com.isti.util.gui.textvalidator
Class TextValidatorDocument

java.lang.Object
  extended by javax.swing.text.AbstractDocument
      extended by javax.swing.text.PlainDocument
          extended by com.isti.util.gui.textvalidator.AbstractValidatedDocument
              extended by com.isti.util.gui.textvalidator.TextValidatorDocument
All Implemented Interfaces:
AllowedCharactersConstants, StringConstants, java.io.Serializable, javax.swing.text.Document

public class TextValidatorDocument
extends AbstractValidatedDocument

Class TextValidatorDocument is an extension of 'PlainDocument' that implements the validating of input characters.

See Also:
Serialized Form

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
 
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 com.isti.util.StringConstants
ALPHA_CAP_CHARS, ALPHA_CHARS, ALPHA_LOW_CHARS, ALPHANUM_CHARS_STRING, ALPHANUMERIC_CHARS, BOOLEAN_FALSE_TEXT, BOOLEAN_TRUE_TEXT, DATE_FORMAT_AMPM_STR, DATE_FORMAT_RFC_822_STR, DATE_FORMAT24_STR, DEFAULT_JAVA_VERSION_STRING, DEFAULT_NULL_STR, DEFAULT_SEP_STR, EFLOAT_CHARS, EMPTY_STRING, FLOAT_CHARS, HEX_ALPHA_CAP_CHARS, HEX_ALPHA_LOW_CHARS, HEX_CHARS, INTEGER_CHARS, INVALID_FILENAME_CHARS, QUOTE_STRING, SIGNED_EFLOAT_CHARS, SIGNED_FLOAT_CHARS, SIGNED_INT_CHARS, SPACE_STRING, TOD_CHARS, WHITE_SPACE_CHARS, WILDCARD_ALL_CHAR, WILDCARD_CHARS, WILDCARD_SINGLE_CHAR
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Constructor Summary
TextValidatorDocument(TextValidator tv)
          Creates the document.
 
Method Summary
 boolean getAllowedFlag()
          Gets the allowed flag.
 int getColumns()
          Gets the number of columns.
 int getMaxNumChars()
          Gets the maximum number of characters.
 java.lang.String getSpecialChars()
          Gets the allowed (or not allowed) special characters.
 TextValidator getTextValidator()
          Returns the text validator.
 boolean isNumeric()
          Determines if the characters represent a numeric value.
 void setTextValidator(TextValidator tv)
          Sets the text validator.
 
Methods inherited from class com.isti.util.gui.textvalidator.AbstractValidatedDocument
insertString, isAllowed, isReplace, isReplace, isSpecialChar
 
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
 

Constructor Detail

TextValidatorDocument

public TextValidatorDocument(TextValidator tv)
Creates the document.

Parameters:
tv - the text validator.
Method Detail

getAllowedFlag

public boolean getAllowedFlag()
Gets the allowed flag.

Specified by:
getAllowedFlag in class AbstractValidatedDocument
Returns:
true to allow only the special characters, false to not allow the special characters.
See Also:
getSpecialChars()

getColumns

public int getColumns()
Gets the number of columns.

Specified by:
getColumns in class AbstractValidatedDocument
Returns:
the number of columns or -1 for the default.

getMaxNumChars

public int getMaxNumChars()
Gets the maximum number of characters.

Specified by:
getMaxNumChars in class AbstractValidatedDocument
Returns:
the maximum number of characters or 0 if none.

getSpecialChars

public java.lang.String getSpecialChars()
Gets the allowed (or not allowed) special characters. If there are no special characters then all characters are allowed.

Specified by:
getSpecialChars in class AbstractValidatedDocument
Returns:
the allowed characters or null for none.
See Also:
getAllowedFlag()

getTextValidator

public TextValidator getTextValidator()
Returns the text validator.

Specified by:
getTextValidator in class AbstractValidatedDocument
Returns:
the text validator.

isNumeric

public boolean isNumeric()
Determines if the characters represent a numeric value.

Specified by:
isNumeric in class AbstractValidatedDocument
Returns:
true if numeric value, false otherwise

setTextValidator

public void setTextValidator(TextValidator tv)
Sets the text validator.

Specified by:
setTextValidator in class AbstractValidatedDocument
Parameters:
tv - the text validator.