Module org.tentackle.fx.rdc
Package org.tentackle.fx.rdc.crud
Class PdoCrud<T extends PersistentDomainObject<T>>
java.lang.Object
org.tentackle.fx.AbstractFxController
org.tentackle.fx.rdc.crud.PdoCrud<T>
- Type Parameters:
T- the PDO type
- All Implemented Interfaces:
FxController,PdoController<T>,PdoProvider<T>,org.tentackle.validate.ScopeConfigurator
@FxControllerService(binding=NO)
public class PdoCrud<T extends PersistentDomainObject<T>>
extends AbstractFxController
implements PdoController<T>
CRUD controller for PDOs.
- Author:
- harald
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPdoEventFilter(javafx.event.EventType<PdoEvent> eventType, javafx.event.EventHandler<PdoEvent> eventFilter) Adds a PDO-event filter.voidaddPdoEventHandler(javafx.event.EventType<PdoEvent> eventType, javafx.event.EventHandler<PdoEvent> eventHandler) Adds a PDO-event handler.voidcancel()Closes this CRUD.protected booleanCloses the stage if modal.voidvoiddelete()Deletes the current PDO.voidfind()Searches for a PDO.Gets the HBox containing all buttons.Gets the pdo editor.getPdo()Gets the pdo.Gets the list of pdos to walk through.booleanGets whether the user can change the editor's contents.booleanReturns whether the PDO is being edited effectively.booleanisModal()Returns whether CRUD should be treated as modal.voidnewPdo()Discards the current PDO and edits a new one.voidnext()Navigates to the next PDO in the list.voidprevious()Navigates to the previous PDO in the list.voidprint()Prints the PDO.voidreleasePdo(Consumer<Boolean> released) Releases the current PDO.voidRemoves all PDO-event handlers and filters.
The method is provided to avoid memleaks.voidremovePdoEventFilter(javafx.event.EventType<PdoEvent> eventType, javafx.event.EventHandler<PdoEvent> eventFilter) Removes a PDO-event filter.voidremovePdoEventHandler(javafx.event.EventType<PdoEvent> eventType, javafx.event.EventHandler<PdoEvent> eventHandler) Removes a PDO-event handler.voidsave()Saves the current PDO.voidsecurity()Shows the security dialog.voidsetEditable(boolean editable) Sets whether the user can change the editor's contents.voidSets the pdo editor.voidsetModal(boolean modal) Sets this CRUD should be treated as modal.
Modality cannot be retrieved from the stage because there may be no stage yet.voidSets the pdo to edit.voidsetPdoList(javafx.collections.ObservableList<T> pdoList) Sets a list of PDOs to walk through via the up and next buttons.protected voidshowValidationResults(org.tentackle.validate.ValidationFailedException ex) Shows the validation errors.voidtree()Shows the browser tree of the current PDO.protected voidUpdates the visibility and disabled state of the buttons.protected voidEnables/Disables the previous and next buttons.voidUpdates the window title if attached to its own stage.Methods inherited from class org.tentackle.fx.AbstractFxController
createBinder, getBinder, getContainer, getDefaultScopes, getFXMLFields, getFXMLMethods, getStage, getView, setView, validateInjectionsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.tentackle.fx.FxController
getBinder, getContainer, getFXMLFields, getFXMLMethods, getStage, getView, setView, validateInjectionsMethods inherited from interface org.tentackle.pdo.PdoProvider
on
-
Constructor Details
-
PdoCrud
public PdoCrud()
-
-
Method Details
-
setEditable
public void setEditable(boolean editable) Sets whether the user can change the editor's contents.- Parameters:
editable- true if editable
-
isEditable
public boolean isEditable()Gets whether the user can change the editor's contents.- Returns:
- true if editable
-
isEditing
public boolean isEditing()Returns whether the PDO is being edited effectively.- Returns:
- true if isEditable() and editing is allowed according to the security rules
-
isModal
public boolean isModal()Returns whether CRUD should be treated as modal.- Returns:
- true if modal
-
setModal
public void setModal(boolean modal) Sets this CRUD should be treated as modal.
Modality cannot be retrieved from the stage because there may be no stage yet.- Parameters:
modal- true if modal
-
setPdoList
Sets a list of PDOs to walk through via the up and next buttons.- Parameters:
pdoList- the pdos, null to disable list navigation
-
getPdoList
Gets the list of pdos to walk through.- Returns:
- the pdos
-
setEditor
Sets the pdo editor.- Parameters:
editor- the editor
-
getEditor
Gets the pdo editor.- Returns:
- editor
-
setPdo
Sets the pdo to edit.- Specified by:
setPdoin interfacePdoController<T extends PersistentDomainObject<T>>- Parameters:
pdo- the pdo
-
getPdo
Gets the pdo.- Specified by:
getPdoin interfacePdoProvider<T extends PersistentDomainObject<T>>- Returns:
- the pdo
-
updateTitle
public void updateTitle()Updates the window title if attached to its own stage. -
configure
public void configure()- Specified by:
configurein interfaceFxController- Overrides:
configurein classAbstractFxController
-
tree
public void tree()Shows the browser tree of the current PDO. -
previous
public void previous()Navigates to the previous PDO in the list. -
next
public void next()Navigates to the next PDO in the list. -
security
public void security()Shows the security dialog. -
newPdo
public void newPdo()Discards the current PDO and edits a new one. -
save
public void save()Saves the current PDO. -
delete
public void delete()Deletes the current PDO. -
cancel
public void cancel()Closes this CRUD. -
find
public void find()Searches for a PDO. -
releasePdo
Releases the current PDO.- Parameters:
released- invoked with true if released, false if not (user answered CANCEL)
-
print
public void print()Prints the PDO. -
getButtonBox
Gets the HBox containing all buttons.- Returns:
- the button container
-
removeAllPdoEventListeners
public void removeAllPdoEventListeners()Removes all PDO-event handlers and filters.
The method is provided to avoid memleaks. -
addPdoEventFilter
public void addPdoEventFilter(javafx.event.EventType<PdoEvent> eventType, javafx.event.EventHandler<PdoEvent> eventFilter) Adds a PDO-event filter.- Parameters:
eventType- the event typeeventFilter- the filter
-
removePdoEventFilter
public void removePdoEventFilter(javafx.event.EventType<PdoEvent> eventType, javafx.event.EventHandler<PdoEvent> eventFilter) Removes a PDO-event filter.- Parameters:
eventType- the event typeeventFilter- the filter
-
addPdoEventHandler
public void addPdoEventHandler(javafx.event.EventType<PdoEvent> eventType, javafx.event.EventHandler<PdoEvent> eventHandler) Adds a PDO-event handler.- Parameters:
eventType- the event typeeventHandler- the handler
-
removePdoEventHandler
public void removePdoEventHandler(javafx.event.EventType<PdoEvent> eventType, javafx.event.EventHandler<PdoEvent> eventHandler) Removes a PDO-event handler.- Parameters:
eventType- the event typeeventHandler- the handler
-
updateButtons
protected void updateButtons()Updates the visibility and disabled state of the buttons. -
updatePrevNextButtons
protected void updatePrevNextButtons()Enables/Disables the previous and next buttons. -
closeIfModal
protected boolean closeIfModal()Closes the stage if modal.- Returns:
- true if closed
-
showValidationResults
protected void showValidationResults(org.tentackle.validate.ValidationFailedException ex) Shows the validation errors.- Parameters:
ex- the validation exception
-