org.odftoolkit.odfdom.dom.element
Class OdfStyleBase

java.lang.Object
  extended by org.apache.xerces.dom.NodeImpl
      extended by org.apache.xerces.dom.ChildNode
          extended by org.apache.xerces.dom.ParentNode
              extended by org.apache.xerces.dom.ElementImpl
                  extended by org.apache.xerces.dom.ElementNSImpl
                      extended by org.odftoolkit.odfdom.pkg.OdfElement
                          extended by org.odftoolkit.odfdom.pkg.OdfContainerElementBase
                              extended by org.odftoolkit.odfdom.dom.element.OdfStyleBase
All Implemented Interfaces:
Serializable, Cloneable, Comparable, OdfStylePropertySet, Element, EventTarget, Node, NodeList, TypeInfo
Direct Known Subclasses:
StyleDefaultStyleElement, StyleFooterStyleElement, StyleHeaderStyleElement, StylePageLayoutElement, StyleStyleElement, TextListLevelStyleElementBase, TextListStyleElement, TextOutlineLevelStyleElement

public abstract class OdfStyleBase
extends OdfContainerElementBase
implements OdfStylePropertySet, Comparable

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.odftoolkit.odfdom.pkg.OdfContainerElementBase
mPackageDocument
 
Fields inherited from class org.apache.xerces.dom.ElementNSImpl
localName, namespaceURI
 
Fields inherited from class org.apache.xerces.dom.ElementImpl
attributes, name
 
Fields inherited from class org.apache.xerces.dom.ParentNode
firstChild, fNodeListCache, ownerDocument
 
Fields inherited from class org.apache.xerces.dom.ChildNode
nextSibling, previousSibling
 
Fields inherited from class org.apache.xerces.dom.NodeImpl
DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_IS_CONTAINED, DOCUMENT_POSITION_PRECEDING, ELEMENT_DEFINITION_NODE, FIRSTCHILD, flags, HASSTRING, ID, IGNORABLEWS, NORMALIZED, OWNED, ownerNode, READONLY, SPECIFIED, SYNCCHILDREN, SYNCDATA, TREE_POSITION_ANCESTOR, TREE_POSITION_DESCENDANT, TREE_POSITION_DISCONNECTED, TREE_POSITION_EQUIVALENT, TREE_POSITION_FOLLOWING, TREE_POSITION_PRECEDING, TREE_POSITION_SAME_NODE
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Fields inherited from interface org.w3c.dom.TypeInfo
DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION
 
Constructor Summary
OdfStyleBase(OdfFileDom ownerDocument, OdfName aName)
          Creates a new instance of OdfElement
OdfStyleBase(OdfFileDom ownerDocument, String namespaceURI, String qualifiedName)
          Creates a new instance of OdfElement
 
Method Summary
 void addStyleUser(OdfStylableElement user)
           
 int compareTo(Object obj)
          compare one style to another one.
 boolean equals(Object obj)
          Indicates if some other object is equal to this one.
 OdfStyleFamily getFamily()
           
 String getFamilyName()
           
 OdfStylePropertiesBase getOrCreatePropertiesElement(OdfStylePropertiesSet set)
           
 OdfStyleBase getParentStyle()
           
 Map<OdfStyleProperty,String> getProperties(Set<OdfStyleProperty> properties)
          gets more than one property at once
 OdfStylePropertiesBase getPropertiesElement(OdfStylePropertiesSet set)
           
 String getProperty(OdfStyleProperty prop)
          returns the given property from this styleable element or style.
 Set<OdfStyleProperty> getStrictProperties()
           
 Map<OdfStyleProperty,String> getStyleProperties()
          get a map containing all properties of this style and their values.
 Map<OdfStyleProperty,String> getStylePropertiesDeep()
          get a map containing all properties of this style and their values.
 int getStyleUserCount()
           
 Iterable<OdfStylableElement> getStyleUsers()
          Returns an iterator for all OdfStylableElement elements using this style.
 int hashCode()
           
 boolean hasProperty(OdfStyleProperty prop)
          checks if this styleable element or style has this property directly set.
protected  void onOdfNodeInserted(OdfElement node, Node refChild)
          override this method to get notified about element insertion
protected  void onOdfNodeRemoved(OdfElement node)
          override this method to get notified about element insertion
 void removeProperty(OdfStyleProperty property)
          removes the given property from this set
 void removeStyleUser(OdfStylableElement user)
           
 void setProperties(Map<OdfStyleProperty,String> properties)
          set more than one property at once.
 void setProperty(OdfStyleProperty property, String value)
          sets a single style property for this element.
 
Methods inherited from class org.odftoolkit.odfdom.pkg.OdfContainerElementBase
insertBefore, removeChild, replaceChild
 
Methods inherited from class org.odftoolkit.odfdom.pkg.OdfElement
accept, cloneNode, findFirstChildNode, findNextChildNode, findPreviousChildNode, getAncestorAs, getOdfAttribute, getOdfAttribute, getOdfAttributeValue, getOdfName, getParentAs, hasOdfAttribute, onInsertNode, onInsertNode, onRemoveNode, onRemoveNode, setOdfAttribute, setOdfAttributeValue, toString
 
Methods inherited from class org.apache.xerces.dom.ElementNSImpl
getBaseURI, getLocalName, getNamespaceURI, getPrefix, getTypeName, getTypeNamespace, isDerivedFrom, setPrefix, setType, setValues
 
Methods inherited from class org.apache.xerces.dom.ElementImpl
getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getDefaultAttributes, getElementsByTagName, getElementsByTagNameNS, getNodeName, getNodeType, getSchemaTypeInfo, getTagName, getXercesAttribute, hasAttribute, hasAttributeNS, hasAttributes, isEqualNode, normalize, reconcileDefaultAttributes, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setOwnerDocument, setReadOnly, setupDefaultAttributes, setXercesAttributeNode, synchronizeData
 
Methods inherited from class org.apache.xerces.dom.ParentNode
getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, getOwnerDocument, getTextContent, hasChildNodes, item, setTextContent, synchronizeChildren
 
Methods inherited from class org.apache.xerces.dom.ChildNode
getNextSibling, getParentNode, getPreviousSibling
 
Methods inherited from class org.apache.xerces.dom.NodeImpl
addEventListener, appendChild, changed, changes, compareDocumentPosition, compareTreePosition, dispatchEvent, getContainer, getFeature, getNodeNumber, getNodeValue, getReadOnly, getUserData, getUserData, getUserDataRecord, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, needsSyncChildren, removeEventListener, setNodeValue, setUserData, setUserData
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, compareDocumentPosition, getChildNodes, getFeature, getFirstChild, getLastChild, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPreviousSibling, getTextContent, getUserData, hasChildNodes, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, setNodeValue, setTextContent, setUserData
 

Constructor Detail

OdfStyleBase

public OdfStyleBase(OdfFileDom ownerDocument,
                    String namespaceURI,
                    String qualifiedName)
             throws DOMException
Creates a new instance of OdfElement

Throws:
DOMException

OdfStyleBase

public OdfStyleBase(OdfFileDom ownerDocument,
                    OdfName aName)
             throws DOMException
Creates a new instance of OdfElement

Throws:
DOMException
Method Detail

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.

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.

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()

getParentStyle

public OdfStyleBase getParentStyle()


Copyright © 2008-2011 The Apache Software Foundation. All Rights Reserved.