public class Span extends Component implements TextHyperlinkContainer
It provides convenient methods to create a span and manipulate attributes of a span.
Modifier and Type | Method and Description |
---|---|
TextHyperlink |
appendHyperlink(String text,
URI linkto)
Append a hyperlink at the end of the container
|
void |
appendTextContent(String content)
Append the text content at the end of this span.
|
void |
appendTextContent(String content,
boolean isStyleInherited)
Append the text content at the end of this span.
|
TextHyperlink |
applyHyperlink(URI linkto)
Hyperlink support
|
Iterator<TextHyperlink> |
getHyperlinkIterator()
Get the iterator of hyperlinks within this container element
|
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 |
removeHyperlinks()
Remove all the hyperlinks in this container element.
|
void |
removeTextContent()
Remove the text content of this span.
|
void |
setTextContent(String content)
Set the text content of this span.
|
getComponentByElement, registerComponent, unregisterComponent
public static Span getInstanceof(TextSpanElement sElement)
TextSpanElement
.sElement
- - the instance of TextSpanElementpublic static Span newSpan(TextSelection textSelection)
textSelection
- the TextSelection which the span is applied to.TextSelection
public DefaultStyleHandler getStyleHandler()
The style handler is an instance of DefaultStyleHandler
DefaultStyleHandler
public Document getOwnerDocument()
getOwnerDocument
in class Component
public TextSpanElement getOdfElement()
getOdfElement
in class Component
public void removeTextContent()
public void setTextContent(String content)
All the existing text content of this paragraph would be removed, and then new text content would be set.
content
- - the text contentpublic String getTextContent()
The other child elements except text content will not be returned.
public void appendTextContent(String content)
The appended text would follow the style of the last character.
content
- - the text contentpublic void appendTextContent(String content, boolean isStyleInherited)
The appended text would follow the style of the last character if the second parameter is set to true; Or else, the appended text would follow the default style of this paragraph.
content
- - the text contentisStyleInherited
- - whether the hyperlink style would be inherited by the
appended textpublic TextHyperlink applyHyperlink(URI linkto)
applyHyperlink
in interface TextHyperlinkContainer
linkto
- the hyperlinkpublic Iterator<TextHyperlink> getHyperlinkIterator()
TextHyperlinkContainer
getHyperlinkIterator
in interface TextHyperlinkContainer
public void removeHyperlinks()
TextHyperlinkContainer
removeHyperlinks
in interface TextHyperlinkContainer
public TextHyperlink appendHyperlink(String text, URI linkto)
TextHyperlinkContainer
appendHyperlink
in interface TextHyperlinkContainer
text
- - the text contentlinkto
- - the URI of this hyperlinkCopyright © 2010-2013 The Apache Software Foundation. All Rights Reserved.