Top Description Inners Fields Constructors Methods
com.dlsc.workbenchfx

public final Class Workbench

extends Control
Class Inheritance
Imports
com.dlsc.workbenchfx.model.WorkbenchDialog, .WorkbenchDialog.Type, .WorkbenchModule, .WorkbenchOverlay, com.dlsc.workbenchfx.view.WorkbenchPresenter, com.dlsc.workbenchfx.view.controls.GlassPane, .NavigationDrawer, .ToolbarItem, com.dlsc.workbenchfx.view.controls.dialog.DialogControl, com.dlsc.workbenchfx.view.controls.module.Page, .Tab, .Tile, com.google.common.collect.Range, javafx.animation.TranslateTransition, javafx.application.Platform, javafx.beans.binding.Bindings, .DoubleBinding, .DoubleExpression, javafx.beans.property.*, javafx.collections.FXCollections, .ObservableList, .ObservableMap, javafx.event.Event, .EventHandler, javafx.geometry.Pos, .Side, javafx.scene.Node, .Scene, javafx.scene.control.ButtonType, .Control, .MenuItem, .Skin, javafx.scene.layout.Region, .StackPane, javafx.stage.Stage, .WindowEvent, javafx.util.Callback, .Duration, org.slf4j.Logger, .LoggerFactory, java.util.Arrays, .HashMap, .Map, .Objects, java.util.concurrent.CompletableFuture, java.util.function.Consumer

Contains all the model logic for the workbench.
Authors
François Martin, Marco Sanfratello

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final ObjectProperty<WorkbenchModule>
activeModule

Currently active module.

private final ObjectProperty<Node>
private final IntegerProperty
private static final int
private static final int
ANIMATION_DURATION_DRAWER_OPEN

Duration of animations according to material design guidelines.

private final ObservableList<Region>
private static final int
private static final NavigationDrawer
private static final Callback<Workbench, Page>
private static final Callback<Workbench, Tab>
private static final Callback<Workbench, Tile>
private final ObjectProperty<Region>
private final ObjectProperty<Side>
private static final Logger
private static final int
private final Map<WorkbenchModule, CompletableFuture<Boolean>>
moduleCloseableMap

Will close the module without calling WorkbenchModule#destroy() if the corresponding CompletableFuture is completed.

private final ListProperty<WorkbenchModule>
modules

List of all modules.

private final IntegerProperty
private final ObservableList<Region>
private final ListProperty<WorkbenchModule>
openModules

List of all currently open modules.

private final ObservableMap<Region, WorkbenchOverlay>
overlays

Map containing all overlays which have been loaded into the scene graph, with their corresponding model object WorkbenchOverlay.

private final ObjectProperty<Callback<Workbench, Page>>
private final ObjectProperty<Callback<Workbench, Tab>>
tabFactory

The factories which are called when creating Tabs, Tiles and Pages of Tiles for the Views.

private final ObjectProperty<Callback<Workbench, Tile>>
private final ObservableList<ToolbarItem>
private final ObservableList<ToolbarItem>

Constructor Summary

AccessConstructor and Description
public
Workbench()

Default constructor for use with Scene Builder.

private
Workbench(Workbench.WorkbenchBuilder
to use for the setup
builder
)

Constructor for WorkbenchFX by using the WorkbenchBuilder.

Method Summary

Modifier and TypeMethod and Description
public final ReadOnlyObjectProperty<WorkbenchModule>
public final ReadOnlyObjectProperty<Node>
private void
addInitialAnimationHandler(WorkbenchOverlay
for which to prepare the initial animation handler for
workbenchOverlay
,
Side
from which the sliding animation should originate
side
)

Handles the initial animation of an overlay.

public final ReadOnlyIntegerProperty
private void
private void
public static Workbench.WorkbenchBuilder

Returns:

builder object
builder
(WorkbenchModule...
which should be loaded for the application
modules
)

Creates a builder for Workbench.

private int

Returns:

amount of pages
calculateAmountOfPages
()

Calculates the amount of pages of modules (rendered as tiles).

public final void
clearOverlays()

Removes all previously loaded overlays from the scene graph including all references to them, in order to free up memory.

public final boolean

Returns:

true if closing was successful
closeModule
(WorkbenchModule
to be closed
module
)

Closes the module.

public final void
completeModuleCloseable(WorkbenchModule
whose moduleCloseable should be completed
module
)

Completes the moduleCloseable of the module.

protected final Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public final ReadOnlyObjectProperty<Region>
public final ReadOnlyObjectProperty<Side>
public final WorkbenchModule
public final Node
public final int
public final ObservableList<Region>
public final Region
public final Side
private CompletableFuture<Boolean>
getModuleCloseable(WorkbenchModule module)

Returns a CompletableFuture, which upon completion will cause the module to be closed and if there was an ongoing stage closing process, it will re-initiate that process.

public final ObservableList<WorkbenchModule>

Returns:

the list of all loaded modules
getModules
()

Returns a list of the currently loaded modules.

public final int
public final NavigationDrawer
public final ObservableList<MenuItem>
public final ObservableList<Region>
public final ObservableList<WorkbenchModule>

Returns:

an unmodifiableObservableList of the currently open modules.
getOpenModules
()

Returns an unmodifiableObservableList of the currently open modules.

public final ObservableMap<Region, WorkbenchOverlay>

Returns:

a map of all overlays, which have previously been opened, with their corresponding model object WorkbenchOverlay.
getOverlays
()

Returns a map of all overlays, which have previously been opened, with their corresponding model object WorkbenchOverlay.

public final Callback<Workbench, Page>
public final Callback<Workbench, Tab>
public final Callback<Workbench, Tile>
public final ObservableList<ToolbarItem>

Returns:

a list of the currently loaded toolbar controls on the left.
getToolbarControlsLeft
()

Returns a list of the currently loaded toolbar controls on the left.

public final ObservableList<ToolbarItem>

Returns:

a list of the currently loaded toolbar controls on the right.
getToolbarControlsRight
()

Returns a list of the currently loaded toolbar controls on the right.

public final String
getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public final void
hideDialog(WorkbenchDialog
to be hidden
dialog
)

Hides the dialog which was previously shown in the view using showDialog(WorkbenchDialog).

public final void
hideDrawer()

Hides the currently displayed drawer that was previously shown using showDrawer(Region, Side) or showDrawer(Region, Side, int).

public final void
public final boolean

Returns:

true if the overlay was showing and is now hidden
hideOverlay
(Region
to be hidden
overlay
)

Hides the overlay together with its GlassPane, which has previously been shown using Workbench#showOverlay(Region, boolean).

private void
private void
private void
private void
private void
private void
private void
public final boolean
public final IntegerProperty
private ListProperty<WorkbenchModule>
public final void
openAddModulePage()

Goes back to the AddModulePage screen where the user can choose between modules.

public final void
openModule(WorkbenchModule
the module to be opened or null to go to the home view
module
)

Opens the module in a new tab, if it isn't initialized yet or else opens the tab of it.

private ListProperty<WorkbenchModule>
public final ObjectProperty<Callback<Workbench, Page>>
private void
private void
setDrawerShown(Region drawerShown)

private void
setDrawerSideShown(Side drawerSideShown)

public final void
setModulesPerPage(int modulesPerPage)

public final void
public final void
public final void
public final void
pack-priv void
public final WorkbenchDialog

Returns:

the WorkbenchDialog, which will be shown
showConfirmationDialog
(String
of the dialog
title
,
String
of the dialog
message
,
Consumer<ButtonType>
the action to perform when a button of the dialog was pressed, providing the ButtonType that was pressed
onResult
)

Shows a confirmation dialog in the view.

public final WorkbenchDialog

Returns:

the WorkbenchDialog, which will be shown
showDialog
(WorkbenchDialog
to be shown
dialog
)

Shows a WorkbenchDialog in the view.

public final void
showDrawer(Region
to be shown
drawer
,
Side
of the workbench, on which the drawer should be positioned
side
)

Shows the drawer on the defined side in the Workbench.

public final void
showDrawer(Region
to be shown
drawer
,
Side
of the workbench, on which the drawer should be positioned
side
,
int
value between 0 and 100, defining how much maximum coverage the drawer should have or -1, to have the drawer size according to its computed size
percentage
)

Shows the drawer on the defined side in the Workbench, ensuring the drawer doesn't cover more than the specified percentage.

public final WorkbenchDialog

Returns:

the WorkbenchDialog, which will be shown
showErrorDialog
(String
of the dialog
title
,
String
of the dialog
message
,
Consumer<ButtonType>
the action to perform when a button of the dialog was pressed, providing the ButtonType that was pressed
onResult
)

Shows an error dialog in the view.

public final WorkbenchDialog

Returns:

the WorkbenchDialog, which will be shown
showErrorDialog
(String
of the dialog
title
,
String
of the dialog
message
,
Exception
of which the stacktrace should be shown
exception
,
Consumer<ButtonType>
the action to perform when a button of the dialog was pressed, providing the ButtonType that was pressed
onResult
)

Shows an error dialog in the view with a stacktrace of the exception.

public final WorkbenchDialog

Returns:

the WorkbenchDialog, which will be shown
showErrorDialog
(String
of the dialog
title
,
String
of the dialog
message
,
String
about the error
details
,
Consumer<ButtonType>
the action to perform when a button of the dialog was pressed, providing the ButtonType that was pressed
onResult
)

Shows an error dialog in the view with details about the error.

public final WorkbenchDialog

Returns:

the WorkbenchDialog, which will be shown
showInformationDialog
(String
of the dialog
title
,
String
of the dialog
message
,
Consumer<ButtonType>
the action to perform when a button of the dialog was pressed, providing the ButtonType that was pressed
onResult
)

Shows an information dialog in the view.

public final void
public final boolean

Returns:

true if the overlay is not being shown already
showOverlay
(Region
to be shown
overlay
,
boolean
If false (non-blocking), clicking outside of the overlay will cause it to get hidden, together with its GlassPane. If true (blocking), clicking outside of the overlay will not do anything. The overlay itself must call Workbench#hideOverlay(Region) to hide it.
blocking
)

Shows the overlay on top of the view, with a GlassPane in the background.

private boolean

Returns:

true if the overlay is not being shown already
showOverlay
(Region
to be shown
overlay
,
boolean
If false (non-blocking), clicking outside of the overlay will cause it to get hidden, together with its GlassPane. If true (blocking), clicking outside of the overlay will not do anything. The overlay itself must call Workbench#hideOverlay(Region) to hide it.
blocking
,
Side
from which the overlay should be slid when the overlay is being shown or hidden
side
)

Shows the overlay on top of the view, with a GlassPane in the background.

public final WorkbenchDialog

Returns:

the WorkbenchDialog, which will be shown
showWarningDialog
(String
of the dialog
title
,
String
of the dialog
message
,
Consumer<ButtonType>
the action to perform when a button of the dialog was pressed, providing the ButtonType that was pressed
onResult
)

Shows a warning dialog in the view.

private TranslateTransition
slideIn(Region overlay)

private TranslateTransition
slideOut(Region overlay)

public final ObjectProperty<Callback<Workbench, Tab>>
public final ObjectProperty<Callback<Workbench, Tile>>
Inherited from javafx.scene.control.Control:
computeMaxHeightcomputeMaxWidthcomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthcontextMenuPropertyexecuteAccessibleActiongetBaselineOffsetgetClassCssMetaDatagetContextMenugetControlCssMetaDatagetCssMetaDatagetInitialFocusTraversablegetSkingetTooltipisResizablelayoutChildrenqueryAccessibleAttributesetContextMenusetSkinsetTooltipskinPropertytooltipProperty