If you want to write it to a file you can do that too btw...
regards
Nino Saturnino Martinez Vazquez Wael wrote:
You dont have to embed it, you could mount it as a resource... But
still it needs to be generated. However you could cache this, it
totally up to you..
regards Nin
Eric Rotick wrote:
Now I see. I had not discovered these classes!
I was hoping to avoid embedding the CSS within the HTML as this does not
benefit from the size reduction that CSS separation gives. However,
you've
given me another idea. CSS allows for definitions to be overridden
locally
in each page so I could arrange for the differences to be embedded
and leave
the rest in the external CSS file.
Actually, now I think of it, the idea of a 'standard' set would mean
that I
have to manage what is the default and what is the exception which is
currently done in a hierarchical fashion which is pretty slow to
resolve.
The concept is that whenever a user changes anything to do with CSS the
system recreated the file username.css which is then included in each
page
dynamically according to the user. The problem comes in where to
write the
file when in a war deployment situation. I could write it to a
database but
that still means it has to be 'produced' by the servlet engine and so
we are
back to the same question.
Eric.
On Sat, Mar 29, 2008 at 3:37 PM, Nino Saturnino Martinez Vazquez Wael <
[EMAIL PROTECTED]> wrote:
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]
--
-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]