Class GanttComposite

  • All Implemented Interfaces:
    java.util.EventListener, IZoomHandler, org.eclipse.swt.events.KeyListener, org.eclipse.swt.events.MouseListener, org.eclipse.swt.events.MouseMoveListener, org.eclipse.swt.events.MouseTrackListener, org.eclipse.swt.graphics.Drawable, org.eclipse.swt.internal.SWTEventListener

    public final class GanttComposite
    extends org.eclipse.swt.widgets.Canvas
    implements org.eclipse.swt.events.MouseListener, org.eclipse.swt.events.MouseMoveListener, org.eclipse.swt.events.MouseTrackListener, org.eclipse.swt.events.KeyListener, IZoomHandler
    The GanttComposite is the workhorse of the GANTT chart. It contains a few public methods available for use, but most of the functionality is private.

    There is a serious amount of calculation done in this chart, it's about 80% calculation and 20% drawing. In fact, most of the drawing is delegated to other classes.

    A lot of settings method calls are set as class variables, but some are called straight off the settings object. The logic isn't that deep, it's mostly just the over-and-over used variables that get class members. Slow stuff is cached, such as the use of gc.stringExtent(), image rotation and so on. Anything that is slow _should_ be cached as it is a slowdown to the chart. A redraw should be as fast as possible and whenever possible should be specific to certain bounds instead of a full redraw.

    This class may not be subclassed.
    • Field Detail

      • _osType

        public static int _osType
      • _parentChart

        private final GanttChart _parentChart
      • _autoScrollDir

        private int _autoScrollDir
      • _showZoomHelper

        private boolean _showZoomHelper
      • _zoomLevelArea

        private org.eclipse.swt.graphics.Rectangle _zoomLevelArea
      • _zoomLevel

        private int _zoomLevel
      • _zoomLevelChanged

        private boolean _zoomLevelChanged
      • _forceSBUpdate

        private boolean _forceSBUpdate
      • _currentView

        private int _currentView
      • _threeDee

        private boolean _threeDee
      • _showNumDays

        private boolean _showNumDays
      • _showPlannedDates

        private boolean _showPlannedDates
      • _calStartOffset

        private final int _calStartOffset
      • _moveAreaInsets

        private final int _moveAreaInsets
      • _yearDayWidth

        private int _yearDayWidth
      • _monthDayWidth

        private int _monthDayWidth
      • _monthWeekWidth

        private int _monthWeekWidth
      • _minuteDayWidth

        private int _minuteDayWidth
      • _dayWidth

        private int _dayWidth
      • _weekWidth

        private int _weekWidth
      • _bottomMostY

        private int _bottomMostY
      • _lineTodayColor

        private org.eclipse.swt.graphics.Color _lineTodayColor
      • _linePeriodColor

        private org.eclipse.swt.graphics.Color _linePeriodColor
      • _lineColor

        private org.eclipse.swt.graphics.Color _lineColor
      • _lineWkDivColor

        private org.eclipse.swt.graphics.Color _lineWkDivColor
      • _textColor

        private org.eclipse.swt.graphics.Color _textColor
      • _satBGColorTop

        private org.eclipse.swt.graphics.Color _satBGColorTop
      • _satBGColorBottom

        private org.eclipse.swt.graphics.Color _satBGColorBottom
      • _weekdayTextColor

        private org.eclipse.swt.graphics.Color _weekdayTextColor
      • _satTextColor

        private org.eclipse.swt.graphics.Color _satTextColor
      • _sunTextColor

        private org.eclipse.swt.graphics.Color _sunTextColor
      • _sunBGColorTop

        private org.eclipse.swt.graphics.Color _sunBGColorTop
      • _sunBGColorBottom

        private org.eclipse.swt.graphics.Color _sunBGColorBottom
      • _holidayBGColorTop

        private org.eclipse.swt.graphics.Color _holidayBGColorTop
      • _holidayBGColorBottom

        private org.eclipse.swt.graphics.Color _holidayBGColorBottom
      • _wkBGColorTop

        private org.eclipse.swt.graphics.Color _wkBGColorTop
      • _wkBGColorBottom

        private org.eclipse.swt.graphics.Color _wkBGColorBottom
      • _txtHeaderBGColorTop

        private org.eclipse.swt.graphics.Color _txtHeaderBGColorTop
      • _txtHeaderBGColorBottom

        private org.eclipse.swt.graphics.Color _txtHeaderBGColorBottom
      • _timeHeaderBGColorTop

        private org.eclipse.swt.graphics.Color _timeHeaderBGColorTop
      • _timeHeaderBGColorBottom

        private org.eclipse.swt.graphics.Color _timeHeaderBGColorBottom
      • _phaseHeaderBGColorTop

        private org.eclipse.swt.graphics.Color _phaseHeaderBGColorTop
      • _phaseHeaderBGColorBottom

        private org.eclipse.swt.graphics.Color _phaseHeaderBGColorBottom
      • _arrowColor

        private org.eclipse.swt.graphics.Color _arrowColor
      • _reverseArrowColor

        private org.eclipse.swt.graphics.Color _reverseArrowColor
      • _todayBGColorTop

        private org.eclipse.swt.graphics.Color _todayBGColorTop
      • _todayBGColorBottom

        private org.eclipse.swt.graphics.Color _todayBGColorBottom
      • _selectedEvents

        private final java.util.List<java.lang.Object> _selectedEvents
      • _mainCalendar

        private java.util.Calendar _mainCalendar
      • _startCalendar

        private java.util.Calendar _startCalendar
      • _endCalendar

        private java.util.Calendar _endCalendar
      • _daysVisible

        private int _daysVisible
      • _hoursVisible

        private int _hoursVisible
      • _ganttEvents

        private final java.util.List<GanttEvent> _ganttEvents
      • _ganttConnections

        private final java.util.List<GanttConnection> _ganttConnections
      • _dayLetterStringExtentMap

        private final java.util.Map<java.lang.String,​org.eclipse.swt.graphics.Point> _dayLetterStringExtentMap
      • _dragging

        private boolean _dragging
      • _resizing

        private boolean _resizing
      • _dragStartLoc

        private org.eclipse.swt.graphics.Point _dragStartLoc
      • _freeDragging

        private boolean _freeDragging
      • _vDragDir

        private int _vDragDir
      • _lastX

        private int _lastX
      • _lastY

        private int _lastY
      • _cursor

        private int _cursor
      • _dragEvents

        private java.util.List<GanttEvent> _dragEvents
      • _lastLeft

        private boolean _lastLeft
      • _dragStartDate

        private java.util.Calendar _dragStartDate
      • _justStartedMoveOrResize

        private boolean _justStartedMoveOrResize
      • _initialHoursDragOffset

        private int _initialHoursDragOffset
      • _settings

        private final ISettings _settings
      • _mouseIsDown

        private boolean _mouseIsDown
      • _mouseDragStartLocation

        private org.eclipse.swt.graphics.Point _mouseDragStartLocation
      • _ganttGroups

        private final java.util.List<GanttGroup> _ganttGroups
      • _ganttSections

        private final java.util.List<GanttSection> _ganttSections
      • _rightClickMenu

        private org.eclipse.swt.widgets.Menu _rightClickMenu
      • _useAdvTooltips

        private boolean _useAdvTooltips
      • _useAlpha

        private boolean _useAlpha
      • _mainBounds

        private org.eclipse.swt.graphics.Rectangle _mainBounds
      • _visibleBounds

        private org.eclipse.swt.graphics.Rectangle _visibleBounds
      • _defaultLocale

        private final java.util.Locale _defaultLocale
      • _eventHeight

        private final int _eventHeight
      • _recalcScopes

        private boolean _recalcScopes
      • _recalcSecBounds

        private boolean _recalcSecBounds
      • _allEventsCombined

        private final java.util.Set<java.lang.Object> _allEventsCombined
      • _verticalLineLocations

        private final java.util.List<java.lang.Integer> _verticalLineLocations
      • _verticalWeekDividerLineLocations

        private final java.util.Set<java.lang.Integer> _verticalWeekDividerLineLocations
      • _hiddenLayers

        private final java.util.Set<java.lang.Integer> _hiddenLayers
      • _layerOpacityMap

        private final java.util.Map<java.lang.Integer,​java.lang.Integer> _layerOpacityMap
      • _eventSpacer

        private int _eventSpacer
      • _fixedRowHeight

        private int _fixedRowHeight
      • _drawVerticalLines

        private boolean _drawVerticalLines
      • _drawHorizontalLines

        private boolean _drawHorizontalLines
      • _lockedHeaderY

        private int _lockedHeaderY
      • _vScrollPos

        private int _vScrollPos
      • _origin

        private final org.eclipse.swt.graphics.Point _origin
      • _lastVScrollPos

        private int _lastVScrollPos
      • _vScrollBar

        private org.eclipse.swt.widgets.ScrollBar _vScrollBar
      • _selHeaderDates

        private java.util.List<java.util.Calendar> _selHeaderDates
      • _style

        private final int _style
      • _tracker

        private org.eclipse.swt.widgets.Tracker _tracker
      • _multiSelect

        private final boolean _multiSelect
      • _dDayCalendar

        private java.util.Calendar _dDayCalendar
      • _savingChartImage

        private boolean _savingChartImage
      • _ganttPhases

        private final java.util.List<GanttPhase> _ganttPhases
      • _stringWidthCache

        private final java.util.Map<java.lang.String,​org.eclipse.swt.graphics.Point> _stringWidthCache
      • _totVisEventCnt

        private int _totVisEventCnt
      • _drawToMinute

        private boolean _drawToMinute
      • holidays

        private Holiday[] holidays
      • sectionDetailMoreIcons

        private java.util.Map<GanttSection,​org.eclipse.swt.graphics.Rectangle> sectionDetailMoreIcons
    • Method Detail

      • startMidnightThread

        private void startMidnightThread()
      • initListeners

        private void initListeners()
      • vScroll

        public void vScroll()
      • vScroll

        private void vScroll​(org.eclipse.swt.widgets.Event event)
      • updateVerticalScrollBar

        void updateVerticalScrollBar​(boolean redraw)
      • handleResize

        private void handleResize​(boolean redraw)
      • initColors

        private void initColors()
      • getDate

        public java.util.Calendar getDate()
        Returns the current date (left-most date).
        Returns:
      • getRootCalendar

        public java.util.Calendar getRootCalendar()
        Returns the non-cloned root calendar of the chart. DO NOT modify this outside of the chart. This method is considered internal public and will be removed later.
        Returns:
        Calendar
      • getRootEndCalendar

        public java.util.Calendar getRootEndCalendar()
        Returns the non-cloned root end calendar of the chart. DO NOT modify this outside of the chart. This method is considered internal public and will be removed later.
        Returns:
        Calendar
      • getRootStartCalendar

        public java.util.Calendar getRootStartCalendar()
        Returns the non-cloned root start calendar of the chart. DO NOT modify this outside of the chart. This method is considered internal public and will be removed later.
        Returns:
        Calendar
      • hideLayer

        public void hideLayer​(int layer)
        Hides all layers of the given value and redraws the event area.
        Parameters:
        layer - Layer to hide.
      • showLayer

        public void showLayer​(int layer)
        Shows all layers of the given value and redraws the event area.
        Parameters:
        layer - Layer to show.
      • redraw

        public void redraw​(org.eclipse.swt.graphics.Rectangle rect)
      • showAllLayers

        public void showAllLayers()
        Shows all layers and redraws the event area.
      • hideAllLayers

        public void hideAllLayers()
        Hides all layers and redraws the event area.
      • setLayerOpacity

        public void setLayerOpacity​(int layer,
                                    int opacity)
        Sets the drawing opacity for a layer. Do note that this may reduce the drawing speed of the chart by a lot. The opacity range is from 0 to 255. Note that if alpha settings are turned on in settings, those values will still be used, so it may be wise to turn them off if you are doing layer blending.
        Parameters:
        layer - Layer to set opacity on
        opacity - Opacity between 0 and 255
      • getLayerOpacity

        public int getLayerOpacity​(int layer)
        Returns the layer opacity for a layer.
        Parameters:
        layer - Layer to get opacity for
        Returns:
        Layer opacity, -1 if layer has no opacity set.
      • setFixedRowHeightOverride

        public void setFixedRowHeightOverride​(int height)
        Setting a fixed row height override causes all rows to be the set height regardless of individual row heights set on items themselves and all settings.
        Parameters:
        height - Height to set. Set to zero to turn off.
      • setEventSpacerOverride

        public void setEventSpacerOverride​(int height)
        Setting a fixed event spacer overrides all individual event space settings on chart items and all settings.
        Parameters:
        height - Height to set. Set to zero to turn off.
      • setDrawHorizontalLinesOverride

        public void setDrawHorizontalLinesOverride​(boolean drawHorizontal)
        Setting this to true will force horizontal lines to draw despite what may be set in the settings.
        Parameters:
        drawHorizontal - true to draw horizontal lines.
      • setDrawVerticalLinesOverride

        public void setDrawVerticalLinesOverride​(boolean drawVertical)
        Setting this to true will force vertical lines to draw despite what may be set in the settings.
        Parameters:
        drawVertical - true to draw vertical lines.
      • setSelection

        public void setSelection​(GanttEvent event)
        Sets the selection to be a specific GanttEvent. This method will cause a redraw.
        Parameters:
        event - GanttEvent to select
      • setSelection

        public void setSelection​(java.util.List list)
        Sets the selection to be a set of GanttEvents. If the chart is set to SWT.SINGLE you should be using setSelection(GanttEvent) as this method will do nothing. This method will cause a redraw.
        Parameters:
        list - List of GanttEvents to select
      • addGroup

        public void addGroup​(GanttGroup group)
        Adds a GanttGroup to the chart.
        Parameters:
        group - Group to add
      • getGroups

        public java.util.List<GanttGroup> getGroups()
        Returns a list of all GanttGroups.
        Returns:
        List of GanttGroups
      • removeGroup

        public void removeGroup​(GanttGroup group)
        Removes a GanttGroup from the chart.
        Parameters:
        group - Group to remove
      • addSection

        public void addSection​(GanttSection section)
        Adds a GanttSection to the chart.
        Parameters:
        section - Section to add
      • addSection

        public void addSection​(GanttSection section,
                               int index)
        Adds a GanttSection to the chart.
        Parameters:
        section - Section to add
        index - the index to add the Section at
      • removeSection

        public void removeSection​(GanttSection section)
        Removes a GanttSection from the chart.
        Parameters:
        section - Section to remove
      • getGanttSections

        public java.util.List getGanttSections()
        Returns a list of all GanttSections.
        Returns:
        List of GanttSections.
      • showScrollDate

        void showScrollDate()
      • getTopEvent

        public GanttEvent getTopEvent()
        Returns the topmost visible event in the current view of the chart.
        Returns:
        GanttEvent or null
      • getBottomEvent

        public GanttEvent getBottomEvent()
        Returns the bottom most visible event in the current view of the chart.
        Returns:
        GanttEvent or null
      • killDialogs

        void killDialogs()
      • repaint

        private void repaint​(org.eclipse.swt.events.PaintEvent event)
      • drawChartOntoGC

        private void drawChartOntoGC​(org.eclipse.swt.graphics.GC gc,
                                     org.eclipse.swt.graphics.Rectangle boundsOverride)
      • setShowPlannedDates

        public void setShowPlannedDates​(boolean showPlanned)
        Flag whether to show planned dates or not. This will override any settings value and will cause a redraw.
        Parameters:
        showPlanned - true to show planned dates
      • isShowingPlannedDates

        public boolean isShowingPlannedDates()
        Returns whether planned date drawing is currently on or off.
        Returns:
        true if on
      • setShowDaysOnEvents

        public void setShowDaysOnEvents​(boolean showDates)
        Flag whether to show the number of days on events. This will override any settings value and will cause a redraw.
        Parameters:
        showDates -
      • isShowingDaysOnEvents

        public boolean isShowingDaysOnEvents()
        Returns whether event day number drawing is currently on or off.
        Returns:
        true if on
      • isShowingGanttSections

        public boolean isShowingGanttSections()
        Whether the chart has gantt sections or not
        Returns:
        true if has gantt sections
      • drawHeader

        private void drawHeader​(org.eclipse.swt.graphics.GC gc,
                                boolean calculateOnly)
        Draws the header but if calculateOnly is set it doesn't actually draw, it only calculates locations of things
      • showMenu

        private void showMenu​(int x,
                              int y,
                              GanttEvent event,
                              org.eclipse.swt.events.MouseEvent me)
      • getSelectedEvents

        public java.util.List<java.lang.Object> getSelectedEvents()
        Returns the a list of all currently selected events, or an emtpy list if none.
        Returns:
        GanttEvent or null
      • setTopItem

        public void setTopItem​(GanttEvent ge,
                               int yOffset,
                               int side)
        Sets the top visible item in the chart and scrolls to show it. Passing SWT.NONE prevents any horizontal alignment from occurring.
        Parameters:
        ge - Event to show
        yOffset - y offset modifier
        side - one of SWT.LEFT, SWT.CENTER, SWT.RIGHT, SWT.NONE
      • setTopItem

        public void setTopItem​(GanttEvent ge,
                               int side)
        Sets the top visible item in the chart and scrolls to show it. Passing SWT.NONE prevents any horizontal alignment from occurring.
        Parameters:
        ge - Event to show
        side - one of SWT.LEFT, SWT.CENTER, SWT.RIGHT, SWT.NONE
      • showEvent

        public void showEvent​(GanttEvent ge,
                              int side)
        Scrolls the chart to the selected item regardless if it is visible or not.
        Parameters:
        ge - GanttEvent to scroll to.
        side - one of SWT.LEFT, SWT.CENTER, SWT.RIGHT
      • vScrollToY

        private void vScrollToY​(int yPos,
                                boolean redraw)
      • getBounds

        public org.eclipse.swt.graphics.Rectangle getBounds()
        Overrides:
        getBounds in class org.eclipse.swt.widgets.Control
      • calculateSectionBounds

        private void calculateSectionBounds​(org.eclipse.swt.graphics.GC gc,
                                            org.eclipse.swt.graphics.Rectangle bounds)
      • getHeaderHeight

        public int getHeaderHeight()
      • drawFills

        private void drawFills​(org.eclipse.swt.graphics.GC gc,
                               org.eclipse.swt.graphics.Rectangle bounds,
                               GanttSection gs)
      • drawFills

        private void drawFills​(org.eclipse.swt.graphics.GC gc,
                               org.eclipse.swt.graphics.Rectangle bounds)
      • internalDrawFills

        private void internalDrawFills​(org.eclipse.swt.graphics.GC gc,
                                       org.eclipse.swt.graphics.Rectangle bounds,
                                       GanttSection gs)
      • getHoliday

        private Holiday getHoliday​(java.util.Calendar day)
      • drawZoomLevel

        private void drawZoomLevel​(org.eclipse.swt.graphics.GC gc)
      • drawSectionColumn

        private void drawSectionColumn​(org.eclipse.swt.graphics.GC gc,
                                       org.eclipse.swt.graphics.Rectangle bounds,
                                       boolean columnOnly,
                                       boolean forceUsageOfBounds,
                                       boolean drawCornerOnly,
                                       boolean force)
      • drawSectionDetails

        private void drawSectionDetails​(org.eclipse.swt.graphics.GC gc,
                                        int x,
                                        int y,
                                        GanttSection section)
      • drawHorizontalLines

        private void drawHorizontalLines​(org.eclipse.swt.graphics.GC gc,
                                         org.eclipse.swt.graphics.Rectangle bounds)
      • drawVerticalLines

        private void drawVerticalLines​(org.eclipse.swt.graphics.GC gc,
                                       org.eclipse.swt.graphics.Rectangle bounds,
                                       boolean applyVscroll)
      • drawYearBottomBoxes

        private void drawYearBottomBoxes​(org.eclipse.swt.graphics.GC gc,
                                         org.eclipse.swt.graphics.Rectangle bounds,
                                         boolean calculateOnly)
      • drawYearTopBoxes

        private void drawYearTopBoxes​(org.eclipse.swt.graphics.GC gc,
                                      org.eclipse.swt.graphics.Rectangle bounds)
      • drawMonthBottomBoxes

        private void drawMonthBottomBoxes​(org.eclipse.swt.graphics.GC gc,
                                          org.eclipse.swt.graphics.Rectangle bounds,
                                          boolean calculateOnly)
      • drawMonthTopBoxes

        private void drawMonthTopBoxes​(org.eclipse.swt.graphics.GC gc,
                                       org.eclipse.swt.graphics.Rectangle bounds)
      • drawWeekTopBoxes

        private void drawWeekTopBoxes​(org.eclipse.swt.graphics.GC gc,
                                      org.eclipse.swt.graphics.Rectangle bounds)
      • drawWeekBottomBoxes

        private void drawWeekBottomBoxes​(org.eclipse.swt.graphics.GC gc,
                                         org.eclipse.swt.graphics.Rectangle bounds,
                                         boolean calculateOnly)
      • drawDDayTopBoxes

        private void drawDDayTopBoxes​(org.eclipse.swt.graphics.GC gc,
                                      org.eclipse.swt.graphics.Rectangle bounds)
      • drawDDayBottomBoxes

        private void drawDDayBottomBoxes​(org.eclipse.swt.graphics.GC gc,
                                         org.eclipse.swt.graphics.Rectangle bounds,
                                         boolean calculateOnly)
      • drawHourTopBoxes

        private void drawHourTopBoxes​(org.eclipse.swt.graphics.GC gc,
                                      org.eclipse.swt.graphics.Rectangle bounds)
      • drawHourBottomBoxes

        private void drawHourBottomBoxes​(org.eclipse.swt.graphics.GC gc,
                                         org.eclipse.swt.graphics.Rectangle bounds,
                                         boolean calculateOnly)
      • drawMinuteTopBoxes

        private void drawMinuteTopBoxes​(org.eclipse.swt.graphics.GC gc,
                                        org.eclipse.swt.graphics.Rectangle bounds)
      • drawMinuteBottomBoxes

        private void drawMinuteBottomBoxes​(org.eclipse.swt.graphics.GC gc,
                                           org.eclipse.swt.graphics.Rectangle bounds,
                                           boolean calculateOnly)
      • drawGanttSpecialDateRanges

        private void drawGanttSpecialDateRanges​(org.eclipse.swt.graphics.GC gc,
                                                org.eclipse.swt.graphics.Rectangle bounds,
                                                GanttSection gs)
      • drawGanttPhases

        private void drawGanttPhases​(org.eclipse.swt.graphics.GC gc,
                                     org.eclipse.swt.graphics.Rectangle bounds,
                                     boolean header,
                                     GanttSection gs)
      • getStringToDisplay

        private java.lang.String getStringToDisplay​(org.eclipse.swt.graphics.GC gc,
                                                    org.eclipse.swt.graphics.Rectangle area,
                                                    java.lang.String text)
        Fetches a dot-concatenated string that will fit the given space. Newlines are not taken into account.
        Parameters:
        gc - GC
        area - Area to fit text in
        text - Text to fit in area
        Returns:
        String concatenated string with ellipsis at end
      • getDayBackgroundGradient

        private org.eclipse.swt.graphics.Color getDayBackgroundGradient​(int day,
                                                                        boolean top,
                                                                        GanttSection gs)
      • getHolidayBackgroundGradient

        private org.eclipse.swt.graphics.Color getHolidayBackgroundGradient​(boolean top,
                                                                            GanttSection gs)
      • internalGetDayBackgroundGradient

        private org.eclipse.swt.graphics.Color internalGetDayBackgroundGradient​(int day,
                                                                                boolean top,
                                                                                GanttSection gs)
      • getDayTextColor

        private org.eclipse.swt.graphics.Color getDayTextColor​(int day)
      • drawEvents

        private void drawEvents​(org.eclipse.swt.graphics.GC gc,
                                org.eclipse.swt.graphics.Rectangle bounds,
                                GanttSection gs)
      • drawEvents

        private void drawEvents​(org.eclipse.swt.graphics.GC gc,
                                org.eclipse.swt.graphics.Rectangle bounds)
      • internalDrawEvents

        private void internalDrawEvents​(org.eclipse.swt.graphics.GC gc,
                                        org.eclipse.swt.graphics.Rectangle bounds,
                                        GanttSection gs)
      • drawOneEvent

        private void drawOneEvent​(org.eclipse.swt.graphics.GC gc,
                                  GanttEvent ge,
                                  org.eclipse.swt.graphics.Rectangle boundsToUse)
      • updateEventVisibilities

        private void updateEventVisibilities​(org.eclipse.swt.graphics.Rectangle bounds)
      • calculateAllScopes

        private void calculateAllScopes​(org.eclipse.swt.graphics.Rectangle bounds,
                                        GanttSection gs)
      • getStringForEvent

        private java.lang.String getStringForEvent​(GanttEvent ge)
      • drawTopHorizontalLines

        private void drawTopHorizontalLines​(org.eclipse.swt.graphics.GC gc,
                                            org.eclipse.swt.graphics.Rectangle bounds)
      • addDependency

        public void addDependency​(GanttEvent source,
                                  GanttEvent target)
        Adds a connection between two GanttEvents. ge1 will connect to ge2.
        Parameters:
        source - Source event
        target - Target event
      • addDependency

        public void addDependency​(GanttEvent source,
                                  GanttEvent target,
                                  org.eclipse.swt.graphics.Color color)
        Adds a connection between two GanttEvents. Source will connect to Target.
        Parameters:
        source - Source event
        target - Target event
        Color - to use to draw connection. Set null to use default color from Settings.
      • isConnected

        public boolean isConnected​(GanttEvent ge)
        Returns true if the given event is connected to another.
        Parameters:
        ge - GanttEvent to check
        Returns:
        true if the GanttEvent is connected
      • isConnected

        public boolean isConnected​(GanttEvent source,
                                   GanttEvent target)
        Checks whether two events are connected to each other.
        Parameters:
        source - Source event
        target - Target event
        Returns:
        true if a connection exists
      • addConnection

        public void addConnection​(GanttEvent source,
                                  GanttEvent target)
        Same as addDependency().
        Parameters:
        source - Source event
        target - Target event
      • addConnection

        public void addConnection​(GanttEvent source,
                                  GanttEvent target,
                                  org.eclipse.swt.graphics.Color color)
        Same as addDependency().
        Parameters:
        source - Source event
        target - Target event
        Color - to use to draw connection. Set null to use defaults.
      • getFirstStub

        private org.eclipse.swt.graphics.Rectangle getFirstStub​(GanttConnection con)
      • drawConnections

        private void drawConnections​(org.eclipse.swt.graphics.GC gc)
      • drawBend

        private org.eclipse.swt.graphics.Point drawBend​(org.eclipse.swt.graphics.GC gc,
                                                        int style,
                                                        int x,
                                                        int y,
                                                        boolean rounded)
      • drawTodayLine

        private void drawTodayLine​(org.eclipse.swt.graphics.GC gc,
                                   org.eclipse.swt.graphics.Rectangle bounds,
                                   int x,
                                   int dayOfWeek,
                                   org.eclipse.swt.graphics.Color lineColor)
      • getDateString

        private java.lang.String getDateString​(java.util.Calendar cal,
                                               boolean top)
      • jumpToToday

        public void jumpToToday()
        Moves calendar to the current date/time.
      • jumpToToday

        public void jumpToToday​(int side)
        Moves calendar to the current date/time.
        Parameters:
        side - one of SWT.LEFT, SWT.CENTER, SWT.RIGHT
      • jumpToEarliestEvent

        public void jumpToEarliestEvent()
        Moves the calendar to the earliest event date.
      • jumpToLatestEvent

        public void jumpToLatestEvent()
        Moves the calendar to the latest event date.
      • jumpToEvent

        private void jumpToEvent​(boolean earliestEvent)
      • jumpToEvent

        public void jumpToEvent​(GanttEvent event,
                                boolean start,
                                int side)
        Moves the calendar to a particular event date horizontally. To move to an event completely, you may use #setTopItem(GanttEvent) or setTopItem(GanttEvent, int).
        Parameters:
        event - Event to move to
        start - true if to jump to the start date, false if to jump to the end date.
        side - one of SWT.LEFT, SWT.CENTER, SWT.RIGHT
      • getEvent

        private GanttEvent getEvent​(boolean earliest,
                                    boolean pixelComparison)
      • getEventDate

        private java.util.Date getEventDate​(boolean earliest)
      • setDate

        public void setDate​(java.util.Calendar date,
                            int side,
                            boolean clearMinutes)
        Sets the calendar date to the given date and shows it on the chart. You may provide the side that the date is to be visible on. This method does not apply any offset or other settings-related magic, but sets the date "purely". This method will only clear minutes, seconds and milliseconds if the clearMinutes variable is set to true.
        Parameters:
        date - Date
        side - one of SWT.LEFT, SWT.CENTER, SWT.RIGHT
        clearMinutes - true if to clear minutes, seconds, milliseconds
        See Also:
        setDate(Calendar, int)
      • setDate

        public void setDate​(java.util.Calendar date,
                            int side)
        Sets the calendar date to the given date and shows it on the chart. You may provide the side that the date is to be visible on. This method does not apply any offset or other settings-related magic, but sets the date "purely". This method will clear minutes, seconds and milliseconds and set them to zero. If you do not wish this, use setDate(Calendar, int, boolean)
        Parameters:
        date - Date
        side - one of SWT.LEFT, SWT.CENTER, SWT.RIGHT
      • internalSetDateAtX

        private void internalSetDateAtX​(int x,
                                        java.util.Calendar preZoomDate,
                                        boolean clearMinutes,
                                        boolean redraw,
                                        boolean zoomIn)
      • internalSetDate

        private void internalSetDate​(java.util.Calendar date,
                                     int side,
                                     boolean clearMinutes,
                                     boolean redraw)
      • setDate

        public void setDate​(java.util.Calendar date,
                            boolean applyOffset)
        Sets the new date of the calendar and redraws. This method will apply any offsets and other date magic that is set in the Settings.
        Parameters:
        date - Date to set
        applyOffset - whether to apply the settings offset
        See Also:
        setDate(Calendar), setDate(Calendar, int), setDate(Calendar, int, boolean)
      • setDate

        private void setDate​(java.util.Calendar date,
                             boolean applyOffset,
                             boolean redraw)
      • reindex

        public void reindex​(GanttEvent event,
                            int newIndex)
        Re-indexes an event to a new index.
        Parameters:
        event - GanttEvent to reindex
        newIndex - new index
      • reindex

        public void reindex​(GanttSection section,
                            int newIndex)
        Re-indexes a GanttSection to a new index.
        Parameters:
        section - GanttSection to reindex
        newIndex - new index
      • reindex

        public void reindex​(GanttGroup group,
                            int newIndex)
        Re-indexes a GanttGroup to a new index.
        Parameters:
        group - GanttGroup to reindex
        newIndex - new index
      • addPhase

        public void addPhase​(GanttPhase phase)
        Adds a GanttPhase to the chart.
        Parameters:
        phase - GanttPhase to add
      • removePhase

        public void removePhase​(GanttPhase phase)
        Removes a GanttPhase from the chart.
        Parameters:
        phase - GanttPhase to remove
      • clearSpecialDateRanges

        public void clearSpecialDateRanges()
        Removes all GanttSpecialDateRanges and redraws.
      • addPhase

        public void addPhase​(GanttPhase phase,
                             boolean redraw)
        Adds a GanttPhase to the chart with optional redraw call.
        Parameters:
        phase - GanttPhase to add
        redraw - true to redraw
      • removePhase

        public void removePhase​(GanttPhase phase,
                                boolean redraw)
        Removes a GanttPhase from the chart with optional redraw call.
        Parameters:
        phase - GanttPhase to remove
        redraw - true to redraw
      • clearPhases

        public void clearPhases()
        Removes all GanttPhases from the chart
      • addEvent

        public void addEvent​(GanttEvent event)
        Adds a GanttEvent to the chart.
        Parameters:
        event - GanttEvent
      • addEvent

        public void addEvent​(GanttEvent event,
                             int index)
        Adds an event at a given index.
        Parameters:
        event - GanttEvent
        index - index
      • addEvent

        public void addEvent​(GanttEvent event,
                             boolean redraw)
        Adds an GanttEvent to the chart and redraws.
        Parameters:
        event - GanttEvent
        redraw - true if to redraw chart
      • removeEvent

        public boolean removeEvent​(GanttEvent event)
        Removes a GanttEvent from the chart.
        Parameters:
        event - GanttEvent to remove
        Returns:
        true if removed
      • getGanttConnections

        public java.util.List getGanttConnections()
        Returns all currently connected events as a list of GanttConnection objects.
        Returns:
        List of connections.
      • eventDatesChanged

        void eventDatesChanged​(GanttEvent ge,
                               boolean redraw)
      • clearGanttEvents

        public void clearGanttEvents()
        Clears all GanttEvents events from the chart.
      • clearGanttGroups

        public void clearGanttGroups()
        Clears all GanttGroups from the chart.
      • clearGanttSections

        public void clearGanttSections()
        Clears all GanttSections from the chart.
      • clearChart

        public void clearChart()
        Clears the entire chart of everything (all types of events) and leaves the chart blank.
      • hasEvent

        public boolean hasEvent​(GanttEvent event)
        Checks whether the chart has a given event.
        Parameters:
        event - GanttEvent
        Returns:
        true if event exists
      • nextMonth

        public void nextMonth()
        Jumps to the next month.
      • prevMonth

        public void prevMonth()
        Jumps to the previous month.
      • nextWeek

        public void nextWeek()
        Jumps one week forward.
      • prevWeek

        public void prevWeek()
        Jumps one week backwards.
      • nextHour

        public void nextHour()
        Jumps to the next hour.
      • prevMinute

        public void prevMinute()
        Jumps to the previous minute.
      • nextMinute

        public void nextMinute()
        Jumps to the next hour.
      • prevHour

        public void prevHour()
        Jumps to the previous hour.
      • nextDay

        public void nextDay()
        Jumps one day forward.
      • prevDay

        public void prevDay()
        Jumps one day backwards.
      • setNoRecalc

        void setNoRecalc()
      • internalAddEvent

        private void internalAddEvent​(int index,
                                      GanttEvent event)
      • internalRemoveEvent

        private void internalRemoveEvent​(GanttEvent event)
      • internalAddGroup

        private void internalAddGroup​(int index,
                                      GanttGroup group)
      • internalRemoveGroup

        private void internalRemoveGroup​(GanttGroup group)
      • internalAddSection

        private void internalAddSection​(int index,
                                        GanttSection section)
      • internalRemoveSection

        private void internalRemoveSection​(GanttSection section)
      • eventNumbersChanged

        private void eventNumbersChanged()
      • moveXBounds

        void moveXBounds​(boolean positive)
      • moveYBounds

        private void moveYBounds​(int move)
      • refresh

        public void refresh()
        Redraws the calendar should some event not do it automatically.
      • redrawEventsArea

        private void redrawEventsArea()
      • isEventVisible

        public boolean isEventVisible​(GanttEvent event,
                                      org.eclipse.swt.graphics.Rectangle bounds)
        Checks whether a certain event is visible in the current bounds.
        Parameters:
        event - GanttEvent
        bounds - Bounds
        Returns:
        true if event is visible
      • getEventVisibility

        private int getEventVisibility​(GanttEvent event,
                                       org.eclipse.swt.graphics.Rectangle bounds)
      • getStartingXFor

        private int getStartingXFor​(GanttEvent event)
      • getStartingXForEventDate

        public int getStartingXForEventDate​(java.util.Calendar date)
        Returns the starting x position for a given date in the current view.
        Parameters:
        date - Date
        Returns:
        x position, -1 should it for some reason not be found
      • getStartingXForEventHours

        private int getStartingXForEventHours​(GanttEvent event)
      • getStartingXForEventHours

        private int getStartingXForEventHours​(java.util.Calendar start)
      • getStartingXFor

        public int getStartingXFor​(java.util.Calendar date)
        Returns the starting x for a given date.
        Parameters:
        date - Calendar date
        Returns:
        x position or -1 if it for some reason should not be found
      • getXLengthForEventHours

        private int getXLengthForEventHours​(GanttEvent event)
      • getXLengthForEvent

        private int getXLengthForEvent​(GanttEvent event)
      • getDayWidth

        public int getDayWidth()
        Returns the width of one day in the current zoom level. Do note that "one day" refers to 1 tick mark, so it might not be one day in a smaller or larger zoom level.
        Returns:
        One tick mark width
      • isInside

        private boolean isInside​(int x,
                                 int y,
                                 org.eclipse.swt.graphics.Rectangle rect)
      • mouseDoubleClick

        public void mouseDoubleClick​(org.eclipse.swt.events.MouseEvent me)
        Specified by:
        mouseDoubleClick in interface org.eclipse.swt.events.MouseListener
      • killMouseState

        private void killMouseState()
      • getAllSelectedHeaderDates

        public java.util.List getAllSelectedHeaderDates()
        Returns a list of all selected header dates (Calendar).
        Returns:
        List of calendars or empty list if none
      • clearAllSelectedHeaders

        public void clearAllSelectedHeaders()
        Clears all selected headers and redraws the chart.
      • setSelectedHeaderDates

        public void setSelectedHeaderDates​(java.util.List dates)
        Sets a list of header dates that should be the selected dates. This list must be a list of Calendars.
        Parameters:
        dates - List of Calendar objects representing selected header dates.
      • doMultiSelect

        private void doMultiSelect​(org.eclipse.swt.graphics.Rectangle rect,
                                   org.eclipse.swt.events.MouseEvent me)
        Selects a region of events.
        Parameters:
        rect - Rectangle of region to select
        me -
      • mouseDown

        public void mouseDown​(org.eclipse.swt.events.MouseEvent me)
        Specified by:
        mouseDown in interface org.eclipse.swt.events.MouseListener
      • drawSelectionAroundEvent

        private void drawSelectionAroundEvent​(org.eclipse.swt.graphics.GC gc,
                                              GanttEvent ge,
                                              int xPos,
                                              int yPos,
                                              int eventWidth,
                                              org.eclipse.swt.graphics.Rectangle bounds)
      • mouseUp

        public void mouseUp​(org.eclipse.swt.events.MouseEvent event)
        Specified by:
        mouseUp in interface org.eclipse.swt.events.MouseListener
      • handlePostVerticalDragDrop

        private void handlePostVerticalDragDrop()
        This method deals with moving events around so that vertical gaps are filled where they left holes after a vertical drag/drop
      • getSectionForVerticalDND

        private GanttSection getSectionForVerticalDND​(GanttEvent event,
                                                      boolean accountForVerticalDragDirection)
        Returns a section that corresponds to where the given event is currently hovering over
        Parameters:
        event - Event to check
        accountForVerticalDragDirection - whether to account for if user is dragging up or down when returning section, if user is between two sections this may play a part
        Returns:
        Section it is over or null if none
      • getSectionAt

        public GanttSection getSectionAt​(org.eclipse.swt.events.MouseEvent me)
        Returns a section that corresponds to where the given MouseEvent is fired
        Parameters:
        event - MouseEvent to check
        Returns:
        Section it is over or null if none
      • getSurroundingVerticalEvents

        private java.util.List getSurroundingVerticalEvents​(GanttEvent event,
                                                            GanttSection section)
        Returns a list of all surrounding vertical events to a given event. If a GanttSection is given, only the events in that section will be used in calculating.
        Parameters:
        event - Event to get surrounding events for
        section - GanttSection optional (pass null for using all events)
        Returns:
        2-size array with entry 0 being the top event and entry 1 being the bottom event. Any or all can be null.
      • keyPressed

        public void keyPressed​(org.eclipse.swt.events.KeyEvent e)
        Specified by:
        keyPressed in interface org.eclipse.swt.events.KeyListener
      • keyReleased

        public void keyReleased​(org.eclipse.swt.events.KeyEvent e)
        Specified by:
        keyReleased in interface org.eclipse.swt.events.KeyListener
      • endEverything

        private void endEverything()
      • mouseMove

        public void mouseMove​(org.eclipse.swt.events.MouseEvent me)
        Specified by:
        mouseMove in interface org.eclipse.swt.events.MouseMoveListener
      • mouseMoveMinutes

        private void mouseMoveMinutes​(java.lang.String dateFormat,
                                      org.eclipse.swt.events.MouseEvent me)
      • getDaysVisible

        public int getDaysVisible()
      • getCurrentDDate

        private java.lang.String getCurrentDDate()
      • isInMoveArea

        private boolean isInMoveArea​(GanttEvent event,
                                     int x)
      • doAutoScroll

        private void doAutoScroll​(org.eclipse.swt.events.MouseEvent event)
        Deals with figuring out what direction we are auto-scrolling in, if any.
        Parameters:
        event - MouseEvent
      • doAutoScroll

        private void doAutoScroll​(int direction)
      • isChartReady

        boolean isChartReady()
      • endAutoScroll

        private void endAutoScroll()
      • getXForDate

        public int getXForDate​(java.util.Date date)
        Gets the X for a given date.
        Parameters:
        date - Date
        Returns:
        x position or -1 if date was not found
      • getXForDate

        public int getXForDate​(java.util.Calendar cal)
        Gets the x position where the given date starts in the current visible area.
        Parameters:
        cal - Calendar
        Returns:
        -1 if date was not found
      • calculateMinuteAdjustment

        private int calculateMinuteAdjustment​(java.util.Calendar date)
      • getDateAt

        public java.util.Calendar getDateAt​(int x)
        Gets the date for a given x position.
        Parameters:
        x - x location
        Returns:
        Calendar of date
      • isNoOverlap

        private boolean isNoOverlap​(java.util.Calendar dat1,
                                    java.util.Calendar dat2)
      • drawMarker

        public void drawMarker​(java.util.Date date)
        Draws a dotted vertical marker at the given date. It will get removed on repaint, so make sure it's drawn as often as needed.
        Parameters:
        date - Date to draw it at
      • handlePhaseMove

        private void handlePhaseMove​(org.eclipse.swt.events.MouseEvent me,
                                     GanttPhase phase,
                                     int type,
                                     boolean showToolTip)
      • calculateVerticalInsertLocations

        private void calculateVerticalInsertLocations()
        Calculates where a vertically DND'd event will end up if dropped
      • drawVerticalInsertMarkers

        private void drawVerticalInsertMarkers​(org.eclipse.swt.graphics.GC gc)
      • handleMove

        private void handleMove​(org.eclipse.swt.events.MouseEvent me,
                                GanttEvent event,
                                int type,
                                boolean showToolTip)
        Handles the actual moving of an event.
      • updateScopeXY

        private void updateScopeXY​(GanttEvent ge)
      • moveEvent

        private void moveEvent​(GanttEvent ge,
                               int diff,
                               int stateMask,
                               org.eclipse.swt.events.MouseEvent me,
                               int type)
      • mouseEnter

        public void mouseEnter​(org.eclipse.swt.events.MouseEvent event)
        Specified by:
        mouseEnter in interface org.eclipse.swt.events.MouseTrackListener
      • mouseExit

        public void mouseExit​(org.eclipse.swt.events.MouseEvent event)
        Specified by:
        mouseExit in interface org.eclipse.swt.events.MouseTrackListener
      • mouseHover

        public void mouseHover​(org.eclipse.swt.events.MouseEvent me)
        Specified by:
        mouseHover in interface org.eclipse.swt.events.MouseTrackListener
      • showTooltip

        private void showTooltip​(GanttEvent event,
                                 org.eclipse.swt.events.MouseEvent me)
      • fixTooltipString

        private java.lang.String fixTooltipString​(java.lang.String input,
                                                  java.lang.String name,
                                                  java.lang.String startDate,
                                                  java.lang.String endDate,
                                                  java.lang.String plannedStart,
                                                  java.lang.String plannedEnd,
                                                  long days,
                                                  long plannedDays,
                                                  int percentageComplete)
      • showTooltip

        private void showTooltip​(Holiday holiday,
                                 org.eclipse.swt.events.MouseEvent me)
      • getVisibleBounds

        public org.eclipse.swt.graphics.Rectangle getVisibleBounds()
        Returns a rectangle with the bounds of what is actually visible inside the chart.
        Returns:
        Rectangle
      • getCurrentView

        public int getCurrentView()
        Returns the current view.
        Returns:
        View
      • setView

        public void setView​(int view)
        Sets the current view.
        Parameters:
        view - View
      • getEvents

        public java.util.List getEvents()
        Returns all events.
        Returns:
        List of all events.
      • getImage

        public org.eclipse.swt.graphics.Image getImage()
        Returns the current visible area of the chart as an image
        Returns:
        Image of the chart
      • getVerticallyFullImage

        public org.eclipse.swt.graphics.Image getVerticallyFullImage()
        Returns the chart as an image with the visible horizontal area but showing all information in the chart vertically.
        Returns:
        Image of the chart
      • getFullImage

        public org.eclipse.swt.graphics.Image getFullImage()
        Returns the image that is the entire chart, regardless of what is currently visible. If chart contains no events, getImage() is called from within.

        Do note that if the chart is "huge", you may need to increase your heap size. If you're zoomed in that's also taken into account and you may need a massive heap to work with hours views as they are simply huge in a pixel-size sense.

        Returns:
        Image
      • getImage

        public org.eclipse.swt.graphics.Image getImage​(org.eclipse.swt.graphics.Rectangle bounds)
        Returns the chart as an image for the given bounds.
        Parameters:
        bounds - Rectangle bounds
        Returns:
        Image of chart
      • getEventsDependingOn

        private java.util.List<java.lang.Object> getEventsDependingOn​(GanttEvent ge)
      • recursiveGetEventsDependingOn

        private java.util.Set recursiveGetEventsDependingOn​(GanttEvent ge,
                                                            GanttMap gm,
                                                            java.util.Set ret)
      • updateZoomLevel

        private void updateZoomLevel()
      • heavyRedraw

        public void heavyRedraw()
        This will cause a full recaclulation of events and a lot of other things. Normally this is used internally when there are zoom changes and/or other events that cause the chart to need a full recalculation. It is NOT intended to be used outside of the chart, but is available as a workaround if there is a bug that you can't get around and you need to force a full update. See this method as a temporary solution if you need to use it.
      • forceFullUpdate

        void forceFullUpdate()
      • flagForceFullUpdate

        void flagForceFullUpdate()
      • updateHorizontalScrollbar

        void updateHorizontalScrollbar()
      • getLeftMostPixel

        int getLeftMostPixel()
      • getRightMostPixel

        int getRightMostPixel()
      • getPixel

        private int getPixel​(boolean left)
      • setZoomLevel

        public void setZoomLevel​(int level)
        Sets the zoom level. If the new level is zoomed in from the previous set zoom level a zoom in event will be reported, otherwise a zoom out.
        Parameters:
        level - Level to set
      • zoomIn

        public void zoomIn()
        Zooms in. If zooming is disabled, does nothing.
        Specified by:
        zoomIn in interface IZoomHandler
      • zoomIn

        public void zoomIn​(boolean fromMouseWheel,
                           org.eclipse.swt.graphics.Point mouseLoc)
        Specified by:
        zoomIn in interface IZoomHandler
      • zoomOut

        public void zoomOut()
        Zooms out. If zooming is disabled, does nothing.
        Specified by:
        zoomOut in interface IZoomHandler
      • zoomOut

        public void zoomOut​(boolean fromMouseWheel,
                            org.eclipse.swt.graphics.Point mouseLoc)
        Specified by:
        zoomOut in interface IZoomHandler
      • resetZoom

        public void resetZoom()
        Resets the zoom level to that set in the settings.
        Specified by:
        resetZoom in interface IZoomHandler
      • redraw

        public void redraw()
        Overrides:
        redraw in class org.eclipse.swt.widgets.Control
      • addGanttEventListener

        public void addGanttEventListener​(IGanttEventListener listener)
        Adds a listener that will be notified of Gantt events.
        Parameters:
        listener - Listener
      • removeGanttEventListener

        public void removeGanttEventListener​(IGanttEventListener listener)
        Removes a listener from being notified of Gantt events.
        Parameters:
        listener - Listener
      • isUseAdvancedTooltips

        private boolean isUseAdvancedTooltips()
      • setUseAdvancedTooltips

        public void setUseAdvancedTooltips​(boolean useAdvancedTooltips)
        Sets whether to use advanced tooltips or not. This method will override the settings implementation with the same name.
        Parameters:
        useAdvancedTooltips - true whether to use advanced tooltips.
      • getDDayCalendar

        public java.util.Calendar getDDayCalendar()
        Returns (a clone) of the D-Day calendar
        Returns:
        D-Day calendar
      • getTotalVisibileGanttEvents

        public int getTotalVisibileGanttEvents()
        Returns the number of visible events on in the current viewport
        Returns:
        number of visible events on in the current viewport
      • selectAll

        public void selectAll()
        Selects all events
      • deselectAll

        public void deselectAll()
        Clears all selected events
      • rotate

        static org.eclipse.swt.graphics.ImageData rotate​(org.eclipse.swt.graphics.ImageData srcData,
                                                         int direction)
      • flip

        static org.eclipse.swt.graphics.ImageData flip​(org.eclipse.swt.graphics.ImageData srcData,
                                                       boolean vertical)
      • hasGanttPhases

        boolean hasGanttPhases()
      • hasGanttSections

        boolean hasGanttSections()
      • hasSpecialDateRanges

        boolean hasSpecialDateRanges()
      • isDDayCalendar

        boolean isDDayCalendar()
      • getSettings

        public ISettings getSettings()
      • setEventFactory

        public void setEventFactory​(IEventFactory factory)
      • setMenuItemFactory

        public void setMenuItemFactory​(IMenuItemFactory factory)
      • setZoomHandler

        public void setZoomHandler​(IZoomHandler zoomHandler)
      • setHolidays

        public void setHolidays​(Holiday[] holidays)