Class Cardlayout
- java.lang.Object
-
- org.zkoss.zk.ui.AbstractComponent
-
- org.zkoss.zk.ui.HtmlBasedComponent
-
- org.zkoss.zul.impl.XulElement
-
- org.zkoss.zkmax.zul.Cardlayout
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,Component
,Scope
,ComponentCtrl
public class Cardlayout extends XulElement
A layout allow end user change view like change card. TheselectedIndex
decide which child component will be shown (aka in view port).Notice: When remove child,
selectedIndex
will decrease if last child is selected- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent
HtmlBasedComponent.ExtraCtrl
-
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
AbstractComponent.Children, AbstractComponent.ForwardInfo, AbstractComponent.TargetInfo
-
-
Field Summary
-
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
_zclass
-
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
-
Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
-
-
Constructor Summary
Constructors Constructor Description Cardlayout()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getOrient()
Returns the orient.int
getSelectedIndex()
Return the index of the component in view port.boolean
insertBefore(Component newChild, Component refChild)
Inserts a child before the reference child.boolean
isHorizontal()
Returns whether it is a horizontal .boolean
isVertical()
Returns whether it is a vertical .boolean
next()
Change to next component if possible.boolean
previous()
Change to previous component if possible.boolean
removeChild(Component child)
Removes a child.protected void
renderProperties(ContentRenderer renderer)
Renders the content of this component, excluding the enclosing tags and children.void
service(AuRequest request, boolean everError)
Swipe event on client will fire onChange to server to set selected index.void
setOrient(java.lang.String orient)
Sets the orient.void
setSelectedIndex(int value)
Note: Unlike other component, "deselect" is unnecessary in Cardlayout.-
Methods inherited from class org.zkoss.zul.impl.XulElement
clone, getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes
-
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, evalCSSFlex, focus, getAction, getClientAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, removeSclass, removeSclass, setAction, setClass, setClientAction, 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
-
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, destroyIndexCacheMap, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, disableHostChanged, enableBindingAnnotation, enableHostChanged, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, 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, getForwards, getId, getIndexCacheMap, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, invalidate, isChildable, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onParentChanged, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderPropertiesOnly, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
-
-
-
Method Detail
-
getOrient
public java.lang.String getOrient()
Returns the orient.Default: "horizontal".
-
setOrient
public void setOrient(java.lang.String orient) throws WrongValueException
Sets the orient.- Parameters:
orient
- either horizontal or vertical- Throws:
WrongValueException
- if orient is not horizontal or vertical.
-
isHorizontal
public boolean isHorizontal()
Returns whether it is a horizontal .
-
isVertical
public boolean isVertical()
Returns whether it is a vertical .
-
getSelectedIndex
public int getSelectedIndex()
Return the index of the component in view port.
-
setSelectedIndex
public void setSelectedIndex(int value)
Note: Unlike other component, "deselect" is unnecessary in Cardlayout. So the index value can't be negative, if do so, it will occur an UiException.
- Parameters:
value
-
-
insertBefore
public boolean insertBefore(Component newChild, Component refChild)
Description copied from interface:Component
Inserts a child before the reference child.You could use
Component.setParent(org.zkoss.zk.ui.Component)
orComponent.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 backComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
and/orComponent.removeChild(org.zkoss.zk.ui.Component)
, whileComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
andComponent.removeChild(org.zkoss.zk.ui.Component)
always calls backComponent.setParent(org.zkoss.zk.ui.Component)
, if the parent is changed. Thus, you don't need to override bothComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
andComponent.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
.- Specified by:
insertBefore
in interfaceComponent
- Overrides:
insertBefore
in classAbstractComponent
- Parameters:
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.- Returns:
- true if newChild is added successfully or moved; false if it already has the specified child and the order doesn't change.
-
removeChild
public boolean removeChild(Component child)
Description copied from interface:Component
Removes a child. The child is not actually removed. Rather, it is detached (seeComponent.detach()
) and it will be removed if it is no longer used.You could use
Component.setParent(org.zkoss.zk.ui.Component)
with null instead of this method.Note:
Component.setParent(org.zkoss.zk.ui.Component)
always calls backComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
and/orComponent.removeChild(org.zkoss.zk.ui.Component)
, whileComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
andComponent.removeChild(org.zkoss.zk.ui.Component)
always calls backComponent.setParent(org.zkoss.zk.ui.Component)
, if the parent is changed. Thus, you don't need to override bothComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
andComponent.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
.- Specified by:
removeChild
in interfaceComponent
- Overrides:
removeChild
in classAbstractComponent
- Returns:
- true if child is removed successfully; false if it doesn't have the specified child
-
renderProperties
protected void renderProperties(ContentRenderer renderer) throws java.io.IOException
Description copied from class:HtmlBasedComponent
Renders the content of this component, excluding the enclosing tags and children.- Overrides:
renderProperties
in classXulElement
- Throws:
java.io.IOException
-
previous
public boolean previous()
Change to previous component if possible.- Returns:
- can change to previous component or not.
-
next
public boolean next()
Change to next component if possible.- Returns:
- whether change to next component is possible or not.
-
service
public void service(AuRequest request, boolean everError)
Swipe event on client will fire onChange to server to set selected index.- Specified by:
service
in interfaceComponentCtrl
- Overrides:
service
in classHtmlBasedComponent
everError
- whether any error ever occurred before processing this request.- See Also:
HtmlBasedComponent.service(org.zkoss.zk.au.AuRequest, boolean)
-
-