info.magnolia.cms.gui.control
Class Tree

java.lang.Object
  extended by info.magnolia.cms.gui.control.ControlImpl
      extended by info.magnolia.cms.gui.control.Tree
All Implemented Interfaces:
Control

public class Tree
extends ControlImpl

Version:
2.0
Author:
Vinzenz Wyser

Field Summary
static int ACTION_ACTIVATE
           
static int ACTION_COPY
           
static int ACTION_DEACTIVATE
           
static int ACTION_MOVE
           
static java.lang.String DEFAULT_ICON
           
static java.lang.String DEFAULT_ICON_CONTENT
           
static java.lang.String DEFAULT_ICON_CONTENTNODE
           
static java.lang.String DEFAULT_ICON_NODEDATA
           
static java.lang.String DOCROOT
           
static java.lang.String ICONDOCROOT
           
static java.lang.String ITEM_TYPE_NODEDATA
          Deprecated. since 4.4, use ItemType.MGNL_NODE_DATA instead
static int PASTETYPE_ABOVE
           
static int PASTETYPE_BELOW
           
static int PASTETYPE_LAST
           
static int PASTETYPE_SUB
           
 
Fields inherited from class info.magnolia.cms.gui.control.ControlImpl
BUTTONSTATE_DISABLED, BUTTONSTATE_MOUSEDOWN, BUTTONSTATE_MOUSEOVER, BUTTONSTATE_NORMAL, BUTTONSTATE_PUSHED, BUTTONTYPE_CHECKBOX, BUTTONTYPE_PUSHBUTTON, BUTTONTYPE_RADIO, CSSCLASS_CONTROLBAR, CSSCLASS_CONTROLBARSMALL, CSSCLASS_CONTROLBUTTON, CSSCLASS_CONTROLBUTTONSMALL, ENCODING_BASE64, ENCODING_NO, ENCODING_UNIX, RICHEDIT_FCK, RICHEDIT_KUPU, RICHEDIT_NONE, VALUETYPE_MULTIPLE, VALUETYPE_SINGLE
 
Constructor Summary
Tree(java.lang.String repository, javax.servlet.http.HttpServletRequest request)
          Deprecated. use Tree(name, repository) instead
Tree(java.lang.String name, java.lang.String repository)
          Constructor.
Tree(java.lang.String name, java.lang.String repository, javax.servlet.http.HttpServletRequest request)
          Deprecated. don't pass the request
 
Method Summary
 void addColumn(TreeColumn tc)
           
 void addFunctionBarItem(FunctionBarItem item)
           
 void addFunctionBarItemFromContextMenu(java.lang.String itemName)
          Convenience method to add a function bar item that already exists in the context menu.
 void addIcon(java.lang.String typeName, java.lang.String icon)
           
 void addItemType(ItemType s)
          Add a itemType to the itemTypes that will be shown in this branch.
 void addItemType(java.lang.String s)
          Deprecated. pass the icon to use as a second parameter
 void addItemType(java.lang.String type, java.lang.String icon)
          Adds an itemType to the list of existing types and associates an icon with it.
 void addItemType(java.lang.String type, java.lang.String icon, boolean strict)
          Adds an itemType to the list of existing types and associates an icon with it.
 void addMenuItem(ContextMenuItem item)
           
 void addSeparator()
          Add a separator line between context menu items.
protected  java.util.Iterator collectRenderedItems(Content parentNode, java.lang.String itemType)
           
 java.lang.String createNode(java.lang.String itemType)
           
 java.lang.String createNode(java.lang.String label, java.lang.String itemType)
          Creates a new node (either NodeData or Content) with the specified name (label) and type.
 java.lang.String getColumnResizer()
           
 java.util.List getColumns()
           
 TreeColumn getColumns(int col)
           
 boolean getDrawShifter()
           
 FunctionBar getFunctionBar()
           
 int getHeight()
           
 HierarchyManager getHierarchyManager()
           
 java.lang.String getHtml()
          Returns an empty string.
 java.lang.String getHtmlBranch()
           
 java.lang.String getHtmlChildren()
           
 java.lang.String getHtmlChildrenOfOneType(Content parentNode, java.lang.String itemType)
           
 java.lang.String getHtmlFooter()
           
 java.lang.String getHtmlHeader()
           
protected  void getHtmlOfSingleItem(java.lang.StringBuffer html, Content parentNode, java.lang.String itemType, java.lang.Object item)
           
protected  java.lang.String getIcon(Content node, NodeData nodedata, java.lang.String itemType)
           
protected  java.lang.String getIcon(java.lang.String itemType)
           
 java.lang.String getIconContentNode()
           
 java.lang.String getIconNodeData()
           
 java.lang.String getIconOndblclick()
           
 java.lang.String getIconPage()
           
 int getIndentionWidth()
           
 java.util.List getItemTypes()
           
 java.lang.String getJavascriptTree()
           
 ContextMenu getMenu()
           
protected  int getPaddingLeft(Content parentNode)
           
 java.lang.String getPath()
           
protected  java.lang.String getPathCurrent()
           
 java.lang.String getPathOpen()
           
 java.lang.String getPathSelected()
           
 java.lang.String getRepository()
           
 java.lang.String getRootPath()
           
 java.lang.String getShifterCollapse()
           
 java.lang.String getShifterEmpty()
           
 java.lang.String getShifterExpand()
           
 boolean getSnippetMode()
           
 java.util.Comparator getSortComparator()
           
protected  java.lang.String getUniqueLabel(java.lang.String label)
           
protected  boolean hasSub(Content c, java.lang.String type)
           
 boolean isBrowseMode()
           
protected  void onGetHtmlOfSingleItem(java.lang.StringBuffer html, Content parentNode, java.lang.String itemType, java.lang.Object item, java.lang.String idPre)
           
protected  java.util.Map populateTemplateParameters()
           
 java.lang.String saveNodeData(java.lang.String nodeDataName, java.lang.String value, boolean isMeta)
           
 java.lang.String saveNodeDataType(java.lang.String nodeDataName, int type)
           
 void setBrowseMode(boolean browseMode)
           
 void setColumnResizer(java.lang.String src)
           
 void setColums(java.util.List al)
          Set the columns (for pages and content nodes only).
 void setDrawShifter(boolean b)
           
 void setFunctionBar(FunctionBar functionBar)
           
 void setHeight(int i)
           
 void setIcon(java.lang.String typeName, java.lang.String icon)
          Deprecated. since 4.4 use addIcon(String, String) instead.
 void setIconContentNode(java.lang.String src)
          Deprecated. since 4.4, use addIcon(ItemType.CONTENTNODE.getSystemName(), src) instead
 void setIconNodeData(java.lang.String src)
          Deprecated. since 4.4, use addIcon(ItemType.MGNL_NODE_DATA, src) instead
 void setIconOndblclick(java.lang.String s)
          Set the double click event of the icon.
 void setIconPage(java.lang.String src)
          Deprecated. since 4.4, use addIcon(ItemType.CONTENT.getSystemName(), src) instead
 void setIndentionWidth(int i)
           
 void setJavascriptTree(java.lang.String variableName)
          Set the name of the javascript tree object.
 void setMenu(ContextMenu menu)
           
protected  void setPathCurrent(java.lang.String s)
           
 void setPathOpen(java.lang.String s)
           
 void setPathSelected(java.lang.String s)
          Sets which path will be selected (and opened - overwrites pathOpen).
 void setRepository(java.lang.String s)
           
 void setRootPath(java.lang.String rootPath)
           
 void setShifterCollapse(java.lang.String src)
          Set the shifter image (collapse branch).
 void setShifterEmpty(java.lang.String src)
          Set the shifter image when no children are available (not expandable).
 void setShifterExpand(java.lang.String src)
          Set the shifter image (expand branch).
 void setSnippetMode(boolean b)
          Sets if only a snippet (requested branch) shall be returnde or including the surounding html (tree header, js/css links etc).
 void setSortComparator(java.util.Comparator sortComperator)
           
protected  boolean showNode(Content node, NodeData nodedata, java.lang.String itemType)
          Override to make special exclusions.
 
Methods inherited from class info.magnolia.cms.gui.control.ControlImpl
escapeHTML, getCssClass, getCssStyles, getCssStyles, getCssStyles, getEncoding, getEvents, getHtmlCssClass, getHtmlCssStyles, getHtmlEvents, getHtmlId, getHtmlInter, getHtmlInter, getHtmlPost, getHtmlPost, getHtmlPre, getHtmlPre, getHtmlSaveInfo, getId, getIsRichEditValue, getLabel, getName, getNodeCollectionName, getNodeCollectionName, getNodeName, getNodeName, getRequest, getSaveInfo, getType, getValue, getValues, getValueType, getWebsiteNode, println, setCssClass, setCssStyles, setCssStyles, setEncoding, setEvent, setEvent, setEvents, setHtmlInter, setHtmlPost, setHtmlPre, setId, setIsRichEditValue, setLabel, setName, setNodeCollectionName, setNodeName, setPath, setRequest, setSaveInfo, setType, setType, setValue, setValues, setValueType, setWebsiteNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOCROOT

public static final java.lang.String DOCROOT
See Also:
Constant Field Values

ICONDOCROOT

public static final java.lang.String ICONDOCROOT
See Also:
Constant Field Values

DEFAULT_ICON

public static final java.lang.String DEFAULT_ICON
See Also:
Constant Field Values

DEFAULT_ICON_CONTENT

public static final java.lang.String DEFAULT_ICON_CONTENT
See Also:
Constant Field Values

DEFAULT_ICON_CONTENTNODE

public static final java.lang.String DEFAULT_ICON_CONTENTNODE
See Also:
Constant Field Values

DEFAULT_ICON_NODEDATA

public static final java.lang.String DEFAULT_ICON_NODEDATA
See Also:
Constant Field Values

ITEM_TYPE_NODEDATA

@Deprecated
public static final java.lang.String ITEM_TYPE_NODEDATA
Deprecated. since 4.4, use ItemType.MGNL_NODE_DATA instead
See Also:
Constant Field Values

ACTION_MOVE

public static final int ACTION_MOVE
See Also:
Constant Field Values

ACTION_COPY

public static final int ACTION_COPY
See Also:
Constant Field Values

ACTION_ACTIVATE

public static final int ACTION_ACTIVATE
See Also:
Constant Field Values

ACTION_DEACTIVATE

public static final int ACTION_DEACTIVATE
See Also:
Constant Field Values

PASTETYPE_ABOVE

public static final int PASTETYPE_ABOVE
See Also:
Constant Field Values

PASTETYPE_BELOW

public static final int PASTETYPE_BELOW
See Also:
Constant Field Values

PASTETYPE_SUB

public static final int PASTETYPE_SUB
See Also:
Constant Field Values

PASTETYPE_LAST

public static final int PASTETYPE_LAST
See Also:
Constant Field Values
Constructor Detail

Tree

@Deprecated
public Tree(java.lang.String name,
                       java.lang.String repository,
                       javax.servlet.http.HttpServletRequest request)
Deprecated. don't pass the request


Tree

public Tree(java.lang.String name,
            java.lang.String repository)
Constructor.

Parameters:
name - name of the tree (name of the treehandler)
repository - name of the repository (i.e. "website", "users")

Tree

@Deprecated
public Tree(java.lang.String repository,
                       javax.servlet.http.HttpServletRequest request)
Deprecated. use Tree(name, repository) instead

Constructor: the name of the tree is the same as the name of the repository

Parameters:
repository -
request -
Method Detail

setRepository

public void setRepository(java.lang.String s)

getRepository

public java.lang.String getRepository()

setPathOpen

public void setPathOpen(java.lang.String s)

getPathOpen

public java.lang.String getPathOpen()

setPathSelected

public void setPathSelected(java.lang.String s)
Sets which path will be selected (and opened - overwrites pathOpen).

Parameters:
s -

getPathSelected

public java.lang.String getPathSelected()

getPath

public java.lang.String getPath()
Overrides:
getPath in class ControlImpl

setPathCurrent

protected void setPathCurrent(java.lang.String s)

getPathCurrent

protected java.lang.String getPathCurrent()

setIndentionWidth

public void setIndentionWidth(int i)

getIndentionWidth

public int getIndentionWidth()

getItemTypes

public java.util.List getItemTypes()

addItemType

@Deprecated
public void addItemType(java.lang.String s)
Deprecated. pass the icon to use as a second parameter

Add a itemType to the itemTypes that will be shown in this branch.


addItemType

public void addItemType(java.lang.String type,
                        java.lang.String icon)
Adds an itemType to the list of existing types and associates an icon with it. This method will cause only items of given type to be displayed. The items of subtype of given type will not be displayed. To display also subtypes see addItemType(String, String, boolean)

Parameters:
type - The item type
icon - The icon used to display items of given type
See Also:
addItemType(String, String, boolean)

addItemType

public void addItemType(java.lang.String type,
                        java.lang.String icon,
                        boolean strict)
Adds an itemType to the list of existing types and associates an icon with it. The type can be specified as a strict, in which case only the items of given type will be displayed, but sub types will be ignored, or non-strict in which case the items of sub types of given type will also be rendered.

Parameters:
type - The item type
icon - The icon used to display items of given type
strict - Flag specifying whether or not to show also items of sub type of given type

addItemType

public void addItemType(ItemType s)
Add a itemType to the itemTypes that will be shown in this branch.

Parameters:
s - itemType (one of: ItemType.CONTENT, ItemType.CONTENTNODE)

setIconPage

@Deprecated
public void setIconPage(java.lang.String src)
Deprecated. since 4.4, use addIcon(ItemType.CONTENT.getSystemName(), src) instead

Set the icon of pages.

Parameters:
src - source of the image

getIconPage

public java.lang.String getIconPage()

setIconContentNode

@Deprecated
public void setIconContentNode(java.lang.String src)
Deprecated. since 4.4, use addIcon(ItemType.CONTENTNODE.getSystemName(), src) instead

Set the icon of content nodes.

Parameters:
src - source of the image

getIconContentNode

public java.lang.String getIconContentNode()

setIconNodeData

@Deprecated
public void setIconNodeData(java.lang.String src)
Deprecated. since 4.4, use addIcon(ItemType.MGNL_NODE_DATA, src) instead

Set the icon of node data.

Parameters:
src - source of the image

getIconNodeData

public java.lang.String getIconNodeData()

getIcon

protected java.lang.String getIcon(java.lang.String itemType)

getIcon

protected java.lang.String getIcon(Content node,
                                   NodeData nodedata,
                                   java.lang.String itemType)

setIcon

@Deprecated
public void setIcon(java.lang.String typeName,
                               java.lang.String icon)
Deprecated. since 4.4 use addIcon(String, String) instead.


addIcon

public void addIcon(java.lang.String typeName,
                    java.lang.String icon)

setIconOndblclick

public void setIconOndblclick(java.lang.String s)
Set the double click event of the icon.

Parameters:
s - javascriopt method

getIconOndblclick

public java.lang.String getIconOndblclick()

setShifterExpand

public void setShifterExpand(java.lang.String src)
Set the shifter image (expand branch). "_EXPAND" in file name will be replaced by "_COLLAPSE" after expanding e.g. myShifterIcon_EXPAND.gif

Parameters:
src - source of the image

getShifterExpand

public java.lang.String getShifterExpand()

setShifterCollapse

public void setShifterCollapse(java.lang.String src)
Set the shifter image (collapse branch). "_COLLAPSE" in file name will be replaced by "_EXPAND" after collapsing e.g. myShifterIcon_COLLAPSE.gif

Parameters:
src - source of the image

getShifterCollapse

public java.lang.String getShifterCollapse()

setShifterEmpty

public void setShifterEmpty(java.lang.String src)
Set the shifter image when no children are available (not expandable). "_EMPTY" in the file name will be replaced when children are available e.g. myShifterIcon_EMPTY.gif

Parameters:
src - source of the image

getShifterEmpty

public java.lang.String getShifterEmpty()

setDrawShifter

public void setDrawShifter(boolean b)

getDrawShifter

public boolean getDrawShifter()

setHeight

public void setHeight(int i)

getHeight

public int getHeight()

setColums

public void setColums(java.util.List al)
Set the columns (for pages and content nodes only).

Parameters:
al - list of TreeColumns

getColumns

public java.util.List getColumns()

getColumns

public TreeColumn getColumns(int col)

addColumn

public void addColumn(TreeColumn tc)

setJavascriptTree

public void setJavascriptTree(java.lang.String variableName)
Set the name of the javascript tree object.

Parameters:
variableName -

getJavascriptTree

public java.lang.String getJavascriptTree()

setSnippetMode

public void setSnippetMode(boolean b)
Sets if only a snippet (requested branch) shall be returnde or including the surounding html (tree header, js/css links etc).

Parameters:
b - true: snippet only

getSnippetMode

public boolean getSnippetMode()

setColumnResizer

public void setColumnResizer(java.lang.String src)

getColumnResizer

public java.lang.String getColumnResizer()

createNode

public java.lang.String createNode(java.lang.String itemType)

createNode

public java.lang.String createNode(java.lang.String label,
                                   java.lang.String itemType)
Creates a new node (either NodeData or Content) with the specified name (label) and type.

Parameters:
label - new node name
itemType - new node type

saveNodeData

public java.lang.String saveNodeData(java.lang.String nodeDataName,
                                     java.lang.String value,
                                     boolean isMeta)

saveNodeDataType

public java.lang.String saveNodeDataType(java.lang.String nodeDataName,
                                         int type)

getUniqueLabel

protected java.lang.String getUniqueLabel(java.lang.String label)
Parameters:
label -
Returns:
unique label

getHtml

public java.lang.String getHtml()
Description copied from class: ControlImpl
Returns an empty string.

Specified by:
getHtml in interface Control
Overrides:
getHtml in class ControlImpl
Returns:
html
See Also:
Control.getHtml()

getHtmlHeader

public java.lang.String getHtmlHeader()

getHtmlFooter

public java.lang.String getHtmlFooter()

populateTemplateParameters

protected java.util.Map populateTemplateParameters()

getHtmlBranch

public java.lang.String getHtmlBranch()

getHtmlChildren

public java.lang.String getHtmlChildren()

getHtmlChildrenOfOneType

public java.lang.String getHtmlChildrenOfOneType(Content parentNode,
                                                 java.lang.String itemType)

getHtmlOfSingleItem

protected void getHtmlOfSingleItem(java.lang.StringBuffer html,
                                   Content parentNode,
                                   java.lang.String itemType,
                                   java.lang.Object item)
                            throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

onGetHtmlOfSingleItem

protected void onGetHtmlOfSingleItem(java.lang.StringBuffer html,
                                     Content parentNode,
                                     java.lang.String itemType,
                                     java.lang.Object item,
                                     java.lang.String idPre)

collectRenderedItems

protected java.util.Iterator collectRenderedItems(Content parentNode,
                                                  java.lang.String itemType)

getPaddingLeft

protected int getPaddingLeft(Content parentNode)
                      throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

hasSub

protected boolean hasSub(Content c,
                         java.lang.String type)

showNode

protected boolean showNode(Content node,
                           NodeData nodedata,
                           java.lang.String itemType)
Override to make special exclusions. The current nodedata or node is passed.

Parameters:
node -
nodedata -
itemType -
Returns:
true if the node is shown

addMenuItem

public void addMenuItem(ContextMenuItem item)
Parameters:
item - ContextMenuItem

addFunctionBarItem

public void addFunctionBarItem(FunctionBarItem item)
Parameters:
item - FunctionBarItem

addFunctionBarItemFromContextMenu

public void addFunctionBarItemFromContextMenu(java.lang.String itemName)
Convenience method to add a function bar item that already exists in the context menu.


addSeparator

public void addSeparator()
Add a separator line between context menu items.


getMenu

public ContextMenu getMenu()

getFunctionBar

public FunctionBar getFunctionBar()
Returns:
the function bar object

setMenu

public void setMenu(ContextMenu menu)

setFunctionBar

public void setFunctionBar(FunctionBar functionBar)
Parameters:
functionBar - the function bar object

isBrowseMode

public boolean isBrowseMode()
Returns:
Returns the browseMode.

setBrowseMode

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

getHierarchyManager

public HierarchyManager getHierarchyManager()
Returns:
the current HierarchyManager

getSortComparator

public java.util.Comparator getSortComparator()

setSortComparator

public void setSortComparator(java.util.Comparator sortComperator)

getRootPath

public java.lang.String getRootPath()

setRootPath

public void setRootPath(java.lang.String rootPath)


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