• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Auto-inspect result sets of 1
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Auto-inspect result sets of 1


  • Subject: Re: Auto-inspect result sets of 1
  • From: David Avendasora <email@hidden>
  • Date: Mon, 11 Oct 2010 06:57:41 -0400

Okay, after a nights sleep, I got it working, but how I did it seems hackish (shocking, I know). Is the nextPage() method below from my delegate the best way to do this?

    public WOComponent nextPage(WOComponent sender) {
        WOComponent nextPage;
        if (((ERD2WQueryPage) sender).queryDataSource()
                  .fetchObjects()
                  .count() == 1) {
            InspectPageInterface ipi = D2W.factory()
                                          .inspectPageForEntityNamed(Student.ENTITY_NAME,
                                                                     sender.session());
            ((ERD2WInspectPage) ipi).setObject((EOEnterpriseObject) ((ERD2WQueryPage) sender).queryDataSource()
                                                                                             .fetchObjects()
                                                                                             .lastObject());
            nextPage = (WOComponent) ipi;
        } else {
            ListPageInterface lpi = D2W.factory()
                                       .listPageForEntityNamed(Student.ENTITY_NAME,
                                                               sender.session());
            ((ERD2WListPage) lpi).setDataSource(((ERD2WQueryPage) sender).queryDataSource());
            nextPage = (WOComponent) lpi;

        }
        return nextPage;
    }

On Oct 10, 2010, at 8:39 PM, David Avendasora wrote:

> Hi All,
>
> When a user performs a query, if the results contain exactly one object I want to return an Inspect page for that object instead of a List page.
>
> I assume I'm going to want to implement a NextPageDelegate, but I'm not sure how to do that. I've looked around but I can't seem to find a good example. Does anyone have an example NextPageDelegate that I can use as a starting point?
>
> I promise to create a Wiki page documenting how to do this for future mes.
>
> Thanks!
>
> Dave _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Auto-inspect result sets of 1
      • From: Ramsey Gurley <email@hidden>
References: 
 >Auto-inspect result sets of 1 (From: David Avendasora <email@hidden>)

  • Prev by Date: Re: Deployment setup on a OS X box
  • Next by Date: Textarea with character countdown
  • Previous by thread: Auto-inspect result sets of 1
  • Next by thread: Re: Auto-inspect result sets of 1
  • Index(es):
    • Date
    • Thread