incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Koci <Martin.K...@aura.cz>
Subject Re: Emphasize important fields with skin
Date Mon, 25 Sep 2006 10:34:05 GMT
I was unaccurate in my question. 
The problem is that class="style1 style2" cannot use compression of
class names (output is "style1 style2") but "style1" can (output is
"x1n"). Here is how I changed method
FormInputRenderer.renderRootDomElementStyles(FacesContext,RenderingContext, UIComponent, FacesBean)
:

 // get the style classes that I want to render on the root dom element
here.  
    String styleClass         = getStyleClass(bean);
    String contentStyleClass  = getRootStyleClass(bean);
    String disabledStyleClass = null;
    String readOnlyStyleClass = null;
    String requiredStyleClass = null;
   
    // Here we split user supplied style classes to string array
    String[] styleClasses = styleClass.split(" ");
    
    // readOnly takes precedence over disabled for the state.  
    // -= Simon =- Why?
    if(getReadOnly(context, bean))
    {
      readOnlyStyleClass = SkinSelectors.STATE_READ_ONLY;
    }
    else if (getDisabled(bean))
    {
      disabledStyleClass = SkinSelectors.STATE_DISABLED;
    }
   
    if(_isConsideredRequired(bean))
    {
      requiredStyleClass = SkinSelectors.STATE_REQUIRED;
    }
   
    String[] strings = new String[4 + styleClasses.length];
    
    strings[0] = contentStyleClass;
    strings[1] = disabledStyleClass;
    strings[2] = readOnlyStyleClass;
    strings[3] = requiredStyleClass;
    
	// we append user styles to the end of array
    for (int i = 0; i < styleClasses.length; i++) {
		String style = styleClasses[i];
		strings[4 + i] = style;
	}
    
	renderStyleClasses(context, arc, strings);
    
    renderInlineStyle(context, arc, bean);  


Simon Lessard píše v Út 19. 09. 2006 v 11:25 -0400:
> Hello Martin,
> 
> I don't think it is the problem. I believe the problem is actually located
> in the interaction between panelFormLayout and inputComponents. Output
> "otherStyleClass styleImportant x1a" is correct, it mean that the element
> has three classes: "otherStyleClass", "styleImportant" and "x1a". In HTML
> the semantic is a bit different from what it's in a CSS file.
> 
> CSS
> .class1 .class2 {...}
> 
> is matching
> HTML
> <element class="class1">
>   <element class="class2"/>
> </element>.
> 
> On the other hand,
> <element class="class1 class2">
> 
> would match the following CSS selectors:
> CSS
> .class1{...}
> .class2{...}
> .class1.class2{...} // Notice there's no space between the classes, this is
> a CSS 2 (not valid in CSS 1) composite selector and it won't work in IE
> because IE is stupid.
> 
> The possible issue I see however is on which DOM element it gets placed and
> I'm working on this issue currently as it's blocking on of my patches.
> 
> 
> Regards,
> 
> ~ Simon
> 
> 
> On 9/19/06, Martin Koci <Martin.Koci@aura.cz> wrote:
> >
> > Hello again,
> >
> > I resume my requirements:
> >
> > 1) use trinidad skin framework as much as possible
> > 2) all explicitly reffered CSS styles are in skins files and will switch
> > with skin (as 'styleImportant' here in my case)
> > 3) allow to use more CSS style class in styleClass attribute
> >
> > with  solution:
> > <tr:inputText ... styleClass="styleImportant" />
> >
> > it works ok, output is somethink like "x1a x1b", styleImportant is
> > correctly compressed to x1a.
> >
> > But if coder uses e.g.
> >
> > <tr:inputText ... styleClass="otherStyleClass styleImportant" />
> > (requirement 3)
> >
> > output is "otherStyleClass styleImportant x1a".
> >
> > Problem is FormInputRenderer.renderRootDomElementStyles:
> >
> > String styleClass         = getStyleClass(bean);
> >
> > returns "otherStyleClass styleImportant" which is not array but String
> > and this value is passed to RendereringContext.getStyleClass. But there
> > is no entry for this  key in _styleMap (there are only entries for
> > "otherStyleClass" and "styleImportant" separately).
> >
> > I think value of styleClass attribute should be parsed to String array
> > to enable users put their CSS style classes into trinidad skins. Is that
> > correct?
> >
> > Regards,
> >
> > Martin
> >
> >
> >
> >
> > Simon Lessard píše v Čt 07. 09. 2006 v 09:13 -0400:
> > > Hmmm try the following then, it might work:
> > >
> > > <tr:inputText ... styleClass="styleImportant" />
> > >
> > > And in the skin:
> > >
> > > .styleImportant af|inputText::content {
> > >   color: #325fa4;
> > >   font-weight: bold;
> > > }
> > >
> > > On 9/7/06, Martin Koci <Martin.Koci@aura.cz> wrote:
> > > >
> > > > Hello Simon,
> > > >
> > > > unfortunately that solution will not work with IE.
> > > >
> > > > In my case I have
> > > > <tr:inputText ...   styleClass="styleImportant" />
> > > >
> > > > where 'styleImportant" is placed in skin file as:
> > > > .styleImportant {
> > > >         color: #325fa4;
> > > >         font-weight: bold;
> > > > }
> > > >
> > > > With Firefox it works because html input inherits (in sence of CSS)
> > font
> > > > size and color. But IE doesn't support CSS inherit for this.
> > > >
> > > > Maybe I'm looking for a way how to place 'importantStyle' to html
> > input
> > > > element rendered with tr:inputText renderer - now it is rendered as
> > > > style class on enclosing span.
> > > >
> > > >
> > > > Thanks
> > > >
> > > > Martin
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Simon Lessard píše v Po 04. 09. 2006 v 13:09 -0400:
> > > > > Hello Martin,
> > > > >
> > > > > You can use a styleClass and place it in the skin's CSS, then it
> > would
> > > > > switch with it.
> > > > >
> > > > >
> > > > > Regards,
> > > > >
> > > > > ~ Simon
> > > > >
> > > > >
> > > > > On 9/3/06, Martin Koci <Martin.Koci@aura.cz> wrote:
> > > > > >
> > > > > > Hello,
> > > > > >
> > > > > > I'm looking for solution how to emphasize some fields on form
with
> > > > > > consistent way with skins.
> > > > > >
> > > > > > My case is simple - users want see some important fields in
> > different
> > > > > > font size or with different font color. This is simply doable
with
> > > > > > inlineStyle or style, but value remains same even user selects
> > other
> > > > > > skin.
> > > > > >
> > > > > > Many thanks,
> > > > > >
> > > > > > Martin
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> >
> >


Mime
View raw message