Hi Marcos.

On Sep 8, 2005, at 1:48 PM, Marcos Trejo Munguia wrote:

Hi Chuck

What I want to do is something like this:

<html>
<body>
<WEBOBJECT NAME=Component1></WEBOBJECT>
</body>
</html>

Component1: Component {
        content = getContent;
}

public WOComponent getContent() {
        ReusablePage page = pagewithName("ReusablePage");
        //Do some stuff with the page
        return page;
}

So the problem is that you need to "Do some stuff with the page" so that WOSwitchComponent will not work for you? I am still a little confused at what WOSwitchComponent or WOComponentContent is lacking.


I just want to know if it's possible to do something like this, if don't I suppose I'll have to use bindings in the ReusablePage,

I _think_ it is possible to do what you need.


if that is the case I have another question, where is the best place to clean/initialize variables in reusable components, I use to do that in the awake method, for example:

public void awake() {
        super.awake();
        if (((Boolean)valueForBinding("clear")).booleanValue()) {
                //Clear/Initialize some variables
        }
}

Does reusable mean stateless? awake() works for both stateless and stateful components, but for stateless ones, you need to implement reset() to set all the values back to null.

I also do not / would not use a binding like clear as shown above. I tend to use lazy initialization like this:

public void clear() {
    if (clear == null) {
        clear = (Boolean)valueForBinding("clear");
    }

    return clear == null ? false : clear.booleanValue();
}

Then, if this value needs to get updated,  in awake() or reset,

public void awake() {
    super.awake();
    clear = null;
}

Does any of that help?

Chuck



On Sep 8, 2006, at 10:11 AM, Chuck Hill wrote:

Hi Marcos,

Can you give us some more information on the situation and what you want to achieve?

Thanks,
Chuck


On Sep 7, 2006, at 5:19 PM, Marcos Trejo Munguia wrote:

Hi List,

I have a doubt, is there a way to create a new instance of a WOComponent and then bind it to some component, a kind of WOSwitchComponent but with a different instance of the WOComponent each time?

Thanks in advanced.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill% 40global-village.net

This email sent to [EMAIL PROTECTED]

--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/ practical_webobjects





--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects





_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Reply via email to