|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jfree.report.style.ElementStyleSheet
An element style-sheet contains zero, one or many attributes that affect the appearance of report elements. For each attribute, there is a predefined key that can be used to access that attribute in the style sheet.
Every report element has an associated style-sheet.
A style-sheet maintains a list of parent style-sheets. If an attribute is not defined in a style-sheet, the code refers to the parent style-sheets to see if the attribute is defined there.
All StyleSheet entries are checked against the StyleKeyDefinition for validity.
Field Summary | |
static StyleKey |
ALIGNMENT
A key for the horizontal alignment of an element. |
static StyleKey |
BOLD
A key for an element's 'bold' flag. |
static StyleKey |
BOUNDS
A key for the 'bounds' of an element. |
static StyleKey |
DYNAMIC_HEIGHT
A key for the dynamic height flag for an element. |
static StyleKey |
ELEMENT_LAYOUT_CACHEABLE
The Layout Cacheable stylekey. |
static StyleKey |
EMBEDDED_FONT
A key for an element's 'embedd' flag. |
static StyleKey |
FONT
A key for the 'font name' used to draw element text. |
static StyleKey |
FONTENCODING
A key for an element's 'embedd' flag. |
static StyleKey |
FONTSIZE
A key for the 'font size' used to draw element text. |
static StyleKey |
ITALIC
A key for an element's 'italic' flag. |
static StyleKey |
KEEP_ASPECT_RATIO
A key for an element's 'keep aspect ratio' flag. |
static StyleKey |
LINEHEIGHT
A key for the 'font size' used to draw element text. |
static StyleKey |
MAXIMUMSIZE
A key for the 'maximum size' of an element. |
static StyleKey |
MINIMUMSIZE
A key for the 'minimum size' of an element. |
static StyleKey |
PAINT
A key for the 'paint' used to color an element. |
static StyleKey |
PREFERREDSIZE
A key for the 'preferred size' of an element. |
static StyleKey |
RESERVED_LITERAL
The string that is used to end a text if not all text fits into the element. |
static StyleKey |
SCALE
A key for an element's 'scale' flag. |
static StyleKey |
STRIKETHROUGH
A key for an element's 'strikethrough' flag. |
static StyleKey |
STROKE
A key for the 'stroke' used to draw an element. |
static StyleKey |
TRIM_TEXT_CONTENT
The Layout Cacheable stylekey. |
static StyleKey |
UNDERLINED
A key for an element's 'underlined' flag. |
static StyleKey |
VALIGNMENT
A key for the vertical alignment of an element. |
static StyleKey |
VISIBLE
A key for an element's 'visible' flag. |
Constructor Summary | |
ElementStyleSheet(java.lang.String name)
Creates a new element style-sheet with the given name. |
Method Summary | |
void |
addDefaultParent(ElementStyleSheet parent)
Adds a parent style-sheet. |
void |
addDefaultParent(int position,
ElementStyleSheet parent)
Adds a parent style-sheet. |
void |
addListener(StyleChangeListener l)
Adds a StyleChangeListener . |
void |
addParent(ElementStyleSheet parent)
Adds a parent style-sheet. |
void |
addParent(int position,
ElementStyleSheet parent)
Adds a parent style-sheet. |
java.lang.Object |
clone()
Creates and returns a copy of this object. |
boolean |
getBooleanStyleProperty(StyleKey key)
Returns a boolean style (defaults to false if the style is not found). |
boolean |
getBooleanStyleProperty(StyleKey key,
boolean defaultValue)
Returns a boolean style. |
ElementStyleSheet |
getCopy()
Clones the style-sheet. |
java.util.List |
getDefaultParents()
Returns a list of the default style-sheets. |
java.util.Iterator |
getDefinedPropertyNames()
Returns an enumeration of all local property keys. |
FontDefinition |
getFontDefinitionProperty()
Returns the font for this style-sheet. |
InstanceID |
getId()
Returns the ID of the stylesheet. |
int |
getIntStyleProperty(StyleKey key,
int def)
Returns an integer style. |
java.lang.String |
getName()
Returns the name of the style-sheet. |
java.util.List |
getParents()
Returns a list of the parent style-sheets. |
java.lang.Object |
getStyleProperty(StyleKey key)
Returns the value of a style. |
java.lang.Object |
getStyleProperty(StyleKey key,
java.lang.Object defaultValue)
Returns the value of a style. |
StyleSheetCollection |
getStyleSheetCollection()
Returns the stylesheet collection of this element stylesheet, or null, if this stylessheet is not assigned with an collection. |
boolean |
isAllowCaching()
Returns true if caching is allowed, and false otherwise. |
boolean |
isGlobalDefault()
Returns true, if this stylesheet is one of the global default stylesheets. |
boolean |
isLocalKey(StyleKey key)
Returns true, if the given key is locally defined, false otherwise. |
boolean |
isSubStyleSheet(ElementStyleSheet parent)
Checks, whether the given element stylesheet is already added as child into the stylesheet tree. |
void |
registerStyleSheetCollection(StyleSheetCollection styleSheetCollection)
Registers the given StyleSheet collection with this ElementStyleSheet. |
void |
removeDefaultParent(ElementStyleSheet parent)
Removes a parent style-sheet. |
void |
removeListener(StyleChangeListener l)
Removes a StyleChangeListener . |
void |
removeParent(ElementStyleSheet parent)
Removes a parent style-sheet. |
void |
setAllowCaching(boolean allowCaching)
Sets the flag that controls whether or not caching is allowed. |
void |
setBooleanStyleProperty(StyleKey key,
boolean value)
Sets a boolean style property. |
void |
setFontDefinitionProperty(FontDefinition font)
Sets the font for this style-sheet. |
void |
setStyleProperty(StyleKey key,
java.lang.Object value)
Sets a style property (or removes the style if the value is null ). |
void |
styleChanged(ElementStyleSheet source,
StyleKey key,
java.lang.Object value)
Forwards a change event notification to all registered StyleChangeListener objects. |
void |
styleRemoved(ElementStyleSheet source,
StyleKey key)
Forwards a change event notification to all registered StyleChangeListener objects. |
void |
unregisterStyleSheetCollection(StyleSheetCollection styleSheetCollection)
Unregisters the given stylesheet collection from this ElementStyleSheet. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final StyleKey MINIMUMSIZE
public static final StyleKey MAXIMUMSIZE
public static final StyleKey PREFERREDSIZE
public static final StyleKey BOUNDS
public static final StyleKey VISIBLE
public static final StyleKey PAINT
public static final StyleKey STROKE
public static final StyleKey FONT
public static final StyleKey FONTSIZE
public static final StyleKey LINEHEIGHT
public static final StyleKey BOLD
public static final StyleKey ITALIC
public static final StyleKey UNDERLINED
public static final StyleKey STRIKETHROUGH
public static final StyleKey EMBEDDED_FONT
public static final StyleKey FONTENCODING
public static final StyleKey ALIGNMENT
public static final StyleKey VALIGNMENT
public static final StyleKey SCALE
public static final StyleKey KEEP_ASPECT_RATIO
public static final StyleKey DYNAMIC_HEIGHT
public static final StyleKey ELEMENT_LAYOUT_CACHEABLE
public static final StyleKey RESERVED_LITERAL
public static final StyleKey TRIM_TEXT_CONTENT
Constructor Detail |
public ElementStyleSheet(java.lang.String name)
name
- the name (null
not permitted).Method Detail |
public boolean isAllowCaching()
true
if caching is allowed, and false
otherwise.
public boolean isLocalKey(StyleKey key)
key
- the key to test
public void setAllowCaching(boolean allowCaching)
allowCaching
- the flag value.public java.lang.String getName()
null
).public void addParent(ElementStyleSheet parent)
parent
- the parent (null
not permitted).public void addDefaultParent(ElementStyleSheet parent)
The default parents operations are reserved for the system internal stylesheet operations. If you want to add own stylesheets, use the addParent methods.
parent
- the parent (null
not permitted).public void addParent(int position, ElementStyleSheet parent)
position
- the position where to insert the parent style sheetparent
- the parent (null
not permitted).
java.lang.IndexOutOfBoundsException
- if the position is invalid (pos < 0 or pos >=
numberOfParents)public void addDefaultParent(int position, ElementStyleSheet parent)
The default parents operations are reserved for the system internal stylesheet operations. If you want to add own stylesheets, use the addParent methods.
Only default style sheets should be added with this method.
position
- the position where to insert the parent style sheetparent
- the parent (null
not permitted).
java.lang.IndexOutOfBoundsException
- if the position is invalid (pos < 0 or pos >=
numberOfParents)public boolean isSubStyleSheet(ElementStyleSheet parent)
parent
- the element that should be tested.
public void removeParent(ElementStyleSheet parent)
parent
- the style-sheet to remove (null
not permitted).public void removeDefaultParent(ElementStyleSheet parent)
parent
- the style-sheet to remove (null
not permitted).public java.util.List getParents()
The list is unmodifiable.
public java.util.List getDefaultParents()
The list is unmodifiable.
public java.lang.Object getStyleProperty(StyleKey key)
null
is returned.
key
- the style key.
public java.lang.Object getStyleProperty(StyleKey key, java.lang.Object defaultValue)
null
) is returned.
key
- the style key.defaultValue
- the default value (null
permitted).
public void setBooleanStyleProperty(StyleKey key, boolean value)
key
- the style key (null
not permitted).value
- the value.
java.lang.NullPointerException
- if the given key is null.
java.lang.ClassCastException
- if the value cannot be assigned with the given key.public void setStyleProperty(StyleKey key, java.lang.Object value)
null
).
key
- the style key (null
not permitted).value
- the value.
java.lang.NullPointerException
- if the given key is null.
java.lang.ClassCastException
- if the value cannot be assigned with the given key.public ElementStyleSheet getCopy()
public boolean getBooleanStyleProperty(StyleKey key)
key
- the style key.
true
or false
.public boolean getBooleanStyleProperty(StyleKey key, boolean defaultValue)
key
- the style key.defaultValue
- the default value.
public int getIntStyleProperty(StyleKey key, int def)
key
- the style key.def
- the default value.
public FontDefinition getFontDefinitionProperty()
public void setFontDefinitionProperty(FontDefinition font)
font
- the font (null
not permitted).public java.util.Iterator getDefinedPropertyNames()
public void addListener(StyleChangeListener l)
StyleChangeListener
.
l
- the listener.public void removeListener(StyleChangeListener l)
StyleChangeListener
.
l
- the listener.public void styleChanged(ElementStyleSheet source, StyleKey key, java.lang.Object value)
StyleChangeListener
objects.
styleChanged
in interface StyleChangeListener
source
- the source of the change.key
- the style key.value
- the new value.public void styleRemoved(ElementStyleSheet source, StyleKey key)
StyleChangeListener
objects.
styleRemoved
in interface StyleChangeListener
source
- the source of the change.key
- the style key.public java.lang.Object clone()
Cloneable
public StyleSheetCollection getStyleSheetCollection()
public void registerStyleSheetCollection(StyleSheetCollection styleSheetCollection) throws InvalidStyleSheetCollectionException
InvalidStyleSheetCollectionException
.
styleSheetCollection
- the stylesheet collection that should be registered.
InvalidStyleSheetCollectionException
- if there is already an other
stylesheet registered.
java.lang.NullPointerException
- if the given stylesheet collection is null.public void unregisterStyleSheetCollection(StyleSheetCollection styleSheetCollection) throws InvalidStyleSheetCollectionException
InvalidStyleSheetCollectionException
styleSheetCollection
- the stylesheet collection that should be unregistered.
InvalidStyleSheetCollectionException
- if there is already an other stylesheet
registered.
java.lang.NullPointerException
- if the given stylesheet collection is null.public InstanceID getId()
public boolean isGlobalDefault()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |