at.spardat.xma.widgets
Class DatePicker

java.lang.Object
  extended byorg.eclipse.swt.widgets.Widget
      extended byorg.eclipse.swt.widgets.Control
          extended byorg.eclipse.swt.widgets.Scrollable
              extended byorg.eclipse.swt.widgets.Composite
                  extended byat.spardat.xma.widgets.DatePicker
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable

public class DatePicker
extends org.eclipse.swt.widgets.Composite

The DatePicker widget consists of a Text field and a Button. Usually the text field is to attach to a simple widget model, on which a Date validator has to be set. On a button click a date-chooser dialog is started, after date selection the dialog is closed and the selected date is written to the widget model.

Since:
version_number

Field Summary
static int RED_SUNDAY
          Style constant for making Sundays red.
static int RED_WEEKEND
          Style constant for making weekends red.
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
DatePicker(org.eclipse.swt.widgets.Composite parent)
           
DatePicker(org.eclipse.swt.widgets.Composite parent, int dateFieldStyle)
           
DatePicker(org.eclipse.swt.widgets.Composite parent, int dateFieldStyle, int datePickerStyle)
           
 
Method Summary
 org.eclipse.swt.widgets.Text getDateTextField()
          Returns the text field used by the DatePicker.
 java.util.Calendar getPickedCalendar()
          Returns the calendar set with the date as chosen by the date-chosser dialog.
 boolean isEditable()
           
 void setBackground(org.eclipse.swt.graphics.Color color)
           
 void setDatePickerDate(java.util.Date aDate)
          Sets the date preselected at the date-chooser dialog.
 void setDatePickerFont(org.eclipse.swt.graphics.Font font)
          Sets the Font of the date-chooser dialog and its controls.
 void setDatePickerLocale(java.util.Locale locale)
          Sets the Locale of the date-chooser dialog and its controls.
 void setEditable(boolean editable)
          Editables text field of DatePicker and enables/disables Button.
 void setEnabled(boolean enabled)
           
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBounds, setBounds, setCapture, setCursor, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, 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

RED_SUNDAY

public static final int RED_SUNDAY
Style constant for making Sundays red.

See Also:
Constant Field Values

RED_WEEKEND

public static final int RED_WEEKEND
Style constant for making weekends red.

See Also:
Constant Field Values
Constructor Detail

DatePicker

public DatePicker(org.eclipse.swt.widgets.Composite parent,
                  int dateFieldStyle,
                  int datePickerStyle)
Parameters:
parent -
dateFieldStyle - The style for the Text dateTextField. Any style valid or a Text widget.
datePickerStyle - The style for the date-picker composite. Can be any style valid for a Composite and RED_WEEKEND, RED_SUNDAY.

DatePicker

public DatePicker(org.eclipse.swt.widgets.Composite parent,
                  int dateFieldStyle)
Parameters:
parent -
dateFieldStyle - The style for the Text dateTextField. Any style valid or a Text widget.

DatePicker

public DatePicker(org.eclipse.swt.widgets.Composite parent)
Parameters:
parent -
Method Detail

getDateTextField

public org.eclipse.swt.widgets.Text getDateTextField()
Returns the text field used by the DatePicker. Usually this text field is attached to a widget model (ISimpleWM) with a date validator.

Returns:
Returns the dateTextField.

getPickedCalendar

public java.util.Calendar getPickedCalendar()
Returns the calendar set with the date as chosen by the date-chosser dialog.

Returns:
Returns the picked date as a Calendar. Returns null if called before anything was picked or set.

setDatePickerDate

public void setDatePickerDate(java.util.Date aDate)
Sets the date preselected at the date-chooser dialog. Note that if this widget is attached to a model, then the model's date is preselected (if the model has a value). This method does not set the date in the dateTextField!

Parameters:
aDate -
Since:
version_number

setDatePickerFont

public void setDatePickerFont(org.eclipse.swt.graphics.Font font)
Sets the Font of the date-chooser dialog and its controls. (Not of the DateTextField, its properties can be set by getDateTextField()) Optional - if not set then the controls' default Fonts are used.


setDatePickerLocale

public void setDatePickerLocale(java.util.Locale locale)
Sets the Locale of the date-chooser dialog and its controls. (Not of the DateTextField. The text field's Locale is set by the Wiget model) Optional - if not set then the default Locale is used.


setBackground

public void setBackground(org.eclipse.swt.graphics.Color color)

setEnabled

public void setEnabled(boolean enabled)

setEditable

public void setEditable(boolean editable)
Editables text field of DatePicker and enables/disables Button.

Parameters:
editable -
Since:
version_number

isEditable

public boolean isEditable()