Re: Accessing a string from a display group.
Re: Accessing a string from a display group.
- Subject: Re: Accessing a string from a display group.
- From: "Jerry W. Walker" <email@hidden>
- Date: Wed, 11 Jan 2006 14:44:06 -0500
Hi, Matt,
On Jan 11, 2006, at 1:18 PM, Matt Harmon wrote:
Hi,
Sorry for what I suspect is a basic question but I have seen no
examples in any of my week and a half of research.
It shouldn't be that hard. I've included some references below.
I've inherited a Web Objects application that uses display groups
for *everything* and I've been asked to make a change to the
application
that requires my extracting data (strings) from a record that is
currently
displayed in a display group.
The fetch specification for the display group appears to have been
created "codelessly" (that is, I can't seem to locate a reference
to it
anywhere in the source code).
The display group was probably created by dragging an entity from the
EOModel and dropping it on the WOComponent page in WOBuilder. You can
confirm this by opening the WOComponent in WOBuilder that uses the
display group. Look for the display group's name in WOBuilder's
browser and if there's a check mark to the left of the display
group's name, then the display group was created in this way and is
automatically initialized.
If so, you will find the parameters for creating a fetch
specification dynamically in the .woo file for that WOComponent. You
can review the contents of the .woo file by clicking on the reveal
triangle for the (yellow) group containing the WOComponent in Xcode's
Groups and Files list, then clicking on the reveal triangle on the
(blue) folder/directory for the WOComponent's package within the
WOComponent's group.
You should see three files listed there with
suffixes: .html, .wod, .woo. Click on the file with the .woo suffix
and Xcode should show you a plist containing the initialization
parameters for the WOComponent, which should include the
initialization for the display group.
How does one access a string (or any other variable for that matter)
in a display group that was created without code? Or do I just need to
rewrite the thing to do it all programmatically?
The best thing to do would probably be to learn about
WODisplayGroups. It might be helpful to realize that they are little
more than array controllers to provide a very convenient display
control for arrays of EOs. If you try to learn about them knowing
that this is their basic function, I think it's a bit easier. If you
become their friend, your development life can generally get much
easier (with minor caveats, but that's what the list is for) :-)
For your immediate problem, go to the WODisplayGroup JavaDocs. The
display group is holding an array of EOs. You want to get to that
array to manipulate its elements in some way. The array is given to
you through the allObjects() method:
public NSArray allObjects()
Provides all of the objects collected by the WODisplayGroup. This
collection differs from that provided by displayedObjects. Typically
this collection will comprise the results of the last fetch from the
WODisplayGroup's dataSource.
It's helpful to simply peruse the WODisplayGroup API page and the
WODisplayGroup.Delegate Interface page, reviewing the members and
methods described there.
Ravi Mendis introduces WODisplayGroups in his WO Developer's Guide on
page 192. The discussion isn't very deep.
You can also get a free introduction to this useful topic at:
http://developer.apple.com/documentation/LegacyTechnologies/
WebObjects/WebObjects_4.5/System/Documentation/Developer/WebObjects/
Topics/TopicsTOC.html
Scan down the page to the heading: "Using Display Groups" and start
reading the topics therein.
This material might be covered in a later version of WebObjects, but
I know it's here and haven't time to look further.
In general, if your predecessor used display groups extensively on a
project that you will be maintaining as you suggest, you will be far
better off learning and working with his/her display groups, than you
will be if you try to take it all back down to the code level.
Thanks for any information anyone can provide,
Matt Harmon
--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial
Strength Internet Enabled Systems
email@hidden
203 278-4085 office
_______________________________________________
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