Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2016-11-25 14:19:12 +0000
committerTom Schindl2016-11-25 14:19:12 +0000
commit7ef4f9330bc18c37f7450e3dc7bcbf0ec4ee86a3 (patch)
tree33544b8d3223e20ab7549d50c47f82d562d4f910
parent5532c98e20c24a6610bdfcdd59e46579fc8c26c2 (diff)
downloadorg.eclipse.efxclipse-7ef4f9330bc18c37f7450e3dc7bcbf0ec4ee86a3.tar.gz
org.eclipse.efxclipse-7ef4f9330bc18c37f7450e3dc7bcbf0ec4ee86a3.tar.xz
org.eclipse.efxclipse-7ef4f9330bc18c37f7450e3dc7bcbf0ec4ee86a3.zip
refs #33
adding a new container who allows to skip css and layout passes on demand Change-Id: Ie4794197cefe0af06813e4bd72ac662a967c3f1a
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.panes/src/org/eclipse/fx/ui/panes/LazyStackPane.java64
1 files changed, 64 insertions, 0 deletions
diff --git a/bundles/runtime/org.eclipse.fx.ui.panes/src/org/eclipse/fx/ui/panes/LazyStackPane.java b/bundles/runtime/org.eclipse.fx.ui.panes/src/org/eclipse/fx/ui/panes/LazyStackPane.java
new file mode 100644
index 000000000..e42090cf7
--- /dev/null
+++ b/bundles/runtime/org.eclipse.fx.ui.panes/src/org/eclipse/fx/ui/panes/LazyStackPane.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2016 BestSolution.at and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tom Schindl<tom.schindl@bestsolution.at> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.fx.ui.panes;
+
+import java.util.function.Predicate;
+
+import javafx.beans.value.WritableValue;
+import javafx.scene.layout.StackPane;
+
+/**
+ * A {@link StackPane} who is able break the recursive CSS & Layout-Pass call
+ * chain
+ */
+public class LazyStackPane extends StackPane {
+ /**
+ * The check type
+ */
+ public enum CheckType {
+ /**
+ * Should a layout pass be forwarded
+ */
+ LAYOUT,
+ /**
+ * Should a css pass be forwarded
+ */
+ CSS
+ }
+
+ private Predicate<CheckType> checkSupplier;
+
+ /**
+ * Create a pane who can optimize CSS & Layout-Passes
+ *
+ * @param checkSupplier
+ * the supplier
+ */
+ public LazyStackPane(Predicate<CheckType> checkSupplier) {
+ this.checkSupplier = checkSupplier;
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ protected void impl_processCSS(WritableValue<Boolean> unused) {
+ if (this.checkSupplier.test(CheckType.CSS)) {
+ super.impl_processCSS(unused);
+ }
+
+ }
+
+ @Override
+ protected void layoutChildren() {
+ if (this.checkSupplier.test(CheckType.LAYOUT)) {
+ super.layoutChildren();
+ }
+ }
+}

Back to the top