Klasse Row<P extends Row<?,?,?>, C extends Row<?,?,?>, A extends Activity>
java.lang.Object
com.flexganttfx.model.Row<P,C,A>
- Typparameter:
P- the type of the parent row (example: row is of type "Building" and parent type is "Factory" to express that the factory consists of several buildings).C- the type of the children rows (example: row is of type "Building" and children type is "Machine" to express that the building houses several machines).A- the type of the activities shown in this row (example: row is of type "Building", activities are "ProductionOrders" that are executed in this building).
public abstract class Row<P extends Row<?,?,?>, C extends Row<?,?,?>, A extends Activity>
extends Object
A row object is used to store the activities found on a row of the Gantt
chart. These activities are not stored directly on the row but in an activity
repository (see
getRepository()). The default repository is of type
IntervalTreeActivityRepository and can be replaced by calling
setRepository(ActivityRepository). Activities can be placed on lines
within the row. The row delegates this work to a LinesManager. The
default manager is of type EqualLinesManager. To replace the manager
simply call setLinesManager(LinesManager).
Code Example
public class Aircraft extends Row<Fleet, CrewMember, Flight> {
}
This now allows you to call:
Aircraft aircraft = new Aircraft(); ... Fleet fleet = aircraft.getParent(); List<CrewMember> crew = aircraft.getChildren();
Lazy Loading
Simply override theisLeaf() method to control
whether a row is a parent row or not. Then listen to changes of the expanded
property to load the children when the user toggles the expansion state.
static class HelloLazyRow extends
Row<HelloLazyRow, HelloLazyRow, Activity> {
public HelloLazyRow(String name) {
super(name);
expandedProperty().addListener(it -> loadChildrenLazily());
}
@Override
public boolean isLeaf() {
return false;
}
private void loadChildrenLazily() {
getChildren().add(new HelloLazyRow("Child 1"));
getChildren().add(new HelloLazyRow("Child 2"));
...
getChildren().add(new HelloLazyRow("Child N"));
}
}
- Seit:
- 1.0
-
Eigenschaftsübersicht
EigenschaftenTypEigenschaftBeschreibungfinal BooleanPropertyThe property used to store the expansion state of the row.final DoublePropertyThe property used to store the height of the row.final ObjectProperty<Layout> The property used to store the layout used for laying out the activities that are directly associated with the row (and not on an inner line).final ReadOnlyBooleanPropertyRepresents the TreeItem leaf property, which is true if the TreeItem has no children.final IntegerPropertyThe property used to keep track of the number of inner lines shown by the row.final ObjectProperty<LinesManager<A>> The property used to store theLinesManagerinstance for this row.final DoublePropertyThe property used to store the maximum height of the row.final DoublePropertyThe property used to store the minimum height of the row.final StringPropertyThe property used to store the name of the row.final ReadOnlyObjectProperty<P> Returns a read-only property used to store the parent row of this row.final ObjectProperty<ActivityRepository<A>> The property used to store the activity repository for the row.final ReadOnlyBooleanPropertyThe property used to express whether a row is currently showing in the view or not.final ObjectProperty<Object> The property used to store a row-specific user object.final ObjectProperty<ZoneId> The property used to store the zone ID for this row. -
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final doubleThe default height of a row (24 pixels). -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungRow()Constructs a new row with anIntervalTreeActivityRepositoryand anEqualLinesManager.Constructs a new row with anIntervalTreeActivityRepositoryand anEqualLinesManagerand the given name. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungfinal voidaddActivity(Layer layer, A activity) Adds the given activity for the given layer to this row.final voidRemoves all activities from the row.final voidclearActivities(Layer layer) Removes all activities on the given layer from the row.final BooleanPropertyThe property used to store the expansion state of the row.final ObservableList<Calendar<?>> Returns a list of calendars attached to this row.final ObservableList<C> Returns the list of children of this row.final InstantReturns the earliest time used by the row.final doubleReturns the value of theheightProperty().final InstantReturns the latest time used by the row.final LayoutReturns the value of thelayoutProperty().final intReturns the value of thelineCountProperty().final doublegetLineHeight(int lineIndex) Returns the height of the given inner line.final intgetLineIndex(A activity) Returns the line index for the given activity.final LayoutgetLineLayout(int lineIndex) Returns a line-specific layout for the given line.final doublegetLineLocation(int lineIndex) Returns the location of the given inner line.final LinesManager<A> Returns the value oflinesManagerProperty().final doubleReturns the value ofmaxHeightProperty().final doubleReturns the value of theminHeightProperty().final StringgetName()Returns the value of thenameProperty().final PThe parent of this row.final Row[]getPath()Returns the path to this row, for example [ROOT, Parent1, Parent2, this].final ObservableMap<Object, Object> Returns an observable map of properties on this row.final ActivityRepository<A> Returns the value of therepositoryProperty().final ObjectReturns the value ofuserObjectProperty().final ZoneIdReturns the value of thezoneIdProperty().booleanhasChildren(Predicate predicate) Checks whether the given row has any child rows (no matter how deep) that fulfill the given predicate.final booleanTests if the row has properties.final DoublePropertyThe property used to store the height of the row.final booleanReturns the value of theexpandedProperty().booleanisLeaf()A row is a leaf in the tree table view on the left-hand side of the Gantt chart if it has no children.final booleanReturns the value ofshowingProperty().final ObjectProperty<Layout> The property used to store the layout used for laying out the activities that are directly associated with the row (and not on an inner line).final ReadOnlyBooleanPropertyRepresents the TreeItem leaf property, which is true if the TreeItem has no children.final IntegerPropertyThe property used to keep track of the number of inner lines shown by the row.final ObjectProperty<LinesManager<A>> The property used to store theLinesManagerinstance for this row.final DoublePropertyThe property used to store the maximum height of the row.final DoublePropertyThe property used to store the minimum height of the row.final StringPropertyThe property used to store the name of the row.final ReadOnlyObjectProperty<P> Returns a read-only property used to store the parent row of this row.final voidremoveActivity(Layer layer, A activity) Removes the given activity from the given layer from this row.final ObjectProperty<ActivityRepository<A>> The property used to store the activity repository for the row.final voidsetExpanded(boolean expanded) Sets the value of theexpandedProperty().final voidsetHeight(double height) Sets the value of theheightProperty().final voidSets the value of thelayoutProperty().final voidsetLineCount(int count) Sets the value of thelineCountProperty().final voidsetLinesManager(LinesManager<A> manager) Sets the value oflinesManagerProperty().final voidsetMaxHeight(double height) Sets the value of themaxHeightProperty().final voidsetMinHeight(double height) Sets a new value for theminHeightProperty().final voidSets the value of thenameProperty().final voidsetRepository(ActivityRepository<A> repository) Sets the value of therepositoryProperty().final voidsetUserObject(Object obj) Sets the value ofuserObjectProperty().final voidSets the value of thezoneIdProperty().final ReadOnlyBooleanPropertyThe property used to express whether a row is currently showing in the view or not.toString()final ObjectProperty<Object> The property used to store a row-specific user object.final ObjectProperty<ZoneId> The property used to store the zone ID for this row.
-
Eigenschaftsdetails
-
parent
Returns a read-only property used to store the parent row of this row.- Seit:
- 1.0
- Siehe auch:
-
leaf
Represents the TreeItem leaf property, which is true if the TreeItem has no children.- Seit:
- 1.3
- Siehe auch:
-
expanded
The property used to store the expansion state of the row. The value of this property is needed for controlling the state of the tree items that will be created for the tree table view control on the left-hand side of the Gantt chart.- Seit:
- 1.0
- Siehe auch:
-
showing
The property used to express whether a row is currently showing in the view or not. This information can be useful when deciding whether a row needs to update its activities or not, for example in a lazy-loading scenario.- Seit:
- 1.0
- Siehe auch:
-
layout
The property used to store the layout used for laying out the activities that are directly associated with the row (and not on an inner line).- Seit:
- 1.0
- Siehe auch:
-
repository
The property used to store the activity repository for the row. A repository is used to lookup the activities for a given time interval that needs to be shown on the row.- Seit:
- 1.0
- Siehe auch:
-
name
The property used to store the name of the row.- Seit:
- 1.0
- Siehe auch:
-
height
The property used to store the height of the row.- Seit:
- 1.0
- Siehe auch:
-
minHeight
The property used to store the minimum height of the row. The user will not be able to resize the row to anything smaller than the value of this property.- Seit:
- 1.0
- Siehe auch:
-
maxHeight
The property used to store the maximum height of the row. The user will not be able to resize the row to anything larger than the value of this property.- Seit:
- 1.0
- Siehe auch:
-
userObject
The property used to store a row-specific user object.- Seit:
- 1.0
- Siehe auch:
-
linesManager
The property used to store theLinesManagerinstance for this row. The lines manager is used to control the layout of inner lines and the placement of activities on these lines.- Seit:
- 1.0
- Siehe auch:
-
zoneId
The property used to store the zone ID for this row. Each row can be placed in a different time zone.- Seit:
- 1.0
- Siehe auch:
-
lineCount
The property used to keep track of the number of inner lines shown by the row.- Seit:
- 1.0
- Siehe auch:
-
-
Felddetails
-
DEFAULT_ROW_HEIGHT
public static final double DEFAULT_ROW_HEIGHTThe default height of a row (24 pixels).- Siehe auch:
-
-
Konstruktordetails
-
Row
public Row()Constructs a new row with anIntervalTreeActivityRepositoryand anEqualLinesManager.- Seit:
- 1.0
-
Row
Constructs a new row with anIntervalTreeActivityRepositoryand anEqualLinesManagerand the given name.- Parameter:
name- the name of the row (e.g. "Building 1")- Seit:
- 1.0
-
-
Methodendetails
-
getProperties
Returns an observable map of properties on this row.- Gibt zurück:
- an observable map of properties on this row
-
hasProperties
public final boolean hasProperties()Tests if the row has properties.- Gibt zurück:
- true if node has properties.
-
getParent
The parent of this row. Each row can have only one parent. If a row has no parent, it represents a root in the tree model.- Gibt zurück:
- the parent of this row, or null if the row has no parent.
- Seit:
- 1.0
-
parentProperty
Returns a read-only property used to store the parent row of this row.- Gibt zurück:
- the property used for storing the parent row
- Seit:
- 1.0
- Siehe auch:
-
getPath
Returns the path to this row, for example [ROOT, Parent1, Parent2, this].- Gibt zurück:
- the path to this row
- Seit:
- 1.0
-
getChildren
Returns the list of children of this row.- Gibt zurück:
- the children
- Seit:
- 1.0
-
hasChildren
Checks whether the given row has any child rows (no matter how deep) that fulfill the given predicate.- Parameter:
predicate- the test to perform- Gibt zurück:
- true if the row has any children where the predicate returns true
-
isLeaf
public boolean isLeaf()A row is a leaf in the tree table view on the left-hand side of the Gantt chart if it has no children. This method may of course be overridden by subclasses to support alternate means of defining how a row may be a leaf, but the general premise is the same: a leaf can not be expanded by the user, and as such will not show a disclosure node or respond to expansion requests.- Gibt zurück:
- true if the row is a leaf (has no children rows)
- Seit:
- 1.3
-
leafProperty
Represents the TreeItem leaf property, which is true if the TreeItem has no children.- Gibt zurück:
- a property for determining if the row is a leaf row
- Seit:
- 1.3
- Siehe auch:
-
expandedProperty
The property used to store the expansion state of the row. The value of this property is needed for controlling the state of the tree items that will be created for the tree table view control on the left-hand side of the Gantt chart.- Gibt zurück:
- the expanded property
- Seit:
- 1.0
- Siehe auch:
-
setExpanded
public final void setExpanded(boolean expanded) Sets the value of theexpandedProperty().- Parameter:
expanded- the new value of the expanded property- Seit:
- 1.0
-
isExpanded
public final boolean isExpanded()Returns the value of theexpandedProperty().- Gibt zurück:
- true if the row is expanded
- Seit:
- 1.0
-
showingProperty
The property used to express whether a row is currently showing in the view or not. This information can be useful when deciding whether a row needs to update its activities or not, for example in a lazy-loading scenario.- Gibt zurück:
- the showing property
- Seit:
- 1.0
- Siehe auch:
-
isShowing
public final boolean isShowing()Returns the value ofshowingProperty().- Gibt zurück:
- true if the row is currently showing in the UI
- Seit:
- 1.0
-
layoutProperty
The property used to store the layout used for laying out the activities that are directly associated with the row (and not on an inner line).- Gibt zurück:
- the row layer property
- Seit:
- 1.0
- Siehe auch:
-
getLayout
Returns the value of thelayoutProperty().- Gibt zurück:
- the layout of the row
- Seit:
- 1.0
-
setLayout
Sets the value of thelayoutProperty().- Parameter:
layout- the new row layout- Seit:
- 1.0
-
repositoryProperty
The property used to store the activity repository for the row. A repository is used to lookup the activities for a given time interval that needs to be shown on the row.- Gibt zurück:
- the repository property
- Seit:
- 1.0
- Siehe auch:
-
getRepository
Returns the value of therepositoryProperty().- Gibt zurück:
- the activity repository of the row
- Seit:
- 1.0
-
setRepository
Sets the value of therepositoryProperty().- Parameter:
repository- the new repository to use- Seit:
- 1.0
-
getEarliestTimeUsed
Returns the earliest time used by the row. This is a convenience method delegating toActivityRepository.getEarliestTimeUsed().- Gibt zurück:
- the earliest time used by the row / by the activities of the row / earliest start time of any activity on the row
- Seit:
getLatestTimeUsed(), 1.0
-
getLatestTimeUsed
Returns the latest time used by the row. This is a convenience method delegating toActivityRepository.getLatestTimeUsed().- Gibt zurück:
- the latest time used by the row / by the activities of the row / earliest start time of any activity on the row
- Seit:
getEarliestTimeUsed(), 1.0
-
nameProperty
The property used to store the name of the row.- Gibt zurück:
- the name property
- Seit:
- 1.0
- Siehe auch:
-
getName
Returns the value of thenameProperty().- Gibt zurück:
- the name of the row
- Seit:
- 1.0
-
setName
Sets the value of thenameProperty().- Parameter:
name- the new name of the row- Seit:
- 1.0
-
heightProperty
The property used to store the height of the row.- Gibt zurück:
- the row height property
- Seit:
- 1.0
- Siehe auch:
-
setHeight
public final void setHeight(double height) Sets the value of theheightProperty().- Parameter:
height- the new height of the row- Seit:
- 1.0
-
getHeight
public final double getHeight()Returns the value of theheightProperty().- Gibt zurück:
- the value of the height property
- Seit:
- 1.0
-
minHeightProperty
The property used to store the minimum height of the row. The user will not be able to resize the row to anything smaller than the value of this property.- Gibt zurück:
- the minimum height property
- Seit:
- 1.0
- Siehe auch:
-
setMinHeight
public final void setMinHeight(double height) Sets a new value for theminHeightProperty().- Parameter:
height- the new minimum height- Seit:
- 1.0
-
getMinHeight
public final double getMinHeight()Returns the value of theminHeightProperty().- Gibt zurück:
- the minimum height of the row
- Seit:
- 1.0
-
maxHeightProperty
The property used to store the maximum height of the row. The user will not be able to resize the row to anything larger than the value of this property.- Gibt zurück:
- the maximum height property
- Seit:
- 1.0
- Siehe auch:
-
setMaxHeight
public final void setMaxHeight(double height) Sets the value of themaxHeightProperty().- Parameter:
height- the maximum height of the row- Seit:
- 1.0
-
getMaxHeight
public final double getMaxHeight()Returns the value ofmaxHeightProperty().- Gibt zurück:
- the maximum height of the row
- Seit:
- 1.0
-
userObjectProperty
The property used to store a row-specific user object.- Gibt zurück:
- the user object property
- Seit:
- 1.0
- Siehe auch:
-
getUserObject
Returns the value ofuserObjectProperty().- Gibt zurück:
- the user object associated with this row
- Seit:
- 1.0
-
setUserObject
Sets the value ofuserObjectProperty().- Parameter:
obj- the new user object- Seit:
- 1.0
-
linesManagerProperty
The property used to store theLinesManagerinstance for this row. The lines manager is used to control the layout of inner lines and the placement of activities on these lines.- Gibt zurück:
- the lines manager property
- Seit:
- 1.0
- Siehe auch:
-
getLinesManager
Returns the value oflinesManagerProperty().- Gibt zurück:
- the lines manager for this row
- Seit:
- 1.0
-
setLinesManager
Sets the value oflinesManagerProperty().- Parameter:
manager- the new lines manager- Seit:
- 1.0
-
zoneIdProperty
The property used to store the zone ID for this row. Each row can be placed in a different time zone.- Gibt zurück:
- the zone ID property
- Seit:
- 1.0
- Siehe auch:
-
getZoneId
Returns the value of thezoneIdProperty().- Gibt zurück:
- the zone ID of this row
- Seit:
- 1.0
-
setZoneId
Sets the value of thezoneIdProperty().- Parameter:
zoneId- the new zone ID for this row- Seit:
- 1.0
-
getCalendars
Returns a list of calendars attached to this row. Calendars directly attached to a row can be used to visualize row-specific information, for example "resource availability".- Gibt zurück:
- a list of row-specific calendars
- Seit:
- 1.0
-
lineCountProperty
The property used to keep track of the number of inner lines shown by the row.- Gibt zurück:
- the line count property
- Seit:
- 1.0
- Siehe auch:
-
setLineCount
public final void setLineCount(int count) Sets the value of thelineCountProperty().- Parameter:
count- the new line count for the row- Seit:
- 1.0
-
getLineCount
public final int getLineCount()Returns the value of thelineCountProperty().- Gibt zurück:
- the line count of the row
- Seit:
- 1.0
-
addActivity
Adds the given activity for the given layer to this row. This method delegates toMutableActivityRepository.addActivity(ActivityRef).- Parameter:
layer- the layer where the activity will be displayedactivity- the activity that will be added- Seit:
- 1.0
- Siehe auch:
-
removeActivity
-
clearActivities
public final void clearActivities()Removes all activities from the row.- Seit:
- 1.0
- Siehe auch:
-
clearActivities
Removes all activities on the given layer from the row.- Parameter:
layer- the layer from which to remove all activities- Seit:
- 1.0
- Siehe auch:
-
getLineIndex
Returns the line index for the given activity. This is a convenience method delegating toLinesManager.getLineIndex(Activity).- Parameter:
activity- the activity for which to return a line index- Gibt zurück:
- the line index for the given activity
- Seit:
- 1.0
-
getLineLocation
public final double getLineLocation(int lineIndex) Returns the location of the given inner line. The value returned is usually between 0 andgetHeight().- Parameter:
lineIndex- the index of the line for which to return a location- Gibt zurück:
- the line location y-coordinate
- Seit:
- 1.0
-
getLineHeight
public final double getLineHeight(int lineIndex) Returns the height of the given inner line. The value returned is usually between 0 andgetHeight().- Parameter:
lineIndex- the index of the line for which to return a height- Gibt zurück:
- the height of the line
- Seit:
- 1.0
-
getLineLayout
Returns a line-specific layout for the given line.- Parameter:
lineIndex- the index of the line- Gibt zurück:
- the line layout
- Seit:
- 1.0
-
toString
-