public class CmsTreeItem extends CmsListItem
Implemented as:
<li class='listTreeItem listTreeItem*state*'>
<span class='listTreeItemImage'></span>
<div class='listTreeItemContent'>...*content*</div>
<ul class='listTreeItemChildren'>
*children*
</ul>
</li>
Where state can be opened, closed or leaf.CmsListItem.MoveHandle| 限定符和类型 | 字段和说明 |
|---|---|
static int |
ANIMATION_DURATION
The duration of the animations.
|
protected CmsList<CmsTreeItem> |
m_children
The children list.
|
protected CmsToggleButton |
m_opener
The element showing the open/close icon.
|
m_checkbox, m_decoratedPanel, m_decorationWidgets, m_decorationWidth, m_id, m_listItemWidget, m_mainWidget, m_panel, m_placeholder, m_provisionalParent| 限定符 | 构造器和说明 |
|---|---|
protected |
CmsTreeItem(boolean showOpeners)
Default constructor.
|
|
CmsTreeItem(boolean showOpeners,
CmsCheckBox checkbox,
com.google.gwt.user.client.ui.Widget mainWidget)
Creates a new list tree item containing a main widget and a check box.
|
|
CmsTreeItem(boolean showOpeners,
com.google.gwt.user.client.ui.Widget mainWidget)
Creates a new list tree item containing a main widget.
|
|
CmsTreeItem(boolean showOpeners,
com.google.gwt.user.client.ui.Widget mainWidget,
java.lang.String icon)
Creates a new tree item with a 24px wide icon.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
add(com.google.gwt.user.client.ui.Widget w)
Unsupported operation.
|
void |
addChild(CmsTreeItem item)
Adds a child list item.
|
protected void |
adopt(CmsTreeItem item)
Adopts the given item.
|
void |
clear() |
void |
clearChildren()
Removes all children.
|
void |
closeAllEmptyChildren()
Closes all empty child entries.
|
protected CmsToggleButton |
createOpener()
Creates the button for opening/closing this item.
|
protected void |
executeOpen(boolean fireEvents)
Executes the open call.
|
protected void |
fireClose()
Fires the close event.
|
protected void |
fireOpen()
Fires the open event on the tree.
|
CmsTreeItem |
getChild(int index)
Returns the child tree item at the given position.
|
CmsTreeItem |
getChild(java.lang.String itemId)
Returns the tree item with the given id.
|
int |
getChildCount()
Helper method which gets the number of children.
|
CmsList<? extends I_CmsListItem> |
getChildren()
Returns the children of this list item.
|
com.google.gwt.dom.client.Element |
getDragHelper(I_CmsDropTarget target)
Creates the drag helper element and attaches it into the DOM.
|
int |
getItemPosition(CmsTreeItem item)
Returns the given item position.
|
protected static CmsTreeItem |
getLastOpenedItem(CmsTreeItem item,
int stopLevel,
boolean requiresDropEnabled)
Returns the last opened item of a tree fragment.
|
protected com.google.gwt.user.client.ui.Image |
getMinusImage()
The '-' image.
|
CmsTreeItem |
getParentItem()
Returns the parent item.
|
I_CmsDropTarget |
getParentTarget()
Returns the parent drop target or
null if there is none. |
java.lang.String |
getPath()
Returns the path of IDs for the this item.
|
protected static int |
getPathLevel(java.lang.String path)
Method determining the path level by counting the number of '/'.
|
protected com.google.gwt.user.client.ui.Image |
getPlusImage()
The '+' image.
|
CmsTree<CmsTreeItem> |
getTree()
Gets the tree to which this tree item belongs, or null if it does not belong to a tree.
|
void |
hideOpeners()
Hides the open/close icons for this tree item and its descendants.
|
void |
insertChild(CmsTreeItem item,
int position)
Inserts the given item at the given position.
|
protected int |
insertPlaceholderAsLastChild(com.google.gwt.dom.client.Element placeholder)
Inserts the placeholder element as last child of the children list.
|
boolean |
isDropEnabled()
Checks if dropping is enabled.
|
boolean |
isOpen()
Checks if the item is open or closed.
|
protected void |
onChangeChildren()
Helper method which is called when the list of children changes.
|
void |
onDragCancel()
Executed on drag cancel.
|
CmsTreeItem |
removeChild(CmsTreeItem item)
Removes an item from the list.
|
CmsTreeItem |
removeChild(int index)
Removes the item identified by the given index from the list.
|
CmsTreeItem |
removeChild(java.lang.String itemId)
Removes an item from the list.
|
void |
removeOpener()
Removes the opener widget.
|
int |
repositionPlaceholder(int x,
int y,
com.google.gwt.dom.client.Element placeholder,
CmsDNDHandler.Orientation orientation)
Positions the drag and drop placeholder as a sibling or descendant of this element.
|
void |
setDropEnabled(boolean enabled)
Enables/disables dropping.
|
void |
setLeafStyle(boolean isLeaf)
Sets the tree item style to leaf, hiding the list opener.
|
void |
setOpen(boolean open)
Opens or closes this tree item (i.e. shows or hides its descendants).
|
void |
setOpen(boolean open,
boolean fireEvents)
Opens or closes this tree item (i.e. shows or hides its descendants).
|
void |
setParentItem(CmsTreeItem parentItem)
Sets the parent item.
|
void |
setTree(CmsTree<CmsTreeItem> tree)
Sets the tree to which this tree item belongs.
|
void |
showOpeners()
Shows the open/close icons for this tree item and its descendants.
|
addCheckBox, addDecoration, addDecorationWidget, addMainWidget, cloneForPlaceholder, getCheckBox, getData, getDecorationWidgets, getId, getListItemWidget, getMainWidget, getMoveHandle, getParentList, getPlaceholder, initContent, initContent, initContent, initMoveHandle, initMoveHandle, onDrop, onStartDrag, removeDecorationWidget, setData, setId, setSmallView, truncateclaimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidgetaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEventsaddStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEventsclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetElementpublic static final int ANIMATION_DURATION
protected CmsList<CmsTreeItem> m_children
protected CmsToggleButton m_opener
public CmsTreeItem(boolean showOpeners,
CmsCheckBox checkbox,
com.google.gwt.user.client.ui.Widget mainWidget)
showOpeners - if true, show open/close iconscheckbox - the check boxmainWidget - the main widgetpublic CmsTreeItem(boolean showOpeners,
com.google.gwt.user.client.ui.Widget mainWidget)
showOpeners - if true, show open/close iconsmainWidget - the main widgetpublic CmsTreeItem(boolean showOpeners,
com.google.gwt.user.client.ui.Widget mainWidget,
java.lang.String icon)
showOpeners - if true, show open/close iconsmainWidget - the main widgeticon - the icon style nameprotected CmsTreeItem(boolean showOpeners)
showOpeners - if true, the opener icons should be shownprotected static CmsTreeItem getLastOpenedItem(CmsTreeItem item, int stopLevel, boolean requiresDropEnabled)
item - the tree itemstopLevel - the level to stop at, set -1 to go to the very last opened itemrequiresDropEnabled - true if it is required the returned element to be drop enabledprotected static int getPathLevel(java.lang.String path)
Example: '/xxx/xxx/' has a path-level of 2.
path - the path to testpublic void add(com.google.gwt.user.client.ui.Widget w)
add 在接口中 I_CmsListItemadd 在类中 CmsListItemw - the widget to addCmsListItem.add(com.google.gwt.user.client.ui.Widget)public void addChild(CmsTreeItem item)
item - the child to addCmsList.addItem(org.opencms.gwt.client.ui.I_CmsListItem)public void clear()
HasWidgets.clear()public void clearChildren()
CmsList.clearList()public void closeAllEmptyChildren()
public CmsTreeItem getChild(int index)
index - the positionCmsList.getItem(int)public CmsTreeItem getChild(java.lang.String itemId)
itemId - the id of the item to retrieveCmsList.getItem(String)public int getChildCount()
ComplexPanel.getWidgetCount()public CmsList<? extends I_CmsListItem> getChildren()
public com.google.gwt.dom.client.Element getDragHelper(I_CmsDropTarget target)
I_CmsDraggablegetDragHelper 在接口中 I_CmsDraggablegetDragHelper 在类中 CmsListItemtarget - the drop targetI_CmsDraggable.getDragHelper(I_CmsDropTarget)public int getItemPosition(CmsTreeItem item)
item - the item to get the position forpublic CmsTreeItem getParentItem()
public I_CmsDropTarget getParentTarget()
I_CmsDraggablenull if there is none.getParentTarget 在接口中 I_CmsDraggablegetParentTarget 在类中 CmsListItemCmsListItem.getParentTarget()public java.lang.String getPath()
public CmsTree<CmsTreeItem> getTree()
nullpublic void hideOpeners()
public void insertChild(CmsTreeItem item, int position)
item - the item to insertposition - the positionCmsList.insertItem(org.opencms.gwt.client.ui.I_CmsListItem, int)public boolean isDropEnabled()
true if dropping is enabledpublic boolean isOpen()
true if openpublic void onDragCancel()
I_CmsDraggableonDragCancel 在接口中 I_CmsDraggableonDragCancel 在类中 CmsListItemI_CmsDraggable.onDragCancel()public CmsTreeItem removeChild(CmsTreeItem item)
item - the item to removeCmsList.removeItem(org.opencms.gwt.client.ui.I_CmsListItem)public CmsTreeItem removeChild(int index)
index - the index of the item to removeComplexPanel.remove(int)public CmsTreeItem removeChild(java.lang.String itemId)
itemId - the id of the item to removeCmsList.removeItem(String)public void removeOpener()
public int repositionPlaceholder(int x,
int y,
com.google.gwt.dom.client.Element placeholder,
CmsDNDHandler.Orientation orientation)
x - the cursor client x positiony - the cursor client y positionplaceholder - the placeholderorientation - the drag and drop orientationpublic void setDropEnabled(boolean enabled)
enabled - true to enable, or false to disablepublic void setLeafStyle(boolean isLeaf)
isLeaf - true to set to leaf stylepublic void setOpen(boolean open)
open - if true, open the tree item, else close itpublic void setOpen(boolean open,
boolean fireEvents)
open - if true, open the tree item, else close itfireEvents - true if the open/close events should be firedpublic void setParentItem(CmsTreeItem parentItem)
parentItem - the parent item to setpublic void setTree(CmsTree<CmsTreeItem> tree)
This is automatically called when this tree item or one of its ancestors is inserted into a tree.
tree - the tree into which the item has been insertedpublic void showOpeners()
protected void adopt(CmsTreeItem item)
item - the item to adoptprotected CmsToggleButton createOpener()
protected void executeOpen(boolean fireEvents)
fireEvents - if true, open/close events will be firedprotected void fireClose()
protected void fireOpen()
protected com.google.gwt.user.client.ui.Image getMinusImage()
protected com.google.gwt.user.client.ui.Image getPlusImage()
protected int insertPlaceholderAsLastChild(com.google.gwt.dom.client.Element placeholder)
placeholder - the placeholder elementprotected void onChangeChildren()