Class OdfStyleBase

All Implemented Interfaces:
Serializable, Cloneable, Comparable, OdfStylePropertySet, Element, ElementTraversal, EventTarget, Node, NodeList, TypeInfo
Direct Known Subclasses:
StyleDefaultStyleElement, StylePageLayoutElement, StyleStyleElement, TextListLevelStyleElementBase, TextListStyleElement, TextOutlineLevelStyleElement

public abstract class OdfStyleBase extends OdfContainerElementBase implements OdfStylePropertySet, Comparable
A placeholder for multiple style incarnation, for instance <style:style> from either the automatic or the template styles parent, e.g. StyleStyleElement is inheriting from it
See Also:
  • Constructor Details

  • Method Details

    • addStyleUser

      public void addStyleUser(OdfStylableElement user)
    • getStyleProperties

      public Map<OdfStyleProperty,String> getStyleProperties()
      get a map containing all properties of this style and their values.
      Returns:
      map of properties. @Deprecated Broken by design as the same OdfStlyeProperty can occur multiple times and would be overwritten (e.g. background color exist 3times in cells).
    • getStylePropertiesDeep

      public Map<OdfStyleProperty,String> getStylePropertiesDeep()
      get a map containing all properties of this style and their values. The map will also include any properties set by parent styles
      Returns:
      a map of all the properties. @Deprecated Broken by design as the same OdfStlyeProperty can occur multiple times and would be overwritten (e.g. background color exist 3times in cells).
    • removeStyleUser

      public void removeStyleUser(OdfStylableElement user)
    • getStyleUserCount

      public int getStyleUserCount()
    • getStyleUsers

      public Iterable<OdfStylableElement> getStyleUsers()
      Returns an iterator for all OdfStylableElement elements using this style.
      Returns:
      an iterator for all OdfStylableElement elements using this style
    • getFamilyName

      public String getFamilyName()
    • getPropertiesElement

      public OdfStylePropertiesBase getPropertiesElement(OdfStylePropertiesSet set)
      Parameters:
      set -
      Returns:
      the style:*-properties element for the given set. Returns null if such element does not exist yet.
    • getOrCreatePropertiesElement

      public OdfStylePropertiesBase getOrCreatePropertiesElement(OdfStylePropertiesSet set)
      Parameters:
      set -
      Returns:
      the style:*-properties element for the given set. If such element does not yet exist, it is created.
    • getProperty

      public String getProperty(OdfStyleProperty prop)
      Description copied from interface: OdfStylePropertySet
      returns the given property from this styleable element or style. If it is not directly set, the value of this property from a parent style will be returned.
      Specified by:
      getProperty in interface OdfStylePropertySet
      Parameters:
      prop - is the property which value will be returned.
      Returns:
      a property value.
    • hasProperty

      public boolean hasProperty(OdfStyleProperty prop)
      Description copied from interface: OdfStylePropertySet
      checks if this styleable element or style has this property directly set.
      Specified by:
      hasProperty in interface OdfStylePropertySet
      Parameters:
      prop - is the property to check.
      Returns:
      true if this property is directly set at this instance or false if not.
    • onOdfNodeInserted

      protected void onOdfNodeInserted(OdfElement node, Node refChild)
      Description copied from class: OdfContainerElementBase
      override this method to get notified about element insertion
      Overrides:
      onOdfNodeInserted in class OdfContainerElementBase
    • onOdfNodeRemoved

      protected void onOdfNodeRemoved(OdfElement node)
      Description copied from class: OdfContainerElementBase
      override this method to get notified about element insertion
      Overrides:
      onOdfNodeRemoved in class OdfContainerElementBase
    • getProperties

      public Map<OdfStyleProperty,String> getProperties(Set<OdfStyleProperty> properties)
      Description copied from interface: OdfStylePropertySet
      gets more than one property at once
      Specified by:
      getProperties in interface OdfStylePropertySet
      Parameters:
      properties - is a set of all properties that should be returned.
      Returns:
      a map with all asked properties and theire value, if available.
    • getStrictProperties

      public Set<OdfStyleProperty> getStrictProperties()
      Specified by:
      getStrictProperties in interface OdfStylePropertySet
      Returns:
      a set with all properties which are specified in the strict odf format.
    • removeProperty

      public void removeProperty(OdfStyleProperty property)
      Description copied from interface: OdfStylePropertySet
      removes the given property from this set
      Specified by:
      removeProperty in interface OdfStylePropertySet
      Parameters:
      property - is the property to be removed
    • setProperties

      public void setProperties(Map<OdfStyleProperty,String> properties)
      Description copied from interface: OdfStylePropertySet
      set more than one property at once.
      Specified by:
      setProperties in interface OdfStylePropertySet
      Parameters:
      properties - is a map of properties with values that should be set.
    • setProperty

      public void setProperty(OdfStyleProperty property, String value)
      Description copied from interface: OdfStylePropertySet
      sets a single style property for this element.
      Specified by:
      setProperty in interface OdfStylePropertySet
      Parameters:
      property - is the property that you want to set.
      value - is the value the property is set to.
    • compareTo

      public int compareTo(Object obj)
      compare one style to another one. This implements a total order on style objects.
      Specified by:
      compareTo in interface Comparable
      Parameters:
      obj - - the reference object with which to compare2.
      Returns:
      0 if this object is the same as the obj argument; -1 if this object is less than the obj argument; 1 if this object is greater than the obj argument
    • equals

      public boolean equals(Object obj)
      Indicates if some other object is equal to this one. The attribute style:name is ignored during compare2.
      Overrides:
      equals in class OdfElement
      Parameters:
      obj - - the reference object with which to compare2.
      Returns:
      true if this object is the same as the obj argument; false otherwise.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getFamily

      public OdfStyleFamily getFamily()
      Returns:
      the style family of the style or null if none existent
    • getParentStyle

      public OdfStyleBase getParentStyle()
      Returns:
      the style parent of the style or null if none existent