Module org.tentackle.fx.rdc
Package org.tentackle.fx.rdc
Class DefaultGuiProvider<T extends PersistentDomainObject<T>>
java.lang.Object
org.tentackle.fx.rdc.DefaultGuiProvider<T>
- Type Parameters:
T- the PDOs class
- All Implemented Interfaces:
GuiProvider<T>,TableConfigurationProvider<T>,DomainContextProvider,PdoProvider<T>
- Direct Known Subclasses:
SecurityGuiProvider
public class DefaultGuiProvider<T extends PersistentDomainObject<T>>
extends Object
implements GuiProvider<T>
Default implementation of a
Can be used as an adapter.
GuiProvider.Can be used as an adapter.
- Author:
- harald
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjavafx.scene.input.DragboardcreateDragboard(javafx.scene.Node node) Creates the dragboard for the pdo.Creates a controller to edit or view this object.Creates a controller to search PDOs.javafx.scene.image.ImageViewGets the PDO's icon.
The icon is displayed in trees, for example.Creates the table view for given configuration.javafx.scene.control.TreeItem<T>Creates the tree item for this pdo.voiddropDragboard(javafx.scene.input.Dragboard dragbord) Drops the dragboard on the pdo.voiddropPdo(PersistentDomainObject<?> pdoToDrop) Drops the given PDO on the serviced pdo.booleanReturns whether a controller exists to edit or view this object.booleanReturns whether a finder exists to search for PDOs.Gets the resource bundle for this provider.getPdo()protected org.tentackle.misc.IdentifiableKey<PersistentDomainObject<?>>getPdoKeyFromDragboard(javafx.scene.input.Dragboard dragboard) Gets the PDO key from the dragboard.
The method is provided to simplify implementing DND as only the methodsisDragAccepted(javafx.scene.input.DragEvent)anddropPdo(org.tentackle.pdo.PersistentDomainObject<?>)need to be overridden.<P extends PersistentDomainObject<P>>
StringgetToolTipText(P parent) Gets the tooltip text with respect to the parent object this object is displayed in a tree.Creates a tree cell factory for a treeview.<P extends PersistentDomainObject<P>>
Collection<? extends PersistentDomainObject<?>>getTreeChildObjects(P parent) Gets the childs with respect to the parent object this object is displayed in the current tree.intGets the maximum level of expansion allowed in a navigatable object tree.
The default is 0, i.e.<P extends PersistentDomainObject<P>>
Collection<? extends PersistentDomainObject<?>>getTreeParentObjects(P parent) Gets the parents with respect to the parent object this object is displayed in the current tree.Gets the object to be displayed in trees in place of this object.<P extends PersistentDomainObject<P>>
StringgetTreeText(P parent) Gets the tree text with respect to the parent object this object is displayed in a tree.booleanReturns whether a resource bundle is provided.booleanisDragAccepted(javafx.scene.input.DragEvent event) Checks whether drag over the pdo is accepted.booleanReturns whether the editor allows editing of the current pdo.booleanReturns whether the editor allows viewing of the current pdo.booleanDetermines whether this object may have child objects that should be visible in a navigatable tree.booleanDetermines whether the navigatable object tree should show the parents of this object.
Objects may be childs of different parents in terms of "being referenced from" or any other relation, for example: the warehouses this customer visited.voidSets the PDO.booleanDetermines whether tree explansion should stop at this object.
Sometimes treechilds should not be expanded if in a recursive "expand all".toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.tentackle.pdo.DomainContextProvider
on, opMethods inherited from interface org.tentackle.pdo.PdoProvider
on
-
Constructor Details
-
DefaultGuiProvider
Creates a default GUI provider.- Parameters:
pdo- the PDO
-
-
Method Details
-
isBundleProvided
public boolean isBundleProvided()Returns whether a resource bundle is provided.- Specified by:
isBundleProvidedin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Returns:
- true if provided, false if no bundle
-
getBundle
Gets the resource bundle for this provider.Throws
MissingResourceExceptionif no bundle found.- Specified by:
getBundlein interfaceGuiProvider<T extends PersistentDomainObject<T>>- Returns:
- the resource bundle
-
getPdo
- Specified by:
getPdoin interfacePdoProvider<T extends PersistentDomainObject<T>>
-
setPdo
Sets the PDO.- Parameters:
pdo- the pdo
-
getDomainContext
- Specified by:
getDomainContextin interfaceDomainContextProvider
-
createIcon
public javafx.scene.image.ImageView createIcon()Description copied from interface:GuiProviderGets the PDO's icon.
The icon is displayed in trees, for example.- Specified by:
createIconin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Returns:
- the icon
-
editorExists
public boolean editorExists()Description copied from interface:GuiProviderReturns whether a controller exists to edit or view this object.- Specified by:
editorExistsin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Returns:
- true if a controller exists
- See Also:
-
isEditAllowed
public boolean isEditAllowed()Description copied from interface:GuiProviderReturns whether the editor allows editing of the current pdo.- Specified by:
isEditAllowedin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Returns:
- true if editing allowed, always false if !editorExists
-
isViewAllowed
public boolean isViewAllowed()Description copied from interface:GuiProviderReturns whether the editor allows viewing of the current pdo.- Specified by:
isViewAllowedin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Returns:
- true if viewing allowed, always false if !editorExists
-
createEditor
Description copied from interface:GuiProviderCreates a controller to edit or view this object.- Specified by:
createEditorin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Returns:
- the controller
-
finderExists
public boolean finderExists()Description copied from interface:GuiProviderReturns whether a finder exists to search for PDOs.- Specified by:
finderExistsin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Returns:
- true if controller exists
-
createFinder
Description copied from interface:GuiProviderCreates a controller to search PDOs.- Specified by:
createFinderin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Returns:
- the controller
-
createDragboard
public javafx.scene.input.Dragboard createDragboard(javafx.scene.Node node) Description copied from interface:GuiProviderCreates the dragboard for the pdo.- Specified by:
createDragboardin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Parameters:
node- the drag source- Returns:
- the dragboard, null if PDO is not a DnD source
-
isDragAccepted
public boolean isDragAccepted(javafx.scene.input.DragEvent event) Description copied from interface:GuiProviderChecks whether drag over the pdo is accepted.- Specified by:
isDragAcceptedin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Parameters:
event- the drag event- Returns:
- true if accepted, false if PDO does not accept the drag
-
getPdoKeyFromDragboard
protected org.tentackle.misc.IdentifiableKey<PersistentDomainObject<?>> getPdoKeyFromDragboard(javafx.scene.input.Dragboard dragboard) Gets the PDO key from the dragboard.
The method is provided to simplify implementing DND as only the methodsisDragAccepted(javafx.scene.input.DragEvent)anddropPdo(org.tentackle.pdo.PersistentDomainObject<?>)need to be overridden.- Parameters:
dragboard- the dragboard- Returns:
- the key, null if dragboard's string is null or empty
-
dropDragboard
public void dropDragboard(javafx.scene.input.Dragboard dragbord) Description copied from interface:GuiProviderDrops the dragboard on the pdo.- Specified by:
dropDragboardin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Parameters:
dragbord- the dragboard
-
dropPdo
Drops the given PDO on the serviced pdo.- Parameters:
pdoToDrop- the PDO to drop
-
createTableConfiguration
- Specified by:
createTableConfigurationin interfaceTableConfigurationProvider<T extends PersistentDomainObject<T>>
-
createTableView
Description copied from interface:GuiProviderCreates the table view for given configuration.- Specified by:
createTableViewin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Returns:
- the view
-
toString
-
providesTreeChildObjects
public boolean providesTreeChildObjects()Description copied from interface:GuiProviderDetermines whether this object may have child objects that should be visible in a navigatable tree.- Specified by:
providesTreeChildObjectsin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Returns:
- true if object may have childs
-
getTreeChildObjects
public <P extends PersistentDomainObject<P>> Collection<? extends PersistentDomainObject<?>> getTreeChildObjects(P parent) Description copied from interface:GuiProviderGets the childs with respect to the parent object this object is displayed in the current tree.- Specified by:
getTreeChildObjectsin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Type Parameters:
P- the parent PDO type- Parameters:
parent- the parent object of this object in the tree, null = no parent- Returns:
- the childs
-
getTreeExpandMaxDepth
public int getTreeExpandMaxDepth()Description copied from interface:GuiProviderGets the maximum level of expansion allowed in a navigatable object tree.
The default is 0, i.e. no limit.- Specified by:
getTreeExpandMaxDepthin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Returns:
- the maximum depth of a subtree of this object, 0 = no limit (default)
-
providesTreeParentObjects
public boolean providesTreeParentObjects()Description copied from interface:GuiProviderDetermines whether the navigatable object tree should show the parents of this object.
Objects may be childs of different parents in terms of "being referenced from" or any other relation, for example: the warehouses this customer visited. Trees may provide a button to make these parents visible. The default implementation returns false.- Specified by:
providesTreeParentObjectsin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Returns:
- true if showing parents is enabled
-
getTreeParentObjects
public <P extends PersistentDomainObject<P>> Collection<? extends PersistentDomainObject<?>> getTreeParentObjects(P parent) Description copied from interface:GuiProviderGets the parents with respect to the parent object this object is displayed in the current tree.- Specified by:
getTreeParentObjectsin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Type Parameters:
P- the parent PDO type- Parameters:
parent- the parent object, null if no parent- Returns:
- the parents
-
getTreeRoot
Description copied from interface:GuiProviderGets the object to be displayed in trees in place of this object.- Specified by:
getTreeRootin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Returns:
- the object to be displayed in a tree
-
getTreeText
Description copied from interface:GuiProviderGets the tree text with respect to the parent object this object is displayed in a tree.- Specified by:
getTreeTextin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Type Parameters:
P- the parent PDO type- Parameters:
parent- is the parent object, null if no parent- Returns:
- the tree text
-
getToolTipText
Description copied from interface:GuiProviderGets the tooltip text with respect to the parent object this object is displayed in a tree.- Specified by:
getToolTipTextin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Type Parameters:
P- the parent PDO type- Parameters:
parent- is the parent object, null if no parent- Returns:
- the tooltip text
-
stopTreeExpansion
public boolean stopTreeExpansion()Description copied from interface:GuiProviderDetermines whether tree explansion should stop at this object.
Sometimes treechilds should not be expanded if in a recursive "expand all". However they should expand if the user explicitly wants to. If this method returns true, the tree will not further expand this node automatically (only on demand).- Specified by:
stopTreeExpansionin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Returns:
- true if expansion should stop.
-
createTreeItem
Description copied from interface:GuiProviderCreates the tree item for this pdo.- Specified by:
createTreeItemin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Returns:
- the tree item
-
getTreeCellFactory
public javafx.util.Callback<javafx.scene.control.TreeView<T>,javafx.scene.control.TreeCell<T>> getTreeCellFactory()Description copied from interface:GuiProviderCreates a tree cell factory for a treeview.- Specified by:
getTreeCellFactoryin interfaceGuiProvider<T extends PersistentDomainObject<T>>- Returns:
- the tree cell factory, never null
-