0

Help. GenericForwardComposer Problem, Event Handler

asked 2009-05-13 03:34:29 +0800

ahn gravatar image ahn
18 1

updated 2009-05-13 08:09:15 +0800

hi, I'm elemetry developver Andrew..
I used GenericForwardComposer Class. please help me..

Java

public class MyClass extends GenericForwardComposer{
    public void onCreate$myPanel(Event event) {
        alert("onCreate ME!!");
    }
}


zul
 
<zul>
<window apply="MyClass">
  <tablelayout>
    <tablechildren>
       <panel id="myPanel">
       </panel>
    </tablechildren>
  </tablelayout>
</window>
<zul>


when panel component was created, onCreate Event Handler was not catched.
what is that problem?

please,, help me...

delete flag offensive retag edit

9 Replies

Sort by ยป oldest newest

answered 2009-05-13 03:54:24 +0800

hideokidd gravatar image hideokidd
750 1 2

updated 2009-05-13 03:55:56 +0800

Hi,

I thinks the onCreate event is not triggered at wanted timing,
you need doAfterCompose method to help you bind all components,
please refer to the smalltalk
http://docs.zkoss.org/wiki/ZK_MVC_Made_Easy
the sample code MyComposer6.java may help.

link publish delete flag offensive edit

answered 2009-05-13 04:10:17 +0800

ahn gravatar image ahn
18 1

updated 2009-05-13 08:21:05 +0800

Thanks, hideokidd

that's sample is implementing Composer.
i already did that in GenericForwardComposer..
in detail,,

public class MyClass extends GenericForwardComposer{ 
    public void doAfterCompose(Component comp) throws Exception {
		super.doAfterCompose(comp);		
}


i catched onChange event at Textbox component like that "MyCompser6.java", but i cannot catch "onCreate" event.
In the Window Component, It catch onCreate Event (public onCreate$WinComponent(Event event)) .
But other component cannot catch onCreate Event.

Is there good method?

link publish delete flag offensive edit

answered 2009-05-13 04:27:38 +0800

hideokidd gravatar image hideokidd
750 1 2

Hi,

I encountered the same case,
but it's interesting that forward event works,
please try

java

public void onCreatePanel(Event event) {
alert("onCreate ME!!");
} 

zul

<panel id="myPanel" forward="onCreate=onCreatePanel"> 

link publish delete flag offensive edit

answered 2009-05-13 08:04:31 +0800

ahn gravatar image ahn
18 1

updated 2009-05-13 08:17:01 +0800

Thanx again.

That's very good idea for me.
Then, I encounter the another problem.
In your second solution, "forward attribute" call the "onCreate" method before components rendered completely.
in your method,

public void onCreatePanel(Event event) {
alert("onCreate ME!!");
} 

It is not problem general case like that "alert()" function.
But I have to control zul's component in this method.

In my case,
public void onCreatePanel(Event event) {
alert("onCreate ME!!");
myPanel.setVisible(false);
} 

it's impossible. because "myPanel" component is not loaded yet.
any other solution?

link publish delete flag offensive edit

answered 2009-05-13 16:12:04 +0800

ahn gravatar image ahn
18 1

updated 2009-05-13 16:13:34 +0800

hi,

I'm mistake,
your method is right.
<<forward="onCreate=onCreatePanel">>

That's good iead!
I've solved this problem.

By the way, why did the event handler couldn't catch "onCreate" event?
is this ZK's bug???

thanks "hideokidd"!!

link publish delete flag offensive edit

answered 2009-05-14 01:06:29 +0800

hideokidd gravatar image hideokidd
750 1 2

Hi,

I think that's life cycle or composer mechanism issue,
there is a small talk about composer,
http://docs.zkoss.org/wiki/An_Introduction_of_ZK_Composer
maybe zk team will fix the specification problem in the future.

link publish delete flag offensive edit

answered 2010-10-05 06:15:20 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Push.

Are there ideas to do the automatically event forwarding for all components in future?

link publish delete flag offensive edit

answered 2010-10-11 23:33:02 +0800

PeterKuo gravatar image PeterKuo
481 2

@terrytornado

Please post to feature request.
It seems like some lifecycle issue inside it.

link publish delete flag offensive edit

answered 2010-10-12 04:15:44 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Done. Thanks Peter.

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: 2009-05-13 03:34:29 +0800

Seen: 1,138 times

Last updated: Oct 12 '10

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