• 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: New WOComponent instance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New WOComponent instance


  • Subject: Re: New WOComponent instance
  • From: Chuck Hill <email@hidden>
  • Date: Mon, 11 Sep 2006 13:27:32 -0700

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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net


This email sent to email@hidden

--

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      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: New WOComponent instance
      • From: Marcos Trejo Munguia <email@hidden>
References: 
 >New WOComponent instance (From: Marcos Trejo Munguia <email@hidden>)
 >Re: New WOComponent instance (From: Chuck Hill <email@hidden>)
 >Re: New WOComponent instance (From: Marcos Trejo Munguia <email@hidden>)

  • Prev by Date: Re: Navigation Working Example?
  • Next by Date: Re: Statless Component and component Action
  • Previous by thread: Re: New WOComponent instance
  • Next by thread: Re: New WOComponent instance
  • Index(es):
    • Date
    • Thread