0

Calling a Method on a Parent Composer

asked 2011-11-08 17:03:00 +0800

SparkySpider gravatar image SparkySpider
444 1 3

I have a modal that I create using Executions.createComponents(...). Both the modal and parent each have their own ForwardComposers.

When a user adds a new item to the list in the modal, I'd like to call updateLinks() on the parent.

How can I get a reference to the parent composer from the modal composer?

Thanks!

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2011-11-08 17:46:15 +0800

ashishd gravatar image ashishd flag of Taiwan
1972 6

You can set your parent composer in desktop using setAttribute on desktop and retrieve it from your modal composer

link publish delete flag offensive edit

answered 2011-11-09 14:11:07 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

Or, better yet, when you have the new window returned from Executions.createComponents(...), add an event listener to it. Then, when the new item is created, send an event that has the new item as event data.
Parent Composer:

    public void someMethod(...)
    {
        ...
        newWin = (Window)Executions.createComponents(....) ;
        newWin.addEventListener( "onItemAdded", this ) ;
        ...
    }

    public void onItemAdded(Event evt)
    {
        Item = (Item)event.getData() ;
        //  do whatever you need to do with the new Item
    }

Child Composer:

...
    Item newItem = new Item() ;
    
    //  when new item is added
    Events.postEvent( "onItemAdded", self, newItem ) ;
...

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-11-08 17:03:00 +0800

Seen: 234 times

Last updated: Nov 09 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More