Class ConnectionVisualSet<T>
java.lang.Object
com.amalgamasimulation.charts.visualsets.VisualSet<T>
com.amalgamasimulation.charts.visualsets.ConnectionVisualSet<T>
- Type Parameters:
T- visual set data elements type
- All Implemented Interfaces:
IBeginEndArgumentPropertyOwner<T>,IUpdatePolicyPropertyOwner,IAbstractChartVisualSet,IGanttChartVisualSet
public class ConnectionVisualSet<T>
extends VisualSet<T>
implements IGanttChartVisualSet, IBeginEndArgumentPropertyOwner<T>
Visual set for drawing arrowed polylines.
Can be drawn on TimeGanttChart.
Used to draw connections or dependencies. Each dependency is defined by a
source and target points, with each of these points being a pair of a
GanttChartRow and an X-axis argument.
- Author:
- Aleksey Kirillov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassInternal class that represents visual element for connection data element.Nested classes/interfaces inherited from class com.amalgamasimulation.charts.visualsets.VisualSet
VisualSet.ContextMenuHandler<T>, VisualSet.UpdatePolicy, VisualSet.VisualElement -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Colorprotected Function<T, Pair<GanttChartRow, Double>> protected Function<T, Pair<GanttChartRow, Double>> protected doubleFields inherited from class com.amalgamasimulation.charts.visualsets.VisualSet
argumentExtractor, contentsToBeginArguments, contentsToEndArguments, contentsToVisualElements, contextMenuHandlers, dataElementsProvider, listeners, maxArgument, maxValueCache, minArgument, minValueCache, mouseEnterHandlers, mouseExitHandlers, mousePressedHandlers, mouseTransparent, name, needsUpdate, oldContentsList, tooltipTextExtractor, updatePolicy, visibilityChangeHandlers, visualElementsList -
Constructor Summary
ConstructorsConstructorDescriptionConnectionVisualSet(String name, Supplier<List<T>> dataElementsProvider, Function<T, Pair<GanttChartRow, Double>> sourceArgumentExtractor, Function<T, Pair<GanttChartRow, Double>> targetArgumentExtractor) Constructs a ConnectionVisualSet with given name, data elements and a set of parameters required to describe a dependency. -
Method Summary
Modifier and TypeMethodDescriptionaddContextMenuHandler(VisualSet.ContextMenuHandler<T> contextMenuHandler) Adds the action to be executed every time a context menu for given data element is called.addMouseEnterHandler(BiConsumer<T, javafx.scene.input.MouseEvent> handler) Adds the action to be executed every time mouse enters to any visual element borders.addMouseExitHandler(BiConsumer<T, javafx.scene.input.MouseEvent> handler) Adds the action to be executed every time the mouse exits the previously entered element's bounds.addMousePressedHandler(BiConsumer<T, javafx.scene.input.MouseEvent> handler) Adds the action to be executed every time a mouse button is pressed.addVisibilityChangeHandler(Consumer<VisibilityChangeDescriptor<? extends IAbstractChartVisualSet>> visibilityChangeHandler) Adds the action to be executed every time the visibility of this VisualSet is changed.createVisualElement(T contents) Creates a new instance ofVisualSet<T>.VisualElementcorresponding to the current VisualSet type.doublegetBeginArgument(T element) Returns the begin X-axis argument of the visual corresponding to the given element.doublegetEndArgument(T element) Returns the end X-axis argument of the visual corresponding to the given element.Returns the line color of the plot.getLineStyle(T element) Returns the currentLineStylefor given data element.doublegetSourceArgument(T element) Returns a source dependency argument for a given data element.getSourceGanttChartRow(T element) Returns a source dependencyGanttChartRowfor a given data element.doublegetTargetArgument(T element) Returns a target dependency argument for a given data element.getTargetGanttChartRow(T element) Returns a target dependencyGanttChartRowfor a given data element.getVisualElements(boolean recalculationRequired) Returns the list of visual elements corresponding to current data elements.doublegetWidth()Returns the line width of the plot, in pixels.setLineColor(Color lineColor) Sets the line color of the plot.setLineStyle(Function<T, LineStyle> lineStyleExtractor) Sets theLineStyleof the lines representing plot data elements.setMouseTransparent(boolean mouseTransparent) Sets the value of the property mouseTransparent.setTooltipText(Function<T, String> tooltipTextExtractor) Adds tooltip text to display when the mouse is hovered over a visual element representing given data element.setUpdatePolicy(VisualSet.UpdatePolicy updatePolicy) Sets the newVisualSet.UpdatePolicyi.e.setWidth(double width) Sets the width of the line, in pixels.Methods inherited from class com.amalgamasimulation.charts.visualsets.VisualSet
addVisualElement, addVisualElement, addVisualSetChangeHandler, clearDependencies, getArgument, getContents, getContextMenuHandlers, getDataElements, getInjectionIndex, getMaxArgument, getMinArgument, getMouseEnterHandlers, getMouseExitHandlers, getMousePressedHandlers, getName, getTooltipText, getUpdatePolicy, getVisibilityChangeHandlers, getVisibleVisualElementIndex, getVisibleVisualElementsCount, isMouseTransparent, isNeedsUpdate, recalculateVisualElements, removeContextMenuHandler, removeMouseEnterHandler, removeMouseExitHandler, removeMousePressedHandler, removeVisibilityChangeHandler, removeVisualElement, removeVisualSetChangeHandler, sortVisualElements, toString, update, updateMinMaxArgumentsValuesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.amalgamasimulation.charts.visualsets.types.IAbstractChartVisualSet
addVisualSetChangeHandler, getContents, getMaxArgument, getMinArgument, getName, getUpdatePolicy, getVisibilityChangeHandlers, getVisibleVisualElementsCount, isMouseTransparent, removeVisibilityChangeHandler, removeVisualSetChangeHandler
-
Field Details
-
lineStyleExtractor
-
lineColor
-
width
protected double width -
sourceArgumentExtractor
-
targetArgumentExtractor
-
-
Constructor Details
-
ConnectionVisualSet
public ConnectionVisualSet(String name, Supplier<List<T>> dataElementsProvider, Function<T, Pair<GanttChartRow, Double>> sourceArgumentExtractor, Function<T, Pair<GanttChartRow, Double>> targetArgumentExtractor) Constructs a ConnectionVisualSet with given name, data elements and a set of parameters required to describe a dependency. The source and target of the dependence are described by pairs from theGanttChartRowand the argument along the X-axis.- Parameters:
name- visual set name is used to sort and name the visual sets on the chartdataElementsProvider- data elements list provider. The provider is invalidated every time the chart is beging redrawnsourceArgumentExtractor- a function that specifies the rule for extracting a source dependency point from a data elementtargetArgumentExtractor- a function that specifies the rule for extracting a target dependency point from a data element
-
-
Method Details
-
setLineColor
Sets the line color of the plot. Transparent and semi-transparent colors are allowed.- Parameters:
lineColor- the line color of the plot- Returns:
- reference to this object
-
setWidth
Sets the width of the line, in pixels.- Parameters:
width- the width of the line, in pixels- Returns:
- reference to this object
-
setLineStyle
Sets theLineStyleof the lines representing plot data elements. TheLineStyleof each line is set independently of theLineStyleof other lines.- Parameters:
lineStyleExtractor- a function that specifies the rule for extracting aLineStylefrom a data element- Returns:
- reference to this object
-
getLineStyle
Returns the currentLineStylefor given data element. -
getWidth
public double getWidth()Returns the line width of the plot, in pixels.- Returns:
- the line color of the plot
-
getLineColor
Returns the line color of the plot.- Returns:
- the line color of the plot
-
getSourceArgument
Returns a source dependency argument for a given data element.- Parameters:
element- data element for which the source dependency point is being checked- Returns:
- a source dependency argument for a given data element
-
getSourceGanttChartRow
Returns a source dependencyGanttChartRowfor a given data element.- Parameters:
element- data element for which the source dependency point is being checked- Returns:
- a source dependency
GanttChartRowfor a given data element
-
getTargetArgument
Returns a target dependency argument for a given data element.- Parameters:
element- data element for which the target dependency point is being checked- Returns:
- a target dependency argument for a given data element
-
getTargetGanttChartRow
Returns a target dependencyGanttChartRowfor a given data element.- Parameters:
element- data element for which the target dependency point is being checked- Returns:
- a target dependency
GanttChartRowfor a given data element
-
getBeginArgument
Description copied from interface:IBeginEndArgumentPropertyOwnerReturns the begin X-axis argument of the visual corresponding to the given element.- Specified by:
getBeginArgumentin interfaceIBeginEndArgumentPropertyOwner<T>- Parameters:
element- data element for which the begin argument is being checked- Returns:
- the begin X-axis argument of the visual corresponding to the given element
-
getEndArgument
Description copied from interface:IBeginEndArgumentPropertyOwnerReturns the end X-axis argument of the visual corresponding to the given element.- Specified by:
getEndArgumentin interfaceIBeginEndArgumentPropertyOwner<T>- Parameters:
element- data element for which the end argument is being checked- Returns:
- the end X-axis argument of the visual corresponding to the given element
-
setTooltipText
Description copied from class:VisualSetAdds tooltip text to display when the mouse is hovered over a visual element representing given data element.- Specified by:
setTooltipTextin classVisualSet<T>- Parameters:
tooltipTextExtractor- a function that specifies the rule for extracting a tooltip text from a data element- Returns:
- reference to this object
-
setUpdatePolicy
Description copied from interface:IAbstractChartVisualSetSets the newVisualSet.UpdatePolicyi.e. the VisualSet update control rule.- Specified by:
setUpdatePolicyin interfaceIAbstractChartVisualSet- Specified by:
setUpdatePolicyin interfaceIUpdatePolicyPropertyOwner- Overrides:
setUpdatePolicyin classVisualSet<T>- Parameters:
updatePolicy- newVisualSet.UpdatePolicyi.e. the VisualSet update control rule- Returns:
- reference to this object
-
addContextMenuHandler
public ConnectionVisualSet<T> addContextMenuHandler(VisualSet.ContextMenuHandler<T> contextMenuHandler) Description copied from class:VisualSetAdds the action to be executed every time a context menu for given data element is called.- Overrides:
addContextMenuHandlerin classVisualSet<T>- Parameters:
contextMenuHandler- context menu call action- Returns:
- reference to this object
-
addMouseEnterHandler
public ConnectionVisualSet<T> addMouseEnterHandler(BiConsumer<T, javafx.scene.input.MouseEvent> handler) Description copied from class:VisualSetAdds the action to be executed every time mouse enters to any visual element borders.- Overrides:
addMouseEnterHandlerin classVisualSet<T>- Parameters:
handler- new mouse enter action- Returns:
- reference to this object
-
addMouseExitHandler
public ConnectionVisualSet<T> addMouseExitHandler(BiConsumer<T, javafx.scene.input.MouseEvent> handler) Description copied from class:VisualSetAdds the action to be executed every time the mouse exits the previously entered element's bounds.- Overrides:
addMouseExitHandlerin classVisualSet<T>- Parameters:
handler- new mouse exit action- Returns:
- reference to this object
-
addMousePressedHandler
public ConnectionVisualSet<T> addMousePressedHandler(BiConsumer<T, javafx.scene.input.MouseEvent> handler) Description copied from class:VisualSetAdds the action to be executed every time a mouse button is pressed.- Overrides:
addMousePressedHandlerin classVisualSet<T>- Parameters:
handler- new mouse button pressed action- Returns:
- reference to this object
-
addVisibilityChangeHandler
public ConnectionVisualSet<T> addVisibilityChangeHandler(Consumer<VisibilityChangeDescriptor<? extends IAbstractChartVisualSet>> visibilityChangeHandler) Description copied from interface:IAbstractChartVisualSetAdds the action to be executed every time the visibility of this VisualSet is changed.- Specified by:
addVisibilityChangeHandlerin interfaceIAbstractChartVisualSet- Overrides:
addVisibilityChangeHandlerin classVisualSet<T>- Parameters:
visibilityChangeHandler- visibility change action- Returns:
- reference to this object
-
setMouseTransparent
Description copied from interface:IAbstractChartVisualSetSets the value of the property mouseTransparent. If true, this VisualSet is completely transparent to mouse events. When choosing target for mouse event, VisualSets with mouseTransparent set to true won't be taken into account.- Specified by:
setMouseTransparentin interfaceIAbstractChartVisualSet- Overrides:
setMouseTransparentin classVisualSet<T>- Parameters:
mouseTransparent- new value of property mouseTransparent- Returns:
- reference to this object
-
getVisualElements
public List<ConnectionVisualSet<T>.ConnectionVisualElement> getVisualElements(boolean recalculationRequired) Description copied from interface:IAbstractChartVisualSetReturns the list of visual elements corresponding to current data elements. Cannot be changed by the user.- Specified by:
getVisualElementsin interfaceIAbstractChartVisualSet- Specified by:
getVisualElementsin interfaceIGanttChartVisualSet- Overrides:
getVisualElementsin classVisualSet<T>- Parameters:
recalculationRequired- flag of the need to recalculate the visual elements- Returns:
- the list of visual elements corresponding to current data elements
-
createVisualElement
Description copied from class:VisualSetCreates a new instance ofVisualSet<T>.VisualElementcorresponding to the current VisualSet type.- Specified by:
createVisualElementin classVisualSet<T>- Parameters:
contents- data element for which theVisualSet<T>.VisualElementis being checked- Returns:
- a new instance of
VisualSet<T>.VisualElementcorresponding to the current VisualSet type
-