public class CallsignDocumentFilter
extends javax.swing.text.DocumentFilter
Constructor and Description |
---|
CallsignDocumentFilter(boolean allowHyphen,
boolean allowComma,
boolean allowWildcard)
Create a CallsignDocumentFilter, that will permit ASCII letters and digits, and optionally a few
other characters to be entered into a document.
|
Modifier and Type | Method and Description |
---|---|
static CallsignDocumentFilter |
getCallsignOnlyInstance()
Get a filter that only allows legal characters for a government-issued callsign.
|
static CallsignDocumentFilter |
getCallsignSsidCommaInstance()
Get a filter that only allows legal characters for a government-issued callsign, plus SSIDs and commas.
|
static CallsignDocumentFilter |
getCallsignSsidInstance()
Get a filter that only allows legal characters for a government-issued callsign, plus appended SSID values.
|
void |
insertString(javax.swing.text.DocumentFilter.FilterBypass fb,
int offset,
java.lang.String string,
javax.swing.text.AttributeSet attr)
Invoked prior to insertion of text into the
specified Document.
|
void |
replace(javax.swing.text.DocumentFilter.FilterBypass fb,
int offset,
int length,
java.lang.String text,
javax.swing.text.AttributeSet attrs)
Invoked prior to replacing a region of text in the
specified Document.
|
public CallsignDocumentFilter(boolean allowHyphen, boolean allowComma, boolean allowWildcard)
allowHyphen
- boolean true if hyphen '-' characters (such as in a SSID suffix) to be enteredallowComma
- boolean true if comma ',' characters to delimit between multiple callsigns may be enteredallowWildcard
- boolean true if asterisk '*' characters may be entered to indicate wildcardspublic static CallsignDocumentFilter getCallsignOnlyInstance()
public static CallsignDocumentFilter getCallsignSsidInstance()
public static CallsignDocumentFilter getCallsignSsidCommaInstance()
public void insertString(javax.swing.text.DocumentFilter.FilterBypass fb, int offset, java.lang.String string, javax.swing.text.AttributeSet attr) throws javax.swing.text.BadLocationException
insertString
in class javax.swing.text.DocumentFilter
fb
- FilterBypass that can be used to mutate Documentoffset
- the offset into the document to insert the content >= 0.
All positions that track change at or after the given location
will move.string
- the string to insertattr
- the attributes to associate with the inserted
content. This may be null if there are no attributes.javax.swing.text.BadLocationException
- the given insert position is not a
valid position within the documentpublic void replace(javax.swing.text.DocumentFilter.FilterBypass fb, int offset, int length, java.lang.String text, javax.swing.text.AttributeSet attrs) throws javax.swing.text.BadLocationException
replace
in class javax.swing.text.DocumentFilter
fb
- FilterBypass that can be used to mutate Documentoffset
- Location in Documentlength
- Length of text to deletetext
- Text to insert, null indicates no text to insertattrs
- AttributeSet indicating attributes of inserted text,
null is legal.javax.swing.text.BadLocationException
- the given insert position is not a
valid position within the document