com.realtime.crossfire.jxclient.gui.commands
Class ToggleCommand

java.lang.Object
  extended by com.realtime.crossfire.jxclient.gui.commands.ToggleCommand
All Implemented Interfaces:
GUICommand

public class ToggleCommand
extends java.lang.Object
implements GUICommand

A GUICommand which toggles the visibility of a target GUIElement.


Field Summary
private  GUIElement target
          The gui element to toggle.
 
Constructor Summary
ToggleCommand(GUIElement target)
          Creates a new instance.
 
Method Summary
 boolean canExecute()
          Returns whether this command may be executed.
 void execute()
          Executes the command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

target

@NotNull
private final GUIElement target
The gui element to toggle.

Constructor Detail

ToggleCommand

public ToggleCommand(@NotNull
                     GUIElement target)
Creates a new instance.

Parameters:
target - the gui element to toggle
Method Detail

canExecute

public boolean canExecute()
Returns whether this command may be executed.

Specified by:
canExecute in interface GUICommand
Returns:
whether this command may be executed

execute

public void execute()
Executes the command. Does nothing if called while GUICommand.canExecute() returns false.

Specified by:
execute in interface GUICommand