Mighty slick, and much appreciated.

On 1/20/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> An example:
>
>                 Map<String, CharSequence> variables = new HashMap<String, 
> CharSequence>(7);
>                 variables.put("javaScriptId", javaScriptId);
>                 variables.put("backGroundElementId", backgroundElementId);
>                 variables.put("imageElementId", imageElementId);
>                 variables.put("leftUp", settings.getLeftUp());
>                 variables.put("rightDown", settings.getRightDown());
>                 variables.put("tick", settings.getTick());
>                 variables.put("formElementId", element.getId());
>
>                 add(TextTemplateHeaderContributor.forJavaScript(Slider.class,
>                                 "init.js", Model.valueOf(variables)));
>
> Where init.js is:
>
> var ${javaScriptId};
> function init${javaScriptId}() {
>    ${javaScriptId} =
> YAHOO.widget.Slider.getHorizSlider("${backGroundElementId}",
> "${imageElementId}", ${leftUp}, ${rightDown}, ${tick});
>    ${javaScriptId}.onChange = function(offsetFromStart) {
>                 document.getElementById("${formElementId}").value = 
> offsetFromStart;
>         }
> }
>
>
> Eelco
>
> On 1/19/07, Scott Swank <[EMAIL PROTECTED]> wrote:
> > Very kind, thank you.  So JavaScriptTemplate defines foo as a
> > document-level object?  Nice.  Much appreciated.
> >
> > Scott
> >
> > On 1/19/07, Nathan Hamblen <[EMAIL PROTECTED]> wrote:
> > > What, you're deciding between Wicket and JSF and no one has answered
> > > your question? Unacceptable!
> > >
> > > JavaScriptTemplate is good for passing variables into Javascript. You
> > > can use a cache buster to make sure it gets loaded each time. So, with
> > > that approach you would have a plain onclick="oldJavaScript(foo);" in
> > > your page template because foo has already been set in the external js
> > > template.
> > >
> > > A quicker and dirtier approach is to use an AttributeModifier for
> > > "onclick" to patch together the full script call during page generation.
> > >  Using an anonymous subclass model: new AbstractReadOnlyModel() { ...
> > > getObject(...) { return "oldJavaScript(" + foo + ");"; }} And so on.
> > >
> > > Nathan
> > >
> > >
> > > > What sort of options are there for embedding simple scalar values into
> > > > an html page, particularly into the parameters of an existing
> > > > javascript method?  I'm looking for something along the lines of:
> > > >
> > > > onclick=oldJavaScript(<wicket:scalar wicket:id="foo"/>);
> > > >
> > > > Which is then rendered as
> > > >
> > > > onclick=oldJavaScript(1234);
> > >
> > >
> > >
> > > -------------------------------------------------------------------------
> > > Take Surveys. Earn Cash. Influence the Future of IT
> > > Join SourceForge.net's Techsay panel and you'll get the chance to share 
> > > your
> > > opinions on IT & business topics through brief surveys - and earn cash
> > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > _______________________________________________
> > > Wicket-user mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> >
> >
> > --
> > Scott Swank
> > reformed mathematician
> >
> > -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share your
> > opinions on IT & business topics through brief surveys - and earn cash
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > _______________________________________________
> > Wicket-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>


-- 
Scott Swank
reformed mathematician

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to