com.jaxfront.swing.helpers
Class NumericDocument

java.lang.Object
  extended by javax.swing.text.AbstractDocument
      extended by javax.swing.text.PlainDocument
          extended by com.jaxfront.swing.helpers.NumericDocument
All Implemented Interfaces:
JAXFrontDocument, java.io.Serializable, javax.swing.text.Document
Direct Known Subclasses:
DecimalDocument

public abstract class NumericDocument
extends javax.swing.text.PlainDocument
implements JAXFrontDocument

The NumericDocument class is the root class for all document classes based on numeric values. The purpose of this class is to provide a finer grained abstraction level as the javax.swing.text.PlainDocument can provide. Furthermore it adds the ability to make more type checking in detail! All the Document classes of the com.jaxfront.swing.helpers package are used as models for the visualizer implementations. For more information about type ranges visit http://www.w3.org/TR/xmlschema-2/

Version:
1.60
See Also:
PlainDocument, 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
BidiElementName, ContentElementName, ElementNameAttribute, ParagraphElementName, SectionElementName
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Constructor Summary
NumericDocument(boolean useErrorSound)
          NumericDocument constructor.
NumericDocument(boolean useErrorSound, int maxLengthOfCharacter)
          NumericDocument constructor.
 
Method Summary
 boolean allowInvalidMinValues()
           
 java.text.DecimalFormatSymbols getDecimalSymbols()
           
 double getDefaultMaxValue()
           
 double getDefaultMinValue()
           
 double getMaxExclValue()
           
 double getMaxInclValue()
           
 double getMaxValue()
           
 double getMinExclValue()
           
 double getMinInclValue()
           
 double getMinValue()
           
 int getTotalDigit()
           
 void insertString(int offs, java.lang.String str, javax.swing.text.AttributeSet a)
           
 boolean isBypassing()
           
 boolean isIntDocument()
           
 boolean isMaxExcl()
           
 boolean isMaxIncl()
           
 boolean isMinExcl()
           
 boolean isMinIncl()
           
abstract  void parse(java.lang.String proposedResult)
          Parses the current result and checks if it has the right number format.
 void remove(int offs, int len)
           
 void setAllowInvalidMinValues(boolean allow)
           
 void setBypassing(boolean bypass)
           
 void setDecimalSymbols(java.text.DecimalFormatSymbols symbols)
           
 void setDefaultMaxValue(double defaultMaxValue)
           
 void setDefaultMinValue(double defaultMinValue)
           
 void setMaxExclValue(double maxExclValue)
           
 void setMaxInclValue(double maxInclValue)
           
 void setMinExclValue(double minExclValue)
           
 void setMinInclValue(double minInclValue)
           
 void setTotalDigit(int totalDigit)
           
 
Methods inherited from class javax.swing.text.PlainDocument
getDefaultRootElement, getParagraphElement
 
Methods inherited from class javax.swing.text.AbstractDocument
addDocumentListener, addUndoableEditListener, createPosition, dump, getAsynchronousLoadPriority, getBidiRootElement, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, putProperty, readLock, readUnlock, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumericDocument

public NumericDocument(boolean useErrorSound)
NumericDocument constructor.

Parameters:
useErrorSound - true, if the system should give out an error sound (beep)

NumericDocument

public NumericDocument(boolean useErrorSound,
                       int maxLengthOfCharacter)
NumericDocument constructor.

Parameters:
useErrorSound - true, if the system should give out an error sound (beep)
maxLengthOfCharacter - the maximum allowed length of the input character
Method Detail

insertString

public void insertString(int offs,
                         java.lang.String str,
                         javax.swing.text.AttributeSet a)
                  throws javax.swing.text.BadLocationException
Specified by:
insertString in interface javax.swing.text.Document
Overrides:
insertString in class javax.swing.text.PlainDocument
Throws:
javax.swing.text.BadLocationException
See Also:
Document.insertString(int, String, AttributeSet)

parse

public abstract void parse(java.lang.String proposedResult)
                    throws java.lang.NumberFormatException
Parses the current result and checks if it has the right number format.

Parameters:
proposedResult - the current result that needs to be checked
Throws:
java.lang.NumberFormatException - if the proposedResult is not of the required number format

remove

public void remove(int offs,
                   int len)
            throws javax.swing.text.BadLocationException
Specified by:
remove in interface javax.swing.text.Document
Overrides:
remove in class javax.swing.text.AbstractDocument
Throws:
javax.swing.text.BadLocationException
See Also:
Document.remove(int, int)

setMaxInclValue

public void setMaxInclValue(double maxInclValue)

setMaxExclValue

public void setMaxExclValue(double maxExclValue)

setTotalDigit

public void setTotalDigit(int totalDigit)

getTotalDigit

public int getTotalDigit()

setMinInclValue

public void setMinInclValue(double minInclValue)

setMinExclValue

public void setMinExclValue(double minExclValue)

getMaxInclValue

public double getMaxInclValue()

getMaxExclValue

public double getMaxExclValue()

getMinInclValue

public double getMinInclValue()

getMinExclValue

public double getMinExclValue()

setDefaultMinValue

public void setDefaultMinValue(double defaultMinValue)

setDefaultMaxValue

public void setDefaultMaxValue(double defaultMaxValue)

getDefaultMinValue

public double getDefaultMinValue()

getDefaultMaxValue

public double getDefaultMaxValue()

getMinValue

public double getMinValue()

getMaxValue

public double getMaxValue()

isMaxExcl

public boolean isMaxExcl()

isMinExcl

public boolean isMinExcl()

isMinIncl

public boolean isMinIncl()

isMaxIncl

public boolean isMaxIncl()

setAllowInvalidMinValues

public void setAllowInvalidMinValues(boolean allow)
Parameters:
_commitOnFocusLost - The _commitOnFocusLost to set.

allowInvalidMinValues

public boolean allowInvalidMinValues()
Returns:
Returns the _commitOnFocusLost.

setDecimalSymbols

public void setDecimalSymbols(java.text.DecimalFormatSymbols symbols)

getDecimalSymbols

public java.text.DecimalFormatSymbols getDecimalSymbols()

setBypassing

public void setBypassing(boolean bypass)
Specified by:
setBypassing in interface JAXFrontDocument

isBypassing

public boolean isBypassing()
Specified by:
isBypassing in interface JAXFrontDocument

isIntDocument

public boolean isIntDocument()