public class ColumnControlButton.ColumnVisibilityAction extends AbstractActionExt
Action
which takes care of keeping in synch with
TableColumn state.
NOTE: client must call releaseColumn if this action is no longer needed!Modifier and Type | Field and Description |
---|---|
private TableColumn |
column |
private PropertyChangeListener |
columnListener |
private boolean |
fromColumn
flag to distinguish selection changes triggered by
column's property change from those triggered by
user interaction.
|
GROUP, IS_STATE, LARGE_ICON
changeSupport, enabled
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
Constructor and Description |
---|
ColumnVisibilityAction(TableColumn column)
Creates a action synched to the table column.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e)
Does nothing.
|
protected boolean |
canControlColumn()
Returns flag to indicate if column's visibility can
be controlled.
|
protected PropertyChangeListener |
createPropertyChangeListener()
Creates and returns the listener to column's property changes.
|
protected PropertyChangeListener |
getColumnListener()
Returns the listener to column's property changes.
|
private void |
installColumn(TableColumn column) |
boolean |
isEnabled()
Returns true if the action is enabled.
|
void |
itemStateChanged(ItemEvent e)
Callback method as
ItemListener . |
void |
releaseColumn()
Releases all references to the synched
TableColumn . |
private void |
reselect()
Enforces selected to
true . |
void |
setSelected(boolean newValue)
Changes the state of the action.
|
private void |
updateFromColumnHeader(Object value)
Synchs name property to value.
|
protected void |
updateFromColumnHideable(boolean hideable) |
private void |
updateFromColumnVisible(boolean visible)
Synchs selected property to visible.
|
dispose, getAccelerator, getActionCommand, getGroup, getLargeIcon, getLongDescription, getMnemonic, getName, getShortDescription, getSmallIcon, isSelected, isStateAction, setAccelerator, setActionCommand, setGroup, setLargeIcon, setLongDescription, setMnemonic, setMnemonic, setName, setShortDescription, setSmallIcon, setStateAction, setStateAction, toString
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, putValue, removePropertyChangeListener, setEnabled
private TableColumn column
private PropertyChangeListener columnListener
private boolean fromColumn
public ColumnVisibilityAction(TableColumn column)
column
- the TableColumn
to keep synched to.public void releaseColumn()
TableColumn
.
Client code must call this method if the
action is no longer needed. After calling this action must not be
used any longer.public boolean isEnabled()
isEnabled
in interface Action
isEnabled
in class AbstractAction
canControlColumn()
protected boolean canControlColumn()
TableColumnExt
.public void itemStateChanged(ItemEvent e)
AbstractActionExt
ItemListener
. Updates internal state based
on the given ItemEvent. Here: synchs selected property if isStateAction(), does nothing otherwise.
itemStateChanged
in interface ItemListener
itemStateChanged
in class AbstractActionExt
e
- the ItemEvent fired by a ItemSelectable on changing the selected
state.public void setSelected(boolean newValue)
AbstractActionExt
setSelected
in class AbstractActionExt
newValue
- true to set the action as selected of the action.Action.SELECTED_KEY
public void actionPerformed(ActionEvent e)
private void updateFromColumnVisible(boolean visible)
visible
property.visible
- column visible state to synch to.protected void updateFromColumnHideable(boolean hideable)
private void updateFromColumnHeader(Object value)
headerValue
property.value
- private void reselect()
true
. Called if user interaction
tried to de-select the last single visible column.private void installColumn(TableColumn column)
protected PropertyChangeListener getColumnListener()
PropertyChangeListener
listening to
TableColumn
's property changes, guaranteed to be
not null
.protected PropertyChangeListener createPropertyChangeListener()
Implementation note: this listener reacts to column's
visible
and headerValue
properties and
calls the respective updateFromXX
methodes.
PropertyChangeListener
to use with the
columnWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses