Package net.sf.jguiraffe.gui.cmd
Class CommandWrapper
- java.lang.Object
-
- net.sf.jguiraffe.gui.cmd.CommandWrapper
-
- All Implemented Interfaces:
Command
public class CommandWrapper extends Object implements Command
A wrapper implementation of the
Commandinterface.An instance of this class is initialized with another
Commandobject. It implements all methods defined by theCommandinterface by delegating to the wrappedCommandobject. Thus this class can serve as a base class for command implementations that need to alter certain behavior of other command objects.- Version:
- $Id: CommandWrapper.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description CommandWrapper(Command wrappedCmd)Creates a new instance ofCommandWrapperand initializes it with the wrapped command.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()Executes this command.RunnablegetGUIUpdater()Returns the object for the updating the UI after execution of the command.CommandgetWrappedCommand()Returns theCommandobject that is wrapped by this object.voidonException(Throwable t)Notifies this command about an exception that occurred during execution.voidonFinally()This method is called after the execution of the command.
-
-
-
Constructor Detail
-
CommandWrapper
public CommandWrapper(Command wrappedCmd)
Creates a new instance ofCommandWrapperand initializes it with the wrapped command.- Parameters:
wrappedCmd- the wrapped command (must not be null)- Throws:
IllegalArgumentException- if the wrapped command is null
-
-
Method Detail
-
getWrappedCommand
public final Command getWrappedCommand()
Returns theCommandobject that is wrapped by this object.- Returns:
- the wrapped
Command
-
execute
public void execute() throws ExceptionExecutes this command. This implementation delegates to the wrapped command.
-
getGUIUpdater
public Runnable getGUIUpdater()
Returns the object for the updating the UI after execution of the command. This implementation delegates to the wrapped command.- Specified by:
getGUIUpdaterin interfaceCommand- Returns:
- the object for updating the UI
-
onException
public void onException(Throwable t)
Notifies this command about an exception that occurred during execution. This implementation delegates to the wrapped command.- Specified by:
onExceptionin interfaceCommand- Parameters:
t- the exception
-
-