📄 z30-constraint.zul
字号:
<?xml version="1.0" encoding="UTF-8"?><!--constraint.zul{{IS_NOTE Purpose: Description: History: Wed Apr 11 15:01:38 2007, Created by tomyeh}}IS_NOTECopyright (C) 2007 Potix Corporation. All Rights Reserved.{{IS_RIGHT}}IS_RIGHT--><window title="Custom Constraint" border="normal"> <zscript><![CDATA[class MyConst implements Constraint { public void validate(Component comp, Object value) { if (value == null || value < 100) throw new WrongValueException(comp, "At least 100 must be specified"); }}class MyCustomConst extends MyConst implements CustomConstraint { public void showCustomError(Component comp, WrongValueException ex) { errmsg.setValue(ex != null ? ex.getMessage(): ""); }}Constraint ctt = new MyConst();Constraint custom_ctt = new MyCustomConst(); ]]></zscript> <vbox> Test of CustomConstraint <hbox> <button label="Retrieve value" onClick="i1.getValue();i2.getValue()"/> shall cause an error box even no input below </hbox> <hbox> Enter a number at least 100 (customize look): <intbox id="i1" constraint="${custom_ctt}"/> <label id="errmsg"/> </hbox> <hbox> another number at least 100 (standard look): <intbox id="i2" constraint="${ctt}"/> </hbox> <hbox> any number: <intbox/> </hbox> Test of between/and <hbox> A date between 2007/12/25 and 2007/12/03 <datebox constraint="between 20071225 and 20071203"/> </hbox> <hbox> A date before 2007/12/25 (include) <datebox constraint="before 20071225"/> </hbox> </vbox></window>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -