Package com.nuix.nx.models
Class ChoiceTableModel<T>
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- com.nuix.nx.models.ChoiceTableModel<T>
-
- Type Parameters:
T- The data type of the of theChoiceinstances 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.AbstractTableModelTable model used by theChoiceTableControl- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ChoiceTableModel()Create a new instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChoice(Choice<T> choice)voidcheckDisplayedChoices()java.util.List<Choice<T>>getCheckedChoices()java.util.List<java.lang.String>getCheckedLabels()intgetCheckedValueCount()java.util.List<T>getCheckedValues()Choice<T>getChoice(int rowIndex)java.util.List<Choice<T>>getChoices()Gets the list of choices associatedjava.lang.Class<?>getColumnClass(int columnIndex)intgetColumnCount()java.lang.StringgetColumnName(int column)Choice<T>getDisplayedChoice(int rowIndex)Choice<T>getFirstChoiceByLabel(java.lang.String label)Attempt to find a choice in the model with a matching labelChoice<T>getFirstChoiceByValue(T value)Attempt to find a choice in the model with a matching valueintgetRowCount()intgetTotalValueCount()java.util.List<Choice<T>>getUncheckedChoices()java.lang.ObjectgetValueAt(int rowIndex, int columnIndex)intgetVisibleValueCount()booleanisCellEditable(int rowIndex, int columnIndex)booleanisSingleSelectMode()voidrefreshTable()voidsetChangeListener(ChoiceTableModelChangeListener listener)Set a listener callback which will be notified of changesjava.util.List<Choice<T>>setCheckedByLabels(java.util.Collection<java.lang.String> labels, boolean setChecked)voidsetChoices(java.util.List<Choice<T>> choices)Sets the list of choices associatedvoidsetChoiceSelection(Choice<T> choice, boolean value)voidsetChoiceTypeName(java.lang.String name)voidsetFilter(java.lang.String filter)voidsetSingleSelectMode(boolean singleSelectMode)voidsetValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)int[]shiftRows(int[] positions, int offset)int[]shiftRows(java.util.List<Choice<T>> list, int offset)int[]shiftRowsDown(int[] positions)int[]shiftRowsUp(int[] positions)voidsortCheckedToTop()voidsortChoicesToTop(java.util.List<Choice> choicesToSort)voiduncheckAllChoices()voiduncheckDisplayedChoices()-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
-
-
-
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
Choiceobject 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
Choiceobject 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:
getColumnClassin interfacejavax.swing.table.TableModel- Overrides:
getColumnClassin classjavax.swing.table.AbstractTableModel
-
getColumnName
public java.lang.String getColumnName(int column)
- Specified by:
getColumnNamein interfacejavax.swing.table.TableModel- Overrides:
getColumnNamein classjavax.swing.table.AbstractTableModel
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex)- Specified by:
isCellEditablein interfacejavax.swing.table.TableModel- Overrides:
isCellEditablein classjavax.swing.table.AbstractTableModel
-
setValueAt
public void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)- Specified by:
setValueAtin interfacejavax.swing.table.TableModel- Overrides:
setValueAtin classjavax.swing.table.AbstractTableModel
-
refreshTable
public void refreshTable()
-
setFilter
public void setFilter(java.lang.String filter)
-
checkDisplayedChoices
public void checkDisplayedChoices()
-
uncheckDisplayedChoices
public void uncheckDisplayedChoices()
-
uncheckAllChoices
public void uncheckAllChoices()
-
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)
-
sortCheckedToTop
public void sortCheckedToTop()
-
sortChoicesToTop
public void sortChoicesToTop(java.util.List<Choice> choicesToSort)
-
isSingleSelectMode
public boolean isSingleSelectMode()
-
setSingleSelectMode
public void setSingleSelectMode(boolean singleSelectMode)
-
-