org.zkoss.zul
Class Applet

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.zul.Applet
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, HtmlBasedComponent, Component, DynamicPropertied, Scope, ComponentCtrl, Applet, XulElement

public class Applet
extends XulElement
implements DynamicPropertied, Applet

A generic applet component.

Non XUL extension.

Since:
3.6.0
Author:
Davidchen, Tomyeh
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, RS_NO_DISPLAY, RS_NO_HEIGHT, RS_NO_WIDTH
 
Fields inherited from class org.zkoss.zk.ui.AbstractComponent
_visible
 
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
 
Constructor Summary
Applet()
           
 
Method Summary
 java.lang.String getCode()
          Return the code of the applet, i.e., the URI of the Java class.
 java.lang.String getCodebase()
          Return the codebase of the applet, i.e., the URI of the Java class.
 java.lang.Object getDynamicProperty(java.lang.String name)
          Returns the property value of the specified name.
 java.lang.String getOuterAttrs()
          Returns the exterior attributes for generating the enclosing HTML tag; never return null.
 java.util.Map getParams()
          Returns a map of parameters (never null).
 java.lang.String getParamsHtml()
          Used only internally for component development.
 boolean hasDynamicProperty(java.lang.String name)
          Returns whether a dynamic property is defined.
 void invoke(java.lang.String function)
          Invokes the function of the applet running at the client.
 void invoke(java.lang.String function, java.lang.String argument)
          Invokes the function of the applet running at the client with one argument.
 void invoke(java.lang.String function, java.lang.String[] arguments)
          Invokes the function of the applet running at the client with variable number argument.
 boolean isChildable()
          No child is allowed.
 void setCode(java.lang.String code)
          Sets the code of the applet, i.e., the URI of the Java class.
 void setCodebase(java.lang.String codebase)
          Sets the codebase of the applet, i.e., the URI of the Java class.
 void setDynamicProperty(java.lang.String name, java.lang.Object value)
          Sets a property with the specified name and value.
 void setField(java.lang.String field, java.lang.String value)
          Sets the value of the specified filed.
 java.lang.String setParam(java.lang.String name, java.lang.String value)
          Sets a parameter.
 void setParams(java.util.Map params)
          Sets a map of parameters (all existent parameters are removed first).
 
Methods inherited from class org.zkoss.zul.impl.XulElement
getAction, getActionAttrs, getAllOnClickAttrs, getContext, getCtrlKeys, getInnerAttrs, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
 
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
focus, getAllOnClickAttrs, getDraggable, getDroppable, getHeight, getLeft, getMoldSclass, getRealSclass, getRealStyle, getRealStyleFlags, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZclass, getZindex, getZIndex, newExtraCtrl, redraw, setClass, setDraggable, setDroppable, setFocus, setHeight, setLeft, setMoldSclass, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addEventHandler, addEventListener, addForward, addForward, addForward, addForward, addMoved, addSharedAnnotationMap, addSharedEventHandlerMap, appendAsapAttr, appendAsapAttr, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, clone, containsVariable, detach, disableClientUpdate, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttributes, getAttributes, getChildren, getCommand, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getExtraCtrl, getFellow, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getMoldURI, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getUuid, getVariable, hasFellow, insertBefore, invalidate, isAsapRequired, isInvalidated, isListenerAvailable, isVisible, newChildren, onChildAdded, onChildRemoved, onDrawNewChild, onPageAttached, onPageDetached, onWrongValue, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, response, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setComponentDefinition, setId, setMold, setPage, setPageBefore, setParent, setVariable, setVisible, smartUpdate, smartUpdate, smartUpdate, smartUpdateDeferred, smartUpdateValues, toString, unsetVariable
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
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.Component
addEventListener, addForward, addForward, addForward, addForward, appendChild, applyProperties, clone, containsVariable, detach, getAttribute, getAttribute, getAttributes, getAttributes, getChildren, getDefinition, getDesktop, getFellow, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getUuid, getVariable, insertBefore, invalidate, isInvalidated, isListenerAvailable, isVisible, redraw, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, setAttribute, setAttribute, setId, setMold, setPage, setPageBefore, setParent, setVariable, setVisible, unsetVariable
 

Constructor Detail

Applet

public Applet()
Method Detail

getCode

public java.lang.String getCode()
Return the code of the applet, i.e., the URI of the Java class.

Specified by:
getCode in interface Applet

setCode

public void setCode(java.lang.String code)
Sets the code of the applet, i.e., the URI of the Java class.

Specified by:
setCode in interface Applet

getCodebase

public java.lang.String getCodebase()
Return the codebase of the applet, i.e., the URI of the Java class.

Since:
3.6.2

setCodebase

public void setCodebase(java.lang.String codebase)
Sets the codebase of the applet, i.e., the URI of the Java class.

Since:
3.6.2

setParams

public void setParams(java.util.Map params)
Sets a map of parameters (all existent parameters are removed first).

Specified by:
setParams in interface Applet

getParams

public java.util.Map getParams()
Returns a map of parameters (never null).

Specified by:
getParams in interface Applet

setParam

public java.lang.String setParam(java.lang.String name,
                                 java.lang.String value)
Sets a parameter. If the value is null, the parameter is removed.

Specified by:
setParam in interface Applet

getParamsHtml

public java.lang.String getParamsHtml()
Used only internally for component development.


getDynamicProperty

public java.lang.Object getDynamicProperty(java.lang.String name)
Description copied from interface: DynamicPropertied
Returns the property value of the specified name.

Specified by:
getDynamicProperty in interface DynamicPropertied

hasDynamicProperty

public boolean hasDynamicProperty(java.lang.String name)
Description copied from interface: DynamicPropertied
Returns whether a dynamic property is defined.

Specified by:
hasDynamicProperty in interface DynamicPropertied

setDynamicProperty

public void setDynamicProperty(java.lang.String name,
                               java.lang.Object value)
                        throws WrongValueException
Description copied from interface: DynamicPropertied
Sets a property with the specified name and value.

If a component supports only String-type values, it could use org.zkoss.lang.Objects.toString() to convert the value to a String instance.

Specified by:
setDynamicProperty in interface DynamicPropertied
Throws:
WrongValueException

invoke

public void invoke(java.lang.String function)
Invokes the function of the applet running at the client.

Specified by:
invoke in interface Applet

invoke

public void invoke(java.lang.String function,
                   java.lang.String argument)
Invokes the function of the applet running at the client with one argument.

Specified by:
invoke in interface Applet

invoke

public void invoke(java.lang.String function,
                   java.lang.String[] arguments)
Invokes the function of the applet running at the client with variable number argument.

Specified by:
invoke in interface Applet

setField

public void setField(java.lang.String field,
                     java.lang.String value)
Sets the value of the specified filed.

Specified by:
setField in interface Applet

getOuterAttrs

public java.lang.String getOuterAttrs()
Description copied from class: HtmlBasedComponent
Returns the exterior attributes for generating the enclosing HTML tag; never return null.

Used only by component developers.

Default: Generates the tooltip text, style, sclass, draggable and droppable attribute if necessary. In other words, the corresponding attribute is generated if HtmlBasedComponent.getTooltiptext(), HtmlBasedComponent.getRealStyle(), HtmlBasedComponent.getSclass(), HtmlBasedComponent.getDraggable(), HtmlBasedComponent.getDroppable() are defined.

You have to call both HtmlBasedComponent.getOuterAttrs() and HtmlBasedComponent.getInnerAttrs() to generate complete attributes.

For simple components that all attributes are put on the outest HTML element, all you need is as follows.

<xx id="${self.uuid}"${self.outerAttrs}${self.innerAttrs}>

If you want to put attributes in a nested HTML element, you shall use the following pattern. Notice: if HtmlBasedComponent.getInnerAttrs() in a different tag, the tag must be named with "${self.uuid}!real".

<xx id="${self.uuid}"${self.outerAttrs}>
 <yy id="${self.uuid}!real"${self.innerAttrs}>...

Note: This class handles non-deferrable event listeners automatically. However, you have to invoke AbstractComponent.appendAsapAttr(java.lang.StringBuffer, java.lang.String) for each event the component handles in HtmlBasedComponent.getOuterAttrs() as follows.


        appendAsapAttr(sb, Events.ON_OPEN);
  appendAsapAttr(sb, Events.ON_CHANGE);

Theorectically, you could put any attributes in either HtmlBasedComponent.getInnerAttrs() or HtmlBasedComponent.getOuterAttrs(). However, zkau.js assumes all attributes are put at the outer one. If you want something different, you have to provide your own setAttr (refer to how checkbox is implemented).

Overrides:
getOuterAttrs in class XulElement

isChildable

public boolean isChildable()
No child is allowed.

Specified by:
isChildable in interface Component
Overrides:
isChildable in class AbstractComponent


Copyright &copy; 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo