• 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: WOSwitchComponent Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOSwitchComponent Problem


  • Subject: Re: WOSwitchComponent Problem
  • From: Andrew Lindesay <email@hidden>
  • Date: Wed, 7 Mar 2007 08:48:46 +1300

Hello Thierry;

Actually the problem is, that WebObjects seems to hold objects somewhere in
memory and then get's them back when I open the window again... Somehow.

It is a little hard to understand without seeing the project, but if your components are in the WOSwitchComponent then they are treated as being stateless. Maybe a good approach here is to not store data in your component's instance variables and instead to get the data straight out of the bindings. People sometimes use a pattern like this;


public class SomeComponent extends WOComponent
{
	protected String someString = null;

	....

	public boolean synchronizesVariablesWithBindings() { return false; }
	public boolean isStateless() { return true; }

	...

	public String getSomeString()
	{
		if(null==someString)
			someString = (String) valueForBinding("someString");

		// maybe do some checks here?

		return someString;
	}

	public void reset()
	{
		super.reset();
		someString = null;
	}
}

Have a look at the javadoc for information about "reset(..)", "synchronizesVariablesWithBindings(..)" and "isStateless(..)".


cheers.

___
Andrew Lindesay
www.lindesay.co.nz



_______________________________________________
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: 
 >Re: WOSwitchComponent Problem (From: Thierry Kramis <email@hidden>)

  • Prev by Date: WebObjects 5.3.3, DST and J2SE 1.4.2
  • Next by Date: Re: WebObjects 5.3.3, DST and J2SE 1.4.2
  • Previous by thread: Re: WOSwitchComponent Problem
  • Next by thread: MEETING: Chicago CocoaHeads / CAWUG Tuesday 3/13 - Core Image
  • Index(es):
    • Date
    • Thread