net.sourceforge.openutils.mgnlcontrols.dialog
Class ConfigurableFreemarkerDialog

java.lang.Object
  extended by info.magnolia.cms.gui.dialog.DialogControlImpl
      extended by info.magnolia.cms.gui.dialog.DialogBox
          extended by net.sourceforge.openutils.mgnlcontrols.dialog.ConfigurableFreemarkerDialog
All Implemented Interfaces:
info.magnolia.cms.gui.dialog.DialogControl
Direct Known Subclasses:
DialogGrid

public abstract class ConfigurableFreemarkerDialog
extends info.magnolia.cms.gui.dialog.DialogBox

* A Magnolia dialog that renders by a freemarker template. There are two main properties for the dialog:

path (required) Path to freemarker template: will be loaded from classpath or from filesystem
multiple true / false. This property gives support to multiple field values storage.
The dialog passes some parameters to freemarker template:
name Dialog / field name
value Field value (multiple = false)
values field values (multiple = true)
request current HttpServletRequest
configuration Map of dialog configuration. This allows to pass to template complex dialog configuration.
Eg.
 -+ Dialog node
  |-- property 1 = value 1
  |-+ subnode1
  | |-- property 11 = value 11
  | |-- property 12 = value 12
  | |-+ subnode 11
  |   |-- property 111 = value 111
  |
  |-- property 2 = value 2

 The map will contain:
 configuration = Map {
    "property1" = "value1",
    "subnode1"  = Map {
        "property11" = "value11",
        "property12" = "value12",
        "subnode11"  =  Map {
            "property111" = "value111"
        }
    },
    "property2" = "value2"
 }
 

Similar to DialogFreemarker but with a fixed template, needed till MAGNOLIA-2175 is done

Version:
$Id: ConfigurableFreemarkerDialog.java 2330 2010-05-02 17:19:37Z fgiust $
Author:
fgiust

Field Summary
protected  java.util.Map<java.lang.String,java.lang.Object> configuration
          Map of dialog configuration.
protected  org.slf4j.Logger log
          Logger.
protected  java.lang.String uuid
          Configuration node UUID.
 
Fields inherited from class info.magnolia.cms.gui.dialog.DialogBox
BOXTYPE_1COL, BOXTYPE_2COLS
 
Fields inherited from class info.magnolia.cms.gui.dialog.DialogControlImpl
DEFAULT_VALUE_PROPERTY, SESSION_ATTRIBUTENAME_DIALOGOBJECT, SESSION_ATTRIBUTENAME_DIALOGOBJECT_REMOVE, VALIDATION_PATTERN_PROPERTY, value
 
Constructor Summary
ConfigurableFreemarkerDialog()
           
 
Method Summary
protected  void addToParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
          Can be implemented by subclasses in order to add parameters to the Map passed to freemarker.
 void drawHtml(java.io.Writer out)
          
protected abstract  java.lang.String getPath()
           
protected  java.util.Map<java.lang.String,java.lang.Object> getSubNodes(info.magnolia.cms.core.Content node)
          Get a recursive map view of a content node
 void init(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, info.magnolia.cms.core.Content websiteNode, info.magnolia.cms.core.Content configNode)
          
 
Methods inherited from class info.magnolia.cms.gui.dialog.DialogBox
drawHtmlPost, drawHtmlPre, getBoxType, getHtmlDescription, setBoxType
 
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, 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
 

Field Detail

log

protected org.slf4j.Logger log
Logger.


configuration

protected java.util.Map<java.lang.String,java.lang.Object> configuration
Map of dialog configuration.


uuid

protected java.lang.String uuid
Configuration node UUID.

Constructor Detail

ConfigurableFreemarkerDialog

public ConfigurableFreemarkerDialog()
Method Detail

getSubNodes

protected java.util.Map<java.lang.String,java.lang.Object> getSubNodes(info.magnolia.cms.core.Content node)
                                                                throws javax.jcr.RepositoryException,
                                                                       info.magnolia.cms.security.AccessDeniedException
Get a recursive map view of a content node

Parameters:
node - content node
Returns:
recursive map view on content node properties and children
Throws:
javax.jcr.RepositoryException - for any exception occurred while accessing the repository
info.magnolia.cms.security.AccessDeniedException - if the current user can't read the configuration subnodes

init

public void init(javax.servlet.http.HttpServletRequest request,
                 javax.servlet.http.HttpServletResponse response,
                 info.magnolia.cms.core.Content websiteNode,
                 info.magnolia.cms.core.Content configNode)
          throws javax.jcr.RepositoryException

Specified by:
init in interface info.magnolia.cms.gui.dialog.DialogControl
Overrides:
init in class info.magnolia.cms.gui.dialog.DialogControlImpl
Throws:
javax.jcr.RepositoryException

drawHtml

public void drawHtml(java.io.Writer out)
              throws java.io.IOException

Specified by:
drawHtml in interface info.magnolia.cms.gui.dialog.DialogControl
Overrides:
drawHtml in class info.magnolia.cms.gui.dialog.DialogControlImpl
Throws:
java.io.IOException

addToParameters

protected void addToParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
Can be implemented by subclasses in order to add parameters to the Map passed to freemarker.

Parameters:
parameters - parameter map

getPath

protected abstract java.lang.String getPath()
Returns:
ftl template path


Copyright © 2008-2010 Openmind. All Rights Reserved.