org.opencms.workplace.explorer
Class CmsExplorerContextMenu

java.lang.Object
  extended byorg.opencms.workplace.explorer.CmsExplorerContextMenu

public class CmsExplorerContextMenu
extends java.lang.Object

Provides methods to build a context menu for an explorer resource type.

This object stores all entries which are displayed in a context menu in a sorted list. The sort order is specified in an attribute of the context menu subnodes in the OpenCms configuration.

Since:
6.0.0
Version:
$Revision: 1.14 $
Author:
Andreas Zahner

Constructor Summary
CmsExplorerContextMenu()
          Default constructor.
 
Method Summary
 void addEntries(java.util.List entries)
          Adds a list of CmsContextMenuItem objects to the context menu list.
 void addEntry(CmsExplorerContextMenuItem entry)
          Adds a single CmsContextMenuItem object to the context menu list.
 void addMenuEntry(java.lang.String key, java.lang.String uri, java.lang.String rules, java.lang.String target, java.lang.String order)
          Adds a single context menu entry to the list of context menu items.
 void addMenuSeparator(java.lang.String order)
          Adds a menu separator to the list of context menu items.
 java.lang.Object clone()
           
 java.util.List getAllEntries()
          Returns all entries of the context menu.
 java.lang.String getJSEntries(CmsObject cms, CmsExplorerTypeSettings settings, int resTypeId, CmsMessages messages)
          Builds the Javascript to create the context menu.
 boolean isEmpty()
          Tests if the context menu is empty.
 boolean isMultiMenu()
          Returns true if the menu is a multi context menu for more than one selected file.
 void setAllEntries(java.util.List entries)
          Sets all entries of the context menu.
 void setMultiMenu(boolean multiMenu)
          Sets if the menu is a multi context menu for more than one selected file.
 void sortEntries()
          Sorts the list of entries according to the value of the "order" attribute in the configuration.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsExplorerContextMenu

public CmsExplorerContextMenu()
Default constructor.

Method Detail

addEntries

public void addEntries(java.util.List entries)
Adds a list of CmsContextMenuItem objects to the context menu list.

The list is sorted by their order after that operation.

Parameters:
entries - a list of initialized context menu items

addEntry

public void addEntry(CmsExplorerContextMenuItem entry)
Adds a single CmsContextMenuItem object to the context menu list.

The list is sorted by their order after that operation.

Parameters:
entry - a single context menu item

addMenuEntry

public void addMenuEntry(java.lang.String key,
                         java.lang.String uri,
                         java.lang.String rules,
                         java.lang.String target,
                         java.lang.String order)
Adds a single context menu entry to the list of context menu items.

Parameters:
key - the key of the current entry
uri - the dialog URI to call with the current entry
rules - the display rules
target - the frame target of the menu entry
order - the sort order of the current entry

addMenuSeparator

public void addMenuSeparator(java.lang.String order)
Adds a menu separator to the list of context menu items.

Parameters:
order - the sort order of the separator

clone

public java.lang.Object clone()
See Also:
Object.clone()

getAllEntries

public java.util.List getAllEntries()
Returns all entries of the context menu.

Returns:
all entries of the context menu

getJSEntries

public java.lang.String getJSEntries(CmsObject cms,
                                     CmsExplorerTypeSettings settings,
                                     int resTypeId,
                                     CmsMessages messages)
Builds the Javascript to create the context menu.

Parameters:
cms - the CmsObject
settings - the explorer type settings for which the context menu is created
resTypeId - the id of the resource type which uses the context menu
messages - the messages to generate the context menu with (should be the workplace messages)
Returns:
the JavaScript output to create the context menu

isEmpty

public boolean isEmpty()
Tests if the context menu is empty.

Returns:
true or false

isMultiMenu

public boolean isMultiMenu()
Returns true if the menu is a multi context menu for more than one selected file.

Returns:
if the menu is a multi context menu for more than one selected file

setAllEntries

public void setAllEntries(java.util.List entries)
Sets all entries of the context menu.

The list is sorted by their order after that operation.

Parameters:
entries - all entries of the context menu

setMultiMenu

public void setMultiMenu(boolean multiMenu)
Sets if the menu is a multi context menu for more than one selected file.

Parameters:
multiMenu - true, if the menu is a multi context menu for more than one selected file, otherwise false

sortEntries

public void sortEntries()
Sorts the list of entries according to the value of the "order" attribute in the configuration.