Module org.tentackle.fx.rdc
Package org.tentackle.fx.rdc
Class DefaultPdoEditor<T extends PersistentDomainObject<T>>
- java.lang.Object
-
- org.tentackle.fx.AbstractFxController
-
- org.tentackle.fx.rdc.PdoEditor<T>
-
- org.tentackle.fx.rdc.DefaultPdoEditor<T>
-
- Type Parameters:
T- the PDO type
- All Implemented Interfaces:
FxController,PdoController<T>,DomainContextProvider,PdoProvider<T>,org.tentackle.validate.ScopeConfigurator
public class DefaultPdoEditor<T extends PersistentDomainObject<T>> extends PdoEditor<T>
A default pdo editor.
The view is generated from the PDO model via reflection.
-
-
Constructor Summary
Constructors Constructor Description DefaultPdoEditor(Class<T> pdoClass, ResourceBundle bundle)Creates the default editor from a pdo class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbind(org.tentackle.bind.BindingMember parent, PdoMember attribute, FxComponent node, String bindingOptions)Binds the node to the PDO member.protected javafx.scene.control.LabelcreateLabel(PdoMember attribute)Creates the label.protected FxComponentcreateNode(PdoMember attribute)Creates an FX node for a given PDO attribute.
Attributes must be bindable.protected Map<PdoMember,FxComponent>createNodeMap()Creates a map of attributes to nodes.protected javafx.scene.ParentcreateView(Map<PdoMember,FxComponent> nodes)Creates a view from the nodes map.ResourceBundlegetBundle()Gets the optional resource bundle.protected FxComponentgetFirstFocusableNode(Map<PdoMember,FxComponent> nodes)Gets the first focusable node.TgetPdo()Class<T>getPdoClass()Gets the PDO class.StringgetValidationPath()Gets the validation root path.
By default, the server returns validation results with a validation path that starts with the entity baseclassname (the first character in lowercase).voidrequestInitialFocus()Requests the initial focus after stage is shown.voidsetPdo(T pdo)Sets the PDO.-
Methods inherited from class org.tentackle.fx.rdc.PdoEditor
getDomainContext, getValidationMappers, isChangeable, isEditAllowed, isNewAllowed, isRemoveAllowed, isViewAllowed, print, setChangeable, validateForm
-
Methods inherited from class org.tentackle.fx.AbstractFxController
configure, createBinder, getBinder, getContainer, getDefaultScopes, getFXMLFields, getFXMLMethods, getStage, getView, setView, validateInjections
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.tentackle.pdo.DomainContextProvider
on, op
-
Methods inherited from interface org.tentackle.fx.FxController
configure, getBinder, getContainer, getFXMLFields, getFXMLMethods, getStage, getView, setView, validateInjections
-
Methods inherited from interface org.tentackle.pdo.PdoProvider
on
-
-
-
-
Constructor Detail
-
DefaultPdoEditor
public DefaultPdoEditor(Class<T> pdoClass, ResourceBundle bundle)
Creates the default editor from a pdo class.- Parameters:
pdoClass- the PDO classbundle- the optional resource bundle
-
-
Method Detail
-
getBundle
public ResourceBundle getBundle()
Gets the optional resource bundle.- Returns:
- null if none
-
requestInitialFocus
public void requestInitialFocus()
Description copied from class:PdoEditorRequests the initial focus after stage is shown.- Specified by:
requestInitialFocusin classPdoEditor<T extends PersistentDomainObject<T>>
-
getPdo
public T getPdo()
-
setPdo
public void setPdo(T pdo)
Description copied from interface:PdoControllerSets the PDO.- Parameters:
pdo- the pdo
-
getValidationPath
public String getValidationPath()
Description copied from class:PdoEditorGets the validation root path.
By default, the server returns validation results with a validation path that starts with the entity baseclassname (the first character in lowercase). If the bound PDO variable of the editor uses a different name, aValidationMapperis necessary to map the results back to the form.
This method is provided to reduce the amount of application code.- Overrides:
getValidationPathin classPdoEditor<T extends PersistentDomainObject<T>>- Returns:
- the validation root path, default is null
- See Also:
PdoEditor.getValidationMappers()
-
getFirstFocusableNode
protected FxComponent getFirstFocusableNode(Map<PdoMember,FxComponent> nodes)
Gets the first focusable node.- Parameters:
nodes- the nodes map- Returns:
- the node, null if none
-
createNode
protected FxComponent createNode(PdoMember attribute)
Creates an FX node for a given PDO attribute.
Attributes must be bindable.- Parameters:
attribute- the PDO attribute- Returns:
- the node, null if skip attribute
- See Also:
Bindable
-
bind
protected void bind(org.tentackle.bind.BindingMember parent, PdoMember attribute, FxComponent node, String bindingOptions)Binds the node to the PDO member.- Parameters:
parent- the PDO parent binding memberattribute- the PDO attributenode- the FX nodebindingOptions- the binding options
-
createNodeMap
protected Map<PdoMember,FxComponent> createNodeMap()
Creates a map of attributes to nodes.- Returns:
- the node map
-
createView
protected javafx.scene.Parent createView(Map<PdoMember,FxComponent> nodes)
Creates a view from the nodes map.- Parameters:
nodes- the nodes map- Returns:
- the view
-
createLabel
protected javafx.scene.control.Label createLabel(PdoMember attribute)
Creates the label.- Parameters:
attribute- the pdo member- Returns:
- the label node
-
-