Class ElementStyleSheet

  • All Implemented Interfaces:
    Serializable, Cloneable, StyleSheet
    Direct Known Subclasses:
    CSSCounterRule, ElementDefaultStyleSheet, ElementStyleRule, ResolverStyleSheet

    public class ElementStyleSheet
    extends AbstractStyleSheet
    implements Serializable, Cloneable
    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.

    As usual, this implementation is not synchronized, we need the performance during the reporting.

    Author:
    Thomas Morgner
    See Also:
    Serialized Form
    • Constructor Detail

      • ElementStyleSheet

        public ElementStyleSheet()
        Creates a new element style-sheet. The style-sheet initially contains no attributes, and has no parent style-sheets.
    • Method Detail

      • isLocalKey

        public boolean isLocalKey​(StyleKey key)
        Returns true, if the given key is locally defined, false otherwise.
        Specified by:
        isLocalKey in interface StyleSheet
        Overrides:
        isLocalKey in class AbstractStyleSheet
        Parameters:
        key - the key to test
        Returns:
        true, if the key is local, false otherwise.
      • getStyleProperty

        public Object getStyleProperty​(StyleKey key,
                                       Object defaultValue)
        Returns the value of a style. If the style is not found in this style-sheet, the code looks in the parent style-sheets. If the style is not found in any of the parent style-sheets, then the default value (possibly null) is returned.
        Specified by:
        getStyleProperty in interface StyleSheet
        Parameters:
        key - the style key.
        defaultValue - the default value (null permitted).
        Returns:
        the value.
      • setBooleanStyleProperty

        public void setBooleanStyleProperty​(StyleKey key,
                                            boolean value)
        Sets a boolean style property.
        Parameters:
        key - the style key (null not permitted).
        value - the value.
        Throws:
        NullPointerException - if the given key is null.
        ClassCastException - if the value cannot be assigned with the given key.
      • setStyleProperty

        public void setStyleProperty​(StyleKey key,
                                     Object value)
        Sets a style property (or removes the style if the value is null).
        Parameters:
        key - the style key (null not permitted).
        value - the value.
        Throws:
        NullPointerException - if the given key is null.
        ClassCastException - if the value cannot be assigned with the given key.
      • clone

        public ElementStyleSheet clone()
        Creates and returns a copy of this object. After the cloning, the new StyleSheet is no longer registered with its parents.
        Overrides:
        clone in class AbstractStyleSheet
        Returns:
        a clone of this instance.
        See Also:
        Cloneable
      • getDefinedPropertyNamesArray

        public StyleKey[] getDefinedPropertyNamesArray()
      • getPropertyKeys

        public StyleKey[] getPropertyKeys()
        Returns the property keys. This must return the same set of keys as a call to StyleSheet.getDefinedKeys(), but it allows us to avoid the synchronization on that call.
        Returns:
        the local copy of the style keys.
      • getPropertyKeyList

        public List<StyleKey> getPropertyKeyList()
      • addInherited

        public void addInherited​(SimpleStyleSheet sourceStyleSheet)
      • clear

        public void clear()
      • setModificationCount

        protected void setModificationCount​(long modificationCount)
      • setChangeTrackerHash

        protected void setChangeTrackerHash​(long changeTracker)