Class MonthCalendar
- java.lang.Object
-
- org.eclipse.swt.widgets.Widget
-
- org.eclipse.swt.widgets.Control
-
- org.eclipse.swt.widgets.Scrollable
-
- org.eclipse.swt.widgets.Composite
-
- org.eclipse.nebula.widgets.compositetable.timeeditor.AbstractEventEditor
-
- org.eclipse.nebula.widgets.compositetable.month.MonthCalendar
-
- All Implemented Interfaces:
IEventEditor,org.eclipse.swt.graphics.Drawable
public class MonthCalendar extends AbstractEventEditor implements IEventEditor
An IEventEditor implementing a month calendar. This class is not intended to be subclassed.
-
-
Field Summary
Fields Modifier and Type Field Description private org.eclipse.swt.events.FocusListenerdayFocusListenerprivate org.eclipse.swt.events.KeyListenerdayKeyListenerprivate org.eclipse.swt.events.MouseListenerdayMouseListenerprivate java.util.List<CalendarableItemEventHandler>deleteHandlersprivate java.util.List<CalendarableItemEventHandler>disposeHandlersprivate EventContentProvidereventContentProviderprivate EventCountProvidereventCountProviderprivate java.util.List<org.eclipse.swt.events.FocusListener>focusListenersprivate java.util.List<CalendarableItemEventHandler>itemEditHandlersprivate java.util.List<org.eclipse.swt.events.KeyListener>keyListenersprivate DaylastSelectedDayprivate java.util.List<org.eclipse.swt.events.MouseListener>mouseListenersprivate MonthCalendarSelectedDayselectedDayprivate java.util.List<CalendarableSelectionChangeListener>selectionChangeListenersprivate java.util.DatestartDateprivate WeekHeaderweekHeaderprivate Week[]weeksprivate org.eclipse.swt.widgets.CompositeweeksHolder-
Fields inherited from interface org.eclipse.nebula.widgets.compositetable.timeeditor.IEventEditor
DISPLAYED_HOURS
-
-
Constructor Summary
Constructors Constructor Description MonthCalendar(org.eclipse.swt.widgets.Composite parent, int style)Constructor DayEditor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFocusListener(org.eclipse.swt.events.FocusListener listener)Adds the listener to the collection of listeners who will be notified when the control gains or loses focus, by sending it one of the messages defined in theFocusListenerinterface.voidaddItemDeleteHandler(CalendarableItemEventHandler deleteHandler)Adds the handler to the collection of handlers who will be notified when a CalendarableItem is deleted from the receiver, by sending it one of the messages defined in theCalendarableItemEventHandlerabstract class.voidaddItemDisposeHandler(CalendarableItemEventHandler itemDisposeHandler)Adds the handler to the collection of handler who will be notified when a CalendarableItem's control is disposed, by sending it one of the messages defined in theCalendarableItemEventHandlerabstract class.voidaddItemEditHandler(CalendarableItemEventHandler handler)Adds the handler to the collection of handlers who will be notified when a CalendarableItem is inserted in the receiver, by sending it one of the messages defined in theCalendarableItemInsertHandlerabstract class.voidaddKeyListener(org.eclipse.swt.events.KeyListener listener)Adds the listener to the collection of listeners who will be notified when keys are pressed and released on the system keyboard, by sending it one of the messages defined in theKeyListenerinterface.voidaddMouseListener(org.eclipse.swt.events.MouseListener listener)voidaddSelectionChangeListener(CalendarableSelectionChangeListener l)Adds the listener to the collection of listeners who will be notified when the receiver's selection changes, by sending it one of the messages defined in theCalendarableSelectionChangeListenerinterface.private WeekcreateWeek()This method initializes weekprivate voidcreateWeekHeader()This method initializes weekHeaderprivate voidcreateWeeksHolder()This method initializes compositebooleanfireDelete(CalendarableItem toDelete)Requests that the event editor delete the specified CalendarableItem's data.intgetNumberOfDays()Method getNumberOfDays.intgetNumberOfDivisionsInHour()Returns the numberOfDivisionsInHour.MonthCalendarSelectedDaygetSelectedDay()Method getSelectedDay.java.util.DategetStartDate()Return the current start date for this event editor.private voidinitialize()voidrefresh()Tells the IEventEditor to refresh all days in its display.voidrefresh(java.util.Date date)Tells the IEventEditor to refresh its display for the specified date.private voidrefresh(java.util.Date date, Day dayControl)voidremoveFocusListener(org.eclipse.swt.events.FocusListener listener)Removes the listener from the collection of listeners who will be notified when the control gains or loses focus.voidremoveItemDeleteHandler(CalendarableItemEventHandler deleteHandler)Removes the handler from the collection of handlers who will be notified when a CalendarableItem is deleted from the receiver, by sending it one of the messages defined in theCalendarableItemEventHandlerabstract class.voidremoveItemDisposeHandler(CalendarableItemEventHandler itemDisposeHandler)Removes the handler from the collection of handlers who will be notified when a CalendarableItem is disposed, by sending it one of the messages defined in theCalendarableItemEventHandlerabstract class.voidremoveItemEditHandler(CalendarableItemEventHandler handler)Removes the handler from the collection of handlers who will be notified when a CalendarableItem is inserted into the receiver, by sending it one of the messages defined in theCalendarableItemInsertHandlerabstract class.voidremoveKeyListener(org.eclipse.swt.events.KeyListener listener)Removes the listener from the collection of listeners who will be notified when keys are pressed and released on the system keyboard.voidremoveMouseListener(org.eclipse.swt.events.MouseListener listener)voidremoveSelectionChangeListener(CalendarableSelectionChangeListener l)Removes the listener from the collection of listeners who will be notified when the receiver's selection changes, by sending it one of the messages defined in theCalendarableSelectionChangeListenerinterface.voidselect(java.util.Date newDate)voidsetEventContentProvider(EventContentProvider eventContentProvider)Sets the strategy pattern object that can set the properties of the event objects in order to display the data associated with the specified event.voidsetEventCountProvider(EventCountProvider eventCountProvider)Set the strategy pattern object that can return how many events to display for specific periods of time.booleansetFocus()voidsetStartDate(java.util.Date startDate)Sets the start date for this MonthCalendar.voidsetTimeBreakdown(int numberOfDays, int numberOfDivisionsInHour)Method setTimeBreakdown.-
Methods inherited from class org.eclipse.nebula.widgets.compositetable.timeeditor.AbstractEventEditor
addItemInsertHandler, fireEvents, fireInsert, getDefaultEventDuration, removeItemInsertHandler, setDefaultEventDuration
-
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setLayout, setLayoutDeferred, setTabList
-
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
-
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addGestureListener, addHelpListener, addMenuDetectListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isAutoScalable, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeGestureListener, removeHelpListener, removeMenuDetectListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
-
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.nebula.widgets.compositetable.timeeditor.IEventEditor
addItemInsertHandler, fireInsert, removeItemInsertHandler
-
-
-
-
Field Detail
-
startDate
private java.util.Date startDate
-
weekHeader
private WeekHeader weekHeader
-
weeksHolder
private org.eclipse.swt.widgets.Composite weeksHolder
-
weeks
private Week[] weeks
-
eventContentProvider
private EventContentProvider eventContentProvider
-
eventCountProvider
private EventCountProvider eventCountProvider
-
deleteHandlers
private java.util.List<CalendarableItemEventHandler> deleteHandlers
-
disposeHandlers
private java.util.List<CalendarableItemEventHandler> disposeHandlers
-
itemEditHandlers
private java.util.List<CalendarableItemEventHandler> itemEditHandlers
-
selectionChangeListeners
private java.util.List<CalendarableSelectionChangeListener> selectionChangeListeners
-
selectedDay
private MonthCalendarSelectedDay selectedDay
-
focusListeners
private java.util.List<org.eclipse.swt.events.FocusListener> focusListeners
-
lastSelectedDay
private Day lastSelectedDay
-
dayFocusListener
private org.eclipse.swt.events.FocusListener dayFocusListener
-
mouseListeners
private java.util.List<org.eclipse.swt.events.MouseListener> mouseListeners
-
dayMouseListener
private org.eclipse.swt.events.MouseListener dayMouseListener
-
keyListeners
private java.util.List<org.eclipse.swt.events.KeyListener> keyListeners
-
dayKeyListener
private org.eclipse.swt.events.KeyListener dayKeyListener
-
-
Method Detail
-
initialize
private void initialize()
-
createWeekHeader
private void createWeekHeader()
This method initializes weekHeader
-
createWeeksHolder
private void createWeeksHolder()
This method initializes composite
-
createWeek
private Week createWeek()
This method initializes week
-
setStartDate
public void setStartDate(java.util.Date startDate)
Sets the start date for this MonthCalendar.The date is set to the first day of the specified month and the time part of the Date object is set to midnight before storing. Calling
getStartDate()will return this mutilated version instead of the original.- Specified by:
setStartDatein interfaceIEventEditor- Parameters:
startDate- The date representing what slice of time to visualize in the editor. null is not permitted. Passing null will result in undefined behavior.- See Also:
IEventEditor.setStartDate(java.util.Date)
-
getStartDate
public java.util.Date getStartDate()
Description copied from interface:IEventEditorReturn the current start date for this event editor. This is the date that was set in setStartDate.- Specified by:
getStartDatein interfaceIEventEditor- Returns:
- The start date, or
nullif no start date has been specified yet. - See Also:
IEventEditor.getStartDate()
-
refresh
public void refresh(java.util.Date date)
Description copied from interface:IEventEditorTells the IEventEditor to refresh its display for the specified date. If the specified date is not being displayed, the request will be ignored. If null is passed as the date, the entire display is refreshed.- Specified by:
refreshin interfaceIEventEditor- Parameters:
date- The date to refresh or null to refresh everything.- See Also:
IEventEditor.refresh(java.util.Date)
-
refresh
private void refresh(java.util.Date date, Day dayControl)
-
refresh
public void refresh()
Description copied from class:AbstractEventEditorTells the IEventEditor to refresh all days in its display.- Specified by:
refreshin interfaceIEventEditor- Specified by:
refreshin classAbstractEventEditor- See Also:
AbstractEventEditor.refresh()
-
setEventContentProvider
public void setEventContentProvider(EventContentProvider eventContentProvider)
Description copied from interface:IEventEditorSets the strategy pattern object that can set the properties of the event objects in order to display the data associated with the specified event.Note that having a separate event count provider and event content provider assumes that the implementer is single-threaded and that the count can't change between calling the count provider and the content provider.
- Specified by:
setEventContentProviderin interfaceIEventEditor- Parameters:
eventContentProvider- The eventContentProvider to set.- See Also:
IEventEditor.setEventContentProvider(org.eclipse.nebula.widgets.compositetable.timeeditor.EventContentProvider)
-
setEventCountProvider
public void setEventCountProvider(EventCountProvider eventCountProvider)
Description copied from interface:IEventEditorSet the strategy pattern object that can return how many events to display for specific periods of time.Note that having a separate event count provider and event content provider assumes that the implementer is single-threaded and that the count can't change between calling the count provider and the content provider.
- Specified by:
setEventCountProviderin interfaceIEventEditor- Parameters:
eventCountProvider- The eventCountProvider to set.
-
addItemDeleteHandler
public void addItemDeleteHandler(CalendarableItemEventHandler deleteHandler)
Description copied from interface:IEventEditorAdds the handler to the collection of handlers who will be notified when a CalendarableItem is deleted from the receiver, by sending it one of the messages defined in theCalendarableItemEventHandlerabstract class.itemDeletedis called when the CalendarableItem is deleted.- Specified by:
addItemDeleteHandlerin interfaceIEventEditor- See Also:
IEventEditor.addItemDeleteHandler(org.eclipse.nebula.widgets.compositetable.day.CalendarableItemEventHandler)
-
removeItemDeleteHandler
public void removeItemDeleteHandler(CalendarableItemEventHandler deleteHandler)
Description copied from interface:IEventEditorRemoves the handler from the collection of handlers who will be notified when a CalendarableItem is deleted from the receiver, by sending it one of the messages defined in theCalendarableItemEventHandlerabstract class.itemDeletedis called when the CalendarableItem is deleted.- Specified by:
removeItemDeleteHandlerin interfaceIEventEditor- See Also:
IEventEditor.removeItemDeleteHandler(org.eclipse.nebula.widgets.compositetable.day.CalendarableItemEventHandler)
-
addItemDisposeHandler
public void addItemDisposeHandler(CalendarableItemEventHandler itemDisposeHandler)
Description copied from interface:IEventEditorAdds the handler to the collection of handler who will be notified when a CalendarableItem's control is disposed, by sending it one of the messages defined in theCalendarableItemEventHandlerabstract class. This is normally used to remove any data bindings that may be attached to the (now-unused) CalendarableItem.itemDeletedis called when the CalendarableItem is deleted.- Specified by:
addItemDisposeHandlerin interfaceIEventEditor- See Also:
IEventEditor.addItemDisposeHandler(org.eclipse.nebula.widgets.compositetable.day.CalendarableItemEventHandler)
-
removeItemDisposeHandler
public void removeItemDisposeHandler(CalendarableItemEventHandler itemDisposeHandler)
Description copied from interface:IEventEditorRemoves the handler from the collection of handlers who will be notified when a CalendarableItem is disposed, by sending it one of the messages defined in theCalendarableItemEventHandlerabstract class. This is normally used to remove any data bindings that may be attached to the (now-unused) CalendarableItem.itemDeletedis called when the CalendarableItem is deleted.- Specified by:
removeItemDisposeHandlerin interfaceIEventEditor- See Also:
IEventEditor.removeItemDisposeHandler(org.eclipse.nebula.widgets.compositetable.day.CalendarableItemEventHandler)
-
addItemEditHandler
public void addItemEditHandler(CalendarableItemEventHandler handler)
Description copied from interface:IEventEditorAdds the handler to the collection of handlers who will be notified when a CalendarableItem is inserted in the receiver, by sending it one of the messages defined in theCalendarableItemInsertHandlerabstract class.itemInsertedis called when the CalendarableItem is inserted.- Specified by:
addItemEditHandlerin interfaceIEventEditor- Parameters:
handler- the handler which should be notified- See Also:
IEventEditor.addItemEditHandler(org.eclipse.nebula.widgets.compositetable.day.CalendarableItemEventHandler)
-
removeItemEditHandler
public void removeItemEditHandler(CalendarableItemEventHandler handler)
Description copied from interface:IEventEditorRemoves the handler from the collection of handlers who will be notified when a CalendarableItem is inserted into the receiver, by sending it one of the messages defined in theCalendarableItemInsertHandlerabstract class.itemInsertedis called when the CalendarableItem is inserted.- Specified by:
removeItemEditHandlerin interfaceIEventEditor- Parameters:
handler- the handler which should be notified- See Also:
IEventEditor.removeItemEditHandler(org.eclipse.nebula.widgets.compositetable.day.CalendarableItemEventHandler)
-
addSelectionChangeListener
public void addSelectionChangeListener(CalendarableSelectionChangeListener l)
Description copied from interface:IEventEditorAdds the listener to the collection of listeners who will be notified when the receiver's selection changes, by sending it one of the messages defined in theCalendarableSelectionChangeListenerinterface.selectionChangedis called when the selection changes.
-
removeSelectionChangeListener
public void removeSelectionChangeListener(CalendarableSelectionChangeListener l)
Description copied from interface:IEventEditorRemoves the listener from the collection of listeners who will be notified when the receiver's selection changes, by sending it one of the messages defined in theCalendarableSelectionChangeListenerinterface.selectionChangedis called when the selection changes.
-
fireDelete
public boolean fireDelete(CalendarableItem toDelete)
Description copied from interface:IEventEditorRequests that the event editor delete the specified CalendarableItem's data.- Specified by:
fireDeletein interfaceIEventEditor- Parameters:
toDelete- The CalendarableItem to delete.- Returns:
- true if successful; false otherwise.
- See Also:
IEventEditor.fireDelete(org.eclipse.nebula.widgets.compositetable.timeeditor.CalendarableItem)
-
setTimeBreakdown
public void setTimeBreakdown(int numberOfDays, int numberOfDivisionsInHour)Description copied from interface:IEventEditorMethod setTimeBreakdown. Call this method exactly once after constructing the control in order to set the number of day columns to display.This method may be executed exactly once. Executing more than once will result in undefined behavior.
This method is a hint. It may be ignored by specific implementations (ie: a month view).
- Specified by:
setTimeBreakdownin interfaceIEventEditor- Parameters:
numberOfDays- The number of days to display.numberOfDivisionsInHour- 1 == one line per hour; 2 == every 1/2 hour; 4 = every 1/4 hour; etc...- See Also:
IEventEditor.setTimeBreakdown(int, int)
-
getNumberOfDays
public int getNumberOfDays()
Description copied from interface:IEventEditorMethod getNumberOfDays. Returns the number of days being displayed in this IEventEditor.- Specified by:
getNumberOfDaysin interfaceIEventEditor- Returns:
- The number of days being displayed.
- See Also:
IEventEditor.getNumberOfDays()
-
getNumberOfDivisionsInHour
public int getNumberOfDivisionsInHour()
Description copied from interface:IEventEditorReturns the numberOfDivisionsInHour. For example, to have a new time slice every 1/4 hour, this value would be 4.- Specified by:
getNumberOfDivisionsInHourin interfaceIEventEditor- Returns:
- Returns the numberOfDivisionsInHour.
- See Also:
IEventEditor.getNumberOfDivisionsInHour()
-
getSelectedDay
public MonthCalendarSelectedDay getSelectedDay()
Method getSelectedDay. Returns the currently-selected day.- Returns:
- The current MonthCalendarSelection which represents the currently- selected day.
-
addFocusListener
public void addFocusListener(org.eclipse.swt.events.FocusListener listener)
Adds the listener to the collection of listeners who will be notified when the control gains or loses focus, by sending it one of the messages defined in theFocusListenerinterface.In addition, e.data in the FocusEvent is the current MonthCalendarSelectedDay.
- Overrides:
addFocusListenerin classorg.eclipse.swt.widgets.Control- Parameters:
listener- the listener which should be notified- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.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:
FocusListener,removeFocusListener(org.eclipse.swt.events.FocusListener),Control.addFocusListener(org.eclipse.swt.events.FocusListener)
-
removeFocusListener
public void removeFocusListener(org.eclipse.swt.events.FocusListener listener)
Removes the listener from the collection of listeners who will be notified when the control gains or loses focus.In addition, e.data in the FocusEvent is the current MonthCalendarSelectedDay.
- Overrides:
removeFocusListenerin classorg.eclipse.swt.widgets.Control- Parameters:
listener- the listener which should no longer be notified- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.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:
FocusListener,addFocusListener(org.eclipse.swt.events.FocusListener),Control.removeFocusListener(org.eclipse.swt.events.FocusListener)
-
addMouseListener
public void addMouseListener(org.eclipse.swt.events.MouseListener listener)
- Overrides:
addMouseListenerin classorg.eclipse.swt.widgets.Control- See Also:
Control.addMouseListener(org.eclipse.swt.events.MouseListener)
-
removeMouseListener
public void removeMouseListener(org.eclipse.swt.events.MouseListener listener)
- Overrides:
removeMouseListenerin classorg.eclipse.swt.widgets.Control- See Also:
Control.removeMouseListener(org.eclipse.swt.events.MouseListener)
-
addKeyListener
public void addKeyListener(org.eclipse.swt.events.KeyListener listener)
Adds the listener to the collection of listeners who will be notified when keys are pressed and released on the system keyboard, by sending it one of the messages defined in theKeyListenerinterface.In addition to the usual KeyListener contract, MonthCalendar will honor e.doit and will not perform its usual key processing if any KeyListener sets e.doit to false.
In addition to the usual KeyEvent fields, e.data is set to the current MonthCalendarSelection.
- Overrides:
addKeyListenerin classorg.eclipse.swt.widgets.Control- Parameters:
listener- the listener which should be notified- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.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:
Control.addKeyListener(org.eclipse.swt.events.KeyListener)
-
removeKeyListener
public void removeKeyListener(org.eclipse.swt.events.KeyListener listener)
Removes the listener from the collection of listeners who will be notified when keys are pressed and released on the system keyboard.- Overrides:
removeKeyListenerin classorg.eclipse.swt.widgets.Control- Parameters:
listener- the listener which should no longer be notified- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.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:
KeyListener,addKeyListener(org.eclipse.swt.events.KeyListener),Control.removeKeyListener(org.eclipse.swt.events.KeyListener)
-
setFocus
public boolean setFocus()
- Overrides:
setFocusin classorg.eclipse.swt.widgets.Composite- See Also:
Composite.setFocus()
-
select
public void select(java.util.Date newDate)
-
-