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 java.lang.String COMMAND_SAVE
           
protected static java.lang.String COMMAND_SELECT_PARAGRAPH
           
protected static java.lang.String COMMAND_SHOW_DIALOG
           
protected  MultipartForm form
          The posted multipart form.
protected  HierarchyManager hm
           
protected  java.lang.String locale
           
protected  Messages msgs
           
protected  java.lang.String nodeName
          the node containing the date for this dialog
protected  RequestFormUtil params
           
protected  java.lang.String path
          Path to the node containing the data
protected  java.lang.String repository
           
protected  java.lang.String richE
           
protected  java.lang.String richEPaste
           
protected  Content storageNode
           
protected static java.lang.String VIEW_CLOSE_WINDOW
           
protected static java.lang.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(java.lang.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.
 java.lang.String getCommand()
          Returns the name of the command we want to execute.
 Content getConfigNode()
          Returns the node with the dialog definition.
 Dialog getDialog()
           
 java.lang.String getItemType()
           
 java.lang.String getJsExecutedAfterSaving()
           
 java.lang.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  java.lang.String onSaveFailed()
          Called if the save failed.
 void removeSessionAttributes()
           
 void renderHtml(java.lang.String view)
          Render the tree depending on the view name.
 java.lang.String save()
          Uses the SaveControl.
 void setDialog(Dialog dialog)
           
 void setItemType(java.lang.String itemType)
           
 void setJsExecutedAfterSaving(java.lang.String jsExecutedAfterSaving)
           
 java.lang.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 java.lang.String COMMAND_SAVE
See Also:
Constant Field Values

COMMAND_SELECT_PARAGRAPH

protected static final java.lang.String COMMAND_SELECT_PARAGRAPH
See Also:
Constant Field Values

COMMAND_SHOW_DIALOG

protected static final java.lang.String COMMAND_SHOW_DIALOG
See Also:
Constant Field Values

VIEW_CLOSE_WINDOW

protected static final java.lang.String VIEW_CLOSE_WINDOW
See Also:
Constant Field Values

VIEW_SHOW_DIALOG

protected static final java.lang.String VIEW_SHOW_DIALOG
See Also:
Constant Field Values

form

protected MultipartForm form
The posted multipart form. Use params for easy access.


path

protected java.lang.String path
Path to the node containing the data


nodeName

protected java.lang.String nodeName
the node containing the date for this dialog


richE

protected java.lang.String richE

richEPaste

protected java.lang.String richEPaste

repository

protected java.lang.String repository

locale

protected java.lang.String locale

hm

protected HierarchyManager hm

msgs

protected Messages msgs

params

protected RequestFormUtil params

storageNode

protected Content storageNode
Constructor Detail

DialogMVCHandler

public DialogMVCHandler(java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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(java.lang.String view)
                throws java.io.IOException
Description copied from interface: MVCServletHandler
Render the tree depending on the view name.

Throws:
java.io.IOException
See Also:
MVCServletHandler.renderHtml(java.lang.String)

getRepository

public java.lang.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 java.lang.String getJsExecutedAfterSaving()

setJsExecutedAfterSaving

public void setJsExecutedAfterSaving(java.lang.String jsExecutedAfterSaving)

getItemType

public java.lang.String getItemType()

setItemType

public void setItemType(java.lang.String itemType)


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