Project Wonder 5.0

er.directtoweb.delegates
Class ERDFlowDelegate

java.lang.Object
  extended by er.directtoweb.delegates.ERDFlowDelegate
All Implemented Interfaces:
com.webobjects.directtoweb.NextPageDelegate

public class ERDFlowDelegate
extends Object
implements com.webobjects.directtoweb.NextPageDelegate

Simple class that makes creating flows of pages a bit easier. Instead of the normal (sender instanceof ...) in nextPage(), you can implement methods nextPageFromSomePageConfiguration() or nextPageFromPageNameOfCurrentPage(). For example:

 public class CreateAssetWithSelectionDelegate extends ERDFlowDelegate {
          
    public WOComponent nextPageFromSelectAssetGroups() {
        ERD2WListPage page = parent(ERD2WListPage.class)
        if(page.selectedObjects().count() > 0)
           ...
           return D2W.factory.pageForConfigurationNamed("CreateAsset");
        return page.pageWithName("MaybeNextTimePage");
    }
    
    public WOComponent nextPageFromCreateAsset() {
        ERD2WInspectPage page = parent(ERD2WInspectPage.class)
        if(page.wasObjectSaved())
           return page.pageWithName("ThankYouPage");
        return page.pageWithName("MaybeNextTimePage"); 
    }
 }
 
 ...
   D2WPage page = D2W.factory.pageForConfigurationNamed("SelectAssetGroups");
   page.setNextPageDelegate(new CreateAssetWithSelectionDelegate())
 ...
 
 

Author:
ak

Constructor Summary
ERDFlowDelegate()
           
 
Method Summary
 WOComponent currentComponent()
          Returns the current component.
 WOComponent nextPage(WOComponent sender)
          Calls up nextPageFrom + pageName()
 WOComponent page()
          Returns the current page.
protected
<T> T
page(Class<? extends T> clazz)
          Returns the page cast as the supplied clazz.
protected  String pageName()
          Returns either the pageConfiguration of the topmost page or the name of the topmost page.
protected
<T> T
parent(Class<? extends T> clazz)
          Returns the innermost enclosing component that extends the supplied clazz.
 WOSession session()
          Returns the session.
protected  void setCurrentComponent(WOComponent current)
          Set the current component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ERDFlowDelegate

public ERDFlowDelegate()
Method Detail

setCurrentComponent

protected void setCurrentComponent(WOComponent current)
Set the current component.

Parameters:
current -

currentComponent

public WOComponent currentComponent()
Returns the current component.


page

public WOComponent page()
Returns the current page.


session

public WOSession session()
Returns the session.


parent

protected <T> T parent(Class<? extends T> clazz)
Returns the innermost enclosing component that extends the supplied clazz.

Type Parameters:
T -
Parameters:
clazz -

page

protected <T> T page(Class<? extends T> clazz)
Returns the page cast as the supplied clazz.

Type Parameters:
T -
Parameters:
clazz -

pageName

protected String pageName()
Returns either the pageConfiguration of the topmost page or the name of the topmost page.


nextPage

public final WOComponent nextPage(WOComponent sender)
Calls up nextPageFrom + pageName()

Specified by:
nextPage in interface com.webobjects.directtoweb.NextPageDelegate

Last updated: Wed, Feb 22, 2012 • 07:00 AM EST

Copyright © 2002 – 2011 Project Wonder.