Class TriangleMarkerVisualSet<T>
java.lang.Object
com.amalgamasimulation.charts.visualsets.VisualSet<T>
com.amalgamasimulation.charts.visualsets.TriangleMarkerVisualSet<T>
- Type Parameters:
T- visual set data elements type
- All Implemented Interfaces:
IGanttChartRowPropertyOwner,IUpdatePolicyPropertyOwner,IAbstractChartVisualSet,IGanttChartVisualSet
public class TriangleMarkerVisualSet<T>
extends VisualSet<T>
implements IGanttChartRowPropertyOwner, IGanttChartVisualSet
Visual set for drawing triangle markers.
Can be drawn on AbstractGanttChart.
Usually used in common with a GanttVisualSet to mark specific areas
on gantt-rectangles. The triangle can be drawn in different directions (i.e.
point up or down) and on different sides of the gantt-rectangle (i.e. on
rectangle top or bottom side).
- Author:
- Aleksey Kirillov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum represents the direction of the vertex of the triangle.static enumEnum represents the side of the intended rectangle, relative to which the triangle is drawn.classInternal class that represents visual element for triangle marker 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 Function<T, TriangleMarkerVisualSet.Direction> protected GanttChartRowprotected Function<T, TriangleMarkerVisualSet.Side> Fields 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
ConstructorsConstructorDescriptionTriangleMarkerVisualSet(String name, GanttChartRow ganttChartRow, Supplier<List<T>> elementsProvider, Function<T, Double> argumentExtractor) Constructs a TriangleMarkerVisualSet with given name,GanttChartRow, data elements and arguments extractors, i.e.TriangleMarkerVisualSet(String name, Supplier<List<T>> dataElementsProvider, Function<T, Double> argumentExtractor) Constructs a TriangleMarkerVisualSet with given name, data elements and arguments extractors, i.e. -
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.getBorderColor(T element) Returns the border color for given data element.doublegetBorderWidth(T element) Returns the border width in pixels for given data element.getDirection(T element) Returns the drawingTriangleMarkerVisualSet.Directionfor given data element.getFillColor(T element) Returns the fill color for given data element.Returns the reference to theGanttChartRowrow on which the visuals will be drawndoubleReturns the height in pixels for given data element.doublegetRowHeightFraction(T element) Returns the fraction height of the region in which polyline is drawn.Returns the drawingTriangleMarkerVisualSet.Sidefor given data element.getVisualElements(boolean recalculationRequired) Returns the list of visual elements corresponding to current data elements.doubleReturns the width in pixels for given data element.setBorderColor(Function<T, Color> borderColorExtractor) Sets the border color for each data element.setBorderWidth(Function<T, Double> borderWidthExtractor) Sets the border width in pixels for each data element.setDirection(Function<T, TriangleMarkerVisualSet.Direction> directionExtractor) Sets the drawingTriangleMarkerVisualSet.Directionfor each data element i.e.setFillColor(Function<T, Color> fillColorExtractor) Sets the background color for each data element.Sets the height in pixels for each data element.setMouseTransparent(boolean mouseTransparent) Sets the value of the property mouseTransparent.setRowHeightFraction(Function<T, Double> rowHeightFractionExtractor) Sets the fraction height of the region in which triangle is drawn.setSide(Function<T, TriangleMarkerVisualSet.Side> sideExtractor) Sets the drawingTriangleMarkerVisualSet.Sidefor each data element i.e.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.Sets the width in pixels for each data element.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
-
ganttChartRow
-
rowHeightFractionExtractor
-
sideExtractor
-
directionExtractor
-
widthExtractor
-
heightExtractor
-
borderColorExtractor
-
borderWidthExtractor
-
fillColorExtractor
-
-
Constructor Details
-
TriangleMarkerVisualSet
public TriangleMarkerVisualSet(String name, Supplier<List<T>> dataElementsProvider, Function<T, Double> argumentExtractor) Constructs a TriangleMarkerVisualSet with given name, data elements and arguments extractors, i.e. a functions that specifies the rule for extracting an argument from a data element.- 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 being redrawnargumentExtractor- a function that specifies the rule for extracting an argument from a data element
-
TriangleMarkerVisualSet
public TriangleMarkerVisualSet(String name, GanttChartRow ganttChartRow, Supplier<List<T>> elementsProvider, Function<T, Double> argumentExtractor) Constructs a TriangleMarkerVisualSet with given name,GanttChartRow, data elements and arguments extractors, i.e. a functions that specifies the rule for extracting an argument from a data element.- Parameters:
name- visual set name is used to sort and name the visual sets on the chartganttChartRow-GanttChartRowwhich displays this visual set i.e. the Y-axis valueelementsProvider- data elements list provider. The provider is invalidated every time the chart is being redrawnargumentExtractor- a function that specifies the rule for extracting an argument from a data element
-
-
Method Details
-
setSide
Sets the drawingTriangleMarkerVisualSet.Sidefor each data element i.e. the side of the intended rectangle, relative to which the triangle is drawn.- Parameters:
sideExtractor- theTriangleMarkerVisualSet.Sideextractor, i.e. method returningTriangleMarkerVisualSet.Sidedepending on the data element- Returns:
- the drawing
TriangleMarkerVisualSet.Sidefor each data element
-
setDirection
public TriangleMarkerVisualSet<T> setDirection(Function<T, TriangleMarkerVisualSet.Direction> directionExtractor) Sets the drawingTriangleMarkerVisualSet.Directionfor each data element i.e. the direction of the vertex of the triangle.- Parameters:
directionExtractor- theTriangleMarkerVisualSet.Directionextractor, i.e. method returningTriangleMarkerVisualSet.Directiondepending on the data element- Returns:
- the drawing
TriangleMarkerVisualSet.Directionfor each data element
-
setWidth
Sets the width in pixels for each data element.- Parameters:
widthExtractor- the width in pixels extractor, i.e. method returning width depending on the data element- Returns:
- reference to this object
-
setHeight
Sets the height in pixels for each data element.- Parameters:
heightExtractor- the height in pixels extractor, i.e. method returning height depending on the data element- Returns:
- reference to this object
-
setBorderColor
Sets the border color for each data element. The color may be different for different data elements.- Parameters:
borderColorExtractor- the border color extractor, i.e. method returning color depending on the data element- Returns:
- reference to this object
-
setBorderWidth
Sets the border width in pixels for each data element.- Parameters:
borderWidthExtractor- the border width in pixels extractor, i.e. method returning width depending on the data element- Returns:
- reference to this object
-
setFillColor
Sets the background color for each data element. The color may be different for different data elements.- Parameters:
fillColorExtractor- the background color extractor, i.e. method returning color depending on the data element- Returns:
- reference to this object
-
setRowHeightFraction
public TriangleMarkerVisualSet<T> setRowHeightFraction(Function<T, Double> rowHeightFractionExtractor) Sets the fraction height of the region in which triangle is drawn. The fraction may be different for different data elements. Fraction is calculated relative to the height of the region allocated for correspondingGanttChartRow.The value must be greater than zero and not greater than 1.
The default value is 1.
- Parameters:
rowHeightFractionExtractor- the row height fraction extractor, i.e. method returning row height fraction depending on the data element- Returns:
- the fraction height of the region in which triangle is drawn
-
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
-
getRowHeightFraction
Returns the fraction height of the region in which polyline is drawn.- Parameters:
element- data element for which the fraction height is being checked- Returns:
- the fraction height of the region in which polyline is drawn
-
getSide
Returns the drawingTriangleMarkerVisualSet.Sidefor given data element.- Parameters:
element- data element for which the drawingTriangleMarkerVisualSet.Sideis being checked- Returns:
- the drawing
TriangleMarkerVisualSet.Sidefor given data element
-
getDirection
Returns the drawingTriangleMarkerVisualSet.Directionfor given data element.- Parameters:
element- data element for which the drawingTriangleMarkerVisualSet.Directionis being checked- Returns:
- the drawing
TriangleMarkerVisualSet.Directionfor given data element
-
getWidth
Returns the width in pixels for given data element.- Parameters:
element- data element for which the width in pixels is being checked- Returns:
- the width in pixels for given data element
-
getHeight
Returns the height in pixels for given data element.- Parameters:
element- data element for which the height in pixels is being checked- Returns:
- the height in pixels for given data element
-
getBorderColor
Returns the border color for given data element.- Parameters:
element- data element for which the border color is being checked- Returns:
- the border color for given data element
-
getBorderWidth
Returns the border width in pixels for given data element.- Parameters:
element- data element for which the border width in pixels is being checked- Returns:
- the border width in pixels for given data element
-
getFillColor
Returns the fill color for given data element.- Parameters:
element- data element for which the fill color is being checked- Returns:
- the fill color for given data element
-
getGanttChartRow
Description copied from interface:IGanttChartRowPropertyOwnerReturns the reference to theGanttChartRowrow on which the visuals will be drawn- Specified by:
getGanttChartRowin interfaceIGanttChartRowPropertyOwner- Returns:
- the reference to the
GanttChartRowrow on which the visuals will be drawn
-
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
-
addContextMenuHandler
public TriangleMarkerVisualSet<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 TriangleMarkerVisualSet<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 TriangleMarkerVisualSet<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 TriangleMarkerVisualSet<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 TriangleMarkerVisualSet<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<TriangleMarkerVisualSet<T>.TriangleMarkerVisualElement> 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
-