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

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.OutdentExecutable
All Implemented Interfaces:
Executable

public class OutdentExecutable
extends AbstractListExecutable

Outdent executable to handle valid XHTML lists outdent, semantically: when a list item is outdented, all its subitems are outdented as well.

Version:
$Id: 805c2be60b5aa9e11ad2b934d15285ad2317493d $

Field Summary
protected static String LINE_BREAK_TAG
          Line break tag, to help manage empty list items after outdenting sublists.
 
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
OutdentExecutable(RichTextArea rta)
          Creates a new executable that can be used to decrease the identation of 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.
protected  void outdentFirstLevelItem(Element listItem, Element parentList)
          Outdents an element on the first level of the list, by splitting the list in two, and leaving the list item's content as text between the lists.
 void outdentItem(Element listItem, Element parentList, Element parentListItem)
          Actually executes the outdent on listItem, with respect to the list it takes part of.
 
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
 

Field Detail

LINE_BREAK_TAG

protected static final String LINE_BREAK_TAG
Line break tag, to help manage empty list items after outdenting sublists.

See Also:
Constant Field Values
Constructor Detail

OutdentExecutable

public OutdentExecutable(RichTextArea rta)
Creates a new executable that can be used to decrease the identation of list items inside the specified rich text area.

Parameters:
rta - the execution target
Method Detail

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. Moves the passed lust item one level up, as a next sibling of the list item it takes part of. If it's a first level list item, it is pulled out of its list.

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

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.

outdentItem

public void outdentItem(Element listItem,
                        Element parentList,
                        Element parentListItem)
Actually executes the outdent on listItem, with respect to the list it takes part of.

Parameters:
listItem - the list item to outdent
parentList - the list in which it is placed
parentListItem - the list item in which this sublist is placed

outdentFirstLevelItem

protected void outdentFirstLevelItem(Element listItem,
                                     Element parentList)
Outdents an element on the first level of the list, by splitting the list in two, and leaving the list item's content as text between the lists.

Parameters:
listItem - the list item that needs to be unindented
parentList - the parent list of this item


Copyright © 2004–2015 XWiki. All rights reserved.