EchoPoint
1.0

echopoint.stylesheet
Interface StyleSheet

All Known Implementing Classes:
CssStyleSheet

public interface StyleSheet

This StyleSheet interface represents a collection of style information that can be applied to a Component and its children.


Method Summary
 void addGroup(StyleSheetGroup styleSheetGroup)
          Deprecated. StyleSheetGroup has been deprecated and will be removed in the next version of EchoPoint. Use the new attributed identifier on the Component from now on, eg component.setIdentifier("stylegroup=xxx;");
 void applyTo(nextapp.echo.Component c)
          This method applies the StyleSheet to the given Component c and all of its children.
 void applyTo(nextapp.echo.Component c, boolean listenForFutureChildren)
          This method applies the StyleSheet to the given Component c and all of its children.
 void applyTo(nextapp.echo.EchoInstance instance)
          This method applies the StyleSheet to the Windows of the given EchoInstance and all of their children.
 void applyTo(nextapp.echo.EchoInstance instance, boolean listenForFutureChildren)
          This method applies the StyleSheet to the Windows of the given EchoInstance and all of their children.
 void loadStyleSheet(java.io.Reader styleSheetReader)
          This method causes the StyleSheet to load and parse the style information contained in the given Reader object.
 void stopListeningTo(nextapp.echo.Component c)
          This stops the StyleSheet from listening for Component.CHILDREN_PROPERTY_CHANGED events on the given Component c.
 void stopListeningTo(nextapp.echo.EchoInstance instance)
          This stops the StyleSheet from listening for EchoInstance.WINDOWS_CHANGED_PROPERTY and Component.CHILDREN_PROPERTY_CHANGED events on the given EchoInstance.
 

Method Detail

loadStyleSheet

public void loadStyleSheet(java.io.Reader styleSheetReader)
                    throws StyleSheetParseException
This method causes the StyleSheet to load and parse the style information contained in the given Reader object.

Parameters:
styleSheetReader - - the Reader containg style sheet information
Throws:
StyleSheetParseException - - if the data cannot be parsed

addGroup

public void addGroup(StyleSheetGroup styleSheetGroup)
Deprecated. StyleSheetGroup has been deprecated and will be removed in the next version of EchoPoint. Use the new attributed identifier on the Component from now on, eg component.setIdentifier("stylegroup=xxx;");

Adds a StyleSheetGroup to the StyleSheet.

If it can , the StyleSheet is expected to apply Styles to Components within this group, based on the StyleSheetGroup name.

Parameters:
styleSheetGroup - - the stylesheet group to add

applyTo

public void applyTo(nextapp.echo.Component c)
This method applies the StyleSheet to the given Component c and all of its children.

This method can throw a StyleSheetInvalidValueException if a value of the wrong type is stored in a Style object. The StyleSheet is expected to catch the ClassCastException that might be thrown and then rethrow it as a StyleSheetInvalidValueException.

Parameters:
c - - the component to apply the style sheet to

applyTo

public void applyTo(nextapp.echo.Component c,
                    boolean listenForFutureChildren)
This method applies the StyleSheet to the given Component c and all of its children.

If listenForFutureChildren is true, then the StyleSheet is expected to listen for Component.CHILDREN_CHANGED_PROPERTY property change events and apply the StyleSheet to any new children.

The can be done by called the Component.addPropertyChangeListener

This method can throw a StyleSheetInvalidValueException if a value of the wrong type is stored in a Style object. The StyleSheet is expected to catch the ClassCastException that might be thrown and then rethrow it as a StyleSheetInvalidValueException.

Parameters:
c - - the component to apply the style sheet to
listenForFutureChildren - - whether to listen for future children

applyTo

public void applyTo(nextapp.echo.EchoInstance instance)
This method applies the StyleSheet to the Windows of the given EchoInstance and all of their children.

Be aware when using this function in EchoInstance.init(). Add that stage there are no Windows in the EchoInstance and it does not fire any events once it has finished, and hence the StyleSheet will not be applied. You can get around this issue by applying the StyleSheet to the Window object you must return in EchoInstance.init() as well as the EchoInstance itself. The code might look like this :

 	public nextapp.echo.Window init() {
      Window window = new Window();
      ...
 		...
 		try {
 			styleSheet.applyTo(this,true);
 			styleSheet.applyTo(window);
 		} catch (StyleSheetParseException e) {
 			....
 		}
 		return window;
  }
 

This method can throw a StyleSheetInvalidValueException if a value of the wrong type is stored in a Style object. The StyleSheet is expected to catch the ClassCastException that might be thrown and then rethrow it as a StyleSheetInvalidValueException.

Parameters:
instance - - the EchoInstance to apply the style sheet to

applyTo

public void applyTo(nextapp.echo.EchoInstance instance,
                    boolean listenForFutureChildren)
This method applies the StyleSheet to the Windows of the given EchoInstance and all of their children.

If listenForFutureChildren is true, then the StyleSheet is expected to listen for EchoInstance.WINDOWS_CHANGED_PROPERTY and Component.CHILDREN_CHANGED_PROPERTY property change events and apply the StyleSheet to any new children.

Be aware when using this function in EchoInstance.init(). Add that stage there are no Windows in the EchoInstance and it does not fire any events once it has finished, and hence the StyleSheet will not be applied. You can get around this issue by applying the StyleSheet to the Window object you must return in EchoInstance.init() as well as the EchoInstance itself. The code might look like this :

 	public nextapp.echo.Window init() {
      Window window = new Window();
      ...
 		...
 		try {
 			styleSheet.applyTo(this,true);
 			styleSheet.applyTo(window);
 		} catch (StyleSheetParseException e) {
 			....
 		}
 		return window;
  }
 

This method can throw a StyleSheetInvalidValueException if a value of the wrong type is stored in a Style object. The StyleSheet is expected to catch the ClassCastException that might be thrown and then rethrow it as a StyleSheetInvalidValueException.

Parameters:
instance - - the EchoInstance to apply the style sheet to
listenForFutureChildren - - whether to listen for future children

stopListeningTo

public void stopListeningTo(nextapp.echo.Component c)
This stops the StyleSheet from listening for Component.CHILDREN_PROPERTY_CHANGED events on the given Component c.

Parameters:
c - - the component to stop listening for children on

stopListeningTo

public void stopListeningTo(nextapp.echo.EchoInstance instance)
This stops the StyleSheet from listening for EchoInstance.WINDOWS_CHANGED_PROPERTY and Component.CHILDREN_PROPERTY_CHANGED events on the given EchoInstance.

Parameters:
instance - - the EchoINstance to stop listening for children on

EchoPoint
1.0