Lance,

I've been using, for example:

@Inject @Path("context:/data/filename.gexf")
@Property
private Asset file;

And then I pass this to the JS function:

String ret= file.getResource().getPath();

It's working fine...but is toClientURL() the preferred method?




On Mon, Jul 8, 2013 at 4:44 AM, Lance Java <lance.j...@googlemail.com>wrote:

> I think you want to @Inject the AssetSource to lookup the Asset. You can
> then call Asset.toClientUrl() to get an href for the asset which you can
> pass to your js library to use.
> On 4 Jul 2013 23:32, "George Ludwig" <georgelud...@gmail.com> wrote:
>
> > Thiago,
> >
> > You're definitely right, it's now a JS issue. I figured out that somehow
> I
> > had downloaded a garbled sigma.parseGexf.js file, which was part of the
> > problem.
> >
> > Quick javascript question: when I pass the filename for parsing to the
> gexf
> > parser, I currently pass it with relationship to the webapp root...but
> > since it still does not render (and everything else looks good right
> now),
> > I'm assuming that I the JS needs a fully qualified local path.
> >
> > Thanks again for your input...
> >
> > -George
> >
> >
> > On Thu, Jul 4, 2013 at 4:22 AM, Thiago H de Paula Figueiredo <
> > thiag...@gmail.com> wrote:
> >
> > > Uncaught SyntaxError: Unexpected token < sigma.parseGexf.js:3
> > >> Uncaught TypeError: Object #<m> has no method 'parseGexf'
> > tap5-sigma.js:24
> > >>
> > >
> > > Are you sure sigma.parseGexf.js is correct? What's in line 24 of
> > > tap5-sigma.js? Anyway, it seems that now this error is completely about
> > > Sigma and JavaScript and not about Tapestry itself. What Tapestry
> version
> > > are you using? JavaScript minification is enabled?
> > >
> > >
> > > On Thu, 04 Jul 2013 01:36:04 -0300, George Ludwig <
> > georgelud...@gmail.com>
> > > wrote:
> > >
> > >  I'm at a point where it seems to me that it really should be working,
> > yet
> > >> I
> > >> get this error in the javascript console:
> > >>
> > >>
> > >> The method it can't find, parseGexf, is in the file
> sigma.parseGexf.js,
> > >> and
> > >> I've included it in the component's java file:
> > >>
> > >> @Import(library={"classpath:**com/intuit/tapestry5/sigmajs/**
> > >> asset/sigma.min.js",
> > >>
>  "classpath:com/intuit/**tapestry5/sigmajs/asset/sigma.**parseGexf.js",
> > >>  "classpath:com/intuit/**tapestry5/sigmajs/asset/tap5-**sigma.js"})
> > >>
> > >>
> > >> Here is the complete javascript file that is being executed in order
> to
> > do
> > >> the initialization:
> > >>
> > >> var sigmajs = Class.create();
> > >> sigmajs.prototype = {
> > >> initialize : function(id, gexfFile) {
> > >>  // Instantiate sigma.js and customize rendering
> > >> var sigInst = sigma.init(document.**getElementById(id)).**
> > >> drawingProperties({
> > >>  <<--- no error is thrown here
> > >> defaultLabelColor : '#fff',
> > >> defaultLabelSize : 14,
> > >> defaultLabelBGColor : '#fff',
> > >> defaultLabelHoverColor : '#000',
> > >> labelThreshold : 6,
> > >> defaultEdgeType : 'curve'
> > >> }).graphProperties({
> > >> minNodeSize : 0.5,
> > >> maxNodeSize : 5,
> > >> minEdgeSize : 1,
> > >> maxEdgeSize : 1
> > >> }).mouseProperties({
> > >> maxRatio : 32
> > >> });
> > >>
> > >> // Parse a GEXF encoded file to fill the graph
> > >> sigInst.parseGexf(gexfFile);                     <<--- error is thrown
> > >> here
> > >>
> > >> // Draw the graph :
> > >> sigInst.draw();
> > >> }
> > >> }
> > >>
> > >> This seems to be a load order issue, yet I tried swapping the order of
> > >> declaration of sigma.parseGexf.js and sigma.min.js, with the same
> > result.
> > >>
> > >> Any thoughts?
> > >>
> > >> -George
> > >>
> > >>
> > >> On Tue, Jul 2, 2013 at 5:43 PM, George Ludwig <georgelud...@gmail.com
> > >> >wrote:
> > >>
> > >>  Cool, thanks a lot!
> > >>>
> > >>>
> > >>> On Tue, Jul 2, 2013 at 3:50 PM, Thiago H de Paula Figueiredo <
> > >>> thiag...@gmail.com> wrote:
> > >>>
> > >>>  On Tue, 02 Jul 2013 19:47:14 -0300, George Ludwig <
> > >>>> georgelud...@gmail.com>
> > >>>> wrote:
> > >>>>
> > >>>>  I think I got it...so to initialize my graph I need to pas it a
> file
> > >>>>
> > >>>>> name...is it most appropriate to use JavaScriptSupport.**
> > >>>>>
> > >>>>> addInitializerCall()
> > >>>>> so that the name of the file can be pulled from the @parameter of
> the
> > >>>>> component?
> > >>>>>
> > >>>>>
> > >>>> For the parameter, it will make no difference. Regardless of using
> > >>>> addScript() or addInitializerCall() you'll need to pass the file
> name
> > in
> > >>>> the parameters of these methods. As you've never did this before,
> use
> > >>>> addScript(), which is easier.
> > >>>>
> > >>>>
> > >>>> --
> > >>>> Thiago H. de Paula Figueiredo
> > >>>>
> > >>>> ------------------------------****----------------------------**
> > >>>> --**---------
> > >>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.**a**pache.org<
> > http://apache.org>
> > >>>> <users-unsubscribe@**tapestry.apache.org<
> > users-unsubscr...@tapestry.apache.org>
> > >>>> >
> > >>>>
> > >>>> For additional commands, e-mail: users-h...@tapestry.apache.org
> > >>>>
> > >>>>
> > >>>>
> > >>>
> > >
> > > --
> > > Thiago H. de Paula Figueiredo
> > >
> > >
> ------------------------------**------------------------------**---------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<
> > users-unsubscr...@tapestry.apache.org>
> > > For additional commands, e-mail: users-h...@tapestry.apache.org
> > >
> > >
> >
>

Reply via email to