Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 121020 Details for
Bug 194734
[Databinding] Property-based observables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Update
clipboard.txt (text/plain), 76.70 KB, created by
Matthew Hall
on 2008-12-21 01:29:27 EST
(
hide
)
Description:
Update
Filename:
MIME Type:
Creator:
Matthew Hall
Created:
2008-12-21 01:29:27 EST
Size:
76.70 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.databinding.beans >Index: src/org/eclipse/core/databinding/beans/PojoProperties.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.databinding.beans/src/org/eclipse/core/databinding/beans/Attic/PojoProperties.java,v >retrieving revision 1.1.2.1 >diff -u -r1.1.2.1 PojoProperties.java >--- src/org/eclipse/core/databinding/beans/PojoProperties.java 17 Dec 2008 18:40:07 -0000 1.1.2.1 >+++ src/org/eclipse/core/databinding/beans/PojoProperties.java 21 Dec 2008 06:26:08 -0000 >@@ -13,11 +13,15 @@ > > import java.beans.PropertyChangeEvent; > >-import org.eclipse.core.databinding.property.list.IListProperty; >-import org.eclipse.core.databinding.property.map.IMapProperty; >-import org.eclipse.core.databinding.property.set.ISetProperty; >-import org.eclipse.core.databinding.property.value.IValueProperty; >+import org.eclipse.core.databinding.property.list.SimpleListProperty; >+import org.eclipse.core.databinding.property.map.SimpleMapProperty; >+import org.eclipse.core.databinding.property.set.SimpleSetProperty; >+import org.eclipse.core.databinding.property.value.SimpleValueProperty; > import org.eclipse.core.internal.databinding.beans.BeanPropertyHelper; >+import org.eclipse.core.internal.databinding.beans.AnonymousPojoListProperty; >+import org.eclipse.core.internal.databinding.beans.AnonymousPojoMapProperty; >+import org.eclipse.core.internal.databinding.beans.AnonymousPojoSetProperty; >+import org.eclipse.core.internal.databinding.beans.AnonymousPojoValueProperty; > import org.eclipse.core.internal.databinding.beans.PojoListProperty; > import org.eclipse.core.internal.databinding.beans.PojoMapProperty; > import org.eclipse.core.internal.databinding.beans.PojoSetProperty; >@@ -33,6 +37,36 @@ > */ > public class PojoProperties { > /** >+ * Returns a value property for the given property name of an arbitrary bean >+ * class. Objects lacking the named property are treated the same as if the >+ * property always contains null. >+ * >+ * @param propertyName >+ * the property name >+ * @return a value property for the given property name of an arbitrary bean >+ * class. >+ */ >+ public static SimpleValueProperty value(String propertyName) { >+ return value(propertyName, null); >+ } >+ >+ /** >+ * Returns a value property for the given property name of an arbitrary bean >+ * class. Objects lacking the named property are treated the same as if the >+ * property always contains null. >+ * >+ * @param propertyName >+ * the property name >+ * @param valueType >+ * the value type of the returned value property >+ * @return a value property for the given property name of an arbitrary bean >+ * class. >+ */ >+ public static SimpleValueProperty value(String propertyName, Class valueType) { >+ return new AnonymousPojoValueProperty(propertyName, valueType); >+ } >+ >+ /** > * Returns a value property for the given property name of the given bean > * class. > * >@@ -43,7 +77,7 @@ > * @return a value property for the given property name of the given bean > * class. > */ >- public static IValueProperty value(Class beanClass, String propertyName) { >+ public static SimpleValueProperty value(Class beanClass, String propertyName) { > return value(beanClass, propertyName, null); > } > >@@ -60,13 +94,43 @@ > * @return a value property for the given property name of the given bean > * class. > */ >- public static IValueProperty value(Class beanClass, String propertyName, >+ public static SimpleValueProperty value(Class beanClass, String propertyName, > Class valueType) { > return new PojoValueProperty(BeanPropertyHelper.getPropertyDescriptor( > beanClass, propertyName), valueType); > } > > /** >+ * Returns a set property for the given property name of an arbitrary bean >+ * class. Objects lacking the named property are treated the same as if the >+ * property always contains an empty set. >+ * >+ * @param propertyName >+ * the property name >+ * @return a set property for the given property name of an arbitrary bean >+ * class. >+ */ >+ public static SimpleSetProperty set(String propertyName) { >+ return set(propertyName, null); >+ } >+ >+ /** >+ * Returns a set property for the given property name of an arbitrary bean >+ * class. Objects lacking the named property are treated the same as if the >+ * property always contains an empty set. >+ * >+ * @param propertyName >+ * the property name >+ * @param elementType >+ * the element type of the returned set property >+ * @return a set property for the given property name of an arbitrary bean >+ * class. >+ */ >+ public static SimpleSetProperty set(String propertyName, Class elementType) { >+ return new AnonymousPojoSetProperty(propertyName, elementType); >+ } >+ >+ /** > * Returns a set property for the given property name of the given bean > * class. > * >@@ -77,7 +141,7 @@ > * @return a set property for the given property name of the given bean > * class. > */ >- public static ISetProperty set(Class beanClass, String propertyName) { >+ public static SimpleSetProperty set(Class beanClass, String propertyName) { > return set(beanClass, propertyName, null); > } > >@@ -94,13 +158,43 @@ > * @return a set property for the given property name of the given bean > * class. > */ >- public static ISetProperty set(Class beanClass, String propertyName, >+ public static SimpleSetProperty set(Class beanClass, String propertyName, > Class elementType) { > return new PojoSetProperty(BeanPropertyHelper.getPropertyDescriptor( > beanClass, propertyName), elementType); > } > > /** >+ * Returns a list property for the given property name of an arbitrary bean >+ * class. Objects lacking the named property are treated the same as if the >+ * property always contains an empty list. >+ * >+ * @param propertyName >+ * the property name >+ * @return a list property for the given property name of an arbitrary bean >+ * class. >+ */ >+ public static SimpleListProperty list(String propertyName) { >+ return list(propertyName, null); >+ } >+ >+ /** >+ * Returns a list property for the given property name of an arbitrary bean >+ * class. Objects lacking the named property are treated the same as if the >+ * property always contains an empty list. >+ * >+ * @param propertyName >+ * the property name >+ * @param elementType >+ * the element type of the returned list property >+ * @return a list property for the given property name of the given bean >+ * class. >+ */ >+ public static SimpleListProperty list(String propertyName, Class elementType) { >+ return new AnonymousPojoListProperty(propertyName, elementType); >+ } >+ >+ /** > * Returns a list property for the given property name of the given bean > * class. > * >@@ -111,7 +205,7 @@ > * @return a list property for the given property name of the given bean > * class. > */ >- public static IListProperty list(Class beanClass, String propertyName) { >+ public static SimpleListProperty list(Class beanClass, String propertyName) { > return list(beanClass, propertyName, null); > } > >@@ -128,13 +222,61 @@ > * @return a list property for the given property name of the given bean > * class. > */ >- public static IListProperty list(Class beanClass, String propertyName, >+ public static SimpleListProperty list(Class beanClass, String propertyName, > Class elementType) { > return new PojoListProperty(BeanPropertyHelper.getPropertyDescriptor( > beanClass, propertyName), elementType); > } > > /** >+ * Returns a map property for the given property name of an arbitrary bean >+ * class. Objects lacking the named property are treated the same as if the >+ * property always contains an empty map. >+ * >+ * @param propertyName >+ * the property name >+ * @return a map property for the given property name of an arbitrary bean >+ * class. >+ */ >+ public static SimpleMapProperty map(String propertyName) { >+ return map(propertyName, null, null); >+ } >+ >+ /** >+ * Returns a map property for the given property name of an arbitrary bean >+ * class. Objects lacking the named property are treated the same as if the >+ * property always contains an empty map. >+ * >+ * @param propertyName >+ * the property name >+ * @param keyType >+ * the key type for the returned map property >+ * @param valueType >+ * the value type for the returned map property >+ * @return a map property for the given property name of an arbitrary bean >+ * class. >+ */ >+ public static SimpleMapProperty map(String propertyName, Class keyType, >+ Class valueType) { >+ return new AnonymousPojoMapProperty(propertyName, keyType, valueType); >+ } >+ >+ /** >+ * Returns a map property for the given property name of the given bean >+ * class. >+ * >+ * @param beanClass >+ * the bean class >+ * @param propertyName >+ * the property name >+ * @return a map property for the given property name of the given bean >+ * class. >+ */ >+ public static SimpleMapProperty map(Class beanClass, String propertyName) { >+ return map(beanClass, propertyName, null, null); >+ } >+ >+ /** > * Returns a map property for the given property name of the given bean > * class. > * >@@ -149,7 +291,7 @@ > * @return a map property for the given property name of the given bean > * class. > */ >- public static IMapProperty map(Class beanClass, String propertyName, >+ public static SimpleMapProperty map(Class beanClass, String propertyName, > Class keyType, Class valueType) { > return new PojoMapProperty(BeanPropertyHelper.getPropertyDescriptor( > beanClass, propertyName), keyType, valueType); >Index: src/org/eclipse/core/databinding/beans/BeansObservables.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.databinding.beans/src/org/eclipse/core/databinding/beans/BeansObservables.java,v >retrieving revision 1.22.2.1 >diff -u -r1.22.2.1 BeansObservables.java >--- src/org/eclipse/core/databinding/beans/BeansObservables.java 17 Dec 2008 18:40:07 -0000 1.22.2.1 >+++ src/org/eclipse/core/databinding/beans/BeansObservables.java 21 Dec 2008 06:26:08 -0000 >@@ -92,8 +92,27 @@ > } > > /** >- * Returns an observable map in the default realm tracking the current >- * values of the named property for the beans in the given set. >+ * Returns an observable map in the given observable set's realm tracking >+ * the current values of the named property for the beans in the given set. >+ * Elements in the set which do not have the named property will have null >+ * values, and attempts to {@link IObservableMap#put(Object, Object) put} >+ * values to these elements will be ignored. >+ * >+ * @param domain >+ * the set of bean objects >+ * @param propertyName >+ * the name of the property >+ * @return an observable map tracking the current values of the named >+ * property for the beans in the given domain set >+ */ >+ public static IObservableMap observeMap(IObservableSet domain, >+ String propertyName) { >+ return BeanProperties.value(propertyName).observeDetailValues(domain); >+ } >+ >+ /** >+ * Returns an observable map in the given observable set's realm tracking >+ * the current values of the named property for the beans in the given set. > * > * @param domain > * the set of bean objects >@@ -204,8 +223,33 @@ > } > > /** >- * Returns an array of observable maps in the default realm tracking the >- * current values of the named propertys for the beans in the given set. >+ * Returns an array of observable maps in the given observable set's realm >+ * tracking the current values of the named properties for the beans in the >+ * given set. Elements in the set which do not have the named property will >+ * have null values, and attempts to >+ * {@link IObservableMap#put(Object, Object) put} values to these elements >+ * will be ignored. >+ * >+ * @param domain >+ * the set of objects >+ * @param propertyNames >+ * the array of property names >+ * @return an array of observable maps tracking the current values of the >+ * named propertys for the beans in the given domain set >+ */ >+ public static IObservableMap[] observeMaps(IObservableSet domain, >+ String[] propertyNames) { >+ IObservableMap[] result = new IObservableMap[propertyNames.length]; >+ for (int i = 0; i < propertyNames.length; i++) { >+ result[i] = observeMap(domain, propertyNames[i]); >+ } >+ return result; >+ } >+ >+ /** >+ * Returns an array of observable maps in the given observable set's realm >+ * tracking the current values of the named properties for the beans in the >+ * given set. > * > * @param domain > * the set of objects >Index: src/org/eclipse/core/databinding/beans/BeanProperties.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.databinding.beans/src/org/eclipse/core/databinding/beans/Attic/BeanProperties.java,v >retrieving revision 1.1.2.1 >diff -u -r1.1.2.1 BeanProperties.java >--- src/org/eclipse/core/databinding/beans/BeanProperties.java 17 Dec 2008 18:40:07 -0000 1.1.2.1 >+++ src/org/eclipse/core/databinding/beans/BeanProperties.java 21 Dec 2008 06:26:08 -0000 >@@ -7,14 +7,19 @@ > * > * Contributors: > * Matthew Hall - initial API and implementation (bug 194734) >+ * Matthew Hall - bug 247997 > ******************************************************************************/ > > package org.eclipse.core.databinding.beans; > >-import org.eclipse.core.databinding.property.list.IListProperty; >-import org.eclipse.core.databinding.property.map.IMapProperty; >-import org.eclipse.core.databinding.property.set.ISetProperty; >-import org.eclipse.core.databinding.property.value.IValueProperty; >+import org.eclipse.core.databinding.property.list.SimpleListProperty; >+import org.eclipse.core.databinding.property.map.SimpleMapProperty; >+import org.eclipse.core.databinding.property.set.SimpleSetProperty; >+import org.eclipse.core.databinding.property.value.SimpleValueProperty; >+import org.eclipse.core.internal.databinding.beans.AnonymousBeanListProperty; >+import org.eclipse.core.internal.databinding.beans.AnonymousBeanMapProperty; >+import org.eclipse.core.internal.databinding.beans.AnonymousBeanSetProperty; >+import org.eclipse.core.internal.databinding.beans.AnonymousBeanValueProperty; > import org.eclipse.core.internal.databinding.beans.BeanListProperty; > import org.eclipse.core.internal.databinding.beans.BeanMapProperty; > import org.eclipse.core.internal.databinding.beans.BeanPropertyHelper; >@@ -30,6 +35,36 @@ > */ > public class BeanProperties { > /** >+ * Returns a value property for the given property name of an arbitrary bean >+ * class. Objects lacking the named property are treated the same as if the >+ * property always contains null. >+ * >+ * @param propertyName >+ * the property name >+ * @return a value property for the given property name of an arbitrary bean >+ * class. >+ */ >+ public static SimpleValueProperty value(String propertyName) { >+ return value(propertyName, null); >+ } >+ >+ /** >+ * Returns a value property for the given property name of an arbitrary bean >+ * class. Objects lacking the named property are treated the same as if the >+ * property always contains null. >+ * >+ * @param propertyName >+ * the property name >+ * @param valueType >+ * the value type of the returned value property >+ * @return a value property for the given property name of an arbitrary bean >+ * class. >+ */ >+ public static SimpleValueProperty value(String propertyName, Class valueType) { >+ return new AnonymousBeanValueProperty(propertyName, valueType); >+ } >+ >+ /** > * Returns a value property for the given property name of the given bean > * class. > * >@@ -40,7 +75,7 @@ > * @return a value property for the given property name of the given bean > * class. > */ >- public static IValueProperty value(Class beanClass, String propertyName) { >+ public static SimpleValueProperty value(Class beanClass, String propertyName) { > return value(beanClass, propertyName, null); > } > >@@ -57,13 +92,43 @@ > * @return a value property for the given property name of the given bean > * class. > */ >- public static IValueProperty value(Class beanClass, String propertyName, >+ public static SimpleValueProperty value(Class beanClass, String propertyName, > Class valueType) { > return new BeanValueProperty(BeanPropertyHelper.getPropertyDescriptor( > beanClass, propertyName), valueType); > } > > /** >+ * Returns a set property for the given property name of an arbitrary bean >+ * class. Objects lacking the named property are treated the same as if the >+ * property always contains an empty set. >+ * >+ * @param propertyName >+ * the property name >+ * @return a set property for the given property name of an arbitrary bean >+ * class. >+ */ >+ public static SimpleSetProperty set(String propertyName) { >+ return set(propertyName, null); >+ } >+ >+ /** >+ * Returns a set property for the given property name of an arbitrary bean >+ * class. Objects lacking the named property are treated the same as if the >+ * property always contains an empty set. >+ * >+ * @param propertyName >+ * the property name >+ * @param elementType >+ * the element type of the returned set property >+ * @return a set property for the given property name of an arbitrary bean >+ * class. >+ */ >+ public static SimpleSetProperty set(String propertyName, Class elementType) { >+ return new AnonymousBeanSetProperty(propertyName, elementType); >+ } >+ >+ /** > * Returns a set property for the given property name of the given bean > * class. > * >@@ -74,7 +139,7 @@ > * @return a set property for the given property name of the given bean > * class. > */ >- public static ISetProperty set(Class beanClass, String propertyName) { >+ public static SimpleSetProperty set(Class beanClass, String propertyName) { > return set(beanClass, propertyName, null); > } > >@@ -91,13 +156,43 @@ > * @return a set property for the given property name of the given bean > * class. > */ >- public static ISetProperty set(Class beanClass, String propertyName, >+ public static SimpleSetProperty set(Class beanClass, String propertyName, > Class elementType) { > return new BeanSetProperty(BeanPropertyHelper.getPropertyDescriptor( > beanClass, propertyName), elementType); > } > > /** >+ * Returns a list property for the given property name of an arbitrary bean >+ * class. Objects lacking the named property are treated the same as if the >+ * property always contains an empty list. >+ * >+ * @param propertyName >+ * the property name >+ * @return a list property for the given property name of an arbitrary bean >+ * class. >+ */ >+ public static SimpleListProperty list(String propertyName) { >+ return list(propertyName, null); >+ } >+ >+ /** >+ * Returns a list property for the given property name of an arbitrary bean >+ * class. Objects lacking the named property are treated the same as if the >+ * property always contains an empty list. >+ * >+ * @param propertyName >+ * the property name >+ * @param elementType >+ * the element type of the returned list property >+ * @return a list property for the given property name of the given bean >+ * class. >+ */ >+ public static SimpleListProperty list(String propertyName, Class elementType) { >+ return new AnonymousBeanListProperty(propertyName, elementType); >+ } >+ >+ /** > * Returns a list property for the given property name of the given bean > * class. > * >@@ -108,7 +203,7 @@ > * @return a list property for the given property name of the given bean > * class. > */ >- public static IListProperty list(Class beanClass, String propertyName) { >+ public static SimpleListProperty list(Class beanClass, String propertyName) { > return list(beanClass, propertyName, null); > } > >@@ -125,13 +220,61 @@ > * @return a list property for the given property name of the given bean > * class. > */ >- public static IListProperty list(Class beanClass, String propertyName, >+ public static SimpleListProperty list(Class beanClass, String propertyName, > Class elementType) { > return new BeanListProperty(BeanPropertyHelper.getPropertyDescriptor( > beanClass, propertyName), elementType); > } > > /** >+ * Returns a map property for the given property name of an arbitrary bean >+ * class. Objects lacking the named property are treated the same as if the >+ * property always contains an empty map. >+ * >+ * @param propertyName >+ * the property name >+ * @return a map property for the given property name of an arbitrary bean >+ * class. >+ */ >+ public static SimpleMapProperty map(String propertyName) { >+ return map(propertyName, null, null); >+ } >+ >+ /** >+ * Returns a map property for the given property name of an arbitrary bean >+ * class. Objects lacking the named property are treated the same as if the >+ * property always contains an empty map. >+ * >+ * @param propertyName >+ * the property name >+ * @param keyType >+ * the key type for the returned map property >+ * @param valueType >+ * the value type for the returned map property >+ * @return a map property for the given property name of an arbitrary bean >+ * class. >+ */ >+ public static SimpleMapProperty map(String propertyName, Class keyType, >+ Class valueType) { >+ return new AnonymousBeanMapProperty(propertyName, keyType, valueType); >+ } >+ >+ /** >+ * Returns a map property for the given property name of the given bean >+ * class. >+ * >+ * @param beanClass >+ * the bean class >+ * @param propertyName >+ * the property name >+ * @return a map property for the given property name of the given bean >+ * class. >+ */ >+ public static SimpleMapProperty map(Class beanClass, String propertyName) { >+ return map(beanClass, propertyName, null, null); >+ } >+ >+ /** > * Returns a map property for the given property name of the given bean > * class. > * >@@ -146,7 +289,7 @@ > * @return a map property for the given property name of the given bean > * class. > */ >- public static IMapProperty map(Class beanClass, String propertyName, >+ public static SimpleMapProperty map(Class beanClass, String propertyName, > Class keyType, Class valueType) { > return new BeanMapProperty(BeanPropertyHelper.getPropertyDescriptor( > beanClass, propertyName), keyType, valueType); >Index: src/org/eclipse/core/databinding/beans/PojoObservables.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.databinding.beans/src/org/eclipse/core/databinding/beans/PojoObservables.java,v >retrieving revision 1.9.2.1 >diff -u -r1.9.2.1 PojoObservables.java >--- src/org/eclipse/core/databinding/beans/PojoObservables.java 17 Dec 2008 18:40:07 -0000 1.9.2.1 >+++ src/org/eclipse/core/databinding/beans/PojoObservables.java 21 Dec 2008 06:26:08 -0000 >@@ -82,8 +82,27 @@ > } > > /** >- * Returns an observable map in the default realm tracking the current >- * values of the named property for the pojos in the given set. >+ * Returns an observable map in the given observable set's realm tracking >+ * the current values of the named property for the beans in the given set. >+ * Elements in the set which do not have the named property will have null >+ * values, and attempts to {@link IObservableMap#put(Object, Object) put} >+ * values to these elements will be ignored. >+ * >+ * @param domain >+ * the set of bean objects >+ * @param propertyName >+ * the name of the property >+ * @return an observable map tracking the current values of the named >+ * property for the beans in the given domain set >+ */ >+ public static IObservableMap observeMap(IObservableSet domain, >+ String propertyName) { >+ return PojoProperties.value(propertyName).observeDetailValues(domain); >+ } >+ >+ /** >+ * Returns an observable map in the given observable set's realm tracking >+ * the current values of the named property for the pojos in the given set. > * > * @param domain > * the set of pojo objects >@@ -105,8 +124,33 @@ > } > > /** >- * Returns an array of observable maps in the default realm tracking the >- * current values of the named propertys for the pojos in the given set. >+ * Returns an array of observable maps in the given observable set's realm >+ * tracking the current values of the named properties for the beans in the >+ * given set. Elements in the set which do not have the named property will >+ * have null values, and attempts to >+ * {@link IObservableMap#put(Object, Object) put} values to these elements >+ * will be ignored. >+ * >+ * @param domain >+ * the set of objects >+ * @param propertyNames >+ * the array of property names >+ * @return an array of observable maps tracking the current values of the >+ * named propertys for the beans in the given domain set >+ */ >+ public static IObservableMap[] observeMaps(IObservableSet domain, >+ String[] propertyNames) { >+ IObservableMap[] result = new IObservableMap[propertyNames.length]; >+ for (int i = 0; i < propertyNames.length; i++) { >+ result[i] = observeMap(domain, propertyNames[i]); >+ } >+ return result; >+ } >+ >+ /** >+ * Returns an array of observable maps in the given observable set's realm >+ * tracking the current values of the named propertys for the pojos in the >+ * given set. > * > * @param domain > * the set of objects >Index: src/org/eclipse/core/internal/databinding/beans/AnonymousBeanListProperty.java >=================================================================== >RCS file: src/org/eclipse/core/internal/databinding/beans/AnonymousBeanListProperty.java >diff -N src/org/eclipse/core/internal/databinding/beans/AnonymousBeanListProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/databinding/beans/AnonymousBeanListProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,69 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Matthew Hall and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Matthew Hall - initial API and implementation (bug 247997) >+ ******************************************************************************/ >+ >+package org.eclipse.core.internal.databinding.beans; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.databinding.BindingException; >+import org.eclipse.core.databinding.beans.BeanProperties; >+import org.eclipse.core.databinding.property.list.DelegatingListProperty; >+import org.eclipse.core.databinding.property.list.SimpleListProperty; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class AnonymousBeanListProperty extends DelegatingListProperty { >+ private final String propertyName; >+ >+ private Map delegates; >+ >+ /** >+ * @param propertyName >+ * @param elementType >+ */ >+ public AnonymousBeanListProperty(String propertyName, Class elementType) { >+ super(elementType); >+ this.propertyName = propertyName; >+ this.delegates = new HashMap(); >+ } >+ >+ protected SimpleListProperty getDelegate(Object source) { >+ if (source == null) >+ return null; >+ >+ Class beanClass = source.getClass(); >+ if (delegates.containsKey(beanClass)) >+ return (BeanListProperty) delegates.get(beanClass); >+ >+ BeanListProperty delegate; >+ try { >+ delegate = (BeanListProperty) BeanProperties.list(beanClass, >+ propertyName, (Class) getElementType()); >+ } catch (BindingException noSuchProperty) { >+ delegate = null; >+ } >+ delegates.put(beanClass, delegate); >+ return delegate; >+ } >+ >+ public String toString() { >+ String s = "{{Generic Bean}}." + propertyName + "[]"; //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ Class elementType = (Class) getElementType(); >+ if (elementType != null) >+ s += " <" + elementType.getName() + ">"; //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ return s; >+ } >+} >Index: src/org/eclipse/core/internal/databinding/beans/AnonymousPojoSetProperty.java >=================================================================== >RCS file: src/org/eclipse/core/internal/databinding/beans/AnonymousPojoSetProperty.java >diff -N src/org/eclipse/core/internal/databinding/beans/AnonymousPojoSetProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/databinding/beans/AnonymousPojoSetProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,69 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Matthew Hall and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Matthew Hall - initial API and implementation (bug 247997) >+ ******************************************************************************/ >+ >+package org.eclipse.core.internal.databinding.beans; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.databinding.BindingException; >+import org.eclipse.core.databinding.beans.PojoProperties; >+import org.eclipse.core.databinding.property.set.DelegatingSetProperty; >+import org.eclipse.core.databinding.property.set.SimpleSetProperty; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class AnonymousPojoSetProperty extends DelegatingSetProperty { >+ private final String propertyName; >+ >+ private Map delegates; >+ >+ /** >+ * @param propertyName >+ * @param elementType >+ */ >+ public AnonymousPojoSetProperty(String propertyName, Class elementType) { >+ super(elementType); >+ this.propertyName = propertyName; >+ this.delegates = new HashMap(); >+ } >+ >+ protected SimpleSetProperty getDelegate(Object source) { >+ if (source == null) >+ return null; >+ >+ Class beanClass = source.getClass(); >+ if (delegates.containsKey(beanClass)) >+ return (PojoSetProperty) delegates.get(beanClass); >+ >+ PojoSetProperty delegate; >+ try { >+ delegate = (PojoSetProperty) PojoProperties.set(beanClass, >+ propertyName, (Class) getElementType()); >+ } catch (BindingException noSuchProperty) { >+ delegate = null; >+ } >+ delegates.put(beanClass, delegate); >+ return delegate; >+ } >+ >+ public String toString() { >+ String s = "{{Generic POJO}}." + propertyName + "{}"; //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ Class elementType = (Class) getElementType(); >+ if (elementType != null) >+ s += " <" + elementType.getName() + ">"; //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ return s; >+ } >+} >Index: src/org/eclipse/core/internal/databinding/beans/AnonymousBeanValueProperty.java >=================================================================== >RCS file: src/org/eclipse/core/internal/databinding/beans/AnonymousBeanValueProperty.java >diff -N src/org/eclipse/core/internal/databinding/beans/AnonymousBeanValueProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/databinding/beans/AnonymousBeanValueProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,69 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Matthew Hall and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Matthew Hall - initial API and implementation (bug 247997) >+ ******************************************************************************/ >+ >+package org.eclipse.core.internal.databinding.beans; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.databinding.BindingException; >+import org.eclipse.core.databinding.beans.BeanProperties; >+import org.eclipse.core.databinding.property.value.DelegatingValueProperty; >+import org.eclipse.core.databinding.property.value.SimpleValueProperty; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class AnonymousBeanValueProperty extends DelegatingValueProperty { >+ private final String propertyName; >+ >+ private Map delegates; >+ >+ /** >+ * @param propertyName >+ * @param valueType >+ */ >+ public AnonymousBeanValueProperty(String propertyName, Class valueType) { >+ super(valueType); >+ this.propertyName = propertyName; >+ this.delegates = new HashMap(); >+ } >+ >+ protected SimpleValueProperty getDelegate(Object source) { >+ if (source == null) >+ return null; >+ >+ Class beanClass = source.getClass(); >+ if (delegates.containsKey(beanClass)) >+ return (BeanValueProperty) delegates.get(beanClass); >+ >+ BeanValueProperty delegate; >+ try { >+ delegate = (BeanValueProperty) BeanProperties.value(beanClass, >+ propertyName, (Class) getValueType()); >+ } catch (BindingException noSuchProperty) { >+ delegate = null; >+ } >+ delegates.put(beanClass, delegate); >+ return delegate; >+ } >+ >+ public String toString() { >+ String s = "{{Generic Bean}}." + propertyName; //$NON-NLS-1$ >+ >+ Class valueType = (Class) getValueType(); >+ if (valueType != null) >+ s += " <" + valueType.getName() + ">"; //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ return s; >+ } >+} >Index: src/org/eclipse/core/internal/databinding/beans/AnonymousBeanMapProperty.java >=================================================================== >RCS file: src/org/eclipse/core/internal/databinding/beans/AnonymousBeanMapProperty.java >diff -N src/org/eclipse/core/internal/databinding/beans/AnonymousBeanMapProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/databinding/beans/AnonymousBeanMapProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,73 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Matthew Hall and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Matthew Hall - initial API and implementation (bug 247997) >+ ******************************************************************************/ >+ >+package org.eclipse.core.internal.databinding.beans; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.databinding.BindingException; >+import org.eclipse.core.databinding.beans.BeanProperties; >+import org.eclipse.core.databinding.property.map.DelegatingMapProperty; >+import org.eclipse.core.databinding.property.map.SimpleMapProperty; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class AnonymousBeanMapProperty extends DelegatingMapProperty { >+ private final String propertyName; >+ >+ private Map delegates; >+ >+ /** >+ * @param propertyName >+ * @param keyType >+ * @param valueType >+ */ >+ public AnonymousBeanMapProperty(String propertyName, Class keyType, >+ Class valueType) { >+ super(keyType, valueType); >+ this.propertyName = propertyName; >+ this.delegates = new HashMap(); >+ } >+ >+ protected SimpleMapProperty getDelegate(Object source) { >+ if (source == null) >+ return null; >+ >+ Class beanClass = source.getClass(); >+ if (delegates.containsKey(beanClass)) >+ return (BeanMapProperty) delegates.get(beanClass); >+ >+ BeanMapProperty delegate; >+ try { >+ delegate = (BeanMapProperty) BeanProperties.map(beanClass, >+ propertyName, (Class) getKeyType(), (Class) getValueType()); >+ } catch (BindingException noSuchProperty) { >+ delegate = null; >+ } >+ delegates.put(beanClass, delegate); >+ return delegate; >+ } >+ >+ public String toString() { >+ String s = "{{Generic Bean}}." + propertyName + "{:}"; //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ Class keyType = (Class) getKeyType(); >+ Class valueType = (Class) getValueType(); >+ if (keyType != null || valueType != null) { >+ s += " <" + keyType + ", " + valueType + ">"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ } >+ >+ return s; >+ } >+} >Index: src/org/eclipse/core/internal/databinding/beans/AnonymousPojoMapProperty.java >=================================================================== >RCS file: src/org/eclipse/core/internal/databinding/beans/AnonymousPojoMapProperty.java >diff -N src/org/eclipse/core/internal/databinding/beans/AnonymousPojoMapProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/databinding/beans/AnonymousPojoMapProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,73 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Matthew Hall and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Matthew Hall - initial API and implementation (bug 247997) >+ ******************************************************************************/ >+ >+package org.eclipse.core.internal.databinding.beans; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.databinding.BindingException; >+import org.eclipse.core.databinding.beans.PojoProperties; >+import org.eclipse.core.databinding.property.map.DelegatingMapProperty; >+import org.eclipse.core.databinding.property.map.SimpleMapProperty; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class AnonymousPojoMapProperty extends DelegatingMapProperty { >+ private final String propertyName; >+ >+ private Map delegates; >+ >+ /** >+ * @param propertyName >+ * @param keyType >+ * @param valueType >+ */ >+ public AnonymousPojoMapProperty(String propertyName, Class keyType, >+ Class valueType) { >+ super(keyType, valueType); >+ this.propertyName = propertyName; >+ this.delegates = new HashMap(); >+ } >+ >+ protected SimpleMapProperty getDelegate(Object source) { >+ if (source == null) >+ return null; >+ >+ Class beanClass = source.getClass(); >+ if (delegates.containsKey(beanClass)) >+ return (PojoMapProperty) delegates.get(beanClass); >+ >+ PojoMapProperty delegate; >+ try { >+ delegate = (PojoMapProperty) PojoProperties.map(beanClass, >+ propertyName, (Class) getKeyType(), (Class) getValueType()); >+ } catch (BindingException noSuchProperty) { >+ delegate = null; >+ } >+ delegates.put(beanClass, delegate); >+ return delegate; >+ } >+ >+ public String toString() { >+ String s = "{{Generic POJO}}." + propertyName + "{:}"; //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ Class keyType = (Class) getKeyType(); >+ Class valueType = (Class) getValueType(); >+ if (keyType != null || valueType != null) { >+ s += " <" + keyType + ", " + valueType + ">"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ } >+ >+ return s; >+ } >+} >Index: src/org/eclipse/core/internal/databinding/beans/AnonymousPojoValueProperty.java >=================================================================== >RCS file: src/org/eclipse/core/internal/databinding/beans/AnonymousPojoValueProperty.java >diff -N src/org/eclipse/core/internal/databinding/beans/AnonymousPojoValueProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/databinding/beans/AnonymousPojoValueProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,67 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Matthew Hall and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Matthew Hall - initial API and implementation (bug 247997) >+ ******************************************************************************/ >+ >+package org.eclipse.core.internal.databinding.beans; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.databinding.BindingException; >+import org.eclipse.core.databinding.beans.PojoProperties; >+import org.eclipse.core.databinding.property.value.DelegatingValueProperty; >+import org.eclipse.core.databinding.property.value.SimpleValueProperty; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class AnonymousPojoValueProperty extends DelegatingValueProperty { >+ private final String propertyName; >+ >+ private Map delegates; >+ >+ /** >+ * @param propertyName >+ * @param valueType >+ */ >+ public AnonymousPojoValueProperty(String propertyName, Class valueType) { >+ super(valueType); >+ this.propertyName = propertyName; >+ this.delegates = new HashMap(); >+ } >+ >+ protected SimpleValueProperty getDelegate(Object source) { >+ if (source == null) >+ return null; >+ >+ Class pojoClass = source.getClass(); >+ if (delegates.containsKey(pojoClass)) >+ return (PojoValueProperty) delegates.get(pojoClass); >+ >+ PojoValueProperty delegate; >+ try { >+ delegate = (PojoValueProperty) PojoProperties.value(pojoClass, >+ propertyName, (Class) getValueType()); >+ } catch (BindingException noSuchProperty) { >+ delegate = null; >+ } >+ delegates.put(pojoClass, delegate); >+ return delegate; >+ } >+ >+ public String toString() { >+ String s = "{{Generic POJO}}." + propertyName; //$NON-NLS-1$ >+ Class valueType = (Class) getValueType(); >+ if (valueType != null) >+ s += " <" + valueType.getName() + ">"; //$NON-NLS-1$ //$NON-NLS-2$ >+ return s; >+ } >+} >Index: src/org/eclipse/core/internal/databinding/beans/AnonymousPojoListProperty.java >=================================================================== >RCS file: src/org/eclipse/core/internal/databinding/beans/AnonymousPojoListProperty.java >diff -N src/org/eclipse/core/internal/databinding/beans/AnonymousPojoListProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/databinding/beans/AnonymousPojoListProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,69 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Matthew Hall and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Matthew Hall - initial API and implementation (bug 247997) >+ ******************************************************************************/ >+ >+package org.eclipse.core.internal.databinding.beans; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.databinding.BindingException; >+import org.eclipse.core.databinding.beans.PojoProperties; >+import org.eclipse.core.databinding.property.list.DelegatingListProperty; >+import org.eclipse.core.databinding.property.list.SimpleListProperty; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class AnonymousPojoListProperty extends DelegatingListProperty { >+ private final String propertyName; >+ >+ private Map delegates; >+ >+ /** >+ * @param propertyName >+ * @param elementType >+ */ >+ public AnonymousPojoListProperty(String propertyName, Class elementType) { >+ super(elementType); >+ this.propertyName = propertyName; >+ this.delegates = new HashMap(); >+ } >+ >+ protected SimpleListProperty getDelegate(Object source) { >+ if (source == null) >+ return null; >+ >+ Class beanClass = source.getClass(); >+ if (delegates.containsKey(beanClass)) >+ return (PojoListProperty) delegates.get(beanClass); >+ >+ PojoListProperty delegate; >+ try { >+ delegate = (PojoListProperty) PojoProperties.list(beanClass, >+ propertyName, (Class) getElementType()); >+ } catch (BindingException noSuchProperty) { >+ delegate = null; >+ } >+ delegates.put(beanClass, delegate); >+ return delegate; >+ } >+ >+ public String toString() { >+ String s = "{{Generic POJO}}." + propertyName + "[]"; //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ Class elementType = (Class) getElementType(); >+ if (elementType != null) >+ s += " <" + elementType.getName() + ">"; //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ return s; >+ } >+} >Index: src/org/eclipse/core/internal/databinding/beans/AnonymousBeanSetProperty.java >=================================================================== >RCS file: src/org/eclipse/core/internal/databinding/beans/AnonymousBeanSetProperty.java >diff -N src/org/eclipse/core/internal/databinding/beans/AnonymousBeanSetProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/databinding/beans/AnonymousBeanSetProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,69 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Matthew Hall and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Matthew Hall - initial API and implementation (bug 247997) >+ ******************************************************************************/ >+ >+package org.eclipse.core.internal.databinding.beans; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.databinding.BindingException; >+import org.eclipse.core.databinding.beans.BeanProperties; >+import org.eclipse.core.databinding.property.set.DelegatingSetProperty; >+import org.eclipse.core.databinding.property.set.SimpleSetProperty; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class AnonymousBeanSetProperty extends DelegatingSetProperty { >+ private final String propertyName; >+ >+ private Map delegates; >+ >+ /** >+ * @param propertyName >+ * @param elementType >+ */ >+ public AnonymousBeanSetProperty(String propertyName, Class elementType) { >+ super(elementType); >+ this.propertyName = propertyName; >+ this.delegates = new HashMap(); >+ } >+ >+ protected SimpleSetProperty getDelegate(Object source) { >+ if (source == null) >+ return null; >+ >+ Class beanClass = source.getClass(); >+ if (delegates.containsKey(beanClass)) >+ return (BeanSetProperty) delegates.get(beanClass); >+ >+ BeanSetProperty delegate; >+ try { >+ delegate = (BeanSetProperty) BeanProperties.set(beanClass, >+ propertyName, (Class) getElementType()); >+ } catch (BindingException noSuchProperty) { >+ delegate = null; >+ } >+ delegates.put(beanClass, delegate); >+ return delegate; >+ } >+ >+ public String toString() { >+ String s = "{{Generic Bean}}." + propertyName + "{}"; //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ Class elementType = (Class) getElementType(); >+ if (elementType != null) >+ s += " <" + elementType.getName() + ">"; //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ return s; >+ } >+} >#P org.eclipse.jface.examples.databinding >Index: src/org/eclipse/jface/examples/databinding/snippets/Snippet026AnonymousBeanProperties.java >=================================================================== >RCS file: src/org/eclipse/jface/examples/databinding/snippets/Snippet026AnonymousBeanProperties.java >diff -N src/org/eclipse/jface/examples/databinding/snippets/Snippet026AnonymousBeanProperties.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jface/examples/databinding/snippets/Snippet026AnonymousBeanProperties.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,373 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.jface.examples.databinding.snippets; >+ >+import java.beans.PropertyChangeEvent; >+import java.beans.PropertyChangeListener; >+import java.beans.PropertyChangeSupport; >+import java.util.Collections; >+import java.util.Iterator; >+import java.util.Set; >+import java.util.TreeSet; >+ >+import org.eclipse.core.databinding.beans.BeanProperties; >+import org.eclipse.core.databinding.observable.Diffs; >+import org.eclipse.core.databinding.observable.Realm; >+import org.eclipse.core.databinding.observable.map.IObservableMap; >+import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory; >+import org.eclipse.core.databinding.observable.set.IObservableSet; >+import org.eclipse.core.databinding.observable.set.SetDiff; >+import org.eclipse.core.databinding.property.INativePropertyListener; >+import org.eclipse.core.databinding.property.set.DelegatingSetProperty; >+import org.eclipse.core.databinding.property.set.ISetPropertyChangeListener; >+import org.eclipse.core.databinding.property.set.SetPropertyChangeEvent; >+import org.eclipse.core.databinding.property.set.SimpleSetProperty; >+import org.eclipse.jface.databinding.swt.SWTObservables; >+import org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider; >+import org.eclipse.jface.databinding.viewers.ObservableSetTreeContentProvider; >+import org.eclipse.jface.viewers.TreeViewer; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.swt.widgets.Tree; >+import org.eclipse.swt.widgets.TreeColumn; >+ >+/** >+ * @since 3.2 >+ * >+ */ >+public class Snippet026AnonymousBeanProperties { >+ private TreeViewer viewer; >+ >+ public static void main(String[] args) { >+ Display display = new Display(); >+ Realm.runWithDefault(SWTObservables.getRealm(display), new Runnable() { >+ public void run() { >+ try { >+ Snippet026AnonymousBeanProperties window = new Snippet026AnonymousBeanProperties(); >+ window.open(); >+ } catch (Exception e) { >+ e.printStackTrace(); >+ } >+ } >+ }); >+ } >+ >+ private ApplicationModel model; >+ private Shell shell; >+ private Tree tree; >+ >+ // Minimal JavaBeans support >+ public static abstract class AbstractModelObject { >+ private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport( >+ this); >+ >+ public void addPropertyChangeListener(PropertyChangeListener listener) { >+ propertyChangeSupport.addPropertyChangeListener(listener); >+ } >+ >+ public void addPropertyChangeListener(String propertyName, >+ PropertyChangeListener listener) { >+ propertyChangeSupport.addPropertyChangeListener(propertyName, >+ listener); >+ } >+ >+ public void removePropertyChangeListener(PropertyChangeListener listener) { >+ propertyChangeSupport.removePropertyChangeListener(listener); >+ } >+ >+ public void removePropertyChangeListener(String propertyName, >+ PropertyChangeListener listener) { >+ propertyChangeSupport.removePropertyChangeListener(propertyName, >+ listener); >+ } >+ >+ protected void firePropertyChange(String propertyName, Object oldValue, >+ Object newValue) { >+ propertyChangeSupport.firePropertyChange(propertyName, oldValue, >+ newValue); >+ } >+ } >+ >+ public static class ContactGroup extends AbstractModelObject implements >+ Comparable { >+ private String name; >+ private Set contacts = new TreeSet(); >+ >+ ContactGroup(String name) { >+ this.name = checkNull(name); >+ } >+ >+ private String checkNull(String string) { >+ if (string == null) >+ throw new NullPointerException(); >+ return string; >+ } >+ >+ public String getName() { >+ return name; >+ } >+ >+ public void setName(String name) { >+ firePropertyChange("name", this.name, this.name = checkNull(name)); >+ } >+ >+ public Set getContacts() { >+ return new TreeSet(contacts); >+ } >+ >+ public void addContact(Contact contact) { >+ Set oldValue = getContacts(); >+ contacts.add(contact); >+ Set newValue = getContacts(); >+ firePropertyChange("contacts", oldValue, newValue); >+ } >+ >+ public void removeContact(Contact contact) { >+ Set oldValue = getContacts(); >+ contacts.remove(contact); >+ Set newValue = getContacts(); >+ firePropertyChange("contacts", oldValue, newValue); >+ } >+ >+ public int compareTo(Object o) { >+ ContactGroup that = (ContactGroup) o; >+ return this.name.compareTo(that.name); >+ } >+ } >+ >+ public static class Contact extends AbstractModelObject implements >+ Comparable { >+ private String name; >+ private String status; >+ >+ private String checkNull(String string) { >+ if (string == null) >+ throw new NullPointerException(); >+ return string; >+ } >+ >+ public Contact(String name, String status) { >+ this.name = checkNull(name); >+ this.status = checkNull(status); >+ } >+ >+ public String getName() { >+ return name; >+ } >+ >+ public void setName(String name) { >+ firePropertyChange("name", this.name, this.name = checkNull(name)); >+ } >+ >+ public String getStatus() { >+ return status; >+ } >+ >+ public void setStatus(String status) { >+ firePropertyChange("status", this.status, >+ this.status = checkNull(status)); >+ } >+ >+ public int compareTo(Object o) { >+ Contact that = (Contact) o; >+ int result = this.name.compareTo(that.name); >+ if (result == 0) >+ result = this.status.compareTo(that.status); >+ return result; >+ } >+ } >+ >+ public static class ApplicationModel extends AbstractModelObject { >+ private Set groups = new TreeSet(); >+ >+ public Set getGroups() { >+ return new TreeSet(groups); >+ } >+ >+ public void setGroups(Set groups) { >+ Set oldValue = getGroups(); >+ this.groups = new TreeSet(groups); >+ Set newValue = getGroups(); >+ firePropertyChange("groups", oldValue, newValue); >+ } >+ } >+ >+ /** >+ * List property for the "contacts" property of a ContactGroup. Since >+ * ContactGroup does not have a setContacts() method we have to write our >+ * own property to apply list changes incrementally through the addContact >+ * and removeContact methods. >+ */ >+ public static class ContactGroupContactsProperty extends SimpleSetProperty { >+ protected Object getElementType() { >+ return Contact.class; >+ } >+ >+ protected Set doGetSet(Object source) { >+ if (source == null) >+ return Collections.EMPTY_SET; >+ return ((ContactGroup) source).getContacts(); >+ } >+ >+ protected boolean setSet(Object source, Set set, SetDiff diff) { >+ if (source == null) >+ return false; >+ ContactGroup group = (ContactGroup) source; >+ for (Iterator it = diff.getRemovals().iterator(); it.hasNext();) { >+ Contact contact = (Contact) it.next(); >+ group.removeContact(contact); >+ } >+ for (Iterator it = diff.getAdditions().iterator(); it.hasNext();) { >+ Contact contact = (Contact) it.next(); >+ group.addContact(contact); >+ } >+ return true; >+ } >+ >+ protected INativePropertyListener adaptListener( >+ final ISetPropertyChangeListener listener) { >+ return new Listener(listener); >+ } >+ >+ private class Listener implements INativePropertyListener, >+ PropertyChangeListener { >+ private final ISetPropertyChangeListener listener; >+ >+ Listener(ISetPropertyChangeListener listener) { >+ this.listener = listener; >+ } >+ >+ public void propertyChange(PropertyChangeEvent evt) { >+ Object source = evt.getSource(); >+ SimpleSetProperty property = ContactGroupContactsProperty.this; >+ SetDiff diff = Diffs.computeSetDiff((Set) evt.getOldValue(), >+ (Set) evt.getNewValue()); >+ listener.handleSetPropertyChange(new SetPropertyChangeEvent( >+ source, property, diff)); >+ } >+ } >+ >+ protected void addListener(Object source, >+ INativePropertyListener listener) { >+ if (source != null) { >+ ((ContactGroup) source).addPropertyChangeListener("contacts", >+ (Listener) listener); >+ } >+ } >+ >+ protected void removeListener(Object source, >+ INativePropertyListener listener) { >+ if (source != null) { >+ ((ContactGroup) source).removePropertyChangeListener( >+ "contacts", (Listener) listener); >+ } >+ } >+ } >+ >+ public void open() { >+ model = createDefaultModel(); >+ >+ final Display display = Display.getDefault(); >+ createContents(); >+ bindUI(); >+ shell.open(); >+ shell.layout(); >+ while (!shell.isDisposed()) { >+ if (!display.readAndDispatch()) >+ display.sleep(); >+ } >+ } >+ >+ /** >+ * @return >+ */ >+ private ApplicationModel createDefaultModel() { >+ ContactGroup swtGroup = new ContactGroup("SWT"); >+ swtGroup.addContact(new Contact("Steve Northover", "Busy")); >+ swtGroup.addContact(new Contact("Grant Gayed", "Online")); >+ swtGroup.addContact(new Contact("Veronika Irvine", "Offline")); >+ swtGroup.addContact(new Contact("Mike Wilson", "Online")); >+ swtGroup.addContact(new Contact("Christophe Cornu", "Idle")); >+ swtGroup.addContact(new Contact("Lynne Kues", "Online")); >+ swtGroup.addContact(new Contact("Silenio Quarti", "Idle")); >+ >+ ContactGroup jdbGroup = new ContactGroup("JFace Data Binding"); >+ jdbGroup.addContact(new Contact("Boris Bokowski", "Online")); >+ jdbGroup.addContact(new Contact("Matthew Hall", "Idle")); >+ >+ Set groups = new TreeSet(); >+ groups.add(swtGroup); >+ groups.add(jdbGroup); >+ ApplicationModel model = new ApplicationModel(); >+ model.setGroups(groups); >+ >+ return model; >+ } >+ >+ /** >+ * Create contents of the window >+ */ >+ protected void createContents() { >+ shell = new Shell(); >+ shell.setSize(379, 393); >+ shell.setText("Snippet026AnonymousBeanProperties"); >+ shell.setLayout(new GridLayout()); >+ >+ viewer = new TreeViewer(shell, SWT.BORDER); >+ tree = viewer.getTree(); >+ tree.setHeaderVisible(true); >+ tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); >+ >+ final TreeColumn nameColumn = new TreeColumn(tree, SWT.NONE); >+ nameColumn.setWidth(163); >+ nameColumn.setText("Name"); >+ >+ final TreeColumn newColumnTreeColumn = new TreeColumn(tree, SWT.NONE); >+ newColumnTreeColumn.setWidth(100); >+ newColumnTreeColumn.setText("Status"); >+ } >+ >+ private void bindUI() { >+ IObservableFactory treeElementFactory = new DelegatingSetProperty() { >+ SimpleSetProperty modelGroups = BeanProperties.set( >+ ApplicationModel.class, "groups"); >+ SimpleSetProperty groupContacts = BeanProperties.set( >+ ContactGroup.class, "contacts"); >+ >+ protected SimpleSetProperty getDelegate(Object source) { >+ if (source instanceof ApplicationModel) >+ return modelGroups; >+ if (source instanceof ContactGroup) >+ return groupContacts; >+ return null; >+ } >+ }.setFactory(); >+ >+ ObservableSetTreeContentProvider cp = new ObservableSetTreeContentProvider( >+ treeElementFactory, null); >+ viewer.setContentProvider(cp); >+ >+ IObservableSet knownElements = cp.getKnownElements(); >+ IObservableMap[] labelMaps = new IObservableMap[] { >+ BeanProperties.value("name").observeDetailValues(knownElements), >+ BeanProperties.value("status").observeDetailValues( >+ knownElements) }; >+ viewer.setLabelProvider(new ObservableMapLabelProvider(labelMaps)); >+ >+ viewer.setInput(model); >+ >+ viewer.expandAll(); >+ } >+} >#P org.eclipse.core.databinding >Index: src/org/eclipse/core/databinding/property/map/DelegatingMapProperty.java >=================================================================== >RCS file: src/org/eclipse/core/databinding/property/map/DelegatingMapProperty.java >diff -N src/org/eclipse/core/databinding/property/map/DelegatingMapProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/databinding/property/map/DelegatingMapProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,127 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Matthew Hall and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Matthew Hall - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.core.databinding.property.map; >+ >+import java.util.Collections; >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.databinding.observable.Realm; >+import org.eclipse.core.databinding.observable.map.IObservableMap; >+import org.eclipse.core.databinding.observable.map.MapDiff; >+import org.eclipse.core.databinding.property.INativePropertyListener; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public abstract class DelegatingMapProperty extends SimpleMapProperty { >+ private final Object keyType; >+ private final Object valueType; >+ >+ protected DelegatingMapProperty() { >+ this(null, null); >+ } >+ >+ protected DelegatingMapProperty(Object keyType, Object valueType) { >+ this.keyType = keyType; >+ this.valueType = valueType; >+ } >+ >+ protected abstract SimpleMapProperty getDelegate(Object source); >+ >+ protected Object getKeyType() { >+ return keyType; >+ } >+ >+ protected Object getValueType() { >+ return valueType; >+ } >+ >+ protected Map doGetMap(Object source) { >+ SimpleMapProperty delegate = getDelegate(source); >+ if (delegate == null) >+ return Collections.EMPTY_MAP; >+ return delegate.doGetMap(source); >+ } >+ >+ protected boolean setMap(Object source, Map map, MapDiff diff) { >+ SimpleMapProperty delegate = getDelegate(source); >+ if (delegate == null) >+ return false; >+ return delegate.setMap(source, map, diff); >+ } >+ >+ protected INativePropertyListener adaptListener( >+ IMapPropertyChangeListener listener) { >+ return new Listener(listener); >+ } >+ >+ private class Listener implements INativePropertyListener, >+ IMapPropertyChangeListener { >+ private final IMapPropertyChangeListener listener; >+ >+ private Map nativeListeners; >+ >+ private Listener(IMapPropertyChangeListener listener) { >+ this.listener = listener; >+ this.nativeListeners = new HashMap(); >+ } >+ >+ public void handleMapPropertyChange(MapPropertyChangeEvent event) { >+ listener.handleMapPropertyChange(event); >+ } >+ >+ private INativePropertyListener getNativeListener( >+ SimpleMapProperty delegate) { >+ if (nativeListeners.containsKey(delegate)) >+ return (INativePropertyListener) nativeListeners.get(delegate); >+ >+ INativePropertyListener nativeListener = delegate >+ .adaptListener(this); >+ nativeListeners.put(delegate, nativeListener); >+ return nativeListener; >+ } >+ >+ private void addListener(Object source) { >+ SimpleMapProperty delegate = getDelegate(source); >+ if (delegate != null) { >+ delegate.addListener(source, getNativeListener(delegate)); >+ } >+ } >+ >+ private void removeListener(Object source) { >+ SimpleMapProperty delegate = getDelegate(source); >+ if (delegate != null) { >+ delegate.addListener(source, getNativeListener(delegate)); >+ } >+ } >+ } >+ >+ protected void addListener(Object source, INativePropertyListener listener) { >+ if (listener != null) >+ ((Listener) listener).addListener(source); >+ } >+ >+ protected void removeListener(Object source, >+ INativePropertyListener listener) { >+ if (listener != null) >+ ((Listener) listener).removeListener(source); >+ } >+ >+ public IObservableMap observeMap(Realm realm, Object source) { >+ SimpleMapProperty delegate = getDelegate(source); >+ if (delegate != null) >+ return delegate.observeMap(realm, source); >+ return super.observeMap(realm, source); >+ } >+} >Index: src/org/eclipse/core/databinding/property/list/DelegatingListProperty.java >=================================================================== >RCS file: src/org/eclipse/core/databinding/property/list/DelegatingListProperty.java >diff -N src/org/eclipse/core/databinding/property/list/DelegatingListProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/databinding/property/list/DelegatingListProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,122 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Matthew Hall and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Matthew Hall - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.core.databinding.property.list; >+ >+import java.util.Collections; >+import java.util.HashMap; >+import java.util.List; >+import java.util.Map; >+ >+import org.eclipse.core.databinding.observable.Realm; >+import org.eclipse.core.databinding.observable.list.IObservableList; >+import org.eclipse.core.databinding.observable.list.ListDiff; >+import org.eclipse.core.databinding.property.INativePropertyListener; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public abstract class DelegatingListProperty extends SimpleListProperty { >+ private final Object elementType; >+ >+ protected DelegatingListProperty() { >+ this(null); >+ } >+ >+ protected DelegatingListProperty(Object elementType) { >+ this.elementType = elementType; >+ } >+ >+ protected abstract SimpleListProperty getDelegate(Object source); >+ >+ protected Object getElementType() { >+ return elementType; >+ } >+ >+ protected List doGetList(Object source) { >+ SimpleListProperty delegate = getDelegate(source); >+ if (delegate == null) >+ return Collections.EMPTY_LIST; >+ return delegate.doGetList(source); >+ } >+ >+ protected boolean setList(Object source, List list, ListDiff diff) { >+ SimpleListProperty delegate = getDelegate(source); >+ if (delegate == null) >+ return false; >+ return delegate.setList(source, list, diff); >+ } >+ >+ protected INativePropertyListener adaptListener( >+ IListPropertyChangeListener listener) { >+ return new Listener(listener); >+ } >+ >+ private class Listener implements INativePropertyListener, >+ IListPropertyChangeListener { >+ private final IListPropertyChangeListener listener; >+ >+ private Map nativeListeners; >+ >+ private Listener(IListPropertyChangeListener listener) { >+ this.listener = listener; >+ this.nativeListeners = new HashMap(); >+ } >+ >+ public void handleListPropertyChange(ListPropertyChangeEvent event) { >+ listener.handleListPropertyChange(event); >+ } >+ >+ private INativePropertyListener getNativeListener( >+ SimpleListProperty delegate) { >+ if (nativeListeners.containsKey(delegate)) >+ return (INativePropertyListener) nativeListeners.get(delegate); >+ >+ INativePropertyListener nativeListener = delegate >+ .adaptListener(this); >+ nativeListeners.put(delegate, nativeListener); >+ return nativeListener; >+ } >+ >+ private void addListener(Object source) { >+ SimpleListProperty delegate = getDelegate(source); >+ if (delegate != null) { >+ delegate.addListener(source, getNativeListener(delegate)); >+ } >+ } >+ >+ private void removeListener(Object source) { >+ SimpleListProperty delegate = getDelegate(source); >+ if (delegate != null) { >+ delegate.addListener(source, getNativeListener(delegate)); >+ } >+ } >+ } >+ >+ protected void addListener(Object source, INativePropertyListener listener) { >+ if (listener != null) >+ ((Listener) listener).addListener(source); >+ } >+ >+ protected void removeListener(Object source, >+ INativePropertyListener listener) { >+ if (listener != null) >+ ((Listener) listener).removeListener(source); >+ } >+ >+ public IObservableList observeList(Realm realm, Object source) { >+ SimpleListProperty delegate = getDelegate(source); >+ if (delegate != null) >+ return delegate.observeList(realm, source); >+ return super.observeList(realm, source); >+ } >+} >Index: src/org/eclipse/core/databinding/property/value/DelegatingValueProperty.java >=================================================================== >RCS file: src/org/eclipse/core/databinding/property/value/DelegatingValueProperty.java >diff -N src/org/eclipse/core/databinding/property/value/DelegatingValueProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/databinding/property/value/DelegatingValueProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,118 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Matthew Hall and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Matthew Hall - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.core.databinding.property.value; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.databinding.observable.Realm; >+import org.eclipse.core.databinding.observable.value.IObservableValue; >+import org.eclipse.core.databinding.property.INativePropertyListener; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public abstract class DelegatingValueProperty extends SimpleValueProperty { >+ private final Object valueType; >+ >+ protected DelegatingValueProperty() { >+ this(null); >+ } >+ >+ protected DelegatingValueProperty(Object valueType) { >+ this.valueType = valueType; >+ } >+ >+ protected abstract SimpleValueProperty getDelegate(Object source); >+ >+ protected Object getValueType() { >+ return valueType; >+ } >+ >+ protected Object getValue(Object source) { >+ SimpleValueProperty delegate = getDelegate(source); >+ if (delegate == null) >+ return null; >+ return delegate.getValue(source); >+ } >+ >+ protected boolean setValue(Object source, Object value) { >+ SimpleValueProperty delegate = getDelegate(source); >+ if (delegate == null) >+ return false; >+ return delegate.setValue(source, value); >+ } >+ >+ public INativePropertyListener adaptListener( >+ final IValuePropertyChangeListener listener) { >+ return new Listener(listener); >+ } >+ >+ private class Listener implements INativePropertyListener, >+ IValuePropertyChangeListener { >+ private final IValuePropertyChangeListener listener; >+ >+ private Map nativeListeners; >+ >+ private Listener(IValuePropertyChangeListener listener) { >+ this.listener = listener; >+ this.nativeListeners = new HashMap(); >+ } >+ >+ public void handleValuePropertyChange(ValuePropertyChangeEvent event) { >+ listener.handleValuePropertyChange(event); >+ } >+ >+ private INativePropertyListener getNativeListener( >+ SimpleValueProperty delegate) { >+ if (nativeListeners.containsKey(delegate)) >+ return (INativePropertyListener) nativeListeners.get(delegate); >+ >+ INativePropertyListener nativeListener = delegate >+ .adaptListener(this); >+ nativeListeners.put(delegate, nativeListener); >+ return nativeListener; >+ } >+ >+ private void addListener(Object source) { >+ SimpleValueProperty delegate = getDelegate(source); >+ if (delegate != null) { >+ delegate.addListener(source, getNativeListener(delegate)); >+ } >+ } >+ >+ private void removeListener(Object source) { >+ SimpleValueProperty delegate = getDelegate(source); >+ if (delegate != null) { >+ delegate.addListener(source, getNativeListener(delegate)); >+ } >+ } >+ } >+ >+ public void addListener(Object source, INativePropertyListener listener) { >+ if (listener != null) >+ ((Listener) listener).addListener(source); >+ } >+ >+ public void removeListener(Object source, INativePropertyListener listener) { >+ if (listener != null) >+ ((Listener) listener).removeListener(source); >+ } >+ >+ public IObservableValue observeValue(Realm realm, Object source) { >+ SimpleValueProperty delegate = getDelegate(source); >+ if (delegate != null) >+ return delegate.observeValue(realm, source); >+ return super.observeValue(realm, source); >+ } >+} >Index: src/org/eclipse/core/databinding/property/set/DelegatingSetProperty.java >=================================================================== >RCS file: src/org/eclipse/core/databinding/property/set/DelegatingSetProperty.java >diff -N src/org/eclipse/core/databinding/property/set/DelegatingSetProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/databinding/property/set/DelegatingSetProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,122 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Matthew Hall and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Matthew Hall - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.core.databinding.property.set; >+ >+import java.util.Collections; >+import java.util.HashMap; >+import java.util.Map; >+import java.util.Set; >+ >+import org.eclipse.core.databinding.observable.Realm; >+import org.eclipse.core.databinding.observable.set.IObservableSet; >+import org.eclipse.core.databinding.observable.set.SetDiff; >+import org.eclipse.core.databinding.property.INativePropertyListener; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public abstract class DelegatingSetProperty extends SimpleSetProperty { >+ private final Object elementType; >+ >+ protected DelegatingSetProperty() { >+ this(null); >+ } >+ >+ protected DelegatingSetProperty(Object elementType) { >+ this.elementType = elementType; >+ } >+ >+ protected abstract SimpleSetProperty getDelegate(Object source); >+ >+ protected Object getElementType() { >+ return elementType; >+ } >+ >+ protected Set doGetSet(Object source) { >+ SimpleSetProperty delegate = getDelegate(source); >+ if (delegate == null) >+ return Collections.EMPTY_SET; >+ return delegate.doGetSet(source); >+ } >+ >+ protected boolean setSet(Object source, Set set, SetDiff diff) { >+ SimpleSetProperty delegate = getDelegate(source); >+ if (delegate == null) >+ return false; >+ return delegate.setSet(source, set, diff); >+ } >+ >+ protected INativePropertyListener adaptListener( >+ ISetPropertyChangeListener listener) { >+ return new Listener(listener); >+ } >+ >+ private class Listener implements INativePropertyListener, >+ ISetPropertyChangeListener { >+ private final ISetPropertyChangeListener listener; >+ >+ private Map nativeListeners; >+ >+ private Listener(ISetPropertyChangeListener listener) { >+ this.listener = listener; >+ this.nativeListeners = new HashMap(); >+ } >+ >+ public void handleSetPropertyChange(SetPropertyChangeEvent event) { >+ listener.handleSetPropertyChange(event); >+ } >+ >+ private INativePropertyListener getNativeListener( >+ SimpleSetProperty delegate) { >+ if (nativeListeners.containsKey(delegate)) >+ return (INativePropertyListener) nativeListeners.get(delegate); >+ >+ INativePropertyListener nativeListener = delegate >+ .adaptListener(this); >+ nativeListeners.put(delegate, nativeListener); >+ return nativeListener; >+ } >+ >+ private void addListener(Object source) { >+ SimpleSetProperty delegate = getDelegate(source); >+ if (delegate != null) { >+ delegate.addListener(source, getNativeListener(delegate)); >+ } >+ } >+ >+ private void removeListener(Object source) { >+ SimpleSetProperty delegate = getDelegate(source); >+ if (delegate != null) { >+ delegate.addListener(source, getNativeListener(delegate)); >+ } >+ } >+ } >+ >+ protected void addListener(Object source, INativePropertyListener listener) { >+ if (listener != null) >+ ((Listener) listener).addListener(source); >+ } >+ >+ protected void removeListener(Object source, >+ INativePropertyListener listener) { >+ if (listener != null) >+ ((Listener) listener).removeListener(source); >+ } >+ >+ public IObservableSet observeSet(Realm realm, Object source) { >+ SimpleSetProperty delegate = getDelegate(source); >+ if (delegate != null) >+ return delegate.observeSet(realm, source); >+ return super.observeSet(realm, source); >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 194734
:
106529
|
107000
|
107001
|
107041
|
107042
|
111164
|
111165
|
111335
|
111336
|
111448
|
111449
|
111640
|
111641
|
111717
|
111719
|
111845
|
111846
|
111897
|
111898
|
111993
|
111994
|
112161
|
112162
|
112268
|
112269
|
112360
|
112361
|
112370
|
112371
|
112471
|
112472
|
112606
|
112607
|
112629
|
112630
|
113149
|
113150
|
113165
|
113166
|
114858
|
114859
|
115196
|
115197
|
115284
|
115458
|
115459
|
117500
|
117501
|
117990
|
117991
|
119231
|
119232
|
119274
|
120541
|
120542
|
120651
|
120652
|
120653
|
120654
|
120914
|
120915
|
120989
|
120990
| 121020 |
121021
|
121141
|
121142
|
122228
|
122229
|
122234
|
122235
|
122288
|
122289
|
122609
|
122610
|
122613
|
122614
|
122775
|
122776
|
122813
|
122814
|
122852
|
122853
|
122864
|
122865
|
123137
|
123138