Class ChoiceTableModel<T>

  • Type Parameters:
    T - The data type of the of the Choice instances which will be held by this model.
    All Implemented Interfaces:
    java.io.Serializable, javax.swing.table.TableModel

    public class ChoiceTableModel<T>
    extends javax.swing.table.AbstractTableModel
    Table model used by the ChoiceTableControl
    See Also:
    Serialized Form
    • Constructor Detail

      • ChoiceTableModel

        public ChoiceTableModel()
        Create a new instance
    • Method Detail

      • setChangeListener

        public void setChangeListener​(ChoiceTableModelChangeListener listener)
        Set a listener callback which will be notified of changes
        Parameters:
        listener - The listener to be notified of changes
      • setCheckedByLabels

        public java.util.List<Choice<T>> setCheckedByLabels​(java.util.Collection<java.lang.String> labels,
                                                            boolean setChecked)
      • getFirstChoiceByLabel

        public Choice<T> getFirstChoiceByLabel​(java.lang.String label)
        Attempt to find a choice in the model with a matching label
        Parameters:
        label - The label to look for
        Returns:
        A corresponding Choice object if a match was found
      • getFirstChoiceByValue

        public Choice<T> getFirstChoiceByValue​(T value)
        Attempt to find a choice in the model with a matching value
        Parameters:
        value - The value to look for
        Returns:
        A corresponding Choice object if a match was found
      • getChoices

        public java.util.List<Choice<T>> getChoices()
        Gets the list of choices associated
        Returns:
        The choices
      • setChoices

        public void setChoices​(java.util.List<Choice<T>> choices)
        Sets the list of choices associated
        Parameters:
        choices - The choices to associate
      • getColumnCount

        public int getColumnCount()
      • getRowCount

        public int getRowCount()
      • getValueAt

        public java.lang.Object getValueAt​(int rowIndex,
                                           int columnIndex)
      • getColumnClass

        public java.lang.Class<?> getColumnClass​(int columnIndex)
        Specified by:
        getColumnClass in interface javax.swing.table.TableModel
        Overrides:
        getColumnClass in class javax.swing.table.AbstractTableModel
      • getColumnName

        public java.lang.String getColumnName​(int column)
        Specified by:
        getColumnName in interface javax.swing.table.TableModel
        Overrides:
        getColumnName in class javax.swing.table.AbstractTableModel
      • isCellEditable

        public boolean isCellEditable​(int rowIndex,
                                      int columnIndex)
        Specified by:
        isCellEditable in interface javax.swing.table.TableModel
        Overrides:
        isCellEditable in class javax.swing.table.AbstractTableModel
      • setValueAt

        public void setValueAt​(java.lang.Object aValue,
                               int rowIndex,
                               int columnIndex)
        Specified by:
        setValueAt in interface javax.swing.table.TableModel
        Overrides:
        setValueAt in class javax.swing.table.AbstractTableModel
      • refreshTable

        public void refreshTable()
      • setFilter

        public void setFilter​(java.lang.String filter)
      • getChoice

        public Choice<T> getChoice​(int rowIndex)
      • getDisplayedChoice

        public Choice<T> getDisplayedChoice​(int rowIndex)
      • addChoice

        public void addChoice​(Choice<T> choice)
      • setChoiceSelection

        public void setChoiceSelection​(Choice<T> choice,
                                       boolean value)
      • checkDisplayedChoices

        public void checkDisplayedChoices()
      • uncheckDisplayedChoices

        public void uncheckDisplayedChoices()
      • uncheckAllChoices

        public void uncheckAllChoices()
      • getCheckedChoices

        public java.util.List<Choice<T>> getCheckedChoices()
      • getUncheckedChoices

        public java.util.List<Choice<T>> getUncheckedChoices()
      • getCheckedValues

        public java.util.List<T> getCheckedValues()
      • getCheckedLabels

        public java.util.List<java.lang.String> getCheckedLabels()
      • getCheckedValueCount

        public int getCheckedValueCount()
      • getVisibleValueCount

        public int getVisibleValueCount()
      • getTotalValueCount

        public int getTotalValueCount()
      • setChoiceTypeName

        public void setChoiceTypeName​(java.lang.String name)
      • shiftRowsUp

        public int[] shiftRowsUp​(int[] positions)
      • shiftRowsDown

        public int[] shiftRowsDown​(int[] positions)
      • shiftRows

        public int[] shiftRows​(int[] positions,
                               int offset)
      • shiftRows

        public int[] shiftRows​(java.util.List<Choice<T>> list,
                               int offset)
      • sortCheckedToTop

        public void sortCheckedToTop()
      • sortChoicesToTop

        public void sortChoicesToTop​(java.util.List<Choice> choicesToSort)
      • isSingleSelectMode

        public boolean isSingleSelectMode()
      • setSingleSelectMode

        public void setSingleSelectMode​(boolean singleSelectMode)