Methods Summary |
---|
java.lang.Object | adjustValue(java.lang.Object value, java.util.Map attributes, java.lang.Object key, int direction)Adjusts the Date if FieldPosition identifies a known calendar
field.
if (key != null) {
int field;
// HOUR1 has no corresponding calendar field, thus, map
// it to HOUR0 which will give the correct behavior.
if (key == DateFormat.Field.HOUR1) {
key = DateFormat.Field.HOUR0;
}
field = ((DateFormat.Field)key).getCalendarField();
Calendar calendar = getCalendar();
if (calendar != null) {
calendar.setTime((Date)value);
int fieldValue = calendar.get(field);
try {
calendar.add(field, direction);
value = calendar.getTime();
} catch (Throwable th) {
value = null;
}
return value;
}
}
return null;
|
java.lang.Object | getAdjustField(int start, java.util.Map attributes)Returns the field that will be adjusted by adjustValue.
Iterator attrs = attributes.keySet().iterator();
while (attrs.hasNext()) {
Object key = attrs.next();
if ((key instanceof DateFormat.Field) &&
(key == DateFormat.Field.HOUR1 ||
((DateFormat.Field)key).getCalendarField() != -1)) {
return key;
}
}
return null;
|
private java.util.Calendar | getCalendar()Returns the Calendar that DateFormat is associated with,
or if the Format is not a DateFormat
Calendar.getInstance is returned.
Format f = getFormat();
if (f instanceof DateFormat) {
return ((DateFormat)f).getCalendar();
}
return Calendar.getInstance();
|
boolean | getSupportsIncrement()Returns true, as DateFormatterFilter will support
incrementing/decrementing of the value.
return true;
|
public void | setFormat(java.text.DateFormat format)Sets the format that dictates the legal values that can be edited
and displayed.
If you have used the nullary constructor the value of this property
will be determined for the current locale by way of the
Dateformat.getDateInstance() method.
super.setFormat(format);
|