Re: non-linear worepetition
Re: non-linear worepetition
- Subject: Re: non-linear worepetition
- From: "Arturo Perez" <email@hidden>
- Date: Fri, 13 Aug 2004 14:40:02 -0400
Michael Engelhart wrote:
The more I think about this the more confused I get. Even if I create
the column listing across the row as a WORepetition walking through an
array of keys, won't my currentFoo get clobbered every time through the
outer loop?
It doesn't. Why not? Well, paraphrasing one of Mr. Crawford's mantras
during training
Ignore the man behind the curtain.
This is (to me) WO's most important value-add. It tracks, without any
code on your part, these things automatically. It's black magic (in the
software development sense) of the highest order. But it requires
component actions, not direct actions.
Does WO keep track of outer/inner loops like that?
Yes, with some caveats. The caveats have to do with whether or not your
methods for setting the iterator variable (currentFoo) have side
effects. Hence the oft-heard admonition "Don't have side effects in
your getters/setters."
So, the double repetition thing should "just work" for you.
Mike
On Aug 13, 2004, at 11:19 AM, Michael Engelhart wrote:
Hi Arturo
Well the inner loop isn't actually a WORepetition. I didn't explain
that well in my original post.
I manually pull out each columns value for each row repetition by a
key. The columns for each row are a HashMap and the keys are
predetermined (say key1, key2, key3) but in that example, key2 may not
have a value so I have to call it and then if it returns null I have
to put an empty table cell.
So the output could and often is like this:
key1 key2 key3 key 4
---------------------------------------------------
name_key1 | obj1 obj2 obj3 obj4
name_key2 | obj1 obj3 obj4
name_key3 | obj1 obj3
Does that make sense?
Thanks for your help
Mike
On Aug 13, 2004, at 9:56 AM, Arturo Perez wrote:
Michael Engelhart wrote:
So my question is how to best generate a WOHyperlink in each cell
that points to the object that is referenced by that cells key.
Hi Mike,
Isn't it just the standard repetition thing? You'd need two
repetitions, one to iterate across rows and the other to iterate down
columns. The second one has an item variable called currentFoo. You
can bind that to a hyperlink action method.
public WOComponent fooAction {
// Object currentFoo set by repetition.
currentFoo.manipulate()
WOComponent woc = pageWithName("updateFoo");
woc.takeValueForKey(currentFoo, "theFoo");
return woc;
}
I think that's what you're asking.
-arturo
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.