|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectlt.monarch.chart.style.Stylesheet
public class Stylesheet extends java.lang.Object implements java.io.Serializable
Stylesheet is a simple in-memory database, designed to store rendering entityStyle, such as
color, font, etc.
Warning: When running under Java 1.1 stylesheet listeners do not chain together parent-child
style sheets. Java 1.1 lacks weak references, and stylesheet listener usage would result in huge
memory leaks.
Please see user guide for complete description of style sheets.
Internal chart objects make use of these stylesheet keys in various combinations:
| Modifier and Type | Field and Description |
|---|---|
static Stylesheet |
defaultStylesheet
the default Stylesheet |
static java.lang.Object |
inheritedValue
A value place holder to be used in the setXXX methods. |
protected static java.lang.Object |
nullValue
specifies null value |
protected DefaultListenerList<StylesheetListener> |
stylesheetListeners
|
protected ListenerList<StylesheetListener> |
weakStylesheetListeners
|
| Constructor and Description |
|---|
Stylesheet()
Constructs empty Stylesheet. |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(StylesheetListener listener)
Registers a stylesheet listener |
void |
addWeakListener(StylesheetListener listener)
Registers a weak stylesheet listener. |
protected java.util.Hashtable<Key,java.lang.Object> |
defaultRead(java.io.ObjectInputStream in,
java.util.Hashtable<Key,java.lang.Object> styleSettings)
Default read of serialization |
protected void |
defaultWrite(java.io.ObjectOutputStream out,
java.util.Hashtable<Key,java.lang.Object> styleSettings)
Default serialization write |
void |
dispose()
Cleans this stylesheet 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 java.lang.Object |
findValue(java.lang.String tag,
java.lang.String attribute)
Finds and returns a property. |
protected void |
fireStylesheetChanged()
Notifies all listeners that stylesheet changed. |
protected void |
fireStylesheetKeyChanged(Key key)
Notifies all listeners that value correspondent to specified key in the stylesheet changed. |
java.awt.Color |
getBackground(java.lang.String tag)
Finds and returns a background property. |
java.awt.Color |
getColor(java.lang.String tag,
java.lang.String attribute)
Finds and returns a color property. |
java.lang.Object |
getComposite(java.lang.String tag)
Finds and returns a composite property. |
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. |
int |
getFlag(java.lang.String tag,
java.lang.String attribute)
Finds and returns a integer flag property. |
java.awt.Font |
getFont(java.lang.String tag)
Finds and returns a font property. |
java.awt.Color |
getForeground(java.lang.String tag)
Finds and returns a foreground property. |
java.lang.Object |
getObject(java.lang.String tag,
java.lang.String attribute)
Finds and returns a property. |
java.lang.Object |
getPaint()
Finds and returns a Paint property. |
java.lang.Object |
getPaint(java.lang.String tag)
Finds and returns a Paint property. |
Stylesheet |
getParentStylesheet()
Returns the parent stylesheet in the stylesheet hierarchy |
StyleObject |
getProperty(java.lang.String tag,
java.lang.String attribute)
Gets property enumeration value |
java.lang.Object |
getRenderingHints(java.lang.String tag)
Finds and returns a rendering hints property. |
java.lang.Object |
getStroke(java.lang.String tag)
Finds and returns a stroke property. |
void |
removeListener(StylesheetListener listener)
Unregisters a stylesheet listener |
void |
removeWeakListener(StylesheetListener listener)
Unregisters a weak stylesheet listener. |
void |
resumeListeners()
Resumes all listeners |
void |
setBackground(java.lang.String tag,
java.awt.Color color)
Sets the background property in the stylesheet. |
void |
setColor(java.lang.String tag,
java.lang.String attribute,
java.awt.Color color)
Sets the color property in the stylesheet. |
void |
setComposite(java.lang.String tag,
java.awt.Composite c)
Sets the composite property in the stylesheet. |
void |
setFlag(java.lang.String tag,
java.lang.String attribute,
int value)
Sets the integer flag property in the stylesheet. |
void |
setFont(java.lang.String tag,
java.awt.Font font)
Sets the font property in the stylesheet. |
void |
setForeground(java.lang.String tag,
java.awt.Color color)
Sets the foreground property in the stylesheet. |
void |
setObject(java.lang.String tag,
java.lang.String attribute,
java.lang.Object value)
Sets any property in the stylesheet. |
void |
setPaint(java.awt.Paint paint)
Sets paint property in the stylesheet. |
void |
setPaint(java.awt.Paint paint,
java.lang.String tag)
Sets paint property in the stylesheet. |
void |
setProperty(java.lang.String tag,
java.lang.String attribute,
StyleObject property)
Sets enumeration property to the stylesheet |
void |
setRenderingHints(java.lang.String tag,
java.awt.RenderingHints c)
Sets the rendering hints property in the stylesheet. |
void |
setStroke(java.lang.String tag,
java.awt.Stroke c)
Sets the stroke property in the stylesheet. |
protected void |
setValue(java.lang.String tag,
java.lang.String attribute,
java.lang.Object value)
Sets any property in the stylesheet. |
void |
suspendListeners()
Suspends all listeners, which later can be resumed |
java.lang.String |
toString()
Returns the String representation of this Stylesheet object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.Object nullValue
public static final java.lang.Object inheritedValue
public static final Stylesheet defaultStylesheet
protected transient DefaultListenerList<StylesheetListener> stylesheetListeners
protected transient ListenerList<StylesheetListener> weakStylesheetListeners
| Constructor Detail |
|---|
public Stylesheet()
| Method Detail |
|---|
public Stylesheet getParentStylesheet()
public void addListener(StylesheetListener listener)
listener - stylesheet listenerpublic void removeListener(StylesheetListener listener)
listener - stylesheet listenerpublic void addWeakListener(StylesheetListener listener)
listener - a weak stylesheet listenerpublic void removeWeakListener(StylesheetListener listener)
listener - a weak stylesheet listenerprotected void fireStylesheetChanged()
protected void fireStylesheetKeyChanged(Key key)
key - the key
public void setComposite(java.lang.String tag,
java.awt.Composite c)
tag - property tagc - composite object
public void setStroke(java.lang.String tag,
java.awt.Stroke c)
tag - property tagc - stroke object
public void setRenderingHints(java.lang.String tag,
java.awt.RenderingHints c)
tag - property tagc - rendering hints
public void setFlag(java.lang.String tag,
java.lang.String attribute,
int value)
tag - property tagattribute - property attributevalue - integer flag value
public void setProperty(java.lang.String tag,
java.lang.String attribute,
StyleObject property)
tag - property tagattribute - property attributeproperty - property value
public StyleObject getProperty(java.lang.String tag,
java.lang.String attribute)
tag - property tagattribute - property attribute
public void setFont(java.lang.String tag,
java.awt.Font font)
tag - property tagfont - font
public void setForeground(java.lang.String tag,
java.awt.Color color)
tag - property tagcolor - foreground color
public void setBackground(java.lang.String tag,
java.awt.Color color)
tag - property tagcolor - background color
public void setColor(java.lang.String tag,
java.lang.String attribute,
java.awt.Color color)
tag - property tagattribute - property attributecolor - foreground colorpublic void setPaint(java.awt.Paint paint)
paint - paint objectpublic java.lang.Object getPaint()
public void setPaint(java.awt.Paint paint,
java.lang.String tag)
paint - paint objecttag - object tag identifier valuepublic java.lang.Object getPaint(java.lang.String tag)
tag - object tag identifier value
public void setObject(java.lang.String tag,
java.lang.String attribute,
java.lang.Object value)
tag - property tagattribute - property attributevalue - property value
public java.lang.Object getObject(java.lang.String tag,
java.lang.String attribute)
tag - property tagattribute - property attributepublic java.lang.Object getComposite(java.lang.String tag)
tag - property tagpublic java.lang.Object getStroke(java.lang.String tag)
tag - property tagpublic java.lang.Object getRenderingHints(java.lang.String tag)
tag - property tag
public int getFlag(java.lang.String tag,
java.lang.String attribute)
tag - property tagattribute - property attributepublic java.awt.Font getFont(java.lang.String tag)
tag - property tagpublic java.awt.Color getForeground(java.lang.String tag)
tag - property tagpublic java.awt.Color getBackground(java.lang.String tag)
tag - property tag
public java.awt.Color getColor(java.lang.String tag,
java.lang.String attribute)
tag - property tagattribute - property attribute
protected java.lang.Object findValue(java.lang.String tag,
java.lang.String attribute)
tag - property tagattribute - property attribute
protected void setValue(java.lang.String tag,
java.lang.String attribute,
java.lang.Object value)
tag - property tagattribute - property attributevalue - property valuepublic java.lang.String getContext()
public java.lang.StringBuilder getContext(java.lang.StringBuilder stringBuilder)
StringBuilder.
It specifies how deeply is this stylesheet nested in the stylesheet hierarchy.
stringBuilder - StringBuilder to use for context assembly.StringBuilderpublic java.lang.String toString()
toString in class java.lang.Objectpublic void dispose()
protected void finalize()
throws java.lang.Throwable
cleanup method if it isn't called
yet.
finalize in class java.lang.Objectjava.lang.Throwable - the Exception raised by this method
protected void defaultWrite(java.io.ObjectOutputStream out,
java.util.Hashtable<Key,java.lang.Object> styleSettings)
throws java.io.IOException
out - serialization output streamstyleSettings - stylesheet settingsjava.io.IOException - throws error if occurs during serialization
protected java.util.Hashtable<Key,java.lang.Object> defaultRead(java.io.ObjectInputStream in,
java.util.Hashtable<Key,java.lang.Object> styleSettings)
throws java.io.IOException,
java.lang.ClassNotFoundException
in - input stream of serializationstyleSettings - stylesheet settingsjava.io.IOException - throws error if something goes wrong during serializationjava.lang.ClassNotFoundExceptionpublic void resumeListeners()
public void suspendListeners()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||