net.sf.ecl.datepicker
Class DateEdit

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

public final class DateEdit
extends Composite

is an editor for the date in a text format. The editor uses Apache's FastDateFormat to obtain default system date format. So the editor is locale sensible. During editing user may use up/down arrow keys to increment/decrement the selected date field or enter date explicitly by typing digits.

Author:
Alexey Afanasyev, Alexey Kharlamov

Field Summary
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
DateEdit(Composite parent, int style)
          creates an instance of the DateEdit for default Locale.
DateEdit(Composite parent, int style, Locale locale)
          creates an instance of the DateEdit.
 
Method Summary
 void addModifyListener(ModifyListener listener)
          Adds the listener to the collection of listeners who will be notified when the receiver's text is modified, by sending it one of the messages defined in the ModifyListener interface.
 Point computeSize(int wHint, int hHint, boolean changed)
           
 Calendar getDate()
          the current date in the control.
 void removeModifyListener(ModifyListener listener)
          Removes the listener from the collection of listeners who will be notified when the receiver's text is modified.
 void setDate(Calendar date)
          sets date into the calendar.
 void setEnabled(boolean enabled)
           
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, 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, 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

DateEdit

public DateEdit(Composite parent,
                int style)
creates an instance of the DateEdit for default Locale.

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

DateEdit

public DateEdit(Composite parent,
                int style,
                Locale locale)
creates an instance of the DateEdit.

Parameters:
parent - the parent composite.
style - the style.
locale - the locale used to obtain date format.
Method Detail

addModifyListener

public void addModifyListener(ModifyListener listener)
Adds the listener to the collection of listeners who will be notified when the receiver's text is modified, by sending it one of the messages defined in the ModifyListener interface.

Parameters:
listener - the listener which should be notified
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the listener is null
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also:
ModifyListener, removeModifyListener(org.eclipse.swt.events.ModifyListener)

computeSize

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

getDate

public Calendar getDate()
the current date in the control.

Returns:
the date or null.

removeModifyListener

public void removeModifyListener(ModifyListener listener)
Removes the listener from the collection of listeners who will be notified when the receiver's text is modified.

Parameters:
listener - the listener which should no longer be notified
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the listener is null
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
See Also:
ModifyListener, addModifyListener(org.eclipse.swt.events.ModifyListener)

setDate

public void setDate(Calendar date)
sets date into the calendar.

Parameters:
date - the date value or null to reset editor.

setEnabled

public void setEnabled(boolean enabled)
Overrides:
setEnabled in class Control