public class SwingListSelectionState extends AbstractSwingState implements ListSelectionListener, ActionListener, TableModelListener, ListDataListener
Modifier and Type | Field and Description |
---|---|
static int |
NO_SELECTION
The marker for no selection.
|
mSilent
mIsEnabled, mIsInitialized, mListenerList, mName, mReason
Constructor and Description |
---|
SwingListSelectionState(JComboBox pComboBox)
Creates a new state, using the selection model of the handed combobox
as its state source.
|
SwingListSelectionState(JComboBox pComboBox,
int pIndex)
Creates a new state, using the selection model of the handed table
as its state source.
|
SwingListSelectionState(JComboBox pComboBox,
int pIndex,
boolean pReverseIndex)
Creates a new state, using the selection model of the handed table
as its state source.
|
SwingListSelectionState(JList pList)
Creates a new state, using the selection model of the handed list
as its state source.
|
SwingListSelectionState(JList pList,
int pIndex)
Creates a new state, using the selection model of the handed list
as its state source.
|
SwingListSelectionState(JList pList,
int pIndex,
boolean pReverseIndex)
Creates a new state, using the selection model of the handed list
as its state source.
|
SwingListSelectionState(JTable pTable)
Creates a new state, using the selection model of the handed table
as its state source.
|
SwingListSelectionState(JTable pTable,
int pIndex)
Creates a new state, using the selection model of the handed table
as its state source.
|
SwingListSelectionState(JTable pTable,
int pIndex,
boolean pReverseIndex)
Creates a new state, using the selection model of the handed table
as its state source.
|
SwingListSelectionState(ListSelectionModel pSelectionModel,
int pIndex)
Creates a new state, using the handed selection model as its state source.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent pEvent)
Handler for combobox callbacks.
|
void |
contentsChanged(ListDataEvent pEvent)
Called whenever our combo box or list data data changes.
|
protected boolean |
getInternalState()
Check if mListIndex is selected, if mListIndex is NO_SELECTION, check if there is no selection.
|
void |
intervalAdded(ListDataEvent pEvent)
Called whenever our combo box or list data data changes.
|
void |
intervalRemoved(ListDataEvent pEvent)
Called whenever our combo box or list data data changes.
|
void |
setCompareContent(int pIndex)
Sets the index we try to find in the list selection.
|
protected void |
setReason()
Set the source of the state as the reason for a change.
|
void |
tableChanged(TableModelEvent pEvent)
Called whenever our table model changes.
|
void |
valueChanged(ListSelectionEvent pEvent)
Called whenever the value of the selection changes.
|
checkStateChange, isSilent, setSilent
addChangeListener, checkDisposed, dispose, fireStateChanged, getChangeReason, getDependents, getName, isDisposed, isEnabled, isInitialized, removeChangeListener, setName, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addChangeListener, dispose, getChangeReason, getDependents, getName, isDisposed, isEnabled, isInitialized, removeChangeListener, setName
public static final int NO_SELECTION
public SwingListSelectionState(JList pList)
pList
- list we take the selection model from, must not be nullpublic SwingListSelectionState(JList pList, int pIndex)
pList
- list we take the selection model from, must not be nullpIndex
- user-provided index we check the selection againstpublic SwingListSelectionState(JList pList, int pIndex, boolean pReverseIndex)
pList
- list we take the selection model from, must not be nullpIndex
- user-provided index we check the selection againstpReverseIndex
- flag if we should take the index as a reverse indexpublic SwingListSelectionState(JTable pTable)
pTable
- table we take the selection model from, must not be nullpublic SwingListSelectionState(JTable pTable, int pIndex)
pTable
- table we take the selection model from.pIndex
- user-provided index we check the selection againstpublic SwingListSelectionState(JTable pTable, int pIndex, boolean pReverseIndex)
pTable
- table we take the selection model from.pIndex
- user-provided index we check the selection againstpReverseIndex
- flag if we should take the index as a reverse indexpublic SwingListSelectionState(ListSelectionModel pSelectionModel, int pIndex)
pSelectionModel
- the selection we monitorpIndex
- user-provided index we check the selection againstpublic SwingListSelectionState(JComboBox pComboBox)
pComboBox
- combobox we take the model from, must not be nullpublic SwingListSelectionState(JComboBox pComboBox, int pIndex)
pComboBox
- combobox we take the model from, must not be nullpIndex
- user-provided index we check the selection againstpublic SwingListSelectionState(JComboBox pComboBox, int pIndex, boolean pReverseIndex)
pComboBox
- combobox we take the model from, must not be nullpIndex
- user-provided index we check the selection againstpReverseIndex
- flag if we should take the index as a reverse indexpublic void setCompareContent(int pIndex)
pIndex
- user-provided index we check the selection againstpublic void valueChanged(ListSelectionEvent pEvent)
valueChanged
in interface ListSelectionListener
pEvent
- the event that characterizes the change.public void tableChanged(TableModelEvent pEvent)
tableChanged
in interface TableModelListener
pEvent
- the event that characterizes the change.public void intervalAdded(ListDataEvent pEvent)
intervalAdded
in interface ListDataListener
pEvent
- the event that characterizes the change.public void intervalRemoved(ListDataEvent pEvent)
intervalRemoved
in interface ListDataListener
pEvent
- the event that characterizes the change.public void contentsChanged(ListDataEvent pEvent)
contentsChanged
in interface ListDataListener
pEvent
- the event that characterizes the change.public void actionPerformed(ActionEvent pEvent)
actionPerformed
in interface ActionListener
pEvent
- not usedprotected boolean getInternalState()
getInternalState
in class AbstractSwingState
protected void setReason()
setReason
in class AbstractSwingState
Copyright © 2017 Jürgen Zeller (privat). All rights reserved.