Class DayEditor
- All Implemented Interfaces:
IEventEditor
,org.eclipse.swt.graphics.Drawable
public class DayEditor extends AbstractEventEditor implements IEventEditor
- Since:
- 3.2
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Calendar
calendar
protected TimeSlice
daysHeader
static int
NO_HEADER
NO_HEADER constant.(package private) org.eclipse.swt.events.MouseAdapter
selectCompositeTableOnMouseDownAdapter
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
Modifier and Type Method Description 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 theCalendarableItemEventHandler
abstract class.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 theCalendarableItemEventHandler
abstract class.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 theCalendarableItemInsertHandler
abstract class.void
addKeyListener(org.eclipse.swt.events.KeyListener listener)
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.protected org.eclipse.swt.graphics.Point[]
computeColumns(int day, int numberOfColumns, org.eclipse.swt.widgets.Control[] gridRows)
boolean
fireDelete(CalendarableItem item)
Requests that the event editor delete the specified CalendarableItem's data.boolean
fireEdit(CalendarableItem toEdit)
Fire the itemEdit event.protected void
fireMouseDoubleClickEvent(org.eclipse.swt.events.MouseEvent e)
protected void
fireMouseDownEvent(org.eclipse.swt.events.MouseEvent e)
protected void
fireMouseUpEvent(org.eclipse.swt.events.MouseEvent e)
protected CalendarableItem
getAllDayCalendarableAt(int day, int row)
Find the all day event that is positioned at the specified day and row in viewport coordinatesint
getDefaultStartHour()
protected CalendarableItem
getFirstCalendarableAt(int day, int row)
(non-API) Method getFirstCalendarableAt.int
getNumberOfDays()
Method getNumberOfDays.int
getNumberOfDivisionsInHour()
Returns the numberOfDivisionsInHour.DayEditorSelection
getSelection()
Method getSelection.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.protected void
refreshColumnHeaders(java.util.LinkedList<org.eclipse.swt.custom.CLabel> columns)
(non-API) Method initializeColumnHeaders.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 theCalendarableItemEventHandler
abstract class.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 theCalendarableItemEventHandler
abstract class.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 theCalendarableItemInsertHandler
abstract class.void
removeKeyListener(org.eclipse.swt.events.KeyListener listener)
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
setBackground(org.eclipse.swt.graphics.Color color)
void
setDefaultStartHour(int defaultStartHour)
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
setMenu(org.eclipse.swt.widgets.Menu menu)
void
setSelection(CalendarableItem newSelection)
Method selectCalendarable.void
setStartDate(java.util.Date startDate)
Set the start date for this event editor.void
setTimeBreakdown(int numberOfDays, int numberOfDivisionsInHour)
Method setTimeBreakdown.void
showEventsWithPrecision(boolean option)
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, 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, 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
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 Details
-
daysHeader
-
NO_HEADER
public static final int NO_HEADERNO_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
-
calendar
java.util.Calendar calendar -
selectCompositeTableOnMouseDownAdapter
org.eclipse.swt.events.MouseAdapter selectCompositeTableOnMouseDownAdapter
-
-
Constructor Details
-
DayEditor
public DayEditor(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
- DayEditor.NO_HEADER or SWT.NO_TRIM means not to display a header.
-
-
Method Details
-
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)
-
setMenu
public void setMenu(org.eclipse.swt.widgets.Menu menu)- Overrides:
setMenu
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.setMenu(org.eclipse.swt.widgets.Menu)
-
addKeyListener
public void addKeyListener(org.eclipse.swt.events.KeyListener listener)- Overrides:
addKeyListener
in 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:
removeKeyListener
in 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:
addMouseListener
in classorg.eclipse.swt.widgets.Control
-
removeMouseListener
public void removeMouseListener(org.eclipse.swt.events.MouseListener listener)- Overrides:
removeMouseListener
in 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) -
getFirstCalendarableAt
(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
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
Method selectCalendarable. Selects the specified Calendarable event.- Parameters:
newSelection
- The Calendarable to select.
-
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
-
addSelectionChangeListener
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.- Specified by:
addSelectionChangeListener
in 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
-
fireEdit
Fire the itemEdit event.- Parameters:
toEdit
- The CalendarableItem to edit.- Returns:
- true if the object represented by the CalendarableItem was changed; false otherwise.
-
addItemEditHandler
Adds the handler to the collection of handlers who will hand editing of calendarable events, 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- 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
Removes the handler from the collection of handlers who will hand editing of calendarable events, 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- 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
Description copied from interface:IEventEditor
Requests that the event editor delete the specified CalendarableItem's data.- Specified by:
fireDelete
in 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
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
- 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
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
- 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
-
addItemDisposeHandler
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
- 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
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
- 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
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.- Specified by:
removeSelectionChangeListener
in 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
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.
-
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.
-
setStartDate
public void setStartDate(java.util.Date startDate)Description copied from interface:IEventEditor
Set 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:
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()
-
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()
-
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
-
computeColumns
protected org.eclipse.swt.graphics.Point[] computeColumns(int day, int numberOfColumns, org.eclipse.swt.widgets.Control[] gridRows) -
setBackground
public void setBackground(org.eclipse.swt.graphics.Color color)- Overrides:
setBackground
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.setBackground(org.eclipse.swt.graphics.Color)
-
setFocus
public boolean setFocus()- Overrides:
setFocus
in classorg.eclipse.swt.widgets.Composite
- See Also:
Composite.setFocus()
-
showEventsWithPrecision
public void showEventsWithPrecision(boolean option)
-