com.waveset.object
Class FieldIterator

java.lang.Object
  extended bycom.waveset.object.FieldIterator

public class FieldIterator
extends java.lang.Object

A class encapsulating the logic necessary to produce a flat list of Field objects, by walking over the field hierarchy, and processing loops.


Field Summary
static java.lang.String code_id
           
static int MAX_STACK_DEPTH
          The maximum allowable recursion depth for the stack, used to catch circular references that would result in an infinite loop.
static java.lang.String PAGE_ATTRIBUTE
          The name of the input variable we expect to hold the current page name.
static java.lang.String[] SPECIAL_FORMS
          Normally if we come across an unresolved form reference we'll emit a warning message since it is usually significant.
 
Constructor Summary
FieldIterator(FormState fs)
          Build an iterator for a certain form state.
 
Method Summary
 void close()
          Must be called in a finally block everytime you call FormState.iterate()
 java.lang.Object getAnnotation()
          Get the annotation from the current stack frame.
 java.lang.String getBaseContext()
           
 java.lang.String getFieldName()
          Return the fully qualified name for the last field, including base contexts specifed in references.
 java.lang.String getFieldName(java.lang.String name)
          Return the fully qualified name for supplied name.
 boolean hasNext()
          Return true if there is another field.
 boolean isSpecialForm(java.lang.String name)
          Test to see if a form name is one of the "special" forms that will never be resolved.
 Form.Field next()
          Return the next field.
static void println(java.lang.String msg)
           
 void setAnnotation(java.lang.Object o)
          Allow stack frame to be annotated with an object.
 void setCheckDisabled(boolean b)
           
 void setIgnoreDisableExpressions(boolean b)
           
 void setIgnorePages(boolean b)
           
 void setPage(java.lang.String s)
           
 void setTrace(boolean b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

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

MAX_STACK_DEPTH

public static final int MAX_STACK_DEPTH
The maximum allowable recursion depth for the stack, used to catch circular references that would result in an infinite loop.

See Also:
Constant Field Values

PAGE_ATTRIBUTE

public static final java.lang.String PAGE_ATTRIBUTE
The name of the input variable we expect to hold the current page name. // Should find a way to allow the Form define this.

See Also:
Constant Field Values

SPECIAL_FORMS

public static final java.lang.String[] SPECIAL_FORMS
Normally if we come across an unresolved form reference we'll emit a warning message since it is usually significant. There are however a few form references that we'll use just as markers for some special form processing and which aren't really form references. This list defines the names to recognize and avoid the warning message. // * It would better if we had a different sort of FieldItem // * to represent these things.

Constructor Detail

FieldIterator

public FieldIterator(FormState fs)
              throws WavesetException
Build an iterator for a certain form state.

Method Detail

close

public void close()
Must be called in a finally block everytime you call FormState.iterate()


setTrace

public void setTrace(boolean b)

setIgnoreDisableExpressions

public void setIgnoreDisableExpressions(boolean b)

setCheckDisabled

public void setCheckDisabled(boolean b)

println

public static void println(java.lang.String msg)

setIgnorePages

public void setIgnorePages(boolean b)

setPage

public void setPage(java.lang.String s)

hasNext

public boolean hasNext()
                throws WavesetException
Return true if there is another field.

Throws:
WavesetException

next

public Form.Field next()
                throws WavesetException
Return the next field.

Throws:
WavesetException

getFieldName

public java.lang.String getFieldName()
Return the fully qualified name for the last field, including base contexts specifed in references. This iterator is a little odd in that you can ask questions about things just returned by the next() method, without advancing the iterator. This is because the Field objects are immutable, they're in a cache and we don't want to copy them. Would be purer if we returned a FieldIterator.Field or some sort of wrapper object that contained both the Field and the expanded name.


getFieldName

public java.lang.String getFieldName(java.lang.String name)
Return the fully qualified name for supplied name. This is used to convert inter-field references like the "confirmation" attribute into a fully qualified name.


setAnnotation

public void setAnnotation(java.lang.Object o)
Allow stack frame to be annotated with an object. This is used so the application iterating can keep track of where we are in the hierarchy, and build a parallel hierarchy.


getAnnotation

public java.lang.Object getAnnotation()
Get the annotation from the current stack frame.


getBaseContext

public java.lang.String getBaseContext()

isSpecialForm

public boolean isSpecialForm(java.lang.String name)
Test to see if a form name is one of the "special" forms that will never be resolved.