Module com.flexganttfx.model
Package com.flexganttfx.model.layout
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 rowA
- 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:
Row.getLineCount()
-
Constructor Summary
Constructors Constructor Description EqualLinesManager(R row)
Constructs a new lines manager for the given row. -
Method Summary
Modifier and Type Method Description 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.Layout
getLineLayout(int lineIndex)
Returns the layout for the line with the given line index.double
getLineLocation(int lineIndex, double rowHeight)
Returns the location of the line with the given index.R
getRow()
Returns the row for which the manager is used.
-
Constructor Details
-
EqualLinesManager
Constructs a new lines manager for the given row. The manager attaches listeners toRow.lineCountProperty()
andRow.heightProperty()
in order to recalculate the line locations and heights.- Parameters:
row
- the row for which to use the manager
-
-
Method Details
-
getRow
Returns the row for which the manager is used.- Returns:
- the row
-
getLineLocation
public final double getLineLocation(int lineIndex, double rowHeight) throws IllegalLineIndexExceptionDescription 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 andRow.getHeight()
. Lines are free to overlap each other.- Specified by:
getLineLocation
in interfaceLinesManager<R extends Row<?,?,A>>
- Parameters:
lineIndex
- the index of the linerowHeight
- 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
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 interfaceLinesManager<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 IllegalLineIndexExceptionDescription copied from interface:LinesManager
Returns the height of the line with the given index. In most cases the height is somewhere between 0 andRow.getHeight()
.- Specified by:
getLineHeight
in interfaceLinesManager<R extends Row<?,?,A>>
- Parameters:
lineIndex
- the index of the linerowHeight
- 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
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 interfaceLinesManager<R extends Row<?,?,A>>
- Parameters:
activity
- the activity for which a line index is requested- Returns:
- the line index of the given activity
-