public class DefaultDocumentModel extends java.lang.Object implements DocumentModel, java.lang.Cloneable
| Constructor and Description |
|---|
DefaultDocumentModel() |
DefaultDocumentModel(java.lang.String text) |
| Modifier and Type | Method and Description |
|---|---|
void |
backspace()
Deletes the character immediately before the current carat position.
|
DefaultDocumentModel |
clone()
Deep clones this document model.
|
VersionedReference<java.lang.Integer> |
createCaratReference()
Returns a VersionedReference that can be watched for changes to
the carat position.
|
protected void |
createComposite() |
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 void |
findPosition(int pos,
int[] location)
Find the line and column of the specified text position.
|
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.
|
java.lang.String |
getLine(int line)
Returns the string representing just the specified line of text.
|
int |
getLineCount()
Returns the current number of lines in this document.
|
DocumentModel |
getObject()
Returns the object that is being versioned.
|
java.lang.String |
getText()
Returns the current text value contained in this DocumentModel.
|
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.
|
protected void |
parseText(java.lang.String text) |
int |
right()
Moves the carat one position to the right, potentially moving it to the
next line depending on the actual DocumentModel implementation.
|
void |
setText(java.lang.String text)
Replaces the text contained in this DocumentModel.
|
java.lang.String |
toString() |
int |
up()
Moves the carat position to the previous line if there is one.
|
public DefaultDocumentModel()
public DefaultDocumentModel(java.lang.String text)
public DefaultDocumentModel clone()
DocumentModelclone in interface DocumentModelclone in class java.lang.Objectpublic void setText(java.lang.String text)
DocumentModelsetText in interface DocumentModelpublic java.lang.String getText()
DocumentModelgetText in interface DocumentModelpublic java.lang.String getLine(int line)
DocumentModelgetLine in interface DocumentModelpublic int getLineCount()
DocumentModelgetLineCount in interface DocumentModelpublic int getCarat()
DocumentModelgetCarat in interface DocumentModelpublic int getCaratLine()
DocumentModelgetCaratLine in interface DocumentModelpublic int getCaratColumn()
DocumentModelgetCaratColumn in interface DocumentModelpublic int getAnchorLine()
DocumentModelgetAnchorLine in interface DocumentModelpublic int getAnchorColumn()
DocumentModelgetAnchorColumn in interface DocumentModelpublic int getAnchor()
DocumentModelgetAnchor in interface DocumentModelpublic int home(boolean currentLine)
DocumentModelhome in interface DocumentModelpublic int end(boolean currentLine)
DocumentModelend in interface DocumentModelpublic int up()
DocumentModelup in interface DocumentModelpublic int down()
DocumentModeldown in interface DocumentModelpublic int left()
DocumentModelleft in interface DocumentModelpublic int right()
DocumentModelright in interface DocumentModelpublic void insertNewLine()
DocumentModelinsertNewLine in interface DocumentModelpublic void deleteCharAt(int pos)
DocumentModeldeleteCharAt in interface DocumentModelpublic void backspace()
DocumentModelbackspace in interface DocumentModelpublic void delete()
DocumentModeldelete in interface DocumentModelprotected void findPosition(int pos,
int[] location)
public void insert(char c)
DocumentModelinsert in interface DocumentModelpublic void insert(java.lang.String text)
DocumentModelinsert in interface DocumentModelpublic long getVersion()
VersionedObjectgetVersion in interface VersionedObject<DocumentModel>public DocumentModel getObject()
VersionedObjectgetObject in interface VersionedObject<DocumentModel>public VersionedReference<DocumentModel> createReference()
VersionedObjectcreateReference in interface VersionedObject<DocumentModel>public VersionedReference<java.lang.Integer> createCaratReference()
DocumentModelcreateCaratReference in interface DocumentModelprotected void parseText(java.lang.String text)
protected void createComposite()
public java.lang.String toString()
toString in class java.lang.Object