Class GanttGroup

  • All Implemented Interfaces:
    IGanttChartItem

    public class GanttGroup
    extends AbstractGanttEvent
    implements IGanttChartItem
    A GanttGroup is a group of GanttEvents that will all draw on the same horizontal "line" or "row" in the GanttChart (next to each other instead of vertically arranged). One GanttEvent may only belong to one GanttGroup.

    One GanttEvent can only exist in one GanttGroup. If an event already has a different GanttGroup parent, the old parent will be overwritten and the new one will be set on the event.

    • Field Detail

      • FIXED_ROW_HEIGHT_AUTOMATIC

        public static final int FIXED_ROW_HEIGHT_AUTOMATIC
        See Also:
        Constant Field Values
      • _events

        private final java.util.List _events
      • _fixedRowHeight

        private int _fixedRowHeight
      • _vAlignment

        private int _vAlignment
    • Constructor Detail

      • GanttGroup

        public GanttGroup​(GanttChart parent)
        Creates a new GanttGroup on the given GanttChart.
        Parameters:
        parent - GanttChart parent
    • Method Detail

      • addEvent

        public void addEvent​(GanttEvent event)
        Adds a GanttEvent to this group. Do note that if a GanttEvent exists in another group already, it will end up being moved to the new group.
        Parameters:
        event - GanttEvent to add.
      • removeEvent

        public void removeEvent​(GanttEvent event)
        Removes a GanttEvent from this group.
        Parameters:
        event - GanttEvent to remove.
      • containsEvent

        public boolean containsEvent​(GanttEvent event)
        Checks whether this GanttGroup contains a given GanttEvent.
        Parameters:
        event - GanttEvent to check if it exists in this GanttGroup.
        Returns:
        true if the event is contained in this group.
      • getEventMembers

        public java.util.List getEventMembers()
        Returns a list of all GanttEvents contained in this group.
        Returns:
        List of GanttEvents.
      • getFixedRowHeight

        public int getFixedRowHeight()
        Returns the fixed row height of this group.
        Specified by:
        getFixedRowHeight in interface IGanttChartItem
        Returns:
        Fixed row height.
      • setFixedRowHeight

        public void setFixedRowHeight​(int fixedRowHeight)
        Sets the fixed row height for this group.
        Specified by:
        setFixedRowHeight in interface IGanttChartItem
        Parameters:
        fixedRowHeight - Row height in pixels.
      • isAutomaticRowHeight

        public boolean isAutomaticRowHeight()
        Whether this group is on automatic row height or if the height is fixed.
        Specified by:
        isAutomaticRowHeight in interface IGanttChartItem
        Returns:
        true if row height is calculated automatically.
      • setAutomaticRowHeight

        public void setAutomaticRowHeight()
        Flags this group to use automatic row height calculation.
        Specified by:
        setAutomaticRowHeight in interface IGanttChartItem
      • getVerticalEventAlignment

        public int getVerticalEventAlignment()
        Returns the vertical alignment of all events in this row.
        Returns:
        Vertical alignment.
      • setVerticalEventAlignment

        public void setVerticalEventAlignment​(int vAlignment)
        Sets the vertical alignment of all contained events.
        Parameters:
        vAlignment - Vertical alignment. Valid values are: SWT.TOP, SWT.CENTER, SWT.BOTTOM. Default is SWT.TOP.
      • dispose

        public void dispose()
        Disposes this event from the chart.
      • getTallestEvent

        int getTallestEvent()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object