0

propagate events from macro component

asked 2009-10-01 07:58:27 +0800

mixgho gravatar image mixgho
193 3

Hi, I have my macro component with some children:

<window id="win" apply="com.class.Composer">
  <myCustomComponent>
    <button forward="onClick=onDoSomethingInComposer" />
  </myCustomComponent>
</window>

The problem is, that event from <button /> is not propagated to the Composer, because myCustomComponent stops propagation.

How to push event up to the window component?

I've tried setting parent window composer for myCustomComponent in afterComposer() method

getDefinition().setApply("${self}");

but with no luck :(

Javadoc for setApply method is not very helpful anyway :-[

Sets the apply attribute that is is a list of Composer class or EL expressions returning classes, class names or composer instances.
Parameters:
apply the attribute this is a list of Composer class or EL expressions El expressions are allowed, but self means the parent, if available; or page, if no parent at all. (Note: the component is not created yet when the apply attribute is evaluated).

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2009-10-01 13:46:24 +0800

martin79 gravatar image martin79
96

It seems that you did, what I couldn't do: Macros with inner-HTML or rather a wrapper-macro.
I think you can't do this. I tried a simple macro and it didn't work.

If you use a normal macro in this way:

<window id="win" apply="com.class.Composer">
  <myCustomComponent>
    <button forward="onClick=onDoSomethingInComposer" />
  </myCustomComponent>
</window>

then anything in the myCustomComponent.zul will be ignored.
If you use inline="true" instead, ONLY the content of the myCustomComponent.zul will be created and anything between your opneing-macro tag and the closing-macro-text is ignored.

To your question - propagate events from macro component:
It depends on how your macro looks like. If you use inline="true", no macro-component will be created, but instead the CONTENT is "written". Therefore you can use an inline-macro as a child component of portalchildren f.e..

And if you don't create any additional ID space owners within your macro, you don't have to apply an additional composer.

A regular macro component is an ID space owner, so you have to cross this border to propagate the event.

link publish delete flag offensive edit

answered 2009-10-02 12:17:23 +0800

mixgho gravatar image mixgho
193 3

My question is exactly how to cross this border and propagate event up the idspace tree!

My custom components are in separate jar as one taglib with definitions in lang-addon.xml and you cannot specify inline attribute in lang-addon.xml :(

link publish delete flag offensive edit

answered 2009-10-05 02:33:34 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

mixgho,

Try specify where your want to forward your onClick to:

<button forward="onClick=win.onDoSomethingInComposer" />

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-10-01 07:58:27 +0800

Seen: 359 times

Last updated: Oct 05 '09

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