public class DocumentModelFilter extends java.lang.Object implements DocumentModel
Constructor and Description |
---|
DocumentModelFilter() |
DocumentModelFilter(DocumentModel delegate) |
DocumentModelFilter(DocumentModel delegate,
com.google.common.base.Function<java.lang.Character,java.lang.Character> inputTransform,
com.google.common.base.Function<java.lang.String,java.lang.String> outputTransform) |
DocumentModelFilter(com.google.common.base.Function<java.lang.Character,java.lang.Character> inputTransform,
com.google.common.base.Function<java.lang.String,java.lang.String> outputTransform) |
Modifier and Type | Method and Description |
---|---|
void |
backspace()
Deletes the character immediately before the current carat position.
|
DocumentModel |
clone()
Deep clones this document model.
|
VersionedReference<java.lang.Integer> |
createCaratReference()
Returns a VersionedReference that can be watched for changes to
the carat position.
|
VersionedReference<DocumentModel> |
createReference()
Creates a new VersionedReference that can be used to monitor
when this object changes.
|
void |
delete()
Deletes the character immediately after the current carat position.
|
void |
deleteCharAt(int pos)
Deletes the character at the specified position.
|
int |
down()
Moves the carat position to the next line if there is one.
|
int |
end(boolean currentLine)
Moves the carat to the document's end position or the current line's
end position depending on the specified 'currentLine' value.
|
protected java.lang.Character |
filterInput(char c)
Can be overridden to filter the input provided to
insert().
|
protected java.lang.String |
filterInput(java.lang.String text)
Can be overridden to bulk filter input provided to
setText().
|
protected java.lang.String |
filterOutput(java.lang.String text)
Can be overridden to filter the output from the getText()
method, for example replacing all characters with '*' for
a password field.
|
int |
getAnchor()
During text selection, this is one end of the selection where the
other end is the carat position.
|
int |
getAnchorColumn()
Returns the column number of the current anchor position in the
line returned by getAnchorLine().
|
int |
getAnchorLine()
Returns the line number containing the current anchor position.
|
int |
getCarat()
Returns the current 'carat' position.
|
int |
getCaratColumn()
Returns the column number of the current carat position in the
line returned by getCaratLine().
|
int |
getCaratLine()
Returns the line number containing the current carat position.
|
DocumentModel |
getDelegate()
Returns the delegate document model for which this document model
filter is filtering,
|
com.google.common.base.Function<java.lang.Character,java.lang.Character> |
getInputTransform() |
java.lang.String |
getLine(int line)
Passes the delegate's getLine() through the local filterOutput()
method before returning.
|
int |
getLineCount()
Returns the current number of lines in this document.
|
DocumentModel |
getObject()
Returns the object that is being versioned.
|
com.google.common.base.Function<java.lang.String,java.lang.String> |
getOutputTransform() |
java.lang.String |
getText()
Passes the delegate's getText() through the local filterOutput()
method before returning.
|
long |
getVersion()
Returns the current version of the versioned object.
|
int |
home(boolean currentLine)
Moves the carat to the document's home position or the current line's
home position depending on the specified 'currentLine' value.
|
void |
insert(char c)
Inserts a character at the current carat position.
|
void |
insert(java.lang.String text)
Bulk inserts a string of text.
|
void |
insertNewLine()
Inserts a new line at the current carat position.
|
int |
left()
Moves the carat one position to the left, potentially moving it to the
previous line depending on the actual DocumentModel implementation.
|
int |
right()
Moves the carat one position to the right, potentially moving it to the
next line depending on the actual DocumentModel implementation.
|
void |
setInputTransform(com.google.common.base.Function<java.lang.Character,java.lang.Character> f)
Sets an optional input transform that will be used to convert
all input from setText() or insert().
|
void |
setOutputTransform(com.google.common.base.Function<java.lang.String,java.lang.String> f)
Sets an optional output transform function that will convert
text before returning it from getText().
|
void |
setText(java.lang.String text)
Replaces the text contained in this DocumentModel.
|
int |
up()
Moves the carat position to the previous line if there is one.
|
public DocumentModelFilter()
public DocumentModelFilter(com.google.common.base.Function<java.lang.Character,java.lang.Character> inputTransform, com.google.common.base.Function<java.lang.String,java.lang.String> outputTransform)
public DocumentModelFilter(DocumentModel delegate)
public DocumentModelFilter(DocumentModel delegate, com.google.common.base.Function<java.lang.Character,java.lang.Character> inputTransform, com.google.common.base.Function<java.lang.String,java.lang.String> outputTransform)
public DocumentModel getDelegate()
public void setOutputTransform(com.google.common.base.Function<java.lang.String,java.lang.String> f)
public com.google.common.base.Function<java.lang.String,java.lang.String> getOutputTransform()
public void setInputTransform(com.google.common.base.Function<java.lang.Character,java.lang.Character> f)
public com.google.common.base.Function<java.lang.Character,java.lang.Character> getInputTransform()
public DocumentModel clone()
DocumentModel
clone
in interface DocumentModel
clone
in class java.lang.Object
protected java.lang.String filterInput(java.lang.String text)
protected java.lang.Character filterInput(char c)
protected java.lang.String filterOutput(java.lang.String text)
public void setText(java.lang.String text)
DocumentModel
setText
in interface DocumentModel
public java.lang.String getText()
getText
in interface DocumentModel
public java.lang.String getLine(int line)
getLine
in interface DocumentModel
public int getLineCount()
DocumentModel
getLineCount
in interface DocumentModel
public int getCarat()
DocumentModel
getCarat
in interface DocumentModel
public int getCaratLine()
DocumentModel
getCaratLine
in interface DocumentModel
public int getCaratColumn()
DocumentModel
getCaratColumn
in interface DocumentModel
public int getAnchorLine()
DocumentModel
getAnchorLine
in interface DocumentModel
public int getAnchorColumn()
DocumentModel
getAnchorColumn
in interface DocumentModel
public int getAnchor()
DocumentModel
getAnchor
in interface DocumentModel
public int home(boolean currentLine)
DocumentModel
home
in interface DocumentModel
public int end(boolean currentLine)
DocumentModel
end
in interface DocumentModel
public int up()
DocumentModel
up
in interface DocumentModel
public int down()
DocumentModel
down
in interface DocumentModel
public int left()
DocumentModel
left
in interface DocumentModel
public int right()
DocumentModel
right
in interface DocumentModel
public void insertNewLine()
DocumentModel
insertNewLine
in interface DocumentModel
public void deleteCharAt(int pos)
DocumentModel
deleteCharAt
in interface DocumentModel
public void backspace()
DocumentModel
backspace
in interface DocumentModel
public void delete()
DocumentModel
delete
in interface DocumentModel
public void insert(char c)
DocumentModel
insert
in interface DocumentModel
public void insert(java.lang.String text)
DocumentModel
insert
in interface DocumentModel
public long getVersion()
VersionedObject
getVersion
in interface VersionedObject<DocumentModel>
public DocumentModel getObject()
VersionedObject
getObject
in interface VersionedObject<DocumentModel>
public VersionedReference<DocumentModel> createReference()
VersionedObject
createReference
in interface VersionedObject<DocumentModel>
public VersionedReference<java.lang.Integer> createCaratReference()
DocumentModel
createCaratReference
in interface DocumentModel