|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Tree
A container which can be used to hold a tabular or hierarchical set of rows of elements.
Event:
Default HtmlBasedComponent.getZclass()
: z-tree, and an other option is z-dottree. (since
3.5.0)
Field Summary |
---|
Fields inherited from interface org.zkoss.zk.ui.Component |
---|
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE |
Method Summary | |
---|---|
void |
addItemToSelectionApi(Treeitem item)
Selects the given item, without deselecting any other items that are already selected.. |
void |
clear()
Clears all child tree items ( Treeitem . |
void |
clearSelection()
Clears the selection. |
int |
getActivePage()
Returns the active page (starting from 0). |
java.util.Collection |
getHeads()
Returns a collection of heads, including getTreecolsApi() and
auxiliary heads (Auxhead ) (never null). |
java.lang.String |
getInnerWidth()
Returns the inner width of this component. |
int |
getItemCount()
Returns the number of child Treeitem . |
java.util.Collection |
getItems()
Returns a readonly list of all descending Treeitem (children's
children and so on). |
TreeModel |
getModel()
Returns the list model associated with this tree, or null if this tree is not associated with any tree data model. |
java.lang.String |
getName()
Returns the name of this component. |
int |
getPageCount()
Returns the number of pages. |
int |
getPageSize()
Returns the page size, aka., the number items per page. |
Paginal |
getPaginal()
Returns the paging controller, or null if not available. |
Paging |
getPagingChildApi()
Returns the child paging controller that is created automatically, or null if mold is not "paging", or the controller is specified externally by setPaginal(org.zkoss.zul.ext.Paginal) . |
int |
getRows()
Returns the rows. |
int |
getSelectedCount()
Returns the number of items being selected. |
Treeitem |
getSelectedItemApi()
Returns the selected item. |
java.util.Set |
getSelectedItems()
Returns all selected items. |
java.lang.String |
getSeltype()
Returns the seltype. |
Treechildren |
getTreechildrenApi()
Returns the treechildren that this tree owns (might null). |
Treecols |
getTreecolsApi()
Returns the treecols that this tree owns (might null). |
Treefoot |
getTreefootApi()
Returns the treefoot that this tree owns (might null). |
TreeitemRenderer |
getTreeitemRenderer()
Returns the renderer to render each item, or null if the default renderer is used. |
boolean |
isFixedLayout()
Deprecated. since 5.0.0, use ! isSizedByContent() instead |
boolean |
isMultiple()
Returns whether multiple selections are allowed. |
boolean |
isSizedByContent()
Returns whether sizing tree grid column width by its content. |
void |
removeItemFromSelectionApi(Treeitem item)
Deselects the given item without deselecting other items. |
void |
renderItemApi(Treeitem item)
Renders the specified Treeitem , if not loaded yet, with
getTreeitemRenderer() . |
void |
renderItemApi(Treeitem item,
java.lang.Object node)
Renders the specified Treeitem , if not loaded yet, with
getTreeitemRenderer() . |
Treeitem |
renderItemByPathApi(int[] path)
Load treeitems through path path Note: By using this method, all treeitems in path will be rendered and opened ( Treeitem.setOpen(boolean) ). |
void |
renderItems(java.util.Set items)
Renders the specified Treeitem if not loaded yet, with
getTreeitemRenderer() . |
void |
selectAll()
Selects all items. |
void |
selectItemApi(Treeitem item)
Deselects all of the currently selected items and selects the given item. |
void |
setActivePage(int pg)
Sets the active page (starting from 0). |
void |
setActivePageApi(Treeitem item)
Sets the active page in which the specified item is. |
void |
setCheckmark(boolean checkmark)
Sets whether the check mark shall be displayed in front of each item. |
void |
setFixedLayout(boolean fixedLayout)
Deprecated. since 5.0.0, use setSizedByContent(boolean) (!fixedLayout) instead |
void |
setInnerWidth(java.lang.String innerWidth)
Sets the inner width of this component. |
void |
setModel(TreeModel model)
Sets the tree model associated with this tree. |
void |
setMultiple(boolean multiple)
Sets whether multiple selections are allowed. |
void |
setName(java.lang.String name)
Sets the name of this component. |
void |
setPageSize(int pgsz)
Sets the page size, aka., the number items per page. |
void |
setPaginal(Paginal pgi)
Specifies the paging controller. |
void |
setPagingPosition(java.lang.String pagingPosition)
Sets how to position the paging of tree at the client screen. |
void |
setRows(int rows)
Sets the rows. |
void |
setSelectedItemApi(Treeitem item)
Deselects all of the currently selected items and selects the given item. |
void |
setSeltype(java.lang.String seltype)
Sets the seltype. |
void |
setSizedByContent(boolean byContent)
Sets whether sizing tree grid column width by its content. |
void |
setTreeitemRenderer(TreeitemRenderer renderer)
Sets the renderer which is used to render each item if getModel()
is not null. |
void |
setVflex(boolean vflex)
Sets whether to grow and shrink vertical to fit their given space, so called vertial flexibility. |
void |
toggleItemSelectionApi(Treeitem item)
If the specified item is selected, it is deselected. |
Methods inherited from interface org.zkoss.zul.impl.api.XulElement |
---|
getAction, getContext, getCtrlKeys, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip |
Methods inherited from interface org.zkoss.zk.ui.api.HtmlBasedComponent |
---|
focus, getHeight, getLeft, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZclass, getZindex, getZIndex, setDraggable, setDroppable, setFocus, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex |
Methods inherited from interface org.zkoss.zk.ui.ext.Scope |
---|
addScopeListener, getAttribute, hasAttribute, removeAttribute, removeScopeListener, setAttribute |
Methods inherited from interface org.zkoss.zul.ext.Paginated |
---|
getPagingPosition |
Method Detail |
---|
void setPagingPosition(java.lang.String pagingPosition)
pagingPosition
- how to position. It can only be "bottom" (the default), or
"top", or "both".Paginal getPaginal()
Component.getMold()
is "paging".
If mold is "paging", this method never returns null, because a child
paging controller is created automcatically (if not specified by
developers with setPaginal(org.zkoss.zul.ext.Paginal)
).
If a paging controller is specified (either by setPaginal(org.zkoss.zul.ext.Paginal)
, or by
Component.setMold(java.lang.String)
with "paging"), the tree will rely on the paging
controller to handle long-content instead of scrolling.
void setPaginal(Paginal pgi)
Component.getMold()
is "paging".
It is OK, though without any effect, to specify a paging controller even if mold is not "paging".
pgi
- the paging controller. If null and Component.getMold()
is
"paging", a paging controller is created automatically as a
child component (see getPagingChildApi()
).Paging getPagingChildApi()
setPaginal(org.zkoss.zul.ext.Paginal)
.
int getPageSize()
java.lang.IllegalStateException
- if getPaginal()
returns null, i.e., mold is not
"paging" and no external controller is specified.void setPageSize(int pgsz) throws WrongValueException
Note: mold is not "paging" and no external controller is specified.
WrongValueException
int getPageCount()
int getActivePage()
void setActivePage(int pg) throws WrongValueException
WrongValueException
void setSizedByContent(boolean byContent)
You can also specify the "sized-by-content" attribute of component in lang-addon.xml directly, it will then take higher priority.
byContent
- boolean isSizedByContent()
Note: if the "sized-by-content" attribute of component is specified, it's prior to the original value.
setSizedByContent(boolean)
void setFixedLayout(boolean fixedLayout)
setSizedByContent(boolean)
(!fixedLayout) instead
You can also specify the "fixed-layout" attribute of component in lang-addon.xml directly, it's a top priority.
boolean isFixedLayout()
isSizedByContent()
instead
Default: false.
Note: if the "fixed-layout" attribute of component is specified, it's prior to the original value.
Treecols getTreecolsApi()
Treefoot getTreefootApi()
Treechildren getTreechildrenApi()
java.util.Collection getHeads()
getTreecolsApi()
and
auxiliary heads (Auxhead
) (never null).
int getRows()
Default: 0.
void setRows(int rows) throws WrongValueException
Note: if both HtmlBasedComponent.setHeight(java.lang.String)
is specified with non-empty,
setRows(int)
is ignored
WrongValueException
java.lang.String getName()
Default: null.
The name is used only to work with "legacy" Web application that handles user's request by servlets. It works only with HTTP/HTML-based browsers. It doesn't work with other kind of clients.
Don't use this method if your application is purely based on ZK's event-driven model.
void setName(java.lang.String name)
The name is used only to work with "legacy" Web application that handles user's request by servlets. It works only with HTTP/HTML-based browsers. It doesn't work with other kind of clients.
Don't use this method if your application is purely based on ZK's event-driven model.
name
- the name of this component.void setCheckmark(boolean checkmark)
The check mark is a checkbox if isMultiple()
returns true. It is a
radio button if isMultiple()
returns false.
void setVflex(boolean vflex)
Note: this attribute is ignored if setRows(int)
is specified
void setInnerWidth(java.lang.String innerWidth)
Application developers rarely call this method, unless they want to
preserve the widths of sizable columns changed by the user. To preserve
the widths, the developer have to store the widths of all columns and the
inner width (getInnerWidth()
), and then restore them when
re-creating this component.
innerWidth
- the inner width. If null, "100%" is assumed.java.lang.String getInnerWidth()
Default: "100%"
setInnerWidth(java.lang.String)
java.lang.String getSeltype()
Default: "single".
void setSeltype(java.lang.String seltype) throws WrongValueException
WrongValueException
boolean isMultiple()
Default: false.
void setMultiple(boolean multiple)
void setActivePageApi(Treeitem item)
item
- the item to show. If the item is null, invisible, or doesn't
belong to the same tree, nothing happens.java.util.Collection getItems()
Treeitem
(children's
children and so on).
Note: the performance of the size method of returned collection is no good.
int getItemCount()
Treeitem
. The same as
getItems()
.size().
Note: the performance of this method is no good.
void selectItemApi(Treeitem item)
It is the same as setSelectedItemApi(org.zkoss.zul.api.Treeitem)
.
item
- the item to select. If null, all items are deselected.void addItemToSelectionApi(Treeitem item)
void removeItemFromSelectionApi(Treeitem item)
void toggleItemSelectionApi(Treeitem item)
void clearSelection()
void selectAll()
Treeitem getSelectedItemApi()
void setSelectedItemApi(Treeitem item)
It is the same as selectItemApi(org.zkoss.zul.api.Treeitem)
.
java.util.Set getSelectedItems()
int getSelectedCount()
void clear()
Treeitem
.
Note: after clear, getTreechildrenApi()
won't be null, but it has
no child
void setModel(TreeModel model)
Note: changing a render will not cause the tree to re-render. If you want
it to re-render, you could assign the same model again (i.e.,
setModel(getModel())), or fire an TreeDataEvent
event.
Author: jeffliu
model
- the tree model to associate, or null to dis-associate any
previous model.
UiException
- if failed to initialize with the modelTreeModel getModel()
Author: jeffliu
void setTreeitemRenderer(TreeitemRenderer renderer)
getModel()
is not null.
Note: changing a render will not cause the tree to re-render. If you want
it to re-render, you could assign the same model again (i.e.,
setModel(getModel())), or fire an TreeDataEvent
event.
Author: jeffliu
renderer
- the renderer, or null to use the default.
UiException
- if failed to initialize with the modelTreeitemRenderer getTreeitemRenderer()
void renderItemApi(Treeitem item)
Treeitem
, if not loaded yet, with
getTreeitemRenderer()
.
It does nothing if getModel()
returns null.
To unload treeitem, use Treeitem.unload()
.
renderItems(java.util.Set)
void renderItemApi(Treeitem item, java.lang.Object node)
Treeitem
, if not loaded yet, with
getTreeitemRenderer()
.
It does nothing if getModel()
returns null.
Note: Since the corresponding node is given, This method has better performance than renderItem(Treeitem item) due to not searching for its corresponding node.
To unload treeitem, use Treeitem.unload()
.
renderItems(java.util.Set)
void renderItems(java.util.Set items)
Treeitem
if not loaded yet, with
getTreeitemRenderer()
.
It does nothing if getModel()
returns null.
To unload treeitem, with Treeitem.unload()
.
Tree.renderItem(org.zkoss.zul.Treeitem)
Treeitem renderItemByPathApi(int[] path)
Treeitem.setOpen(boolean)
). If you want to visit the rendered item
in paging mold, please invoke setActivePageApi(Treeitem)
.
path
- - an int[] path, see TreeModel.getPath(java.lang.Object, java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |