AbstractComponent

A skeletal implementation of Component. Though it is OK to implement Component from scratch, this class simplifies some of the chores.

Class Name

org.zkoss.zk.ui.AbstractComponent

Properties

Property

Description

Data Type

Default Value

id

Sets the ID.

java.lang.String

UUID (universal unique ID)

mold

Sets the mold for this component.

java.lang.String

default

visible

Sets whether this component is visible.

boolean

true

Methods

Name

Description

Return Data Type

AddAnnotation

(java.lang.String annotName, java.util.Map annotAttrs)

Associates an annotation to this component.

void

addAnnotation(java.lang.String propName, java.lang.String annotName, java.util.Map annotAttrs)

Adds an annotation to the specified proeprty of this component.

void

addEventHandler(java.lang.String name, EventHandler evthd)

Adds an event handler.

void

addEventListener(java.lang.String evtnm, EventListener listener)

Adds an event listener to specified event for this component.

boolean

addSharedAnnotationMap(AnnotationMap annots)

Add a map of annotations which is shared by other components.

void

addSharedEventHandlerMap(EventHandlerMap evthds)

Adds a map of event handlers which is shared by other components.

void

appendChild(Component child)

Appends a child to the end of all children.

boolean

applyProperties()

Initializes the properties (aka. members) and custom-attributes based on what are defined in the component definition.

void

clone()

Clones the component.

java.lang.Object

containsVariable(java.lang.String name, boolean local)

Returns whether the specified variable is defined.

boolean

detach()

Detaches this component such that it won't belong to any page.

void

getAnnotatedProperties()

Returns a read-only list of the name (String) of properties that are associated at least one annotation (never null).

java.util.List

getAnnotatedPropertiesBy(java.lang.String annotName)

Returns a read-only list of the names (String) of the properties that are associated with the specified annotation (never null).

java.util.List

getAnnotation(java.lang.String annotName)

Returns the annotation associated with the component, or null if not available.

org.zkoss.zk.ui.metainfo.Annotation

getAnnotation(java.lang.String propName, java.lang.String annotName)

Returns the annotation associated with the definition of the specified property, or null if not available.

org.zkoss.zk.ui.metainfo.Annotation

getAnnotations()

Returns a read-only collection of all annotations associated with this component (never null).

java.util.Collection

getAnnotations(java.lang.String propName)

Returns a read-only collection of all annotations associated with the specified property (never null).

java.util.Collection

getAttribute(java.lang.String name)

Returns the custom attribute associated with this component, i.e., Component.COMPONENT_SCOPE.

java.lang.Object

getAttribute(java.lang.String name, int scope)

Returns the value of the specified custom attribute in the specified scope, or null if not defined.

java.lang.Object

getAttributes()

Returns all custom attributes associated with this component, i.e., Component.COMPONENT_SCOPE.

java.util.Map

getAttributes(int scope)

Returns all custom attributes of the specified scope.

java.util.Map

getChildren()

Returns a live list of children.

java.util.List

getDefinition()

Returns the component definition of this component (never null).

org.zkoss.zk.ui.metainfo. ComponentDefinition

getDesktop()

Returns the desktop of this component, or null if this component doesn't belong to any desktop.

org.zkoss.zk.ui .Desktop

getEventHandler(java.lang.String evtnm)

Returns the event handler of the specified name, or null if not found.

org.zkoss.zk.ui.metainfo.ZScript

getExtraCtrl()

Returns the extra controls that tell ZK how to handle this component specially.

java.lang.Object

getFellow(java.lang.String compId)

Returns a component of the specified ID in the same ID space.

org.zkoss.zk.ui .Component

getFellowIfAny(java.lang.String compId)

Returns a component of the specified ID in the same ID space, or null if not found.

org.zkoss.zk.ui .Component

getListenerIterator(java.lang.String evtnm)

Returns an iterator for iterating listener for the specified event.

java.util.Iterator

getNamespace()

Returns the namespace to store variables and functions belonging to the ID space of this component.

org.zkoss.zk.scripting.Namespace

getPage()

Returns the page that this component belongs to, or null if it doesn't belong to any page.

Page

getParent()

Returns the parent component, or null if this is the root component.

org.zkoss.zk.ui.Component

getPropagatee(java.lang.String evtnm)

Default: null (no propagation at all).

org.zkoss.zk.ui.Component

getRoot()

Returns the root of the specified component.

org.zkoss.zk.ui.Component

getSpaceOwner()

Returns the owner of the ID space that this component belongs to.

org.zkoss.zk.ui.IdSpace

getUuid()

Returns UUID (universal unique ID) which is unquie in the whole session.

java.lang.String

getVariable(java.lang.String name, boolean local)

Returns the value of a variable defined in the namespace, or null if not defined or the value is null.

java.lang.Object

insertBefore(Component newChild, Component refChild)

Inserts a child before the reference child.

boolean

invalidate()

Invalidates this component by setting the dirty flag such that it will be redraw the whole content later.

void

isChildable()

Default: return true (allows to have children).

boolean

isListenerAvailable(java.lang.String evtnm, boolean asap)

Returns whether the event listener is available.

boolean

onChildAdded(Component child)

Default: does nothing.

void

onChildRemoved(Component child)

Default: does nothing.

void

onDrawNewChild(Component child, java.lang.StringBuffer out)

Called when a new-created child is drawn.

void

onWrongValue(WrongValueException ex)

Notifies that an WrongValueException instance is thrown, and WrongValueException.getComponent() is this component.

org.zkoss.zk.ui.WrongValueException

redraw(java.io.Writer out)

Includes the page returned by getMoldURI() and set the self attribute to be this component.

void

removeAttribute(java.lang.String name)

Removes the custom attribute associated with this component, i.e., Component.COMPONENT_SCOPE.

java.lang.Object

removeAttribute(java.lang.String name, int scope)

Removes the specified custom attribute in the specified scope.

java.lang.Object

removeChild(Component child)

Removes a child.

boolean

removeEventListener(java.lang.String evtnm, EventListener listener)

Removes an event listener.

boolean

response(java.lang.String key, AuResponse response)

Causes a response (aka., a command) to be sent to the client.

void

sessionDidActivate(Page page)

Notification that the session, which owns this component, has just been activated (aka., deserialized).

void

sessionWillPassivate(Page page)

Notification that the session, which owns this component, is about to be passivated (aka., serialized).

void

setAttribute(java.lang.String name, java.lang.Object value)

Sets the custom attribute associated with this component, i.e., Component.COMPONENT_SCOPE.

java.lang.Object

setAttribute(java.lang.String name, java.lang.Object value, int scope)

Sets the value of the specified custom attribute in the specified scope.

java.lang.Object

setComponentDefinition(ComponentDefinition compdef)

Sets the component definition.

void

setPage(Page page)

Sets the page that this component belongs to.

void

setParent(Component parent)

Sets the parent component.

void

setVariable(java.lang.String name, java.lang.Object val, boolean local)

Sets a variable to the namespace.

void

smartUpdate(java.lang.String attr, boolean value)

A special smart-update that update a value in boolean.

void

smartUpdate(java.lang.String attr, int value)

A special smart-update that update a value in int.

void

smartUpdate(java.lang.String attr, java.lang.String value)

Smart-updates a property with the specified value.

void

toString()

java.lang.String

unsetVariable(java.lang.String name, boolean local)

Unsets a variable defined in the namespace.

void