org.xwiki.gwt.user.client.ui.rta.cmd
Interface CommandManager

All Superinterfaces:
SourcesCommandEvents

public interface CommandManager
extends SourcesCommandEvents

Interface for executing commands on a rich text area and for retrieving informations about the state of these commands. This is the recommended way of altering the document edited with the rich text area because others can be notified about these changes. A group of changes to the edited document, with a well defined purpose, should be grouped in a command.

Version:
$Id: CommandManager.java 24888 2009-11-06 02:16:19Z sdumitriu $

Method Summary
 boolean execute(Command cmd)
          Executes a command on the current selection of the document edited with the underlying rich text area.
 boolean execute(Command cmd, boolean param)
          Executes a command on the current selection of the document edited with the underlying rich text area.
 boolean execute(Command cmd, int param)
          Executes a command on the current selection of the document edited with the underlying rich text area.
 boolean execute(Command cmd, java.lang.String param)
          Executes a command on the current selection of the document edited with the underlying rich text area.
 java.lang.Boolean getBooleanValue(Command cmd)
          Returns the value of the given command for the current selection in the document edited with the underlying rich text area.
 Executable getExecutable(Command command)
           
 java.lang.Integer getIntegerValue(Command cmd)
          Returns the value of the given command for the current selection in the document edited with the underlying rich text area.
 java.lang.String getStringValue(Command cmd)
          Returns the value of the given command for the current selection in the document edited with the underlying rich text area.
 boolean isEnabled(Command cmd)
          Returns a boolean value that indicates whether the specified command can be successfully executed using execute(Command, String), given the current selection of the document edited with the underlying rich text area.
 boolean isExecuted(Command cmd)
          Returns a boolean value that indicates the current state of the given command.
 boolean isSupported(Command cmd)
          Returns a boolean value that indicates whether the current command is supported by the underlying rich text area.
 Executable registerCommand(Command command, Executable executable)
          Associates the given command with the specified executable.
 Executable unregisterCommand(Command command)
          Unregisters the given command.
 
Methods inherited from interface org.xwiki.gwt.user.client.ui.rta.cmd.SourcesCommandEvents
addCommandListener, removeCommandListener
 

Method Detail

execute

boolean execute(Command cmd,
                java.lang.String param)
Executes a command on the current selection of the document edited with the underlying rich text area.

Parameters:
cmd - The command to execute.
param - The parameter of the command.
Returns:
true if the command is executed successfully.

execute

boolean execute(Command cmd,
                int param)
Executes a command on the current selection of the document edited with the underlying rich text area.

Parameters:
cmd - The command to execute.
param - The parameter of the command.
Returns:
true if the command is executed successfully.

execute

boolean execute(Command cmd,
                boolean param)
Executes a command on the current selection of the document edited with the underlying rich text area.

Parameters:
cmd - The command to execute.
param - The parameter of the command.
Returns:
true if the command is executed successfully.

execute

boolean execute(Command cmd)
Executes a command on the current selection of the document edited with the underlying rich text area.

Parameters:
cmd - The command to execute.
Returns:
true if the command is executed successfully.

isEnabled

boolean isEnabled(Command cmd)
Returns a boolean value that indicates whether the specified command can be successfully executed using execute(Command, String), given the current selection of the document edited with the underlying rich text area.

Parameters:
cmd - The command to test.
Returns:
true if the command is enabled.

isExecuted

boolean isExecuted(Command cmd)
Returns a boolean value that indicates the current state of the given command.

Parameters:
cmd - The command to test.
Returns:
true if the given command has been executed on the current selection.

isSupported

boolean isSupported(Command cmd)
Returns a boolean value that indicates whether the current command is supported by the underlying rich text area.

Parameters:
cmd - The command to test
Returns:
true if the command is supported.

getStringValue

java.lang.String getStringValue(Command cmd)
Returns the value of the given command for the current selection in the document edited with the underlying rich text area. In most of the cases this value is the parameter used for executing the command.

Parameters:
cmd - The command to query.
Returns:
the command value for current selection, if supported.

getIntegerValue

java.lang.Integer getIntegerValue(Command cmd)
Returns the value of the given command for the current selection in the document edited with the underlying rich text area. In most of the cases this value is the parameter used for executing the command.

Parameters:
cmd - The command to query.
Returns:
the command value for current selection, if supported.

getBooleanValue

java.lang.Boolean getBooleanValue(Command cmd)
Returns the value of the given command for the current selection in the document edited with the underlying rich text area. In most of the cases this value is the parameter used for executing the command.

Parameters:
cmd - The command to query.
Returns:
the command value for current selection, if supported.

registerCommand

Executable registerCommand(Command command,
                           Executable executable)
Associates the given command with the specified executable. From now on, whenever you execute(Command) the given command the specified executable will be execute in fact.

Parameters:
command - The command to be registered.
executable - The code to be associated with the given command. This code will be execute when the command is fired.
Returns:
The previous executable associated with the given command, if any, or null otherwise.

unregisterCommand

Executable unregisterCommand(Command command)
Unregisters the given command. As a consequence, further calls to execute(Command) will do nothing because there's no executable associated with the given command.

Parameters:
command - The command to be executed.
Returns:
The executable that was registered with the given command, if any, or null otherwise.

getExecutable

Executable getExecutable(Command command)
Parameters:
command - A command.
Returns:
The executable associated with the given command if there is one, or null otherwise.


Copyright © 2004-2010 XWiki. All Rights Reserved.