org.odftoolkit.simple.text
Class Span

java.lang.Object
  extended by org.odftoolkit.simple.Component
      extended by org.odftoolkit.simple.text.Span

public class Span
extends Component

This class represents the application of a style to the character data of a portion of text.

It provides convenient methods to create a span and manipulate attributes of a span.

Since:
0.5.5

Method Summary
 void appendTextContent(String content)
          Append the text content at the end of this paragraph.
static Span getInstanceof(TextSpanElement sElement)
          Get a span instance by an instance of TextSpanElement.
 TextSpanElement getOdfElement()
          Return the instance of "text:span" element
 Document getOwnerDocument()
          Get the owner document of this span
 DefaultStyleHandler getStyleHandler()
          Get the style handler of this span.
 String getTextContent()
          Return the text content of this span.
static Span newSpan(TextSelection textSelection)
          Create a span instance with a text selection
 void removeTextContent()
          Remove the text content of this span.
 void setTextContent(String content)
          Set the text content of this span.
 
Methods inherited from class org.odftoolkit.simple.Component
getComponentByElement, registerComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstanceof

public static Span getInstanceof(TextSpanElement sElement)
Get a span instance by an instance of TextSpanElement.

Parameters:
sElement - - the instance of TextSpanElement
Returns:
an instance of span

newSpan

public static Span newSpan(TextSelection textSelection)
Create a span instance with a text selection

Parameters:
text -
Returns:
an instance of span
See Also:
TextSelection

getStyleHandler

public DefaultStyleHandler getStyleHandler()
Get the style handler of this span.

The style handler is an instance of DefaultStyleHandler

Returns:
an instance of DefaultStyleHandler
See Also:
DefaultStyleHandler

getOwnerDocument

public Document getOwnerDocument()
Get the owner document of this span

Overrides:
getOwnerDocument in class Component
Returns:
the document who owns this span

getOdfElement

public TextSpanElement getOdfElement()
Return the instance of "text:span" element

Specified by:
getOdfElement in class Component
Returns:
the instance of "text:span" element

removeTextContent

public void removeTextContent()
Remove the text content of this span.


setTextContent

public void setTextContent(String content)
Set the text content of this span.

All the existing text content of this paragraph would be removed, and then new text content would be set.

Parameters:
content - - the text content

getTextContent

public String getTextContent()
Return the text content of this span.

The other child elements except text content will not be returned.

Returns:
- the text content of this span

appendTextContent

public void appendTextContent(String content)
Append the text content at the end of this paragraph.

Parameters:
content - - the text content


Copyright © 2010-2011 ODF Toolkit Project. All Rights Reserved.