blob: c31cd7479f90e68845d243f5e00d4f80c1615292 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
/*
* Copyright 2000-2022 Vaadin Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.data;
import java.util.EventObject;
import com.vaadin.data.Binder.Binding;
import com.vaadin.data.Binder.BindingBuilder;
import com.vaadin.server.Setter;
/**
* Binder status change event.
* <p>
* The {@link Binder} status is changed whenever any of the following happens:
* <ul>
* <li>if any of its bound fields or selects have been changed
* <li>{@link Binder#writeBean(Object)} or
* {@link Binder#writeBeanIfValid(Object)} is called
* <li>{@link Binder#readBean(Object)} is called
* <li>{@link Binder#setBean(Object)} is called
* <li>{@link Binder#removeBean()} is called
* <li>{@link BindingBuilder#bind(ValueProvider, Setter)} is called
* <li>{@link Binder#validate()} or {@link Binding#validate()} is called
* </ul>
*
* @see StatusChangeListener#statusChange(StatusChangeEvent)
* @see Binder#addStatusChangeListener(StatusChangeListener)
*
* @author Vaadin Ltd
*
* @since 8.0
*/
public class StatusChangeEvent extends EventObject {
private final boolean hasValidationErrors;
/**
* Create a new status change event for given {@code binder}, storing
* information of whether the change that triggered this event caused
* validation errors.
*
* @param binder
* the event source binder
* @param hasValidationErrors
* the validation status associated with this event
*/
public StatusChangeEvent(Binder<?> binder, boolean hasValidationErrors) {
super(binder);
this.hasValidationErrors = hasValidationErrors;
}
/**
* Gets the associated validation status.
*
* @return {@code true} if the change that triggered this event caused
* validation errors, {@code false} otherwise
*/
public boolean hasValidationErrors() {
return hasValidationErrors;
}
@Override
public Binder<?> getSource() {
return (Binder<?>) super.getSource();
}
/**
* Gets the binder.
*
* @return the binder
*/
public Binder<?> getBinder() {
return getSource();
}
}
|