-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I want to customize the Messagebox component, that is to add names for buttons in archive/web/zul/html/messageboxdialog.zul.
but instead of modifying the origional source code, I desire to add new file named namedmessageboxdialog.zul
and in accordding to it, I desire to add an org.zkoss.zul.NamedMessageboxDlg.java.
Now I don't know what else to do, how to configure in conf files, can any guy tell me the steps in detail?
relative files are as bellow:
(1) archive/web/zul/html/namedmessageboxdialog.zul
<?xml version="1.0" encoding="UTF-8"?>
...
<hbox style="margin-left:auto; margin-right:auto">
<button id="btn1" name="aslmsgyes" identity="${arg.OK}" sclass="z-messagebox-btn" use="org.zkoss.zul.impl.MessageboxDlg$Button"
if="$"/>
<button name="aslmsgcancel" identity="${arg.CANCEL}" sclass="z-messagebox-btn" use="org.zkoss.zul.impl.MessageboxDlg$Button"
if="$"/>
...
</hbox>
</window>
(2) org.zkoss.zul.NamedMessageboxDlg.java
package org.zkoss.zul.impl;
...
/**
* Used with {@link Messagebox} to implement a message box.
*
* @author tomyeh
*/
public class MessageboxDlg extends Window {
...
/**
* Represents a button on the message box.
* @since 3.0.0
*/
public static class Button extends org.zkoss.zul.ASLNamedButton {
...
}
}
Hi,
Configuration file would be src\archive\metainfo\zk\lang.xml
and component development guide may help
http://www.zkoss.org/doc/compdevguide/
hai tiaji,
do use success to implement your Messagebox, Can you share that ?
Regards,
Andy Susanto
hai Stephen,
i just try your code. The example almost work, but where is the button ?myCustomMessage
Regards,
Andy Susanto
@ibsolution,
Please show your code.
Stephan
hai,
zul file
<?xml version="1.0" encoding="UTF-8"?> <window id="wndconfirm" use="org.zkoss.zul.impl.MessageboxDlg" title="${arg.title}" border="none" width="300pt" height="200pt"> <hbox> <div class="${arg.icon}" /> <div sclass="z-messagebox" width="100%"> <label value="Password : " /> <textbox id="pass" type="password" /> </div> </hbox> <separator bar="true" /> <hbox style="margin-left:auto; margin-right:auto"> <button id="btn1" identity="${arg.OK}" sclass="z-messagebox-btn" use="org.zkoss.zul.impl.MessageboxDlg$Button" if="$" /> <button identity="${arg.CANCEL}" sclass="z-messagebox-btn" use="org.zkoss.zul.impl.MessageboxDlg$Button" if="$" /> <button identity="${arg.YES}" sclass="z-messagebox-btn" use="org.zkoss.zul.impl.MessageboxDlg$Button" if="$" /> <button identity="${arg.NO}" sclass="z-messagebox-btn" use="org.zkoss.zul.impl.MessageboxDlg$Button" if="$" /> <button identity="${arg.RETRY}" sclass="z-messagebox-btn" use="org.zkoss.zul.impl.MessageboxDlg$Button" if="$" /> <button identity="${arg.ABORT}" sclass="z-messagebox-btn" use="org.zkoss.zul.impl.MessageboxDlg$Button" if="$" /> <button identity="${arg.IGNORE}" sclass="z-messagebox-btn" use="org.zkoss.zul.impl.MessageboxDlg$Button" if="$" /> </hbox> </window>
java
toolBarBtn.addEventListener("onClick", new EventListener() { boolean canUpdate = Boolean.TRUE; public void onEvent(Event event) { UserObject usrObj = (UserObject)(Sessions.getCurrent()).getAttribute("key"); if (usrObj.doEditWithPassword()){ canUpdate = !usrObj.doEditWithPassword(); try{ Messagebox.setTemplate("../windowconfirm/windowconfirm.zul"); Messagebox.show("Insert Password to Edit", "Question", Messagebox.YES|Messagebox.NO,Messagebox.QUESTION, new EventListener() { public void onEvent(Event evt) { switch (((Integer)evt.getData()).intValue()) { case Messagebox.YES: canUpdate = Boolean.TRUE; break; //the Yes button is pressed case Messagebox.NO: canUpdate = Boolean.FALSE; break; //the No button is pressed } }}); }catch(InterruptedException e1){} } if (canUpdate){ update(id); } } });
Regards,
Andy Susanto
Hmmmm,
have a look at the original.
You have deleted the args of the if tags
if="$" if="$ '{' '!' 'empty' 'arg''.'OK'}'" --> Delete the ''.
Argh. Cannot write the code here. It's time for made an update of the forum :-)
So the overhanded button-params are not evaluated.
This is originally by zkoss. I have only modified for multiline working.
Stephan
oke,
i implement your code and now work properly
thanks for your help,
Andy Susanto
Asked: 2009-04-19 15:21:35 +0800
Seen: 697 times
Last updated: May 16 '09