com.dlsc.flexgantt.model.gantt

## Class DefaultResourceNode<T,S extends ITimelineObject>

- java.lang.Object
- - javax.swing.tree.DefaultMutableTreeNode
  - - com.dlsc.flexgantt.model.treetable.DefaultMutableTreeTableNode<T>
    - - com.dlsc.flexgantt.model.gantt.DefaultGanttChartNode<T,S>
      - - com.dlsc.flexgantt.model.gantt.DefaultResourceNode<T,S>

- Type Parameters:
    `T` - the type of the wrapped user / business object
    `S` - the type of the timeline objects returned by the node
  All Implemented Interfaces:
    IGanttChartNode<S>, IResourceNode<S>, IMutableTreeTableNode, ITreeTableNode, Serializable, Cloneable, Comparator, MutableTreeNode, TreeNode

      public class DefaultResourceNode<T,S extends ITimelineObject>
      extends DefaultGanttChartNode<T,S>
      implements IResourceNode<S>

  The default implementation of a Gantt chart node that represents a resource (e.g. a machine with a minimum and a maximum capacity). It is up to the application to decide whether the values for the minimum and the maximum capacity represent the minimum and maximum capacity used over the entire time horizon or whether these are the the minimum and maximum capacity supported by the machine.

  The default configuration of the node is:

  - Minimum capacity: 0%
  - Maximum capacity: 125%
  - Capacity lines at: 0%, 50%, 100%
  Using a maximum capacity of more than 100% allows the resource row renderer to visualize capacity overallocations.
  Since:
    1.0
  Version:
    $Revision: 1.3 $
  Author:
    Dirk Lemmermann
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class javax.swing.tree.DefaultMutableTreeNode

      `allowsChildren, children, EMPTY_ENUMERATION, parent, userObject`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultResourceNode()` Constructs a new resource node.
    `DefaultResourceNode(boolean allowsChildren)` Constructs a new resource node.
    `DefaultResourceNode(T userObject)` Constructs a new resource node.
    `DefaultResourceNode(T userObject, boolean allowsChildren)` Constructs a new resource node.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMajorCapacityLine(CapacityLine line)` Adds the given major capacity line to the resource node.
    `void` | `addMinorCapacityLine(CapacityLine line)` Adds the given minor capacity line to the resource node.
    `void` | `clearMajorCapacityLines()` Removes all major capacity lines from the resource node.
    `void` | `clearMinorCapacityLines()` Removes all minor capacity lines from the resource node.
    `double` | `getCapacityAt(int rowHeight, int y)` Returns the capacity value for the given y coordinate.
    `List<CapacityLine>` | `getCapacityLines(int rowHeight, boolean major)` Returns a list of capacity lines that can be picked up by row renderers to draw a nice scale in the background of the resource row.
    `int` | `getCapacityLocation(int rowHeight, double capacity)` Returns the location / y-coordinate of a given capacity for a given row height.
    `double` | `getMaximumCapacity()` Returns the maximum capacity of the resource node.
    `double` | `getMinimumCapacity()` Returns the minimum capacity of the resource node.
    `void` | `removeMajorCapacityLine(CapacityLine line)` Removes the given major capacity line from the resource node.
    `void` | `removeMinorCapacityLine(CapacityLine line)` Removes the given minor capacity line from the resource node.
    `void` | `setMaximumCapacity(double capacity)` Sets the maximum capacity of the resource node.
    `void` | `setMinimumCapacity(double capacity)` Sets the minimum capacity of the resource node.

    - ### Methods inherited from class com.dlsc.flexgantt.model.gantt.DefaultGanttChartNode

      `addTimelineObject, addTimelineObjects, addTimelineObjects, clearSpreadsheetValues, clearTimelineObjects, getDropActions, getLineCount, getLineHeight, getLineLocation, getSpreadsheetValue, getTimelineObjects, getTimelineObjects, getTimelineObjectsIterator, getTimelineObjectsIterator, isSelectable, isTimelineObjectCreatableAt, removeTimelineObject, removeTimelineObjects, removeTimelineObjects, setLineCount, setRowHeight, setSpreadsheetValue, setTimelineObject, setTimelineObjects, setTimelineObjects, sortTimelineObjects, validateTimelineObjectList`

    - ### Methods inherited from class com.dlsc.flexgantt.model.treetable.DefaultMutableTreeTableNode

      `add, compare, compare, getColumnValue, getComparator, getDragActions, getDropActions, getKey, getKeyComparator, getPopupObject, getPopupTitleObject, getRowHeaderValue, getRowHeight, getRowHeightMaximum, getRowHeightMinimum, getToolTipText, getTypedUserObject, getUserObject, insert, isDeletable, isKeyEditable, isReassignable, isResizable, isRowLineVisible, isSelectable, isSorting, isValueEditable, setColumnValue, setComparator, setDefaultRowHeight, setDeletable, setDragActions, setKey, setKeyComparator, setKeyEditable, setPopupObject, setPopupTitleObject, setResizable, setRowHeaderValue, setRowHeightMaximum, setRowHeightMinimum, setRowLineVisible, setSelectable, setToolTipText, setTypedUserObject, setUserObject, setValueEditable, sort`

    - ### Methods inherited from class javax.swing.tree.DefaultMutableTreeNode

      `breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObjectPath, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, toString`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.dlsc.flexgantt.model.gantt.IGanttChartNode

      `addTimelineObjects, clearTimelineObjects, getDropActions, getLineCount, getLineHeight, getLineLocation, getSpreadsheetValue, getTimelineObjects, getTimelineObjects, getTimelineObjectsIterator, isSelectable, isTimelineObjectCreatableAt, removeTimelineObjects, setSpreadsheetValue`

    - ### Methods inherited from interface com.dlsc.flexgantt.model.treetable.ITreeTableNode

      `getColumnValue, getDragActions, getDropActions, getKey, getPopupObject, getPopupTitleObject, getRowHeaderValue, getRowHeight, getRowHeightMaximum, getRowHeightMinimum, getToolTipText, isDeletable, isKeyEditable, isReassignable, isResizable, isRowLineVisible, isSelectable, isValueEditable, setColumnValue, setKey, setRowHeaderValue, setRowHeight, sort`

    - ### Methods inherited from interface javax.swing.tree.TreeNode

      `children, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf`

    - ### Methods inherited from interface javax.swing.tree.MutableTreeNode

      `remove, remove, removeFromParent, setParent`

    - ### Methods inherited from interface java.util.Comparator

      `comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- - ### Constructor Detail

    - #### DefaultResourceNode

          public DefaultResourceNode(T userObject,
                                     boolean allowsChildren)

      Constructs a new resource node.
      Parameters:
        `userObject` - the wrapped user / business object
        `allowsChildren` - a flag signalling whether the node allows child nodes at all
      Since:
        1.0

    - #### DefaultResourceNode

          public DefaultResourceNode(T userObject)

      Constructs a new resource node.
      Parameters:
        `userObject` - the wrapped user / business object
      Since:
        1.0

    - #### DefaultResourceNode

          public DefaultResourceNode(boolean allowsChildren)

      Constructs a new resource node.
      Parameters:
        `allowsChildren` - a flag signalling whether the node allows child nodes at all
      Since:
        1.0

    - #### DefaultResourceNode

          public DefaultResourceNode()

      Constructs a new resource node.
      Since:
        1.0

  - ### Method Detail

    - #### getCapacityLines

          public List<CapacityLine> getCapacityLines(int rowHeight,
                                                     boolean major)

      Description copied from interface: `IResourceNode`
      Returns a list of capacity lines that can be picked up by row renderers to draw a nice scale in the background of the resource row.
      Specified by:
        `getCapacityLines` in interface `IResourceNode<S extends ITimelineObject>`
      Parameters:
        `rowHeight` - the height of the row in which the resource gets displayed
        `major` - a flag signalling whether the application queries the major or the minor capacity lines
      Returns:
        a list of capacity lines that can be visualized in the Gantt chart

    - #### getCapacityLocation

          public int getCapacityLocation(int rowHeight,
                                         double capacity)

      Description copied from interface: `IResourceNode`
      Returns the location / y-coordinate of a given capacity for a given row height. This method is required for the correct placing of capacity lines.
      Specified by:
        `getCapacityLocation` in interface `IResourceNode<S extends ITimelineObject>`
      Parameters:
        `rowHeight` - the current height of the row in which the resource node gets displayed
        `capacity` - the capacity for which to return a location
      Returns:
        the location of the given capacity (the y-coordinate within the coordinate space / interval [0, rowHeight])

    - #### getCapacityAt

          public double getCapacityAt(int rowHeight,
                                      int y)

      Description copied from interface: `IResourceNode`
      Returns the capacity value for the given y coordinate. The y coordinate uses the coordinate space of the row, which means that y = 0 is the bottom of the row.
      Specified by:
        `getCapacityAt` in interface `IResourceNode<S extends ITimelineObject>`
      Parameters:
        `rowHeight` - the height of the row
        `y` - the location for which to return a capacity
      Returns:
        the capacity at the given location

    - #### addMajorCapacityLine

          public void addMajorCapacityLine(CapacityLine line)

      Adds the given major capacity line to the resource node.
      Parameters:
        `line` - the capacity line to add
      Since:
        1.0

    - #### removeMajorCapacityLine

          public void removeMajorCapacityLine(CapacityLine line)

      Removes the given major capacity line from the resource node.
      Parameters:
        `line` - the capacity line to remove
      Since:
        1.0

    - #### addMinorCapacityLine

          public void addMinorCapacityLine(CapacityLine line)

      Adds the given minor capacity line to the resource node.
      Parameters:
        `line` - the capacity line to add
      Since:
        1.0

    - #### removeMinorCapacityLine

          public void removeMinorCapacityLine(CapacityLine line)

      Removes the given minor capacity line from the resource node.
      Parameters:
        `line` - the capacity line to remove
      Since:
        1.0

    - #### clearMajorCapacityLines

          public void clearMajorCapacityLines()

      Removes all major capacity lines from the resource node.
      Since:
        1.0

    - #### clearMinorCapacityLines

          public void clearMinorCapacityLines()

      Removes all minor capacity lines from the resource node.
      Since:
        1.0

    - #### getMaximumCapacity

          public double getMaximumCapacity()

      Returns the maximum capacity of the resource node.
      Specified by:
        `getMaximumCapacity` in interface `IResourceNode<S extends ITimelineObject>`
      Returns:
        the maximum capacity of the resource node
      Since:
        1.0

    - #### setMaximumCapacity

          public void setMaximumCapacity(double capacity)

      Sets the maximum capacity of the resource node.
      Parameters:
        `capacity` - the maximum capacity of the resource node
      Since:
        1.0

    - #### getMinimumCapacity

          public double getMinimumCapacity()

      Returns the minimum capacity of the resource node.
      Specified by:
        `getMinimumCapacity` in interface `IResourceNode<S extends ITimelineObject>`
      Returns:
        the minimum capacity of the resource node
      Since:
        1.0

    - #### setMinimumCapacity

          public void setMinimumCapacity(double capacity)

      Sets the minimum capacity of the resource node.
      Parameters:
        `capacity` - the minimum capacity of the resource node
      Since:
        1.0

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.