|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sandev.basics.structs.UIFormInitializerStruct
org.sandev.basics.sandmessages.UIFormInitializer
org.sandev.basics.util.UIFormContext
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 java.lang.String |
selectionField
An output directive telling the UI display which field in the current instance should be selected. |
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_CUSTOM, ACTION_DELETE, ACTION_DEREF, ACTION_DRILLDOWN, ACTION_EDIT, ACTION_FIND, ACTION_HELP, ACTION_INIT, ACTION_MOVEDOWN, ACTION_MOVEUP, ACTION_NEW, ACTION_NEXT, ACTION_OK, 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, modeStack, outputText, position, rootMsg, userQuery |
| Fields inherited from interface org.sandev.basics.structs.SandInstanceMessage |
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_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 |
addCurrInstToParentColl()
Add the currInst to our findCollection. |
void |
addOutputText(java.lang.String text)
Convenience append method. |
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. |
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. |
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. |
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. |
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 |
java.lang.String |
getSelectionField()
accessor for selectionField |
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 |
hasPendingEdits()
accessor for pendingEdits |
void |
init()
Initialize this form context to the default values. |
void |
initCollectionDisplay(java.lang.String dispClass,
SandCollectionMessage coll)
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. |
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 |
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 |
setSelectionField(java.lang.String val)
mutator for selectionField |
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected boolean pendingEdits
protected AggregateUpdate updates
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.
protected long userID
protected java.util.Locale locale
protected java.lang.String displayContext
protected java.lang.Object displayState
protected java.util.Map parameterMap
UIRenderInput, but is not required to.
protected boolean[] supportedActions
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.
protected java.lang.String selectionField
protected java.lang.String openLocation
| Constructor Detail |
public UIFormContext()
| Method Detail |
public boolean hasPendingEdits()
public boolean getPendingEdits()
public void setPendingEdits(boolean val)
public AggregateUpdate getUpdates()
public void setUpdates(AggregateUpdate val)
public void trimLastUpdate()
public long getUserID()
public void setUserID(long ID)
public java.util.Locale getLocale()
public void setLocale(java.util.Locale loc)
public java.lang.String getDisplayContext()
public void setDisplayContext(java.lang.String val)
public java.lang.Object getDisplayState()
public void setDisplayState(java.lang.Object val)
public java.util.Map getParameterMap()
public void setParameterMap(java.util.Map pmap)
public java.lang.String getParam(java.lang.String key)
public boolean[] getSupportedActions()
public void setSupportedActions(boolean[] val)
If the array given is null, or the length of the array is not ACTION_HELP+1, then the call is ignored.
public boolean actionSupported(int action)
if(actionSupported(UIFormContext.ACTION_HELP))
public void disableAction(int action)
formContext.disableAction(UIFormContext.ACTION_HELP)
public void disableActionsFromContext()
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.
public java.lang.String getSelectionField()
public void setSelectionField(java.lang.String val)
public java.lang.String getOpenLocation()
public void setOpenLocation(java.lang.String val)
public void init()
init in class UIFormInitializerpublic int getMode()
public java.lang.String getModePath()
public void setModePath(java.lang.String path)
public void initPosition(java.lang.String pos)
public java.lang.String getPositionPath()
public void setPositionPath(java.lang.String pos)
public java.lang.String getFindKeysPath()
public void setFindKeysPath(java.lang.String path)
public void addOutputText(java.lang.String text)
public static void debugDump(UIFormContext uifc)
public static void debugDump(java.lang.String headerline,
UIFormContext uifc)
public static java.lang.String dumpQuery(SandQueryMessage sqm)
public static java.lang.String dumpUIFormQuery(UIFormQuery uiq)
public static void debugout(java.lang.String text)
public java.lang.String getDisplayClass()
public SandInstanceMessage getCurrentParent()
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.
public SandInstanceMessage getCurrentObject()
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.
public SandInstanceMessage getInstanceAtPosition(SandInstanceMessage source,
int index)
public java.lang.String getCurrentField()
public java.lang.String getLastPositionEntry()
public int getCurrentFieldIndex()
public void upOneLevel()
public void evalPosition()
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.
public boolean atTopLevel()
public void normalizeReferences()
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.
public void resolveTransactionResults(AggregateUpdate oldUpdate,
AggregateUpdate newUpdate,
java.lang.String source)
public boolean isFormManagerAction()
public boolean isUninitialized()
public boolean isCollectionView()
public boolean isFindCollectionView()
public void resetToCollection()
public void initCollectionDisplay(java.lang.String dispClass,
SandCollectionMessage coll)
public void initInstanceDisplay(SandInstanceMessage sim)
public void addCurrInstToParentColl()
This method does not check if the currInst matches the parameters in the find query. There are two reasons for this:
public UIFormContext cloneContext()
public void copyValuesFrom(UIFormContext uifc)
public static java.lang.String removeArrayIndex(java.lang.String value)
public static java.lang.String getArraySuffix(java.lang.String value)
public static int getArrayIndex(java.lang.String posentry)
public static java.lang.String getAccessMethodForField(java.lang.String field)
public static java.lang.String getSetMethodForField(java.lang.String field)
public static java.lang.String getArraySetMethodForField(java.lang.String field)
public static java.lang.String getInsertMethodForField(java.lang.String field)
public static java.lang.String getAppendMethodForField(java.lang.String field)
public static java.lang.String getRemoveMethodForField(java.lang.String field)
public SandInstanceMessage getReferencedObject(SandInstanceMessage obj,
java.lang.String posentry)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||