org.xwiki.gwt.user.client.ui.rta.cmd.internal
Class BlockStyleExecutable
java.lang.Object
org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractRichTextAreaExecutable
org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractSelectionExecutable
org.xwiki.gwt.user.client.ui.rta.cmd.internal.AbstractBlockExecutable
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.
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 targetproperty
- the style property to be applied
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 processedstartOffset
- the start offset within the give nodeendOffset
- the end offset within the given nodevalue
- 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 styledvalue
- 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)