com.waveset.object
Class Form

java.lang.Object
  extended bycom.waveset.util.AbstractXmlObject
      extended bycom.waveset.object.FormItem
          extended bycom.waveset.object.Form
All Implemented Interfaces:
Extension, Library.Member, com.sun.idm.debugger.common.Locatable, javax.naming.Referenceable, XmlObject

public class Form
extends FormItem
implements Extension, Library.Member

A class used to describe data that may be gathered interactively and passed to another object.

This is currently used in the TaskDefinition object to describe data that must be specified by the user before a task is launched. It is general enough to have other uses.

It isn't a PersistentObject at the moment, since its always stored inside something else, though I suppose it could evolve into one if it made sense to reuse these.


Nested Class Summary
static class Form.Expansion
          A class used to represent a expansion for a field value constraint.
static class Form.ExpansionGroup
          A class used to represent a a collection of expansions for a field value.
static class Form.Expression
          Inner class used to represent a top-level XPRESS node, normally a or This wrapper is so we can assume that all items on the _items list is a FormItem.
static class Form.Field
          Inner class used to represent a single form field.
static class Form.FieldMap
          Class representing a FieldMap.
static class Form.FieldRef
          Inner class used to represent a reference to a Field, possibly defined in an included form.
static class Form.FormRef
          Inner class used to represent a reference to a Form.
static class Form.InvalidFieldValue
           
static class Form.Loop
          Inner class used to represent the dynamic duplication of a set of Fields based on inputs.
static class Form.Page
          Inner class used to represent a form page.
static class Form.Reference
          Inner class used to represent a form or field reference.
static class Form.Value
          A class used to represent a value constraint for a form field.
 
Field Summary
static java.lang.String ATT_BASE
           
static java.lang.String ATT_DEFBUTTONS
           
static java.lang.String ATT_HELP
           
static java.lang.String ATT_NAME
           
static java.lang.String ATT_SUBTITLE
           
static java.lang.String ATT_TITLE
           
static java.lang.String ATT_TRACE
           
static java.lang.String ATT_VALUE
           
static java.lang.String code_id
           
static java.lang.String EL_COMMENTS
           
static java.lang.String EL_DESCRIPTION
           
static java.lang.String EL_INCLUDE
           
static java.lang.String EL_NAMESPACE
           
static java.lang.String EL_PROPERTIES
           
static java.lang.String ELEMENT
          Our XML element name.
 
Constructor Summary
Form()
          Build an empty form object, ready for filling.
Form(org.w3c.dom.Element e)
          Build a form object by parsing its DOM representation.
 
Method Summary
 void addItem(FormItem item)
           
 void addItem(int index, FormItem item)
          Add one item to the end of the item list.
 void addResolvedInclude(java.lang.Object o)
          Add a resolved include object.
 void clearItems()
          Clear all the items in the form.
 Form cloneNoFields()
           
 WSAttribute getAttributeValues(java.lang.String attrName)
          Allows the form to contribute any queryable or summary attribute.
 java.lang.String getBaseContext()
           
 java.lang.String getDescription()
           
 FieldDisplay getDisplay()
           
 java.lang.String getElementName()
          Return our XML element name, required by XmlObject.
 ExEnvironment getEnvironment()
          Get the expression environment.
 Form.Field getField(java.lang.String name)
          Locate a field by name.
 java.util.List getFields(java.lang.String name)
          Locate fields by name.
 java.lang.String getFullname(java.lang.String name)
          Expand a namespace qualified field name.
 java.lang.String getHelpCatalog()
           
 java.util.List getIncludes()
          Return the include list.
 Library getLibrary()
          Gets the library.
 java.util.Map getNamespaces()
          Get the namespace map.
 java.lang.Object getOwner()
           
 java.util.List getProperties()
          Get the entire propert list.
 java.lang.Object getProperty(ExState state, java.lang.String name)
          Get a form property value, computing if necessary.
 java.lang.Object getProperty(java.lang.String name)
          Get a form property value, must be static.
 Property getPropertyObject(java.lang.String name)
          Get a form property object.
 java.util.List getResolvedIncludes()
          Return the resolved include list.
 java.lang.String getSubTitle()
          Convenience method to get the subtitle property from the FieldDisplay
 java.lang.String getTitle()
          Convenience method to get the title property from the FieldDisplay
 boolean hasFields()
          Returns whether the form has any fields or not.
 boolean isNoDefaultButtons()
           
 boolean isTrace()
           
 void link(ExEnvironment env)
          Perform a "link" traversal on this form.
 void listQueryableAttributes(java.util.List qattrs)
          Allows the form to contribute defined attributes that this type of extension may expose as queryable attributes.
 void listSummaryAttributes(java.util.List sattrs)
          Allows the extension to contribute defined attributes that this type of extension may expose as summary attributes.
static void main(java.lang.String[] args)
           
 void resolveExpressions()
          Resolve references between nodes in the environment quietly.
 java.lang.String resolveNamespace(java.lang.String key)
          Given a namespace name, return the expansion.
 void setBaseContext(java.lang.String s)
           
 void setDescription(java.lang.String s)
           
 void setDisplay(FieldDisplay d)
           
 void setFields(java.util.List fields)
          Set the list of field definitions.
 void setHelpCatalog(java.lang.String s)
           
 void setIncludes(java.util.List l)
           
 void setLibrary(Library lib)
          Set the library we're within
 void setNoDefaultButtons(boolean b)
           
 void setOwner(java.lang.Object o)
          Allows the extension to keep a back pointer to its container.
 void setProperties(java.util.List props)
          Set the entire propertylist, should only be called by the form editor.
 void setProperty(java.lang.String name, java.lang.Object value)
          Set a static property.
 void setResolvedIncludes(java.util.List l)
          Set the resolved include list.
 void setSubTitle(java.lang.String s)
          Convenience method which sets the subTitle property of FieldDisplay
 void setTitle(java.lang.String s)
          Convenience method which sets the title property of FieldDisplay
 void setTrace(boolean b)
           
 java.lang.String toString()
           
 void toXml(java.lang.StringBuffer b, int indent)
          Serialize the object to an XML buffer.
 void toXml(java.lang.StringBuffer b, int indent, boolean includeResolved)
          Serialize the object to an XML buffer.
 void toXml(java.lang.StringBuffer b, int indent, boolean includeResolved, boolean stripFields)
           
 
Methods inherited from class com.waveset.object.FormItem
addCommonAttributes, addItems, 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, toIdentityString, toVerboseString, toVerboseString, toXml, toXml, toXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.waveset.object.Library.Member
getName
 

Field Detail

code_id

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

ELEMENT

public static final java.lang.String ELEMENT
Our XML element name.

See Also:
Constant Field Values

ATT_NAME

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

ATT_HELP

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

ATT_VALUE

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

ATT_BASE

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

ATT_DEFBUTTONS

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

ATT_TRACE

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

EL_INCLUDE

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

EL_PROPERTIES

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

EL_DESCRIPTION

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

EL_COMMENTS

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

EL_NAMESPACE

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

ATT_TITLE

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

ATT_SUBTITLE

public static final java.lang.String ATT_SUBTITLE
See Also:
Constant Field Values
Constructor Detail

Form

public Form()
Build an empty form object, ready for filling.


Form

public Form(org.w3c.dom.Element e)
     throws WavesetException
Build a form object by parsing its DOM representation. Required by XmlObject.

Method Detail

toString

public java.lang.String toString()

getOwner

public java.lang.Object getOwner()
Specified by:
getOwner in interface Extension

setDescription

public void setDescription(java.lang.String s)

setTitle

public void setTitle(java.lang.String s)
Convenience method which sets the title property of FieldDisplay


setSubTitle

public void setSubTitle(java.lang.String s)
Convenience method which sets the subTitle property of FieldDisplay


setHelpCatalog

public void setHelpCatalog(java.lang.String s)

setBaseContext

public void setBaseContext(java.lang.String s)

setIncludes

public void setIncludes(java.util.List l)

addItem

public void addItem(int index,
                    FormItem item)
Add one item to the end of the item list.

Overload the two FormItem methods to do extra processing. !! Work to do Need to have "resolve" and "unresolve" node walkers so we can copy node trees around and re-resolve them in their new environment. This might be simpler if we treated function resolution like variable binding and maintained it in the ExState? !! Wait, we're probably just lucky in that resolved functions are carrying over when a field is moved from one form to another, even though the function doesn't exist in the target form. We shouldn't be doing this. ALL items need to be copied over. !! Now that we can have hierarchical items, there is potentially the same sort of work to do in each of the FormItem subclasses, think.

Overrides:
addItem in class FormItem

addItem

public void addItem(FormItem item)
Overrides:
addItem in class FormItem

clearItems

public void clearItems()
Clear all the items in the form.

Overrides:
clearItems in class FormItem

setFields

public void setFields(java.util.List fields)
Set the list of field definitions. This is used when assembling forms dynamically from multiple sources.

This does things strangely for temporary backward compatibility. Originally, we kept expressions and fields on two different lists. So, after the field list was filtered and assigned, the target form would still have all the necessary and expressions. We want to simulate the same behavior here. So filter the item list to remove just the Field items, then add these items to the end.


setNoDefaultButtons

public void setNoDefaultButtons(boolean b)

setTrace

public void setTrace(boolean b)
Overrides:
setTrace in class AbstractXmlObject

setOwner

public void setOwner(java.lang.Object o)
Description copied from interface: Extension
Allows the extension to keep a back pointer to its container.

Specified by:
setOwner in interface Extension

listQueryableAttributes

public void listQueryableAttributes(java.util.List qattrs)
Allows the form to contribute defined attributes that this type of extension may expose as queryable attributes.

Specified by:
listQueryableAttributes in interface Extension

listSummaryAttributes

public void listSummaryAttributes(java.util.List sattrs)
Allows the extension to contribute defined attributes that this type of extension may expose as summary attributes.

Specified by:
listSummaryAttributes in interface Extension

getAttributeValues

public WSAttribute getAttributeValues(java.lang.String attrName)
Allows the form to contribute any queryable or summary attribute.

Specified by:
getAttributeValues in interface Extension
Returns:
any attribute values that the extension may have for the specified attribute.

setLibrary

public void setLibrary(Library lib)
Set the library we're within

Specified by:
setLibrary in interface Library.Member

getLibrary

public Library getLibrary()
Description copied from interface: Library.Member
Gets the library.

Specified by:
getLibrary in interface Library.Member

resolveExpressions

public void resolveExpressions()
Resolve references between nodes in the environment quietly. This needs to be called after you're done incrementally building up fields and addItem or one of the other constructors.


link

public void link(ExEnvironment env)
Perform a "link" traversal on this form. This will see that all expression fragments found in the form are installed in the ExEnvironment. This should be called after any sort of incremental modification of the form structure. It will be called automatically by the Form constructor.

Overrides:
link in class FormItem

getElementName

public java.lang.String getElementName()
Return our XML element name, required by XmlObject.

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

getEnvironment

public ExEnvironment getEnvironment()
Get the expression environment. This is required by some of the inner classes, exposing it may be useful as well?


getDescription

public java.lang.String getDescription()

isNoDefaultButtons

public boolean isNoDefaultButtons()

isTrace

public boolean isTrace()

getIncludes

public java.util.List getIncludes()
Return the include list.


getBaseContext

public java.lang.String getBaseContext()

getResolvedIncludes

public java.util.List getResolvedIncludes()
Return the resolved include list.


setResolvedIncludes

public void setResolvedIncludes(java.util.List l)
Set the resolved include list.


addResolvedInclude

public void addResolvedInclude(java.lang.Object o)
Add a resolved include object.


hasFields

public boolean hasFields()
Returns whether the form has any fields or not.


getField

public Form.Field getField(java.lang.String name)
Locate a field by name. We construct a hashtable on the fly to speed this up.


getFields

public java.util.List getFields(java.lang.String name)
Locate fields by name. We construct a hashtable on the fly to speed this up.


getDisplay

public FieldDisplay getDisplay()

setDisplay

public void setDisplay(FieldDisplay d)

getTitle

public java.lang.String getTitle()
Convenience method to get the title property from the FieldDisplay


getSubTitle

public java.lang.String getSubTitle()
Convenience method to get the subtitle property from the FieldDisplay


getHelpCatalog

public java.lang.String getHelpCatalog()

resolveNamespace

public java.lang.String resolveNamespace(java.lang.String key)
Given a namespace name, return the expansion.


getNamespaces

public java.util.Map getNamespaces()
Get the namespace map.


getFullname

public java.lang.String getFullname(java.lang.String name)
Expand a namespace qualified field name.


getProperties

public java.util.List getProperties()
Get the entire propert list. Added for the form editor.


setProperties

public void setProperties(java.util.List props)
Set the entire propertylist, should only be called by the form editor.


getPropertyObject

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


getProperty

public java.lang.Object getProperty(ExState state,
                                    java.lang.String name)
                             throws WavesetException
Get a form property value, computing if necessary.

Throws:
WavesetException

getProperty

public java.lang.Object getProperty(java.lang.String name)
Get a form property value, must be static.


setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Set a static property.


toXml

public void toXml(java.lang.StringBuffer b,
                  int indent)
Serialize the object to an XML buffer. Broke this out so we can control whether resolved forms are included in the XML. This is used only for views.

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

cloneNoFields

public Form cloneNoFields()
                   throws WavesetException
Throws:
WavesetException

toXml

public void toXml(java.lang.StringBuffer b,
                  int indent,
                  boolean includeResolved)
Serialize the object to an XML buffer.


toXml

public void toXml(java.lang.StringBuffer b,
                  int indent,
                  boolean includeResolved,
                  boolean stripFields)

main

public static void main(java.lang.String[] args)