Module org.tentackle.fx.rdc
Package org.tentackle.fx.rdc.translate
Class PdoComponentAddon<T extends PersistentDomainObject<T>>
- java.lang.Object
-
- org.tentackle.fx.rdc.translate.PdoComponentAddon<T>
-
- Type Parameters:
T- the PDO type
public class PdoComponentAddon<T extends PersistentDomainObject<T>> extends Object
Adds style, context-menu, DnD and function-keys to components bound to a PDO.
-
-
Constructor Summary
Constructors Constructor Description PdoComponentAddon(FxComponent component, Supplier<T> pdoSupplier, Consumer<T> pdoConsumer)Creates the addon.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TcreatePdo()Creates a new PDO.voidedit()Edit or view current pdo.DomainContextgetDomainContext()Gets the domain context from the binding properties.TgetPdo()Gets the PDO.booleanisInSearchOrEdit()Returns whether search or edit dialog is currently displayed.voidsearch()Search for a PDO.voidsearchPdo(T proxy, Consumer<T> selectedItem)Modal search of the pdo.List<T>selectAll(T proxy)Returns a list of all pdos.
Used in comboboxes and choiceboxes to initialize the component's item list.voidsetPdo(T pdo)Sets the PDO.
-
-
-
Field Detail
-
PDO_STYLE
public static final String PDO_STYLE
The PDO style.
Remove this style to disable PDO features.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PdoComponentAddon
public PdoComponentAddon(FxComponent component, Supplier<T> pdoSupplier, Consumer<T> pdoConsumer)
Creates the addon.- Parameters:
component- the fx componentpdoSupplier- a supplier for the currently displayed PDOpdoConsumer- a consumer for the PDO (changed by DnD)
-
-
Method Detail
-
getPdo
public T getPdo()
Gets the PDO.- Returns:
- the pdo
-
setPdo
public void setPdo(T pdo)
Sets the PDO.- Parameters:
pdo- the pdo
-
isInSearchOrEdit
public boolean isInSearchOrEdit()
Returns whether search or edit dialog is currently displayed.- Returns:
- true if within search or edit
-
edit
public void edit()
Edit or view current pdo.
-
search
public void search()
Search for a PDO.
-
createPdo
public T createPdo()
Creates a new PDO.- Returns:
- the pdo
-
getDomainContext
public DomainContext getDomainContext()
Gets the domain context from the binding properties.- Returns:
- the domain context, null if not defined in properties
-
searchPdo
public void searchPdo(T proxy, Consumer<T> selectedItem)
Modal search of the pdo.- Parameters:
proxy- the proxy pdo (possibly presetted with partial search criteria)selectedItem- the consumer for the selected pdo, invoked with null if no pdo found
-
-