org.apache.myfaces.trinidad.style
Class Styles

java.lang.Object
  extended by org.apache.myfaces.trinidad.style.Styles

public abstract class Styles
extends Object

Styles is a class that contains information about CSS Selectors and their corresponding Style object (i.e., the css properties) for the css selectors that are written to the generated css file. The methods in this class are useful if you need to know in the renderer code what css properties a particular selector has.


Constructor Summary
Styles()
           
 
Method Summary
abstract  String getNativeSelectorString(Selector selector)
          Returns the Selector in String form, converted to a format that is suitable to be written to the client (e.g., a css-2 format that can be read by a browser)
 Set<Selector> getSelectorsForSimpleSelector(String simpleSelector)
          Given a simple selector (as opposed to a complex selector), this method will return a Set of the Selectors that contain the simple selector.
abstract  Map<Selector,Style> getSelectorStyleMap()
          Returns a Map containing the Selector Object as the key and the Style Object as the value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Styles

public Styles()
Method Detail

getSelectorStyleMap

public abstract Map<Selector,Style> getSelectorStyleMap()
Returns a Map containing the Selector Object as the key and the Style Object as the value. The Style object contains all the css property names/values. This Map can then be used to get all the selector keys, or to get the Style Object for a Selector, or to get all the selectors that match some criteria, like they contain a certain simple selector.

Returns:
unmodifiableMap of the resolved Selector -> Style map.

getNativeSelectorString

public abstract String getNativeSelectorString(Selector selector)
Returns the Selector in String form, converted to a format that is suitable to be written to the client (e.g., a css-2 format that can be read by a browser)

Parameters:
selector - Selector
Returns:
String the Selector in a String form that is suitable to be written to the client.

getSelectorsForSimpleSelector

public Set<Selector> getSelectorsForSimpleSelector(String simpleSelector)
Given a simple selector (as opposed to a complex selector), this method will return a Set of the Selectors that contain the simple selector. It calls getSelectorStyleMap() and then looks through each Selector to see if the simple selector is contained within it. If so, it puts it in a Set. The recommended usage is to call this for simple selectors, like "af|inputText" or "af|treeTable" and not selectors like "af|inputText::content".

Parameters:
simpleSelector -
Returns:
an unmodfiable Set<Selector> of all the complete selectors that contain the simple selector.


Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.