Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2013-12-04 01:22:55 +0000
committerTom Schindl2013-12-04 01:22:55 +0000
commitf22369559c27e3c7aeca8ee3b2d100521da9dd75 (patch)
tree6400e634f4df25b7850ebc3e72833328b86ac579 /bundles/runtime
parent68359e3002007d3d5c157308adf9b10af46adf56 (diff)
downloadorg.eclipse.efxclipse-f22369559c27e3c7aeca8ee3b2d100521da9dd75.tar.gz
org.eclipse.efxclipse-f22369559c27e3c7aeca8ee3b2d100521da9dd75.tar.xz
org.eclipse.efxclipse-f22369559c27e3c7aeca8ee3b2d100521da9dd75.zip
fixed warnings
Diffstat (limited to 'bundles/runtime')
-rwxr-xr-xbundles/runtime/org.eclipse.fx.core.databinding/.settings/org.eclipse.jdt.core.prefs113
-rwxr-xr-xbundles/runtime/org.eclipse.fx.core.databinding/build.properties2
-rwxr-xr-xbundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/AdapterFactory.java398
-rwxr-xr-xbundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/IJFXBeanProperty.java8
-rwxr-xr-xbundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/IJFXBeanValueProperty.java26
-rwxr-xr-xbundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/JFXBeanProperties.java64
-rwxr-xr-xbundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/JFXRealm.java6
-rwxr-xr-xbundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/ObservableWritableValue.java7
-rwxr-xr-xbundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/AnonymousFXBeanValueProperty.java20
-rwxr-xr-xbundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanObservableValueDecorator.java14
-rwxr-xr-xbundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanPropertyHelper.java21
-rwxr-xr-xbundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanPropertyListener.java48
-rwxr-xr-xbundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanPropertyListenerSupport.java6
-rwxr-xr-xbundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanValueProperty.java24
-rwxr-xr-xbundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanValuePropertyDecorator.java39
15 files changed, 527 insertions, 269 deletions
diff --git a/bundles/runtime/org.eclipse.fx.core.databinding/.settings/org.eclipse.jdt.core.prefs b/bundles/runtime/org.eclipse.fx.core.databinding/.settings/org.eclipse.jdt.core.prefs
index f42de363a..5671530f4 100755
--- a/bundles/runtime/org.eclipse.fx.core.databinding/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/runtime/org.eclipse.fx.core.databinding/.settings/org.eclipse.jdt.core.prefs
@@ -1,7 +1,114 @@
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/bundles/runtime/org.eclipse.fx.core.databinding/build.properties b/bundles/runtime/org.eclipse.fx.core.databinding/build.properties
index bad151d65..03ffd23a0 100755
--- a/bundles/runtime/org.eclipse.fx.core.databinding/build.properties
+++ b/bundles/runtime/org.eclipse.fx.core.databinding/build.properties
@@ -4,3 +4,5 @@ bin.includes = META-INF/,\
.,\
about.html,\
OSGI-INF/
+additional.bundles = org.eclipse.jdt.annotation
+jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
diff --git a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/AdapterFactory.java b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/AdapterFactory.java
index 829fbf4b4..ec02eec4b 100755
--- a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/AdapterFactory.java
+++ b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/AdapterFactory.java
@@ -41,215 +41,222 @@ import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.IValueChangeListener;
import org.eclipse.core.databinding.observable.value.ValueChangeEvent;
+/**
+ * Allows to adapt between Eclipse Databinding and JavaFX observables
+ */
public class AdapterFactory {
static class WrappedList<E> implements ObservableList<E> {
-
- private List<InvalidationListener> fxInvalidationListeners;
- private List<ListChangeListener<? super E>> fxChangeListeners;
-
- private final IObservableList list;
- private IChangeListener dbInvalidationListener;
- private IListChangeListener dbChangeListener;
-
+
+ List<InvalidationListener> fxInvalidationListeners;
+ List<ListChangeListener<? super E>> fxChangeListeners;
+
+ final IObservableList list;
+ IChangeListener dbInvalidationListener;
+ IListChangeListener dbChangeListener;
+
public WrappedList(IObservableList list) {
this.list = list;
this.list.addDisposeListener(new IDisposeListener() {
-
+
@Override
public void handleDispose(DisposeEvent event) {
- fxInvalidationListeners.clear();
- dbInvalidationListener = null;
-
- fxChangeListeners.clear();
- dbChangeListener = null;
+ if (WrappedList.this.fxInvalidationListeners != null) {
+ WrappedList.this.fxInvalidationListeners.clear();
+ }
+ WrappedList.this.dbInvalidationListener = null;
+
+ if (WrappedList.this.fxChangeListeners != null) {
+ WrappedList.this.fxChangeListeners.clear();
+ }
+ WrappedList.this.dbChangeListener = null;
}
});
}
-
+
@Override
public int size() {
- return list.size();
+ return this.list.size();
}
@Override
public boolean isEmpty() {
- return list.isEmpty();
+ return this.list.isEmpty();
}
@Override
public boolean contains(Object o) {
- return list.contains(o);
+ return this.list.contains(o);
}
@SuppressWarnings("unchecked")
@Override
public Iterator<E> iterator() {
- return list.iterator();
+ return this.list.iterator();
}
@Override
public Object[] toArray() {
- return list.toArray();
+ return this.list.toArray();
}
@SuppressWarnings("unchecked")
@Override
public <T> T[] toArray(T[] a) {
- return (T[]) list.toArray(a);
+ return (T[]) this.list.toArray(a);
}
@Override
public boolean add(E e) {
- return list.add(e);
+ return this.list.add(e);
}
@Override
public boolean remove(Object o) {
- return list.remove(o);
+ return this.list.remove(o);
}
@Override
public boolean containsAll(Collection<?> c) {
- return list.containsAll(c);
+ return this.list.containsAll(c);
}
@Override
public boolean addAll(Collection<? extends E> c) {
- return list.addAll(c);
+ return this.list.addAll(c);
}
@Override
public boolean addAll(int index, Collection<? extends E> c) {
- return list.addAll(index, c);
+ return this.list.addAll(index, c);
}
@Override
public boolean removeAll(Collection<?> c) {
- return list.removeAll(c);
+ return this.list.removeAll(c);
}
@Override
public boolean retainAll(Collection<?> c) {
- return list.retainAll(c);
+ return this.list.retainAll(c);
}
@Override
public void clear() {
- list.clear();
+ this.list.clear();
}
@SuppressWarnings("unchecked")
@Override
public E get(int index) {
- return (E) list.get(index);
+ return (E) this.list.get(index);
}
@SuppressWarnings("unchecked")
@Override
public E set(int index, E element) {
- return (E) list.set(index, element);
+ return (E) this.list.set(index, element);
}
@SuppressWarnings("unchecked")
@Override
public void add(int index, E element) {
- list.add(index, element);
+ this.list.add(index, element);
}
@SuppressWarnings("unchecked")
@Override
public E remove(int index) {
- return (E) list.remove(index);
+ return (E) this.list.remove(index);
}
@Override
public int indexOf(Object o) {
- return list.indexOf(o);
+ return this.list.indexOf(o);
}
@Override
public int lastIndexOf(Object o) {
- return list.lastIndexOf(o);
+ return this.list.lastIndexOf(o);
}
@SuppressWarnings("unchecked")
@Override
public ListIterator<E> listIterator() {
- return list.listIterator();
+ return this.list.listIterator();
}
@SuppressWarnings("unchecked")
@Override
public ListIterator<E> listIterator(int index) {
- return list.listIterator(index);
+ return this.list.listIterator(index);
}
@SuppressWarnings("unchecked")
@Override
public List<E> subList(int fromIndex, int toIndex) {
- return list.subList(fromIndex, toIndex);
+ return this.list.subList(fromIndex, toIndex);
}
@Override
public void addListener(InvalidationListener listener) {
- if( fxInvalidationListeners == null ) {
- fxInvalidationListeners = new ArrayList<InvalidationListener>();
- dbInvalidationListener = new IChangeListener() {
-
+ if (this.fxInvalidationListeners == null) {
+ this.fxInvalidationListeners = new ArrayList<InvalidationListener>();
+ this.dbInvalidationListener = new IChangeListener() {
+
@Override
public void handleChange(ChangeEvent event) {
- for( InvalidationListener l : fxInvalidationListeners.toArray(new InvalidationListener[0]) ) {
+ for (InvalidationListener l : WrappedList.this.fxInvalidationListeners.toArray(new InvalidationListener[0])) {
l.invalidated(WrappedList.this);
}
}
};
- list.addChangeListener(dbInvalidationListener);
+ this.list.addChangeListener(this.dbInvalidationListener);
}
-
- fxInvalidationListeners.add(listener);
+
+ this.fxInvalidationListeners.add(listener);
}
@Override
public void removeListener(InvalidationListener listener) {
- if( fxInvalidationListeners != null ) {
- fxInvalidationListeners.remove(listener);
- if( fxInvalidationListeners.isEmpty() ) {
- list.removeChangeListener(dbInvalidationListener);
- dbInvalidationListener = null;
- fxInvalidationListeners = null;
+ if (this.fxInvalidationListeners != null) {
+ this.fxInvalidationListeners.remove(listener);
+ if (this.fxInvalidationListeners.isEmpty()) {
+ this.list.removeChangeListener(this.dbInvalidationListener);
+ this.dbInvalidationListener = null;
+ this.fxInvalidationListeners = null;
}
}
}
@Override
public boolean addAll(E... elements) {
- return list.addAll(Arrays.asList(elements));
+ return this.list.addAll(Arrays.asList(elements));
}
@Override
public void addListener(ListChangeListener<? super E> listener) {
- if( fxChangeListeners == null ) {
- fxChangeListeners = new ArrayList<ListChangeListener<? super E>>();
- dbChangeListener = new IListChangeListener() {
-
+ if (this.fxChangeListeners == null) {
+ this.fxChangeListeners = new ArrayList<ListChangeListener<? super E>>();
+ this.dbChangeListener = new IListChangeListener() {
+
@SuppressWarnings("unchecked")
@Override
public void handleListChange(ListChangeEvent event) {
final ListDiffEntry[] differences = event.diff.getDifferences();
-
- if( differences.length == 0 ) {
+
+ if (differences.length == 0) {
return;
}
-
- //TODO We need to make this perform a lot better by calculating range changes
- for( ListChangeListener<? super E> l : fxChangeListeners.toArray(new ListChangeListener[0]) ) {
+
+ // TODO We need to make this perform a lot better by calculating range changes
+ for (ListChangeListener<? super E> l : WrappedList.this.fxChangeListeners.toArray(new ListChangeListener[0])) {
Change<E> change = new Change<E>(WrappedList.this) {
private int index = -1;
private ListDiffEntry current;
-
+
@Override
public int getFrom() {
- return current.getPosition();
+ return this.current.getPosition();
}
@Override
@@ -259,42 +266,46 @@ public class AdapterFactory {
@Override
public List<E> getRemoved() {
- if( ! current.isAddition() ) {
- return Collections.singletonList((E)current.getElement());
+ if (!this.current.isAddition()) {
+ return Collections.singletonList((E) this.current.getElement());
}
return Collections.emptyList();
}
@Override
public int getTo() {
- if( current.isAddition() ) {
- return current.getPosition() + 1;
+ if (this.current.isAddition()) {
+ return this.current.getPosition() + 1;
} else {
- return current.getPosition();
+ return this.current.getPosition();
}
}
+ @Override
public boolean wasAdded() {
- return current.isAddition();
+ return this.current.isAddition();
}
-
+
+ @Override
public boolean wasRemoved() {
- return ! current.isAddition();
+ return !this.current.isAddition();
}
-
+
+ @Override
public boolean wasPermutated() {
return false;
}
-
+
+ @Override
public boolean wasReplaced() {
return false;
}
-
+
@Override
public boolean next() {
- index++;
- if( index < differences.length ) {
- current = differences[index];
+ this.index++;
+ if (this.index < differences.length) {
+ this.current = differences[this.index];
return true;
}
return false;
@@ -302,167 +313,166 @@ public class AdapterFactory {
@Override
public void reset() {
- index = 0;
+ this.index = 0;
}
};
l.onChanged(change);
}
}
};
- list.addListChangeListener(dbChangeListener);
+ this.list.addListChangeListener(this.dbChangeListener);
}
-
- fxChangeListeners.add(listener);
+
+ this.fxChangeListeners.add(listener);
}
@Override
public void removeListener(ListChangeListener<? super E> listener) {
- if( fxChangeListeners != null ) {
- fxChangeListeners.remove(listener);
- if( fxChangeListeners.isEmpty() ) {
- list.removeListChangeListener(dbChangeListener);
- dbChangeListener = null;
- fxChangeListeners = null;
+ if (this.fxChangeListeners != null) {
+ this.fxChangeListeners.remove(listener);
+ if (this.fxChangeListeners.isEmpty()) {
+ this.list.removeListChangeListener(this.dbChangeListener);
+ this.dbChangeListener = null;
+ this.fxChangeListeners = null;
}
}
}
-
+
@Override
public void remove(int from, int to) {
- //TODO Improve performance??
- for( int idx = to; idx >= from; idx-- ) {
- list.remove(idx);
+ // TODO Improve performance??
+ for (int idx = to; idx >= from; idx--) {
+ this.list.remove(idx);
}
}
@Override
public boolean removeAll(E... elements) {
- return list.removeAll(Arrays.asList(elements));
+ return this.list.removeAll(Arrays.asList(elements));
}
-
@Override
public boolean retainAll(E... elements) {
- return list.retainAll(Arrays.asList(elements));
+ return this.list.retainAll(Arrays.asList(elements));
}
@Override
public boolean setAll(E... elements) {
- //TODO Improve performance
- list.clear();
- return list.addAll(Arrays.asList(elements));
+ // TODO Improve performance
+ this.list.clear();
+ return this.list.addAll(Arrays.asList(elements));
}
@Override
public boolean setAll(Collection<? extends E> col) {
- //TODO Improve performance
- list.clear();
- return list.addAll(col);
- }
-
-//FIXME Java8
-// Default methods NOT YET supported by JDT-Core
-// @Override
+ // TODO Improve performance
+ this.list.clear();
+ return this.list.addAll(col);
+ }
+
+ // FIXME Java8
+ // Default methods NOT YET supported by JDT-Core
+ // @Override
+ @Override
public void forEach(Consumer<? super E> action) {
- list.forEach(action);
+ this.list.forEach(action);
}
-
-// @Override
+
+ // @Override
public Spliterator<E> spliterator() {
- return list.spliterator();
+ return this.list.spliterator();
}
}
-
+
static class WrappedValue<E> implements ObservableWritableValue<E> {
-
- private List<InvalidationListener> fxInvalidationListeners;
- private List<ChangeListener<? super E>> fxChangeListeners;
-
- private final IObservableValue value;
- private IChangeListener dbInvalidationListener;
- private IValueChangeListener dbChangeListener;
-
-
+
+ List<InvalidationListener> fxInvalidationListeners;
+ List<ChangeListener<? super E>> fxChangeListeners;
+
+ final IObservableValue value;
+ IChangeListener dbInvalidationListener;
+ IValueChangeListener dbChangeListener;
+
public WrappedValue(IObservableValue value) {
this.value = value;
this.value.addDisposeListener(new IDisposeListener() {
-
+
@Override
public void handleDispose(DisposeEvent event) {
- if( fxInvalidationListeners != null ) {
- fxInvalidationListeners.clear();
+ if (WrappedValue.this.fxInvalidationListeners != null) {
+ WrappedValue.this.fxInvalidationListeners.clear();
}
-
- dbInvalidationListener = null;
-
- if( fxChangeListeners != null ) {
- fxChangeListeners.clear();
+
+ WrappedValue.this.dbInvalidationListener = null;
+
+ if (WrappedValue.this.fxChangeListeners != null) {
+ WrappedValue.this.fxChangeListeners.clear();
}
-
- dbChangeListener = null;
+
+ WrappedValue.this.dbChangeListener = null;
}
});
}
@Override
public void addListener(InvalidationListener listener) {
- if( fxInvalidationListeners == null ) {
- fxInvalidationListeners = new ArrayList<InvalidationListener>();
- dbInvalidationListener = new IChangeListener() {
-
+ if (this.fxInvalidationListeners == null) {
+ this.fxInvalidationListeners = new ArrayList<InvalidationListener>();
+ this.dbInvalidationListener = new IChangeListener() {
+
@Override
public void handleChange(ChangeEvent event) {
- for( InvalidationListener l : fxInvalidationListeners.toArray(new InvalidationListener[0]) ) {
+ for (InvalidationListener l : WrappedValue.this.fxInvalidationListeners.toArray(new InvalidationListener[0])) {
l.invalidated(WrappedValue.this);
}
}
};
- value.addChangeListener(dbInvalidationListener);
+ this.value.addChangeListener(this.dbInvalidationListener);
}
-
- fxInvalidationListeners.add(listener);
+
+ this.fxInvalidationListeners.add(listener);
}
@Override
public void removeListener(InvalidationListener listener) {
- if( fxInvalidationListeners != null ) {
- fxInvalidationListeners.remove(listener);
- if( fxInvalidationListeners.isEmpty() ) {
- value.removeChangeListener(dbInvalidationListener);
- dbInvalidationListener = null;
- fxInvalidationListeners = null;
+ if (this.fxInvalidationListeners != null) {
+ this.fxInvalidationListeners.remove(listener);
+ if (this.fxInvalidationListeners.isEmpty()) {
+ this.value.removeChangeListener(this.dbInvalidationListener);
+ this.dbInvalidationListener = null;
+ this.fxInvalidationListeners = null;
}
}
}
@Override
public void addListener(ChangeListener<? super E> listener) {
- if( fxChangeListeners == null ) {
- fxChangeListeners = new ArrayList<ChangeListener<? super E>>();
- dbChangeListener = new IValueChangeListener() {
-
+ if (this.fxChangeListeners == null) {
+ this.fxChangeListeners = new ArrayList<ChangeListener<? super E>>();
+ this.dbChangeListener = new IValueChangeListener() {
+
@SuppressWarnings("unchecked")
@Override
public void handleValueChange(ValueChangeEvent event) {
- for( ChangeListener<? super E> l : fxChangeListeners.toArray(new ChangeListener[0]) ) {
- l.changed(WrappedValue.this, (E)event.diff.getOldValue(), (E)event.diff.getNewValue());
+ for (ChangeListener<? super E> l : WrappedValue.this.fxChangeListeners.toArray(new ChangeListener[0])) {
+ l.changed(WrappedValue.this, (E) event.diff.getOldValue(), (E) event.diff.getNewValue());
}
}
};
- value.addValueChangeListener(dbChangeListener);
+ this.value.addValueChangeListener(this.dbChangeListener);
}
-
- fxChangeListeners.add(listener);
+
+ this.fxChangeListeners.add(listener);
}
-
+
@Override
public void removeListener(ChangeListener<? super E> listener) {
- if( fxChangeListeners != null ) {
- fxChangeListeners.remove(listener);
- if( fxChangeListeners.isEmpty() ) {
- value.removeValueChangeListener(dbChangeListener);
- dbChangeListener = null;
- fxChangeListeners = null;
+ if (this.fxChangeListeners != null) {
+ this.fxChangeListeners.remove(listener);
+ if (this.fxChangeListeners.isEmpty()) {
+ this.value.removeValueChangeListener(this.dbChangeListener);
+ this.dbChangeListener = null;
+ this.fxChangeListeners = null;
}
}
}
@@ -470,41 +480,70 @@ public class AdapterFactory {
@SuppressWarnings("unchecked")
@Override
public E getValue() {
- return (E) value.getValue();
+ return (E) this.value.getValue();
}
@Override
public void setValue(E value) {
this.value.setValue(value);
- }
+ }
}
-
+
+ /**
+ * Adapt an {@link IObservableValue} to an {@link ObservableWritableValue}
+ *
+ * @param value
+ * the eclipse db value
+ * @return the javafx observable
+ */
public static <E> ObservableWritableValue<E> adapt(IObservableValue value) {
return new WrappedValue<E>(value);
}
-
+
+ /**
+ * Adapt an {@link IObservableList} to an {@link ObservableList}
+ *
+ * @param list
+ * the eclipse db list
+ * @return the javafx observable list
+ */
public static <E> ObservableList<E> adapt(IObservableList list) {
return new WrappedList<E>(list);
}
-
+
enum InitialSync {
- FX_TO_DB,
- DB_TO_FX
+ FX_TO_DB, DB_TO_FX
}
-
+
+ /**
+ * Bind a JavaFX observable list to an Eclipse DB observable list
+ *
+ * @param fxObs
+ * the fx observable
+ * @param dbObs
+ * the eclipse db observable
+ * @param initialSync
+ * the initial sync direction
+ */
public static <E> void bind(ObservableList<E> fxObs, IObservableList dbObs, InitialSync initialSync) {
ObservableList<E> dbList = adapt(dbObs);
- if( initialSync == InitialSync.FX_TO_DB ) {
+ if (initialSync == InitialSync.FX_TO_DB) {
Bindings.bindContent(dbList, fxObs);
} else {
- Bindings.bindContentBidirectional(fxObs, dbList);
+ Bindings.bindContentBidirectional(fxObs, dbList);
}
-
+
}
-
+
+ /**
+ * Bind an javafx observable value to a eclipse db observable
+ * @param fxObs the javafx observable
+ * @param dbObs the eclipse db observable
+ * @param initialSync the initial sync direction
+ */
@SuppressWarnings("unchecked")
public static <E, F extends ObservableValue<E> & WritableValue<E>> void bind(F fxObs, IObservableValue dbObs, InitialSync initialSync) {
- if( initialSync == InitialSync.FX_TO_DB ) {
+ if (initialSync == InitialSync.FX_TO_DB) {
dbObs.setValue(fxObs.getValue());
} else {
fxObs.setValue((E) dbObs.getValue());
@@ -512,25 +551,26 @@ public class AdapterFactory {
ObservableWritableValue<E> wrapped = adapt(dbObs);
do_bind(fxObs, wrapped);
}
-
+
private static <E, F extends ObservableValue<E> & WritableValue<E>> void do_bind(final F fxObs, final F dbObs) {
fxObs.addListener(new ChangeListener<E>() {
boolean syncing;
+
@Override
public void changed(ObservableValue<? extends E> observable, E oldValue, E newValue) {
- if( syncing ) {
+ if (this.syncing) {
return;
}
-
+
try {
- syncing = true;
- if( observable == fxObs ) {
+ this.syncing = true;
+ if (observable == fxObs) {
dbObs.setValue(newValue);
} else {
fxObs.setValue(newValue);
}
} finally {
- syncing = false;
+ this.syncing = false;
}
}
});
diff --git a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/IJFXBeanProperty.java b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/IJFXBeanProperty.java
index d929f7cf6..f4cc42d8c 100755
--- a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/IJFXBeanProperty.java
+++ b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/IJFXBeanProperty.java
@@ -13,7 +13,15 @@ package org.eclipse.fx.core.databinding;
import java.beans.PropertyDescriptor;
import org.eclipse.core.databinding.property.IProperty;
+import org.eclipse.jdt.annotation.NonNull;
+/**
+ * Root interface of all JavaFX properties
+ */
public interface IJFXBeanProperty extends IProperty {
+ /**
+ * @return the descriptor
+ */
+ @NonNull
public PropertyDescriptor getPropertyDescriptor();
}
diff --git a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/IJFXBeanValueProperty.java b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/IJFXBeanValueProperty.java
index 0ea6d3a34..db31702ae 100755
--- a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/IJFXBeanValueProperty.java
+++ b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/IJFXBeanValueProperty.java
@@ -12,10 +12,36 @@ package org.eclipse.fx.core.databinding;
import org.eclipse.core.databinding.property.value.IValueProperty;
+/**
+ * Single valued property
+ */
public interface IJFXBeanValueProperty extends IJFXBeanProperty, IValueProperty {
+ /**
+ * Create a child property without a type
+ *
+ * @param propertyName
+ * the name
+ * @return child property
+ */
public IJFXBeanValueProperty value(String propertyName);
+ /**
+ * Create a child property with a type
+ *
+ * @param propertyName
+ * the name
+ * @param valueType
+ * the type
+ * @return child property
+ */
public IJFXBeanValueProperty value(String propertyName, Class<?> valueType);
+ /**
+ * Create a child property from a property
+ *
+ * @param property
+ * the property
+ * @return the child property
+ */
public IJFXBeanValueProperty value(IJFXBeanValueProperty property);
}
diff --git a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/JFXBeanProperties.java b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/JFXBeanProperties.java
index 2334cf99f..8c75dd44b 100755
--- a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/JFXBeanProperties.java
+++ b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/JFXBeanProperties.java
@@ -20,46 +20,71 @@ import org.eclipse.fx.core.databinding.internal.FXBeanPropertyHelper;
import org.eclipse.fx.core.databinding.internal.FXBeanValueProperty;
import org.eclipse.fx.core.databinding.internal.FXBeanValuePropertyDecorator;
-
-import javafx.beans.property.Property;
-
-
+/**
+ * Factory to create property descriptions
+ */
public class JFXBeanProperties {
+ /**
+ * Create a single value property without a type
+ *
+ * @param propertyName
+ * the name of the property (nested properties are separated with a .)
+ * @return the property
+ */
public static IJFXBeanValueProperty value(String propertyName) {
return value(null, propertyName, null);
}
-
- public static IJFXBeanValueProperty value(String propertyName, Class valueType) {
+
+ /**
+ * Create a single value property with a type
+ *
+ * @param propertyName
+ * the name of the property (nested properties are separated with a .)
+ * @param valueType
+ * the type
+ * @return the property
+ */
+ public static IJFXBeanValueProperty value(String propertyName, Class<?> valueType) {
return value(null, propertyName, valueType);
}
-
- public static IJFXBeanValueProperty value(Class beanClass,
- String propertyName, Class valueType) {
+
+ /**
+ * Create a property on a class
+ *
+ * @param beanClass
+ * the bean type the property is created on
+ * @param propertyName
+ * the property name
+ * @param _valueType
+ * the type
+ * @return the property
+ */
+ public static IJFXBeanValueProperty value(Class<?> beanClass, String propertyName, Class<?> _valueType) {
+ Class<?> valueType = _valueType;
String[] propertyNames = split(propertyName);
- if (propertyNames.length > 1)
+ if (propertyNames.length > 1) {
valueType = null;
+ }
PropertyDescriptor propertyDescriptor;
IValueProperty property;
if (beanClass == null) {
propertyDescriptor = null;
- property = new AnonymousFXBeanValueProperty(propertyNames[0],
- valueType);
+ property = new AnonymousFXBeanValueProperty(propertyNames[0], valueType);
} else {
- propertyDescriptor = FXBeanPropertyHelper.getPropertyDescriptor(
- beanClass, propertyNames[0]);
+ propertyDescriptor = FXBeanPropertyHelper.getPropertyDescriptor(beanClass, propertyNames[0]);
property = new FXBeanValueProperty(propertyDescriptor, valueType);
}
- IJFXBeanValueProperty beanProperty = new FXBeanValuePropertyDecorator(
- property, propertyDescriptor);
+ IJFXBeanValueProperty beanProperty = new FXBeanValuePropertyDecorator(property, propertyDescriptor);
for (int i = 1; i < propertyNames.length; i++) {
beanProperty = beanProperty.value(propertyNames[i]);
}
return beanProperty;
}
-
- private static String[] split(String propertyName) {
+
+ private static String[] split(String _propertyName) {
+ String propertyName = _propertyName;
if (propertyName.indexOf('.') == -1)
return new String[] { propertyName };
List<String> propertyNames = new ArrayList<String>();
@@ -69,7 +94,6 @@ public class JFXBeanProperties {
propertyName = propertyName.substring(index + 1);
}
propertyNames.add(propertyName);
- return (String[]) propertyNames
- .toArray(new String[propertyNames.size()]);
+ return (String[]) propertyNames.toArray(new String[propertyNames.size()]);
}
}
diff --git a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/JFXRealm.java b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/JFXRealm.java
index 8f3fdd3e6..c410d0f47 100755
--- a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/JFXRealm.java
+++ b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/JFXRealm.java
@@ -14,7 +14,13 @@ import javafx.application.Platform;
import org.eclipse.core.databinding.observable.Realm;
+/**
+ * JavaFX realm implementation
+ */
public class JFXRealm extends Realm {
+ /**
+ * Create a default realm
+ */
public static void createDefault() {
setDefault(new JFXRealm());
}
diff --git a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/ObservableWritableValue.java b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/ObservableWritableValue.java
index cfb97353e..c350f104c 100755
--- a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/ObservableWritableValue.java
+++ b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/ObservableWritableValue.java
@@ -13,6 +13,11 @@ package org.eclipse.fx.core.databinding;
import javafx.beans.value.ObservableValue;
import javafx.beans.value.WritableValue;
+/**
+ * Observable value which can be modified as well
+ *
+ * @param <E> the type
+ */
public interface ObservableWritableValue<E> extends ObservableValue<E>, WritableValue<E> {
-
+ // no additional methods
}
diff --git a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/AnonymousFXBeanValueProperty.java b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/AnonymousFXBeanValueProperty.java
index b0889260c..701ed1876 100755
--- a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/AnonymousFXBeanValueProperty.java
+++ b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/AnonymousFXBeanValueProperty.java
@@ -20,6 +20,8 @@ import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.property.value.DelegatingValueProperty;
import org.eclipse.core.databinding.property.value.IValueProperty;
import org.eclipse.fx.core.databinding.JFXBeanProperties;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
/**
@@ -27,39 +29,44 @@ import org.eclipse.fx.core.databinding.JFXBeanProperties;
*
*/
public class AnonymousFXBeanValueProperty extends DelegatingValueProperty {
+ @NonNull
private final String propertyName;
+ @NonNull
private Map<Class<?>,IValueProperty> delegates;
/**
* @param propertyName
* @param valueType
*/
- public AnonymousFXBeanValueProperty(String propertyName, Class<?> valueType) {
+ public AnonymousFXBeanValueProperty(String propertyName, @Nullable Class<?> valueType) {
super(valueType);
this.propertyName = propertyName;
this.delegates = new HashMap<Class<?>,IValueProperty>();
}
+ @Override
+ @Nullable
protected IValueProperty doGetDelegate(Object source) {
return getClassDelegate(source.getClass());
}
private IValueProperty getClassDelegate(Class<?> beanClass) {
- if (delegates.containsKey(beanClass))
- return delegates.get(beanClass);
+ if (this.delegates.containsKey(beanClass))
+ return this.delegates.get(beanClass);
IValueProperty delegate;
try {
- delegate = JFXBeanProperties.value(beanClass, propertyName,
+ delegate = JFXBeanProperties.value(beanClass, this.propertyName,
(Class<?>) getValueType());
} catch (IllegalArgumentException noSuchProperty) {
delegate = null;
}
- delegates.put(beanClass, delegate);
+ this.delegates.put(beanClass, delegate);
return delegate;
}
+ @Override
public IObservableValue observeDetail(IObservableValue master) {
Object valueType = getValueType();
if (valueType == null)
@@ -76,8 +83,9 @@ public class AnonymousFXBeanValueProperty extends DelegatingValueProperty {
return null;
}
+ @Override
public String toString() {
- String s = "?." + propertyName; //$NON-NLS-1$
+ String s = "?." + this.propertyName; //$NON-NLS-1$
Class<?> valueType = (Class<?>) getValueType();
if (valueType != null)
s += "<" + FXBeanPropertyHelper.shortClassName(valueType) + ">"; //$NON-NLS-1$//$NON-NLS-2$
diff --git a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanObservableValueDecorator.java b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanObservableValueDecorator.java
index c0f343fa5..7ce80a30a 100755
--- a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanObservableValueDecorator.java
+++ b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanObservableValueDecorator.java
@@ -19,6 +19,8 @@ import org.eclipse.core.databinding.observable.IObserving;
import org.eclipse.core.databinding.observable.value.DecoratingObservableValue;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.fx.core.databinding.IJFXBeanObservable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
/**
@@ -28,23 +30,27 @@ import org.eclipse.fx.core.databinding.IJFXBeanObservable;
*/
public class FXBeanObservableValueDecorator extends DecoratingObservableValue
implements IJFXBeanObservable {
+ @NonNull
private PropertyDescriptor propertyDescriptor;
/**
* @param decorated
* @param propertyDescriptor
*/
- public FXBeanObservableValueDecorator(IObservableValue decorated,
- PropertyDescriptor propertyDescriptor) {
+ public FXBeanObservableValueDecorator(@NonNull IObservableValue decorated,
+ @NonNull PropertyDescriptor propertyDescriptor) {
super(decorated, true);
this.propertyDescriptor = propertyDescriptor;
}
+ @Override
public synchronized void dispose() {
this.propertyDescriptor = null;
super.dispose();
}
+ @Override
+ @Nullable
public Object getObserved() {
IObservable decorated = getDecorated();
if (decorated instanceof IObserving)
@@ -52,7 +58,9 @@ public class FXBeanObservableValueDecorator extends DecoratingObservableValue
return null;
}
+ @Override
+ @NonNull
public PropertyDescriptor getPropertyDescriptor() {
- return propertyDescriptor;
+ return this.propertyDescriptor;
}
}
diff --git a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanPropertyHelper.java b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanPropertyHelper.java
index 03c4a1964..bcd9e919f 100755
--- a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanPropertyHelper.java
+++ b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanPropertyHelper.java
@@ -21,6 +21,9 @@ import java.util.List;
import org.eclipse.core.databinding.observable.value.IObservableValue;
+/**
+ * Helper class to access javafx bean properties
+ */
public class FXBeanPropertyHelper {
/**
* Sets the contents of the given property on the given source object to the
@@ -120,9 +123,9 @@ public class FXBeanPropertyHelper {
* @return the element type of the given collection-typed property if it is
* an array property, or Object.class otherwise.
*/
- public static Class getCollectionPropertyElementType(
+ public static Class<?> getCollectionPropertyElementType(
PropertyDescriptor descriptor) {
- Class propertyType = descriptor.getPropertyType();
+ Class<?> propertyType = descriptor.getPropertyType();
return propertyType.isArray() ? propertyType.getComponentType()
: Object.class;
}
@@ -133,7 +136,7 @@ public class FXBeanPropertyHelper {
* @return the PropertyDescriptor for the named property on the given bean
* class
*/
- public static PropertyDescriptor getPropertyDescriptor(Class beanClass,
+ public static PropertyDescriptor getPropertyDescriptor(Class<?> beanClass,
String propertyName) {
if (!beanClass.isInterface()) {
BeanInfo beanInfo;
@@ -154,7 +157,7 @@ public class FXBeanPropertyHelper {
} else {
try {
PropertyDescriptor propertyDescriptors[];
- List pds = new ArrayList();
+ List<PropertyDescriptor> pds = new ArrayList<>();
getInterfacePropertyDescriptors(pds, beanClass);
if (pds.size() > 0) {
propertyDescriptors = (PropertyDescriptor[]) pds
@@ -187,7 +190,7 @@ public class FXBeanPropertyHelper {
* @throws IntrospectionException
*/
private static void getInterfacePropertyDescriptors(
- List propertyDescriptors, Class iface)
+ List<PropertyDescriptor> propertyDescriptors, Class<?> iface)
throws IntrospectionException {
BeanInfo beanInfo = Introspector.getBeanInfo(iface);
PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
@@ -195,7 +198,7 @@ public class FXBeanPropertyHelper {
PropertyDescriptor pd = pds[i];
propertyDescriptors.add(pd);
}
- Class[] subIntfs = iface.getInterfaces();
+ Class<?>[] subIntfs = iface.getInterfaces();
for (int j = 0; j < subIntfs.length; j++) {
getInterfacePropertyDescriptors(propertyDescriptors, subIntfs[j]);
}
@@ -209,7 +212,7 @@ public class FXBeanPropertyHelper {
/* package */public static PropertyDescriptor getValueTypePropertyDescriptor(
IObservableValue observable, String propertyName) {
if (observable.getValueType() != null)
- return getPropertyDescriptor((Class) observable.getValueType(),
+ return getPropertyDescriptor((Class<?>) observable.getValueType(),
propertyName);
return null;
}
@@ -219,7 +222,7 @@ public class FXBeanPropertyHelper {
* @return String description of property descriptor
*/
public static String propertyName(PropertyDescriptor propertyDescriptor) {
- Class beanClass = propertyDescriptor.getReadMethod()
+ Class<?> beanClass = propertyDescriptor.getReadMethod()
.getDeclaringClass();
return shortClassName(beanClass)
+ "." + propertyDescriptor.getName() + ""; //$NON-NLS-1$ //$NON-NLS-2$
@@ -229,7 +232,7 @@ public class FXBeanPropertyHelper {
* @param beanClass
* @return class name excluding package
*/
- public static String shortClassName(Class beanClass) {
+ public static String shortClassName(Class<?> beanClass) {
if (beanClass == null)
return "?"; //$NON-NLS-1$
String className = beanClass.getName();
diff --git a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanPropertyListener.java b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanPropertyListener.java
index 487a1f0a5..f8c31a152 100755
--- a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanPropertyListener.java
+++ b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanPropertyListener.java
@@ -25,8 +25,7 @@ import org.eclipse.core.databinding.property.ISimplePropertyListener;
import org.eclipse.core.databinding.property.NativePropertyListener;
/**
- * @since 3.3
- *
+ * Wraps a native listener
*/
public abstract class FXBeanPropertyListener extends NativePropertyListener {
private final PropertyDescriptor propertyDescriptor;
@@ -39,25 +38,31 @@ public abstract class FXBeanPropertyListener extends NativePropertyListener {
this.propertyDescriptor = propertyDescriptor;
}
- public void propertyChange(java.beans.PropertyChangeEvent evt) {
- if (evt.getPropertyName() == null
- || propertyDescriptor.getName().equals(evt.getPropertyName())) {
- Object oldValue = evt.getOldValue();
- Object newValue = evt.getNewValue();
- IDiff diff;
- if (evt.getPropertyName() == null || oldValue == null
- || newValue == null)
- diff = null;
- else
- diff = computeDiff(oldValue, newValue);
- fireChange(evt.getSource(), diff);
- }
- }
+// public void propertyChange(java.beans.PropertyChangeEvent evt) {
+// if (evt.getPropertyName() == null
+// || propertyDescriptor.getName().equals(evt.getPropertyName())) {
+// Object oldValue = evt.getOldValue();
+// Object newValue = evt.getNewValue();
+// IDiff diff;
+// if (evt.getPropertyName() == null || oldValue == null
+// || newValue == null)
+// diff = null;
+// else
+// diff = computeDiff(oldValue, newValue);
+// fireChange(evt.getSource(), diff);
+// }
+// }
protected abstract IDiff computeDiff(Object oldValue, Object newValue);
+ @Override
+ protected void fireChange(Object source, IDiff diff) {
+ super.fireChange(source, diff);
+ }
+
+ @Override
protected void doAddTo(Object source) {
- if( ! map.containsKey(source) ) {
+ if( ! this.map.containsKey(source) ) {
ChangeListener<Object> l = new ChangeListener<Object>() {
@Override
@@ -71,18 +76,19 @@ public abstract class FXBeanPropertyListener extends NativePropertyListener {
fireChange(source, diff);
}
};
- map.put(source, l);
+ this.map.put(source, l);
FXBeanPropertyListenerSupport.hookListener(source,
- propertyDescriptor.getName(), l);
+ this.propertyDescriptor.getName(), l);
}
}
+ @Override
protected void doRemoveFrom(Object source) {
- ChangeListener<Object> l = map.get(source);
+ ChangeListener<Object> l = this.map.get(source);
if (l != null) {
FXBeanPropertyListenerSupport.unhookListener(source,
- propertyDescriptor.getName(), l);
+ this.propertyDescriptor.getName(), l);
}
}
} \ No newline at end of file
diff --git a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanPropertyListenerSupport.java b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanPropertyListenerSupport.java
index a7a45c08d..73a9f0069 100755
--- a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanPropertyListenerSupport.java
+++ b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanPropertyListenerSupport.java
@@ -41,7 +41,7 @@ public class FXBeanPropertyListenerSupport {
Assert.isNotNull(listener, "Listener cannot be null"); //$NON-NLS-1$
Assert.isNotNull(propertyName, "Property name cannot be null"); //$NON-NLS-1$
processListener(bean, propertyName, listener,
- /*"addPropertyChangeListener",*/ "Could not attach listener to ");//$NON-NLS-1$ //$NON-NLS-2$
+ /*"addPropertyChangeListener",*/ "Could not attach listener to ");//$NON-NLS-1$
}
/**
@@ -61,7 +61,7 @@ public class FXBeanPropertyListenerSupport {
bean,
propertyName,
listener,
- /*"removePropertyChangeListener",*/ "Cound not remove listener from "); //$NON-NLS-1$ //$NON-NLS-2$
+ /*"removePropertyChangeListener",*/ "Cound not remove listener from "); //$NON-NLS-1$
}
/**
@@ -82,7 +82,7 @@ public class FXBeanPropertyListenerSupport {
private static boolean processListener(Object bean, String propertyName,
ChangeListener<Object> listener, /*String methodName,*/ String message) {
try {
- Method method = bean.getClass().getMethod(propertyName+"Property");
+ Method method = bean.getClass().getMethod(propertyName+"Property"); //$NON-NLS-1$
Object observable = method.invoke(bean);
if( observable instanceof ObservableValue<?> ) {
((ObservableValue<Object>) observable).addListener(listener);
diff --git a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanValueProperty.java b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanValueProperty.java
index 03804538e..910046e14 100755
--- a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanValueProperty.java
+++ b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanValueProperty.java
@@ -26,44 +26,50 @@ import org.eclipse.core.databinding.property.value.SimpleValueProperty;
*/
public class FXBeanValueProperty extends SimpleValueProperty {
private final PropertyDescriptor propertyDescriptor;
- private final Class valueType;
+ private final Class<?> valueType;
/**
* @param propertyDescriptor
* @param valueType
*/
public FXBeanValueProperty(PropertyDescriptor propertyDescriptor,
- Class valueType) {
+ Class<?> valueType) {
this.propertyDescriptor = propertyDescriptor;
this.valueType = valueType == null ? propertyDescriptor
.getPropertyType() : valueType;
}
+ @Override
public Object getValueType() {
- return valueType;
+ return this.valueType;
}
+ @Override
protected Object doGetValue(Object source) {
- return FXBeanPropertyHelper.readProperty(source, propertyDescriptor);
+ return FXBeanPropertyHelper.readProperty(source, this.propertyDescriptor);
}
+ @Override
protected void doSetValue(Object source, Object value) {
- FXBeanPropertyHelper.writeProperty(source, propertyDescriptor, value);
+ FXBeanPropertyHelper.writeProperty(source, this.propertyDescriptor, value);
}
+ @Override
public INativePropertyListener adaptListener(
final ISimplePropertyListener listener) {
- return new FXBeanPropertyListener(this, propertyDescriptor, listener) {
+ return new FXBeanPropertyListener(this, this.propertyDescriptor, listener) {
+ @Override
protected IDiff computeDiff(Object oldValue, Object newValue) {
return Diffs.createValueDiff(oldValue, newValue);
}
};
}
+ @Override
public String toString() {
- String s = FXBeanPropertyHelper.propertyName(propertyDescriptor);
- if (valueType != null)
- s += "<" + FXBeanPropertyHelper.shortClassName(valueType) + ">"; //$NON-NLS-1$//$NON-NLS-2$
+ String s = FXBeanPropertyHelper.propertyName(this.propertyDescriptor);
+ if (this.valueType != null)
+ s += "<" + FXBeanPropertyHelper.shortClassName(this.valueType) + ">"; //$NON-NLS-1$//$NON-NLS-2$
return s;
}
}
diff --git a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanValuePropertyDecorator.java b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanValuePropertyDecorator.java
index 7abb6fe7b..1412ebf94 100755
--- a/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanValuePropertyDecorator.java
+++ b/bundles/runtime/org.eclipse.fx.core.databinding/src/org/eclipse/fx/core/databinding/internal/FXBeanValuePropertyDecorator.java
@@ -15,9 +15,6 @@ package org.eclipse.fx.core.databinding.internal;
import java.beans.PropertyDescriptor;
import org.eclipse.core.databinding.observable.Realm;
-import org.eclipse.core.databinding.observable.list.IObservableList;
-import org.eclipse.core.databinding.observable.map.IObservableMap;
-import org.eclipse.core.databinding.observable.set.IObservableSet;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.property.value.IValueProperty;
import org.eclipse.core.databinding.property.value.ValueProperty;
@@ -32,6 +29,7 @@ import org.eclipse.fx.core.databinding.JFXBeanProperties;
public class FXBeanValuePropertyDecorator extends ValueProperty implements
IJFXBeanValueProperty {
private final IValueProperty delegate;
+
private final PropertyDescriptor propertyDescriptor;
/**
@@ -44,31 +42,38 @@ public class FXBeanValuePropertyDecorator extends ValueProperty implements
this.propertyDescriptor = propertyDescriptor;
}
+ @Override
public PropertyDescriptor getPropertyDescriptor() {
- return propertyDescriptor;
+ return this.propertyDescriptor;
}
+ @Override
public Object getValueType() {
- return delegate.getValueType();
+ return this.delegate.getValueType();
}
+ @Override
protected Object doGetValue(Object source) {
- return delegate.getValue(source);
+ return this.delegate.getValue(source);
}
+ @Override
protected void doSetValue(Object source, Object value) {
- delegate.setValue(source, value);
+ this.delegate.setValue(source, value);
}
+ @Override
public IJFXBeanValueProperty value(String propertyName) {
return value(propertyName, null);
}
- public IJFXBeanValueProperty value(String propertyName, Class valueType) {
- Class beanClass = (Class) delegate.getValueType();
+ @Override
+ public IJFXBeanValueProperty value(String propertyName, Class<?> valueType) {
+ Class<?> beanClass = (Class<?>) this.delegate.getValueType();
return value(JFXBeanProperties.value(beanClass, propertyName, valueType));
}
+ @Override
public IJFXBeanValueProperty value(IJFXBeanValueProperty property) {
return new FXBeanValuePropertyDecorator(super.value(property),
property.getPropertyDescriptor());
@@ -118,19 +123,22 @@ public class FXBeanValuePropertyDecorator extends ValueProperty implements
property.getPropertyDescriptor());
}*/
+ @Override
public IObservableValue observe(Object source) {
- return new FXBeanObservableValueDecorator(delegate.observe(source),
- propertyDescriptor);
+ return new FXBeanObservableValueDecorator(this.delegate.observe(source),
+ this.propertyDescriptor);
}
+ @Override
public IObservableValue observe(Realm realm, Object source) {
return new FXBeanObservableValueDecorator(
- delegate.observe(realm, source), propertyDescriptor);
+ this.delegate.observe(realm, source), this.propertyDescriptor);
}
+ @Override
public IObservableValue observeDetail(IObservableValue master) {
- return new FXBeanObservableValueDecorator(delegate.observeDetail(master),
- propertyDescriptor);
+ return new FXBeanObservableValueDecorator(this.delegate.observeDetail(master),
+ this.propertyDescriptor);
}
/*public IObservableList observeDetail(IObservableList master) {
@@ -148,7 +156,8 @@ public class FXBeanValuePropertyDecorator extends ValueProperty implements
propertyDescriptor);
}*/
+ @Override
public String toString() {
- return delegate.toString();
+ return this.delegate.toString();
}
}

Back to the top