info.magnolia.module.admininterface
Class AdminTreeMVCHandler

java.lang.Object
  extended by info.magnolia.cms.servlets.MVCServletHandlerImpl
      extended by info.magnolia.cms.servlets.CommandBasedMVCServletHandler
          extended by info.magnolia.module.admininterface.AdminTreeMVCHandler
All Implemented Interfaces:
MVCServletHandler
Direct Known Subclasses:
UsersTreeHandler, WebsiteTreeHandler

public class AdminTreeMVCHandler
extends CommandBasedMVCServletHandler

this class wrapes the tree control. The AdminInterfaceServlet instantiates a subclass. To build your own tree you have to override the prepareTree() method

Author:
philipp, Fabrizio Giustina

Field Summary
protected  boolean browseMode
          Used to display the same tree in the linkbrowser
protected static java.lang.String COMMAND_ACTIVATE
           
protected static java.lang.String COMMAND_COPY_NODE
           
protected static java.lang.String COMMAND_CREATE_NODE
           
protected static java.lang.String COMMAND_DEACTIVATE
           
protected static java.lang.String COMMAND_DELETE_NODE
           
protected static java.lang.String COMMAND_MOVE_NODE
           
protected static java.lang.String COMMAND_SAVE_VALUE
           
protected static java.lang.String COMMAND_SHOW_TREE
          this are the used actions
protected  AdminTreeConfiguration configuration
          The configuration used to configure the tree
protected  java.lang.String createItemType
           
protected  java.lang.String displayValue
          Used to pass the saved value to the view
protected  java.lang.String newNodeName
           
protected  java.lang.String newPath
           
protected  java.lang.String path
           
protected  java.lang.String pathOpen
           
protected  java.lang.String pathSelected
           
protected  java.lang.String rootPath
           
protected  Tree tree
          name of the tree (not the repository)
protected static java.lang.String VIEW_COPY_MOVE
           
protected static java.lang.String VIEW_CREATE
           
protected static java.lang.String VIEW_NOTHING
           
protected static java.lang.String VIEW_TREE
          The view names
protected static java.lang.String VIEW_VALUE
           
 
Fields inherited from class info.magnolia.cms.servlets.MVCServletHandlerImpl
exception, request, response, VIEW_ERROR, VIEW_SUCCESS
 
Constructor Summary
AdminTreeMVCHandler(java.lang.String name, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Method Summary
 java.lang.String copy()
          Copy a node
 Content copyMoveNode(java.lang.String source, java.lang.String destination, boolean move)
           
 void copyNode(java.lang.String source, java.lang.String destination)
           
 java.lang.String createNode()
          Create a new node and show the tree
 void deactivateNode(java.lang.String path)
          Execute the deactivation command
 java.lang.String delete()
           
 void deleteNode(java.lang.String path)
           
 void deleteNode(java.lang.String parentPath, java.lang.String label)
           
protected  org.apache.commons.chain.Command findCommand(java.lang.String commandName)
          Allow default catalogue
 Syndicator getActivationSyndicator(java.lang.String path)
          Create the Syndicator to activate the specified path.
 java.lang.String getCommand()
          Depending on the request it is generating a logical command name
protected  Context getCommandContext(java.lang.String commandName)
          TODO: this is a temporary solution
 AdminTreeConfiguration getConfiguration()
          Returns the configuration object for this tree; if it's not been instanciated yet, this method attempts to instanciate the configurationClass.
 java.lang.String getConfigurationClass()
           
 java.lang.String getCreateItemType()
           
 HierarchyManager getHierarchyManager()
           
 java.lang.String getI18nBasename()
           
 java.lang.String getNewNodeName()
           
protected  java.lang.String getPath()
           
protected  java.lang.String getPathSelected()
           
 java.lang.String getRepository()
          Override this method if you are not using the same name for the tree and the repository
 java.lang.String getRootPath()
           
protected  Tree getTree()
           
 java.lang.String getTreeClass()
           
protected  java.lang.String getViewNameAfterExecution(java.lang.String commandName, Context ctx)
          Show the tree after execution of a command
 void init()
          Called after instantiating.
 boolean isBrowseMode()
           
 boolean isEnableDeleteConfirmation()
           
 java.lang.String move()
          Move a node
 void moveNode(java.lang.String source, java.lang.String destination)
           
 java.lang.String pasteNode(java.lang.String pathOrigin, java.lang.String pathSelected, int pasteType, int action)
           
protected  java.lang.String rename(java.lang.String value)
          Called during a renaming of a node.
 java.lang.String renameNode(java.lang.String newLabel)
           
protected  void renderHeaderIncludes(java.lang.StringBuffer html)
           
 void renderHtml(java.lang.String view)
          Render the tree depending on the view name.
protected  void renderTree(java.lang.StringBuffer html)
          Create the html for the tree.
 java.lang.String saveValue()
          Saves a value edited directly inside the tree.
 void setBrowseMode(boolean browseMode)
           
 void setConfiguration(AdminTreeConfiguration configuration)
           
 void setConfigurationClass(java.lang.String configClass)
           
 void setCreateItemType(java.lang.String createItemType)
           
 void setEnableDeleteConfirmation(boolean enableConfirmation)
           
 void setI18nBasename(java.lang.String i18nBasename)
           
 void setNewNodeName(java.lang.String newNodeName)
           
 void setRepository(java.lang.String repository)
           
 void setRootPath(java.lang.String rootPath)
           
protected  void setTree(Tree tree)
           
 void setTreeClass(java.lang.String treeClass)
           
 java.lang.String show()
          Show the tree
 
Methods inherited from class info.magnolia.cms.servlets.CommandBasedMVCServletHandler
execute, getCatalogueName, setCatalogueName
 
Methods inherited from class info.magnolia.cms.servlets.MVCServletHandlerImpl
getException, getExceptionStackTrace, getName, getRequest, getResponse, 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_SHOW_TREE

protected static final java.lang.String COMMAND_SHOW_TREE
this are the used actions

See Also:
Constant Field Values

COMMAND_COPY_NODE

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

COMMAND_MOVE_NODE

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

COMMAND_ACTIVATE

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

COMMAND_DEACTIVATE

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

COMMAND_CREATE_NODE

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

COMMAND_DELETE_NODE

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

COMMAND_SAVE_VALUE

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

VIEW_TREE

protected static final java.lang.String VIEW_TREE
The view names

See Also:
Constant Field Values

VIEW_CREATE

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

VIEW_VALUE

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

VIEW_NOTHING

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

VIEW_COPY_MOVE

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

tree

protected Tree tree
name of the tree (not the repository)


configuration

protected AdminTreeConfiguration configuration
The configuration used to configure the tree


newNodeName

protected java.lang.String newNodeName

createItemType

protected java.lang.String createItemType

path

protected java.lang.String path

pathOpen

protected java.lang.String pathOpen

pathSelected

protected java.lang.String pathSelected

rootPath

protected java.lang.String rootPath

displayValue

protected java.lang.String displayValue
Used to pass the saved value to the view


newPath

protected java.lang.String newPath

browseMode

protected boolean browseMode
Used to display the same tree in the linkbrowser

Constructor Detail

AdminTreeMVCHandler

public AdminTreeMVCHandler(java.lang.String name,
                           javax.servlet.http.HttpServletRequest request,
                           javax.servlet.http.HttpServletResponse response)
Method Detail

getRepository

public java.lang.String getRepository()
Override this method if you are not using the same name for the tree and the repository

Returns:
name of the repository

setRepository

public void setRepository(java.lang.String repository)

getHierarchyManager

public HierarchyManager getHierarchyManager()
Returns:
the current HierarchyManager

init

public void init()
Description copied from interface: MVCServletHandler
Called after instantiating.

Specified by:
init in interface MVCServletHandler
Overrides:
init in class MVCServletHandlerImpl

getCommand

public java.lang.String getCommand()
Depending on the request it is generating a logical command name

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

getCommandContext

protected Context getCommandContext(java.lang.String commandName)
TODO: this is a temporary solution

Overrides:
getCommandContext in class CommandBasedMVCServletHandler
Parameters:
commandName - the name of the command to be called
Returns:
the context to pass to the command

findCommand

protected org.apache.commons.chain.Command findCommand(java.lang.String commandName)
Allow default catalogue

Overrides:
findCommand in class CommandBasedMVCServletHandler
Returns:
the callable command object

getViewNameAfterExecution

protected java.lang.String getViewNameAfterExecution(java.lang.String commandName,
                                                     Context ctx)
Show the tree after execution of a command

Overrides:
getViewNameAfterExecution in class CommandBasedMVCServletHandler
Returns:
the view name returned by this execution

show

public java.lang.String show()
Show the tree


createNode

public java.lang.String createNode()
Create a new node and show the tree

Returns:
newly created content node

copy

public java.lang.String copy()
Copy a node


move

public java.lang.String move()
Move a node


deleteNode

public void deleteNode(java.lang.String parentPath,
                       java.lang.String label)
                throws ExchangeException,
                       javax.jcr.RepositoryException
Throws:
ExchangeException
javax.jcr.RepositoryException

deleteNode

public void deleteNode(java.lang.String path)
                throws java.lang.Exception
Throws:
java.lang.Exception

delete

public java.lang.String delete()

getActivationSyndicator

public Syndicator getActivationSyndicator(java.lang.String path)
Create the Syndicator to activate the specified path. method implementation will make sure that proper node collection Rule and Sysdicator is used

Parameters:
path - node path to be activated
Returns:
the Syndicator used to activate

deactivateNode

public void deactivateNode(java.lang.String path)
                    throws ExchangeException,
                           javax.jcr.RepositoryException
Execute the deactivation command

Parameters:
path -
Throws:
ExchangeException
javax.jcr.RepositoryException

copyMoveNode

public Content copyMoveNode(java.lang.String source,
                            java.lang.String destination,
                            boolean move)
                     throws ExchangeException,
                            javax.jcr.RepositoryException
Throws:
ExchangeException
javax.jcr.RepositoryException

moveNode

public void moveNode(java.lang.String source,
                     java.lang.String destination)
              throws ExchangeException,
                     javax.jcr.RepositoryException
Throws:
ExchangeException
javax.jcr.RepositoryException

copyNode

public void copyNode(java.lang.String source,
                     java.lang.String destination)
              throws ExchangeException,
                     javax.jcr.RepositoryException
Throws:
ExchangeException
javax.jcr.RepositoryException

renameNode

public java.lang.String renameNode(java.lang.String newLabel)
                            throws AccessDeniedException,
                                   ExchangeException,
                                   javax.jcr.PathNotFoundException,
                                   javax.jcr.RepositoryException
Throws:
AccessDeniedException
ExchangeException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException

saveValue

public java.lang.String saveValue()
Saves a value edited directly inside the tree. This can also be a lable

Returns:
name of the view

rename

protected java.lang.String rename(java.lang.String value)
Called during a renaming of a node. First is the action saveValue called

Parameters:
value - the new name
Returns:
return the new name (can change if there were not allowed characters passed)

pasteNode

public java.lang.String pasteNode(java.lang.String pathOrigin,
                                  java.lang.String pathSelected,
                                  int pasteType,
                                  int action)
                           throws ExchangeException,
                                  javax.jcr.RepositoryException
Throws:
ExchangeException
javax.jcr.RepositoryException

renderHtml

public void renderHtml(java.lang.String view)
                throws java.io.IOException
Render the tree depending on the view name.

Parameters:
view -
Throws:
java.io.IOException

renderTree

protected void renderTree(java.lang.StringBuffer html)
Create the html for the tree. Calls tree.getHtml after calling prepareTree.

Parameters:
html -

renderHeaderIncludes

protected void renderHeaderIncludes(java.lang.StringBuffer html)
Parameters:
html -

setTree

protected void setTree(Tree tree)

getTree

protected Tree getTree()

getNewNodeName

public java.lang.String getNewNodeName()

setNewNodeName

public void setNewNodeName(java.lang.String newNodeName)

getPath

protected java.lang.String getPath()

getPathSelected

protected java.lang.String getPathSelected()

getCreateItemType

public java.lang.String getCreateItemType()

setCreateItemType

public void setCreateItemType(java.lang.String createItemType)

isBrowseMode

public boolean isBrowseMode()
Returns:
Returns the browseMode.

setBrowseMode

public void setBrowseMode(boolean browseMode)
Parameters:
browseMode - The browseMode to set.

getConfiguration

public AdminTreeConfiguration getConfiguration()
Returns the configuration object for this tree; if it's not been instanciated yet, this method attempts to instanciate the configurationClass. (i.e a pre-instanciated AdminTreeConfiguration could already have been set by content2bean)


setConfiguration

public void setConfiguration(AdminTreeConfiguration configuration)
Parameters:
configuration - The configuration to set.

getConfigurationClass

public java.lang.String getConfigurationClass()

setConfigurationClass

public void setConfigurationClass(java.lang.String configClass)

getTreeClass

public java.lang.String getTreeClass()

setTreeClass

public void setTreeClass(java.lang.String treeClass)

getI18nBasename

public java.lang.String getI18nBasename()

setI18nBasename

public void setI18nBasename(java.lang.String i18nBasename)

getRootPath

public java.lang.String getRootPath()

setRootPath

public void setRootPath(java.lang.String rootPath)

isEnableDeleteConfirmation

public boolean isEnableDeleteConfirmation()

setEnableDeleteConfirmation

public void setEnableDeleteConfirmation(boolean enableConfirmation)


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