org.jopendocument.dom
Class StyledNode<S extends Style,D extends ODDocument>

java.lang.Object
  extended by org.jopendocument.dom.ODNode
      extended by org.jopendocument.dom.StyledNode<S,D>
Type Parameters:
S - type of style.
D - type of document.
Direct Known Subclasses:
ImmutableDocStyledNode, TextNode

public abstract class StyledNode<S extends Style,D extends ODDocument>
extends ODNode

A node with a style.

Author:
Sylvain CUAZ

Constructor Summary
StyledNode(org.jdom.Element local, java.lang.Class<S> styleClass)
          Create a new instance.
 
Method Summary
abstract  D getODDocument()
           
 S getPrivateStyle()
          Assure that this node's style is only referenced by this.
 S getStyle()
           
 StyleDesc<S> getStyleDesc()
           
<S2 extends Style>
StyleDesc<S2>
getStyleDesc(java.lang.Class<S2> clazz)
           
<S2 extends StyleStyle>
StyleStyleDesc<S2>
getStyleStyleDesc(java.lang.Class<S2> clazz)
           
static void setStyleName(org.jdom.Element elem, java.lang.String name)
           
 void setStyleName(java.lang.String name)
           
 
Methods inherited from class org.jopendocument.dom.ODNode
getElement, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StyledNode

public StyledNode(org.jdom.Element local,
                  java.lang.Class<S> styleClass)
Create a new instance. We used to find the Style class with reflection but this was slow.

Parameters:
local - our XML model.
styleClass - our class of style, cannot be null.
Method Detail

setStyleName

public static final void setStyleName(org.jdom.Element elem,
                                      java.lang.String name)

getODDocument

public abstract D getODDocument()

getStyleDesc

public final StyleDesc<S> getStyleDesc()

getStyleDesc

public final <S2 extends Style> StyleDesc<S2> getStyleDesc(java.lang.Class<S2> clazz)

getStyleStyleDesc

public final <S2 extends StyleStyle> StyleStyleDesc<S2> getStyleStyleDesc(java.lang.Class<S2> clazz)

getStyle

public final S getStyle()

getPrivateStyle

public final S getPrivateStyle()
Assure that this node's style is only referenced by this. I.e. after this method returns the style of this node can be safely modified without affecting other nodes.

Returns:
this node's style, never null.

setStyleName

public final void setStyleName(java.lang.String name)