Package xal.ca.view
Class ChannelNameDocument
java.lang.Object
javax.swing.text.AbstractDocument
javax.swing.text.PlainDocument
xal.ca.view.ChannelNameDocument
- All Implemented Interfaces:
Serializable
,Document
ChannelNameDocument is a javax.swing.text.Document implementation useful for
filtering out invalid characters of a channel name. For example channel names
cannot have spaces or non-printing characters. This is useful when
implementing intelligent text fields that allow a user to enter a channel
name. Invalid characters are thrown away and a system beep warning is heard
in its place.
- Author:
- tap
- See Also:
-
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
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
insertString
(int offset, String string, AttributeSet attributes) Override the inherited method to filter out characters that are not alpha-numeric or a colon, dash, underscore or period.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
-
Constructor Details
-
ChannelNameDocument
public ChannelNameDocument()
-
-
Method Details
-
insertString
public void insertString(int offset, String string, AttributeSet attributes) throws BadLocationException Override the inherited method to filter out characters that are not alpha-numeric or a colon, dash, underscore or period.- Specified by:
insertString
in interfaceDocument
- Overrides:
insertString
in classPlainDocument
- Throws:
BadLocationException
- under the same conditions the inherited method would.
-