|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.unitesk.atp.text.filters.Filter
com.unitesk.atp.text.filters.IndentFilter
public class IndentFilter
This filter manages indent levels and inserts spaces according to the current indent level at the start of every line.
| Field Summary | |
|---|---|
static int |
DEFAULT_INDENT_STEP
The default value of indent step. |
| Fields inherited from class com.unitesk.atp.text.filters.Filter |
|---|
client |
| Constructor Summary | |
|---|---|
IndentFilter(TextReceiver client)
Constructs indent filter with default indent step. |
|
IndentFilter(TextReceiver client,
int indent_step)
Constructs indent server with given indent step. |
|
| Method Summary | |
|---|---|
static String |
fill(char c,
int l)
Fills a string with characters. |
int |
getIndent()
Returns the current indent level. |
int |
getIndentStep()
Returns the indent step. |
boolean |
isLineStart()
Returns the current state of the line start indicator. |
void |
nl()
Receives line separator and passes it to the client. |
void |
popIndent()
Restores the previous indent level. |
void |
pushIndent(int indent)
Pushes in stack new indent level. |
void |
txt(String str)
Receives string and passes it to the client inserting appropriate number of spaces at the start of each line |
| Methods inherited from class com.unitesk.atp.text.filters.Filter |
|---|
getClient |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_INDENT_STEP
| Constructor Detail |
|---|
public IndentFilter(TextReceiver client)
DEFAULT_INDENT_STEP
public IndentFilter(TextReceiver client,
int indent_step)
indent_step - the indent step value
IllegalArgumentException - if indent_step <= 0| Method Detail |
|---|
public int getIndentStep()
public void pushIndent(int indent)
indent - the new indent level
IllegalArgumentException - if indent is negativepublic int getIndent()
EmptyStackException - if no indent level is in stack.public void popIndent()
EmptyStackException - if no indent level is in stack.public void txt(String str)
txt in interface TextReceivertxt in class Filterstr - the string to receive
NullPointerException - if str is nullpublic void nl()
TextReceiver.txt(String) will be
prefixed by indent.
nl in interface TextReceivernl in class FilterNullPointerException - if c is nullpublic boolean isLineStart()
public static String fill(char c,
int l)
c - the character to filll - the length of the string
l filled by c.
If l < 0 empty string is returned.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||