How about something like this?
<input jwcid="@TextField" class="ognl:textClass" ... />
java:
public String getTextClass()
{
return "redtitle";
}
----- Original Message -----
From: "Patrick Casey" <[EMAIL PROTECTED]>
To: "'Tapestry users'" <[email protected]>
Sent: Wednesday, June 01, 2005 9:52 PM
Subject: Manipulating existing components via java code
>
> I have a component on my form:
>
> <input type="text" jwcid="@TextField" value="ognl:object.login"
> size="30"/>
>
> I have some java code that runs on a button handler:
>
> Public void edit(IRequestCycle cycle) {
> If (some complicated server side processing) {
> // give the field a color code based on the result
> of the processing
> // this gets the field (or seems to)
> Map m = this.getPage().getComponents();
> Iterator it = m.values().iterator();
> while (it.hasNext()) {
> Object o = it.next();
> if (o instanceof IComponent) {
> IComponent c = (IComponent) o;
> // reload the component to get a
> modifiable version
> c =
> getPage().getComponent(c.getId());
> // snipped out some more processing
> to make sure I'm on the right widget
> // ok, now how to make it red?
> c.setProperty("class", "red"); //
> exception
>
>
> }
> }
> }
> }
>
> How the heck do I make the component red? I can make it red on the
> page definition with:
>
> <input type="text" jwcid="@TextField" value="ognl:object.login"
> class="red" size="30"/>
>
> But I can't seem to find a way for my java code to set the class
> programmatically. Is there a way I can do this?
>
> --- pat
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]