org.zkoss.zkmax.zul
Class Cardlayout

java.lang.Object
  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zk.ui.HtmlBasedComponent
          extended by org.zkoss.zul.impl.XulElement
              extended by 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. The selectedIndex 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
 
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
CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
 
Constructor Summary
Cardlayout()
           
 
Method Summary
 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, getTooltip, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
 
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
focus, getAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeightDirectly, setHflex, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTooltiptext, setTop, setTopDirectly, setVflex, setWidth, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getChildren, getClientAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowRoots, 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, isChildable, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, 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
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Cardlayout

public Cardlayout()
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) 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.

Specified by:
insertBefore in interface Component
Overrides:
insertBefore in class AbstractComponent
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 (see Component.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 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.

Specified by:
removeChild in interface Component
Overrides:
removeChild in class AbstractComponent
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.

See also ZK Client-side Reference: Property Rendering

Overrides:
renderProperties in class XulElement
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 interface ComponentCtrl
Overrides:
service in class HtmlBasedComponent
everError - whether any error ever occurred before processing this request.
See Also:
HtmlBasedComponent.service(org.zkoss.zk.au.AuRequest, boolean)


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo