blob: b002d22199cb0a08ac660efb8fb421bf5c27af2d [file] [log] [blame]
/**
* Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Florian Pirchner - Initial implementation
*/
package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
import org.eclipse.core.databinding.property.IProperty;
import org.eclipse.core.databinding.property.ISimplePropertyListener;
import org.eclipse.core.databinding.property.NativePropertyListener;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
/**
*/
@SuppressWarnings("serial")
public class PropertyValueChangeListener extends NativePropertyListener
implements Property.ValueChangeListener {
public PropertyValueChangeListener(IProperty property,
ISimplePropertyListener listener) {
super(property, listener);
}
protected void doAddTo(Object source) {
if (source instanceof Property.ValueChangeNotifier) {
Property.ValueChangeNotifier notifier = (Property.ValueChangeNotifier) source;
notifier.addValueChangeListener(this);
}
}
protected void doRemoveFrom(Object source) {
if (source instanceof Property.ValueChangeNotifier) {
Property.ValueChangeNotifier notifier = (Property.ValueChangeNotifier) source;
notifier.removeValueChangeListener(this);
}
}
@Override
public void valueChange(ValueChangeEvent event) {
fireChange(event.getProperty(), null);
}
}