info.magnolia.module.admininterface
Class DialogMVCHandler

java.lang.Object
  extended by info.magnolia.cms.servlets.MVCServletHandlerImpl
      extended by info.magnolia.module.admininterface.DialogMVCHandler
All Implemented Interfaces:
info.magnolia.cms.servlets.MVCServletHandler
Direct Known Subclasses:
ConfiguredDialog, ParagraphEditDialog.NoDialogMVCHandler, ParagraphSelectDialog

public class DialogMVCHandler
extends info.magnolia.cms.servlets.MVCServletHandlerImpl

This is the MVCHandler for dialogs. You can make a subclass to take influence on creation or saving.

Version:
$Id: DialogMVCHandler.java 52831 2011-12-19 14:47:01Z ochytil $
Author:
Philipp Bracher

Field Summary
protected static String COMMAND_SAVE
           
protected static String COMMAND_SELECT_PARAGRAPH
           
protected static String COMMAND_SHOW_DIALOG
           
protected  info.magnolia.cms.beans.runtime.MultipartForm form
          The posted multipart form.
protected  info.magnolia.cms.core.HierarchyManager hm
           
protected  String locale
           
protected  info.magnolia.cms.i18n.Messages msgs
           
protected  String nodeName
          the node containing the date for this dialog
protected  info.magnolia.cms.util.RequestFormUtil params
           
protected  String path
          Path to the node containing the data
protected  String repository
           
protected  String richE
           
protected  String richEPaste
           
protected  info.magnolia.cms.core.Content storageNode
           
protected static String VIEW_CLOSE_WINDOW
           
protected static String VIEW_SHOW_DIALOG
           
 
Fields inherited from class info.magnolia.cms.servlets.MVCServletHandlerImpl
exception, request, response, VIEW_ERROR, VIEW_SUCCESS
 
Fields inherited from interface info.magnolia.cms.servlets.MVCServletHandler
VIEW_NOTHING
 
Constructor Summary
DialogMVCHandler(String name, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Initialize the used parameters: path, nodeCollectionName, nodeName, ..
 
Method Summary
protected  void configureDialog(info.magnolia.cms.gui.dialog.Dialog dialog)
           
protected  void configureSaveHandler(SaveHandler saveHandler)
          Configure the save control
protected  info.magnolia.cms.gui.dialog.Dialog createDialog(info.magnolia.cms.core.Content configNode, info.magnolia.cms.core.Content storageNode)
          Is called during showDialog().
protected  void createSaveHandler()
          If there is the property saveHandler defined in the config it instantiates the configured save handler.
 String getCommand()
           
 info.magnolia.cms.core.Content getConfigNode()
          Returns the node with the dialog definition.
 info.magnolia.cms.gui.dialog.Dialog getDialog()
           
 String getItemType()
           
 String getJsExecutedAfterSaving()
           
 String getRepository()
           
protected  SaveHandler getSaveHandler()
          Returns the save handler used by this dialog handler.
 info.magnolia.cms.core.Content getStorageNode()
          Defines the node/page containing the data editing in this dialog.
protected  boolean onPostSave(SaveHandler control)
           
protected  boolean onPreSave(SaveHandler control)
           
protected  boolean onSave(SaveHandler control)
           
protected  String onSaveFailed()
          Called if the save failed.
 void removeSessionAttributes()
           
 void renderHtml(String view)
           
 String save()
          Uses the SaveControl.
 void setDialog(info.magnolia.cms.gui.dialog.Dialog dialog)
           
 void setItemType(String itemType)
           
 void setJsExecutedAfterSaving(String jsExecutedAfterSaving)
           
 String showDialog()
          Calls createDialog and sets the common parameters on the dialog
protected  boolean validate()
           
 
Methods inherited from class info.magnolia.cms.servlets.MVCServletHandlerImpl
execute, getException, getExceptionStackTrace, getName, getRequest, getResponse, init, populateFromRequest, setCommand, setRequest, setResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMAND_SAVE

protected static final String COMMAND_SAVE
See Also:
Constant Field Values

COMMAND_SELECT_PARAGRAPH

protected static final String COMMAND_SELECT_PARAGRAPH
See Also:
Constant Field Values

COMMAND_SHOW_DIALOG

protected static final String COMMAND_SHOW_DIALOG
See Also:
Constant Field Values

VIEW_CLOSE_WINDOW

protected static final String VIEW_CLOSE_WINDOW
See Also:
Constant Field Values

VIEW_SHOW_DIALOG

protected static final String VIEW_SHOW_DIALOG
See Also:
Constant Field Values

form

protected info.magnolia.cms.beans.runtime.MultipartForm form
The posted multipart form. Use params for easy access.


path

protected String path
Path to the node containing the data


nodeName

protected String nodeName
the node containing the date for this dialog


richE

protected String richE

richEPaste

protected String richEPaste

repository

protected String repository

locale

protected String locale

hm

protected info.magnolia.cms.core.HierarchyManager hm

msgs

protected info.magnolia.cms.i18n.Messages msgs

params

protected info.magnolia.cms.util.RequestFormUtil params

storageNode

protected info.magnolia.cms.core.Content storageNode
Constructor Detail

DialogMVCHandler

public DialogMVCHandler(String name,
                        javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response)
Initialize the used parameters: path, nodeCollectionName, nodeName, ..

Parameters:
request -
response -
Method Detail

getCommand

public String getCommand()
Specified by:
getCommand in interface info.magnolia.cms.servlets.MVCServletHandler
Overrides:
getCommand in class info.magnolia.cms.servlets.MVCServletHandlerImpl

showDialog

public String showDialog()
Calls createDialog and sets the common parameters on the dialog


configureDialog

protected void configureDialog(info.magnolia.cms.gui.dialog.Dialog dialog)

createDialog

protected info.magnolia.cms.gui.dialog.Dialog createDialog(info.magnolia.cms.core.Content configNode,
                                                           info.magnolia.cms.core.Content storageNode)
                                                    throws javax.jcr.RepositoryException
Is called during showDialog(). Here can you create/ add controls for the dialog.

Parameters:
configNode -
storageNode -
Throws:
javax.jcr.RepositoryException

save

public String save()
Uses the SaveControl. Override to take influence. todo - this should take care of exceptions thrown while writing - onPreSave, Save and onPostSave should be allowed to throw an exception on failure

Returns:
close view name

validate

protected boolean validate()

onSaveFailed

protected String onSaveFailed()
Called if the save failed.


getSaveHandler

protected SaveHandler getSaveHandler()
Returns the save handler used by this dialog handler.

Returns:
the handler

createSaveHandler

protected void createSaveHandler()
If there is the property saveHandler defined in the config it instantiates the configured save handler. Else it instantiates the default save handler


configureSaveHandler

protected void configureSaveHandler(SaveHandler saveHandler)
Configure the save control


onPreSave

protected boolean onPreSave(SaveHandler control)

onSave

protected boolean onSave(SaveHandler control)

onPostSave

protected boolean onPostSave(SaveHandler control)

getStorageNode

public info.magnolia.cms.core.Content getStorageNode()
Defines the node/page containing the data editing in this dialog. The default implementation is using the path parameter


getConfigNode

public info.magnolia.cms.core.Content getConfigNode()
Returns the node with the dialog definition. Default: null


renderHtml

public void renderHtml(String view)
                throws IOException
Throws:
IOException
See Also:
MVCServletHandler.renderHtml(java.lang.String)

getRepository

public String getRepository()
Returns:
the default repository

removeSessionAttributes

public void removeSessionAttributes()

setDialog

public void setDialog(info.magnolia.cms.gui.dialog.Dialog dialog)
Parameters:
dialog - The dialog to set.

getDialog

public info.magnolia.cms.gui.dialog.Dialog getDialog()
Returns:
Returns the dialog.

getJsExecutedAfterSaving

public String getJsExecutedAfterSaving()

setJsExecutedAfterSaving

public void setJsExecutedAfterSaving(String jsExecutedAfterSaving)

getItemType

public String getItemType()

setItemType

public void setItemType(String itemType)


Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.