|
|||||||||
| 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.jp.comp.calendar.DateDocument
DateDocument formats and validates the date in the DateField
DateField,
Serialized Form| Nested Class Summary |
| 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 |
DATE_ELEMENTS
|
protected static java.text.SimpleDateFormat |
DEFAULT_DATE_FORMAT
|
protected java.text.DateFormat |
fDateFormat
|
protected java.lang.String |
fDatePattern
|
protected java.lang.String |
fDateSymbols
|
protected java.lang.String |
fEmptyDate
|
protected java.util.Locale |
fLocale
|
protected char |
fSeparator
|
protected boolean |
fSeparatorTraversed
|
protected int |
fYearDigitsAmount
|
protected char |
fZeroChar
|
static char |
WHITESPACE_CHAR
|
| 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 | |
DateDocument()
Constructs the class with default Locale |
|
DateDocument(java.util.Locale aLocale)
Constructs the class with specified Locale |
|
| Method Summary | |
protected java.lang.String |
fillWithSpace(java.lang.String aDate)
Filles the date with extra space for some locales to allow entering 2 digits |
protected java.lang.String |
fillWithSpace(java.lang.String aDate,
boolean anAddExtraSpace)
Filles the date with extra space for some locales to allow entering 2 digits |
java.util.Date |
getDate()
Returns entered Date |
java.util.Locale |
getLocale()
Gets the Locale |
int |
getYearDigitsAmount()
Gets the year digits amount. |
void |
insertString(int anOffset,
java.lang.String aStr,
javax.swing.text.AttributeSet anAttrSet)
|
boolean |
isDateEmpty()
Returns true if date field is empty |
protected boolean |
isDateValueEmpty(java.lang.String aDate,
int anOffSet)
|
protected boolean |
isDateValueValid(java.lang.String aDate,
int anOffSet)
Validates typing value in the date field suppressing entering invalid date. |
void |
reformDate()
Validates and reforms entered date. |
void |
remove(int anOffset,
int aLen)
|
void |
setDate(java.util.Date aDate)
Sets a new Date |
void |
setLocale(java.util.Locale aLocale)
Sets a new Locale |
void |
setYearDigitsAmount(int aYearDigitsAmount)
Sets the year digits amount. |
protected java.lang.String[] |
splitString(java.lang.String aString)
Splits the string by its parts using the date separator |
| 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, 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 char WHITESPACE_CHAR
public static final java.lang.String DATE_ELEMENTS
protected static final java.text.SimpleDateFormat DEFAULT_DATE_FORMAT
protected char fZeroChar
protected java.lang.String fDateSymbols
protected int fYearDigitsAmount
protected java.util.Locale fLocale
protected java.text.DateFormat fDateFormat
protected java.lang.String fDatePattern
protected java.lang.String fEmptyDate
protected char fSeparator
protected boolean fSeparatorTraversed
| Constructor Detail |
public DateDocument()
Locale
public DateDocument(java.util.Locale aLocale)
Locale
aLocale - the Locale| Method Detail |
public void insertString(int anOffset,
java.lang.String aStr,
javax.swing.text.AttributeSet anAttrSet)
throws javax.swing.text.BadLocationException
javax.swing.text.BadLocationException
public void remove(int anOffset,
int aLen)
throws javax.swing.text.BadLocationException
javax.swing.text.BadLocationExceptionpublic java.util.Locale getLocale()
Locale
Localepublic void setLocale(java.util.Locale aLocale)
Locale
aLocale - a new Localepublic java.util.Date getDate()
Date
Datepublic void setDate(java.util.Date aDate)
Date
aDate - a new Datepublic boolean isDateEmpty()
true if date field is empty
true if date field is emptypublic void reformDate()
protected java.lang.String fillWithSpace(java.lang.String aDate)
aDate - the date to fill up with spaces
protected java.lang.String fillWithSpace(java.lang.String aDate,
boolean anAddExtraSpace)
aDate - the date to fill up with spacesanAddExtraSpace - to add extra spaces for some locales to parse them
protected java.lang.String[] splitString(java.lang.String aString)
aString - the date to split
protected boolean isDateValueValid(java.lang.String aDate,
int anOffSet)
aDate - the date to validateanOffSet - current offset in the date editor
true if valid
protected boolean isDateValueEmpty(java.lang.String aDate,
int anOffSet)
public int getYearDigitsAmount()
setYearDigitsAmount(int)public void setYearDigitsAmount(int aYearDigitsAmount)
Locale's default year digits amountIllegalArgumentException will be thrown
aYearDigitsAmount - the year digits amount
java.lang.IllegalArgumentException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||