|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.graphiti.util.TextBuilder
public class TextBuilder
Class to construct TextStyleRegion
s while adding text.
Nested Class Summary | |
---|---|
static class |
TextBuilder.TextBuilderRegion
Inner class for storing the partial region styles. |
Field Summary | |
---|---|
private int |
length
Number of code points in text . |
private List<TextStyleRegion> |
regions
Regions created in the collected text. |
private Map<String,TextBuilder.TextBuilderRegion> |
styles
Partly finished text styles. |
private StringBuilder |
text
Constructed text string. |
Constructor Summary | |
---|---|
TextBuilder()
|
Method Summary | |
---|---|
void |
add(String text)
Add text to the builder. |
void |
finishRegion(String name)
Finish a region. |
void |
forgetRegion(String name)
Drop a region that was created but not yet finished. |
int |
getLength()
Get current length of the collected text. |
TextBuilder.TextBuilderRegion |
getRegion(String name)
Get a previously created and not yet finished region. |
List<TextStyleRegion> |
getRegions()
Get the regions created and finished for the text. |
boolean |
isEmpty()
Is any text added yet? |
TextBuilder.TextBuilderRegion |
startRegion(String name)
Start a new region in the text. |
String |
toString()
Get the collected text. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private StringBuilder text
private int length
text
.
private List<TextStyleRegion> regions
private Map<String,TextBuilder.TextBuilderRegion> styles
Constructor Detail |
---|
public TextBuilder()
Method Detail |
---|
public void add(String text)
text
- Text to append.public int getLength()
public boolean isEmpty()
true
if no text added yet, else false
.public String toString()
toString
in class Object
add(java.lang.String)
.public List<TextStyleRegion> getRegions()
public TextBuilder.TextBuilderRegion startRegion(String name)
name
- Name of the region.
public TextBuilder.TextBuilderRegion getRegion(String name)
name
- Name of the region to retrieve.
null
.public void finishRegion(String name)
name
- Name of the region to finish.public void forgetRegion(String name)
name
- Name of the region to forget.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |