|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.zaval.lw.LwSwitchManager
This abstract class can be used to control state of switching components.
The switching component is a component that can have one of the following two states: "off" or "on".
The class provides ability to control state of the component by getState
setState
methods. The abstract methods have to be implemented.
It is possible to organize combined action for a set of switching components. For example,
if we have group of switching components where only one component can be "on" at the given
moment than we can use the class to implement appropriate switch manager. First of all we
should have ability to register and unregister the components as a members of the set.
For the purpose the class provides
install
and uninstall
methods. Than we should implement
getState
and setState
abstract methods. The input argument
for install
, uninstall
and setState
methods is Switchable
interface. The interface has to be used as a callback interface to notify a switching
component by calling switchedOff
and switchedOn
methods about
changing state of the switching component.
The switch manager has to perform action events when a state has been changed. Use
addActionListener
and removeActionListener
to register and
unregister listeners of the events.
Constructor Summary | |
LwSwitchManager()
|
Method Summary | |
void |
addActionListener(LwActionListener a)
Adds the specified action listener to receive action events from this manager. |
abstract boolean |
getState(Switchable o)
Gets state for the specified switching component. |
void |
install(Switchable o)
Registers the specified switching component that wants to use the manager. |
protected void |
perform(Switchable s)
Fires the action event for the list of LwActionListener with the specified switching component as the event source. |
void |
removeActionListener(LwActionListener a)
Removes the specified action listener so it no longer receives action events from this manager. |
abstract void |
setState(Switchable o,
boolean b)
Sets the specified state for the switching component. |
void |
uninstall(Switchable o)
Unregisters the specified switching component that doesn't want to use the manager. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LwSwitchManager()
Method Detail |
public void install(Switchable o)
o
- the specified switching component.public void uninstall(Switchable o)
o
- the specified switching component.public void addActionListener(LwActionListener a)
a
- the specified action listener.public void removeActionListener(LwActionListener a)
a
- the specified action listener.protected void perform(Switchable s)
s
- the specified switching component.public abstract boolean getState(Switchable o)
o
- the specified switching component.true
if the switching component has "on" state, false
if it has "off" state.public abstract void setState(Switchable o, boolean b)
o
- the specified switching component.b
- the specified state. The true
value corresponds to
"on" state and false
value corresponds to "off" state.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |