org.xwiki.gwt.user.client.ui.rta.cmd.internal
Class BlockStyleExecutable

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
All Implemented Interfaces:
Executable
Direct Known Subclasses:
BlockStyleNameExecutable

public class BlockStyleExecutable
extends AbstractBlockExecutable

Looks for the nearest block-level elements from the current selection and applies a specific style to them.


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
BlockStyleExecutable(RichTextArea rta, Property property)
          Creates a new instance that applies the given style property to the nearest block-level elements from the current selection in the specified rich text area.
 
Method Summary
protected  void addStyle(Element element, String value)
          Styles the given element.
protected  void execute(com.google.gwt.dom.client.Node node, int startOffset, int endOffset, String value)
          Processes the given node between the specified offsets.
protected  String getParameter(com.google.gwt.dom.client.Node node)
          
 
Methods inherited from class org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractBlockExecutable
execute, execute, execute, getParameter, getParameter, wrap
 
Methods inherited from class org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractSelectionExecutable
hasValidSelection, isEnabled, 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

BlockStyleExecutable

public BlockStyleExecutable(RichTextArea rta,
                            Property property)
Creates a new instance that applies the given style property to the nearest block-level elements from the current selection in the specified rich text area.

Parameters:
rta - the execution target
property - the style property to be applied
Method Detail

execute

protected void execute(com.google.gwt.dom.client.Node node,
                       int startOffset,
                       int endOffset,
                       String value)
Processes the given node between the specified offsets. For a text node the offset if a position between its characters; for an element the offset is a position between its child nodes.

Applies the underlying style property with the specified value to the nearest block-level ancestor of the given node.

Specified by:
execute in class AbstractBlockExecutable
Parameters:
node - the DOM node to be processed
startOffset - the start offset within the give node
endOffset - the end offset within the given node
value - the execution parameter
See Also:
AbstractStyleExecutable#execute(Node, int, int, String)

addStyle

protected void addStyle(Element element,
                        String value)
Styles the given element.

Parameters:
element - the element to be styled
value - the value of the style property that is set

getParameter

protected String getParameter(com.google.gwt.dom.client.Node node)

Returns the value of the underlying style property for the nearest block-level ancestor of the given node.

Specified by:
getParameter in class AbstractBlockExecutable
Parameters:
node - a DOM node
Returns:
the execution parameter if this executable has been called on the given node, null otherwise
See Also:
AbstractStyleExecutable#getParameter(Node)