22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25 package javafx.commons;
26
27 import javafx.beans.value.ChangeListener;
28 import javafx.beans.value.ObservableValue;
29 import javafx.factory.ControlsFactory;
30 import javafx.factory.NodeFactory;
31 import javafx.factory.Panes;
32 import javafx.factory.Shapes;
33 import javafx.geometry.Pos;
34 import javafx.scene.Node;
35 import javafx.scene.Parent;
36 import javafx.scene.Scene;
37 import javafx.scene.control.ChoiceBox;
38 import javafx.scene.control.Label;
39 import javafx.scene.control.test.utils.ptables.PropertiesTable;
40 import javafx.scene.layout.HBox;
41 import javafx.scene.layout.Pane;
42 import javafx.scene.layout.PaneBuilder;
43 import javafx.scene.layout.VBox;
44 import javafx.scene.layout.VBoxBuilder;
45 import test.javaclient.shared.InteroperabilityApp;
46 import test.javaclient.shared.Utils;
47
48 /**
49 *
50 * @author Dmitry Zinkevich <dmitry.zinkevich@oracle.com>
51 */
52 public class ControlChooserApp extends InteroperabilityApp {
53 public static final String NODE_CHOOSER_ID = "nodeChooser";
54 public static final String TESTED_CONTROL_ID = "target";
55
56 private VBox spaceForNode;
57 private PropertiesTable propertiesTable;
58 private Pane propertiesPane = PaneBuilder.create()
59 .style("-fx-border-color:BLUE")
60 .build();
61
62 public static void main(String[] args) {
63 Utils.launch(javafx.commons.ControlChooserApp.class, args);
64 }
65
66 @Override
67 protected Scene getScene() {
68 Scene scene = new Scene(getContent(), 800, 600);
69 Utils.addBrowser(scene);
70 return scene;
71 }
72
73 private Node createNodeChooser() {
74 ChoiceBox<NodeFactory> cb = new ChoiceBox<NodeFactory>();
75 cb.setId(NODE_CHOOSER_ID);
76 cb.getItems().addAll(ControlsFactory.filteredValues());
77 /*
78 * Remove image view and media view
79 */
80 cb.getItems().removeAll(ControlsFactory.ImageView, ControlsFactory.MediaView);
89 node.setId(TESTED_CONTROL_ID);
90 spaceForNode.getChildren().clear();
91 spaceForNode.getChildren().add(node);
92
93 propertiesTable = new PropertiesTable(node);
94 propertiesTable.addBooleanPropertyLine(node.disableProperty());
95 propertiesTable.addDoublePropertyLine(node.opacityProperty(), 0, 1, 1);
96 propertiesTable.addSimpleListener(node.focusedProperty(), node);
97
98 propertiesPane.getChildren().clear();
99 propertiesPane.getChildren().add(propertiesTable);
100 }
101 });
102
103 VBox vb = new VBox(5);
104 vb.getChildren().addAll(new Label("Choose tested control : "), cb);
105 return vb;
106 }
107
108 private Parent getContent() {
109 spaceForNode = new VBox(10);
110 spaceForNode.setAlignment(Pos.CENTER);
111 spaceForNode.setMinWidth(300);
112 spaceForNode.setPrefWidth(300);
113 spaceForNode.setMaxWidth(300);
114 spaceForNode.setMinHeight(300);
115 spaceForNode.setPrefHeight(300);
116 spaceForNode.setMaxHeight(300);
117 spaceForNode.setStyle("-fx-border-color:RED");
118
119 VBox controls = new VBox(10);
120 controls.setAlignment(Pos.CENTER);
121 controls.getChildren().add(createNodeChooser());
122 controls.setStyle("-fx-border-color:GREEN");
123
124 VBox vBox = VBoxBuilder.create()
125 .children(spaceForNode, controls)
126 .spacing(10d)
127 .build();
128
129 HBox hBox = new HBox(10);
130 hBox.setAlignment(Pos.TOP_LEFT);
131 hBox.getChildren().addAll(
132 vBox,
133 propertiesPane);
134 return hBox;
135 }
136 }
|
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25 package javafx.commons;
26
27 import javafx.beans.value.ChangeListener;
28 import javafx.beans.value.ObservableValue;
29 import javafx.factory.ControlsFactory;
30 import javafx.factory.NodeFactory;
31 import javafx.factory.Panes;
32 import javafx.factory.Shapes;
33 import javafx.geometry.Pos;
34 import javafx.scene.Node;
35 import javafx.scene.Parent;
36 import javafx.scene.Scene;
37 import javafx.scene.control.ChoiceBox;
38 import javafx.scene.control.Label;
39 import javafx.scene.control.test.utils.ptables.PropertiesTable;
40 import javafx.scene.layout.HBox;
41 import javafx.scene.layout.Pane;
42 import javafx.scene.layout.VBox;
43 import test.javaclient.shared.InteroperabilityApp;
44 import test.javaclient.shared.Utils;
45
46 /**
47 *
48 * @author Dmitry Zinkevich <dmitry.zinkevich@oracle.com>
49 */
50 public class ControlChooserApp extends InteroperabilityApp {
51 public static final String NODE_CHOOSER_ID = "nodeChooser";
52 public static final String TESTED_CONTROL_ID = "target";
53
54 private VBox spaceForNode;
55 private PropertiesTable propertiesTable;
56 private Pane propertiesPane;
57
58 public static void main(String[] args) {
59 Utils.launch(javafx.commons.ControlChooserApp.class, args);
60 }
61
62 @Override
63 protected Scene getScene() {
64 Scene scene = new Scene(getContent(), 800, 600);
65 Utils.addBrowser(scene);
66 return scene;
67 }
68
69 private Node createNodeChooser() {
70 ChoiceBox<NodeFactory> cb = new ChoiceBox<NodeFactory>();
71 cb.setId(NODE_CHOOSER_ID);
72 cb.getItems().addAll(ControlsFactory.filteredValues());
73 /*
74 * Remove image view and media view
75 */
76 cb.getItems().removeAll(ControlsFactory.ImageView, ControlsFactory.MediaView);
85 node.setId(TESTED_CONTROL_ID);
86 spaceForNode.getChildren().clear();
87 spaceForNode.getChildren().add(node);
88
89 propertiesTable = new PropertiesTable(node);
90 propertiesTable.addBooleanPropertyLine(node.disableProperty());
91 propertiesTable.addDoublePropertyLine(node.opacityProperty(), 0, 1, 1);
92 propertiesTable.addSimpleListener(node.focusedProperty(), node);
93
94 propertiesPane.getChildren().clear();
95 propertiesPane.getChildren().add(propertiesTable);
96 }
97 });
98
99 VBox vb = new VBox(5);
100 vb.getChildren().addAll(new Label("Choose tested control : "), cb);
101 return vb;
102 }
103
104 private Parent getContent() {
105 propertiesPane = new Pane();
106 propertiesPane.setStyle("-fx-border-color:BLUE");
107
108 spaceForNode = new VBox(10);
109 spaceForNode.setAlignment(Pos.CENTER);
110 spaceForNode.setMinWidth(300);
111 spaceForNode.setPrefWidth(300);
112 spaceForNode.setMaxWidth(300);
113 spaceForNode.setMinHeight(300);
114 spaceForNode.setPrefHeight(300);
115 spaceForNode.setMaxHeight(300);
116 spaceForNode.setStyle("-fx-border-color:RED");
117
118 VBox controls = new VBox(10);
119 controls.setAlignment(Pos.CENTER);
120 controls.getChildren().add(createNodeChooser());
121 controls.setStyle("-fx-border-color:GREEN");
122
123 VBox vBox = new VBox(spaceForNode, controls);
124 vBox.setSpacing(10d);
125 HBox hBox = new HBox(10);
126 hBox.setAlignment(Pos.TOP_LEFT);
127 hBox.getChildren().addAll(
128 vBox,
129 propertiesPane);
130 return hBox;
131 }
132 }
|