Class ActivityRef<A extends Activity>

java.lang.Object
com.flexganttfx.model.ActivityRef<A>
Type Parameters:
A - the type of the referenced activity

public final class ActivityRef<A extends Activity>
extends Object
An activity reference is used to precisely identify the location of an activity where the location is a combination of row, layer, and the activity itself. As the same activity can be located on multiple rows and or multiple layers at the same time it is often necessary to work with an activity reference instead of only the activity.
Since:
1.0
  • Constructor Details

    • ActivityRef

      public ActivityRef​(Row<?,​?,​A> row, Layer layer, A activity)
      Constructs a new activity reference.
      Parameters:
      row - the row where the activity is shown
      layer - the model layer where the activity is located (optional)
      activity - the referenced activity
      Since:
      1.0
  • Method Details

    • isPathExpanded

      public boolean isPathExpanded()
      Determines if the entire row path to the activity is currently expanded or not. An activity will not be shown if the tree path to it is not expanded.
      Returns:
      true if the row path to the activity is completely expanded
      Since:
      1.0
    • getRow

      public Row<?,​?,​A> getRow()
      Returns the row where the activity is located.
      Returns:
      the row where the activity is located
      Since:
      1.0
    • getLayer

      public Layer getLayer()
      The layer on which the activity is shown.
      Returns:
      the layer that is displaying the activity
      Since:
      1.0
    • getActivity

      public A getActivity()
      Returns the activity itself.
      Returns:
      the activity
    • getLineIndex

      public int getLineIndex()
      The line index of the activity. This is a convenience method delegating to Row.getLineIndex(Activity) which then delegates to LinesManager.getLineIndex(Activity).
      Returns:
      the line index of the activity
      Since:
      1.0
    • detachFromRow

      public void detachFromRow()
      Removes the activity from the row where it is currently shown.
      Since:
      1.0
      See Also:
      detachFromRow()
    • attachToRow

      public void attachToRow()
      Attaches the activity to its row.
      Since:
      1.0
      See Also:
      Row.addActivity(Layer, Activity)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals​(Object obj)
      Overrides:
      equals in class Object