com.waveset.object
Class Form.Field

java.lang.Object
  extended bycom.waveset.util.AbstractXmlObject
      extended bycom.waveset.object.FormItem
          extended bycom.waveset.object.Form.Field
All Implemented Interfaces:
java.lang.Cloneable, com.sun.idm.debugger.common.Locatable, javax.naming.Referenceable, XmlObject
Enclosing class:
Form

public static class Form.Field
extends FormItem
implements java.lang.Cloneable

Inner class used to represent a single form field. We make this an AbstractXmlObject only so we can take advantage of the create method to make cloning easier.


Field Summary
static java.lang.String ATT_AVAILABLETITLE
           
static java.lang.String ATT_BUTTON
           
static java.lang.String ATT_COLUMNS
           
static java.lang.String ATT_CONFIRM
           
static java.lang.String ATT_DEFAULT
           
static java.lang.String ATT_DISPLAYTYPE
           
static java.lang.String ATT_HELP
           
static java.lang.String ATT_HIDDEN
           
static java.lang.String ATT_LABELS
           
static java.lang.String ATT_LIBRARY
           
static java.lang.String ATT_MAXLEN
           
static java.lang.String ATT_NAME
           
static java.lang.String ATT_NOWRAP
           
static java.lang.String ATT_PROMPT
           
static java.lang.String ATT_REQUIRED
           
static java.lang.String ATT_RESACCTATTR
           
static java.lang.String ATT_ROWS
           
static java.lang.String ATT_SELECTEDTITLE
           
static java.lang.String ATT_SIZE
           
static java.lang.String ATT_TYPE
           
static java.lang.String EL_CONSTRAINTS
           
static java.lang.String EL_DEFAULT
           
static java.lang.String EL_DERIVE
           
static java.lang.String EL_DISABLE
           
static java.lang.String EL_DISPLAY
           
static java.lang.String EL_EXPANSION
           
static java.lang.String EL_HELP
          Deprecated. Not sure if this was ever used.
static java.lang.String EL_HIDDEN
           
static java.lang.String EL_PROPERTIES
           
static java.lang.String EL_VALIDATION
           
static java.lang.String ELEMENT
           
 
Fields inherited from class com.waveset.util.AbstractXmlObject
_trace, code_id
 
Constructor Summary
Form.Field()
          Build an empty field object.
Form.Field(org.w3c.dom.Element e)
          Build a field object from its DOM representation.
Form.Field(org.w3c.dom.Element e, FormItem parent)
          Build a field object from its DOM representation.
 
Method Summary
 Form.Field cloneObject(FormItem parent)
          Method to clone another field when assembling fields.
 void deriveDisplayFromSyntax()
          Derive display properties for the current syntax.
 boolean equals(java.lang.Object obj)
          Equality is true if the only names are the same.
 java.lang.String getConfirmation()
          Get the confirmation field name.
 java.util.List getConstraints(FormState state)
          Get the value constraints as a list of objects, normally strings.
 java.lang.Object getDefault(FormState state)
          Get the default value.
 ExNode getDefaultExpression()
           
 ExNode getDerivationExpression()
           
 ExNode getDisableExpression()
           
 FieldDisplay getDisplay()
          Get an object describing display properties.
 java.lang.String getElementName()
          Return the element name.
 ExNode getExpansionExpression()
           
 Form.Value[] getFixedValues()
          Return the list of fixed expansion values.
 java.lang.String getFullname()
          Return the full name of this field, expanding namespace references if necessary.
 java.lang.String getHelp()
          Get the field help.
 ExNode getHiddenExpression()
          Get the hidden expression.
 java.lang.String getPrompt()
          Get the field prompt.
 java.util.List getProperties()
           
 Property getPropertyObject(java.lang.String name)
          Get a field property.
 Syntax getSyntax()
          Get the field syntax.
 java.lang.String getType()
          Deprecated. - use getSyntax() instead.
 ExNode getValidationExpression()
           
protected  Form.Value getValue(FormState state, java.lang.Object input, Form.Value[] values)
          Lookup a Value constraint given an input value.
protected  Form.Value[] getValues(FormState state, java.util.List src, Form.Value[] values)
          Lookup a collection of Value constraints given a list of input values.
 boolean isButton()
           
 boolean isDisabled(FormState state)
          Test the disable expression.
 boolean isHidden()
          Test the hidden flag.
 boolean isLibrary()
           
 boolean isRequired()
          Get the required flag.
 boolean isRequired(ExState state)
          Test the required flag, allowing expressions.
 boolean isResourceAccountAttribute()
          Test the resourceAccountAttribute flag.
 void link(ExEnvironment env)
          Link expressions within us into the environment.
 void setButton(boolean b)
           
 void setConfirmation(java.lang.String s)
          Set the confirmation field name.
 void setDefault(java.lang.Object o)
          Set the static field default.
 void setDefaultExpression(ExNode n)
           
 void setDerivationExpression(ExNode n)
           
 void setDisableExpression(ExNode n)
           
 void setDisplay(FieldDisplay d)
           
 void setDisplayClass(java.lang.String name)
          Set the display class.
 void setDisplayProperty(java.lang.String name, java.lang.Object value)
          Set one display property.
 void setExpansionExpression(ExNode n)
           
 void setFixedValues(Form.Value[] values)
          Set the fixed list of static value constraints.
 void setHelp(java.lang.String s)
          Set the field help.
 void setLibrary(boolean b)
           
 void setMaxlen(int len)
          Set text field maxlen.
 void setPrompt(java.lang.String s)
          Set the field prompt.
 void setProperties(java.util.List props)
           
 void setRequired(boolean b)
          Set required flag.
 void setResourceAccountAttribute(boolean b)
           
 void setSize(int size)
          Set text field size.
 void setSyntax(Syntax syntax)
          Set the field syntax.
 void setType(java.lang.String type)
          Deprecated. - use getSyntax() instead.
 void setValidationExpression(ExNode exp)
           
 void toXml(java.lang.StringBuffer b, int indent)
          Serialize a form field to an XML buffer.
 
Methods inherited from class com.waveset.object.FormItem
addCommonAttributes, addItem, addItem, addItems, clearItems, getComments, getForm, getItemList, getItems, getLocation, getName, getParent, parseChild, parseCommonAttributes, setComments, setItems, setLocation, setName, setParent, toXmlChildren
 
Methods inherited from class com.waveset.util.AbstractXmlObject
addXmlHeader, cloneObject, dump, dumpFile, getReference, println, setTrace, toIdentityString, toVerboseString, toVerboseString, toXml, toXml, toXml
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ELEMENT

public static final java.lang.String ELEMENT
See Also:
Constant Field Values

ATT_NAME

public static final java.lang.String ATT_NAME
See Also:
Constant Field Values

ATT_TYPE

public static final java.lang.String ATT_TYPE
See Also:
Constant Field Values

ATT_REQUIRED

public static final java.lang.String ATT_REQUIRED
See Also:
Constant Field Values

ATT_RESACCTATTR

public static final java.lang.String ATT_RESACCTATTR
See Also:
Constant Field Values

ATT_CONFIRM

public static final java.lang.String ATT_CONFIRM
See Also:
Constant Field Values

ATT_BUTTON

public static final java.lang.String ATT_BUTTON
See Also:
Constant Field Values

ATT_LIBRARY

public static final java.lang.String ATT_LIBRARY
See Also:
Constant Field Values

EL_DISPLAY

public static final java.lang.String EL_DISPLAY
See Also:
Constant Field Values

EL_PROPERTIES

public static final java.lang.String EL_PROPERTIES
See Also:
Constant Field Values

EL_DISABLE

public static final java.lang.String EL_DISABLE
See Also:
Constant Field Values

EL_HIDDEN

public static final java.lang.String EL_HIDDEN
See Also:
Constant Field Values

EL_DEFAULT

public static final java.lang.String EL_DEFAULT
See Also:
Constant Field Values

EL_DERIVE

public static final java.lang.String EL_DERIVE
See Also:
Constant Field Values

EL_EXPANSION

public static final java.lang.String EL_EXPANSION
See Also:
Constant Field Values

EL_VALIDATION

public static final java.lang.String EL_VALIDATION
See Also:
Constant Field Values

EL_CONSTRAINTS

public static final java.lang.String EL_CONSTRAINTS
See Also:
Constant Field Values

ATT_DISPLAYTYPE

public static final java.lang.String ATT_DISPLAYTYPE
See Also:
Constant Field Values

ATT_PROMPT

public static final java.lang.String ATT_PROMPT
See Also:
Constant Field Values

ATT_DEFAULT

public static final java.lang.String ATT_DEFAULT
See Also:
Constant Field Values

ATT_NOWRAP

public static final java.lang.String ATT_NOWRAP
See Also:
Constant Field Values

ATT_AVAILABLETITLE

public static final java.lang.String ATT_AVAILABLETITLE
See Also:
Constant Field Values

ATT_SELECTEDTITLE

public static final java.lang.String ATT_SELECTEDTITLE
See Also:
Constant Field Values

ATT_SIZE

public static final java.lang.String ATT_SIZE
See Also:
Constant Field Values

ATT_MAXLEN

public static final java.lang.String ATT_MAXLEN
See Also:
Constant Field Values

ATT_ROWS

public static final java.lang.String ATT_ROWS
See Also:
Constant Field Values

ATT_COLUMNS

public static final java.lang.String ATT_COLUMNS
See Also:
Constant Field Values

ATT_LABELS

public static final java.lang.String ATT_LABELS
See Also:
Constant Field Values

ATT_HIDDEN

public static final java.lang.String ATT_HIDDEN
See Also:
Constant Field Values

ATT_HELP

public static final java.lang.String ATT_HELP
See Also:
Constant Field Values

EL_HELP

public static final java.lang.String EL_HELP
Deprecated. Not sure if this was ever used.

See Also:
Constant Field Values
Constructor Detail

Form.Field

public Form.Field()
Build an empty field object.


Form.Field

public Form.Field(org.w3c.dom.Element e)
           throws WavesetException
Build a field object from its DOM representation.


Form.Field

public Form.Field(org.w3c.dom.Element e,
                  FormItem parent)
           throws WavesetException
Build a field object from its DOM representation.

Method Detail

cloneObject

public Form.Field cloneObject(FormItem parent)
                       throws WavesetException
Method to clone another field when assembling fields. We don't use clone so we can throw exceptions. // * I suppose we could throw an unchecked exception. UPDATE: Now that this is an XmlObject, this is done for us, except that here were supporting the parent argument to the constructor. // * This needs to go away.

Throws:
WavesetException

link

public void link(ExEnvironment env)
Link expressions within us into the environment.

Overrides:
link in class FormItem

setConfirmation

public void setConfirmation(java.lang.String s)
Set the confirmation field name.


setSyntax

public void setSyntax(Syntax syntax)
Set the field syntax.


deriveDisplayFromSyntax

public void deriveDisplayFromSyntax()
Derive display properties for the current syntax. A convenience for forms generated from other type systems, like Resources. Formerly, this was done automatically when setSyntax was called. Now visibility must be explicitly indicated, either by setting display properties, or calling this method.


setDisableExpression

public void setDisableExpression(ExNode n)

setDefaultExpression

public void setDefaultExpression(ExNode n)

setDerivationExpression

public void setDerivationExpression(ExNode n)

setExpansionExpression

public void setExpansionExpression(ExNode n)

setValidationExpression

public void setValidationExpression(ExNode exp)

setFixedValues

public void setFixedValues(Form.Value[] values)
Set the fixed list of static value constraints.


setResourceAccountAttribute

public void setResourceAccountAttribute(boolean b)

setProperties

public void setProperties(java.util.List props)

setLibrary

public void setLibrary(boolean b)

getElementName

public java.lang.String getElementName()
Description copied from class: AbstractXmlObject
Return the element name.

Specified by:
getElementName in interface XmlObject
Specified by:
getElementName in class AbstractXmlObject

getFullname

public java.lang.String getFullname()
Return the full name of this field, expanding namespace references if necessary.


getSyntax

public Syntax getSyntax()
Get the field syntax.


getPropertyObject

public Property getPropertyObject(java.lang.String name)
Get a field property.


getProperties

public java.util.List getProperties()

getType

public java.lang.String getType()
Deprecated. - use getSyntax() instead.

Get the field type.


setType

public void setType(java.lang.String type)
Deprecated. - use getSyntax() instead.

Set the field type.


getConfirmation

public java.lang.String getConfirmation()
Get the confirmation field name.


isResourceAccountAttribute

public boolean isResourceAccountAttribute()
Test the resourceAccountAttribute flag.


equals

public boolean equals(java.lang.Object obj)
Equality is true if the only names are the same.


isLibrary

public boolean isLibrary()

getDefaultExpression

public ExNode getDefaultExpression()

getDerivationExpression

public ExNode getDerivationExpression()

getExpansionExpression

public ExNode getExpansionExpression()

getValidationExpression

public ExNode getValidationExpression()

getDisableExpression

public ExNode getDisableExpression()

isDisabled

public boolean isDisabled(FormState state)
                   throws WavesetException
Test the disable expression.

Throws:
WavesetException

getDefault

public java.lang.Object getDefault(FormState state)
                            throws WavesetException
Get the default value.

Throws:
WavesetException

getConstraints

public java.util.List getConstraints(FormState state)
                              throws WavesetException
Get the value constraints as a list of objects, normally strings.

Throws:
WavesetException

getFixedValues

public Form.Value[] getFixedValues()
Return the list of fixed expansion values.


getValue

protected Form.Value getValue(FormState state,
                              java.lang.Object input,
                              Form.Value[] values)
                       throws WavesetException
Lookup a Value constraint given an input value. This does a linear search on the constraint list, so if these can be long, might need to sort them first.

Throws:
WavesetException

getValues

protected Form.Value[] getValues(FormState state,
                                 java.util.List src,
                                 Form.Value[] values)
                          throws WavesetException
Lookup a collection of Value constraints given a list of input values.

Throws:
WavesetException

getDisplay

public FieldDisplay getDisplay()
Get an object describing display properties.


setDisplay

public void setDisplay(FieldDisplay d)

setDisplayClass

public void setDisplayClass(java.lang.String name)
Set the display class. Convenient when building forms in code.


setDisplayProperty

public void setDisplayProperty(java.lang.String name,
                               java.lang.Object value)
Set one display property. Convenient when buiding forms in code.


isButton

public boolean isButton()

setButton

public void setButton(boolean b)

isRequired

public boolean isRequired()
Get the required flag. Originally this was a Field attribute, now it is a display property.


isRequired

public boolean isRequired(ExState state)
                   throws WavesetException
Test the required flag, allowing expressions.

Throws:
WavesetException

getHiddenExpression

public ExNode getHiddenExpression()
Get the hidden expression. Deprecated: this has been renamed to the disable expression to better describe what it does.


setDefault

public void setDefault(java.lang.Object o)
Set the static field default. Formerly maintained a field for this, but now it's just shorthand for a simple default expression.


isHidden

public boolean isHidden()
Test the hidden flag. Formerly had a _hidden field here, now we just check for the absense of a FieldDisplay object.


setHelp

public void setHelp(java.lang.String s)
Set the field help.


getHelp

public java.lang.String getHelp()
Get the field help.


setPrompt

public void setPrompt(java.lang.String s)
Set the field prompt. Maintaining this for backward compatibility as it is commonly used when building forms in code.


getPrompt

public java.lang.String getPrompt()
Get the field prompt. Formerly had a _prompt field, now we derive it from a display property.


setSize

public void setSize(int size)
Set text field size.


setMaxlen

public void setMaxlen(int len)
Set text field maxlen.


setRequired

public void setRequired(boolean b)
Set required flag. // This is implemented as a display property though originally // it was a Field attribute. This is ok as long as we don't // have a case where something needs to be required, but be hidden.


toXml

public void toXml(java.lang.StringBuffer b,
                  int indent)
Serialize a form field to an XML buffer.

Specified by:
toXml in interface XmlObject
Specified by:
toXml in class AbstractXmlObject