public class Organigram extends XulElement
TreeModel
to render the data.
Event:
SelectEvent
is sent when user changes the selection.
To retrieve what is selected in Organigram with a TreeSelectableModel
,
you shall use TreeSelectableModel.isPathSelected(int[])
to check whether the current path is selected in TreeSelectableModel
rather than using getSelectedItem()
. That is, you shall operate on
the item of the TreeSelectableModel
rather than on the Orgitem
of the Organigram
if you use the TreeSelectableModel
and TreeModel
.
To retrieve what are opened nodes in Organigram with a TreeOpenableModel
,
you shall use TreeOpenableModel.isPathOpened(int[])
to check whether the current path is opened in TreeOpenableModel
rather than using Orgitem.isOpen()
. That is, you shall operate on
the item of the TreeOpenableModel
rather than on the Orgitem
of the Organigram
if you use the TreeOpenableModel
and TreeModel
.
HtmlBasedComponent.ExtraCtrl
AbstractComponent.Children
_zclass
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
Constructor and Description |
---|
Organigram() |
Modifier and Type | Method and Description |
---|---|
void |
beforeChildAdded(Component child,
Component insertBefore)
Default: does nothing.
|
void |
clear()
Clears all child Orgitems (
Orgitem . |
java.lang.Object |
clone()
Clones the component.
|
int |
getItemCount()
Returns the number of child
Orgitem . |
<T> OrgitemRenderer<T> |
getItemRenderer()
Returns the renderer to render each item, or null if the default renderer is used.
|
java.util.Collection<Orgitem> |
getItems()
Returns a readonly list of all descending
Orgitem
(children's children and so on). |
<T> TreeModel<T> |
getModel()
Returns the tree model associated with this Organigram, or null
if this Organigram is not associated with any tree data model.
|
Orgchildren |
getOrgchildren()
Returns the Orgchildren that this Organigram owns.
|
Orgitem |
getSelectedItem()
Returns the selected item.
|
int |
getVisibleItemCount()
Returns the number of visible descendant
Orgitem . |
java.lang.String |
getZclass()
Returns the ZK Cascading Style class(es) for this component.
|
boolean |
insertBefore(Component newChild,
Component refChild)
Inserts a child before the reference child.
|
void |
onChildRemoved(Component child)
Default: handles special event listeners.
|
void |
onInitRender()
Handles a private event, onInitRender.
|
void |
onPageAttached(Page newpage,
Page oldpage)
Default: handles special event listeners.
|
void |
onPageDetached(Page page)
Default: handles special event listeners.
|
void |
renderItem(Orgitem item)
Renders the specified
Orgitem , if not loaded yet,
with getItemRenderer() . |
protected void |
renderProperties(ContentRenderer renderer)
Renders the content of this component, excluding the enclosing
tags and children.
|
void |
service(AuRequest request,
boolean everError)
Processes an AU request.
|
void |
sessionDidActivate(Page page)
Notification that the session, which owns this component,
has just been activated (a.k.a., deserialized).
|
void |
sessionWillPassivate(Page page)
Notification that the session, which owns this component,
is about to be passivated (a.k.a., serialized).
|
void |
setItemRenderer(OrgitemRenderer<?> renderer)
Sets the renderer which is used to render each item
if
getModel() is not null. |
void |
setItemRenderer(java.lang.String clsnm)
Sets the renderer by use of a class name.
|
void |
setModel(TreeModel<?> model)
Sets the tree model associated with this Organigram.
|
void |
setSelectedItem(Orgitem selectedItem)
Deselects previous selected item and selects the given item.
|
getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes
addSclass, evalCSSFlex, focus, getAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, removeSclass, removeSclass, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
addAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, invalidate, invalidatePartial, isChildable, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, replace, response, response, response, service, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
invalidatePartial
public Orgchildren getOrgchildren()
public java.util.Collection<Orgitem> getItems()
Orgitem
(children's children and so on).
Note: the performance of the size method of returned collection is no good.
Orgitem
public int getItemCount()
Orgitem
.
The same as getItems()
.size().
Note: the performance of this method is no good.
Orgitem
.public int getVisibleItemCount()
Orgitem
.
Descendants include direct children, grand children and so on.Orgitem
.public Orgitem getSelectedItem()
public void setSelectedItem(Orgitem selectedItem)
selectedItem
- the item will be selectedpublic void clear()
Orgitem
.
Note: after clear, getOrgchildren()
won't be null, but it has no child.
public void beforeChildAdded(Component child, Component insertBefore)
AbstractComponent
beforeChildAdded
in interface ComponentCtrl
beforeChildAdded
in class AbstractComponent
child
- the child to be added (never null).insertBefore
- another child component that the new child
will be inserted before it. If null, the new child will be the
last child.ComponentCtrl.beforeChildAdded(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
public boolean insertBefore(Component newChild, Component refChild)
Component
You could use Component.setParent(org.zkoss.zk.ui.Component)
or Component.appendChild(org.zkoss.zk.ui.Component)
instead of this method, unless
you want to control where to put the child.
Note: Component.setParent(org.zkoss.zk.ui.Component)
always calls back Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
and/or Component.removeChild(org.zkoss.zk.ui.Component)
,
while Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
and Component.removeChild(org.zkoss.zk.ui.Component)
always calls back Component.setParent(org.zkoss.zk.ui.Component)
,
if the parent is changed. Thus, you don't need to override
both Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
and Component.setParent(org.zkoss.zk.ui.Component)
, if you want
to customize the behavior.
If you would like to monitor if a component is attached or detached
from a page, you could register a desktop listener implementing
UiLifeCycle
.
insertBefore
in interface Component
insertBefore
in class AbstractComponent
newChild
- the new child to be inserted.refChild
- the child before which you want the new child
being inserted. If null, the new child is append to the end.public void onChildRemoved(Component child)
AbstractComponent
onChildRemoved
in interface ComponentCtrl
onChildRemoved
in class AbstractComponent
ComponentCtrl.onChildRemoved(org.zkoss.zk.ui.Component)
public void onPageAttached(Page newpage, Page oldpage)
AbstractComponent
onPageAttached
in interface ComponentCtrl
onPageAttached
in class AbstractComponent
newpage
- the new page (never null).oldpage
- the previous page, if any, or null if it didn't
belong to any page.ComponentCtrl.onPageAttached(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Page)
public void onPageDetached(Page page)
AbstractComponent
onPageDetached
in interface ComponentCtrl
onPageDetached
in class AbstractComponent
page
- the previous page (never null)ComponentCtrl.onPageDetached(org.zkoss.zk.ui.Page)
public java.lang.Object clone()
Component
clone
in interface Component
clone
in class XulElement
public void sessionWillPassivate(Page page)
ComponentCtrl
Note: only root components are notified by this method.
sessionWillPassivate
in interface ComponentCtrl
sessionWillPassivate
in class AbstractComponent
public void sessionDidActivate(Page page)
ComponentCtrl
Note: only root components are notified by this method.
sessionDidActivate
in interface ComponentCtrl
sessionDidActivate
in class AbstractComponent
public <T> TreeModel<T> getModel()
public void setModel(TreeModel<?> model)
model
- the tree model to associate, or null to dissociate any previous model.UiException
- if failed to initialize with the modelpublic void onInitRender()
public <T> OrgitemRenderer<T> getItemRenderer()
public void setItemRenderer(OrgitemRenderer<?> renderer)
getModel()
is not null.
Note: changing a render will cause the Organigram to re-render.
renderer
- the renderer, or null to use the default.public void setItemRenderer(java.lang.String clsnm) throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.reflect.InvocationTargetException
clsnm
- the class name of rendererjava.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
public void renderItem(Orgitem item)
Orgitem
, if not loaded yet,
with getItemRenderer()
.
It does nothing if getModel()
returns null.
item
- the item to be renderedpublic void service(AuRequest request, boolean everError)
HtmlBasedComponent
Default: it handles onClick, onDoubleClick, onRightClick onMove, onSize, onZIndex.
service
in interface ComponentCtrl
service
in class HtmlBasedComponent
everError
- whether any error ever occurred before
processing this request.AbstractComponent.setAuService(org.zkoss.zk.au.AuService)
protected void renderProperties(ContentRenderer renderer) throws java.io.IOException
HtmlBasedComponent
renderProperties
in class XulElement
java.io.IOException
public java.lang.String getZclass()
HtmlBasedComponent
AbstractComponent.getMold()
).
Default: null (the default value depends on element).
HtmlBasedComponent.setZclass(java.lang.String)
) will completely replace the default style
of a component. In other words, the default style of a component
is associated with the default value of HtmlBasedComponent.getZclass()
.
Once it is changed, the default style won't be applied at all.
If you want to perform small adjustments, use HtmlBasedComponent.setSclass(java.lang.String)
instead.
getZclass
in class HtmlBasedComponent
HtmlBasedComponent.getSclass()
Copyright © 2005-2021 Potix Corporation. All Rights Reserved.