You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2020/07/15 12:05:29 UTC
[isis] branch master updated: ISIS-2340: adds new internal binding
API
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new 300b613 ISIS-2340: adds new internal binding API
300b613 is described below
commit 300b613a46bbd951131314a1b693ba53616b00a3
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Jul 15 14:05:10 2020 +0200
ISIS-2340: adds new internal binding API
---
.../apache/isis/core/commons/binding/Bindable.java | 23 +-
.../isis/core/commons/binding/ChangeListener.java | 8 +-
...angeListener.java => InvalidationListener.java} | 10 +-
.../{ChangeListener.java => Observable.java} | 8 +-
.../{Bindable.java => ObservableValue.java} | 24 +-
.../{ChangeListener.java => WritableValue.java} | 9 +-
.../binding/InternalBidirectionalBinding.java | 214 ++++++++++
.../commons/internal/binding/InternalUtil.java | 443 +++++++++++++++++++++
.../internal/binding/_BindableAbstract.java | 171 ++++++++
.../binding/_Bindables.java} | 45 ++-
.../binding/package-info.java} | 20 +-
.../commons/internal/binding/BindableTest.java | 237 +++++++++++
.../specloader/specimpl/PendingParameterModel.java | 37 +-
13 files changed, 1162 insertions(+), 87 deletions(-)
diff --git a/core/commons/src/main/java/org/apache/isis/core/commons/binding/Bindable.java b/core/commons/src/main/java/org/apache/isis/core/commons/binding/Bindable.java
index f2e1195..15245e8 100644
--- a/core/commons/src/main/java/org/apache/isis/core/commons/binding/Bindable.java
+++ b/core/commons/src/main/java/org/apache/isis/core/commons/binding/Bindable.java
@@ -18,27 +18,20 @@
*/
package org.apache.isis.core.commons.binding;
-public interface Bindable<T> {
-
- Object getBean();
-
- String getName();
+/**
+ * Heavily inspired by the JavaFX project.
+ * @param <T>
+ */
+public interface Bindable<T> extends ObservableValue<T>, WritableValue<T> {
- T getValue();
+ void bind(ObservableValue<? extends T> observable);
- void setValue(T newValue);
+ void unbind();
boolean isBound();
- void bind(Bindable<T> observable);
- void unbind();
-
void bindBidirectional(Bindable<T> other);
- void unbindBidirectional(Bindable<T> other);
- void addListener(ChangeListener<? super T> listener);
-
- void removeListener(ChangeListener<? super T> listener);
-
+ void unbindBidirectional(Bindable<T> other);
}
diff --git a/core/commons/src/main/java/org/apache/isis/core/commons/binding/ChangeListener.java b/core/commons/src/main/java/org/apache/isis/core/commons/binding/ChangeListener.java
index db1455a..8dad41d 100644
--- a/core/commons/src/main/java/org/apache/isis/core/commons/binding/ChangeListener.java
+++ b/core/commons/src/main/java/org/apache/isis/core/commons/binding/ChangeListener.java
@@ -18,8 +18,12 @@
*/
package org.apache.isis.core.commons.binding;
+/**
+ * Heavily inspired by the JavaFX project.
+ * @param <T>
+ */
+@FunctionalInterface
public interface ChangeListener<T> {
- void changed(Bindable<? extends T> bindable, T oldValue, T newValue);
-
+ void changed(ObservableValue<? extends T> observable, T oldValue, T newValue);
}
diff --git a/core/commons/src/main/java/org/apache/isis/core/commons/binding/ChangeListener.java b/core/commons/src/main/java/org/apache/isis/core/commons/binding/InvalidationListener.java
similarity index 83%
copy from core/commons/src/main/java/org/apache/isis/core/commons/binding/ChangeListener.java
copy to core/commons/src/main/java/org/apache/isis/core/commons/binding/InvalidationListener.java
index db1455a..013a3d5 100644
--- a/core/commons/src/main/java/org/apache/isis/core/commons/binding/ChangeListener.java
+++ b/core/commons/src/main/java/org/apache/isis/core/commons/binding/InvalidationListener.java
@@ -18,8 +18,12 @@
*/
package org.apache.isis.core.commons.binding;
-public interface ChangeListener<T> {
-
- void changed(Bindable<? extends T> bindable, T oldValue, T newValue);
+/**
+ * Heavily inspired by the JavaFX project.
+ * @param <T>
+ */
+@FunctionalInterface
+public interface InvalidationListener {
+ public void invalidated(Observable observable);
}
diff --git a/core/commons/src/main/java/org/apache/isis/core/commons/binding/ChangeListener.java b/core/commons/src/main/java/org/apache/isis/core/commons/binding/Observable.java
similarity index 82%
copy from core/commons/src/main/java/org/apache/isis/core/commons/binding/ChangeListener.java
copy to core/commons/src/main/java/org/apache/isis/core/commons/binding/Observable.java
index db1455a..558f49d 100644
--- a/core/commons/src/main/java/org/apache/isis/core/commons/binding/ChangeListener.java
+++ b/core/commons/src/main/java/org/apache/isis/core/commons/binding/Observable.java
@@ -18,8 +18,12 @@
*/
package org.apache.isis.core.commons.binding;
-public interface ChangeListener<T> {
+/**
+ * Heavily inspired by the JavaFX project.
+ */
+public interface Observable {
- void changed(Bindable<? extends T> bindable, T oldValue, T newValue);
+ void addListener(InvalidationListener listener);
+ void removeListener(InvalidationListener listener);
}
diff --git a/core/commons/src/main/java/org/apache/isis/core/commons/binding/Bindable.java b/core/commons/src/main/java/org/apache/isis/core/commons/binding/ObservableValue.java
similarity index 77%
copy from core/commons/src/main/java/org/apache/isis/core/commons/binding/Bindable.java
copy to core/commons/src/main/java/org/apache/isis/core/commons/binding/ObservableValue.java
index f2e1195..c898472 100644
--- a/core/commons/src/main/java/org/apache/isis/core/commons/binding/Bindable.java
+++ b/core/commons/src/main/java/org/apache/isis/core/commons/binding/ObservableValue.java
@@ -18,27 +18,15 @@
*/
package org.apache.isis.core.commons.binding;
-public interface Bindable<T> {
-
- Object getBean();
-
- String getName();
+/**
+ * Heavily inspired by the JavaFX project.
+ * @param <T>
+ */
+public interface ObservableValue<T> extends Observable {
T getValue();
-
- void setValue(T newValue);
-
- boolean isBound();
-
- void bind(Bindable<T> observable);
- void unbind();
- void bindBidirectional(Bindable<T> other);
- void unbindBidirectional(Bindable<T> other);
-
void addListener(ChangeListener<? super T> listener);
-
void removeListener(ChangeListener<? super T> listener);
-
-
+
}
diff --git a/core/commons/src/main/java/org/apache/isis/core/commons/binding/ChangeListener.java b/core/commons/src/main/java/org/apache/isis/core/commons/binding/WritableValue.java
similarity index 85%
copy from core/commons/src/main/java/org/apache/isis/core/commons/binding/ChangeListener.java
copy to core/commons/src/main/java/org/apache/isis/core/commons/binding/WritableValue.java
index db1455a..48eb54c 100644
--- a/core/commons/src/main/java/org/apache/isis/core/commons/binding/ChangeListener.java
+++ b/core/commons/src/main/java/org/apache/isis/core/commons/binding/WritableValue.java
@@ -18,8 +18,13 @@
*/
package org.apache.isis.core.commons.binding;
-public interface ChangeListener<T> {
+/**
+ * Heavily inspired by the JavaFX project.
+ * @param <T>
+ */
+public interface WritableValue<T> {
- void changed(Bindable<? extends T> bindable, T oldValue, T newValue);
+ T getValue();
+ void setValue(T value);
}
diff --git a/core/commons/src/main/java/org/apache/isis/core/commons/internal/binding/InternalBidirectionalBinding.java b/core/commons/src/main/java/org/apache/isis/core/commons/internal/binding/InternalBidirectionalBinding.java
new file mode 100644
index 0000000..f5145d4
--- /dev/null
+++ b/core/commons/src/main/java/org/apache/isis/core/commons/internal/binding/InternalBidirectionalBinding.java
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.core.commons.internal.binding;
+
+import java.lang.ref.WeakReference;
+
+import org.apache.isis.core.commons.binding.Bindable;
+import org.apache.isis.core.commons.binding.ChangeListener;
+import org.apache.isis.core.commons.binding.ObservableValue;
+
+import lombok.val;
+
+//@Log4j2
+abstract class InternalBidirectionalBinding<T>
+implements ChangeListener<T>, InternalUtil._WeakListener {
+
+ private static void checkParameters(Object property1, Object property2) {
+ if ((property1 == null) || (property2 == null)) {
+ throw new NullPointerException("Both properties must be specified.");
+ }
+ if (property1 == property2) {
+ throw new IllegalArgumentException("Cannot bind property to itself");
+ }
+ }
+
+ public static <T> InternalBidirectionalBinding<T> bind(Bindable<T> property1, Bindable<T> property2) {
+ checkParameters(property1, property2);
+ val binding = new TypedGenericBidirectionalBinding<T>(property1, property2);
+ property1.setValue(property2.getValue());
+ property1.addListener(binding);
+ property2.addListener(binding);
+ return binding;
+ }
+
+ public static <T> void unbind(Bindable<T> property1, Bindable<T> property2) {
+ checkParameters(property1, property2);
+ val binding = new UntypedGenericBidirectionalBinding(property1, property2);
+ property1.removeListener(binding);
+ property2.removeListener(binding);
+ }
+
+ public static void unbind(Object property1, Object property2) {
+ checkParameters(property1, property2);
+ val binding = new UntypedGenericBidirectionalBinding(property1, property2);
+ if (property1 instanceof ObservableValue) {
+ ((ObservableValue<?>) property1).removeListener(binding);
+ }
+ if (property2 instanceof ObservableValue) {
+ ((ObservableValue<?>) property2).removeListener(binding);
+ }
+ }
+
+ private final int cachedHashCode;
+
+ private InternalBidirectionalBinding(Object property1, Object property2) {
+ cachedHashCode = property1.hashCode() * property2.hashCode();
+ }
+
+ protected abstract Object getProperty1();
+
+ protected abstract Object getProperty2();
+
+ @Override
+ public int hashCode() {
+ return cachedHashCode;
+ }
+
+ @Override
+ public boolean wasGarbageCollected() {
+ return (getProperty1() == null) || (getProperty2() == null);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ final Object propertyA1 = getProperty1();
+ final Object propertyA2 = getProperty2();
+ if ((propertyA1 == null) || (propertyA2 == null)) {
+ return false;
+ }
+
+ if (obj instanceof InternalBidirectionalBinding) {
+ final InternalBidirectionalBinding<?> otherBinding = (InternalBidirectionalBinding<?>) obj;
+ final Object propertyB1 = otherBinding.getProperty1();
+ final Object propertyB2 = otherBinding.getProperty2();
+ if ((propertyB1 == null) || (propertyB2 == null)) {
+ return false;
+ }
+
+ if (propertyA1 == propertyB1 && propertyA2 == propertyB2) {
+ return true;
+ }
+ if (propertyA1 == propertyB2 && propertyA2 == propertyB1) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static class TypedGenericBidirectionalBinding<T> extends InternalBidirectionalBinding<T> {
+ private final WeakReference<Bindable<T>> propertyRef1;
+ private final WeakReference<Bindable<T>> propertyRef2;
+ private boolean updating = false;
+
+ private TypedGenericBidirectionalBinding(Bindable<T> property1, Bindable<T> property2) {
+ super(property1, property2);
+ propertyRef1 = new WeakReference<Bindable<T>>(property1);
+ propertyRef2 = new WeakReference<Bindable<T>>(property2);
+ }
+
+ @Override
+ protected Bindable<T> getProperty1() {
+ return propertyRef1.get();
+ }
+
+ @Override
+ protected Bindable<T> getProperty2() {
+ return propertyRef2.get();
+ }
+
+ @Override
+ public void changed(ObservableValue<? extends T> sourceProperty, T oldValue, T newValue) {
+ if (!updating) {
+ final Bindable<T> property1 = propertyRef1.get();
+ final Bindable<T> property2 = propertyRef2.get();
+ if ((property1 == null) || (property2 == null)) {
+ if (property1 != null) {
+ property1.removeListener(this);
+ }
+ if (property2 != null) {
+ property2.removeListener(this);
+ }
+ } else {
+ try {
+ updating = true;
+ if (property1 == sourceProperty) {
+ property2.setValue(newValue);
+ } else {
+ property1.setValue(newValue);
+ }
+ } catch (RuntimeException e) {
+ try {
+ if (property1 == sourceProperty) {
+ property1.setValue(oldValue);
+ } else {
+ property2.setValue(oldValue);
+ }
+ } catch (Exception e2) {
+ e2.addSuppressed(e);
+ unbind(property1, property2);
+ throw new RuntimeException(
+ "Bidirectional binding failed together with an attempt"
+ + " to restore the source property to the previous value."
+ + " Removing the bidirectional binding from properties " +
+ property1 + " and " + property2, e2);
+ }
+ throw new RuntimeException(
+ "Bidirectional binding failed, setting to the previous value", e);
+ } finally {
+ updating = false;
+ }
+ }
+ }
+ }
+ }
+
+ private static class UntypedGenericBidirectionalBinding extends InternalBidirectionalBinding<Object> {
+
+ private final Object property1;
+ private final Object property2;
+
+ public UntypedGenericBidirectionalBinding(Object property1, Object property2) {
+ super(property1, property2);
+ this.property1 = property1;
+ this.property2 = property2;
+ }
+
+ @Override
+ protected Object getProperty1() {
+ return property1;
+ }
+
+ @Override
+ protected Object getProperty2() {
+ return property2;
+ }
+
+ @Override
+ public void changed(ObservableValue<? extends Object> sourceProperty, Object oldValue, Object newValue) {
+ throw new RuntimeException("Should not reach here");
+ }
+ }
+
+
+}
diff --git a/core/commons/src/main/java/org/apache/isis/core/commons/internal/binding/InternalUtil.java b/core/commons/src/main/java/org/apache/isis/core/commons/internal/binding/InternalUtil.java
new file mode 100644
index 0000000..aabc71a
--- /dev/null
+++ b/core/commons/src/main/java/org/apache/isis/core/commons/internal/binding/InternalUtil.java
@@ -0,0 +1,443 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.core.commons.internal.binding;
+
+import java.lang.ref.WeakReference;
+import java.util.Arrays;
+import java.util.function.Predicate;
+
+import org.apache.isis.core.commons.binding.ChangeListener;
+import org.apache.isis.core.commons.binding.InvalidationListener;
+import org.apache.isis.core.commons.binding.Observable;
+import org.apache.isis.core.commons.binding.ObservableValue;
+
+import lombok.NonNull;
+
+abstract class InternalUtil<T> {
+
+ // -- WEAK LISTENING STUFF
+
+ static interface _WeakListener {
+ boolean wasGarbageCollected();
+ }
+
+ final static class _WeakChangeListener<T> implements ChangeListener<T>, _WeakListener {
+
+ private final WeakReference<ChangeListener<T>> ref;
+
+ public _WeakChangeListener(@NonNull ChangeListener<T> listener) {
+ this.ref = new WeakReference<ChangeListener<T>>(listener);
+ }
+
+ @Override
+ public boolean wasGarbageCollected() {
+ return (ref.get() == null);
+ }
+
+ @Override
+ public void changed(ObservableValue<? extends T> observable, T oldValue, T newValue) {
+ ChangeListener<T> listener = ref.get();
+ if (listener != null) {
+ listener.changed(observable, oldValue, newValue);
+ } else {
+ observable.removeListener(this);
+ }
+ }
+
+ }
+
+ final static class _WeakInvalidationListener implements InvalidationListener, _WeakListener {
+
+ private final WeakReference<InvalidationListener> ref;
+
+ public _WeakInvalidationListener(@NonNull InvalidationListener listener) {
+ this.ref = new WeakReference<InvalidationListener>(listener);
+ }
+
+ @Override
+ public boolean wasGarbageCollected() {
+ return (ref.get() == null);
+ }
+
+ @Override
+ public void invalidated(Observable observable) {
+ InvalidationListener listener = ref.get();
+ if (listener != null) {
+ listener.invalidated(observable);
+ } else {
+ observable.removeListener(this);
+ }
+ }
+ }
+
+
+ // -- STATIC METHODS
+
+ static <T> InternalUtil<T> addListener(InternalUtil<T> helper, ObservableValue<T> observable, InvalidationListener listener) {
+ if ((observable == null) || (listener == null)) {
+ throw new NullPointerException();
+ }
+ observable.getValue(); // validate observable
+ return (helper == null)? new SingleInvalidation<T>(observable, listener) : helper.addListener(listener);
+ }
+
+ static <T> InternalUtil<T> removeListener(InternalUtil<T> helper, InvalidationListener listener) {
+ if (listener == null) {
+ throw new NullPointerException();
+ }
+ return (helper == null)? null : helper.removeListener(listener);
+ }
+
+ static <T> InternalUtil<T> addListener(InternalUtil<T> helper, ObservableValue<T> observable, ChangeListener<? super T> listener) {
+ if ((observable == null) || (listener == null)) {
+ throw new NullPointerException();
+ }
+ return (helper == null)? new SingleChange<T>(observable, listener) : helper.addListener(listener);
+ }
+
+ static <T> InternalUtil<T> removeListener(InternalUtil<T> helper, ChangeListener<? super T> listener) {
+ if (listener == null) {
+ throw new NullPointerException();
+ }
+ return (helper == null)? null : helper.removeListener(listener);
+ }
+
+ static <T> void fireValueChangedEvent(InternalUtil<T> helper) {
+ if (helper != null) {
+ helper.fireValueChangedEvent();
+ }
+ }
+
+ // -- COMMON IMPLEMENTATIONS
+
+ protected final ObservableValue<T> observable;
+
+ private InternalUtil(ObservableValue<T> observable) {
+ this.observable = observable;
+ }
+
+ protected abstract InternalUtil<T> addListener(InvalidationListener listener);
+ protected abstract InternalUtil<T> removeListener(InvalidationListener listener);
+
+ protected abstract InternalUtil<T> addListener(ChangeListener<? super T> listener);
+ protected abstract InternalUtil<T> removeListener(ChangeListener<? super T> listener);
+
+ protected abstract void fireValueChangedEvent();
+
+ // -- IMPLEMENTATIONS
+
+ private static class SingleInvalidation<T> extends InternalUtil<T> {
+
+ private final InvalidationListener listener;
+
+ private SingleInvalidation(ObservableValue<T> expression, InvalidationListener listener) {
+ super(expression);
+ this.listener = listener;
+ }
+
+ @Override
+ protected InternalUtil<T> addListener(InvalidationListener listener) {
+ return new Generic<T>(observable, this.listener, listener);
+ }
+
+ @Override
+ protected InternalUtil<T> removeListener(InvalidationListener listener) {
+ return (listener.equals(this.listener))? null : this;
+ }
+
+ @Override
+ protected InternalUtil<T> addListener(ChangeListener<? super T> listener) {
+ return new Generic<T>(observable, this.listener, listener);
+ }
+
+ @Override
+ protected InternalUtil<T> removeListener(ChangeListener<? super T> listener) {
+ return this;
+ }
+
+ @Override
+ protected void fireValueChangedEvent() {
+ try {
+ listener.invalidated(observable);
+ } catch (Exception e) {
+ Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
+ }
+ }
+ }
+
+ private static class SingleChange<T> extends InternalUtil<T> {
+
+ private final ChangeListener<? super T> listener;
+ private T currentValue;
+
+ private SingleChange(ObservableValue<T> observable, ChangeListener<? super T> listener) {
+ super(observable);
+ this.listener = listener;
+ this.currentValue = observable.getValue();
+ }
+
+ @Override
+ protected InternalUtil<T> addListener(InvalidationListener listener) {
+ return new Generic<T>(observable, listener, this.listener);
+ }
+
+ @Override
+ protected InternalUtil<T> removeListener(InvalidationListener listener) {
+ return this;
+ }
+
+ @Override
+ protected InternalUtil<T> addListener(ChangeListener<? super T> listener) {
+ return new Generic<T>(observable, this.listener, listener);
+ }
+
+ @Override
+ protected InternalUtil<T> removeListener(ChangeListener<? super T> listener) {
+ return (listener.equals(this.listener))? null : this;
+ }
+
+ @Override
+ protected void fireValueChangedEvent() {
+ final T oldValue = currentValue;
+ currentValue = observable.getValue();
+ final boolean changed = (currentValue == null)? (oldValue != null) : !currentValue.equals(oldValue);
+ if (changed) {
+ try {
+ listener.changed(observable, oldValue, currentValue);
+ } catch (Exception e) {
+ Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
+ }
+ }
+ }
+ }
+
+ private static class Generic<T> extends InternalUtil<T> {
+
+ private InvalidationListener[] invalidationListeners;
+ private ChangeListener<? super T>[] changeListeners;
+ private int invalidationSize;
+ private int changeSize;
+ private boolean locked;
+ private T currentValue;
+
+ private Generic(ObservableValue<T> observable, InvalidationListener listener0, InvalidationListener listener1) {
+ super(observable);
+ this.invalidationListeners = new InvalidationListener[] {listener0, listener1};
+ this.invalidationSize = 2;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Generic(ObservableValue<T> observable, ChangeListener<? super T> listener0, ChangeListener<? super T> listener1) {
+ super(observable);
+ this.changeListeners = new ChangeListener[] {listener0, listener1};
+ this.changeSize = 2;
+ this.currentValue = observable.getValue();
+ }
+
+ @SuppressWarnings("unchecked")
+ private Generic(ObservableValue<T> observable, InvalidationListener invalidationListener, ChangeListener<? super T> changeListener) {
+ super(observable);
+ this.invalidationListeners = new InvalidationListener[] {invalidationListener};
+ this.invalidationSize = 1;
+ this.changeListeners = new ChangeListener[] {changeListener};
+ this.changeSize = 1;
+ this.currentValue = observable.getValue();
+ }
+
+ @Override
+ protected Generic<T> addListener(InvalidationListener listener) {
+ if (invalidationListeners == null) {
+ invalidationListeners = new InvalidationListener[] {listener};
+ invalidationSize = 1;
+ } else {
+ final int oldCapacity = invalidationListeners.length;
+ if (locked) {
+ final int newCapacity = (invalidationSize < oldCapacity)? oldCapacity : (oldCapacity * 3)/2 + 1;
+ invalidationListeners = Arrays.copyOf(invalidationListeners, newCapacity);
+ } else if (invalidationSize == oldCapacity) {
+ invalidationSize = trimListeners(invalidationSize, invalidationListeners);
+ if (invalidationSize == oldCapacity) {
+ final int newCapacity = (oldCapacity * 3)/2 + 1;
+ invalidationListeners = Arrays.copyOf(invalidationListeners, newCapacity);
+ }
+ }
+ invalidationListeners[invalidationSize++] = listener;
+ }
+ return this;
+ }
+
+ @Override
+ protected InternalUtil<T> removeListener(InvalidationListener listener) {
+ if (invalidationListeners != null) {
+ for (int index = 0; index < invalidationSize; index++) {
+ if (listener.equals(invalidationListeners[index])) {
+ if (invalidationSize == 1) {
+ if (changeSize == 1) {
+ return new SingleChange<T>(observable, changeListeners[0]);
+ }
+ invalidationListeners = null;
+ invalidationSize = 0;
+ } else if ((invalidationSize == 2) && (changeSize == 0)) {
+ return new SingleInvalidation<T>(observable, invalidationListeners[1-index]);
+ } else {
+ final int numMoved = invalidationSize - index - 1;
+ final InvalidationListener[] oldListeners = invalidationListeners;
+ if (locked) {
+ invalidationListeners = new InvalidationListener[invalidationListeners.length];
+ System.arraycopy(oldListeners, 0, invalidationListeners, 0, index);
+ }
+ if (numMoved > 0) {
+ System.arraycopy(oldListeners, index+1, invalidationListeners, index, numMoved);
+ }
+ invalidationSize--;
+ if (!locked) {
+ invalidationListeners[invalidationSize] = null; // Let gc do its work
+ }
+ }
+ break;
+ }
+ }
+ }
+ return this;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected InternalUtil<T> addListener(ChangeListener<? super T> listener) {
+ if (changeListeners == null) {
+ changeListeners = new ChangeListener[] {listener};
+ changeSize = 1;
+ } else {
+ final int oldCapacity = changeListeners.length;
+ if (locked) {
+ final int newCapacity = (changeSize < oldCapacity)? oldCapacity : (oldCapacity * 3)/2 + 1;
+ changeListeners = Arrays.copyOf(changeListeners, newCapacity);
+ } else if (changeSize == oldCapacity) {
+ changeSize = trimListeners(changeSize, changeListeners);
+ if (changeSize == oldCapacity) {
+ final int newCapacity = (oldCapacity * 3)/2 + 1;
+ changeListeners = Arrays.copyOf(changeListeners, newCapacity);
+ }
+ }
+ changeListeners[changeSize++] = listener;
+ }
+ if (changeSize == 1) {
+ currentValue = observable.getValue();
+ }
+ return this;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected InternalUtil<T> removeListener(ChangeListener<? super T> listener) {
+ if (changeListeners != null) {
+ for (int index = 0; index < changeSize; index++) {
+ if (listener.equals(changeListeners[index])) {
+ if (changeSize == 1) {
+ if (invalidationSize == 1) {
+ return new SingleInvalidation<T>(observable, invalidationListeners[0]);
+ }
+ changeListeners = null;
+ changeSize = 0;
+ } else if ((changeSize == 2) && (invalidationSize == 0)) {
+ return new SingleChange<T>(observable, changeListeners[1-index]);
+ } else {
+ final int numMoved = changeSize - index - 1;
+ final ChangeListener<? super T>[] oldListeners = changeListeners;
+ if (locked) {
+ changeListeners = new ChangeListener[changeListeners.length];
+ System.arraycopy(oldListeners, 0, changeListeners, 0, index);
+ }
+ if (numMoved > 0) {
+ System.arraycopy(oldListeners, index+1, changeListeners, index, numMoved);
+ }
+ changeSize--;
+ if (!locked) {
+ changeListeners[changeSize] = null; // Let gc do its work
+ }
+ }
+ break;
+ }
+ }
+ }
+ return this;
+ }
+
+ @Override
+ protected void fireValueChangedEvent() {
+ final InvalidationListener[] curInvalidationList = invalidationListeners;
+ final int curInvalidationSize = invalidationSize;
+ final ChangeListener<? super T>[] curChangeList = changeListeners;
+ final int curChangeSize = changeSize;
+
+ try {
+ locked = true;
+ for (int i = 0; i < curInvalidationSize; i++) {
+ try {
+ curInvalidationList[i].invalidated(observable);
+ } catch (Exception e) {
+ Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
+ }
+ }
+ if (curChangeSize > 0) {
+ final T oldValue = currentValue;
+ currentValue = observable.getValue();
+ final boolean changed = (currentValue == null)? (oldValue != null) : !currentValue.equals(oldValue);
+ if (changed) {
+ for (int i = 0; i < curChangeSize; i++) {
+ try {
+ curChangeList[i].changed(observable, oldValue, currentValue);
+ } catch (Exception e) {
+ Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
+ }
+ }
+ }
+ }
+ } finally {
+ locked = false;
+ }
+ }
+ }
+
+ private static int trimListeners(int size, Object[] listeners) {
+ Predicate<Object> p = t -> t instanceof _WeakListener &&
+ ((_WeakListener)t).wasGarbageCollected();
+ int index = 0;
+ for (; index < size; index++) {
+ if (p.test(listeners[index])) {
+ break;
+ }
+ }
+ if (index < size) {
+ for (int src = index + 1; src < size; src++) {
+ if (!p.test(listeners[src])) {
+ listeners[index++] = listeners[src];
+ }
+ }
+ int oldSize = size;
+ size = index;
+ for (; index < oldSize; index++) {
+ listeners[index] = null;
+ }
+ }
+
+ return size;
+ }
+
+}
diff --git a/core/commons/src/main/java/org/apache/isis/core/commons/internal/binding/_BindableAbstract.java b/core/commons/src/main/java/org/apache/isis/core/commons/internal/binding/_BindableAbstract.java
new file mode 100644
index 0000000..da565dc
--- /dev/null
+++ b/core/commons/src/main/java/org/apache/isis/core/commons/internal/binding/_BindableAbstract.java
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.core.commons.internal.binding;
+
+import java.lang.ref.WeakReference;
+
+import org.apache.isis.core.commons.binding.Bindable;
+import org.apache.isis.core.commons.binding.ChangeListener;
+import org.apache.isis.core.commons.binding.InvalidationListener;
+import org.apache.isis.core.commons.binding.Observable;
+import org.apache.isis.core.commons.binding.ObservableValue;
+
+
+/**
+ * <h1>- internal use only -</h1>
+ *
+ * <p>
+ * <b>WARNING</b>: Do <b>NOT</b> use any of the classes provided by this package! <br/>
+ * These may be changed or removed without notice!
+ * </p>
+ *
+ * @since 2.0
+ */
+abstract class _BindableAbstract<T> implements Bindable<T> {
+
+ private T value;
+ private ObservableValue<? extends T> observable = null;;
+ private InvalidationListener listener = null;
+ private boolean valid = true;
+ private InternalUtil<T> helper = null;
+
+ public _BindableAbstract() {
+ }
+
+ public _BindableAbstract(T initialValue) {
+ this.value = initialValue;
+ }
+
+ @Override
+ public void addListener(InvalidationListener listener) {
+ helper = InternalUtil.addListener(helper, this, listener);
+ }
+
+ @Override
+ public void removeListener(InvalidationListener listener) {
+ helper = InternalUtil.removeListener(helper, listener);
+ }
+
+ @Override
+ public void addListener(ChangeListener<? super T> listener) {
+ helper = InternalUtil.addListener(helper, this, listener);
+ }
+
+ @Override
+ public void removeListener(ChangeListener<? super T> listener) {
+ helper = InternalUtil.removeListener(helper, listener);
+ }
+
+ @Override
+ public void bindBidirectional(Bindable<T> other) {
+ InternalBidirectionalBinding.bind(this, other);
+ }
+
+ @Override
+ public void unbindBidirectional(Bindable<T> other) {
+ InternalBidirectionalBinding.unbind(this, other);
+ }
+
+ protected void fireValueChangedEvent() {
+ InternalUtil.fireValueChangedEvent(helper);
+ }
+
+ private void markInvalid() {
+ if (valid) {
+ valid = false;
+ invalidated();
+ fireValueChangedEvent();
+ }
+ }
+
+ protected void invalidated() {
+ }
+
+ @Override
+ public T getValue() {
+ valid = true;
+ return observable == null ? value : observable.getValue();
+ }
+
+ @Override
+ public void setValue(T newValue) {
+ if (isBound()) {
+ throw new java.lang.RuntimeException("A bound value cannot be set.");
+ }
+ if (value != newValue) {
+ value = newValue;
+ markInvalid();
+ }
+ }
+
+ @Override
+ public boolean isBound() {
+ return observable != null;
+ }
+
+ @Override
+ public void bind(final ObservableValue<? extends T> newObservable) {
+ if (newObservable == null) {
+ throw new NullPointerException("Cannot bind to null");
+ }
+
+ if (!newObservable.equals(this.observable)) {
+ unbind();
+ observable = newObservable;
+ if (listener == null) {
+ listener = new Listener(this);
+ }
+ observable.addListener(listener);
+ markInvalid();
+ }
+ }
+
+ @Override
+ public void unbind() {
+ if (observable != null) {
+ value = observable.getValue();
+ observable.removeListener(listener);
+ observable = null;
+ }
+ }
+
+ private static class Listener implements InvalidationListener, InternalUtil._WeakListener {
+
+ private final WeakReference<_BindableAbstract<?>> wref;
+
+ public Listener(_BindableAbstract<?> ref) {
+ this.wref = new WeakReference<_BindableAbstract<?>>(ref);
+ }
+
+ @Override
+ public void invalidated(Observable observable) {
+ _BindableAbstract<?> ref = wref.get();
+ if (ref == null) {
+ observable.removeListener(this);
+ } else {
+ ref.markInvalid();
+ }
+ }
+
+ @Override
+ public boolean wasGarbageCollected() {
+ return wref.get() == null;
+ }
+ }
+}
diff --git a/core/commons/src/main/java/org/apache/isis/core/commons/binding/Bindable.java b/core/commons/src/main/java/org/apache/isis/core/commons/internal/binding/_Bindables.java
similarity index 54%
copy from core/commons/src/main/java/org/apache/isis/core/commons/binding/Bindable.java
copy to core/commons/src/main/java/org/apache/isis/core/commons/internal/binding/_Bindables.java
index f2e1195..9b30654 100644
--- a/core/commons/src/main/java/org/apache/isis/core/commons/binding/Bindable.java
+++ b/core/commons/src/main/java/org/apache/isis/core/commons/internal/binding/_Bindables.java
@@ -16,29 +16,32 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.isis.core.commons.binding;
+package org.apache.isis.core.commons.internal.binding;
-public interface Bindable<T> {
+import lombok.val;
- Object getBean();
-
- String getName();
-
- T getValue();
-
- void setValue(T newValue);
-
- boolean isBound();
+/**
+ * <h1>- internal use only -</h1>
+ *
+ * <p>
+ * <b>WARNING</b>: Do <b>NOT</b> use any of the classes provided by this package! <br/>
+ * These may be changed or removed without notice!
+ * </p>
+ *
+ * @since 2.0
+ */
+public class _Bindables {
- void bind(Bindable<T> observable);
- void unbind();
+ private static class SimpleBindable<T> extends _BindableAbstract<T> {}
+
+ public static <T> _BindableAbstract<T> empty() {
+ return new SimpleBindable<T>();
+ }
+
+ public static <T> _BindableAbstract<T> forValue(T initialValue) {
+ val bindable = new SimpleBindable<T>();
+ bindable.setValue(initialValue);
+ return bindable;
+ }
- void bindBidirectional(Bindable<T> other);
- void unbindBidirectional(Bindable<T> other);
-
- void addListener(ChangeListener<? super T> listener);
-
- void removeListener(ChangeListener<? super T> listener);
-
-
}
diff --git a/core/commons/src/main/java/org/apache/isis/core/commons/binding/ChangeListener.java b/core/commons/src/main/java/org/apache/isis/core/commons/internal/binding/package-info.java
similarity index 68%
copy from core/commons/src/main/java/org/apache/isis/core/commons/binding/ChangeListener.java
copy to core/commons/src/main/java/org/apache/isis/core/commons/internal/binding/package-info.java
index db1455a..2fd0a9f 100644
--- a/core/commons/src/main/java/org/apache/isis/core/commons/binding/ChangeListener.java
+++ b/core/commons/src/main/java/org/apache/isis/core/commons/internal/binding/package-info.java
@@ -16,10 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.isis.core.commons.binding;
-
-public interface ChangeListener<T> {
-
- void changed(Bindable<? extends T> bindable, T oldValue, T newValue);
-
-}
+/**
+ * This Binding API is heavily inspired by the JavaFX project!
+ * <p>
+ *
+ * <h1>Internal API</h1>
+ * Internal classes, contributing to the internal proprietary API.
+ * These may be changed or removed without notice!
+ * <p>
+ * <b>WARNING</b>:
+ * Do NOT use any of the classes provided by this package!
+ * </p>
+ */
+package org.apache.isis.core.commons.internal.binding;
\ No newline at end of file
diff --git a/core/commons/src/test/java/org/apache/isis/core/commons/internal/binding/BindableTest.java b/core/commons/src/test/java/org/apache/isis/core/commons/internal/binding/BindableTest.java
new file mode 100644
index 0000000..3848080
--- /dev/null
+++ b/core/commons/src/test/java/org/apache/isis/core/commons/internal/binding/BindableTest.java
@@ -0,0 +1,237 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.core.commons.internal.binding;
+
+import java.util.concurrent.atomic.LongAdder;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.apache.isis.core.commons.collections.Can;
+
+import lombok.val;
+
+class BindableTest {
+
+ @Test
+ void unidirectionalBinding() {
+
+ val primaryChangeCounter = new LongAdder();
+ val secondaryChangeCounter = new LongAdder();
+
+ val primary = _Bindables.forValue("hello");
+ val secondary = _Bindables.forValue("");
+
+ primary.addListener((e,o,n)->primaryChangeCounter.increment());
+ secondary.addListener((e,o,n)->secondaryChangeCounter.increment());
+
+ assertFalse(primary.isBound());
+ assertFalse(secondary.isBound());
+
+ // setup unidirectional binding, implicitly propagates value PRIMARY -> SECONDARY
+
+ secondary.bind(primary);
+
+ assertFalse(primary.isBound()); // not bound
+ assertTrue(secondary.isBound()); // bound
+
+ assertEquals("hello", primary.getValue());
+ assertEquals("hello", secondary.getValue());
+
+ assertEquals(0, primaryChangeCounter.intValue());
+ assertEquals(1, secondaryChangeCounter.intValue()); // expected 1 after bidirectional binding established
+
+ // propagate value PRIMARY -> SECONDARY
+
+ primary.setValue("there");
+
+ assertEquals("there", primary.getValue());
+ assertEquals("there", secondary.getValue());
+
+ assertEquals(1, primaryChangeCounter.intValue());
+ assertEquals(2, secondaryChangeCounter.intValue());
+
+ // propagate value SECONDARY -> PRIMARY
+
+ assertThrows(Exception.class, ()->secondary.setValue("world")); // a bound value cannot be set
+
+ assertEquals("there", primary.getValue());
+ assertEquals("there", secondary.getValue());
+
+ assertEquals(1, primaryChangeCounter.intValue());
+ assertEquals(2, secondaryChangeCounter.intValue());
+
+ }
+
+ @Test
+ void bidirectionalBinding() {
+
+ val primaryChangeCounter = new LongAdder();
+ val secondaryChangeCounter = new LongAdder();
+
+ val primary = _Bindables.forValue("hello");
+ val secondary = _Bindables.forValue("");
+
+ primary.addListener((e,o,n)->primaryChangeCounter.increment());
+ secondary.addListener((e,o,n)->secondaryChangeCounter.increment());
+
+ assertFalse(primary.isBound());
+ assertFalse(secondary.isBound());
+
+ // setup bidirectional binding, implicitly propagates value PRIMARY -> SECONDARY
+
+ secondary.bindBidirectional(primary);
+
+ assertFalse(primary.isBound()); // bidirectional binding is separated from unidirectional binding
+ assertFalse(secondary.isBound()); // bidirectional binding is separated from unidirectional binding
+
+ assertEquals("hello", primary.getValue());
+ assertEquals("hello", secondary.getValue());
+
+ assertEquals(0, primaryChangeCounter.intValue());
+ assertEquals(1, secondaryChangeCounter.intValue()); // expected 1 after bidirectional binding established
+
+ // propagate value PRIMARY -> SECONDARY
+
+ primary.setValue("there");
+
+ assertEquals("there", primary.getValue());
+ assertEquals("there", secondary.getValue());
+
+ assertEquals(1, primaryChangeCounter.intValue());
+ assertEquals(2, secondaryChangeCounter.intValue());
+
+ // propagate value SECONDARY -> PRIMARY
+
+ secondary.setValue("world");
+
+ assertEquals("world", primary.getValue());
+ assertEquals("world", secondary.getValue());
+
+ assertEquals(2, primaryChangeCounter.intValue());
+ assertEquals(3, secondaryChangeCounter.intValue());
+
+ }
+
+ @Test
+ void unidirectionalBinding_onCan() {
+
+ val primaryChangeCounter = new LongAdder();
+ val secondaryChangeCounter = new LongAdder();
+
+ val primary = _Bindables.forValue(Can.<String>of("hello"));
+ val secondary = _Bindables.forValue(Can.<String>empty());
+
+ primary.addListener((e,o,n)->primaryChangeCounter.increment());
+ secondary.addListener((e,o,n)->secondaryChangeCounter.increment());
+
+ assertFalse(primary.isBound());
+ assertFalse(secondary.isBound());
+
+ // setup unidirectional binding, implicitly propagates value PRIMARY -> SECONDARY
+
+ secondary.bind(primary);
+
+ assertFalse(primary.isBound()); // not bound
+ assertTrue(secondary.isBound()); // bound
+
+ assertEquals(Can.<String>of("hello"), primary.getValue());
+ assertEquals(Can.<String>of("hello"), secondary.getValue());
+
+ assertEquals(0, primaryChangeCounter.intValue());
+ assertEquals(1, secondaryChangeCounter.intValue()); // expected 1 after bidirectional binding established
+
+ // propagate value PRIMARY -> SECONDARY
+
+ primary.setValue(primary.getValue().add("there"));
+
+ assertEquals(Can.<String>of("hello", "there"), primary.getValue());
+ assertEquals(Can.<String>of("hello", "there"), secondary.getValue());
+
+ assertEquals(1, primaryChangeCounter.intValue());
+ assertEquals(2, secondaryChangeCounter.intValue());
+
+ // propagate value SECONDARY -> PRIMARY
+
+ assertThrows(Exception.class, ()->secondary.setValue(Can.empty())); // a bound value cannot be set
+
+ assertEquals(Can.<String>of("hello", "there"), primary.getValue());
+ assertEquals(Can.<String>of("hello", "there"), secondary.getValue());
+
+ assertEquals(1, primaryChangeCounter.intValue());
+ assertEquals(2, secondaryChangeCounter.intValue());
+
+ }
+
+ @Test
+ void bidirectionalBinding_onCan() {
+
+ val primaryChangeCounter = new LongAdder();
+ val secondaryChangeCounter = new LongAdder();
+
+ val primary = _Bindables.forValue(Can.<String>of("hello"));
+ val secondary = _Bindables.forValue(Can.<String>empty());
+
+ primary.addListener((e,o,n)->primaryChangeCounter.increment());
+ secondary.addListener((e,o,n)->secondaryChangeCounter.increment());
+
+ assertFalse(primary.isBound());
+ assertFalse(secondary.isBound());
+
+ // setup bidirectional binding, implicitly propagates value PRIMARY -> SECONDARY
+
+ secondary.bindBidirectional(primary);
+
+ assertFalse(primary.isBound()); // bidirectional binding is separated from unidirectional binding
+ assertFalse(secondary.isBound()); // bidirectional binding is separated from unidirectional binding
+
+ assertEquals(Can.<String>of("hello"), primary.getValue());
+ assertEquals(Can.<String>of("hello"), secondary.getValue());
+
+ assertEquals(0, primaryChangeCounter.intValue());
+ assertEquals(1, secondaryChangeCounter.intValue()); // expected 1 after bidirectional binding established
+
+ // propagate value PRIMARY -> SECONDARY
+
+ primary.setValue(primary.getValue().add("there"));
+
+ assertEquals(Can.<String>of("hello", "there"), primary.getValue());
+ assertEquals(Can.<String>of("hello", "there"), secondary.getValue());
+
+ assertEquals(1, primaryChangeCounter.intValue());
+ assertEquals(2, secondaryChangeCounter.intValue());
+
+ // propagate value SECONDARY -> PRIMARY
+
+ primary.setValue(primary.getValue().add("world"));
+
+ assertEquals(Can.<String>of("hello", "there", "world"), primary.getValue());
+ assertEquals(Can.<String>of("hello", "there", "world"), secondary.getValue());
+
+ assertEquals(2, primaryChangeCounter.intValue());
+ assertEquals(3, secondaryChangeCounter.intValue());
+
+ }
+
+
+}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/PendingParameterModel.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/PendingParameterModel.java
index 7e4e60b..6fe2b45 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/PendingParameterModel.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/PendingParameterModel.java
@@ -26,6 +26,8 @@ import javax.annotation.Nullable;
import org.apache.isis.core.commons.binding.Bindable;
import org.apache.isis.core.commons.binding.ChangeListener;
+import org.apache.isis.core.commons.binding.InvalidationListener;
+import org.apache.isis.core.commons.binding.ObservableValue;
import org.apache.isis.core.commons.collections.Can;
import org.apache.isis.core.commons.internal.collections._Maps;
import org.apache.isis.core.metamodel.interactions.managed.ActionInteractionHead;
@@ -78,12 +80,10 @@ public class PendingParameterModel {
@Getter @NonNull private int paramNr;
@Getter @NonNull private PendingParameterModel model;
- @Override
public Object getBean() {
return model;
}
- @Override
public String getName() {
val paramMeta = model.getHead().getMetaModel().getParameters().getElseFail(paramNr);
return paramMeta.getName();
@@ -116,32 +116,22 @@ public class PendingParameterModel {
changeListeners.remove(listener);
}
-// @Override
-// public void addListener(InvalidationListener listener) {
-// invalidationListeners.add(listener);
-// }
-//
-// @Override
-// public void removeListener(InvalidationListener listener) {
-// invalidationListeners.remove(listener);
-// }
-
@Override
- public void bind(Bindable<ManagedObject> observable) {
+ public void unbind() {
// TODO Auto-generated method stub
}
@Override
- public void unbind() {
+ public boolean isBound() {
// TODO Auto-generated method stub
-
+ return false;
}
@Override
- public boolean isBound() {
+ public void bind(ObservableValue<? extends ManagedObject> observable) {
// TODO Auto-generated method stub
- return false;
+
}
@Override
@@ -155,6 +145,19 @@ public class PendingParameterModel {
// TODO Auto-generated method stub
}
+
+ @Override
+ public void addListener(InvalidationListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeListener(InvalidationListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
}