Re: WOHyperlink in WOComponentContent wrapped by WORepetition in subcomponent
Re: WOHyperlink in WOComponentContent wrapped by WORepetition in subcomponent
- Subject: Re: WOHyperlink in WOComponentContent wrapped by WORepetition in subcomponent
- From: LD <email@hidden>
- Date: Fri, 1 Jul 2005 09:13:04 +1000
Hi Keiran,
On 30/06/2005, at 10:12 PM, Kieran Kelleher wrote:
On Jun 29, 2005, at 11:11 PM, LD wrote:
On 30/06/2005, at 7:21 AM, Kieran Kelleher wrote:
I have a reusable component (WKObjectTable) that generates a HTML
table displaying attributes for an array of objects. The row
repetition in this reusable component has a WOComponentContent
allowing parent components to optionally add content for each row.
Assume this is populated via an optional API binding for the
component... e.g., a dictionary of content (values) for the
repetition objects (as keys).
No, WKObjectTable has the WORepetition. The WORepetition contains
the data for an object and iterates thru the array of objects. The
WORepetition has a WOComponentContent component dropped into the
repetition aswell.
I understood that. My suggestion is that (in order for this to be re-
usable) the array of objects iterated over ought to be given to the
reusable component by the parent (if it's not already). i.e., Open
the reusable component in WebObjects Builder, open menu Window ->
API... and define the interface for the reusable component.
Hence when WKObjectTable is dropped into some parent, it looks like
a container object. If I put the text "ABC" in the container (now
working in a parent containing a WKObjectTable reusable component,
the "ABC" (in the parent) gets repeated by the reusable sub-
component's repetition along with the objects. When I drop a
WOHyperLink into the container (still working in the parent), that
WOHyperlink gets repeated by the sub-component's repetition even
though the WOHyperlink does not exist in the reusable WKObjectTable
subcomponent. The WOHyperlinks are not passed to the WKObjectTable
subcomponent. It does not know the WOHyperlink exists.
Right - then this would be of limited value when you're needing
interaction between a single repeated object which has no knowledge
about or link between it and the array of objects in the repetition.
Actually, I can't see the value of the component content passed from
the parent seeing as it isn't specific to each row in the repetition.
e.g., If the "WKObjectTable.api" for the reusable component was
something like the following - you might be closer to where you want
to be... (actually using an NSNotification might be better than a
delegate definition)...
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wodefinitions>
<wo class="WKObjectTable" wocomponentcontent="false">
<binding name="items"/>
<binding name="itemAttributeKeys"/>
<binding name="optionalContentsForItemKeys"/>
<binding name="notificationRecipient"/>
<binding name="notificationSelector"/>
<binding name="notificationName"/>
<validation message="'items' is a required binding">
<unbound name="items"/>
</validation>
<validation message="'itemAttributeKeys' is a
required binding">
<unbound name="itemAttributeKeys"/>
</validation>
</wo>
</wodefinitions>
Then in "WKObjectTable.java" when the action is called in the
reusable component, you could create a notification...
public WOComponent reusableAction() {
Object observer = notificationRecipient();
String name = notificationName();
NSSelector sel = notificationSelector();
Object theItem = anItem;
if (observer != null &&
name != null &&
!name.equals("") &&
sel != null)
{
NSNotificationCenter notificationCenter;
NSNotification notification;
notificationCenter = NSNotificationCenter.defaultCenter();
notification = new NSNotification(observer, sel, name,
theItem);
notificationCenter.postNotification(notification);
}
}
You have given me some ideas. Either it is easy do get this working
and I don't get it, or it is too hacky to get this working in which
case my reusable component became too difficult to use to be
regarded as a reusable component, so I need to rethink my design.
Thanks, you have given me some ideas.
I think for what you were wanting to achieve the design of the
reusable component wasn't really suited.
with regards,
--
LD
_______________________________________________
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