net.sf.ecl.datepicker
Class WeekSelector

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

public final class WeekSelector
extends Composite

is a week of selection control. The control is used to select some week on the timeline. Year borders are not honored. So it is posible to select a week like this: 30.12 - 05.01. The control shows a standard calendar widget with selectable week.

Events:
SelectionListener

Author:
Alexey Afanasyev, Alexey Kharlamov

Field Summary
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
WeekSelector(Composite parent, int style)
          creates WeekSelector instance.
WeekSelector(Composite parent, int style, Locale locale)
          creates WeekSelector instance.
 
Method Summary
 void addSelectionListener(SelectionListener listener)
          adds selecetion listener.
 void clearSelection()
          clears control's selection.
 Point computeSize(int wHint, int hHint, boolean changed)
           
 DatePeriod getSelection()
           
 DatePeriod getVisibleMonth()
          returns the month visible in the control as a date period.
 void layout(boolean changed)
           
 void removeSelectionListener(SelectionListener listener)
          removes the given selection listener.
 void setFont(Font font)
           
 void setSelection(Calendar startDate, Calendar endDate)
           
 void setSelection(DatePeriod period)
           
 void setVisibleMonth(Calendar dayOfMonth)
           
 
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, 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

WeekSelector

public WeekSelector(Composite parent,
                    int style)
creates WeekSelector instance.

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

WeekSelector

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

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

addSelectionListener

public void addSelectionListener(SelectionListener listener)
adds selecetion listener.

Parameters:
listener - the listener.

clearSelection

public void clearSelection()
clears control's selection.


computeSize

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

getSelection

public DatePeriod getSelection()
Returns:

getVisibleMonth

public DatePeriod getVisibleMonth()
returns the month visible in the control as a date period.

Returns:
the visible month.

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.

setFont

public final void setFont(Font font)
Overrides:
setFont in class Control

setSelection

public void setSelection(Calendar startDate,
                         Calendar endDate)
Parameters:
startDate -
endDate -

setSelection

public void setSelection(DatePeriod period)
Parameters:
period -

setVisibleMonth

public void setVisibleMonth(Calendar dayOfMonth)
Parameters:
dayOfMonth -