public class HourDateDocument extends DateDocument
DateCellEditor},
Serialized FormDateDocument.DateFormatCache, DateDocument.DateFormatCacheKeyAbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement| Modifier and Type | Field and Description |
|---|---|
static char |
charDateHourSeparator |
protected Date |
currentDocumentDate
Date that stores the document for each moment.
|
protected static SimpleDateFormat |
dfHourDate
Instance of date formatter
|
static String |
HH_mm
Default pattern for hours HH:mm
|
protected boolean |
hourFirst
Hour will be showed at first.
|
protected boolean |
onlyHour
It assigns a pattern to the document without date, only with hour.
|
protected String |
patternHour
String with hour pattern
|
protected String |
patternHourDate
String with hour and date patterns separated by
charDateHourSeparator. |
protected String |
sDateHourSeparator |
currentDate, currentTimestamp, dateFormat, datePattern, DEBUG, defaultLocale, dfConstructor, insertedDate, localelineLimitAttribute, tabSizeAttributeBAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementNameDEBUG_LANGUAGEStreamDescriptionProperty, TitleProperty| Constructor and Description |
|---|
HourDateDocument()
Constructor that creates a date document with hour and date, when hour is
showed at first.
|
HourDateDocument(boolean onlyHour,
boolean hourFirst) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
buildHourDatePattern()
Concatenates both patterns.
|
protected void |
buildHourPattern()
Builds hour pattern.
|
protected void |
buildPattern()
Builds pattern for date and hour.
|
String |
getText(int offset,
int length) |
Timestamp |
getTimestampValue() |
void |
insertString(int offset,
String sValue,
AttributeSet attributes)
Date pattern is known:
- Non numeric characters are allowed. |
boolean |
isValid()
Pattern is valid when parsing returns a correct date.
|
boolean |
isValidHour(String sHour)
Checks whether hour is valid.
|
void |
setPattern(String patternHourDate)
Applies specified pattern to date formatter.
|
void |
setValue(Date value) |
format, getDate, getDatePattern, getFormat, getTextsToTranslate, getTimestampValue, insertStringWithoutCheck, isValid, setComponentLocale, setDatePattern, setResourceBundlecreateDefaultRoot, getDefaultRootElement, getParagraphElement, insertUpdate, removeUpdateaddDocumentListener, addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, remove, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlockpublic static final String HH_mm
public static final char charDateHourSeparator
protected String sDateHourSeparator
protected String patternHour
protected String patternHourDate
charDateHourSeparator. Order of these patterns will be
assigned according to variable hourFirst. By default, hour
is showed at first.protected Date currentDocumentDate
protected static SimpleDateFormat dfHourDate
protected boolean onlyHour
protected boolean hourFirst
public HourDateDocument()
public HourDateDocument(boolean onlyHour,
boolean hourFirst)
public void insertString(int offset,
String sValue,
AttributeSet attributes)
throws BadLocationException
DateDocumentinsertString in interface DocumentinsertString in class DateDocumentBadLocationExceptionprotected void buildPattern()
buildPattern in class DateDocumentprotected void buildHourDatePattern()
public void setPattern(String patternHourDate)
patternHourDate - The pattern to be applied.protected void buildHourPattern()
public boolean isValid()
isValid in class DateDocumentpublic boolean isValidHour(String sHour)
sHour - String with hourpublic String getText(int offset, int length) throws BadLocationException
getText in interface DocumentgetText in class AbstractDocumentBadLocationExceptionpublic void setValue(Date value)
setValue in class DateDocumentpublic Timestamp getTimestampValue()
getTimestampValue in class DateDocumentCopyright © 2016 Imatia Innovation S.L.. All rights reserved.