• 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: Access a private variable?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Access a private variable?


  • Subject: Re: Access a private variable?
  • From: Alex Johnson <email@hidden>
  • Date: Thu, 14 Jul 2005 17:57:25 -0500

Hi again --

On Jul 14, 2005, at 5:12 PM, Sacha Mallais wrote:
WODisplayGroup.allObjects().count();
On Jul 14, 2005, at 5:17 PM, Ricardo Strausz wrote:
Isn't it displayGroup.allObjects().count()??

Wow, thank you both for replying so quickly!
Let me add some more context to better explain my issue:

Starting with a WODisplayGroup that is initialized via the WOO file, I call:
<x-tad-bigger>
displayGroup.fetch();
</x-tad-bigger>

This fetches about 350 objects from the database. In order to make the results more user friendly, I set <x-tad-bigger>numberOfObjectsPerBatch</x-tad-bigger> to <x-tad-bigger>25</x-tad-bigger> for my display group:

<x-tad-bigger> displayGroup.setNumberOfObjectsPerBatch( </x-tad-bigger><x-tad-bigger>25</x-tad-bigger><x-tad-bigger> );
</x-tad-bigger>

When I then call:
<x-tad-bigger>
displayGroup.queryMin().takeValueForKey( someTimestampInThePast, </x-tad-bigger><x-tad-bigger>"dateCreated"</x-tad-bigger><x-tad-bigger> );
displayGroup.qualifyDisplayGroup();
</x-tad-bigger>

This trims down the list of objects to 60 objects (which makes 3 batches). I would like to display that number (60) somewhere on my page. However, these are the results I get:

<x-tad-bigger>displayGroup.</x-tad-bigger><x-tad-bigger>allObjects().count()</x-tad-bigger> <x-tad-bigger>350</x-tad-bigger> (the total number of fetched objects)

<x-tad-bigger>displayGroup.</x-tad-bigger><x-tad-bigger>displayedObjects().count() </x-tad-bigger><x-tad-bigger>25</x-tad-bigger> (the number that fit on that page), or <x-tad-bigger>10</x-tad-bigger> (for the last page)

<x-tad-bigger> displayGroup.setNumberOfObjectsPerBatch(</x-tad-bigger><x-tad-bigger>0</x-tad-bigger><x-tad-bigger>);
displayGroup.displayedObjects().count() </x-tad-bigger><x-tad-bigger>60</x-tad-bigger><x-tad-bigger> </x-tad-bigger>
(the number of qualified objects -- this is what I want)

I would like to be able to get the third value without temporarily setting <x-tad-bigger>numberOfObjectsPerBatch</x-tad-bigger> to <x-tad-bigger>0</x-tad-bigger>, because that has the side effect of erasing the <x-tad-bigger>selectedObjects()</x-tad-bigger> and <x-tad-bigger>currentBatchIndex()</x-tad-bigger>. Thus, I am wondering if it's possible for me to access the WODisplayGroup's private variables to see if I can directly get the array of qualified objects.


On Jul 14, 2005, at 5:12 PM, Sacha Mallais wrote:

Does anyone know if it's possible to access an object's private variable?
Yes, it is.

Any sample code you can point me to?


--
Thanks again

Alex Johnson

|| | ||| || | ||| | | | || || |||
\\ SITE 9 \\ SITE9.COM \\ 312.670.8469 \\


Hi all --

Does anyone know if it's possible to access an object's private variable?

Specifically, I want to get at <x-tad-bigger>WODisplayGroup._displayedObjects</x-tad-bigger> so I can tell how many objects match the query settings. With batching turned on, <x-tad-bigger>displayedObjects()</x-tad-bigger> only returns the current batch of objects.

The only solution I've come up with so far is:
<x-tad-bigger> </x-tad-bigger><x-tad-bigger>int</x-tad-bigger><x-tad-bigger> pp = numberOfObjectsPerBatch();
</x-tad-bigger><x-tad-bigger>int</x-tad-bigger><x-tad-bigger> pg = currentBatchIndex();
NSArray sel = selectedObjects();

setNumberOfObjectsPerBatch(</x-tad-bigger><x-tad-bigger>0</x-tad-bigger><x-tad-bigger>);
countOfQualifiedObjects = </x-tad-bigger><x-tad-bigger>new</x-tad-bigger><x-tad-bigger> Integer( displayedObjects().count() );

setNumberOfObjectsPerBatch( pp );
setCurrentBatchIndex( pg );
setSelectedObjects( sel );
</x-tad-bigger>
 _______________________________________________
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: Access a private variable?
      • From: Alex Johnson <email@hidden>
    • Re: Access a private variable?
      • From: Alex Johnson <email@hidden>
    • Re: Access a private variable?
      • From: Sacha Mallais <email@hidden>
    • Re: Access a private variable?
      • From: Ricardo Strausz <email@hidden>
References: 
 >Access a private variable? (From: Alex Johnson <email@hidden>)
 >Re: Access a private variable? (From: Sacha Mallais <email@hidden>)

  • Prev by Date: Re: Access a private variable?
  • Next by Date: Re: Access a private variable?
  • Previous by thread: Re: Access a private variable?
  • Next by thread: Re: Access a private variable?
  • Index(es):
    • Date
    • Thread