myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Lessard" <simon.lessar...@gmail.com>
Subject Re: Why is the styleClass Property always overridden?
Date Mon, 03 Mar 2008 18:53:01 GMT
Hello Thomas,

why don't you simply use <tr:inputText styleClass="myClass"/>? If the class
changes at runtime you can use <tr:inputText styleClass="#{bean.myClass}"/>
or programatically:

<tr:inputText binding="#{bean.input}"/>

CoreInputText input;

public CoreInputText getInput()
{
  return input;
}

public void setInput(CoreInputText input)
{
  this.input = input;
  this.input.setStyleClass("myClass");
}


Regards,

~ Simon

On Mon, Mar 3, 2008 at 1:39 PM, <thomas.asel@mvv.de> wrote:

>
> Hi everybody,
> Im stuck with a problem and may need a little help to get through.
> Basically all I want to do is to add the name of a CSS-class
> programmatically to the styleClass attribute so that somithing like this is
> rendered in HTML:
>
> <input id="myText" class="af_inputText_content myClass" ...>
> The 'myClass' should be added to the class inserted by the
> skinning-renderer of Trinidad.
>
> Even the very basic approach of using the styleClass Attribute of
> <tr:inputText> does not work as only af_inputText_content is inserted as
> value for the class attribute.
>
> Manipulating the componentes attribute map works for
> JSF-Standard-Components but not for Trinidad-Components.
> This is what my code looks like:
>                                 Map<String, Object> attributes =
> component.getAttributes();
>                                 String styleClass = (String)
> attributes.get("styleClass");
>                                 // Append myClass to whatever is set as
> styleClass
>                                 attributes.put("styleClass", styleClass +
> " myClass");
>
> Do I have to use the acesBean for Trinidad-Components? If so, how can the
> styleClass-attribute be accessed?
>
> Thanks in advance,
> Tom
>
>
>
>
> Thomas Asel
> Diplom Informatiker (FH)
> Selbständiger Softwareentwickler
> im Auftrag der 24/7 IT-Services GmbH
>
> == == == == == == == == == == == ==
> ***www.thomas-asel.de*
> J2EE und Contentmanagement-Lösungen
> L13,7 68161 Mannheim
> Tel.: +49 (0) 621 / 386 448 3
> Mobil: +49(0) 176 / 219 284 26
> USt-IdNr.: DE248123620
>

Mime
View raw message