org.xwiki.gwt.wysiwyg.client.plugin.indent.exec
Class IndentExecutable

java.lang.Object
  extended by org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractRichTextAreaExecutable
      extended by org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractSelectionExecutable
          extended by org.xwiki.gwt.wysiwyg.client.plugin.indent.exec.AbstractListExecutable
              extended by org.xwiki.gwt.wysiwyg.client.plugin.indent.exec.IndentExecutable
All Implemented Interfaces:
Executable

public class IndentExecutable
extends AbstractListExecutable

Indent executable to handle valid XHTML lists indent, semantically: when a list item is indented, all its subitems are indented as well.

Version:
$Id: 086344e0da735b63a6d861e9e06d0dbf23451d36 $

Field Summary
 
Fields inherited from class org.xwiki.gwt.wysiwyg.client.plugin.indent.exec.AbstractListExecutable
LIST_ITEM_TAG, ORDERED_LIST_TAG, UNORDERED_LIST_TAG
 
Fields inherited from class org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractSelectionExecutable
cache, domUtils
 
Fields inherited from class org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractRichTextAreaExecutable
rta
 
Constructor Summary
IndentExecutable(RichTextArea rta)
          Creates a new executable that can be used to indent list items inside the specified rich text area.
 
Method Summary
protected  boolean canExecute(Element listItem)
          Checks if this command can be executed on a single list item.
protected  void execute(Element listItem)
          Actually executes the operation on a single list item.
protected  boolean executeOnMultipleItems(Range range, boolean perform)
          Executes this list operation on all items in the non-collapsed selection.
 
Methods inherited from class org.xwiki.gwt.wysiwyg.client.plugin.indent.exec.AbstractListExecutable
execute, getListItem, isEnabled, isList
 
Methods inherited from class org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractSelectionExecutable
getParameter, hasValidSelection, isExecuted
 
Methods inherited from class org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractRichTextAreaExecutable
isSupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndentExecutable

public IndentExecutable(RichTextArea rta)
Creates a new executable that can be used to indent list items inside the specified rich text area.

Parameters:
rta - the execution target
Method Detail

executeOnMultipleItems

protected boolean executeOnMultipleItems(Range range,
                                         boolean perform)
Executes this list operation on all items in the non-collapsed selection. The perform parameter specifies if the operation is actually performed or just checked to be possible (while this kind of parameters are not good practice, it's the best way right now to make sure we use the same detection algorithm in the #execute(RichTextArea, String) and #isEnabled(RichTextArea) functions).

Specified by:
executeOnMultipleItems in class AbstractListExecutable
Parameters:
range - the current range to execute the operation on
perform - true if the operation is to be actually executed, false if it's only to be checked
Returns:
true if at least one of the items in the selection was affected, false otherwise.

canExecute

protected boolean canExecute(Element listItem)
Checks if this command can be executed on a single list item.

Overrides:
canExecute in class AbstractListExecutable
Parameters:
listItem - the list item to check if the command can be executed on
Returns:
true if the command can be executed, false otherwise

execute

protected void execute(Element listItem)
Actually executes the operation on a single list item. This should be called only after AbstractListExecutable.canExecute(Element) on the same list item returns true.. Performs the indent of the passed list item, if possible: it turns it into the child list item of its previous sibling, if such an element exists, also handling the merge if the previous sibling already has a sublist.

Specified by:
execute in class AbstractListExecutable
Parameters:
listItem - the list item to execute the operation on


Copyright © 2004-2012 XWiki. All Rights Reserved.