01: package org.osbl.client.wings.form;
02:
03: import org.conform.BeanData;
04: import org.conform.ValidationException;
05: import org.wings.SForm;
06: import org.wings.LowLevelEventListener;
07:
08: import java.beans.PropertyChangeListener;
09: import java.beans.PropertyChangeEvent;
10:
11: /**
12: * Created by IntelliJ IDEA.
13: * User: hengels
14: * Date: Jun 27, 2006
15: * Time: 11:27:50 PM
16: * To change this template use File | Settings | File Templates.
17: */
18: class DeferredValidationListener implements PropertyChangeListener {
19: protected DeferredValidationListener.Trigger trigger;
20:
21: public DeferredValidationListener(BeanData beanData) {
22: trigger = new DeferredValidationListener.Trigger(beanData);
23: }
24:
25: public void propertyChange(PropertyChangeEvent evt) {
26: SForm.addArmedComponent(trigger);
27: }
28:
29: private class Trigger implements LowLevelEventListener {
30: private final BeanData beanData;
31:
32: public Trigger(BeanData beanData) {
33: this .beanData = beanData;
34: }
35:
36: public void processLowLevelEvent(String name, String[] values) {
37: }
38:
39: public String getLowLevelEventId() {
40: return null;
41: }
42:
43: public String getEncodedLowLevelEventId() {
44: return null;
45: }
46:
47: public String getName() {
48: return null;
49: }
50:
51: public void fireIntermediateEvents() {
52: }
53:
54: public void fireFinalEvents() {
55: try {
56: // TODO: should be selective validation by affected validators only
57: // revalidation is more expensive
58: beanData.revalidate();
59: } catch (ValidationException e) {
60: }
61: }
62:
63: public boolean isEnabled() {
64: return false;
65: }
66:
67: public boolean isEpochCheckEnabled() {
68: return false;
69: }
70:
71: public boolean equals(Object o) {
72: if (this == o)
73: return true;
74: if (o == null || getClass() != o.getClass())
75: return false;
76:
77: final DeferredValidationListener.Trigger that = (DeferredValidationListener.Trigger) o;
78:
79: if (!beanData.equals(that.beanData))
80: return false;
81:
82: return true;
83: }
84:
85: public int hashCode() {
86: return beanData.hashCode();
87: }
88: }
89: }
|