|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.services.controller.ui.DefaultAutoElement
Default implementation of the AutoController Element. Provides a default unified method for rendering/parsing Inputs from DBObjects
| Field Summary | |
static String |
BLOCK_TITLE
|
static String |
CLASS_HANDLER_NAME
|
static String |
DBOBJECT_LABEL
|
static String |
DEFAULT_CLASS_HANDLER
|
static String |
DEFAULT_STYLE
|
static String |
ERROR_STYLE
|
protected static org.apache.log4j.Logger |
log
|
static String |
REQUIRED_STYLE
|
static String |
SESSION_KEY
|
protected static AutoControllerElement |
theDefault
singleton instance |
| Constructor Summary | |
protected |
DefaultAutoElement()
The constructor here is protected. |
| Method Summary | |
Block |
createDBObjectBlock(ControllerRequest request,
ControllerResponse response,
DataObject dbobj)
Creates a DBObject Block that contains all the non-secret fields for the DBObject. |
Block |
createDBObjectBlock(ControllerRequest request,
ControllerResponse response,
String title,
DataObject dbobj)
Creates a DBObject Block that contains all the non-secret fields for the DBObject. |
protected String |
displayValue(DataFieldMetaData metaData,
Date dt,
Locale l)
Same as display value but for Date/DateTime types. |
protected String |
displayValue(DataFieldMetaData metaData,
String fieldValue,
String fieldName,
Locale l)
Format a value for display in the HTML being returned to the client |
static AutoControllerElement |
getAutoControllerElement()
Constructor. |
String |
getErrorStyle()
Returns the style to be used if the Input field has an error with it. |
String |
getNormalStyle()
Returns the style to be used if the input has normal non-required characteristics |
String |
getRequiredDecorator()
Returns the string to append to a field label if it is required. |
String |
getRequiredStyle()
Returns the style to be used if the Input is required |
DataObject |
parseBlock(ControllerRequest request,
DataObject oneObject,
ErrorCollection ec)
Convienence method if you only expect one DBObject to be returned from a particular form. |
DataObject[] |
parseBlocks(ControllerRequest request,
DataObject[] theObjects,
ErrorCollection ec)
Parses the appropriate DBObject from the block. |
DataObject |
parseDBObject(ControllerRequest request,
DataObject oneObject,
ErrorCollection ec)
Convienence method if you only expect one DBObject to be returned from a particular form, and unlike the ParseBlock, there is no DBOBject name prefix attached to the parameter names. |
DataObject |
parseDBObject(ControllerRequest request,
DataObject oneObject,
ErrorCollection ec,
boolean validate)
Parses a dbobject |
String |
parseSingleInput(ControllerRequest request,
DataObject dbobj,
String fieldName,
String parameterName,
ErrorCollection ec)
Takes the Controller Request and appropriately parses a string for a particular field. |
Input |
renderDBObjectField(ControllerResponse response,
DataObject dbobj,
String fieldName,
String cachedValue,
boolean readOnly)
Renders a DBOBject Field as either an Input or an Output. |
protected Input |
renderReadOnlyInput(ControllerResponse response,
Input oneField,
DataObject dbobj,
String fieldName,
String oneFieldValue)
Modifies an already instantiated Input to be a finished read only control. |
protected void |
renderReadWriteBlob(ControllerResponse response,
Input oneField,
DataObject dbobj,
String fieldName,
String oneFieldValue,
String oneFieldSize)
Modifies an already instantiated Input to be a finished Input control specifically for a blob field. |
protected Input |
renderReadWriteInput(ControllerResponse response,
Input oneField,
DataObject dbobj,
String fieldName,
String oneFieldValue,
String oneFieldSize)
Modifies an already instantiated Input to be a finished Input control |
protected void |
retrieveCachedValueInForm(ControllerResponse response,
String oneFieldName,
Input i)
Used to set values in created db objects to the values found (if any) in the form cache. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static AutoControllerElement theDefault
public static final String CLASS_HANDLER_NAME
public static final String DEFAULT_CLASS_HANDLER
public static final String DEFAULT_STYLE
public static final String REQUIRED_STYLE
public static final String ERROR_STYLE
protected static org.apache.log4j.Logger log
public static final String SESSION_KEY
public static final String DBOBJECT_LABEL
public static final String BLOCK_TITLE
| Constructor Detail |
protected DefaultAutoElement()
| Method Detail |
public static AutoControllerElement getAutoControllerElement()
throws ControllerException
ControllerException - upon errorpublic String getErrorStyle()
getErrorStyle in interface AutoControllerElementpublic String getNormalStyle()
getNormalStyle in interface AutoControllerElementpublic String getRequiredDecorator()
public String getRequiredStyle()
getRequiredStyle in interface AutoControllerElement
public Block createDBObjectBlock(ControllerRequest request,
ControllerResponse response,
DataObject dbobj)
throws ControllerException
createDBObjectBlock in interface AutoControllerElementresponse - The ControllerResponse objectrequest - The ControllerRequest Objectdbobj - The dbObject to automatically render.
ControllerException - if there's an error rendering the DBObject
public Block createDBObjectBlock(ControllerRequest request,
ControllerResponse response,
String title,
DataObject dbobj)
throws ControllerException
createDBObjectBlock in interface AutoControllerElementresponse - The ControllerResponse objectrequest - The ControllerRequest Objecttitle - The title to give this block. The system renders a nested
Output called "block-title" for the block that contains this
data.dbobj - The dbObject to automatically render.
ControllerException - if there's an error rendering the DBObject
protected void retrieveCachedValueInForm(ControllerResponse response,
String oneFieldName,
Input i)
throws ControllerException
response - ?oneFieldName - ?i - The Input to retrieve.
ControllerExceptionCacheAutoElement
public DataObject parseBlock(ControllerRequest request,
DataObject oneObject,
ErrorCollection ec)
throws ControllerException
parseBlock in interface AutoControllerElementrequest - The ControllerRequest object handed down by the frameworkoneObject - a single dbobject ro dumpt the parsed values into.ec - An instantiated ErrorCollection that is filled in with any
error
ControllerException - if there's an error parsing the block or
communicating with the underlying DBObject
public DataObject[] parseBlocks(ControllerRequest request,
DataObject[] theObjects,
ErrorCollection ec)
throws ControllerException
parseBlocks in interface AutoControllerElementrequest - The ControllerRequest object handed down by the frameworktheObjects - A pre-instantiated group of DBObjects in which you
expect to have the fields overwritten/filled. By using
instantiated DBObjects, you can pre-fill any potentially blank
fields and thus remove any Errors.ec - An instantiated ErrorCollection that is filled in with any
error
ControllerException - if there's an error parsing the block or
communicating with the underlying DBObject
IllegalArgumentException - if request, theObjects, or ec is null
public DataObject parseDBObject(ControllerRequest request,
DataObject oneObject,
ErrorCollection ec,
boolean validate)
throws ControllerException
parseDBObject in interface AutoControllerElementrequest - The ControllerRequest that contains all the parameters
for parsing.oneObject - The DBObject to populate.ec - An error Collection to send in for any parsing errors to be
saved to.validate - Set to true if you want the DBObject validated.
Sometimes, like for the DBMaint search form, this is not a
desired feature.
IllegalArgumentException - upon data exception.
ControllerException - upon controller-related error.
public DataObject parseDBObject(ControllerRequest request,
DataObject oneObject,
ErrorCollection ec)
throws ControllerException
parseDBObject in interface AutoControllerElementrequest - The ControllerRequest object handed down by the frameworkoneObject - A DBObject to fill in.ec - An instantiated ErrorCollection that is filled in with any
error
ControllerException - if there's an error parsing the block or
communicating with the underlying DBObject
public String parseSingleInput(ControllerRequest request,
DataObject dbobj,
String fieldName,
String parameterName,
ErrorCollection ec)
throws ControllerException
DataObject.getFieldData(fieldName).getAttribute(attribName);
new
File(fileName) to actually access the uploaded file
parseSingleInput in interface AutoControllerElementrequest - The ControllerRequest objectdbobj - The DBObject for which we're going to put the field tofieldName - The name of the field to parseparameterName - The name of the http paramter to parse May be null
in which case, the funciton will by default use the fieldName as
the parameter name.ec - An instantiated ErrorCollection object that will be filled
with any parsing errors that may be encountered.
ControllerException - upon parsing error
public Input renderDBObjectField(ControllerResponse response,
DataObject dbobj,
String fieldName,
String cachedValue,
boolean readOnly)
throws ControllerException
renderDBObjectField in interface AutoControllerElementresponse - The ControllerResponse objectdbobj - The parameter to renderfieldName - The name of the field to rendercachedValue - Any cached form value to put in the field.readOnly - - If set to true, then this is automatically a read-only
field... if set to false, this function might still render the
field as read-only if, for example, it's a key field.
ControllerException - if there's an error creating the Input Field
protected String displayValue(DataFieldMetaData metaData,
Date dt,
Locale l)
metaData - the Data Field's metadatadt - The date value to formatl - the User's Locale gathered from the ControllerResponse object
protected String displayValue(DataFieldMetaData metaData,
String fieldValue,
String fieldName,
Locale l)
throws ControllerException
metaData - The Field MetadatafieldValue - The value of the fieldfieldName - the name of the field to renderl - The Locale to display the value for.
ControllerException - If the field format information could not be
determined
protected Input renderReadOnlyInput(ControllerResponse response,
Input oneField,
DataObject dbobj,
String fieldName,
String oneFieldValue)
throws DBException,
ControllerException
response - The ControllerResponse objectoneField - The input to flesh out.dbobj - The data source objectfieldName - The field name in the dbobj to render.oneFieldValue - The value to add to the input control.
DBException - if there's an error communicating with the DBObject
ControllerException - if there's an error building the Input
field.
protected void renderReadWriteBlob(ControllerResponse response,
Input oneField,
DataObject dbobj,
String fieldName,
String oneFieldValue,
String oneFieldSize)
throws DBException,
ControllerException
response - The ControllerResponse objectoneField - The input to flesh out.dbobj - The data source objectfieldName - The field name in the dbobj to render.oneFieldValue - The value to add to the input control.oneFieldSize - The size of the Input control when finished.
DBException - if there's an error communicating with the DBObject
ControllerException - if there's an error building the Input
field.
protected Input renderReadWriteInput(ControllerResponse response,
Input oneField,
DataObject dbobj,
String fieldName,
String oneFieldValue,
String oneFieldSize)
throws DBException,
ControllerException
response - The ControllerResponse objectoneField - The input to flesh out.dbobj - The data source objectfieldName - The field name in the dbobj to render.oneFieldValue - The value to add to the input control.oneFieldSize - The size of the Input control when finished.
DBException - if there's an error communicating with the DBObject
ControllerException - if there's an error building the Input
field.
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||