|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.text.AbstractDocument
javax.swing.text.PlainDocument
com.cosylab.gui.components.numberfield.AbstractNumberDocument
public abstract class AbstractNumberDocument
Abstract base for implementation of number parsers, hiding the details of
the javax.swing.text.Document interface. This class handles
parsing of the string and caching last value. It ensures that only
acceptable numbers are entered (within the numeric range of the desired
class).
| 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 | |
|---|---|
protected java.lang.Number |
max
|
protected java.lang.Number |
min
|
| 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 | |
|---|---|
AbstractNumberDocument()
Constructor for AbstractNumberDocument. |
|
| Method Summary | |
|---|---|
protected boolean |
checkBounds(java.lang.Number newVal)
|
java.lang.Number |
getMaxValue()
Returns the maximum value. |
java.lang.Number |
getMinValue()
Returns the minimum value. |
java.lang.Number |
getValue()
Returns last successfully entered number. |
void |
insertString(int offs,
java.lang.String str,
javax.swing.text.AttributeSet attributes)
Inserts the string at str parameter into existing string, but only if the result is valid number. |
boolean |
isUpdated()
Returns the updated. |
protected abstract java.lang.Number |
parseNumber(java.lang.String s)
Parses the given string and returns the number represented. |
void |
remove(int offs,
int len)
Removes the string specified by offs and len, but only if the resulting string is a valid number. |
void |
setMaxValue(java.lang.Number max)
Sets the maximum value. |
void |
setMinValue(java.lang.Number min)
Sets the minimum value. |
void |
setUpdated(boolean updated)
Sets the updated property. |
| 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 |
|---|
protected java.lang.Number min
protected java.lang.Number max
| Constructor Detail |
|---|
public AbstractNumberDocument()
| Method Detail |
|---|
public void insertString(int offs,
java.lang.String str,
javax.swing.text.AttributeSet attributes)
throws javax.swing.text.BadLocationException
insertString in interface javax.swing.text.DocumentinsertString in class javax.swing.text.PlainDocumentoffs - intstr - Stringattributes - AttributeSet
javax.swing.text.BadLocationExceptionDocument#insertString(int, String, AttributeSet)protected boolean checkBounds(java.lang.Number newVal)
public void remove(int offs,
int len)
throws javax.swing.text.BadLocationException
remove in interface javax.swing.text.Documentremove in class javax.swing.text.AbstractDocumentoffs - intlen - int
javax.swing.text.BadLocationExceptionDocument#remove(int, int)protected abstract java.lang.Number parseNumber(java.lang.String s)
s - String
public java.lang.Number getValue()
public java.lang.Number getMaxValue()
public void setMaxValue(java.lang.Number max)
max - new maximumpublic java.lang.Number getMinValue()
public void setMinValue(java.lang.Number min)
min - minimum valuepublic boolean isUpdated()
public void setUpdated(boolean updated)
updated -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||