Class GanttVisualSet<T>
java.lang.Object
com.amalgamasimulation.charts.visualsets.VisualSet<T>
com.amalgamasimulation.charts.visualsets.LabeledVisualSet<T>
com.amalgamasimulation.charts.visualsets.GanttVisualSet<T>
- Type Parameters:
T- visual set data elements type
- All Implemented Interfaces:
IBeginEndArgumentPropertyOwner<T>,IGanttChartRowPropertyOwner,IUpdatePolicyPropertyOwner,IAbstractChartVisualSet,IGanttChartVisualSet
- Direct Known Subclasses:
SlotsVisualSet
public class GanttVisualSet<T>
extends LabeledVisualSet<T>
implements IGanttChartRowPropertyOwner, IGanttChartVisualSet, IBeginEndArgumentPropertyOwner<T>
Visual set for drawing rectangles.
Can be drawn on TimeGanttChart.
Usually it is used to show history of some state changes or schedules within time-related X-axis.
- Author:
- Aleksey Kirillov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassInternal class that represents visual element for gantt data element.Nested classes/interfaces inherited from class com.amalgamasimulation.charts.visualsets.LabeledVisualSet
LabeledVisualSet.LabeledVisualElementNested classes/interfaces inherited from class com.amalgamasimulation.charts.visualsets.VisualSet
VisualSet.ContextMenuHandler<T>, VisualSet.UpdatePolicy, VisualSet.VisualElement -
Field Summary
Fields inherited from class com.amalgamasimulation.charts.visualsets.LabeledVisualSet
labelColorExtractors, labelFontSizeExtractors, labelTextExtractors, labelTextSidesListFields 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
ConstructorsConstructorDescriptionGanttVisualSet(String name, GanttChartRow ganttChartRow, Supplier<List<T>> dataElementsProvider, Function<T, Double> beginArgumentExtractor, Function<T, Double> endArgumentExtractor) Constructs a GanttVisualSet with given name, data elements and begin/end argument extractors, i.e.GanttVisualSet(String name, Supplier<List<T>> dataElementsProvider, Function<T, Double> beginArgumentExtractor, Function<T, Double> endArgumentExtractor) Constructs a GanttVisualSet with given name, data elements and begin/end argument 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.getBackgroundColor(T element) Returns the background color for given data element.doublegetBeginArgument(T element) Returns the begin X-axis argument of the visual corresponding to the given element.getBorderColor(T element) Returns the border color for given data element.getBorderWidth(T element) Returns the border width in pixels for given data element.doublegetEndArgument(T element) Returns the end X-axis argument of the visual corresponding to the given element.Returns the reference to theGanttChartRowrow on which the visuals will be drawndoublegetRowHeightFraction(T element) Returns the fraction height of the region in which polyline is drawn.getVisualElements(boolean recalculationRequired) Returns the list of visual elements corresponding to current data elements.setBackgroundColor(Function<? extends T, Color> backgroundColorExtractor) Sets the background color for each data element.setBorderColor(Function<? extends T, Color> borderColorExtractor) Sets the border color for each data element.setBorderWidth(Function<? extends T, Double> borderWidthExtractor) Sets the border width in pixels for each data element.setLabelText(LabelSide labelSide, Function<? extends T, String> labelTextExtractor, Function<? extends T, Double> labelFontSizeExtractor) Sets the labels of the rectangles representing plot data elements.setLabelText(LabelSide labelSide, Function<? extends T, String> labelTextExtractor, Function<? extends T, Double> labelFontSizeExtractor, Function<? extends T, Color> labelColorExtractor) Sets the labels of the rectangles representing plot data elements.setMouseTransparent(boolean mouseTransparent) Sets the value of the property mouseTransparent.setRowHeightFraction(Function<? extends T, Double> rowHeightFractionExtractor) Sets the fraction height of the region in which rectangle is drawn.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.Methods inherited from class com.amalgamasimulation.charts.visualsets.LabeledVisualSet
getLabelColor, getLabelFontSize, getLabelSides, getLabelTextMethods 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
-
Constructor Details
-
GanttVisualSet
public GanttVisualSet(String name, Supplier<List<T>> dataElementsProvider, Function<T, Double> beginArgumentExtractor, Function<T, Double> endArgumentExtractor) Constructs a GanttVisualSet with given name, data elements and begin/end argument extractors, i.e. a functions that specifies the rule for extracting a begin/end arguments from a data element. Creates a defaultGanttChartRowbased on the given name.- 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 redrawnbeginArgumentExtractor- a function that specifies the rule for extracting a begin argument from a data elementendArgumentExtractor- a function that specifies the rule for extracting an end argument from a data element
-
GanttVisualSet
public GanttVisualSet(String name, GanttChartRow ganttChartRow, Supplier<List<T>> dataElementsProvider, Function<T, Double> beginArgumentExtractor, Function<T, Double> endArgumentExtractor) Constructs a GanttVisualSet with given name, data elements and begin/end argument extractors, i.e. a functions that specifies the rule for extracting a begin/end arguments 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 valuedataElementsProvider- data elements list provider. The provider is invalidated every time the chart is being redrawnbeginArgumentExtractor- a function that specifies the rule for extracting a begin argument from a data elementendArgumentExtractor- a function that specifies the rule for extracting an end argument from a data element
-
-
Method Details
-
setBackgroundColor
Sets the background color for each data element. The color may be different for different data elements.- Parameters:
backgroundColorExtractor- the background color extractor, i.e. method returning color 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. The width may be different for different data elements.- Parameters:
borderWidthExtractor- the border width extractor, i.e. method returning width in pixels depending on the data element- Returns:
- reference to this object
-
setRowHeightFraction
public GanttVisualSet<T> setRowHeightFraction(Function<? extends T, Double> rowHeightFractionExtractor) Sets the fraction height of the region in which rectangle 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 rectangle is drawn
-
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
-
getBackgroundColor
Returns the background color for given data element.- Parameters:
element- data element for which the background color is being checked- Returns:
- the background color 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
-
setLabelText
public GanttVisualSet<T> setLabelText(LabelSide labelSide, Function<? extends T, String> labelTextExtractor, Function<? extends T, Double> labelFontSizeExtractor) Sets the labels of the rectangles representing plot data elements. The label of each rectangle is set independently of the labels on other sides of this rectangle or the labels on other rectangles. The label will not be displayed if the specified text is empty. The label color is generated automatically based on the inverted background color of the rectangle.- Parameters:
labelSide- theLabelSideof bar where the corresponding label will be drawnlabelTextExtractor- the text of the labellabelFontSizeExtractor- the font size of the label- Returns:
- reference to this object
-
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
-
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
-
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
-
setLabelText
public GanttVisualSet<T> setLabelText(LabelSide labelSide, Function<? extends T, String> labelTextExtractor, Function<? extends T, Double> labelFontSizeExtractor, Function<? extends T, Color> labelColorExtractor) Description copied from class:LabeledVisualSetSets the labels of the rectangles representing plot data elements. The label of each rectangle is set independently of the labels on other sides of this rectangle or the labels on other rectangles. The label will not be displayed if the specified text is empty.- Overrides:
setLabelTextin classLabeledVisualSet<T>- Parameters:
labelSide- theLabelSideof rectangle where the corresponding label will be drawnlabelTextExtractor- the text of the labellabelFontSizeExtractor- the font size of the labellabelColorExtractor- the color of the label- Returns:
- reference to this object
-
addContextMenuHandler
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
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
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 GanttVisualSet<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 GanttVisualSet<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
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
-