Package nl.gx.webmanager.taglib
Class EditableTag
- java.lang.Object
-
- javax.servlet.jsp.tagext.SimpleTagSupport
-
- nl.gx.webmanager.taglib.EditableTag
-
- All Implemented Interfaces:
javax.servlet.jsp.tagext.DynamicAttributes
,javax.servlet.jsp.tagext.JspTag
,javax.servlet.jsp.tagext.SimpleTag
public class EditableTag extends javax.servlet.jsp.tagext.SimpleTagSupport implements javax.servlet.jsp.tagext.DynamicAttributes
Define editable content areas on the page inside the WM editor. The inline edit mode in WebManager needs to know where to place editable content on the page. This is done by using this tag and telling it which content it should use. There are a number of required parameters:- tag: The name of the HTML block tag to output. This HTML tag will be used to contain the editable content. The extra meta-data is attached to this tag as HTML5 data attributes.
- contentHolder: The page version or page section version which holds the content.
- area: Identifies where in the content holder the content should come from. The separator element is used inside WebManager to divide content up into different areas. The first area is 0, the second is 1 etc. If you are not using any separator elements, this this should just be 0. It is also possible to edit the title of page version. In this case area should be the string "title". In the case where the named content areas feature is used, and the separator elements have an explicit identifier String value, then this identifier is used to locate the correct content area. Note that this identifier may not be a number and may not contain slash characters, nor may it be the string "title".
- readOnly: When
true
the editable content is rendered in a read only view, in which it can't be edited. - areaend: Optional parameter which is only needed if the content spans a range of separator elements. This value specifies the end area of the range
- showUI: Optional parameter which is true by default. When true, the UI for the editable content area is always available, even when the content area is not editable.
<wm:editable tag="div" contentHolder="${pageVersion}" area="0" class="main_content"></wm:editable>
This is the most basic and common usage. The class attribute is passed through to the output HTML, and the requested content HTML is output. Example of usage (2):<wm:editable tag="div" contentHolder="${pageVersion}" area="title" class="main_title"></wm:editable>
This example shows the title of a page version.
-
-
Field Summary
Fields Modifier and Type Field Description static String
EDITABLE_TAG_ATTR
-
Constructor Summary
Constructors Constructor Description EditableTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doTag()
String
getArea()
Get the content area name.String
getAreaend()
Get the content area end value.Object
getContentHolder()
Get the content holder.boolean
getReadOnly()
Get the readOnly value.protected Session
getSession()
boolean
getShowUI()
Gets the show UI valueString
getTag()
Get the tag name to use to wrap the content.void
setArea(String area)
Set the area.void
setAreaend(String areaEnd)
Set the area end value.void
setContentHolder(Object contentHolder)
Set the content holder.void
setDynamicAttribute(String uri, String localName, Object value)
void
setReadOnly(boolean isReadOnly)
Set the readOnly value.void
setShowUI(boolean showUI)
Set the showUI value.void
setTag(String tag)
Set the tag.
-
-
-
Field Detail
-
EDITABLE_TAG_ATTR
public static final String EDITABLE_TAG_ATTR
- See Also:
- Constant Field Values
-
-
Method Detail
-
getTag
public String getTag()
Get the tag name to use to wrap the content.- Returns:
- Tag name
-
setTag
public void setTag(String tag)
Set the tag.- Parameters:
tag
- The name of a block element such as div, h1, h2 etc.
-
getReadOnly
public boolean getReadOnly()
Get the readOnly value. WM-5214: Readonly means that elements are generated as if they appear inside an editable area, but they are not really editable and no wm:editable tag is generated. {@see ElementHolderImpl.getElements}.- Returns:
- whether the tag is readonly
-
setReadOnly
public void setReadOnly(boolean isReadOnly)
Set the readOnly value.- Parameters:
isReadOnly
- whether the tag is readonly
-
getShowUI
public boolean getShowUI()
Gets the show UI value- Returns:
- whether the UI should be shown
-
setShowUI
public void setShowUI(boolean showUI)
Set the showUI value. When true, the UI for the editable content area is always available, even when the content area is not editable.- Parameters:
showUI
- whether the UI should be shown
-
getArea
public String getArea()
Get the content area name.- Returns:
- The area name.
-
setArea
public void setArea(String area)
Set the area.- Parameters:
area
- The area name. Either the string "title" a 0 based index or in case of named content areas the identifier of the separator of the area.
-
getAreaend
public String getAreaend()
Get the content area end value.- Returns:
- The area end value.
-
setAreaend
public void setAreaend(String areaEnd)
Set the area end value. This is an optional parameter and is only needed if the content spans a range of separator elements. This value specifies the end area of the range.- Parameters:
areaEnd
- The end area name. This should be a number.
-
getContentHolder
public Object getContentHolder()
Get the content holder.
-
setContentHolder
public void setContentHolder(Object contentHolder)
Set the content holder.- Parameters:
contentHolder
- The content holder which contains the content being marked.
-
setDynamicAttribute
public void setDynamicAttribute(String uri, String localName, Object value)
- Specified by:
setDynamicAttribute
in interfacejavax.servlet.jsp.tagext.DynamicAttributes
-
doTag
public void doTag() throws javax.servlet.jsp.JspException, IOException
- Specified by:
doTag
in interfacejavax.servlet.jsp.tagext.SimpleTag
- Overrides:
doTag
in classjavax.servlet.jsp.tagext.SimpleTagSupport
- Throws:
javax.servlet.jsp.JspException
IOException
-
getSession
protected Session getSession()
-
-