functional/ControlsTests/src/javafx/scene/control/test/datepicker/DatePickerApp.java

Print this page




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package javafx.scene.control.test.datepicker;
  26 
  27 import java.time.DayOfWeek;
  28 import java.time.LocalDate;
  29 import java.time.Month;
  30 import java.time.chrono.Chronology;
  31 import java.time.format.DateTimeFormatter;
  32 import java.util.Arrays;
  33 import javafx.beans.property.ObjectProperty;
  34 import javafx.event.ActionEvent;
  35 import javafx.event.EventHandler;
  36 import javafx.geometry.Insets;
  37 import javafx.geometry.Pos;
  38 import javafx.scene.Scene;
  39 import javafx.scene.control.Button;
  40 import javafx.scene.control.ButtonBuilder;
  41 import javafx.scene.control.DateCell;
  42 import javafx.scene.control.DatePicker;
  43 import javafx.scene.control.test.utils.CommonPropertiesScene;
  44 import javafx.scene.control.test.utils.ptables.PropertiesTable;
  45 import javafx.scene.control.test.utils.ptables.PropertyTablesFactory;
  46 import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider;
  47 import javafx.scene.layout.HBox;
  48 import javafx.scene.layout.Pane;
  49 import javafx.scene.layout.VBox;
  50 import javafx.util.Callback;
  51 import javafx.util.StringConverter;
  52 import test.javaclient.shared.InteroperabilityApp;
  53 import test.javaclient.shared.Utils;
  54 
  55 /**
  56  * @author Alexander Kirov
  57  */
  58 public class DatePickerApp extends InteroperabilityApp {
  59 
  60     public final static String TESTED_DATEPICKER_ID = "TESTED_DATEPICKER_ID";


 109                     Arrays.asList(new StringConverter[]{null, new LocalDateConverter(testedDatePicker)}), testedDatePicker);
 110 
 111             PropertyTablesFactory.explorePropertiesList(testedDatePicker, propertiesTable);
 112             SpecialTablePropertiesProvider.provideForControl(testedDatePicker, propertiesTable);
 113 
 114 //            propertiesTable.addObjectEnumPropertyLine(testedDatePicker.chronologyProperty(), Arrays.asList(
 115 //                    Chronology.of("ISO"), Chronology.of("Minguo"), Chronology.of("ThaiBuddhist"), Chronology.of("Japanese"), Chronology.of("Hijrah-umalqura")));
 116 
 117             pane.setMinSize(240, 240);
 118             pane.setPrefSize(240, 240);
 119             pane.setStyle("-fx-border-color : red;");
 120             pane.getChildren().add(testedDatePicker);
 121 
 122             VBox vb = new VBox();
 123             vb.setSpacing(5);
 124 
 125             HBox hb = (HBox) getRoot();
 126             hb.setPadding(new Insets(5, 5, 5, 5));
 127             hb.setStyle("-fx-border-color : green;");
 128 
 129             Button hardResetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Hard reset").build();

 130             hardResetButton.setOnAction(new EventHandler<ActionEvent>() {
 131                 public void handle(ActionEvent t) {
 132                     HBox hb = (HBox) getRoot();
 133                     hb.getChildren().clear();
 134                     prepareMainSceneStructure();
 135                     prepareScene();
 136                 }
 137             });
 138 
 139             Button softResetButton = ButtonBuilder.create().id(SOFT_RESET_BUTTON_ID).text("Soft reset").build();

 140             softResetButton.setOnAction(new EventHandler<ActionEvent>() {
 141                 public void handle(ActionEvent t) {
 142                     propertiesTable.refresh();
 143                     DatePicker newOne = new DatePicker();
 144                     testedDatePicker.setValue(newOne.getValue());
 145                     testedDatePicker.setConverter(newOne.getConverter());
 146                     testedDatePicker.setDayCellFactory(newOne.getDayCellFactory());
 147                     testedDatePicker.setShowWeekNumbers(newOne.isShowWeekNumbers());
 148                 }
 149             });
 150 
 151             HBox resetButtonsHBox = new HBox();
 152             resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton);
 153             resetButtonsHBox.setAlignment(Pos.CENTER);
 154 
 155             VBox vb1 = new VBox(5);
 156             vb1.getChildren().addAll(resetButtonsHBox);
 157 
 158             setTestedControl(testedDatePicker);
 159             setControllersContent(vb1);




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package javafx.scene.control.test.datepicker;
  26 
  27 import java.time.DayOfWeek;
  28 import java.time.LocalDate;
  29 import java.time.Month;
  30 import java.time.chrono.Chronology;
  31 import java.time.format.DateTimeFormatter;
  32 import java.util.Arrays;
  33 import javafx.beans.property.ObjectProperty;
  34 import javafx.event.ActionEvent;
  35 import javafx.event.EventHandler;
  36 import javafx.geometry.Insets;
  37 import javafx.geometry.Pos;
  38 import javafx.scene.Scene;
  39 import javafx.scene.control.Button;

  40 import javafx.scene.control.DateCell;
  41 import javafx.scene.control.DatePicker;
  42 import javafx.scene.control.test.utils.CommonPropertiesScene;
  43 import javafx.scene.control.test.utils.ptables.PropertiesTable;
  44 import javafx.scene.control.test.utils.ptables.PropertyTablesFactory;
  45 import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider;
  46 import javafx.scene.layout.HBox;
  47 import javafx.scene.layout.Pane;
  48 import javafx.scene.layout.VBox;
  49 import javafx.util.Callback;
  50 import javafx.util.StringConverter;
  51 import test.javaclient.shared.InteroperabilityApp;
  52 import test.javaclient.shared.Utils;
  53 
  54 /**
  55  * @author Alexander Kirov
  56  */
  57 public class DatePickerApp extends InteroperabilityApp {
  58 
  59     public final static String TESTED_DATEPICKER_ID = "TESTED_DATEPICKER_ID";


 108                     Arrays.asList(new StringConverter[]{null, new LocalDateConverter(testedDatePicker)}), testedDatePicker);
 109             
 110             PropertyTablesFactory.explorePropertiesList(testedDatePicker, propertiesTable);
 111             SpecialTablePropertiesProvider.provideForControl(testedDatePicker, propertiesTable);
 112 
 113 //            propertiesTable.addObjectEnumPropertyLine(testedDatePicker.chronologyProperty(), Arrays.asList(
 114 //                    Chronology.of("ISO"), Chronology.of("Minguo"), Chronology.of("ThaiBuddhist"), Chronology.of("Japanese"), Chronology.of("Hijrah-umalqura")));
 115             
 116             pane.setMinSize(240, 240);
 117             pane.setPrefSize(240, 240);
 118             pane.setStyle("-fx-border-color : red;");
 119             pane.getChildren().add(testedDatePicker);
 120 
 121             VBox vb = new VBox();
 122             vb.setSpacing(5);
 123 
 124             HBox hb = (HBox) getRoot();
 125             hb.setPadding(new Insets(5, 5, 5, 5));
 126             hb.setStyle("-fx-border-color : green;");
 127 
 128             Button hardResetButton = new Button("Hard reset");

 129             hardResetButton.setId(HARD_RESET_BUTTON_ID);

 130             hardResetButton.setOnAction(new EventHandler<ActionEvent>() {
 131                 public void handle(ActionEvent t) {
 132                     HBox hb = (HBox) getRoot();
 133                     hb.getChildren().clear();
 134                     prepareMainSceneStructure();
 135                     prepareScene();
 136                 }
 137             });
 138 
 139             Button softResetButton = new Button("Soft reset");

 140             softResetButton.setId(SOFT_RESET_BUTTON_ID);

 141             softResetButton.setOnAction(new EventHandler<ActionEvent>() {
 142                 public void handle(ActionEvent t) {
 143                     propertiesTable.refresh();
 144                     DatePicker newOne = new DatePicker();
 145                     testedDatePicker.setValue(newOne.getValue());
 146                     testedDatePicker.setConverter(newOne.getConverter());
 147                     testedDatePicker.setDayCellFactory(newOne.getDayCellFactory());
 148                     testedDatePicker.setShowWeekNumbers(newOne.isShowWeekNumbers());
 149                 }
 150             });
 151 
 152             HBox resetButtonsHBox = new HBox();
 153             resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton);
 154             resetButtonsHBox.setAlignment(Pos.CENTER);
 155 
 156             VBox vb1 = new VBox(5);
 157             vb1.getChildren().addAll(resetButtonsHBox);
 158 
 159             setTestedControl(testedDatePicker);
 160             setControllersContent(vb1);