ERD2WControllerFactory Class Reference

Inherits er::directtoweb::ERD2WFactory.

Collaboration diagram for ERD2WControllerFactory:

Collaboration graph
[legend]

List of all members.

Classes

class  ERCCore
class  ERCCreate
class  ERCEdit
class  ERCInspect
class  ERCQuery
class  ERCSingleObject
class  ERD2WController

Public Member Functions

ERD2WController controllerForName (String controllerName, WOSession session)
ERD2WController controllerForTaskAndEntityNamed (String task, String entityName, WOSession session)
 ERD2WControllerFactory ()

Static Public Member Functions

static ERD2WControllerFactory controllerFactory ()

Protected Member Functions

ERD2WController controllerInstanceWithContext (D2WContext d2wContext)

Static Private Attributes

static final Logger log = Logger.getLogger(ERD2WControllerFactory.class)


Detailed Description

ERD2WControllerFactory a an enhancement of the D2W factory class with the notion of "Processes".
A Process - or controller is an abstraction of a sequence of pages. For example, when you want to edit an object, you start at the edit page, make your change, save, get a confirmation page and finally go back to where you started.
The major benefit against simply using pageConfigurations and NextPageDelegates is that it is very confusing to link them together in a flow of pages. The second benefit is that it inherits from branchDelegate, which lets you make up a very flexible UI, you can have page-level actions mixed into the property repetitions for example. Also, you get much more control of the flow of complex tasks where you simply would get lost when you use bare NextPageDelegates and you can more easily create custom pages in between the flow. And finally, they make for great re-use and testing, because you can simply fake the actions the user took.
Controllers are instatiated via something like:
 public WOActionResults TestEditAction() {
     ERD2WControllerFactory.ERCCreate erc = (ERD2WControllerFactory.ERCCreate)ERD2WControllerFactory.controllerFactory().controllerForName("CreateUser", session());
     erc.setFinalPage(previousPageFromRequest());
     erc.setPrimaryKeyValue(primaryKeyFromRequest());
     return (WOActionResults)erc.firstPage();
 }
 
They can be subclassed and you can change the flow of your app without the need to create subclasses of your pages - which spares you the hassle to deal with the duplicated HTML. A controller gets instantiated via a D2W rule like:
(controllerName = "EditDocument") => controllerClassName = "er.directtoweb.ERD2WControllerFactory$ERCEdit"
and you might need supporting wildcard rules like the one for the pageConfigurations. Also, rules like:
controllerName <> null => pageConfiguration = controllerName [KeyValueAssignment] [0]
will spare you a lot of work.

The ERD2WControllerFactory is not heavily tested and the API might change. Especially that the controller subclasses are inner classes of this factory is subject to change. Feedback would be very welcome.

Author:
ak on Tue Apr 08 2003 AHApp pageConfiguration

Constructor & Destructor Documentation

Public constructor


Member Function Documentation

static ERD2WControllerFactory controllerFactory (  )  [static]

Gets the D2W factory cast as an ERD2WControllerFactory object.

Returns:
the singleton factory

ERD2WController controllerForName ( String  controllerName,
WOSession  session 
)

ERD2WController controllerForTaskAndEntityNamed ( String  task,
String  entityName,
WOSession  session 
)

ERD2WController controllerInstanceWithContext ( D2WContext  d2wContext  )  [protected]


Member Data Documentation

final Logger log = Logger.getLogger(ERD2WControllerFactory.class) [static, private]

logging support

Reimplemented from ERD2WFactory.


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:42:48 2012 for Project Wonder by  doxygen 1.5.8