0

Text in ZUL and surrounding whitespace

asked 2010-04-28 10:36:06 +0800

xmedeko gravatar image xmedeko
1031 1 16
http://xmedeko.blogspot.c...

Hi,
I a ZUL like

<window>
                      as
</window>

creates an output like:

<span id="z_e4_2" class="z-label" z.zcls="z-label" class="z-label">
                      as
</span>

I think, it should be trimmed, like

<span id="z_e4_2" class="z-label" z.zcls="z-label" class="z-label">
as
</span>

doesn't it?

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2010-04-28 21:01:47 +0800

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

updated 2010-04-28 21:02:03 +0800

Hi xmedeko
You can refer to zul.jar\metainfo\zk\lang.xml
and scroll down to bottom
you will see the below setting

<component>
		<component-name>window</component-name>
		<component-class>org.zkoss.zul.Window</component-class>
		<widget-class>zul.wnd.Window</widget-class>
		<mold>
			<mold-name>default</mold-name>
			<mold-uri>mold/window.js</mold-uri>
			<css-uri>css/window.css.dsp</css-uri>
		</mold>
		<preserve-blank/>
	</component>

The <preserve-blank/> will leave the blank

link publish delete flag offensive edit

answered 2010-04-29 02:57:08 +0800

xmedeko gravatar image xmedeko
1031 1 16
http://xmedeko.blogspot.c...

Hi Jimmi,

thanks. I have tried to put into my lang=addon.xml"

<component>
		<component-name>window</component-name>
		<component-class>org.zkoss.zul.Window</component-class>
		<widget-class>zul.wnd.Window</widget-class>
		<mold>
			<mold-name>default</mold-name>
			<mold-uri>mold/window.js</mold-uri>
			<css-uri>css/window.css.dsp</css-uri>
		</mold>
</component>

But the result is the same. BTW. <preserve-blank/> is probably undocumented, because http://www.zkoss.org/doc/searchresult.dsp?cx=008321236477929467003%3A63kdpeqkkvw&cof=FORID%3A11&q=%22preserve-blank%22&sa.x=0&sa.y=0#416 brings no results.

I have thought the blank space is the job of the labelTemplate and the labelTemplate for the ZUL it should trim the blank spaces, or not? My real problem is that

	<label value="A" />
	<label value="B" />

shows "A B" in the browser. I can make <label value="A" /><label value="B" /> but Eclipse formatter always changes that :-( (I have made http://www.zkoss.org"]http://www.zkoss.org/forum/listComment/12221, sorry.)

It is a philosophical question. Since ZUL is XML, should the result be always the same when formatting changes or may be different? I do not know the answer. I think I will have to change my code to produce <label value="AB" />.

link publish delete flag offensive edit

answered 2010-04-29 03:25:10 +0800

xmedeko gravatar image xmedeko
1031 1 16
http://xmedeko.blogspot.c...

The problem is more confusing. I have a macro form-mandatory.zul:

<n:span class="z-label form-mandatory" xmlns:n="http://www.zkoss.org/2005/zk/native">*</n:span>

Then this 3 scenarios produce 3 different results:

1.

<window xmlns:n="http://www.zkoss.org/2005/zk/native">
	<span>A</span>
	<form-mandatory />
</window>

2.

<window xmlns:n="http://www.zkoss.org/2005/zk/native">
	<n:span>A</n:span>
	<form-mandatory />
</window>

3.

<window xmlns:n="http://www.zkoss.org/2005/zk/native">
	A
	<form-mandatory />
</window>

1. shows "A*" in the browser. The 2. and 3. both shows "A *" in the browser, but the HTML code is a little but different; 3. produces more spaces around 'A'.

I have no big problem with that. Just writing this post to let you know.

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-04-28 10:36:06 +0800

Seen: 393 times

Last updated: Apr 29 '10

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