org.xwiki.gwt.user.client.ui.rta.cmd
Class Command

java.lang.Object
  extended by org.xwiki.gwt.user.client.ui.rta.cmd.Command

public class Command
extends java.lang.Object

Identifies an action that the user can take on a rich text area. So an instance of this class it's just an identifier. The code associated with the user action should be found in Executable. Commands should be registered with the CommandManager.

Version:
$Id: Command.java 24900 2009-11-06 16:53:01Z sdumitriu $

Field Summary
static Command BACK_COLOR
          This command will set the background color of the document.
static Command BOLD
          If there is no selection, the insertion point will set bold for subsequently typed characters.
If there is a selection and all of the characters are already bold, the bold will be removed.
static Command CREATE_LINK
          This command will insert a link in place of the current selection, either if it is a collapsed selection or an expanded one.
static Command DELETE
          Deletes the current selection.
static Command FONT_NAME
          This command will set the font face for a selection or at the insertion point if there is no selection.
The given string is such as would be used in the "name" attribute of the font tag.
static Command FONT_SIZE
          This command will set the font size for a selection or at the insertion point if there is no selection.
The given number is such as would be used in the "size" attribute of the font tag.
static Command FORE_COLOR
          This command will set the text color of the selection or at the insertion point.
static Command FORMAT_BLOCK
          Adds an HTML block-style tag around a selection or at the insertion point line.
static Command INDENT
          Indent the block where the caret is located.
static Command INSERT_BR_ON_RETURN
          Selects whether pressing return inside a paragraph creates another paragraph or just inserts a <br> tag.
static Command INSERT_HORIZONTAL_RULE
          This command will insert a horizontal rule (line) at the insertion point.
Does it delete the selection? Yes!
static Command INSERT_HTML
          This command will insert the given HTML into the <body> in place of the current selection or at the caret location.
The given string is the HTML to insert.
static Command INSERT_IMAGE
          This command will insert an image (referenced by the given url) at the insertion point.
static Command INSERT_ORDERED_LIST
          Depends on the selection.
static Command INSERT_PARAGRAPH
          Inserts a new paragraph.
static Command INSERT_UNORDERED_LIST
          Depends on the selection.
static Command ITALIC
          If there is no selection, the insertion point will set italic for subsequently typed characters.
If there is a selection and all of the characters are already italic, the italic will be removed.
static Command JUSTIFY_CENTER
          Center-aligns the current block.
static Command JUSTIFY_FULL
          Fully-justifies the current block.
static Command JUSTIFY_LEFT
          Left-aligns the current block.
static Command JUSTIFY_RIGHT
          Right aligns the current block.
protected  java.lang.String name
          The name of the command.
static Command OUTDENT
          Outdent the block where the caret is located.
static Command REDO
          This command will redo the previous undo action.
static Command REMOVE_FORMAT
          Removes inline formatting from the current selection.
static Command STRIKE_THROUGH
          If there is no selection, the insertion point will set strikethrough for subsequently typed characters.
If there is a selection and all of the characters are already striked, the strikethrough will be removed.
static Command STYLE_WITH_CSS
          This command is used for toggling the format of generated content.
static Command SUB_SCRIPT
          If there is no selection, the insertion point will set subscript for subsequently typed characters.
If there is a selection and all of the characters are already subscripted, the subscript will be removed.
static Command SUPER_SCRIPT
          If there is no selection, the insertion point will set superscript for subsequently typed characters.
If there is a selection and all of the characters are already superscripted, the superscript will be removed.
static Command TELETYPE
          If there is no selection, the insertion point will be set to teletype for subsequently typed characters.
If there is a selection and all of the characters have already teletype style, the teletype will be removed.
static Command UNDERLINE
          If there is no selection, the insertion point will set underline for subsequently typed characters.
If there is a selection and all of the characters are already underlined, the underline will be removed.
static Command UNDO
          This command will undo the previous action.
static Command UNLINK
          If the insertion point is within a link or if the current selection contains a link, the link will be removed and the text will remain.
 
Constructor Summary
Command(java.lang.String name)
          Creates a new command with the given name.
 
Method Summary
 boolean equals(java.lang.Object obj)
          
 int hashCode()
          
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

BACK_COLOR

public static final Command BACK_COLOR
This command will set the background color of the document.


BOLD

public static final Command BOLD
If there is no selection, the insertion point will set bold for subsequently typed characters.
If there is a selection and all of the characters are already bold, the bold will be removed. Otherwise, all selected characters will become bold.


CREATE_LINK

public static final Command CREATE_LINK
This command will insert a link in place of the current selection, either if it is a collapsed selection or an expanded one. It is based on the insert HTML command, and it will insert the link HTML received as a parameter.


DELETE

public static final Command DELETE
Deletes the current selection.


FONT_NAME

public static final Command FONT_NAME
This command will set the font face for a selection or at the insertion point if there is no selection.
The given string is such as would be used in the "name" attribute of the font tag.


FONT_SIZE

public static final Command FONT_SIZE
This command will set the font size for a selection or at the insertion point if there is no selection.
The given number is such as would be used in the "size" attribute of the font tag.


FORE_COLOR

public static final Command FORE_COLOR
This command will set the text color of the selection or at the insertion point.


FORMAT_BLOCK

public static final Command FORMAT_BLOCK
Adds an HTML block-style tag around a selection or at the insertion point line. Requires a tag-name string to be passed in as a value argument. Virtually all block style tags can be used (eg. "H1", "EM", "BUTTON", "TEXTAREA"). (Internet Explorer supports only heading tags H1 - H6, ADDRESS, and PRE.)


INDENT

public static final Command INDENT
Indent the block where the caret is located. If the caret is inside a list, that item becomes a sub-item one level deeper.


INSERT_BR_ON_RETURN

public static final Command INSERT_BR_ON_RETURN
Selects whether pressing return inside a paragraph creates another paragraph or just inserts a <br> tag.


INSERT_HORIZONTAL_RULE

public static final Command INSERT_HORIZONTAL_RULE
This command will insert a horizontal rule (line) at the insertion point.
Does it delete the selection? Yes!


INSERT_HTML

public static final Command INSERT_HTML
This command will insert the given HTML into the <body> in place of the current selection or at the caret location.
The given string is the HTML to insert.


INSERT_IMAGE

public static final Command INSERT_IMAGE
This command will insert an image (referenced by the given url) at the insertion point.


INSERT_ORDERED_LIST

public static final Command INSERT_ORDERED_LIST
Depends on the selection. If the caret is not inside a non-LI block, that block becomes the first LI and an OL. If the caret is inside a bulleted item, the bulleted item becomes a numbered item.


INSERT_UNORDERED_LIST

public static final Command INSERT_UNORDERED_LIST
Depends on the selection. If the caret is not inside a non-LI block, that block becomes the first LI and UL. If the caret is inside a numbered item, the numbered item becomes a bulleted item.


INSERT_PARAGRAPH

public static final Command INSERT_PARAGRAPH
Inserts a new paragraph.


ITALIC

public static final Command ITALIC
If there is no selection, the insertion point will set italic for subsequently typed characters.
If there is a selection and all of the characters are already italic, the italic will be removed. Otherwise, all selected characters will become italic.


JUSTIFY_CENTER

public static final Command JUSTIFY_CENTER
Center-aligns the current block.


JUSTIFY_FULL

public static final Command JUSTIFY_FULL
Fully-justifies the current block.


JUSTIFY_LEFT

public static final Command JUSTIFY_LEFT
Left-aligns the current block.


JUSTIFY_RIGHT

public static final Command JUSTIFY_RIGHT
Right aligns the current block.


OUTDENT

public static final Command OUTDENT
Outdent the block where the caret is located. If the block is not indented prior to calling outdent, nothing will happen.
If the caret is in a list item, the item will bump up a level in the list or break out of the list entirely.


REDO

public static final Command REDO
This command will redo the previous undo action. If undo was not the most recent action, this command will have no effect.


REMOVE_FORMAT

public static final Command REMOVE_FORMAT
Removes inline formatting from the current selection.


STRIKE_THROUGH

public static final Command STRIKE_THROUGH
If there is no selection, the insertion point will set strikethrough for subsequently typed characters.
If there is a selection and all of the characters are already striked, the strikethrough will be removed. Otherwise, all selected characters will have a line drawn through them.


STYLE_WITH_CSS

public static final Command STYLE_WITH_CSS
This command is used for toggling the format of generated content. By default (at least today), this is true. An example of the differences is that the "bold" command will generate <b> if the styleWithCSS command is false and generate css style attribute if the styleWithCSS command is true.


SUB_SCRIPT

public static final Command SUB_SCRIPT
If there is no selection, the insertion point will set subscript for subsequently typed characters.
If there is a selection and all of the characters are already subscripted, the subscript will be removed. Otherwise, all selected characters will be drawn slightly lower than normal text.


SUPER_SCRIPT

public static final Command SUPER_SCRIPT
If there is no selection, the insertion point will set superscript for subsequently typed characters.
If there is a selection and all of the characters are already superscripted, the superscript will be removed. Otherwise, all selected characters will be drawn slightly higher than normal text.


TELETYPE

public static final Command TELETYPE
If there is no selection, the insertion point will be set to teletype for subsequently typed characters.
If there is a selection and all of the characters have already teletype style, the teletype will be removed. Otherwise, all selected characters will become teletype.


UNDERLINE

public static final Command UNDERLINE
If there is no selection, the insertion point will set underline for subsequently typed characters.
If there is a selection and all of the characters are already underlined, the underline will be removed. Otherwise, all selected characters will become underlined.


UNDO

public static final Command UNDO
This command will undo the previous action. If no action has occurred in the document, then this command will have no effect.


UNLINK

public static final Command UNLINK
If the insertion point is within a link or if the current selection contains a link, the link will be removed and the text will remain.


name

protected java.lang.String name
The name of the command. For predefined commands (supported by the built-in rich text editor, the one offered by the browser) this is the name of the command execute with the native API. For the rest (custom commands) this is just a string identifier.

Constructor Detail

Command

public Command(java.lang.String name)
Creates a new command with the given name.

Parameters:
name - The name of the new command.
Method Detail

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(Object)


Copyright © 2004-2009 XWiki. All Rights Reserved.