org.xwiki.gwt.wysiwyg.client.plugin.format.exec
Class RemoveFormatExecutable

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.user.client.ui.rta.cmd.internal.InlineStyleExecutable
              extended by org.xwiki.gwt.user.client.ui.rta.cmd.internal.ToggleInlineStyleExecutable
                  extended by org.xwiki.gwt.wysiwyg.client.plugin.format.exec.RemoveFormatExecutable
All Implemented Interfaces:
Executable

public class RemoveFormatExecutable
extends org.xwiki.gwt.user.client.ui.rta.cmd.internal.ToggleInlineStyleExecutable

Removes the in-line style from the current selection.

Version:
$Id: 97a740c1f487d39945fc0f8c2e10404194fc7232 $

Field Summary
static String CSS_TEXT
          The property of the style object which holds the value of the style attribute.
static List<String> DO_NOT_SPLIT
          The list of HTML tags that shouldn't be split while removing the in-line style.
 
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
RemoveFormatExecutable(RichTextArea rta)
          Creates a new executable that can be used to remove the in-line style from the current text selection.
 
Method Summary
protected  Stack<com.google.gwt.dom.client.Node> getInlineAncestorsStack(com.google.gwt.dom.client.Node node)
          Computes the stack of in-line ancestors, starting with the given node and ending with its top most in-line ancestor.
 String getParameter()
          
 boolean isExecuted()
          
protected  void isolateUpTo(com.google.gwt.dom.client.Node child, com.google.gwt.dom.client.Node top)
          Isolates the ancestors of the given child node up to the specified top ancestor.
protected  TextFragment removeStyle(Text text, int firstCharIndex, int lastCharIndex)
          
protected  void reorder(com.google.gwt.dom.client.Node top, com.google.gwt.dom.client.Node child)
          Moves the parent of the given child node before the specified top and replicates three times the ancestors up to the top: once for the left siblings of the given child node, once the child node itself and once for the right siblings of the given child node.
protected  boolean splitParenStyle(com.google.gwt.dom.client.Node child)
          Removes the in-line style from the parent of the given node and applies it to the given node's siblings.
 
Methods inherited from class org.xwiki.gwt.user.client.ui.rta.cmd.internal.ToggleInlineStyleExecutable
addStyle, execute, execute, isExecuted, matchesInheritedStyle, matchesStyle, matchesStyle
 
Methods inherited from class org.xwiki.gwt.user.client.ui.rta.cmd.internal.InlineStyleExecutable
addStyle, execute, getNonEmptyTextNodes, getParameter, getParameter, getParameter, getProperty
 
Methods inherited from class org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractSelectionExecutable
hasValidSelection, isEnabled
 
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

CSS_TEXT

public static final String CSS_TEXT
The property of the style object which holds the value of the style attribute.

See Also:
Constant Field Values

DO_NOT_SPLIT

public static final List<String> DO_NOT_SPLIT
The list of HTML tags that shouldn't be split while removing the in-line style. Don't include the span tag in this list!

Constructor Detail

RemoveFormatExecutable

public RemoveFormatExecutable(RichTextArea rta)
Creates a new executable that can be used to remove the in-line style from the current text selection.

Parameters:
rta - the execution target
Method Detail

removeStyle

protected TextFragment removeStyle(Text text,
                                   int firstCharIndex,
                                   int lastCharIndex)

Overrides:
removeStyle in class org.xwiki.gwt.user.client.ui.rta.cmd.internal.ToggleInlineStyleExecutable
See Also:
ToggleInlineStyleExecutable.removeStyle(Text, int, int)

getInlineAncestorsStack

protected Stack<com.google.gwt.dom.client.Node> getInlineAncestorsStack(com.google.gwt.dom.client.Node node)
Computes the stack of in-line ancestors, starting with the given node and ending with its top most in-line ancestor.

Parameters:
node - a DOM node
Returns:
the stack of in-line ancestors of the given node

splitParenStyle

protected boolean splitParenStyle(com.google.gwt.dom.client.Node child)
Removes the in-line style from the parent of the given node and applies it to the given node's siblings.

Parameters:
child - a DOM node
Returns:
true if the in-line style has been split, false otherwise

reorder

protected void reorder(com.google.gwt.dom.client.Node top,
                       com.google.gwt.dom.client.Node child)
Moves the parent of the given child node before the specified top and replicates three times the ancestors up to the top: once for the left siblings of the given child node, once the child node itself and once for the right siblings of the given child node.

Parameters:
top - the ancestor before which the parent is moved
child - the child node whose parent is moved before the top

isolateUpTo

protected void isolateUpTo(com.google.gwt.dom.client.Node child,
                           com.google.gwt.dom.client.Node top)
Isolates the ancestors of the given child node up to the specified top ancestor.

Parameters:
child - the child node whose ancestors will be isolated
top - the top most ancestor that will be isolated

isExecuted

public boolean isExecuted()

Specified by:
isExecuted in interface Executable
Overrides:
isExecuted in class org.xwiki.gwt.user.client.ui.rta.cmd.internal.ToggleInlineStyleExecutable
See Also:
ToggleInlineStyleExecutable.isExecuted()

getParameter

public String getParameter()

Specified by:
getParameter in interface Executable
Overrides:
getParameter in class org.xwiki.gwt.user.client.ui.rta.cmd.internal.InlineStyleExecutable
See Also:
InlineStyleExecutable.getParameter()


Copyright © 2004–2014 XWiki. All rights reserved.