|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||
com.sas.swing.visuals.util.ChangeEnabledStateCommand
public class ChangeEnabledStateCommand
A command for changing a component's enabled state. The command may be executed any number of times with different components and supports undo, and thus provides an easy way to temporarily change the enabled state for a set of components. For example,
// create command to disable components
ChangeEnabledStateCommand cmd = new ChangeEnabledStateCommand (false);
// apply the command to our container and all its children
com.sas.swing.visuals.util.Util.apply (container, cmd);
// do some work
[...]
// restore the container and its children back to their original enabled state
cmd.undoAll ();
CompositeCommand,
ChangeCursorCommand,
DisableCommand,
Util.apply(java.awt.Component, com.sas.util.ApplyInterface)| Field Summary |
|---|
| Fields inherited from interface com.sas.util.ApplyInterface |
|---|
ABORT, CONTINUE |
| Constructor Summary | |
|---|---|
ChangeEnabledStateCommand(boolean state)
Constructor. |
|
| Method Summary | |
|---|---|
int |
apply(java.lang.Object obj)
Alias for execute(obj). |
java.lang.Object |
clone()
Clones this command. |
void |
execute(java.lang.Object obj)
Changes the enabled state for a given component. |
boolean |
getEnabledState()
Returns the enabled state that this command uses. |
java.lang.String |
getText()
Placeholder to satisy interface requirements. |
boolean |
isExecutable()
Returns true since this command is executable. |
boolean |
isUndoable()
Returns true since this command is undoable. |
void |
setText(java.lang.String text)
Placeholder to satisy interface requirements; does nothing. |
void |
undo()
Undoes the most recent enabled state change, if any. |
void |
undoAll()
Undoes all state changes, if any. |
| Constructor Detail |
|---|
public ChangeEnabledStateCommand(boolean state)
state - the enabled state to change to when executedgetEnabledState(),
execute(java.lang.Object)| Method Detail |
|---|
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface com.sas.PublicClonableclone in interface com.sas.util.Commandclone in class java.lang.Objectjava.lang.CloneNotSupportedException - this class supports cloning, but a subclass may notpublic boolean getEnabledState()
public boolean isExecutable()
true since this command is executable.
isExecutable in interface com.sas.util.Commandtrueexecute(java.lang.Object)public void execute(java.lang.Object obj)
execute in interface com.sas.util.SimpleCommandobj - must be an instance of java.awt.Componentundo()public int apply(java.lang.Object obj)
execute(obj).
apply in interface com.sas.util.ApplyInterfaceobj - must be an instance of java.awt.Component
ApplyInterface.CONTINUEexecute(java.lang.Object)public boolean isUndoable()
true since this command is undoable.
isUndoable in interface com.sas.util.Commandtrueundo()public void undo()
undo in interface com.sas.util.Commandexecute(java.lang.Object),
undoAll()public void undoAll()
undo()public java.lang.String getText()
getText in interface com.sas.lang.StringDataInterfacesetText(java.lang.String)public void setText(java.lang.String text)
setText in interface com.sas.lang.StringDataInterfacegetText()
|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||