Class TimeSlot

  • All Implemented Interfaces:
    org.eclipse.swt.graphics.Drawable

    public class TimeSlot
    extends org.eclipse.swt.widgets.Canvas
    Represents a particular range in time in a single day.
    Since:
    3.2
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean allDay  
      private org.eclipse.swt.graphics.Color CELL_BACKGROUND_LIGHT  
      private org.eclipse.swt.graphics.Color CELL_BACKGROUND_WHITE  
      private org.eclipse.swt.graphics.Color CELL_BORDER_EMPHASIZED  
      private org.eclipse.swt.graphics.Color CELL_BORDER_LIGHT  
      private org.eclipse.swt.events.DisposeListener disposeListener
      Make sure we remove our listeners...
      private static int FOCUS_LINE_WIDTH  
      private org.eclipse.swt.graphics.Color FOCUS_RUBBERBAND  
      private boolean focusControl  
      private org.eclipse.swt.events.FocusListener focusListener
      When we gain/lose focus, redraw ourselves appropriately
      private org.eclipse.swt.events.KeyListener keyListener  
      private org.eclipse.swt.events.MouseListener mouseListener  
      private org.eclipse.swt.events.PaintListener paintListener
      Paint the control.
      private org.eclipse.swt.graphics.Point preferredSize  
      private java.util.Date time  
      private org.eclipse.swt.graphics.Color TIME_BAR_COLOR  
      static int TIME_BAR_WIDTH
      Width of the bar between events
      private org.eclipse.swt.events.TraverseListener traverseListener
      Permit focus events via keyboard.
      private org.eclipse.swt.graphics.Color WHITE  
      • Fields inherited from class org.eclipse.swt.widgets.Composite

        embeddedHandle
      • Fields inherited from class org.eclipse.swt.widgets.Widget

        handle
    • Constructor Summary

      Constructors 
      Constructor Description
      TimeSlot​(org.eclipse.swt.widgets.Composite parent, int style)
      Constructor EmptyTablePlaceholder.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.eclipse.swt.graphics.Point computeSize​(int wHint, int hHint, boolean changed)  
      boolean isAllDay()  
      boolean isMinutesAfterHour​(int minute)  
      private org.eclipse.swt.graphics.RGB lighten​(org.eclipse.swt.graphics.RGB color, float amount)  
      private org.eclipse.swt.graphics.RGB saturate​(org.eclipse.swt.graphics.RGB color, float saturation)
      Sets the color's saturation to the specified value.
      void setAllDay​(boolean isAllDayEvent)  
      void setTime​(java.util.Date currentTime)  
      • Methods inherited from class org.eclipse.swt.widgets.Canvas

        drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
      • Methods inherited from class org.eclipse.swt.widgets.Composite

        changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, 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, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, 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, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
      • Methods inherited from class org.eclipse.swt.widgets.Widget

        addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
      • Methods inherited from class java.lang.Object

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

      • focusControl

        private boolean focusControl
      • WHITE

        private final org.eclipse.swt.graphics.Color WHITE
      • CELL_BACKGROUND_LIGHT

        private final org.eclipse.swt.graphics.Color CELL_BACKGROUND_LIGHT
      • CELL_BACKGROUND_WHITE

        private final org.eclipse.swt.graphics.Color CELL_BACKGROUND_WHITE
      • CELL_BORDER_EMPHASIZED

        private final org.eclipse.swt.graphics.Color CELL_BORDER_EMPHASIZED
      • CELL_BORDER_LIGHT

        private final org.eclipse.swt.graphics.Color CELL_BORDER_LIGHT
      • TIME_BAR_COLOR

        private final org.eclipse.swt.graphics.Color TIME_BAR_COLOR
      • FOCUS_RUBBERBAND

        private final org.eclipse.swt.graphics.Color FOCUS_RUBBERBAND
      • TIME_BAR_WIDTH

        public static final int TIME_BAR_WIDTH
        Width of the bar between events
        See Also:
        Constant Field Values
      • disposeListener

        private org.eclipse.swt.events.DisposeListener disposeListener
        Make sure we remove our listeners...
      • keyListener

        private org.eclipse.swt.events.KeyListener keyListener
      • preferredSize

        private org.eclipse.swt.graphics.Point preferredSize
      • paintListener

        private org.eclipse.swt.events.PaintListener paintListener
        Paint the control.
      • focusListener

        private org.eclipse.swt.events.FocusListener focusListener
        When we gain/lose focus, redraw ourselves appropriately
      • traverseListener

        private org.eclipse.swt.events.TraverseListener traverseListener
        Permit focus events via keyboard.
      • mouseListener

        private org.eclipse.swt.events.MouseListener mouseListener
      • allDay

        private boolean allDay
      • time

        private java.util.Date time
    • Constructor Detail

      • TimeSlot

        public TimeSlot​(org.eclipse.swt.widgets.Composite parent,
                        int style)
        Constructor EmptyTablePlaceholder. Construct an EmptyTablePlaceholder control.
        Parameters:
        parent - The parent control
        style - Style bits. These are the same as what Canvas accepts.
    • Method Detail

      • saturate

        private org.eclipse.swt.graphics.RGB saturate​(org.eclipse.swt.graphics.RGB color,
                                                      float saturation)
        Sets the color's saturation to the specified value.
        Parameters:
        color - The RGB of the color
        saturation - the new saturation (between 0 and 1)
        Returns:
        a Color that is saturated by the specified amount
      • lighten

        private org.eclipse.swt.graphics.RGB lighten​(org.eclipse.swt.graphics.RGB color,
                                                     float amount)
        Parameters:
        color - The RGB of the color
        amount - The amount to lighten as a percentage expresssed as a float between -1 and 1.
        Returns:
        The new RGB that is lightened by the specified amount
      • computeSize

        public org.eclipse.swt.graphics.Point computeSize​(int wHint,
                                                          int hHint,
                                                          boolean changed)
        Overrides:
        computeSize in class org.eclipse.swt.widgets.Control
      • isMinutesAfterHour

        public boolean isMinutesAfterHour​(int minute)
        Parameters:
        minute - The minute to check
        Returns:
        true if the time falls on the specified minute of the hour. false otherwise.
      • setAllDay

        public void setAllDay​(boolean isAllDayEvent)
        Parameters:
        isAllDayEvent -
      • isAllDay

        public boolean isAllDay()
        Returns:
        Returns the allDay.
      • setTime

        public void setTime​(java.util.Date currentTime)
        Parameters:
        currentTime -