diff options
author | Carolyn MacLeod <carolyn> | 2007-05-31 20:34:20 +0000 |
---|---|---|
committer | Carolyn MacLeod <carolyn> | 2007-05-31 20:34:20 +0000 |
commit | 20a3f2c29e1d6bada2326bd04dcead2e1ae22ad9 (patch) | |
tree | 39bd3703cea1020d3f848e884fffd09cef858c42 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java | |
parent | 29ed0b9d892e5929f54e524e3dc1c92d73ee99db (diff) | |
download | eclipse.platform.swt-20a3f2c29e1d6bada2326bd04dcead2e1ae22ad9.tar.gz eclipse.platform.swt-20a3f2c29e1d6bada2326bd04dcead2e1ae22ad9.tar.xz eclipse.platform.swt-20a3f2c29e1d6bada2326bd04dcead2e1ae22ad9.zip |
After javadoc bash for 3.3 RC3BEFORE_COPYRIGHT_BASH_FOR_33RC3AFTER_JAVADOC_BASH_FOR_33RC3
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java | 250 |
1 files changed, 250 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java index 7bf38e5642..7cdd1541aa 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java @@ -18,6 +18,29 @@ import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.gtk.OS; +/** + * Instances of this class are selectable user interface + * objects that allow the user to enter and modify date + * or time values. + * <p> + * Note that although this class is a subclass of <code>Composite</code>, + * it does not make sense to add children to it, or set a layout on it. + * </p> + * <dl> + * <dt><b>Styles:</b></dt> + * <dd>DATE, TIME, CALENDAR, SHORT, MEDIUM, LONG</dd> + * <dt><b>Events:</b></dt> + * <dd>Selection</dd> + * </dl> + * <p> + * Note: Only one of the styles DATE, TIME, or CALENDAR may be specified, + * and only one of the styles SHORT, MEDIUM, or LONG may be specified. + * </p><p> + * IMPORTANT: This class is <em>not</em> intended to be subclassed. + * </p> + * + * @since 3.3 + */ public class DateTime extends Composite { int day, month, year, hours, minutes, seconds; @@ -41,6 +64,36 @@ public class DateTime extends Composite { static final String DEFAULT_MEDIUM_TIME_FORMAT = "HH:MM:SS AM"; static final String DEFAULT_LONG_TIME_FORMAT = "HH:MM:SS AM"; +/** + * Constructs a new instance of this class given its parent + * and a style value describing its behavior and appearance. + * <p> + * The style value is either one of the style constants defined in + * class <code>SWT</code> which is applicable to instances of this + * class, or must be built by <em>bitwise OR</em>'ing together + * (that is, using the <code>int</code> "|" operator) two or more + * of those <code>SWT</code> style constants. The class description + * lists the style constants that are applicable to the class. + * Style bits are also inherited from superclasses. + * </p> + * + * @param parent a composite control which will be the parent of the new instance (cannot be null) + * @param style the style of control to construct + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> + * </ul> + * @exception SWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> + * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li> + * </ul> + * + * @see SWT#DATE + * @see SWT#TIME + * @see SWT#CALENDAR + * @see Widget#checkSubclass + * @see Widget#getStyle + */ public DateTime (Composite parent, int style) { super (parent, checkStyle (style)); if ((this.style & SWT.CALENDAR) == 0) { @@ -109,6 +162,30 @@ static int checkStyle (int style) { return checkBits (style, SWT.MEDIUM, SWT.SHORT, SWT.LONG, 0, 0, 0); } +/** + * Adds the listener to the collection of listeners who will + * be notified when the control is selected by the user, by sending + * it one of the messages defined in the <code>SelectionListener</code> + * interface. + * <p> + * <code>widgetSelected</code> is called when the user changes the control's value. + * <code>widgetDefaultSelected</code> is not called. + * </p> + * + * @param listener the listener which should be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * + * @see SelectionListener + * @see #removeSelectionListener + * @see SelectionEvent + */ public void addSelectionListener (SelectionListener listener) { checkWidget (); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); @@ -250,6 +327,19 @@ void getDate() { day = d[0]; } +/** + * Returns the receiver's date, or day of the month. + * <p> + * The first day of the month is 1, and the last day depends on the month and year. + * </p> + * + * @return a positive integer beginning with 1 + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ public int getDay () { checkWidget (); if ((style & SWT.CALENDAR) != 0) { @@ -260,6 +350,19 @@ public int getDay () { } } +/** + * Returns the receiver's hours. + * <p> + * Hours is an integer between 0 and 23. + * </p> + * + * @return an integer between 0 and 23 + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ public int getHours () { checkWidget (); if ((style & SWT.CALENDAR) != 0) { @@ -269,6 +372,19 @@ public int getHours () { } } +/** + * Returns the receiver's minutes. + * <p> + * Minutes is an integer between 0 and 59. + * </p> + * + * @return an integer between 0 and 59 + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ public int getMinutes () { checkWidget (); if ((style & SWT.CALENDAR) != 0) { @@ -278,6 +394,19 @@ public int getMinutes () { } } +/** + * Returns the receiver's month. + * <p> + * The first month of the year is 0, and the last month is 11. + * </p> + * + * @return an integer between 0 and 11 + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ public int getMonth () { checkWidget (); if ((style & SWT.CALENDAR) != 0) { @@ -288,6 +417,19 @@ public int getMonth () { } } +/** + * Returns the receiver's seconds. + * <p> + * Seconds is an integer between 0 and 59. + * </p> + * + * @return an integer between 0 and 59 + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ public int getSeconds () { checkWidget (); if ((style & SWT.CALENDAR) != 0) { @@ -297,6 +439,19 @@ public int getSeconds () { } } +/** + * Returns the receiver's year. + * <p> + * The first year is 1752 and the last year is 9999. + * </p> + * + * @return an integer between 1752 and 9999 + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ public int getYear () { checkWidget (); if ((style & SWT.CALENDAR) != 0) { @@ -495,6 +650,23 @@ void releaseWidget () { //TODO: need to do anything here? } +/** + * Removes the listener from the collection of listeners who will + * be notified when the control is selected by the user. + * + * @param listener the listener which should no longer be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * + * @see SelectionListener + * @see #addSelectionListener + */ public void removeSelectionListener (SelectionListener listener) { checkWidget (); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); @@ -638,6 +810,19 @@ void setTextField(int fieldName, int value, boolean commit, boolean adjust) { if (commit) setField(fieldName, value); } +/** + * Sets the receiver's date, or day of the month, to the specified day. + * <p> + * The first day of the month is 1, and the last day depends on the month and year. + * </p> + * + * @param day a positive integer beginning with 1 + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ public void setDay (int day) { checkWidget (); if (!isValid(Calendar.DAY_OF_MONTH, day)) return; @@ -650,6 +835,19 @@ public void setDay (int day) { } } +/** + * Sets the receiver's hours. + * <p> + * Hours is an integer between 0 and 23. + * </p> + * + * @param hours an integer between 0 and 23 + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ public void setHours (int hours) { checkWidget (); if (!isValid(Calendar.HOUR_OF_DAY, hours)) return; @@ -661,6 +859,19 @@ public void setHours (int hours) { } } +/** + * Sets the receiver's minutes. + * <p> + * Minutes is an integer between 0 and 59. + * </p> + * + * @param minutes an integer between 0 and 59 + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ public void setMinutes (int minutes) { checkWidget (); if (!isValid(Calendar.MINUTE, minutes)) return; @@ -672,6 +883,19 @@ public void setMinutes (int minutes) { } } +/** + * Sets the receiver's month. + * <p> + * The first month of the year is 0, and the last month is 11. + * </p> + * + * @param month an integer between 0 and 11 + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ public void setMonth (int month) { checkWidget (); if (!isValid(Calendar.MONTH, month)) return; @@ -684,6 +908,19 @@ public void setMonth (int month) { } } +/** + * Sets the receiver's seconds. + * <p> + * Seconds is an integer between 0 and 59. + * </p> + * + * @param seconds an integer between 0 and 59 + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ public void setSeconds (int seconds) { checkWidget (); if (!isValid(Calendar.SECOND, seconds)) return; @@ -695,6 +932,19 @@ public void setSeconds (int seconds) { } } +/** + * Sets the receiver's year. + * <p> + * The first year is 1752 and the last year is 9999. + * </p> + * + * @param year an integer between 1752 and 9999 + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ public void setYear (int year) { checkWidget (); //if (!isValid(Calendar.YEAR, year)) return; |