Class AbstractManagementPanel<T extends Comparable>

    • Field Detail

      • m_ButtonClear

        protected BaseButton m_ButtonClear
        the button for clearing the input.
      • m_ButtonAdd

        protected BaseButton m_ButtonAdd
        the button for adding an object.
      • m_ButtonUpdate

        protected BaseButton m_ButtonUpdate
        the button for updating an object.
      • m_ButtonRefresh

        protected BaseButton m_ButtonRefresh
        the button for refreshing the table.
      • m_ButtonRemove

        protected BaseButton m_ButtonRemove
        the button for deleting selected objects.
      • m_ButtonLoad

        protected BaseButton m_ButtonLoad
        the button for loading the selected object.
      • m_PanelTable

        protected JPanel m_PanelTable
        the panel with the currently available objects.
      • m_PanelSearch

        protected SearchPanel m_PanelSearch
        the search panel.
      • m_MenuBar

        protected JMenuBar m_MenuBar
        the menu bar.
      • m_MenuItemFileRefresh

        protected JMenuItem m_MenuItemFileRefresh
        the menu item for refreshing.
      • m_MenuItemEditClear

        protected JMenuItem m_MenuItemEditClear
        the menu item for clearing.
      • m_MenuItemEditAdd

        protected JMenuItem m_MenuItemEditAdd
        the menu item for adding.
      • m_MenuItemEditUpdate

        protected JMenuItem m_MenuItemEditUpdate
        the menu item for updating.
      • m_MenuItemEditRemove

        protected JMenuItem m_MenuItemEditRemove
        the menu item for removing.
    • Constructor Detail

      • AbstractManagementPanel

        public AbstractManagementPanel()
    • Method Detail

      • initGUI

        protected void initGUI()
        Initializes the widgets.
        Overrides:
        initGUI in class BasePanel
      • finishInit

        protected void finishInit()
        Finishes the initialization.
        Overrides:
        finishInit in class BasePanel
      • addToFileMenu

        protected boolean addToFileMenu​(JMenu menu)
        Hook method for adding items to the "File" menu.
        Parameters:
        menu - the menu to update
        Returns:
        true if an item was added
      • addToEditMenu

        protected boolean addToEditMenu​(JMenu menu)
        Hook method for adding items to the "Edit" menu.
        Parameters:
        menu - the menu to update
        Returns:
        true if an item was added
      • addOtherMenus

        protected void addOtherMenus​(JMenuBar menubar)
        For adding additional menus.
        Parameters:
        menubar - the menubar to extend
      • getMenuBar

        public JMenuBar getMenuBar()
        Creates a menu bar (singleton per panel object). Can be used in frames.
        Specified by:
        getMenuBar in interface MenuBarProvider
        Returns:
        the menu bar
      • updateMenu

        protected void updateMenu()
        updates the enabled state of the menu items.
      • getFileChooser

        protected SpreadSheetFileChooser getFileChooser()
        Returns the filechooser for saving the table as spreadsheet.
        Returns:
        the filechooser
      • addDocumentListener

        protected void addDocumentListener​(Document doc)
        Adds the appropriate document listener to the document.
        Parameters:
        doc - the document to add the listener to
        See Also:
        addListener(Component)
      • addActionListener

        protected void addActionListener​(JComboBox combo)
        Adds an action listener to the combobox.
        Parameters:
        combo - the combobox to add the listener to
        See Also:
        addListener(Component)
      • addChangeListener

        protected void addChangeListener​(AbstractChooserPanel chooser)
        Adds a change listener to the chooser.
        Parameters:
        chooser - the chooser to add the listener to
        See Also:
        addListener(Component)
      • addListener

        protected void addListener​(Component comp)
        Adds the appropriate listener to the component.
        Parameters:
        comp - the component to add a listener to
      • addFields

        protected abstract void addFields​(ParameterPanelWithButtons panel)
        For adding all the fields.
        Parameters:
        panel - the panel to add the fields to
      • newTableModel

        protected abstract AbstractManagementTableModel<T> newTableModel()
        Returns an instance of a new table model.
        Returns:
        the table model
      • getManagedClass

        protected abstract Class getManagedClass()
        Returns the class that is being managed.
        Returns:
        the class being managed
      • getItemName

        protected String getItemName​(boolean multiple)
        Returns a human-readable string describing the managed objects.
        Parameters:
        multiple - true if to return the plural
        Returns:
        the name of the objects
      • clear

        protected abstract void clear()
        Resets the input fields.
      • fieldsToObject

        protected abstract T fieldsToObject()
        Turns the fields into an object.
        Returns:
        the generated object
      • objectToFields

        protected abstract void objectToFields​(T value)
        Updates the field with the specified object.
        Parameters:
        value - the object to display
      • loadAll

        protected abstract List<T> loadAll()
        Loads all the objects.
        Returns:
        all available Objects
      • exists

        protected abstract boolean exists​(T value)
        Checks whether the object already exists.
        Parameters:
        value - the value to look for
        Returns:
        true if already available
      • store

        protected abstract boolean store​(T value)
        Stores the object.
        Parameters:
        value - the value to store
        Returns:
        true if successfully stored
      • remove

        protected abstract boolean remove​(T value)
        Removes the object.
        Parameters:
        value - the value to remove
        Returns:
        true if successfully removed
      • getID

        protected String getID​(T value)
        Returns the ID from the object.

        Default implementation only returns and ID if the object implements IDHandler.
        Parameters:
        value - the object to get the ID from
        Returns:
        the ID, null if it could not be retrieved
      • addObject

        protected void addObject()
        Adds the object and refreshes the table.
      • updateObject

        protected void updateObject()
        Updates the object and refreshes the table.
      • removeObjects

        protected void removeObjects()
        Removes the selected objects and refreshes the table.
      • loadValue

        protected void loadValue()
        Loads the Object from the table and displays it in the GUI.
      • getSelectedValues

        protected List<T> getSelectedValues()
        Returns the selected values.
        Returns:
        the selected values
      • refresh

        protected void refresh()
        Refreshes the table.
      • getMaximumColumnWidth

        protected int getMaximumColumnWidth()
        Returns the maximum column width to use when determining the optimal column width.
        Returns:
        the maximum
      • canClearFields

        protected abstract boolean canClearFields()
        Returns whether the fields can be cleared, i.e., if there is any input.
        Returns:
        true if input can be cleared
      • isReadOnly

        protected abstract boolean isReadOnly()
        Returns whether modified data cannot be stored.
        Returns:
        true if storing is not available
      • canAddObject

        protected abstract boolean canAddObject()
        Returns whether all the required fields are set to add the object.
        Returns:
        true if required fields are filled in
      • update

        protected void update()
        Updates the enabled state of the widgets.
      • updateButtons

        protected void updateButtons()
        Updates the enabled state of the widgets.
      • cleanUp

        public void cleanUp()
        Cleans up data structures, frees up memory.
        Specified by:
        cleanUp in interface CleanUpHandler