Class AutoLinesManager<R extends Row<?,​?,​A>,​A extends Activity>

  • Type Parameters:
    R - the type of the row that will be managed
    A - the type of the activities that will be managed
    All Implemented Interfaces:
    LinesManager<A>

    public class AutoLinesManager<R extends Row<?,​?,​A>,​A extends Activity>
    extends EqualLinesManager<R,​A>
    A specialized LinesManager used for ensuring that activities will not overlap each other. This manager will create as many inner lines as needed and will calculate the placement of all activities on these lines.
    Since:
    1.2
    • Constructor Detail

      • AutoLinesManager

        public AutoLinesManager​(R row,
                                GraphicsBase<R> graphics)
        Constructs a new automatic lines manager. The constructor requires a reference to the graphics view to lookup various parameters that are needed when the manager queries the activity repository of the row (e.g. the currently displayed temporal unit and the list of layers).
        Parameters:
        row - the managed row
        graphics - the graphics view where the manager will be used
        Since:
        1.2
    • Method Detail

      • getGraphics

        public final GraphicsBase<R> getGraphics()
        Returns the graphics view where the manager will be used.
        Returns:
        the graphics view
        Since:
        1.2
      • setFilter

        public final void setFilter​(Predicate<A> filter)
        Sets a filter that will be used in combination with a Resolver instance to figure out which activities are relevant for the calculation of overlapping activities (clusters). If the predicate returns false then the activity will not be considered when creating the clusters.
        Parameters:
        filter - the filter
      • layout

        public final void layout()
        Triggers a layout of the activities and calculates the line count for the row.
        Since:
        1.2
      • getLineIndex

        public final 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>>
        Overrides:
        getLineIndex in class EqualLinesManager<R extends Row<?,​?,​A>,​A extends Activity>
        Parameters:
        activity - the activity for which a line index is requested
        Returns:
        the line index of the given activity