You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Régis Legrand <le...@gmail.com> on 2014/07/07 16:19:14 UTC

tapestry5-d3 - d3 integration

Hi to all,

We (got5) have released a new tapestry module project, tapestry5-d3,
available here:
https://github.com/got5/tapestry5-d3

Its aim is to allow to develop tapestry components based on d3js.
Feel free to give us your advices/remarks.


Regards,
Régis.

Re: tapestry5-d3 - d3 integration

Posted by Michael Gentry <mg...@masslight.net>.
Hi Régis,

Sorry, the repository is our private/internal, but there really isn't much
more to show, either (that is general-purpose).  What I included is all of
the setup we needed to include (RequireJS) and use D3 with an AJAX
callback.  The onAjax() method just packages up some JSON (from database
queries) for the CoffeeScript success handler to process.

mrg



On Tue, Jul 8, 2014 at 4:17 AM, Régis Legrand <le...@gmail.com>
wrote:

> Hello Michael,
>
> Yes it seems to be interesting. Do you have a repo in order to compare with
> our implementation in order to get the best of both? ;-)
>
>
> Régis.
>
>
> 2014-07-07 18:12 GMT+02:00 Michael Gentry <mg...@masslight.net>:
>
> > Hi Régis (and others),
> >
> > We just did a simple D3 integration into our Tapestry 5.4 Beta 6
> > application and with RequireJS/jQuery/etc being provided by Tapestry now
> it
> > seems a pretty simple integration.
> >
> > For our Java class (with stuff removed to just show invoking the module):
> >
> > @Import(stylesheet = { "css/large-expenditures.less" } )
> >
> > public class LargestExpenditures
> >
> > {
> >
> >     @Inject
> >
> >     private JavaScriptSupport javaScriptSupport;
> >
> >
> >     @Inject
> >
> >     private ComponentResources resources;
> >
> >
> >     public void afterRender()
> >
> >     {
> >
> >         String url = resources.createEventLink("ajax").toAbsoluteURI();
> >
> >
> >         javaScriptSupport.require("reports/LargestExpenditures").invoke(
> > "initialize").with(url);
> >
> >     }
> >
> >
> >     JSONObject onAjax()
> >
> >     {
> >
> >         JSONObject json = new JSONObject();
> >
> >         // Build up JSON...
> >
> >         return json;
> >
> >     }
> >
> > }
> >
> > For
> src/main/resources/META-INF/modules/reports/LargestExpenditures.coffee,
> > we just have it import/require the D3 JS, which we stored under
> > src/main/resources/META-INF/modules/d3 as d3.js and d3.min.js (in case we
> > need to debug via the non-minified in the future).  The CoffeeScript,
> again
> > with stuff removed to show the basics:
> >
> > define ["jquery", "underscore", "t5/core/ajax", "d3/d3.min"],
> >     ($, _, ajax, d3) ->
> >         initialize = (url) ->
> >             # D3 setup...
> >
> >             # Invoke T5 AJAX Handler...
> >             ajax url,
> >                 success: (response) =>
> >                     # Handle response...
> >
> >         # Exports
> >         { initialize }
> >
> > In your 'initialize' function, have it call all the d3 goodies and fetch
> > the data, etc.  T5.4 invokes 'initialize' in afterRender().
> >
> > mrg
> >
> >
> >
> > On Mon, Jul 7, 2014 at 10:19 AM, Régis Legrand <le...@gmail.com>
> > wrote:
> >
> > > Hi to all,
> > >
> > > We (got5) have released a new tapestry module project, tapestry5-d3,
> > > available here:
> > > https://github.com/got5/tapestry5-d3
> > >
> > > Its aim is to allow to develop tapestry components based on d3js.
> > > Feel free to give us your advices/remarks.
> > >
> > >
> > > Regards,
> > > Régis.
> > >
> >
>

Re: tapestry5-d3 - d3 integration

Posted by Régis Legrand <le...@gmail.com>.
Hello Michael,

Yes it seems to be interesting. Do you have a repo in order to compare with
our implementation in order to get the best of both? ;-)


Régis.


2014-07-07 18:12 GMT+02:00 Michael Gentry <mg...@masslight.net>:

> Hi Régis (and others),
>
> We just did a simple D3 integration into our Tapestry 5.4 Beta 6
> application and with RequireJS/jQuery/etc being provided by Tapestry now it
> seems a pretty simple integration.
>
> For our Java class (with stuff removed to just show invoking the module):
>
> @Import(stylesheet = { "css/large-expenditures.less" } )
>
> public class LargestExpenditures
>
> {
>
>     @Inject
>
>     private JavaScriptSupport javaScriptSupport;
>
>
>     @Inject
>
>     private ComponentResources resources;
>
>
>     public void afterRender()
>
>     {
>
>         String url = resources.createEventLink("ajax").toAbsoluteURI();
>
>
>         javaScriptSupport.require("reports/LargestExpenditures").invoke(
> "initialize").with(url);
>
>     }
>
>
>     JSONObject onAjax()
>
>     {
>
>         JSONObject json = new JSONObject();
>
>         // Build up JSON...
>
>         return json;
>
>     }
>
> }
>
> For src/main/resources/META-INF/modules/reports/LargestExpenditures.coffee,
> we just have it import/require the D3 JS, which we stored under
> src/main/resources/META-INF/modules/d3 as d3.js and d3.min.js (in case we
> need to debug via the non-minified in the future).  The CoffeeScript, again
> with stuff removed to show the basics:
>
> define ["jquery", "underscore", "t5/core/ajax", "d3/d3.min"],
>     ($, _, ajax, d3) ->
>         initialize = (url) ->
>             # D3 setup...
>
>             # Invoke T5 AJAX Handler...
>             ajax url,
>                 success: (response) =>
>                     # Handle response...
>
>         # Exports
>         { initialize }
>
> In your 'initialize' function, have it call all the d3 goodies and fetch
> the data, etc.  T5.4 invokes 'initialize' in afterRender().
>
> mrg
>
>
>
> On Mon, Jul 7, 2014 at 10:19 AM, Régis Legrand <le...@gmail.com>
> wrote:
>
> > Hi to all,
> >
> > We (got5) have released a new tapestry module project, tapestry5-d3,
> > available here:
> > https://github.com/got5/tapestry5-d3
> >
> > Its aim is to allow to develop tapestry components based on d3js.
> > Feel free to give us your advices/remarks.
> >
> >
> > Regards,
> > Régis.
> >
>

Re: tapestry5-d3 - d3 integration

Posted by Michael Gentry <mg...@masslight.net>.
Hi Régis (and others),

We just did a simple D3 integration into our Tapestry 5.4 Beta 6
application and with RequireJS/jQuery/etc being provided by Tapestry now it
seems a pretty simple integration.

For our Java class (with stuff removed to just show invoking the module):

@Import(stylesheet = { "css/large-expenditures.less" } )

public class LargestExpenditures

{

    @Inject

    private JavaScriptSupport javaScriptSupport;


    @Inject

    private ComponentResources resources;


    public void afterRender()

    {

        String url = resources.createEventLink("ajax").toAbsoluteURI();


        javaScriptSupport.require("reports/LargestExpenditures").invoke(
"initialize").with(url);

    }


    JSONObject onAjax()

    {

        JSONObject json = new JSONObject();

        // Build up JSON...

        return json;

    }

}

For src/main/resources/META-INF/modules/reports/LargestExpenditures.coffee,
we just have it import/require the D3 JS, which we stored under
src/main/resources/META-INF/modules/d3 as d3.js and d3.min.js (in case we
need to debug via the non-minified in the future).  The CoffeeScript, again
with stuff removed to show the basics:

define ["jquery", "underscore", "t5/core/ajax", "d3/d3.min"],
    ($, _, ajax, d3) ->
        initialize = (url) ->
            # D3 setup...

            # Invoke T5 AJAX Handler...
            ajax url,
                success: (response) =>
                    # Handle response...

        # Exports
        { initialize }

In your 'initialize' function, have it call all the d3 goodies and fetch
the data, etc.  T5.4 invokes 'initialize' in afterRender().

mrg



On Mon, Jul 7, 2014 at 10:19 AM, Régis Legrand <le...@gmail.com>
wrote:

> Hi to all,
>
> We (got5) have released a new tapestry module project, tapestry5-d3,
> available here:
> https://github.com/got5/tapestry5-d3
>
> Its aim is to allow to develop tapestry components based on d3js.
> Feel free to give us your advices/remarks.
>
>
> Regards,
> Régis.
>

Re: tapestry5-d3 - d3 integration

Posted by Régis Legrand <le...@gmail.com>.
Hello Thiago,

You're right, we did the correction.

Thanks for your remark,
Régis.


2014-07-07 22:30 GMT+02:00 Thiago H de Paula Figueiredo <th...@gmail.com>
:

> On Mon, 07 Jul 2014 11:19:14 -0300, Régis Legrand <le...@gmail.com>
> wrote:
>
>  Hi to all,
>>
>
> Hi!
>
>
>  We (got5) have released a new tapestry module project, tapestry5-d3,
>> available here: https://github.com/got5/tapestry5-d3
>>
>> Its aim is to allow to develop tapestry components based on d3js.
>>
>
> That's great news!
>
>
>  Feel free to give us your advices/remarks.
>>
>
> I have one already. :P The abstract classes in
> org.got5.tapestry5.jquery.d3.components should be in
> org.got5.tapestry5.jquery.d3.base, as any other abstract page, component
> or mixin.
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: tapestry5-d3 - d3 integration

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Mon, 07 Jul 2014 11:19:14 -0300, Régis Legrand  
<le...@gmail.com> wrote:

> Hi to all,

Hi!

> We (got5) have released a new tapestry module project, tapestry5-d3,
> available here: https://github.com/got5/tapestry5-d3
>
> Its aim is to allow to develop tapestry components based on d3js.

That's great news!

> Feel free to give us your advices/remarks.

I have one already. :P The abstract classes in  
org.got5.tapestry5.jquery.d3.components should be in  
org.got5.tapestry5.jquery.d3.base, as any other abstract page, component  
or mixin.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org