|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object se.biltmore.tools.odttoapt.maven.plugin.models.APT se.biltmore.tools.odttoapt.maven.plugin.models.APTParent se.biltmore.tools.odttoapt.maven.plugin.models.APTParagraph
public class APTParagraph
This represents a paragraph in a APT document. This is created for each <text:p ...> in the odt file.
A paragraph is just one block of text, but parts of it can have different formatting like bold, italic, etc. The odt XML format in content.xml handles this by <text:span text:style-name="APT-Text-Bold"> child elements. There can be plain text both before, in-between, and after these.
This was easiest handled by letting APTParagraph be a parent and accept different subclasses of APTText as children. This will receive setValue(...) calls for the text in the <text:p> element. This can come multiple times for the same block of text that gets delivered in parts. So we add all received text to a StringBuilder. When a <test:span> element occurs an APTText subclass will be added as a child. Before the child is added we convert the StringBuilder to a string and create an APTText instance and add the text to it, and add it as a child before the received child. To catch the last pieces of text we also override done() and take any new text and put in a new APTText and add as a child.
Field Summary | |
---|---|
private StringBuilder |
localValue
This collets received values. |
Constructor Summary | |
---|---|
APTParagraph()
Creates a new APTParagraph instance. |
Method Summary | |
---|---|
void |
addChild(APT child)
Adds a child text part to this paragraph. |
void |
done()
This gets called when this APT object has received all data. |
protected String |
getValue()
Returns the value. |
protected String |
getValue(String formatPrefix)
Returns the formatted value. |
void |
setValue(String value)
Sets the value for this APT. |
Methods inherited from class se.biltmore.tools.odttoapt.maven.plugin.models.APTParent |
---|
getChildren, getLastChild, getUnformattedValue, hasChildren |
Methods inherited from class se.biltmore.tools.odttoapt.maven.plugin.models.APT |
---|
formatText, getParent, hasValue, isAllowFormat, isLink, setAllowFormat, setLink, setParent, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private StringBuilder localValue
Constructor Detail |
---|
public APTParagraph()
Method Detail |
---|
public void setValue(String value)
setValue
in class APT
value
- The value to set.public void addChild(APT child)
addChild
in class APTParent
child
- The text part to add.public void done()
done
in class APT
protected String getValue()
getValue
in class APT
protected String getValue(String formatPrefix)
formatPrefix
- The prefix to use for the format.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |