Class ContainerModel<M extends AbstractContainerManager,​C extends AbstractContainer>

    • Field Detail

      • m_DisplayVisibility

        protected boolean m_DisplayVisibility
        whether to display the visibility column or not (if possible).
      • m_DisplayDatabaseID

        protected boolean m_DisplayDatabaseID
        whether to display the database ID column or not (if possible).
    • Constructor Detail

      • ContainerModel

        public ContainerModel()
        Initializes the model.
      • ContainerModel

        public ContainerModel​(ContainerListManager<M> manager)
        Initializes the model.
        Parameters:
        manager - the managing object to obtain the data from
      • ContainerModel

        public ContainerModel​(M manager)
        Initializes the model.
        Parameters:
        manager - the manager to obtain the data from
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
      • getManager

        public M getManager()
        Returns the underlying manager.
        Returns:
        the manager or null if not set (e.g., empty model)
      • unregister

        public void unregister()
        Unregisters this model as listener.
      • setDisplayVisibility

        public void setDisplayVisibility​(boolean value)
        Whether to display the visibility column (if possible).
        Parameters:
        value - if true then the column will be displayed where possible
      • getDisplayVisibility

        public boolean getDisplayVisibility()
        Returns whether the visibility column will be displayed where possible.
        Returns:
        true if the column will be displayed where possible
      • setDisplayDatabaseID

        public void setDisplayDatabaseID​(boolean value)
        Whether to display the database ID column (if possible).
        Parameters:
        value - if true then the column will be displayed where possible
      • getDisplayDatabaseID

        public boolean getDisplayDatabaseID()
        Returns whether the database ID column will be displayed where possible.
        Returns:
        true if the column will be displayed where possible
      • showVisibilityColumn

        protected boolean showVisibilityColumn()
        Returns whether the visibility column is to be displayed.
        Returns:
        true if the column is to be displayed
      • showDatabaseIDColumn

        protected boolean showDatabaseIDColumn()
        Returns whether the database ID column is to be displayed.
        Returns:
        true if the column is to be displayed
      • getColumnCount

        public int getColumnCount()
        Returns the number of columns.
         - Checkbox (if manager implements VisibilityContainerManager and m_DisplayVisibility is true)
         - Database ID (if manager implements DatabaseContainerManager and m_DisplayDatabaseID is true)
         - Display string
         
        Specified by:
        getColumnCount in interface TableModel
        Returns:
        the number of columns
        See Also:
        m_DisplayVisibility, m_DisplayDatabaseID, VisibilityContainerManager
      • getVisibilityColumn

        protected int getVisibilityColumn()
        Returns the column index of the visibility column.
        Returns:
        the column index, -1 if not available
      • getDatabaseIDColumn

        protected int getDatabaseIDColumn()
        Returns the column index of the database ID column.
        Returns:
        the column index, -1 if not available
      • getDataColumn

        protected int getDataColumn()
        Returns the column index of the data column.
        Returns:
        the column index, -1 if not available
      • getColumnWidth

        public int getColumnWidth​(int columnIndex)
        Returns the default width for the column.
        Parameters:
        columnIndex - the index of the column
        Returns:
        the width
      • getRowCount

        public int getRowCount()
        Returns the number of rows to display.
        Specified by:
        getRowCount in interface TableModel
        Returns:
        the number of rows
      • getValueAt

        public Object getValueAt​(int rowIndex,
                                 int columnIndex)
        Returns the value at the specified position.
        Specified by:
        getValueAt in interface TableModel
        Parameters:
        rowIndex - the row
        columnIndex - the column
        Returns:
        the value
      • setValueAt

        public void setValueAt​(Object aValue,
                               int rowIndex,
                               int columnIndex)
        Sets the value at the given position.
        Specified by:
        setValueAt in interface TableModel
        Overrides:
        setValueAt in class AbstractTableModel
        Parameters:
        aValue - the value to set
        rowIndex - the row
        columnIndex - the column
      • isCellEditable

        public boolean isCellEditable​(int rowIndex,
                                      int columnIndex)
        Returns whether a cell is editable or not.
        Specified by:
        isCellEditable in interface TableModel
        Overrides:
        isCellEditable in class AbstractTableModel
        Parameters:
        rowIndex - the row
        columnIndex - the column
        Returns:
        true if editable
      • dataChanged

        public void dataChanged​(DataChangeEvent e)
        Gets called if the data of the manager noticed a changed.
        Specified by:
        dataChanged in interface DataChangeListener
        Parameters:
        e - the event that was sent
      • getContainerAt

        public C getContainerAt​(int row)
        Returns the container at the specified row.
        Parameters:
        row - the row of the container to retrieve
        Returns:
        the container
      • cleanUp

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