|
|||||||||
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.TimeFilteredDocument
class TimeFilteredDocument
Class TimeFilteredDocument 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 | |
---|---|
static java.lang.String[] |
ALLOWED_CHARS
|
static java.lang.String |
HOURS_FIRST_DIGITS
|
static java.lang.String |
MINS_SECS_FIRST_DIGITS
|
static java.lang.String |
TIME_DIGITS
|
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 | |
---|---|
TimeFilteredDocument(TimeJTextField textField,
int maxNumChars)
Constructs a plain text document. |
Method Summary | |
---|---|
TimeJTextField |
getTextField()
Gets the text field for this document. |
protected int |
insertChar(int offs,
char ch)
Inserts a character into the document. |
void |
insertString(int offs,
java.lang.String str,
javax.swing.text.AttributeSet aSet)
Inserts data into the document, filtering it along the way. |
protected static boolean |
isValidChar(int offs,
char ch)
Determines if the character is valid for the specified position. |
protected boolean |
isValidStr(int offs,
java.lang.String str)
Determines if the string is valid for the specified position. |
void |
remove(int offs,
int len)
Removes some content from the document. |
protected int |
removeChar(int offs)
Remove the character from the document. |
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, 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 static final java.lang.String TIME_DIGITS
public static final java.lang.String HOURS_FIRST_DIGITS
public static final java.lang.String MINS_SECS_FIRST_DIGITS
public static final java.lang.String[] ALLOWED_CHARS
Constructor Detail |
---|
public TimeFilteredDocument(TimeJTextField textField, int maxNumChars)
textField
- the text field for the document.maxNumChars
- the maximum number of characters.Method Detail |
---|
protected int insertChar(int offs, char ch) throws javax.swing.text.BadLocationException
offs
- the offset.ch
- the character to insert.
javax.swing.text.BadLocationException
- if the given position is not a
valid position within the document.protected static boolean isValidChar(int offs, char ch)
offs
- the offset.ch
- the character to insert.
protected boolean isValidStr(int offs, java.lang.String str)
offs
- the offset.str
- the string to insert.
protected int removeChar(int offs) throws javax.swing.text.BadLocationException
offs
- the offset.
javax.swing.text.BadLocationException
- if the given position is not a
valid position within the document.public TimeJTextField getTextField()
public void insertString(int offs, java.lang.String str, javax.swing.text.AttributeSet aSet) throws javax.swing.text.BadLocationException
insertString
in interface javax.swing.text.Document
insertString
in class javax.swing.text.PlainDocument
offs
- the starting offset (greater than or equal to zero).str
- 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 remove(int offs, int len) throws javax.swing.text.BadLocationException
remove
in interface javax.swing.text.Document
remove
in class javax.swing.text.AbstractDocument
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 document
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |