Expresso 5-6

com.jcorporate.expresso.services.controller.ui
Interface AutoControllerElement

All Known Implementing Classes:
DefaultAutoElement

public interface AutoControllerElement

This interface is for objects that provide an automatic rendering capability to the system. It's in sort of a way a bridge between DBObjects and ControllerElements

Since:
Expresso 5.0
Author:
Michael Rimov, portions from Adam Rossi, Michael Nash, Shash Chatterjee

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.
 String getErrorStyle()
          Allows for easy overriding fo the style name for special customization.
 String getNormalStyle()
          Allows for easy overriding of the style name for special customization
 String getRequiredStyle()
          Allows for easy overriding fo the style name for special customization.
 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)
           
 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 defaultValue, boolean readOnly)
          Renders an Input in a update method per field name.
 

Method Detail

renderDBObjectField

public Input renderDBObjectField(ControllerResponse response,
                                 DataObject dbobj,
                                 String fieldName,
                                 String defaultValue,
                                 boolean readOnly)
                          throws ControllerException
Renders an Input in a update method per field name.

Parameters:
response - a ControllerResponse Object
dbobj - A DBObject to transform into an Input
fieldName - the name of the field to render
defaultValue - the default value to use in the field
readOnly - true if the Input should be a read only input.
Returns:
an instantiated Input object
Throws:
ControllerException

createDBObjectBlock

public Block createDBObjectBlock(ControllerRequest request,
                                 ControllerResponse response,
                                 DataObject dbobj)
                          throws ControllerException
Creates a DBObject Block that contains all the non-secret fields for the DBObject. The Block will have a nested Output that matches DBObject's description unless one is not supplied in which case the nested Output will have the title "Untitled"

Parameters:
response - a ControllerResponse Object
request - The ControllerRequest Object
dbobj - The dbObject to automatically render.
Returns:
an instantiated DBObject block based upon the parameters
Throws:
ControllerException - if there's an error rendering the DBObject

createDBObjectBlock

public Block createDBObjectBlock(ControllerRequest request,
                                 ControllerResponse response,
                                 String title,
                                 DataObject dbobj)
                          throws ControllerException
Creates a DBObject Block that contains all the non-secret fields for the DBObject.

Parameters:
response - a ControllerResponse Object
request - The ControllerRequest Object
title - 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.
Returns:
an instantiated DBObject block based upon the parameters
Throws:
ControllerException - if there's an error rendering the DBObject

parseBlock

public DataObject parseBlock(ControllerRequest request,
                             DataObject oneObject,
                             ErrorCollection ec)
                      throws ControllerException
Convienence method if you only expect one DBObject to be returned from a particular form.

Parameters:
request - The ControllerRequest object handed down by the framework
oneObject - A single DBObject to fill into fill out from the block.
ec - An instantiated ErrorCollection that is filled in with any error
Returns:
an instatiated DBObject
Throws:
ControllerException - if there's an error parsing the block or communicating with the underlying DBObject
IllegalArgumentException - if request, DBObjectNames, or ec is null

parseDBObject

public DataObject parseDBObject(ControllerRequest request,
                                DataObject oneObject,
                                ErrorCollection ec)
                         throws ControllerException
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. This is similar to the ControllerRequest validateDBObject functionality, but we're consolodating things here.

Parameters:
request - The ControllerRequest object handed down by the framework
oneObject - a Single DBObject to fill out.
ec - An instantiated ErrorCollection that is filled in with any error
Returns:
an instatiated DBObject
Throws:
ControllerException - if there's an error parsing the block or communicating with the underlying DBObject
IllegalArgumentException - if request, DBObjectNames, or ec is null

parseDBObject

public DataObject parseDBObject(ControllerRequest request,
                                DataObject oneObject,
                                ErrorCollection ec,
                                boolean validate)
                         throws ControllerException
Throws:
ControllerException

parseBlocks

public DataObject[] parseBlocks(ControllerRequest request,
                                DataObject[] theObjects,
                                ErrorCollection ec)
                         throws ControllerException
Parses the appropriate DBObject from the block. Returns the fully constructed DBOBject including any errors in the DBObject

Parameters:
request - The ControllerRequest object handed down by the framework
theObjects - 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
Returns:
an array of DBObjects
Throws:
ControllerException - if there's an error parsing the block or communicating with the underlying DBObject

parseSingleInput

public String parseSingleInput(ControllerRequest request,
                               DataObject dbobj,
                               String fieldName,
                               String parameterName,
                               ErrorCollection ec)
                        throws ControllerException
Takes the Controller Request and appropriately parses a string for a particular field. If the field is a Date, then it parses it as such, if it is money, then it perses it as such. Etc.

Parameters:
request - the ControllerRequest object
fieldName - the name of the field to parse
dbobj - The DBObject for which we're going to put the field to
parameterName - 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 gets filled out by the function.
Returns:
an properly parsed String
Throws:
ControllerException - if there's an error parsing the block or communicating with the underlying DBObject

getNormalStyle

public String getNormalStyle()
                      throws ControllerException
Allows for easy overriding of the style name for special customization

Returns:
a String naming the CSS class to use under normal circumstanes.
Throws:
ControllerException

getRequiredStyle

public String getRequiredStyle()
                        throws ControllerException
Allows for easy overriding fo the style name for special customization.

Returns:
a String naming the CSS class to use to render required fields.
Throws:
ControllerException

getErrorStyle

public String getErrorStyle()
                     throws ControllerException
Allows for easy overriding fo the style name for special customization.

Returns:
the class name that is used for error conditions.
Throws:
ControllerException

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.