myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: Why is the styleClass Property always overridden?
Date Tue, 04 Mar 2008 09:51:05 GMT
Sorry, sent the mail instead of pasting my code, seems like I'm getting mad on this ;-)
if(component instanceof UIXComponentBase) {
    UIXComponentBase trinidadComponent = (UIXComponentBase) component;
    ((FacesBean) trinidadComponent.getFacesBean()).setProperty(PropertyKey.createPropertyKey("styleClass"),



Von: Simon Lessard [] 
Gesendet: Montag, 3. März 2008 19:58
An: MyFaces Discussion
Betreff: Re: Why is the styleClass Property always overridden?

Wow... really not my day... there's no such attribute... only contentStyle... I always create
it when I make custom components... oh well... JIRA ticket time...

On Mon, Mar 3, 2008 at 1:56 PM, Simon Lessard <> wrote:

	Oups, I misread something. You need to use the contentStyleClass attribute to affect the
input's style class, the styleClass attribute applies the class on the input container. 

	On Mon, Mar 3, 2008 at 1:53 PM, Simon Lessard <> wrote:

		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;
		~ Simon 

		On Mon, Mar 3, 2008 at 1:39 PM, <> 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
			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, 

			Thomas Asel 
			Diplom Informatiker (FH) 
			Selbständiger Softwareentwickler 
			im Auftrag der 24/7 IT-Services GmbH 

			== == == == == == == == == == == == 
			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 

View raw message