0

Customize ZK error message popup

asked 2012-11-14 13:32:22 +0800

xeridia gravatar image xeridia
47 1

Hi!

In my ZK application, I have a customized error ZUL page, when some error occurs:

<error-page>
	<exception-type>java.lang.Throwable</exception-type>
	<location>/WEB-INF/zul/common/error.zul</location>
</error-page>

With this configuration, I get an error page that is shown with application styling.

My problem is that some interface failures show a message box with ZK default style (and ZK title). This happens, for instance, when SizeLimitExceededException is thrown in too big file upload.
I would like to customize this kind of messages (text and appearance), but I don't find a valid solution.
Does anyone have any ideas?

My tries were:
1. Customize org.zkoss.zk.au.http.AuUploader, overriding handleError method. With this, I only customize error text message, that is not enough.
2. Customize org.zkoss.zul.Messagebox, setting template with setTemplate method on application startup. With this, I customize default messagebox template, but is not used in SizeLimitExceededException error popup.

Thanks.

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2012-11-15 04:41:41 +0800

MontyPan gravatar image MontyPan
435 3
http://xitop.blogspot.com...

Hi xeridia,

The system's exception will handle by error-page setting, but the ZK's exception (like size limit exception of file upload) will handle by ZK itself.
According to your requirement, my suggest is override the jq.alert() method, like this:

<zk>
	<script>
	jq.alert = function (msg, opts) {
		alert("ERROR!");
	}
	</script>
	<button label="Upload error" upload="true, maxsize=1"/>
</zk>

Notice: It has global effect with other component which use this function on the same zul.

Reference:
http://books.zkoss.org/wiki/ZK_Client-side_Reference/General_Control/Widget_Customization
https://github.com/zkoss/zk/blob/master/zul/src/archive/web/js/zul/dom.js
http://www.zkoss.org/javadoc/6.5.0/jsdoc/_global_/jq.html#alert(_global_.String, _global_.Map)

Regards,
Monty Pan

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: 2012-11-14 13:32:22 +0800

Seen: 227 times

Last updated: Nov 15 '12

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