lt.monarch.chart.style
Class Style

java.lang.Object
  extended by lt.monarch.chart.style.Stylesheet
      extended by lt.monarch.chart.style.Style
All Implemented Interfaces:
java.io.Serializable

public class Style
extends Stylesheet

Style is a view of the entire stylesheet and filters out unnecessary entityStyle. It has an associated tag, which defines what entityStyle are needed. All matching entityStyle are normalized to a "." tag, so that they can be selected as default values for the style.

See Also:
Serialized Form

Field Summary
Modifier and Type Field and Description
 
Fields inherited from class lt.monarch.chart.style.Stylesheet
defaultStylesheet, inheritedValue, nullValue, stylesheetListeners, weakStylesheetListeners
 
Constructor Summary
Constructor and Description
Style()
          Constructs a new Style with defaultStylesheet as parent.
Style(java.lang.String foo)
           
Style(Stylesheet parentStylesheet, java.lang.String tag)
          Constructs a new Style with the parent Stylesheet and default tag.
 
Method Summary
Modifier and Type Method and Description
 void addChild(Style style)
           
 void copyStyle(Style style)
           
 void dispose()
          Cleans this style object.
protected  void finalize()
          Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
protected  void generateStylesheetCache()
          Loads all necessary entityStyle from parent Stylesheet.
 java.awt.Color getBackground()
          Returns the background property with tag "."
 java.awt.Color getColor(java.lang.String attribute)
          Returns the color property with tag "."
 java.lang.Object getComposite()
          Returns the composite property with tag "."
 java.lang.String getContext()
          Returns a textual stylesheet context.
 java.lang.StringBuilder getContext(java.lang.StringBuilder stringBuilder)
          Returns a textual stylesheet context appended to a StringBuilder.
 java.lang.String getDefaultTag()
          Gets the defaultTag value
 int getFlag(java.lang.String attribute)
          Returns the flag property with tag "."
 java.awt.Font getFont()
          Returns the font property with tag "."
 java.awt.Color getForeground()
          Returns the foreground property with tag "."
 java.util.Hashtable<Key,java.lang.Object> getLocalStyle()
           
 java.lang.Object getObject(java.lang.String attribute)
          Returns the property with tag "."
 PaintStyle getPaintStyle()
           
 Stylesheet getParentStylesheet()
          Returns the parent Stylesheet.
 StyleObject getProperty(java.lang.String attribute)
          Gets enumeration property
 java.lang.Object getRenderingHints()
          Returns the rendering hints property with tag "."
 java.lang.Object getStroke()
          Returns the stroke property with tag "."
 Style getSubStyle(java.lang.String tag)
          Creates and returns a child stylesheet with the specified view tag.
 TextStyle getTextStyle()
           
 java.lang.Object getValueFromLocalStyle(java.lang.String tag, java.lang.String attribute)
           
 boolean isDefault(Key key)
           
protected  void refreshStylesheetCache()
          Refreshes stylesheet cache - clears and regenerates.
protected  boolean refreshStylesheetCacheKey(Key key)
          Refreshes the value correspondent to the specified key in the stylesheet.
 void removeChild(Style style)
           
 void setBackground(java.awt.Color color)
          Sets the background property with tag "."
 void setColor(java.lang.String attribute, java.awt.Color color)
          Sets the color property with tag "."
 void setComposite(java.awt.Composite c)
          Sets the composite property with tag "."
 void setFlag(java.lang.String attribute, int flag)
          Sets the flag property with tag "."
 void setFont(java.awt.Font font)
          Sets the font property with tag "."
 void setForeground(java.awt.Color color)
          Sets the foreground property with tag "."
 void setObject(java.lang.String attribute, java.lang.Object value)
          Sets the property with tag "."
 void setParentStylesheet(Stylesheet parentStylesheet)
          Sets a parent stylesheet.
 void setProperty(java.lang.String attribute, StyleObject property)
          Sets the enumeration property with tag "."
 void setRenderingHints(java.awt.RenderingHints c)
          Sets the rendering hints property with tag "."
 void setStroke(java.awt.Stroke c)
          Sets the stroke property with tag "."
 void setTag(java.lang.String tag)
          Sets the stylesheet view tag, used for parent stylesheet lookup.
protected  void setValue(java.lang.String tag, java.lang.String attribute, java.lang.Object value)
          Sets any property in the style.
 
Methods inherited from class lt.monarch.chart.style.Stylesheet
addListener, addWeakListener, defaultRead, defaultWrite, findValue, fireStylesheetChanged, fireStylesheetKeyChanged, getBackground, getColor, getComposite, getFlag, getFont, getForeground, getObject, getPaint, getPaint, getProperty, getRenderingHints, getStroke, removeListener, removeWeakListener, resumeListeners, setBackground, setColor, setComposite, setFlag, setFont, setForeground, setObject, setPaint, setPaint, setProperty, setRenderingHints, setStroke, suspendListeners, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Style

public Style(Stylesheet parentStylesheet,
             java.lang.String tag)
Constructs a new Style with the parent Stylesheet and default tag.

Parameters:
parentStylesheet - the parent Stylesheet
tag - the default tag

Style

public Style()
Constructs a new Style with defaultStylesheet as parent.


Style

public Style(java.lang.String foo)
Method Detail

setParentStylesheet

public void setParentStylesheet(Stylesheet parentStylesheet)
Sets a parent stylesheet. EntityStyle, which are not found in this stylesheet are retrieved from a normalized version of the parent stylesheet

Parameters:
parentStylesheet - parent stylesheet

getParentStylesheet

public Stylesheet getParentStylesheet()
Returns the parent Stylesheet.

Overrides:
getParentStylesheet in class Stylesheet
Returns:
the parent Stylesheet

setTag

public void setTag(java.lang.String tag)
Sets the stylesheet view tag, used for parent stylesheet lookup. For example: If parent stylesheet has a property H1.H2.color and the view tag is set to H1, then this property appears as H2.color in this stylesheet.

Parameters:
tag - view tag

getSubStyle

public Style getSubStyle(java.lang.String tag)
Creates and returns a child stylesheet with the specified view tag.

Parameters:
tag - view tag
Returns:
newly created stylesheet

getComposite

public java.lang.Object getComposite()
Returns the composite property with tag "."

Returns:
property value

getStroke

public java.lang.Object getStroke()
Returns the stroke property with tag "."

Returns:
property value

getRenderingHints

public java.lang.Object getRenderingHints()
Returns the rendering hints property with tag "."

Returns:
property value

getFlag

public int getFlag(java.lang.String attribute)
Returns the flag property with tag "."

Parameters:
attribute - property attribute
Returns:
property value

getFont

public java.awt.Font getFont()
Returns the font property with tag "."

Returns:
property value

getForeground

public java.awt.Color getForeground()
Returns the foreground property with tag "."

Returns:
property value

getBackground

public java.awt.Color getBackground()
Returns the background property with tag "."

Returns:
property value

getColor

public java.awt.Color getColor(java.lang.String attribute)
Returns the color property with tag "."

Parameters:
attribute - property attribute
Returns:
property value

getObject

public java.lang.Object getObject(java.lang.String attribute)
Returns the property with tag "."

Parameters:
attribute - property attribute
Returns:
property value

setComposite

public void setComposite(java.awt.Composite c)
Sets the composite property with tag "."

Parameters:
c - composite object

setStroke

public void setStroke(java.awt.Stroke c)
Sets the stroke property with tag "."

Parameters:
c - stroke object

setRenderingHints

public void setRenderingHints(java.awt.RenderingHints c)
Sets the rendering hints property with tag "."

Parameters:
c - rendering hints object

setFlag

public void setFlag(java.lang.String attribute,
                    int flag)
Sets the flag property with tag "."

Parameters:
attribute - property attribute
flag - flag

setProperty

public void setProperty(java.lang.String attribute,
                        StyleObject property)
Sets the enumeration property with tag "."

Parameters:
attribute - property attribute
property - enumeration value

getProperty

public StyleObject getProperty(java.lang.String attribute)
Gets enumeration property

Parameters:
attribute - property attribute
Returns:
enumeration value

setFont

public void setFont(java.awt.Font font)
Sets the font property with tag "."

Parameters:
font - font object

setForeground

public void setForeground(java.awt.Color color)
Sets the foreground property with tag "."

Parameters:
color - foreground color

setBackground

public void setBackground(java.awt.Color color)
Sets the background property with tag "."

Parameters:
color - background color

setColor

public void setColor(java.lang.String attribute,
                     java.awt.Color color)
Sets the color property with tag "."

Parameters:
attribute - property attribute
color - color

setObject

public void setObject(java.lang.String attribute,
                      java.lang.Object value)
Sets the property with tag "."

Parameters:
attribute - property attribute
value - property value

generateStylesheetCache

protected void generateStylesheetCache()
Loads all necessary entityStyle from parent Stylesheet.


refreshStylesheetCache

protected void refreshStylesheetCache()
Refreshes stylesheet cache - clears and regenerates.


refreshStylesheetCacheKey

protected boolean refreshStylesheetCacheKey(Key key)
Refreshes the value correspondent to the specified key in the stylesheet. The value is loaded from parent stylesheet.

Parameters:
key - the key
Returns:
true if a value correspondent to the specified during this operation key changed, false otherwise

setValue

protected void setValue(java.lang.String tag,
                        java.lang.String attribute,
                        java.lang.Object value)
Sets any property in the style.

Overrides:
setValue in class Stylesheet
Parameters:
tag - the tag
attribute - the attribute
value - the property value

getValueFromLocalStyle

public java.lang.Object getValueFromLocalStyle(java.lang.String tag,
                                               java.lang.String attribute)

getContext

public java.lang.String getContext()
Returns a textual stylesheet context. It specifies how deeply is this stylesheet nested in the stylesheet hierarchy. The context for this style object is created as: getParentStylesheet().getContext() +"."+ tag, there tag is the String set by method setTag

Overrides:
getContext in class Stylesheet
Returns:
a textual stylesheet context

getContext

public java.lang.StringBuilder getContext(java.lang.StringBuilder stringBuilder)
Returns a textual stylesheet context appended to a StringBuilder. It specifies how deeply is this stylesheet nested in the stylesheet hierarchy. The context for this style object is created as: getParentStylesheet().getContext() +"."+ tag, there tag is the String set by method setTag

Overrides:
getContext in class Stylesheet
Parameters:
stringBuilder - StringBuilder to use for context assembly.
Returns:
context tag in a StringBuilder

dispose

public void dispose()
Cleans this style object. After this style object is unusable and can be garbage collected.

Overrides:
dispose in class Stylesheet

finalize

protected void finalize()
                 throws java.lang.Throwable
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. Calls cleanup method if it isn't called yet.

Overrides:
finalize in class Stylesheet
Throws:
java.lang.Throwable - the Exception raised by this method

getDefaultTag

public java.lang.String getDefaultTag()
Gets the defaultTag value

Returns:
the defaultTag value

copyStyle

public void copyStyle(Style style)

addChild

public void addChild(Style style)

removeChild

public void removeChild(Style style)

getLocalStyle

public java.util.Hashtable<Key,java.lang.Object> getLocalStyle()

isDefault

public boolean isDefault(Key key)

getPaintStyle

public PaintStyle getPaintStyle()

getTextStyle

public TextStyle getTextStyle()