Class PdoSearch<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 PdoSearch<T extends org.tentackle.pdo.PersistentDomainObject<T>>
    extends org.tentackle.fx.AbstractFxController
    implements org.tentackle.pdo.PdoHolder<T>
    Search controller for PDOs.
    Author:
    harald
    • Constructor Summary

      Constructors 
      Constructor Description
      PdoSearch()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void bindOkButton()
      Binds the ok button so that it is enabled only if a PDO is selected.
      void cancel()
      Close and cancel.
      void clearSelection()
      Clears the selection.
      void close()
      Close the search.
      void configure()  
      void createPdo()
      Creates a new PDO.
      protected javafx.scene.Node createPlaceHolder()
      Creates the placeholder node for the empty search result in table view.
      void filterResult()
      Filters the result.
      void find()
      Runs the search and displays the results.
      org.tentackle.fx.container.FxHBox getButtonBox()
      Gets the HBox containing all buttons.
      java.util.function.Consumer<T> getDoubleClickHandler()
      Gets the double click handler.
      PdoFinder<T> getFinder()
      Gets the pdo finder.
      javafx.collections.ObservableList<T> getItems()
      Gets the items shown in the table or tree.
      java.lang.String getNoDataMessage()
      Gets the message displayed in tableview when there was no data found.
      T getPdo()
      Gets the pdo.
      javafx.collections.ObservableList<T> getSelectedItems()
      Returns the selected PDOs.
      org.tentackle.fx.component.FxTableView<T> getTableView()
      Gets access to the table view.
      If the tree is shown, it will be switched to the table view.
      javafx.collections.ObservableList<T> getTotalsItems()
      Gets the totals if shown.
      org.tentackle.fx.component.FxTreeView<T> getTreeView()
      Gets access to the tree view.
      If the table is shown, it will be switched to the tree view.
      boolean isCreatePdoAllowed()
      Returns whether creating a new PDO is allowed.
      protected boolean isCrudShown()
      Returns whether a CRUD is currently shown for this search.
      boolean isFinderVisible()
      Returns whether the finder is visible.
      boolean isSingleSelectMode()
      Returns single selection mode.
      boolean isTreeShown()
      Returns whether the tree is shown instead of the table.
      void setCreatePdoAllowed​(boolean allowed)
      Sets whether creating a new PDO is allowed.
      void setDoubleClickHandler​(java.util.function.Consumer<T> doubleClickHandler)
      Sets the double-click handler.
      If the search dialog is non-modal and the user double-clicks on a row of the table view, this handler will be invoked instead of the default (showing the PDO editor, if any provided).
      void setFinder​(PdoFinder<T> finder)
      Sets the pdo finder.
      void setFinderVisible​(boolean visible)
      Sets the visibility of the finder.
      The method must be invoked after setPdo because the finder will be made visible according to
      void setItems​(javafx.collections.ObservableList<T> items)
      Shows the search results.
      void setNoDataMessage​(java.lang.String noDataMessage)
      Sets the message displayed in tableview when there was no data found.
      void setPdo​(T pdo)
      Sets the pdo as a template for the search.
      void setSingleSelectMode​(boolean singleSelectMode)
      Sets the single selection mode.
      This mode is usually used in a modal dialog to select exactly one PDO.
      void setTotals​(javafx.collections.ObservableList<T> totals)
      Sets the totals.
      Shows the results from PdoFinder.createTotals(javafx.collections.ObservableList<T>) or hides the totals if none.
      void showTable()
      Switches to the table view.
      void showTree()
      Switches to the tree view.
      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

      • PdoSearch

        public PdoSearch()
    • Method Detail

      • getNoDataMessage

        public java.lang.String getNoDataMessage()
        Gets the message displayed in tableview when there was no data found.
        Returns:
        the placeholder message, null if default message, empty if no message at all
      • setNoDataMessage

        public void setNoDataMessage​(java.lang.String noDataMessage)
        Sets the message displayed in tableview when there was no data found.
        Parameters:
        noDataMessage - the placeholder message, null if default message, empty if no message at all
      • getDoubleClickHandler

        public java.util.function.Consumer<T> getDoubleClickHandler()
        Gets the double click handler.
        Returns:
        the handler, null if default handler
      • setDoubleClickHandler

        public void setDoubleClickHandler​(java.util.function.Consumer<T> doubleClickHandler)
        Sets the double-click handler.
        If the search dialog is non-modal and the user double-clicks on a row of the table view, this handler will be invoked instead of the default (showing the PDO editor, if any provided).
        Parameters:
        doubleClickHandler - the handler, null to clear
      • getButtonBox

        public org.tentackle.fx.container.FxHBox getButtonBox()
        Gets the HBox containing all buttons.
        Returns:
        the button container
      • setFinder

        public void setFinder​(PdoFinder<T> finder)
        Sets the pdo finder.
        Parameters:
        finder - the finder
      • getFinder

        public PdoFinder<T> getFinder()
        Gets the pdo finder.
        Returns:
        the finder
      • setPdo

        public void setPdo​(T pdo)
        Sets the pdo as a template for the search.
        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
      • setFinderVisible

        public void setFinderVisible​(boolean visible)
        Sets the visibility of the finder.
        The method must be invoked after setPdo because the finder will be made visible according to
        Parameters:
        visible - true if visible
      • isFinderVisible

        public boolean isFinderVisible()
        Returns whether the finder is visible.
        Returns:
        true if visible
      • setSingleSelectMode

        public void setSingleSelectMode​(boolean singleSelectMode)
        Sets the single selection mode.
        This mode is usually used in a modal dialog to select exactly one PDO.
        Parameters:
        singleSelectMode - true if select a single PDO
      • isSingleSelectMode

        public boolean isSingleSelectMode()
        Returns single selection mode.
        Returns:
        true if select a single PDO
      • setCreatePdoAllowed

        public void setCreatePdoAllowed​(boolean allowed)
        Sets whether creating a new PDO is allowed.
        Parameters:
        allowed - true if allowed
      • isCreatePdoAllowed

        public boolean isCreatePdoAllowed()
        Returns whether creating a new PDO is allowed.
        Returns:
        true if allowed
      • setTotals

        public void setTotals​(javafx.collections.ObservableList<T> totals)
        Sets the totals.
        Shows the results from PdoFinder.createTotals(javafx.collections.ObservableList<T>) or hides the totals if none.
        Parameters:
        totals - the totals (usually one item), null or empty if none
        See Also:
        TotalsTableView
      • getTotalsItems

        public javafx.collections.ObservableList<T> getTotalsItems()
        Gets the totals if shown.
        Returns:
        the totals, null if no totals
      • updateTitle

        public void updateTitle()
        Updates the window title if attached to its own stage.
      • find

        public void find()
        Runs the search and displays the results.
      • setItems

        public void setItems​(javafx.collections.ObservableList<T> items)
        Shows the search results.
        Parameters:
        items - the found PDOs
      • getItems

        public javafx.collections.ObservableList<T> getItems()
        Gets the items shown in the table or tree.
        Returns:
        the items
      • filterResult

        public void filterResult()
        Filters the result.
      • getSelectedItems

        public javafx.collections.ObservableList<T> getSelectedItems()
        Returns the selected PDOs.
        Returns:
        the selected PDOs, empty list, if nothing selected
      • clearSelection

        public void clearSelection()
        Clears the selection.
      • isTreeShown

        public boolean isTreeShown()
        Returns whether the tree is shown instead of the table.
        Returns:
        true if tree shown, else table shown
      • showTree

        public void showTree()
        Switches to the tree view.
      • getTreeView

        public org.tentackle.fx.component.FxTreeView<T> getTreeView()
        Gets access to the tree view.
        If the table is shown, it will be switched to the tree view.
        Returns:
        the table view
      • showTable

        public void showTable()
        Switches to the table view.
      • getTableView

        public org.tentackle.fx.component.FxTableView<T> getTableView()
        Gets access to the table view.
        If the tree is shown, it will be switched to the table view.
        Returns:
        the table view
      • cancel

        public void cancel()
        Close and cancel.
      • close

        public void close()
        Close the search.
      • createPdo

        public void createPdo()
        Creates a new PDO.
      • configure

        public void configure()
        Specified by:
        configure in interface org.tentackle.fx.FxController
        Overrides:
        configure in class org.tentackle.fx.AbstractFxController
      • bindOkButton

        protected void bindOkButton()
        Binds the ok button so that it is enabled only if a PDO is selected.
      • isCrudShown

        protected boolean isCrudShown()
        Returns whether a CRUD is currently shown for this search.
        Returns:
        true if shown
      • createPlaceHolder

        protected javafx.scene.Node createPlaceHolder()
        Creates the placeholder node for the empty search result in table view.
        Returns:
        the node, null if use tableview's default placeholder