Class MonthCalendar
- All Implemented Interfaces:
IEventEditor
,org.eclipse.swt.graphics.Drawable
public class MonthCalendar extends AbstractEventEditor implements IEventEditor
-
Field Summary
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
Modifier and Type Method Description 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 theFocusListener
interface.void
addItemDeleteHandler(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 theCalendarableItemEventHandler
abstract class.void
addItemDisposeHandler(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 theCalendarableItemEventHandler
abstract class.void
addItemEditHandler(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 theCalendarableItemInsertHandler
abstract class.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 theKeyListener
interface.void
addMouseListener(org.eclipse.swt.events.MouseListener listener)
void
addSelectionChangeListener(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 theCalendarableSelectionChangeListener
interface.boolean
fireDelete(CalendarableItem toDelete)
Requests that the event editor delete the specified CalendarableItem's data.int
getNumberOfDays()
Method getNumberOfDays.int
getNumberOfDivisionsInHour()
Returns the numberOfDivisionsInHour.MonthCalendarSelectedDay
getSelectedDay()
Method getSelectedDay.java.util.Date
getStartDate()
Return the current start date for this event editor.void
refresh()
Tells the IEventEditor to refresh all days in its display.void
refresh(java.util.Date date)
Tells the IEventEditor to refresh its display for the specified date.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.void
removeItemDeleteHandler(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 theCalendarableItemEventHandler
abstract class.void
removeItemDisposeHandler(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 theCalendarableItemEventHandler
abstract class.void
removeItemEditHandler(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 theCalendarableItemInsertHandler
abstract class.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.void
removeMouseListener(org.eclipse.swt.events.MouseListener listener)
void
removeSelectionChangeListener(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 theCalendarableSelectionChangeListener
interface.void
select(java.util.Date newDate)
void
setEventContentProvider(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.void
setEventCountProvider(EventCountProvider eventCountProvider)
Set the strategy pattern object that can return how many events to display for specific periods of time.boolean
setFocus()
void
setStartDate(java.util.Date startDate)
Sets the start date for this MonthCalendar.void
setTimeBreakdown(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, toString
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, 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
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
-
Constructor Details
-
MonthCalendar
public MonthCalendar(org.eclipse.swt.widgets.Composite parent, int style)Constructor DayEditor. Constructs a calendar control that can display events on one or more days.- Parameters:
parent
-style
- The same style bits as @see Composite
-
-
Method Details
-
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:
setStartDate
in 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:IEventEditor
Return the current start date for this event editor. This is the date that was set in setStartDate.- Specified by:
getStartDate
in interfaceIEventEditor
- Returns:
- The start date, or
null
if no start date has been specified yet. - See Also:
IEventEditor.getStartDate()
-
refresh
public void refresh(java.util.Date date)Description copied from interface:IEventEditor
Tells 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:
refresh
in interfaceIEventEditor
- Parameters:
date
- The date to refresh or null to refresh everything.- See Also:
IEventEditor.refresh(java.util.Date)
-
refresh
public void refresh()Description copied from class:AbstractEventEditor
Tells the IEventEditor to refresh all days in its display.- Specified by:
refresh
in interfaceIEventEditor
- Specified by:
refresh
in classAbstractEventEditor
- See Also:
AbstractEventEditor.refresh()
-
setEventContentProvider
Description copied from interface:IEventEditor
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.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:
setEventContentProvider
in interfaceIEventEditor
- Parameters:
eventContentProvider
- The eventContentProvider to set.- See Also:
IEventEditor.setEventContentProvider(org.eclipse.nebula.widgets.compositetable.timeeditor.EventContentProvider)
-
setEventCountProvider
Description copied from interface:IEventEditor
Set 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:
setEventCountProvider
in interfaceIEventEditor
- Parameters:
eventCountProvider
- The eventCountProvider to set.
-
addItemDeleteHandler
Description copied from interface:IEventEditor
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 theCalendarableItemEventHandler
abstract class.itemDeleted
is called when the CalendarableItem is deleted.- Specified by:
addItemDeleteHandler
in interfaceIEventEditor
- See Also:
IEventEditor.addItemDeleteHandler(org.eclipse.nebula.widgets.compositetable.day.CalendarableItemEventHandler)
-
removeItemDeleteHandler
Description copied from interface:IEventEditor
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 theCalendarableItemEventHandler
abstract class.itemDeleted
is called when the CalendarableItem is deleted.- Specified by:
removeItemDeleteHandler
in interfaceIEventEditor
- See Also:
IEventEditor.removeItemDeleteHandler(org.eclipse.nebula.widgets.compositetable.day.CalendarableItemEventHandler)
-
addItemDisposeHandler
Description copied from interface:IEventEditor
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 theCalendarableItemEventHandler
abstract class. This is normally used to remove any data bindings that may be attached to the (now-unused) CalendarableItem.itemDeleted
is called when the CalendarableItem is deleted.- Specified by:
addItemDisposeHandler
in interfaceIEventEditor
- See Also:
IEventEditor.addItemDisposeHandler(org.eclipse.nebula.widgets.compositetable.day.CalendarableItemEventHandler)
-
removeItemDisposeHandler
Description copied from interface:IEventEditor
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 theCalendarableItemEventHandler
abstract class. This is normally used to remove any data bindings that may be attached to the (now-unused) CalendarableItem.itemDeleted
is called when the CalendarableItem is deleted.- Specified by:
removeItemDisposeHandler
in interfaceIEventEditor
- See Also:
IEventEditor.removeItemDisposeHandler(org.eclipse.nebula.widgets.compositetable.day.CalendarableItemEventHandler)
-
addItemEditHandler
Description copied from interface:IEventEditor
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 theCalendarableItemInsertHandler
abstract class.itemInserted
is called when the CalendarableItem is inserted.- Specified by:
addItemEditHandler
in interfaceIEventEditor
- Parameters:
handler
- the handler which should be notified- See Also:
IEventEditor.addItemEditHandler(org.eclipse.nebula.widgets.compositetable.day.CalendarableItemEventHandler)
-
removeItemEditHandler
Description copied from interface:IEventEditor
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 theCalendarableItemInsertHandler
abstract class.itemInserted
is called when the CalendarableItem is inserted.- Specified by:
removeItemEditHandler
in interfaceIEventEditor
- Parameters:
handler
- the handler which should be notified- See Also:
IEventEditor.removeItemEditHandler(org.eclipse.nebula.widgets.compositetable.day.CalendarableItemEventHandler)
-
addSelectionChangeListener
Description copied from interface:IEventEditor
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 theCalendarableSelectionChangeListener
interface.selectionChanged
is called when the selection changes. -
removeSelectionChangeListener
Description copied from interface:IEventEditor
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 theCalendarableSelectionChangeListener
interface.selectionChanged
is called when the selection changes. -
fireDelete
Description copied from interface:IEventEditor
Requests that the event editor delete the specified CalendarableItem's data.- Specified by:
fireDelete
in 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:IEventEditor
Method 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:
setTimeBreakdown
in 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:IEventEditor
Method getNumberOfDays. Returns the number of days being displayed in this IEventEditor.- Specified by:
getNumberOfDays
in interfaceIEventEditor
- Returns:
- The number of days being displayed.
- See Also:
IEventEditor.getNumberOfDays()
-
getNumberOfDivisionsInHour
public int getNumberOfDivisionsInHour()Description copied from interface:IEventEditor
Returns the numberOfDivisionsInHour. For example, to have a new time slice every 1/4 hour, this value would be 4.- Specified by:
getNumberOfDivisionsInHour
in interfaceIEventEditor
- Returns:
- Returns the numberOfDivisionsInHour.
- See Also:
IEventEditor.getNumberOfDivisionsInHour()
-
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 theFocusListener
interface.In addition, e.data in the FocusEvent is the current MonthCalendarSelectedDay.
- Overrides:
addFocusListener
in 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:
removeFocusListener
in 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:
addMouseListener
in 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:
removeMouseListener
in 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 theKeyListener
interface.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:
addKeyListener
in 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:
removeKeyListener
in 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:
setFocus
in classorg.eclipse.swt.widgets.Composite
- See Also:
Composite.setFocus()
-
select
public void select(java.util.Date newDate)
-