HiRISE

HiRISE.HiPlan.Utilities
Class Number_Document

java.lang.Object
  extended by javax.swing.text.AbstractDocument
      extended by javax.swing.text.PlainDocument
          extended by HiRISE.HiPlan.Utilities.Number_Document
All Implemented Interfaces:
Serializable, Document

public class Number_Document
extends PlainDocument

A PlainDocument that allows only those characters suitable for an English decimal number. These include the ten digits, the decimal point ('.'), the comma (','), the plus sign ('+'), and the minus sign ('-'). All other characters are ignored and never become part of the Number_Document's content.

NOTE: No attempt is made to ensure that the contents of the document form a valid number. The document may read '..+++---,' for example, which is not a valid number but which contains only valid number characters.

Version:
1.6
Author:
Christian Schaller - UA/PIRL
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.text.AbstractDocument
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement
 
Field Summary
static String ID
          Class identification name with source code version and date.
 
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
Number_Document()
          Creates a new Number_Document using the PlainDocument's default content container.
Number_Document(AbstractDocument.Content container)
          Creates a new Number_Document using the specified container for the document's content.
 
Method Summary
 void insertString(int offset, String str, AttributeSet a)
          Inserts content into 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, 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
 

Field Detail

ID

public static final String ID
Class identification name with source code version and date.

See Also:
Constant Field Values
Constructor Detail

Number_Document

public Number_Document()
Creates a new Number_Document using the PlainDocument's default content container.

See Also:
PlainDocument.PlainDocument()

Number_Document

public Number_Document(AbstractDocument.Content container)
Creates a new Number_Document using the specified container for the document's content.

Parameters:
container - the document's content container.
See Also:
PlainDocument.PlainDocument(AbstractDocument.Content)
Method Detail

insertString

public void insertString(int offset,
                         String str,
                         AttributeSet a)
                  throws BadLocationException
Inserts content into the document. Characters that are not allowed are not added.

Specified by:
insertString in interface Document
Overrides:
insertString in class PlainDocument
Parameters:
offset - the starting offset, at least 0.
str - the string to insert; null/empty strings are not inserted.
a - the attributes for the inserted content; this document does not use attributes.
Throws:
BadLocationException
See Also:
PlainDocument.insertString(int, java.lang.String, javax.swing.text.AttributeSet)

HiRISE

Copyright (C) Arizona Board of Regents on behalf of the Planetary Image Research Laboratory, Lunar and Planetary Laboratory at the University of Arizona