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:
MVCServletHandler
Direct Known Subclasses:
ConfiguredDialog, ParagraphEditDialog.NoDialogMVCHandler, ParagraphSelectDialog

public class DialogMVCHandler
extends MVCServletHandlerImpl

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

Version:
$Id: DialogMVCHandler.java 41137 2011-01-06 18:19:25Z gjoseph $
Author:
Philipp Bracher

Field Summary
protected static String COMMAND_SAVE
           
protected static String COMMAND_SELECT_PARAGRAPH
           
protected static String COMMAND_SHOW_DIALOG
           
protected  MultipartForm form
          The posted multipart form.
protected  HierarchyManager hm
           
protected  String locale
           
protected  Messages msgs
           
protected  String nodeName
          the node containing the date for this dialog
protected  RequestFormUtil params
           
protected  String path
          Path to the node containing the data
protected  String repository
           
protected  String richE
           
protected  String richEPaste
           
protected  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(Dialog dialog)
           
protected  void configureSaveHandler(SaveHandler saveHandler)
          Configure the save control
protected  Dialog createDialog(Content configNode, 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()
          Returns the name of the command we want to execute.
 Content getConfigNode()
          Returns the node with the dialog definition.
 Dialog getDialog()
           
 String getItemType()
           
 String getJsExecutedAfterSaving()
           
 String getRepository()
           
protected  SaveHandler getSaveHandler()
          Returns the save handler used by this dialog handler.
 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)
          Render the tree depending on the view name.
 String save()
          Uses the SaveControl.
 void setDialog(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 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 HierarchyManager hm

msgs

protected Messages msgs

params

protected RequestFormUtil params

storageNode

protected 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()
Description copied from interface: MVCServletHandler
Returns the name of the command we want to execute.

Specified by:
getCommand in interface MVCServletHandler
Overrides:
getCommand in class MVCServletHandlerImpl
Returns:
Returns the command.

showDialog

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


configureDialog

protected void configureDialog(Dialog dialog)

createDialog

protected Dialog createDialog(Content configNode,
                              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 Content getStorageNode()
Defines the node/page containing the data editing in this dialog. The default implementation is using the path parameter


getConfigNode

public Content getConfigNode()
Returns the node with the dialog definition. Default: null


renderHtml

public void renderHtml(String view)
                throws IOException
Description copied from interface: MVCServletHandler
Render the tree depending on the view name.

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(Dialog dialog)
Parameters:
dialog - The dialog to set.

getDialog

public 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-2011 Magnolia International Ltd.. All Rights Reserved.