functional/ControlsTests/src/javafx/scene/control/test/splitpane/SplitPaneApp.java

Print this page




  59     protected Scene getScene() {
  60         Utils.setTitleToStage(stage, "SplitPaneTestApp");
  61         return new SplitPaneApp.SplitPaneScene();
  62     }
  63 
  64     class SplitPaneScene extends Scene {
  65 
  66         //VBox which contain tested split pane.
  67         Pane pane;
  68         //Splipane to be tested.
  69         SplitPane testedSplitPane;
  70 
  71         public SplitPaneScene() {
  72             super(new HBox(), 800, 600);
  73 
  74             prepareScene();
  75         }
  76 
  77         private void prepareScene() {
  78             pane = new Pane();
  79             testedSplitPane = SplitPaneBuilder.create().id(TESTED_SPLIPANE_ID).build();

  80 
  81             PropertiesTable tb = new PropertiesTable(testedSplitPane);
  82             PropertyTablesFactory.explorePropertiesList(testedSplitPane, tb);
  83 
  84             final TabPaneWithControl tabPane = new TabPaneWithControl("Accordion", tb);
  85 
  86             final TextField tf = TextFieldBuilder.create().id(SPLITPANE_ADD_INDEX_TEXT_FIELD_ID).text("0").prefWidth(40).build();


  87 
  88             HBox nodeshb = new NodesChoserFactory("Add!", new NodesChoserFactory.NodeAction<Node>() {
  89 
  90                 @Override
  91                 public void execute(Node node) {
  92                     testedSplitPane.getItems().add(Integer.parseInt(tf.getText()), node);
  93                     tabPane.addPropertiesTable(node.getClass().getSimpleName(), NodeControllerFactory.createFullController(node, tabPane));
  94                 }
  95             }, tf);
  96 
  97             pane.setMinSize(220, 220);
  98             pane.setPrefSize(220, 220);
  99             pane.setStyle("-fx-border-color : red;");
 100             pane.getChildren().add(testedSplitPane);
 101 
 102             VBox vb = new VBox();
 103             vb.setSpacing(5);
 104 
 105             HBox hb = (HBox) getRoot();
 106             hb.setPadding(new Insets(5, 5, 5, 5));
 107             hb.setStyle("-fx-border-color : green;");
 108 
 109             Button resetButton = ButtonBuilder.create().id(RESET_BUTTON_ID).text("Reset").build();

 110             resetButton.setOnAction(new EventHandler<ActionEvent>() {
 111 
 112                 public void handle(ActionEvent t) {
 113                     HBox hb = (HBox) getRoot();
 114                     hb.getChildren().clear();
 115                     prepareScene();
 116                 }
 117             });
 118 
 119             vb.getChildren().addAll(new Label("Pane with tested Accordion"), pane, resetButton, nodeshb);
 120 
 121             hb.getChildren().addAll(vb, tabPane);
 122         }
 123     }
 124 }


  59     protected Scene getScene() {
  60         Utils.setTitleToStage(stage, "SplitPaneTestApp");
  61         return new SplitPaneApp.SplitPaneScene();
  62     }
  63 
  64     class SplitPaneScene extends Scene {
  65 
  66         //VBox which contain tested split pane.
  67         Pane pane;
  68         //Splipane to be tested.
  69         SplitPane testedSplitPane;
  70 
  71         public SplitPaneScene() {
  72             super(new HBox(), 800, 600);
  73 
  74             prepareScene();
  75         }
  76 
  77         private void prepareScene() {
  78             pane = new Pane();
  79             testedSplitPane = new SplitPane();

  80             testedSplitPane.setId(TESTED_SPLIPANE_ID);

  81 
  82             PropertiesTable tb = new PropertiesTable(testedSplitPane);
  83             PropertyTablesFactory.explorePropertiesList(testedSplitPane, tb);
  84 
  85             final TabPaneWithControl tabPane = new TabPaneWithControl("Accordion", tb);
  86 
  87             final TextField tf = new TextField("0");

  88             tf.setId(SPLITPANE_ADD_INDEX_TEXT_FIELD_ID);

  89             tf.setPrefWidth(40);

  90 
  91             HBox nodeshb = new NodesChoserFactory("Add!", new NodesChoserFactory.NodeAction<Node>() {
  92 
  93                 @Override
  94                 public void execute(Node node) {                  
  95                     testedSplitPane.getItems().add(Integer.parseInt(tf.getText()), node);
  96                     tabPane.addPropertiesTable(node.getClass().getSimpleName(), NodeControllerFactory.createFullController(node, tabPane));
  97                 }
  98             }, tf);
  99 
 100             pane.setMinSize(220, 220);
 101             pane.setPrefSize(220, 220);
 102             pane.setStyle("-fx-border-color : red;");
 103             pane.getChildren().add(testedSplitPane);
 104 
 105             VBox vb = new VBox();
 106             vb.setSpacing(5);
 107 
 108             HBox hb = (HBox) getRoot();
 109             hb.setPadding(new Insets(5, 5, 5, 5));
 110             hb.setStyle("-fx-border-color : green;");
 111 
 112             Button resetButton = new Button("Reset");

 113             resetButton.setId(RESET_BUTTON_ID);

 114             resetButton.setOnAction(new EventHandler<ActionEvent>() {
 115 
 116                 public void handle(ActionEvent t) {
 117                     HBox hb = (HBox) getRoot();
 118                     hb.getChildren().clear();
 119                     prepareScene();
 120                 }
 121             });
 122 
 123             vb.getChildren().addAll(new Label("Pane with tested Accordion"), pane, resetButton, nodeshb);
 124 
 125             hb.getChildren().addAll(vb, tabPane);
 126         }
 127     }
 128 }