net.sf.ecl.datepicker
Class DatePicker

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by net.sf.ecl.datepicker.AbstractCombo
                      extended by net.sf.ecl.datepicker.DatePicker
All Implemented Interfaces:
Drawable

public final class DatePicker
extends AbstractCombo

is a combo providing date editing with DateEdit control and a drop-down with DateSelector control. Groupped together these controls allow to explicitly enter or quickly select date.

Author:
Alexey Afanasyev, Alexey Kharlamov

Field Summary
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
DatePicker(Composite parent, int style)
          creates instance of DatePicker.
DatePicker(Composite parent, int style, Locale locale)
          creates instance of DatePicker.
 
Method Summary
protected  Control createInput(Composite parent, int style)
          creates an input widget.
protected  Control createPopup(Composite parent, int style)
          creates a control placed into combo's drop-down.
 Calendar getSelection()
          return the selected date.
protected  void handlePopupHiding()
          notification of popup hiding.
protected  void handlePopupShowing()
          notification of popup appearance.
 void setSelection(Calendar date)
          sets selected date.
 
Methods inherited from class net.sf.ecl.datepicker.AbstractCombo
addSelectionListener, computeSize, dispose, hidePopup, layout, removeSelectionListener, setBackground, setEnabled, setFont, setForeground, setToolTipText, showPopup
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, setBackgroundMode, 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, getBackgroundImage, 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, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, 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
 

Constructor Detail

DatePicker

public DatePicker(Composite parent,
                  int style)
creates instance of DatePicker.

Parameters:
parent - the parent composite.
style - the control's style.

DatePicker

public DatePicker(Composite parent,
                  int style,
                  Locale locale)
creates instance of DatePicker.

Parameters:
parent - the parent composite.
style - the control's style.
locale - the locale used to obtain date format, month & weekday titles.
Method Detail

getSelection

public Calendar getSelection()
return the selected date.

Returns:
the date or null.

setSelection

public void setSelection(Calendar date)
sets selected date.

Parameters:
date - the date or null to reset selection.

createInput

protected Control createInput(Composite parent,
                              int style)
Description copied from class: AbstractCombo
creates an input widget. The widget is used by the composite to edit textual representation of the date.

Specified by:
createInput in class AbstractCombo
Parameters:
parent - the input widget's parent.
style - the style for input widget. The style is derived from the composite's style.
Returns:
the input widget.

createPopup

protected Control createPopup(Composite parent,
                              int style)
Description copied from class: AbstractCombo
creates a control placed into combo's drop-down. The method is called each time the drop-down is shown.

Specified by:
createPopup in class AbstractCombo
Parameters:
parent - the parent control.
style - the style derived from the style of the combo.
Returns:
the control.

handlePopupHiding

protected void handlePopupHiding()
Description copied from class: AbstractCombo
notification of popup hiding. It is called _before_ the actual hiding.

Specified by:
handlePopupHiding in class AbstractCombo

handlePopupShowing

protected void handlePopupShowing()
Description copied from class: AbstractCombo
notification of popup appearance. The method is called after popup construction but before it becomes visible.

Specified by:
handlePopupShowing in class AbstractCombo