Class PdoCrud<T extends org.tentackle.pdo.PersistentDomainObject<T>>

  • Type Parameters:
    T - the PDO type
    All Implemented Interfaces:
    org.tentackle.fx.FxController, org.tentackle.pdo.PdoHolder<T>, org.tentackle.validate.ScopeConfigurator

    @FxControllerService(binding=NO)
    public class PdoCrud<T extends org.tentackle.pdo.PersistentDomainObject<T>>
    extends org.tentackle.fx.AbstractFxController
    implements org.tentackle.pdo.PdoHolder<T>
    CRUD controller for PDOs.
    Author:
    harald
    • Constructor Summary

      Constructors 
      Constructor Description
      PdoCrud()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addPdoEventFilter​(javafx.event.EventType<PdoEvent> eventType, javafx.event.EventHandler<PdoEvent> eventFilter)
      Adds a PDO-event filter.
      void addPdoEventHandler​(javafx.event.EventType<PdoEvent> eventType, javafx.event.EventHandler<PdoEvent> eventHandler)
      Adds a PDO-event handler.
      void cancel()
      Closes this CRUD.
      protected boolean closeIfModal()
      Closes the stage if modal.
      void configure()  
      protected InteractiveError createInteractiveError​(org.tentackle.validate.ValidationResult validationResult)
      Creates an interactive error from a validation result.
      protected java.util.List<InteractiveError> createInteractiveErrors​(java.util.List<org.tentackle.validate.ValidationResult> validationResults)
      Creates interactive errors from validation results.
      void delete()
      Deletes the current PDO.
      void find()
      Searches for a PDO.
      org.tentackle.fx.container.FxHBox getButtonBox()
      Gets the HBox containing all buttons.
      PdoEditor<T> getEditor()
      Gets the pdo editor.
      T getPdo()
      Gets the pdo.
      java.util.List<T> getPdoList()
      Gets the list of pdos to walk through.
      boolean isEditable()
      Gets whether the user can change the editor's contents.
      boolean isEditing()
      Returns whether the PDO is being edited effectively.
      boolean isModal()
      Returns whether CRUD should be treated as modal.
      void newPdo()
      Discards the current PDO and edits a new one.
      void next()
      Navigates to the next PDO in the list.
      void previous()
      Navigates to the previous PDO in the list.
      void print()
      Prints the PDO.
      boolean releasePdo()
      Releases the current PDO.
      void removeAllPdoEventListeners()
      Removes all PDO-event handlers and filters.
      The method is provided to avoid memleaks.
      void removePdoEventFilter​(javafx.event.EventType<PdoEvent> eventType, javafx.event.EventHandler<PdoEvent> eventFilter)
      Removes a PDO-event filter.
      void removePdoEventHandler​(javafx.event.EventType<PdoEvent> eventType, javafx.event.EventHandler<PdoEvent> eventHandler)
      Removes a PDO-event handler.
      void save()
      Saves the current PDO.
      void security()
      Shows the security dialog.
      void setEditable​(boolean editable)
      Sets whether the user can change the editor's contents.
      void setEditor​(PdoEditor<T> editor)
      Sets the pdo editor.
      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.
      void setPdo​(T pdo)
      Sets the pdo to edit.
      void setPdoList​(javafx.collections.ObservableList<T> pdoList)
      Sets a list of PDOs to walk through via the up and next buttons.
      protected void showValidationResults​(org.tentackle.validate.ValidationFailedException ex)
      Shows the validation errors.
      void tree()
      Shows the browser tree of the current PDO.
      protected void updateButtons()
      Updates the visibility and disabled state of the buttons.
      protected void updatePrevNextButtons()
      Enables/Disables the previous and next buttons.
      void updateTitle()
      Updates 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, 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.PdoHolder

        on
    • Constructor Detail

      • PdoCrud

        public PdoCrud()
    • Method Detail

      • 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

        public void setPdoList​(javafx.collections.ObservableList<T> pdoList)
        Sets a list of PDOs to walk through via the up and next buttons.
        Parameters:
        pdoList - the pdos, null to disable list navigation
      • getPdoList

        public java.util.List<T> getPdoList()
        Gets the list of pdos to walk through.
        Returns:
        the pdos
      • setEditor

        public void setEditor​(PdoEditor<T> editor)
        Sets the pdo editor.
        Parameters:
        editor - the editor
      • getEditor

        public PdoEditor<T> getEditor()
        Gets the pdo editor.
        Returns:
        editor
      • setPdo

        public void setPdo​(T pdo)
        Sets the pdo to edit.
        Specified by:
        setPdo in interface org.tentackle.pdo.PdoHolder<T extends org.tentackle.pdo.PersistentDomainObject<T>>
        Parameters:
        pdo - the pdo
      • getPdo

        public T getPdo()
        Gets the pdo.
        Specified by:
        getPdo in interface org.tentackle.pdo.PdoHolder<T extends org.tentackle.pdo.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:
        configure in interface org.tentackle.fx.FxController
        Overrides:
        configure in class org.tentackle.fx.AbstractFxController
      • 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

        public boolean releasePdo()
        Releases the current PDO.
        Returns:
        true if released
      • print

        public void print()
        Prints the PDO.
      • getButtonBox

        public org.tentackle.fx.container.FxHBox 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 type
        eventFilter - 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 type
        eventFilter - 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 type
        eventHandler - 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 type
        eventHandler - 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
      • createInteractiveError

        protected InteractiveError createInteractiveError​(org.tentackle.validate.ValidationResult validationResult)
        Creates an interactive error from a validation result.
        Parameters:
        validationResult - the validation result
        Returns:
        the interactive error
      • createInteractiveErrors

        protected java.util.List<InteractiveError> createInteractiveErrors​(java.util.List<org.tentackle.validate.ValidationResult> validationResults)
        Creates interactive errors from validation results.
        Parameters:
        validationResults - the validation results
        Returns:
        the interactive errors
      • showValidationResults

        protected void showValidationResults​(org.tentackle.validate.ValidationFailedException ex)
        Shows the validation errors.
        Parameters:
        ex - the validation exception