Re: Javascript templating? Removing java code mixed with js

2010-05-08 Thread nino martinez wael
take a look at inputevents in wicketstuff, it uses the javascript
template james mention..

2010/5/7 Anthony DePalma :
> I recently developed a component that can be added to any form to put
> a character countdown div next to any textarea. Just for some
> background, the component constructor is:
> CharacterCountdownPanel(String id, TextArea textArea, int charLimit).
>
> The textarea is necessary because the countdown panel needs to know
> the id of the generated markup (Although while typing this, I realize
> it might be useful for textfields as well, so that may change). But
> one issue I often encounter with components like these is the need to
> generate highly dynamic javascript, and I really dislike mixing up
> java string concatenation with multiline js functions.
>
> Does anyone do anything to reduce this language mismatch? One idea I
> had was to pull the entire javascript function into its own file, and
> use something similar to Wicket's property file handling, and have a
> model pull all the dynamic values into the script. I could use a
> regular property file, but I don't know if it makes sense to put the
> entire js function as a single property in one giant line. Any
> suggestions?
>
> -
> 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 templating? Removing java code mixed with js

2010-05-07 Thread James Carman
Did you look at the JavaScriptTemplate class?

On Fri, May 7, 2010 at 2:31 PM, Anthony DePalma  wrote:
> I recently developed a component that can be added to any form to put
> a character countdown div next to any textarea. Just for some
> background, the component constructor is:
> CharacterCountdownPanel(String id, TextArea textArea, int charLimit).
>
> The textarea is necessary because the countdown panel needs to know
> the id of the generated markup (Although while typing this, I realize
> it might be useful for textfields as well, so that may change). But
> one issue I often encounter with components like these is the need to
> generate highly dynamic javascript, and I really dislike mixing up
> java string concatenation with multiline js functions.
>
> Does anyone do anything to reduce this language mismatch? One idea I
> had was to pull the entire javascript function into its own file, and
> use something similar to Wicket's property file handling, and have a
> model pull all the dynamic values into the script. I could use a
> regular property file, but I don't know if it makes sense to put the
> entire js function as a single property in one giant line. Any
> suggestions?
>
> -
> 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 templating? Removing java code mixed with js

2010-05-07 Thread Anthony DePalma
I recently developed a component that can be added to any form to put
a character countdown div next to any textarea. Just for some
background, the component constructor is:
CharacterCountdownPanel(String id, TextArea textArea, int charLimit).

The textarea is necessary because the countdown panel needs to know
the id of the generated markup (Although while typing this, I realize
it might be useful for textfields as well, so that may change). But
one issue I often encounter with components like these is the need to
generate highly dynamic javascript, and I really dislike mixing up
java string concatenation with multiline js functions.

Does anyone do anything to reduce this language mismatch? One idea I
had was to pull the entire javascript function into its own file, and
use something similar to Wicket's property file handling, and have a
model pull all the dynamic values into the script. I could use a
regular property file, but I don't know if it makes sense to put the
entire js function as a single property in one giant line. Any
suggestions?

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