• 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: Reusable Component Tricks...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reusable Component Tricks...


  • Subject: Re: Reusable Component Tricks...
  • From: David Koski <email@hidden>
  • Date: Tue, 2 Aug 2005 10:27:14 -0700

Hi,

On Aug 1, 2005, at 10:31 PM, LD wrote:

Hi all,

I've just been having a look through the developer examples for Reusable components here...
/Developer/Examples/JavaWebObjects/Frameworks/WOComponentElements


... and I'm just trying to understand a couple of things. e.g.,
In EXHyperlink you've got:
--WXHyperlink.html--
<WEBOBJECT NAME=HyperlinkContainer><WEBOBJECT NAME=String></ WEBOBJECT><WEBOBJECT NAME=Content></WEBOBJECT></WEBOBJECT>


--WXHyperlink.wod--
Content: WOComponentContent {}

HyperlinkContainer: WOGenericContainer {
    elementName = "a";
    invokeAction = invokeAction;
    href = context.componentActionURL;
}

String: WOString {
    value = ^string;
}

If I understand the WOGenericContainer correctly, after invokeAction is called href will be the returned component's componentActionURL, yes?

Yes, during append to response, the context.componentActionURL will be something like /.../10.5.0.1.1. In the invokeAction phase it will look at the incoming url and compare it to the componentActionURL, which will again be something like /.../10.5.0.1.1. If they match, it will call the invokeAction method.



What's the deal, however, with having both the WOString and WOComponentContent as child elements? And where exactly is the ^string pulling its info from? I understand that the caret symbol is analogous to a call to super but WOGenericContainer doesn't have a 'string' binding nor does WOComponent...

This allows you to do a few different things:

<WEBOBJECT NAME=HYPER1></WEBOBJECT>

<WEBOBJECT NAME=HYPER2>this is a string</WEBOBJECT>

<WEBOBJECT NAME=HYPER3>second string</WEBOBJECT>

HYPER1 : EXHyperlink {
    string = "first string";
}

HYPER2 : EXHyperlink {
}

HYPER3 : EXHyperlink {
    string = "first string";
}

which would put out html like:

<a>first string</a>

<a>this is a string</a>

<a>first stringsecond string</a>

Different ways of setting the text of the link.

^string is equivalent to valueForBinding("string"). This will look at the arguments (bindings) to the component from the wod file. It is not a call to "super", although the binding in the wod may tie string to a method in the parent component.


As for other tricks, I'll need to spend some time looking through Chapters 6-7 of Practical WebObjects, but in the mean time - how do others take advantage of WOGenericContainer and co

You might use it for things like <TR> and <TD>'s that you want to have dynamic pieces to:


<WEBOBJECT NAME=TR>
    <TD>
        ....
    </TD>
</WEBOBJECT>

TR : WOGenericContainer {
    elementName = "TD";
    bgColor = alternatingBackgrounColor;
}

This would call the alternatingBackgrounColor() background color on each row and give something like:

<TR bgColor="#ff0000">
    ...
</TR>
<TR bgColor="#00ff00">
   ...
</TR>

Hope this helps,
dk


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:
40mac.com


This email sent to email@hidden


_______________________________________________ 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: Reusable Component Tricks...
      • From: LD <email@hidden>
References: 
 >Reusable Component Tricks... (From: LD <email@hidden>)

  • Prev by Date: Re: Undo/Redo in Web Application
  • Next by Date: Re: EditingContext problem, ghost entry in datastore [ was Debuging WOManyToManyRelationship]
  • Previous by thread: Reusable Component Tricks...
  • Next by thread: Re: Reusable Component Tricks...
  • Index(es):
    • Date
    • Thread