Re: Javascript template as linked header contribution?

2010-05-18 Thread Ralf Eichinger
Finally I made it working after finding this WIKI entry:
https://cwiki.apache.org/WICKET/dynamically-generate-a-css-stylesheet.html

Just used it the same way for Javascript file.

Igor: This very useful class should be integrated into Wicket core!
(under org.apache.wicket.markup.html.resources)

Am Montag, den 19.04.2010, 17:52 -0700 schrieb Igor Vaynberg:
 i meant you have to create the classes...
 
 -igor
 
 On Mon, Apr 19, 2010 at 4:10 PM, Ralf Eichinger
 ralf.eichin...@pixotec.de wrote:
  Am Montag, den 19.04.2010, 09:08 -0700 schrieb Igor Vaynberg:
  you will have to create a TextTemplateResource to serve such resources
  and a TextTemplateResourceReference to create urls for them.
 
  -igor
 
  as there are no TextTemplateResource and TextTemplateResourceReference
  classes in Wicket 1.4.7, I tried this:
 
  PackagedTextTemplate jsTemplate = new
   PackagedTextTemplate(this.getClass(), js/lightbox.js);
 
  TextTemplateSharedResourceFactory ttsr = new
   TextTemplateSharedResourceFactory(jsTemplate, this.getClass());
 
  String webappContext = WebApplication.get().getServletContext()
   .getContextPath();
 
  MapString, Object parameters = new HashMapString, Object();
  parameters.put(webappContext, webappContext);
  TextTemplateLink ref = new TextTemplateLink(lightbox, ttsr,
   parameters);
  add(ref);
 
  and in panels html:
 
  wicket:head
  script wicket:id=lightbox src=# language=JavaScript/script
  /wicket:head
 
  this resulted in a rendered URL (that looks weired):
 
  script wicket:id=lightbox src=resources/LightBox2Panel/%2fnetcms
  language=JavaScript/script
 
  And this link returns a 404 error...
 
  So what's wrong?
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Javascript template as linked header contribution?

2010-05-18 Thread Igor Vaynberg
jira issue or this request never happened :)

-igor

On Tue, May 18, 2010 at 12:07 AM, Ralf Eichinger
ralf.eichin...@pixotec.de wrote:
 Finally I made it working after finding this WIKI entry:
 https://cwiki.apache.org/WICKET/dynamically-generate-a-css-stylesheet.html

 Just used it the same way for Javascript file.

 Igor: This very useful class should be integrated into Wicket core!
 (under org.apache.wicket.markup.html.resources)

 Am Montag, den 19.04.2010, 17:52 -0700 schrieb Igor Vaynberg:
 i meant you have to create the classes...

 -igor

 On Mon, Apr 19, 2010 at 4:10 PM, Ralf Eichinger
 ralf.eichin...@pixotec.de wrote:
  Am Montag, den 19.04.2010, 09:08 -0700 schrieb Igor Vaynberg:
  you will have to create a TextTemplateResource to serve such resources
  and a TextTemplateResourceReference to create urls for them.
 
  -igor
 
  as there are no TextTemplateResource and TextTemplateResourceReference
  classes in Wicket 1.4.7, I tried this:
 
  PackagedTextTemplate jsTemplate = new
   PackagedTextTemplate(this.getClass(), js/lightbox.js);
 
  TextTemplateSharedResourceFactory ttsr = new
   TextTemplateSharedResourceFactory(jsTemplate, this.getClass());
 
  String webappContext = WebApplication.get().getServletContext()
   .getContextPath();
 
  MapString, Object parameters = new HashMapString, Object();
  parameters.put(webappContext, webappContext);
  TextTemplateLink ref = new TextTemplateLink(lightbox, ttsr,
   parameters);
  add(ref);
 
  and in panels html:
 
  wicket:head
  script wicket:id=lightbox src=# language=JavaScript/script
  /wicket:head
 
  this resulted in a rendered URL (that looks weired):
 
  script wicket:id=lightbox src=resources/LightBox2Panel/%2fnetcms
  language=JavaScript/script
 
  And this link returns a 404 error...
 
  So what's wrong?
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Javascript template as linked header contribution?

2010-04-19 Thread Igor Vaynberg
you will have to create a TextTemplateResource to serve such resources
and a TextTemplateResourceReference to create urls for them.

-igor

On Sun, Apr 18, 2010 at 8:25 PM, Ralf Eichinger
ralf.eichin...@pixotec.de wrote:
 How to change

 add(JavascriptPackageResource.getHeaderContribution(this.getClass(),
  js/lightbox.js));

 so that variables inside lightbox.js are replace on delivery?

 I tried something like this:

 PackagedTextTemplate jsTemplate = new PackagedTextTemplate(this
                                .getClass(), js/lightbox.js);
 TextTemplateSharedResourceFactory resourceReference = new
 TextTemplateSharedResourceFactory(jsTemplate, this.getClass());

 String webappContext = WebApplication.get().getServletContext()
                                .getContextPath();
 MapString, Object parameters = new HashMapString, Object();
 parameters.put(webappContext, webappContext);
 TextTemplateLink ref = new TextTemplateLink(, resourceReference,
                                parameters);
 ??? what to do with link ???

 or when I try

 ...
 add(TextTemplateHeaderContributor.forJavaScript(jsTemplate, new
 Model((Serializable) parameters)));

 the content is rendered into head, what I do not want.
 I just want a header contribution to a parsed template like this:
 script type=text/javascript src=.../script

 Any ideas?


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Javascript template as linked header contribution?

2010-04-19 Thread Ralf Eichinger
Am Montag, den 19.04.2010, 09:08 -0700 schrieb Igor Vaynberg:
 you will have to create a TextTemplateResource to serve such resources
 and a TextTemplateResourceReference to create urls for them.
 
 -igor

as there are no TextTemplateResource and TextTemplateResourceReference
classes in Wicket 1.4.7, I tried this:

PackagedTextTemplate jsTemplate = new   
  PackagedTextTemplate(this.getClass(), js/lightbox.js);

TextTemplateSharedResourceFactory ttsr = new
  TextTemplateSharedResourceFactory(jsTemplate, this.getClass());

String webappContext = WebApplication.get().getServletContext()
  .getContextPath();

MapString, Object parameters = new HashMapString, Object();
parameters.put(webappContext, webappContext);
TextTemplateLink ref = new TextTemplateLink(lightbox, ttsr,
  parameters);
add(ref);

and in panels html:

wicket:head
script wicket:id=lightbox src=# language=JavaScript/script
/wicket:head

this resulted in a rendered URL (that looks weired):

script wicket:id=lightbox src=resources/LightBox2Panel/%2fnetcms
language=JavaScript/script

And this link returns a 404 error...

So what's wrong?



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Javascript template as linked header contribution?

2010-04-19 Thread Igor Vaynberg
i meant you have to create the classes...

-igor

On Mon, Apr 19, 2010 at 4:10 PM, Ralf Eichinger
ralf.eichin...@pixotec.de wrote:
 Am Montag, den 19.04.2010, 09:08 -0700 schrieb Igor Vaynberg:
 you will have to create a TextTemplateResource to serve such resources
 and a TextTemplateResourceReference to create urls for them.

 -igor

 as there are no TextTemplateResource and TextTemplateResourceReference
 classes in Wicket 1.4.7, I tried this:

 PackagedTextTemplate jsTemplate = new
  PackagedTextTemplate(this.getClass(), js/lightbox.js);

 TextTemplateSharedResourceFactory ttsr = new
  TextTemplateSharedResourceFactory(jsTemplate, this.getClass());

 String webappContext = WebApplication.get().getServletContext()
  .getContextPath();

 MapString, Object parameters = new HashMapString, Object();
 parameters.put(webappContext, webappContext);
 TextTemplateLink ref = new TextTemplateLink(lightbox, ttsr,
  parameters);
 add(ref);

 and in panels html:

 wicket:head
 script wicket:id=lightbox src=# language=JavaScript/script
 /wicket:head

 this resulted in a rendered URL (that looks weired):

 script wicket:id=lightbox src=resources/LightBox2Panel/%2fnetcms
 language=JavaScript/script

 And this link returns a 404 error...

 So what's wrong?



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Javascript template as linked header contribution?

2010-04-18 Thread Ralf Eichinger
How to change

add(JavascriptPackageResource.getHeaderContribution(this.getClass(),
  js/lightbox.js));

so that variables inside lightbox.js are replace on delivery?

I tried something like this:

PackagedTextTemplate jsTemplate = new PackagedTextTemplate(this
.getClass(), js/lightbox.js);
TextTemplateSharedResourceFactory resourceReference = new
TextTemplateSharedResourceFactory(jsTemplate, this.getClass());

String webappContext = WebApplication.get().getServletContext()
.getContextPath();
MapString, Object parameters = new HashMapString, Object();
parameters.put(webappContext, webappContext);
TextTemplateLink ref = new TextTemplateLink(, resourceReference,
parameters);
??? what to do with link ???

or when I try

...
add(TextTemplateHeaderContributor.forJavaScript(jsTemplate, new
Model((Serializable) parameters)));

the content is rendered into head, what I do not want.
I just want a header contribution to a parsed template like this:
script type=text/javascript src=.../script

Any ideas?


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org