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 java.lang.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
 com.webobjects.appserver.WOComponent currentComponent()
          Returns the current component.
 com.webobjects.appserver.WOComponent nextPage(com.webobjects.appserver.WOComponent sender)
          Calls up nextPageFrom + pageName()
 com.webobjects.appserver.WOComponent page()
          Returns the current page.
protected
<T> T
page(java.lang.Class<? extends T> clazz)
          Returns the page cast as the supplied clazz.
protected  java.lang.String pageName()
          Returns either the pageConfiguration of the topmost page or the name of the topmost page.
protected
<T> T
parent(java.lang.Class<? extends T> clazz)
          Returns the innermost enclosing component that extends the supplied clazz.
 com.webobjects.appserver.WOSession session()
          Returns the session.
protected  void setCurrentComponent(com.webobjects.appserver.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(com.webobjects.appserver.WOComponent current)
Set the current component.

Parameters:
current -

currentComponent

public com.webobjects.appserver.WOComponent currentComponent()
Returns the current component.


page

public com.webobjects.appserver.WOComponent page()
Returns the current page.


session

public com.webobjects.appserver.WOSession session()
Returns the session.


parent

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

Type Parameters:
T -
Parameters:
clazz -

page

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

Type Parameters:
T -
Parameters:
clazz -

pageName

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


nextPage

public final com.webobjects.appserver.WOComponent nextPage(com.webobjects.appserver.WOComponent sender)
Calls up nextPageFrom + pageName()

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

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.