Module com.flexganttfx.view
Package impl.com.flexganttfx.skin.util
Class Cluster<A extends Activity>
java.lang.Object
impl.com.flexganttfx.skin.util.Cluster<A>
- Type Parameters:
A
- the type of the activities
public final class Cluster<A extends Activity> extends Object
A cluster is a group of activities placed on multiple columns. The activities
can overlap each other within the cluster, but not within a single column.
- See Also:
Resolver.resolve(List, Predicate)
-
Constructor Summary
Constructors Constructor Description Cluster()
-
Method Summary
Modifier and Type Method Description void
add(A activity)
Adds an activity to the cluster.List<A>
getActivities()
Returns all activities within the cluster.int
getColumnCount()
Returns the number of columns that are needed by the cluster in order to display all activities without any overlaps.List<Column<A>>
getColumns()
Returns the list of columns.boolean
intersects(A activity)
Determines if the given activity intersects with the current time bounds of the cluster.Map<A,Placement<A>>
resolve(Predicate<A> filter)
Resolves the conflicts within this cluster by placing the activites in different columns.
-
Constructor Details
-
Cluster
public Cluster()
-
-
Method Details
-
getColumnCount
public int getColumnCount()Returns the number of columns that are needed by the cluster in order to display all activities without any overlaps. This value is only valid after theresolve(Predicate)
method has been called.- Returns:
- the number of columns inside the cluster
-
add
Adds an activity to the cluster.- Parameters:
activity
- the activity
-
getActivities
Returns all activities within the cluster.- Returns:
- the cluster activities
-
intersects
Determines if the given activity intersects with the current time bounds of the cluster. The first activity always intersects with the cluster so that the cluster gets initialized.- Parameters:
activity
- the activity to check- Returns:
- true if the time bounds of the activity intersect with the time bounds of the cluster
-
resolve
Resolves the conflicts within this cluster by placing the activites in different columns. The filter allows the application to ignore some activities when resolving the conflicts.- Parameters:
filter
- a filter used to ignore some of the activities- Returns:
- a map structure containing the placement for each activity within the cluster
-
getColumns
Returns the list of columns. This list is only valid after the methodresolve(Predicate)
has been called.- Returns:
- the list of columns
-