0

Problem with apply and zscript

asked 2010-03-12 10:54:23 +0800

ziccardi gravatar image ziccardi
321 7

Hi all.
I've the following code:

<?component name="allDocsList" macroURI="/wf_pages/docList/docListGrid.zul"?>
<zk>
   <zscript>
         Composer comp = new MyComposer();
   </zscript>

   <window>
       <allDocList apply="${comp}"/>
   </window>

</zk>

What do I do wrong? The composer is not called at all. Instead of ${comp} you could write everything and get no error. Try with ${duffyduck}.

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2010-03-12 10:59:59 +0800

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

updated 2010-03-12 11:04:26 +0800

Only a hint.

Hope i'm not wrong.
As i heard today the: <?component name .... ?> tag is only reading/parsing if it's in a zul file under the <?page ... ?> tag, because it's belonged to a Page definition.

link publish delete flag offensive edit

answered 2010-03-15 04:19:15 +0800

ziccardi gravatar image ziccardi
321 7

I did some investigation. I tried to install the zul editor eclipse plugin, and I noticed that the code autocompletion feature do not completes my code if the apply is inside a macro tag component. On the other side, it works if I try to assign my composer to non macro components. For example:

<?component name="allDocsList" macroURI="/wf_pages/docList/docListGrid.zul"?>
<zk>
   <zscript>
         Composer comp = new MyComposer();
   </zscript>

   <window apply="${comp}"> <!-- THIS WORKS -->
       <allDocList apply="${comp}"/> <!-- THIS IS TOTALLY IGNORED -->
   </window>

</zk>

Is this a bug, or this is the (in my opinion wrong) behaviour by design?

Is there a way I can workaround the issue? (I need to choose dinamically the composer).

Thanks,
Massimiliano

link publish delete flag offensive edit

answered 2010-03-15 04:59:33 +0800

ziccardi gravatar image ziccardi
321 7

updated 2010-03-15 06:14:02 +0800

Ok, since it seems the problem is with the macro component, I tried to following approach.

File 1:

<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" ?>
<?page title="Document List" contentType="text/html;charset=UTF-8"?>
<?component name="myMacro" macroURI="/wf_pages/docList/docListGrid.zul"?>

<zk>

<window border="normal" >
   <myMacro />
</window>

File 2 (MACRO DEFINITION):

<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" ?>
<?page title="Document List" contentType="text/html;charset=UTF-8"?>
<zk >
	<zscript >
		<![CDATA[
                       Composer comp = new MyComposer();
		]]>
	</zscript>	
	<window apply="${ comp }">
              <textbox />
        </window>

As you can notice, I moved the zscript code inside the macro definition, so that the apply is 'applied' to a ZK native widget (window).
With this approach, the ZUL Editor autocomplete feature works (it lists the comp variable). However, at runtime it do not works (the composer do not gets called).

Could someone there tell me if this is a bug, it is like that by design or something else?

link publish delete flag offensive edit

answered 2010-03-15 21:31:24 +0800

PeterKuo gravatar image PeterKuo
481 2

@ziccardi
zul editor tried best to mimic the behavior of zk, but sometimes the spec of zk changes,
and zul editor may not modify as fast.

the composer do not gets called, should be another bug of zk of implementation of macro component.
Please post to bug in sourceforge.

link publish delete flag offensive edit

answered 2010-03-18 06:13:28 +0800

ziccardi gravatar image ziccardi
321 7

Thank you terrytornato and thank you PeterKuo.

The new bug id is #2972517.

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: 2010-03-12 10:54:23 +0800

Seen: 334 times

Last updated: Mar 18 '10

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