📄 b30-1701986.zul
字号:
<window title="constraints depends on two component" border="normal"> Bug 1701986: The error msgbox should disappear when error is corrected. <zscript> <![CDATA[Constraint ctt = new Constraint() { public void validate(Component comp, Object value) throws WrongValueException { comp.setAttribute("dt", value); if (comp.getFellowIfAny("endDate") != null && comp.getFellowIfAny("beginDate") != null) { Date beginValue = null; if (comp.getId().equals("beginDate")) { beginValue = (Date) value; } else { beginValue = (Date) ((Datebox) comp.getFellowIfAny("beginDate")).getAttribute("dt"); } Date endValue = null; if (comp.getId().equals("endDate")) { endValue = (Date) value; } else { endValue = (Date)((Datebox) comp.getFellowIfAny("endDate")).getAttribute("dt"); } if (beginValue != null && endValue != null) { if (endValue.before(beginValue)) { throw new WrongValueException(comp, "ErrorMessage"); } else { long startM = beginValue.getTime(); long endM = endValue.getTime(); int days_plan = ((Long) ((endM - startM) / 1000 / 60 / 60 / 24)) .intValue(); ((Label) comp.getFellowIfAny("days")) .setValue(new Integer(days_plan).toString()); comp.getFellow("beginDate").clearErrorMessage(); comp.getFellow("endDate").clearErrorMessage(); } } } }};]]> </zscript> <grid width="90%"> <rows> <row> <label id="days" /> </row> <row> start date box: <datebox id="beginDate" constraint="${ctt}"/> </row> <row> end date box: <datebox id="endDate" constraint="${ctt}" /> </row> </rows> </grid> <label id = "lb" /><button label="submit"><attribute name="onClick">lb.setValue((beginDate.getValue() == null ? "" : beginDate.getValue().toString())+(endDate.getValue() == null ? "" : endDate.getValue().toString()) );</attribute></button></window>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -