blob: 540402c4e2b8172f1f24f1eab5855c93bcf9df28 [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.values;
import org.eclipse.core.databinding.observable.Realm;
import org.eclipse.core.databinding.property.value.SimpleValueProperty;
import org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue;
import com.vaadin.data.Property;
import com.vaadin.data.Property.Viewer;
import com.vaadin.ui.AbstractSelect;
// TODO: Auto-generated Javadoc
/**
* The Class SimpleVaadinPropertyObservableValue.
*/
@SuppressWarnings("restriction")
public class SimpleVaadinPropertyObservableValue extends
SimplePropertyObservableValue {
/**
* Instantiates a new simple vaadin property observable value.
*
* @param realm
* the realm
* @param source
* the source
* @param property
* the property
*/
public SimpleVaadinPropertyObservableValue(Realm realm, Object source,
SimpleValueProperty property) {
super(realm, source, property);
}
/* (non-Javadoc)
* @see org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue#getValueType()
*/
@Override
public Object getValueType() {
// delegate call to getValueType to vaadin property
com.vaadin.data.Property<?> property = (com.vaadin.data.Property<?>) getObserved();
if (property instanceof AbstractSelect) {
AbstractSelect select = (AbstractSelect) property;
if (select.isMultiSelect()) {
return select.getType();
}
}
if (property instanceof Property.Viewer) {
Property.Viewer viewer = (Viewer) property;
com.vaadin.data.Property<?> internalProperty = viewer
.getPropertyDataSource();
if (internalProperty != null) {
return internalProperty.getType();
}
}
return property.getType();
}
}