info.magnolia.cms.gui.dialog
Class DialogEditCode
java.lang.Object
info.magnolia.cms.gui.dialog.DialogControlImpl
info.magnolia.cms.gui.dialog.DialogBox
info.magnolia.cms.gui.dialog.DialogEditCode
- All Implemented Interfaces:
- DialogControl
public class DialogEditCode
- extends DialogBox
Turns a textarea into a basic code editor using CodeMirror. If no language
option is explicitly configured, it will try to guess
the correct syntax highlighter by either looking at the resource extension or the mgnl:template
metadata property. Defaults to a generic
syntax parser which
will highlight html, javascript and css.
Configuration options are:
- useCodeHighlighter: activate/deactivate the editor with code highlighting. Default value is
true
. If set as false
, falls back to a plain textarea.
- language: one of the supported languages (e.g. css, javascript or js, html, freemarker or ftl, groovy) supported.
Default value is
generic
.
- readOnly: make the editor read-only. Default value is
false
.
- lineNumbers: shows/hide line numbers. Default value is
true
.
- rows: determines the numbers of rows initially shown.
If
useCodeHighlighter
is true
the value is automatically converted in pixels by multiplying LINE_HEIGHT
by the number of rows (default value is 20
).
If useCodeHighlighter
is false
it has the same meaning as the html textareas attribute (default value is 20
).
KNOWN ISSUE: setting the control's width with the cols
option currently does not work.
- Version:
- $Id$
Field Summary |
static java.util.Map<java.lang.String,java.lang.String> |
availableParsers
Valid values are js, javascript, processedJs, css, processedCss, html, freemarker, ftl, groovy, generic . |
static java.lang.Long |
LINE_HEIGHT
The editor line height in pixels. |
Method Summary |
void |
drawHtml(java.io.Writer out)
Actually draw the dialog content. |
Methods inherited from class info.magnolia.cms.gui.dialog.DialogControlImpl |
addOption, addSub, clearWebsiteNode, drawHtmlPostSubs, drawHtmlPreSubs, drawSubs, getConfigValue, getConfigValue, getDescription, getId, getLabel, getMessage, getMessage, getMessages, getName, getOptions, getParent, getRequest, getResponse, getStorageNode, getSub, getSubs, getTopParent, getValidationPattern, getValue, getValues, getWebsiteNode, init, isRequired, readValue, readValues, removeSessionAttribute, setConfig, setConfig, setConfig, setDescription, setLabel, setName, setOptions, setRequired, setSaveInfo, setSessionAttribute, setTopParent, setValidationMessage, setValue, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
availableParsers
public static final java.util.Map<java.lang.String,java.lang.String> availableParsers
- Valid values are
js, javascript, processedJs, css, processedCss, html, freemarker, ftl, groovy, generic
.
LINE_HEIGHT
public static final java.lang.Long LINE_HEIGHT
- The editor line height in pixels.
DialogEditCode
public DialogEditCode()
drawHtml
public void drawHtml(java.io.Writer out)
throws java.io.IOException
- Description copied from interface:
DialogControl
- Actually draw the dialog content.
- Specified by:
drawHtml
in interface DialogControl
- Overrides:
drawHtml
in class DialogControlImpl
- Parameters:
out
- Writer
- Throws:
java.io.IOException
- exceptions thrown when writing to the Writer can be safely rethrown by the dialog- See Also:
DialogControl.drawHtml(Writer)
Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.