01: /* CustomConstraint.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Wed Apr 11 17:59:43 2007, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2007 Potix Corporation. All Rights Reserved.
13:
14: {{IS_RIGHT
15: This program is distributed under GPL Version 2.0 in the hope that
16: it will be useful, but WITHOUT ANY WARRANTY.
17: }}IS_RIGHT
18: */
19: package org.zkoss.zul;
20:
21: import org.zkoss.zk.ui.Component;
22: import org.zkoss.zk.ui.WrongValueException;
23:
24: /**
25: * Additional interface implemented with {@link Constraint} to denote
26: * a constraint supports a custom way to display the error message.
27: * If this interface is implemented, the default error box won't be
28: * displayed. Rather, {@link #showCustomError} is called.
29: *
30: * <p>Note: if this interface is implemented,
31: * {@link ClientConstraint} is ignored, since all validation will be done
32: * at the server.
33: *
34: * @author tomyeh
35: * @see Constraint
36: * @see ClientConstraint
37: */
38: public interface CustomConstraint {
39: /** To display the error message in a custom way.
40: * Note: this method is called either with a error or not, depending
41: * on whether ex is null.
42: *
43: * @param comp the component causing the error.
44: * @param ex the error to display, or null to clear
45: * the error message.
46: */
47: public void showCustomError(Component comp, WrongValueException ex);
48: }
|