Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2016-03-31 13:00:20 +0000
committerTom Schindl2016-03-31 13:00:20 +0000
commit1a7c4f1a0444c65d6c467457899e6b07d7bc96c3 (patch)
treeca313b1a95e9a3cecaceb961e529909e31380d68
parent1161702d13e771e64381eb53e1e71e3510b624a4 (diff)
downloadorg.eclipse.efxclipse-1a7c4f1a0444c65d6c467457899e6b07d7bc96c3.tar.gz
org.eclipse.efxclipse-1a7c4f1a0444c65d6c467457899e6b07d7bc96c3.tar.xz
org.eclipse.efxclipse-1a7c4f1a0444c65d6c467457899e6b07d7bc96c3.zip
Bug 490787 - Add validation and decoration support
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/form/Binding.java4
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/form/DefaultForm.java18
2 files changed, 9 insertions, 13 deletions
diff --git a/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/form/Binding.java b/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/form/Binding.java
index 38fce75cf..2c49e8090 100644
--- a/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/form/Binding.java
+++ b/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/form/Binding.java
@@ -1,7 +1,5 @@
package org.eclipse.fx.ui.controls.form;
-import java.util.Optional;
-
import org.eclipse.fx.core.Status;
import javafx.beans.property.ReadOnlyObjectProperty;
@@ -10,6 +8,6 @@ import javafx.scene.Node;
public interface Binding {
public String id();
public ReadOnlyObjectProperty<Status> validationStatusProperty();
- public Optional<Node> decoratedNode();
+ public Node nodeWithStatus();
public void dispose();
}
diff --git a/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/form/DefaultForm.java b/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/form/DefaultForm.java
index 870c48a5f..7d4a163c2 100644
--- a/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/form/DefaultForm.java
+++ b/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/form/DefaultForm.java
@@ -173,7 +173,7 @@ public class DefaultForm implements Form {
private BindingConfiguration type;
private final DefaultForm form;
private Node decoratedNode;
- private Optional<Node> cachedNode;
+ private Node cachedNode;
public BindingImpl(DefaultForm form, String id, Node decoratedNode, Property<T> validatedProperty,
Property<T> oppositeProperty,
@@ -237,16 +237,14 @@ public class DefaultForm implements Form {
}
@Override
- public Optional<Node> decoratedNode() {
+ public Node nodeWithStatus() {
if( this.cachedNode == null ) {
- this.cachedNode = Optional.ofNullable(this.decoratedNode)
- .map( n -> this.form.decorator.decorate(this.validationStatus, n))
- .map( n -> {
- if( this.nodeMutatorList != null ) {
- this.nodeMutatorList.forEach( m -> m.mutator.accept(n, m.data));
- }
- return n;
- });
+ this.cachedNode = this.form.decorator.decorate(this.validationStatus, this.decoratedNode);
+ if( this.nodeMutatorList != null ) {
+ this.nodeMutatorList.forEach( m -> m.mutator.accept(this.cachedNode, m.data));
+ }
+ } else {
+ this.cachedNode = new StatusNode(this.validationStatus);
}
return this.cachedNode;
}

Back to the top