• 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: Marcos Trejo Munguia <email@hidden>
  • Date: Tue, 11 Oct 2005 16:11:39 -0500

Hi Chuck,

On Sep 11, 2006, at 3:27 PM, Chuck Hill wrote:

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.

Exactly, I need to do what WOSwitchComponent and WOComponentContent can't do. ;-)



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.

Might be overriding appendToResponse?

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.

Only reusable, not stateless. Then I will continue using awake for that purpose.


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;
}

Nice tip!

Does any of that help?

It helps, thanks!

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:
email@hidden


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
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>)
 >Re: New WOComponent instance (From: Chuck Hill <email@hidden>)

  • Prev by Date: Utility to move files into database
  • Next by Date: Re: Session timeout and memory
  • Previous by thread: Re: New WOComponent instance
  • Next by thread: Re: Xcode 2.4 Deprecation Announcements
  • Index(es):
    • Date
    • Thread