shemnon avatar shemnon committed a92e6d3

update modena examples

Comments (0)

Files changed (2)

samples/Modena/src/main/java/modena/Modena.java

 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.lang.Override;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLConnection;
 import javafx.scene.transform.Scale;
 import javafx.stage.FileChooser;
 import javafx.stage.Stage;
+import javafx.stage.WindowEvent;
+
 import javax.imageio.ImageIO;
 
 public class Modena extends Application {
         }
     }
     
-    private final BorderPane outerRoot = new BorderPane();
+    private BorderPane outerRoot;
     private BorderPane root;
     private SamplePageNavigation samplePageNavigation;
     private SamplePage samplePage;
         // set user agent stylesheet
         updateUserAgentStyleSheet(true);
         // build Menu Bar
+        outerRoot = new BorderPane();
         outerRoot.setTop(buildMenuBar());
         outerRoot.setCenter(root);
         // build UI
 //        stage.setIconified(test); // TODO: Blocked by http://javafx-jira.kenai.com/browse/JMY-203
         stage.show(); // see SamplePage.java:110 comment on how test fails without having stage shown
         instance = this;
+        
+        //threading bugs
+        stage.setOnHiding(new EventHandler<WindowEvent>() {
+            @Override
+            public void handle(WindowEvent windowEvent) {
+                Platform.exit();
+                System.exit(0);
+            }
+        });
     }
     
     private MenuBar buildMenuBar() {

samples/Modena/src/main/java/modena/SamplePage.java

 import javafx.scene.control.ToggleGroup;
 import javafx.scene.control.Tooltip;
 import javafx.scene.control.TooltipBuilder;
-import javafx.scene.control.TreeTableViewBuilder;
+import javafx.scene.control.TreeTableView;
 import javafx.scene.control.TreeViewBuilder;
 import javafx.scene.layout.GridPane;
 import javafx.scene.layout.HBox;
 import javafx.scene.layout.VBox;
 import javafx.scene.layout.VBoxBuilder;
 import javafx.scene.paint.Color;
-import javafx.scene.web.HTMLEditorBuilder;
+import javafx.scene.web.HTMLEditor;
 
 import static modena.SamplePageChartHelper.*;
 import static modena.SamplePageHelpers.*;
 import static modena.SamplePageTableHelper.*;
-import static modena.SamplePageTreeHelper.*;
-import static modena.SamplePageTreeTableHelper.*;
+import static modena.SamplePageTreeHelper.createTreeView;
+import static modena.SamplePageTreeTableHelper.createTreeTableView;
 
 /**
  * Page showing every control in every state.
         choiceBoxLongList.add(100, "Long List");
         newSection(
                 "ChoiceBox:",
-                ChoiceBoxBuilder.create(String.class).items(sampleItems()).value("Item A").build(),
-                ChoiceBoxBuilder.create(String.class).items(choiceBoxLongList).value("Long List").build(),
-                withState(ChoiceBoxBuilder.create(String.class).items(sampleItems()).value("Item B").build(), "hover"),
-                withState(ChoiceBoxBuilder.create(String.class).items(sampleItems()).value("Item B").build(), "showing"),
-                withState(ChoiceBoxBuilder.create(String.class).items(sampleItems()).value("Item B").build(), "focused"),
-                ChoiceBoxBuilder.create(String.class).items(sampleItems()).value("Item C").disable(true).build()
+                ChoiceBoxBuilder.<String>create().items(sampleItems()).value("Item A").build(),
+                ChoiceBoxBuilder.<String>create().items(choiceBoxLongList).value("Long List").build(),
+                withState(ChoiceBoxBuilder.<String>create().items(sampleItems()).value("Item B").build(), "hover"),
+                withState(ChoiceBoxBuilder.<String>create().items(sampleItems()).value("Item B").build(), "showing"),
+                withState(ChoiceBoxBuilder.<String>create().items(sampleItems()).value("Item B").build(), "focused"),
+                ChoiceBoxBuilder.<String>create().items(sampleItems()).value("Item C").disable(true).build()
         );
         newSection(
                 "ComboBox:",
-                ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item A").build(),
-                ComboBoxBuilder.create(String.class).items(choiceBoxLongList).value("Long List").build(),
-                withState(ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item B").build(), "hover"),
-                withState(ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item B").build(), "showing"),
-                withState(ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item B").build(), "focused"),
-                ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item C").disable(true).build()
+                ComboBoxBuilder.<String>create().items(sampleItems()).value("Item A").build(),
+                ComboBoxBuilder.<String>create().items(choiceBoxLongList).value("Long List").build(),
+                withState(ComboBoxBuilder.<String>create().items(sampleItems()).value("Item B").build(), "hover"),
+                withState(ComboBoxBuilder.<String>create().items(sampleItems()).value("Item B").build(), "showing"),
+                withState(ComboBoxBuilder.<String>create().items(sampleItems()).value("Item B").build(), "focused"),
+                ComboBoxBuilder.<String>create().items(sampleItems()).value("Item C").disable(true).build()
                 );
         newSection(
                 "ComboBox\nEditable:",
-                ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item A").editable(true).build(),
-                withState(ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item B").editable(true).build(), "editable", ".arrow-button", "hover"),
-                withState(ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item B").editable(true).build(), "editable", ".arrow-button", "pressed")
+                ComboBoxBuilder.<String>create().items(sampleItems()).value("Item A").editable(true).build(),
+                withState(ComboBoxBuilder.<String>create().items(sampleItems()).value("Item B").editable(true).build(), "editable", ".arrow-button", "hover"),
+                withState(ComboBoxBuilder.<String>create().items(sampleItems()).value("Item B").editable(true).build(), "editable", ".arrow-button", "pressed")
                 );
         newSection(
                 "ComboBox\nEditable\n(More):",
-                withState(ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item B").editable(true).build(), "editable,contains-focus", ".text-field", "focused"),
-                ComboBoxBuilder.create(String.class).items(sampleItems()).value("Item C").editable(true).disable(true).build()
+                withState(ComboBoxBuilder.<String>create().items(sampleItems()).value("Item B").editable(true).build(), "editable,contains-focus", ".text-field", "focused"),
+                ComboBoxBuilder.<String>create().items(sampleItems()).value("Item C").editable(true).disable(true).build()
                 );
         newSection(
                 "Color Picker:",
         );
         newSection(
                 "HTMLEditor:",
-                HTMLEditorBuilder.create().htmlText("Hello <b>Bold</b> Text").prefWidth(650).prefHeight(120).build()
-                );
+                new HTMLEditor() {{
+                    setHtmlText("Hello <b>Bold</b> Text");
+                    setPrefSize(650, 120);
+                }});
         newSection(
                 "HTMLEditor\nFocused:",
-                withState(HTMLEditorBuilder.create().htmlText("<i>Focused</i>").prefWidth(650).prefHeight(120).build(), "focused")
+                withState(new HTMLEditor() {{
+                    setHtmlText("<i>Focused</i>");
+                    setPrefSize(650, 120);
+                }}, "focused")
                 );
         newDetailedSection(
                 new String[] { "ToolBar (H|TOP):", "normal", "overflow", "disabled" },
                 );
         newDetailedSection(
                 new String[] {"Empty:", "ListView", "TableView", "TreeView", "TreeTableView"},
-                ListViewBuilder.create(String.class).prefWidth(150).prefHeight(100).build(),
-                TableViewBuilder.create(Object.class).prefWidth(150).prefHeight(100).build(),
-                TreeViewBuilder.create(Object.class).prefWidth(150).prefHeight(100).build(),
-                TreeTableViewBuilder.create(Object.class).prefWidth(150).prefHeight(100).build()
+                ListViewBuilder.<String>create().prefWidth(150).prefHeight(100).build(),
+                TableViewBuilder.create().prefWidth(150).prefHeight(100).build(),
+                TreeViewBuilder.create().prefWidth(150).prefHeight(100).build(),
+                new TreeTableView() {{
+                    setPrefSize(150, 100);
+                }}
                 );
         newDetailedSection(
                 new String[] {"ToolTip:","inline","inline + graphic", "popup"},
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.