Class FWTextFieldRegexpFilter
java.lang.Object
javax.swing.text.AbstractDocument
javax.swing.text.PlainDocument
net.simplace.pipe.util.components.LimitedDocument
net.simplace.pipe.util.components.FWTextFieldRegexpFilter
- All Implemented Interfaces:
Serializable, Document
Document that accepts inserted text only if it matches a regular expression. The expression is
matched against each inserted string (e.g. a single typed character), not the whole content.
- Author:
- Andreas Enders
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractDocument
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement -
Field Summary
FieldsFields inherited from class PlainDocument
lineLimitAttribute, tabSizeAttributeFields inherited from class AbstractDocument
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementNameFields inherited from interface Document
StreamDescriptionProperty, TitleProperty -
Constructor Summary
ConstructorsConstructorDescriptionFWTextFieldRegexpFilter(String aRegExp) Creates a filter without length limit.FWTextFieldRegexpFilter(String aRegExp, int aDocumentMaxSize) Creates a filter with length limit. -
Method Summary
Modifier and TypeMethodDescriptionvoidinsertString(int offset, String aString, AttributeSet attr) Inserts the new string and truncates the text to the maximum size (with a beep) if it gets too long.voidMethods inherited from class LimitedDocument
setMaxSizeMethods inherited from class PlainDocument
createDefaultRoot, getDefaultRootElement, getParagraphElement, insertUpdate, removeUpdateMethods inherited from class 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
-
Field Details
-
iRegExp
-
-
Constructor Details
-
FWTextFieldRegexpFilter
Creates a filter without length limit.- Parameters:
aRegExp- regular expression for inserted strings, ornullfor no filter
-
FWTextFieldRegexpFilter
Creates a filter with length limit.- Parameters:
aRegExp- regular expression for inserted strings, ornullfor no filteraDocumentMaxSize- maximum number of characters,-1for unlimited
-
-
Method Details
-
setRegexp
- Parameters:
aRegExp- regular expression for inserted strings, ornullfor no filter
-
insertString
Description copied from class:LimitedDocumentInserts the new string and truncates the text to the maximum size (with a beep) if it gets too long.- Specified by:
insertStringin interfaceDocument- Overrides:
insertStringin classLimitedDocument- Throws:
BadLocationException
-