Class CalendarableItem


  • public class CalendarableItem
    extends ModelObject
    This class represents an event that can be displayed on a calendar.
    Since:
    3.2
    • Constructor Summary

      Constructors 
      Constructor Description
      CalendarableItem​(java.util.Date day)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getContinued()  
      ICalendarableItemControl getControl()
      (non-API) Returns the UI control for this CalendarableItem.
      java.lang.Object getData()
      Returns the application defined widget data associated with the receiver, or null if it has not been set.
      java.lang.Object getData​(java.lang.String key)
      Returns the application defined property of the receiver with the specified name, or null if it has not been set.
      java.util.Date getDate()  
      java.util.Date getEndTime()
      Returns the event's end time.
      org.eclipse.swt.graphics.Image getImage()
      Return the IEvent's image or null.
      org.eclipse.swt.graphics.Point getLowerRightPositionInDayRowCoordinates()
      (non-API)
      java.util.Date getStartTime()
      Gets the event's start time.
      java.lang.String getText()
      Returns the widget text.
      java.lang.String getToolTipText()
      Returns the receiver's tool tip text, or null if it has not been set.
      org.eclipse.swt.graphics.Point getUpperLeftPositionInDayRowCoordinates()
      (non-API)
      boolean isAllDayEvent()
      Returns if this Calenderable represents an all-day event.
      void setAllDayEvent​(boolean allDayEvent)
      Sets if this Calenderable represents an all-day event.
      void setContinued​(int continued)
      Sets the "To be continued..." bitmask indicating that this event is continued on the next or previous days respectively.
      void setControl​(ICalendarableItemControl control)
      (non-API) Set the UI control for this CalendarableItem.
      void setData​(java.lang.Object data)
      Sets the application defined widget data associated with the receiver to be the argument.
      void setData​(java.lang.String key, java.lang.Object data)
      Sets the application defined property of the receiver with the specified name to the given value.
      void setDate​(java.util.Date date)  
      private java.util.Date setDateComponentOf​(java.util.Date source, java.util.Date into)  
      void setEndTime​(java.util.Date endTime)
      Sets the event's end time.
      void setImage​(org.eclipse.swt.graphics.Image image)
      Set the IEvent's Image.
      void setLowerRightPositionInDayRowCoordinates​(org.eclipse.swt.graphics.Point lowerRightPositionInDayRowCoordinates)
      (non-API) Sets the lower right position of the bounding box.
      void setStartTime​(java.util.Date startTime)
      Sets the event's start time.
      void setText​(java.lang.String string)
      Sets the contents of the receiver to the given string.
      private java.util.Date setTimeComponentOf​(java.util.Date source, java.util.Date into)  
      void setToolTipText​(java.lang.String string)
      Sets the receiver's tool tip text to the argument, which may be null indicating that no tool tip text should be shown.
      void setUpperLeftPositionInDayRowCoordinates​(org.eclipse.swt.graphics.Point upperLeftPositionInDayRowCoordinates)
      (non-API) Sets the upper left position of the bounding box and initializes the lower right position to be the same as the upper left if the lower right has not yet been set.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PROP_TOOL_TIP_TEXT

        public static final java.lang.String PROP_TOOL_TIP_TEXT
        A constant representing the name of the toolTipText property.
        See Also:
        Constant Field Values
      • PROP_DATA

        public static final java.lang.String PROP_DATA
        A constant representing the name of the data property.
        See Also:
        Constant Field Values
      • PROP_TEXT

        public static final java.lang.String PROP_TEXT
        A constant representing the name of the text property.
        See Also:
        Constant Field Values
      • PROP_IMAGE

        public static final java.lang.String PROP_IMAGE
        A constant representing the name of the image property.
        See Also:
        Constant Field Values
      • PROP_END_TIME

        public static final java.lang.String PROP_END_TIME
        A constant representing the name of the endTime property.
        See Also:
        Constant Field Values
      • PROP_START_TIME

        public static final java.lang.String PROP_START_TIME
        A constant representing the name of the startTime property.
        See Also:
        Constant Field Values
      • PROP_ALL_DAY_EVENT

        public static final java.lang.String PROP_ALL_DAY_EVENT
        A constant representing the name of the allDayEvent property.
        See Also:
        Constant Field Values
      • PROP_CONTINUED

        public static final java.lang.String PROP_CONTINUED
        A constant representing the name of the continued property.
        See Also:
        Constant Field Values
      • comparator

        public static final java.util.Comparator comparator
        A comparator for CalendarableItem objects
      • allDayEvent

        private boolean allDayEvent
      • startTime

        private java.util.Date startTime
      • endTime

        private java.util.Date endTime
      • image

        private org.eclipse.swt.graphics.Image image
      • text

        private java.lang.String text
      • toolTipText

        private java.lang.String toolTipText
      • data

        private java.lang.Object data
      • dataMap

        private java.util.Map dataMap
      • upperLeftPositionInDayRowCoordinates

        private org.eclipse.swt.graphics.Point upperLeftPositionInDayRowCoordinates
      • lowerRightPositionInDayRowCoordinates

        private org.eclipse.swt.graphics.Point lowerRightPositionInDayRowCoordinates
      • continued

        private int continued
      • BINDING_KEY

        public static final java.lang.String BINDING_KEY
        (Non-API)
        See Also:
        Constant Field Values
    • Constructor Detail

      • CalendarableItem

        public CalendarableItem​(java.util.Date day)
    • Method Detail

      • isAllDayEvent

        public boolean isAllDayEvent()
        Returns if this Calenderable represents an all-day event.
        Returns:
        true if this is an all-day event; false otherwise.
      • setAllDayEvent

        public void setAllDayEvent​(boolean allDayEvent)
        Sets if this Calenderable represents an all-day event.
        Parameters:
        allDayEvent - true if this is an all-day event; false otherwise.
      • getDate

        public java.util.Date getDate()
        Returns:
        Returns the date on which the event falls.
      • setDate

        public void setDate​(java.util.Date date)
        Parameters:
        date - Sets the date on which the event falls. Ignores the time component of the date that is passed in.
      • setDateComponentOf

        private java.util.Date setDateComponentOf​(java.util.Date source,
                                                  java.util.Date into)
        Parameters:
        source -
        into -
      • setTimeComponentOf

        private java.util.Date setTimeComponentOf​(java.util.Date source,
                                                  java.util.Date into)
        Parameters:
        source -
        into -
      • getStartTime

        public java.util.Date getStartTime()
        Gets the event's start time. This value is ignored if this is an all-day event.
        Returns:
        the start time for the event.
      • setStartTime

        public void setStartTime​(java.util.Date startTime)
        Sets the event's start time. This value is ignored if this is an all-day event.
        Parameters:
        startTime - the event's start time.
      • getEndTime

        public java.util.Date getEndTime()
        Returns the event's end time. This value is ignored if this is an all-day event.
        Returns:
        the event's end time. This value is ignored if this is an all-day event.
      • setEndTime

        public void setEndTime​(java.util.Date endTime)
        Sets the event's end time. This value is ignored if this is an all-day event.
        Parameters:
        endTime - the event's end time. This value is ignored if this is an all-day event.
      • getImage

        public org.eclipse.swt.graphics.Image getImage()
        Return the IEvent's image or null.
        Returns:
        the image of the label or null
      • setImage

        public void setImage​(org.eclipse.swt.graphics.Image image)
        Set the IEvent's Image. The value null clears it.
        Parameters:
        image - the image to be displayed in the label or null
        Throws:
        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
      • getText

        public java.lang.String getText()
        Returns the widget text.

        The text for a text widget is the characters in the widget, or an empty string if this has never been set.

        Returns:
        the widget text
        Throws:
        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
      • setText

        public void setText​(java.lang.String string)
        Sets the contents of the receiver to the given string. If the receiver has style SINGLE and the argument contains multiple lines of text, the result of this operation is undefined and may vary from platform to platform.
        Parameters:
        string - the new text
        Throws:
        java.lang.IllegalArgumentException -
        • ERROR_NULL_ARGUMENT - if the string 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
      • getToolTipText

        public java.lang.String getToolTipText()
        Returns the receiver's tool tip text, or null if it has not been set.
        Returns:
        the receiver's tool tip text
        Throws:
        org.eclipse.swt.SWTException -
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • setToolTipText

        public void setToolTipText​(java.lang.String string)
        Sets the receiver's tool tip text to the argument, which may be null indicating that no tool tip text should be shown.
        Parameters:
        string - the new tool tip text (or null)
        Throws:
        org.eclipse.swt.SWTException -
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • getData

        public java.lang.Object getData()
        Returns the application defined widget data associated with the receiver, or null if it has not been set. The widget data is a single, unnamed field that is stored with every widget.

        Applications may put arbitrary objects in this field. If the object stored in the widget data needs to be notified when the widget is disposed of, it is the application's responsibility to hook the Dispose event on the widget and do so.

        Returns:
        the widget data
        See Also:
        setData(Object)
      • setData

        public void setData​(java.lang.Object data)
        Sets the application defined widget data associated with the receiver to be the argument. The widget data is a single, unnamed field that is stored with every widget.

        Applications may put arbitrary objects in this field. If the object stored in the widget data needs to be notified when the widget is disposed of, it is the application's responsibility to hook the Dispose event on the widget and do so.

        Parameters:
        data - the widget data
        See Also:
        getData()
      • setData

        public void setData​(java.lang.String key,
                            java.lang.Object data)
        Sets the application defined property of the receiver with the specified name to the given value.

        Applications may associate arbitrary objects with the receiver in this fashion.

        Parameters:
        key - the name of the property
        value - the new value for the property
        Throws:
        java.lang.IllegalArgumentException -
        • ERROR_NULL_ARGUMENT - if the key is null
        See Also:
        getData(String)
      • getData

        public java.lang.Object getData​(java.lang.String key)
        Returns the application defined property of the receiver with the specified name, or null if it has not been set.

        Applications may have associated arbitrary objects with the receiver in this fashion.

        Parameters:
        key - the name of the property
        Returns:
        the value of the property or null if it has not been set
        Throws:
        java.lang.IllegalArgumentException -
        • ERROR_NULL_ARGUMENT - if the key is null
        See Also:
        setData(String, Object)
      • getUpperLeftPositionInDayRowCoordinates

        public org.eclipse.swt.graphics.Point getUpperLeftPositionInDayRowCoordinates()
        (non-API)
        Returns:
        Returns the upperLeftPositionInDayRowCoordinates.
      • setUpperLeftPositionInDayRowCoordinates

        public void setUpperLeftPositionInDayRowCoordinates​(org.eclipse.swt.graphics.Point upperLeftPositionInDayRowCoordinates)
        (non-API) Sets the upper left position of the bounding box and initializes the lower right position to be the same as the upper left if the lower right has not yet been set. If the lower right has been set, it is left as it is.
        Parameters:
        upperLeftPositionInDayRowCoordinates - The upperLeftPositionInDayRowCoordinates to set.
      • getLowerRightPositionInDayRowCoordinates

        public org.eclipse.swt.graphics.Point getLowerRightPositionInDayRowCoordinates()
        (non-API)
        Returns:
        Returns the lowerRightPositionInDayRowCoordinates.
      • setLowerRightPositionInDayRowCoordinates

        public void setLowerRightPositionInDayRowCoordinates​(org.eclipse.swt.graphics.Point lowerRightPositionInDayRowCoordinates)
        (non-API) Sets the lower right position of the bounding box.
        Parameters:
        lowerRightPositionInDayRowCoordinates - The lowerRightPositionInDayRowCoordinates to set.
      • getControl

        public ICalendarableItemControl getControl()
        (non-API) Returns the UI control for this CalendarableItem.
        Returns:
        The UI control for this CalendarableItem or null if there is none.
      • setControl

        public void setControl​(ICalendarableItemControl control)
        (non-API) Set the UI control for this CalendarableItem.
        Parameters:
        control - The control to set.
      • setContinued

        public void setContinued​(int continued)
        Sets the "To be continued..." bitmask indicating that this event is continued on the next or previous days respectively.
        Parameters:
        continued - One or both of SWT.TOP or SWT.BOTTOM
      • getContinued

        public int getContinued()
        Returns:
        The continued bitmask; one or both of SWT.TOP or SWT.BOTTOM