• 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 16:58:18 -0400

On Oct 11, 2010, at 4:48 PM, Ramsey Gurley wrote:

>
> On Oct 11, 2010, at 4:28 PM, David Avendasora wrote:
>
>> Hey Ramsey,
>>
>> I'm using the branch delegate in other places where the user is given a choice of what the next page should be, but I thought that since I'm figuring it out on-the-fly during the request that nextPageDelegate was the way to go. I've revised my NPD and here's what it looks like now:
>>
>>   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((Student) ((ERD2WQueryPage) sender).queryDataSource().fetchObjects().lastObject());
>
> You may want to consider getting your object first, then using object.entityName() in your factory method to make this more generally reusable.

See, now that's just genius. This can be a delegate that works for any EO, not just Student. Brilliant!

>>           nextPage = (WOComponent) ipi;
>>       } else {
>>           nextPage = ((ERD2WQueryPage) sender).nextPage();
>
> Does that last line work?  I would have thought the logic in your original would be required.

Yep! Works great. :-) When I wrote it I was worried that it would end up in an endless loop with sender.nextPage() simply calling this delegate, but it works perfectly. Maybe I'm just lucky.

Dave

>
> Ramsey
>
>>       }
>>       return nextPage;
>>   }
>>
>>
>> Dave
>>
>> On Oct 11, 2010, at 9:55 AM, Ramsey Gurley wrote:
>>
>>> Looks good to me Dave. I think any "better" way than something that works will be a matter of opinion (^_^)  Personally I like branch delegates, but in this case, the next page delegate is only called by the queryAction. So you know the call to next page comes from the find button.
>>>
>>> Ramsey
>>>
>>> On Oct 11, 2010, at 6:57 AM, David Avendasora wrote:
>>>
>>>> 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
>>>>
>>>
>>>
>>>
>>
>>
>
>
>

 _______________________________________________
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: David Avendasora <email@hidden>
References: 
 >Auto-inspect result sets of 1 (From: David Avendasora <email@hidden>)
 >Re: Auto-inspect result sets of 1 (From: David Avendasora <email@hidden>)
 >Re: Auto-inspect result sets of 1 (From: Ramsey Gurley <email@hidden>)
 >Re: Auto-inspect result sets of 1 (From: David Avendasora <email@hidden>)
 >Re: Auto-inspect result sets of 1 (From: Ramsey Gurley <email@hidden>)

  • Prev by Date: Re: [Wonder-disc] RuleModeler with lhs type ahead search
  • Next by Date: Re: [Wonder-disc] RuleModeler with lhs type ahead search
  • Previous by thread: Re: Auto-inspect result sets of 1
  • Next by thread: Re: Auto-inspect result sets of 1
  • Index(es):
    • Date
    • Thread