|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.swt.widgets.Widget org.eclipse.swt.widgets.Control org.eclipse.ercp.swt.mobile.DateEditor
A special data entry control that allows users to enter or choose a date. The
return value of getDate()
is an instance of a Date class.
The default locale and timezone for the date and time formatting reflects the
current configuration in the device. The default date used if a date is not
set is the current date. Applications may call
setTimeZone(timeZone)
to change the differential added to UTC
time. This change only affects the widget instance and
does not affect other applications.
Example code
DateEditor date1 = new DateEditor(composite, SWT.BORDER, DateEditor.DATE_TIME); date1.setDate((new Date()));
IMPORTANT: This class is not intended to be subclassed.
Field Summary | |
static int |
COMPACT
A hint that the widget should be displayed in a format which is smaller or less full featured. |
static int |
DATE
A date entry type for year, month and day. |
static int |
DATE_TIME
An entry type for date and time. |
static int |
DURATION
An entry type for a period of time in hours, minutes and seconds. |
static int |
FULL
A hint that the widget should be displayed in a format which is full featured and emphasizes ease of use rather than compactness. |
static int |
OFFSET
An entry type for a period of time in hours, minutes, and seconds which can be subtracted or added to another time value. |
static int |
TIME
A time entry type for hours, minutes and seconds. |
Constructor Summary | |
DateEditor(Composite parent,
int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance. |
|
DateEditor(Composite parent,
int style,
int dateEditorStyle)
Constructs a new instance of this class given its parent, a style value describing its appearance, and a widget-specific style describing its behavior. |
Method Summary | |
void |
addModifyListener(ModifyListener listener)
Adds the listener to the collection of listeners that will be notified when the receiver's content is modified. |
void |
addSelectionListener(SelectionListener listener)
Adds the listener to the collection of listeners that will be notified when the control is selected. |
java.util.Date |
getDate()
Returns the date when DATE, TIME or DATE_TIME styles are used. |
int |
getTime()
Returns the number of seconds when TIME, OFFSET or DURATION styles are used. |
void |
removeModifyListener(ModifyListener listener)
Removes the listener from the collection of listeners that will be notified when the receiver's text is modified. |
void |
removeSelectionListener(SelectionListener listener)
Removes the listener from the collection of listeners that will be notified when the control is selected. |
void |
setDate(java.util.Date date)
Sets the date for the editor when DATE, TIME or DATE_TIME styles are used. |
void |
setTime(int seconds)
Sets the time for the editor when TIME, OFFSET or DURATION styles are used. |
void |
setTimeZone(java.util.TimeZone timeZone)
Defines the time zone, which is applied on the DateEditor (which is UTC time). |
Methods inherited from class org.eclipse.swt.widgets.Widget |
addDisposeListener, addListener, checkSubclass, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int DATE
Value 1
is assigned to DATE
.
public static final int TIME
Value 2
is assigned to TIME
.
public static final int DATE_TIME
Value 3
is assigned to DATE_TIME
.
public static final int DURATION
Value 4
is assigned to DURATION
.
public static final int OFFSET
Value 5
is assigned to OFFSET
.
public static final int COMPACT
Value 0x10
is assigned to COMPACT
.
public static final int FULL
Value 0x20
is assigned to FULL
.
Constructor Detail |
public DateEditor(Composite parent, int style)
The style value is either one of the style constants defined in class
SWT
which is applicable to instances of this class, or
must be built by bitwise OR 'ing together (that is, using the
int
"|" operator) two or more of those SWT
style constants. The class description lists the style constants that are
applicable to the class. Style bits are also inherited from superclasses.
DATE|COMPACT is used as the default date editor style value.
parent
- a composite control which will be the parent of the new
instance (cannot be null)style
- the SWT style to construct
java.lang.IllegalArgumentException
- SWTException
- DATE
,
COMPACT
public DateEditor(Composite parent, int style, int dateEditorStyle)
The style value is either one of the style constants defined in class
SWT
which is applicable to instances of this class, or
must be built by bitwise OR 'ing together (that is, using the
int
"|" operator) two or more of those SWT
style constants. The class description lists the style constants that are
applicable to the class. Style bits are also inherited from superclasses.
The DateEditor type constants: DATE, TIME, DATE_TIME, DURATION, OFFSET may be bitwise OR'ed with one of the widget-specific styles: COMPACT or FULL.
parent
- a composite control which will be the parent of the new
instance (cannot be null)style
- the SWT style to constructdateEditorStyle
- the DateEditor style to construct.
java.lang.IllegalArgumentException
- SWTException
- DATE
,
TIME
,
DATE_TIME
,
DURATION
,
OFFSET
,
COMPACT
,
FULL
Method Detail |
public void addModifyListener(ModifyListener listener)
ModifyListener
interface.
listener
- the listener which should be notified
java.lang.IllegalArgumentException
- SWTException
- ModifyListener
,
removeModifyListener(org.eclipse.swt.events.ModifyListener)
public void addSelectionListener(SelectionListener listener)
SelectionListener
interface.
widgetSelected
is called when a date or time selection is
finalized by single clicking or pressing the selection key.
widgetDefaultSelected
is called when the user double clicks
or presses the ENTER key.
listener
- the listener which should be notified
java.lang.IllegalArgumentException
- SWTException
- SelectionListener
,
removeSelectionListener(org.eclipse.swt.events.SelectionListener)
,
SelectionEvent
public java.util.Date getDate()
Date
instance will not affect the
date value in the control.
SWTException
- public int getTime()
SWTException
- public void removeModifyListener(ModifyListener listener)
listener
- the listener which should no longer be notified
java.lang.IllegalArgumentException
- SWTException
- ModifyListener
,
addModifyListener(org.eclipse.swt.events.ModifyListener)
public void removeSelectionListener(SelectionListener listener)
listener
- the listener which should be notified
java.lang.IllegalArgumentException
- SWTException
- SelectionListener
,
addSelectionListener(org.eclipse.swt.events.SelectionListener)
public void setDate(java.util.Date date)
date
- an instance of date/time in UTC
java.lang.IllegalArgumentException
- SWTException
- public void setTime(int seconds)
seconds
- the number of seconds which will be displayed in hours,
minutes, and seconds. The maximum value is +/- 86399 seconds
which is equivalent to 23:59:59 in hh:mm:ss.
java.lang.IllegalArgumentException
- SWTException
- public void setTimeZone(java.util.TimeZone timeZone)
timeZone
- an instance of TimeZone or null
SWTException
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |