Class SortPanel

    • Field Detail

      • m_Sheet

        protected SpreadSheet m_Sheet
        the spreadsheet that forms the basis for the sorting.
      • m_Layout

        protected GridLayout m_Layout
        the gridlayout in use.
      • m_PanelDefinitions

        protected BasePanel m_PanelDefinitions
        the panel holding the defintion panels.
      • m_PanelButtons

        protected BasePanel m_PanelButtons
        the panel for the buttons.
      • m_ButtonReset

        protected BaseButton m_ButtonReset
        the button for resetting the definitions.
      • m_ButtonAdd

        protected BaseButton m_ButtonAdd
        the button for a new sort definition.
      • m_ColumnNames

        protected List<String> m_ColumnNames
        the column names.
      • m_SortSetupListeners

        protected HashSet<SortSetupListener> m_SortSetupListeners
        the listeners for changes in the setup.
    • Constructor Detail

      • SortPanel

        public SortPanel()
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class BasePanel
      • initGUI

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

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

        public boolean setSpreadSheet​(SpreadSheet value)
        Sets the spreadsheet to use.
        Parameters:
        value - the spreadsheet to use
        Returns:
        true if the panel was reset
      • getSpreadSheet

        public SpreadSheet getSpreadSheet()
        Returns the spreadsheet to use.
        Returns:
        the spreadsheet in use, null if none set
      • getColumnNames

        public List<String> getColumnNames()
        Returns the column names in use.
        Returns:
        the column names
      • resetDefinitions

        public void resetDefinitions()
        Resets the definitions.
      • addDefinition

        public void addDefinition()
        Adds a new definition.
      • removeDefinition

        public void removeDefinition​(SortDefinitionPanel panel)
        Removes the panel from the list of sort definitions.
        Parameters:
        panel - the panel to remove
      • reset

        public void reset()
        Removes all sort definition panels.
      • isFirstDefinition

        public boolean isFirstDefinition​(SortDefinitionPanel panel)
        Checks whether the panel is the first one.
        Parameters:
        panel - the panel to check
        Returns:
        true if the first one
      • isLastDefinition

        public boolean isLastDefinition​(SortDefinitionPanel panel)
        Checks whether the panel is the last one.
        Parameters:
        panel - the panel to check
        Returns:
        true if the last one
      • moveDefinition

        public boolean moveDefinition​(SortDefinitionPanel panel,
                                      boolean up)
        Moves the panel up/down.
        Parameters:
        panel - the panel to move
        up - if true, gets moved up, otherwise down
        Returns:
        true if successfully moved
      • update

        protected void update()
        Updates the display.
      • isValidSetup

        public boolean isValidSetup()
        Checks whether the setup is valid, i.e., no name used twice, at least one sorting definition.
        Returns:
        true if valid
      • getComparator

        public RowComparator getComparator()
        Returns a comparator for sorting the spreadsheet.
        Returns:
        the comparator, null if not valid setup
      • addSortSetupListener

        public void addSortSetupListener​(SortSetupListener l)
        Adds the specified listener.
        Parameters:
        l - the listener to add
      • removeSortSetupListener

        public void removeSortSetupListener​(SortSetupListener l)
        Removes the specified listener.
        Parameters:
        l - the listener to remove
      • notifySortSetupListeners

        public void notifySortSetupListeners​(SortSetupEvent e)
        Notifies all listeners with the specified event.
        Parameters:
        e - the event to send