Class DayEditor
- 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.day.DayEditor
-
- All Implemented Interfaces:
IEventEditor,org.eclipse.swt.graphics.Drawable
public class DayEditor extends AbstractEventEditor implements IEventEditor
A DayEditor is an SWT control that can display events on a time line that can span one or more days. This class is not intended to be subclassed.- Since:
- 3.2
-
-
Field Summary
Fields Modifier and Type Field Description private org.eclipse.swt.graphics.Colorbackground(package private) java.util.Calendarcalendarprivate org.eclipse.swt.events.FocusListenercellFocusListenerprivate org.eclipse.swt.events.MouseListenercellMouseListenerprivate CompositeTablecompositeTableprotected TimeSlicedaysHeaderprivate java.util.List<CalendarableItemEventHandler>deleteHandlersprivate java.util.List<CalendarableItemEventHandler>editHandlersprivate booleanheaderDisabledprivate java.util.List<CalendarableItemEventHandler>itemDisposeHandlersprivate org.eclipse.swt.events.KeyListenerkeyListenerprivate java.util.ArrayList<org.eclipse.swt.events.KeyListener>keyListenersprivate org.eclipse.swt.widgets.Menumenuprivate CalendarableModelmodelprivate java.util.ArrayList<org.eclipse.swt.events.MouseListener>mouseListenersstatic intNO_HEADERNO_HEADER constant.private intnumberOfAllDayEventRowsprivate java.util.List<DayEditorCalendarableItemControl>recycledCalendarableEventControlsprivate java.lang.RunnablerefreshEventControlPositionsprivate booleanrefreshingprivate booleanselectCalendarableControlOnSetFocus(package private) org.eclipse.swt.events.MouseAdapterselectCompositeTableOnMouseDownAdapterprivate CalendarableItemselectedCalendarableprivate java.util.List<CalendarableSelectionChangeListener>selectionChangeListenersprivate booleanshowEventsWithPrecision-
Fields inherited from interface org.eclipse.nebula.widgets.compositetable.timeeditor.IEventEditor
DISPLAYED_HOURS
-
-
Constructor Summary
Constructors Constructor Description DayEditor(org.eclipse.swt.widgets.Composite parent, int style)Constructor DayEditor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddItemDeleteHandler(CalendarableItemEventHandler handler)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 handler)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 hand editing of calendarable events, by sending it one of the messages defined in theCalendarableItemInsertHandlerabstract class.voidaddKeyListener(org.eclipse.swt.events.KeyListener listener)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.protected org.eclipse.swt.graphics.Point[]computeColumns(int day, int numberOfColumns, org.eclipse.swt.widgets.Control[] gridRows)private java.util.DatecomputeDateTimeFromViewportCoordinates(org.eclipse.swt.graphics.Point viewportSelection, int visibleAllDayEventRows)private voidcomputeEventLayout(EventLayoutComputer dayModel, int dayOffset)private voidcomputeEventRowsForDate(java.util.Date date)private voidcomputeEventRowsForNewDays()private voidcomputeLayoutFor(java.util.Date date)private intcomputeNewTopRowBasedOnSelection(CalendarableItem newSelection)private intcomputeNumRowsInCollection(int numberOfDivisionsInHour)private intcomputeRowForCalendarable(CalendarableItem calendarable, int day)private intconvertDayRowToViewportCoordinates(int row)private intconvertViewportRowToDayRow(int row)private voidcreateCalendarableControl(CalendarableItem calendarable)private voidcreateCompositeTable(int numberOfDays, int numberOfDivisionsInHour)This method initializes compositeTableprivate intendRowDiff(CalendarableItem calendarable)private booleaneventRowIsVisible(int eventRow)private voidfillControlData(CalendarableItem calendarable, int clippingStyle)private intfindRowDiff(CalendarableItem calendarable, java.util.Calendar time, boolean subtractDiff)For finding the pixel difference between filling the entire row, and filling only partially.booleanfireDelete(CalendarableItem item)Requests that the event editor delete the specified CalendarableItem's data.private booleanfireDisposeItemStrategy(CalendarableItem item)booleanfireEdit(CalendarableItem toEdit)Fire the itemEdit event.private booleanfireEvents(CalendarableItem calendarableItem, java.util.List<CalendarableItemEventHandler> handlers)protected voidfireMouseDoubleClickEvent(org.eclipse.swt.events.MouseEvent e)protected voidfireMouseDownEvent(org.eclipse.swt.events.MouseEvent e)protected voidfireMouseUpEvent(org.eclipse.swt.events.MouseEvent e)private voidfireSelectionChangeEvent(CalendarableItem currentSelection, CalendarableItem newSelection)private voidfreeCalendarableControl(CalendarableItem calendarableItem)private voidfreeCEC(DayEditorCalendarableItemControl control)private voidfreeObsoleteCalendarableEventControls(java.util.List<CalendarableItem> removedCalendarables)protected CalendarableItemgetAllDayCalendarableAt(int day, int row)Find the all day event that is positioned at the specified day and row in viewport coordinatesprivate org.eclipse.swt.graphics.RectanglegetBoundsInDayEditorCoordinates(org.eclipse.swt.widgets.Control slot)private DayEditorCalendarableItemControlgetControl(CalendarableItem item)intgetDefaultStartHour()protected CalendarableItemgetFirstCalendarableAt(int day, int row)(non-API) Method getFirstCalendarableAt.intgetNumberOfDays()Method getNumberOfDays.intgetNumberOfDivisionsInHour()Returns the numberOfDivisionsInHour.DayEditorSelectiongetSelection()Method getSelection.java.util.DategetStartDate()Return the current start date for this event editor.private org.eclipse.swt.graphics.RectanglegetTimeSliceBounds(int day, int eventRow, org.eclipse.swt.widgets.Control[] gridRows)private voidlayoutAllDayEvent(int day, int allDayEventRow, CalendarableItem calendarable, org.eclipse.swt.widgets.Control[] gridRows)private voidlayoutEventControls()private voidlayoutEventControlsDeferred()private voidlayoutTimedEvent(int day, org.eclipse.swt.graphics.Point[] columnPositions, CalendarableItem calendarable, org.eclipse.swt.widgets.Control[] gridRows)private DayEditorCalendarableItemControlnewCEC()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.protected voidrefreshColumnHeaders(java.util.LinkedList<org.eclipse.swt.custom.CLabel> columns)(non-API) Method initializeColumnHeaders.private voidrefreshRow(int currentObjectOffset, TimeSlice timeSlice)voidremoveItemDeleteHandler(CalendarableItemEventHandler handler)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 handler)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 hand editing of calendarable events, by sending it one of the messages defined in theCalendarableItemInsertHandlerabstract class.voidremoveKeyListener(org.eclipse.swt.events.KeyListener listener)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.private voidselectCalenderableControl(CalendarableItem newSelection)voidsetBackground(org.eclipse.swt.graphics.Color color)voidsetDefaultStartHour(int defaultStartHour)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()voidsetMenu(org.eclipse.swt.widgets.Menu menu)private voidsetMenuOnCollection(java.util.List<DayEditorCalendarableItemControl> collection, org.eclipse.swt.widgets.Menu menu)voidsetSelection(CalendarableItem newSelection)Method selectCalendarable.private voidsetSelectionByDayAndRow(int day, int row, CalendarableItem aboutToSelect)voidsetStartDate(java.util.Date startDate)Set the start date for this event editor.voidsetTimeBreakdown(int numberOfDays, int numberOfDivisionsInHour)Method setTimeBreakdown.voidshowEventsWithPrecision(boolean option)private intstartRowDiff(CalendarableItem calendarable)private booleantimedEventIsVisible(int firstVisibleRow, int lastVisibleRow, int startRow, int endRow)private voidupdateVisibleRows()-
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, addFocusListener, 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, removeFocusListener, removeGestureListener, removeHelpListener, removeMenuDetectListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, 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
-
compositeTable
private CompositeTable compositeTable
-
model
private CalendarableModel model
-
recycledCalendarableEventControls
private java.util.List<DayEditorCalendarableItemControl> recycledCalendarableEventControls
-
daysHeader
protected TimeSlice daysHeader
-
headerDisabled
private final boolean headerDisabled
-
showEventsWithPrecision
private boolean showEventsWithPrecision
-
NO_HEADER
public static final int NO_HEADER
NO_HEADER constant. A style bit constant to indicate that no header should be displayed at the top of the editor window.- See Also:
- Constant Field Values
-
menu
private org.eclipse.swt.widgets.Menu menu
-
keyListeners
private java.util.ArrayList<org.eclipse.swt.events.KeyListener> keyListeners
-
keyListener
private org.eclipse.swt.events.KeyListener keyListener
-
mouseListeners
private java.util.ArrayList<org.eclipse.swt.events.MouseListener> mouseListeners
-
cellMouseListener
private org.eclipse.swt.events.MouseListener cellMouseListener
-
selectCalendarableControlOnSetFocus
private boolean selectCalendarableControlOnSetFocus
-
cellFocusListener
private org.eclipse.swt.events.FocusListener cellFocusListener
-
selectedCalendarable
private CalendarableItem selectedCalendarable
-
selectionChangeListeners
private java.util.List<CalendarableSelectionChangeListener> selectionChangeListeners
-
editHandlers
private java.util.List<CalendarableItemEventHandler> editHandlers
-
deleteHandlers
private java.util.List<CalendarableItemEventHandler> deleteHandlers
-
itemDisposeHandlers
private java.util.List<CalendarableItemEventHandler> itemDisposeHandlers
-
refreshing
private boolean refreshing
-
numberOfAllDayEventRows
private int numberOfAllDayEventRows
-
calendar
java.util.Calendar calendar
-
refreshEventControlPositions
private java.lang.Runnable refreshEventControlPositions
-
selectCompositeTableOnMouseDownAdapter
org.eclipse.swt.events.MouseAdapter selectCompositeTableOnMouseDownAdapter
-
background
private org.eclipse.swt.graphics.Color background
-
-
Method Detail
-
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)
-
createCompositeTable
private void createCompositeTable(int numberOfDays, int numberOfDivisionsInHour)This method initializes compositeTable- Parameters:
numberOfDays- The number of day columns to display
-
setMenu
public void setMenu(org.eclipse.swt.widgets.Menu menu)
- Overrides:
setMenuin classorg.eclipse.swt.widgets.Control- See Also:
Control.setMenu(org.eclipse.swt.widgets.Menu)
-
setMenuOnCollection
private void setMenuOnCollection(java.util.List<DayEditorCalendarableItemControl> collection, org.eclipse.swt.widgets.Menu menu)
-
addKeyListener
public void addKeyListener(org.eclipse.swt.events.KeyListener listener)
- Overrides:
addKeyListenerin classorg.eclipse.swt.widgets.Control- See Also:
Control.addKeyListener(org.eclipse.swt.events.KeyListener)
-
removeKeyListener
public void removeKeyListener(org.eclipse.swt.events.KeyListener listener)
- Overrides:
removeKeyListenerin classorg.eclipse.swt.widgets.Control- See Also:
Control.removeKeyListener(org.eclipse.swt.events.KeyListener)
-
addMouseListener
public void addMouseListener(org.eclipse.swt.events.MouseListener listener)
- Overrides:
addMouseListenerin classorg.eclipse.swt.widgets.Control
-
removeMouseListener
public void removeMouseListener(org.eclipse.swt.events.MouseListener listener)
- Overrides:
removeMouseListenerin classorg.eclipse.swt.widgets.Control
-
fireMouseDownEvent
protected void fireMouseDownEvent(org.eclipse.swt.events.MouseEvent e)
-
fireMouseUpEvent
protected void fireMouseUpEvent(org.eclipse.swt.events.MouseEvent e)
-
fireMouseDoubleClickEvent
protected void fireMouseDoubleClickEvent(org.eclipse.swt.events.MouseEvent e)
-
computeNewTopRowBasedOnSelection
private int computeNewTopRowBasedOnSelection(CalendarableItem newSelection)
-
setSelectionByDayAndRow
private void setSelectionByDayAndRow(int day, int row, CalendarableItem aboutToSelect)
-
getFirstCalendarableAt
protected CalendarableItem getFirstCalendarableAt(int day, int row)
(non-API) Method getFirstCalendarableAt. Finds the calendarable event at the specified day/row in DayRow coordinates. If no calendarable exists at the specified coordinates, does nothing.- Parameters:
day- The day offsetrow- The row offset in DayRow coordinates- Returns:
- the first Calendarable in the specified (day, row) or null if none.
-
getAllDayCalendarableAt
protected CalendarableItem getAllDayCalendarableAt(int day, int row)
Find the all day event that is positioned at the specified day and row in viewport coordinates- Parameters:
day-row-- Returns:
- The found Calendarable or null if none
-
setSelection
public void setSelection(CalendarableItem newSelection)
Method selectCalendarable. Selects the specified Calendarable event.- Parameters:
newSelection- The Calendarable to select.
-
selectCalenderableControl
private void selectCalenderableControl(CalendarableItem newSelection)
-
getSelection
public DayEditorSelection getSelection()
Method getSelection. Returns the selection. This is computed as follows:- If a CalendarableItem is currently selected, it is returned.
- If the selection rectangle is in an all-day event row, null is returned.
- Otherwise, the date/time corresponding to the selection rectangle is returned as a java.util.Date.
- Returns:
- the current DayEditorSelection
-
fireSelectionChangeEvent
private void fireSelectionChangeEvent(CalendarableItem currentSelection, CalendarableItem newSelection)
-
addSelectionChangeListener
public 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 theCalendarableSelectionChangeListenerinterface.selectionChangedis called when the selection changes.- Specified by:
addSelectionChangeListenerin interfaceIEventEditor- 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
- See Also:
CalendarableSelectionChangeListener,removeSelectionChangeListener(org.eclipse.nebula.widgets.compositetable.day.CalendarableSelectionChangeListener),SelectionChangeEvent
-
fireEvents
private boolean fireEvents(CalendarableItem calendarableItem, java.util.List<CalendarableItemEventHandler> handlers)
-
fireEdit
public boolean fireEdit(CalendarableItem toEdit)
Fire the itemEdit event.- Parameters:
toEdit- The CalendarableItem to edit.- Returns:
- true if the object represented by the CalendarableItem was changed; false otherwise.
-
addItemEditHandler
public void addItemEditHandler(CalendarableItemEventHandler handler)
Adds the handler to the collection of handlers who will hand editing of calendarable events, 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- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the handler is null
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- See Also:
CalendarableItemInsertHandler,AbstractEventEditor.removeItemInsertHandler(org.eclipse.nebula.widgets.compositetable.day.CalendarableItemEventHandler)
-
removeItemEditHandler
public void removeItemEditHandler(CalendarableItemEventHandler handler)
Removes the handler from the collection of handlers who will hand editing of calendarable events, 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- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the handler is null
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- See Also:
CalendarableItemInsertHandler,AbstractEventEditor.removeItemInsertHandler(org.eclipse.nebula.widgets.compositetable.day.CalendarableItemEventHandler)
-
fireDelete
public boolean fireDelete(CalendarableItem item)
Description copied from interface:IEventEditorRequests that the event editor delete the specified CalendarableItem's data.- Specified by:
fireDeletein interfaceIEventEditor- Parameters:
item- The CalendarableItem to delete.- Returns:
- true if successful; false otherwise.
- See Also:
IEventEditor.fireDelete(org.eclipse.nebula.widgets.compositetable.timeeditor.CalendarableItem)
-
addItemDeleteHandler
public void addItemDeleteHandler(CalendarableItemEventHandler handler)
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.itemDeletedis called when the CalendarableItem is deleted.- Specified by:
addItemDeleteHandlerin interfaceIEventEditor- Parameters:
handler- the handler which should be notified- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the handler is null
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- See Also:
CalendarableItemEventHandler,#removeDeleteItemHandler
-
removeItemDeleteHandler
public void removeItemDeleteHandler(CalendarableItemEventHandler handler)
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.itemDeletedis called when the CalendarableItem is deleted.- Specified by:
removeItemDeleteHandlerin interfaceIEventEditor- Parameters:
handler- the handler which should be notified- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the handler is null
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- See Also:
CalendarableItemEventHandler,#addDeleteItemHandler
-
fireDisposeItemStrategy
private boolean fireDisposeItemStrategy(CalendarableItem item)
-
addItemDisposeHandler
public void addItemDisposeHandler(CalendarableItemEventHandler handler)
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. 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- Parameters:
handler- the handler which should be notified- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the handler is null
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- See Also:
CalendarableItemEventHandler,#removeCalendarableItemDisposeHandler
-
removeItemDisposeHandler
public void removeItemDisposeHandler(CalendarableItemEventHandler handler)
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. 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- Parameters:
handler- the handler which should be notified- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the handler is null
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- See Also:
CalendarableItemEventHandler,#removeDeleteListener
-
removeSelectionChangeListener
public 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 theCalendarableSelectionChangeListenerinterface.selectionChangedis called when the selection changes.- Specified by:
removeSelectionChangeListenerin interfaceIEventEditor- 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
- See Also:
CalendarableSelectionChangeListener,addSelectionChangeListener(org.eclipse.nebula.widgets.compositetable.day.CalendarableSelectionChangeListener),SelectionChangeEvent
-
getDefaultStartHour
public int getDefaultStartHour()
- Returns:
- Returns the defaultStartHour.
-
setDefaultStartHour
public void setDefaultStartHour(int defaultStartHour)
- Parameters:
defaultStartHour- The defaultStartHour to set.
-
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.
-
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.
-
setStartDate
public void setStartDate(java.util.Date startDate)
Description copied from interface:IEventEditorSet the start date for this event editor. How this is interpreted depends on how time is being visualized.For example, a month editor would only pay attention to the month portion of the date. A multi-day editor would make the date passed be the first date edited in the set of days being visualized.
- 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)
-
computeLayoutFor
private void computeLayoutFor(java.util.Date date)
-
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()
-
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()
-
computeNumRowsInCollection
private int computeNumRowsInCollection(int numberOfDivisionsInHour)
-
convertViewportRowToDayRow
private int convertViewportRowToDayRow(int row)
-
convertDayRowToViewportCoordinates
private int convertDayRowToViewportCoordinates(int row)
-
computeDateTimeFromViewportCoordinates
private java.util.Date computeDateTimeFromViewportCoordinates(org.eclipse.swt.graphics.Point viewportSelection, int visibleAllDayEventRows)
-
computeRowForCalendarable
private int computeRowForCalendarable(CalendarableItem calendarable, int day)
- Parameters:
calendarable-day-- Returns:
- The row in DayRow coordinates
-
updateVisibleRows
private void updateVisibleRows()
-
refreshRow
private void refreshRow(int currentObjectOffset, TimeSlice timeSlice)
-
refreshColumnHeaders
protected void refreshColumnHeaders(java.util.LinkedList<org.eclipse.swt.custom.CLabel> columns)
(non-API) Method initializeColumnHeaders. Called internally when the column header text needs to be updated.- Parameters:
columns- A LinkedList of CLabels representing the column objects
-
freeObsoleteCalendarableEventControls
private void freeObsoleteCalendarableEventControls(java.util.List<CalendarableItem> removedCalendarables)
-
computeEventRowsForDate
private void computeEventRowsForDate(java.util.Date date)
-
computeEventRowsForNewDays
private void computeEventRowsForNewDays()
-
computeEventLayout
private void computeEventLayout(EventLayoutComputer dayModel, int dayOffset)
-
layoutEventControlsDeferred
private void layoutEventControlsDeferred()
-
layoutEventControls
private void layoutEventControls()
-
computeColumns
protected org.eclipse.swt.graphics.Point[] computeColumns(int day, int numberOfColumns, org.eclipse.swt.widgets.Control[] gridRows)
-
fillControlData
private void fillControlData(CalendarableItem calendarable, int clippingStyle)
-
getControl
private DayEditorCalendarableItemControl getControl(CalendarableItem item)
-
layoutAllDayEvent
private void layoutAllDayEvent(int day, int allDayEventRow, CalendarableItem calendarable, org.eclipse.swt.widgets.Control[] gridRows)
-
layoutTimedEvent
private void layoutTimedEvent(int day, org.eclipse.swt.graphics.Point[] columnPositions, CalendarableItem calendarable, org.eclipse.swt.widgets.Control[] gridRows)
-
startRowDiff
private int startRowDiff(CalendarableItem calendarable)
-
endRowDiff
private int endRowDiff(CalendarableItem calendarable)
-
findRowDiff
private int findRowDiff(CalendarableItem calendarable, java.util.Calendar time, boolean subtractDiff)
For finding the pixel difference between filling the entire row, and filling only partially. Used For rendering more accurate & precise event durations.- Parameters:
calendarable-time-subtractDiff- set to true to subtract rather than add- Returns:
-
eventRowIsVisible
private boolean eventRowIsVisible(int eventRow)
-
timedEventIsVisible
private boolean timedEventIsVisible(int firstVisibleRow, int lastVisibleRow, int startRow, int endRow)
-
createCalendarableControl
private void createCalendarableControl(CalendarableItem calendarable)
-
getTimeSliceBounds
private org.eclipse.swt.graphics.Rectangle getTimeSliceBounds(int day, int eventRow, org.eclipse.swt.widgets.Control[] gridRows)
-
freeCalendarableControl
private void freeCalendarableControl(CalendarableItem calendarableItem)
-
getBoundsInDayEditorCoordinates
private org.eclipse.swt.graphics.Rectangle getBoundsInDayEditorCoordinates(org.eclipse.swt.widgets.Control slot)
-
newCEC
private DayEditorCalendarableItemControl newCEC()
-
freeCEC
private void freeCEC(DayEditorCalendarableItemControl control)
-
setBackground
public void setBackground(org.eclipse.swt.graphics.Color color)
- Overrides:
setBackgroundin classorg.eclipse.swt.widgets.Control- See Also:
Control.setBackground(org.eclipse.swt.graphics.Color)
-
setFocus
public boolean setFocus()
- Overrides:
setFocusin classorg.eclipse.swt.widgets.Composite- See Also:
Composite.setFocus()
-
showEventsWithPrecision
public void showEventsWithPrecision(boolean option)
-
-