http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-stuff-contrib-input-events

essentially its this which are interesting:

private String generateString(TextTemplate textTemplate) {
       // variables for the initialization script
       Map<String, String> variables = new HashMap<String, String>();
       variables.put("disable_in_input", getDisable_in_input().toString());
       variables.put("type", getType().toString());
       variables.put("propagate", getPropagate().toString());
       variables.put("target", getTarget());

       textTemplate.interpolate(variables);
       return textTemplate.asString();

   }

in your case the text template could look like this:

   private final TextTemplate css = new PackagedTextTemplate(
           InputBehavior.class, "mystyle.css");

you notate in your text file like this:

 input {
   color:${color};
}

Basicly you have a textfile and a map, when you interpolate the values the are replaced by what are inside your map... Ask if you have questions..:)

regards Nino

Eric Rotick wrote:
Where can I find out more about this approach?

On Sat, Mar 29, 2008 at 2:07 PM, Nino Saturnino Martinez Vazquez Wael <
[EMAIL PROTECTED]> wrote:

if you need to do it dynamicly, you could "just" use the
textressourcetemplate approach, something similar what I've done with
the js in wicket input events (I stole the idea from the datepicker)..


regards Nino

Eric Rotick wrote:
I have a requirement to allow users to change such things as colour,
font
etc. for certain markup. Currently this is all 'wrapped' by CSS
ids/classes
but the use of varying ids/classes seems wrong.

The use case if for engineers viewing data from sensors. Some engineers
require values below a certain value to be highlighted whereas other
engineers want values above a certain value to be highlighted. The
highlighting might means changing the font to bold, the background
colour to
yellow, the foreground colour to red and the surrounding box to double
lines. I could have CSS classes of highlight1, highlight2 etc but read
on.
In essence the markup is exactly the same but for the highlighting rules
so
having a number of sub classed pages is not correct. In addition, the
rules
at which something may change might change at run time. For example, one
particular engineer may be monitoring a system where a value is
highlighted
if it goes outside of a range and another highlight if the erroneous
value
has been out of range for an extended time period. Basically, each
engineer
can choose their own colour scheme. Also, for very complex situations an
engineer would be overloaded by too much information. In these cases
they
dim down the non important data so that the important data becomes more
prominent.

OK, I could define a bigger set of CSS classes for each situation but
each
engineer has a different way of solving the viewing problem and the
current
system (not web based) does what they want.

So, I think the solution lies in the dynamic generation of the CSS at
run
time from the database. I then thought I would create a small servlet to
handle this but then, I already have Wicket running, maybe I should sub
class Page and make a CssPage class. I need to have a pop at doing this
in
the future anyway for WML so the research would not be wasted.

I was wondering if anyone had any experience or advice before I look
into
this in more detail.

Eric.


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to