Package hec.ui
Class TristateDecorator
java.lang.Object
hec.ui.TristateDecorator
- All Implemented Interfaces:
ItemSelectable,ButtonModel
- Direct Known Subclasses:
TristateCheckBoxRenderer
Author: Dr. Heinz M. Kabutz
Changed some by Shannon Larson
Restricted feature added by Mike Perryman
Exactly which Design Pattern is this? Is it an Adapter,
a Proxy or a Decorator? In this case, my vote lies with the
Decorator, because we are extending functionality and
"decorating" the original model with a more powerful model.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidintObject[]getState()The current state is embedded in the selection / armed state of the model.booleanisArmed()All these methods simply delegate to the "other" model that is being decorated.booleanbooleanbooleanbooleanvoidWe rotate between NOT_SELECTED, SELECTED and SEMI_SELECTED.voidnextState(boolean restricted) We rotate between NOT_SELECTED, SELECTED and SEMI_SELECTED.voidvoidvoidvoidvoidsetArmed(boolean b) Filter: No one may change the armed status except us.voidsetEnabled(boolean b) We disable focusing on the component when it is not enabled.voidsetGroup(ButtonGroup group) voidsetMnemonic(int key) voidsetPressed(boolean b) voidsetRollover(boolean b) voidsetSelected(boolean b) voidsetState(TristateCheckBox.State state) Sets the state.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.swing.ButtonModel
getGroup
-
Constructor Details
-
TristateDecorator
Instantiates a new tristate decorator.- Parameters:
other- the other
-
-
Method Details
-
setState
Sets the state.- Parameters:
state- the new state
-
getState
The current state is embedded in the selection / armed state of the model. We return the SELECTED state when the check box is selected but not armed, SEMI_SELECTED state when the check box is selected and armed (grey) and NOT_SELECTED when the check box is de-selected.- Returns:
- the state
-
nextState
public void nextState()We rotate between NOT_SELECTED, SELECTED and SEMI_SELECTED. -
nextState
public void nextState(boolean restricted) We rotate between NOT_SELECTED, SELECTED and SEMI_SELECTED. -
setArmed
public void setArmed(boolean b) Filter: No one may change the armed status except us.- Specified by:
setArmedin interfaceButtonModel- Parameters:
b- the new armed
-
setEnabled
public void setEnabled(boolean b) We disable focusing on the component when it is not enabled.- Specified by:
setEnabledin interfaceButtonModel- Parameters:
b- the new enabled
-
isArmed
public boolean isArmed()All these methods simply delegate to the "other" model that is being decorated.- Specified by:
isArmedin interfaceButtonModel- Returns:
- true, if is armed
-
isSelected
public boolean isSelected()- Specified by:
isSelectedin interfaceButtonModel
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceButtonModel
-
isPressed
public boolean isPressed()- Specified by:
isPressedin interfaceButtonModel
-
isRollover
public boolean isRollover()- Specified by:
isRolloverin interfaceButtonModel
-
setSelected
public void setSelected(boolean b) - Specified by:
setSelectedin interfaceButtonModel
-
setPressed
public void setPressed(boolean b) - Specified by:
setPressedin interfaceButtonModel
-
setRollover
public void setRollover(boolean b) - Specified by:
setRolloverin interfaceButtonModel
-
setMnemonic
public void setMnemonic(int key) - Specified by:
setMnemonicin interfaceButtonModel
-
getMnemonic
public int getMnemonic()- Specified by:
getMnemonicin interfaceButtonModel
-
setActionCommand
- Specified by:
setActionCommandin interfaceButtonModel
-
getActionCommand
- Specified by:
getActionCommandin interfaceButtonModel
-
setGroup
- Specified by:
setGroupin interfaceButtonModel
-
addActionListener
- Specified by:
addActionListenerin interfaceButtonModel
-
removeActionListener
- Specified by:
removeActionListenerin interfaceButtonModel
-
addItemListener
- Specified by:
addItemListenerin interfaceButtonModel- Specified by:
addItemListenerin interfaceItemSelectable
-
removeItemListener
- Specified by:
removeItemListenerin interfaceButtonModel- Specified by:
removeItemListenerin interfaceItemSelectable
-
addChangeListener
- Specified by:
addChangeListenerin interfaceButtonModel
-
removeChangeListener
- Specified by:
removeChangeListenerin interfaceButtonModel
-
getSelectedObjects
- Specified by:
getSelectedObjectsin interfaceItemSelectable
-