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 String DEFAULT_ICON
           
static String DEFAULT_ICON_CONTENT
           
static String DEFAULT_ICON_CONTENTNODE
           
static String DEFAULT_ICON_DELETED
           
static String DEFAULT_ICON_NODEDATA
           
static String DOCROOT
           
static String ICONDOCROOT
           
static 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_NO, ENCRYPTION_HASH_BCRYPT, ENCRYPTION_HASH_SHA, ENCRYPTION_NO, ENCRYPTION_NO_ENCODING_BASE64, RICHEDIT_FCK, RICHEDIT_KUPU, RICHEDIT_NONE, VALUETYPE_MULTIPLE, VALUETYPE_SINGLE
 
Constructor Summary
Tree(String repository, javax.servlet.http.HttpServletRequest request)
          Deprecated. use Tree(name, repository) instead
Tree(String name, String repository)
          Constructor.
Tree(String name, 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(String itemName)
          Convenience method to add a function bar item that already exists in the context menu.
 void addIcon(String typeName, String icon)
           
 void addItemType(info.magnolia.cms.core.ItemType s)
          Add a itemType to the itemTypes that will be shown in this branch.
 void addItemType(String s)
          Deprecated. pass the icon to use as a second parameter
 void addItemType(String type, boolean strict)
           
 void addItemType(String type, String icon)
          Adds an itemType to the list of existing types and associates an icon with it.
 void addItemType(String type, 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  Iterator collectRenderedItems(info.magnolia.cms.core.Content parentNode, String itemType)
           
 String createNode(String itemType)
           
 String createNode(String label, String itemType)
          Creates a new node (either NodeData or Content) with the specified name (label) and type.
 String getColumnResizer()
           
 List getColumns()
           
 TreeColumn getColumns(int col)
           
 boolean getDrawShifter()
           
 FunctionBar getFunctionBar()
           
 int getHeight()
           
 info.magnolia.cms.core.HierarchyManager getHierarchyManager()
           
 String getHtml()
          Returns an empty string.
 String getHtmlBranch()
           
 String getHtmlChildren()
           
 String getHtmlChildrenOfOneType(info.magnolia.cms.core.Content parentNode, String itemType)
           
 String getHtmlFooter()
           
 String getHtmlHeader()
           
protected  void getHtmlOfSingleItem(StringBuffer html, info.magnolia.cms.core.Content parentNode, String itemType, Object item)
           
protected  String getIcon(info.magnolia.cms.core.Content node, info.magnolia.cms.core.NodeData nodedata, String itemType)
           
protected  String getIcon(String itemType)
           
 String getIconContentNode()
           
 String getIconNodeData()
           
 String getIconOndblclick()
           
 String getIconPage()
           
 int getIndentionWidth()
           
 List getItemTypes()
           
 String getJavascriptTree()
           
 ContextMenu getMenu()
           
protected  int getPaddingLeft(info.magnolia.cms.core.Content parentNode)
           
 String getPath()
           
protected  String getPathCurrent()
           
 String getPathOpen()
           
 String getPathSelected()
           
 String getRepository()
           
 String getRootPath()
           
 String getShifterCollapse()
           
 String getShifterEmpty()
           
 String getShifterExpand()
           
 boolean getSnippetMode()
           
 Comparator getSortComparator()
           
protected  String getUniqueLabel(String label)
           
protected  boolean hasSub(info.magnolia.cms.core.Content c, String type)
           
 boolean isBrowseMode()
           
protected  void onGetHtmlOfSingleItem(StringBuffer html, info.magnolia.cms.core.Content parentNode, String itemType, Object item, String idPre)
           
protected  Map populateTemplateParameters()
           
 String saveNodeData(String nodeDataName, String value, boolean isMeta)
           
 String saveNodeDataType(String nodeDataName, int type)
           
 void setBrowseMode(boolean browseMode)
           
 void setColumnResizer(String src)
           
 void setColums(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(String typeName, String icon)
          Deprecated. since 4.4 use addIcon(String, String) instead.
 void setIconContentNode(String src)
          Deprecated. since 4.4, use addIcon(ItemType.CONTENTNODE.getSystemName(), src) instead
 void setIconNodeData(String src)
          Deprecated. since 4.4, use addIcon(ItemType.MGNL_NODE_DATA, src) instead
 void setIconOndblclick(String s)
          Set the double click event of the icon.
 void setIconPage(String src)
          Deprecated. since 4.4, use addIcon(ItemType.CONTENT.getSystemName(), src) instead
 void setIndentionWidth(int i)
           
 void setJavascriptTree(String variableName)
          Set the name of the javascript tree object.
 void setMenu(ContextMenu menu)
           
protected  void setPathCurrent(String s)
           
 void setPathOpen(String s)
           
 void setPathSelected(String s)
          Sets which path will be selected (and opened - overwrites pathOpen).
 void setRepository(String s)
           
 void setRootPath(String rootPath)
           
 void setShifterCollapse(String src)
          Set the shifter image (collapse branch).
 void setShifterEmpty(String src)
          Set the shifter image when no children are available (not expandable).
 void setShifterExpand(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(Comparator sortComperator)
           
protected  boolean showNode(info.magnolia.cms.core.Content node, info.magnolia.cms.core.NodeData nodedata, 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 String DOCROOT
See Also:
Constant Field Values

ICONDOCROOT

public static final String ICONDOCROOT
See Also:
Constant Field Values

DEFAULT_ICON

public static final String DEFAULT_ICON
See Also:
Constant Field Values

DEFAULT_ICON_CONTENT

public static final String DEFAULT_ICON_CONTENT
See Also:
Constant Field Values

DEFAULT_ICON_CONTENTNODE

public static final String DEFAULT_ICON_CONTENTNODE
See Also:
Constant Field Values

DEFAULT_ICON_NODEDATA

public static final String DEFAULT_ICON_NODEDATA
See Also:
Constant Field Values

DEFAULT_ICON_DELETED

public static final String DEFAULT_ICON_DELETED
See Also:
Constant Field Values

ITEM_TYPE_NODEDATA

@Deprecated
public static final 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(String name,
                       String repository,
                       javax.servlet.http.HttpServletRequest request)
Deprecated. don't pass the request


Tree

public Tree(String name,
            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(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(String s)

getRepository

public String getRepository()

setPathOpen

public void setPathOpen(String s)

getPathOpen

public String getPathOpen()

setPathSelected

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

Parameters:
s -

getPathSelected

public String getPathSelected()

getPath

public String getPath()
Overrides:
getPath in class ControlImpl

setPathCurrent

protected void setPathCurrent(String s)

getPathCurrent

protected String getPathCurrent()

setIndentionWidth

public void setIndentionWidth(int i)

getIndentionWidth

public int getIndentionWidth()

getItemTypes

public List getItemTypes()

addItemType

@Deprecated
public void addItemType(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(String type,
                        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(String type,
                        boolean strict)

addItemType

public void addItemType(String type,
                        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(info.magnolia.cms.core.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(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 String getIconPage()

setIconContentNode

@Deprecated
public void setIconContentNode(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 String getIconContentNode()

setIconNodeData

@Deprecated
public void setIconNodeData(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 String getIconNodeData()

getIcon

protected String getIcon(String itemType)

getIcon

protected String getIcon(info.magnolia.cms.core.Content node,
                         info.magnolia.cms.core.NodeData nodedata,
                         String itemType)

setIcon

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


addIcon

public void addIcon(String typeName,
                    String icon)

setIconOndblclick

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

Parameters:
s - javascriopt method

getIconOndblclick

public String getIconOndblclick()

setShifterExpand

public void setShifterExpand(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 String getShifterExpand()

setShifterCollapse

public void setShifterCollapse(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 String getShifterCollapse()

setShifterEmpty

public void setShifterEmpty(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 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(List al)
Set the columns (for pages and content nodes only).

Parameters:
al - list of TreeColumns

getColumns

public List getColumns()

getColumns

public TreeColumn getColumns(int col)

addColumn

public void addColumn(TreeColumn tc)

setJavascriptTree

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

Parameters:
variableName -

getJavascriptTree

public 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(String src)

getColumnResizer

public String getColumnResizer()

createNode

public String createNode(String itemType)

createNode

public String createNode(String label,
                         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 String saveNodeData(String nodeDataName,
                           String value,
                           boolean isMeta)

saveNodeDataType

public String saveNodeDataType(String nodeDataName,
                               int type)

getUniqueLabel

protected String getUniqueLabel(String label)
Parameters:
label -
Returns:
unique label

getHtml

public 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 String getHtmlHeader()

getHtmlFooter

public String getHtmlFooter()

populateTemplateParameters

protected Map populateTemplateParameters()

getHtmlBranch

public String getHtmlBranch()

getHtmlChildren

public String getHtmlChildren()

getHtmlChildrenOfOneType

public String getHtmlChildrenOfOneType(info.magnolia.cms.core.Content parentNode,
                                       String itemType)

getHtmlOfSingleItem

protected void getHtmlOfSingleItem(StringBuffer html,
                                   info.magnolia.cms.core.Content parentNode,
                                   String itemType,
                                   Object item)
                            throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

onGetHtmlOfSingleItem

protected void onGetHtmlOfSingleItem(StringBuffer html,
                                     info.magnolia.cms.core.Content parentNode,
                                     String itemType,
                                     Object item,
                                     String idPre)

collectRenderedItems

protected Iterator collectRenderedItems(info.magnolia.cms.core.Content parentNode,
                                        String itemType)

getPaddingLeft

protected int getPaddingLeft(info.magnolia.cms.core.Content parentNode)
                      throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

hasSub

protected boolean hasSub(info.magnolia.cms.core.Content c,
                         String type)

showNode

protected boolean showNode(info.magnolia.cms.core.Content node,
                           info.magnolia.cms.core.NodeData nodedata,
                           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(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 info.magnolia.cms.core.HierarchyManager getHierarchyManager()
Returns:
the current HierarchyManager

getSortComparator

public Comparator getSortComparator()

setSortComparator

public void setSortComparator(Comparator sortComperator)

getRootPath

public String getRootPath()

setRootPath

public void setRootPath(String rootPath)


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