org.xwiki.gwt.wysiwyg.client.plugin.style.exec
Class BlockStyleNameExecutable

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.AbstractBlockExecutable
              extended by org.xwiki.gwt.user.client.ui.rta.cmd.internal.BlockStyleExecutable
                  extended by org.xwiki.gwt.wysiwyg.client.plugin.style.exec.BlockStyleNameExecutable
All Implemented Interfaces:
Executable

public class BlockStyleNameExecutable
extends org.xwiki.gwt.user.client.ui.rta.cmd.internal.BlockStyleExecutable

Applies a given style name to each of the block nodes touched by the current text selection.

Version:
$Id: BlockStyleNameExecutable.java 33189 2010-11-30 13:57:38Z mflorea $

Field Summary
 
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
BlockStyleNameExecutable(RichTextArea rta)
          Creates a new instance.
 
Method Summary
protected  void addStyle(Element element, java.lang.String styleName)
          
protected  void execute(com.google.gwt.dom.client.Node node, int startOffset, int endOffset, java.lang.String value)
          
 boolean execute(java.lang.String parameter)
          
 java.lang.String getParameter()
          
protected  java.util.Set<java.lang.String> getStyleNames(com.google.gwt.dom.client.Node node)
           
protected  java.util.Set<java.lang.String> getStyleNames(Range range)
           
protected  java.util.Set<java.lang.String> getStyleNames(Selection selection)
           
 boolean isExecuted()
          
protected  boolean matchesStyleName(com.google.gwt.dom.client.Node node, java.lang.String styleName)
           
protected  void removeStyleName(com.google.gwt.dom.client.Node node, java.lang.String styleName)
          Removes the specified style name from the block-level ancestors of the given DOM node.
 
Methods inherited from class org.xwiki.gwt.user.client.ui.rta.cmd.internal.BlockStyleExecutable
getParameter
 
Methods inherited from class org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractBlockExecutable
execute, execute, getParameter, wrap
 
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
 

Constructor Detail

BlockStyleNameExecutable

public BlockStyleNameExecutable(RichTextArea rta)
Creates a new instance.

Parameters:
rta - the execution target
Method Detail

execute

public boolean execute(java.lang.String parameter)

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

execute

protected void execute(com.google.gwt.dom.client.Node node,
                       int startOffset,
                       int endOffset,
                       java.lang.String value)

Overrides:
execute in class org.xwiki.gwt.user.client.ui.rta.cmd.internal.BlockStyleExecutable
See Also:
BlockStyleExecutable.execute(Node, int, int, String)

addStyle

protected void addStyle(Element element,
                        java.lang.String styleName)

Overrides:
addStyle in class org.xwiki.gwt.user.client.ui.rta.cmd.internal.BlockStyleExecutable
See Also:
BlockStyleExecutable.addStyle(Element, String)

removeStyleName

protected void removeStyleName(com.google.gwt.dom.client.Node node,
                               java.lang.String styleName)
Removes the specified style name from the block-level ancestors of the given DOM node.

Parameters:
node - a DOM node
styleName - the style name to be removed

matchesStyleName

protected boolean matchesStyleName(com.google.gwt.dom.client.Node node,
                                   java.lang.String styleName)
Parameters:
node - a DOM node
styleName - a style name
Returns:
true if any of the block-level ancestors of the given node has the specified style name, false otherwise

getParameter

public java.lang.String getParameter()

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

getStyleNames

protected java.util.Set<java.lang.String> getStyleNames(Selection selection)
Parameters:
selection - a text selection
Returns:
the set of style names that affect all the text nodes touched by the given text selection

getStyleNames

protected java.util.Set<java.lang.String> getStyleNames(Range range)
Parameters:
range - a text range
Returns:
the set of style names that affect all the leafs in the given DOM range

getStyleNames

protected java.util.Set<java.lang.String> getStyleNames(com.google.gwt.dom.client.Node node)
Parameters:
node - a DOM node
Returns:
the set of style names that affect the block-level ancestors of the given DOM node

isExecuted

public boolean isExecuted()

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


Copyright © 2004-2011 XWiki. All Rights Reserved.