• 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: Invoking Subcomponent Action
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Invoking Subcomponent Action


  • Subject: Re: Invoking Subcomponent Action
  • From: Henrique Prange <email@hidden>
  • Date: Wed, 25 Feb 2009 12:13:19 -0300

Hi Faizel,

On Wed, Feb 18, 2009 at 7:49 PM, Faizel Dakri <email@hidden> wrote:
>
> Just a thought, but you might try posting a notification from your
> clearState() method in the parent component, using the parent as the
> notification object. Then in your switched component you can listen for that
> notification from the parent object and handle appropriately.
>

Good idea.

> Obviously, you'd have to handle registration appropriately in the child
> component so that you have access to the parent component when registering
> for the notification--I'm thinking maybe during awake() or during
> appendToResponse(), and then unregistering during sleep()? Either that, or
> just register for the notification blindly and check the notification object
> before clearing the state.
>

Below is what I did to solve the problem (a little bit different, but
based on your advice). All components created by the WOSwitchComponent
extend an AbstractComponent class. I added the following to this
class:

public void awake() {
   ERXWOContext.contextDictionary().setObjectForKey(this, "KEY");
}

...

public void sleep() {
   ERXWOContext.contextDictionary().removeObjectForKey("KEY");
}

In the parent project 'clearInnerComponentState' method I get the
child component (an AbstractComponent type) and call the clearState
method like this:

public void clearInnerComponentState() {
   AbstractCreateComponent component =
     (AbstractCreateComponent)
ERXWOContext.contextDictionary().objectForKey("KEY");

   if (component != null) {
      component.clearState();
   }
}

Now, if I have to clear the state of a component, it is just a matter
of overriding the clearState method.

Cheers,

Henrique
 _______________________________________________
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: Invoking Subcomponent Action
      • From: Mike Schrag <email@hidden>
References: 
 >Invoking Subcomponent Action (From: Henrique Prange <email@hidden>)
 >Re: Invoking Subcomponent Action (From: Faizel Dakri <email@hidden>)

  • Prev by Date: Re: Hibernate
  • Next by Date: Re: Invoking Subcomponent Action
  • Previous by thread: Re: Invoking Subcomponent Action
  • Next by thread: Re: Invoking Subcomponent Action
  • Index(es):
    • Date
    • Thread