CS 1705 Library

cs1705.web
Class Variable

java.lang.Object
  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zhtml.Text
          extended by cs1705.web.internal.JavaStatementElement
              extended by cs1705.web.Variable
All Implemented Interfaces:
Serializable, Cloneable, Component, RawId, ComponentCtrl

public class Variable
extends cs1705.web.internal.JavaStatementElement

A ZUL variable declaration.

A <variable> tag has two required properties and one optional property:

Parameters
type - The (optional) Java type of the variable--this should be a legal Java class name that is in scope (see Import) (must come before the value!).
name - The variable name (must come before the value!)
value - The variable's value. It can be any Java expression, or any EL expression (i.e., ${...}), but may not be a bound data value (no @{...}).

Examples:

 <variable name="x" value="new Person()"/>

 <!-- With an included type -->
 <variable type="Person" name="x" value="new Person()"/>

 <!-- If you use quotes, they must be HTML-escaped -->
 <variable name="file"
   value="cs1705.IOHelper.getFile(&quot;infile.txt&quot;)"/>

 <!-- A longer version, so you don't have to escape the quotes. -->
 <variable name="file2">
   <attribute name="value">
     cs1705.IOHelper.getFile("infile.txt")
   </attribute>
 </variable>
 

Version:
2007.08.13
Author:
Stephen Edwards
See Also:
Serialized Form

Field Summary
 
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
Variable()
          Creates a new Variable component.
 
Method Summary
 String getName()
          Accessor for the "name" property.
 String getType()
          Accessor for the "type" property, which may be null if no type has been specified.
 void setName(String newName)
          Mutator for the "name" property.
 void setType(String newType)
          Mutator for the "type" property, which is optional.
 void setValue(String newValue)
          Mutator for the "value" property, which provides the variable's initial value.
 
Methods inherited from class cs1705.web.internal.JavaStatementElement
redraw
 
Methods inherited from class org.zkoss.zhtml.Text
getValue, invalidate, isChildable, setParent
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addEventHandler, addEventListener, addForward, addForward, addForward, addForward, addSharedAnnotationMap, addSharedEventHandlerMap, appendChild, applyProperties, clone, containsVariable, detach, 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, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getUuid, getVariable, hasFellow, insertBefore, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onDrawNewChild, onPageAttached, onPageDetached, onWrongValue, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, response, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setComponentDefinition, setId, setMold, setPage, setPageBefore, setVariable, setVisible, smartUpdate, smartUpdate, smartUpdate, smartUpdateDeferred, smartUpdateValues, toString, unsetVariable
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Variable

public Variable()
Creates a new Variable component.

Method Detail

getName

public String getName()
Accessor for the "name" property.

Returns:
The variable's name

setName

public void setName(String newName)
Mutator for the "name" property. Note that the variable name must be set before the value (which means the name attribute must appear to the left of the value attribute in your ZHTML code).

Parameters:
newName - The name to use for the variable

getType

public String getType()
Accessor for the "type" property, which may be null if no type has been specified.

Returns:
The variable's type (a Java Class name)

setType

public void setType(String newType)
Mutator for the "type" property, which is optional. Note that the variable type, if used, must be set before the value (which means the type attribute must appear to the left of the value attribute in your ZHTML code).

Parameters:
newType - The type (class) to use for the variable. The class name specified must either be fully qualified, or must have been imported (see Import).

setValue

public void setValue(String newValue)
Mutator for the "value" property, which provides the variable's initial value. It must come after the name and (optional) type.

Overrides:
setValue in class org.zkoss.zhtml.Text
Parameters:
newValue - The value to use for the variable. It must either be an object of the appropriate type, or a string that can be interpreted as a Java expression of the appropriate type.

Last updated: Wed, Apr 1, 2009 • 12:29 AM EDT

Copyright © 2009 Virginia Tech.