org.zkoss.jsf.zul.impl
Class LeafComponent

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by org.zkoss.jsf.zul.impl.AbstractComponent
              extended by org.zkoss.jsf.zul.impl.LeafComponent
All Implemented Interfaces:
javax.faces.component.StateHolder
Direct Known Subclasses:
BranchComponent

public abstract class LeafComponent
extends AbstractComponent

The skeletal class used to implement the ZULJSF Component for ZK components that don't accept any child.

Author:
Dennis.Chen

Field Summary
protected  java.util.Map _compAttrMap
           
protected  ComposerHandler _composer
           
 
Fields inherited from class javax.faces.component.UIComponent
bindings
 
Constructor Summary
LeafComponent()
           
 
Method Summary
protected  void addZULDynamicAttribute(java.lang.String name, java.lang.Object value)
          set the attribute(name) of this component to value, the difference between this method and setAttributeValue(java.lang.String, java.lang.Object) is this method directly replace the attribute whether the attribute associate to a ValueBinding.
protected  void afterZULComponentComposed(org.zkoss.zk.ui.Component zulcomp)
          This method give the delivering class a chance to handle ZUL Component just after it is composed.
 void encodeBegin(javax.faces.context.FacesContext context)
          Override method, We Construct ZUL JSF Component tree here.
 void encodeChildren(javax.faces.context.FacesContext context)
           
 void encodeEnd(javax.faces.context.FacesContext context)
          Override Method, write a special mark denoting the component in this method
protected  void evaluateDynaAttributes(org.zkoss.zk.ui.Component target, java.util.Map zulAttrMap)
          Test if the attributes are annotation or component attributes.
 java.lang.Object getAttributeValue(java.lang.String att)
          Get value of attribute of Component. if value of attribute is a ValueBinding, then Binding result will return.
protected  java.lang.String getComponentDefName()
          get the component definition name of this component
The default implementation change the class name to lower char and return
protected  org.zkoss.jsf.zul.impl.ComponentInfo getComponentInfo()
          Get ComponentInfo for current Component Tree.
 java.lang.String getForward()
          Returns the forward condition that controls how to forward an event, that is received by the component created by this info, to another component.
 boolean getRendersChildren()
          Override Method, don't render children my self. return false;
 java.lang.String getUse()
          Returns the class name that is used to implement the ZUL Component associated with this ZULJSF Component.
protected  org.zkoss.zk.ui.Component getZULComponent()
          Returns the ZUL Component associated with this ZUL JSF Component the associated ZUL Component is only exist after loadZULTree(org.zkoss.zk.ui.Page, java.io.StringWriter)
protected  void loadZULTree(org.zkoss.zk.ui.Page page, java.io.StringWriter writer)
          Call by RootComponent or BranchComponent to load zk stuff.
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
          Override Method, restore the state of this component.
 java.lang.Object saveState(javax.faces.context.FacesContext context)
          Override Method, save the state of this component.
 void setAttributeValue(java.lang.String att, java.lang.Object value)
          set value to attribute of Component, if a ValueBinding is associated with attribute , then it will set value to Binding Object
Note: set attribute after loadZULTree(org.zkoss.zk.ui.Page, java.io.StringWriter) doesn't affect the ZUL Component which is associated to this component.
 void setForward(java.lang.String forward)
          Sets the forward condition that controls when to forward an event receiving by this component to another component.
 void setId(java.lang.String id)
          Override Method, remember the id is set.
 void setUse(java.lang.String use)
          Sets the class name that is used to implement the ZUL Component associated with this ZULJSF Component.
 void setZULDynamicAttribute(java.util.Map map)
          Set dynamic Attribute of this ZULJSF Component, This method is called by LeafTag only, developer should not call this method directly.
 
Methods inherited from class org.zkoss.jsf.zul.impl.AbstractComponent
findAncestorWithClass, getBodyContent, getFacesContext, getFamily, getIf, getUnless, isEffective, isSuppressed, restoreAttachedMapState, saveAttachedMapState, setBodyContent, setIf, setSuppressed, setUnless
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, broadcast, decode, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getValueBinding, invokeOnComponent, isRendered, isTransient, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setParent, setRendered, setRendererType, setTransient, setValueBinding
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getContainerClientId, getValueExpression, setValueExpression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_compAttrMap

protected java.util.Map _compAttrMap

_composer

protected ComposerHandler _composer
Constructor Detail

LeafComponent

public LeafComponent()
Method Detail

getComponentDefName

protected java.lang.String getComponentDefName()
get the component definition name of this component
The default implementation change the class name to lower char and return

Returns:
a ZUL component name

encodeBegin

public void encodeBegin(javax.faces.context.FacesContext context)
                 throws java.io.IOException
Override method, We Construct ZUL JSF Component tree here. This method is called by JSF implementation, deriving class rarely need to invoke this method.

Overrides:
encodeBegin in class javax.faces.component.UIComponentBase
Throws:
java.io.IOException

getComponentInfo

protected org.zkoss.jsf.zul.impl.ComponentInfo getComponentInfo()
Get ComponentInfo for current Component Tree.
it always return RootComponent's getComponentInfo(), if RootComponent doesn't exist return null;

Overrides:
getComponentInfo in class AbstractComponent
Returns:
a ComponentInfo of current Component Tree

getRendersChildren

public boolean getRendersChildren()
Override Method, don't render children my self. return false;

Overrides:
getRendersChildren in class javax.faces.component.UIComponentBase

encodeChildren

public void encodeChildren(javax.faces.context.FacesContext context)
                    throws java.io.IOException
Overrides:
encodeChildren in class javax.faces.component.UIComponentBase
Throws:
java.io.IOException

encodeEnd

public void encodeEnd(javax.faces.context.FacesContext context)
               throws java.io.IOException
Override Method, write a special mark denoting the component in this method

Overrides:
encodeEnd in class javax.faces.component.UIComponentBase
Throws:
java.io.IOException

loadZULTree

protected void loadZULTree(org.zkoss.zk.ui.Page page,
                           java.io.StringWriter writer)
                    throws java.io.IOException
Call by RootComponent or BranchComponent to load zk stuff.

Overrides:
loadZULTree in class AbstractComponent
Throws:
java.io.IOException

getZULComponent

protected org.zkoss.zk.ui.Component getZULComponent()
Returns the ZUL Component associated with this ZUL JSF Component the associated ZUL Component is only exist after loadZULTree(org.zkoss.zk.ui.Page, java.io.StringWriter)


evaluateDynaAttributes

protected void evaluateDynaAttributes(org.zkoss.zk.ui.Component target,
                                      java.util.Map zulAttrMap)
                               throws org.zkoss.util.ModificationException,
                                      java.lang.NoSuchMethodException
Test if the attributes are annotation or component attributes.
If is Component attributes then invokes setter methods to update all assigned attributes. If is annotations then add annotation to component

Parameters:
target - the target component
Throws:
java.lang.NoSuchMethodException
org.zkoss.util.ModificationException

afterZULComponentComposed

protected void afterZULComponentComposed(org.zkoss.zk.ui.Component zulcomp)
This method give the delivering class a chance to handle ZUL Component just after it is composed.
This method will be invoked after ZUL component is composed and listener, attribute of ZUL component is setted. Note: Default implementation do nothing.


getAttributeValue

public java.lang.Object getAttributeValue(java.lang.String att)
Get value of attribute of Component. if value of attribute is a ValueBinding, then Binding result will return.

Parameters:
att - attribute name
Returns:
value of attribute

setAttributeValue

public void setAttributeValue(java.lang.String att,
                              java.lang.Object value)
set value to attribute of Component, if a ValueBinding is associated with attribute , then it will set value to Binding Object
Note: set attribute after loadZULTree(org.zkoss.zk.ui.Page, java.io.StringWriter) doesn't affect the ZUL Component which is associated to this component.

Parameters:
att - attribute name
value - attribute value;

getUse

public java.lang.String getUse()
Returns the class name that is used to implement the ZUL Component associated with this ZULJSF Component.

Default: null

Returns:
the class name used to implement the ZUL Component, or null to use the default

setUse

public void setUse(java.lang.String use)
Sets the class name that is used to implement the ZUL Component associated with this ZULJSF Component.

Parameters:
use - the class name used to implement the ZUL Component, or null to use the default

setZULDynamicAttribute

public void setZULDynamicAttribute(java.util.Map map)
Set dynamic Attribute of this ZULJSF Component, This method is called by LeafTag only, developer should not call this method directly.

Parameters:
map - the dynamic attributes.

addZULDynamicAttribute

protected void addZULDynamicAttribute(java.lang.String name,
                                      java.lang.Object value)
set the attribute(name) of this component to value, the difference between this method and setAttributeValue(java.lang.String, java.lang.Object) is this method directly replace the attribute whether the attribute associate to a ValueBinding. Note: set attribute after loadZULTree(org.zkoss.zk.ui.Page, StringWriter) doesn't affect the ZUL Component which is associated to this component.

Parameters:
name - attribute name of component
value - value of attribute

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Override Method, save the state of this component.

Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class AbstractComponent

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Override Method, restore the state of this component.

Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class AbstractComponent

setId

public void setId(java.lang.String id)
Override Method, remember the id is set.

Overrides:
setId in class javax.faces.component.UIComponentBase

getForward

public java.lang.String getForward()
Returns the forward condition that controls how to forward an event, that is received by the component created by this info, to another component.

Default: null.

If not null, when the component created by this info receives the event specified in the forward condition, it will forward it to the target component, which is also specified in the forward condition.

See Also:
setForward(java.lang.String)

setForward

public void setForward(java.lang.String forward)
Sets the forward condition that controls when to forward an event receiving by this component to another component.

The basic format:
onEvent1=id1/id2.onEvent2

It means when onEvent1 is received, onEvent2 will be posted to the component with the specified path (id1/id2).

If onEvent1 is omitted, it is assumed to be onClick (and the equal sign need not to be specified. If the path is omitted, it is assumed to be the space owner Component.getSpaceOwner().

For example, "onOK" means "onClick=onOK".

You can specify several forward conditions by separating them with comma as follows:

onChanging=onChanging,onChange=onUpdate,onOK

Parameters:
forward - the forward condition. There are several forms: "onEvent1", "target.onEvent1" and "onEvent1(target.onEvent2)", where target could be "id", "id1/id2" or "${elExpr}". The EL expression must return either a path or a reference to a component.


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.