Hi Joe,

On 2010-11-17, at 9:15 AM, Joe Kramer wrote:

> Hi All,
> 
> I'm trying my first D2W app... This should be easy to find, and I'm almost 
> embarrassed to ask, but I need to get this working ASAP.

Never be embarrassed to ask anything related to D2W :-) It is a complex topic 
that will take you awhile to get your head around.  What follows assumes you 
are using ModernLook and Wonder.

>  I'm wondering how to make it so that you can create new entities from the 
> list page.

This may not be quite as easy as you might think. Where do you imagine the 
button going? In the list itself or above or below the table?

>  What rule should I add to make that happen?

From fastest to hardest:

1. The fastest way to handle it (and it is the one of the ways 
ERModernMoviesDemo and BugTracker demonstrate), is to make the action a link in 
your ERXNavigationMenu with the code for entity creation in the Navigation 
Controller class.

        public WOComponent createMovieAction() {
                return newObjectForEntityName(MOVIE);
        }

    public WOComponent newObjectForEntityName(String entityName) {
        WOComponent nextPage = null;
        try {
            EditPageInterface epi = 
D2W.factory().editPageForNewObjectWithEntityNamed(entityName, session());
            epi.setNextPage(session().context().page());
            nextPage = (WOComponent) epi;
        } catch (IllegalArgumentException e) {
            ErrorPageInterface epf = D2W.factory().errorPage(session());
            epf.setMessage(e.toString());
            epf.setNextPage(session().context().page());
            nextPage = (WOComponent) epf;
        }
        return nextPage;
    }

2.  You could create a custom component that would be repeated in the list that 
has similar code to that in the Navigation Controller class. You name a 
placeholder propertyKey such as "createLink", set it to display a custom 
component, then name the custom component. If you choose this route and need 
help, please let the list know.

3. You can use ERDActionBar and a delegate for your entity that has a 
createAction. This component is supported in the ModernLook list page template. 
This took me a couple of days to wrap my head around. To get an idea of what is 
involved see this page:

ERDBranchDelegate & ERDControllerButton

http://wiki.objectstyle.org/confluence/display/WO/D2W+Flow+Control

4. You could place your custom component from item 2 above or below your list, 
but then you'd need to muck with the list page template to support your custom 
component.

I have been using the first option in my D2W apps.

David

> 
> Thanks,
> 
> Joe Kramer
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/programmingosx%40mac.com
> 
> This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to