public class MacroDisplayer extends Object implements InnerHTMLListener
| Modifier and Type | Field and Description |
|---|---|
static String |
BLOCK_MACRO_STYLE_NAME
The CSS class name used on the text box containing the output of a block macro.
|
static String |
COLLAPSED_MACRO_STYLE_NAME
The CSS class name used on the macro container when a place-holder is displayed instead of the macro output.
|
protected DOMUtils |
domUtils
Collection of DOM utility methods.
|
static String |
INLINE_MACRO_STYLE_NAME
The CSS class name used on the text box containing the output of an in-line macro.
|
static String |
MACRO_PLACEHOLDER_STYLE_NAME
The CSS class name used on the macro content place-holder.
|
static String |
MACRO_STYLE_NAME
The CSS class name used on the text box containing the output of a macro.
|
static String |
SELECTED_MACRO_STYLE_NAME
The CSS class name used on the text box containing the output of a selected macro.
|
static String |
START_MACRO_COMMENT_PREFIX
The prefix of the start macro comment node.
|
static String |
STOP_MACRO_COMMENT_VALUE
The value of the stop macro comment node.
|
| Constructor and Description |
|---|
MacroDisplayer(RichTextArea textArea)
Creates a new macro displayer for the given rich text area.
|
| Modifier and Type | Method and Description |
|---|---|
protected Element |
createMacroContainer(com.google.gwt.dom.client.Node start,
com.google.gwt.dom.client.Node stop,
int siblingCount)
Puts macro output inside a read only text box that can be collapsed.
|
protected Element |
createReadOnlyBox(boolean inLine) |
void |
destroy()
Destroys this displayer.
|
List<Element> |
getMacroContainers(Element root) |
protected Element |
getOutput(Element container) |
protected Element |
getPlaceHolder(Element container) |
String |
getSerializedMacroCall(Element container) |
RichTextArea |
getTextArea() |
boolean |
hasOutput(Element container)
This method is useful to determine if a macro can be expanded or not.
|
boolean |
isCollapsed(Element container) |
boolean |
isMacroContainer(com.google.gwt.dom.client.Node node) |
boolean |
isSelected(Element container) |
protected void |
limitTextSelectionOnDoubleClick(Element container)
Make sure that a double click inside the given in-line element selects only text that is inside the element.
|
void |
onInnerHTMLChange(Element element) |
void |
setCollapsed(Element container,
boolean collapsed)
Collapses or expands the specified macro.
|
void |
setSelected(Element container,
boolean selected)
Changes the appearance of the specified macro based on its selected state.
|
public static final String MACRO_STYLE_NAME
public static final String SELECTED_MACRO_STYLE_NAME
public static final String BLOCK_MACRO_STYLE_NAME
public static final String INLINE_MACRO_STYLE_NAME
public static final String COLLAPSED_MACRO_STYLE_NAME
public static final String MACRO_PLACEHOLDER_STYLE_NAME
public static final String START_MACRO_COMMENT_PREFIX
public static final String STOP_MACRO_COMMENT_VALUE
protected final DOMUtils domUtils
public MacroDisplayer(RichTextArea textArea)
textArea - the rich text area whose macros will be displayed using this objectpublic void destroy()
public RichTextArea getTextArea()
textAreaprotected Element createMacroContainer(com.google.gwt.dom.client.Node start, com.google.gwt.dom.client.Node stop, int siblingCount)
start - start macro comment nodestop - stop macro comment nodesiblingCount - the number of siblings between start and stop nodesprotected Element createReadOnlyBox(boolean inLine)
inLine - true if the read-only box is going to displayed in-line, false otherwiseprotected void limitTextSelectionOnDoubleClick(Element container)
container - the element for which to limit the text selection on double clickpublic void setSelected(Element container, boolean selected)
container - a macro containerselected - true to select the specified macro, false otherwisepublic boolean isSelected(Element container)
container - a macro containertrue if the specified macro is selected, false otherwisepublic boolean isMacroContainer(com.google.gwt.dom.client.Node node)
node - a DOM nodetrue if the given node is a macro container, false otherwisepublic List<Element> getMacroContainers(Element root)
root - a DOM elementpublic void setCollapsed(Element container, boolean collapsed)
container - a macro containercollapsed - true to collapse the specified macro, false to expand itpublic boolean isCollapsed(Element container)
container - a macro containertrue if the specified macro is collapsed, false otherwiseprotected Element getOutput(Element container)
container - a macro containerpublic boolean hasOutput(Element container)
container - a macro containertrue if the specified macro has any output, false otherwiseprotected Element getPlaceHolder(Element container)
container - a macro containerpublic void onInnerHTMLChange(Element element)
onInnerHTMLChange in interface InnerHTMLListenerCopyright © 2004–2017 XWiki. All rights reserved.