org.jopendocument.dom
Class StyleDesc<S extends Style>

java.lang.Object
  extended by org.jopendocument.dom.StyleDesc<S>
Type Parameters:
S - type of style
Direct Known Subclasses:
DataStyle.DataStyleDesc, StyleStyleDesc

public abstract class StyleDesc<S extends Style>
extends java.lang.Object

Describe a family of style.

Author:
Sylvain CUAZ

Method Summary
static
<C extends Style>
StyleDesc<C>
copy(StyleDesc<C> toClone, XMLVersion version)
           
abstract  S create(ODPackage pkg, org.jdom.Element e)
           
 S createAutoStyle(ODPackage pkg)
           
 S createAutoStyle(ODPackage pkg, java.lang.String baseName)
          Create a new automatic style in the content of pkg.
 S createCommonStyle(ODPackage pkg, java.lang.String styleName)
           
 S findStyleForNode(ODPackage pkg, org.jdom.Document doc, StyledNode<S,?> styledNode, java.lang.String name)
           
 S findStyleForNode(StyledNode<S,?> styledNode, java.lang.String name)
          Find the style for the passed node.
 S findStyleWithName(ODPackage pkg, org.jdom.Document doc, java.lang.String name)
          Resolve the passed style name.
 java.lang.String getBaseName()
           
 java.lang.String getElementName()
          The name of the XML element for this type of style.
 org.jdom.Namespace getElementNS()
           
 XMLVersion getVersion()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

copy

public static <C extends Style> StyleDesc<C> copy(StyleDesc<C> toClone,
                                                  XMLVersion version)

create

public abstract S create(ODPackage pkg,
                         org.jdom.Element e)

getVersion

public final XMLVersion getVersion()

getElementNS

public final org.jdom.Namespace getElementNS()

getElementName

public final java.lang.String getElementName()
The name of the XML element for this type of style.

Returns:
the name of the element, e.g. "style" or "master-page".

getBaseName

public final java.lang.String getBaseName()

findStyleWithName

public final S findStyleWithName(ODPackage pkg,
                                 org.jdom.Document doc,
                                 java.lang.String name)
Resolve the passed style name. Note: this always return the style named name, possibly ignoring conditions.

Parameters:
pkg - the package of the searched for style.
doc - the document of the searched for style.
name - the name of the style.
Returns:
the corresponding style, null if not found.
See Also:
findStyleForNode(StyledNode, String)

findStyleForNode

public final S findStyleForNode(StyledNode<S,?> styledNode,
                                java.lang.String name)
Find the style for the passed node. Depending on conditions the returned style might not be named name.

Parameters:
styledNode - needed to evaluate conditions, not null.
name - the name of the style.
Returns:
the corresponding style, null if not found.
See Also:
findStyleWithName(ODPackage, Document, String)

findStyleForNode

public final S findStyleForNode(ODPackage pkg,
                                org.jdom.Document doc,
                                StyledNode<S,?> styledNode,
                                java.lang.String name)

createAutoStyle

public final S createAutoStyle(ODPackage pkg)

createAutoStyle

public final S createAutoStyle(ODPackage pkg,
                               java.lang.String baseName)
Create a new automatic style in the content of pkg.

Parameters:
pkg - where to add the new style.
baseName - the base name for the new style, eg "ce".
Returns:
the new style, eg named "ce3".

createCommonStyle

public final S createCommonStyle(ODPackage pkg,
                                 java.lang.String styleName)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object