/* * Copyright 2000-2016 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. *

* The {@link Binder} status is changed whenever any of the following happens: *

* * @see StatusChangeListener#statusChange(StatusChangeEvent) * @see Binder#addStatusChangeListener(StatusChangeListener) * * @author Vaadin Ltd * */ public class StatusChangeEvent extends EventObject { private final boolean hasValidationErrors; /** * Create a new status change event for given {@code binder} using its * current validation status. * * @param binder * the event source binder * @param hasValidationErrors * the binder validation status */ public StatusChangeEvent(Binder binder, boolean hasValidationErrors) { super(binder); this.hasValidationErrors = hasValidationErrors; } /** * Gets the binder validation status. * * @return {@code true} if the binder has 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(); } }