com.instantbank.common.uiutils
Class IntegerDocument

java.lang.Object
  |
  +--javax.swing.text.AbstractDocument
        |
        +--javax.swing.text.PlainDocument
              |
              +--com.instantbank.common.uiutils.IntegerDocument
All Implemented Interfaces:
javax.swing.text.Document, java.io.Serializable

class IntegerDocument
extends javax.swing.text.PlainDocument

Auxiliary class suited for restricting input for a JTextField to numeric strings.

Author:
InstantBank (Rodrigo Lopez)
See Also:
Serialized Form

Inner classes inherited from class javax.swing.text.AbstractDocument
javax.swing.text.AbstractDocument.AbstractElement, javax.swing.text.AbstractDocument.AttributeContext, javax.swing.text.AbstractDocument.BidiElement, javax.swing.text.AbstractDocument.BidiRootElement, 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 int ALL
          Input can be positive or negative
static int NEGATIVE
          Input must be negative or zero
static int POSITIVE
          Input must be positive or zero
private  int range
          Allowed range for the input (POSITIVE, NEGATIVE, ALL)
 
Fields inherited from class javax.swing.text.PlainDocument
added, defaultRoot, lineLimitAttribute, removed, tabSizeAttribute
 
Fields inherited from class javax.swing.text.AbstractDocument
AsyncLoadPriority, BAD_LOCATION, BAD_LOCK_STATE, BidiElementName, bidiRoot, ContentElementName, context, currWriter, data, defaultI18NProperty, documentProperties, ElementNameAttribute, I18NProperty, listenerList, MultiByteProperty, numReaders, ParagraphElementName, SectionElementName, segment
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Constructor Summary
IntegerDocument(int range)
          IntegerDocument constructor.
 
Method Summary
 void insertString(int offset, java.lang.String s, javax.swing.text.AttributeSet attributeSet)
          Redefinition of the method from the PlainDocument class.
 
Methods inherited from class javax.swing.text.PlainDocument
createDefaultRoot, getDefaultRootElement, getParagraphElement, insertComposedTextUpdate, insertUpdate, removeUpdate
 
Methods inherited from class javax.swing.text.AbstractDocument
, addDocumentListener, addUndoableEditListener, calculateBidiLevels, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, isLeftToRight, postRemoveUpdate, putProperty, readLock, readObject, readUnlock, remove, removeDocumentListener, removeUndoableEditListener, render, setAsynchronousLoadPriority, setDocumentProperties, updateBidi, writeLock, writeUnlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

POSITIVE

public static final int POSITIVE
Input must be positive or zero

NEGATIVE

public static final int NEGATIVE
Input must be negative or zero

ALL

public static final int ALL
Input can be positive or negative

range

private int range
Allowed range for the input (POSITIVE, NEGATIVE, ALL)
Constructor Detail

IntegerDocument

public IntegerDocument(int range)
IntegerDocument constructor.
Parameters:
range - Allowed range for the input (POSITIVE, NEGATIVE, ALL)
Method Detail

insertString

public void insertString(int offset,
                         java.lang.String s,
                         javax.swing.text.AttributeSet attributeSet)
                  throws javax.swing.text.BadLocationException
Redefinition of the method from the PlainDocument class.
Overrides:
insertString in class javax.swing.text.AbstractDocument
Parameters:
offset - Description of the Parameter
s - Description of the Parameter
attributeSet - Description of the Parameter
Throws:
javax.swing.text.BadLocationException - Description of the Exception