|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.text.AbstractDocument javax.swing.text.PlainDocument com.taursys.swing.MDocument
MDocument is a Document Implementation which binds to a value in a TextModel
Nested Class Summary |
Nested classes inherited from class javax.swing.text.AbstractDocument |
javax.swing.text.AbstractDocument.AbstractElement, javax.swing.text.AbstractDocument.AttributeContext, javax.swing.text.AbstractDocument.BranchElement, javax.swing.text.AbstractDocument.Content, javax.swing.text.AbstractDocument.DefaultDocumentEvent, javax.swing.text.AbstractDocument.ElementEdit, javax.swing.text.AbstractDocument.LeafElement |
Field Summary |
Fields inherited from class javax.swing.text.PlainDocument |
lineLimitAttribute, tabSizeAttribute |
Fields inherited from class javax.swing.text.AbstractDocument |
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName |
Fields inherited from interface javax.swing.text.Document |
StreamDescriptionProperty, TitleProperty |
Constructor Summary | |
MDocument()
Constructs a new MDocument and its default TextModel (not Document). |
|
MDocument(int javaDataType)
Creates a new MDocument and a DefaultTextModel with a VariantValueHolder of the given type. |
Method Summary | |
void |
addEnableListener(EnableListener l)
Adds the given listener to the list that is notified each time the enabled state changes. |
protected javax.swing.text.Element |
createBranchElement(javax.swing.text.Element parent,
javax.swing.text.AttributeSet a)
Creates a document branch element, that can contain other elements. |
protected TextModel |
createDefaultTextModel()
Creates the default model used by this component |
protected javax.swing.text.Element |
createLeafElement(javax.swing.text.Element parent,
javax.swing.text.AttributeSet a,
int p0,
int p1)
Creates a document leaf element. |
protected void |
fireEnableChange(EnableEvent e)
Notify the listeners that the enabled state has changed. |
java.text.Format |
getFormat()
Returns the Format of the TextModel. |
java.lang.String |
getFormatPattern()
Returns the Format pattern of the TextModel. |
TextModel |
getModel()
Returns the model for this component |
java.lang.String |
getPropertyName()
Returns the propertyName in the valueHolder where the model stores the value. |
ValueHolder |
getValueHolder()
Returns the valueHolder for the model. |
void |
insertString(int offs,
java.lang.String str,
javax.swing.text.AttributeSet a)
Inserts some content into the document. |
protected void |
insertUpdate(javax.swing.text.AbstractDocument.DefaultDocumentEvent chng,
javax.swing.text.AttributeSet attr)
Updates document structure as a result of text insertion. |
boolean |
isModified()
Get the modified flag which indicates whether or not this document is modified. |
void |
remove(int offs,
int len)
Removes some content from the document. |
void |
removeEnableListener(EnableListener l)
Removes the given listener from the list that is notified each time the enabled state changes. |
protected void |
removeUpdate(javax.swing.text.AbstractDocument.DefaultDocumentEvent chng)
Updates any document structure as a result of text removal. |
void |
retrieveValue()
Retrieves text from TextModel and stores in this Document |
void |
setFormat(java.text.Format format)
Sets the Format of the TextModel. |
void |
setFormatPattern(java.lang.String newPattern)
Sets the Format patten of the TextModel. |
void |
setModel(TextModel newModel)
Sets the TextModel used by this Document. |
void |
setModified(boolean newModified)
Set the modified flag which indicates whether or not this document is modified. |
void |
setPropertyName(java.lang.String newPropertyName)
Sets the propertyName in the valueHolder where the model stores the value. |
void |
setValueHolder(ValueHolder newValueHolder)
Sets the valueHolder for the model. |
void |
stateChanged(javax.swing.event.ChangeEvent e)
Invoked whenever a change event occurs so the value will be retrieved from the TextModel. |
void |
storeValue()
Stores Document value in TextModel |
Methods inherited from class javax.swing.text.PlainDocument |
createDefaultRoot, getDefaultRootElement, getParagraphElement |
Methods inherited from class javax.swing.text.AbstractDocument |
addDocumentListener, addUndoableEditListener, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MDocument()
public MDocument(int javaDataType) throws UnsupportedDataTypeException
UnsupportedDataTypeException
- if invalid javaDataType is givenMethod Detail |
public TextModel getModel()
public void setModel(TextModel newModel)
protected TextModel createDefaultTextModel()
public void setFormat(java.text.Format format)
public java.text.Format getFormat()
public void setFormatPattern(java.lang.String newPattern)
public java.lang.String getFormatPattern()
public void setValueHolder(ValueHolder newValueHolder)
public ValueHolder getValueHolder()
public void setPropertyName(java.lang.String newPropertyName)
public java.lang.String getPropertyName()
public void retrieveValue()
public void storeValue() throws ModelException
ModelException
- if value cannot be stored because of invalid format or other reasonspublic void stateChanged(javax.swing.event.ChangeEvent e)
stateChanged
in interface javax.swing.event.ChangeListener
public void setModified(boolean newModified)
newModified
- the modified flag which indicates whether or not this document is modified.public boolean isModified()
protected void insertUpdate(javax.swing.text.AbstractDocument.DefaultDocumentEvent chng, javax.swing.text.AttributeSet attr)
chng
- the change event describing the ditattr
- the set of attributes for the inserted textprotected void removeUpdate(javax.swing.text.AbstractDocument.DefaultDocumentEvent chng)
chng
- the change event describing the editprotected javax.swing.text.Element createLeafElement(javax.swing.text.Element parent, javax.swing.text.AttributeSet a, int p0, int p1)
parent
- the parent elementa
- the attributes for the elementp0
- the beginning of the range >= 0p1
- the end of the range >= p0
public void remove(int offs, int len) throws javax.swing.text.BadLocationException
This method is thread safe, although most Swing methods are not. Please see Threads and Swing for more information.
remove
in interface javax.swing.text.Document
offs
- the starting offset >= 0len
- the number of characters to remove >= 0
javax.swing.text.BadLocationException
- the given remove position is not a valid
position within the documentDocument.remove(int, int)
public void insertString(int offs, java.lang.String str, javax.swing.text.AttributeSet a) throws javax.swing.text.BadLocationException
This method is thread safe, although most Swing methods are not. Please see Threads and Swing for more information.
insertString
in interface javax.swing.text.Document
offs
- the starting offset >= 0str
- the string to insert; does nothing with null/empty stringsa
- the attributes for the inserted content
javax.swing.text.BadLocationException
- the given insert position is not a valid
position within the documentDocument.insertString(int, java.lang.String, javax.swing.text.AttributeSet)
protected javax.swing.text.Element createBranchElement(javax.swing.text.Element parent, javax.swing.text.AttributeSet a)
parent
- the parent elementa
- the attributes
public void removeEnableListener(EnableListener l)
l
- the EnableListener to remove from the notify list.public void addEnableListener(EnableListener l)
l
- the EnableListener to add to the notify list.protected void fireEnableChange(EnableEvent e)
e
- the EnableEvent to send to the listeners on the notify list.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |