net.sourceforge.spedit.core
Class Styleable.StyleSheet

java.lang.Object
  |
  +--net.sourceforge.spedit.core.Styleable.StyleSheet
All Implemented Interfaces:
EventListener, PropertyChangeListener
Enclosing class:
Styleable

public static class Styleable.StyleSheet
extends Object
implements PropertyChangeListener

The StyleSheet provides a flexible way to store structured, hierarchized style information. These stylesheet support inheritance of whole, or part of the style tree structure, plus resolution into a parent Styleable element.


Field Summary
 float align
           
 Color background
           
 Color borderColor
           
 short borderPaddingBottom
           
 short borderPaddingLeft
           
 short borderPaddingRight
           
 short borderPaddingTop
           
 int borderSize
           
static float CENTER
           
 Font font
           
 Color foreground
           
 boolean hasExpander
           
protected  Hashtable inherited
           
static float LEFT
           
 int lineHeight
           
protected  Vector listeners
           
protected  String name
          This hash stores the different root properties and property groups.
 short paddingBottom
           
 short paddingLeft
           
 short paddingRight
           
 short paddingTop
           
protected  Styleable parent
           
protected  Hashtable properties
           
protected  Hashtable propertiesClasses
           
static float RIGHT
           
 String title
           
 Font titleFont
           
 short titlePaddingBottom
           
 short titlePaddingLeft
           
 short titlePaddingRight
           
 short titlePaddingTop
           
 float width
           
 
Constructor Summary
Styleable.StyleSheet()
           
Styleable.StyleSheet(String name)
           
Styleable.StyleSheet(String name, Styleable parent)
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
          Adds a listener that will be called each time a property of the stylable object changes.
protected  void firePropertyChange(PropertyChangeEvent evt)
           
 String getName()
           
 Styleable getParent()
           
 Object getStyle(String property)
          Gets the given style propery.
 Class getStyleClass(String property)
          Returns the class of the object bound to the given style property.
protected  Styleable.StyleSheet getStyleOwner(String property)
          Retrieves the parent of the given property.
 void inheritStyle(String property, Styleable.StyleSheet stylesheet)
          Inherits only a given property or group of properties from the given stylable object.
 void inheritStyle(Styleable.StyleSheet stylesheet)
          Inherits all the properties of the given stylable object.
protected  void init()
           
 Enumeration listProperties(String group)
           
 void propertyChange(PropertyChangeEvent evt)
           
 void removePropertyChangeListener(PropertyChangeListener l)
           
 void setName(String name)
           
 void setParent(Styleable parent)
           
 void setStyle(String property, Object value)
          Sets the style property designated by the property parameter to the given value.
 void setStyleClass(String property, Class pclass)
          Specifies that the given property has to be of the given class.
 String toString()
           
 void update()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LEFT

public static final float LEFT

CENTER

public static final float CENTER

RIGHT

public static final float RIGHT

name

protected String name
This hash stores the different root properties and property groups. For example font.name and font.size will be accessed by getting the font entry of the has, which will be a hash itself and which will contain the name and size properties.

properties

protected Hashtable properties

propertiesClasses

protected Hashtable propertiesClasses

inherited

protected Hashtable inherited

listeners

protected Vector listeners

parent

protected Styleable parent

paddingLeft

public short paddingLeft

paddingRight

public short paddingRight

paddingTop

public short paddingTop

paddingBottom

public short paddingBottom

lineHeight

public int lineHeight

align

public float align

width

public float width

font

public Font font

foreground

public Color foreground

background

public Color background

title

public String title

titleFont

public Font titleFont

titlePaddingLeft

public short titlePaddingLeft

titlePaddingRight

public short titlePaddingRight

titlePaddingTop

public short titlePaddingTop

titlePaddingBottom

public short titlePaddingBottom

borderSize

public int borderSize

borderColor

public Color borderColor

borderPaddingLeft

public short borderPaddingLeft

borderPaddingRight

public short borderPaddingRight

borderPaddingTop

public short borderPaddingTop

borderPaddingBottom

public short borderPaddingBottom

hasExpander

public boolean hasExpander
Constructor Detail

Styleable.StyleSheet

public Styleable.StyleSheet()

Styleable.StyleSheet

public Styleable.StyleSheet(String name)

Styleable.StyleSheet

public Styleable.StyleSheet(String name,
                            Styleable parent)
Method Detail

init

protected void init()

setStyleClass

public void setStyleClass(String property,
                          Class pclass)
Specifies that the given property has to be of the given class.

setStyle

public void setStyle(String property,
                     Object value)
Sets the style property designated by the property parameter to the given value.

getStyleOwner

protected Styleable.StyleSheet getStyleOwner(String property)
Retrieves the parent of the given property. It can be the this object in case the property is defined locally, otherwise the parent from which the property is inherited is given. In case the property is not defined nor inherited, null is returned.

getStyle

public Object getStyle(String property)
Gets the given style propery. This can be either a list or a style object. In case the returned object is a List this will mean the given property is a property set.

getStyleClass

public Class getStyleClass(String property)
Returns the class of the object bound to the given style property. This is useful if you want to check what type of object you can put inside a property.

inheritStyle

public void inheritStyle(Styleable.StyleSheet stylesheet)
Inherits all the properties of the given stylable object.

inheritStyle

public void inheritStyle(String property,
                         Styleable.StyleSheet stylesheet)
Inherits only a given property or group of properties from the given stylable object.

listProperties

public Enumeration listProperties(String group)

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Adds a listener that will be called each time a property of the stylable object changes.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Specified by:
propertyChange in interface PropertyChangeListener

firePropertyChange

protected void firePropertyChange(PropertyChangeEvent evt)

getName

public String getName()

setName

public void setName(String name)

getParent

public Styleable getParent()

setParent

public void setParent(Styleable parent)

update

public void update()

toString

public String toString()
Overrides:
toString in class Object