R
- the type of the rows shown by the Gantt chart (e.g. "Aircraft")public class GanttChart<R extends Row<?,?,?>> extends GanttChartBase<R>
setRoot(Row)
- sets the root row.GanttChartBase.getLayers()
- returns the list of layersGanttChartBase.getLinks()
- returns the list of links between activities
The control consists of several children controls:
TreeTableView
: shown on the left-hand side to display a
hierarchical structure of rowsGraphicsBase
: shown on the right-hand side to display a graphical
representation of the model dataTimeline
: shown above the graphics view. The timeline itself
consists of two child controls.Dateline
: displays days, weeks, months, years, etc...Eventline
: displays various time markersGanttChartBase.setDetail(Node)
. The property
sheet displays a lot of properties that are used by the controls, the
renderers, the system layers to fine-tune the appearance of the control. Many
of them can be changed at runtime.
MultiGanttChartContainer
or
DualGanttChartContainer
. When used in one of these containers the
Position
of the Gantt chart becomes important. The control can be the
first chart, the last chart, the only chart, or a chart somewhere in the
middle. A "first" or "only" chart always displays a timeline. A "middle" or
"last" displays a special header (see GanttChartBase.setGraphicsHeader(Node)
). The
containers are also the reason why the control distinguishes between a
timeline (GanttChartBase.getTimeline()
) and a master timeline (
GanttChartBase.getMasterTimeline()
). The master timeline is the one shown by the
"first" chart, while the regular timeline is the one that belongs directly to
an individual Gantt chart instance.
import java.time.Duration; import java.time.Instant; import java.time.temporal.ChronoUnit; import javafx.application.Application; import javafx.scene.Scene; import javafx.stage.Stage; import com.flexganttfx.model.GanttChartModel; import com.flexganttfx.model.Layer; import com.flexganttfx.model.Row; import com.flexganttfx.model.activity.MutableActivityBase; import com.flexganttfx.model.layout.GanttLayout; import com.flexganttfx.view.GanttChart; import com.flexganttfx.view.graphics.GraphicsView; import com.flexganttfx.view.graphics.renderer.ActivityBarRenderer; import com.flexganttfx.view.timeline.Timeline; public class TutorialAircraftFlight extends Application { class FlightData { String flightNo; Instant departureTime = Instant.now(); Instant arrivalTime = Instant.now().plus(Duration.ofHours(6)); public FlightData(String flightNo, int day) { this.flightNo = flightNo; departureTime = departureTime.plus(Duration.ofDays(day)); arrivalTime = arrivalTime.plus(Duration.ofDays(day)); } } class Flight extends MutableActivityBase<FlightData> { public Flight(FlightData data) { setUserObject(data); setName(data.flightNo); setStartTime(data.departureTime); setEndTime(data.arrivalTime); } } class Aircraft extends Row<Aircraft, Aircraft, Flight> { public Aircraft(String name) { super(name); } } public void start(Stage stage) { // Create the root row Aircraft root = new Aircraft("Root"); root.setExpanded(true); // Create the Gantt chart GanttChart<Aircraft> gantt = new GanttChart<>(new FlightSchedule(new Aircraft("ROOT"))); Layer flightsLayer = new Layer("Flights"); gantt.getLayers().add(flightsLayer); Aircraft b747 = new Aircraft("B747"); b747.addActivity(flightsLayer, new Flight(new FlightData("flight1", 1))); b747.addActivity(flightsLayer, new Flight(new FlightData("flight2", 2))); b747.addActivity(flightsLayer, new Flight(new FlightData("flight3", 3))); Aircraft a380 = new Aircraft("A380"); a380.addActivity(flightsLayer, new Flight(new FlightData("flight1", 1))); a380.addActivity(flightsLayer, new Flight(new FlightData("flight2", 2))); a380.addActivity(flightsLayer, new Flight(new FlightData("flight3", 3))); root.getChildren().setAll(b747, a380); Timeline timeline = gantt.getTimeline(); timeline.showTemporalUnit(ChronoUnit.HOURS, 10); GraphicsView<Aircraft> graphics = gantt.getGraphics(); graphics.setActivityRenderer(Flight.class, GanttLayout.class, new ActivityBarRenderer<>(graphics, "Flight Renderer")); graphics.showEarliestActivities(); Scene scene = new Scene(gantt); stage.setScene(scene); stage.sizeToScene(); stage.centerOnScreen(); stage.show(); } public static void main(String[] args) { launch(args); }
Modifier and Type | Class and Description |
---|---|
static class |
GanttChart.DisplayMode
An enum used for specifying how to layout the Gantt chart.
|
static class |
GanttChart.RowHeaderType
An enum used to control the visuals of the cells in the row header
column.
|
Constructor and Description |
---|
GanttChart()
Constructs a new Gantt chart control.
|
GanttChart(R root)
Constructs a new Gantt Chart control.
|
Modifier and Type | Method and Description |
---|---|
void |
collapseRows()
Collapses all rows inside the Gantt chart.
|
void |
collapseRowsByOneLevel()
Collapses the hightest level of rows inside the Gantt chart that is
currently being used.
|
protected javafx.scene.control.Skin<?> |
createDefaultSkin() |
protected RowHeaderColumn<R> |
createRowHeaderColumn()
Creates the row header column used by the Gantt chart.
|
protected javafx.scene.control.TreeTableView<R> |
createTreeTable()
Creates the tree table view instance.
|
javafx.beans.property.ObjectProperty<GanttChart.DisplayMode> |
displayModeProperty()
A property used to specify the mode in which the Gantt chart will layout
its primary views, the table and the graphics.
|
void |
expandRows()
Expands all rows inside the Gantt chart.
|
void |
expandRowsByOneLevel()
Expands the next level of rows inside the Gantt chart.
|
GanttChart.DisplayMode |
getDisplayMode()
Returns the value of
displayModeProperty() . |
R |
getRoot()
Returns the root row of the Gantt chart.
|
RowHeaderColumn<R> |
getRowHeaderColumn()
Returns the row header control used as the first column of the tree table
view.
|
javafx.util.Callback<R,javafx.scene.Node> |
getRowHeaderNodeFactory()
Returns the value of
rowHeaderNodeFactoryProperty() . |
GanttChart.RowHeaderType |
getRowHeaderType()
Returns the value of
rowHeaderTypeProperty() . |
javafx.scene.control.TreeTableView<R> |
getTreeTable()
Returns the
TreeTableView instance that is shown on the left-hand
side of the Gantt chart. |
org.controlsfx.control.MasterDetailPane |
getTreeTableMasterDetailPane()
Returns the primary
MasterDetailPane instance that is being used
to display the TreeTableView and the ListViewGraphics . |
javafx.scene.control.ScrollBar |
getTreeTableScrollBar()
Returns the scrollbar that is being used for horizontal scrolling
operations of the tree table view.
|
boolean |
isShowTreeTable()
Returns the value of
showTreeTableProperty() . |
boolean |
isTableMenuButtonVisible()
Returns the value of
tableMenuButtonVisibleProperty() . |
void |
resizeColumn(javafx.scene.control.TreeTableColumn<R,?> column)
This method will resize the given column in the tree table view to ensure
that the content of the column cells will be completely visible.
|
void |
resizeColumn(javafx.scene.control.TreeTableColumn tc,
int maxRows)
This method will resize the given column in the tree table view to ensure
that the content of the column cells will be completely visible.
|
void |
resizeColumns()
This method will resize all columns in the tree table view to ensure that
the content of all cells will be completely visible.
|
void |
resizeColumns(int maxRows)
This method will resize all columns in the tree table view to ensure that
the content of all cells will be completely visible.
|
javafx.beans.property.ObjectProperty<R> |
rootProperty()
Returns the root row property.
|
javafx.beans.property.ObjectProperty<javafx.util.Callback<R,javafx.scene.Node>> |
rowHeaderNodeFactoryProperty()
A property used to store a callback for creating a node that will be
placed to the left of each row in the tree table view.
|
javafx.beans.property.ObjectProperty<GanttChart.RowHeaderType> |
rowHeaderTypeProperty()
A property used to store the currently used type of row headers (row
number, level number, custom graphics).
|
void |
setDisplayMode(GanttChart.DisplayMode mode)
Sets the value of the
displayModeProperty() . |
void |
setRoot(R root)
Sets a new root on the Gantt chart, which will cause the framework to set
a new root of type
GanttChartTreeItem on the underlying
TreeTableView . |
void |
setRowHeaderNodeFactory(javafx.util.Callback<R,javafx.scene.Node> factory)
Sets the value of
rowHeaderNodeFactoryProperty() . |
void |
setRowHeaderType(GanttChart.RowHeaderType type)
Sets the value of
rowHeaderTypeProperty() . |
void |
setShowTreeTable(boolean show)
Sets the value of
showTreeTableProperty() . |
void |
setTableMenuButtonVisible(boolean value)
Sets the value of
tableMenuButtonVisibleProperty() . |
javafx.beans.property.BooleanProperty |
showTreeTableProperty()
A property used to control whether the tree table view will be shown or
not.
|
javafx.beans.property.BooleanProperty |
tableMenuButtonVisibleProperty()
This controls whether a menu button is available when the user clicks in
a designated space within the TreeTableView, within which is a check menu
item for each column in this table.
|
createGraphics, createTimeline, detailProperty, fixedCellSizeProperty, getCalendars, getDetail, getFixedCellSize, getGraphics, getGraphicsHeader, getGraphicsMasterDetailPane, getLayers, getLinks, getMasterTimeline, getPosition, getRowFilter, getTimeline, getTimelineScrollBar, getUserAgentStylesheet, graphicsHeaderProperty, isShowDetail, masterTimelineProperty, positionProperty, redrawObservable, rowFilterProperty, setDetail, setFixedCellSize, setGraphicsHeader, setMasterTimeline, setPosition, setRowFilter, setShowDetail, showDetailProperty
getUserAgentStylesheet
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getClassCssMetaData, getContextMenu, getControlCssMetaData, getCssMetaData, getSkin, getTooltip, impl_cssGetFocusTraversableInitialValue, impl_processCSS, isResizable, layoutChildren, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinClassNameProperty, skinProperty, tooltipProperty
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getWidth, heightProperty, impl_computeContains, impl_computeGeomBounds, impl_computeLayoutBounds, impl_createPeer, impl_notifyLayoutBoundsChanged, impl_pickNodeLocal, impl_updatePeer, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapSize, snapSpace, snapToPixelProperty, widthProperty
getChildren, getChildrenUnmodifiable, getImpl_traversalEngine, getManagedChildren, getStylesheets, impl_getAllParentStylesheets, impl_processMXNode, impl_traversalEngineProperty, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setImpl_traversalEngine, setNeedsLayout, updateBounds
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, containsBounds, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, hasProperties, hoverProperty, idProperty, impl_clearDirty, impl_computeIntersects, impl_cssGetCursorInitialValue, impl_findStyles, impl_geomChanged, impl_getLeafTransform, impl_getMatchingStyles, impl_getPeer, impl_getPivotX, impl_getPivotY, impl_getPivotZ, impl_getStyleMap, impl_hasTransforms, impl_intersects, impl_intersectsBounds, impl_isDirty, impl_isDirtyEmpty, impl_isShowMnemonics, impl_isTreeVisible, impl_layoutBoundsChanged, impl_markDirty, impl_pickNode, impl_processCSS, impl_reapplyCSS, impl_setShowMnemonics, impl_setStyleMap, impl_showMnemonicsProperty, impl_syncPeer, impl_transformsChanged, impl_traverse, impl_treeVisibleProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visibleProperty
public GanttChart()
public GanttChart(R root)
root
- the root row of the Gantt chartprotected javafx.scene.control.Skin<?> createDefaultSkin()
createDefaultSkin
in class javafx.scene.control.Control
public final javafx.beans.property.ObjectProperty<GanttChart.DisplayMode> displayModeProperty()
public final void setDisplayMode(GanttChart.DisplayMode mode)
displayModeProperty()
.mode
- the new display modepublic final GanttChart.DisplayMode getDisplayMode()
displayModeProperty()
.protected javafx.scene.control.TreeTableView<R> createTreeTable()
public final javafx.beans.property.BooleanProperty tableMenuButtonVisibleProperty()
public final void setTableMenuButtonVisible(boolean value)
tableMenuButtonVisibleProperty()
.value
- if true the menu button will be shown to the userpublic final boolean isTableMenuButtonVisible()
tableMenuButtonVisibleProperty()
.public final javafx.beans.property.ObjectProperty<R> rootProperty()
GanttChartTreeItem
). Other rows can be
added by adding them to the root row or one of its children.Row.getChildren()
public final void setRoot(R root)
GanttChartTreeItem
on the underlying
TreeTableView
.root
- the new root of the modelrootProperty()
public final R getRoot()
public final RowHeaderColumn<R> getRowHeaderColumn()
protected RowHeaderColumn<R> createRowHeaderColumn()
public final javafx.scene.control.ScrollBar getTreeTableScrollBar()
public final javafx.scene.control.TreeTableView<R> getTreeTable()
TreeTableView
instance that is shown on the left-hand
side of the Gantt chart.createTreeTable()
public org.controlsfx.control.MasterDetailPane getTreeTableMasterDetailPane()
MasterDetailPane
instance that is being used
to display the TreeTableView
and the ListViewGraphics
.public final javafx.beans.property.BooleanProperty showTreeTableProperty()
getTreeTableMasterDetailPane()
).MasterDetailPane.detailNodeProperty()
,
MasterDetailPane.setDetailNode(Node)
,
getTreeTableMasterDetailPane()
public final boolean isShowTreeTable()
showTreeTableProperty()
.public final void setShowTreeTable(boolean show)
showTreeTableProperty()
.show
- if true the tree table becomes visiblepublic final javafx.beans.property.ObjectProperty<GanttChart.RowHeaderType> rowHeaderTypeProperty()
GanttChart.RowHeaderType
public final void setRowHeaderType(GanttChart.RowHeaderType type)
rowHeaderTypeProperty()
.type
- the row header type (row number, level number, graphics)public final GanttChart.RowHeaderType getRowHeaderType()
rowHeaderTypeProperty()
.public final javafx.beans.property.ObjectProperty<javafx.util.Callback<R,javafx.scene.Node>> rowHeaderNodeFactoryProperty()
GanttChart.RowHeaderType.GRAPHIC_NODE
.setRowHeaderType(RowHeaderType)
public final void setRowHeaderNodeFactory(javafx.util.Callback<R,javafx.scene.Node> factory)
rowHeaderNodeFactoryProperty()
.factory
- the factory used for creating the row header nodespublic final javafx.util.Callback<R,javafx.scene.Node> getRowHeaderNodeFactory()
rowHeaderNodeFactoryProperty()
.public final void expandRows()
Row.setExpanded(boolean)
,
expandRowsByOneLevel()
,
collapseRows()
,
collapseRowsByOneLevel()
public final void expandRowsByOneLevel()
Row.setExpanded(boolean)
,
expandRows()
,
collapseRows()
,
collapseRowsByOneLevel()
public final void collapseRows()
Row.setExpanded(boolean)
,
collapseRowsByOneLevel()
,
expandRows()
,
expandRowsByOneLevel()
public final void collapseRowsByOneLevel()
Row.setExpanded(boolean)
,
expandRows()
,
collapseRows()
,
collapseRowsByOneLevel()
public final void resizeColumns()
resizeColumn(TreeTableColumn, int)
public final void resizeColumns(int maxRows)
maxRows
- the maximum number of rows that will be considered for the
width calculationsresizeColumn(TreeTableColumn, int)
public final void resizeColumn(javafx.scene.control.TreeTableColumn<R,?> column)
column
- the column that will be resizedresizeColumn(TreeTableColumn, int)
public final void resizeColumn(javafx.scene.control.TreeTableColumn tc, int maxRows)
tc
- the column that will be resizedmaxRows
- the maximum number of rows that will be evaluated for the
width calculationresizeColumn(TreeTableColumn, int)
Copyright © 2020 Dirk Lemmermann Software & Consulting. All rights reserved.