Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2016-03-31 09:20:52 -0400
committerTom Schindl2016-03-31 09:20:52 -0400
commit3f50fc7aeb48a192acda56dea32263101592c86d (patch)
tree2788bb7fde601c13ce311481a51891782a5ddeff
parentc6bea67daef430bfe413fcd801bc8ae0c992ed2a (diff)
downloadorg.eclipse.efxclipse-3f50fc7aeb48a192acda56dea32263101592c86d.tar.gz
org.eclipse.efxclipse-3f50fc7aeb48a192acda56dea32263101592c86d.tar.xz
org.eclipse.efxclipse-3f50fc7aeb48a192acda56dea32263101592c86d.zip
Bug 490787 - Add validation and decoration support
-rw-r--r--demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/dialogs/sample/HeavyWeightDialogSample.java76
-rw-r--r--demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/dialogs/sample/LwDialogSample.java84
2 files changed, 160 insertions, 0 deletions
diff --git a/demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/dialogs/sample/HeavyWeightDialogSample.java b/demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/dialogs/sample/HeavyWeightDialogSample.java
new file mode 100644
index 000000000..66fb50335
--- /dev/null
+++ b/demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/dialogs/sample/HeavyWeightDialogSample.java
@@ -0,0 +1,76 @@
+package org.eclipse.fx.ui.dialogs.sample;
+
+import org.eclipse.fx.core.Subscription;
+import org.eclipse.fx.ui.dialogs.TitleAreaDialog;
+
+import javafx.application.Application;
+import javafx.scene.Node;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.layout.HBox;
+import javafx.stage.Stage;
+import javafx.stage.Window;
+
+public class HeavyWeightDialogSample extends Application {
+ public static void main(String[] args) {
+ launch(args);
+ }
+ @Override
+ public void start(Stage primaryStage) throws Exception {
+ HBox container = new HBox();
+
+ {
+ Button b = new Button("Show TitleArea Dialog");
+ b.setOnAction(e -> new SampleHeavyTitleAreaDialog(primaryStage).open());
+ container.getChildren().add(b);
+ }
+
+ primaryStage.setScene(new Scene(container, 800, 600));
+ primaryStage.show();
+ }
+
+ static class SampleHeavyTitleAreaDialog extends TitleAreaDialog {
+ private Subscription currentTempMessage;
+
+ public SampleHeavyTitleAreaDialog(Window parent) {
+ super(parent, "Sample Dialog", "Sample Dialog", "This is a sample dialog", "sample-title-icon");
+ }
+
+ @Override
+ protected Node createDialogContent() {
+ HBox box = new HBox();
+
+ {
+ Button b = new Button("Error");
+ b.setOnAction(e -> currentTempMessage = showTemporaryErrorMessage("This is an error message"));
+ box.getChildren().add(b);
+ }
+
+ {
+ Button b = new Button("Warning");
+ b.setOnAction(e -> currentTempMessage = showTemporaryWarningMessage("This is an warning message"));
+ box.getChildren().add(b);
+ }
+
+ {
+ Button b = new Button("Info");
+ b.setOnAction(e -> currentTempMessage = showTemporaryInfoMessage("This is an info message"));
+ box.getChildren().add(b);
+ }
+
+ {
+ Button b = new Button("Reset");
+ b.setOnAction(e -> {
+ if (currentTempMessage != null) {
+ currentTempMessage.dispose();
+ currentTempMessage = null;
+ }
+ });
+ box.getChildren().add(b);
+ }
+
+ return box;
+ }
+
+ }
+}
diff --git a/demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/dialogs/sample/LwDialogSample.java b/demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/dialogs/sample/LwDialogSample.java
new file mode 100644
index 000000000..c8f78c55c
--- /dev/null
+++ b/demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/dialogs/sample/LwDialogSample.java
@@ -0,0 +1,84 @@
+package org.eclipse.fx.ui.dialogs.sample;
+
+import org.eclipse.fx.core.Subscription;
+import org.eclipse.fx.ui.controls.stage.FrameEvent;
+
+import javafx.application.Application;
+import javafx.scene.Node;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.StackPane;
+import javafx.stage.Stage;
+
+public class LwDialogSample extends Application {
+ public static void main(String[] args) {
+ launch(args);
+ }
+
+ @Override
+ public void start(Stage primaryStage) throws Exception {
+ StackPane pane = new StackPane();
+ HBox container = new HBox();
+
+ {
+ Button b = new Button("LW Dialog");
+ b.setOnAction(e -> {
+ SampleLWTitleAreaDialog d = new SampleLWTitleAreaDialog();
+ d.addEventHandler(FrameEvent.CLOSED, ev -> {
+ pane.getChildren().remove(d);
+ });
+ pane.getChildren().add(d);
+ });
+ container.getChildren().add(b);
+ }
+
+ pane.getChildren().add(container);
+ primaryStage.setScene(new Scene(pane,800,600));
+ primaryStage.show();
+ }
+
+ static class SampleLWTitleAreaDialog extends org.eclipse.fx.ui.controls.dialog.TitleAreaDialog {
+ private Subscription currentTempMessage;
+ public SampleLWTitleAreaDialog() {
+ super("Sample Dialog", "Sample Dialog", "This is a sample dialog");
+ setPrefSize(500, 300);
+ setClientArea(createClientArea());
+ addDefaultButtons();
+ }
+
+ private Node createClientArea() {
+ HBox box = new HBox();
+
+ {
+ Button b = new Button("Error");
+ b.setOnAction(e -> currentTempMessage = showTemporaryErrorMessage("This is an error message"));
+ box.getChildren().add(b);
+ }
+
+ {
+ Button b = new Button("Warning");
+ b.setOnAction(e -> currentTempMessage = showTemporaryWarningMessage("This is an warning message"));
+ box.getChildren().add(b);
+ }
+
+ {
+ Button b = new Button("Info");
+ b.setOnAction(e -> currentTempMessage = showTemporaryInfoMessage("This is an info message"));
+ box.getChildren().add(b);
+ }
+
+ {
+ Button b = new Button("Reset");
+ b.setOnAction(e -> {
+ if (currentTempMessage != null) {
+ currentTempMessage.dispose();
+ currentTempMessage = null;
+ }
+ });
+ box.getChildren().add(b);
+ }
+ return box;
+ }
+ }
+}

Back to the top