• 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: Ricardo Strausz <email@hidden>
  • Date: Thu, 14 Jul 2005 18:04:48 -0500

Then do the following (if it helps):

displayGroup.dataSource().setAuxiliaryQualifier(aQualifier);
displayGroup.setNumberOfObjectsPerBatch(25);
displayGroup.fetch();

then

displayGroup.allObjects().count() = 60
and
displayGroup.displayedObjects().count() = 25

Dino


On Jul 14, 2005, at 5:57 PM, Alex Johnson wrote:

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:

    displayGroup.fetch();

This fetches about 350 objects from the database. In order to make the results more user friendly, I set numberOfObjectsPerBatch to 25 for my display group:

    displayGroup.setNumberOfObjectsPerBatch( 25 );

When I then call:

    displayGroup.queryMin().takeValueForKey( someTimestampInThePast, "dateCreated" );
    displayGroup.qualifyDisplayGroup();

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:

    displayGroup.allObjects().count()            350    (the total number of fetched objects)

    displayGroup.displayedObjects().count()        25    (the number that fit on that page), or 10 (for the last page)

    displayGroup.setNumberOfObjectsPerBatch(0);
    displayGroup.displayedObjects().count()        60    (the number of qualified objects -- this is what I want)

I would like to be able to get the third value without temporarily setting numberOfObjectsPerBatch to 0, because that has the side effect of erasing the selectedObjects() and currentBatchIndex(). 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 WODisplayGroup._displayedObjects so I can tell how many objects match the query settings. With batching turned on, displayedObjects() only returns the current batch of objects.

The only solution I've come up with so far is:
    int pp = numberOfObjectsPerBatch();
    int pg = currentBatchIndex();
    NSArray sel = selectedObjects();

    setNumberOfObjectsPerBatch(0);
    countOfQualifiedObjects = new Integer( displayedObjects().count() );

    setNumberOfObjectsPerBatch( pp );
    setCurrentBatchIndex( pg );
    setSelectedObjects( sel );

_______________________________________________
WebObjects-dev mailing list
email@hidden
http://www.omnigroup.com/mailman/listinfo/webobjects-dev


--
Ricardo Strausz
email@hidden
Business Applied C Objects
恐龍 駝鳥
+5255 5437 8205


 _______________________________________________
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

References: 
 >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: Alex Johnson <email@hidden>)

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