Class GanttComposite
- java.lang.Object
-
- org.eclipse.swt.widgets.Widget
-
- org.eclipse.swt.widgets.Control
-
- org.eclipse.swt.widgets.Scrollable
-
- org.eclipse.swt.widgets.Composite
-
- org.eclipse.swt.widgets.Canvas
-
- org.eclipse.nebula.widgets.ganttchart.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 ofgc.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 Summary
Fields Modifier and Type Field Description private java.util.Set<java.lang.Object>
_allEventsCombined
private org.eclipse.swt.graphics.Color
_arrowColor
private int
_autoScrollDir
private int
_bottomMostY
private int
_calStartOffset
private IColorManager
_colorManager
private int
_currentView
private int
_cursor
private java.util.Map<java.lang.String,org.eclipse.swt.graphics.Point>
_dayLetterStringExtentMap
private int
_daysVisible
private int
_dayWidth
private java.util.Calendar
_dDayCalendar
private java.util.Locale
_defaultLocale
private java.util.List<GanttEvent>
_dragEvents
private boolean
_dragging
private GanttPhase
_dragPhase
private java.util.Calendar
_dragStartDate
private org.eclipse.swt.graphics.Point
_dragStartLoc
private boolean
_drawHorizontalLines
private boolean
_drawToMinute
private boolean
_drawVerticalLines
private java.util.Calendar
_endCalendar
private int
_eventHeight
private java.util.List<IGanttEventListener>
_eventListeners
private int
_eventSpacer
private int
_fixedRowHeight
private boolean
_forceSBUpdate
private boolean
_freeDragging
private java.util.List<GanttConnection>
_ganttConnections
private java.util.List<GanttEvent>
_ganttEvents
private java.util.List<GanttGroup>
_ganttGroups
private java.util.List<GanttPhase>
_ganttPhases
private java.util.List<GanttSection>
_ganttSections
private java.util.Set<java.lang.Integer>
_hiddenLayers
private org.eclipse.swt.graphics.Color
_holidayBGColorBottom
private org.eclipse.swt.graphics.Color
_holidayBGColorTop
private int
_hoursVisible
private HorizontalScrollbarHandler
_hScrollHandler
private int
_initialHoursDragOffset
private boolean
_justStartedMoveOrResize
private ILanguageManager
_languageManager
private boolean
_lastLeft
private int
_lastVScrollPos
private int
_lastX
private int
_lastY
private java.util.Map<java.lang.Integer,java.lang.Integer>
_layerOpacityMap
private org.eclipse.swt.graphics.Color
_lineColor
private org.eclipse.swt.graphics.Color
_linePeriodColor
private org.eclipse.swt.graphics.Color
_lineTodayColor
private org.eclipse.swt.graphics.Color
_lineWkDivColor
private int
_lockedHeaderY
private org.eclipse.swt.graphics.Rectangle
_mainBounds
private java.util.Calendar
_mainCalendar
private int
_minuteDayWidth
private int
_monthDayWidth
private int
_monthWeekWidth
private org.eclipse.swt.graphics.Point
_mouseDragStartLocation
private boolean
_mouseIsDown
private int
_moveAreaInsets
private boolean
_multiSelect
private org.eclipse.swt.graphics.Point
_origin
static int
_osType
private IPaintManager
_paintManager
private GanttChart
_parentChart
private org.eclipse.swt.graphics.Color
_phaseHeaderBGColorBottom
private org.eclipse.swt.graphics.Color
_phaseHeaderBGColorTop
private boolean
_recalcScopes
private boolean
_recalcSecBounds
private boolean
_resizing
private org.eclipse.swt.graphics.Color
_reverseArrowColor
private org.eclipse.swt.widgets.Menu
_rightClickMenu
private org.eclipse.swt.graphics.Color
_satBGColorBottom
private org.eclipse.swt.graphics.Color
_satBGColorTop
private org.eclipse.swt.graphics.Color
_satTextColor
private boolean
_savingChartImage
private java.util.List<java.lang.Object>
_selectedEvents
private java.util.List<java.util.Calendar>
_selHeaderDates
private ISettings
_settings
private boolean
_showNumDays
private boolean
_showPlannedDates
private boolean
_showZoomHelper
private java.util.List<GanttSpecialDateRange>
_specDateRanges
private java.util.Calendar
_startCalendar
private java.util.Map<java.lang.String,org.eclipse.swt.graphics.Point>
_stringWidthCache
private int
_style
private org.eclipse.swt.graphics.Color
_sunBGColorBottom
private org.eclipse.swt.graphics.Color
_sunBGColorTop
private org.eclipse.swt.graphics.Color
_sunTextColor
private org.eclipse.swt.graphics.Color
_textColor
private boolean
_threeDee
private org.eclipse.swt.graphics.Color
_timeHeaderBGColorBottom
private org.eclipse.swt.graphics.Color
_timeHeaderBGColorTop
private org.eclipse.swt.graphics.Color
_todayBGColorBottom
private org.eclipse.swt.graphics.Color
_todayBGColorTop
private int
_totVisEventCnt
private org.eclipse.swt.widgets.Tracker
_tracker
private org.eclipse.swt.graphics.Color
_txtHeaderBGColorBottom
private org.eclipse.swt.graphics.Color
_txtHeaderBGColorTop
private GanttUndoRedoManager
_undoRedoManager
private boolean
_useAdvTooltips
private boolean
_useAlpha
private VerticalDragDropManager
_vDNDManager
private int
_vDragDir
private java.util.List<java.lang.Integer>
_verticalLineLocations
private java.util.Set<java.lang.Integer>
_verticalWeekDividerLineLocations
private IViewPortHandler2
_viewPortHandler
private org.eclipse.swt.graphics.Rectangle
_visibleBounds
private org.eclipse.swt.widgets.ScrollBar
_vScrollBar
private int
_vScrollPos
private org.eclipse.swt.graphics.Color
_weekdayTextColor
private int
_weekWidth
private org.eclipse.swt.graphics.Color
_wkBGColorBottom
private org.eclipse.swt.graphics.Color
_wkBGColorTop
private int
_yearDayWidth
private int
_zoomLevel
private org.eclipse.swt.graphics.Rectangle
_zoomLevelArea
private boolean
_zoomLevelChanged
private IEventFactory
eventFactory
private IEventMenuItemFactory
eventMenuItemFactory
private Holiday[]
holidays
private IMenuItemFactory
menuItemFactory
private java.util.List<ISectionDetailMoreClickListener>
sectionDetailMoreClickListener
private java.util.Map<GanttSection,org.eclipse.swt.graphics.Rectangle>
sectionDetailMoreIcons
private IZoomHandler
zoomHandler
-
Constructor Summary
Constructors Constructor Description GanttComposite(GanttChart parent, int style, ISettings settings, IColorManager colorManager, IPaintManager paintManager, ILanguageManager languageManager)
GanttComposite(GanttChart parent, int style, ISettings settings, IColorManager colorManager, IPaintManager paintManager, ILanguageManager languageManager, Holiday[] holidays)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addConnection(GanttEvent source, GanttEvent target)
Same as addDependency().void
addConnection(GanttEvent source, GanttEvent target, org.eclipse.swt.graphics.Color color)
Same as addDependency().void
addDependency(GanttEvent source, GanttEvent target)
Adds a connection between two GanttEvents.void
addDependency(GanttEvent source, GanttEvent target, org.eclipse.swt.graphics.Color color)
Adds a connection between two GanttEvents.void
addEvent(GanttEvent event)
Adds a GanttEvent to the chart.void
addEvent(GanttEvent event, boolean redraw)
Adds an GanttEvent to the chart and redraws.void
addEvent(GanttEvent event, int index)
Adds an event at a given index.void
addGanttEventListener(IGanttEventListener listener)
Adds a listener that will be notified of Gantt events.void
addGroup(GanttGroup group)
Adds a GanttGroup to the chart.void
addPhase(GanttPhase phase)
Adds a GanttPhase to the chart.void
addPhase(GanttPhase phase, boolean redraw)
Adds a GanttPhase to the chart with optional redraw call.void
addSection(GanttSection section)
Adds a GanttSection to the chart.void
addSection(GanttSection section, int index)
Adds a GanttSection to the chart.void
addSelectionDetailClickListener(ISectionDetailMoreClickListener listener)
void
addSpecialDateRange(GanttSpecialDateRange range)
Adds aGanttSpecialDateRange
to the chart.void
addSpecialDateRange(GanttSpecialDateRange range, boolean redraw)
Adds aGanttSpecialDateRange
and optionally redraws.private void
calculateAllScopes(org.eclipse.swt.graphics.Rectangle bounds, GanttSection gs)
private int
calculateMinuteAdjustment(java.util.Calendar date)
private void
calculateSectionBounds(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds)
private void
calculateVerticalInsertLocations()
Calculates where a vertically DND'd event will end up if droppedvoid
clearAllSelectedHeaders()
Clears all selected headers and redraws the chart.void
clearChart()
Clears the entire chart of everything (all types of events) and leaves the chart blank.void
clearGanttEvents()
Clears all GanttEvents events from the chart.void
clearGanttGroups()
Clears all GanttGroups from the chart.void
clearGanttSections()
Clears all GanttSections from the chart.void
clearPhases()
Removes all GanttPhases from the chartvoid
clearSpecialDateRanges()
Removes allGanttSpecialDateRange
s and redraws.(package private) void
connectionAdded(GanttConnection conn)
(package private) void
connectionRemoved(GanttConnection conn)
void
deselectAll()
Clears all selected eventsprivate void
doAutoScroll(int direction)
private void
doAutoScroll(org.eclipse.swt.events.MouseEvent event)
Deals with figuring out what direction we are auto-scrolling in, if any.private void
doMultiSelect(org.eclipse.swt.graphics.Rectangle rect, org.eclipse.swt.events.MouseEvent me)
Selects a region of events.private org.eclipse.swt.graphics.Point
drawBend(org.eclipse.swt.graphics.GC gc, int style, int x, int y, boolean rounded)
private void
drawChartOntoGC(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle boundsOverride)
private void
drawConnections(org.eclipse.swt.graphics.GC gc)
private void
drawDDayBottomBoxes(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, boolean calculateOnly)
private void
drawDDayTopBoxes(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds)
private void
drawEvents(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds)
private void
drawEvents(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, GanttSection gs)
private void
drawFills(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds)
private void
drawFills(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, GanttSection gs)
private void
drawGanttPhases(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, boolean header, GanttSection gs)
private void
drawGanttSpecialDateRanges(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, GanttSection gs)
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 thingsprivate void
drawHorizontalLines(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds)
private void
drawHourBottomBoxes(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, boolean calculateOnly)
private void
drawHourTopBoxes(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds)
void
drawMarker(java.util.Date date)
Draws a dotted vertical marker at the given date.private void
drawMinuteBottomBoxes(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, boolean calculateOnly)
private void
drawMinuteTopBoxes(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds)
private void
drawMonthBottomBoxes(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, boolean calculateOnly)
private void
drawMonthTopBoxes(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds)
private void
drawOneEvent(org.eclipse.swt.graphics.GC gc, GanttEvent ge, org.eclipse.swt.graphics.Rectangle boundsToUse)
private void
drawSectionColumn(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, boolean columnOnly, boolean forceUsageOfBounds, boolean drawCornerOnly, boolean force)
private void
drawSectionDetails(org.eclipse.swt.graphics.GC gc, int x, int y, GanttSection section)
private void
drawSelectionAroundEvent(org.eclipse.swt.graphics.GC gc, GanttEvent ge, int xPos, int yPos, int eventWidth, org.eclipse.swt.graphics.Rectangle bounds)
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)
private void
drawTopHorizontalLines(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds)
private void
drawVerticalInsertMarkers(org.eclipse.swt.graphics.GC gc)
private void
drawVerticalLines(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, boolean applyVscroll)
private void
drawWeekBottomBoxes(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, boolean calculateOnly)
private void
drawWeekTopBoxes(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds)
private void
drawYearBottomBoxes(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, boolean calculateOnly)
private void
drawYearTopBoxes(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds)
private void
drawZoomLevel(org.eclipse.swt.graphics.GC gc)
private void
endAutoScroll()
private void
endEverything()
(package private) void
eventDatesChanged(GanttEvent ge, boolean redraw)
private void
eventNumbersChanged()
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)
(package private) void
flagForceFullUpdate()
(package private) static org.eclipse.swt.graphics.ImageData
flip(org.eclipse.swt.graphics.ImageData srcData, boolean vertical)
(package private) void
forceFullUpdate()
java.util.List
getAllSelectedHeaderDates()
Returns a list of all selected header dates (Calendar).GanttEvent
getBottomEvent()
Returns the bottom most visible event in the current view of the chart.org.eclipse.swt.graphics.Rectangle
getBounds()
private java.lang.String
getCurrentDDate()
int
getCurrentView()
Returns the current view.java.util.Calendar
getDate()
Returns the current date (left-most date).java.util.Calendar
getDateAt(int x)
Gets the date for a given x position.private java.lang.String
getDateString(java.util.Calendar cal, boolean top)
private org.eclipse.swt.graphics.Color
getDayBackgroundGradient(int day, boolean top, GanttSection gs)
int
getDaysVisible()
private org.eclipse.swt.graphics.Color
getDayTextColor(int day)
int
getDayWidth()
Returns the width of one day in the current zoom level.java.util.Calendar
getDDayCalendar()
Returns (a clone) of the D-Day calendarprivate GanttEvent
getEvent(boolean earliest, boolean pixelComparison)
private java.util.Date
getEventDate(boolean earliest)
java.util.List
getEvents()
Returns all events.private java.util.List<java.lang.Object>
getEventsDependingOn(GanttEvent ge)
private int
getEventVisibility(GanttEvent event, org.eclipse.swt.graphics.Rectangle bounds)
private org.eclipse.swt.graphics.Rectangle
getFirstStub(GanttConnection con)
org.eclipse.swt.graphics.Image
getFullImage()
Returns the image that is the entire chart, regardless of what is currently visible.java.util.List
getGanttConnections()
Returns all currently connected events as a list ofGanttConnection
objects.java.util.List
getGanttSections()
Returns a list of all GanttSections.java.util.List<GanttGroup>
getGroups()
Returns a list of all GanttGroups.int
getHeaderHeight()
private Holiday
getHoliday(java.util.Calendar day)
private org.eclipse.swt.graphics.Color
getHolidayBackgroundGradient(boolean top, GanttSection gs)
org.eclipse.swt.graphics.Image
getImage()
Returns the current visible area of the chart as an imageorg.eclipse.swt.graphics.Image
getImage(org.eclipse.swt.graphics.Rectangle bounds)
Returns the chart as an image for the given bounds.int
getLayerOpacity(int layer)
Returns the layer opacity for a layer.(package private) int
getLeftMostPixel()
private int
getPixel(boolean left)
(package private) int
getRightMostPixel()
java.util.Calendar
getRootCalendar()
Returns the non-cloned root calendar of the chart.java.util.Calendar
getRootEndCalendar()
Returns the non-cloned root end calendar of the chart.java.util.Calendar
getRootStartCalendar()
Returns the non-cloned root start calendar of the chart.GanttSection
getSectionAt(org.eclipse.swt.events.MouseEvent me)
Returns a section that corresponds to where the given MouseEvent is firedprivate GanttSection
getSectionForVerticalDND(GanttEvent event, boolean accountForVerticalDragDirection)
Returns a section that corresponds to where the given event is currently hovering overjava.util.List<java.lang.Object>
getSelectedEvents()
Returns the a list of all currently selected events, or an emtpy list if none.ISettings
getSettings()
int
getStartingXFor(java.util.Calendar date)
Returns the starting x for a given date.private int
getStartingXFor(GanttEvent event)
int
getStartingXForEventDate(java.util.Calendar date)
Returns the starting x position for a given date in the current view.private int
getStartingXForEventHours(java.util.Calendar start)
private int
getStartingXForEventHours(GanttEvent event)
private java.lang.String
getStringForEvent(GanttEvent ge)
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.private java.util.List
getSurroundingVerticalEvents(GanttEvent event, GanttSection section)
Returns a list of all surrounding vertical events to a given event.GanttEvent
getTopEvent()
Returns the topmost visible event in the current view of the chart.int
getTotalVisibileGanttEvents()
Returns the number of visible events on in the current viewportGanttUndoRedoManager
getUndoRedoManager()
Returns the Undo/Redo manager.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.IViewPortHandler
getViewPortHandler()
org.eclipse.swt.graphics.Rectangle
getVisibleBounds()
Returns a rectangle with the bounds of what is actually visible inside the chart.int
getXForDate(java.util.Calendar cal)
Gets the x position where the given date starts in the current visible area.int
getXForDate(java.util.Date date)
Gets the X for a given date.private int
getXLengthForEvent(GanttEvent event)
private int
getXLengthForEventHours(GanttEvent event)
private void
handleMove(org.eclipse.swt.events.MouseEvent me, GanttEvent event, int type, boolean showToolTip)
Handles the actual moving of an event.private void
handlePhaseMove(org.eclipse.swt.events.MouseEvent me, GanttPhase phase, int type, boolean showToolTip)
private void
handlePostVerticalDragDrop()
This method deals with moving events around so that vertical gaps are filled where they left holes after a vertical drag/dropprivate void
handleResize(boolean redraw)
boolean
hasEvent(GanttEvent event)
Checks whether the chart has a given event.(package private) boolean
hasGanttPhases()
(package private) boolean
hasGanttSections()
(package private) boolean
hasSpecialDateRanges()
void
heavyRedraw()
This will cause a full recaclulation of events and a lot of other things.void
hideAllLayers()
Hides all layers and redraws the event area.void
hideLayer(int layer)
Hides all layers of the given value and redraws the event area.private void
initColors()
private void
initListeners()
private void
internalAddEvent(int index, GanttEvent event)
private void
internalAddGroup(int index, GanttGroup group)
private void
internalAddSection(int index, GanttSection section)
private void
internalDrawEvents(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, GanttSection gs)
private void
internalDrawFills(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, GanttSection gs)
private org.eclipse.swt.graphics.Color
internalGetDayBackgroundGradient(int day, boolean top, GanttSection gs)
private void
internalRemoveEvent(GanttEvent event)
private void
internalRemoveGroup(GanttGroup group)
private void
internalRemoveSection(GanttSection section)
private void
internalSetDate(java.util.Calendar date, int side, boolean clearMinutes, boolean redraw)
private void
internalSetDateAtX(int x, java.util.Calendar preZoomDate, boolean clearMinutes, boolean redraw, boolean zoomIn)
(package private) boolean
isChartReady()
boolean
isConnected(GanttEvent ge)
Returns true if the given event is connected to another.boolean
isConnected(GanttEvent source, GanttEvent target)
Checks whether two events are connected to each other.(package private) boolean
isDDayCalendar()
boolean
isEventVisible(GanttEvent event, org.eclipse.swt.graphics.Rectangle bounds)
Checks whether a certain event is visible in the current bounds.private boolean
isInMoveArea(GanttEvent event, int x)
private boolean
isInside(int x, int y, org.eclipse.swt.graphics.Rectangle rect)
private boolean
isNoOverlap(java.util.Calendar dat1, java.util.Calendar dat2)
boolean
isShowingDaysOnEvents()
Returns whether event day number drawing is currently on or off.boolean
isShowingGanttSections()
Whether the chart has gantt sections or notboolean
isShowingPlannedDates()
Returns whether planned date drawing is currently on or off.private boolean
isUseAdvancedTooltips()
void
jumpToEarliestEvent()
Moves the calendar to the earliest event date.private void
jumpToEvent(boolean earliestEvent)
void
jumpToEvent(GanttEvent event, boolean start, int side)
Moves the calendar to a particular event date horizontally.void
jumpToLatestEvent()
Moves the calendar to the latest event date.void
jumpToToday()
Moves calendar to the current date/time.void
jumpToToday(int side)
Moves calendar to the current date/time.void
keyPressed(org.eclipse.swt.events.KeyEvent e)
void
keyReleased(org.eclipse.swt.events.KeyEvent e)
(package private) void
killDialogs()
private void
killMouseState()
void
mouseDoubleClick(org.eclipse.swt.events.MouseEvent me)
void
mouseDown(org.eclipse.swt.events.MouseEvent me)
void
mouseEnter(org.eclipse.swt.events.MouseEvent event)
void
mouseExit(org.eclipse.swt.events.MouseEvent event)
void
mouseHover(org.eclipse.swt.events.MouseEvent me)
void
mouseMove(org.eclipse.swt.events.MouseEvent me)
private void
mouseMoveMinutes(java.lang.String dateFormat, org.eclipse.swt.events.MouseEvent me)
void
mouseUp(org.eclipse.swt.events.MouseEvent event)
private void
moveEvent(GanttEvent ge, int diff, int stateMask, org.eclipse.swt.events.MouseEvent me, int type)
(package private) void
moveXBounds(boolean positive)
private void
moveYBounds(int move)
void
nextDay()
Jumps one day forward.void
nextHour()
Jumps to the next hour.void
nextMinute()
Jumps to the next hour.void
nextMonth()
Jumps to the next month.void
nextWeek()
Jumps one week forward.void
prevDay()
Jumps one day backwards.void
prevHour()
Jumps to the previous hour.void
prevMinute()
Jumps to the previous minute.void
prevMonth()
Jumps to the previous month.void
prevWeek()
Jumps one week backwards.private java.util.Set
recursiveGetEventsDependingOn(GanttEvent ge, GanttMap gm, java.util.Set ret)
void
redraw()
void
redraw(org.eclipse.swt.graphics.Rectangle rect)
private void
redrawEventsArea()
void
refresh()
Redraws the calendar should some event not do it automatically.void
reindex(GanttEvent event, int newIndex)
Re-indexes an event to a new index.void
reindex(GanttGroup group, int newIndex)
Re-indexes a GanttGroup to a new index.void
reindex(GanttSection section, int newIndex)
Re-indexes a GanttSection to a new index.boolean
removeEvent(GanttEvent event)
Removes a GanttEvent from the chart.void
removeGanttEventListener(IGanttEventListener listener)
Removes a listener from being notified of Gantt events.void
removeGroup(GanttGroup group)
Removes a GanttGroup from the chart.void
removePhase(GanttPhase phase)
Removes a GanttPhase from the chart.void
removePhase(GanttPhase phase, boolean redraw)
Removes a GanttPhase from the chart with optional redraw call.void
removeSection(GanttSection section)
Removes a GanttSection from the chart.void
removeSelectionDetailClickListener(ISectionDetailMoreClickListener listener)
void
removeSpecialDateRange(GanttSpecialDateRange range)
Removes aGanttSpecialDateRange
to the chart and redraws.void
removeSpecialDateRange(GanttSpecialDateRange range, boolean redraw)
Removes aGanttSpecialDateRange
to the chart and redraws.private void
repaint(org.eclipse.swt.events.PaintEvent event)
void
resetZoom()
Resets the zoom level to that set in the settings.(package private) static org.eclipse.swt.graphics.ImageData
rotate(org.eclipse.swt.graphics.ImageData srcData, int direction)
void
selectAll()
Selects all eventsvoid
setDate(java.util.Calendar date)
Sets the calendar date.void
setDate(java.util.Calendar date, boolean applyOffset)
Sets the new date of the calendar and redraws.private void
setDate(java.util.Calendar date, boolean applyOffset, boolean redraw)
void
setDate(java.util.Calendar date, int side)
Sets the calendar date to the given date and shows it on the chart.void
setDate(java.util.Calendar date, int side, boolean clearMinutes)
Sets the calendar date to the given date and shows it on the chart.void
setDrawHorizontalLinesOverride(boolean drawHorizontal)
Setting this to true will force horizontal lines to draw despite what may be set in the settings.void
setDrawVerticalLinesOverride(boolean drawVertical)
Setting this to true will force vertical lines to draw despite what may be set in the settings.void
setEventFactory(IEventFactory factory)
void
setEventMenuItemFactory(IEventMenuItemFactory factory)
void
setEventSpacerOverride(int height)
Setting a fixed event spacer overrides all individual event space settings on chart items and all settings.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.void
setHolidays(Holiday[] holidays)
void
setLayerOpacity(int layer, int opacity)
Sets the drawing opacity for a layer.void
setMenuItemFactory(IMenuItemFactory factory)
(package private) void
setNoRecalc()
void
setSelectedHeaderDates(java.util.List dates)
Sets a list of header dates that should be the selected dates.void
setSelection(java.util.List list)
Sets the selection to be a set of GanttEvents.void
setSelection(GanttEvent event)
Sets the selection to be a specific GanttEvent.void
setShowDaysOnEvents(boolean showDates)
Flag whether to show the number of days on events.void
setShowPlannedDates(boolean showPlanned)
Flag whether to show planned dates or not.void
setTopItem(GanttEvent ge, int side)
Sets the top visible item in the chart and scrolls to show it.void
setTopItem(GanttEvent ge, int yOffset, int side)
Sets the top visible item in the chart and scrolls to show it.void
setUseAdvancedTooltips(boolean useAdvancedTooltips)
Sets whether to use advanced tooltips or not.void
setView(int view)
Sets the current view.void
setViewPortHandler(IViewPortHandler2 vph)
void
setZoomHandler(IZoomHandler zoomHandler)
void
setZoomLevel(int level)
Sets the zoom level.void
showAllLayers()
Shows all layers and redraws the event area.void
showEvent(GanttEvent ge, int side)
Scrolls the chart to the selected item regardless if it is visible or not.void
showLayer(int layer)
Shows all layers of the given value and redraws the event area.private void
showMenu(int x, int y, GanttEvent event, org.eclipse.swt.events.MouseEvent me)
(package private) void
showScrollDate()
private void
showTooltip(GanttEvent event, org.eclipse.swt.events.MouseEvent me)
private void
showTooltip(Holiday holiday, org.eclipse.swt.events.MouseEvent me)
private void
startMidnightThread()
private void
updateEventVisibilities(org.eclipse.swt.graphics.Rectangle bounds)
(package private) void
updateHorizontalScrollbar()
private void
updateScopeXY(GanttEvent ge)
(package private) void
updateVerticalScrollBar(boolean redraw)
private void
updateZoomLevel()
void
vScroll()
private void
vScroll(org.eclipse.swt.widgets.Event event)
private void
vScrollToY(int yPos, boolean redraw)
void
zoomIn()
Zooms in.void
zoomIn(boolean fromMouseWheel, org.eclipse.swt.graphics.Point mouseLoc)
void
zoomOut()
Zooms out.void
zoomOut(boolean fromMouseWheel, org.eclipse.swt.graphics.Point mouseLoc)
-
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, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, 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, 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
-
-
-
-
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
-
_dragPhase
private GanttPhase _dragPhase
-
_lastLeft
private boolean _lastLeft
-
_dragStartDate
private java.util.Calendar _dragStartDate
-
_justStartedMoveOrResize
private boolean _justStartedMoveOrResize
-
_initialHoursDragOffset
private int _initialHoursDragOffset
-
_settings
private final ISettings _settings
-
_colorManager
private final IColorManager _colorManager
-
_paintManager
private final IPaintManager _paintManager
-
_languageManager
private final ILanguageManager _languageManager
-
_eventListeners
private final java.util.List<IGanttEventListener> _eventListeners
-
_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
-
_hScrollHandler
private HorizontalScrollbarHandler _hScrollHandler
-
_viewPortHandler
private IViewPortHandler2 _viewPortHandler
-
_savingChartImage
private boolean _savingChartImage
-
_ganttPhases
private final java.util.List<GanttPhase> _ganttPhases
-
_specDateRanges
private final java.util.List<GanttSpecialDateRange> _specDateRanges
-
_stringWidthCache
private final java.util.Map<java.lang.String,org.eclipse.swt.graphics.Point> _stringWidthCache
-
_totVisEventCnt
private int _totVisEventCnt
-
_vDNDManager
private final VerticalDragDropManager _vDNDManager
-
_undoRedoManager
private final GanttUndoRedoManager _undoRedoManager
-
_drawToMinute
private boolean _drawToMinute
-
eventFactory
private IEventFactory eventFactory
-
eventMenuItemFactory
private IEventMenuItemFactory eventMenuItemFactory
-
menuItemFactory
private IMenuItemFactory menuItemFactory
-
holidays
private Holiday[] holidays
-
zoomHandler
private IZoomHandler zoomHandler
-
sectionDetailMoreIcons
private java.util.Map<GanttSection,org.eclipse.swt.graphics.Rectangle> sectionDetailMoreIcons
-
sectionDetailMoreClickListener
private final java.util.List<ISectionDetailMoreClickListener> sectionDetailMoreClickListener
-
-
Constructor Detail
-
GanttComposite
public GanttComposite(GanttChart parent, int style, ISettings settings, IColorManager colorManager, IPaintManager paintManager, ILanguageManager languageManager)
-
GanttComposite
public GanttComposite(GanttChart parent, int style, ISettings settings, IColorManager colorManager, IPaintManager paintManager, ILanguageManager languageManager, Holiday[] holidays)
-
-
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 onopacity
- 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 toSWT.SINGLE
you should be usingsetSelection(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 addindex
- 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 showyOffset
- y offset modifierside
- one ofSWT.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 showside
- one ofSWT.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 ofSWT.LEFT
,SWT.CENTER
,SWT.RIGHT
-
vScrollToY
private void vScrollToY(int yPos, boolean redraw)
-
getBounds
public org.eclipse.swt.graphics.Rectangle getBounds()
- Overrides:
getBounds
in classorg.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
- GCarea
- Area to fit text intext
- 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 eventtarget
- 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 toTarget
.- Parameters:
source
- Source eventtarget
- Target eventColor
- to use to draw connection. Set null to use default color from Settings.
-
connectionAdded
void connectionAdded(GanttConnection conn)
-
connectionRemoved
void connectionRemoved(GanttConnection conn)
-
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 eventtarget
- Target event- Returns:
- true if a connection exists
-
addConnection
public void addConnection(GanttEvent source, GanttEvent target)
Same as addDependency().- Parameters:
source
- Source eventtarget
- Target event
-
addConnection
public void addConnection(GanttEvent source, GanttEvent target, org.eclipse.swt.graphics.Color color)
Same as addDependency().- Parameters:
source
- Source eventtarget
- Target eventColor
- 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)
-
setDate
public void setDate(java.util.Calendar date)
Sets the calendar date.- Parameters:
date
-- See Also:
setDate(Calendar, boolean)
,setDate(Calendar, int)
,setDate(Calendar, int, boolean)
-
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 ofSWT.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)
orsetTopItem(GanttEvent, int)
.- Parameters:
event
- Event to move tostart
- true if to jump to the start date, false if to jump to the end date.side
- one ofSWT.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
- Dateside
- one ofSWT.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, usesetDate(Calendar, int, boolean)
- Parameters:
date
- Dateside
- one ofSWT.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 setapplyOffset
- 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 reindexnewIndex
- new index
-
reindex
public void reindex(GanttSection section, int newIndex)
Re-indexes a GanttSection to a new index.- Parameters:
section
- GanttSection to reindexnewIndex
- new index
-
reindex
public void reindex(GanttGroup group, int newIndex)
Re-indexes a GanttGroup to a new index.- Parameters:
group
- GanttGroup to reindexnewIndex
- 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
-
addSpecialDateRange
public void addSpecialDateRange(GanttSpecialDateRange range)
Adds aGanttSpecialDateRange
to the chart.- Parameters:
range
-GanttSpecialDateRange
to add.
-
removeSpecialDateRange
public void removeSpecialDateRange(GanttSpecialDateRange range)
Removes aGanttSpecialDateRange
to the chart and redraws.- Parameters:
range
-GanttSpecialDateRange
to remove
-
removeSpecialDateRange
public void removeSpecialDateRange(GanttSpecialDateRange range, boolean redraw)
Removes aGanttSpecialDateRange
to the chart and redraws.- Parameters:
range
-GanttSpecialDateRange
to removeredraw
- true to redraw
-
clearSpecialDateRanges
public void clearSpecialDateRanges()
Removes allGanttSpecialDateRange
s and redraws.
-
addSpecialDateRange
public void addSpecialDateRange(GanttSpecialDateRange range, boolean redraw)
Adds aGanttSpecialDateRange
and optionally redraws.- Parameters:
range
-GanttSpecialDateRange
to addredraw
- true to redraw
-
addPhase
public void addPhase(GanttPhase phase, boolean redraw)
Adds a GanttPhase to the chart with optional redraw call.- Parameters:
phase
- GanttPhase to addredraw
- 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 removeredraw
- 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
- GanttEventindex
- index
-
addEvent
public void addEvent(GanttEvent event, boolean redraw)
Adds an GanttEvent to the chart and redraws.- Parameters:
event
- GanttEventredraw
- 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 ofGanttConnection
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
- GanttEventbounds
- 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 interfaceorg.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 selectme
-
-
mouseDown
public void mouseDown(org.eclipse.swt.events.MouseEvent me)
- Specified by:
mouseDown
in interfaceorg.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 interfaceorg.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 checkaccountForVerticalDragDirection
- 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 forsection
- 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 interfaceorg.eclipse.swt.events.KeyListener
-
keyReleased
public void keyReleased(org.eclipse.swt.events.KeyEvent e)
- Specified by:
keyReleased
in interfaceorg.eclipse.swt.events.KeyListener
-
endEverything
private void endEverything()
-
mouseMove
public void mouseMove(org.eclipse.swt.events.MouseEvent me)
- Specified by:
mouseMove
in interfaceorg.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 interfaceorg.eclipse.swt.events.MouseTrackListener
-
mouseExit
public void mouseExit(org.eclipse.swt.events.MouseEvent event)
- Specified by:
mouseExit
in interfaceorg.eclipse.swt.events.MouseTrackListener
-
mouseHover
public void mouseHover(org.eclipse.swt.events.MouseEvent me)
- Specified by:
mouseHover
in interfaceorg.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()
-
getViewPortHandler
public IViewPortHandler getViewPortHandler()
-
setViewPortHandler
public void setViewPortHandler(IViewPortHandler2 vph)
-
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 interfaceIZoomHandler
-
zoomIn
public void zoomIn(boolean fromMouseWheel, org.eclipse.swt.graphics.Point mouseLoc)
- Specified by:
zoomIn
in interfaceIZoomHandler
-
zoomOut
public void zoomOut()
Zooms out. If zooming is disabled, does nothing.- Specified by:
zoomOut
in interfaceIZoomHandler
-
zoomOut
public void zoomOut(boolean fromMouseWheel, org.eclipse.swt.graphics.Point mouseLoc)
- Specified by:
zoomOut
in interfaceIZoomHandler
-
resetZoom
public void resetZoom()
Resets the zoom level to that set in the settings.- Specified by:
resetZoom
in interfaceIZoomHandler
-
redraw
public void redraw()
- Overrides:
redraw
in classorg.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
-
getUndoRedoManager
public GanttUndoRedoManager getUndoRedoManager()
Returns the Undo/Redo manager.- Returns:
GanttUndoRedoManager
-
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)
-
setEventMenuItemFactory
public void setEventMenuItemFactory(IEventMenuItemFactory factory)
-
setMenuItemFactory
public void setMenuItemFactory(IMenuItemFactory factory)
-
setZoomHandler
public void setZoomHandler(IZoomHandler zoomHandler)
-
addSelectionDetailClickListener
public void addSelectionDetailClickListener(ISectionDetailMoreClickListener listener)
-
removeSelectionDetailClickListener
public void removeSelectionDetailClickListener(ISectionDetailMoreClickListener listener)
-
setHolidays
public void setHolidays(Holiday[] holidays)
-
-