org.sandev.basics.util
Class UIFormContext

java.lang.Object
  extended by org.sandev.basics.structs.UIFormInitializerStruct
      extended by org.sandev.basics.sandmessages.UIFormInitializer
          extended by org.sandev.basics.util.UIFormContext
All Implemented Interfaces:
SandInstanceMessage, SandMessage, SandStructMessage, InfoReport, Resolvable

public class UIFormContext
extends UIFormInitializer
implements InfoReport

A contract between a user interface and the system. The atomic application input and output is defined via SAND messages. This class captures the context surrounding these atomic actions to enable intuitive traversal and manipulation of data.

The class is structured around UI interaction with the system through a form. For examples of typical system interactions, and an overview of this class, see UIGen.html


Field Summary
protected  java.lang.String displayContext
          A UI dependent string indicating the environment this form context exists in.
protected  java.lang.Object displayState
          A UI dependent instance providing access to the overall display processing state.
protected  java.util.Locale locale
          The locale we are working with.
protected  java.lang.String openLocation
          A URL to be opened.
protected  java.util.Map parameterMap
          A map of parameter names to values which provides access to all link parameters.
protected  boolean pendingEdits
          Provides a flag for tracking if there are outstanding edits which need to be saved to disk.
protected  boolean requireSecure
          A flag indicating that secure communications are required.
protected  boolean[] supportedActions
          A flag array indicating which actions are supported and which are not.
protected  AggregateUpdate updates
          Outstanding updates necessary for save processing.
protected  long userID
          The uniqueID of the current user.
 
Fields inherited from class org.sandev.basics.sandmessages.UIFormInitializer
ACTION_ADD, ACTION_CANCEL, ACTION_COLLAPSE, ACTION_CUSTOM, ACTION_DELETE, ACTION_DEREF, ACTION_DRILLDOWN, ACTION_EDIT, ACTION_EXPAND, ACTION_FIND, ACTION_HELP, ACTION_INIT, ACTION_MOVEDOWN, ACTION_MOVEUP, ACTION_NEW, ACTION_NEXT, ACTION_OK, ACTION_PAGETO, ACTION_PARENT, ACTION_PREVIOUS, ACTION_REMOVE, ACTION_SAVE, ACTION_SELECT, ACTION_UNDEFINED, MODESTACK_ADDING, MODESTACK_FINDING, MODESTACK_LISTING, MODESTACK_UNDEFINED, MODESTACK_UPDATING
 
Fields inherited from class org.sandev.basics.structs.UIFormInitializerStruct
action, currClass, currInst, findCollection, findCollIndex, findCollMaxDisplay, findKeys, findQuery, formControl, modeStack, outputText, position, rootMsg, userQuery
 
Fields inherited from interface org.sandev.basics.structs.SandInstanceMessage
FIELDCHECK_EMPTYSTRINGPRINTVAL, FIELDCHECK_INVALIDVAL, FIELDCHECK_NOTAREF, FIELDCHECK_NOTINRANGE, FIELDCHECK_NULLARRAY, FIELDCHECK_STRINGOVER, FIELDCHECK_UNKNOWNVAL, FIELDFLAG_BINARY, FIELDFLAG_ENCRYPT, FIELDFLAG_INTERNAL, FIELDFLAG_NOECHO, FIELDFLAG_OBFUSCATE, FIELDFLAG_STRINGPERSIST, FIELDFLAG_SUMMARYEDIT, FIELDFLAG_UNIQUE, GENMOD_ACTION_APPEND, GENMOD_ACTION_INSERT, GENMOD_ACTION_REMOVE, GENMOD_ACTION_SET
 
Constructor Summary
UIFormContext()
          default ctor calls init
 
Method Summary
 boolean actionSupported(int action)
          Returns true if this action is currently supported, false otherwise.
 void addCollapsed(java.lang.String msgClass, java.lang.String msgID, java.lang.String fieldname)
          If no matching UIFormDirective collapsing the given specification is found, then add it.
 void addNewInstanceToParentColl()
          Add a newly created instance to the current find collection.
 void addOutput(int sev, java.lang.String text)
          Convenience append method to add output text.
 void addOutput(int sev, java.lang.String fieldname, java.lang.String code, java.lang.String text)
          Convenience append method to add output text.
 void appendError(java.lang.String text)
          Convenience append method to add an error to the output text.
 void appendInfo(java.lang.String text)
          Convenience append method for informational messages
 void appendInfo(java.lang.String field, java.lang.String code, java.lang.String text)
          Convenience append method for informational messages
 void appendWarning(java.lang.String text)
          Convenience append method for informational messages
 boolean atTopLevel()
          Returns true if we are at the root display for the form.
 UIFormContext cloneContext()
          Return a copy of this UIFormContext instance.
 void copyValuesFrom(UIFormContext uifc)
          Copy all the values from the given UIFormContext.
static void debugDump(java.lang.String headerline, UIFormContext uifc)
          Dump this form context to the standard output.
static void debugDump(UIFormContext uifc)
          Dump this form context to the standard output with a default header.
 void debugDumpActionSupport()
          Write out all the actions and whether they are currently supported or not.
static void debugout(java.lang.String text)
          Used for all debug output.
 void disableAction(int action)
          Disables a specific form action.
 void disableActionsFromContext()
          Disables all top level actions that are not appropriate given the current context.
 java.lang.String dumpOutputText()
          Return the output text messages in log dump format.
 void dumpParams()
          Debugging method for dumping the first value of each entry in the parameterMap.
static java.lang.String dumpQuery(SandQueryMessage sqm)
          Returns the match expression as a String.
static java.lang.String dumpUIFormQuery(UIFormQuery uiq)
           
 void evalPosition()
          Set our currInst and currClass the position and rootMsg information.
static java.lang.String getAccessMethodForField(java.lang.String field)
          return the name of the access method for the given field
static java.lang.String getAppendMethodForField(java.lang.String field)
          return the name of the append method for the given field
static int getArrayIndex(java.lang.String posentry)
          Given a position entry, return the array index it is referencing or -2 if it is not referencing an array.
static java.lang.String getArraySetMethodForField(java.lang.String field)
          return the name of the array set method for the given field
static java.lang.String getArraySuffix(java.lang.String value)
          Convenience method for returning just the array index suffix of a given string.
static int getCollapsed(UIFormControl formControl, java.lang.String msgClass, java.lang.String msgID, java.lang.String fieldname)
          Utility method to evaluate the state of a given collapsible field.
 java.lang.String getCurrentField()
          Return the name of the field we are currently positioned at.
 int getCurrentFieldIndex()
          Returns the array index of the current field, or -2 if this field is not an array.
 SandInstanceMessage getCurrentObject()
          Walk the position and msg variables to find the message instance corresponding to the last position entry.
 SandInstanceMessage getCurrentParent()
          Walk the position and msg variables to find the message instance corresponding to the second-to-last position entry.
 java.lang.String getDisplayClass()
          Return the current class we are working with.
 java.lang.String getDisplayContext()
          accessor for displayContext
 java.lang.Object getDisplayState()
          accessor for displayState
 java.lang.String getFindKeysPath()
          Return the findKeys array as a dot separated string.
 java.lang.String getFormControlSummary()
          Return a summary text description of the UIFormControl parameters currently in effect.
static java.lang.String getInsertMethodForField(java.lang.String field)
          return the name of the insert method for the given field
 SandInstanceMessage getInstanceAtPosition(SandInstanceMessage source, int index)
          Walk the position stack down to the specified index and return the referenced object.
 java.lang.String getLastPositionEntry()
          Returns the last element in the position stack.
 java.util.Locale getLocale()
          accessor for locale
 int getMode()
          Equivalent to lastModeStack.
 java.lang.String getModePath()
          Returns the modeStack array as a dot separated string.
 java.lang.String getOpenLocation()
          accessor for openLocation
 java.lang.String getParam(java.lang.String key)
          Utility for retrieving single-valued string parameters from our parameterMap.
 java.util.Map getParameterMap()
          accessor for parameterMap
 boolean getPendingEdits()
          accessor for pendingEdits
 java.lang.String getPositionPath()
          Return the position as a dot separated string.
 SandInstanceMessage getReferencedObject(SandInstanceMessage obj, java.lang.String posentry)
          Given an object reference, and the name of a field within the object which may have array indices at the end, return the referenced object.
static java.lang.String getRemoveMethodForField(java.lang.String field)
          return the name of the remove method for the given field
 boolean getRequireSecure()
          accessor for requireSecure
 java.lang.String getSelectionField()
          Convenience accessor method for the selectionField value of the formControl.
static java.lang.String getSetMethodForField(java.lang.String field)
          return the name of the set method for the given field
 boolean[] getSupportedActions()
          accessor for supportedActions.
 AggregateUpdate getUpdates()
          accessor for updates
 long getUserID()
          accessor for userID
 boolean hasErrorOutput()
          Return true if the outputText contains error output, false otherwise.
 boolean hasPendingEdits()
          accessor for pendingEdits
 void init()
          Initialize this form context to the default values.
 void initCollectionDisplay(java.lang.String dispClass, SandCollectionMessage coll, SandQueryMessage query)
          Set up this initialized form context to display a collection.
 void initInstanceDisplay(SandInstanceMessage sim)
          Set up the form context to display the specified instance.
 void initPosition(java.lang.String pos)
          Sets the position to a new array containing only the specified value.
 boolean isCollectionView()
          Return true if we are currently displaying a collection.
 boolean isFindCollectionView()
          Return true if we are currently displaying a find collection.
 boolean isFormManagerAction()
          Return true if the current action is expected to be handled by a UIFormManager implementation, false otherwise.
static boolean isSameIDOrEquivalent(SandStructMessage oldMsg, SandInstanceMessage newMsg)
          Return true if the oldMsg and newMsg have the same uniqueID, or are equivalent based on field comparison.
 boolean isUninitialized()
          Return true if this form context is uninitialized.
 void normalizeReferences()
          Make equivalent data point to the same object.
static java.lang.String removeArrayIndex(java.lang.String value)
          Convenience method for removing any array index brackets from a given string field value.
 void removeCollapsed(java.lang.String msgClass, java.lang.String msgID, java.lang.String fieldname)
          If a UIFormDirective matching the specified parameters exists, then remove it.
 void resetSupportedActions()
          Initialize the supported actions array.
 void resetToCollection()
          This method factors the calls needed to nuke whatever context is captured in the uifc, in preparation for initializing it with a collection display.
 void resolveTransactionResults(AggregateUpdate oldUpdate, AggregateUpdate newUpdate, java.lang.String source)
          Walk the old updates and the new updates, resolving any data against the new values.
 void setDisplayContext(java.lang.String val)
          mutator for displayContext
 void setDisplayState(java.lang.Object val)
          mutator for displayState
 void setFindKeysPath(java.lang.String path)
          Set the findKeys array from the given dot separated string.
 void setLocale(java.util.Locale loc)
          mutator for locale
 void setModePath(java.lang.String path)
          Set the modeStack array from the given dot separated string.
 void setOpenLocation(java.lang.String val)
          mutator for openLocation
 void setParameterMap(java.util.Map pmap)
          mutator for parameterMap
 void setPendingEdits(boolean val)
          mutator for pendingEdits
 void setPositionPath(java.lang.String pos)
          Set the position array from the given dot separated string.
 void setRequireSecure(boolean val)
          mutator for requireSecure
 void setSelectionField(java.lang.String val)
          Convenience mutator method for the selectionField value of the formControl.
 void setSupportedActions(boolean[] val)
          mutator for supportedActions.
 void setUpdates(AggregateUpdate val)
          mutator for updates
 void setUserID(long ID)
          mutator for userID
 void trimLastUpdate()
          Removes the last update message from the aggregate.
 void upOneLevel()
          Moves the entire context up one level, discarding any current working text or object.
 
Methods inherited from class org.sandev.basics.sandmessages.UIFormInitializer
actionActual2Print, actionLabelToValue, actionLabelToValueStatic, actionPrint2Actual, actionPrint2Key, actionValueToLabel, actionValueToLabelStatic, addFindKeys, addFindKeys, addModeStack, addModeStack, addOutputText, addOutputText, addPosition, addPosition, clearFindKeys, clearModeStack, clearOutputText, clearPosition, cloneMessage, cloneUIFormInitializer, convertToSuperstructClass, copyDataFrom, copyFieldValue, debugDump, defaultField, fieldHasFlag, fieldsValid, fieldValidate, find, findKeysContains, findKeysIndexOf, generalAccessor, generalDereference, generalModifier, getAction, getActionActualVals, getActionDefaultValue, getActionEnumSummary, getActionFieldPrintValue, getActionFlag, getActionInvalidValue, getActionKeyVals, getActionMetatype, getActionPrintVals, getActionPrintValue, getActionRange, getActionValidityCheck, getAllFields, getBaseMemoryUse, getCollectionMessage, getContainedMessageFields, getCurrClass, getCurrClassDefaultValue, getCurrClassFieldPrintValue, getCurrClassFlag, getCurrClassInvalidValue, getCurrClassLengthMax, getCurrClassLengthNorm, getCurrClassMetatype, getCurrClassPrintValue, getCurrClassRange, getCurrClassValidityCheck, getCurrInst, getCurrInstDefaultValue, getCurrInstFieldPrintValue, getCurrInstFlag, getCurrInstInvalidValue, getCurrInstMetatype, getCurrInstPrintValue, getCurrInstRange, getCurrInstValidityCheck, getDisplayFields, getDisplayFieldsPrint, getDisplayID, getDisplayValues, getDisplayValues, getFindCollection, getFindCollectionDefaultValue, getFindCollectionFieldPrintValue, getFindCollectionFlag, getFindCollectionInvalidValue, getFindCollectionMetatype, getFindCollectionPrintValue, getFindCollectionRange, getFindCollectionValidityCheck, getFindCollIndex, getFindCollIndexDefaultValue, getFindCollIndexFieldPrintValue, getFindCollIndexFlag, getFindCollIndexInvalidValue, getFindCollIndexMetatype, getFindCollIndexPrintValue, getFindCollIndexRange, getFindCollIndexValidityCheck, getFindCollMaxDisplay, getFindCollMaxDisplayDefaultValue, getFindCollMaxDisplayFieldPrintValue, getFindCollMaxDisplayFlag, getFindCollMaxDisplayInvalidValue, getFindCollMaxDisplayMetatype, getFindCollMaxDisplayPrintValue, getFindCollMaxDisplayRange, getFindCollMaxDisplayValidityCheck, getFindKeys, getFindKeys, getFindKeysDefaultValue, getFindKeysElementInvalidValue, getFindKeysFieldPrintValue, getFindKeysFlag, getFindKeysInvalidValue, getFindKeysLengthMax, getFindKeysLengthNorm, getFindKeysMetatype, getFindKeysPrintValue, getFindKeysRange, getFindKeysValidityCheck, getFindQuery, getFindQueryDefaultValue, getFindQueryFieldPrintValue, getFindQueryFlag, getFindQueryInvalidValue, getFindQueryMetatype, getFindQueryPrintValue, getFindQueryRange, getFindQueryValidityCheck, getFormControl, getFormControlDefaultValue, getFormControlFieldPrintValue, getFormControlFlag, getFormControlInvalidValue, getFormControlMetatype, getFormControlPrintValue, getFormControlRange, getFormControlValidityCheck, getInstance, getInstance, getLayoutXML, getModeStack, getModeStack, getModeStackActualVals, getModeStackDefaultValue, getModeStackElementInvalidValue, getModeStackEnumSummary, getModeStackFieldPrintValue, getModeStackFlag, getModeStackInvalidValue, getModeStackKeyVals, getModeStackMetatype, getModeStackPrintVals, getModeStackPrintValue, getModeStackRange, getModeStackValidityCheck, getOutputText, getOutputText, getOutputTextDefaultValue, getOutputTextElementInvalidValue, getOutputTextFieldPrintValue, getOutputTextFlag, getOutputTextInvalidValue, getOutputTextMetatype, getOutputTextPrintValue, getOutputTextRange, getOutputTextValidityCheck, getPosition, getPosition, getPositionDefaultValue, getPositionElementInvalidValue, getPositionFieldPrintValue, getPositionFlag, getPositionInvalidValue, getPositionLengthMax, getPositionLengthNorm, getPositionMetatype, getPositionPrintValue, getPositionRange, getPositionValidityCheck, getPrintname, getPrintnameForField, getQueryMessage, getRootMsg, getRootMsgDefaultValue, getRootMsgFieldPrintValue, getRootMsgFlag, getRootMsgInvalidValue, getRootMsgMetatype, getRootMsgPrintValue, getRootMsgRange, getRootMsgValidityCheck, getShortName, getStructMessage, getUpdateMessage, getUserQuery, getUserQueryDefaultValue, getUserQueryFieldPrintValue, getUserQueryFlag, getUserQueryInvalidValue, getUserQueryMetatype, getUserQueryPrintValue, getUserQueryRange, getUserQueryValidityCheck, getValueForFieldName, insertFindKeys, insertModeStack, insertOutputText, insertPosition, isEquivalent, lastFindKeys, lastModeStack, lastPosition, modeStackActual2Print, modeStackContains, modeStackIndexOf, modeStackLabelToValue, modeStackLabelToValueStatic, modeStackPrint2Actual, modeStackPrint2Key, modeStackValueToLabel, modeStackValueToLabelStatic, outputTextContains, outputTextIndexOf, popFindKeys, popModeStack, popPosition, positionContains, positionIndexOf, pushFindKeys, pushModeStack, pushPosition, referenceValidate, removeFindKeys, removeFindKeysValue, removeModeStack, removeModeStackValue, removeOutputText, removeOutputTextValue, removePosition, removePositionValue, setAction, setCurrClass, setCurrClass, setCurrInst, setCurrInst, setFindCollection, setFindCollection, setFindCollIndex, setFindCollMaxDisplay, setFindKeys, setFindKeys, setFindQuery, setFindQuery, setFormControl, setFormControl, setModeStack, setModeStack, setOutputText, setOutputText, setOutputText, setPosition, setPosition, setRootMsg, setRootMsg, setUserQuery, setUserQuery, shallowCopy, sizeofFindKeys, sizeofModeStack, sizeofOutputText, sizeofPosition, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pendingEdits

protected boolean pendingEdits
Provides a flag for tracking if there are outstanding edits which need to be saved to disk. If you set this to false, any pending updates will be dropped as well.


updates

protected AggregateUpdate updates
Outstanding updates necessary for save processing. This is typically populated by the UIFormManager and maintained as part of the form context to enable save processing.

By using ACTION_OK to accumulate updates without committing them, a user can generate a transaction where several updates are done at once. If ACTION_OK is disabled, then they user saves as they go, so the number of outstanding updates will be limited to new references from the current instance.


userID

protected long userID
The uniqueID of the current user. This is useful for holding onto who the user is after the initial lookup. Each request must still be authorized, but the ID provides for AuthUser instance lookup.


locale

protected java.util.Locale locale
The locale we are working with. Used for loading resources during processing by the UIFormOwner (not part of the serialized form).


displayContext

protected java.lang.String displayContext
A UI dependent string indicating the environment this form context exists in. For a SandUI, this is the name of the screen followed by a dot followed by the name of the link (form or text). This provides a unique display value which can be used for localized text lookup.


displayState

protected java.lang.Object displayState
A UI dependent instance providing access to the overall display processing state. For a SandUI, this is the working copy of the Screen instance, which can be traversed to reference the formState of another Link.


parameterMap

protected java.util.Map parameterMap
A map of parameter names to values which provides access to all link parameters. This method may return the the same map used by UIRenderInput, but is not required to.


supportedActions

protected boolean[] supportedActions
A flag array indicating which actions are supported and which are not. By default all actions are supported. To disable an action set the associated flag to false by calling disableAction.

Specific actions can be disabled, but not enabled, during processing. Essentially actions which are not applicable, or which are not authorized, are turned off by setting them to false in this array. The supportedActions are reinitialized for each request, and then restricted by the UIFormManager and the UIFormAdaptor based on the mode and authorization.

A UI may completely disable a command by setting it to false before passing it to the UIFormManager. This can be used to create limited functionality forms.


openLocation

protected java.lang.String openLocation
A URL to be opened. For a non-web UI, the new location will be opened using the default browser. For a web UI, the display will be redirected to the new URL.


requireSecure

protected boolean requireSecure
A flag indicating that secure communications are required. In a client/server based application, this signals that processing requires encrypted communications. For example a web UI might set this flag to require https.

Constructor Detail

UIFormContext

public UIFormContext()
default ctor calls init

Method Detail

hasPendingEdits

public boolean hasPendingEdits()
accessor for pendingEdits


getPendingEdits

public boolean getPendingEdits()
accessor for pendingEdits


setPendingEdits

public void setPendingEdits(boolean val)
mutator for pendingEdits


getUpdates

public AggregateUpdate getUpdates()
accessor for updates


setUpdates

public void setUpdates(AggregateUpdate val)
mutator for updates


trimLastUpdate

public void trimLastUpdate()
Removes the last update message from the aggregate.


getUserID

public long getUserID()
accessor for userID


setUserID

public void setUserID(long ID)
mutator for userID


getLocale

public java.util.Locale getLocale()
accessor for locale


setLocale

public void setLocale(java.util.Locale loc)
mutator for locale


getDisplayContext

public java.lang.String getDisplayContext()
accessor for displayContext


setDisplayContext

public void setDisplayContext(java.lang.String val)
mutator for displayContext


getDisplayState

public java.lang.Object getDisplayState()
accessor for displayState


setDisplayState

public void setDisplayState(java.lang.Object val)
mutator for displayState


getParameterMap

public java.util.Map getParameterMap()
accessor for parameterMap


setParameterMap

public void setParameterMap(java.util.Map pmap)
mutator for parameterMap


getParam

public java.lang.String getParam(java.lang.String key)
Utility for retrieving single-valued string parameters from our parameterMap. Note that all hardcoded Strings within java code are automatically interned by the compiler, which enables fast lookup. If the key passed in here is not interned, then this method may not find it. Returns the value of the given parameter if found, null otherwise.


dumpParams

public void dumpParams()
Debugging method for dumping the first value of each entry in the parameterMap.


resetSupportedActions

public void resetSupportedActions()
Initialize the supported actions array.


getSupportedActions

public boolean[] getSupportedActions()
accessor for supportedActions. This initializes supportedActions if necessary.


setSupportedActions

public void setSupportedActions(boolean[] val)
mutator for supportedActions. Since the UIFormContext functions as a workspace, this method makes a copy of the given array. This prevents any inadvertent modifications to the reference passed as a parameter.

If the array given is null, or the length of the array is not ACTION_HELP+1, then the call is ignored.


actionSupported

public boolean actionSupported(int action)
Returns true if this action is currently supported, false otherwise.


disableAction

public void disableAction(int action)
Disables a specific form action.


disableActionsFromContext

public void disableActionsFromContext()
Disables all top level actions that are not appropriate given the current context. The top level actions are:

ACTION_HELP is not necessarily context dependent, so it is not modified here. It is up to specific form adaptors/owners to enable or disable help appropriately.


debugDumpActionSupport

public void debugDumpActionSupport()
Write out all the actions and whether they are currently supported or not. Used for debugging.


getSelectionField

public java.lang.String getSelectionField()
Convenience accessor method for the selectionField value of the formControl. Returns the empty string if the formControl is null or the selectionField is null. The empty string is generally easier to use for comparison purposes.


setSelectionField

public void setSelectionField(java.lang.String val)
Convenience mutator method for the selectionField value of the formControl. Initializes the formControl to a new instance as needed.


getOpenLocation

public java.lang.String getOpenLocation()
accessor for openLocation


setOpenLocation

public void setOpenLocation(java.lang.String val)
mutator for openLocation


getRequireSecure

public boolean getRequireSecure()
accessor for requireSecure


setRequireSecure

public void setRequireSecure(boolean val)
mutator for requireSecure


init

public void init()
Initialize this form context to the default values. By default we start in MODE_LISTING. This calls getSupportedActions to trigger initialization of supported actions.

Overrides:
init in class UIFormInitializer

getMode

public int getMode()
Equivalent to lastModeStack.


getModePath

public java.lang.String getModePath()
Returns the modeStack array as a dot separated string. This is useful for debugging and to support stack tail checking logic.


setModePath

public void setModePath(java.lang.String path)
Set the modeStack array from the given dot separated string. This essentially reconstructs the stack from the path form. The supported actions are also reset since the existing values are likely no longer correct for the new state. The display processing will call disableActionsFromContext before rendering the action buttons.


initPosition

public void initPosition(java.lang.String pos)
Sets the position to a new array containing only the specified value. Equivalent to setPositionPath(pos).


getPositionPath

public java.lang.String getPositionPath()
Return the position as a dot separated string.


setPositionPath

public void setPositionPath(java.lang.String pos)
Set the position array from the given dot separated string.


getFindKeysPath

public java.lang.String getFindKeysPath()
Return the findKeys array as a dot separated string.


setFindKeysPath

public void setFindKeysPath(java.lang.String path)
Set the findKeys array from the given dot separated string.


appendError

public void appendError(java.lang.String text)
Convenience append method to add an error to the output text.


appendWarning

public void appendWarning(java.lang.String text)
Convenience append method for informational messages


appendInfo

public void appendInfo(java.lang.String text)
Convenience append method for informational messages

Specified by:
appendInfo in interface InfoReport

appendInfo

public void appendInfo(java.lang.String field,
                       java.lang.String code,
                       java.lang.String text)
Convenience append method for informational messages

Specified by:
appendInfo in interface InfoReport

addOutput

public void addOutput(int sev,
                      java.lang.String text)
Convenience append method to add output text.


addOutput

public void addOutput(int sev,
                      java.lang.String fieldname,
                      java.lang.String code,
                      java.lang.String text)
Convenience append method to add output text.


hasErrorOutput

public boolean hasErrorOutput()
Return true if the outputText contains error output, false otherwise.


dumpOutputText

public java.lang.String dumpOutputText()
Return the output text messages in log dump format.


debugDump

public static void debugDump(UIFormContext uifc)
Dump this form context to the standard output with a default header.


debugDump

public static void debugDump(java.lang.String headerline,
                             UIFormContext uifc)
Dump this form context to the standard output. This method is static so it can be used with null form context references.


dumpQuery

public static java.lang.String dumpQuery(SandQueryMessage sqm)
Returns the match expression as a String. Used for debug dump.


dumpUIFormQuery

public static java.lang.String dumpUIFormQuery(UIFormQuery uiq)

debugout

public static void debugout(java.lang.String text)
Used for all debug output. If singleton access to a Logger instance is standardized, then this method should use that mechanism. For now this just wraps System.out.println.


getDisplayClass

public java.lang.String getDisplayClass()
Return the current class we are working with. This method makes a best guess using the current class and the display state.


getCurrentParent

public SandInstanceMessage getCurrentParent()
Walk the position and msg variables to find the message instance corresponding to the second-to-last position entry. This is the parent of the instance currently being edited, which is necessary for insert/append/remove operations. Note that by default this works off the root message.

If the current message has no parent, then this method returns null. That's necessary as a termination point, and to distinguish if you are editing the root directly.


getCurrentObject

public SandInstanceMessage getCurrentObject()
Walk the position and msg variables to find the message instance corresponding to the last position entry. This is necessary to get the current information for editing.

NOTE: This method returns the current instance, which may be the same as the value returned by getCurrInst() if you are adding a new instance.


getInstanceAtPosition

public SandInstanceMessage getInstanceAtPosition(SandInstanceMessage source,
                                                 int index)
Walk the position stack down to the specified index and return the referenced object. If not possible, return null.


getCurrentField

public java.lang.String getCurrentField()
Return the name of the field we are currently positioned at. This is the last string in the position, with any array reference brackets trimmed off.


getLastPositionEntry

public java.lang.String getLastPositionEntry()
Returns the last element in the position stack.


getCurrentFieldIndex

public int getCurrentFieldIndex()
Returns the array index of the current field, or -2 if this field is not an array.


upOneLevel

public void upOneLevel()
Moves the entire context up one level, discarding any current working text or object. This method modifies the position and then calls evalPosition to set the other elements accordingly


evalPosition

public void evalPosition()
Set our currInst and currClass the position and rootMsg information. Essentially we traverse the rootMsg according to the position and then update the currInst and currClass from the instance information there.

If there is no object for the last field (as can happen when you are adding a new element), then the currInst is set to null, and nothing is done with the currClass. The presumption is that the currClass will already have been set to something reasonable.


atTopLevel

public boolean atTopLevel()
Returns true if we are at the root display for the form. Being at the root display means we are either: This method is somewhat heuristic in that if a save fails, then you won't really be back at the top level yet. But under normal processing you would be.


normalizeReferences

public void normalizeReferences()
Make equivalent data point to the same object. To support cancel operations (and context over time), the currInst, rootMsg, findCollection and updates normally have separate object information even if they are referring to the same data. But when processing a save operation, uniqueID values are assigned to new instances, and these values need to be reflected in the rest of the context. The easiest way to make sure things stay consistent is to make all the references point to the same actual object instances.

Once the UIFormContext is serialized into display form and reconstructed, the references will all point to separate object instances again. Since the display is refreshed at the conclusion of save processing, this consolidation is short lived.

This method assumes that we are about to save (so pendingEdits is true) and uses the information in the updates as its base reference. If updates is null or empty, this method does nothing.


resolveTransactionResults

public void resolveTransactionResults(AggregateUpdate oldUpdate,
                                      AggregateUpdate newUpdate,
                                      java.lang.String source)
Walk the old updates and the new updates, resolving any data against the new values. If a source is specified, then any new updates not matching the source are ignored. This allows processing to ignore any other updates that were inserted into the transaction to enforce application logic.

When a new persistent message instance is saved, it is added to the findCollection during form processing. In all other cases the results are merged into the current UIFormContext so it contains the latest reference values.


isSameIDOrEquivalent

public static boolean isSameIDOrEquivalent(SandStructMessage oldMsg,
                                           SandInstanceMessage newMsg)
Return true if the oldMsg and newMsg have the same uniqueID, or are equivalent based on field comparison.


isFormManagerAction

public boolean isFormManagerAction()
Return true if the current action is expected to be handled by a UIFormManager implementation, false otherwise.


isUninitialized

public boolean isUninitialized()
Return true if this form context is uninitialized. This method returns true if: