There is a minor advantage to velocity over TextTemplates in that the
velocity engine caches its templates as ASTs, so they only need to be read
in and parsed once (provided caching is turned on and the velocity singleton
is used)

On 11/15/06, Johan Compagner <[EMAIL PROTECTED]> wrote:

what the hack is inefficient on those string concats?
especially the one below that is just one big string? (so run time it
isn't
even concatting??)

Reading in a template looks much more inefficient to me!

johan



On 11/15/06, Jean-Baptiste Quenot <[EMAIL PROTECTED]> wrote:
>
> * [EMAIL PROTECTED]:
> >
> > Log Message:
> > -----------
> > DragAndDrop Orderable listView
> >
> > Modified:
>
trunk/wicket-contrib-dojo/src/main/java/wicket/contrib/dojo/dojodnd/DojoDropContainerHandler.java
> > ===================================================================
> > ---
>
trunk/wicket-contrib-dojo/src/main/java/wicket/contrib/dojo/dojodnd/DojoDropContainerHandler.java
> 2006-11-12 20:04:46 UTC (rev 1116)
> > +++
>
trunk/wicket-contrib-dojo/src/main/java/wicket/contrib/dojo/dojodnd/DojoDropContainerHandler.java
> 2006-11-14 18:26:19 UTC (rev 1117)
> > @@ -59,11 +59,7 @@
> >               toReturn += "   var dl = byId(\"" + container.getId() +
> "\");\n";
> >               toReturn += "   var drop = new dojo.dnd.HtmlDropTarget
(dl,
> [\"" + container.getDropId() + "\"]);\n";
> >               toReturn += "   dojo.event.connect(drop, 'onDrop',
> function(e) {\n";
> > -             toReturn += "           dojo.io.bind({\n";
> > -             toReturn += "                    url: createUrl(e),\n";
> > -             toReturn += "                    mimetype:
> \"text/plain\",\n";
> > -             toReturn += "                    load: function(type,
> data, evt) {}\n";
> > -             toReturn += "           });\n";
> > +             toReturn += "
> dojoUpdate(createUrl(e),function(){},function(){},function(){},'');";
> >               toReturn += "   });\n";
> >               toReturn += "}\n";
> >               toReturn += "dojo.event.connect(dojo, \"loaded\",
> \"initDrop" + container.getMarkupId() + "\");\n";
>
> Hi Vincent,
>
> Great stuff, thanks!
>
> However, in the future we will likely have more and more
> JavaScript code embedded in Java classes.
>
> What do you think if we introduced a dependency from
> wicket-contrib-dojo to wicket-contrib-velocity to be able to use
> Velocity JavaScript templates instead of ugly and inefficient
> String concatenations?
> --
>      Jean-Baptiste Quenot
> aka  John Banana Qwerty
> http://caraldi.com/jbq/
>


Reply via email to