0

Triiger an event from a java file

asked 2014-04-16 04:56:59 +0800

sampang gravatar image sampang
10 1

Dear all,

I got a zul file which contain a taxtbox like

 <textbox id="name_" value="" />

and in the doAfterCompose block of the composer, i wrote some code like this

name_.addEventListener(MY_EVENT, new MYListener());

now, i want to trigger MY_EVENT directly from a pure JAVA file which is not extend from any composer. i try to do like this

Events.sendEvent(MY_EVENT);

or

Events.sendEvent(MY_EVENT,new SomeComposer(),null);

those all are wrong. Especially, what is the correct way to code "new SomeComposer()"?

is there anyone could give me some hint?

Thanks in advance.

Allen

delete flag offensive retag edit

Comments

And the MyEvent on the textbox does also something when handling the textbox? otherwise, you could better go to EventQueues.

chillworld ( 2014-04-16 05:51:38 +0800 )edit

just like i wrote, I've added name_.addEventListener(). is this what you mean? and I'll check EventQueues as well. thanks.

sampang ( 2014-04-16 06:04:07 +0800 )edit

No I mean, let's say you added the listener on your own Triple_Click. So do it have to work on triple click on the textBox also or is your MY_Event something that shall never be thrown in IE.

chillworld ( 2014-04-16 06:48:50 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-04-16 09:25:10 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

can't understand

 i want to trigger MY_EVENT directly from a pure JAVA file which is not extend from any composer.

and don't know how you can pass a Composer at 2nd parameter (it should be a Component, which Events you are using?)

Please read the this javadoc sendEvent, you should do like

Events.sendEvent(MY_EVENT,name_,null)
link publish delete flag offensive edit

Comments

because the stand alone java file is a background job and waiting an input. which means it's not a composer or component. what i want to do is fire an event from this java file if the java file get some value. so, if like you said Event.setEvent, what should i write in 2nd parameter? thanks.

sampang ( 2014-04-16 10:30:17 +0800 )edit
0

answered 2014-04-17 02:05:09 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi

if you want to trigger a event in a pure java class, you need to use event queue

and you can also refer to this thread.

link publish delete flag offensive edit
Your answer
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
2 followers

RSS

Stats

Asked: 2014-04-16 04:56:59 +0800

Seen: 17 times

Last updated: Apr 17 '14

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