public abstract class AbstractAsciiList extends Object implements AsciiList
AsciiList hierarchy.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
isContinued
Flag indicating if the list is continued from a previous list of the same type or not.
|
protected List<Object> |
items
The items of a list.
|
protected int |
level
The level of the list, default is 1.
|
protected int |
maxItemIndent
The maximum item indentation, 0 until calculated.
|
protected int |
postLabelIndent
The indentation after the label (and the post-label string), default is 1.
|
protected String |
postLabelStr
A string printed directly after the label, other than indentation, default is empty string.
|
protected int |
preLabelIndent
The indentation before the label (and the pre-label string), default is 1.
|
protected String |
preLabelStr
A string printed directly before the label, other than indentation, default is empty string.
|
protected int |
width
The maximum width if the list (and all items and sub-lists), -1 for no width until set otherwise.
|
IMPLICIT_NEWLINE| Constructor and Description |
|---|
AbstractAsciiList()
Creates a new list.
|
AbstractAsciiList(AbstractAsciiList list)
Creates a new list.
|
AbstractAsciiList(boolean isContinued)
Creates a new list.
|
| Modifier and Type | Method and Description |
|---|---|
int |
calculateMaxIndentation()
Calculates indentation for each element of the list and returns the maximum value.
|
List<Object> |
getItems()
Returns the items of the list.
|
int |
getLevel()
Returns the level of the list.
|
int |
getPostLabelIndent()
Sets the indentation to be used for an item after the label (and before the post-label string).
|
String |
getPostLabelString()
Sets a string to be printed after an item label (and before the post-label indentation).
|
int |
getPreLabelIndent()
Gets the indentation to be used for an item before the label (and after the pre-label string).
|
String |
getPreLabelString()
Sets a string to be printed before an item label (and after the pre-label indentation).
|
boolean |
isContinuedList()
Returns a flag indicating if the list is continued from a previous list of the same type or not.
|
void |
prepareRender()
Prepares a list to be rendered.
|
String |
render()
Renders the list, generates a string representation of it.
|
AsciiList |
setLabelDefaults()
Sets the values for pre/post paramters of labels back to their default values.
|
AsciiList |
setLevel(int level)
Sets the level of the list.
|
AsciiList |
setPostLabelIndent(int indent)
Sets the indentation to be used for an item after the label (and before the post-label string).
|
AsciiList |
setPostLabelString(String str)
Sets a string to be printed after an item label (and before the post-label indentation).
|
AsciiList |
setPreLabelIndent(int indent)
Sets the indentation to be used for an item before the label (and after the pre-label string).
|
AsciiList |
setPreLabelString(String str)
Sets a string to be printed before an item label (and after the pre-label indentation).
|
AsciiList |
setWidth(int width)
Sets the (maximum) width a list (and all items and sub-lists) can have when being rendered.
|
protected String |
wrapItem(String renderedItem)
Wraps a rendered list item for the width given in the list.
|
protected String |
wrapItemNextLine(String str)
Wraps all following lines of an item
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcalculateMaxIndentation, copy, renderItem, setListStyleprotected int preLabelIndent
protected int postLabelIndent
protected String preLabelStr
protected String postLabelStr
protected int level
protected final boolean isContinued
protected int maxItemIndent
protected int width
public AbstractAsciiList()
public AbstractAsciiList(AbstractAsciiList list)
list - original listpublic AbstractAsciiList(boolean isContinued)
isContinued - true if the list is continued from a previous list of the same type, false otherwisepublic AsciiList setLabelDefaults()
AsciiListsetLabelDefaults in interface AsciiListpublic int calculateMaxIndentation()
AsciiListcalculateMaxIndentation in interface AsciiListpublic List<Object> getItems()
AsciiListpublic int getLevel()
AsciiListpublic int getPostLabelIndent()
AsciiListgetPostLabelIndent in interface AsciiListpublic String getPostLabelString()
AsciiListgetPostLabelString in interface AsciiListpublic int getPreLabelIndent()
AsciiListgetPreLabelIndent in interface AsciiListpublic String getPreLabelString()
AsciiListgetPreLabelString in interface AsciiListpublic boolean isContinuedList()
AsciiListisContinuedList in interface AsciiListpublic String render()
AsciiListpublic AsciiList setLevel(int level)
AsciiListpublic void prepareRender()
AsciiListprepareRender in interface AsciiListpublic AsciiList setPostLabelIndent(int indent)
AsciiListsetPostLabelIndent in interface AsciiListindent - post-label indentation, negative integer will use defaultpublic AsciiList setPostLabelString(String str)
AsciiListsetPostLabelString in interface AsciiListstr - string for post labelpublic AsciiList setPreLabelIndent(int indent)
AsciiListsetPreLabelIndent in interface AsciiListindent - pre-label indentation, negative integer will use defaultpublic AsciiList setPreLabelString(String str)
AsciiListsetPreLabelString in interface AsciiListstr - string for pre-labelpublic AsciiList setWidth(int width)
AsciiListprotected String wrapItem(String renderedItem)
renderedItem - the rendered item to wrapCopyright © 2015–2016. All rights reserved.