Class EqualLinesManager<R extends Row<?,?,A>,A extends Activity>

java.lang.Object
com.flexganttfx.model.layout.EqualLinesManager<R,A>
Type Parameters:
R - the type of the row
A - the type of the activities
All Implemented Interfaces:
LinesManager<A>
Direct Known Subclasses:
AutoLinesManager

public class EqualLinesManager<R extends Row<?,?,A>,A extends Activity> extends Object implements LinesManager<A>
A lines manager that equally distributes the available row height to all lines.
Since:
1.0
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new lines manager for the given row.
  • Method Summary

    Modifier and Type
    Method
    Description
    final double
    getLineHeight(int lineIndex, double rowHeight)
    Returns the height of the line with the given index.
    int
    getLineIndex(A activity)
    Returns the line index for the given activity.
    getLineLayout(int lineIndex)
    Returns the layout for the line with the given line index.
    final double
    getLineLocation(int lineIndex, double rowHeight)
    Returns the location of the line with the given index.
    final R
    Returns the row for which the manager is used.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EqualLinesManager

      public EqualLinesManager(R row)
      Constructs a new lines manager for the given row. The manager attaches listeners to Row.lineCountProperty() and Row.heightProperty() in order to recalculate the line locations and heights.
      Parameters:
      row - the row for which to use the manager
  • Method Details

    • getRow

      public final R getRow()
      Returns the row for which the manager is used.
      Returns:
      the row
    • getLineLocation

      public final double getLineLocation(int lineIndex, double rowHeight) throws IllegalLineIndexException
      Description copied from interface: LinesManager
      Returns the location of the line with the given index. In most cases the value of the location is somewhere between 0 and Row.getHeight(). Lines are free to overlap each other.
      Specified by:
      getLineLocation in interface LinesManager<R extends Row<?,?,A>>
      Parameters:
      lineIndex - the index of the line
      rowHeight - the height of the row where the line is located
      Returns:
      the location of the given line (y-coordinate)
      Throws:
      IllegalLineIndexException - if no line with the given index exists
    • getLineLayout

      public Layout getLineLayout(int lineIndex) throws IllegalLineIndexException
      Description copied from interface: LinesManager
      Returns the layout for the line with the given line index. A row and each line within a row can have their own layout.
      Specified by:
      getLineLayout in interface LinesManager<R extends Row<?,?,A>>
      Parameters:
      lineIndex - the index of the line
      Returns:
      the layout of the given line
      Throws:
      IllegalLineIndexException - if no line with the given index exists
    • getLineHeight

      public final double getLineHeight(int lineIndex, double rowHeight) throws IllegalLineIndexException
      Description copied from interface: LinesManager
      Returns the height of the line with the given index. In most cases the height is somewhere between 0 and Row.getHeight().
      Specified by:
      getLineHeight in interface LinesManager<R extends Row<?,?,A>>
      Parameters:
      lineIndex - the index of the line
      rowHeight - the height of the row where the line is located
      Returns:
      the height of the given line
      Throws:
      IllegalLineIndexException - if no line with the given index exists
    • getLineIndex

      public int getLineIndex(A activity)
      Description copied from interface: LinesManager
      Returns the line index for the given activity. This method is responsible for placing activities on different lines.
      Specified by:
      getLineIndex in interface LinesManager<R extends Row<?,?,A>>
      Parameters:
      activity - the activity for which a line index is requested
      Returns:
      the line index of the given activity