net.sf.ecl.datepicker
Class DateSelector

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.DateSelector
All Implemented Interfaces:
Drawable

public final class DateSelector
extends Composite

is a flat calendar control allowing to select single date.

Author:
Alexey Afanasyev, Alexey Kharlamov

Field Summary
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
DateSelector(Composite parent, int style)
          creates a new instance of the DateSelector.
DateSelector(Composite parent, int style, Locale locale)
          creates a new instance of the DateSelector.
 
Method Summary
 void addSelectionListener(SelectionListener listener)
          adds a selection listener to the control.
 Point computeSize(int wHint, int hHint, boolean changed)
           
 Calendar getSelection()
          returns the selected date.
 void layout(boolean changed)
           
 void removeSelectionListener(SelectionListener listener)
          removes the given selection listener.
 void setSelection(Calendar date)
          sets the selected date.
 
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, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setEnabled, 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
 

Constructor Detail

DateSelector

public DateSelector(Composite parent,
                    int style)
creates a new instance of the DateSelector.

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

DateSelector

public DateSelector(Composite parent,
                    int style,
                    Locale locale)
creates a new instance of the DateSelector.

Parameters:
parent - the parent composite.
style - the control style.
locale - the locale to use.
Method Detail

addSelectionListener

public void addSelectionListener(SelectionListener listener)
adds a selection listener to the control.

Parameters:
listener - the listener.

computeSize

public Point computeSize(int wHint,
                         int hHint,
                         boolean changed)
Overrides:
computeSize in class Composite

getSelection

public Calendar getSelection()
returns the selected date.

Returns:
the selected date or null on empty selection.

layout

public void layout(boolean changed)
Overrides:
layout in class Composite

removeSelectionListener

public void removeSelectionListener(SelectionListener listener)
removes the given selection listener.

Parameters:
listener - the listener.

setSelection

public void setSelection(Calendar date)
sets the selected date.

Parameters:
date - the date to select. not null.