changeset 5908:2627257f8d78

Ensemble8: Fix for RT-34701 Need to remove Lambda expressions from Ensemble8
author Alexander Kouznetsov
date Wed, 04 Dec 2013 14:40:10 -0800
parents 6f1de57755ac
children ff662670c9a4
files apps/samples/Ensemble8/nbproject/project.properties apps/samples/Ensemble8/src/app/java/ensemble/samplepage/Description.java apps/samples/Ensemble8/src/app/java/ensemble/samplepage/SamplePage.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/graphics3d/xylophone/XylophoneApp.java
diffstat 4 files changed, 68 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/apps/samples/Ensemble8/nbproject/project.properties	Wed Dec 04 13:35:56 2013 -0800
+++ b/apps/samples/Ensemble8/nbproject/project.properties	Wed Dec 04 14:40:10 2013 -0800
@@ -43,8 +43,8 @@
 javac.deprecation=false
 javac.processorpath=\
     ${javac.classpath}
-javac.source=1.8
-javac.target=1.8
+javac.source=1.7
+javac.target=1.7
 javac.test.classpath=\
     ${javac.classpath}:\
     ${build.classes.dir}
--- a/apps/samples/Ensemble8/src/app/java/ensemble/samplepage/Description.java	Wed Dec 04 13:35:56 2013 -0800
+++ b/apps/samples/Ensemble8/src/app/java/ensemble/samplepage/Description.java	Wed Dec 04 14:40:10 2013 -0800
@@ -46,7 +46,7 @@
 import javafx.scene.layout.GridPane;
 import javafx.scene.layout.VBox;
 import javafx.scene.text.Text;
-
+import javafx.util.Callback;
 import static ensemble.samplepage.SamplePage.INDENT;
 import static ensemble.samplepage.SamplePageContent.title;
 import javafx.application.ConditionalFeature;
@@ -79,8 +79,10 @@
         sourceBtn.getStyleClass().add("sample-page-box-title");
         sourceBtn.setGraphic(new ImageView(ORANGE_ARROW));
         sourceBtn.setContentDisplay(ContentDisplay.RIGHT);
-        sourceBtn.setOnAction(event -> {
-            samplePage.pageBrowser.goToPage(samplePage.getUrl().replaceFirst("sample://", "sample-src://"));
+        sourceBtn.setOnAction(new EventHandler<ActionEvent>() {
+            @Override public void handle(ActionEvent ev) {
+                samplePage.pageBrowser.goToPage(samplePage.getUrl().replaceFirst("sample://", "sample-src://"));
+            }
         });
         if (!PlatformFeatures.EMBEDDED) getChildren().add(sourceBtn);
         if (Platform.isSupported(ConditionalFeature.WEB)) {
@@ -126,9 +128,11 @@
         }
 
         // listen for when sample changes
-        samplePage.registerSampleInfoUpdater(sampleInfo -> {
-            update(sampleInfo);
-            return null;
+        samplePage.registerSampleInfoUpdater(new Callback<SampleInfo, Void>() {
+            @Override public Void call(SampleInfo sampleInfo) {
+                update(sampleInfo);
+                return null;
+            }
         });
     }
 
@@ -137,16 +141,20 @@
             relatedDocumentsList.getChildren().clear();
             for (final URL docUrl : sampleInfo.getDocURLs()) {
                 Hyperlink link = new Hyperlink(docUrl.getName());
-                link.setOnAction(t -> {
-                    samplePage.pageBrowser.goToPage(docUrl.getURL());
+                link.setOnAction(new EventHandler<ActionEvent>() {
+                    @Override public void handle(ActionEvent ev) {
+                        samplePage.pageBrowser.goToPage(docUrl.getURL());
+                    }
                 });
                 link.setTooltip(new Tooltip(docUrl.getName()));
                 relatedDocumentsList.getChildren().add(link);
             }
             for (final String classpath : sampleInfo.apiClasspaths) {
                 Hyperlink link = new Hyperlink(classpath.replace('$', '.'));
-                link.setOnAction(t -> {
-                    samplePage.pageBrowser.goToPage(samplePage.apiClassToUrl(classpath));
+                link.setOnAction(new EventHandler<ActionEvent>() {
+                    @Override public void handle(ActionEvent ev) {
+                        samplePage.pageBrowser.goToPage(samplePage.apiClassToUrl(classpath));
+                    }
                 });
                 relatedDocumentsList.getChildren().add(link);
             }
--- a/apps/samples/Ensemble8/src/app/java/ensemble/samplepage/SamplePage.java	Wed Dec 04 13:35:56 2013 -0800
+++ b/apps/samples/Ensemble8/src/app/java/ensemble/samplepage/SamplePage.java	Wed Dec 04 14:40:10 2013 -0800
@@ -43,6 +43,8 @@
 import javafx.beans.property.SimpleObjectProperty;
 import javafx.beans.property.SimpleStringProperty;
 import javafx.beans.property.StringProperty;
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
 import javafx.scene.Node;
 import javafx.scene.layout.StackPane;
 import javafx.util.Callback;
@@ -118,8 +120,10 @@
      * @param updater a method that updates content for a given SampleInfo
      */
     void registerSampleInfoUpdater(final Callback<SampleInfo, Void> updater) {
-        sampleInfoProperty.addListener((ov, t, sampleInfo) -> {
-            updater.call(sampleInfo);
+        sampleInfoProperty.addListener(new ChangeListener<SampleInfo>() {
+            public void changed(ObservableValue<? extends SampleInfo> ov, SampleInfo t, SampleInfo sampleInfo) {
+                updater.call(sampleInfo);
+            }
         });
         updater.call(sampleInfoProperty.get());
     }
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/graphics3d/xylophone/XylophoneApp.java	Wed Dec 04 13:35:56 2013 -0800
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/graphics3d/xylophone/XylophoneApp.java	Wed Dec 04 14:40:10 2013 -0800
@@ -36,12 +36,14 @@
 import javafx.animation.KeyValue;
 import javafx.animation.Timeline;
 import javafx.application.Application;
+import javafx.event.EventHandler;
 import javafx.scene.Group;
 import javafx.scene.SceneAntialiasing;
 import javafx.scene.Parent;
 import javafx.scene.PerspectiveCamera;
 import javafx.scene.Scene;
 import javafx.scene.SubScene;
+import javafx.scene.input.MouseEvent;
 import javafx.scene.media.AudioClip;
 import javafx.scene.paint.Color;
 import javafx.scene.paint.PhongMaterial;
@@ -171,15 +173,46 @@
         bar8Cube.setTranslateX(xStart + 8 * xOffset);
         bar8Cube.setTranslateZ(yPos);
 
-        bar1Cube.setOnMousePressed(t -> bar1Note.play());
-        bar2Cube.setOnMousePressed(t -> bar2Note.play());
-        bar3Cube.setOnMousePressed(t -> bar3Note.play());
-        bar4Cube.setOnMousePressed(t -> bar4Note.play());
-        bar5Cube.setOnMousePressed(t -> bar5Note.play());
-        bar6Cube.setOnMousePressed(t -> bar6Note.play());
-        bar7Cube.setOnMousePressed(t -> bar7Note.play());
-        bar8Cube.setOnMousePressed(t -> bar8Note.play());
-
+        bar1Cube.setOnMousePressed(new EventHandler<MouseEvent>() {
+            @Override public void handle(MouseEvent me) {
+                bar1Note.play();
+            }
+        });
+        bar2Cube.setOnMousePressed(new EventHandler<MouseEvent>() {
+            @Override public void handle(MouseEvent me) {
+                bar2Note.play();
+            }
+        });
+        bar3Cube.setOnMousePressed(new EventHandler<MouseEvent>() {
+            @Override public void handle(MouseEvent me) {
+                bar3Note.play();
+            }
+        });
+        bar4Cube.setOnMousePressed(new EventHandler<MouseEvent>() {
+            @Override public void handle(MouseEvent me) {
+                bar4Note.play();
+            }
+        });
+        bar5Cube.setOnMousePressed(new EventHandler<MouseEvent>() {
+            @Override public void handle(MouseEvent me) {
+                bar5Note.play();
+            }
+        });
+        bar6Cube.setOnMousePressed(new EventHandler<MouseEvent>() {
+            @Override public void handle(MouseEvent me) {
+                bar6Note.play();
+            }
+        });
+        bar7Cube.setOnMousePressed(new EventHandler<MouseEvent>() {
+            @Override public void handle(MouseEvent me) {
+                bar7Note.play();
+            }
+        });
+        bar8Cube.setOnMousePressed(new EventHandler<MouseEvent>() {
+            @Override public void handle(MouseEvent me) {
+                bar8Note.play();
+            }
+        });
         rectangleGroup.getChildren().addAll(base1Cube, base2Cube,
                 bar1Cube, bar2Cube, bar3Cube,
                 bar4Cube, bar5Cube, bar6Cube,