Module org.tentackle.fx.rdc
Package org.tentackle.fx.rdc
Class DefaultGuiProvider<T extends org.tentackle.pdo.PersistentDomainObject<T>>
- java.lang.Object
-
- org.tentackle.fx.rdc.DefaultGuiProvider<T>
-
- Type Parameters:
T- the PDOs class
- All Implemented Interfaces:
GuiProvider<T>,org.tentackle.pdo.DomainContextProvider,org.tentackle.pdo.PdoHolder<T>
- Direct Known Subclasses:
SecurityGuiProvider
public class DefaultGuiProvider<T extends org.tentackle.pdo.PersistentDomainObject<T>> extends java.lang.Object implements GuiProvider<T>
Default implementation of aGuiProvider.
Can be used as an adapter.- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description DefaultGuiProvider(T pdo)Creates a default GUI provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javafx.scene.input.DragboardcreateDragboard(javafx.scene.Node node)Creates the dragboard for the pdo.PdoEditor<T>createEditor()Creates a controller to edit or view this object.PdoFinder<T>createFinder()Creates a controller to search PDOs.javafx.scene.image.ImageViewcreateIcon()Gets the PDO's icon.
The icon is displayed in trees, for example.org.tentackle.fx.table.TableConfiguration<T>createTableConfiguration()Creates the table configuration.org.tentackle.fx.component.FxTableView<T>createTableView()Creates the table view for given configuration.javafx.scene.control.TreeCell<T>createTreeCell()Creates a tree cell for this type of pdo.javafx.scene.control.TreeItem<T>createTreeItem()Creates the tree item for this pdo.voiddropDragboard(javafx.scene.input.Dragboard dragbord)Drops the dragboard on the pdo.voiddropPdo(org.tentackle.pdo.PersistentDomainObject<?> pdoToDrop)Drops the given PDO on the serviced pdo.booleaneditorExists()Returns whether a controller exists to edit or view this object.booleanfinderExists()Returns whether a finder exists to search for PDOs.java.util.ResourceBundlegetBundle()Gets the resource bundle for this provider.org.tentackle.pdo.DomainContextgetDomainContext()TgetPdo()org.tentackle.misc.IdentifiableKey<org.tentackle.pdo.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 org.tentackle.pdo.PersistentDomainObject<P>>
java.lang.StringgetToolTipText(P parent)Gets the tooltip text with respect to the parent object this object is displayed in a tree.<P extends org.tentackle.pdo.PersistentDomainObject<P>>
java.util.Collection<? extends org.tentackle.pdo.PersistentDomainObject<?>>getTreeChildObjects(P parent)Gets the childs with respect to the parent object this object is displayed in the current tree.intgetTreeExpandMaxDepth()Gets the maximum level of expansion allowed in a navigatable object tree.
The default is 0, i.e.<P extends org.tentackle.pdo.PersistentDomainObject<P>>
java.util.Collection<? extends org.tentackle.pdo.PersistentDomainObject<?>>getTreeParentObjects(P parent)Gets the parents with respect to the parent object this object is displayed in the current tree.TgetTreeRoot()Gets the object to be displayed in trees in place of this object.<P extends org.tentackle.pdo.PersistentDomainObject<P>>
java.lang.StringgetTreeText(P parent)Gets the tree text with respect to the parent object this object is displayed in a tree.booleanisBundleProvided()Returns whether a resource bundle is provided.booleanisDragAccepted(javafx.scene.input.DragEvent event)Checks whether drag over the pdo is accepted.booleanprovidesTreeChildObjects()Determines whether this object may have child objects that should be visible in a navigatable tree.booleanprovidesTreeParentObjects()Determines 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.voidsetPdo(T pdo)booleanstopTreeExpansion()Determines whether tree explansion should stop at this object.
Sometimes treechilds should not be expanded if in a recursive "expand all".java.lang.StringtoString()
-
-
-
Constructor Detail
-
DefaultGuiProvider
public DefaultGuiProvider(T pdo)
Creates a default GUI provider.- Parameters:
pdo- the PDO
-
-
Method Detail
-
isBundleProvided
public boolean isBundleProvided()
Description copied from interface:GuiProviderReturns whether a resource bundle is provided.- Specified by:
isBundleProvidedin interfaceGuiProvider<T extends org.tentackle.pdo.PersistentDomainObject<T>>- Returns:
- true if provided, false if no bundle
-
getBundle
public java.util.ResourceBundle getBundle()
Description copied from interface:GuiProviderGets the resource bundle for this provider.Throws
MissingResourceExceptionif no bundle found.- Specified by:
getBundlein interfaceGuiProvider<T extends org.tentackle.pdo.PersistentDomainObject<T>>- Returns:
- the resource bundle
-
getPdo
public T getPdo()
-
setPdo
public void setPdo(T pdo)
-
getDomainContext
public org.tentackle.pdo.DomainContext getDomainContext()
- Specified by:
getDomainContextin interfaceorg.tentackle.pdo.DomainContextProvider
-
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 org.tentackle.pdo.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 org.tentackle.pdo.PersistentDomainObject<T>>- Returns:
- true if a controller exists
- See Also:
GuiProvider.createEditor()
-
createEditor
public PdoEditor<T> createEditor()
Description copied from interface:GuiProviderCreates a controller to edit or view this object.- Specified by:
createEditorin interfaceGuiProvider<T extends org.tentackle.pdo.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 org.tentackle.pdo.PersistentDomainObject<T>>- Returns:
- true if controller exists
-
createFinder
public PdoFinder<T> createFinder()
Description copied from interface:GuiProviderCreates a controller to search PDOs.- Specified by:
createFinderin interfaceGuiProvider<T extends org.tentackle.pdo.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 org.tentackle.pdo.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 org.tentackle.pdo.PersistentDomainObject<T>>- Parameters:
event- the drag event- Returns:
- true if accepted, false if PDO does not accept the drag
-
getPdoKeyFromDragboard
public org.tentackle.misc.IdentifiableKey<org.tentackle.pdo.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 org.tentackle.pdo.PersistentDomainObject<T>>- Parameters:
dragbord- the dragboard
-
dropPdo
public void dropPdo(org.tentackle.pdo.PersistentDomainObject<?> pdoToDrop)
Drops the given PDO on the serviced pdo.- Parameters:
pdoToDrop- the PDO to drop
-
createTableConfiguration
public org.tentackle.fx.table.TableConfiguration<T> createTableConfiguration()
Description copied from interface:GuiProviderCreates the table configuration.- Specified by:
createTableConfigurationin interfaceGuiProvider<T extends org.tentackle.pdo.PersistentDomainObject<T>>- Returns:
- the table configuration
-
createTableView
public org.tentackle.fx.component.FxTableView<T> createTableView()
Description copied from interface:GuiProviderCreates the table view for given configuration.- Specified by:
createTableViewin interfaceGuiProvider<T extends org.tentackle.pdo.PersistentDomainObject<T>>- Returns:
- the view
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
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 org.tentackle.pdo.PersistentDomainObject<T>>- Returns:
- true if object may have childs
-
getTreeChildObjects
public <P extends org.tentackle.pdo.PersistentDomainObject<P>> java.util.Collection<? extends org.tentackle.pdo.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 org.tentackle.pdo.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 org.tentackle.pdo.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 org.tentackle.pdo.PersistentDomainObject<T>>- Returns:
- true if showing parents is enabled
-
getTreeParentObjects
public <P extends org.tentackle.pdo.PersistentDomainObject<P>> java.util.Collection<? extends org.tentackle.pdo.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 org.tentackle.pdo.PersistentDomainObject<T>>- Type Parameters:
P- the parent PDO type- Parameters:
parent- the parent object, null if no parent- Returns:
- the parents
-
getTreeRoot
public T getTreeRoot()
Description copied from interface:GuiProviderGets the object to be displayed in trees in place of this object.- Specified by:
getTreeRootin interfaceGuiProvider<T extends org.tentackle.pdo.PersistentDomainObject<T>>- Returns:
- the object to be displayed in a tree
-
getTreeText
public <P extends org.tentackle.pdo.PersistentDomainObject<P>> java.lang.String getTreeText(P parent)
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 org.tentackle.pdo.PersistentDomainObject<T>>- Type Parameters:
P- the parent PDO type- Parameters:
parent- is the parent object, null if no parent- Returns:
- the tree text
-
getToolTipText
public <P extends org.tentackle.pdo.PersistentDomainObject<P>> java.lang.String getToolTipText(P parent)
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 org.tentackle.pdo.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 org.tentackle.pdo.PersistentDomainObject<T>>- Returns:
- true if expansion should stop.
-
createTreeItem
public javafx.scene.control.TreeItem<T> createTreeItem()
Description copied from interface:GuiProviderCreates the tree item for this pdo.- Specified by:
createTreeItemin interfaceGuiProvider<T extends org.tentackle.pdo.PersistentDomainObject<T>>- Returns:
- the tree item
-
createTreeCell
public javafx.scene.control.TreeCell<T> createTreeCell()
Description copied from interface:GuiProviderCreates a tree cell for this type of pdo.- Specified by:
createTreeCellin interfaceGuiProvider<T extends org.tentackle.pdo.PersistentDomainObject<T>>- Returns:
- the tree cell
-
-