changeset 5240:9b496ab6ad57

RT-29922 Ensemble8: remove builders (partial)
author dmasada
date Wed, 02 Oct 2013 15:31:11 -0700
parents 5f4b2dc52be7
children bed4d07b03e8
files apps/samples/Ensemble8/src/samples/java/ensemble/samples/animation/transitions/sequentialtransition/SequentialTransitionApp.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/charts/area/stacked/StackedAreaChartApp.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/charts/bar/stacked/StackedBarChartApp.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/controls/colorpicker/ColorPickerApp.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/controls/pagination/PaginationApp.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/controls/splitpane/hiddensplitpane/HiddenSplitPaneApp.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/controls/tab/tabpane/TabPaneApp.java
diffstat 7 files changed, 65 insertions(+), 92 deletions(-) [+]
line wrap: on
line diff
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/animation/transitions/sequentialtransition/SequentialTransitionApp.java	Wed Oct 02 15:04:32 2013 -0700
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/animation/transitions/sequentialtransition/SequentialTransitionApp.java	Wed Oct 02 15:31:11 2013 -0700
@@ -32,16 +32,11 @@
 package ensemble.samples.animation.transitions.sequentialtransition;
 
 import javafx.animation.FadeTransition;
-import javafx.animation.FadeTransitionBuilder;
 import javafx.animation.RotateTransition;
-import javafx.animation.RotateTransitionBuilder;
 import javafx.animation.ScaleTransition;
-import javafx.animation.ScaleTransitionBuilder;
 import javafx.animation.SequentialTransition;
-import javafx.animation.SequentialTransitionBuilder;
 import javafx.animation.Timeline;
 import javafx.animation.TranslateTransition;
-import javafx.animation.TranslateTransitionBuilder;
 import javafx.application.Application;
 import javafx.scene.Parent;
 import javafx.scene.Scene;
@@ -87,45 +82,34 @@
         rect.setTranslateY(50);
         root.getChildren().add(rect);
         // create 4 transitions
-        FadeTransition fadeTransition =
-                FadeTransitionBuilder.create()
-                .duration(Duration.seconds(1))
-                .fromValue(1)
-                .toValue(0.3)
-                .cycleCount(2)
-                .autoReverse(true)
-                .build();
-        TranslateTransition translateTransition =
-                TranslateTransitionBuilder.create()
-                .duration(Duration.seconds(2))
-                .fromX(50)
-                .toX(220)
-                .cycleCount(2)
-                .autoReverse(true)
-                .build();       
-        RotateTransition rotateTransition = 
-                RotateTransitionBuilder.create()
-                .duration(Duration.seconds(2))
-                .byAngle(180)
-                .cycleCount(4)
-                .autoReverse(true)
-                .build();
-        ScaleTransition scaleTransition =
-                ScaleTransitionBuilder.create()
-                .duration(Duration.seconds(2))
-                .toX(2)
-                .toY(2)
-                .cycleCount(2)
-                .autoReverse(true)
-                .build();
+        FadeTransition fadeTransition = new FadeTransition(Duration.seconds(1));
+        fadeTransition.setFromValue(1);
+        fadeTransition.setToValue(0.3);
+        fadeTransition.setCycleCount(2);
+        fadeTransition.setAutoReverse(true);
+        
+        TranslateTransition translateTransition = new TranslateTransition(Duration.seconds(2));
+        translateTransition.setFromX(50);
+        translateTransition.setToX(220);
+        translateTransition.setCycleCount(2);
+        translateTransition.setAutoReverse(true);
+        
+        RotateTransition rotateTransition = new RotateTransition(Duration.seconds(2));
+        rotateTransition.setByAngle(180);
+        rotateTransition.setCycleCount(4);
+        rotateTransition.setAutoReverse(true);
+               
+        ScaleTransition scaleTransition = new ScaleTransition(Duration.seconds(2));
+        scaleTransition.setToX(2);
+        scaleTransition.setToY(2);
+        scaleTransition.setCycleCount(2);
+        scaleTransition.setAutoReverse(true);
         // create sequential transition to do 4 transitions one after another       
-        sequentialTransition = SequentialTransitionBuilder.create()
-                .node(rect)
-                .children(fadeTransition, translateTransition, rotateTransition,
-                           scaleTransition)
-                .cycleCount(Timeline.INDEFINITE)
-                .autoReverse(true)
-                .build();
+        sequentialTransition = new SequentialTransition(rect, 
+                fadeTransition, translateTransition, rotateTransition, scaleTransition);
+        sequentialTransition.setCycleCount(Timeline.INDEFINITE);
+        sequentialTransition.setAutoReverse(true);
+        
         return root;
     }
 
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/charts/area/stacked/StackedAreaChartApp.java	Wed Oct 02 15:04:32 2013 -0700
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/charts/area/stacked/StackedAreaChartApp.java	Wed Oct 02 15:31:11 2013 -0700
@@ -39,7 +39,6 @@
 import javafx.scene.Scene;
 import javafx.scene.chart.StackedAreaChart;
 import javafx.scene.chart.NumberAxis;
-import javafx.scene.chart.NumberAxisBuilder;
 import javafx.stage.Stage;
 
 
@@ -115,16 +114,8 @@
     private NumberAxis yAxis;
 
     public Parent createContent() {
-        xAxis = NumberAxisBuilder.create()
-                .label("X Values")
-                .lowerBound(1.0d)
-                .upperBound(9.0d)
-                .tickUnit(2.0d).build();
-        yAxis = NumberAxisBuilder.create()
-                .label("Y Values")
-                .lowerBound(0.0d)
-                .upperBound(30.0d)
-                .tickUnit(2.0d).build();
+        xAxis = new NumberAxis("X Values", 1.0d, 9.0d, 2.0d);
+        yAxis = new NumberAxis("Y Values", 0.0d, 30.0d, 2.0d);
                 
         ObservableList<StackedAreaChart.Series> areaChartData = FXCollections.observableArrayList(
                 new StackedAreaChart.Series("Series 1",FXCollections.observableArrayList(
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/charts/bar/stacked/StackedBarChartApp.java	Wed Oct 02 15:04:32 2013 -0700
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/charts/bar/stacked/StackedBarChartApp.java	Wed Oct 02 15:31:11 2013 -0700
@@ -38,9 +38,7 @@
 import javafx.scene.Parent;
 import javafx.scene.Scene;
 import javafx.scene.chart.CategoryAxis;
-import javafx.scene.chart.CategoryAxisBuilder;
 import javafx.scene.chart.NumberAxis;
-import javafx.scene.chart.NumberAxisBuilder;
 import javafx.scene.chart.StackedBarChart;
 import javafx.stage.Stage;
 
@@ -114,14 +112,9 @@
 
     public Parent createContent() {
         String[] years = {"2007", "2008", "2009"};
-        xAxis = CategoryAxisBuilder.create()
-                .categories(observableArrayList(years))
-                .build();
-        yAxis = NumberAxisBuilder.create()
-                .label("Units Sold")
-                .lowerBound(0.0d)
-                .upperBound(10000.0d)
-                .tickUnit(1000.0d).build();
+        xAxis = new CategoryAxis(observableArrayList(years));
+        yAxis = new NumberAxis("Units Sold", 0.0d, 10000.0d, 1000.0d);
+        
         ObservableList<StackedBarChart.Series> barChartData = 
                 observableArrayList(
                     new StackedBarChart.Series("Region 1", 
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/controls/colorpicker/ColorPickerApp.java	Wed Oct 02 15:04:32 2013 -0700
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/controls/colorpicker/ColorPickerApp.java	Wed Oct 02 15:31:11 2013 -0700
@@ -41,7 +41,6 @@
 import javafx.scene.control.ColorPicker;
 import javafx.scene.control.Label;
 import javafx.scene.layout.VBox;
-import javafx.scene.layout.VBoxBuilder;
 import javafx.scene.paint.Color;
 import javafx.scene.text.Font;
 import javafx.stage.Stage;
@@ -73,13 +72,11 @@
             }
         });
 
-        VBox outerVBox = VBoxBuilder.create()
-                .alignment(Pos.CENTER)
-                .spacing(20)
-                .maxWidth(VBox.USE_PREF_SIZE)
-                .maxHeight(VBox.USE_PREF_SIZE)
-                .children(coloredText, coloredButton, colorPicker)
-                .build();
+        VBox outerVBox = new VBox(coloredText, coloredButton, colorPicker);
+        outerVBox.setAlignment(Pos.CENTER);
+        outerVBox.setSpacing(20);
+        outerVBox.setMaxSize(VBox.USE_PREF_SIZE, VBox.USE_PREF_SIZE);
+        
         return outerVBox;
     }
 
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/controls/pagination/PaginationApp.java	Wed Oct 02 15:04:32 2013 -0700
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/controls/pagination/PaginationApp.java	Wed Oct 02 15:31:11 2013 -0700
@@ -39,10 +39,8 @@
 import javafx.scene.Parent;
 import javafx.scene.Scene;
 import javafx.scene.control.Button;
-import javafx.scene.control.ButtonBuilder;
 import javafx.scene.control.Label;
 import javafx.scene.control.Pagination;
-import javafx.scene.control.PaginationBuilder;
 import javafx.scene.image.Image;
 import javafx.scene.image.ImageView;
 import javafx.scene.layout.VBox;
@@ -73,21 +71,25 @@
         images[5] = new Image(PaginationApp.class.getResource("/ensemble/samples/shared-resources/Animal6.jpg").toExternalForm(), false);
         images[6] = new Image(PaginationApp.class.getResource("/ensemble/samples/shared-resources/Animal7.jpg").toExternalForm(), false);
 
-        pagination = PaginationBuilder.create().pageCount(7).pageFactory(new Callback<Integer, Node>() {
-            @Override public Node call(Integer pageIndex) {
+        pagination = new Pagination(7);
+        pagination.setPageFactory(new Callback<Integer, Node>() {
+            @Override
+            public Node call(Integer pageIndex) {
                 return createAnimalPage(pageIndex);
             }
-        }).build();
+        });
         //Style can be numeric page indicators or bullet indicators
-        Button styleButton = ButtonBuilder.create().text("Toggle pagination style").onAction(new EventHandler<ActionEvent>() {
-            @Override public void handle(ActionEvent me) {
+        Button styleButton = new Button("Toggle pagination style");
+        styleButton.setOnAction(new EventHandler<ActionEvent>() {
+            @Override
+            public void handle(ActionEvent me) {
                 if (!pagination.getStyleClass().contains(Pagination.STYLE_CLASS_BULLET)) {
                     pagination.getStyleClass().add(Pagination.STYLE_CLASS_BULLET);
                 } else {
                     pagination.getStyleClass().remove(Pagination.STYLE_CLASS_BULLET);
                 }
             }
-        }).build();
+        });
 
         outerBox.getChildren().addAll(pagination, styleButton);
         return outerBox;
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/controls/splitpane/hiddensplitpane/HiddenSplitPaneApp.java	Wed Oct 02 15:04:32 2013 -0700
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/controls/splitpane/hiddensplitpane/HiddenSplitPaneApp.java	Wed Oct 02 15:31:11 2013 -0700
@@ -35,8 +35,7 @@
 import javafx.scene.Parent;
 import javafx.scene.Scene;
 import javafx.scene.control.SplitPane;
-import javafx.scene.control.SplitPaneBuilder;
-import javafx.scene.layout.RegionBuilder;
+import javafx.scene.layout.Region;
 import javafx.stage.Stage;
 
 /**
@@ -50,10 +49,17 @@
 
     public Parent createContent() {
         String hidingSplitPaneCss = HiddenSplitPaneApp.class.getResource("HiddenSplitPane.css").toExternalForm();
-        final SplitPane splitPane = SplitPaneBuilder.create().id("hiddenSplitter").items(
-                RegionBuilder.create().styleClass("rounded").build(),
-                RegionBuilder.create().styleClass("rounded").build(),
-                RegionBuilder.create().styleClass("rounded").build()).dividerPositions(new double[]{0.33, 0.66}).build();
+
+        final SplitPane splitPane = new SplitPane();
+        splitPane.setId("hiddenSplitter");
+        Region region1 = new Region();
+        region1.getStyleClass().add("rounded");
+        Region region2 = new Region();
+        region2.getStyleClass().add("rounded");
+        Region region3 = new Region();
+        region3.getStyleClass().add("rounded");
+        splitPane.getItems().addAll(region1, region2, region3);
+        splitPane.setDividerPositions(0.33, 0.66);
         splitPane.getStylesheets().add(hidingSplitPaneCss);
 
         return splitPane;
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/controls/tab/tabpane/TabPaneApp.java	Wed Oct 02 15:04:32 2013 -0700
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/controls/tab/tabpane/TabPaneApp.java	Wed Oct 02 15:31:11 2013 -0700
@@ -42,7 +42,6 @@
 import javafx.scene.control.Label;
 import javafx.scene.control.RadioButton;
 import javafx.scene.control.Tab;
-import javafx.scene.control.TabBuilder;
 import javafx.scene.control.TabPane;
 import javafx.scene.control.ToggleGroup;
 import javafx.scene.control.Tooltip;
@@ -60,7 +59,6 @@
  * @preview preview.png
  * @see javafx.scene.control.Tab
  * @see javafx.scene.control.TabPane
- * @see javafx.scene.control.TabBuilder
  */
 public class TabPaneApp extends Application {
 
@@ -238,9 +236,10 @@
         });
         // Add tab and switch to it
         final Button newTabButton = new Button("Switch to New Tab");
-        newTabButton.setOnAction(new EventHandler<ActionEvent>() {           
+        newTabButton.setOnAction(new EventHandler<ActionEvent>() {
             @Override public void handle(ActionEvent e) {
-                Tab t = TabBuilder.create().text("Testing").content(new Button("Howdy")).build();
+                Tab t = new Tab("Testing");
+                t.setContent(new Button("Howdy"));
                 tabPane.getTabs().add(t);
                 tabPane.getSelectionModel().select(t);
             }
@@ -248,9 +247,10 @@
         vbox.getChildren().add(newTabButton);
         // Add tab
         final Button addTabButton = new Button("Add Tab");
-        addTabButton.setOnAction(new EventHandler<ActionEvent>() {           
+        addTabButton.setOnAction(new EventHandler<ActionEvent>() {
             @Override public void handle(ActionEvent e) {
-                Tab t = TabBuilder.create().text("New Tab").content(new Region()).build();
+                Tab t = new Tab("New Tab");
+                t.setContent(new Region());
                 tabPane.getTabs().add(t);
             }
         });