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 theChoice
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 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 void
addChoice(Choice<T> choice)
void
checkDisplayedChoices()
java.util.List<Choice<T>>
getCheckedChoices()
java.util.List<java.lang.String>
getCheckedLabels()
int
getCheckedValueCount()
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)
int
getColumnCount()
java.lang.String
getColumnName(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 valueint
getRowCount()
int
getTotalValueCount()
java.util.List<Choice<T>>
getUncheckedChoices()
java.lang.Object
getValueAt(int rowIndex, int columnIndex)
int
getVisibleValueCount()
boolean
isCellEditable(int rowIndex, int columnIndex)
boolean
isSingleSelectMode()
void
refreshTable()
void
setChangeListener(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)
void
setChoices(java.util.List<Choice<T>> choices)
Sets the list of choices associatedvoid
setChoiceSelection(Choice<T> choice, boolean value)
void
setChoiceTypeName(java.lang.String name)
void
setFilter(java.lang.String filter)
void
setSingleSelectMode(boolean singleSelectMode)
void
setValueAt(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)
void
sortCheckedToTop()
void
sortChoicesToTop(java.util.List<Choice> choicesToSort)
void
uncheckAllChoices()
void
uncheckDisplayedChoices()
-
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
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 interfacejavax.swing.table.TableModel
- Overrides:
getColumnClass
in classjavax.swing.table.AbstractTableModel
-
getColumnName
public java.lang.String getColumnName(int column)
- Specified by:
getColumnName
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnName
in classjavax.swing.table.AbstractTableModel
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex)
- Specified by:
isCellEditable
in interfacejavax.swing.table.TableModel
- Overrides:
isCellEditable
in classjavax.swing.table.AbstractTableModel
-
setValueAt
public void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
- Specified by:
setValueAt
in interfacejavax.swing.table.TableModel
- Overrides:
setValueAt
in 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)
-
-