Class AbstractTableBasedSelectionPanel<T>

    • Constructor Detail

      • AbstractTableBasedSelectionPanel

        public AbstractTableBasedSelectionPanel()
    • Method Detail

      • initialize

        protected void initialize()
        For initializing members.
        Overrides:
        initialize in class BasePanel
      • initGUI

        protected void initGUI()
        initializes the GUI elements.
        Overrides:
        initGUI in class BasePanel
      • newSearchPanel

        protected SearchPanel newSearchPanel()
        Creates a new search panel widget.
        Returns:
        the search panel
      • getItemClass

        protected abstract Class getItemClass()
        Returns the class of the items displayed, same as "T".
        Returns:
        the class of the items
      • setMultipleSelection

        public void setMultipleSelection​(boolean value)
        Sets whether multiple or single selection is used.
        Parameters:
        value - if true multiple items can be selected
      • isMultipleSelection

        public boolean isMultipleSelection()
        Returns whether multiple or single selection is active.
        Returns:
        true if multiple selection is active
      • getSelectedRowCount

        public int getSelectedRowCount()
        Returns the number of selected rows.
        Returns:
        the number of selected rows
      • search

        protected void search()
        Performs a search.
      • addListSelectionListener

        public void addListSelectionListener​(ListSelectionListener l)
        Adds the given listener to the table's list of ListSelectionListeners.
        Parameters:
        l - the listener to add
      • removeListSelectionListener

        public void removeListSelectionListener​(ListSelectionListener l)
        Removes the given listener from the table's list of ListSelectionListeners.
        Parameters:
        l - the listener to remove
      • addDoubleClickListener

        public void addDoubleClickListener​(DoubleClickListener l)
        Adds the given listener to the list of double-click listeners.
        Parameters:
        l - the listener to add
      • removeDoubleClickListener

        public void removeDoubleClickListener​(DoubleClickListener l)
        Removes the given listener from the list of double-click listeners.
        Parameters:
        l - the listener to remove
      • notifyDoubleClickListeners

        protected void notifyDoubleClickListeners​(DoubleClickEvent e)
        Sends the event to all double-click listeners.
        Parameters:
        e - the event to send
      • cleanUp

        public void cleanUp()
        Cleans up data structures, frees up memory.
      • setEnabled

        public void setEnabled​(boolean value)
        Sets the enabled state of the panel.
        Overrides:
        setEnabled in class JComponent
        Parameters:
        value - if true then the components will be enabled
      • getItemCount

        public int getItemCount()
        Returns the count of currently displayed items.
        Returns:
        the total count
      • getSelectedItemCount

        public int getSelectedItemCount()
        Returns the count of currently selected items.
        Returns:
        the selection count
      • getCurrentItems

        protected T[] getCurrentItems()
        Returns the currently selected items, null if none chosen or dialog canceled.
        Returns:
        the selected items
      • getItem

        public T getItem()
        Returns the item, null if none chosen or dialog canceled.
        Returns:
        the selected item
      • getItems

        public T[] getItems()
        Returns the selected items, null if none chosen or dialog canceled.
        Returns:
        the selected items
      • setItem

        public void setItem​(T value)
        Sets the initially selected item.
        Parameters:
        value - the item to select
      • processMissing

        protected void processMissing​(List<T> missing)
        Hook method for processing items that were not found when trying to select them initially.

        The default implementation merely outputs the items.
        Parameters:
        missing - the missing items
      • isValidItem

        protected boolean isValidItem​(T item)
        Checks whether the item is valid.

        Default implementation only checks for null.
        Parameters:
        item - the item to check
        Returns:
        true if valid
      • addToMissing

        protected boolean addToMissing​(T item)
        Returns whether to add the item really to the missing list.

        Default implementation returns always true.
        Parameters:
        item - the item to check
        Returns:
        true if to add the item to the missing list, false otherwise
      • select

        protected List<T> select​(T[] value)
        Selects the items.
        Parameters:
        value - the items to select
        Returns:
        the actually selected items
      • setItems

        public void setItems​(T[] value)
        Sets the initially selected items.
        Parameters:
        value - the items to select
      • scrollIntoView

        public void scrollIntoView()
        Makes sure that the first selected row is visible.
      • beforeShow

        protected void beforeShow()
        Hook method just before the dialog is made visible.
        Overrides:
        beforeShow in class BasePanel
      • setDefaultPopupMenuSupplier

        public void setDefaultPopupMenuSupplier()
        Sets a default popup menu supplier. Simply allows to copy all the column values to the clipboard.
      • setCountsVisible

        public void setCountsVisible​(boolean value)
        Sets whether the total/selected counts are displayed.
        Parameters:
        value - if true then the total/selected counts are displayed
      • isCountsVisible

        public boolean isCountsVisible()
        Returns whether the total/selected counts are displayed.
        Returns:
        true if the total/selected counts are displayed
      • updateCounts

        protected void updateCounts()
        Updates the total/selected counts.