Class Row<P extends Row<?,​?,​?>,​C extends Row<?,​?,​?>,​A extends Activity>

java.lang.Object
com.flexganttfx.model.Row<P,​C,​A>
Type Parameters:
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 the isLeaf() 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"));
     }
 }
 
Since:
1.0