use of org.eclipse.core.databinding.beans.IBeanObservable in project eclipse.platform.ui by eclipse-platform.
the class BeanPropertiesTest method testMap_MapFactory_ProducesIBeanObservable.
@Test
public void testMap_MapFactory_ProducesIBeanObservable() {
IObservable observable = BeanProperties.map(Bean.class, "map").mapFactory().createObservable(bean);
assertTrue(observable instanceof IBeanObservable);
}
use of org.eclipse.core.databinding.beans.IBeanObservable in project eclipse.platform.ui by eclipse-platform.
the class BeanPropertiesTest method testValue_ValueFactory_ProducesIBeanObservable.
@Test
public void testValue_ValueFactory_ProducesIBeanObservable() {
IObservable observable = BeanProperties.value(Bean.class, "value").valueFactory().createObservable(bean);
assertTrue(observable instanceof IBeanObservable);
}
use of org.eclipse.core.databinding.beans.IBeanObservable in project eclipse.platform.ui by eclipse-platform.
the class BeanPropertiesTest method testSet_SetFactory_ProducesIBeanObservable.
@Test
public void testSet_SetFactory_ProducesIBeanObservable() {
IObservable observable = BeanProperties.set(Bean.class, "set").setFactory().createObservable(bean);
assertTrue(observable instanceof IBeanObservable);
}
use of org.eclipse.core.databinding.beans.IBeanObservable in project eclipse.platform.ui by eclipse-platform.
the class BeansObservablesTest method testObserveDetailValueIBeanObservable.
@Test
public void testObserveDetailValueIBeanObservable() throws Exception {
WritableValue<Bean> parent = WritableValue.withValueType(Bean.class);
Bean bean = new Bean();
parent.setValue(bean);
IObservableValue<String> detailValue = BeanProperties.value(Bean.class, "value", String.class).observeDetail(parent);
assertTrue(detailValue instanceof IBeanObservable);
BeanObservableValueDecorator<?> beanObservable = (BeanObservableValueDecorator<?>) detailValue;
assertEquals("property descriptor", Bean.class.getMethod("getValue"), beanObservable.getPropertyDescriptor().getReadMethod());
assertEquals("observed", bean, beanObservable.getObserved());
assertTrue("delegate", beanObservable.getDecorated().getClass().getName().endsWith("DetailObservableValue"));
}
use of org.eclipse.core.databinding.beans.IBeanObservable in project eclipse.platform.ui by eclipse-platform.
the class BeansObservablesTest method testObservableDetailListIBeanObservable.
@Test
public void testObservableDetailListIBeanObservable() throws Exception {
WritableValue<Bean> parent = WritableValue.withValueType(Bean.class);
Bean bean = new Bean();
parent.setValue(bean);
IObservableList<Bean> detailList = BeanProperties.list(Bean.class, "list", Bean.class).observeDetail(parent);
assertTrue("detail is not an IBeanObservable", detailList instanceof IBeanObservable);
BeanObservableListDecorator<?> beanObservable = (BeanObservableListDecorator<?>) detailList;
assertEquals("property descriptor", Bean.class.getMethod("getList"), beanObservable.getPropertyDescriptor().getReadMethod());
assertEquals("observed", bean, beanObservable.getObserved());
// DetailObservableList is package level we can do a straight instanceof
// check
assertTrue("delegate is the observed", beanObservable.getDecorated().equals(detailList));
}
Aggregations