org.sandev.basics.util
Interface UIFormAdaptorCallback

All Superinterfaces:
IDLookup, NameLookup, UIFileLocator
All Known Subinterfaces:
UIFormOwner

public interface UIFormAdaptorCallback
extends IDLookup, NameLookup, UIFileLocator

Callback interface for UIFormAdaptor providing IDLookup, NameLookup, and dynamic form processing functions.


Method Summary
 void doActionAddHook(UIFormContext uifc)
          Given the UIFormContext which will be used to present a new form for the user to fill out, preprocess as needed before returning control to the UIFormManager.
 void doActionCancelHook(UIFormContext uifc)
          Given the UIFormContext that is being used for adding a new instance or editing an existing instance, preprocess as needed before returning control to the UIFormManager.
 void doActionDeleteHook(UIFormContext uifc)
          Given the UIFormContext that is being used for deleting the current instance, preprocess as needed before returning control to the UIFormManager.
 void doActionDisplayHook(UIFormContext uifc)
          Given the UIFormContext that will be used to present a form for displaying an existing instance, preprocess as needed before returning control to the UIFormManager.
 void doActionEditHook(UIFormContext uifc)
          Given the UIFormContext which will be used to present a form for editing an existing instance, preprocess as needed before returning control to the UIFormManager.
 void doActionFindHook(UIFormContext uifc)
          Given the UIFormContext reconstructed on an ACTION_FIND, preprocess as needed before returning control to the UIFormManager.
 java.lang.String filterDisplayText(java.lang.String text)
          Given the source text for display, perform any alterations that are necessary and return the result.
 java.util.Map filterInputParameters(java.lang.String prefix, java.util.Map params, FormOutput outText)
          Given a map of input parameters, filter as necessary and return the result.
 java.lang.String getFieldPrintname(java.lang.String field, SandInstanceMessage msg, java.util.Locale locale)
          Given a field name and an instance of the message that field is defined for, return a print representation of the field.
 ArrayAssociation getSelectionValues(SandInstanceMessage msg, java.lang.String fieldname, AuthUser user)
          Return a matched set of arrays to be used for selecting a field value for the given field name in the given SandInstanceMessage.
 void log(int severity, java.lang.String msg)
          Log the given text at the given Logger severity level.
 int stdActionFromText(java.lang.String actionText)
          Given action text from stdActionToText, translate it back to a standard action value.
 java.lang.String stdActionToText(int action, UIFormContext uifc)
          Given a standard action value, return the text used when displaying it.
 java.lang.String verifyDefaultAction(java.lang.String currAction, UIFormContext uifc, java.lang.String formName)
          Given the current default action for the form, return the name of the default action.
 java.lang.String verifyDefaultScreen(java.lang.String defaultScreen, AuthUser user, java.lang.String[] screens, java.util.Map params)
          Return the name of the default screen to be presented.
 SandAttrVal[] verifyGeneralInfo(SandAttrVal[] generalInfo, AuthUser user)
          Return an array of general information to be made globally available in display processing.
 
Methods inherited from interface org.sandev.basics.util.IDLookup
getInstance
 
Methods inherited from interface org.sandev.basics.util.NameLookup
getInstance
 
Methods inherited from interface org.sandev.basics.util.UIFileLocator
getInboundFilesDir, getInboundFilesLink, getOutboundFilesDir, getOutboundFilesLink, setInboundFilesLink, setOutboundFilesLink
 

Method Detail

getSelectionValues

ArrayAssociation getSelectionValues(SandInstanceMessage msg,
                                    java.lang.String fieldname,
                                    AuthUser user)
Return a matched set of arrays to be used for selecting a field value for the given field name in the given SandInstanceMessage. Returns null if no translation is available. The keyValues in the array are the actual assignment values, while the transValues are the values for the selection display.

A UIFormAdaptor will render the field selection for editing using the display text. On reconstruction, the message field value will be set by looking up the corresponding real value for the selected display text value. If this method returns null, then the default rendering/reconstruction for that field type is used.


getFieldPrintname

java.lang.String getFieldPrintname(java.lang.String field,
                                   SandInstanceMessage msg,
                                   java.util.Locale locale)
Given a field name and an instance of the message that field is defined for, return a print representation of the field.


stdActionToText

java.lang.String stdActionToText(int action,
                                 UIFormContext uifc)
Given a standard action value, return the text used when displaying it. The standard actions are defined by the UIFormInitializerStruct action field definitions. If this method returns null, then the default text value is used. It must be possible to translate the returned text back into an action value via stdActionFromText.

The given UIFormContext parameter may be null, which happens for things like the SELECT action where the overall context may not be readily available or relevant to the display processing.


stdActionFromText

int stdActionFromText(java.lang.String actionText)
Given action text from stdActionToText, translate it back to a standard action value. If this method returns a value less than zero, then the text will be translated using the default action print values.


doActionFindHook

void doActionFindHook(UIFormContext uifc)
Given the UIFormContext reconstructed on an ACTION_FIND, preprocess as needed before returning control to the UIFormManager.


doActionAddHook

void doActionAddHook(UIFormContext uifc)
Given the UIFormContext which will be used to present a new form for the user to fill out, preprocess as needed before returning control to the UIFormManager.


doActionEditHook

void doActionEditHook(UIFormContext uifc)
Given the UIFormContext which will be used to present a form for editing an existing instance, preprocess as needed before returning control to the UIFormManager.


doActionDisplayHook

void doActionDisplayHook(UIFormContext uifc)
Given the UIFormContext that will be used to present a form for displaying an existing instance, preprocess as needed before returning control to the UIFormManager.


doActionCancelHook

void doActionCancelHook(UIFormContext uifc)
Given the UIFormContext that is being used for adding a new instance or editing an existing instance, preprocess as needed before returning control to the UIFormManager.


doActionDeleteHook

void doActionDeleteHook(UIFormContext uifc)
Given the UIFormContext that is being used for deleting the current instance, preprocess as needed before returning control to the UIFormManager.


filterDisplayText

java.lang.String filterDisplayText(java.lang.String text)
Given the source text for display, perform any alterations that are necessary and return the result. If you don't need to do any filtering of text, then just return the given value.

This method is intended to support things like remapping of URLs within text, filtering of words in descriptions and other similar low level text manipulation as required. It is not intended for general display level presentation remapping, use template transformation for that.


filterInputParameters

java.util.Map filterInputParameters(java.lang.String prefix,
                                    java.util.Map params,
                                    FormOutput outText)
                                    throws UIFormAdaptorException
Given a map of input parameters, filter as necessary and return the result. If you don't need to do any filtering of the input, then just return the given map. Use the FormOutput for reporting soft errors, in the event of a hard error this method should throw. Parameters are keyed off prefix + name (interned). There is one call to this method for each top level message load in the UIFormContext. The prefix varies accordingly.

This method is not intended for general display level presentation parsing, it exists to provide a hook for specific parameters that may need to be rationalized or sanitized for before normal processing starts.

Throws:
UIFormAdaptorException

verifyDefaultAction

java.lang.String verifyDefaultAction(java.lang.String currAction,
                                     UIFormContext uifc,
                                     java.lang.String formName)
                                     throws UIFormAdaptorException
Given the current default action for the form, return the name of the default action. The returned value may be
  1. The given currAction default value, which may be null. Returning null means no default action is specified.
  2. The name of a standard button as returned by stdActionToText.
  3. The name of a custom action defined for the given form context (The actual action name value, not the display value).
  4. The button id, name and value in CSV format.

    The last option breaks display encapsulation somewhat, but it allows the app to set the default button to any input control with an id, even input controls that are not part of SAND forms. In this case the application is also responsible for ensuring that the specified button is authorized and currently displayed. The recommended format is the button id (in double quotes), followed by a comma, followed by the button name (in double quotes), followed by a comma, followed by the button value (in double quotes).

    Throws:
    UIFormAdaptorException

verifyDefaultScreen

java.lang.String verifyDefaultScreen(java.lang.String defaultScreen,
                                     AuthUser user,
                                     java.lang.String[] screens,
                                     java.util.Map params)
                                     throws UIFormAdaptorException
Return the name of the default screen to be presented. The given default is typically the first defined entry point, which for many applications can simply be returned. Otherwise the callback can choose one of the screens from the given array based on the user or other information.

Throws:
UIFormAdaptorException

verifyGeneralInfo

SandAttrVal[] verifyGeneralInfo(SandAttrVal[] generalInfo,
                                AuthUser user)
Return an array of general information to be made globally available in display processing. The given information can be returned directly if no other information is needed.


log

void log(int severity,
         java.lang.String msg)
Log the given text at the given Logger severity level.