er.directtoweb
Class ERD2WControllerFactory
java.lang.Object
com.webobjects.directtoweb.D2W
er.directtoweb.ERD2WFactory
er.directtoweb.ERD2WControllerFactory
- public class ERD2WControllerFactory
- extends ERD2WFactory
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.
Nested classes inherited from class com.webobjects.directtoweb.D2W |
D2W._Observer |
Methods inherited from class er.directtoweb.ERD2WFactory |
_entityNameFromPage, _pageConfigurationFromPage, _taskFromPage, csvExportPageForD2WContext, defaultListPageDisplayGroupDelegate, defaultPage, editPageForNewObjectWithConfigurationNamed, editPageForNewObjectWithEntityNamed, entityNameFromPage, erFactory, errorPageForException, myCheckRules, pageConfigurationFromPage, pageForConfigurationNamed, pageForTaskAndEntityNamed, pageForTaskSubTaskAndEntityNamed, printerFriendlyPageForD2WContext, privateContext, queryPageWithFetchSpecificationForEntityNamed, setDefaultListPageDisplayGroupDelegate, taskFromPage, visibleEntityNames |
Methods inherited from class com.webobjects.directtoweb.D2W |
_applicationDidFinishLaunching, _applicationWillFinishLaunching, _init, activateWebAssistantServer, checkMultithreading, confirmPageForEntityNamed, editPageForEntityNamed, editRelationshipPageForEntityNamed, errorPage, errorPage, factory, homeHrefInContext, init, inspectPageForEntityNamed, isLiveAssistantEnabled, isWebAssistantEnabled, listPageForEntityNamed, newSignificantKey, packetForPropertyAndSettingsWithPage, packetForSettingsWithPage, pageForTaskAndEntityNamed, queryAllPage, queryPageForEntityNamed, requestWasHandled, selectPageForEntityNamed, setFactory, setLiveAssistantEnabled, setWebAssistantEnabled, traceRuleFiringEnabled, traceRuleModificationsEnabled, visibleEntityNames, webAssistantInContext, willCheckRules |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ERD2WControllerFactory
public ERD2WControllerFactory()
- Public constructor
controllerFactory
public static ERD2WControllerFactory controllerFactory()
- Gets the D2W factory cast as an ERD2WControllerFactory object.
- Returns:
- the singleton factory
controllerInstanceWithContext
protected ERD2WControllerFactory.ERD2WController controllerInstanceWithContext(D2WContext d2wContext)
controllerForName
public ERD2WControllerFactory.ERD2WController controllerForName(String controllerName,
WOSession session)
controllerForTaskAndEntityNamed
public ERD2WControllerFactory.ERD2WController controllerForTaskAndEntityNamed(String task,
String entityName,
WOSession session)
Copyright © 2002 – 2004 Project Wonder.