|
|||||||||||
| 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.sdm.quasar.client.swing.ui.text.RestrictionDocument
A Document for multi-line text. The number of lines and the length
of each line as well as the total text length can be restricted.
Additionally there can be specified, which characters can be entered into
this document and which characters are used when counting the length.
| Nested Class Summary | |
static interface |
RestrictionDocument.FixedLengthListener
A listener interface for FixedLengthDocuments. |
| Nested classes 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 | |
static java.lang.String |
ASCII_LETTER_NOSPACE_PATTERN
Pattern with all ascii-characters (without space) without special characters. |
static java.lang.String |
ASCII_LETTER_PATTERN
Pattern with all ascii-characters (and the space) without special characters. |
static java.lang.String |
ASCII_LOWER_LETTER
Pattern with all lower ascii-characters without special characters. |
static java.lang.String |
ASCII_UPPER_LETTER
Pattern with all upper ascii-characters without special characters. |
static int |
CASEMODE_LOWER
Convert to lowercase. |
static int |
CASEMODE_ORIGINAL
Leave the original case as it is. |
static int |
CASEMODE_UPPER
Convert to uppercase. |
static java.lang.String |
DIGIT_LETTER_PATTERN
Pattern with all decimal digits and all unicode letters. |
static java.lang.String |
DIGIT_PATTERN
Pattern with all decimal digits. |
static java.lang.String |
FOREIGN_KEY_PATTERN
Pattern with all valid characters for foreign keys. |
static java.lang.String |
LETTER_PATTERN
Pattern with all unicode letters. |
static java.lang.String |
NUMBER_PATTERN
Pattern with all decimal digits plus characters for number representation ('+','-','.',','). |
static int |
UNRESTRICTED_LINE_LENGTH
Special value for the line length, indicating to not enforce any restrictions. |
static int |
UNRESTRICTED_LINE_NUMBER
Special value for the line number, indicating to not enforce any restrictions. |
static int |
UNRESTRICTED_TOTAL_LENGTH
Special value for the total length, indicating to not enforce any restrictions. |
| 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 | |
RestrictionDocument()
Creates a new RestrictionDocument without restrictions. |
|
RestrictionDocument(int max_length)
Creates a new RestrictionDocument |
|
RestrictionDocument(int max_length,
int max_line_number,
int max_line_length)
Creates a new RestrictionDocument |
|
RestrictionDocument(int max_length,
int max_line_number,
int max_line_length,
java.lang.String validCharacters)
Creates a new RestrictionDocument |
|
RestrictionDocument(int max_length,
java.lang.String validCharacters)
Creates a new RestrictionDocument |
|
RestrictionDocument(int max_length,
java.lang.String validCharacters,
int caseMode)
Creates a new RestrictionDocument |
|
| Method Summary | |
void |
addFixedLenghtListener(RestrictionDocument.FixedLengthListener listener)
Adds a new RestrictionDocument.FixedLengthListener to this RestrictionDocument. |
protected void |
fireCutOff(java.lang.String cut_off)
Notifies registered listeners, that the given string was cut-off. |
int |
getCaseMode()
Returns the int. |
java.lang.String |
getCountCharacters()
|
protected int |
getCountLength(java.lang.String s)
Returns the length of the string as returned by the count filter. |
int |
getFilteredLength()
Returns the number of the count-filtered characters (see #setCountFilter(CharacterFilter)). |
int |
getMaxLength()
Returns the maximum length (number of characters) of this document. |
int |
getMaxLineLength()
Returns the maxmimum length of each line |
int |
getMaxLineNumber()
Returns the maximum number of lines |
java.lang.String |
getValidCharacters()
|
void |
insertString(int offset,
java.lang.String s,
javax.swing.text.AttributeSet attributeSet)
Inserts a string of content. |
boolean |
isBeepOnError()
Shall errors be reported by a beep sound? |
protected static int |
occurrencesOf(java.lang.String wholeString,
java.lang.String searchString)
How often does the search string occur in the whole string? |
void |
removeFixedLenghtListener(RestrictionDocument.FixedLengthListener listener)
Removes a previously added RestrictionDocument.FixedLengthListener from this
RestrictionDocument. |
void |
setBeepOnError(boolean beepOnError)
Beep on invalid input. |
void |
setCaseMode(int caseMode)
Sets the case mode to the given value. |
void |
setCountCharacters(java.lang.String countCharacters)
Sets the valid characters for counting the maximum length. |
void |
setMaxLength(int new_max_length)
Sets the maximum length (number of characters) of this document. |
void |
setMaxLineLength(int lineLength)
Sets the maxmimum length of each line |
void |
setMaxLineNumber(int lineNumber)
Sets the maximum number of lines |
void |
setValidCharacters(java.lang.String validCharacters)
Sets the CharacterFilter, which accepts characters. |
| 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 |
public static final java.lang.String DIGIT_PATTERN
public static final java.lang.String ASCII_UPPER_LETTER
public static final java.lang.String ASCII_LOWER_LETTER
public static final java.lang.String ASCII_LETTER_NOSPACE_PATTERN
public static final java.lang.String ASCII_LETTER_PATTERN
public static final java.lang.String LETTER_PATTERN
public static final java.lang.String DIGIT_LETTER_PATTERN
public static final java.lang.String NUMBER_PATTERN
public static final java.lang.String FOREIGN_KEY_PATTERN
public static final int CASEMODE_ORIGINAL
public static final int CASEMODE_UPPER
public static final int CASEMODE_LOWER
public static final int UNRESTRICTED_TOTAL_LENGTH
public static final int UNRESTRICTED_LINE_LENGTH
public static final int UNRESTRICTED_LINE_NUMBER
| Constructor Detail |
public RestrictionDocument()
RestrictionDocument without restrictions.
public RestrictionDocument(int max_length)
RestrictionDocument
max_length - the maximum total length of the contents
public RestrictionDocument(int max_length,
java.lang.String validCharacters)
RestrictionDocument
max_length - the maximum total length of the contentsvalidCharacters - the valid characters accepted
public RestrictionDocument(int max_length,
java.lang.String validCharacters,
int caseMode)
RestrictionDocument
max_length - the maximum total length of the contentsvalidCharacters - the valid characters acceptedcaseMode - the case mode to set (one of CASEMODE_ORIGINAL,
CASEMODE_LOWER or CASEMODE_UPPER).
public RestrictionDocument(int max_length,
int max_line_number,
int max_line_length)
RestrictionDocument
max_length - the maximum total length of the contentsmax_line_number - the maximum number of linesmax_line_length - the maximum length of each line
public RestrictionDocument(int max_length,
int max_line_number,
int max_line_length,
java.lang.String validCharacters)
RestrictionDocument
max_length - the maximum total length of the contentsmax_line_number - the maximum number of linesmax_line_length - the maximum length of each linevalidCharacters - the valid characters accepted| Method Detail |
public void setBeepOnError(boolean beepOnError)
public boolean isBeepOnError()
true if errors are reported acusticallypublic java.lang.String getCountCharacters()
public java.lang.String getValidCharacters()
public void setCountCharacters(java.lang.String countCharacters)
countCharacters - the characters used to count the length.public void setValidCharacters(java.lang.String validCharacters)
CharacterFilter, which accepts characters.
public int getCaseMode()
int.
public void setCaseMode(int caseMode)
caseMode - the case mode to set (one of CASEMODE_ORIGINAL,
CASEMODE_LOWER or CASEMODE_UPPER).public int getMaxLength()
public int getMaxLineLength()
public int getMaxLineNumber()
public void setMaxLength(int new_max_length)
new_max_length - the maximum length (number of
characters) of this document.public void setMaxLineLength(int lineLength)
lineLength - The maxmimum length of each linepublic void setMaxLineNumber(int lineNumber)
lineNumber - The maximum number of linesprotected int getCountLength(java.lang.String s)
public int getFilteredLength()
#setCountFilter(CharacterFilter)).
public void insertString(int offset,
java.lang.String s,
javax.swing.text.AttributeSet attributeSet)
throws javax.swing.text.BadLocationException
offset - the offset into the document to insert the content >= 0.
All positions that track change at or after the given location will move.
javax.swing.text.BadLocationException
protected static int occurrencesOf(java.lang.String wholeString,
java.lang.String searchString)
wholeString - The string that may contain the search stringsearchString - The string to be searched forpublic void addFixedLenghtListener(RestrictionDocument.FixedLengthListener listener)
RestrictionDocument.FixedLengthListener to this RestrictionDocument.
listener - the RestrictionDocument.FixedLengthListener to addpublic void removeFixedLenghtListener(RestrictionDocument.FixedLengthListener listener)
RestrictionDocument.FixedLengthListener from this
RestrictionDocument.
listener - the RestrictionDocument.FixedLengthListener to removeprotected void fireCutOff(java.lang.String cut_off)
cut_off - the string that was cut-off
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||