Class GanttEvent
- java.lang.Object
-
- org.eclipse.nebula.widgets.ganttchart.AbstractGanttEvent
-
- org.eclipse.nebula.widgets.ganttchart.GanttEvent
-
- All Implemented Interfaces:
java.lang.Cloneable
,IGanttChartItem
- Direct Known Subclasses:
GanttCheckpoint
,GanttImage
,GanttScope
public class GanttEvent extends AbstractGanttEvent implements IGanttChartItem, java.lang.Cloneable
One GanttEvent represents one "active" object in the GANTT chart.This object can take many shapes, here is a list of a few:
- Normal event
- Checkpoint event
- Scope event
- Image event
- And so on...
Events may be modified on the fly to become a different object type from the above list. Please do ensure that the ALL parameters are set for it to become the new object before you do so.
Once an event has been created, add it onto the GanttChart widget via the addScopeEvent(...) methods available.
Sample Code:
// make a 10 day long event
Calendar cStartDate = Calendar.getInstance(Locale.getDefault());
Calendar cEndDate = Calendar.getInstance(Locale.getDefault());
cEndDate.add(Calendar.DATE, 10);
// we're setting the percentage complete to 50%
GanttEvent ganttEvent = new GanttEvent(ganttChart, "Event Name", cStartDate, cEndDate, 50);
This class should not be subclassed, do so at your own risk.
-
-
Field Summary
Fields Modifier and Type Field Description private int
_actualWidth
private AdvancedTooltip
_advancedTooltip
private boolean
_boundsHaveBeenSet
private boolean
_checkpoint
private java.lang.Object
_data
private int
_daysBetweenStartAndEnd
private int
_dDayEnd
private int
_dDayStart
private int
_earliestStartX
private java.util.Calendar
_endDate
private int
_fixedRowHeight
private GanttGroup
_ganttGroup
private GanttSection
_ganttSection
private org.eclipse.swt.graphics.Color
_gradientStatusColor
private int
_height
private boolean
_hidden
private int
_horizontalLineBottomY
private int
_horizontalLineTopY
private int
_horizontalTextLocation
private boolean
_image
private int
_latestEndX
private boolean
_locked
private org.eclipse.swt.widgets.Menu
_menu
private boolean
_moveable
private int
_moveType
private boolean
_moving
private java.lang.String
_name
private boolean
_nameChanged
private org.eclipse.swt.graphics.Point
_nameExtent
private java.util.Calendar
_noMoveAfterDate
private java.util.Calendar
_noMoveBeforeDate
private GanttChart
_parentChart
private GanttComposite
_parentComposite
private java.lang.String
_parsedString
private int
_percentComplete
private org.eclipse.swt.graphics.Image
_picture
private org.eclipse.swt.graphics.Rectangle
_preMoveBounds
private java.util.Calendar
_preMoveDateEstiEnd
private java.util.Calendar
_preMoveDateEstiStart
private java.util.Calendar
_preMoveDateRevisedEnd
private java.util.Calendar
_preMoveDateRevisedStart
private int
_preMoveGanttSectionEventLocationIndex
private int
_preMoveGanttSectionIndex
private org.eclipse.swt.graphics.Rectangle
_preVerticalDragBounds
private boolean
_resizable
private java.util.Calendar
_revisedEnd
private java.util.Calendar
_revisedStart
private int
_savedVerticalDragY
private boolean
_scope
private java.util.List
_scopeEvents
private GanttEvent
_scopeParent
private boolean
_showBoldText
private boolean
_showText
private java.util.Calendar
_startDate
private org.eclipse.swt.graphics.Color
_statusColor
private java.lang.String
_textDisplayFormat
private org.eclipse.swt.graphics.Font
_textFont
private int
_verticalEventAlignment
private int
_verticalTextLocation
private int
_visibility
private int
_width
private int
_widthWithtText
private int
_x
private int
_y
static int
FIXED_ROW_HEIGHT_AUTOMATIC
-
Constructor Summary
Constructors Constructor Description GanttEvent(GanttChart parent, int dDayStart, int dDayEnd)
D-day event creation.GanttEvent(GanttChart parent, java.lang.Object data, java.lang.String name)
Creates a GanttEvent intended to be a scope.GanttEvent(GanttChart parent, java.lang.Object data, java.lang.String name, java.util.Calendar date)
Creates a GanttEvent intended to be a checkpoint.GanttEvent(GanttChart parent, java.lang.Object data, java.lang.String name, java.util.Calendar startDate, java.util.Calendar endDate, int percentComplete)
Creates a new GanttEvent object.GanttEvent(GanttChart parent, java.lang.Object data, java.lang.String name, java.util.Calendar startDate, java.util.Calendar endDate, java.util.Calendar revisedStart, java.util.Calendar revisedEnd, int percentComplete)
Creates a new GanttEvent object with revised start and end dates.GanttEvent(GanttChart parent, java.lang.Object data, java.lang.String name, java.util.Calendar date, org.eclipse.swt.graphics.Image picture)
Creates a GanttEvent intended to be an image.GanttEvent(GanttChart parent, java.lang.String name)
Creates a GanttEvent intended to be a scope.GanttEvent(GanttChart parent, java.lang.String name, java.util.Calendar date)
Creates a GanttEvent intended to be a checkpoint.GanttEvent(GanttChart parent, java.lang.String name, java.util.Calendar startDate, java.util.Calendar endDate, int percentComplete)
Creates a new GanttEvent.GanttEvent(GanttChart parent, java.lang.String name, java.util.Calendar startDate, java.util.Calendar endDate, java.util.Calendar revisedStart, java.util.Calendar revisedEnd, int percentComplete)
Creates a new GanttEvent.GanttEvent(GanttChart parent, java.lang.String name, java.util.Calendar date, org.eclipse.swt.graphics.Image picture)
Creates a GanttEvent intended to be an image.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addScopeEvent(GanttEvent event)
Adds an event that this event should cover if it has been set to be a scope.(package private) void
calculateScope()
java.lang.Object
clone()
Clones the GanttEvent and all objects of it (assuming they are cloneable).void
dispose()
Removes this item from the chart.(package private) void
flagDragging()
org.eclipse.swt.graphics.Rectangle
getActualBounds()
This takes any text drawing widths into account and returns the bounds as suchint
getActualDDayEnd()
int
getActualDDayStart()
java.util.Calendar
getActualEndDate()
Returns the revised end date if set, or the end date if not.java.util.Calendar
getActualStartDate()
Returns the revised start date if set, or the start date if not.(package private) int
getActualWidth()
AdvancedTooltip
getAdvancedTooltip()
Returns the currently set Advanced tooltip, or null if none is set.int
getBottomY()
Returns the bottom y of this event.org.eclipse.swt.graphics.Rectangle
getBounds()
Returns the bounds of this event (do note that events may have no bounds if they are invisible or hidden and will not get actual bounds set until they are shown).java.lang.Object
getData()
Returns the currently set data object.(package private) int
getDaysBetweenStartAndEnd()
int
getDDateRange()
int
getDDayEnd()
int
getDDayRevisedEnd()
int
getDDayRevisedStart()
int
getDDayStart()
Returns the D-day start value.private GanttEvent
getEarliestOrLatestScopeEvent(boolean earliest)
GanttEvent
getEarliestScopeEvent()
Returns the event that has the earliest date of all events in a scope.java.util.Calendar
getEarliestStartDate()
Returns whatever is the earliest calendar of the start date and the actual start date.(package private) int
getEarliestStartX()
java.util.Calendar
getEndDate()
Returns the end date of this event.int
getFixedRowHeight()
Returns the fixed row height in pixels.GanttGroup
getGanttGroup()
Returns what GanttGroup this event belongs to.GanttSection
getGanttSection()
Returns theGanttSection
that this event belongs to, or null if none.org.eclipse.swt.graphics.Color
getGradientStatusColor()
Returns the status color used as part of the gradient colors used to draw the event.int
getHeight()
Returns the height of this event.(package private) int
getHorizontalLineBottomY()
(package private) int
getHorizontalLineTopY()
int
getHorizontalTextLocation()
Returns the location where the event text will be displayed.java.util.Calendar
getLatestEndDate()
Returns whatever is the latest calendar of the end date and the actual end date.(package private) int
getLatestEndX()
GanttEvent
getLatestScopeEvent()
Returns the event that has the latest date of all events in a scope.org.eclipse.swt.widgets.Menu
getMenu()
Returns the individual Menu for this event for which custom events can be created.java.lang.String
getName()
Returns the display name of this event.(package private) org.eclipse.swt.graphics.Point
getNameExtent()
java.util.Calendar
getNoMoveAfterDate()
Returns the date after which no moves or resizes are allowed.java.util.Calendar
getNoMoveBeforeDate()
Returns the date prior to which no moves or resizes are allowed.GanttChart
getParentChart()
Returns the parentGanttChart
GanttComposite
getParentComposite()
Returns the parentGanttComposite
(package private) java.lang.String
getParsedString()
int
getPercentComplete()
Returns the percentage complete of this event.org.eclipse.swt.graphics.Image
getPicture()
Returns the picture image for this event.(package private) IUndoRedoCommand
getPostMoveOrResizeUndoCommand()
Call after a move/resize is done to get the command to undo/redo the latest move/resize(package private) org.eclipse.swt.graphics.Rectangle
getPreVerticalDragBounds()
int
getRevisedDDateRange()
java.util.Calendar
getRevisedEnd()
Returns the revised end date of this event.java.util.Calendar
getRevisedStart()
Returns the revised start date of this event.java.util.List
getScopeEvents()
Returns the list of GanttEvents that the scope encompasses.GanttEvent
getScopeParent()
Returns the scope parent of this event if it has one.java.util.Calendar
getStartDate()
Returns the start date of this event.org.eclipse.swt.graphics.Color
getStatusColor()
Returns the status color of this event.java.lang.String
getTextDisplayFormat()
Returns the text display format of this event.org.eclipse.swt.graphics.Font
getTextFont()
Returns the text font to use when drawing the event text.int
getVerticalEventAlignment()
Returns the vertical alignment set.int
getVerticalTextLocation()
Returns the lcoation where the event text will be displayed vertically.(package private) int
getVisibility()
int
getWidth()
Returns the width of this event.int
getWidthWithText()
Returns the full right most x value if event has text or images drawn after it.int
getX()
Returns the x location of this event.int
getXEnd()
Returns the ending x location for this event.int
getY()
Returns the y location of this event.(package private) boolean
hasMovedVertically()
(package private) boolean
hasMovementConstraints()
void
hideAllChildren()
Hides all children from view.private void
init()
private void
internalSetAllChildrenHidden(boolean hidden)
boolean
isAutomaticRowHeight()
Whether the row height is calculated automatically or if it's fixed(package private) boolean
isBoundsSet()
boolean
isCheckpoint()
Whether this is a checkpoint or not.boolean
isChildrenHidden()
Returns whether all children are hidden or not.boolean
isHidden()
Returns whether this event is hidden or not.boolean
isImage()
Returns whether this event is an image representation or not.boolean
isLocked()
Whether this event is locked or not.boolean
isMoveable()
Whether this event is moveable.(package private) boolean
isNameChanged()
boolean
isResizable()
Whether this event is resizable.boolean
isScope()
Returns whether this is a scope or not.boolean
isShowText()
(package private) void
moveCancelled()
(package private) void
moveFinished()
(package private) void
moveStarted(int moveType)
void
removeScopeEvent(GanttEvent event)
Removes event that this event encompasses as a scope.void
reparentToNewGanttSection(int index, GanttSection newSection)
Reparents this event from the currentGanttSection
to a newGanttSection
void
setAdvancedTooltip(AdvancedTooltip advancedTooltip)
Sets the advanced tooltip.void
setAutomaticRowHeight()
Resets the row height to be calculated automatically should the row height have been set to a specific value.(package private) void
setBounds(int x, int y, int width, int height)
Sets the bounds of the event.(package private) void
setBounds(org.eclipse.swt.graphics.Rectangle bounds)
Sets the bounds of the event.(package private) void
setBoundsSet(boolean set)
void
setCheckpoint(boolean checkpoint)
Sets the event to be a checkpoint.void
setData(java.lang.Object data)
Sets the current data object.void
setDDayEnd(int day)
void
setDDayStart(int day)
Sets the D-day start value.(package private) void
setEarliestStartX(int x)
void
setEndDate(java.util.Calendar endDate)
Sets the end date of this event.void
setFixedRowHeight(int fixedRowHeight)
Sets the fixed row height in pixels.void
setGanttGroup(GanttGroup group)
Sets what group this event belongs to.(package private) void
setGanttSection(GanttSection ganttSection)
Sets the GanttSection that this event belongs tovoid
setGradientStatusColor(org.eclipse.swt.graphics.Color gradientStatusColor)
Sets the status color used as part of the gradient colors used to draw the event.void
setHidden(boolean hidden)
Sets if this event should be hidden or not.(package private) void
setHorizontalLineBottomY(int y)
(package private) void
setHorizontalLineTopY(int y)
void
setHorizontalTextLocation(int textLocation)
Sets the location of where the event text will be displayed.void
setImage(boolean image)
Sets this event to be represented by an image.(package private) void
setLatestEndX(int x)
void
setLocked(boolean locked)
Sets whether this event is locked or not.void
setMoveable(boolean moveable)
Sets this event to be moveable or not.void
setName(java.lang.String name)
Sets the display name of this event.(package private) void
setNameChanged(boolean changed)
(package private) void
setNameExtent(org.eclipse.swt.graphics.Point extent)
void
setNoMoveAfterDate(java.util.Calendar noMoveAfterDate)
Sets the date after which no moves or resizes are allowed.void
setNoMoveBeforeDate(java.util.Calendar noMoveBeforeDate)
Sets the date prior to which no moves or resizes are allowed.void
setNoUpdatePlannedDates(java.util.Calendar start, java.util.Calendar end)
Will update planned dates without question or internal checks.void
setNoUpdateRevisedDates(java.util.Calendar start, java.util.Calendar end)
Will update revised dates without question or internal checks.(package private) void
setParsedString(java.lang.String parsed)
void
setPercentComplete(int percentComplete)
Sets the percentage complete of this event.void
setPicture(org.eclipse.swt.graphics.Image picture)
Sets the picture image for this event.void
setResizable(boolean resizable)
Sets this event to be resizable or not.private void
setRevisedDates(java.util.Calendar revisedStart, java.util.Calendar revisedEnd)
Sets new revised dates.void
setRevisedDates(java.util.Calendar revisedStart, java.util.Calendar revisedEnd, int order)
Another utility method for setting new dates but this method enforces the usual validation.void
setRevisedEnd(int dDayEnd)
Sets the revised D-day end.void
setRevisedEnd(java.util.Calendar revisedEnd)
Sets the revised end date of this event.void
setRevisedEnd(java.util.Calendar revisedEnd, boolean validate)
When you need to move events manually you may run into issues as one date always has to be set before the other.void
setRevisedStart(int dDayStart)
Sets the revised D-day start.void
setRevisedStart(java.util.Calendar revisedStart)
Sets the revised start date of this event.void
setRevisedStart(java.util.Calendar revisedStart, boolean validate)
When you need to move events manually you may run into issues as one date always has to be set before the other.void
setScope(boolean scope)
Sets this event to be a scope.(package private) void
setScopeParent(GanttEvent parent)
void
setShowBoldText(boolean showBoldText)
Sets whether to show the display name in bold text or not.void
setShowText(boolean _showText)
void
setStartDate(java.util.Calendar startDate)
Sets the end date of this event.void
setStatusColor(org.eclipse.swt.graphics.Color statusColor)
Sets the status color of this event.void
setTextDisplayFormat(java.lang.String format)
Sets the text display format of this event.void
setTextFont(org.eclipse.swt.graphics.Font textFont)
Sets the text font to use when drawing the event text.void
setVerticalEventAlignment(int verticalEventAlignment)
Sets the vertical alignment for this event.void
setVerticalTextLocation(int verticalTextLocation)
Sets the vertical location where the event text will be displayed.(package private) void
setVisibility(int visibility)
void
setWidthWithText(int width)
Sets the full width of the event width and the text and images that come after it.void
showAllChildren()
Un-hides all children from view.boolean
showBoldText()
Whether to show the display name in bold text or not.java.lang.String
toString()
(package private) void
undoVerticalDragging()
void
update(boolean redraw)
Forces the chart to recognize that something within this event has changed and that it needs an update.(package private) void
updateActualWidth()
private void
updateDaysBetweenStartAndEnd()
(package private) void
updateHeight(int height)
private void
updateOtherXs()
(package private) void
updateWidth(int width)
(package private) void
updateX(int x)
(package private) void
updateY(int y)
(package private) boolean
wasVerticallyMovedUp()
-
Methods inherited from class org.eclipse.nebula.widgets.ganttchart.AbstractGanttEvent
getLayer, getLayerInt, setLayer
-
-
-
-
Field Detail
-
FIXED_ROW_HEIGHT_AUTOMATIC
public static final int FIXED_ROW_HEIGHT_AUTOMATIC
- See Also:
- Constant Field Values
-
_data
private java.lang.Object _data
-
_name
private java.lang.String _name
-
_revisedStart
private java.util.Calendar _revisedStart
-
_revisedEnd
private java.util.Calendar _revisedEnd
-
_startDate
private java.util.Calendar _startDate
-
_endDate
private java.util.Calendar _endDate
-
_percentComplete
private int _percentComplete
-
_checkpoint
private boolean _checkpoint
-
_scope
private boolean _scope
-
_locked
private boolean _locked
-
_image
private boolean _image
-
_resizable
private boolean _resizable
-
_moveable
private boolean _moveable
-
_x
private int _x
-
_y
private int _y
-
_width
private int _width
-
_height
private int _height
-
_earliestStartX
private int _earliestStartX
-
_latestEndX
private int _latestEndX
-
_actualWidth
private int _actualWidth
-
_statusColor
private org.eclipse.swt.graphics.Color _statusColor
-
_gradientStatusColor
private org.eclipse.swt.graphics.Color _gradientStatusColor
-
_showBoldText
private boolean _showBoldText
-
_textDisplayFormat
private java.lang.String _textDisplayFormat
-
_scopeEvents
private java.util.List _scopeEvents
-
_picture
private org.eclipse.swt.graphics.Image _picture
-
_menu
private org.eclipse.swt.widgets.Menu _menu
-
_parentChart
private GanttChart _parentChart
-
_parentComposite
private GanttComposite _parentComposite
-
_ganttGroup
private GanttGroup _ganttGroup
-
_ganttSection
private GanttSection _ganttSection
-
_hidden
private boolean _hidden
-
_widthWithtText
private int _widthWithtText
-
_advancedTooltip
private AdvancedTooltip _advancedTooltip
-
_visibility
private int _visibility
-
_boundsHaveBeenSet
private boolean _boundsHaveBeenSet
-
_fixedRowHeight
private int _fixedRowHeight
-
_verticalEventAlignment
private int _verticalEventAlignment
-
_horizontalLineTopY
private int _horizontalLineTopY
-
_horizontalLineBottomY
private int _horizontalLineBottomY
-
_noMoveBeforeDate
private java.util.Calendar _noMoveBeforeDate
-
_noMoveAfterDate
private java.util.Calendar _noMoveAfterDate
-
_nameChanged
private boolean _nameChanged
-
_nameExtent
private org.eclipse.swt.graphics.Point _nameExtent
-
_parsedString
private java.lang.String _parsedString
-
_horizontalTextLocation
private int _horizontalTextLocation
-
_verticalTextLocation
private int _verticalTextLocation
-
_showText
private boolean _showText
-
_textFont
private org.eclipse.swt.graphics.Font _textFont
-
_daysBetweenStartAndEnd
private int _daysBetweenStartAndEnd
-
_preMoveDateEstiStart
private java.util.Calendar _preMoveDateEstiStart
-
_preMoveDateEstiEnd
private java.util.Calendar _preMoveDateEstiEnd
-
_preMoveDateRevisedStart
private java.util.Calendar _preMoveDateRevisedStart
-
_preMoveDateRevisedEnd
private java.util.Calendar _preMoveDateRevisedEnd
-
_preMoveBounds
private org.eclipse.swt.graphics.Rectangle _preMoveBounds
-
_moving
private boolean _moving
-
_moveType
private int _moveType
-
_preMoveGanttSectionIndex
private int _preMoveGanttSectionIndex
-
_preMoveGanttSectionEventLocationIndex
private int _preMoveGanttSectionEventLocationIndex
-
_scopeParent
private GanttEvent _scopeParent
-
_dDayStart
private int _dDayStart
-
_dDayEnd
private int _dDayEnd
-
_savedVerticalDragY
private int _savedVerticalDragY
-
_preVerticalDragBounds
private org.eclipse.swt.graphics.Rectangle _preVerticalDragBounds
-
-
Constructor Detail
-
GanttEvent
public GanttEvent(GanttChart parent, java.lang.String name, java.util.Calendar startDate, java.util.Calendar endDate, int percentComplete)
Creates a new GanttEvent.- Parameters:
parent
- Parent chartname
- Name of eventstartDate
- Start dateendDate
- End datepercentComplete
- Percent complete
-
GanttEvent
public GanttEvent(GanttChart parent, java.lang.Object data, java.lang.String name, java.util.Calendar startDate, java.util.Calendar endDate, int percentComplete)
Creates a new GanttEvent object.- Parameters:
parent
- Parent chartdata
- Data objectname
- Name of eventstartDate
- Start dateendDate
- End datepercentComplete
- Percent complete
-
GanttEvent
public GanttEvent(GanttChart parent, java.lang.String name, java.util.Calendar startDate, java.util.Calendar endDate, java.util.Calendar revisedStart, java.util.Calendar revisedEnd, int percentComplete)
Creates a new GanttEvent.- Parameters:
parent
- Parent chartname
- Name of eventstartDate
- Start dateendDate
- End daterevisedStart
- Revised startrevisedEnd
- Revised endpercentComplete
- Percent complete
-
GanttEvent
public GanttEvent(GanttChart parent, java.lang.Object data, java.lang.String name, java.util.Calendar startDate, java.util.Calendar endDate, java.util.Calendar revisedStart, java.util.Calendar revisedEnd, int percentComplete)
Creates a new GanttEvent object with revised start and end dates.- Parameters:
parent
- Parent GanttChartdata
- Data objectname
- Display namestartDate
- Start dateendDate
- End daterevisedStart
- Revised start daterevisedEnd
- Revised end datepercentComplete
- Percentage complete
-
GanttEvent
public GanttEvent(GanttChart parent, int dDayStart, int dDayEnd)
D-day event creation.- Parameters:
parent
- Parent chartdDayStart
- D day start value (zero based)dDayEnd
- D day end value (zero based)
-
GanttEvent
public GanttEvent(GanttChart parent, java.lang.String name)
Creates a GanttEvent intended to be a scope.- Parameters:
parent
- Chart parentname
- Name of scope
-
GanttEvent
public GanttEvent(GanttChart parent, java.lang.Object data, java.lang.String name)
Creates a GanttEvent intended to be a scope.- Parameters:
parent
- Chart parentdata
- Data objectname
- Name of scope
-
GanttEvent
public GanttEvent(GanttChart parent, java.lang.String name, java.util.Calendar date)
Creates a GanttEvent intended to be a checkpoint.- Parameters:
parent
- Chart parentname
- Name of checkpointdate
- Checkpoint start (and end) date
-
GanttEvent
public GanttEvent(GanttChart parent, java.lang.Object data, java.lang.String name, java.util.Calendar date)
Creates a GanttEvent intended to be a checkpoint.- Parameters:
parent
- Chart parentdata
- Data objectname
- Name of checkpointdate
- Start (and end) date
-
GanttEvent
public GanttEvent(GanttChart parent, java.lang.String name, java.util.Calendar date, org.eclipse.swt.graphics.Image picture)
Creates a GanttEvent intended to be an image.- Parameters:
parent
- Chart parentname
- Name of imagedate
- Start (and end) datepicture
- Image to show
-
GanttEvent
public GanttEvent(GanttChart parent, java.lang.Object data, java.lang.String name, java.util.Calendar date, org.eclipse.swt.graphics.Image picture)
Creates a GanttEvent intended to be an image.- Parameters:
parent
- Chart parentdata
- Data objectname
- Name of imagedate
- Start (and end) datepicture
- Image to show
-
-
Method Detail
-
init
private final void init()
-
getData
public java.lang.Object getData()
Returns the currently set data object.- Returns:
- Data object
-
setData
public void setData(java.lang.Object data)
Sets the current data object.- Parameters:
data
- Data object
-
getName
public java.lang.String getName()
Returns the display name of this event.- Returns:
- Display name
-
setName
public void setName(java.lang.String name)
Sets the display name of this event.- Parameters:
name
- Display name
-
getStartDate
public java.util.Calendar getStartDate()
Returns the start date of this event.- Returns:
- Start date
-
getActualStartDate
public java.util.Calendar getActualStartDate()
Returns the revised start date if set, or the start date if not.- Returns:
- Start date or null
-
getActualEndDate
public java.util.Calendar getActualEndDate()
Returns the revised end date if set, or the end date if not.- Returns:
- End date or null
-
getEarliestStartDate
public java.util.Calendar getEarliestStartDate()
Returns whatever is the earliest calendar of the start date and the actual start date. If any of them are null, whichever has a calendar is returned. If both are null, null is returned.- Returns:
- Earliest start date
-
getLatestEndDate
public java.util.Calendar getLatestEndDate()
Returns whatever is the latest calendar of the end date and the actual end date. If any of them are null, whichever has a calendar is returned. If both are null, null is returned.- Returns:
- Latest end date
-
setStartDate
public void setStartDate(java.util.Calendar startDate)
Sets the end date of this event.- Parameters:
startDate
- Start date
-
update
public void update(boolean redraw)
Forces the chart to recognize that something within this event has changed and that it needs an update. This method will cause a redraw if told to redraw.- Parameters:
redraw
- if to redraw the chart after notifying of changes.
-
getEndDate
public java.util.Calendar getEndDate()
Returns the end date of this event.- Returns:
- End date
-
setEndDate
public void setEndDate(java.util.Calendar endDate)
Sets the end date of this event.- Parameters:
endDate
- End date
-
getPercentComplete
public int getPercentComplete()
Returns the percentage complete of this event.- Returns:
- Percentage complete
-
setPercentComplete
public void setPercentComplete(int percentComplete)
Sets the percentage complete of this event.- Parameters:
percentComplete
- Percentage complete
-
getMenu
public org.eclipse.swt.widgets.Menu getMenu()
Returns the individual Menu for this event for which custom events can be created. Custom events will be mixed with built-in events (if they exist). The menu will be created on the first get call to this method, any subsequent method calls will return the same menu object. Do remember that a menu counts as a handle towards the maximum number of handles. If you have very many events, it is probably better to use a different way of creating menus, this is merely meant as a convenience.- Returns:
- Menu
-
setBounds
void setBounds(int x, int y, int width, int height)
Sets the bounds of the event. This is done internally.- Parameters:
x
- x locationy
- y locationwidth
- width of eventheight
- height of event
-
setBounds
void setBounds(org.eclipse.swt.graphics.Rectangle bounds)
Sets the bounds of the event.- Parameters:
bounds
- New bounds
-
updateX
void updateX(int x)
-
updateOtherXs
private void updateOtherXs()
-
updateY
void updateY(int y)
-
updateHeight
void updateHeight(int height)
-
updateWidth
void updateWidth(int width)
-
isCheckpoint
public boolean isCheckpoint()
Whether this is a checkpoint or not.- Returns:
- true if this is a checkpoint
-
setCheckpoint
public void setCheckpoint(boolean checkpoint)
Sets the event to be a checkpoint.- Parameters:
checkpoint
- true if the event should be a checkpoint
-
getX
public int getX()
Returns the x location of this event.- Returns:
- x location
-
getXEnd
public int getXEnd()
Returns the ending x location for this event.- Returns:
- x end location
-
getY
public int getY()
Returns the y location of this event.- Returns:
- y location
-
getBottomY
public int getBottomY()
Returns the bottom y of this event.- Returns:
- y bottom
-
getWidth
public int getWidth()
Returns the width of this event.- Returns:
- width
-
getHeight
public int getHeight()
Returns the height of this event.- Returns:
- height
-
getRevisedStart
public java.util.Calendar getRevisedStart()
Returns the revised start date of this event.- Returns:
- Revised date
-
setRevisedStart
public void setRevisedStart(java.util.Calendar revisedStart)
Sets the revised start date of this event.- Parameters:
revisedStart
-
-
getRevisedEnd
public java.util.Calendar getRevisedEnd()
Returns the revised end date of this event.- Returns:
- revised end date
-
setRevisedEnd
public void setRevisedEnd(java.util.Calendar revisedEnd)
Sets the revised end date of this event.- Parameters:
revisedEnd
- Revised end date
-
setRevisedStart
public void setRevisedStart(int dDayStart)
Sets the revised D-day start.- Parameters:
dDayStart
- d-day start.
-
setRevisedEnd
public void setRevisedEnd(int dDayEnd)
Sets the revised D-day end.- Parameters:
dDayEnd
- d-day end
-
setRevisedDates
private void setRevisedDates(java.util.Calendar revisedStart, java.util.Calendar revisedEnd)
Sets new revised dates. This is useful when you need to update two dates that move at the same time (such as manually doing a move via setDates). Normally each setting of a date would check it against its start date or end date to make sure it doesn't overlap. This does too, but at the same time, thus, no oddity in movement will appear. This is rather difficult to explain, but if you experience event-length changes when using individual start and end date sets that appear at the same time, you probably want to use this method instead.Either parameter may be null to set just one, but both may not be null
- Parameters:
revisedStart
- New revised Start daterevisedEnd
- New revised End date
-
setRevisedStart
public void setRevisedStart(java.util.Calendar revisedStart, boolean validate)
When you need to move events manually you may run into issues as one date always has to be set before the other. So when you set a new end and start date one is checked for overlap before the other and is thus ignored. Sometimes you just want to set the dates and not enforce validation. Do remember, you need to validate the dates yourself before setting them. If the start comes after the end or vice versa you will run into serious drawing issues and strange behavior.- Parameters:
revisedStart
- New revised start datevalidate
- true if to validate the date as normal, false to just set the date as is.
-
setRevisedEnd
public void setRevisedEnd(java.util.Calendar revisedEnd, boolean validate)
When you need to move events manually you may run into issues as one date always has to be set before the other. So when you set a new end and start date one is checked for overlap before the other and is thus ignored. Sometimes you just want to set the dates and not enforce validation. Do remember, you need to validate the dates yourself before setting them. If the start comes after the end or vice versa you will run into serious drawing issues and strange behavior.- Parameters:
revisedStart
- New revised start datevalidate
- true if to validate the date as normal, false to just set the date as is.
-
setRevisedDates
public void setRevisedDates(java.util.Calendar revisedStart, java.util.Calendar revisedEnd, int order)
Another utility method for setting new dates but this method enforces the usual validation. The difference here is that you can tell the method in which order the new dates should be set. If you say left to right, the start is set first, the end last.- Parameters:
revisedStart
- Revised start daterevisedEnd
- Revised end dateorder
-SWT.LEFT_TO_RIHT
orSWT.RIGHT_TO_LEFT
-
isLocked
public boolean isLocked()
Whether this event is locked or not.- Returns:
- true if event is locked.
-
setLocked
public void setLocked(boolean locked)
Sets whether this event is locked or not.- Parameters:
locked
- true if locked
-
getGradientStatusColor
public org.eclipse.swt.graphics.Color getGradientStatusColor()
Returns the status color used as part of the gradient colors used to draw the event.- Returns:
- Gradient color
-
setGradientStatusColor
public void setGradientStatusColor(org.eclipse.swt.graphics.Color gradientStatusColor)
Sets the status color used as part of the gradient colors used to draw the event.- Parameters:
gradientStatusColor
- Gradient color
-
getStatusColor
public org.eclipse.swt.graphics.Color getStatusColor()
Returns the status color of this event. This is also used for drawing gradients.- Returns:
- Status color
-
setStatusColor
public void setStatusColor(org.eclipse.swt.graphics.Color statusColor)
Sets the status color of this event. This is also used for drawing gradients.- Parameters:
statusColor
- Status color
-
showBoldText
public boolean showBoldText()
Whether to show the display name in bold text or not.- Returns:
- true if to show bold text
-
setShowBoldText
public void setShowBoldText(boolean showBoldText)
Sets whether to show the display name in bold text or not.- Parameters:
showBoldText
- Set to true if to show bold text
-
getBounds
public org.eclipse.swt.graphics.Rectangle getBounds()
Returns the bounds of this event (do note that events may have no bounds if they are invisible or hidden and will not get actual bounds set until they are shown).- Returns:
- Bounds
-
getTextDisplayFormat
public java.lang.String getTextDisplayFormat()
Returns the text display format of this event. Please see ISettings.getTextDisplayFormat() for an overview. If this method returns null, whatever is set in the settings will be used.- Returns:
- Text format or null
- See Also:
ISettings.getTextDisplayFormat()
-
setTextDisplayFormat
public void setTextDisplayFormat(java.lang.String format)
Sets the text display format of this event. Please see ISettings.getTextDisplayFormat() for an overview.- See Also:
ISettings.getTextDisplayFormat()
-
setScope
public void setScope(boolean scope)
Sets this event to be a scope. Don't forget to add events that the scope is supposed to encompass withaddScopeEvent(GanttEvent)
.- Parameters:
scope
-- See Also:
addScopeEvent(GanttEvent)
-
isScope
public boolean isScope()
Returns whether this is a scope or not.- Returns:
- true if scope
-
addScopeEvent
public void addScopeEvent(GanttEvent event)
Adds an event that this event should cover if it has been set to be a scope.- Parameters:
event
- GanttEvent to encompass
-
removeScopeEvent
public void removeScopeEvent(GanttEvent event)
Removes event that this event encompasses as a scope.- Parameters:
event
- GanttEvent
-
getScopeEvents
public java.util.List getScopeEvents()
Returns the list of GanttEvents that the scope encompasses.- Returns:
- List of events
-
getEarliestOrLatestScopeEvent
private GanttEvent getEarliestOrLatestScopeEvent(boolean earliest)
-
getEarliestScopeEvent
public GanttEvent getEarliestScopeEvent()
Returns the event that has the earliest date of all events in a scope.- Returns:
- Earliest event or null if none
-
getLatestScopeEvent
public GanttEvent getLatestScopeEvent()
Returns the event that has the latest date of all events in a scope.- Returns:
- Latest event or null if none
-
getPicture
public org.eclipse.swt.graphics.Image getPicture()
Returns the picture image for this event.- Returns:
- Picture
-
setPicture
public void setPicture(org.eclipse.swt.graphics.Image picture)
Sets the picture image for this event.- Parameters:
picture
- Image picture
-
setImage
public void setImage(boolean image)
Sets this event to be represented by an image.- Parameters:
image
- true if it's an image
-
isImage
public boolean isImage()
Returns whether this event is an image representation or not.- Returns:
- true if this event is an image representation
-
getGanttGroup
public GanttGroup getGanttGroup()
Returns what GanttGroup this event belongs to. Grouped events are drawn on the same line. Set null for no group.- Returns:
- GanttGroup
-
setGanttGroup
public void setGanttGroup(GanttGroup group)
Sets what group this event belongs to. Grouped events are drawn on the same line.- Parameters:
group
- GanttGroup or null if none
-
getGanttSection
public GanttSection getGanttSection()
Returns theGanttSection
that this event belongs to, or null if none.- Returns:
- Parent
GanttSection
-
setGanttSection
void setGanttSection(GanttSection ganttSection)
Sets the GanttSection that this event belongs to- Parameters:
ganttSection
-
-
setHidden
public void setHidden(boolean hidden)
Sets if this event should be hidden or not. Hidden events are not shown on the chart and the space they normally would occupy is free.- Parameters:
hidden
- true to hide event.
-
isHidden
public boolean isHidden()
Returns whether this event is hidden or not. Hidden events are not shown on the chart and the space they normally would occupy is free.- Returns:
- true if hidden.
-
internalSetAllChildrenHidden
private void internalSetAllChildrenHidden(boolean hidden)
-
hideAllChildren
public void hideAllChildren()
Hides all children from view. Children only exist on Scoped events.- See Also:
isHidden()
-
showAllChildren
public void showAllChildren()
Un-hides all children from view. Children only exist on Scoped events.- See Also:
isHidden()
-
isChildrenHidden
public boolean isChildrenHidden()
Returns whether all children are hidden or not. Children only exist on Scoped events.- Returns:
- true if all children are hidden.
-
getWidthWithText
public int getWidthWithText()
Returns the full right most x value if event has text or images drawn after it.- Returns:
- x position
-
setWidthWithText
public void setWidthWithText(int width)
Sets the full width of the event width and the text and images that come after it.- Parameters:
width
- x width
-
getAdvancedTooltip
public AdvancedTooltip getAdvancedTooltip()
Returns the currently set Advanced tooltip, or null if none is set.- Returns:
- Advanced tooltip
-
setAdvancedTooltip
public void setAdvancedTooltip(AdvancedTooltip advancedTooltip)
Sets the advanced tooltip. If none is set, a default tooltip will be used.- Parameters:
advancedTooltip
-
-
getFixedRowHeight
public int getFixedRowHeight()
Returns the fixed row height in pixels.- Specified by:
getFixedRowHeight
in interfaceIGanttChartItem
- Returns:
- Fixed row height
-
setFixedRowHeight
public void setFixedRowHeight(int fixedRowHeight)
Sets the fixed row height in pixels.- Specified by:
setFixedRowHeight
in interfaceIGanttChartItem
- Parameters:
fixedRowHeight
- Fixed row height
-
isAutomaticRowHeight
public boolean isAutomaticRowHeight()
Whether the row height is calculated automatically or if it's fixed- Specified by:
isAutomaticRowHeight
in interfaceIGanttChartItem
- Returns:
- true if automatic
-
setAutomaticRowHeight
public void setAutomaticRowHeight()
Resets the row height to be calculated automatically should the row height have been set to a specific value.- Specified by:
setAutomaticRowHeight
in interfaceIGanttChartItem
-
getVerticalEventAlignment
public int getVerticalEventAlignment()
Returns the vertical alignment set. Alignments are only valid if the row height is a fixed value.- Returns:
- Row alignment, one of
SWT.TOP
,SWT.CENTER
,SWT.BOTTOM
. Default isSWT.TOP
.
-
setVerticalEventAlignment
public void setVerticalEventAlignment(int verticalEventAlignment)
Sets the vertical alignment for this event. Alignments are only valid if the row height is a fixed value.- Parameters:
verticalEventAlignment
- one ofSWT.TOP
,SWT.CENTER
,SWT.BOTTOM
-
isResizable
public boolean isResizable()
Whether this event is resizable. If resizing is turned off in the settings this method does nothing.- Returns:
- true if resizable. Default is true.
-
setResizable
public void setResizable(boolean resizable)
Sets this event to be resizable or not. If resizing is turned off in the settings this method does nothing.- Parameters:
resizable
- true to make event resizable.
-
isMoveable
public boolean isMoveable()
Whether this event is moveable. If moving is turned off in the settings this method does nothing.- Returns:
- true if moveable. Default is true.
-
setMoveable
public void setMoveable(boolean moveable)
Sets this event to be moveable or not. If moving is turned off in the settings this method does nothing.- Parameters:
resizable
- true to make event moveable.
-
getNoMoveBeforeDate
public java.util.Calendar getNoMoveBeforeDate()
Returns the date prior to which no moves or resizes are allowed. Any events moved towards or across the date mark will stop at this mark.- Returns:
- Calendar or null.
-
setNoMoveBeforeDate
public void setNoMoveBeforeDate(java.util.Calendar noMoveBeforeDate)
Sets the date prior to which no moves or resizes are allowed. Any events moved towards or across the date mark will stop at this mark.- Parameters:
noMoveBeforeDate
- Calendar or null.
-
getNoMoveAfterDate
public java.util.Calendar getNoMoveAfterDate()
Returns the date after which no moves or resizes are allowed. Any events moved towards or across the date mark will stop at this mark.- Returns:
- Calendar or null.
-
setNoMoveAfterDate
public void setNoMoveAfterDate(java.util.Calendar noMoveAfterDate)
Sets the date after which no moves or resizes are allowed. Any events moved towards or across the date mark will stop at this mark.- Parameters:
noMoveAfterDate
- Calendar or null.
-
getHorizontalTextLocation
public int getHorizontalTextLocation()
Returns the location where the event text will be displayed. Default is SWT.RIGHT.- Returns:
- Event text location
-
setHorizontalTextLocation
public void setHorizontalTextLocation(int textLocation)
Sets the location of where the event text will be displayed. Options are:SWT.LEFT
,SWT.CENTER
,SWT.RIGHT
. Center means the text will be drawn inside the event. Default isSWT.RIGHT
.- Parameters:
textLocation
- Text location, one ofSWT.LEFT
,SWT.CENTER
,SWT.RIGHT
.
-
getVerticalTextLocation
public int getVerticalTextLocation()
Returns the lcoation where the event text will be displayed vertically. Default isSWT.CENTER
which is right behind the event itself.- Returns:
- Vertical text location.
-
setVerticalTextLocation
public void setVerticalTextLocation(int verticalTextLocation)
Sets the vertical location where the event text will be displayed. Options are:SWT.TOP
,SWT.CENTER
,SWT.BOTTOM
. Default isSWT.CENTER
.- Parameters:
verticalTextLocation
- Vertical text location
-
getTextFont
public org.eclipse.swt.graphics.Font getTextFont()
Returns the text font to use when drawing the event text. Default is null.- Returns:
- Event font
-
setTextFont
public void setTextFont(org.eclipse.swt.graphics.Font textFont)
Sets the text font to use when drawing the event text. Default is null. Setting a font will override any flags for font settings in the Settings implementation.- Parameters:
textFont
- Font or null.
-
dispose
public void dispose()
Removes this item from the chart.
-
getActualDDayStart
public int getActualDDayStart()
-
getActualDDayEnd
public int getActualDDayEnd()
-
getDDayStart
public int getDDayStart()
Returns the D-day start value.- Returns:
-
getDDayRevisedStart
public int getDDayRevisedStart()
-
getDDayRevisedEnd
public int getDDayRevisedEnd()
-
setDDayStart
public void setDDayStart(int day)
Sets the D-day start value.- Parameters:
day
-
-
getDDayEnd
public int getDDayEnd()
-
setDDayEnd
public void setDDayEnd(int day)
-
getDDateRange
public int getDDateRange()
-
getRevisedDDateRange
public int getRevisedDDateRange()
-
getActualBounds
public org.eclipse.swt.graphics.Rectangle getActualBounds()
This takes any text drawing widths into account and returns the bounds as such- Returns:
- Rectangle of bounds
-
calculateScope
void calculateScope()
-
hasMovementConstraints
boolean hasMovementConstraints()
-
getVisibility
int getVisibility()
-
setVisibility
void setVisibility(int visibility)
-
isBoundsSet
boolean isBoundsSet()
-
setBoundsSet
void setBoundsSet(boolean set)
-
setHorizontalLineTopY
void setHorizontalLineTopY(int y)
-
getHorizontalLineTopY
int getHorizontalLineTopY()
-
getHorizontalLineBottomY
int getHorizontalLineBottomY()
-
setHorizontalLineBottomY
void setHorizontalLineBottomY(int y)
-
setNameChanged
void setNameChanged(boolean changed)
-
isNameChanged
boolean isNameChanged()
-
getNameExtent
org.eclipse.swt.graphics.Point getNameExtent()
-
setNameExtent
void setNameExtent(org.eclipse.swt.graphics.Point extent)
-
getParsedString
java.lang.String getParsedString()
-
setParsedString
void setParsedString(java.lang.String parsed)
-
getDaysBetweenStartAndEnd
int getDaysBetweenStartAndEnd()
-
updateDaysBetweenStartAndEnd
private final void updateDaysBetweenStartAndEnd()
-
moveStarted
void moveStarted(int moveType)
-
getPostMoveOrResizeUndoCommand
IUndoRedoCommand getPostMoveOrResizeUndoCommand()
Call after a move/resize is done to get the command to undo/redo the latest move/resize- Returns:
- Command or null if none of the given move events matched
-
moveCancelled
void moveCancelled()
-
moveFinished
void moveFinished()
-
getScopeParent
public GanttEvent getScopeParent()
Returns the scope parent of this event if it has one.- Returns:
- Scope parent
-
setScopeParent
void setScopeParent(GanttEvent parent)
-
setEarliestStartX
void setEarliestStartX(int x)
-
setLatestEndX
void setLatestEndX(int x)
-
getEarliestStartX
int getEarliestStartX()
-
getLatestEndX
int getLatestEndX()
-
getActualWidth
int getActualWidth()
-
updateActualWidth
void updateActualWidth()
-
flagDragging
void flagDragging()
-
getPreVerticalDragBounds
org.eclipse.swt.graphics.Rectangle getPreVerticalDragBounds()
-
undoVerticalDragging
void undoVerticalDragging()
-
wasVerticallyMovedUp
boolean wasVerticallyMovedUp()
-
hasMovedVertically
boolean hasMovedVertically()
-
reparentToNewGanttSection
public void reparentToNewGanttSection(int index, GanttSection newSection)
Reparents this event from the currentGanttSection
to a newGanttSection
- Parameters:
index
- index to put event at in new sectionnewSection
- new section to put event in
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getParentChart
public GanttChart getParentChart()
Returns the parentGanttChart
- Returns:
GanttChart
-
getParentComposite
public GanttComposite getParentComposite()
Returns the parentGanttComposite
- Returns:
GanttComposite
-
setNoUpdatePlannedDates
public void setNoUpdatePlannedDates(java.util.Calendar start, java.util.Calendar end)
Will update planned dates without question or internal checks. This is used internally, it's not recommended to be used externally.- Parameters:
start
- Date or nullend
- Date or null
-
setNoUpdateRevisedDates
public void setNoUpdateRevisedDates(java.util.Calendar start, java.util.Calendar end)
Will update revised dates without question or internal checks. This is used internally, it's not recommended to be used externally.- Parameters:
start
- Date or nullend
- Date or null
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Clones the GanttEvent and all objects of it (assuming they are cloneable). The clone should be exactly like the original except for a possible few internal flags. The clone does not need to be re-added to the chart, but if it needs to exist below a certain parent it will need to be re-added to that parent (such as a scope).- Overrides:
clone
in classjava.lang.Object
- Throws:
java.lang.CloneNotSupportedException
-
isShowText
public boolean isShowText()
- Returns:
- the _showText
-
setShowText
public void setShowText(boolean _showText)
- Parameters:
_showText
- the _showText to set
-
-