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:
HierarchicalUsersTreeHandler, UsersTreeHandler, WebsiteTreeHandler

public class AdminTreeMVCHandler
extends CommandBasedMVCServletHandler

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

See Also:
Constant Field Values

COMMAND_COPY_NODE

protected static final String COMMAND_COPY_NODE
See Also:
Constant Field Values

COMMAND_MOVE_NODE

protected static final String COMMAND_MOVE_NODE
See Also:
Constant Field Values

COMMAND_ACTIVATE

protected static final String COMMAND_ACTIVATE
See Also:
Constant Field Values

COMMAND_DEACTIVATE

protected static final String COMMAND_DEACTIVATE
See Also:
Constant Field Values

COMMAND_CREATE_NODE

protected static final String COMMAND_CREATE_NODE
See Also:
Constant Field Values

COMMAND_DELETE_NODE

protected static final String COMMAND_DELETE_NODE
See Also:
Constant Field Values

COMMAND_SAVE_VALUE

protected static final String COMMAND_SAVE_VALUE
See Also:
Constant Field Values

VIEW_TREE

protected static final String VIEW_TREE
The view names

See Also:
Constant Field Values

VIEW_CREATE

protected static final String VIEW_CREATE
See Also:
Constant Field Values

VIEW_VALUE

protected static final String VIEW_VALUE
See Also:
Constant Field Values

VIEW_NOTHING

protected static final String VIEW_NOTHING
See Also:
Constant Field Values

VIEW_COPY_MOVE

protected static final 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 String newNodeName

createItemType

protected String createItemType

path

protected String path

pathOpen

protected String pathOpen

pathSelected

protected String pathSelected

rootPath

protected String rootPath

displayValue

protected String displayValue
Used to pass the saved value to the view


newPath

protected String newPath

browseMode

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

Constructor Detail

AdminTreeMVCHandler

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

getRepository

public 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(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 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(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(String commandName)
Allow default catalogue

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

getViewNameAfterExecution

protected String getViewNameAfterExecution(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 String show()
Show the tree


createNode

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

Returns:
newly created content node

copy

public String copy()
Copy a node


move

public String move()
Move a node


copyOrMove

protected void copyOrMove(int action)
                   throws ExchangeException,
                          javax.jcr.RepositoryException
Parameters:
action -
Throws:
javax.jcr.RepositoryException
ExchangeException

deleteNode

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

deleteNode

public void deleteNode(String path)
                throws Exception
Throws:
Exception

delete

public String delete()

getActivationSyndicator

public Syndicator getActivationSyndicator(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(String path)
                    throws ExchangeException,
                           javax.jcr.RepositoryException
Execute the deactivation command

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

copyMoveNode

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

moveNode

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

copyNode

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

renameNode

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

saveValue

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

Returns:
name of the view

encodeHTML

public String encodeHTML(String value)

rename

protected String rename(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 String pasteNode(String pathOrigin,
                        String pathSelected,
                        int pasteType,
                        int action)
                 throws ExchangeException,
                        javax.jcr.RepositoryException
Throws:
ExchangeException
javax.jcr.RepositoryException

renderHtml

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

Parameters:
view -
Throws:
IOException

renderTree

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

Parameters:
html -

renderHeaderIncludes

protected void renderHeaderIncludes(StringBuffer html)
Parameters:
html -

setTree

protected void setTree(Tree tree)

getTree

protected Tree getTree()

getNewNodeName

public String getNewNodeName()

setNewNodeName

public void setNewNodeName(String newNodeName)

getPath

protected String getPath()

getPathSelected

protected String getPathSelected()

getCreateItemType

public String getCreateItemType()

setCreateItemType

public void setCreateItemType(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 String getConfigurationClass()

setConfigurationClass

public void setConfigurationClass(String configClass)

getTreeClass

public String getTreeClass()

setTreeClass

public void setTreeClass(String treeClass)

getI18nBasename

public String getI18nBasename()

setI18nBasename

public void setI18nBasename(String i18nBasename)

getRootPath

public String getRootPath()

setRootPath

public void setRootPath(String rootPath)

isEnableDeleteConfirmation

public boolean isEnableDeleteConfirmation()

setEnableDeleteConfirmation

public void setEnableDeleteConfirmation(boolean enableConfirmation)


Copyright © 2003–2014 Magnolia International Ltd.. All rights reserved.