|
|||||||||
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.isti.util.gui.FilteredDocument
class FilteredDocument
Class FilteredDocument is an extension of 'PlainDocument' that implements the filtering of input characters.
Nested Class Summary |
---|
Nested classes/interfaces 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 | |
---|---|
boolean |
allowFlag
|
int |
maxNumChars
|
boolean |
numericFlag
|
java.lang.String |
specialChars
|
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 | |
---|---|
FilteredDocument(java.lang.String allowedChars,
boolean numericFlag,
int maxNumChars)
Constructs a plain text document. |
|
FilteredDocument(java.lang.String specialChars,
boolean numericFlag,
int maxNumChars,
boolean allowFlag)
Constructs a plain text document. |
Method Summary | |
---|---|
java.lang.Comparable |
getMaxValueObj()
Returns the maximum value to be allowed for numeric entries, or null if no value has been entered. |
void |
insertString(int insOffs,
java.lang.String insStr,
javax.swing.text.AttributeSet aSet)
Inserts data into the document, filtering it along the way. |
void |
setMaxValueObj(java.lang.Comparable obj)
Sets a maximum value to be allowed for numeric entries (only used if the 'numericFlag' is true). |
Methods inherited from class javax.swing.text.PlainDocument |
---|
createDefaultRoot, getDefaultRootElement, getParagraphElement, insertUpdate, removeUpdate |
Methods inherited from class javax.swing.text.AbstractDocument |
---|
addDocumentListener, addUndoableEditListener, createBranchElement, createLeafElement, 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, remove, 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 |
Field Detail |
---|
public final java.lang.String specialChars
public final boolean numericFlag
public final int maxNumChars
public final boolean allowFlag
Constructor Detail |
---|
public FilteredDocument(java.lang.String allowedChars, boolean numericFlag, int maxNumChars)
allowedChars
- a String of characters allowed to be entered
into the document.numericFlag
- true for valid numeric onlymaxNumChars
- maximum number of chars allowedpublic FilteredDocument(java.lang.String specialChars, boolean numericFlag, int maxNumChars, boolean allowFlag)
specialChars
- a String of characters allowed (or not)
into the document.numericFlag
- true for valid numeric onlymaxNumChars
- maximum number of chars allowedallowFlag
- true to allow only the special characters, false to not
allow the special characters.Method Detail |
---|
public void insertString(int insOffs, java.lang.String insStr, javax.swing.text.AttributeSet aSet) throws javax.swing.text.BadLocationException
insertString
in interface javax.swing.text.Document
insertString
in class javax.swing.text.PlainDocument
insOffs
- the starting offset (greater than or equal to zero).insStr
- the string to insert (empty and null strings are
ignored).aSet
- the attributes for the inserted content.
javax.swing.text.BadLocationException
- if the given position is not a
valid position within the document.public void setMaxValueObj(java.lang.Comparable obj)
obj
- a "maximum" value object that implements the
'Comparable' interface (or null for no maximum).public java.lang.Comparable getMaxValueObj()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |