|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.swt.widgets.Widget org.eclipse.swt.widgets.Control org.eclipse.swt.widgets.Scrollable org.eclipse.swt.widgets.Composite de.jaret.util.ui.datechooser.DateChooserPanel
public class DateChooserPanel
The DateChooserPanel is intended to be used as a dropdown for the DateFieldCombo (@see de.jaret.swt.util.datechooser.DateFieldCombo). However if it seems useful it is possible to be used as a standalone control for selecting a date. It features
(intermdiate change, cancel, selection)
can be set for highlighting holidays in the day panel
Field Summary | |
---|---|
protected static java.util.Calendar |
_calendar
calendar instance. |
protected java.util.Date |
_date
currently selected date. |
protected static java.text.DateFormatSymbols |
_dateFormatSymbols
date format symbols instance. |
protected de.jaret.util.ui.datechooser.DateChooserPanel.DayGrid |
_dayGrid
the daygrid canvas. |
protected IAdditionalDayInformationProvider |
_dayInformationProvider
provider for additional day information. |
protected org.eclipse.swt.widgets.Button |
_decMonthButton
decrement month button. |
protected boolean |
_displayWeeks
true: a columnn showing the number of the week in the year should be displayed. |
protected org.eclipse.swt.graphics.Color |
_holidayColor
actual color for the foreground of holidays. |
protected de.jaret.util.date.holidayenumerator.HolidayEnumerator |
_holidayEnumerator
holiday enumerator. |
protected org.eclipse.swt.widgets.Button |
_incMonthButton
increment month button. |
protected java.util.List<IDateChooserListener> |
_listenerList
listener list. |
protected java.util.Locale |
_locale
locale for the panel. |
protected org.eclipse.swt.graphics.Color |
_markerColor
actual color for the background marking. |
protected org.eclipse.swt.widgets.Label |
_monthLabel
label displaying the month. |
protected boolean |
_oneClickSelection
true: a single click will select. |
protected org.eclipse.swt.graphics.Color |
_specialDayColor
actual color for the foreground of special days. |
protected org.eclipse.swt.widgets.Label |
_todayLabel
label displaying teh current date. |
protected static org.eclipse.swt.graphics.Color |
DEFAULTHOLIDAYCOLOR
default color for drawing holidays. |
protected static org.eclipse.swt.graphics.Color |
DEFAULTMARKERCOLOR
default color for marking selected date in the panel. |
protected static org.eclipse.swt.graphics.Color |
DEFAULTSPECIALDAYCOLOR
default color for drawing special days. |
Fields inherited from class org.eclipse.swt.widgets.Control |
---|
handle |
Constructor Summary | |
---|---|
DateChooserPanel(org.eclipse.swt.widgets.Composite parent,
int style)
Constructor for the DateChooserPanel. |
|
DateChooserPanel(org.eclipse.swt.widgets.Composite parent,
int style,
boolean oneClickSelection,
boolean displayWeeks,
java.util.Locale locale)
Constructor for the DateChooserPanel. |
Method Summary | |
---|---|
void |
addDateChooserListener(IDateChooserListener listener)
Add a DateChooserListener to be informed about changes. |
void |
dispose()
|
protected void |
fireChoosingCanceled()
Inform listeners about cancellation f the choosing. |
protected void |
fireDateChosen(java.util.Date date)
Inform listeners about a chosing action. |
protected void |
fireIntermediateChange(java.util.Date date)
Inform listeners about an intermediate date change. |
IAdditionalDayInformationProvider |
getAdditionalDayInformationProvider()
Retrieve the additional information provider. |
java.util.Date |
getDate()
Get the selected Date. |
org.eclipse.swt.graphics.Color |
getHolidayColor()
Retrieve the color used for painting the foreground of a holiday. |
de.jaret.util.date.holidayenumerator.HolidayEnumerator |
getHolidayEnumerator()
Retrieve the HolidayEnumerator. |
org.eclipse.swt.graphics.Color |
getMarkerColor()
Retrieve the color used for painting the background of the marked day. |
org.eclipse.swt.graphics.Color |
getSpecialDayColor()
Retrieve the color used for painting the foreground of a special day. |
boolean |
isDisplayWeeks()
|
boolean |
isOneClickSelection()
|
void |
mouseDoubleClick(org.eclipse.swt.events.MouseEvent event)
|
void |
mouseDown(org.eclipse.swt.events.MouseEvent event)
|
void |
mouseUp(org.eclipse.swt.events.MouseEvent event)
|
void |
redraw()
Also redraws the grid. |
void |
remDateChooserListener(IDateChooserListener listener)
Remove a DateChooserListener. |
void |
setAdditionalDayInformationProvider(IAdditionalDayInformationProvider informationProvider)
Set an additional provider for day information. |
void |
setBackground(org.eclipse.swt.graphics.Color color)
Propagate the change to the elements. |
void |
setDate(java.util.Date date)
Set the currently selected date. |
protected boolean |
setDateByLocation(int x,
int y)
Sets the calendar day for a given location. |
void |
setDisplayWeeks(boolean displayWeeks)
Set whether a column showing the week of the year should be displayed. |
void |
setHolidayColor(org.eclipse.swt.graphics.Color holidayColor)
Set the color to paint the foreground of holidays. |
void |
setHolidayEnumerator(de.jaret.util.date.holidayenumerator.HolidayEnumerator holidayEnumerator)
Set the HolidayEnumerator. |
void |
setMarkerColor(org.eclipse.swt.graphics.Color markerColor)
Set the color to paint the background of the marked day. |
void |
setOneClickSelection(boolean oneClickSelection)
Set whether a single or a double click will select the date. |
void |
setSpecialDayColor(org.eclipse.swt.graphics.Color specialDayColor)
Set the color to paint the foreground of special days. |
Methods inherited from class org.eclipse.swt.widgets.Composite |
---|
changed, checkSubclass, computeSize, 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, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, 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, 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 |
---|
protected java.util.Date _date
protected static java.text.DateFormatSymbols _dateFormatSymbols
protected static java.util.Calendar _calendar
protected static final org.eclipse.swt.graphics.Color DEFAULTMARKERCOLOR
protected static final org.eclipse.swt.graphics.Color DEFAULTHOLIDAYCOLOR
protected static final org.eclipse.swt.graphics.Color DEFAULTSPECIALDAYCOLOR
protected org.eclipse.swt.graphics.Color _markerColor
protected org.eclipse.swt.graphics.Color _holidayColor
protected org.eclipse.swt.graphics.Color _specialDayColor
protected boolean _displayWeeks
protected boolean _oneClickSelection
protected de.jaret.util.date.holidayenumerator.HolidayEnumerator _holidayEnumerator
protected IAdditionalDayInformationProvider _dayInformationProvider
protected org.eclipse.swt.widgets.Label _monthLabel
protected org.eclipse.swt.widgets.Label _todayLabel
protected org.eclipse.swt.widgets.Button _incMonthButton
protected org.eclipse.swt.widgets.Button _decMonthButton
protected de.jaret.util.ui.datechooser.DateChooserPanel.DayGrid _dayGrid
protected java.util.List<IDateChooserListener> _listenerList
protected java.util.Locale _locale
Constructor Detail |
---|
public DateChooserPanel(org.eclipse.swt.widgets.Composite parent, int style, boolean oneClickSelection, boolean displayWeeks, java.util.Locale locale)
parent
- Composite parentstyle
- style bitsoneClickSelection
- if true, a single mouse click will be considered a valid selection. Otherwise a
selection will need a double click.displayWeeks
- if true the panel will display a week of the year columnlocale
- Locale to be usedpublic DateChooserPanel(org.eclipse.swt.widgets.Composite parent, int style)
false
, displayWeeks defaults
to true
. The Locale used is the default locale.
parent
- Composite parentstyle
- style bitsMethod Detail |
---|
public void dispose()
dispose
in class org.eclipse.swt.widgets.Widget
public void setBackground(org.eclipse.swt.graphics.Color color)
setBackground
in class org.eclipse.swt.widgets.Control
public void setDate(java.util.Date date)
null
will be transformed to the current date.
date
- Date to be displayedpublic java.util.Date getDate()
public void redraw()
redraw
in class org.eclipse.swt.widgets.Control
public void mouseDoubleClick(org.eclipse.swt.events.MouseEvent event)
mouseDoubleClick
in interface org.eclipse.swt.events.MouseListener
public void mouseDown(org.eclipse.swt.events.MouseEvent event)
mouseDown
in interface org.eclipse.swt.events.MouseListener
public void mouseUp(org.eclipse.swt.events.MouseEvent event)
mouseUp
in interface org.eclipse.swt.events.MouseListener
protected boolean setDateByLocation(int x, int y)
x
- x coordinatey
- y coordinate
public void addDateChooserListener(IDateChooserListener listener)
listener
- the DateChooserListener to be addedpublic void remDateChooserListener(IDateChooserListener listener)
listener
- the DateChooserListener to be removedprotected void fireDateChosen(java.util.Date date)
date
- date chosenprotected void fireIntermediateChange(java.util.Date date)
date
- date currently selectedprotected void fireChoosingCanceled()
public de.jaret.util.date.holidayenumerator.HolidayEnumerator getHolidayEnumerator()
public void setHolidayEnumerator(de.jaret.util.date.holidayenumerator.HolidayEnumerator holidayEnumerator)
null
is valid meaning no HolidayEnumerator should be used.
holidayEnumerator
- The HolidayEnumerator to set.public IAdditionalDayInformationProvider getAdditionalDayInformationProvider()
public void setAdditionalDayInformationProvider(IAdditionalDayInformationProvider informationProvider)
informationProvider
- the information providerpublic boolean isDisplayWeeks()
public void setDisplayWeeks(boolean displayWeeks)
displayWeeks
- if set to true a column with the number of the week in the year is displayed.public boolean isOneClickSelection()
public void setOneClickSelection(boolean oneClickSelection)
oneClickSelection
- if set to true one click will select the date. If set to false the date selection
requires a double click.public org.eclipse.swt.graphics.Color getMarkerColor()
public void setMarkerColor(org.eclipse.swt.graphics.Color markerColor)
markerColor
- color for the markerpublic org.eclipse.swt.graphics.Color getHolidayColor()
public void setHolidayColor(org.eclipse.swt.graphics.Color holidayColor)
holidayColor
- holiday colorpublic org.eclipse.swt.graphics.Color getSpecialDayColor()
public void setSpecialDayColor(org.eclipse.swt.graphics.Color specialDayColor)
specialDayColor
- color for special days
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |