|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.ercp.swt.mobile.DateEditor
public class 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. |
Fields inherited from class org.eclipse.swt.widgets.Control |
---|
enableTraverse, internal_parent |
Fields inherited from class org.eclipse.swt.widgets.Widget |
---|
internal_handle, internal_style |
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. |
boolean |
allowTraverseByArrowKey(Event event)
|
Point |
computeSize(int wHint,
int hHint,
boolean changed)
Returns the preferred size of the receiver. |
void |
dispose()
Disposes of the operating system resources associated with the receiver and all its descendents. |
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 |
internal_createHandle(int index)
|
boolean |
isDispose()
|
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). |
protected boolean |
traverse(Event event)
|
Methods inherited from class org.eclipse.swt.widgets.Widget |
---|
addDisposeListener, addListener, checkSubclass, checkWidget, getData, getData, getDisplay, getStyle, internal_sendEvent, isDisposed, isListening, notifyListeners, removeDisposeListener, removeInternalFilter, removeListener, removeListener, sendEvent, 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 Point computeSize(int wHint, int hHint, boolean changed)
Control
The preferred size of a control is the size that it would
best be displayed at. The width hint and height hint arguments
allow the caller to ask a control questions such as "Given a particular
width, how high does the control need to be to show all of the contents?"
To indicate that the caller does not wish to constrain a particular
dimension, the constant SWT.DEFAULT
is passed for the hint.
If the changed flag is true
, it indicates that the receiver's
contents have changed, therefore any caches that a layout manager
containing the control may have been keeping need to be flushed. When the
control is resized, the changed flag will be false
, so layout
manager caches can be retained.
computeSize
in class Control
wHint
- the width hint (can be SWT.DEFAULT
)hHint
- the height hint (can be SWT.DEFAULT
)changed
- true
if the control's contents have changed, and false
otherwise
Layout
,
Control.getBorderWidth()
,
Control.getBounds()
,
Control.getSize()
,
Control.pack(boolean)
,
"computeTrim, getClientArea for controls that implement them"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
- public void internal_createHandle(int index)
internal_createHandle
in class Widget
public void dispose()
Widget
true
when sent the message isDisposed()
.
Any internal connections between the widgets in the tree will
have been removed to facilitate garbage collection.
NOTE: This method is not called recursively on the descendents
of the receiver. This means that, widget implementers can not
detect when a widget is being disposed of by re-implementing
this method, but should instead listen for the Dispose
event.
dispose
in class Control
Widget.addDisposeListener(org.eclipse.swt.events.DisposeListener)
,
Widget.removeDisposeListener(org.eclipse.swt.events.DisposeListener)
,
Widget.checkWidget()
public boolean isDispose()
public boolean allowTraverseByArrowKey(Event event)
allowTraverseByArrowKey
in class Control
protected boolean traverse(Event event)
traverse
in class Control
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |