--- old/./build.xml 2016-12-22 11:26:18.192970779 +0300 +++ new/./build.xml 2016-12-22 11:26:18.132970201 +0300 @@ -1,5 +1,5 @@ - + + + @@ -63,9 +63,9 @@ - + --- old/./detect_javafx.xml 2016-12-22 11:26:18.388972669 +0300 +++ new/./detect_javafx.xml 2016-12-22 11:26:18.332972130 +0300 @@ -9,24 +9,21 @@ - + - - - - - - + + + - + - \ No newline at end of file + --- old/functional/ControlsTests/build.xml 2016-12-22 11:26:18.580974522 +0300 +++ new/functional/ControlsTests/build.xml 2016-12-22 11:26:18.524973981 +0300 @@ -1,5 +1,5 @@ - Builds, tests, and runs the project ControlsTests. - + @@ -38,7 +38,7 @@ - + @@ -48,7 +48,7 @@ - + Must set test.subdir with short name of root dir of tests; eg ListView @@ -68,7 +68,7 @@ - + @@ -76,7 +76,7 @@ - + @@ -89,8 +89,8 @@ - - + + --- old/functional/ControlsTests/coverage.fcov 2016-12-22 11:26:18.764976296 +0300 +++ new/functional/ControlsTests/coverage.fcov 2016-12-22 11:26:18.712975795 +0300 @@ -1,96 +1,96 @@ -javafx.scene.control.ScrollPane.prefViewportWidth.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkPrefViewPortWidthOptionTest();FULL -javafx.scene.control.ColorPicker.value.GET;javafx.scene.control.test.colorpicker.ColorPickerTest.colorPropertyTest();FULL -com.sun.javafx.scene.control.Pagination.currentpageindex.DEFAULT;javafx.scene.control.test.pagination.PaginationTest.currentPageIndexPropertyTest();FULL -com.sun.javafx.scene.control.Pagination.pageindicatorcount.GET;javafx.scene.control.test.pagination.PaginationTest.pageIndicatorCountTest();FULL -javafx.scene.control.Button.cancelButton.SET;javafx.scene.control.test.ButtonsTest.cancelButtonTest();FULL -javafx.scene.control.Button.text.GET;javafx.scene.control.test.ButtonsTest.binding();FULL -javafx.scene.control.MenuItem.onHidden.GET;javafx.scene.control.test.MenuTest.apiTest(),javafx.scene.control.test.MenuTest.dropTest();FULL -com.sun.javafx.scene.control.Pagination.pageindicatorcount.BIND;javafx.scene.control.test.pagination.PaginationTest.pageIndicatorCountTest();FULL -javafx.scene.control.Button.defaultButton.BIND;javafx.scene.control.test.ButtonsTest.defaultButtonTest();FULL -javafx.scene.control.ScrollPane.hmin.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkHMinOptionTest();FULL -javafx.scene.control.Button.cancelButton.GET;javafx.scene.control.test.ButtonsTest.cancelButtonTest();FULL -javafx.scene.control.MenuItem.onHidden.SET;javafx.scene.control.test.MenuTest.apiTest(),javafx.scene.control.test.MenuTest.dropTest();FULL -javafx.scene.control.CheckBox.indeterminate.SET;javafx.scene.control.test.ChecksTest.checks();FULL -javafx.scene.control.CheckBox.selected.GET;javafx.scene.control.test.tableview.TableViewApp.getControlsContainer(),javafx.scene.control.test.ChecksTest.checks();FULL -javafx.scene.control.Button.text.SET;javafx.scene.control.test.ButtonsTest.binding();FULL -javafx.scene.control.Tooltip.activated.GET;javafx.scene.control.test.TooltipTest.enabled();FULL -javafx.scene.control.ChoiceBox.showing.BIND;javafx.scene.control.test.choicebox.ChoiceBoxApp.getScene();FULL -javafx.scene.control.SingleSelectionModel.selectedItem.BIND;javafx.scene.control.test.choicebox.ChoiceBoxApp.getScene();FULL -javafx.scene.control.ChoiceBox.showing.GET;javafx.scene.control.test.choicebox.ChoiceBoxApp.getScene();FULL -com.sun.javafx.scene.control.Pagination.currentpageindex.BEHAVIOR;javafx.scene.control.test.pagination.PaginationTest.currentPageIndexPropertyTest();FULL -javafx.scene.control.ColorPicker.value.SET;javafx.scene.control.test.colorpicker.ColorPickerTest.colorPropertyTest();FULL -javafx.scene.control.ColorPicker.value.DEFAULT;javafx.scene.control.test.colorpicker.ColorPickerTest.colorPropertyTest();FULL -javafx.scene.control.CheckBox.indeterminate.GET;javafx.scene.control.test.ChecksTest.checks();FULL -javafx.scene.control.CheckBox.selected.SET;javafx.scene.control.test.tableview.TableViewApp.getControlsContainer(),javafx.scene.control.test.ChecksTest.checks();FULL -javafx.scene.control.MenuItem.onHiding.SET;javafx.scene.control.test.MenuTest.apiTest(),javafx.scene.control.test.MenuTest.dropTest();FULL -javafx.scene.control.ScrollPane.vbarPolicy.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkHVBarPolicyOptionTest();FULL -javafx.scene.control.ScrollPane.fitToWidth.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkFitToWidthAndHeightOptionTest();FULL -javafx.scene.control.Tooltip.activated.SET;javafx.scene.control.test.TooltipTest.enabled();FULL -javafx.scene.control.ScrollPane.pannable.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkPannableOptionTest();FULL -com.sun.javafx.scene.control.Pagination.pagecount.DEFAULT;javafx.scene.control.test.pagination.PaginationTest.pageCountPropertyTest();FULL -javafx.scene.control.CheckMenuItem.selected.SET;javafx.scene.control.test.tableview.TableViewApp.createColumn();FULL -javafx.scene.control.ScrollPane.vmin.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkVMinOptionTest();FULL -javafx.scene.control.SingleSelectionModel.selectedItem.GET;javafx.scene.control.test.choicebox.ChoiceBoxApp.getScene();FULL -com.sun.javafx.scene.control.Pagination.currentpageindex.BIND;javafx.scene.control.test.pagination.PaginationTest.currentPageIndexPropertyTest();FULL -javafx.scene.control.SingleSelectionModel.selectedItem.SET;javafx.scene.control.test.choicebox.ChoiceBoxApp.getScene();FULL -javafx.scene.control.MenuItem.onHiding.GET;javafx.scene.control.test.MenuTest.apiTest(),javafx.scene.control.test.MenuTest.dropTest();FULL -TreeView.onEditStartProperty.SET;javafx.scene.control.test.treeview.TreeViewTest.testOnEditStartCancel();FULL -TreeView.onEditCommitProperty.GET;javafx.scene.control.test.treeview.TreeViewTest.testOnEditOnCancelEventSequence();FULL -com.sun.javafx.scene.control.Pagination.pagefactory.BEHAVIOR;javafx.scene.control.test.pagination.PaginationTest.factoryChangingTest();FULL -com.sun.javafx.scene.control.Pagination.pagecount.BIND;javafx.scene.control.test.pagination.PaginationTest.pageCountPropertyTest();FULL -javafx.scene.control.ScrollPane.prefViewportWidth.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkPrefViewPortWidthOptionTest();FULL -com.sun.javafx.scene.control.Pagination.pagecount.BEHAVIOR;javafx.scene.control.test.pagination.PaginationTest.pageCountPropertyTest();FULL -javafx.scene.control.ScrollPane.prefViewportHeight.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkPrefViewPortHeightOptionTest();FULL -javafx.scene.control.MenuItem.disable.SET;javafx.scene.control.test.MenuItemTest.disableTest();FULL -TreeView.onEditStartProperty.GET;javafx.scene.control.test.treeview.TreeViewTest.testOnEditOnCancelEventSequence();FULL -TreeView.onEditCommitProperty.SET;javafx.scene.control.test.treeview.TreeViewTest.testOnEditCommit();FULL -javafx.scene.control.CheckMenuItem.selected.GET;javafx.scene.control.test.tableview.TableViewApp.createColumn();FULL -javafx.scene.control.ScrollPane.fitToHeight.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkFitToWidthAndHeightOptionTest();FULL -javafx.scene.control.ScrollPane.hbarPolicy.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkHVBarPolicyOptionTest();FULL -javafx.scene.control.MenuItem.visible.BIND;javafx.scene.control.test.MenuItemTest.visibleTest();FULL -javafx.scene.control.ScrollPane.hmax.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkHMaxOptionTest();FULL -javafx.scene.control.ScrollPane.vmax.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkVMaxOptionTest();FULL -javafx.scene.control.ScrollPane.prefViewportHeight.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkPrefViewPortHeightOptionTest();FULL -javafx.scene.control.ScrollPane.hmin.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkHMinOptionTest();FULL -javafx.scene.control.MenuItem.disable.GET;javafx.scene.control.test.MenuItemTest.disableTest();FULL -javafx.scene.control.MenuItem.onHidden.BIND;javafx.scene.control.test.MenuTest.apiTest(),javafx.scene.control.test.MenuTest.dropTest();FULL -javafx.scene.control.MenuItem.disable.BIND;javafx.scene.control.test.MenuItemTest.disableTest();FULL -javafx.scene.control.ScrollPane.viewportBounds.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.boundsTest();FULL -TreeView.onEditCancelProperty.GET;javafx.scene.control.test.treeview.TreeViewTest.testOnEditOnCancelEventSequence();FULL -javafx.scene.control.ScrollPane.pannable.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkPannableOptionTest();FULL -javafx.scene.control.ScrollPane.hbarPolicy.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkHVBarPolicyOptionTest();FULL -javafx.scene.control.ColorPicker.value.BIND;javafx.scene.control.test.colorpicker.ColorPickerTest.colorPropertyTest();FULL -com.sun.javafx.scene.control.Pagination.pagefactory.DEFAULT;javafx.scene.control.test.pagination.PaginationTest.factoryChangingTest();FULL -javafx.scene.control.ListView.selectionModel.SET;javafx.scene.control.test.ListView.ListViewApp.getTestContainer();FULL -com.sun.javafx.scene.control.Pagination.currentpageindex.SET;javafx.scene.control.test.pagination.PaginationTest.currentPageIndexPropertyTest();FULL -javafx.scene.control.ScrollPane.vbarPolicy.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkHVBarPolicyOptionTest();FULL -javafx.scene.control.ListView.selectionModel.GET;javafx.scene.control.test.ListView.ListViewApp.getTestContainer();FULL -javafx.scene.control.MenuItem.visible.SET;javafx.scene.control.test.MenuItemTest.visibleTest();FULL -javafx.scene.control.ScrollPane.fitToWidth.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkFitToWidthAndHeightOptionTest();FULL -javafx.scene.control.Button.cancelButton.BIND;javafx.scene.control.test.ButtonsTest.cancelButtonTest();FULL -javafx.scene.control.CheckBox.selected.DEFAULT;javafx.scene.control.test.ChecksTest.checks();FULL -javafx.scene.control.ChoiceBox.showing.DEFAULT;javafx.scene.control.test.choicebox.ChoiceBoxApp.getScene();FULL -javafx.scene.control.MenuItem.visible.GET;javafx.scene.control.test.MenuItemTest.visibleTest();FULL -com.sun.javafx.scene.control.Pagination.currentpageindex.GET;javafx.scene.control.test.pagination.PaginationTest.currentPageIndexPropertyTest();FULL -TreeView.onEditCancelProperty.SET;javafx.scene.control.test.treeview.TreeViewTest.testOnEditStartCancel();FULL -javafx.scene.control.ChoiceBox.showing.SET;javafx.scene.control.test.choicebox.ChoiceBoxApp.getScene();FULL -com.sun.javafx.scene.control.Pagination.pagecount.GET;javafx.scene.control.test.pagination.PaginationTest.pageCountPropertyTest();FULL -javafx.scene.control.Button.defaultButton.GET;javafx.scene.control.test.ButtonsTest.defaultButtonTest();FULL -javafx.scene.control.MenuItem.onHiding.BIND;javafx.scene.control.test.MenuTest.apiTest(),javafx.scene.control.test.MenuTest.dropTest();FULL -com.sun.javafx.scene.control.Pagination.pageindicatorcounts.SET;javafx.scene.control.test.pagination.PaginationTest.pageIndicatorCountTest();FULL -javafx.scene.control.ScrollPane.vmax.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkVMaxOptionTest();FULL -com.sun.javafx.scene.control.Pagination.pageindicatorcount.BEHAVIOR;javafx.scene.control.test.pagination.PaginationTest.pageIndicatorCountTest();FULL -javafx.scene.control.CheckBox.indeterminate.DEFAULT;javafx.scene.control.test.ChecksTest.checks();FULL -com.sun.javafx.scene.control.Pagination.pagecount.SET;javafx.scene.control.test.pagination.PaginationTest.pageCountPropertyTest();FULL -com.sun.javafx.scene.control.Pagination.pagefactory.GET;javafx.scene.control.test.pagination.PaginationTest.factoryChangingTest();FULL -javafx.scene.control.Button.defaultButton.SET;javafx.scene.control.test.ButtonsTest.defaultButtonTest();FULL -javafx.scene.control.Button.cancelButton.DEFAULT;javafx.scene.control.test.ButtonsTest.cancelButtonTest();FULL -javafx.scene.control.Button.defaultButton.DEFAULT;javafx.scene.control.test.ButtonsTest.defaultButtonTest();FULL -javafx.scene.control.Button.text.BIND;javafx.scene.control.test.ButtonsTest.binding();FULL -com.sun.javafx.scene.control.Pagination.pageindicatorcount.DEFAULT;javafx.scene.control.test.pagination.PaginationTest.pageIndicatorCountTest();FULL -javafx.scene.control.Button.text.DEFAULT;javafx.scene.control.test.ButtonsTest.binding();FULL -javafx.scene.control.ScrollPane.hmax.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkHMaxOptionTest();FULL -javafx.scene.control.ScrollPane.fitToHeight.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkFitToWidthAndHeightOptionTest();FULL -javafx.scene.control.ScrollPane.vmin.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkVMinOptionTest();FULL -javafx.scene.control.ColorPicker.value.BEHAVIOR;javafx.scene.control.test.colorpicker.ColorPickerTest.colorPropertyTest();FULL -com.sun.javafx.scene.control.Pagination.pagefactory.SET;javafx.scene.control.test.pagination.PaginationTest.factoryChangingTest();FULL +javafx.scene.control.ScrollPane.prefViewportWidth.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkPrefViewPortWidthOptionTest(),javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkMinViewPortWidthSetTest();FULL +javafx.scene.control.ColorPicker.value.GET;javafx.scene.control.test.colorpicker.ColorPickerTest.colorPropertyTest();FULL +com.sun.javafx.scene.control.Pagination.currentpageindex.DEFAULT;javafx.scene.control.test.pagination.PaginationTest.currentPageIndexPropertyTest();FULL +com.sun.javafx.scene.control.Pagination.pageindicatorcount.GET;javafx.scene.control.test.pagination.PaginationTest.pageIndicatorCountTest();FULL +javafx.scene.control.Button.cancelButton.SET;javafx.scene.control.test.ButtonsTest.cancelButtonTest(),javafx.scene.control.test.mix.ButtonsTest.cancelButtonTest();FULL +javafx.scene.control.Button.text.GET;javafx.scene.control.test.ButtonsTest.binding(),javafx.scene.control.test.mix.ButtonsTest.binding();FULL +javafx.scene.control.MenuItem.onHidden.GET;javafx.scene.control.test.MenuTest.apiTest(),javafx.scene.control.test.MenuTest.dropTest(),javafx.scene.control.test.mix.MenuTest.apiTest(),javafx.scene.control.test.mix.MenuTest.dropTest();FULL +com.sun.javafx.scene.control.Pagination.pageindicatorcount.BIND;javafx.scene.control.test.pagination.PaginationTest.pageIndicatorCountTest();FULL +javafx.scene.control.Button.defaultButton.BIND;javafx.scene.control.test.ButtonsTest.defaultButtonTest(),javafx.scene.control.test.mix.ButtonsTest.defaultButtonTest();FULL +javafx.scene.control.ScrollPane.hmin.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkHMinOptionTest();FULL +javafx.scene.control.Button.cancelButton.GET;javafx.scene.control.test.ButtonsTest.cancelButtonTest(),javafx.scene.control.test.mix.ButtonsTest.cancelButtonTest();FULL +javafx.scene.control.MenuItem.onHidden.SET;javafx.scene.control.test.MenuTest.apiTest(),javafx.scene.control.test.MenuTest.dropTest(),javafx.scene.control.test.mix.MenuTest.apiTest(),javafx.scene.control.test.mix.MenuTest.dropTest();FULL +javafx.scene.control.CheckBox.indeterminate.SET;javafx.scene.control.test.ChecksTest.checks(),javafx.scene.control.test.mix.ChecksTest.checks();FULL +javafx.scene.control.CheckBox.selected.GET;javafx.scene.control.test.tableview.TableViewApp.getControlsContainer(),javafx.scene.control.test.ChecksTest.checks(),javafx.scene.control.test.mix.ChecksTest.checks();FULL +javafx.scene.control.Button.text.SET;javafx.scene.control.test.ButtonsTest.binding(),javafx.scene.control.test.mix.ButtonsTest.binding();FULL +javafx.scene.control.Tooltip.activated.GET;javafx.scene.control.test.TooltipTest.enabled(),javafx.scene.control.test.mix.TooltipTest.enabled();FULL +javafx.scene.control.ChoiceBox.showing.BIND;javafx.scene.control.test.choicebox.ChoiceBoxApp.getScene();FULL +javafx.scene.control.SingleSelectionModel.selectedItem.BIND;javafx.scene.control.test.choicebox.ChoiceBoxApp.getScene();FULL +javafx.scene.control.ChoiceBox.showing.GET;javafx.scene.control.test.choicebox.ChoiceBoxApp.getScene();FULL +com.sun.javafx.scene.control.Pagination.currentpageindex.BEHAVIOR;javafx.scene.control.test.pagination.PaginationTest.currentPageIndexPropertyTest();FULL +javafx.scene.control.ColorPicker.value.SET;javafx.scene.control.test.colorpicker.ColorPickerTest.colorPropertyTest();FULL +javafx.scene.control.ColorPicker.value.DEFAULT;javafx.scene.control.test.colorpicker.ColorPickerTest.colorPropertyTest();FULL +javafx.scene.control.CheckBox.indeterminate.GET;javafx.scene.control.test.ChecksTest.checks(),javafx.scene.control.test.mix.ChecksTest.checks();FULL +javafx.scene.control.CheckBox.selected.SET;javafx.scene.control.test.tableview.TableViewApp.getControlsContainer(),javafx.scene.control.test.ChecksTest.checks(),javafx.scene.control.test.mix.ChecksTest.checks();FULL +javafx.scene.control.MenuItem.onHiding.SET;javafx.scene.control.test.MenuTest.apiTest(),javafx.scene.control.test.MenuTest.dropTest(),javafx.scene.control.test.mix.MenuTest.apiTest(),javafx.scene.control.test.mix.MenuTest.dropTest();FULL +javafx.scene.control.ScrollPane.vbarPolicy.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkHVBarPolicyOptionTest();FULL +javafx.scene.control.ScrollPane.fitToWidth.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkFitToWidthAndHeightOptionTest();FULL +javafx.scene.control.Tooltip.activated.SET;javafx.scene.control.test.TooltipTest.enabled(),javafx.scene.control.test.mix.TooltipTest.enabled();FULL +javafx.scene.control.ScrollPane.pannable.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkPannableOptionTest();FULL +com.sun.javafx.scene.control.Pagination.pagecount.DEFAULT;javafx.scene.control.test.pagination.PaginationTest.pageCountPropertyTest();FULL +javafx.scene.control.CheckMenuItem.selected.SET;javafx.scene.control.test.tableview.TableViewApp.createColumn();FULL +javafx.scene.control.ScrollPane.vmin.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkVMinOptionTest();FULL +javafx.scene.control.SingleSelectionModel.selectedItem.GET;javafx.scene.control.test.choicebox.ChoiceBoxApp.getScene();FULL +com.sun.javafx.scene.control.Pagination.currentpageindex.BIND;javafx.scene.control.test.pagination.PaginationTest.currentPageIndexPropertyTest();FULL +javafx.scene.control.SingleSelectionModel.selectedItem.SET;javafx.scene.control.test.choicebox.ChoiceBoxApp.getScene();FULL +javafx.scene.control.MenuItem.onHiding.GET;javafx.scene.control.test.MenuTest.apiTest(),javafx.scene.control.test.MenuTest.dropTest(),javafx.scene.control.test.mix.MenuTest.apiTest(),javafx.scene.control.test.mix.MenuTest.dropTest();FULL +TreeView.onEditStartProperty.SET;javafx.scene.control.test.treeview.TreeViewTest.testOnEditStartCancel();FULL +TreeView.onEditCommitProperty.GET;javafx.scene.control.test.treeview.TreeViewTest.testOnEditOnCancelEventSequence();FULL +com.sun.javafx.scene.control.Pagination.pagefactory.BEHAVIOR;javafx.scene.control.test.pagination.PaginationTest.factoryChangingTest();FULL +com.sun.javafx.scene.control.Pagination.pagecount.BIND;javafx.scene.control.test.pagination.PaginationTest.pageCountPropertyTest();FULL +javafx.scene.control.ScrollPane.prefViewportWidth.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkPrefViewPortWidthOptionTest(),javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkMinViewPortWidthSetTest();FULL +com.sun.javafx.scene.control.Pagination.pagecount.BEHAVIOR;javafx.scene.control.test.pagination.PaginationTest.pageCountPropertyTest();FULL +javafx.scene.control.ScrollPane.prefViewportHeight.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkPrefViewPortHeightOptionTest();FULL +javafx.scene.control.MenuItem.disable.SET;javafx.scene.control.test.MenuItemTest.disableTest(),javafx.scene.control.test.mix.MenuItemTest.disableTest();FULL +TreeView.onEditStartProperty.GET;javafx.scene.control.test.treeview.TreeViewTest.testOnEditOnCancelEventSequence();FULL +TreeView.onEditCommitProperty.SET;javafx.scene.control.test.treeview.TreeViewTest.testOnEditCommit();FULL +javafx.scene.control.CheckMenuItem.selected.GET;javafx.scene.control.test.tableview.TableViewApp.createColumn();FULL +javafx.scene.control.ScrollPane.fitToHeight.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkFitToWidthAndHeightOptionTest();FULL +javafx.scene.control.ScrollPane.hbarPolicy.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkHVBarPolicyOptionTest();FULL +javafx.scene.control.MenuItem.visible.BIND;javafx.scene.control.test.MenuItemTest.visibleTest(),javafx.scene.control.test.mix.MenuItemTest.visibleTest();FULL +javafx.scene.control.ScrollPane.hmax.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkHMaxOptionTest();FULL +javafx.scene.control.ScrollPane.vmax.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkVMaxOptionTest();FULL +javafx.scene.control.ScrollPane.prefViewportHeight.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkPrefViewPortHeightOptionTest();FULL +javafx.scene.control.ScrollPane.hmin.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkHMinOptionTest();FULL +javafx.scene.control.MenuItem.disable.GET;javafx.scene.control.test.MenuItemTest.disableTest(),javafx.scene.control.test.mix.MenuItemTest.disableTest();FULL +javafx.scene.control.MenuItem.onHidden.BIND;javafx.scene.control.test.MenuTest.apiTest(),javafx.scene.control.test.MenuTest.dropTest(),javafx.scene.control.test.mix.MenuTest.apiTest(),javafx.scene.control.test.mix.MenuTest.dropTest();FULL +javafx.scene.control.MenuItem.disable.BIND;javafx.scene.control.test.MenuItemTest.disableTest(),javafx.scene.control.test.mix.MenuItemTest.disableTest();FULL +javafx.scene.control.ScrollPane.viewportBounds.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.boundsTest();FULL +TreeView.onEditCancelProperty.GET;javafx.scene.control.test.treeview.TreeViewTest.testOnEditOnCancelEventSequence();FULL +javafx.scene.control.ScrollPane.pannable.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkPannableOptionTest();FULL +javafx.scene.control.ScrollPane.hbarPolicy.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkHVBarPolicyOptionTest();FULL +javafx.scene.control.ColorPicker.value.BIND;javafx.scene.control.test.colorpicker.ColorPickerTest.colorPropertyTest();FULL +com.sun.javafx.scene.control.Pagination.pagefactory.DEFAULT;javafx.scene.control.test.pagination.PaginationTest.factoryChangingTest();FULL +javafx.scene.control.ListView.selectionModel.SET;javafx.scene.control.test.ListView.ListViewApp.getTestContainer();FULL +com.sun.javafx.scene.control.Pagination.currentpageindex.SET;javafx.scene.control.test.pagination.PaginationTest.currentPageIndexPropertyTest();FULL +javafx.scene.control.ScrollPane.vbarPolicy.GET;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkHVBarPolicyOptionTest();FULL +javafx.scene.control.ListView.selectionModel.GET;javafx.scene.control.test.ListView.ListViewApp.getTestContainer();FULL +javafx.scene.control.MenuItem.visible.SET;javafx.scene.control.test.MenuItemTest.visibleTest(),javafx.scene.control.test.mix.MenuItemTest.visibleTest();FULL +javafx.scene.control.ScrollPane.fitToWidth.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkFitToWidthAndHeightOptionTest();FULL +javafx.scene.control.Button.cancelButton.BIND;javafx.scene.control.test.ButtonsTest.cancelButtonTest(),javafx.scene.control.test.mix.ButtonsTest.cancelButtonTest();FULL +javafx.scene.control.CheckBox.selected.DEFAULT;javafx.scene.control.test.ChecksTest.checks(),javafx.scene.control.test.mix.ChecksTest.checks();FULL +javafx.scene.control.ChoiceBox.showing.DEFAULT;javafx.scene.control.test.choicebox.ChoiceBoxApp.getScene();FULL +javafx.scene.control.MenuItem.visible.GET;javafx.scene.control.test.MenuItemTest.visibleTest(),javafx.scene.control.test.mix.MenuItemTest.visibleTest();FULL +com.sun.javafx.scene.control.Pagination.currentpageindex.GET;javafx.scene.control.test.pagination.PaginationTest.currentPageIndexPropertyTest();FULL +TreeView.onEditCancelProperty.SET;javafx.scene.control.test.treeview.TreeViewTest.testOnEditStartCancel();FULL +javafx.scene.control.ChoiceBox.showing.SET;javafx.scene.control.test.choicebox.ChoiceBoxApp.getScene();FULL +com.sun.javafx.scene.control.Pagination.pagecount.GET;javafx.scene.control.test.pagination.PaginationTest.pageCountPropertyTest();FULL +javafx.scene.control.Button.defaultButton.GET;javafx.scene.control.test.ButtonsTest.defaultButtonTest(),javafx.scene.control.test.mix.ButtonsTest.defaultButtonTest();FULL +javafx.scene.control.MenuItem.onHiding.BIND;javafx.scene.control.test.MenuTest.apiTest(),javafx.scene.control.test.MenuTest.dropTest(),javafx.scene.control.test.mix.MenuTest.apiTest(),javafx.scene.control.test.mix.MenuTest.dropTest();FULL +com.sun.javafx.scene.control.Pagination.pageindicatorcounts.SET;javafx.scene.control.test.pagination.PaginationTest.pageIndicatorCountTest();FULL +javafx.scene.control.ScrollPane.vmax.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkVMaxOptionTest();FULL +com.sun.javafx.scene.control.Pagination.pageindicatorcount.BEHAVIOR;javafx.scene.control.test.pagination.PaginationTest.pageIndicatorCountTest();FULL +javafx.scene.control.CheckBox.indeterminate.DEFAULT;javafx.scene.control.test.ChecksTest.checks(),javafx.scene.control.test.mix.ChecksTest.checks();FULL +com.sun.javafx.scene.control.Pagination.pagecount.SET;javafx.scene.control.test.pagination.PaginationTest.pageCountPropertyTest();FULL +com.sun.javafx.scene.control.Pagination.pagefactory.GET;javafx.scene.control.test.pagination.PaginationTest.factoryChangingTest();FULL +javafx.scene.control.Button.defaultButton.SET;javafx.scene.control.test.ButtonsTest.defaultButtonTest(),javafx.scene.control.test.mix.ButtonsTest.defaultButtonTest();FULL +javafx.scene.control.Button.cancelButton.DEFAULT;javafx.scene.control.test.ButtonsTest.cancelButtonTest(),javafx.scene.control.test.mix.ButtonsTest.cancelButtonTest();FULL +javafx.scene.control.Button.defaultButton.DEFAULT;javafx.scene.control.test.ButtonsTest.defaultButtonTest(),javafx.scene.control.test.mix.ButtonsTest.defaultButtonTest();FULL +javafx.scene.control.Button.text.BIND;javafx.scene.control.test.ButtonsTest.binding(),javafx.scene.control.test.mix.ButtonsTest.binding();FULL +com.sun.javafx.scene.control.Pagination.pageindicatorcount.DEFAULT;javafx.scene.control.test.pagination.PaginationTest.pageIndicatorCountTest();FULL +javafx.scene.control.Button.text.DEFAULT;javafx.scene.control.test.ButtonsTest.binding(),javafx.scene.control.test.mix.ButtonsTest.binding();FULL +javafx.scene.control.ScrollPane.hmax.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkHMaxOptionTest();FULL +javafx.scene.control.ScrollPane.fitToHeight.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkFitToWidthAndHeightOptionTest();FULL +javafx.scene.control.ScrollPane.vmin.DEFAULT;javafx.scene.control.test.ScrollPane.ScrollPaneTest.checkVMinOptionTest();FULL +javafx.scene.control.ColorPicker.value.BEHAVIOR;javafx.scene.control.test.colorpicker.ColorPickerTest.colorPropertyTest();FULL +com.sun.javafx.scene.control.Pagination.pagefactory.SET;javafx.scene.control.test.pagination.PaginationTest.factoryChangingTest();FULL --- old/functional/ControlsTests/nbproject/project.properties 2016-12-22 11:26:18.960978186 +0300 +++ new/functional/ControlsTests/nbproject/project.properties 2016-12-22 11:26:18.904977646 +0300 @@ -25,7 +25,7 @@ file.reference.JemmyFX.jar=../../tools/Jemmy/JemmyFX/dist/JemmyFX.jar file.reference.JemmyFXBrowser.jar=../../tools/Jemmy/JemmyFXBrowser/dist/JemmyFXBrowser.jar file.reference.JemmySWT.jar=../../tools/lib/JemmySWT.jar -file.reference.jfxswt.jar=${java.home}/lib/jfxswt.jar +file.reference.jfxswt.jar=${java.home}/lib/javafx-swt.jar build.test.results.dir=${external.output}/${application.title}/build/test/results file.reference.junit.jar=../../tools/Jemmy/jemmy_core/junit.jar file.reference.SharedTestUtilsOpen.jar=../../tools/SharedTestUtilsOpen/dist/SharedTestUtilsOpen.jar --- old/functional/ControlsTests/src/javafx/commons/ControlChooserApp.java 2016-12-22 11:26:19.148979998 +0300 +++ new/functional/ControlsTests/src/javafx/commons/ControlChooserApp.java 2016-12-22 11:26:19.100979536 +0300 @@ -1,136 +1,132 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.commons; - -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; -import javafx.factory.ControlsFactory; -import javafx.factory.NodeFactory; -import javafx.factory.Panes; -import javafx.factory.Shapes; -import javafx.geometry.Pos; -import javafx.scene.Node; -import javafx.scene.Parent; -import javafx.scene.Scene; -import javafx.scene.control.ChoiceBox; -import javafx.scene.control.Label; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Pane; -import javafx.scene.layout.PaneBuilder; -import javafx.scene.layout.VBox; -import javafx.scene.layout.VBoxBuilder; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * - * @author Dmitry Zinkevich - */ -public class ControlChooserApp extends InteroperabilityApp { - public static final String NODE_CHOOSER_ID = "nodeChooser"; - public static final String TESTED_CONTROL_ID = "target"; - - private VBox spaceForNode; - private PropertiesTable propertiesTable; - private Pane propertiesPane = PaneBuilder.create() - .style("-fx-border-color:BLUE") - .build(); - - public static void main(String[] args) { - Utils.launch(javafx.commons.ControlChooserApp.class, args); - } - - @Override - protected Scene getScene() { - Scene scene = new Scene(getContent(), 800, 600); - Utils.addBrowser(scene); - return scene; - } - - private Node createNodeChooser() { - ChoiceBox cb = new ChoiceBox(); - cb.setId(NODE_CHOOSER_ID); - cb.getItems().addAll(ControlsFactory.filteredValues()); - /* - * Remove image view and media view - */ - cb.getItems().removeAll(ControlsFactory.ImageView, ControlsFactory.MediaView); - - cb.getItems().addAll(Shapes.values()); - cb.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { - - @Override - public void changed(ObservableValue ov, NodeFactory t, NodeFactory t1) { - final Node node = t1.createNode(); - - node.setId(TESTED_CONTROL_ID); - spaceForNode.getChildren().clear(); - spaceForNode.getChildren().add(node); - - propertiesTable = new PropertiesTable(node); - propertiesTable.addBooleanPropertyLine(node.disableProperty()); - propertiesTable.addDoublePropertyLine(node.opacityProperty(), 0, 1, 1); - propertiesTable.addSimpleListener(node.focusedProperty(), node); - - propertiesPane.getChildren().clear(); - propertiesPane.getChildren().add(propertiesTable); - } - }); - - VBox vb = new VBox(5); - vb.getChildren().addAll(new Label("Choose tested control : "), cb); - return vb; - } - - private Parent getContent() { - spaceForNode = new VBox(10); - spaceForNode.setAlignment(Pos.CENTER); - spaceForNode.setMinWidth(300); - spaceForNode.setPrefWidth(300); - spaceForNode.setMaxWidth(300); - spaceForNode.setMinHeight(300); - spaceForNode.setPrefHeight(300); - spaceForNode.setMaxHeight(300); - spaceForNode.setStyle("-fx-border-color:RED"); - - VBox controls = new VBox(10); - controls.setAlignment(Pos.CENTER); - controls.getChildren().add(createNodeChooser()); - controls.setStyle("-fx-border-color:GREEN"); - - VBox vBox = VBoxBuilder.create() - .children(spaceForNode, controls) - .spacing(10d) - .build(); - - HBox hBox = new HBox(10); - hBox.setAlignment(Pos.TOP_LEFT); - hBox.getChildren().addAll( - vBox, - propertiesPane); - return hBox; - } +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.commons; + +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.factory.ControlsFactory; +import javafx.factory.NodeFactory; +import javafx.factory.Panes; +import javafx.factory.Shapes; +import javafx.geometry.Pos; +import javafx.scene.Node; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.scene.control.ChoiceBox; +import javafx.scene.control.Label; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * + * @author Dmitry Zinkevich + */ +public class ControlChooserApp extends InteroperabilityApp { + public static final String NODE_CHOOSER_ID = "nodeChooser"; + public static final String TESTED_CONTROL_ID = "target"; + + private VBox spaceForNode; + private PropertiesTable propertiesTable; + private Pane propertiesPane; + + public static void main(String[] args) { + Utils.launch(javafx.commons.ControlChooserApp.class, args); + } + + @Override + protected Scene getScene() { + Scene scene = new Scene(getContent(), 800, 600); + Utils.addBrowser(scene); + return scene; + } + + private Node createNodeChooser() { + ChoiceBox cb = new ChoiceBox(); + cb.setId(NODE_CHOOSER_ID); + cb.getItems().addAll(ControlsFactory.filteredValues()); + /* + * Remove image view and media view + */ + cb.getItems().removeAll(ControlsFactory.ImageView, ControlsFactory.MediaView); + + cb.getItems().addAll(Shapes.values()); + cb.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { + + @Override + public void changed(ObservableValue ov, NodeFactory t, NodeFactory t1) { + final Node node = t1.createNode(); + + node.setId(TESTED_CONTROL_ID); + spaceForNode.getChildren().clear(); + spaceForNode.getChildren().add(node); + + propertiesTable = new PropertiesTable(node); + propertiesTable.addBooleanPropertyLine(node.disableProperty()); + propertiesTable.addDoublePropertyLine(node.opacityProperty(), 0, 1, 1); + propertiesTable.addSimpleListener(node.focusedProperty(), node); + + propertiesPane.getChildren().clear(); + propertiesPane.getChildren().add(propertiesTable); + } + }); + + VBox vb = new VBox(5); + vb.getChildren().addAll(new Label("Choose tested control : "), cb); + return vb; + } + + private Parent getContent() { + propertiesPane = new Pane(); + propertiesPane.setStyle("-fx-border-color:BLUE"); + + spaceForNode = new VBox(10); + spaceForNode.setAlignment(Pos.CENTER); + spaceForNode.setMinWidth(300); + spaceForNode.setPrefWidth(300); + spaceForNode.setMaxWidth(300); + spaceForNode.setMinHeight(300); + spaceForNode.setPrefHeight(300); + spaceForNode.setMaxHeight(300); + spaceForNode.setStyle("-fx-border-color:RED"); + + VBox controls = new VBox(10); + controls.setAlignment(Pos.CENTER); + controls.getChildren().add(createNodeChooser()); + controls.setStyle("-fx-border-color:GREEN"); + + VBox vBox = new VBox(spaceForNode, controls); + vBox.setSpacing(10d); + HBox hBox = new HBox(10); + hBox.setAlignment(Pos.TOP_LEFT); + hBox.getChildren().addAll( + vBox, + propertiesPane); + return hBox; + } } \ No newline at end of file --- old/functional/ControlsTests/src/javafx/draganddrop/DragDropWithControls.java 2016-12-22 11:26:19.332981773 +0300 +++ new/functional/ControlsTests/src/javafx/draganddrop/DragDropWithControls.java 2016-12-22 11:26:19.284981310 +0300 @@ -50,14 +50,13 @@ import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Button; -import javafx.scene.control.ButtonBuilder; import javafx.scene.control.CheckBox; import javafx.scene.control.ChoiceBox; import javafx.scene.control.Label; import javafx.scene.control.Separator; import javafx.scene.control.TextField; import javafx.scene.image.Image; -import javafx.scene.image.ImageViewBuilder; +import javafx.scene.image.ImageView; import javafx.scene.input.Clipboard; import javafx.scene.input.ClipboardContent; import javafx.scene.input.DataFormat; @@ -293,15 +292,16 @@ createTMSelect(sourceModes)); VBox rbox = new VBox(10); - rbox.getChildren().addAll(new Text("Data formats:"), - createFormatSelect(sourceFormats), - ButtonBuilder.create().text("Put to clipboard") - .id(ID_TO_CLIPBOARD_BUTTON) - .onAction(new EventHandler() { + Button b = new Button("Put to clipboard"); + b.setId(ID_TO_CLIPBOARD_BUTTON); + b.setOnAction(new EventHandler() { public void handle(ActionEvent t) { Clipboard.getSystemClipboard().setContent(prepareClipboardContent()); } - }).build()); + }); + rbox.getChildren().addAll(new Text("Data formats:"), + createFormatSelect(sourceFormats), + b); HBox hbox = new HBox(10); hbox.getChildren().addAll(lbox, new Separator(Orientation.VERTICAL), rbox); @@ -342,10 +342,13 @@ useCustomViewCB = new CheckBox("Use custom drag view."); VBox box = new VBox(10); + ImageView i = new ImageView(); + i.setImage(CONTENT_IMAGE); + i.setId(ID_SRC_IMAGE); box.getChildren().addAll(hbox, new Separator(), fileHdr, fileNames, tb, btns, useCustomViewCB, new Text("Image: "), - ImageViewBuilder.create().image(CONTENT_IMAGE).id(ID_SRC_IMAGE).build(), + i, log); if (parameters.size() > 0) { box.setStyle("-fx-background-color: " + parameters.get(0) + ";"); @@ -370,12 +373,14 @@ createControlCombo(targetControlPane, false), new Text("Target transfer modes:"), createTMSelect(targetModes)); VBox rbox = new VBox(10); - rbox.getChildren().addAll(new Text("Data formats:"), createFormatSelect(targetFormats), - ButtonBuilder.create().text("paste from clipboard").id(ID_FROM_CLIPBOARD_BUTTON).onAction(new EventHandler() { + Button b = new Button("paste from clipboard"); + b.setId(ID_FROM_CLIPBOARD_BUTTON); + b.setOnAction(new EventHandler() { public void handle(ActionEvent t) { getDataFromClipboard(Clipboard.getSystemClipboard()); } - }).build()); + }); + rbox.getChildren().addAll(new Text("Data formats:"), createFormatSelect(targetFormats), b); VBox content = new VBox(10); content.getChildren().addAll(new Text("Transfered content:"), transferedContentPane); @@ -400,6 +405,9 @@ public void changed(ObservableValue ov, NodeFactory t, NodeFactory t1) { Node ctrl = null; ctrl = t1.createNode(); + if (ctrl instanceof ImageView) { + ctrl.setPickOnBounds(true); + } if (source) { ctrl.setId(ID_DRAG_SOURCE); } else { @@ -569,7 +577,9 @@ } if (targetFormats.contains(DataFormat.IMAGE) && cb.hasImage()) { receivedContent.put(DataFormat.IMAGE, cb.getImage()); - transferedContentPane.getChildren().addAll(new Text("Image: "), ImageViewBuilder.create().image(cb.getImage()).id(ID_RECEIVED_IMAGE).build()); + ImageView i = new ImageView(cb.getImage()); + i.setId(ID_RECEIVED_IMAGE); + transferedContentPane.getChildren().addAll(new Text("Image: "), i); log("Dropped image: " + cb.getImage()); gotData = true; } --- old/functional/ControlsTests/src/javafx/factory/ControlsFactory.java 2016-12-22 11:26:19.536983741 +0300 +++ new/functional/ControlsTests/src/javafx/factory/ControlsFactory.java 2016-12-22 11:26:19.480983200 +0300 @@ -46,54 +46,38 @@ import javafx.scene.Node; import javafx.scene.control.Accordion; import javafx.scene.control.Button; -import javafx.scene.control.ButtonBuilder; import javafx.scene.control.CheckBox; -import javafx.scene.control.CheckBoxBuilder; import javafx.scene.control.ChoiceBox; import javafx.scene.control.ColorPicker; import javafx.scene.control.ComboBox; import javafx.scene.control.Control; import javafx.scene.control.DatePicker; import javafx.scene.control.Hyperlink; -import javafx.scene.control.HyperlinkBuilder; import javafx.scene.control.Label; -import javafx.scene.control.LabelBuilder; import javafx.scene.control.ListView; import javafx.scene.control.Menu; import javafx.scene.control.MenuBar; import javafx.scene.control.MenuItem; import javafx.scene.control.Pagination; import javafx.scene.control.PasswordField; -import javafx.scene.control.PasswordFieldBuilder; import javafx.scene.control.ProgressBar; -import javafx.scene.control.ProgressBarBuilder; import javafx.scene.control.ProgressIndicator; -import javafx.scene.control.ProgressIndicatorBuilder; import javafx.scene.control.RadioButton; -import javafx.scene.control.RadioButtonBuilder; import javafx.scene.control.ScrollBar; -import javafx.scene.control.ScrollBarBuilder; import javafx.scene.control.ScrollPane; import javafx.scene.control.Separator; -import javafx.scene.control.SeparatorBuilder; import javafx.scene.control.Slider; -import javafx.scene.control.SliderBuilder; import javafx.scene.control.SplitMenuButton; -import javafx.scene.control.SplitMenuButtonBuilder; import javafx.scene.control.SplitPane; -import javafx.scene.control.SplitPaneBuilder; import javafx.scene.control.Tab; import javafx.scene.control.TabPane; import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn.CellDataFeatures; import javafx.scene.control.TableView; import javafx.scene.control.TextArea; -import javafx.scene.control.TextAreaBuilder; import javafx.scene.control.TextField; -import javafx.scene.control.TextFieldBuilder; import javafx.scene.control.TitledPane; import javafx.scene.control.ToggleButton; -import javafx.scene.control.ToggleButtonBuilder; import javafx.scene.control.ToolBar; import javafx.scene.control.TreeItem; import javafx.scene.control.TreeTableColumn; @@ -102,7 +86,7 @@ import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.HBox; -import javafx.scene.layout.StackPaneBuilder; +import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; @@ -114,7 +98,10 @@ Buttons(new ControlFactory() { public Control createControl() { - return ButtonBuilder.create().text("Button the first line" + "\nthe sec long line" + "\nthe third line").focusTraversable(false).graphic(new Rectangle(10, 10, Color.RED)).build(); + Button b = new Button("Button the first line" + "\nthe sec long line" + "\nthe third line"); + b.setFocusTraversable(false); + b.setGraphic(new Rectangle(10, 10, Color.RED)); + return b; } public Class getControlClass() { @@ -183,7 +170,10 @@ }), CheckBoxes(new ControlFactory() { public Control createControl() { - return CheckBoxBuilder.create().text("Check box the first line" + "\nthe sec long line" + "\nthe third line").graphic(new Rectangle(20, 20, Color.web("lightblue"))).focusTraversable(false).build(); + CheckBox cb = new CheckBox("Check box the first line" + "\nthe sec long line" + "\nthe third line"); + cb.setFocusTraversable(false); + cb.setGraphic(new Rectangle(20, 20, Color.web("lightblue"))); + return cb; } public Class getControlClass() { @@ -192,7 +182,11 @@ }), RadioButtons(new ControlFactory() { public Control createControl() { - return RadioButtonBuilder.create().text("Radio the first line" + "\nthe sec long line" + "\nthe third line").graphic(new Rectangle(20, 20, Color.web("lightblue"))).focusTraversable(false).textAlignment(TextAlignment.RIGHT).build(); + RadioButton rb = new RadioButton("Radio the first line" + "\nthe sec long line" + "\nthe third line"); + rb.setFocusTraversable(false); + rb.setGraphic(new Rectangle(20, 20, Color.web("lightblue"))); + rb.setTextAlignment(TextAlignment.RIGHT); + return rb; } public Class getControlClass() { @@ -201,7 +195,9 @@ }), TextFields(new ControlFactory() { public Control createControl() { - return TextFieldBuilder.create().text("Text box the first line" + "\nthe sec long line" + "\nthe third line").focusTraversable(false).build(); + TextField tf = new TextField("Text box the first line" + "\nthe sec long line" + "\nthe third line"); + tf.setFocusTraversable(false); + return tf; } public Class getControlClass() { @@ -210,7 +206,10 @@ }), TextAreas(new ControlFactory() { public Control createControl() { - return TextAreaBuilder.create().maxWidth(100).maxHeight(50).text("Text area the first line" + "\nthe sec long line" + "\nthe third line").focusTraversable(false).build(); + TextArea ta = new TextArea("Text area the first line" + "\nthe sec long line" + "\nthe third line"); + ta.setFocusTraversable(false); + ta.setMaxSize(100, 50); + return ta; } public Class getControlClass() { @@ -219,7 +218,10 @@ }), PasswordFields(new ControlFactory() { public Control createControl() { - return PasswordFieldBuilder.create().promptText("Password box the first line" + "\nthe sec long line" + "\nthe third line").focusTraversable(false).build(); + PasswordField pf = new PasswordField(); + pf.setPromptText("Password box the first line" + "\nthe sec long line" + "\nthe third line"); + pf.setFocusTraversable(false); + return pf; } public Class getControlClass() { @@ -228,7 +230,12 @@ }), Sliders(new ControlFactory() { public Control createControl() { - return SliderBuilder.create().min(0).max(100).value(20).focusTraversable(false).build(); + Slider s = new Slider(); + s.setMin(0); + s.setMax(100); + s.setValue(20); + s.setFocusTraversable(false); + return s; } public Class getControlClass() { @@ -237,7 +244,10 @@ }), Labels(new ControlFactory() { public Control createControl() { - return LabelBuilder.create().text("Label the first line" + "\nthe sec longlong line" + "\nthe third line").focusTraversable(false).graphic(new Rectangle(20, 20, Color.web("lightblue"))).build(); + Label l = new Label("Label the first line" + "\nthe sec longlong line" + "\nthe third line"); + l.setFocusTraversable(false); + l.setGraphic(new Rectangle(20, 20, Color.web("lightblue"))); + return l; } public Class getControlClass() { @@ -246,7 +256,10 @@ }), Hyperlinks(new ControlFactory() { public Control createControl() { - return HyperlinkBuilder.create().text("Hyperlink the first line" + "\nthe sec long line" + "\nthe third line").focusTraversable(false).graphic(new Circle(10, Color.BLUE)).build(); + Hyperlink hl = new Hyperlink("Hyperlink the first line" + "\nthe sec long line" + "\nthe third line"); + hl.setFocusTraversable(false); + hl.setGraphic(new Circle(10, Color.BLUE)); + return hl; } public Class getControlClass() { @@ -299,7 +312,8 @@ }), Separators(new ControlFactory() { public Control createControl() { - Separator sep = SeparatorBuilder.create().halignment(HPos.CENTER).build(); + Separator sep = new Separator(); + sep.setHalignment(HPos.CENTER); sep.setPrefWidth(80); return sep; } @@ -310,7 +324,12 @@ }), ScrollBars(new ControlFactory() { public Control createControl() { - return ScrollBarBuilder.create().value(45).min(0).max(100).focusTraversable(false).build(); + ScrollBar sb = new ScrollBar(); + sb.setValue(45); + sb.setMin(0); + sb.setMax(100); + sb.setFocusTraversable(false); + return sb; } public Class getControlClass() { @@ -337,7 +356,9 @@ }), ProgressIndicators(new ControlFactory() { public Node createControl() { - return ProgressIndicatorBuilder.create().progress(0.85).focusTraversable(false).build(); + ProgressIndicator pi = new ProgressIndicator(0.85); + pi.setFocusTraversable(false); + return pi; } public Class getControlClass() { @@ -346,7 +367,9 @@ }), ProgressBars(new ControlFactory() { public Node createControl() { - return ProgressBarBuilder.create().progress(0.25).focusTraversable(false).build(); + ProgressBar pb = new ProgressBar(0.25); + pb.setFocusTraversable(false); + return pb; } public Class getControlClass() { @@ -356,6 +379,8 @@ ListViews(new ControlFactory() { public Node createControl() { ListView list = new ListView(); + + // The following requires --add-exports javafx.base/com.sun.javafx.collections=ALL-UNNAMED ObservableListWrapper items = new ObservableListWrapper(Arrays.asList("One", "Two", "Three", "Four", "Five", "Six", "long line long line long line long line")); list.setItems(items); list.setPrefWidth(100); @@ -370,7 +395,11 @@ }), PressedToggleButtons(new ControlFactory() { public Control createControl() { - return ToggleButtonBuilder.create().selected(true).text("Button the first line" + "\nthe sec long line" + "\nthe third line").focusTraversable(false).graphic(new Rectangle(10, 10, Color.RED)).build(); + ToggleButton tb = new ToggleButton("Button the first line" + "\nthe sec long line" + "\nthe third line"); + tb.setFocusTraversable(false); + tb.setGraphic(new Rectangle(10, 10, Color.RED)); + tb.setSelected(true); + return tb; } public Class getControlClass() { @@ -379,7 +408,11 @@ }), UnPressedToggleButtons(new ControlFactory() { public Control createControl() { - return ToggleButtonBuilder.create().selected(false).text("Button the first line" + "\nthe sec long line" + "\nthe third line").focusTraversable(false).graphic(new Rectangle(10, 10, Color.RED)).build(); + ToggleButton tb = new ToggleButton("Button the first line" + "\nthe sec long line" + "\nthe third line"); + tb.setFocusTraversable(false); + tb.setGraphic(new Rectangle(10, 10, Color.RED)); + tb.setSelected(false); + return tb; } public Class getControlClass() { @@ -389,7 +422,9 @@ Toolbars(new ControlFactory() { public Node createControl() { ToolBar toolbar = new ToolBar(); - toolbar.getItems().addAll(new Button("One"), new Button("Two"), new Separator(), SplitMenuButtonBuilder.create().text("three").build()); + SplitMenuButton smb = new SplitMenuButton(); + smb.setText("three"); + toolbar.getItems().addAll(new Button("One"), new Button("Two"), new Separator(), smb); toolbar.setFocusTraversable(false); return toolbar; } @@ -412,12 +447,10 @@ }), SplitMenuButtons(new ControlFactory() { public Node createControl() { - SplitMenuButton smb = SplitMenuButtonBuilder.create() - .text("Split box the first line" + "\nthe sec long line" + "\nthe third line") - .items(new MenuItem("Split box the first line" + "\nthe sec long line" + "\nthe third line", - new Rectangle(10, 10, Color.BLUE))) - .graphic(new Rectangle(10, 10, Color.RED)) - .build(); + SplitMenuButton smb = new SplitMenuButton(new MenuItem("Split box the first line" + "\nthe sec long line" + "\nthe third line", + new Rectangle(10, 10, Color.BLUE))); + smb.setText("Split box the first line" + "\nthe sec long line" + "\nthe third line"); + smb.setGraphic(new Rectangle(10, 10, Color.RED)); smb.setMinWidth(100); smb.setFocusTraversable(false); return smb; @@ -491,7 +524,6 @@ table.getColumns().setAll(column1, column2); table.setPrefHeight(100); table.setPrefWidth(100); - table.setMinHeight(Control.USE_PREF_SIZE); table.setFocusTraversable(false); return table; } @@ -531,7 +563,6 @@ treeTable.getColumns().setAll(column1, column2); treeTable.setPrefHeight(100); treeTable.setPrefWidth(100); - treeTable.setMinHeight(Control.USE_PREF_SIZE); treeTable.setFocusTraversable(false); return treeTable; } @@ -584,10 +615,11 @@ }), SplitPanes(new ControlFactory() { public Node createControl() { - SplitPane pane = SplitPaneBuilder.create().items( - StackPaneBuilder.create().children(new Rectangle(40, 40, Color.WHITESMOKE)).build(), - StackPaneBuilder.create().children(new Rectangle(40, 40, Color.BLUE)).build(), - StackPaneBuilder.create().children(new Rectangle(40, 40, Color.RED)).build()).prefWidth(150).prefHeight(150).build(); + StackPane sp1 = new StackPane(new Rectangle(40, 40, Color.WHITESMOKE)); + StackPane sp2 = new StackPane(new Rectangle(40, 40, Color.BLUE)); + StackPane sp3 = new StackPane(new Rectangle(40, 40, Color.RED)); + SplitPane pane = new SplitPane(sp1, sp2, sp3); + pane.setPrefSize(150, 150); pane.setMinWidth(100); pane.setDividerPositions(0.33, 0.67); pane.setFocusTraversable(false); --- old/functional/ControlsTests/src/javafx/scene/control/test/ListView/NewListViewApp.java 2016-12-22 11:26:19.752985824 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/ListView/NewListViewApp.java 2016-12-22 11:26:19.696985284 +0300 @@ -118,7 +118,9 @@ PropertyTablesFactory.explorePropertiesList(testedListView, tb); SpecialTablePropertiesProvider.provideForControl(testedControl, tb); - final TextField tf = TextFieldBuilder.create().id(LIST_VIEW_CONTROL_ADD_INDEX_TEXT_FIELD_ID).text("0").prefWidth(40).build(); + final TextField tf = new TextField("0"); + tf.setId(LIST_VIEW_CONTROL_ADD_INDEX_TEXT_FIELD_ID); + tf.setPrefWidth(40); HBox nodeshb = new NodesChoserFactory("Add!", new NodesChoserFactory.NodeAction() { @Override @@ -128,7 +130,8 @@ }, tf); HBox resetButtons = new HBox(); - Button hardResetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Hard reset").build(); + Button hardResetButton = new Button("Hard reset"); + hardResetButton.setId(HARD_RESET_BUTTON_ID); hardResetButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { HBox hb = (HBox) getRoot(); @@ -138,7 +141,8 @@ } }); - Button softResetButton = ButtonBuilder.create().id(SOFT_RESET_BUTTON_ID).text("Soft reset").build(); + Button softResetButton = new Button("Soft reset"); + softResetButton.setId(SOFT_RESET_BUTTON_ID); softResetButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { softReset(); @@ -154,7 +158,8 @@ } }); - Button changeSelectionModel = ButtonBuilder.create().text("Change selection model to custom").id(CHANGE_SELECTION_MODEL_BUTTON_ID).build(); + Button changeSelectionModel = new Button("Change selection model to custom"); + changeSelectionModel.setId(CHANGE_SELECTION_MODEL_BUTTON_ID); changeSelectionModel.setOnAction(new EventHandler() { public void handle(ActionEvent t) { testedListView.setSelectionModel(cmsm); @@ -180,7 +185,6 @@ ListView lv = new ListView(); lv.setId(TESTED_LIST_VIEW_ID); return lv; - //return ListViewBuilder.create().id(TESTED_LIST_VIEW_ID).build(); } private void softReset() { @@ -225,12 +229,17 @@ private HBox getAddItemHBox() { HBox hb = new HBox(); Label lb = new Label("Add item"); - final TextField tf = TextFieldBuilder.create().prefWidth(50).id(ADD_ITEM_TEXT_FIELD_ID).build(); + final TextField tf = new TextField(); + tf.setPrefWidth(50); + tf.setId(ADD_ITEM_TEXT_FIELD_ID); Label atLb = new Label("at pos"); - final TextField tfPos = TextFieldBuilder.create().prefWidth(50).id(ADD_ITEM_POSITION_TEXT_FIELD_ID).build(); + final TextField tfPos = new TextField(); + tfPos.setPrefWidth(50); + tfPos.setId(ADD_ITEM_POSITION_TEXT_FIELD_ID); - Button bt = ButtonBuilder.create().text("Add!").id(ADD_ITEM_BUTTON_ID).build(); + Button bt = new Button("Add!"); + bt.setId(ADD_ITEM_BUTTON_ID); bt.setOnAction(new EventHandler() { public void handle(Event t) { ((ListView) testedControl).getItems().add(Integer.parseInt(tfPos.getText()), tf.getText()); @@ -243,8 +252,11 @@ private HBox getRemoveItemHBox() { HBox hb = new HBox(); Label lb = new Label("From position"); - final TextField tf = TextFieldBuilder.create().text("0").prefWidth(50).id(REMOVE_ITEM_POS_TEXT_FIELD_ID).build(); - Button bt = ButtonBuilder.create().text("Remove!").id(REMOVE_BUTTON_ID).build(); + final TextField tf = new TextField("0"); + tf.setPrefWidth(50); + tf.setId(REMOVE_ITEM_POS_TEXT_FIELD_ID); + Button bt = new Button("Remove!"); + bt.setId(REMOVE_BUTTON_ID); bt.setOnAction(new EventHandler() { public void handle(Event t) { int index = Integer.parseInt(tf.getText()); @@ -257,8 +269,10 @@ private HBox getScrollToHBox() { HBox hb = new HBox(); - Button button = ButtonBuilder.create().text("ScrollTo").id(SCROLL_TO_BUTTON_ID).build(); - final TextField tf = TextFieldBuilder.create().text("0").id(SCROLL_TO_TEXT_FIELD_ID).build(); + Button button = new Button("ScrollTo"); + button.setId(SCROLL_TO_BUTTON_ID); + final TextField tf = new TextField("0"); + tf.setId(SCROLL_TO_TEXT_FIELD_ID); button.setOnAction(new EventHandler() { public void handle(ActionEvent t) { @@ -273,8 +287,11 @@ private HBox getAddRectangleHbox() { HBox hb = new HBox(); Label lb = new Label("Add rectangle at pos"); - final TextField tfPos = TextFieldBuilder.create().prefWidth(50).id(ADD_RECTANGLE_TEXT_FIELD_ID).build(); - Button bt = ButtonBuilder.create().text("Add!").id(ADD_RECTANGLE_BUTTON_ID).build(); + final TextField tfPos = new TextField(); + tfPos.setPrefWidth(50); + tfPos.setId(ADD_RECTANGLE_TEXT_FIELD_ID); + Button bt = new Button("Add!"); + bt.setId(ADD_RECTANGLE_BUTTON_ID); bt.setOnAction(new EventHandler() { public void handle(Event t) { int index = Integer.parseInt(tfPos.getText()); @@ -288,8 +305,11 @@ private HBox getAddFormHbox() { HBox hb = new HBox(); Label lb = new Label("Add form at pos"); - final TextField tfPos = TextFieldBuilder.create().prefWidth(50).id(ADD_FORM_TEXT_FIELD_ID).build(); - Button bt = ButtonBuilder.create().text("Add!").id(ADD_FORM_BUTTON_ID).build(); + final TextField tfPos = new TextField(); + tfPos.setPrefWidth(50); + tfPos.setId(ADD_FORM_TEXT_FIELD_ID); + Button bt = new Button("Add!"); + bt.setId(ADD_FORM_BUTTON_ID); bt.setOnAction(new EventHandler() { public void handle(Event t) { int index = Integer.parseInt(tfPos.getText()); @@ -303,8 +323,11 @@ private HBox getAddTextFieldHbox() { HBox hb = new HBox(); Label lb = new Label("Add textField at pos"); - final TextField tfPos = TextFieldBuilder.create().prefWidth(50).id(ADD_TEXT_FIELD_TEXT_FIELD_ID).build(); - Button bt = ButtonBuilder.create().text("Add!").id(ADD_TEXT_FIELD_BUTTON_ID).build(); + final TextField tfPos = new TextField(); + tfPos.setPrefWidth(50); + tfPos.setId(ADD_TEXT_FIELD_TEXT_FIELD_ID); + Button bt = new Button("Add!"); + bt.setId(ADD_TEXT_FIELD_BUTTON_ID); bt.setOnAction(new EventHandler() { public void handle(Event t) { int index = Integer.parseInt(tfPos.getText()); @@ -317,9 +340,11 @@ private HBox getStartMotionHBox() { HBox hb = new HBox(); - Button startMotion = ButtonBuilder.create().text("start motion").id(START_MOTION_BUTTON_ID).build(); + Button startMotion = new Button("start motion"); + startMotion.setId(START_MOTION_BUTTON_ID); Label label = new Label(" of element at position "); - final TextField tf = TextFieldBuilder.create().text("0").id(START_MOTION_TEXT_FIELD_ID).build(); + final TextField tf = new TextField("0"); + tf.setId(START_MOTION_TEXT_FIELD_ID); startMotion.setOnAction(new EventHandler() { public void handle(Event t) { cm.applyTransition((Node) ((ListView) testedControl).getItems().get(Integer.parseInt(tf.getText()))); @@ -332,9 +357,11 @@ private HBox getIncreaseScaleHBox() { HBox hb = new HBox(); - final TextField tf = TextFieldBuilder.create().text("0").id(INCREASE_SCALE_TEXT_FIELD_ID).build(); + final TextField tf = new TextField("0"); + tf.setId(INCREASE_SCALE_TEXT_FIELD_ID); Label label = new Label(" of node on position "); - Button increaseScaleButton = ButtonBuilder.create().id(INCREASE_SCALE_BUTTON_ID).text("Increase scale").build(); + Button increaseScaleButton = new Button("Increase scale"); + increaseScaleButton.setId(INCREASE_SCALE_BUTTON_ID); increaseScaleButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { Node content = (Node) ((ListView) testedControl).getItems().get(Integer.parseInt(tf.getText())); @@ -348,9 +375,11 @@ private HBox getDecreaseScaleHBox() { HBox hb = new HBox(); - final TextField tf = TextFieldBuilder.create().text("0").id(DECREASE_SCALE_TEXT_FIELD_ID).build(); + final TextField tf = new TextField("0"); + tf.setId(DECREASE_SCALE_TEXT_FIELD_ID); Label label = new Label(" of node on position "); - Button increaseScaleButton = ButtonBuilder.create().id(DECREASE_SCALE_BUTTON_ID).text("Decrease scale").build(); + Button increaseScaleButton = new Button("Decrease scale"); + increaseScaleButton.setId(DECREASE_SCALE_BUTTON_ID); increaseScaleButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { Node content = (Node) ((ListView) testedControl).getItems().get(Integer.parseInt(tf.getText())); @@ -371,7 +400,9 @@ } private TextField getNewTextField() { - return TextFieldBuilder.create().id("CONTENT_TEXT_FIELD_" + (textFieldsCounter++) + "_ID").build(); + TextField tf = new TextField(); + tf.setId("CONTENT_TEXT_FIELD_" + (textFieldsCounter++) + "_ID"); + return tf; } } } --- old/functional/ControlsTests/src/javafx/scene/control/test/ScrollPane/NewScrollPaneApp.java 2016-12-22 11:26:19.952987752 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/ScrollPane/NewScrollPaneApp.java 2016-12-22 11:26:19.900987251 +0300 @@ -113,14 +113,13 @@ public ScrollPaneScene() { super("ScrollPane", 800, 600); - - prepareScene(); } @Override protected final void prepareScene() { Utils.addBrowser(this); - testedScrollPane = ScrollPaneBuilder.create().id(TESTED_SCROLLPANE_ID).build(); + testedScrollPane = new ScrollPane(); + testedScrollPane.setId(TESTED_SCROLLPANE_ID); final Node content = setCustomContent(customContentHeight, customContentWidth); final ContentMotion cm = new ContentMotion(); @@ -136,7 +135,8 @@ testedScrollPane.setPrefViewportHeight(scrollPaneHeight); } - Button changeContentButton = ButtonBuilder.create().id(CHANGE_CONTENT_BUTTON_ID).text("ChangeContent").build(); + Button changeContentButton = new Button("ChangeContent"); + changeContentButton.setId(CHANGE_CONTENT_BUTTON_ID); changeContentButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { changeContent(); @@ -144,7 +144,8 @@ } }); - Button addPrefWidthAndHeightButton = ButtonBuilder.create().id(ADD_SIZE_BUTTON_ID).text("Add pref sizes").build(); + Button addPrefWidthAndHeightButton = new Button("Add pref sizes"); + addPrefWidthAndHeightButton.setId(ADD_SIZE_BUTTON_ID); addPrefWidthAndHeightButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { tb.addDoublePropertyLine(testedScrollPane.prefWidthProperty(), -100, 200, 100); @@ -152,7 +153,8 @@ } }); - Button setTextAreaAsContentButton = ButtonBuilder.create().id(CHANGE_CONTENT_TO_RESIZABLE_BUTTON_ID).text("Set blue pane as content").build(); + Button setTextAreaAsContentButton = new Button("Set blue pane as content"); + setTextAreaAsContentButton.setId(CHANGE_CONTENT_TO_RESIZABLE_BUTTON_ID); setTextAreaAsContentButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { setResizableContent(); @@ -162,35 +164,40 @@ } }); - Button setCustomContentButton = ButtonBuilder.create().id(CHANGE_CONTENT_TO_CUSTOM_BUTTON_ID).text("Set custom content").build(); + Button setCustomContentButton = new Button("Set custom content"); + setCustomContentButton.setId(CHANGE_CONTENT_TO_CUSTOM_BUTTON_ID); setCustomContentButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { setCustomContent(); } }); - Button buttonStart = ButtonBuilder.create().id(START_MOTION_BUTTON_ID).text("Start motion").build(); + Button buttonStart = new Button("Start motion"); + buttonStart.setId(START_MOTION_BUTTON_ID); buttonStart.setOnAction(new EventHandler() { public void handle(ActionEvent t) { cm.getTimeline().play(); } }); - Button rotateButton = ButtonBuilder.create().id(ROTATE_BUTTON_ID).text("Rotate on 30deg").build(); + Button rotateButton = new Button("Rotate on 30deg"); + rotateButton.setId(ROTATE_BUTTON_ID); rotateButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { content.setRotate(content.getRotate() + 30); } }); - Button rotateScrollPaneButton = ButtonBuilder.create().id(ROTATE_SCROLLPANE_BUTTON_ID).text("Rotate scrollpane on 30deg").build(); + Button rotateScrollPaneButton = new Button("Rotate scrollpane on 30deg"); + rotateScrollPaneButton.setId(ROTATE_SCROLLPANE_BUTTON_ID); rotateScrollPaneButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { testedScrollPane.setRotate(testedScrollPane.getRotate() + 30); } }); - Button increaseScaleButton = ButtonBuilder.create().id(INCREASE_SCALE_BUTTON_ID).text("Increase scale").build(); + Button increaseScaleButton = new Button("Increase scale"); + increaseScaleButton.setId(INCREASE_SCALE_BUTTON_ID); increaseScaleButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { content.setScaleX(content.getScaleX() + 0.15); @@ -198,7 +205,8 @@ } }); - Button decreaseScaleButton = ButtonBuilder.create().id(DECREASE_SCALE_BUTTON_ID).text("Decrease scale").build(); + Button decreaseScaleButton = new Button("Decrease scale"); + decreaseScaleButton.setId(DECREASE_SCALE_BUTTON_ID); decreaseScaleButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { content.setScaleX(content.getScaleX() - 0.15); @@ -206,7 +214,8 @@ } }); - Button increaseScrollPaneScaleButton = ButtonBuilder.create().id(INCREASE_SCROLLPANE_SCALE_BUTTON_ID).text("Increase ScrollPane scale").build(); + Button increaseScrollPaneScaleButton = new Button("Increase ScrollPane scale"); + increaseScrollPaneScaleButton.setId(INCREASE_SCROLLPANE_SCALE_BUTTON_ID); increaseScrollPaneScaleButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { testedScrollPane.setScaleX(testedScrollPane.getScaleX() + 0.15); @@ -214,7 +223,8 @@ } }); - Button decreaseScrollPaneScaleButton = ButtonBuilder.create().id(DECREASE_SCROLLPANE_SCALE_BUTTON_ID).text("Decrease ScrollPane scale").build(); + Button decreaseScrollPaneScaleButton = new Button("Decrease ScrollPane scale"); + decreaseScrollPaneScaleButton.setId(DECREASE_SCROLLPANE_SCALE_BUTTON_ID); decreaseScrollPaneScaleButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { testedScrollPane.setScaleX(testedScrollPane.getScaleX() - 0.15); @@ -222,7 +232,8 @@ } }); - Button resetButton = ButtonBuilder.create().id(RESET_BUTTON_ID).text("Reset").build(); + Button resetButton = new Button("Reset"); + resetButton.setId(RESET_BUTTON_ID); resetButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { HBox hb = (HBox) getRoot(); @@ -246,8 +257,12 @@ } private Node getAddGridPaneForm() { - final TextField dimension = TextFieldBuilder.create().id(GRID_DIMENSION_TEXTFIELD_ID).promptText("int-dimension").maxWidth(50).build(); - Button addButton = ButtonBuilder.create().id(ADD_GRID_BUTTON_ID).text("Add grid").build(); + final TextField dimension = new TextField(); + dimension.setId(GRID_DIMENSION_TEXTFIELD_ID); + dimension.setPromptText("int-dimension"); + dimension.setMaxWidth(50); + Button addButton = new Button("Add grid"); + addButton.setId(ADD_GRID_BUTTON_ID); addButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { int c = Integer.parseInt(dimension.getText()); @@ -256,7 +271,11 @@ for (int i = 0; i < c; i++) { for (int j = 0; j < c; j++) { final String name = "B-" + String.valueOf(i) + "-" + String.valueOf(j); - gridPane.add(ButtonBuilder.create().text(name).id(name).minHeight(10 * i).minWidth(10 * j).build(), i, j); + Button temp = new Button(name); + temp.setId(name); + temp.setMinHeight(10 * i); + temp.setMinWidth(10 * j); + gridPane.add(temp, i, j); } } testedScrollPane.setContent(gridPane); @@ -291,18 +310,23 @@ private void changeContent() { VBox vb = new VBox(); - Button button = ButtonBuilder.create().id(CONTENT_BUTTON).text("Press me").build(); - final TextField tf1 = TextFieldBuilder.create().id(CONTENT_TEXT_FIELD_ID).text("0").build(); + Button button = new Button("Press me"); + button.setId(CONTENT_BUTTON); + final TextField tf1 = new TextField("0"); + tf1.setId(CONTENT_TEXT_FIELD_ID); button.setOnAction(new EventHandler() { public void handle(ActionEvent t) { tf1.setText(String.valueOf(Integer.parseInt(tf1.getText()) + 1)); } }); - TextArea tf2 = TextAreaBuilder.create().prefHeight(100).id(CONTENT_TEXT_AREA_ID).build(); + TextArea tf2 = new TextArea(); + tf2.setPrefHeight(100); + tf2.setId(CONTENT_TEXT_AREA_ID); for (int i = 0; i < 15; i++) { tf2.appendText("text" + i + "\n"); } - Button empty = ButtonBuilder.create().text("This is empty-action button").id(WITHOUT_ACTION_BUTTON).build(); + Button empty = new Button("This is empty-action button"); + empty.setId(WITHOUT_ACTION_BUTTON); vb.getChildren().addAll(button, tf1, tf2, empty); vb.setStyle("-fx-border-color: blue;"); --- old/functional/ControlsTests/src/javafx/scene/control/test/ToggleButtonNewApp.java 2016-12-22 11:26:20.152989681 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/ToggleButtonNewApp.java 2016-12-22 11:26:20.100989180 +0300 @@ -31,14 +31,10 @@ import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; -import javafx.scene.control.ButtonBuilder; import javafx.scene.control.CheckBox; -import javafx.scene.control.CheckBoxBuilder; import javafx.scene.control.Label; -import javafx.scene.control.LabelBuilder; -import javafx.scene.control.RadioButtonBuilder; +import javafx.scene.control.RadioButton; import javafx.scene.control.ToggleButton; -import javafx.scene.control.ToggleButtonBuilder; import javafx.scene.control.ToggleGroup; import javafx.scene.input.MouseEvent; import javafx.scene.layout.HBox; @@ -80,21 +76,45 @@ ToggleButton toggleButton1; ToggleButton toggleButton2; - CheckBox checkBox1 = CheckBoxBuilder.create().wrapText(true).text("Unidirectionally binded to\ntoggle button 1 selection property").id(CHECK_BOX_LISTENING_1_ID).build(); - CheckBox checkBox2 = CheckBoxBuilder.create().wrapText(true).text("Unidirectionally binded to\ntoggle button 2 selection property").id(CHECK_BOX_LISTENING_2_ID).build(); - CheckBox checkBox3 = CheckBoxBuilder.create().wrapText(true).text("This check box is bidirectionally binded\nto Toggle Button 1 selection property").id(CHECK_BOX_SETTING_1_BIDIR_ID).build(); - CheckBox checkBox4 = CheckBoxBuilder.create().wrapText(true).text("This check box unidirectionally sets\ntoggle button 2 selection property").id(CHECK_BOX_SETTING_2_UNIDIR_ID).build(); + CheckBox checkBox1; + CheckBox checkBox2; + CheckBox checkBox3; + CheckBox checkBox4; ToggleGroup toggleGroup = new ToggleGroup(); - ToggleButton bindingsSettingButton = ToggleButtonBuilder.create().text("State: Unbinded").id(BINDING_SET_TOGGLE_BUTTON_ID).build(); - ToggleButton groupingButton = ToggleButtonBuilder.create().text("State: Ungrouped").id(GROUPING_TOGGLE_BUTTON_ID).build(); - ToggleButton testedControlChangeButton = ToggleButtonBuilder.create().text("Control: radio button").id(SETTING_CONTROL_TOGGLE_BUTTON_ID).build(); - Button resetButton = ButtonBuilder.create().text("Reset state").id(RESET_BUTTON_ID).build(); - Label mouseEventsLogger = LabelBuilder.create().text("0").id(MOUSE_EVENTS_LOGGER_LABEL_ID).build(); + ToggleButton bindingsSettingButton; + ToggleButton groupingButton; + ToggleButton testedControlChangeButton; + Button resetButton; + Label mouseEventsLogger; VBox vb1 = new VBox(); public ToggleButtonNewAppScene() { super(new HBox(), 800, 320); + checkBox1 = new CheckBox("Unidirectionally binded to\ntoggle button 1 selection property"); + checkBox1.setWrapText(true); + checkBox1.setId(CHECK_BOX_LISTENING_1_ID); + checkBox2 = new CheckBox("Unidirectionally binded to\ntoggle button 2 selection property"); + checkBox2.setWrapText(true); + checkBox2.setId(CHECK_BOX_LISTENING_2_ID); + checkBox3 = new CheckBox("This check box is bidirectionally binded\nto Toggle Button 1 selection property"); + checkBox3.setWrapText(true); + checkBox3.setId(CHECK_BOX_SETTING_1_BIDIR_ID); + checkBox4 = new CheckBox("This check box unidirectionally sets\ntoggle button 2 selection property"); + checkBox4.setWrapText(true); + checkBox4.setId(CHECK_BOX_SETTING_2_UNIDIR_ID); + + bindingsSettingButton = new ToggleButton("State: Unbinded"); + bindingsSettingButton.setId(BINDING_SET_TOGGLE_BUTTON_ID); + groupingButton = new ToggleButton("State: Ungrouped"); + groupingButton.setId(GROUPING_TOGGLE_BUTTON_ID); + testedControlChangeButton = new ToggleButton("Control: radio button"); + testedControlChangeButton.setId(SETTING_CONTROL_TOGGLE_BUTTON_ID); + resetButton = new Button("Reset state"); + resetButton.setId(RESET_BUTTON_ID); + mouseEventsLogger = new Label("0"); + mouseEventsLogger.setId(MOUSE_EVENTS_LOGGER_LABEL_ID); + setControl(ControlType.RADIO_BUTTON); addButtonsListeners(); @@ -131,11 +151,15 @@ private void setControl(ControlType type) { if (type == ControlType.RADIO_BUTTON) { - toggleButton1 = RadioButtonBuilder.create().text("Radio button 1").id(TOGGLE_BUTTON_1_ID).build(); - toggleButton2 = RadioButtonBuilder.create().text("Radio button 2").id(TOGGLE_BUTTON_2_ID).build(); + toggleButton1 = new RadioButton("Radio button 1"); + toggleButton1.setId(TOGGLE_BUTTON_1_ID); + toggleButton2 = new RadioButton("Radio button 2"); + toggleButton2.setId(TOGGLE_BUTTON_2_ID); } else { - toggleButton1 = ToggleButtonBuilder.create().text("Toggle button 1").id(TOGGLE_BUTTON_1_ID).build(); - toggleButton2 = ToggleButtonBuilder.create().text("Toggle button 2").id(TOGGLE_BUTTON_2_ID).build(); + toggleButton1 = new ToggleButton("Toggle button 1"); + toggleButton1.setId(TOGGLE_BUTTON_1_ID); + toggleButton2 = new ToggleButton("Toggle button 2"); + toggleButton2.setId(TOGGLE_BUTTON_2_ID); } vb1.getChildren().clear(); --- old/functional/ControlsTests/src/javafx/scene/control/test/accordion/NewAccordionApp.java 2016-12-22 11:26:20.344991533 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/accordion/NewAccordionApp.java 2016-12-22 11:26:20.296991070 +0300 @@ -1,150 +1,154 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.Accordion; - -import javafx.scene.control.test.utils.ptables.TabPaneWithControl; -import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.NodesChoserFactory; -import javafx.scene.control.test.utils.ptables.NodeControllerFactory; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.geometry.Insets; -import javafx.scene.Node; -import javafx.scene.Scene; -import javafx.scene.control.*; -import javafx.scene.control.test.utils.*; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Pane; -import javafx.scene.layout.VBox; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class NewAccordionApp extends InteroperabilityApp { - - public final static String TESTED_ACCORDION_ID = "TESTED_ACCORDION_ID"; - public final static String RESET_BUTTON_ID = "RESET_ACCORDION_BUTTON_ID"; - public final String ACCORDION_ADD_INDEX_TEXT_FIELD_ID = "ACCORDION_ADD_INDEX_TEXT_FIELD_ID"; - - public static void main(String[] args) { - Utils.launch(NewAccordionApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "AccordionTestApp"); - return new NewAccordionApp.AccordionScene(); - } - - class AccordionScene extends Scene { - - //VBox which contain tested Accordion. - Pane pane; - //Accordion to be tested. - Accordion testedAccordion; - - public AccordionScene() { - super(new HBox(), 800, 600); - - prepareScene(); - } - - private void prepareScene() { - pane = new Pane(); - testedAccordion = AccordionBuilder.create().id(TESTED_ACCORDION_ID).build(); - - PropertiesTable tb = new PropertiesTable(testedAccordion); - PropertyTablesFactory.explorePropertiesList(testedAccordion, tb); - - final TabPaneWithControl tabPane = new TabPaneWithControl("Accordion", tb); - - final TextField tf = TextFieldBuilder.create().id(ACCORDION_ADD_INDEX_TEXT_FIELD_ID).text("0").prefWidth(40).build(); - - HBox nodeshb = new NodesChoserFactory("Add!", new NodesChoserFactory.NodeAction() { - - @Override - public void execute(Node node) { - TitledPane tp = new TitledPane(node.getClass().getSimpleName(), node); - testedAccordion.getPanes().add(Integer.parseInt(tf.getText()), tp); - tabPane.addPropertiesTable(node.getClass().getSimpleName(), NodeControllerFactory.createFullController(node, tabPane)); - tabPane.addPropertiesTable(tp.getClass().getSimpleName(), NodeControllerFactory.createFullController(tp, tabPane)); - } - }, tf); - - pane.setMinSize(220, 220); - pane.setPrefSize(220, 220); - pane.setStyle("-fx-border-color : red;"); - pane.getChildren().add(testedAccordion); - - VBox vb = new VBox(); - vb.setSpacing(5); - - HBox hb = (HBox) getRoot(); - hb.setPadding(new Insets(5, 5, 5, 5)); - hb.setStyle("-fx-border-color : green;"); - - Button resetButton = ButtonBuilder.create().id(RESET_BUTTON_ID).text("Reset").build(); - resetButton.setOnAction(new EventHandler() { - - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareScene(); - } - }); - - final ToggleButton compactStateToggle = new ToggleButton("Compact"); - compactStateToggle.setSelected(true); - compactStateToggle.selectedProperty().addListener(new ChangeListener() { - - public void changed(ObservableValue ov, Boolean t, Boolean t1) { - if (t1) { - compactStateToggle.setText("Compact"); - pane.setMinSize(220, 220); - pane.setPrefSize(220, 220); - AccordionScene.this.getWindow().setWidth(1200); - AccordionScene.this.getWindow().setHeight(700); - } else { - compactStateToggle.setText("Free"); - pane.setMinSize(600, 600); - pane.setPrefSize(600, 600); - AccordionScene.this.getWindow().setWidth(800); - AccordionScene.this.getWindow().setHeight(600); - } - } - }); - - - vb.getChildren().addAll(new Label("Pane with tested Accordion"), pane, resetButton, compactStateToggle, nodeshb); - - hb.getChildren().addAll(vb, tabPane); - } - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.Accordion; + +import javafx.scene.control.test.utils.ptables.TabPaneWithControl; +import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.NodesChoserFactory; +import javafx.scene.control.test.utils.ptables.NodeControllerFactory; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.geometry.Insets; +import javafx.scene.Node; +import javafx.scene.Scene; +import javafx.scene.control.*; +import javafx.scene.control.test.utils.*; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class NewAccordionApp extends InteroperabilityApp { + + public final static String TESTED_ACCORDION_ID = "TESTED_ACCORDION_ID"; + public final static String RESET_BUTTON_ID = "RESET_ACCORDION_BUTTON_ID"; + public final String ACCORDION_ADD_INDEX_TEXT_FIELD_ID = "ACCORDION_ADD_INDEX_TEXT_FIELD_ID"; + + public static void main(String[] args) { + Utils.launch(NewAccordionApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "AccordionTestApp"); + return new NewAccordionApp.AccordionScene(); + } + + class AccordionScene extends Scene { + + //VBox which contain tested Accordion. + Pane pane; + //Accordion to be tested. + Accordion testedAccordion; + + public AccordionScene() { + super(new HBox(), 800, 600); + + prepareScene(); + } + + private void prepareScene() { + pane = new Pane(); + testedAccordion = new Accordion(); + testedAccordion.setId(TESTED_ACCORDION_ID); + + PropertiesTable tb = new PropertiesTable(testedAccordion); + PropertyTablesFactory.explorePropertiesList(testedAccordion, tb); + + final TabPaneWithControl tabPane = new TabPaneWithControl("Accordion", tb); + + final TextField tf = new TextField("0"); + tf.setId(ACCORDION_ADD_INDEX_TEXT_FIELD_ID); + tf.setPrefWidth(40); + + HBox nodeshb = new NodesChoserFactory("Add!", new NodesChoserFactory.NodeAction() { + + @Override + public void execute(Node node) { + TitledPane tp = new TitledPane(node.getClass().getSimpleName(), node); + testedAccordion.getPanes().add(Integer.parseInt(tf.getText()), tp); + tabPane.addPropertiesTable(node.getClass().getSimpleName(), NodeControllerFactory.createFullController(node, tabPane)); + tabPane.addPropertiesTable(tp.getClass().getSimpleName(), NodeControllerFactory.createFullController(tp, tabPane)); + } + }, tf); + + pane.setMinSize(220, 220); + pane.setPrefSize(220, 220); + pane.setStyle("-fx-border-color : red;"); + pane.getChildren().add(testedAccordion); + + VBox vb = new VBox(); + vb.setSpacing(5); + + HBox hb = (HBox) getRoot(); + hb.setPadding(new Insets(5, 5, 5, 5)); + hb.setStyle("-fx-border-color : green;"); + + Button resetButton = new Button("Reset"); + resetButton.setId(RESET_BUTTON_ID); + resetButton.setOnAction(new EventHandler() { + + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareScene(); + } + }); + + final ToggleButton compactStateToggle = new ToggleButton("Compact"); + compactStateToggle.setSelected(true); + compactStateToggle.selectedProperty().addListener(new ChangeListener() { + + public void changed(ObservableValue ov, Boolean t, Boolean t1) { + if (t1) { + compactStateToggle.setText("Compact"); + pane.setMinSize(220, 220); + pane.setPrefSize(220, 220); + AccordionScene.this.getWindow().setWidth(1200); + AccordionScene.this.getWindow().setHeight(700); + } else { + compactStateToggle.setText("Free"); + pane.setMinSize(600, 600); + pane.setPrefSize(600, 600); + AccordionScene.this.getWindow().setWidth(800); + AccordionScene.this.getWindow().setHeight(600); + } + } + }); + + + vb.getChildren().addAll(new Label("Pane with tested Accordion"), pane, resetButton, compactStateToggle, nodeshb); + + hb.getChildren().addAll(vb, tabPane); + } + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/chart/apps/NewAreaChartApp.java 2016-12-22 11:26:20.528993308 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/chart/apps/NewAreaChartApp.java 2016-12-22 11:26:20.480992844 +0300 @@ -1,301 +1,328 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.chart.apps; - -import java.util.Arrays; -import java.util.Comparator; -import java.util.Iterator; -import java.util.Random; -import javafx.beans.property.DoubleProperty; -import javafx.beans.property.SimpleDoubleProperty; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.event.ActionEvent; -import javafx.event.Event; -import javafx.event.EventHandler; -import javafx.scene.Scene; -import javafx.scene.chart.AreaChart; -import javafx.scene.chart.NumberAxis; -import javafx.scene.chart.XYChart; -import javafx.scene.chart.XYChart.Series; -import javafx.scene.control.*; -import static javafx.scene.control.test.chart.apps.CommonFunctions.*; -import javafx.scene.control.test.utils.CommonPropertiesScene; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.TabPaneWithControl; -import javafx.scene.layout.HBox; -import javafx.scene.layout.VBox; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class NewAreaChartApp extends InteroperabilityApp implements ChartIDsInterface { - - public final static String REMOVE_ITEM_POS_TEXT_FIELD_ID = "REMOVE_ITEM_POS_TEXT_FIELD_ID"; - public final static String REMOVE_BUTTON_ID = "REMOVE_BUTTON_ID"; - public final static String ADD_ITEM_TEXT_FIELD_ID = "ADD_ITEM_TEXT_FIELD_ID"; - public final static String ADD_ITEM_POSITION_TEXT_FIELD_ID = "ADD_ITEM_POSITION_TEXT_FIELD_ID"; - public final static String ADD_ITEM_BUTTON_ID = "ADD_ITEM_BUTTON_ID"; - public final static String REMOVE_AREA_POS_TEXT_FIELD_ID = "REMOVE_AREA_POS_TEXT_FIELD_ID"; - public final static String REMOVE_INDEX_TEXT_FIELD_ID = "REMOVE_INDEX_TEXT_FIELD_ID"; - public final static String ADD_AREA_POS_TEXT_FIELD_ID = "ADD_AREA_POS_TEXT_FIELD_ID"; - public final static String ADD_INDEX_TEXT_FIELD_ID = "ADD_INDEX_TEXT_FIELD_ID"; - public final static String ADD_VALUE_TEXT_FIELD_ID = "ADD_VALUE_TEXT_FIELD_ID"; - - public static void main(String[] args) { - Utils.launch(NewAreaChartApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "AreaChartTestApp"); - return new NewAreaChartApp.AreaChartScene(); - } - - class AreaChartScene extends CommonPropertiesScene { - - //AreaChart to be tested. - AreaChart testedAreaChart; - NumberAxis axis1; - NumberAxis axis2; - TabPaneWithControl pane; - - public AreaChartScene() { - super("AreaChart", 1300, 800); - } - - @Override - final protected void prepareScene() { - Utils.addBrowser(this); - - axis1 = new NumberAxis(0, 100, 10); - axis2 = new NumberAxis(0, 100, 10); - testedAreaChart = getNewChart(); - testedAreaChart.setId(TESTED_CHART_ID); - - Button hardResetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Hard reset").build(); - hardResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareMainSceneStructure(); - prepareScene(); - } - }); - - Button softResetButton = ButtonBuilder.create().id(SOFT_RESET_BUTTON_ID).text("Soft reset").build(); - softResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - //throw new UnsupportedOperationException("Not supported yet."); - } - }); - - HBox resetButtonsHBox = new HBox(); - resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); - - VBox vb = new VBox(5); - vb.getChildren().addAll(resetButtonsHBox, getAddAreaHBox(), getAddPointToDataDialog(), getRemovePointFromDataDialog(), getRemoveDataDialog()); - - pane = getPaneFor(testedAreaChart, CHART_TAB_NAME, axis1, AXIS_1_TAB_NAME, axis2, AXIS_2_TAB_NAME); - - setTestedControlContainerSize(500, 500); - setTestedControl(testedAreaChart); - setPropertiesContent(pane); - setControllersContent(vb); - } - - public HBox getAddPointToDataDialog() { - HBox hb = new HBox(); - - Label lb1 = new Label("To area"); - final TextField tf1 = TextFieldBuilder.create().text("0").prefWidth(50).id(ADD_AREA_POS_TEXT_FIELD_ID).build(); - - Label lb2 = new Label("to index"); - final TextField tf2 = TextFieldBuilder.create().text("0").prefWidth(50).id(ADD_INDEX_TEXT_FIELD_ID).build(); - - Label lb3 = new Label("value"); - final TextField tf3 = TextFieldBuilder.create().text("0").prefWidth(50).id(ADD_VALUE_TEXT_FIELD_ID).build(); - - Button bt = ButtonBuilder.create().text("add point!").id(REMOVE_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int area = Integer.parseInt(tf1.getText()); - int point = Integer.parseInt(tf2.getText()); - double value = Double.parseDouble(tf3.getText()); - - XYChart.Data newData = new XYChart.Data(); - newData.setXValue((((Double) ((XYChart.Data) (((Series) testedAreaChart.getData().get(area)).getData().get(point))).getXValue()) + ((Double) ((XYChart.Data) (((Series) testedAreaChart.getData().get(area)).getData().get(point - 1))).getXValue())) / 2); - newData.setYValue(value); - - ((Series) testedAreaChart.getData().get(area)).getData().add(point, newData); - } - }); - hb.getChildren().addAll(lb1, tf1, lb2, tf2, lb3, tf3, bt); - return hb; - } - - public HBox getRemovePointFromDataDialog() { - HBox hb = new HBox(); - - Label lb1 = new Label("From area"); - final TextField tf1 = TextFieldBuilder.create().text("0").prefWidth(50).id(REMOVE_AREA_POS_TEXT_FIELD_ID).build(); - - Label lb2 = new Label("From index"); - final TextField tf2 = TextFieldBuilder.create().text("0").prefWidth(50).id(REMOVE_INDEX_TEXT_FIELD_ID).build(); - - Button bt = ButtonBuilder.create().text("remove point!").id(REMOVE_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int area = Integer.parseInt(tf1.getText()); - int point = Integer.parseInt(tf2.getText()); - ((Series) testedAreaChart.getData().get(area)).getData().remove(point); - } - }); - hb.getChildren().addAll(lb1, tf1, lb2, tf2, bt); - return hb; - } - - public HBox getRemoveDataDialog() { - HBox hb = new HBox(); - Label lb = new Label("From index"); - final TextField tf = TextFieldBuilder.create().text("0").prefWidth(50).id(REMOVE_AREA_INDEX_TEXTFIELD_ID).build(); - Button bt = ButtonBuilder.create().text("remove area!").id(REMOVE_AREA_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int index = Integer.parseInt(tf.getText()); - testedAreaChart.getData().remove(index); - } - }); - hb.getChildren().addAll(lb, tf, bt); - return hb; - } - - public HBox getAddAreaHBox() { - HBox hb = new HBox(); - Label lb = new Label("Add series named "); - final TextField tf = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_NAME_TEXTFIELD_ID).build(); - - Label minLabel = new Label(" minX "); - final TextField minText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_MIN_VALUE_TEXTFIELD_ID).build(); - - Label maxLabel = new Label(" maxX "); - final TextField maxText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_MAX_VALUE_TEXTFIELD_ID).build(); - - Label amountLabel = new Label(" with "); - final TextField amountText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_DOTS_COUNT_TEXTFIELD_ID).build(); - - Button bt = ButtonBuilder.create().text("add area!").id(ADD_SERIES_COMMAND_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - String serieName = tf.getText(); - double min = Double.parseDouble(minText.getText()); - double max = Double.parseDouble(maxText.getText()); - int amount = Integer.parseInt(amountText.getText()); - - ObservableList list = FXCollections.observableArrayList(); - - for (int i = 0; i < amount; i++) { - XYChart.Data newData = new XYChart.Data(); - newData.setXValue(new Random().nextDouble() * (max - min) + min); - newData.setYValue(new Random().nextDouble() * (max - min) + min); - list.add(newData); - } - Object[] array = list.toArray(); - Arrays.sort(array, new Comparator() { - public int compare(Object t, Object t1) { - return (int) Math.round(((Double) ((XYChart.Data) t).getXValue()) - ((Double) ((XYChart.Data) t1).getXValue())); - } - }); - - XYChart.Series serie = new XYChart.Series(serieName, FXCollections.observableArrayList(array)); - - testedAreaChart.getData().add(serie); - pane.addPropertiesTable(serieName, getTableForProperty(serie, min, max).getVisualRepresentation()); - } - }); - hb.getChildren().addAll(lb, tf, minLabel, minText, maxLabel, maxText, amountLabel, amountText, bt); - return hb; - } - - protected PropertiesTable getTableForProperty(XYChart.Series serie, double min, double max) { - PropertiesTable table = new PropertiesTable(serie); - - table.addSimpleListener(serie.chartProperty(), serie); - table.addSimpleListener(serie.nameProperty(), serie); - table.addSimpleListener(serie.dataProperty(), serie); - - for (Iterator it = serie.getData().iterator(); it.hasNext();) { - final XYChart.Data data = (XYChart.Data) it.next(); - - final DoubleProperty intermediateX = new SimpleDoubleProperty(null, "XValue"); - final DoubleProperty intermediateY = new SimpleDoubleProperty(null, "YValue"); - - data.XValueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - if (!intermediateX.isBound()) { - intermediateX.setValue((Double) data.XValueProperty().getValue()); - } - } - }); - - data.YValueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - if (!intermediateY.isBound()) { - intermediateY.setValue((Double) data.YValueProperty().getValue()); - } - } - }); - - intermediateX.addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - data.setXValue(t1); - } - }); - - intermediateY.addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - data.setYValue(t1); - } - }); - - table.addDoublePropertyLine(intermediateX, min, max, (Double) data.getXValue(), data); - table.addDoublePropertyLine(intermediateY, min, max, (Double) data.getYValue(), data); - } - - return table; - } - - public AreaChart getNewChart() { - AreaChart chart = new AreaChart(axis1, axis2); - chart.setTitle("AreaChart"); - chart.setStyle("-fx-border-color: darkgray;"); - return chart; - } - } +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.chart.apps; + +import java.util.Arrays; +import java.util.Comparator; +import java.util.Iterator; +import java.util.Random; +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.SimpleDoubleProperty; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.event.ActionEvent; +import javafx.event.Event; +import javafx.event.EventHandler; +import javafx.scene.Scene; +import javafx.scene.chart.AreaChart; +import javafx.scene.chart.NumberAxis; +import javafx.scene.chart.XYChart; +import javafx.scene.chart.XYChart.Series; +import javafx.scene.control.*; +import static javafx.scene.control.test.chart.apps.ChartIDsInterface.HARD_RESET_BUTTON_ID; +import static javafx.scene.control.test.chart.apps.CommonFunctions.*; +import javafx.scene.control.test.utils.CommonPropertiesScene; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.TabPaneWithControl; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class NewAreaChartApp extends InteroperabilityApp implements ChartIDsInterface { + + public final static String REMOVE_ITEM_POS_TEXT_FIELD_ID = "REMOVE_ITEM_POS_TEXT_FIELD_ID"; + public final static String REMOVE_BUTTON_ID = "REMOVE_BUTTON_ID"; + public final static String ADD_ITEM_TEXT_FIELD_ID = "ADD_ITEM_TEXT_FIELD_ID"; + public final static String ADD_ITEM_POSITION_TEXT_FIELD_ID = "ADD_ITEM_POSITION_TEXT_FIELD_ID"; + public final static String ADD_ITEM_BUTTON_ID = "ADD_ITEM_BUTTON_ID"; + public final static String REMOVE_AREA_POS_TEXT_FIELD_ID = "REMOVE_AREA_POS_TEXT_FIELD_ID"; + public final static String REMOVE_INDEX_TEXT_FIELD_ID = "REMOVE_INDEX_TEXT_FIELD_ID"; + public final static String ADD_AREA_POS_TEXT_FIELD_ID = "ADD_AREA_POS_TEXT_FIELD_ID"; + public final static String ADD_INDEX_TEXT_FIELD_ID = "ADD_INDEX_TEXT_FIELD_ID"; + public final static String ADD_VALUE_TEXT_FIELD_ID = "ADD_VALUE_TEXT_FIELD_ID"; + + public static void main(String[] args) { + Utils.launch(NewAreaChartApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "AreaChartTestApp"); + return new NewAreaChartApp.AreaChartScene(); + } + + class AreaChartScene extends CommonPropertiesScene { + + //AreaChart to be tested. + AreaChart testedAreaChart; + NumberAxis axis1; + NumberAxis axis2; + TabPaneWithControl pane; + + public AreaChartScene() { + super("AreaChart", 1300, 800); + } + + @Override + final protected void prepareScene() { + Utils.addBrowser(this); + + axis1 = new NumberAxis(0, 100, 10); + axis2 = new NumberAxis(0, 100, 10); + testedAreaChart = getNewChart(); + testedAreaChart.setId(TESTED_CHART_ID); + + Button hardResetButton = new Button("Hard reset"); + hardResetButton.setId(HARD_RESET_BUTTON_ID); + hardResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareMainSceneStructure(); + prepareScene(); + } + }); + + Button softResetButton = new Button("Soft reset"); + softResetButton.setId(SOFT_RESET_BUTTON_ID); + softResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + //throw new UnsupportedOperationException("Not supported yet."); + } + }); + + HBox resetButtonsHBox = new HBox(); + resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); + + VBox vb = new VBox(5); + vb.getChildren().addAll(resetButtonsHBox, getAddAreaHBox(), getAddPointToDataDialog(), getRemovePointFromDataDialog(), getRemoveDataDialog()); + + pane = getPaneFor(testedAreaChart, CHART_TAB_NAME, axis1, AXIS_1_TAB_NAME, axis2, AXIS_2_TAB_NAME); + + setTestedControlContainerSize(500, 500); + setTestedControl(testedAreaChart); + setPropertiesContent(pane); + setControllersContent(vb); + } + + public HBox getAddPointToDataDialog() { + HBox hb = new HBox(); + + Label lb1 = new Label("To area"); + final TextField tf1 = new TextField("0"); + tf1.setPrefWidth(50); + tf1.setId(ADD_AREA_POS_TEXT_FIELD_ID); + + Label lb2 = new Label("to index"); + final TextField tf2 = new TextField("0"); + tf2.setPrefWidth(50); + tf2.setId(ADD_INDEX_TEXT_FIELD_ID); + + Label lb3 = new Label("value"); + final TextField tf3 = new TextField("0"); + tf3.setPrefWidth(50); + tf3.setId(ADD_VALUE_TEXT_FIELD_ID); + + Button bt = new Button("add point!"); + bt.setId(REMOVE_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int area = Integer.parseInt(tf1.getText()); + int point = Integer.parseInt(tf2.getText()); + double value = Double.parseDouble(tf3.getText()); + + XYChart.Data newData = new XYChart.Data(); + newData.setXValue((((Double) ((XYChart.Data) (((Series) testedAreaChart.getData().get(area)).getData().get(point))).getXValue()) + ((Double) ((XYChart.Data) (((Series) testedAreaChart.getData().get(area)).getData().get(point - 1))).getXValue())) / 2); + newData.setYValue(value); + + ((Series) testedAreaChart.getData().get(area)).getData().add(point, newData); + } + }); + hb.getChildren().addAll(lb1, tf1, lb2, tf2, lb3, tf3, bt); + return hb; + } + + public HBox getRemovePointFromDataDialog() { + HBox hb = new HBox(); + + Label lb1 = new Label("From area"); + final TextField tf1 = new TextField("0"); + tf1.setPrefWidth(50); + tf1.setId(REMOVE_AREA_POS_TEXT_FIELD_ID); + + Label lb2 = new Label("From index"); + final TextField tf2 = new TextField("0"); + tf2.setPrefWidth(50); + tf2.setId(REMOVE_INDEX_TEXT_FIELD_ID); + + Button bt = new Button("remove point!"); + bt.setId(REMOVE_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int area = Integer.parseInt(tf1.getText()); + int point = Integer.parseInt(tf2.getText()); + ((Series) testedAreaChart.getData().get(area)).getData().remove(point); + } + }); + hb.getChildren().addAll(lb1, tf1, lb2, tf2, bt); + return hb; + } + + public HBox getRemoveDataDialog() { + HBox hb = new HBox(); + Label lb = new Label("From index"); + final TextField tf = new TextField("0"); + tf.setPrefWidth(50); + tf.setId(REMOVE_AREA_INDEX_TEXTFIELD_ID); + Button bt = new Button("remove area!"); + bt.setId(REMOVE_AREA_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int index = Integer.parseInt(tf.getText()); + testedAreaChart.getData().remove(index); + } + }); + hb.getChildren().addAll(lb, tf, bt); + return hb; + } + + public HBox getAddAreaHBox() { + HBox hb = new HBox(); + Label lb = new Label("Add series named "); + final TextField tf = new TextField(); + tf.setPrefWidth(50); + tf.setId(ADDED_SERIES_NAME_TEXTFIELD_ID); + + Label minLabel = new Label(" minX "); + final TextField minText = new TextField(); + minText.setPrefWidth(50); + minText.setId(ADDED_SERIES_MIN_VALUE_TEXTFIELD_ID); + + Label maxLabel = new Label(" maxX "); + final TextField maxText = new TextField(); + maxText.setPrefWidth(50); + maxText.setId(ADDED_SERIES_MAX_VALUE_TEXTFIELD_ID); + + Label amountLabel = new Label(" with "); + final TextField amountText = new TextField(); + amountText.setPrefWidth(50); + amountText.setId(ADDED_SERIES_DOTS_COUNT_TEXTFIELD_ID); + + Button bt = new Button("add area!"); + bt.setId(ADD_SERIES_COMMAND_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + String serieName = tf.getText(); + double min = Double.parseDouble(minText.getText()); + double max = Double.parseDouble(maxText.getText()); + int amount = Integer.parseInt(amountText.getText()); + + ObservableList list = FXCollections.observableArrayList(); + + for (int i = 0; i < amount; i++) { + XYChart.Data newData = new XYChart.Data(); + newData.setXValue(new Random().nextDouble() * (max - min) + min); + newData.setYValue(new Random().nextDouble() * (max - min) + min); + list.add(newData); + } + Object[] array = list.toArray(); + Arrays.sort(array, new Comparator() { + public int compare(Object t, Object t1) { + return (int) Math.round(((Double) ((XYChart.Data) t).getXValue()) - ((Double) ((XYChart.Data) t1).getXValue())); + } + }); + + XYChart.Series serie = new XYChart.Series(serieName, FXCollections.observableArrayList(array)); + + testedAreaChart.getData().add(serie); + pane.addPropertiesTable(serieName, getTableForProperty(serie, min, max).getVisualRepresentation()); + } + }); + hb.getChildren().addAll(lb, tf, minLabel, minText, maxLabel, maxText, amountLabel, amountText, bt); + return hb; + } + + protected PropertiesTable getTableForProperty(XYChart.Series serie, double min, double max) { + PropertiesTable table = new PropertiesTable(serie); + + table.addSimpleListener(serie.chartProperty(), serie); + table.addSimpleListener(serie.nameProperty(), serie); + table.addSimpleListener(serie.dataProperty(), serie); + + for (Iterator it = serie.getData().iterator(); it.hasNext();) { + final XYChart.Data data = (XYChart.Data) it.next(); + + final DoubleProperty intermediateX = new SimpleDoubleProperty(null, "XValue"); + final DoubleProperty intermediateY = new SimpleDoubleProperty(null, "YValue"); + + data.XValueProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + if (!intermediateX.isBound()) { + intermediateX.setValue((Double) data.XValueProperty().getValue()); + } + } + }); + + data.YValueProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + if (!intermediateY.isBound()) { + intermediateY.setValue((Double) data.YValueProperty().getValue()); + } + } + }); + + intermediateX.addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + data.setXValue(t1); + } + }); + + intermediateY.addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + data.setYValue(t1); + } + }); + + table.addDoublePropertyLine(intermediateX, min, max, (Double) data.getXValue(), data); + table.addDoublePropertyLine(intermediateY, min, max, (Double) data.getYValue(), data); + } + + return table; + } + + public AreaChart getNewChart() { + AreaChart chart = new AreaChart(axis1, axis2); + chart.setTitle("AreaChart"); + chart.setStyle("-fx-border-color: darkgray;"); + return chart; + } + } } \ No newline at end of file --- old/functional/ControlsTests/src/javafx/scene/control/test/chart/apps/NewBarChartApp.java 2016-12-22 11:26:20.732995275 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/chart/apps/NewBarChartApp.java 2016-12-22 11:26:20.672994696 +0300 @@ -1,273 +1,290 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.chart.apps; - -import java.util.Iterator; -import java.util.Random; -import javafx.beans.property.DoubleProperty; -import javafx.beans.property.SimpleDoubleProperty; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.event.ActionEvent; -import javafx.event.Event; -import javafx.event.EventHandler; -import javafx.scene.Scene; -import javafx.scene.chart.BarChart; -import javafx.scene.chart.CategoryAxis; -import javafx.scene.chart.NumberAxis; -import javafx.scene.chart.XYChart; -import javafx.scene.control.*; -import static javafx.scene.control.test.chart.apps.CommonFunctions.*; -import javafx.scene.control.test.utils.CommonPropertiesScene; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.TabPaneWithControl; -import javafx.scene.layout.HBox; -import javafx.scene.layout.VBox; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class NewBarChartApp extends InteroperabilityApp implements ChartIDsInterface { - - public final static String REMOVE_ITEM_POS_TEXT_FIELD_ID = "REMOVE_ITEM_POS_TEXT_FIELD_ID"; - public final static String REMOVE_BUTTON_ID = "REMOVE_BUTTON_ID"; - public final static String ADD_ITEM_TEXT_FIELD_ID = "ADD_ITEM_TEXT_FIELD_ID"; - public final static String ADD_ITEM_POSITION_TEXT_FIELD_ID = "ADD_ITEM_POSITION_TEXT_FIELD_ID"; - public final static String ADD_ITEM_BUTTON_ID = "ADD_ITEM_BUTTON_ID"; - - public static void main(String[] args) { - Utils.launch(NewBarChartApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "ScatterChartTestApp"); - return new NewBarChartApp.BarChartScene(); - } - - class BarChartScene extends CommonPropertiesScene { - - //BarChart to be tested. - BarChart testedBarChart; - NumberAxis axis2; - ObservableList existingCategories; - CategoryAxis axis1; - TabPaneWithControl pane; - - public BarChartScene() { - super("BarChart", 1300, 800); - } - - @Override - final protected void prepareScene() { - Utils.addBrowser(this); - - existingCategories = FXCollections.observableArrayList(); - existingCategories.addAll("category1", "category2", "category3"); - axis1 = new CategoryAxis(existingCategories); - axis2 = new NumberAxis(0, 100, 10); - testedBarChart = getNewChart(); - testedBarChart.setId(TESTED_CHART_ID); - - Button hardResetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Hard reset").build(); - hardResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareMainSceneStructure(); - prepareScene(); - } - }); - - Button softResetButton = ButtonBuilder.create().id(SOFT_RESET_BUTTON_ID).text("Soft reset").build(); - softResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - //throw new UnsupportedOperationException("Not supported yet."); - } - }); - - HBox resetButtonsHBox = new HBox(); - resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); - - VBox vb = new VBox(5); - vb.getChildren().addAll(resetButtonsHBox, getAddItemHBox(), getRemoveDataDialog(), getAddCategoryDialog(), getRemoveCategoryDialog()); - - pane = getPaneFor(testedBarChart, CHART_TAB_NAME, axis1, AXIS_1_TAB_NAME, axis2, AXIS_2_TAB_NAME); - - setTestedControlContainerSize(500, 500); - setTestedControl(testedBarChart); - setPropertiesContent(pane); - setControllersContent(vb); - } - - public HBox getRemoveDataDialog() { - HBox hb = new HBox(); - Label lb = new Label("From position"); - final TextField tf = TextFieldBuilder.create().text("0").prefWidth(50).id(REMOVE_ITEM_POS_TEXT_FIELD_ID).build(); - Button bt = ButtonBuilder.create().text("Remove!").id(REMOVE_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int index = Integer.parseInt(tf.getText()); - testedBarChart.getData().remove(index); - } - }); - hb.getChildren().addAll(lb, tf, bt); - return hb; - } - - public HBox getRemoveCategoryDialog() { - HBox hb = new HBox(); - Label lb = new Label("From index"); - final TextField tf = TextFieldBuilder.create().text("0").prefWidth(50).build(); - Button bt = ButtonBuilder.create().text("Remove category!").build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int index = Integer.parseInt(tf.getText()); - existingCategories.remove(index); - axis1.getCategories().remove(index); - } - }); - hb.getChildren().addAll(lb, tf, bt); - return hb; - } - - public HBox getAddCategoryDialog() { - HBox hb = new HBox(); - Label lb = new Label("Category"); - final TextField tf = TextFieldBuilder.create().text("").prefWidth(50).build(); - - Label lind = new Label("to index"); - final TextField tfind = TextFieldBuilder.create().text("0").prefWidth(50).build(); - - Button bt = ButtonBuilder.create().text("Add!").build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int index = Integer.parseInt(tfind.getText()); - existingCategories.add(index, tf.getText()); - axis1.getCategories().add(index, tf.getText()); - } - }); - hb.getChildren().addAll(lb, tf, lind, tfind, bt); - return hb; - } - - public HBox getAddItemHBox() { - HBox hb = new HBox(); - Label lb = new Label("Add series named "); - final TextField tf = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_NAME_TEXTFIELD_ID).build(); - - Label minLabel = new Label(" min "); - final TextField minText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_MIN_VALUE_TEXTFIELD_ID).build(); - - Label maxLabel = new Label(" max "); - final TextField maxText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_MAX_VALUE_TEXTFIELD_ID).build(); - - Label amountLabel = new Label(" amount "); - final TextField amountText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_DOTS_COUNT_TEXTFIELD_ID).build(); - - Button bt = ButtonBuilder.create().text("Add!").id(ADD_SERIES_COMMAND_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - String serieName = tf.getText(); - double min = Double.parseDouble(minText.getText()); - double max = Double.parseDouble(maxText.getText()); - int amount = Integer.parseInt(amountText.getText()); - - ObservableList list = FXCollections.observableArrayList(); - - XYChart.Series serie = new XYChart.Series(serieName, list); - - for (int i = 0; i < amount; i++) { - XYChart.Data newData = new XYChart.Data(); - String category = existingCategories.get(new Random().nextInt(existingCategories.size())); - Double value = new Random().nextDouble() * (max - min) + min; - newData.setYValue(category); - newData.setXValue(value); - list.add(newData); - } - - testedBarChart.getData().add(serie); - pane.addPropertiesTable(serieName, getTableForProperty(serie, min, max).getVisualRepresentation()); - } - }); - hb.getChildren().addAll(lb, tf, minLabel, minText, maxLabel, maxText, amountLabel, amountText, bt); - return hb; - } - - protected PropertiesTable getTableForProperty(XYChart.Series serie, double min, double max) { - PropertiesTable table = new PropertiesTable(serie); - - table.addSimpleListener(serie.chartProperty(), serie); - table.addSimpleListener(serie.nameProperty(), serie); - table.addSimpleListener(serie.dataProperty(), serie); - - for (Iterator it = serie.getData().iterator(); it.hasNext();) { - final XYChart.Data data = (XYChart.Data) it.next(); - - final DoubleProperty intermediateX = new SimpleDoubleProperty(null, "XValue"); - final DoubleProperty intermediateY = new SimpleDoubleProperty(null, "YValue"); - - data.XValueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - intermediateX.setValue((Double) data.XValueProperty().getValue()); - } - }); - - data.YValueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - intermediateY.setValue((Double) data.YValueProperty().getValue()); - } - }); - - intermediateX.addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - data.setXValue(t1); - } - }); - - intermediateY.addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - data.setYValue(t1); - } - }); - - table.addDoublePropertyLine(intermediateY, min, max, (Double) data.getXValue(), data); - } - - return table; - } - - public BarChart getNewChart() { - BarChart chart = new BarChart(axis2, axis1); - chart.setTitle("BarChart"); - chart.setStyle("-fx-border-color: darkgray;"); - return chart; - } - } +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.chart.apps; + +import java.util.Iterator; +import java.util.Random; +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.SimpleDoubleProperty; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.event.ActionEvent; +import javafx.event.Event; +import javafx.event.EventHandler; +import javafx.scene.Scene; +import javafx.scene.chart.BarChart; +import javafx.scene.chart.CategoryAxis; +import javafx.scene.chart.NumberAxis; +import javafx.scene.chart.XYChart; +import javafx.scene.control.*; +import static javafx.scene.control.test.chart.apps.CommonFunctions.*; +import javafx.scene.control.test.utils.CommonPropertiesScene; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.TabPaneWithControl; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class NewBarChartApp extends InteroperabilityApp implements ChartIDsInterface { + + public final static String REMOVE_ITEM_POS_TEXT_FIELD_ID = "REMOVE_ITEM_POS_TEXT_FIELD_ID"; + public final static String REMOVE_BUTTON_ID = "REMOVE_BUTTON_ID"; + public final static String ADD_ITEM_TEXT_FIELD_ID = "ADD_ITEM_TEXT_FIELD_ID"; + public final static String ADD_ITEM_POSITION_TEXT_FIELD_ID = "ADD_ITEM_POSITION_TEXT_FIELD_ID"; + public final static String ADD_ITEM_BUTTON_ID = "ADD_ITEM_BUTTON_ID"; + + public static void main(String[] args) { + Utils.launch(NewBarChartApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "ScatterChartTestApp"); + return new NewBarChartApp.BarChartScene(); + } + + class BarChartScene extends CommonPropertiesScene { + + //BarChart to be tested. + BarChart testedBarChart; + NumberAxis axis2; + ObservableList existingCategories; + CategoryAxis axis1; + TabPaneWithControl pane; + + public BarChartScene() { + super("BarChart", 1300, 800); + } + + @Override + final protected void prepareScene() { + Utils.addBrowser(this); + + existingCategories = FXCollections.observableArrayList(); + existingCategories.addAll("category1", "category2", "category3"); + axis1 = new CategoryAxis(existingCategories); + axis2 = new NumberAxis(0, 100, 10); + testedBarChart = getNewChart(); + testedBarChart.setId(TESTED_CHART_ID); + + Button hardResetButton = new Button("Hard reset"); + hardResetButton.setId(HARD_RESET_BUTTON_ID); + hardResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareMainSceneStructure(); + prepareScene(); + } + }); + + Button softResetButton = new Button("Soft reset"); + softResetButton.setId(SOFT_RESET_BUTTON_ID); + softResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + //throw new UnsupportedOperationException("Not supported yet."); + } + }); + + HBox resetButtonsHBox = new HBox(); + resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); + + VBox vb = new VBox(5); + vb.getChildren().addAll(resetButtonsHBox, getAddItemHBox(), getRemoveDataDialog(), getAddCategoryDialog(), getRemoveCategoryDialog()); + + pane = getPaneFor(testedBarChart, CHART_TAB_NAME, axis1, AXIS_1_TAB_NAME, axis2, AXIS_2_TAB_NAME); + + setTestedControlContainerSize(500, 500); + setTestedControl(testedBarChart); + setPropertiesContent(pane); + setControllersContent(vb); + } + + public HBox getRemoveDataDialog() { + HBox hb = new HBox(); + Label lb = new Label("From position"); + final TextField tf = new TextField("0"); + tf.setPrefWidth(50); + tf.setId(REMOVE_ITEM_POS_TEXT_FIELD_ID); + Button bt = new Button("Remove!"); + bt.setId(REMOVE_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int index = Integer.parseInt(tf.getText()); + testedBarChart.getData().remove(index); + } + }); + hb.getChildren().addAll(lb, tf, bt); + return hb; + } + + public HBox getRemoveCategoryDialog() { + HBox hb = new HBox(); + Label lb = new Label("From index"); + final TextField tf = new TextField("0"); + tf.setPrefWidth(50); + Button bt = new Button("Remove category!"); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int index = Integer.parseInt(tf.getText()); + existingCategories.remove(index); + axis1.getCategories().remove(index); + } + }); + hb.getChildren().addAll(lb, tf, bt); + return hb; + } + + public HBox getAddCategoryDialog() { + HBox hb = new HBox(); + Label lb = new Label("Category"); + final TextField tf = new TextField(""); + tf.setPrefWidth(50); + + Label lind = new Label("to index"); + final TextField tfind = new TextField("0"); + tfind.setPrefWidth(50); + + Button bt = new Button("Add!"); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int index = Integer.parseInt(tfind.getText()); + existingCategories.add(index, tf.getText()); + axis1.getCategories().add(index, tf.getText()); + } + }); + hb.getChildren().addAll(lb, tf, lind, tfind, bt); + return hb; + } + + public HBox getAddItemHBox() { + HBox hb = new HBox(); + Label lb = new Label("Add series named "); + final TextField tf = new TextField(); + tf.setPrefWidth(50); + tf.setId(ADDED_SERIES_NAME_TEXTFIELD_ID); + + Label minLabel = new Label(" min "); + final TextField minText = new TextField(); + minText.setPrefWidth(50); + minText.setId(ADDED_SERIES_MIN_VALUE_TEXTFIELD_ID); + + Label maxLabel = new Label(" max "); + final TextField maxText = new TextField(); + maxText.setPrefWidth(50); + maxText.setId(ADDED_SERIES_MAX_VALUE_TEXTFIELD_ID); + + Label amountLabel = new Label(" amount "); + final TextField amountText = new TextField(); + amountText.setPrefWidth(50); + amountText.setId(ADDED_SERIES_DOTS_COUNT_TEXTFIELD_ID); + + Button bt = new Button("Add!"); + bt.setId(ADD_SERIES_COMMAND_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + String serieName = tf.getText(); + double min = Double.parseDouble(minText.getText()); + double max = Double.parseDouble(maxText.getText()); + int amount = Integer.parseInt(amountText.getText()); + + ObservableList list = FXCollections.observableArrayList(); + + XYChart.Series serie = new XYChart.Series(serieName, list); + + for (int i = 0; i < amount; i++) { + XYChart.Data newData = new XYChart.Data(); + String category = existingCategories.get(new Random().nextInt(existingCategories.size())); + Double value = new Random().nextDouble() * (max - min) + min; + newData.setYValue(category); + newData.setXValue(value); + list.add(newData); + } + + testedBarChart.getData().add(serie); + pane.addPropertiesTable(serieName, getTableForProperty(serie, min, max).getVisualRepresentation()); + } + }); + hb.getChildren().addAll(lb, tf, minLabel, minText, maxLabel, maxText, amountLabel, amountText, bt); + return hb; + } + + protected PropertiesTable getTableForProperty(XYChart.Series serie, double min, double max) { + PropertiesTable table = new PropertiesTable(serie); + + table.addSimpleListener(serie.chartProperty(), serie); + table.addSimpleListener(serie.nameProperty(), serie); + table.addSimpleListener(serie.dataProperty(), serie); + + for (Iterator it = serie.getData().iterator(); it.hasNext();) { + final XYChart.Data data = (XYChart.Data) it.next(); + + final DoubleProperty intermediateX = new SimpleDoubleProperty(null, "XValue"); + final DoubleProperty intermediateY = new SimpleDoubleProperty(null, "YValue"); + + data.XValueProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + intermediateX.setValue((Double) data.XValueProperty().getValue()); + } + }); + + data.YValueProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + intermediateY.setValue((Double) data.YValueProperty().getValue()); + } + }); + + intermediateX.addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + data.setXValue(t1); + } + }); + + intermediateY.addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + data.setYValue(t1); + } + }); + + table.addDoublePropertyLine(intermediateY, min, max, (Double) data.getXValue(), data); + } + + return table; + } + + public BarChart getNewChart() { + BarChart chart = new BarChart(axis2, axis1); + chart.setTitle("BarChart"); + chart.setStyle("-fx-border-color: darkgray;"); + return chart; + } + } } \ No newline at end of file --- old/functional/ControlsTests/src/javafx/scene/control/test/chart/apps/NewBubbleChartApp.java 2016-12-22 11:26:20.920997088 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/chart/apps/NewBubbleChartApp.java 2016-12-22 11:26:20.868996586 +0300 @@ -1,312 +1,335 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.chart.apps; - -import java.util.Iterator; -import java.util.Random; -import javafx.beans.property.DoubleProperty; -import javafx.beans.property.SimpleDoubleProperty; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.event.ActionEvent; -import javafx.event.Event; -import javafx.event.EventHandler; -import javafx.scene.Scene; -import javafx.scene.chart.BubbleChart; -import javafx.scene.chart.NumberAxis; -import javafx.scene.chart.XYChart; -import javafx.scene.chart.XYChart.Series; -import javafx.scene.control.*; -import static javafx.scene.control.test.chart.apps.CommonFunctions.*; -import javafx.scene.control.test.utils.CommonPropertiesScene; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.TabPaneWithControl; -import javafx.scene.layout.HBox; -import javafx.scene.layout.VBox; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class NewBubbleChartApp extends InteroperabilityApp implements ChartIDsInterface { - - public final static String REMOVE_ITEM_POS_TEXT_FIELD_ID = "REMOVE_ITEM_POS_TEXT_FIELD_ID"; - public final static String REMOVE_BUTTON_ID = "REMOVE_BUTTON_ID"; - public final static String ADD_ITEM_TEXT_FIELD_ID = "ADD_ITEM_TEXT_FIELD_ID"; - public final static String ADD_ITEM_POSITION_TEXT_FIELD_ID = "ADD_ITEM_POSITION_TEXT_FIELD_ID"; - public final static String ADD_ITEM_BUTTON_ID = "ADD_ITEM_BUTTON_ID"; - - public static void main(String[] args) { - Utils.launch(NewBubbleChartApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "BubbleChartTestApp"); - return new NewBubbleChartApp.BubbleChartScene(); - } - - class BubbleChartScene extends CommonPropertiesScene { - - //BubbleChart to be tested. - BubbleChart testedBubbleChart; - NumberAxis axis1; - NumberAxis axis2; - TabPaneWithControl pane; - - public BubbleChartScene() { - super("BubbleChart", 1300, 800); - } - - @Override - final protected void prepareScene() { - Utils.addBrowser(this); - - axis1 = new NumberAxis(0, 100, 10); - axis2 = new NumberAxis(0, 100, 10); - testedBubbleChart = getNewChart(); - testedBubbleChart.setId(TESTED_CHART_ID); - - Button hardResetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Hard reset").build(); - hardResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareMainSceneStructure(); - prepareScene(); - } - }); - - Button softResetButton = ButtonBuilder.create().id(SOFT_RESET_BUTTON_ID).text("Soft reset").build(); - softResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - //throw new UnsupportedOperationException("Not supported yet."); - } - }); - - HBox resetButtonsHBox = new HBox(); - resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); - - VBox vb = new VBox(5); - vb.getChildren().addAll(resetButtonsHBox, getAddItemHBox(), getAddBubbleToSerieDialog(), getRemoveDataDialog(), getRemoveDataFromSerieDialog()); - - pane = getPaneFor(testedBubbleChart, CHART_TAB_NAME, axis1, AXIS_1_TAB_NAME, axis2, AXIS_2_TAB_NAME); - - setTestedControlContainerSize(500, 500); - setTestedControl(testedBubbleChart); - setPropertiesContent(pane); - setControllersContent(vb); - } - - public HBox getRemoveDataDialog() { - HBox hb = new HBox(); - Label lb = new Label("From position"); - final TextField tf = TextFieldBuilder.create().text("0").prefWidth(50).id(REMOVE_ITEM_POS_TEXT_FIELD_ID).build(); - Button bt = ButtonBuilder.create().text("Remove serie!").id(REMOVE_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int index = Integer.parseInt(tf.getText()); - testedBubbleChart.getData().remove(index); - } - }); - hb.getChildren().addAll(lb, tf, bt); - return hb; - } - - public HBox getRemoveDataFromSerieDialog() { - HBox hb = new HBox(); - Label lb1 = new Label("From serie"); - final TextField tf1 = TextFieldBuilder.create().text("0").prefWidth(50).build(); - - Label lb2 = new Label("from index"); - final TextField tf2 = TextFieldBuilder.create().text("0").prefWidth(50).build(); - - Button bt = ButtonBuilder.create().text("remove bubble!").id(REMOVE_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int serie = Integer.parseInt(tf1.getText()); - int index = Integer.parseInt(tf2.getText()); - ((Series) testedBubbleChart.getData().get(serie)).getData().remove(index); - } - }); - hb.getChildren().addAll(lb1, tf1, lb2, tf2, bt); - return hb; - } - - public HBox getAddBubbleToSerieDialog() { - HBox hb = new HBox(); - Label lb1 = new Label("To serie"); - final TextField tf1 = TextFieldBuilder.create().text("0").prefWidth(50).build(); - - Label lb2 = new Label("to index"); - final TextField tf2 = TextFieldBuilder.create().text("0").prefWidth(50).build(); - - Label lb3 = new Label("X"); - final TextField tf3 = TextFieldBuilder.create().text("0").prefWidth(50).build(); - - Label lb4 = new Label("Y"); - final TextField tf4 = TextFieldBuilder.create().text("0").prefWidth(50).build(); - - Label lb5 = new Label("R"); - final TextField tf5 = TextFieldBuilder.create().text("0").prefWidth(50).build(); - - Button bt = ButtonBuilder.create().text("add bubble!").id(REMOVE_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int serie = Integer.parseInt(tf1.getText()); - int index = Integer.parseInt(tf2.getText()); - double X = Double.parseDouble(tf3.getText()); - double Y = Double.parseDouble(tf4.getText()); - double R = Double.parseDouble(tf5.getText()); - - XYChart.Data newData = new XYChart.Data(); - newData.setXValue(X); - newData.setYValue(Y); - newData.setExtraValue(R); - - ((Series) testedBubbleChart.getData().get(serie)).getData().add(index, newData); - } - }); - hb.getChildren().addAll(lb1, tf1, lb2, tf2, lb3, tf3, lb4, tf4, lb5, tf5, bt); - return hb; - } - - public HBox getAddItemHBox() { - HBox hb = new HBox(); - Label lb = new Label("Add series named "); - final TextField tf = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_NAME_TEXTFIELD_ID).build(); - - Label minLabel = new Label(" min X,Y "); - final TextField minText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_MIN_VALUE_TEXTFIELD_ID).build(); - - Label maxLabel = new Label(" max X,Y "); - final TextField maxText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_MAX_VALUE_TEXTFIELD_ID).build(); - - Label amountLabel = new Label(" add "); - final TextField amountText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_DOTS_COUNT_TEXTFIELD_ID).build(); - - Button bt = ButtonBuilder.create().text(" bubbles!").id(ADD_SERIES_COMMAND_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - String serieName = tf.getText(); - double min = Double.parseDouble(minText.getText()); - double max = Double.parseDouble(maxText.getText()); - int amount = Integer.parseInt(amountText.getText()); - - ObservableList list = FXCollections.observableArrayList(); - - XYChart.Series serie = new XYChart.Series(serieName, list); - - for (int i = 0; i < amount; i++) { - XYChart.Data newData = new XYChart.Data(); - newData.setXValue(new Random().nextDouble() * (max - min) + min); - newData.setYValue(new Random().nextDouble() * (max - min) + min); - newData.setExtraValue(new Random().nextDouble() * (max - min) / 8 + min); - list.add(newData); - } - - testedBubbleChart.getData().add(serie); - pane.addPropertiesTable(serieName, getTableForProperty(serie, min, max).getVisualRepresentation()); - } - }); - hb.getChildren().addAll(lb, tf, minLabel, minText, maxLabel, maxText, amountLabel, amountText, bt); - return hb; - } - - protected PropertiesTable getTableForProperty(XYChart.Series serie, double min, double max) { - PropertiesTable table = new PropertiesTable(serie); - - table.addSimpleListener(serie.chartProperty(), serie); - table.addSimpleListener(serie.nameProperty(), serie); - table.addSimpleListener(serie.dataProperty(), serie); - - for (Iterator it = serie.getData().iterator(); it.hasNext();) { - final XYChart.Data data = (XYChart.Data) it.next(); - - final DoubleProperty intermediateX = new SimpleDoubleProperty(null, "XValue"); - final DoubleProperty intermediateY = new SimpleDoubleProperty(null, "YValue"); - final DoubleProperty intermediateExtra = new SimpleDoubleProperty(null, "ExtraValue"); - - data.XValueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - if (!intermediateX.isBound()) { - intermediateX.setValue((Double) data.XValueProperty().getValue()); - } - } - }); - - data.YValueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - if (!intermediateY.isBound()) { - intermediateY.setValue((Double) data.YValueProperty().getValue()); - } - } - }); - - data.extraValueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - if (!intermediateExtra.isBound()) { - intermediateExtra.setValue((Double) data.extraValueProperty().getValue()); - } - } - }); - - intermediateX.addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - data.setXValue(t1); - } - }); - - intermediateY.addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - data.setYValue(t1); - } - }); - - intermediateExtra.addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - data.setExtraValue(t1); - } - }); - - table.addDoublePropertyLine(intermediateX, min, max, (Double) data.getXValue(), data); - table.addDoublePropertyLine(intermediateY, min, max, (Double) data.getYValue(), data); - table.addDoublePropertyLine(intermediateExtra, min, max, (Double) data.getYValue(), data); - } - - return table; - } - - public BubbleChart getNewChart() { - BubbleChart chart = new BubbleChart(axis1, axis2); - chart.setTitle("BubbleChart"); - chart.setStyle("-fx-border-color: darkgray;"); - return chart; - } - } +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.chart.apps; + +import java.util.Iterator; +import java.util.Random; +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.SimpleDoubleProperty; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.event.ActionEvent; +import javafx.event.Event; +import javafx.event.EventHandler; +import javafx.scene.Scene; +import javafx.scene.chart.BubbleChart; +import javafx.scene.chart.NumberAxis; +import javafx.scene.chart.XYChart; +import javafx.scene.chart.XYChart.Series; +import javafx.scene.control.*; +import static javafx.scene.control.test.chart.apps.CommonFunctions.*; +import javafx.scene.control.test.utils.CommonPropertiesScene; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.TabPaneWithControl; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class NewBubbleChartApp extends InteroperabilityApp implements ChartIDsInterface { + + public final static String REMOVE_ITEM_POS_TEXT_FIELD_ID = "REMOVE_ITEM_POS_TEXT_FIELD_ID"; + public final static String REMOVE_BUTTON_ID = "REMOVE_BUTTON_ID"; + public final static String ADD_ITEM_TEXT_FIELD_ID = "ADD_ITEM_TEXT_FIELD_ID"; + public final static String ADD_ITEM_POSITION_TEXT_FIELD_ID = "ADD_ITEM_POSITION_TEXT_FIELD_ID"; + public final static String ADD_ITEM_BUTTON_ID = "ADD_ITEM_BUTTON_ID"; + + public static void main(String[] args) { + Utils.launch(NewBubbleChartApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "BubbleChartTestApp"); + return new NewBubbleChartApp.BubbleChartScene(); + } + + class BubbleChartScene extends CommonPropertiesScene { + + //BubbleChart to be tested. + BubbleChart testedBubbleChart; + NumberAxis axis1; + NumberAxis axis2; + TabPaneWithControl pane; + + public BubbleChartScene() { + super("BubbleChart", 1300, 800); + } + + @Override + final protected void prepareScene() { + Utils.addBrowser(this); + + axis1 = new NumberAxis(0, 100, 10); + axis2 = new NumberAxis(0, 100, 10); + testedBubbleChart = getNewChart(); + testedBubbleChart.setId(TESTED_CHART_ID); + + Button hardResetButton = new Button("Hard reset"); + hardResetButton.setId(HARD_RESET_BUTTON_ID); + hardResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareMainSceneStructure(); + prepareScene(); + } + }); + + Button softResetButton = new Button("Soft reset"); + softResetButton.setId(SOFT_RESET_BUTTON_ID); + softResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + //throw new UnsupportedOperationException("Not supported yet."); + } + }); + + HBox resetButtonsHBox = new HBox(); + resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); + + VBox vb = new VBox(5); + vb.getChildren().addAll(resetButtonsHBox, getAddItemHBox(), getAddBubbleToSerieDialog(), getRemoveDataDialog(), getRemoveDataFromSerieDialog()); + + pane = getPaneFor(testedBubbleChart, CHART_TAB_NAME, axis1, AXIS_1_TAB_NAME, axis2, AXIS_2_TAB_NAME); + + setTestedControlContainerSize(500, 500); + setTestedControl(testedBubbleChart); + setPropertiesContent(pane); + setControllersContent(vb); + } + + public HBox getRemoveDataDialog() { + HBox hb = new HBox(); + Label lb = new Label("From position"); + final TextField tf = new TextField("0"); + tf.setPrefWidth(50); + tf.setId(REMOVE_ITEM_POS_TEXT_FIELD_ID); + Button bt = new Button("Remove serie!"); + bt.setId(REMOVE_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int index = Integer.parseInt(tf.getText()); + testedBubbleChart.getData().remove(index); + } + }); + hb.getChildren().addAll(lb, tf, bt); + return hb; + } + + public HBox getRemoveDataFromSerieDialog() { + HBox hb = new HBox(); + Label lb1 = new Label("From serie"); + final TextField tf1 = new TextField("0"); + tf1.setPrefWidth(50); + + Label lb2 = new Label("from index"); + final TextField tf2 = new TextField("0"); + tf2.setPrefWidth(50); + + Button bt = new Button("remove bubble!"); + bt.setId(REMOVE_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int serie = Integer.parseInt(tf1.getText()); + int index = Integer.parseInt(tf2.getText()); + ((Series) testedBubbleChart.getData().get(serie)).getData().remove(index); + } + }); + hb.getChildren().addAll(lb1, tf1, lb2, tf2, bt); + return hb; + } + + public HBox getAddBubbleToSerieDialog() { + HBox hb = new HBox(); + Label lb1 = new Label("To serie"); + final TextField tf1 = new TextField("0"); + tf1.setPrefWidth(50); + + Label lb2 = new Label("to index"); + final TextField tf2 = new TextField("0"); + tf2.setPrefWidth(50); + + Label lb3 = new Label("X"); + final TextField tf3 = new TextField("0"); + tf3.setPrefWidth(50); + + Label lb4 = new Label("Y"); + final TextField tf4 = new TextField("0"); + tf4.setPrefWidth(50); + + Label lb5 = new Label("R"); + final TextField tf5 = new TextField("0"); + tf5.setPrefWidth(50); + + Button bt = new Button("add bubble!"); + bt.setId(REMOVE_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int serie = Integer.parseInt(tf1.getText()); + int index = Integer.parseInt(tf2.getText()); + double X = Double.parseDouble(tf3.getText()); + double Y = Double.parseDouble(tf4.getText()); + double R = Double.parseDouble(tf5.getText()); + + XYChart.Data newData = new XYChart.Data(); + newData.setXValue(X); + newData.setYValue(Y); + newData.setExtraValue(R); + + ((Series) testedBubbleChart.getData().get(serie)).getData().add(index, newData); + } + }); + hb.getChildren().addAll(lb1, tf1, lb2, tf2, lb3, tf3, lb4, tf4, lb5, tf5, bt); + return hb; + } + + public HBox getAddItemHBox() { + HBox hb = new HBox(); + Label lb = new Label("Add series named "); + final TextField tf = new TextField(); + tf.setPrefWidth(50); + tf.setId(ADDED_SERIES_NAME_TEXTFIELD_ID); + + Label minLabel = new Label(" min X,Y "); + final TextField minText = new TextField(); + minText.setPrefWidth(50); + minText.setId(ADDED_SERIES_MIN_VALUE_TEXTFIELD_ID); + + Label maxLabel = new Label(" max X,Y "); + final TextField maxText = new TextField(); + maxText.setPrefWidth(50); + maxText.setId(ADDED_SERIES_MAX_VALUE_TEXTFIELD_ID); + + Label amountLabel = new Label(" add "); + final TextField amountText = new TextField(); + amountText.setPrefWidth(50); + amountText.setId(ADDED_SERIES_DOTS_COUNT_TEXTFIELD_ID); + + Button bt = new Button(" bubbles!"); + bt.setId(ADD_SERIES_COMMAND_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + String serieName = tf.getText(); + double min = Double.parseDouble(minText.getText()); + double max = Double.parseDouble(maxText.getText()); + int amount = Integer.parseInt(amountText.getText()); + + ObservableList list = FXCollections.observableArrayList(); + + XYChart.Series serie = new XYChart.Series(serieName, list); + + for (int i = 0; i < amount; i++) { + XYChart.Data newData = new XYChart.Data(); + newData.setXValue(new Random().nextDouble() * (max - min) + min); + newData.setYValue(new Random().nextDouble() * (max - min) + min); + newData.setExtraValue(new Random().nextDouble() * (max - min) / 8 + min); + list.add(newData); + } + + testedBubbleChart.getData().add(serie); + pane.addPropertiesTable(serieName, getTableForProperty(serie, min, max).getVisualRepresentation()); + } + }); + hb.getChildren().addAll(lb, tf, minLabel, minText, maxLabel, maxText, amountLabel, amountText, bt); + return hb; + } + + protected PropertiesTable getTableForProperty(XYChart.Series serie, double min, double max) { + PropertiesTable table = new PropertiesTable(serie); + + table.addSimpleListener(serie.chartProperty(), serie); + table.addSimpleListener(serie.nameProperty(), serie); + table.addSimpleListener(serie.dataProperty(), serie); + + for (Iterator it = serie.getData().iterator(); it.hasNext();) { + final XYChart.Data data = (XYChart.Data) it.next(); + + final DoubleProperty intermediateX = new SimpleDoubleProperty(null, "XValue"); + final DoubleProperty intermediateY = new SimpleDoubleProperty(null, "YValue"); + final DoubleProperty intermediateExtra = new SimpleDoubleProperty(null, "ExtraValue"); + + data.XValueProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + if (!intermediateX.isBound()) { + intermediateX.setValue((Double) data.XValueProperty().getValue()); + } + } + }); + + data.YValueProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + if (!intermediateY.isBound()) { + intermediateY.setValue((Double) data.YValueProperty().getValue()); + } + } + }); + + data.extraValueProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + if (!intermediateExtra.isBound()) { + intermediateExtra.setValue((Double) data.extraValueProperty().getValue()); + } + } + }); + + intermediateX.addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + data.setXValue(t1); + } + }); + + intermediateY.addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + data.setYValue(t1); + } + }); + + intermediateExtra.addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + data.setExtraValue(t1); + } + }); + + table.addDoublePropertyLine(intermediateX, min, max, (Double) data.getXValue(), data); + table.addDoublePropertyLine(intermediateY, min, max, (Double) data.getYValue(), data); + table.addDoublePropertyLine(intermediateExtra, min, max, (Double) data.getYValue(), data); + } + + return table; + } + + public BubbleChart getNewChart() { + BubbleChart chart = new BubbleChart(axis1, axis2); + chart.setTitle("BubbleChart"); + chart.setStyle("-fx-border-color: darkgray;"); + return chart; + } + } } \ No newline at end of file --- old/functional/ControlsTests/src/javafx/scene/control/test/chart/apps/NewLineChartApp.java 2016-12-22 11:26:21.108998901 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/chart/apps/NewLineChartApp.java 2016-12-22 11:26:21.060998438 +0300 @@ -1,300 +1,326 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.chart.apps; - -import java.util.Arrays; -import java.util.Comparator; -import java.util.Iterator; -import java.util.Random; -import javafx.beans.property.DoubleProperty; -import javafx.beans.property.SimpleDoubleProperty; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.event.ActionEvent; -import javafx.event.Event; -import javafx.event.EventHandler; -import javafx.scene.Scene; -import javafx.scene.chart.LineChart; -import javafx.scene.chart.NumberAxis; -import javafx.scene.chart.XYChart; -import javafx.scene.control.*; -import static javafx.scene.control.test.chart.apps.CommonFunctions.*; -import javafx.scene.control.test.utils.CommonPropertiesScene; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.TabPaneWithControl; -import javafx.scene.layout.HBox; -import javafx.scene.layout.VBox; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class NewLineChartApp extends InteroperabilityApp implements ChartIDsInterface { - - public final static String REMOVE_ITEM_POS_TEXT_FIELD_ID = "REMOVE_ITEM_POS_TEXT_FIELD_ID"; - public final static String REMOVE_BUTTON_ID = "REMOVE_BUTTON_ID"; - public final static String ADD_LINE_TEXT_FIELD_ID = "ADD_LINE_TEXT_FIELD_ID"; - public final static String ADD_LINE_AT_POSITION_TEXT_FIELD_ID = "ADD_ITEM_POSITION_TEXT_FIELD_ID"; - public final static String ADD_LINE_BUTTON_ID = "ADD_ITEM_BUTTON_ID"; - public final static String REMOVE_LINE_FROM_POS_TEXT_FIELD_ID = "REMOVE_AREA_POS_TEXT_FIELD_ID"; - public final static String REMOVE_INDEX_TEXT_FIELD_ID = "REMOVE_INDEX_TEXT_FIELD_ID"; - public final static String ADD_LINE_POS_TEXT_FIELD_ID = "ADD_AREA_POS_TEXT_FIELD_ID"; - public final static String ADD_INDEX_TEXT_FIELD_ID = "ADD_INDEX_TEXT_FIELD_ID"; - public final static String ADD_VALUE_TEXT_FIELD_ID = "ADD_VALUE_TEXT_FIELD_ID"; - - public static void main(String[] args) { - Utils.launch(NewLineChartApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "LineChartTestApp"); - return new NewLineChartApp.LineChartScene(); - } - - class LineChartScene extends CommonPropertiesScene { - - //LineChart to be tested. - LineChart testedLineChart; - NumberAxis axis1; - NumberAxis axis2; - TabPaneWithControl pane; - - public LineChartScene() { - super("LineChart", 1300, 800); - } - - @Override - final protected void prepareScene() { - Utils.addBrowser(this); - - axis1 = new NumberAxis(0, 100, 10); - axis2 = new NumberAxis(0, 100, 10); - testedLineChart = getNewChart(); - testedLineChart.setId(TESTED_CHART_ID); - - Button hardResetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Hard reset").build(); - hardResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareMainSceneStructure(); - prepareScene(); - } - }); - - Button softResetButton = ButtonBuilder.create().id(SOFT_RESET_BUTTON_ID).text("Soft reset").build(); - softResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - //throw new UnsupportedOperationException("Not supported yet."); - } - }); - - HBox resetButtonsHBox = new HBox(); - resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); - - VBox vb = new VBox(5); - vb.getChildren().addAll(resetButtonsHBox, getAddLineHBox(), getAddPointToDataDialog(), getRemoveDataDialog(), getRemovePointFromDataDialog()); - - pane = getPaneFor(testedLineChart, CHART_TAB_NAME, axis1, AXIS_1_TAB_NAME, axis2, AXIS_2_TAB_NAME); - - setTestedControlContainerSize(500, 500); - setTestedControl(testedLineChart); - setPropertiesContent(pane); - setControllersContent(vb); - } - - public HBox getAddPointToDataDialog() { - HBox hb = new HBox(); - - Label lb1 = new Label("To area"); - final TextField tf1 = TextFieldBuilder.create().text("0").prefWidth(50).id(ADD_LINE_POS_TEXT_FIELD_ID).build(); - - Label lb2 = new Label("to index"); - final TextField tf2 = TextFieldBuilder.create().text("0").prefWidth(50).id(ADD_INDEX_TEXT_FIELD_ID).build(); - - Label lb3 = new Label("value"); - final TextField tf3 = TextFieldBuilder.create().text("0").prefWidth(50).id(ADD_VALUE_TEXT_FIELD_ID).build(); - - Button bt = ButtonBuilder.create().text("add point!").id(REMOVE_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int area = Integer.parseInt(tf1.getText()); - int point = Integer.parseInt(tf2.getText()); - double value = Double.parseDouble(tf3.getText()); - - XYChart.Data newData = new XYChart.Data(); - newData.setXValue((((Double) ((XYChart.Data) (((XYChart.Series) testedLineChart.getData().get(area)).getData().get(point))).getXValue()) + ((Double) ((XYChart.Data) (((XYChart.Series) testedLineChart.getData().get(area)).getData().get(point - 1))).getXValue())) / 2); - newData.setYValue(value); - - ((XYChart.Series) testedLineChart.getData().get(area)).getData().add(point, newData); - } - }); - hb.getChildren().addAll(lb1, tf1, lb2, tf2, lb3, tf3, bt); - return hb; - } - - public HBox getRemovePointFromDataDialog() { - HBox hb = new HBox(); - - Label lb1 = new Label("From area"); - final TextField tf1 = TextFieldBuilder.create().text("0").prefWidth(50).id(REMOVE_LINE_FROM_POS_TEXT_FIELD_ID).build(); - - Label lb2 = new Label("From index"); - final TextField tf2 = TextFieldBuilder.create().text("0").prefWidth(50).id(REMOVE_INDEX_TEXT_FIELD_ID).build(); - - Button bt = ButtonBuilder.create().text("remove point!").id(REMOVE_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int area = Integer.parseInt(tf1.getText()); - int point = Integer.parseInt(tf2.getText()); - ((XYChart.Series) testedLineChart.getData().get(area)).getData().remove(point); - } - }); - hb.getChildren().addAll(lb1, tf1, lb2, tf2, bt); - return hb; - } - - public HBox getRemoveDataDialog() { - HBox hb = new HBox(); - Label lb = new Label("From index"); - final TextField tf = TextFieldBuilder.create().text("0").prefWidth(50).id(REMOVE_ITEM_POS_TEXT_FIELD_ID).build(); - Button bt = ButtonBuilder.create().text("remove line!").id(REMOVE_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int index = Integer.parseInt(tf.getText()); - testedLineChart.getData().remove(index); - } - }); - hb.getChildren().addAll(lb, tf, bt); - return hb; - } - - public HBox getAddLineHBox() { - HBox hb = new HBox(); - Label lb = new Label("Add series named "); - final TextField tf = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_NAME_TEXTFIELD_ID).build(); - - Label minLabel = new Label(" minX "); - final TextField minText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_MIN_VALUE_TEXTFIELD_ID).build(); - - Label maxLabel = new Label(" maxX "); - final TextField maxText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_MAX_VALUE_TEXTFIELD_ID).build(); - - Label amountLabel = new Label(" with "); - final TextField amountText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_DOTS_COUNT_TEXTFIELD_ID).build(); - - Button bt = ButtonBuilder.create().text(" points add!").id(ADD_SERIES_COMMAND_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - String serieName = tf.getText(); - double min = Double.parseDouble(minText.getText()); - double max = Double.parseDouble(maxText.getText()); - int amount = Integer.parseInt(amountText.getText()); - - ObservableList list = FXCollections.observableArrayList(); - - for (int i = 0; i < amount; i++) { - XYChart.Data newData = new XYChart.Data(); - newData.setXValue(new Random().nextDouble() * (max - min) + min); - newData.setYValue(new Random().nextDouble() * (max - min) + min); - list.add(newData); - } - Object[] array = list.toArray(); - Arrays.sort(array, new Comparator() { - public int compare(Object t, Object t1) { - return (int) Math.round(((Double) ((XYChart.Data) t).getXValue()) - ((Double) ((XYChart.Data) t1).getXValue())); - } - }); - - XYChart.Series serie = new XYChart.Series(serieName, FXCollections.observableArrayList(array)); - - testedLineChart.getData().add(serie); - pane.addPropertiesTable(serieName, getTableForProperty(serie, min, max).getVisualRepresentation()); - } - }); - hb.getChildren().addAll(lb, tf, minLabel, minText, maxLabel, maxText, amountLabel, amountText, bt); - return hb; - } - - protected PropertiesTable getTableForProperty(XYChart.Series serie, double min, double max) { - PropertiesTable table = new PropertiesTable(serie); - - table.addSimpleListener(serie.chartProperty(), serie); - table.addSimpleListener(serie.nameProperty(), serie); - table.addSimpleListener(serie.dataProperty(), serie); - - for (Iterator it = serie.getData().iterator(); it.hasNext();) { - final XYChart.Data data = (XYChart.Data) it.next(); - - final DoubleProperty intermediateX = new SimpleDoubleProperty(null, "XValue"); - final DoubleProperty intermediateY = new SimpleDoubleProperty(null, "YValue"); - - data.XValueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - if (!intermediateX.isBound()) { - intermediateX.setValue((Double) data.XValueProperty().getValue()); - } - } - }); - - data.YValueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - if (!intermediateY.isBound()) { - intermediateY.setValue((Double) data.YValueProperty().getValue()); - } - } - }); - - intermediateX.addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - data.setXValue(t1); - } - }); - - intermediateY.addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - data.setYValue(t1); - } - }); - - table.addDoublePropertyLine(intermediateX, min, max, (Double) data.getXValue(), data); - table.addDoublePropertyLine(intermediateY, min, max, (Double) data.getYValue(), data); - } - - return table; - } - - public LineChart getNewChart() { - LineChart chart = new LineChart(axis1, axis2); - chart.setTitle("LineChart"); - chart.setStyle("-fx-border-color: darkgray;"); - return chart; - } - } +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.chart.apps; + +import java.util.Arrays; +import java.util.Comparator; +import java.util.Iterator; +import java.util.Random; +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.SimpleDoubleProperty; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.event.ActionEvent; +import javafx.event.Event; +import javafx.event.EventHandler; +import javafx.scene.Scene; +import javafx.scene.chart.LineChart; +import javafx.scene.chart.NumberAxis; +import javafx.scene.chart.XYChart; +import javafx.scene.control.*; +import static javafx.scene.control.test.chart.apps.CommonFunctions.*; +import javafx.scene.control.test.utils.CommonPropertiesScene; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.TabPaneWithControl; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class NewLineChartApp extends InteroperabilityApp implements ChartIDsInterface { + + public final static String REMOVE_ITEM_POS_TEXT_FIELD_ID = "REMOVE_ITEM_POS_TEXT_FIELD_ID"; + public final static String REMOVE_BUTTON_ID = "REMOVE_BUTTON_ID"; + public final static String ADD_LINE_TEXT_FIELD_ID = "ADD_LINE_TEXT_FIELD_ID"; + public final static String ADD_LINE_AT_POSITION_TEXT_FIELD_ID = "ADD_ITEM_POSITION_TEXT_FIELD_ID"; + public final static String ADD_LINE_BUTTON_ID = "ADD_ITEM_BUTTON_ID"; + public final static String REMOVE_LINE_FROM_POS_TEXT_FIELD_ID = "REMOVE_AREA_POS_TEXT_FIELD_ID"; + public final static String REMOVE_INDEX_TEXT_FIELD_ID = "REMOVE_INDEX_TEXT_FIELD_ID"; + public final static String ADD_LINE_POS_TEXT_FIELD_ID = "ADD_AREA_POS_TEXT_FIELD_ID"; + public final static String ADD_INDEX_TEXT_FIELD_ID = "ADD_INDEX_TEXT_FIELD_ID"; + public final static String ADD_VALUE_TEXT_FIELD_ID = "ADD_VALUE_TEXT_FIELD_ID"; + + public static void main(String[] args) { + Utils.launch(NewLineChartApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "LineChartTestApp"); + return new NewLineChartApp.LineChartScene(); + } + + class LineChartScene extends CommonPropertiesScene { + + //LineChart to be tested. + LineChart testedLineChart; + NumberAxis axis1; + NumberAxis axis2; + TabPaneWithControl pane; + + public LineChartScene() { + super("LineChart", 1300, 800); + } + + @Override + final protected void prepareScene() { + Utils.addBrowser(this); + + axis1 = new NumberAxis(0, 100, 10); + axis2 = new NumberAxis(0, 100, 10); + testedLineChart = getNewChart(); + testedLineChart.setId(TESTED_CHART_ID); + + Button hardResetButton = new Button("Hard reset"); + hardResetButton.setId(HARD_RESET_BUTTON_ID); + hardResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareMainSceneStructure(); + prepareScene(); + } + }); + + Button softResetButton = new Button("Soft reset"); + softResetButton.setId(SOFT_RESET_BUTTON_ID); + softResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + //throw new UnsupportedOperationException("Not supported yet."); + } + }); + + HBox resetButtonsHBox = new HBox(); + resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); + + VBox vb = new VBox(5); + vb.getChildren().addAll(resetButtonsHBox, getAddLineHBox(), getAddPointToDataDialog(), getRemoveDataDialog(), getRemovePointFromDataDialog()); + + pane = getPaneFor(testedLineChart, CHART_TAB_NAME, axis1, AXIS_1_TAB_NAME, axis2, AXIS_2_TAB_NAME); + + setTestedControlContainerSize(500, 500); + setTestedControl(testedLineChart); + setPropertiesContent(pane); + setControllersContent(vb); + } + + public HBox getAddPointToDataDialog() { + HBox hb = new HBox(); + + Label lb1 = new Label("To area"); + final TextField tf1 = new TextField("0"); + tf1.setPrefWidth(50); + tf1.setId(ADD_LINE_POS_TEXT_FIELD_ID); + + Label lb2 = new Label("to index"); + final TextField tf2 = new TextField("0"); + tf2.setPrefWidth(50); + tf2.setId(ADD_INDEX_TEXT_FIELD_ID); + + Label lb3 = new Label("value"); + final TextField tf3 = new TextField("0"); + tf3.setPrefWidth(50); + tf3.setId(ADD_VALUE_TEXT_FIELD_ID); + + Button bt = new Button("add point!"); + bt.setId(REMOVE_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int area = Integer.parseInt(tf1.getText()); + int point = Integer.parseInt(tf2.getText()); + double value = Double.parseDouble(tf3.getText()); + + XYChart.Data newData = new XYChart.Data(); + newData.setXValue((((Double) ((XYChart.Data) (((XYChart.Series) testedLineChart.getData().get(area)).getData().get(point))).getXValue()) + ((Double) ((XYChart.Data) (((XYChart.Series) testedLineChart.getData().get(area)).getData().get(point - 1))).getXValue())) / 2); + newData.setYValue(value); + + ((XYChart.Series) testedLineChart.getData().get(area)).getData().add(point, newData); + } + }); + hb.getChildren().addAll(lb1, tf1, lb2, tf2, lb3, tf3, bt); + return hb; + } + + public HBox getRemovePointFromDataDialog() { + HBox hb = new HBox(); + + Label lb1 = new Label("From area"); + final TextField tf1 = new TextField("0"); + tf1.setPrefWidth(50); + tf1.setId(REMOVE_LINE_FROM_POS_TEXT_FIELD_ID); + + Label lb2 = new Label("From index"); + final TextField tf2 = new TextField("0"); + tf2.setPrefWidth(50); + tf2.setId(REMOVE_INDEX_TEXT_FIELD_ID); + + Button bt = new Button("remove point!"); + bt.setId(REMOVE_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int area = Integer.parseInt(tf1.getText()); + int point = Integer.parseInt(tf2.getText()); + ((XYChart.Series) testedLineChart.getData().get(area)).getData().remove(point); + } + }); + hb.getChildren().addAll(lb1, tf1, lb2, tf2, bt); + return hb; + } + + public HBox getRemoveDataDialog() { + HBox hb = new HBox(); + Label lb = new Label("From index"); + final TextField tf = new TextField("0"); + tf.setPrefWidth(50); + tf.setId(REMOVE_ITEM_POS_TEXT_FIELD_ID); + Button bt = new Button("remove line!"); + bt.setId(REMOVE_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int index = Integer.parseInt(tf.getText()); + testedLineChart.getData().remove(index); + } + }); + hb.getChildren().addAll(lb, tf, bt); + return hb; + } + + public HBox getAddLineHBox() { + HBox hb = new HBox(); + Label lb = new Label("Add series named "); + final TextField tf = new TextField(); + tf.setPrefWidth(50); + tf.setId(ADDED_SERIES_NAME_TEXTFIELD_ID); + + Label minLabel = new Label(" minX "); + final TextField minText = new TextField(); + minText.setPrefWidth(50); + minText.setId(ADDED_SERIES_MIN_VALUE_TEXTFIELD_ID); + + Label maxLabel = new Label(" maxX "); + final TextField maxText = new TextField(); + maxText.setPrefWidth(50); + maxText.setId(ADDED_SERIES_MAX_VALUE_TEXTFIELD_ID); + + Label amountLabel = new Label(" with "); + final TextField amountText = new TextField(); + amountText.setPrefWidth(50); + amountText.setId(ADDED_SERIES_DOTS_COUNT_TEXTFIELD_ID); + + Button bt = new Button(" points add!"); + bt.setId(ADD_SERIES_COMMAND_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + String serieName = tf.getText(); + double min = Double.parseDouble(minText.getText()); + double max = Double.parseDouble(maxText.getText()); + int amount = Integer.parseInt(amountText.getText()); + + ObservableList list = FXCollections.observableArrayList(); + + for (int i = 0; i < amount; i++) { + XYChart.Data newData = new XYChart.Data(); + newData.setXValue(new Random().nextDouble() * (max - min) + min); + newData.setYValue(new Random().nextDouble() * (max - min) + min); + list.add(newData); + } + Object[] array = list.toArray(); + Arrays.sort(array, new Comparator() { + public int compare(Object t, Object t1) { + return (int) Math.round(((Double) ((XYChart.Data) t).getXValue()) - ((Double) ((XYChart.Data) t1).getXValue())); + } + }); + + XYChart.Series serie = new XYChart.Series(serieName, FXCollections.observableArrayList(array)); + + testedLineChart.getData().add(serie); + pane.addPropertiesTable(serieName, getTableForProperty(serie, min, max).getVisualRepresentation()); + } + }); + hb.getChildren().addAll(lb, tf, minLabel, minText, maxLabel, maxText, amountLabel, amountText, bt); + return hb; + } + + protected PropertiesTable getTableForProperty(XYChart.Series serie, double min, double max) { + PropertiesTable table = new PropertiesTable(serie); + + table.addSimpleListener(serie.chartProperty(), serie); + table.addSimpleListener(serie.nameProperty(), serie); + table.addSimpleListener(serie.dataProperty(), serie); + + for (Iterator it = serie.getData().iterator(); it.hasNext();) { + final XYChart.Data data = (XYChart.Data) it.next(); + + final DoubleProperty intermediateX = new SimpleDoubleProperty(null, "XValue"); + final DoubleProperty intermediateY = new SimpleDoubleProperty(null, "YValue"); + + data.XValueProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + if (!intermediateX.isBound()) { + intermediateX.setValue((Double) data.XValueProperty().getValue()); + } + } + }); + + data.YValueProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + if (!intermediateY.isBound()) { + intermediateY.setValue((Double) data.YValueProperty().getValue()); + } + } + }); + + intermediateX.addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + data.setXValue(t1); + } + }); + + intermediateY.addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + data.setYValue(t1); + } + }); + + table.addDoublePropertyLine(intermediateX, min, max, (Double) data.getXValue(), data); + table.addDoublePropertyLine(intermediateY, min, max, (Double) data.getYValue(), data); + } + + return table; + } + + public LineChart getNewChart() { + LineChart chart = new LineChart(axis1, axis2); + chart.setTitle("LineChart"); + chart.setStyle("-fx-border-color: darkgray;"); + return chart; + } + } } \ No newline at end of file --- old/functional/ControlsTests/src/javafx/scene/control/test/chart/apps/NewNumberScatterChartApp.java 2016-12-22 11:26:21.301000752 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/chart/apps/NewNumberScatterChartApp.java 2016-12-22 11:26:21.249000251 +0300 @@ -1,287 +1,309 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.chart.apps; - -import java.util.Iterator; -import java.util.Random; -import javafx.beans.property.DoubleProperty; -import javafx.beans.property.SimpleDoubleProperty; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.event.ActionEvent; -import javafx.event.Event; -import javafx.event.EventHandler; -import javafx.scene.Scene; -import javafx.scene.chart.NumberAxis; -import javafx.scene.chart.ScatterChart; -import javafx.scene.chart.XYChart; -import javafx.scene.chart.XYChart.Data; -import javafx.scene.chart.XYChart.Series; -import javafx.scene.control.*; -import static javafx.scene.control.test.chart.apps.CommonFunctions.*; -import javafx.scene.control.test.utils.CommonPropertiesScene; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.TabPaneWithControl; -import javafx.scene.layout.HBox; -import javafx.scene.layout.VBox; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class NewNumberScatterChartApp extends InteroperabilityApp implements ChartIDsInterface { - - public final static String REMOVE_ITEM_POS_TEXT_FIELD_ID = "REMOVE_ITEM_POS_TEXT_FIELD_ID"; - public final static String REMOVE_BUTTON_ID = "REMOVE_BUTTON_ID"; - public final static String ADD_ITEM_TEXT_FIELD_ID = "ADD_ITEM_TEXT_FIELD_ID"; - public final static String ADD_ITEM_POSITION_TEXT_FIELD_ID = "ADD_ITEM_POSITION_TEXT_FIELD_ID"; - public final static String ADD_ITEM_BUTTON_ID = "ADD_ITEM_BUTTON_ID"; - - public static void main(String[] args) { - Utils.launch(NewNumberScatterChartApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "ScatterChartTestApp"); - return new NewNumberScatterChartApp.ScatterChartScene(); - } - - class ScatterChartScene extends CommonPropertiesScene { - - //ScatterChart to be tested. - ScatterChart testedScatterChart; - NumberAxis axis1; - NumberAxis axis2; - TabPaneWithControl pane; - - public ScatterChartScene() { - super("NumberScatterChart", 1300, 800); - } - - @Override - final protected void prepareScene() { - Utils.addBrowser(this); - - axis1 = new NumberAxis(0, 100, 10); - axis2 = new NumberAxis(0, 100, 10); - testedScatterChart = getNewChart(); - testedScatterChart.setId(TESTED_CHART_ID); - - Button hardResetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Hard reset").build(); - hardResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareMainSceneStructure(); - prepareScene(); - } - }); - - Button softResetButton = ButtonBuilder.create().id(SOFT_RESET_BUTTON_ID).text("Soft reset").build(); - softResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - //throw new UnsupportedOperationException("Not supported yet."); - } - }); - - HBox resetButtonsHBox = new HBox(); - resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); - - VBox vb = new VBox(5); - vb.getChildren().addAll(resetButtonsHBox, getAddItemHBox(), getAddPointToSerieDialog(), getRemoveDataFromSerieDialog(), getRemoveDataDialog()); - - pane = getPaneFor(testedScatterChart, CHART_TAB_NAME, axis1, AXIS_1_TAB_NAME, axis2, AXIS_2_TAB_NAME); - - setTestedControlContainerSize(500, 500); - setTestedControl(testedScatterChart); - setPropertiesContent(pane); - setControllersContent(vb); - } - - public HBox getRemoveDataDialog() { - HBox hb = new HBox(); - Label lb = new Label("From position"); - final TextField tf = TextFieldBuilder.create().text("0").prefWidth(50).id(REMOVE_ITEM_POS_TEXT_FIELD_ID).build(); - Button bt = ButtonBuilder.create().text("Remove!").id(REMOVE_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int index = Integer.parseInt(tf.getText()); - testedScatterChart.getData().remove(index); - } - }); - hb.getChildren().addAll(lb, tf, bt); - return hb; - } - - public HBox getRemoveDataFromSerieDialog() { - HBox hb = new HBox(); - Label lb1 = new Label("From serie"); - final TextField tf1 = TextFieldBuilder.create().text("0").prefWidth(50).build(); - - Label lb2 = new Label("from index"); - final TextField tf2 = TextFieldBuilder.create().text("0").prefWidth(50).build(); - - Button bt = ButtonBuilder.create().text("remove point!").id(REMOVE_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int serie = Integer.parseInt(tf1.getText()); - int index = Integer.parseInt(tf2.getText()); - ((Series) testedScatterChart.getData().get(serie)).getData().remove(index); - } - }); - hb.getChildren().addAll(lb1, tf1, lb2, tf2, bt); - return hb; - } - - public HBox getAddPointToSerieDialog() { - HBox hb = new HBox(); - Label lb1 = new Label("To serie"); - final TextField tf1 = TextFieldBuilder.create().text("0").prefWidth(50).build(); - - Label lb2 = new Label("to index"); - final TextField tf2 = TextFieldBuilder.create().text("0").prefWidth(50).build(); - - Label lb3 = new Label("X"); - final TextField tf3 = TextFieldBuilder.create().text("0").prefWidth(50).build(); - - Label lb4 = new Label("Y"); - final TextField tf4 = TextFieldBuilder.create().text("0").prefWidth(50).build(); - - Button bt = ButtonBuilder.create().text("add point!").id(REMOVE_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int serie = Integer.parseInt(tf1.getText()); - int index = Integer.parseInt(tf2.getText()); - double X = Double.parseDouble(tf3.getText()); - double Y = Double.parseDouble(tf4.getText()); - - XYChart.Data newData = new XYChart.Data(); - newData.setXValue(X); - newData.setYValue(Y); - - ((Series) testedScatterChart.getData().get(serie)).getData().add(index, newData); - } - }); - hb.getChildren().addAll(lb1, tf1, lb2, tf2, lb3, tf3, lb4, tf4, bt); - return hb; - } - - public HBox getAddItemHBox() { - HBox hb = new HBox(); - Label lb = new Label("Add series named "); - final TextField tf = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_NAME_TEXTFIELD_ID).build(); - - Label minLabel = new Label(" min "); - final TextField minText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_MIN_VALUE_TEXTFIELD_ID).build(); - - Label maxLabel = new Label(" max "); - final TextField maxText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_MAX_VALUE_TEXTFIELD_ID).build(); - - Label amountLabel = new Label(" amount "); - final TextField amountText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_DOTS_COUNT_TEXTFIELD_ID).build(); - - Button bt = ButtonBuilder.create().text("Add!").id(ADD_SERIES_COMMAND_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - String serieName = tf.getText(); - double min = Double.parseDouble(minText.getText()); - double max = Double.parseDouble(maxText.getText()); - int amount = Integer.parseInt(amountText.getText()); - - ObservableList list = FXCollections.observableArrayList(); - - Series serie = new XYChart.Series(serieName, list); - - for (int i = 0; i < amount; i++) { - Data newData = new Data(); - newData.setXValue(new Random().nextDouble() * (max - min) + min); - newData.setYValue(new Random().nextDouble() * (max - min) + min); - list.add(newData); - } - - testedScatterChart.getData().add(serie); - pane.addPropertiesTable(serieName, getTableForProperty(serie, min, max).getVisualRepresentation()); - } - }); - hb.getChildren().addAll(lb, tf, minLabel, minText, maxLabel, maxText, amountLabel, amountText, bt); - return hb; - } - - protected PropertiesTable getTableForProperty(Series serie, double min, double max) { - PropertiesTable table = new PropertiesTable(serie); - - table.addSimpleListener(serie.chartProperty(), serie); - table.addSimpleListener(serie.nameProperty(), serie); - table.addSimpleListener(serie.dataProperty(), serie); - - for (Iterator it = serie.getData().iterator(); it.hasNext();) { - final Data data = (Data) it.next(); - - final DoubleProperty intermediateX = new SimpleDoubleProperty(null, "XValue"); - final DoubleProperty intermediateY = new SimpleDoubleProperty(null, "YValue"); - - data.XValueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - intermediateX.setValue((Double) data.XValueProperty().getValue()); - } - }); - - data.YValueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - intermediateY.setValue((Double) data.YValueProperty().getValue()); - } - }); - - intermediateX.addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - data.setXValue(t1); - } - }); - - intermediateY.addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - data.setYValue(t1); - } - }); - - table.addDoublePropertyLine(intermediateX, min, max, (Double) data.getXValue(), data); - table.addDoublePropertyLine(intermediateY, min, max, (Double) data.getYValue(), data); - } - - return table; - } - - public ScatterChart getNewChart() { - ScatterChart chart = new ScatterChart(axis1, axis2); - chart.setTitle("ScatterChart"); - chart.setStyle("-fx-border-color: darkgray;"); - return chart; - } - } +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.chart.apps; + +import java.util.Iterator; +import java.util.Random; +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.SimpleDoubleProperty; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.event.ActionEvent; +import javafx.event.Event; +import javafx.event.EventHandler; +import javafx.scene.Scene; +import javafx.scene.chart.NumberAxis; +import javafx.scene.chart.ScatterChart; +import javafx.scene.chart.XYChart; +import javafx.scene.chart.XYChart.Data; +import javafx.scene.chart.XYChart.Series; +import javafx.scene.control.*; +import static javafx.scene.control.test.chart.apps.CommonFunctions.*; +import javafx.scene.control.test.utils.CommonPropertiesScene; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.TabPaneWithControl; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class NewNumberScatterChartApp extends InteroperabilityApp implements ChartIDsInterface { + + public final static String REMOVE_ITEM_POS_TEXT_FIELD_ID = "REMOVE_ITEM_POS_TEXT_FIELD_ID"; + public final static String REMOVE_BUTTON_ID = "REMOVE_BUTTON_ID"; + public final static String ADD_ITEM_TEXT_FIELD_ID = "ADD_ITEM_TEXT_FIELD_ID"; + public final static String ADD_ITEM_POSITION_TEXT_FIELD_ID = "ADD_ITEM_POSITION_TEXT_FIELD_ID"; + public final static String ADD_ITEM_BUTTON_ID = "ADD_ITEM_BUTTON_ID"; + + public static void main(String[] args) { + Utils.launch(NewNumberScatterChartApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "ScatterChartTestApp"); + return new NewNumberScatterChartApp.ScatterChartScene(); + } + + class ScatterChartScene extends CommonPropertiesScene { + + //ScatterChart to be tested. + ScatterChart testedScatterChart; + NumberAxis axis1; + NumberAxis axis2; + TabPaneWithControl pane; + + public ScatterChartScene() { + super("NumberScatterChart", 1300, 800); + } + + @Override + final protected void prepareScene() { + Utils.addBrowser(this); + + axis1 = new NumberAxis(0, 100, 10); + axis2 = new NumberAxis(0, 100, 10); + testedScatterChart = getNewChart(); + testedScatterChart.setId(TESTED_CHART_ID); + + Button hardResetButton = new Button("Hard reset"); + hardResetButton.setId(HARD_RESET_BUTTON_ID); + hardResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareMainSceneStructure(); + prepareScene(); + } + }); + + Button softResetButton = new Button("Soft reset"); + softResetButton.setId(SOFT_RESET_BUTTON_ID); + softResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + //throw new UnsupportedOperationException("Not supported yet."); + } + }); + + HBox resetButtonsHBox = new HBox(); + resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); + + VBox vb = new VBox(5); + vb.getChildren().addAll(resetButtonsHBox, getAddItemHBox(), getAddPointToSerieDialog(), getRemoveDataFromSerieDialog(), getRemoveDataDialog()); + + pane = getPaneFor(testedScatterChart, CHART_TAB_NAME, axis1, AXIS_1_TAB_NAME, axis2, AXIS_2_TAB_NAME); + + setTestedControlContainerSize(500, 500); + setTestedControl(testedScatterChart); + setPropertiesContent(pane); + setControllersContent(vb); + } + + public HBox getRemoveDataDialog() { + HBox hb = new HBox(); + Label lb = new Label("From position"); + final TextField tf = new TextField("0"); + tf.setPrefWidth(50); + tf.setId(REMOVE_ITEM_POS_TEXT_FIELD_ID); + Button bt = new Button("Remove!"); + bt.setId(REMOVE_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int index = Integer.parseInt(tf.getText()); + testedScatterChart.getData().remove(index); + } + }); + hb.getChildren().addAll(lb, tf, bt); + return hb; + } + + public HBox getRemoveDataFromSerieDialog() { + HBox hb = new HBox(); + Label lb1 = new Label("From serie"); + final TextField tf1 = new TextField("0"); + tf1.setPrefWidth(50); + + Label lb2 = new Label("from index"); + final TextField tf2 = new TextField("0"); + tf2.setPrefWidth(50); + + Button bt = new Button("remove point!"); + bt.setId(REMOVE_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int serie = Integer.parseInt(tf1.getText()); + int index = Integer.parseInt(tf2.getText()); + ((Series) testedScatterChart.getData().get(serie)).getData().remove(index); + } + }); + hb.getChildren().addAll(lb1, tf1, lb2, tf2, bt); + return hb; + } + + public HBox getAddPointToSerieDialog() { + HBox hb = new HBox(); + Label lb1 = new Label("To serie"); + final TextField tf1 = new TextField("0"); + tf1.setPrefWidth(50); + + Label lb2 = new Label("to index"); + final TextField tf2 = new TextField("0"); + tf2.setPrefWidth(50); + + Label lb3 = new Label("X"); + final TextField tf3 = new TextField("0"); + tf3.setPrefWidth(50); + + Label lb4 = new Label("Y"); + final TextField tf4 = new TextField("0"); + tf4.setPrefWidth(50); + + Button bt = new Button("add point!"); + bt.setId(REMOVE_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int serie = Integer.parseInt(tf1.getText()); + int index = Integer.parseInt(tf2.getText()); + double X = Double.parseDouble(tf3.getText()); + double Y = Double.parseDouble(tf4.getText()); + + XYChart.Data newData = new XYChart.Data(); + newData.setXValue(X); + newData.setYValue(Y); + + ((Series) testedScatterChart.getData().get(serie)).getData().add(index, newData); + } + }); + hb.getChildren().addAll(lb1, tf1, lb2, tf2, lb3, tf3, lb4, tf4, bt); + return hb; + } + + public HBox getAddItemHBox() { + HBox hb = new HBox(); + Label lb = new Label("Add series named "); + final TextField tf = new TextField(); + tf.setPrefWidth(50); + tf.setId(ADDED_SERIES_NAME_TEXTFIELD_ID); + + Label minLabel = new Label(" min "); + final TextField minText = new TextField(); + minText.setPrefWidth(50); + minText.setId(ADDED_SERIES_MIN_VALUE_TEXTFIELD_ID); + + Label maxLabel = new Label(" max "); + final TextField maxText = new TextField(); + maxText.setPrefWidth(50); + maxText.setId(ADDED_SERIES_MAX_VALUE_TEXTFIELD_ID); + + Label amountLabel = new Label(" amount "); + final TextField amountText = new TextField(); + amountText.setPrefWidth(50); + amountText.setId(ADDED_SERIES_DOTS_COUNT_TEXTFIELD_ID); + + Button bt = new Button("Add!"); + bt.setId(ADD_SERIES_COMMAND_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + String serieName = tf.getText(); + double min = Double.parseDouble(minText.getText()); + double max = Double.parseDouble(maxText.getText()); + int amount = Integer.parseInt(amountText.getText()); + + ObservableList list = FXCollections.observableArrayList(); + + Series serie = new XYChart.Series(serieName, list); + + for (int i = 0; i < amount; i++) { + Data newData = new Data(); + newData.setXValue(new Random().nextDouble() * (max - min) + min); + newData.setYValue(new Random().nextDouble() * (max - min) + min); + list.add(newData); + } + + testedScatterChart.getData().add(serie); + pane.addPropertiesTable(serieName, getTableForProperty(serie, min, max).getVisualRepresentation()); + } + }); + hb.getChildren().addAll(lb, tf, minLabel, minText, maxLabel, maxText, amountLabel, amountText, bt); + return hb; + } + + protected PropertiesTable getTableForProperty(Series serie, double min, double max) { + PropertiesTable table = new PropertiesTable(serie); + + table.addSimpleListener(serie.chartProperty(), serie); + table.addSimpleListener(serie.nameProperty(), serie); + table.addSimpleListener(serie.dataProperty(), serie); + + for (Iterator it = serie.getData().iterator(); it.hasNext();) { + final Data data = (Data) it.next(); + + final DoubleProperty intermediateX = new SimpleDoubleProperty(null, "XValue"); + final DoubleProperty intermediateY = new SimpleDoubleProperty(null, "YValue"); + + data.XValueProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + intermediateX.setValue((Double) data.XValueProperty().getValue()); + } + }); + + data.YValueProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + intermediateY.setValue((Double) data.YValueProperty().getValue()); + } + }); + + intermediateX.addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + data.setXValue(t1); + } + }); + + intermediateY.addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + data.setYValue(t1); + } + }); + + table.addDoublePropertyLine(intermediateX, min, max, (Double) data.getXValue(), data); + table.addDoublePropertyLine(intermediateY, min, max, (Double) data.getYValue(), data); + } + + return table; + } + + public ScatterChart getNewChart() { + ScatterChart chart = new ScatterChart(axis1, axis2); + chart.setTitle("ScatterChart"); + chart.setStyle("-fx-border-color: darkgray;"); + return chart; + } + } } \ No newline at end of file --- old/functional/ControlsTests/src/javafx/scene/control/test/chart/apps/NewPieChartApp.java 2016-12-22 11:26:21.493002605 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/chart/apps/NewPieChartApp.java 2016-12-22 11:26:21.441002103 +0300 @@ -1,201 +1,213 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.chart.apps; - -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.event.ActionEvent; -import javafx.event.Event; -import javafx.event.EventHandler; -import javafx.geometry.Insets; -import javafx.scene.Scene; -import javafx.scene.chart.PieChart; -import javafx.scene.chart.PieChart.Data; -import javafx.scene.control.*; -import javafx.scene.control.test.utils.CommonPropertiesScene; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; -import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Pane; -import javafx.scene.layout.VBox; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class NewPieChartApp extends InteroperabilityApp implements ChartIDsInterface { - - public final static String REMOVE_ITEM_POS_TEXT_FIELD_ID = "REMOVE_ITEM_POS_TEXT_FIELD_ID"; - public final static String REMOVE_BUTTON_ID = "REMOVE_BUTTON_ID"; - public final static String ADD_ITEM_VALUE_TEXT_FIELD_ID = "ADD_ITEM_VALUE_TEXT_FIELD_ID"; - public final static String ADD_ITEM_TEXT_FIELD_ID = "ADD_ITEM_TEXT_FIELD_ID"; - public final static String ADD_ITEM_POSITION_TEXT_FIELD_ID = "ADD_ITEM_POSITION_TEXT_FIELD_ID"; - public final static String ADD_ITEM_BUTTON_ID = "ADD_ITEM_BUTTON_ID"; - - public static void main(String[] args) { - Utils.launch(NewPieChartApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "PieChartTestApp"); - return new PieChartScene(); - } - - class PieChartScene extends CommonPropertiesScene { - - //VBox which contain tested PieChart. - Pane pane; - PropertiesTable tb; - //PieChart to be tested. - PieChart testedPieChart; - double controlContainerWidth = 600; - double controlContainerHeight = 600; - ObservableList data; - - public PieChartScene() { - super("PieChart", 1300, 800); - } - - @Override - final protected void prepareScene() { - Utils.addBrowser(this); - pane = new Pane(); - testedPieChart = getNewChart(); - testedPieChart.setId(TESTED_CHART_ID); - - tb = new PropertiesTable(testedPieChart); - PropertyTablesFactory.explorePropertiesList(testedPieChart, tb); - SpecialTablePropertiesProvider.provideForControl(testedPieChart, tb); - - pane.setMinSize(controlContainerWidth, controlContainerHeight); - pane.setPrefSize(controlContainerWidth, controlContainerHeight); - pane.setStyle("-fx-border-color : red;"); - pane.getChildren().add(testedPieChart); - - VBox vb = new VBox(); - vb.setSpacing(5); - - HBox hb = (HBox) getRoot(); - hb.setPadding(new Insets(5, 5, 5, 5)); - hb.setStyle("-fx-border-color : green;"); - - Button hardResetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Hard reset").build(); - hardResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareMainSceneStructure(); - prepareScene(); - } - }); - - Button softResetButton = ButtonBuilder.create().id(SOFT_RESET_BUTTON_ID).text("Soft reset").build(); - softResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - throw new UnsupportedOperationException("Not supported yet."); - } - }); - - Button b = new Button("Add"); - b.setOnAction(new EventHandler() { - public void handle(Event t) { - for (Data data : testedPieChart.getData()) { - Label label = new Label("Label"); - label.setLabelFor(data.getNode()); - } - } - }); - - HBox resetButtonsHBox = new HBox(); - resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton, b); - vb.getChildren().addAll(resetButtonsHBox, getAddItemHBox(), getRemoveDataDialog()); - - ScrollPane sp = new ScrollPane(); - sp.setContent(tb); - sp.setPannable(true); - sp.setMinWidth(1000); - sp.setMinHeight(800); - - setTestedControl(testedPieChart); - setPropertiesContent(sp); - setTestedControlContainerSize(500, 500); - setControllersContent(vb); - } - - public HBox getRemoveDataDialog() { - HBox hb = new HBox(); - Label lb = new Label("From position"); - final TextField tf = TextFieldBuilder.create().text("0").prefWidth(50).id(REMOVE_ITEM_POS_TEXT_FIELD_ID).build(); - Button bt = ButtonBuilder.create().text("Remove!").id(REMOVE_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int index = Integer.parseInt(tf.getText()); - ((PieChart) testedPieChart).getData().remove(index); - } - }); - hb.getChildren().addAll(lb, tf, bt); - return hb; - } - - public HBox getAddItemHBox() { - HBox hb = new HBox(); - Label lb = new Label("Add item"); - final TextField tf = TextFieldBuilder.create().prefWidth(50).id(ADD_ITEM_VALUE_TEXT_FIELD_ID).build(); - Label namedLabel = new Label(" named "); - final TextField name = TextFieldBuilder.create().prefWidth(50).id(ADD_ITEM_TEXT_FIELD_ID).build(); - Label atLb = new Label("at pos"); - final TextField tfPos = TextFieldBuilder.create().prefWidth(50).id(ADD_ITEM_POSITION_TEXT_FIELD_ID).build(); - Button bt = ButtonBuilder.create().text("Add!").id(ADD_ITEM_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int index = Integer.parseInt(tfPos.getText()); - - Data newData = new Data("".equals(name.getText()) ? String.valueOf(index) : name.getText(), Double.parseDouble(tf.getText())); - - ((PieChart) testedPieChart).getData().add(index, newData); - - tb.addDoublePropertyLine(newData.pieValueProperty(), -10, 10000, 100, newData); - } - }); - hb.getChildren().addAll(lb, tf, namedLabel, name, atLb, tfPos, bt); - return hb; - } - - public PieChart getNewChart() { - data = FXCollections.observableArrayList(); - //Don't change numbers here. - for (int i = 0; i < 4; i++) { - data.add(new Data("Data item " + i, 100)); - } - PieChart chart = new PieChart(data); - chart.setTitle("PieChart"); - chart.setStyle("-fx-border-color: darkgray;"); - return chart; - } - } +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.chart.apps; + +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.event.ActionEvent; +import javafx.event.Event; +import javafx.event.EventHandler; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.chart.PieChart; +import javafx.scene.chart.PieChart.Data; +import javafx.scene.control.*; +import javafx.scene.control.test.utils.CommonPropertiesScene; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; +import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class NewPieChartApp extends InteroperabilityApp implements ChartIDsInterface { + + public final static String REMOVE_ITEM_POS_TEXT_FIELD_ID = "REMOVE_ITEM_POS_TEXT_FIELD_ID"; + public final static String REMOVE_BUTTON_ID = "REMOVE_BUTTON_ID"; + public final static String ADD_ITEM_VALUE_TEXT_FIELD_ID = "ADD_ITEM_VALUE_TEXT_FIELD_ID"; + public final static String ADD_ITEM_TEXT_FIELD_ID = "ADD_ITEM_TEXT_FIELD_ID"; + public final static String ADD_ITEM_POSITION_TEXT_FIELD_ID = "ADD_ITEM_POSITION_TEXT_FIELD_ID"; + public final static String ADD_ITEM_BUTTON_ID = "ADD_ITEM_BUTTON_ID"; + + public static void main(String[] args) { + Utils.launch(NewPieChartApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "PieChartTestApp"); + return new PieChartScene(); + } + + class PieChartScene extends CommonPropertiesScene { + + //VBox which contain tested PieChart. + Pane pane; + PropertiesTable tb; + //PieChart to be tested. + PieChart testedPieChart; + double controlContainerWidth = 600; + double controlContainerHeight = 600; + ObservableList data; + + public PieChartScene() { + super("PieChart", 1300, 800); + } + + @Override + final protected void prepareScene() { + Utils.addBrowser(this); + pane = new Pane(); + testedPieChart = getNewChart(); + testedPieChart.setId(TESTED_CHART_ID); + + tb = new PropertiesTable(testedPieChart); + PropertyTablesFactory.explorePropertiesList(testedPieChart, tb); + SpecialTablePropertiesProvider.provideForControl(testedPieChart, tb); + + pane.setMinSize(controlContainerWidth, controlContainerHeight); + pane.setPrefSize(controlContainerWidth, controlContainerHeight); + pane.setStyle("-fx-border-color : red;"); + pane.getChildren().add(testedPieChart); + + VBox vb = new VBox(); + vb.setSpacing(5); + + HBox hb = (HBox) getRoot(); + hb.setPadding(new Insets(5, 5, 5, 5)); + hb.setStyle("-fx-border-color : green;"); + + Button hardResetButton = new Button("Hard reset"); + hardResetButton.setId(HARD_RESET_BUTTON_ID); + hardResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareMainSceneStructure(); + prepareScene(); + } + }); + + Button softResetButton = new Button("Soft reset"); + softResetButton.setId(SOFT_RESET_BUTTON_ID); + softResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + throw new UnsupportedOperationException("Not supported yet."); + } + }); + + Button b = new Button("Add"); + b.setOnAction(new EventHandler() { + public void handle(Event t) { + for (Data data : testedPieChart.getData()) { + Label label = new Label("Label"); + label.setLabelFor(data.getNode()); + } + } + }); + + HBox resetButtonsHBox = new HBox(); + resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton, b); + vb.getChildren().addAll(resetButtonsHBox, getAddItemHBox(), getRemoveDataDialog()); + + ScrollPane sp = new ScrollPane(); + sp.setContent(tb); + sp.setPannable(true); + sp.setMinWidth(1000); + sp.setMinHeight(800); + + setTestedControl(testedPieChart); + setPropertiesContent(sp); + setTestedControlContainerSize(500, 500); + setControllersContent(vb); + } + + public HBox getRemoveDataDialog() { + HBox hb = new HBox(); + Label lb = new Label("From position"); + final TextField tf = new TextField("0"); + tf.setPrefWidth(50); + tf.setId(REMOVE_ITEM_POS_TEXT_FIELD_ID); + Button bt = new Button("Remove!"); + bt.setId(REMOVE_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int index = Integer.parseInt(tf.getText()); + ((PieChart) testedPieChart).getData().remove(index); + } + }); + hb.getChildren().addAll(lb, tf, bt); + return hb; + } + + public HBox getAddItemHBox() { + HBox hb = new HBox(); + Label lb = new Label("Add item"); + final TextField tf = new TextField(); + tf.setPrefWidth(50); + tf.setId(ADD_ITEM_VALUE_TEXT_FIELD_ID); + Label namedLabel = new Label(" named "); + final TextField name = new TextField(); + name.setPrefWidth(50); + name.setId(ADD_ITEM_TEXT_FIELD_ID); + Label atLb = new Label("at pos"); + final TextField tfPos = new TextField(); + tfPos.setPrefWidth(50); + tfPos.setId(ADD_ITEM_POSITION_TEXT_FIELD_ID); + Button bt = new Button("Add!"); + bt.setId(ADD_ITEM_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int index = Integer.parseInt(tfPos.getText()); + + Data newData = new Data("".equals(name.getText()) ? String.valueOf(index) : name.getText(), Double.parseDouble(tf.getText())); + + ((PieChart) testedPieChart).getData().add(index, newData); + + tb.addDoublePropertyLine(newData.pieValueProperty(), -10, 10000, 100, newData); + } + }); + hb.getChildren().addAll(lb, tf, namedLabel, name, atLb, tfPos, bt); + return hb; + } + + public PieChart getNewChart() { + data = FXCollections.observableArrayList(); + //Don't change numbers here. + for (int i = 0; i < 4; i++) { + data.add(new Data("Data item " + i, 100)); + } + PieChart chart = new PieChart(data); + chart.setTitle("PieChart"); + chart.setStyle("-fx-border-color: darkgray;"); + return chart; + } + } } \ No newline at end of file --- old/functional/ControlsTests/src/javafx/scene/control/test/chart/apps/NewStackedAreaChartApp.java 2016-12-22 11:26:21.681004418 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/chart/apps/NewStackedAreaChartApp.java 2016-12-22 11:26:21.629003917 +0300 @@ -1,234 +1,248 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.chart.apps; - -import java.util.Arrays; -import java.util.Comparator; -import java.util.Iterator; -import java.util.Random; -import javafx.beans.property.DoubleProperty; -import javafx.beans.property.SimpleDoubleProperty; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.event.ActionEvent; -import javafx.event.Event; -import javafx.event.EventHandler; -import javafx.scene.Scene; -import javafx.scene.chart.NumberAxis; -import javafx.scene.chart.StackedAreaChart; -import javafx.scene.chart.XYChart; -import javafx.scene.control.*; -import static javafx.scene.control.test.chart.apps.CommonFunctions.*; -import javafx.scene.control.test.utils.CommonPropertiesScene; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.TabPaneWithControl; -import javafx.scene.layout.HBox; -import javafx.scene.layout.VBox; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class NewStackedAreaChartApp extends InteroperabilityApp implements ChartIDsInterface { - - public static void main(String[] args) { - Utils.launch(NewStackedAreaChartApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "StackedAreaChartTestApp"); - return new NewStackedAreaChartApp.AreaChartScene(); - } - - class AreaChartScene extends CommonPropertiesScene { - - //AreaChart to be tested. - StackedAreaChart testedStackedAreaChart; - NumberAxis axis1; - NumberAxis axis2; - TabPaneWithControl pane; - - public AreaChartScene() { - super("StackedAreaChartApp", 1300, 800); - } - - @Override - final protected void prepareScene() { - Utils.addBrowser(this); - - axis1 = new NumberAxis(0, 100, 10); - axis2 = new NumberAxis(0, 100, 10); - testedStackedAreaChart = getNewChart(); - testedStackedAreaChart.setId(TESTED_CHART_ID); - - Button hardResetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Hard reset").build(); - hardResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareMainSceneStructure(); - prepareScene(); - } - }); - - Button softResetButton = ButtonBuilder.create().id(SOFT_RESET_BUTTON_ID).text("Soft reset").build(); - softResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - //throw new UnsupportedOperationException("Not supported yet."); - } - }); - - HBox resetButtonsHBox = new HBox(); - resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); - - VBox vb = new VBox(5); - vb.getChildren().addAll(resetButtonsHBox, getAddItemHBox(), getRemoveDataDialog()); - - pane = getPaneFor(testedStackedAreaChart, CHART_TAB_NAME, axis1, AXIS_1_TAB_NAME, axis2, AXIS_2_TAB_NAME); - - setTestedControlContainerSize(500, 500); - setTestedControl(testedStackedAreaChart); - setPropertiesContent(pane); - setControllersContent(vb); - } - - public HBox getRemoveDataDialog() { - HBox hb = new HBox(); - Label lb = new Label("From position"); - final TextField tf = TextFieldBuilder.create().text("0").prefWidth(50).id(REMOVE_AREA_INDEX_TEXTFIELD_ID).build(); - Button bt = ButtonBuilder.create().text("Remove!").id(REMOVE_AREA_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int index = Integer.parseInt(tf.getText()); - testedStackedAreaChart.getData().remove(index); - } - }); - hb.getChildren().addAll(lb, tf, bt); - return hb; - } - - public HBox getAddItemHBox() { - HBox hb = new HBox(); - Label lb = new Label("Add series named "); - final TextField tf = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_NAME_TEXTFIELD_ID).build(); - - Label minLabel = new Label(" min "); - final TextField minText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_MIN_VALUE_TEXTFIELD_ID).build(); - - Label maxLabel = new Label(" max "); - final TextField maxText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_MAX_VALUE_TEXTFIELD_ID).build(); - - Label amountLabel = new Label(" amount "); - final TextField amountText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_DOTS_COUNT_TEXTFIELD_ID).build(); - - Button bt = ButtonBuilder.create().text("Add!").id(ADD_SERIES_COMMAND_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - String serieName = tf.getText(); - double min = Double.parseDouble(minText.getText()); - double max = Double.parseDouble(maxText.getText()); - int amount = Integer.parseInt(amountText.getText()); - - ObservableList list = FXCollections.observableArrayList(); - - for (int i = 0; i < amount; i++) { - XYChart.Data newData = new XYChart.Data(); - newData.setXValue(new Random().nextDouble() * (max - min) + min); - newData.setYValue(new Random().nextDouble() * (max - min) / 4 + min); - list.add(newData); - } - Object[] array = list.toArray(); - Arrays.sort(array, new Comparator() { - public int compare(Object t, Object t1) { - return (int) Math.round(((Double) ((XYChart.Data) t).getXValue()) - ((Double) ((XYChart.Data) t1).getXValue())); - } - }); - - XYChart.Series serie = new XYChart.Series(serieName, FXCollections.observableArrayList(array)); - - testedStackedAreaChart.getData().add(serie); - pane.addPropertiesTable(serieName, getTableForProperty(serie, min, max).getVisualRepresentation()); - } - }); - hb.getChildren().addAll(lb, tf, minLabel, minText, maxLabel, maxText, amountLabel, amountText, bt); - return hb; - } - - protected PropertiesTable getTableForProperty(XYChart.Series serie, double min, double max) { - PropertiesTable table = new PropertiesTable(serie); - - table.addSimpleListener(serie.chartProperty(), serie); - table.addSimpleListener(serie.nameProperty(), serie); - table.addSimpleListener(serie.dataProperty(), serie); - - for (Iterator it = serie.getData().iterator(); it.hasNext();) { - final XYChart.Data data = (XYChart.Data) it.next(); - - final DoubleProperty intermediateX = new SimpleDoubleProperty(null, "XValue"); - final DoubleProperty intermediateY = new SimpleDoubleProperty(null, "YValue"); - - data.XValueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - intermediateX.setValue((Double) data.XValueProperty().getValue()); - } - }); - - data.YValueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - intermediateY.setValue((Double) data.YValueProperty().getValue()); - } - }); - - intermediateX.addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - data.setXValue(t1); - } - }); - - intermediateY.addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - data.setYValue(t1); - } - }); - - table.addDoublePropertyLine(intermediateX, min, max, (Double) data.getXValue(), data); - table.addDoublePropertyLine(intermediateY, min, max, (Double) data.getYValue(), data); - } - - return table; - } - - public StackedAreaChart getNewChart() { - StackedAreaChart chart = new StackedAreaChart(axis1, axis2); - chart.setTitle("StackedAreaChart"); - chart.setStyle("-fx-border-color: darkgray;"); - return chart; - } - } +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.chart.apps; + +import java.util.Arrays; +import java.util.Comparator; +import java.util.Iterator; +import java.util.Random; +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.SimpleDoubleProperty; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.event.ActionEvent; +import javafx.event.Event; +import javafx.event.EventHandler; +import javafx.scene.Scene; +import javafx.scene.chart.NumberAxis; +import javafx.scene.chart.StackedAreaChart; +import javafx.scene.chart.XYChart; +import javafx.scene.control.*; +import static javafx.scene.control.test.chart.apps.CommonFunctions.*; +import javafx.scene.control.test.utils.CommonPropertiesScene; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.TabPaneWithControl; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class NewStackedAreaChartApp extends InteroperabilityApp implements ChartIDsInterface { + + public static void main(String[] args) { + Utils.launch(NewStackedAreaChartApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "StackedAreaChartTestApp"); + return new NewStackedAreaChartApp.AreaChartScene(); + } + + class AreaChartScene extends CommonPropertiesScene { + + //AreaChart to be tested. + StackedAreaChart testedStackedAreaChart; + NumberAxis axis1; + NumberAxis axis2; + TabPaneWithControl pane; + + public AreaChartScene() { + super("StackedAreaChartApp", 1300, 800); + } + + @Override + final protected void prepareScene() { + Utils.addBrowser(this); + + axis1 = new NumberAxis(0, 100, 10); + axis2 = new NumberAxis(0, 100, 10); + testedStackedAreaChart = getNewChart(); + testedStackedAreaChart.setId(TESTED_CHART_ID); + + Button hardResetButton = new Button("Hard reset"); + hardResetButton.setId(HARD_RESET_BUTTON_ID); + hardResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareMainSceneStructure(); + prepareScene(); + } + }); + + Button softResetButton = new Button("Soft reset"); + softResetButton.setId(SOFT_RESET_BUTTON_ID); + softResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + //throw new UnsupportedOperationException("Not supported yet."); + } + }); + + HBox resetButtonsHBox = new HBox(); + resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); + + VBox vb = new VBox(5); + vb.getChildren().addAll(resetButtonsHBox, getAddItemHBox(), getRemoveDataDialog()); + + pane = getPaneFor(testedStackedAreaChart, CHART_TAB_NAME, axis1, AXIS_1_TAB_NAME, axis2, AXIS_2_TAB_NAME); + + setTestedControlContainerSize(500, 500); + setTestedControl(testedStackedAreaChart); + setPropertiesContent(pane); + setControllersContent(vb); + } + + public HBox getRemoveDataDialog() { + HBox hb = new HBox(); + Label lb = new Label("From position"); + final TextField tf = new TextField("0"); + tf.setPrefWidth(50); + tf.setId(REMOVE_AREA_INDEX_TEXTFIELD_ID); + Button bt = new Button("Remove!"); + bt.setId(REMOVE_AREA_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int index = Integer.parseInt(tf.getText()); + testedStackedAreaChart.getData().remove(index); + } + }); + hb.getChildren().addAll(lb, tf, bt); + return hb; + } + + public HBox getAddItemHBox() { + HBox hb = new HBox(); + Label lb = new Label("Add series named "); + final TextField tf = new TextField(); + tf.setPrefWidth(50); + tf.setId(ADDED_SERIES_NAME_TEXTFIELD_ID); + + Label minLabel = new Label(" min "); + final TextField minText = new TextField(); + minText.setPrefWidth(50); + minText.setId(ADDED_SERIES_MIN_VALUE_TEXTFIELD_ID); + + Label maxLabel = new Label(" max "); + final TextField maxText = new TextField(); + maxText.setPrefWidth(50); + maxText.setId(ADDED_SERIES_MAX_VALUE_TEXTFIELD_ID); + + Label amountLabel = new Label(" amount "); + final TextField amountText = new TextField(); + amountText.setPrefWidth(50); + amountText.setId(ADDED_SERIES_DOTS_COUNT_TEXTFIELD_ID); + + Button bt = new Button("Add!"); + bt.setId(ADD_SERIES_COMMAND_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + String serieName = tf.getText(); + double min = Double.parseDouble(minText.getText()); + double max = Double.parseDouble(maxText.getText()); + int amount = Integer.parseInt(amountText.getText()); + + ObservableList list = FXCollections.observableArrayList(); + + for (int i = 0; i < amount; i++) { + XYChart.Data newData = new XYChart.Data(); + newData.setXValue(new Random().nextDouble() * (max - min) + min); + newData.setYValue(new Random().nextDouble() * (max - min) / 4 + min); + list.add(newData); + } + Object[] array = list.toArray(); + Arrays.sort(array, new Comparator() { + public int compare(Object t, Object t1) { + return (int) Math.round(((Double) ((XYChart.Data) t).getXValue()) - ((Double) ((XYChart.Data) t1).getXValue())); + } + }); + + XYChart.Series serie = new XYChart.Series(serieName, FXCollections.observableArrayList(array)); + + testedStackedAreaChart.getData().add(serie); + pane.addPropertiesTable(serieName, getTableForProperty(serie, min, max).getVisualRepresentation()); + } + }); + hb.getChildren().addAll(lb, tf, minLabel, minText, maxLabel, maxText, amountLabel, amountText, bt); + return hb; + } + + protected PropertiesTable getTableForProperty(XYChart.Series serie, double min, double max) { + PropertiesTable table = new PropertiesTable(serie); + + table.addSimpleListener(serie.chartProperty(), serie); + table.addSimpleListener(serie.nameProperty(), serie); + table.addSimpleListener(serie.dataProperty(), serie); + + for (Iterator it = serie.getData().iterator(); it.hasNext();) { + final XYChart.Data data = (XYChart.Data) it.next(); + + final DoubleProperty intermediateX = new SimpleDoubleProperty(null, "XValue"); + final DoubleProperty intermediateY = new SimpleDoubleProperty(null, "YValue"); + + data.XValueProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + intermediateX.setValue((Double) data.XValueProperty().getValue()); + } + }); + + data.YValueProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + intermediateY.setValue((Double) data.YValueProperty().getValue()); + } + }); + + intermediateX.addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + data.setXValue(t1); + } + }); + + intermediateY.addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + data.setYValue(t1); + } + }); + + table.addDoublePropertyLine(intermediateX, min, max, (Double) data.getXValue(), data); + table.addDoublePropertyLine(intermediateY, min, max, (Double) data.getYValue(), data); + } + + return table; + } + + public StackedAreaChart getNewChart() { + StackedAreaChart chart = new StackedAreaChart(axis1, axis2); + chart.setTitle("StackedAreaChart"); + chart.setStyle("-fx-border-color: darkgray;"); + return chart; + } + } } \ No newline at end of file --- old/functional/ControlsTests/src/javafx/scene/control/test/chart/apps/NewStackedBarChartApp.java 2016-12-22 11:26:21.877006308 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/chart/apps/NewStackedBarChartApp.java 2016-12-22 11:26:21.825005806 +0300 @@ -1,273 +1,290 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.chart.apps; - -import java.util.Iterator; -import java.util.Random; -import javafx.beans.property.DoubleProperty; -import javafx.beans.property.SimpleDoubleProperty; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.event.ActionEvent; -import javafx.event.Event; -import javafx.event.EventHandler; -import javafx.scene.Scene; -import javafx.scene.chart.CategoryAxis; -import javafx.scene.chart.NumberAxis; -import javafx.scene.chart.StackedBarChart; -import javafx.scene.chart.XYChart; -import javafx.scene.control.*; -import static javafx.scene.control.test.chart.apps.CommonFunctions.*; -import javafx.scene.control.test.utils.CommonPropertiesScene; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.TabPaneWithControl; -import javafx.scene.layout.HBox; -import javafx.scene.layout.VBox; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class NewStackedBarChartApp extends InteroperabilityApp implements ChartIDsInterface { - - public final static String REMOVE_ITEM_POS_TEXT_FIELD_ID = "REMOVE_ITEM_POS_TEXT_FIELD_ID"; - public final static String REMOVE_BUTTON_ID = "REMOVE_BUTTON_ID"; - public final static String ADD_ITEM_TEXT_FIELD_ID = "ADD_ITEM_TEXT_FIELD_ID"; - public final static String ADD_ITEM_POSITION_TEXT_FIELD_ID = "ADD_ITEM_POSITION_TEXT_FIELD_ID"; - public final static String ADD_ITEM_BUTTON_ID = "ADD_ITEM_BUTTON_ID"; - - public static void main(String[] args) { - Utils.launch(NewStackedBarChartApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "ScatterChartTestApp"); - return new NewStackedBarChartApp.StackedBarChartScene(); - } - - class StackedBarChartScene extends CommonPropertiesScene { - - //StackedBarChart to be tested. - StackedBarChart testedStackedBarChart; - NumberAxis axis2; - ObservableList existingCategories; - CategoryAxis axis1; - TabPaneWithControl pane; - - public StackedBarChartScene() { - super("StackedBarChart", 1300, 800); - } - - @Override - final protected void prepareScene() { - Utils.addBrowser(this); - - existingCategories = FXCollections.observableArrayList(); - existingCategories.addAll("category1", "category2", "category3"); - axis1 = new CategoryAxis(existingCategories); - axis2 = new NumberAxis(0, 100, 10); - testedStackedBarChart = getNewChart(); - testedStackedBarChart.setId(TESTED_CHART_ID); - - Button hardResetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Hard reset").build(); - hardResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareMainSceneStructure(); - prepareScene(); - } - }); - - Button softResetButton = ButtonBuilder.create().id(SOFT_RESET_BUTTON_ID).text("Soft reset").build(); - softResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - //throw new UnsupportedOperationException("Not supported yet."); - } - }); - - HBox resetButtonsHBox = new HBox(); - resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); - - VBox vb = new VBox(5); - vb.getChildren().addAll(resetButtonsHBox, getAddItemHBox(), getRemoveDataDialog(), getAddCategoryDialog(), getRemoveCategoryDialog()); - - pane = getPaneFor(testedStackedBarChart, CHART_TAB_NAME, axis1, AXIS_1_TAB_NAME, axis2, AXIS_2_TAB_NAME); - - setTestedControlContainerSize(500, 500); - setTestedControl(testedStackedBarChart); - setPropertiesContent(pane); - setControllersContent(vb); - } - - public HBox getRemoveDataDialog() { - HBox hb = new HBox(); - Label lb = new Label("From position"); - final TextField tf = TextFieldBuilder.create().text("0").prefWidth(50).id(REMOVE_ITEM_POS_TEXT_FIELD_ID).build(); - Button bt = ButtonBuilder.create().text("Remove!").id(REMOVE_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int index = Integer.parseInt(tf.getText()); - testedStackedBarChart.getData().remove(index); - } - }); - hb.getChildren().addAll(lb, tf, bt); - return hb; - } - - public HBox getRemoveCategoryDialog() { - HBox hb = new HBox(); - Label lb = new Label("From index"); - final TextField tf = TextFieldBuilder.create().text("0").prefWidth(50).build(); - Button bt = ButtonBuilder.create().text("Remove category!").build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int index = Integer.parseInt(tf.getText()); - existingCategories.remove(index); - axis1.getCategories().remove(index); - } - }); - hb.getChildren().addAll(lb, tf, bt); - return hb; - } - - public HBox getAddCategoryDialog() { - HBox hb = new HBox(); - Label lb = new Label("Category"); - final TextField tf = TextFieldBuilder.create().text("").prefWidth(50).build(); - - Label lind = new Label("to index"); - final TextField tfind = TextFieldBuilder.create().text("0").prefWidth(50).build(); - - Button bt = ButtonBuilder.create().text("Add!").build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - int index = Integer.parseInt(tfind.getText()); - existingCategories.add(index, tf.getText()); - axis1.getCategories().add(index, tf.getText()); - } - }); - hb.getChildren().addAll(lb, tf, lind, tfind, bt); - return hb; - } - - public HBox getAddItemHBox() { - HBox hb = new HBox(); - Label lb = new Label("Add series named "); - final TextField tf = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_NAME_TEXTFIELD_ID).build(); - - Label minLabel = new Label(" min "); - final TextField minText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_MIN_VALUE_TEXTFIELD_ID).build(); - - Label maxLabel = new Label(" max "); - final TextField maxText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_MAX_VALUE_TEXTFIELD_ID).build(); - - Label amountLabel = new Label(" amount "); - final TextField amountText = TextFieldBuilder.create().prefWidth(50).id(ADDED_SERIES_DOTS_COUNT_TEXTFIELD_ID).build(); - - Button bt = ButtonBuilder.create().text("Add!").id(ADD_SERIES_COMMAND_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - String serieName = tf.getText(); - double min = Double.parseDouble(minText.getText()); - double max = Double.parseDouble(maxText.getText()); - int amount = Integer.parseInt(amountText.getText()); - - ObservableList list = FXCollections.observableArrayList(); - - XYChart.Series serie = new XYChart.Series(serieName, list); - - for (int i = 0; i < amount; i++) { - XYChart.Data newData = new XYChart.Data(); - String category = existingCategories.get(new Random().nextInt(existingCategories.size())); - Double value = new Random().nextDouble() * (max - min) + min; - newData.setYValue(value); - newData.setXValue(category); - list.add(newData); - } - - testedStackedBarChart.getData().add(serie); - pane.addPropertiesTable(serieName, getTableForProperty(serie, min, max).getVisualRepresentation()); - } - }); - hb.getChildren().addAll(lb, tf, minLabel, minText, maxLabel, maxText, amountLabel, amountText, bt); - return hb; - } - - protected PropertiesTable getTableForProperty(XYChart.Series serie, double min, double max) { - PropertiesTable table = new PropertiesTable(serie); - - table.addSimpleListener(serie.chartProperty(), serie); - table.addSimpleListener(serie.nameProperty(), serie); - table.addSimpleListener(serie.dataProperty(), serie); - - for (Iterator it = serie.getData().iterator(); it.hasNext();) { - final XYChart.Data data = (XYChart.Data) it.next(); - - final DoubleProperty intermediateX = new SimpleDoubleProperty(null, "XValue"); - final DoubleProperty intermediateY = new SimpleDoubleProperty(null, "YValue"); - - data.XValueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - intermediateX.setValue((Double) data.XValueProperty().getValue()); - } - }); - - data.YValueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - intermediateY.setValue((Double) data.YValueProperty().getValue()); - } - }); - - intermediateX.addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - data.setXValue(t1); - } - }); - - intermediateY.addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - data.setYValue(t1); - } - }); - - table.addDoublePropertyLine(intermediateY, min, max, (Double) data.getYValue(), data); - } - - return table; - } - - public StackedBarChart getNewChart() { - StackedBarChart chart = new StackedBarChart(axis1, axis2); - chart.setTitle("StackedBarChart"); - chart.setStyle("-fx-border-color: darkgray;"); - return chart; - } - } +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.chart.apps; + +import java.util.Iterator; +import java.util.Random; +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.SimpleDoubleProperty; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.event.ActionEvent; +import javafx.event.Event; +import javafx.event.EventHandler; +import javafx.scene.Scene; +import javafx.scene.chart.CategoryAxis; +import javafx.scene.chart.NumberAxis; +import javafx.scene.chart.StackedBarChart; +import javafx.scene.chart.XYChart; +import javafx.scene.control.*; +import static javafx.scene.control.test.chart.apps.CommonFunctions.*; +import javafx.scene.control.test.utils.CommonPropertiesScene; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.TabPaneWithControl; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class NewStackedBarChartApp extends InteroperabilityApp implements ChartIDsInterface { + + public final static String REMOVE_ITEM_POS_TEXT_FIELD_ID = "REMOVE_ITEM_POS_TEXT_FIELD_ID"; + public final static String REMOVE_BUTTON_ID = "REMOVE_BUTTON_ID"; + public final static String ADD_ITEM_TEXT_FIELD_ID = "ADD_ITEM_TEXT_FIELD_ID"; + public final static String ADD_ITEM_POSITION_TEXT_FIELD_ID = "ADD_ITEM_POSITION_TEXT_FIELD_ID"; + public final static String ADD_ITEM_BUTTON_ID = "ADD_ITEM_BUTTON_ID"; + + public static void main(String[] args) { + Utils.launch(NewStackedBarChartApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "ScatterChartTestApp"); + return new NewStackedBarChartApp.StackedBarChartScene(); + } + + class StackedBarChartScene extends CommonPropertiesScene { + + //StackedBarChart to be tested. + StackedBarChart testedStackedBarChart; + NumberAxis axis2; + ObservableList existingCategories; + CategoryAxis axis1; + TabPaneWithControl pane; + + public StackedBarChartScene() { + super("StackedBarChart", 1300, 800); + } + + @Override + final protected void prepareScene() { + Utils.addBrowser(this); + + existingCategories = FXCollections.observableArrayList(); + existingCategories.addAll("category1", "category2", "category3"); + axis1 = new CategoryAxis(existingCategories); + axis2 = new NumberAxis(0, 100, 10); + testedStackedBarChart = getNewChart(); + testedStackedBarChart.setId(TESTED_CHART_ID); + + Button hardResetButton = new Button("Hard reset"); + hardResetButton.setId(HARD_RESET_BUTTON_ID); + hardResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareMainSceneStructure(); + prepareScene(); + } + }); + + Button softResetButton = new Button("Soft reset"); + softResetButton.setId(SOFT_RESET_BUTTON_ID); + softResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + //throw new UnsupportedOperationException("Not supported yet."); + } + }); + + HBox resetButtonsHBox = new HBox(); + resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); + + VBox vb = new VBox(5); + vb.getChildren().addAll(resetButtonsHBox, getAddItemHBox(), getRemoveDataDialog(), getAddCategoryDialog(), getRemoveCategoryDialog()); + + pane = getPaneFor(testedStackedBarChart, CHART_TAB_NAME, axis1, AXIS_1_TAB_NAME, axis2, AXIS_2_TAB_NAME); + + setTestedControlContainerSize(500, 500); + setTestedControl(testedStackedBarChart); + setPropertiesContent(pane); + setControllersContent(vb); + } + + public HBox getRemoveDataDialog() { + HBox hb = new HBox(); + Label lb = new Label("From position"); + final TextField tf = new TextField("0"); + tf.setPrefWidth(50); + tf.setId(REMOVE_ITEM_POS_TEXT_FIELD_ID); + Button bt = new Button("Remove!"); + bt.setId(REMOVE_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int index = Integer.parseInt(tf.getText()); + testedStackedBarChart.getData().remove(index); + } + }); + hb.getChildren().addAll(lb, tf, bt); + return hb; + } + + public HBox getRemoveCategoryDialog() { + HBox hb = new HBox(); + Label lb = new Label("From index"); + final TextField tf = new TextField("0"); + tf.setPrefWidth(50); + Button bt = new Button("Remove category!"); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int index = Integer.parseInt(tf.getText()); + existingCategories.remove(index); + axis1.getCategories().remove(index); + } + }); + hb.getChildren().addAll(lb, tf, bt); + return hb; + } + + public HBox getAddCategoryDialog() { + HBox hb = new HBox(); + Label lb = new Label("Category"); + final TextField tf = new TextField(""); + tf.setPrefWidth(50); + + Label lind = new Label("to index"); + final TextField tfind = new TextField("0"); + tfind.setPrefWidth(50); + + Button bt = new Button("Add!"); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + int index = Integer.parseInt(tfind.getText()); + existingCategories.add(index, tf.getText()); + axis1.getCategories().add(index, tf.getText()); + } + }); + hb.getChildren().addAll(lb, tf, lind, tfind, bt); + return hb; + } + + public HBox getAddItemHBox() { + HBox hb = new HBox(); + Label lb = new Label("Add series named "); + final TextField tf = new TextField(); + tf.setPrefWidth(50); + tf.setId(ADDED_SERIES_NAME_TEXTFIELD_ID); + + Label minLabel = new Label(" min "); + final TextField minText = new TextField(); + minText.setPrefWidth(50); + minText.setId(ADDED_SERIES_MIN_VALUE_TEXTFIELD_ID); + + Label maxLabel = new Label(" max "); + final TextField maxText = new TextField(); + maxText.setPrefWidth(50); + maxText.setId(ADDED_SERIES_MAX_VALUE_TEXTFIELD_ID); + + Label amountLabel = new Label(" amount "); + final TextField amountText = new TextField(); + amountText.setPrefWidth(50); + amountText.setId(ADDED_SERIES_DOTS_COUNT_TEXTFIELD_ID); + + Button bt = new Button("Add!"); + bt.setId(ADD_SERIES_COMMAND_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + String serieName = tf.getText(); + double min = Double.parseDouble(minText.getText()); + double max = Double.parseDouble(maxText.getText()); + int amount = Integer.parseInt(amountText.getText()); + + ObservableList list = FXCollections.observableArrayList(); + + XYChart.Series serie = new XYChart.Series(serieName, list); + + for (int i = 0; i < amount; i++) { + XYChart.Data newData = new XYChart.Data(); + String category = existingCategories.get(new Random().nextInt(existingCategories.size())); + Double value = new Random().nextDouble() * (max - min) + min; + newData.setYValue(value); + newData.setXValue(category); + list.add(newData); + } + + testedStackedBarChart.getData().add(serie); + pane.addPropertiesTable(serieName, getTableForProperty(serie, min, max).getVisualRepresentation()); + } + }); + hb.getChildren().addAll(lb, tf, minLabel, minText, maxLabel, maxText, amountLabel, amountText, bt); + return hb; + } + + protected PropertiesTable getTableForProperty(XYChart.Series serie, double min, double max) { + PropertiesTable table = new PropertiesTable(serie); + + table.addSimpleListener(serie.chartProperty(), serie); + table.addSimpleListener(serie.nameProperty(), serie); + table.addSimpleListener(serie.dataProperty(), serie); + + for (Iterator it = serie.getData().iterator(); it.hasNext();) { + final XYChart.Data data = (XYChart.Data) it.next(); + + final DoubleProperty intermediateX = new SimpleDoubleProperty(null, "XValue"); + final DoubleProperty intermediateY = new SimpleDoubleProperty(null, "YValue"); + + data.XValueProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + intermediateX.setValue((Double) data.XValueProperty().getValue()); + } + }); + + data.YValueProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + intermediateY.setValue((Double) data.YValueProperty().getValue()); + } + }); + + intermediateX.addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + data.setXValue(t1); + } + }); + + intermediateY.addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + data.setYValue(t1); + } + }); + + table.addDoublePropertyLine(intermediateY, min, max, (Double) data.getYValue(), data); + } + + return table; + } + + public StackedBarChart getNewChart() { + StackedBarChart chart = new StackedBarChart(axis1, axis2); + chart.setTitle("StackedBarChart"); + chart.setStyle("-fx-border-color: darkgray;"); + return chart; + } + } } \ No newline at end of file --- old/functional/ControlsTests/src/javafx/scene/control/test/chart/manual/PieChartManualApp.java 2016-12-22 11:26:22.069008159 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/chart/manual/PieChartManualApp.java 2016-12-22 11:26:22.021007697 +0300 @@ -1,156 +1,155 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.chart.manual; - -import javafx.scene.control.test.utils.ptables.WeakPropertyValueController; -import java.util.Arrays; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.scene.chart.PieChart; -import javafx.scene.Scene; -import javafx.scene.control.*; -import javafx.scene.control.ButtonBuilder; -import javafx.scene.control.test.utils.CommonPropertiesScene; -import javafx.geometry.Side; -import javafx.scene.layout.HBox; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; -import javafx.scene.layout.VBox; -import javafx.geometry.Orientation; - -/** - * @author Alexander Kirov - */ -public class PieChartManualApp extends InteroperabilityApp { - - public static void main(String[] args) { - Utils.launch(PieChartManualApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "PieChartTestApp"); - return new PieChartScene(); - } - - class PieChartScene extends CommonPropertiesScene { - - //PieChart to be tested. - PieChart testedPieChart; - int controlContainerWidth = 400; - int controlContainerHeight = 400; - ObservableList data; - VBox properties; - - public PieChartScene() { - super("PieChart", 900, 630); - - prepareScene(); - } - - @Override - final protected void prepareScene() { - testedPieChart = getNewChart(); - testedPieChart.setPrefSize(controlContainerHeight, controlContainerWidth); - properties = new VBox(10); - - Button addDataButton = new Button("Add data at index 0"); - addDataButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - testedPieChart.getData().add(0, new PieChart.Data("Added data", Math.random() * 100)); - } - }); - - Button removeDataButton = new Button("Remove data from index 0"); - removeDataButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - if (testedPieChart.getData().size() > 0) { - testedPieChart.getData().remove(0); - } - } - }); - - Button changeDataButton = new Button("Change data at index 0"); - changeDataButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - if (testedPieChart.getData().size() > 0) { - PieChart.Data data = testedPieChart.getData().get(0); - data.setPieValue(Math.max(0, data.getPieValue() + (Math.random() - 0.5) * 200)); - } - } - }); - - Button hardResetButton = ButtonBuilder.create().text("Reset").build(); - hardResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareMainSceneStructure(); - prepareScene(); - } - }); - - VBox vb = new VBox(5); - vb.getChildren().addAll(hardResetButton, - new Separator(Orientation.HORIZONTAL), new Label("Add new data : "), addDataButton, - new Separator(Orientation.HORIZONTAL), new Label("Remove existing data : "), removeDataButton, - new Separator(Orientation.HORIZONTAL), new Label("Change existing data : "), changeDataButton); - - addController(new WeakPropertyValueController(testedPieChart.animatedProperty(), testedPieChart)); - addController(new WeakPropertyValueController(testedPieChart.clockwiseProperty(), testedPieChart)); - addController(new WeakPropertyValueController(testedPieChart.legendVisibleProperty(), testedPieChart)); - addController(new WeakPropertyValueController(testedPieChart.startAngleProperty(), testedPieChart, -300.0, 0.0, 300.0)); - addController(new WeakPropertyValueController(testedPieChart.labelLineLengthProperty(), testedPieChart, -20.0, 10.0, 30.0)); - addController(new WeakPropertyValueController(testedPieChart.labelsVisibleProperty(), testedPieChart)); - addController(new WeakPropertyValueController(testedPieChart.titleProperty(), testedPieChart, "New title")); - addController(new WeakPropertyValueController(testedPieChart.titleSideProperty(), testedPieChart, Arrays.asList(Side.values()))); - addController(new WeakPropertyValueController(testedPieChart.legendSideProperty(), testedPieChart, Arrays.asList(Side.values()))); - addController(new WeakPropertyValueController(testedPieChart.prefWidthProperty(), testedPieChart, 100.0, 400.0, 400.0)); - addController(new WeakPropertyValueController(testedPieChart.prefHeightProperty(), testedPieChart, 100.0, 400.0, 400.0)); - - setTestedControlContainerSize(400, 400); - setTestedControl(testedPieChart); - setControllersContent(vb); - setPropertiesContent(properties); - } - - private void addController(WeakPropertyValueController controller) { - properties.getChildren().addAll(new Separator(Orientation.HORIZONTAL), controller); - } - - public PieChart getNewChart() { - data = FXCollections.observableArrayList(); - for (int i = 0; i < 4; i++) { - data.add(new PieChart.Data("Data item " + i, 50)); - } - PieChart chart = new PieChart(data); - chart.setTitle("PieChart"); - chart.setStyle("-fx-border-color: darkgray;"); - return chart; - } - } +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.chart.manual; + +import javafx.scene.control.test.utils.ptables.WeakPropertyValueController; +import java.util.Arrays; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.scene.chart.PieChart; +import javafx.scene.Scene; +import javafx.scene.control.*; +import javafx.scene.control.test.utils.CommonPropertiesScene; +import javafx.geometry.Side; +import javafx.scene.layout.HBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; +import javafx.scene.layout.VBox; +import javafx.geometry.Orientation; + +/** + * @author Alexander Kirov + */ +public class PieChartManualApp extends InteroperabilityApp { + + public static void main(String[] args) { + Utils.launch(PieChartManualApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "PieChartTestApp"); + return new PieChartScene(); + } + + class PieChartScene extends CommonPropertiesScene { + + //PieChart to be tested. + PieChart testedPieChart; + int controlContainerWidth = 400; + int controlContainerHeight = 400; + ObservableList data; + VBox properties; + + public PieChartScene() { + super("PieChart", 900, 630); + + prepareScene(); + } + + @Override + final protected void prepareScene() { + testedPieChart = getNewChart(); + testedPieChart.setPrefSize(controlContainerHeight, controlContainerWidth); + properties = new VBox(10); + + Button addDataButton = new Button("Add data at index 0"); + addDataButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + testedPieChart.getData().add(0, new PieChart.Data("Added data", Math.random() * 100)); + } + }); + + Button removeDataButton = new Button("Remove data from index 0"); + removeDataButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + if (testedPieChart.getData().size() > 0) { + testedPieChart.getData().remove(0); + } + } + }); + + Button changeDataButton = new Button("Change data at index 0"); + changeDataButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + if (testedPieChart.getData().size() > 0) { + PieChart.Data data = testedPieChart.getData().get(0); + data.setPieValue(Math.max(0, data.getPieValue() + (Math.random() - 0.5) * 200)); + } + } + }); + + Button hardResetButton = new Button("Reset"); + hardResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareMainSceneStructure(); + prepareScene(); + } + }); + + VBox vb = new VBox(5); + vb.getChildren().addAll(hardResetButton, + new Separator(Orientation.HORIZONTAL), new Label("Add new data : "), addDataButton, + new Separator(Orientation.HORIZONTAL), new Label("Remove existing data : "), removeDataButton, + new Separator(Orientation.HORIZONTAL), new Label("Change existing data : "), changeDataButton); + + addController(new WeakPropertyValueController(testedPieChart.animatedProperty(), testedPieChart)); + addController(new WeakPropertyValueController(testedPieChart.clockwiseProperty(), testedPieChart)); + addController(new WeakPropertyValueController(testedPieChart.legendVisibleProperty(), testedPieChart)); + addController(new WeakPropertyValueController(testedPieChart.startAngleProperty(), testedPieChart, -300.0, 0.0, 300.0)); + addController(new WeakPropertyValueController(testedPieChart.labelLineLengthProperty(), testedPieChart, -20.0, 10.0, 30.0)); + addController(new WeakPropertyValueController(testedPieChart.labelsVisibleProperty(), testedPieChart)); + addController(new WeakPropertyValueController(testedPieChart.titleProperty(), testedPieChart, "New title")); + addController(new WeakPropertyValueController(testedPieChart.titleSideProperty(), testedPieChart, Arrays.asList(Side.values()))); + addController(new WeakPropertyValueController(testedPieChart.legendSideProperty(), testedPieChart, Arrays.asList(Side.values()))); + addController(new WeakPropertyValueController(testedPieChart.prefWidthProperty(), testedPieChart, 100.0, 400.0, 400.0)); + addController(new WeakPropertyValueController(testedPieChart.prefHeightProperty(), testedPieChart, 100.0, 400.0, 400.0)); + + setTestedControlContainerSize(400, 400); + setTestedControl(testedPieChart); + setControllersContent(vb); + setPropertiesContent(properties); + } + + private void addController(WeakPropertyValueController controller) { + properties.getChildren().addAll(new Separator(Orientation.HORIZONTAL), controller); + } + + public PieChart getNewChart() { + data = FXCollections.observableArrayList(); + for (int i = 0; i < 4; i++) { + data.add(new PieChart.Data("Data item " + i, 50)); + } + PieChart chart = new PieChart(data); + chart.setTitle("PieChart"); + chart.setStyle("-fx-border-color: darkgray;"); + return chart; + } + } } \ No newline at end of file --- old/functional/ControlsTests/src/javafx/scene/control/test/choicebox/NewChoiceBoxApp.java 2016-12-22 11:26:22.261010011 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/choicebox/NewChoiceBoxApp.java 2016-12-22 11:26:22.209009510 +0300 @@ -1,106 +1,107 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.choicebox; - -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.scene.Scene; -import javafx.scene.control.*; -import javafx.scene.control.test.utils.CommonPropertiesScene; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; -import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Pane; -import javafx.scene.layout.VBox; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class NewChoiceBoxApp extends InteroperabilityApp { - - public final static String TESTED_CHOICEBOX_ID = "TESTED_CHOICEBOX_ID"; - public final static String RESET_BUTTON_ID = "RESET_CHOICEBOX_BUTTON_ID"; - - public static void main(String[] args) { - Utils.launch(NewChoiceBoxApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "ChoiceBoxTestApp"); - return new NewChoiceBoxApp.ChoiceBoxScene(); - } - - class ChoiceBoxScene extends CommonPropertiesScene { - - //VBox which contains tested ChoiceBox. - Pane pane; - PropertiesTable tb; - //ChoiceBox to be tested. - ChoiceBox testedChoiceBox; - - public ChoiceBoxScene() { - super("ChoiceBox", 800, 600); - - prepareScene(); - } - - @Override - final protected void prepareScene() { - pane = new Pane(); - testedChoiceBox = new ChoiceBox(); - testedChoiceBox.setId(TESTED_CHOICEBOX_ID); - - tb = new PropertiesTable(testedChoiceBox); - PropertyTablesFactory.explorePropertiesList(testedChoiceBox, tb); - SpecialTablePropertiesProvider.provideForControl(testedChoiceBox, tb); - - pane.setMinSize(220, 220); - pane.setPrefSize(220, 220); - pane.setStyle("-fx-border-color : red;"); - pane.getChildren().add(testedChoiceBox); - - Button resetButton = ButtonBuilder.create().id(RESET_BUTTON_ID).text("Reset").build(); - resetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareScene(); - } - }); - - setTestedControl(testedChoiceBox); - setPropertiesContent(tb); - - VBox vb = new VBox(); - vb.setSpacing(5); - vb.getChildren().addAll(resetButton); - setControllersContent(vb); - } - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.choicebox; + +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.scene.Scene; +import javafx.scene.control.*; +import javafx.scene.control.test.utils.CommonPropertiesScene; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; +import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class NewChoiceBoxApp extends InteroperabilityApp { + + public final static String TESTED_CHOICEBOX_ID = "TESTED_CHOICEBOX_ID"; + public final static String RESET_BUTTON_ID = "RESET_CHOICEBOX_BUTTON_ID"; + + public static void main(String[] args) { + Utils.launch(NewChoiceBoxApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "ChoiceBoxTestApp"); + return new NewChoiceBoxApp.ChoiceBoxScene(); + } + + class ChoiceBoxScene extends CommonPropertiesScene { + + //VBox which contains tested ChoiceBox. + Pane pane; + PropertiesTable tb; + //ChoiceBox to be tested. + ChoiceBox testedChoiceBox; + + public ChoiceBoxScene() { + super("ChoiceBox", 800, 600); + + prepareScene(); + } + + @Override + final protected void prepareScene() { + pane = new Pane(); + testedChoiceBox = new ChoiceBox(); + testedChoiceBox.setId(TESTED_CHOICEBOX_ID); + + tb = new PropertiesTable(testedChoiceBox); + PropertyTablesFactory.explorePropertiesList(testedChoiceBox, tb); + SpecialTablePropertiesProvider.provideForControl(testedChoiceBox, tb); + + pane.setMinSize(220, 220); + pane.setPrefSize(220, 220); + pane.setStyle("-fx-border-color : red;"); + pane.getChildren().add(testedChoiceBox); + + Button resetButton = new Button("Reset"); + resetButton.setId(RESET_BUTTON_ID); + resetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareScene(); + } + }); + + setTestedControl(testedChoiceBox); + setPropertiesContent(tb); + + VBox vb = new VBox(); + vb.setSpacing(5); + vb.getChildren().addAll(resetButton); + setControllersContent(vb); + } + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/chooser/FXChooser.java 2016-12-22 11:26:22.449011825 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/chooser/FXChooser.java 2016-12-22 11:26:22.401011361 +0300 @@ -33,7 +33,6 @@ import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; -import javafx.scene.control.TextFieldBuilder; import javafx.scene.control.Tooltip; import javafx.scene.layout.GridPane; import javafx.scene.text.Text; @@ -59,8 +58,10 @@ public void start(final Stage stage) throws Exception { try { extensionFilter = new FileChooser.ExtensionFilter("File with extension (*.extension)", "*.extension"); - initialFileNameTextField = TextFieldBuilder.create().text("").promptText("Initial file name").build(); - titleTextField = TextFieldBuilder.create().text("").promptText("Title").build(); + initialFileNameTextField = new TextField(""); + initialFileNameTextField.setPromptText("Initial file name"); + titleTextField = new TextField(""); + titleTextField.setPromptText("Title"); errorText = new Label("No errors"); // OPEN FOLDER --- old/functional/ControlsTests/src/javafx/scene/control/test/colorpicker/ColorPickerApp.java 2016-12-22 11:26:22.641013676 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/colorpicker/ColorPickerApp.java 2016-12-22 11:26:22.589013174 +0300 @@ -1,183 +1,188 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.colorpicker; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import javafx.event.ActionEvent; -import javafx.event.Event; -import javafx.event.EventHandler; -import javafx.geometry.Insets; -import javafx.geometry.Pos; -import javafx.scene.Scene; -import javafx.scene.control.*; -import javafx.scene.control.test.utils.CommonPropertiesScene; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Pane; -import javafx.scene.layout.VBox; -import javafx.scene.paint.Color; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class ColorPickerApp extends InteroperabilityApp { - - public final static String TESTED_COLORPICKER_ID = "TESTED_COLORPICKER_ID"; - public final static String HARD_RESET_BUTTON_ID = "HARD_RESET_COLORPICKER_BUTTON_ID"; - public final static String SOFT_RESET_BUTTON_ID = "SOFT_RESET_COLORPICKER_BUTTON_ID"; - public final static String SET_COLOR_TEXT_FIELD_ID = "SET_COLOR_TEXT_FIELD_ID"; - public final static String SET_COLOR_BUTTON_ID = "SET_COLOR_BUTTON_ID"; - public final static List predefinedColors = new ArrayList(); - - public static void main(String[] args) { - Utils.launch(ColorPickerApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "ColorPickerTestApp"); - return new ColorPickerScene(); - } - - class ColorPickerScene extends CommonPropertiesScene { - - //VBox which contain tested color picker. - Pane pane; - PropertiesTable tb; - //Color picker to be tested. - ColorPicker testedColorPicker; - - public ColorPickerScene() { - super("ColorPicker", 800, 600); - - prepareScene(); - } - - @Override - final protected void prepareScene() { - predefinedColors.add(Color.WHITE); - predefinedColors.add(Color.BLACK); - predefinedColors.add(Color.BLUE); - - Utils.addBrowser(this); - pane = new Pane(); - testedColorPicker = new ColorPicker(); - testedColorPicker.setId(TESTED_COLORPICKER_ID); - - tb = new PropertiesTable(testedColorPicker); - - tb.addStringLine(testedColorPicker.promptTextProperty(), "prompt text"); - - tb.addBooleanPropertyLine(testedColorPicker.armedProperty()); - tb.addBooleanPropertyLine(testedColorPicker.focusTraversableProperty()); - - tb.addBooleanPropertyLine(testedColorPicker.visibleProperty()); - - tb.addObjectEnumPropertyLine(testedColorPicker.blendModeProperty(), Arrays.asList(javafx.scene.effect.BlendMode.values()), testedColorPicker); - tb.addObjectEnumPropertyLine(testedColorPicker.valueProperty(), predefinedColors, testedColorPicker); - - tb.addDoublePropertyLine(testedColorPicker.prefWidthProperty(), -100, 400, 100); - tb.addDoublePropertyLine(testedColorPicker.prefHeightProperty(), -100, 400, 100); - - tb.addDoublePropertyLine(testedColorPicker.rotateProperty(), -100, 400, 100); - - tb.addDoublePropertyLine(testedColorPicker.translateXProperty(), -1, 15, 0); - tb.addDoublePropertyLine(testedColorPicker.scaleXProperty(), -1, 4, 1); - tb.addDoublePropertyLine(testedColorPicker.scaleYProperty(), -1, 4, 1); - tb.addDoublePropertyLine(testedColorPicker.scaleZProperty(), -1, 4, 1); - - tb.addSimpleListener(testedColorPicker.widthProperty(), testedColorPicker); - tb.addSimpleListener(testedColorPicker.heightProperty(), testedColorPicker); - - tb.addSimpleListener(testedColorPicker.focusedProperty(), testedColorPicker); - tb.addSimpleListener(testedColorPicker.pressedProperty(), testedColorPicker); - tb.addSimpleListener(testedColorPicker.showingProperty(), testedColorPicker); - tb.addSimpleListener(testedColorPicker.sceneProperty(), testedColorPicker); - - tb.addStringLine(testedColorPicker.promptTextProperty(), "prompt"); - - pane.setMinSize(240, 240); - pane.setPrefSize(240, 240); - pane.setStyle("-fx-border-color : red;"); - pane.getChildren().add(testedColorPicker); - - VBox vb = new VBox(); - vb.setSpacing(5); - - HBox hb = (HBox) getRoot(); - hb.setPadding(new Insets(5, 5, 5, 5)); - hb.setStyle("-fx-border-color : green;"); - - Button hardResetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Hard reset").build(); - hardResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareMainSceneStructure(); - prepareScene(); - } - }); - - Button softResetButton = ButtonBuilder.create().id(SOFT_RESET_BUTTON_ID).text("Soft reset").build(); - softResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - tb.refresh(); - ColorPicker newOne = new ColorPicker(); - testedColorPicker.setValue(newOne.getValue()); - } - }); - - HBox resetButtonsHBox = new HBox(); - resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); - resetButtonsHBox.setAlignment(Pos.CENTER); - - VBox vb1 = new VBox(5); - vb1.getChildren().addAll(resetButtonsHBox, setColorHbox()); - - setTestedControl(testedColorPicker); - setControllersContent(vb1); - setPropertiesContent(tb); - } - - private HBox setColorHbox() { - HBox hb = new HBox(); - Label lb = new Label("Set color"); - final TextField colorTf = TextFieldBuilder.create().prefWidth(100).id(SET_COLOR_TEXT_FIELD_ID).build(); - Button bt = ButtonBuilder.create().text("Set!").id(SET_COLOR_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - public void handle(Event t) { - testedColorPicker.setValue(Color.web(colorTf.getText())); - } - }); - hb.getChildren().addAll(lb, colorTf, bt); - hb.setAlignment(Pos.CENTER); - return hb; - } - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.colorpicker; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import javafx.event.ActionEvent; +import javafx.event.Event; +import javafx.event.EventHandler; +import javafx.geometry.Insets; +import javafx.geometry.Pos; +import javafx.scene.Scene; +import javafx.scene.control.*; +import javafx.scene.control.test.utils.CommonPropertiesScene; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; +import javafx.scene.paint.Color; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class ColorPickerApp extends InteroperabilityApp { + + public final static String TESTED_COLORPICKER_ID = "TESTED_COLORPICKER_ID"; + public final static String HARD_RESET_BUTTON_ID = "HARD_RESET_COLORPICKER_BUTTON_ID"; + public final static String SOFT_RESET_BUTTON_ID = "SOFT_RESET_COLORPICKER_BUTTON_ID"; + public final static String SET_COLOR_TEXT_FIELD_ID = "SET_COLOR_TEXT_FIELD_ID"; + public final static String SET_COLOR_BUTTON_ID = "SET_COLOR_BUTTON_ID"; + public final static List predefinedColors = new ArrayList(); + + public static void main(String[] args) { + Utils.launch(ColorPickerApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "ColorPickerTestApp"); + return new ColorPickerScene(); + } + + class ColorPickerScene extends CommonPropertiesScene { + + //VBox which contain tested color picker. + Pane pane; + PropertiesTable tb; + //Color picker to be tested. + ColorPicker testedColorPicker; + + public ColorPickerScene() { + super("ColorPicker", 800, 600); + + prepareScene(); + } + + @Override + final protected void prepareScene() { + predefinedColors.add(Color.WHITE); + predefinedColors.add(Color.BLACK); + predefinedColors.add(Color.BLUE); + + Utils.addBrowser(this); + pane = new Pane(); + testedColorPicker = new ColorPicker(); + testedColorPicker.setId(TESTED_COLORPICKER_ID); + + tb = new PropertiesTable(testedColorPicker); + + tb.addStringLine(testedColorPicker.promptTextProperty(), "prompt text"); + + tb.addBooleanPropertyLine(testedColorPicker.armedProperty()); + tb.addBooleanPropertyLine(testedColorPicker.focusTraversableProperty()); + + tb.addBooleanPropertyLine(testedColorPicker.visibleProperty()); + + tb.addObjectEnumPropertyLine(testedColorPicker.blendModeProperty(), Arrays.asList(javafx.scene.effect.BlendMode.values()), testedColorPicker); + tb.addObjectEnumPropertyLine(testedColorPicker.valueProperty(), predefinedColors, testedColorPicker); + + tb.addDoublePropertyLine(testedColorPicker.prefWidthProperty(), -100, 400, 100); + tb.addDoublePropertyLine(testedColorPicker.prefHeightProperty(), -100, 400, 100); + + tb.addDoublePropertyLine(testedColorPicker.rotateProperty(), -100, 400, 100); + + tb.addDoublePropertyLine(testedColorPicker.translateXProperty(), -1, 15, 0); + tb.addDoublePropertyLine(testedColorPicker.scaleXProperty(), -1, 4, 1); + tb.addDoublePropertyLine(testedColorPicker.scaleYProperty(), -1, 4, 1); + tb.addDoublePropertyLine(testedColorPicker.scaleZProperty(), -1, 4, 1); + + tb.addSimpleListener(testedColorPicker.widthProperty(), testedColorPicker); + tb.addSimpleListener(testedColorPicker.heightProperty(), testedColorPicker); + + tb.addSimpleListener(testedColorPicker.focusedProperty(), testedColorPicker); + tb.addSimpleListener(testedColorPicker.pressedProperty(), testedColorPicker); + tb.addSimpleListener(testedColorPicker.showingProperty(), testedColorPicker); + tb.addSimpleListener(testedColorPicker.sceneProperty(), testedColorPicker); + + tb.addStringLine(testedColorPicker.promptTextProperty(), "prompt"); + + pane.setMinSize(240, 240); + pane.setPrefSize(240, 240); + pane.setStyle("-fx-border-color : red;"); + pane.getChildren().add(testedColorPicker); + + VBox vb = new VBox(); + vb.setSpacing(5); + + HBox hb = (HBox) getRoot(); + hb.setPadding(new Insets(5, 5, 5, 5)); + hb.setStyle("-fx-border-color : green;"); + + Button hardResetButton = new Button("Hard reset"); + hardResetButton.setId(HARD_RESET_BUTTON_ID); + hardResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareMainSceneStructure(); + prepareScene(); + } + }); + + Button softResetButton = new Button("Soft reset"); + softResetButton.setId(SOFT_RESET_BUTTON_ID); + softResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + tb.refresh(); + ColorPicker newOne = new ColorPicker(); + testedColorPicker.setValue(newOne.getValue()); + } + }); + + HBox resetButtonsHBox = new HBox(); + resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); + resetButtonsHBox.setAlignment(Pos.CENTER); + + VBox vb1 = new VBox(5); + vb1.getChildren().addAll(resetButtonsHBox, setColorHbox()); + + setTestedControl(testedColorPicker); + setControllersContent(vb1); + setPropertiesContent(tb); + } + + private HBox setColorHbox() { + HBox hb = new HBox(); + Label lb = new Label("Set color"); + final TextField colorTf = new TextField(); + colorTf.setPrefWidth(100); + colorTf.setId(SET_COLOR_TEXT_FIELD_ID); + Button bt = new Button("Set!"); + bt.setId(SET_COLOR_BUTTON_ID); + bt.setOnAction(new EventHandler() { + public void handle(Event t) { + testedColorPicker.setValue(Color.web(colorTf.getText())); + } + }); + hb.getChildren().addAll(lb, colorTf, bt); + hb.setAlignment(Pos.CENTER); + return hb; + } + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/combobox/ComboBoxApp.java 2016-12-22 11:26:22.829015489 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/combobox/ComboBoxApp.java 2016-12-22 11:26:22.781015027 +0300 @@ -167,21 +167,24 @@ // } // }); - Button applyCustomSelectionModel = ButtonBuilder.create().text("Apply custom selection model").id(APPLY_CUSTOM_SELECTION_MODEL_BUTTON_ID).build(); + Button applyCustomSelectionModel = new Button("Apply custom selection model"); + applyCustomSelectionModel.setId(APPLY_CUSTOM_SELECTION_MODEL_BUTTON_ID); applyCustomSelectionModel.setOnAction(new EventHandler() { public void handle(ActionEvent t) { testedComboBox.selectionModelProperty().setValue(selectionModel); } }); - Button applyCustomStringConverter = ButtonBuilder.create().text("Apply custom string converter").id(APPLY_CUSTOM_STRING_CONVERTER_BUTTON_ID).build(); + Button applyCustomStringConverter = new Button("Apply custom string converter"); + applyCustomStringConverter.setId(APPLY_CUSTOM_STRING_CONVERTER_BUTTON_ID); applyCustomStringConverter.setOnAction(new EventHandler() { public void handle(ActionEvent t) { testedComboBox.setConverter(new CustomStringConverter()); } }); - Button applyCustomCellFactory = ButtonBuilder.create().text("Apply custom cell factory").id(APPLY_CUSTOM_CELL_FACTORY_BUTTON_ID).build(); + Button applyCustomCellFactory = new Button("Apply custom cell factory"); + applyCustomCellFactory.setId(APPLY_CUSTOM_CELL_FACTORY_BUTTON_ID); applyCustomCellFactory.setOnAction(new EventHandler() { public void handle(ActionEvent t) { testedComboBox.setCellFactory(new Callback, ListCell>() { @@ -193,7 +196,8 @@ } }); - Button hardResetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Hard reset").build(); + Button hardResetButton = new Button("Hard reset"); + hardResetButton.setId(HARD_RESET_BUTTON_ID); hardResetButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { HBox hb = (HBox) getRoot(); @@ -203,7 +207,8 @@ } }); - Button softResetButton = ButtonBuilder.create().id(SOFT_RESET_BUTTON_ID).text("Soft reset").build(); + Button softResetButton = new Button("Soft reset"); + softResetButton.setId(SOFT_RESET_BUTTON_ID); softResetButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { tb.refresh(); @@ -228,11 +233,8 @@ HBox resetButtonsHBox = new HBox(); resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); - Button setAddingElementsOnShowing = ButtonBuilder.create() - .id(SET_ADDING_ELEMENTS_ON_SHOWING) - .text("Set adding elements on showing") - .build(); - + Button setAddingElementsOnShowing = new Button("Set adding elements on showing"); + setAddingElementsOnShowing.setId(SET_ADDING_ELEMENTS_ON_SHOWING); setAddingElementsOnShowing.setOnAction(new EventHandler() { public void handle(ActionEvent t) { testedComboBox.setOnShowing(new EventHandler() { @@ -246,11 +248,8 @@ } }); - Button restoreDefaultOnShowingHandler = ButtonBuilder.create() - .id(RESTORE_ON_SHOWING_EVENT_HANDLER) - .text("Restore default onShowing handler") - .build(); - + Button restoreDefaultOnShowingHandler = new Button("Restore default onShowing handler"); + restoreDefaultOnShowingHandler.setId(RESTORE_ON_SHOWING_EVENT_HANDLER); restoreDefaultOnShowingHandler.setOnAction(new EventHandler() { public void handle(ActionEvent t) { testedComboBox.setOnShowing(new EventHandler() { @@ -261,11 +260,8 @@ } }); - Button populateComboBoxWithFontSizes = ButtonBuilder.create() - .id(POPULATE_COMBOBOX_WITH_FONT_SIZES) - .text("Populate ComboBox with font sizes") - .build(); - + Button populateComboBoxWithFontSizes = new Button("Populate ComboBox with font sizes"); + populateComboBoxWithFontSizes.setId(POPULATE_COMBOBOX_WITH_FONT_SIZES); populateComboBoxWithFontSizes.setOnAction(new EventHandler() { public void handle(ActionEvent t) { @@ -317,10 +313,15 @@ private HBox getAddItemHBox() { HBox hb = new HBox(); Label lb = new Label("Add item"); - final TextField tf = TextFieldBuilder.create().prefWidth(50).id(ADD_ITEM_TEXT_FIELD_ID).build(); + final TextField tf = new TextField(); + tf.setPrefWidth(50); + tf.setId(ADD_ITEM_TEXT_FIELD_ID); Label atLb = new Label("at pos"); - final TextField tfPos = TextFieldBuilder.create().prefWidth(50).id(ADD_ITEM_POSITION_TEXT_FIELD_ID).build(); - Button bt = ButtonBuilder.create().text("Add!").id(ADD_ITEM_BUTTON_ID).build(); + final TextField tfPos = new TextField(); + tfPos.setPrefWidth(50); + tfPos.setId(ADD_ITEM_POSITION_TEXT_FIELD_ID); + Button bt = new Button("Add!"); + bt.setId(ADD_ITEM_BUTTON_ID); bt.setOnAction(new EventHandler() { public void handle(Event t) { int index = Integer.parseInt(tfPos.getText()); @@ -334,8 +335,11 @@ private HBox getRemoveItemHBox() { HBox hb = new HBox(); Label lb = new Label("From position"); - final TextField tf = TextFieldBuilder.create().text("0").prefWidth(50).id(REMOVE_ITEM_POS_TEXT_FIELD_ID).build(); - Button bt = ButtonBuilder.create().text("Remove!").id(REMOVE_BUTTON_ID).build(); + final TextField tf = new TextField("0"); + tf.setPrefWidth(50); + tf.setId(REMOVE_ITEM_POS_TEXT_FIELD_ID); + Button bt = new Button("Remove!"); + bt.setId(REMOVE_BUTTON_ID); bt.setOnAction(new EventHandler() { public void handle(Event t) { int index = Integer.parseInt(tf.getText()); @@ -349,7 +353,8 @@ private HBox getSetItemsNullHBox() { HBox hb = new HBox(); - Button bt = ButtonBuilder.create().text("Set items null").id(SET_ITEMS_NULL_BUTTON_ID).build(); + Button bt = new Button("Set items null"); + bt.setId(SET_ITEMS_NULL_BUTTON_ID); bt.setOnAction(new EventHandler() { public void handle(Event t) { ((ComboBox) testedComboBox).setItems(null); --- old/functional/ControlsTests/src/javafx/scene/control/test/datepicker/DatePickerApp.java 2016-12-22 11:26:23.029017418 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/datepicker/DatePickerApp.java 2016-12-22 11:26:22.973016878 +0300 @@ -1,228 +1,229 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.datepicker; - -import java.time.DayOfWeek; -import java.time.LocalDate; -import java.time.Month; -import java.time.chrono.Chronology; -import java.time.format.DateTimeFormatter; -import java.util.Arrays; -import javafx.beans.property.ObjectProperty; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.geometry.Insets; -import javafx.geometry.Pos; -import javafx.scene.Scene; -import javafx.scene.control.Button; -import javafx.scene.control.ButtonBuilder; -import javafx.scene.control.DateCell; -import javafx.scene.control.DatePicker; -import javafx.scene.control.test.utils.CommonPropertiesScene; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; -import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Pane; -import javafx.scene.layout.VBox; -import javafx.util.Callback; -import javafx.util.StringConverter; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class DatePickerApp extends InteroperabilityApp { - - public final static String TESTED_DATEPICKER_ID = "TESTED_DATEPICKER_ID"; - public final static String HARD_RESET_BUTTON_ID = "HARD_RESET_DATEPICKER_BUTTON_ID"; - public final static String SOFT_RESET_BUTTON_ID = "SOFT_RESET_DATEPICKER_BUTTON_ID"; - - public static void main(String[] args) { - Utils.launch(DatePickerApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "DatePickerTestApp"); - return new DatePickerApp.DatePickerScene(); - } - - class DatePickerScene extends CommonPropertiesScene { - - //VBox which contain tested date picker. - Pane pane; - PropertiesTable propertiesTable; - //Date picker to be tested. - DatePicker testedDatePicker; - - public DatePickerScene() { - super("DatePicker", 800, 600); - - prepareScene(); - } - - @Override - final protected void prepareScene() { - Utils.addBrowser(this); - pane = new Pane(); - testedDatePicker = new DatePicker(); - testedDatePicker.setId(TESTED_DATEPICKER_ID); - - propertiesTable = new PropertiesTable(testedDatePicker); - propertiesTable.addObjectEnumPropertyLine((ObjectProperty) testedDatePicker.dayCellFactoryProperty(), Arrays.asList(new Callback[]{null, new Callback() { - public DateCell call(final DatePicker datePicker) { - return new DateCell() { - { - setId("ID"); - } - }; - } - @Override public String toString() { return "Cells with ID"; } - }, - new WorkingDays()}), testedDatePicker); - - propertiesTable.addObjectEnumPropertyLine((ObjectProperty) testedDatePicker.converterProperty(), - Arrays.asList(new StringConverter[]{null, new LocalDateConverter(testedDatePicker)}), testedDatePicker); - - PropertyTablesFactory.explorePropertiesList(testedDatePicker, propertiesTable); - SpecialTablePropertiesProvider.provideForControl(testedDatePicker, propertiesTable); - -// propertiesTable.addObjectEnumPropertyLine(testedDatePicker.chronologyProperty(), Arrays.asList( -// Chronology.of("ISO"), Chronology.of("Minguo"), Chronology.of("ThaiBuddhist"), Chronology.of("Japanese"), Chronology.of("Hijrah-umalqura"))); - - pane.setMinSize(240, 240); - pane.setPrefSize(240, 240); - pane.setStyle("-fx-border-color : red;"); - pane.getChildren().add(testedDatePicker); - - VBox vb = new VBox(); - vb.setSpacing(5); - - HBox hb = (HBox) getRoot(); - hb.setPadding(new Insets(5, 5, 5, 5)); - hb.setStyle("-fx-border-color : green;"); - - Button hardResetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Hard reset").build(); - hardResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareMainSceneStructure(); - prepareScene(); - } - }); - - Button softResetButton = ButtonBuilder.create().id(SOFT_RESET_BUTTON_ID).text("Soft reset").build(); - softResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - propertiesTable.refresh(); - DatePicker newOne = new DatePicker(); - testedDatePicker.setValue(newOne.getValue()); - testedDatePicker.setConverter(newOne.getConverter()); - testedDatePicker.setDayCellFactory(newOne.getDayCellFactory()); - testedDatePicker.setShowWeekNumbers(newOne.isShowWeekNumbers()); - } - }); - - HBox resetButtonsHBox = new HBox(); - resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); - resetButtonsHBox.setAlignment(Pos.CENTER); - - VBox vb1 = new VBox(5); - vb1.getChildren().addAll(resetButtonsHBox); - - setTestedControl(testedDatePicker); - setControllersContent(vb1); - setPropertiesContent(propertiesTable); - } - } - - public static class LocalDateConverter extends StringConverter { - - public LocalDateConverter(DatePicker testedDatePicker) { - testedDatePicker.setPromptText(pattern.toLowerCase()); - } - - String pattern = "yyyy-MM-dd"; - DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern(pattern); - - @Override - public String toString(LocalDate date) { - if (date != null) { - return dateFormatter.format(date); - } else { - return ""; - } - } - - @Override - public LocalDate fromString(String string) { - if (string != null && !string.isEmpty()) { - return LocalDate.parse(string, dateFormatter); - } else { - return null; - } - } - - @Override public String toString() { return pattern; } - } - - public static class DummyConverter extends StringConverter { - @Override public String toString(LocalDate date) { return "Dummy"; } - - @Override public LocalDate fromString(String string) { - return LocalDate.of(2000, Month.JANUARY, 1); - } - } - - /** - * Class implements a DateCell factory. It disables days which are sundays. - */ - public static class WorkingDays implements Callback { - - public DateCell call(DatePicker param) { - return new DateCell() { - - @Override - public void updateItem(LocalDate item, boolean empty) { - super.updateItem(item, empty); - - if (isRestricted(item)) { - setStyle("-fx-background-color: #ff4444;"); - setDisable(true); - } - } - }; - } - - protected static boolean isRestricted(LocalDate item) { - return DayOfWeek.SUNDAY == item.getDayOfWeek(); - } - - @Override public String toString() { return "Except sundays"; } - } +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.datepicker; + +import java.time.DayOfWeek; +import java.time.LocalDate; +import java.time.Month; +import java.time.chrono.Chronology; +import java.time.format.DateTimeFormatter; +import java.util.Arrays; +import javafx.beans.property.ObjectProperty; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.geometry.Insets; +import javafx.geometry.Pos; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.DateCell; +import javafx.scene.control.DatePicker; +import javafx.scene.control.test.utils.CommonPropertiesScene; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; +import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; +import javafx.util.Callback; +import javafx.util.StringConverter; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class DatePickerApp extends InteroperabilityApp { + + public final static String TESTED_DATEPICKER_ID = "TESTED_DATEPICKER_ID"; + public final static String HARD_RESET_BUTTON_ID = "HARD_RESET_DATEPICKER_BUTTON_ID"; + public final static String SOFT_RESET_BUTTON_ID = "SOFT_RESET_DATEPICKER_BUTTON_ID"; + + public static void main(String[] args) { + Utils.launch(DatePickerApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "DatePickerTestApp"); + return new DatePickerApp.DatePickerScene(); + } + + class DatePickerScene extends CommonPropertiesScene { + + //VBox which contain tested date picker. + Pane pane; + PropertiesTable propertiesTable; + //Date picker to be tested. + DatePicker testedDatePicker; + + public DatePickerScene() { + super("DatePicker", 800, 600); + + prepareScene(); + } + + @Override + final protected void prepareScene() { + Utils.addBrowser(this); + pane = new Pane(); + testedDatePicker = new DatePicker(); + testedDatePicker.setId(TESTED_DATEPICKER_ID); + + propertiesTable = new PropertiesTable(testedDatePicker); + propertiesTable.addObjectEnumPropertyLine((ObjectProperty) testedDatePicker.dayCellFactoryProperty(), Arrays.asList(new Callback[]{null, new Callback() { + public DateCell call(final DatePicker datePicker) { + return new DateCell() { + { + setId("ID"); + } + }; + } + @Override public String toString() { return "Cells with ID"; } + }, + new WorkingDays()}), testedDatePicker); + + propertiesTable.addObjectEnumPropertyLine((ObjectProperty) testedDatePicker.converterProperty(), + Arrays.asList(new StringConverter[]{null, new LocalDateConverter(testedDatePicker)}), testedDatePicker); + + PropertyTablesFactory.explorePropertiesList(testedDatePicker, propertiesTable); + SpecialTablePropertiesProvider.provideForControl(testedDatePicker, propertiesTable); + +// propertiesTable.addObjectEnumPropertyLine(testedDatePicker.chronologyProperty(), Arrays.asList( +// Chronology.of("ISO"), Chronology.of("Minguo"), Chronology.of("ThaiBuddhist"), Chronology.of("Japanese"), Chronology.of("Hijrah-umalqura"))); + + pane.setMinSize(240, 240); + pane.setPrefSize(240, 240); + pane.setStyle("-fx-border-color : red;"); + pane.getChildren().add(testedDatePicker); + + VBox vb = new VBox(); + vb.setSpacing(5); + + HBox hb = (HBox) getRoot(); + hb.setPadding(new Insets(5, 5, 5, 5)); + hb.setStyle("-fx-border-color : green;"); + + Button hardResetButton = new Button("Hard reset"); + hardResetButton.setId(HARD_RESET_BUTTON_ID); + hardResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareMainSceneStructure(); + prepareScene(); + } + }); + + Button softResetButton = new Button("Soft reset"); + softResetButton.setId(SOFT_RESET_BUTTON_ID); + softResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + propertiesTable.refresh(); + DatePicker newOne = new DatePicker(); + testedDatePicker.setValue(newOne.getValue()); + testedDatePicker.setConverter(newOne.getConverter()); + testedDatePicker.setDayCellFactory(newOne.getDayCellFactory()); + testedDatePicker.setShowWeekNumbers(newOne.isShowWeekNumbers()); + } + }); + + HBox resetButtonsHBox = new HBox(); + resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); + resetButtonsHBox.setAlignment(Pos.CENTER); + + VBox vb1 = new VBox(5); + vb1.getChildren().addAll(resetButtonsHBox); + + setTestedControl(testedDatePicker); + setControllersContent(vb1); + setPropertiesContent(propertiesTable); + } + } + + public static class LocalDateConverter extends StringConverter { + + public LocalDateConverter(DatePicker testedDatePicker) { + testedDatePicker.setPromptText(pattern.toLowerCase()); + } + + String pattern = "yyyy-MM-dd"; + DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern(pattern); + + @Override + public String toString(LocalDate date) { + if (date != null) { + return dateFormatter.format(date); + } else { + return ""; + } + } + + @Override + public LocalDate fromString(String string) { + if (string != null && !string.isEmpty()) { + return LocalDate.parse(string, dateFormatter); + } else { + return null; + } + } + + @Override public String toString() { return pattern; } + } + + public static class DummyConverter extends StringConverter { + @Override public String toString(LocalDate date) { return "Dummy"; } + + @Override public LocalDate fromString(String string) { + return LocalDate.of(2000, Month.JANUARY, 1); + } + } + + /** + * Class implements a DateCell factory. It disables days which are sundays. + */ + public static class WorkingDays implements Callback { + + public DateCell call(DatePicker param) { + return new DateCell() { + + @Override + public void updateItem(LocalDate item, boolean empty) { + super.updateItem(item, empty); + + if (isRestricted(item)) { + setStyle("-fx-background-color: #ff4444;"); + setDisable(true); + } + } + }; + } + + protected static boolean isRestricted(LocalDate item) { + return DayOfWeek.SUNDAY == item.getDayOfWeek(); + } + + @Override public String toString() { return "Except sundays"; } + } } \ No newline at end of file --- old/functional/ControlsTests/src/javafx/scene/control/test/fxcanvas/FXCanvasBrowserApp.java 2016-12-22 11:26:23.229019347 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/fxcanvas/FXCanvasBrowserApp.java 2016-12-22 11:26:23.181018884 +0300 @@ -132,8 +132,6 @@ } public static void main(String[] args) { - System.setProperty("proxyHost", "www-proxy.ru.oracle.com"); - System.setProperty("proxyPort", "80"); try { startAndWaitShell(); } catch (InterruptedException ex) { --- old/functional/ControlsTests/src/javafx/scene/control/test/labeleds/newapps/LabeledsApp.java 2016-12-22 11:26:23.421021199 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/labeleds/newapps/LabeledsApp.java 2016-12-22 11:26:23.369020698 +0300 @@ -29,7 +29,6 @@ import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Button; -import javafx.scene.control.ButtonBuilder; import javafx.scene.control.Label; import javafx.scene.control.Labeled; import javafx.scene.control.test.utils.CommonPropertiesScene; @@ -87,7 +86,8 @@ hb.setPadding(new Insets(5, 5, 5, 5)); hb.setStyle("-fx-border-color : green;"); - Button resetButton = ButtonBuilder.create().id(RESET_BUTTON_ID).text("Reset").build(); + Button resetButton = new Button("Reset"); + resetButton.setId(RESET_BUTTON_ID); resetButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { HBox hb = (HBox) getRoot(); --- old/functional/ControlsTests/src/javafx/scene/control/test/labeleds/newapps/TextNodeApp.java 2016-12-22 11:26:23.609023012 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/labeleds/newapps/TextNodeApp.java 2016-12-22 11:26:23.557022511 +0300 @@ -1,155 +1,155 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.labeleds.newapps; - -import javafx.scene.control.test.utils.ptables.TabPaneWithControl; -import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.geometry.Insets; -import javafx.geometry.Orientation; -import javafx.scene.Scene; -import javafx.scene.control.Button; -import javafx.scene.control.ButtonBuilder; -import javafx.scene.control.CheckBox; -import javafx.scene.control.Label; -import javafx.scene.control.Separator; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Pane; -import javafx.scene.layout.VBox; -import javafx.scene.shape.Line; -import javafx.scene.text.Text; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class TextNodeApp extends InteroperabilityApp { - - public final static String TESTED_TEXTNODE_ID = "TESTED_TEXTNODE_ID"; - public final static String RESET_BUTTON_ID = "RESET_LABELED_BUTTON_ID"; - - public static void main(String[] args) { - Utils.launch(TextNodeApp.class, args); - } - - @Override - protected Scene getScene() { - return new LabeledScene(); - } - - protected class LabeledScene extends Scene { - - //Pane which contain tested text control. - Pane vb3; - PropertiesTable tb; - //Text to be tested. - Text testedControl; - - public LabeledScene() { - super(new HBox(), 800, 600); - - prepareScene(); - } - - private void prepareScene() { - vb3 = new Pane(); - testedControl = new Text(); - testedControl.setId(TESTED_TEXTNODE_ID); - - tb = new PropertiesTable(testedControl); - tb.addSimpleListener(testedControl.boundsInLocalProperty(), testedControl); - tb.addSimpleListener(testedControl.boundsInParentProperty(), testedControl); - PropertyTablesFactory.explorePropertiesList(testedControl, tb); - SpecialTablePropertiesProvider.provideForControl(testedControl, tb); - TabPaneWithControl tabPane = new TabPaneWithControl("Text", tb); - - vb3.setMinSize(220, 220); - vb3.setPrefSize(220, 220); - vb3.setStyle("-fx-border-color : red;"); - vb3.getChildren().add(testedControl); - - VBox vb = new VBox(); - vb.setSpacing(5); - - HBox hb = (HBox) getRoot(); - hb.setPadding(new Insets(5, 5, 5, 5)); - hb.setStyle("-fx-border-color : green;"); - - Button resetButton = ButtonBuilder.create().id(RESET_BUTTON_ID).text("Reset").build(); - resetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareScene(); - } - }); - - vb.getChildren().addAll(new Label("Pane with tested Text node"), vb3, resetButton, new Separator(Orientation.HORIZONTAL), getDrawLinesHBox()); - - tb.setStyle("-fx-border-color : yellow;"); - - //Main scene layout. - hb.getChildren().addAll(vb, tabPane); - } - - protected HBox getDrawLinesHBox() { - CheckBox cb = new CheckBox("Show borders"); - - cb.selectedProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Boolean t, Boolean t1) { - double x = testedControl.getBoundsInParent().getMinX(); - double y = testedControl.getBoundsInParent().getMinY(); - - double w = testedControl.getBoundsInLocal().getWidth(); - double h = testedControl.getBoundsInLocal().getHeight(); - - Line line1 = new Line(x, y, x + w, y); - Line line2 = new Line(x, y, x, y + h); - Line line3 = new Line(x + w, y, x + w, y + h); - Line line4 = new Line(x, y + h, x + w, y + h); - - line1.setVisible(t1); - line2.setVisible(t1); - line3.setVisible(t1); - line4.setVisible(t1); - - vb3.getChildren().clear(); - vb3.getChildren().add(testedControl); - vb3.getChildren().addAll(line1, line2, line3, line4); - } - }); - - HBox hb = new HBox(); - hb.getChildren().addAll(cb); - return hb; - } - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.labeleds.newapps; + +import javafx.scene.control.test.utils.ptables.TabPaneWithControl; +import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.geometry.Insets; +import javafx.geometry.Orientation; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.CheckBox; +import javafx.scene.control.Label; +import javafx.scene.control.Separator; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; +import javafx.scene.shape.Line; +import javafx.scene.text.Text; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class TextNodeApp extends InteroperabilityApp { + + public final static String TESTED_TEXTNODE_ID = "TESTED_TEXTNODE_ID"; + public final static String RESET_BUTTON_ID = "RESET_LABELED_BUTTON_ID"; + + public static void main(String[] args) { + Utils.launch(TextNodeApp.class, args); + } + + @Override + protected Scene getScene() { + return new LabeledScene(); + } + + protected class LabeledScene extends Scene { + + //Pane which contain tested text control. + Pane vb3; + PropertiesTable tb; + //Text to be tested. + Text testedControl; + + public LabeledScene() { + super(new HBox(), 800, 600); + + prepareScene(); + } + + private void prepareScene() { + vb3 = new Pane(); + testedControl = new Text(); + testedControl.setId(TESTED_TEXTNODE_ID); + + tb = new PropertiesTable(testedControl); + tb.addSimpleListener(testedControl.boundsInLocalProperty(), testedControl); + tb.addSimpleListener(testedControl.boundsInParentProperty(), testedControl); + PropertyTablesFactory.explorePropertiesList(testedControl, tb); + SpecialTablePropertiesProvider.provideForControl(testedControl, tb); + TabPaneWithControl tabPane = new TabPaneWithControl("Text", tb); + + vb3.setMinSize(220, 220); + vb3.setPrefSize(220, 220); + vb3.setStyle("-fx-border-color : red;"); + vb3.getChildren().add(testedControl); + + VBox vb = new VBox(); + vb.setSpacing(5); + + HBox hb = (HBox) getRoot(); + hb.setPadding(new Insets(5, 5, 5, 5)); + hb.setStyle("-fx-border-color : green;"); + + Button resetButton = new Button("Reset"); + resetButton.setId(RESET_BUTTON_ID); + resetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareScene(); + } + }); + + vb.getChildren().addAll(new Label("Pane with tested Text node"), vb3, resetButton, new Separator(Orientation.HORIZONTAL), getDrawLinesHBox()); + + tb.setStyle("-fx-border-color : yellow;"); + + //Main scene layout. + hb.getChildren().addAll(vb, tabPane); + } + + protected HBox getDrawLinesHBox() { + CheckBox cb = new CheckBox("Show borders"); + + cb.selectedProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Boolean t, Boolean t1) { + double x = testedControl.getBoundsInParent().getMinX(); + double y = testedControl.getBoundsInParent().getMinY(); + + double w = testedControl.getBoundsInLocal().getWidth(); + double h = testedControl.getBoundsInLocal().getHeight(); + + Line line1 = new Line(x, y, x + w, y); + Line line2 = new Line(x, y, x, y + h); + Line line3 = new Line(x + w, y, x + w, y + h); + Line line4 = new Line(x, y + h, x + w, y + h); + + line1.setVisible(t1); + line2.setVisible(t1); + line3.setVisible(t1); + line4.setVisible(t1); + + vb3.getChildren().clear(); + vb3.getChildren().add(testedControl); + vb3.getChildren().addAll(line1, line2, line3, line4); + } + }); + + HBox hb = new HBox(); + hb.getChildren().addAll(cb); + return hb; + } + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/menubar/NewMenuApp.java 2016-12-22 11:26:23.805024902 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/menubar/NewMenuApp.java 2016-12-22 11:26:23.753024401 +0300 @@ -1,156 +1,163 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.menubar; - -import javafx.scene.control.test.utils.ptables.TabPaneWithControl; -import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.NodeControllerFactory; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; -import javafx.event.ActionEvent; -import javafx.event.Event; -import javafx.event.EventHandler; -import javafx.geometry.Insets; -import javafx.scene.Scene; -import javafx.scene.control.*; -import javafx.scene.control.test.utils.*; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Pane; -import javafx.scene.layout.VBox; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class NewMenuApp extends InteroperabilityApp { - - public final static String TESTED_MENUBAR_ID = "TESTED_MENUBAR_ID"; - public final static String RESET_BUTTON_ID = "RESET_MENUBAR_BUTTON_ID"; - public final String MENUBAR_ADD_INDEX_TEXT_FIELD_ID = "MENUBAR_ADD_INDEX_TEXT_FIELD_ID"; - public final String MENUBAR_ADD_NAME_TEXT_FIELD_ID = "MENUBAR_ADD_NAME_TEXT_FIELD_ID"; - public final String ADD_MENU_BUTTON_ID = "ADD_MENU_BUTTON_ID"; - - public static void main(String[] args) { - Utils.launch(NewMenuApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "MenuBarTestApp"); - return new NewMenuApp.MenuBarScene(); - } - - class MenuBarScene extends Scene { - - Pane pane; - //MenuBar to be tested. - MenuBar testedMenuBar; - TabPaneWithControl tabPane; - - public MenuBarScene() { - super(new HBox(), 800, 600); - - prepareScene(); - } - - private void prepareScene() { - pane = new Pane(); - testedMenuBar = MenuBarBuilder.create().id(TESTED_MENUBAR_ID).build(); - - PropertiesTable tb = new PropertiesTable(testedMenuBar); - PropertyTablesFactory.explorePropertiesList(testedMenuBar, tb); - tabPane = new TabPaneWithControl("MenuBar", tb); - - pane.setMinSize(220, 220); - pane.setPrefSize(220, 220); - pane.setStyle("-fx-border-color : red;"); - pane.getChildren().add(testedMenuBar); - - VBox vb = new VBox(); - vb.setSpacing(5); - - HBox hb = (HBox) getRoot(); - hb.setPadding(new Insets(5, 5, 5, 5)); - hb.setStyle("-fx-border-color : green;"); - - Button resetButton = ButtonBuilder.create().id(RESET_BUTTON_ID).text("Reset").build(); - resetButton.setOnAction(new EventHandler() { - - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareScene(); - } - }); - - final ToggleButton compactStateToggle = new ToggleButton("Compact"); - compactStateToggle.setSelected(true); - compactStateToggle.selectedProperty().addListener(new ChangeListener() { - - public void changed(ObservableValue ov, Boolean t, Boolean t1) { - if (t1) { - compactStateToggle.setText("Compact"); - pane.setMinSize(220, 220); - pane.setPrefSize(220, 220); - MenuBarScene.this.getWindow().setWidth(1200); - MenuBarScene.this.getWindow().setHeight(700); - } else { - compactStateToggle.setText("Free"); - pane.setMinSize(600, 600); - pane.setPrefSize(600, 600); - MenuBarScene.this.getWindow().setWidth(800); - MenuBarScene.this.getWindow().setHeight(600); - } - } - }); - - vb.getChildren().addAll(new Label("Pane with tested MenuBar"), pane, resetButton, compactStateToggle, getAddTextFieldHbox()); - - hb.getChildren().addAll(vb, tabPane); - } - - private HBox getAddTextFieldHbox() { - HBox hb = new HBox(); - Label lb = new Label("Add Menu at pos"); - final TextField tf = TextFieldBuilder.create().id(MENUBAR_ADD_INDEX_TEXT_FIELD_ID).text("0").prefWidth(40).build(); - final TextField nameTF = TextFieldBuilder.create().id(MENUBAR_ADD_NAME_TEXT_FIELD_ID).text("Menu").prefWidth(40).build(); - - Button bt = ButtonBuilder.create().text("Add!").id(ADD_MENU_BUTTON_ID).build(); - bt.setOnAction(new EventHandler() { - - public void handle(Event t) { - Menu menu = new Menu(nameTF.getText()); - int index = Integer.parseInt(tf.getText()); - (testedMenuBar).getMenus().add(index, menu); - tabPane.addPropertiesTable(nameTF.getText(), NodeControllerFactory.createFullController(menu, tabPane)); - } - }); - hb.getChildren().addAll(lb, tf, new Label("named"), nameTF, bt); - return hb; - } - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.menubar; + +import javafx.scene.control.test.utils.ptables.TabPaneWithControl; +import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.NodeControllerFactory; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.event.ActionEvent; +import javafx.event.Event; +import javafx.event.EventHandler; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.*; +import javafx.scene.control.test.utils.*; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class NewMenuApp extends InteroperabilityApp { + + public final static String TESTED_MENUBAR_ID = "TESTED_MENUBAR_ID"; + public final static String RESET_BUTTON_ID = "RESET_MENUBAR_BUTTON_ID"; + public final String MENUBAR_ADD_INDEX_TEXT_FIELD_ID = "MENUBAR_ADD_INDEX_TEXT_FIELD_ID"; + public final String MENUBAR_ADD_NAME_TEXT_FIELD_ID = "MENUBAR_ADD_NAME_TEXT_FIELD_ID"; + public final String ADD_MENU_BUTTON_ID = "ADD_MENU_BUTTON_ID"; + + public static void main(String[] args) { + Utils.launch(NewMenuApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "MenuBarTestApp"); + return new NewMenuApp.MenuBarScene(); + } + + class MenuBarScene extends Scene { + + Pane pane; + //MenuBar to be tested. + MenuBar testedMenuBar; + TabPaneWithControl tabPane; + + public MenuBarScene() { + super(new HBox(), 800, 600); + + prepareScene(); + } + + private void prepareScene() { + pane = new Pane(); + testedMenuBar = new MenuBar(); + testedMenuBar.setId(TESTED_MENUBAR_ID); + + PropertiesTable tb = new PropertiesTable(testedMenuBar); + PropertyTablesFactory.explorePropertiesList(testedMenuBar, tb); + tabPane = new TabPaneWithControl("MenuBar", tb); + + pane.setMinSize(220, 220); + pane.setPrefSize(220, 220); + pane.setStyle("-fx-border-color : red;"); + pane.getChildren().add(testedMenuBar); + + VBox vb = new VBox(); + vb.setSpacing(5); + + HBox hb = (HBox) getRoot(); + hb.setPadding(new Insets(5, 5, 5, 5)); + hb.setStyle("-fx-border-color : green;"); + + Button resetButton = new Button("Reset"); + resetButton.setId(RESET_BUTTON_ID); + resetButton.setOnAction(new EventHandler() { + + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareScene(); + } + }); + + final ToggleButton compactStateToggle = new ToggleButton("Compact"); + compactStateToggle.setSelected(true); + compactStateToggle.selectedProperty().addListener(new ChangeListener() { + + public void changed(ObservableValue ov, Boolean t, Boolean t1) { + if (t1) { + compactStateToggle.setText("Compact"); + pane.setMinSize(220, 220); + pane.setPrefSize(220, 220); + MenuBarScene.this.getWindow().setWidth(1200); + MenuBarScene.this.getWindow().setHeight(700); + } else { + compactStateToggle.setText("Free"); + pane.setMinSize(600, 600); + pane.setPrefSize(600, 600); + MenuBarScene.this.getWindow().setWidth(800); + MenuBarScene.this.getWindow().setHeight(600); + } + } + }); + + vb.getChildren().addAll(new Label("Pane with tested MenuBar"), pane, resetButton, compactStateToggle, getAddTextFieldHbox()); + + hb.getChildren().addAll(vb, tabPane); + } + + private HBox getAddTextFieldHbox() { + HBox hb = new HBox(); + Label lb = new Label("Add Menu at pos"); + final TextField tf = new TextField("0"); + tf.setId(MENUBAR_ADD_INDEX_TEXT_FIELD_ID); + tf.setPrefWidth(40); + final TextField nameTF = new TextField("Menu"); + nameTF.setId(MENUBAR_ADD_NAME_TEXT_FIELD_ID); + nameTF.setPrefWidth(40); + + Button bt = new Button("Add!"); + bt.setId(ADD_MENU_BUTTON_ID); + bt.setOnAction(new EventHandler() { + + public void handle(Event t) { + Menu menu = new Menu(nameTF.getText()); + int index = Integer.parseInt(tf.getText()); + (testedMenuBar).getMenus().add(index, menu); + tabPane.addPropertiesTable(nameTF.getText(), NodeControllerFactory.createFullController(menu, tabPane)); + } + }); + hb.getChildren().addAll(lb, tf, new Label("named"), nameTF, bt); + return hb; + } + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/pagination/PaginationApp.java 2016-12-22 11:26:24.021026986 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/pagination/PaginationApp.java 2016-12-22 11:26:23.961026408 +0300 @@ -1,242 +1,247 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.pagination; - -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.scene.Node; -import javafx.scene.Scene; -import javafx.scene.control.Button; -import javafx.scene.control.ButtonBuilder; -import javafx.scene.control.Label; -import javafx.scene.control.Pagination; -import javafx.scene.control.test.utils.*; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; -import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider; -import javafx.scene.layout.HBox; -import javafx.scene.layout.VBox; -import javafx.util.Callback; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class PaginationApp extends InteroperabilityApp { - - public final static String TESTED_PAGINATION_ID = "TESTED_PAGINATION_ID"; - public final static String HARD_RESET_BUTTON_ID = "HARD_RESET_PAGINATION_BUTTON_ID"; - public final static String SOFT_RESET_BUTTON_ID = "SOFT_RESET_PAGINATION_BUTTON_ID"; - public final static String SET_NEW_PAGE_FACTORY_BUTTON_ID = "SET_NEW_PAGE_FACTORY_BUTTON_ID"; - public final static String SET_OLD_PAGE_FACTORY_BUTTON_ID = "SET_OLD_PAGE_FACTORY_BUTTON_ID"; - public final static String SET_BULLET_PAGE_INDICATOR_BUTTON_ID = "SET_BULLET_PAGE_INDICATOR_BUTTON_ID"; - public final static String SET_PAGE_COUNT_TO_INDETERMINATE_BUTTON_ID = "SET_PAGE_COUNT_TO_INDETERMINATE_BUTTON_ID"; - public final static String OLD_FACTORY_MARKER = "factory : old"; - public final static String NEW_FACTORY_MARKER = "factory : new"; - public final static String PAGE_INDEX_PREFIX = "PAGE : "; - public final static int LABELS_PER_PAGE = 10; - - public static void main(String[] args) { - Utils.launch(PaginationApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "PaginationTestApp"); - return new PaginationApp.PaginationScene(); - } - - class PaginationScene extends CommonPropertiesScene { - - PropertiesTable tb; - Pagination testedPagination; - final int i = 10; - private String[] content; - private static final int MAX_CONTENT = 2500; - - public PaginationScene() { - super("Pagination", 800, 600); - - prepareScene(); - } - - @Override - final protected void prepareScene() { - Utils.addBrowser(this); - - content = new String[MAX_CONTENT]; - for (int i = 0; i < MAX_CONTENT; i++) { - content[i] = "some text " + i; - } - - testedPagination = new Pagination(i); - testedPagination.setId(TESTED_PAGINATION_ID); - - testedPagination.setPageFactory(new Callback() { - @Override - public Node call(Integer pageIndex) { - return createPage(pageIndex); - } - }); - - tb = new PropertiesTable(testedPagination); - PropertyTablesFactory.explorePropertiesList(testedPagination, tb); - SpecialTablePropertiesProvider.provideForControl(testedPagination, tb); - tb.addDoublePropertyLine(testedPagination.minHeightProperty(), -100, 300, 50, testedPagination); - tb.addDoublePropertyLine(testedPagination.minWidthProperty(), -100, 300, 50, testedPagination); - - Button hardResetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Hard reset").build(); - hardResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareMainSceneStructure(); - prepareScene(); - } - }); - - Button setBulletPageIndicatorButton = ButtonBuilder.create().id(SET_BULLET_PAGE_INDICATOR_BUTTON_ID).text("Set bullet").build(); - setBulletPageIndicatorButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - //testedPagination.setStyle(Pagination.STYLE_CLASS_BULLET); - testedPagination.getStyleClass().add(Pagination.STYLE_CLASS_BULLET); - } - }); - - Button setPageCountToIndeterminateButton = ButtonBuilder.create().id(SET_PAGE_COUNT_TO_INDETERMINATE_BUTTON_ID).text("Set indeterminate\n page count").build(); - setPageCountToIndeterminateButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - testedPagination.setPageCount(Pagination.INDETERMINATE); - } - }); - - Button softResetButton = ButtonBuilder.create().id(SOFT_RESET_BUTTON_ID).text("Soft reset").build(); - softResetButton.setOnAction(new EventHandler() { - @Override - public void handle(ActionEvent t) { - tb.refresh(); - Pagination newOne = new Pagination(i); - testedPagination.setCurrentPageIndex(newOne.getCurrentPageIndex()); - testedPagination.setPageCount(newOne.getPageCount()); - testedPagination.setPageFactory(newOne.getPageFactory()); - testedPagination.setMaxPageIndicatorCount(newOne.maxPageIndicatorCountProperty().get()); - } - }); - - Button setNewPageFactory = ButtonBuilder.create().id(SET_NEW_PAGE_FACTORY_BUTTON_ID).text("Set new page factory").build(); - setNewPageFactory.setOnAction(new EventHandler() { - @Override - public void handle(ActionEvent t) { - Callback newOne = new Callback() { - @Override - public Node call(Integer pageIndex) { - return createPage2(pageIndex); - } - }; - - Callback oldOne = testedPagination.getPageFactory(); - - testedPagination.setPageFactory(newOne); - - assertTrue(testedPagination.pageFactoryProperty().getValue().equals(newOne)); - assertTrue(testedPagination.getPageFactory().equals(newOne)); - assertFalse(testedPagination.pageFactoryProperty().getValue().equals(oldOne)); - assertFalse(testedPagination.getPageFactory().equals(oldOne)); - } - }); - - Button setOldPageFactory = ButtonBuilder.create().id(SET_OLD_PAGE_FACTORY_BUTTON_ID).text("Set old page factory").build(); - setOldPageFactory.setOnAction(new EventHandler() { - @Override - public void handle(ActionEvent t) { - Callback newOne = new Callback() { - @Override - public Node call(Integer pageIndex) { - return createPage(pageIndex); - } - }; - - Callback oldOne = testedPagination.getPageFactory(); - - testedPagination.setPageFactory(newOne); - - assertTrue(testedPagination.pageFactoryProperty().getValue().equals(newOne)); - assertTrue(testedPagination.getPageFactory().equals(newOne)); - assertFalse(testedPagination.pageFactoryProperty().getValue().equals(oldOne)); - assertFalse(testedPagination.getPageFactory().equals(oldOne)); - } - }); - - HBox resetButtonsHBox = new HBox(); - resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); - - VBox vb = new VBox(); - vb.setSpacing(5); - vb.getChildren().addAll(resetButtonsHBox, setNewPageFactory, - setOldPageFactory, setBulletPageIndicatorButton, - setPageCountToIndeterminateButton); - setControllersContent(vb); - setTestedControl(testedPagination); - setPropertiesContent(tb); - } - - public VBox createPage(int pageIndex) { - checkIndexCorrectness(pageIndex); - - VBox box = new VBox(5); - int page = pageIndex * 10; - for (int i = 0; i < 10; i++) { - Label l = new Label(PAGE_INDEX_PREFIX + pageIndex + "; " + OLD_FACTORY_MARKER + "; " + content[page + i % MAX_CONTENT]); - box.getChildren().add(l); - } - box.getChildren().addAll(ComponentsFactory.createFormComponent(), ComponentsFactory.createCustomContent(100, 100)); - return box; - } - - public VBox createPage2(int pageIndex) { - checkIndexCorrectness(pageIndex); - - VBox box = new VBox(5); - int page = pageIndex * 10; - for (int i = 0; i < LABELS_PER_PAGE; i++) { - Label l = new Label(PAGE_INDEX_PREFIX + pageIndex + "; " + NEW_FACTORY_MARKER + "; " + content[page + i % MAX_CONTENT]); - box.getChildren().add(l); - } - box.getChildren().addAll(ComponentsFactory.createCustomContent(100, 100)); - return box; - } - - private void checkIndexCorrectness(int index) { - if (testedPagination.getPageCount() != Pagination.INDETERMINATE) { - if ((index < 0) || (index > Math.max(testedPagination.getPageCount() - 1, 0))) { - throw new IllegalArgumentException("Incorrect index : " + index); - } - } - } - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.pagination; + +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.scene.Node; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.Pagination; +import javafx.scene.control.test.utils.*; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; +import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import javafx.util.Callback; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class PaginationApp extends InteroperabilityApp { + + public final static String TESTED_PAGINATION_ID = "TESTED_PAGINATION_ID"; + public final static String HARD_RESET_BUTTON_ID = "HARD_RESET_PAGINATION_BUTTON_ID"; + public final static String SOFT_RESET_BUTTON_ID = "SOFT_RESET_PAGINATION_BUTTON_ID"; + public final static String SET_NEW_PAGE_FACTORY_BUTTON_ID = "SET_NEW_PAGE_FACTORY_BUTTON_ID"; + public final static String SET_OLD_PAGE_FACTORY_BUTTON_ID = "SET_OLD_PAGE_FACTORY_BUTTON_ID"; + public final static String SET_BULLET_PAGE_INDICATOR_BUTTON_ID = "SET_BULLET_PAGE_INDICATOR_BUTTON_ID"; + public final static String SET_PAGE_COUNT_TO_INDETERMINATE_BUTTON_ID = "SET_PAGE_COUNT_TO_INDETERMINATE_BUTTON_ID"; + public final static String OLD_FACTORY_MARKER = "factory : old"; + public final static String NEW_FACTORY_MARKER = "factory : new"; + public final static String PAGE_INDEX_PREFIX = "PAGE : "; + public final static int LABELS_PER_PAGE = 10; + + public static void main(String[] args) { + Utils.launch(PaginationApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "PaginationTestApp"); + return new PaginationApp.PaginationScene(); + } + + class PaginationScene extends CommonPropertiesScene { + + PropertiesTable tb; + Pagination testedPagination; + final int i = 10; + private String[] content; + private static final int MAX_CONTENT = 2500; + + public PaginationScene() { + super("Pagination", 800, 600); + + prepareScene(); + } + + @Override + final protected void prepareScene() { + Utils.addBrowser(this); + + content = new String[MAX_CONTENT]; + for (int i = 0; i < MAX_CONTENT; i++) { + content[i] = "some text " + i; + } + + testedPagination = new Pagination(i); + testedPagination.setId(TESTED_PAGINATION_ID); + + testedPagination.setPageFactory(new Callback() { + @Override + public Node call(Integer pageIndex) { + return createPage(pageIndex); + } + }); + + tb = new PropertiesTable(testedPagination); + PropertyTablesFactory.explorePropertiesList(testedPagination, tb); + SpecialTablePropertiesProvider.provideForControl(testedPagination, tb); + tb.addDoublePropertyLine(testedPagination.minHeightProperty(), -100, 300, 50, testedPagination); + tb.addDoublePropertyLine(testedPagination.minWidthProperty(), -100, 300, 50, testedPagination); + + Button hardResetButton = new Button("Hard reset"); + hardResetButton.setId(HARD_RESET_BUTTON_ID); + hardResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareMainSceneStructure(); + prepareScene(); + } + }); + + Button setBulletPageIndicatorButton = new Button("Set bullet"); + setBulletPageIndicatorButton.setId(SET_BULLET_PAGE_INDICATOR_BUTTON_ID); + setBulletPageIndicatorButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + //testedPagination.setStyle(Pagination.STYLE_CLASS_BULLET); + testedPagination.getStyleClass().add(Pagination.STYLE_CLASS_BULLET); + } + }); + + Button setPageCountToIndeterminateButton = new Button("Set indeterminate\n page count"); + setPageCountToIndeterminateButton.setId(SET_PAGE_COUNT_TO_INDETERMINATE_BUTTON_ID); + setPageCountToIndeterminateButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + testedPagination.setPageCount(Pagination.INDETERMINATE); + } + }); + + Button softResetButton = new Button("Soft reset"); + softResetButton.setId(SOFT_RESET_BUTTON_ID); + softResetButton.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent t) { + tb.refresh(); + Pagination newOne = new Pagination(i); + testedPagination.setCurrentPageIndex(newOne.getCurrentPageIndex()); + testedPagination.setPageCount(newOne.getPageCount()); + testedPagination.setPageFactory(newOne.getPageFactory()); + testedPagination.setMaxPageIndicatorCount(newOne.maxPageIndicatorCountProperty().get()); + } + }); + + Button setNewPageFactory = new Button("Set new page factory"); + setNewPageFactory.setId(SET_NEW_PAGE_FACTORY_BUTTON_ID); + setNewPageFactory.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent t) { + Callback newOne = new Callback() { + @Override + public Node call(Integer pageIndex) { + return createPage2(pageIndex); + } + }; + + Callback oldOne = testedPagination.getPageFactory(); + + testedPagination.setPageFactory(newOne); + + assertTrue(testedPagination.pageFactoryProperty().getValue().equals(newOne)); + assertTrue(testedPagination.getPageFactory().equals(newOne)); + assertFalse(testedPagination.pageFactoryProperty().getValue().equals(oldOne)); + assertFalse(testedPagination.getPageFactory().equals(oldOne)); + } + }); + + Button setOldPageFactory = new Button("Set old page factory"); + setOldPageFactory.setId(SET_OLD_PAGE_FACTORY_BUTTON_ID); + setOldPageFactory.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent t) { + Callback newOne = new Callback() { + @Override + public Node call(Integer pageIndex) { + return createPage(pageIndex); + } + }; + + Callback oldOne = testedPagination.getPageFactory(); + + testedPagination.setPageFactory(newOne); + + assertTrue(testedPagination.pageFactoryProperty().getValue().equals(newOne)); + assertTrue(testedPagination.getPageFactory().equals(newOne)); + assertFalse(testedPagination.pageFactoryProperty().getValue().equals(oldOne)); + assertFalse(testedPagination.getPageFactory().equals(oldOne)); + } + }); + + HBox resetButtonsHBox = new HBox(); + resetButtonsHBox.getChildren().addAll(hardResetButton, softResetButton); + + VBox vb = new VBox(); + vb.setSpacing(5); + vb.getChildren().addAll(resetButtonsHBox, setNewPageFactory, + setOldPageFactory, setBulletPageIndicatorButton, + setPageCountToIndeterminateButton); + setControllersContent(vb); + setTestedControl(testedPagination); + setPropertiesContent(tb); + } + + public VBox createPage(int pageIndex) { + checkIndexCorrectness(pageIndex); + + VBox box = new VBox(5); + int page = pageIndex * 10; + for (int i = 0; i < 10; i++) { + Label l = new Label(PAGE_INDEX_PREFIX + pageIndex + "; " + OLD_FACTORY_MARKER + "; " + content[page + i % MAX_CONTENT]); + box.getChildren().add(l); + } + box.getChildren().addAll(ComponentsFactory.createFormComponent(), ComponentsFactory.createCustomContent(100, 100)); + return box; + } + + public VBox createPage2(int pageIndex) { + checkIndexCorrectness(pageIndex); + + VBox box = new VBox(5); + int page = pageIndex * 10; + for (int i = 0; i < LABELS_PER_PAGE; i++) { + Label l = new Label(PAGE_INDEX_PREFIX + pageIndex + "; " + NEW_FACTORY_MARKER + "; " + content[page + i % MAX_CONTENT]); + box.getChildren().add(l); + } + box.getChildren().addAll(ComponentsFactory.createCustomContent(100, 100)); + return box; + } + + private void checkIndexCorrectness(int index) { + if (testedPagination.getPageCount() != Pagination.INDETERMINATE) { + if ((index < 0) || (index > Math.max(testedPagination.getPageCount() - 1, 0))) { + throw new IllegalArgumentException("Incorrect index : " + index); + } + } + } + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/scrollbar/ScrollBarApp.java 2016-12-22 11:26:24.221028915 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/scrollbar/ScrollBarApp.java 2016-12-22 11:26:24.161028337 +0300 @@ -66,13 +66,16 @@ @Override final protected void prepareScene() { - testedScrollBar = ScrollBarBuilder.create().id(TESTED_SCROLLBAR_ID).build(); + testedScrollBar = new ScrollBar(); + testedScrollBar.setFocusTraversable(true); + testedScrollBar.setId(TESTED_SCROLLBAR_ID); tb = new PropertiesTable(testedScrollBar); PropertyTablesFactory.explorePropertiesList(testedScrollBar, tb); SpecialTablePropertiesProvider.provideForControl(testedScrollBar, tb); - Button resetButton = ButtonBuilder.create().id(RESET_BUTTON_ID).text("Reset").build(); + Button resetButton = new Button("Reset"); + resetButton.setId(RESET_BUTTON_ID); resetButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { HBox hb = (HBox) getRoot(); --- old/functional/ControlsTests/src/javafx/scene/control/test/separator/SeparatorApp.java 2016-12-22 11:26:24.405030689 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/separator/SeparatorApp.java 2016-12-22 11:26:24.353030188 +0300 @@ -1,106 +1,108 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.separator; - -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.geometry.Insets; -import javafx.scene.Scene; -import javafx.scene.control.*; -import javafx.scene.control.test.utils.CommonPropertiesScene; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Pane; -import javafx.scene.layout.VBox; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class SeparatorApp extends InteroperabilityApp { - - public final static String TESTED_SEPARATOR_ID = "TESTED_SEPARATOR_ID"; - public final static String RESET_BUTTON_ID = "RESET_SEPARATOR_BUTTON_ID"; - - public static void main(String[] args) { - Utils.launch(SeparatorApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "SeparatorTestApp"); - return new SeparatorApp.SeparatorScene(); - } - - class SeparatorScene extends CommonPropertiesScene { - - //VBox which contains tested separator. - Pane pane; - PropertiesTable tb; - //Separator to be tested. - Separator testedSeparator; - - public SeparatorScene() { - super("Separator", 800, 600); - - prepareScene(); - } - - @Override - final protected void prepareScene() { - pane = new Pane(); - testedSeparator = SeparatorBuilder.create().id(TESTED_SEPARATOR_ID).build(); - - tb = new PropertiesTable(testedSeparator); - PropertyTablesFactory.explorePropertiesList(testedSeparator, tb); - - pane.setMinSize(220, 220); - pane.setPrefSize(220, 220); - pane.setStyle("-fx-border-color : red;"); - pane.getChildren().add(testedSeparator); - - VBox vb = new VBox(); - vb.setSpacing(5); - - HBox hb = (HBox) getRoot(); - hb.setPadding(new Insets(5, 5, 5, 5)); - hb.setStyle("-fx-border-color : green;"); - - Button resetButton = ButtonBuilder.create().id(RESET_BUTTON_ID).text("Reset").build(); - resetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareScene(); - } - }); - setTestedControl(testedSeparator); - setControllersContent(resetButton); - setPropertiesContent(tb); - } - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.separator; + +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.*; +import javafx.scene.control.test.utils.CommonPropertiesScene; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class SeparatorApp extends InteroperabilityApp { + + public final static String TESTED_SEPARATOR_ID = "TESTED_SEPARATOR_ID"; + public final static String RESET_BUTTON_ID = "RESET_SEPARATOR_BUTTON_ID"; + + public static void main(String[] args) { + Utils.launch(SeparatorApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "SeparatorTestApp"); + return new SeparatorApp.SeparatorScene(); + } + + class SeparatorScene extends CommonPropertiesScene { + + //VBox which contains tested separator. + Pane pane; + PropertiesTable tb; + //Separator to be tested. + Separator testedSeparator; + + public SeparatorScene() { + super("Separator", 800, 600); + + prepareScene(); + } + + @Override + final protected void prepareScene() { + pane = new Pane(); + testedSeparator = new Separator(); + testedSeparator.setId(TESTED_SEPARATOR_ID); + + tb = new PropertiesTable(testedSeparator); + PropertyTablesFactory.explorePropertiesList(testedSeparator, tb); + + pane.setMinSize(220, 220); + pane.setPrefSize(220, 220); + pane.setStyle("-fx-border-color : red;"); + pane.getChildren().add(testedSeparator); + + VBox vb = new VBox(); + vb.setSpacing(5); + + HBox hb = (HBox) getRoot(); + hb.setPadding(new Insets(5, 5, 5, 5)); + hb.setStyle("-fx-border-color : green;"); + + Button resetButton = new Button("Reset"); + resetButton.setId(RESET_BUTTON_ID); + resetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareScene(); + } + }); + setTestedControl(testedSeparator); + setControllersContent(resetButton); + setPropertiesContent(tb); + } + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/slider/SliderNewApp.java 2016-12-22 11:26:24.601032580 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/slider/SliderNewApp.java 2016-12-22 11:26:24.553032117 +0300 @@ -28,9 +28,7 @@ import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; -import javafx.scene.control.ButtonBuilder; import javafx.scene.control.Slider; -import javafx.scene.control.SliderBuilder; import javafx.scene.control.test.utils.CommonPropertiesScene; import javafx.scene.control.test.utils.ptables.PropertiesTable; import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; @@ -76,13 +74,15 @@ @Override final protected void prepareScene() { - testedSlider = SliderBuilder.create().id(TESTED_SLIDER_ID).build(); + testedSlider = new Slider(); + testedSlider.setId(TESTED_SLIDER_ID); tb = new PropertiesTable(testedSlider); PropertyTablesFactory.explorePropertiesList(testedSlider, tb); SpecialTablePropertiesProvider.provideForControl(testedSlider, tb); - Button resetButton = ButtonBuilder.create().id(RESET_BUTTON_ID).text("Reset").build(); + Button resetButton = new Button("Reset"); + resetButton.setId(RESET_BUTTON_ID); resetButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { HBox hb = (HBox) getRoot(); @@ -92,7 +92,8 @@ } }); - Button setCustomConverter = ButtonBuilder.create().id(APPLY_CUSTOM_LABEL_FORMATTER).text("ApplyCsustomConverter").build(); + Button setCustomConverter = new Button("ApplyCsustomConverter"); + setCustomConverter.setId(APPLY_CUSTOM_LABEL_FORMATTER); setCustomConverter.setOnAction(new EventHandler() { public void handle(ActionEvent t) { testedSlider.setLabelFormatter(new CustomConverter()); --- old/functional/ControlsTests/src/javafx/scene/control/test/splitpane/SplitPaneApp.java 2016-12-22 11:26:24.789034394 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/splitpane/SplitPaneApp.java 2016-12-22 11:26:24.741033930 +0300 @@ -1,124 +1,128 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.splitpane; - -import javafx.scene.control.test.utils.ptables.TabPaneWithControl; -import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.NodesChoserFactory; -import javafx.scene.control.test.utils.ptables.NodeControllerFactory; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.geometry.Insets; -import javafx.scene.Node; -import javafx.scene.Scene; -import javafx.scene.control.*; -import javafx.scene.control.test.utils.*; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Pane; -import javafx.scene.layout.VBox; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class SplitPaneApp extends InteroperabilityApp { - - public final static String TESTED_SPLIPANE_ID = "TESTED_SPLIPANE_ID"; - public final static String RESET_BUTTON_ID = "RESET_SPLIPANE_BUTTON_ID"; - public final static String SPLITPANE_ADD_INDEX_TEXT_FIELD_ID = "SPLITPANE_ADD_INDEX_TEXT_FIELD_ID"; - - public static void main(String[] args) { - Utils.launch(SplitPaneApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "SplitPaneTestApp"); - return new SplitPaneApp.SplitPaneScene(); - } - - class SplitPaneScene extends Scene { - - //VBox which contain tested split pane. - Pane pane; - //Splipane to be tested. - SplitPane testedSplitPane; - - public SplitPaneScene() { - super(new HBox(), 800, 600); - - prepareScene(); - } - - private void prepareScene() { - pane = new Pane(); - testedSplitPane = SplitPaneBuilder.create().id(TESTED_SPLIPANE_ID).build(); - - PropertiesTable tb = new PropertiesTable(testedSplitPane); - PropertyTablesFactory.explorePropertiesList(testedSplitPane, tb); - - final TabPaneWithControl tabPane = new TabPaneWithControl("Accordion", tb); - - final TextField tf = TextFieldBuilder.create().id(SPLITPANE_ADD_INDEX_TEXT_FIELD_ID).text("0").prefWidth(40).build(); - - HBox nodeshb = new NodesChoserFactory("Add!", new NodesChoserFactory.NodeAction() { - - @Override - public void execute(Node node) { - testedSplitPane.getItems().add(Integer.parseInt(tf.getText()), node); - tabPane.addPropertiesTable(node.getClass().getSimpleName(), NodeControllerFactory.createFullController(node, tabPane)); - } - }, tf); - - pane.setMinSize(220, 220); - pane.setPrefSize(220, 220); - pane.setStyle("-fx-border-color : red;"); - pane.getChildren().add(testedSplitPane); - - VBox vb = new VBox(); - vb.setSpacing(5); - - HBox hb = (HBox) getRoot(); - hb.setPadding(new Insets(5, 5, 5, 5)); - hb.setStyle("-fx-border-color : green;"); - - Button resetButton = ButtonBuilder.create().id(RESET_BUTTON_ID).text("Reset").build(); - resetButton.setOnAction(new EventHandler() { - - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareScene(); - } - }); - - vb.getChildren().addAll(new Label("Pane with tested Accordion"), pane, resetButton, nodeshb); - - hb.getChildren().addAll(vb, tabPane); - } - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.splitpane; + +import javafx.scene.control.test.utils.ptables.TabPaneWithControl; +import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.NodesChoserFactory; +import javafx.scene.control.test.utils.ptables.NodeControllerFactory; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.geometry.Insets; +import javafx.scene.Node; +import javafx.scene.Scene; +import javafx.scene.control.*; +import javafx.scene.control.test.utils.*; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class SplitPaneApp extends InteroperabilityApp { + + public final static String TESTED_SPLIPANE_ID = "TESTED_SPLIPANE_ID"; + public final static String RESET_BUTTON_ID = "RESET_SPLIPANE_BUTTON_ID"; + public final static String SPLITPANE_ADD_INDEX_TEXT_FIELD_ID = "SPLITPANE_ADD_INDEX_TEXT_FIELD_ID"; + + public static void main(String[] args) { + Utils.launch(SplitPaneApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "SplitPaneTestApp"); + return new SplitPaneApp.SplitPaneScene(); + } + + class SplitPaneScene extends Scene { + + //VBox which contain tested split pane. + Pane pane; + //Splipane to be tested. + SplitPane testedSplitPane; + + public SplitPaneScene() { + super(new HBox(), 800, 600); + + prepareScene(); + } + + private void prepareScene() { + pane = new Pane(); + testedSplitPane = new SplitPane(); + testedSplitPane.setId(TESTED_SPLIPANE_ID); + + PropertiesTable tb = new PropertiesTable(testedSplitPane); + PropertyTablesFactory.explorePropertiesList(testedSplitPane, tb); + + final TabPaneWithControl tabPane = new TabPaneWithControl("Accordion", tb); + + final TextField tf = new TextField("0"); + tf.setId(SPLITPANE_ADD_INDEX_TEXT_FIELD_ID); + tf.setPrefWidth(40); + + HBox nodeshb = new NodesChoserFactory("Add!", new NodesChoserFactory.NodeAction() { + + @Override + public void execute(Node node) { + testedSplitPane.getItems().add(Integer.parseInt(tf.getText()), node); + tabPane.addPropertiesTable(node.getClass().getSimpleName(), NodeControllerFactory.createFullController(node, tabPane)); + } + }, tf); + + pane.setMinSize(220, 220); + pane.setPrefSize(220, 220); + pane.setStyle("-fx-border-color : red;"); + pane.getChildren().add(testedSplitPane); + + VBox vb = new VBox(); + vb.setSpacing(5); + + HBox hb = (HBox) getRoot(); + hb.setPadding(new Insets(5, 5, 5, 5)); + hb.setStyle("-fx-border-color : green;"); + + Button resetButton = new Button("Reset"); + resetButton.setId(RESET_BUTTON_ID); + resetButton.setOnAction(new EventHandler() { + + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareScene(); + } + }); + + vb.getChildren().addAll(new Label("Pane with tested Accordion"), pane, resetButton, nodeshb); + + hb.getChildren().addAll(vb, tabPane); + } + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/tableview/NewTableViewApp.java 2016-12-22 11:26:24.989036322 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/tableview/NewTableViewApp.java 2016-12-22 11:26:24.941035859 +0300 @@ -24,10 +24,10 @@ */ package javafx.scene.control.test.tableview; -import com.sun.javafx.scene.control.skin.NestedTableColumnHeader; -import com.sun.javafx.scene.control.skin.TableColumnHeader; -import com.sun.javafx.scene.control.skin.TableHeaderRow; -import com.sun.javafx.scene.control.skin.TableViewSkin; +import javafx.scene.control.skin.NestedTableColumnHeader; +import javafx.scene.control.skin.TableColumnHeader; +import javafx.scene.control.skin.TableHeaderRow; +import javafx.scene.control.skin.TableViewSkin; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -66,6 +66,8 @@ import static javafx.commons.Consts.*; import static javafx.commons.Consts.Cell.*; import javafx.scene.Node; +import static javafx.scene.control.test.treetable.ResetButtonNames.HARD_RESET_BUTTON_ID; +import static javafx.scene.control.test.treetable.ResetButtonNames.SOFT_RESET_BUTTON_ID; import javafx.scene.control.test.utils.ComponentsFactory.MultipleIndexFormComponent.MultipleIndicesAction; import static org.junit.Assert.assertTrue; @@ -129,7 +131,8 @@ tabPane = new TabPaneWithControl("TableView", tb); tabPane.setMinSize(1000, 1000); - Button hardResetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Hard reset").build(); + Button hardResetButton = new Button("Hard reset"); + hardResetButton.setId(HARD_RESET_BUTTON_ID); hardResetButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { HBox hb = (HBox) getRoot(); @@ -139,7 +142,8 @@ } }); - Button softResetButton = ButtonBuilder.create().id(SOFT_RESET_BUTTON_ID).text("Soft reset").build(); + Button softResetButton = new Button("Soft reset"); + softResetButton.setId(SOFT_RESET_BUTTON_ID); softResetButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { TableView newOne = new TableView(); @@ -327,7 +331,7 @@ public String toString() { return "CUSTOM " + super.toString(); } - +/* @Override protected TableHeaderRow createTableHeaderRow() { return new TableHeaderRow(this) { @@ -350,6 +354,7 @@ } }; } + */ }); } }); @@ -456,10 +461,8 @@ hb.getChildren().addAll(cmbEditors, chbCustom, btnSetEditor); - Button btn = ButtonBuilder.create() - .text("Set onEdit event hadlers") - .id(BTN_SET_ON_EDIT_EVENT_HANDLERS) - .build(); + Button btn = new Button("Set onEdit event hadlers"); + btn.setId(BTN_SET_ON_EDIT_EVENT_HANDLERS); btn.setOnAction(new EventHandler() { public void handle(ActionEvent t) { @@ -896,4 +899,4 @@ } return testData; } -} \ No newline at end of file +} --- old/functional/ControlsTests/src/javafx/scene/control/test/tabpane/NewTabPaneApp.java 2016-12-22 11:26:25.185038213 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/tabpane/NewTabPaneApp.java 2016-12-22 11:26:25.133037711 +0300 @@ -1,274 +1,267 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.tabpane; - -import javafx.event.ActionEvent; -import javafx.event.Event; -import javafx.event.EventHandler; -import javafx.factory.*; -import javafx.scene.Node; -import javafx.scene.Scene; -import javafx.scene.control.*; -import javafx.scene.control.test.utils.CommonPropertiesScene; -import javafx.scene.control.test.utils.ptables.*; -import javafx.scene.control.test.utils.ptables.NodeControllerFactory.NodesStorage; -import static javafx.scene.control.test.utils.ptables.NodesChoserFactory.*; -import javafx.scene.layout.ColumnConstraints; -import javafx.scene.layout.GridPane; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Pane; -import javafx.scene.layout.VBox; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class NewTabPaneApp extends InteroperabilityApp { - - public final static String TESTED_TABPANE_ID = "TESTED_TABPANE_ID"; - public final static String RESET_BUTTON_ID = "RESET_TABPANE_BUTTON_ID"; - public final static String RESET_SOFTLY_BUTTON_ID = "RESET_SOFTLY_BUTTON_ID"; - public final static String TABPANE_ADD_INDEX_TEXT_FIELD_ID = "TABPANE_ADD_INDEX_TEXT_FIELD_ID"; - public final static String NEW_TAB_ID_TEXT_FIELD_ID = "TAB_ID"; - public final static String FOCUS_RECEIVING_BUTTON_ID = "FOCUS_RECEIVING_BUTTON_ID"; - public final static String TAB_CLOSE_REQUEST_EVENT = "TAB_CLOSE_REQUEST_EVENT"; - public final static String VETO_CHECKBOX_ID = "VETO_CHECKBOX_ID"; - - public static void main(String[] args) { - Utils.launch(NewTabPaneApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "TabPaneTestApp"); - NewTabPaneApp.TabPaneScene tabPaneScene = new NewTabPaneApp.TabPaneScene(); - Utils.addBrowser(tabPaneScene); - return tabPaneScene; - } - - class TabPaneScene extends CommonPropertiesScene { - - //VBox which contain tested TabPane. - Pane pane; - //TabPane to be tested. - TabPane testedTabPane; - TabPaneWithControl tabPane; - private PropertiesTable tb; - - public TabPaneScene() { - super("Tab pane tests", 800, 600); - - prepareScene(); - } - - @Override - public final void prepareScene() { - pane = new Pane(); - pane.setMinSize(220, 220); - pane.setPrefSize(220, 220); - pane.setStyle("-fx-border-color : red;"); - - testedTabPane = TabPaneBuilder.create().id(TESTED_TABPANE_ID).build(); - pane.getChildren().add(testedTabPane); - - tb = new PropertiesTable(testedTabPane); - PropertyTablesFactory.explorePropertiesList(testedTabPane, tb); - - Button btnResetHardly = ButtonBuilder.create().id(RESET_BUTTON_ID).text("Reset").build(); - btnResetHardly.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareMainSceneStructure(); - prepareScene(); - } - }); - - Button btnResetSoftly = ButtonBuilder.create().id(RESET_SOFTLY_BUTTON_ID).text("Reset softly").build(); - btnResetSoftly.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - - tb.refresh(); - - TabPane newInstance = new TabPane(); - while (testedTabPane.getTabs().size() != 0) { - testedTabPane.getTabs().remove(0); - } - - testedTabPane.setSide(newInstance.getSide()); - testedTabPane.setPrefHeight(newInstance.getPrefHeight()); - testedTabPane.setMinHeight(newInstance.getMinHeight()); - testedTabPane.setMaxHeight(newInstance.getMaxHeight()); - testedTabPane.setPrefWidth(newInstance.getPrefWidth()); - testedTabPane.setMinWidth(newInstance.getMinWidth()); - testedTabPane.setMaxWidth(newInstance.getMaxWidth()); - testedTabPane.setVisible(newInstance.isVisible()); - testedTabPane.setDisable(newInstance.isDisable()); - testedTabPane.setContextMenu(newInstance.getContextMenu()); - - tabPane.removePropertiesTablesExceptFirstOnes(1); - } - }); - - tabPane = new TabPaneWithControl("TabPane", tb); - - - - VBox vb = new VBox(); - vb.setSpacing(5); - vb.getChildren().addAll( - btnResetHardly, - btnResetSoftly, - getControlsForTabCreation(tabPane), - getButtonForFocus()); - - setTestedControl(testedTabPane); - setControllersContent(vb); - setPropertiesContent(tabPane); - } - - private Button getButtonForFocus() { - Button b = new Button("empty button"); - b.setId("FOCUS_RECEIVING_BUTTON_ID"); - return b; - } - - /** - * - * @return controls which set parameters and create the new tab - */ - private Pane getControlsForTabCreation(final TabPaneWithControl tabPane) { - - GridPane grid = new GridPane(); - - grid.setStyle("-fx-border-color:DARKBLUE"); - grid.setHgap(5); - grid.setVgap(5); - - ColumnConstraints column1 = new ColumnConstraints(); - column1.setPercentWidth(40); - ColumnConstraints column2 = new ColumnConstraints(); - column2.setPercentWidth(60); - - grid.getColumnConstraints().addAll(column1, column2); - //row #1 - grid.add(new Label("Tab ID"), 0, 0); - final TextField newTabId = TextFieldBuilder.create() - .id(NEW_TAB_ID_TEXT_FIELD_ID) - .text("ID") - .prefWidth(40d) - .build(); - grid.add(newTabId, 1, 0); - - //row #2 - grid.add(new Label("Index"), 0, 1); - final TextField newTabIndex = TextFieldBuilder.create() - .id(TABPANE_ADD_INDEX_TEXT_FIELD_ID) - .text("0") - .prefWidth(40) - .build(); - grid.add(newTabIndex, 1, 1); - - //row #3 - grid.add(new Label("Content"), 0, 2); - final ChoiceBox cb = new ChoiceBox(); - cb.setId(NODE_CHOSER_CHOICE_BOX_ID); - cb.getItems().addAll(ControlsFactory.filteredValues()); - cb.getItems().addAll(Shapes.values()); - cb.getItems().addAll(Panes.values()); - grid.add(cb, 1, 2); - - //row #4 - /* - * If true then there will be created a properties pane - * for tab content each time a tab is added - */ - final CheckBox createPropsTab = CheckBoxBuilder - .create() - .text("Create additional panes\n with content properties") - .build(); - grid.add(createPropsTab, 0, 3, 2, 1); - - //row #5 - /* - * If true then there will be created a properties pane - * for tab content each time a tab is added - */ - final CheckBox vetoOnClose = CheckBoxBuilder - .create() - .text("Veto tab request on close.") - .id(VETO_CHECKBOX_ID) - .build(); - grid.add(vetoOnClose, 0, 4, 2, 1); - - //row #6 - Button actionButton = new Button("Create new tab"); - actionButton.setId(NODE_CHOOSER_ACTION_BUTTON_ID); - - final NodesChoserFactory.NodeAction handler = new NodesChoserFactory.NodeAction() { - @Override - public void execute(Node node) { - Tab tab = new Tab(); - - tab.setId(newTabId.getText()); - tab.setText(newTabId.getText()); - tab.setContent(node); - - final NodesStorage fullController = NodeControllerFactory.createFullController(tab, tabPane); - fullController.pt.addCounter(TAB_CLOSE_REQUEST_EVENT); - - tab.setOnCloseRequest(new EventHandler() { - private boolean useVeto = vetoOnClose.isSelected(); - - public void handle(Event t) { - fullController.pt.incrementCounter(TAB_CLOSE_REQUEST_EVENT); - - if (useVeto) { - t.consume(); - } - } - }); - - tabPane.addPropertiesTable(newTabId.getText(), fullController); - testedTabPane.getTabs().add(Integer.parseInt(newTabIndex.getText()), tab); - - if (createPropsTab.isSelected()) { - tabPane.addPropertiesTable(node.getClass().getSimpleName(), NodeControllerFactory.createFullController(node, tabPane)); - } - } - }; - - actionButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - handler.execute(cb.getSelectionModel().getSelectedItem().createNode()); - } - }); - grid.add(actionButton, 0, 5, 2, 1); - - return grid; - } - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.tabpane; + +import javafx.event.ActionEvent; +import javafx.event.Event; +import javafx.event.EventHandler; +import javafx.factory.*; +import javafx.scene.Node; +import javafx.scene.Scene; +import javafx.scene.control.*; +import javafx.scene.control.test.utils.CommonPropertiesScene; +import javafx.scene.control.test.utils.ptables.*; +import javafx.scene.control.test.utils.ptables.NodeControllerFactory.NodesStorage; +import static javafx.scene.control.test.utils.ptables.NodesChoserFactory.*; +import javafx.scene.layout.ColumnConstraints; +import javafx.scene.layout.GridPane; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class NewTabPaneApp extends InteroperabilityApp { + + public final static String TESTED_TABPANE_ID = "TESTED_TABPANE_ID"; + public final static String RESET_BUTTON_ID = "RESET_TABPANE_BUTTON_ID"; + public final static String RESET_SOFTLY_BUTTON_ID = "RESET_SOFTLY_BUTTON_ID"; + public final static String TABPANE_ADD_INDEX_TEXT_FIELD_ID = "TABPANE_ADD_INDEX_TEXT_FIELD_ID"; + public final static String NEW_TAB_ID_TEXT_FIELD_ID = "TAB_ID"; + public final static String FOCUS_RECEIVING_BUTTON_ID = "FOCUS_RECEIVING_BUTTON_ID"; + public final static String TAB_CLOSE_REQUEST_EVENT = "TAB_CLOSE_REQUEST_EVENT"; + public final static String VETO_CHECKBOX_ID = "VETO_CHECKBOX_ID"; + + public static void main(String[] args) { + Utils.launch(NewTabPaneApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "TabPaneTestApp"); + NewTabPaneApp.TabPaneScene tabPaneScene = new NewTabPaneApp.TabPaneScene(); + Utils.addBrowser(tabPaneScene); + return tabPaneScene; + } + + class TabPaneScene extends CommonPropertiesScene { + + //VBox which contain tested TabPane. + Pane pane; + //TabPane to be tested. + TabPane testedTabPane; + TabPaneWithControl tabPane; + private PropertiesTable tb; + + public TabPaneScene() { + super("Tab pane tests", 800, 600); + + prepareScene(); + } + + @Override + public final void prepareScene() { + pane = new Pane(); + pane.setMinSize(220, 220); + pane.setPrefSize(220, 220); + pane.setStyle("-fx-border-color : red;"); + + testedTabPane = new TabPane(); + testedTabPane.setId(TESTED_TABPANE_ID); + pane.getChildren().add(testedTabPane); + + tb = new PropertiesTable(testedTabPane); + PropertyTablesFactory.explorePropertiesList(testedTabPane, tb); + + Button btnResetHardly = new Button("Reset"); + btnResetHardly.setId(RESET_BUTTON_ID); + btnResetHardly.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareMainSceneStructure(); + prepareScene(); + } + }); + + Button btnResetSoftly = new Button("Reset softly"); + btnResetSoftly.setId(RESET_SOFTLY_BUTTON_ID); + btnResetSoftly.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + + tb.refresh(); + + TabPane newInstance = new TabPane(); + while (testedTabPane.getTabs().size() != 0) { + testedTabPane.getTabs().remove(0); + } + + testedTabPane.setSide(newInstance.getSide()); + testedTabPane.setPrefHeight(newInstance.getPrefHeight()); + testedTabPane.setMinHeight(newInstance.getMinHeight()); + testedTabPane.setMaxHeight(newInstance.getMaxHeight()); + testedTabPane.setPrefWidth(newInstance.getPrefWidth()); + testedTabPane.setMinWidth(newInstance.getMinWidth()); + testedTabPane.setMaxWidth(newInstance.getMaxWidth()); + testedTabPane.setVisible(newInstance.isVisible()); + testedTabPane.setDisable(newInstance.isDisable()); + testedTabPane.setContextMenu(newInstance.getContextMenu()); + + tabPane.removePropertiesTablesExceptFirstOnes(1); + } + }); + + tabPane = new TabPaneWithControl("TabPane", tb); + + + + VBox vb = new VBox(); + vb.setSpacing(5); + vb.getChildren().addAll( + btnResetHardly, + btnResetSoftly, + getControlsForTabCreation(tabPane), + getButtonForFocus()); + + setTestedControl(testedTabPane); + setControllersContent(vb); + setPropertiesContent(tabPane); + } + + private Button getButtonForFocus() { + Button b = new Button("empty button"); + b.setId("FOCUS_RECEIVING_BUTTON_ID"); + return b; + } + + /** + * + * @return controls which set parameters and create the new tab + */ + private Pane getControlsForTabCreation(final TabPaneWithControl tabPane) { + + GridPane grid = new GridPane(); + + grid.setStyle("-fx-border-color:DARKBLUE"); + grid.setHgap(5); + grid.setVgap(5); + + ColumnConstraints column1 = new ColumnConstraints(); + column1.setPercentWidth(40); + ColumnConstraints column2 = new ColumnConstraints(); + column2.setPercentWidth(60); + + grid.getColumnConstraints().addAll(column1, column2); + //row #1 + grid.add(new Label("Tab ID"), 0, 0); + final TextField newTabId = new TextField("ID"); + newTabId.setPrefWidth(40d); + newTabId.setId(NEW_TAB_ID_TEXT_FIELD_ID); + grid.add(newTabId, 1, 0); + + //row #2 + grid.add(new Label("Index"), 0, 1); + final TextField newTabIndex = new TextField("0"); + newTabIndex.setId(TABPANE_ADD_INDEX_TEXT_FIELD_ID); + newTabIndex.setPrefWidth(40); + grid.add(newTabIndex, 1, 1); + + //row #3 + grid.add(new Label("Content"), 0, 2); + final ChoiceBox cb = new ChoiceBox(); + cb.setId(NODE_CHOSER_CHOICE_BOX_ID); + cb.getItems().addAll(ControlsFactory.filteredValues()); + cb.getItems().addAll(Shapes.values()); + cb.getItems().addAll(Panes.values()); + grid.add(cb, 1, 2); + + //row #4 + /* + * If true then there will be created a properties pane + * for tab content each time a tab is added + */ + final CheckBox createPropsTab = new CheckBox("Create additional panes\n with content properties"); + grid.add(createPropsTab, 0, 3, 2, 1); + + //row #5 + /* + * If true then there will be created a properties pane + * for tab content each time a tab is added + */ + final CheckBox vetoOnClose = new CheckBox("Veto tab request on close."); + vetoOnClose.setId(VETO_CHECKBOX_ID); + grid.add(vetoOnClose, 0, 4, 2, 1); + + //row #6 + Button actionButton = new Button("Create new tab"); + actionButton.setId(NODE_CHOOSER_ACTION_BUTTON_ID); + + final NodesChoserFactory.NodeAction handler = new NodesChoserFactory.NodeAction() { + @Override + public void execute(Node node) { + Tab tab = new Tab(); + + tab.setId(newTabId.getText()); + tab.setText(newTabId.getText()); + tab.setContent(node); + + final NodesStorage fullController = NodeControllerFactory.createFullController(tab, tabPane); + fullController.pt.addCounter(TAB_CLOSE_REQUEST_EVENT); + + tab.setOnCloseRequest(new EventHandler() { + private boolean useVeto = vetoOnClose.isSelected(); + + public void handle(Event t) { + fullController.pt.incrementCounter(TAB_CLOSE_REQUEST_EVENT); + + if (useVeto) { + t.consume(); + } + } + }); + + tabPane.addPropertiesTable(newTabId.getText(), fullController); + testedTabPane.getTabs().add(Integer.parseInt(newTabIndex.getText()), tab); + + if (createPropsTab.isSelected()) { + tabPane.addPropertiesTable(node.getClass().getSimpleName(), NodeControllerFactory.createFullController(node, tabPane)); + } + } + }; + + actionButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + handler.execute(cb.getSelectionModel().getSelectedItem().createNode()); + } + }); + grid.add(actionButton, 0, 5, 2, 1); + + return grid; + } + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/tabpane/TabPaneApp2.java 2016-12-22 11:26:25.373040026 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/tabpane/TabPaneApp2.java 2016-12-22 11:26:25.325039563 +0300 @@ -32,7 +32,7 @@ import javafx.event.EventHandler; import javafx.geometry.Side; import javafx.scene.Scene; -import javafx.scene.control.ButtonBuilder; +import javafx.scene.control.Button; import javafx.scene.control.ChoiceBox; import javafx.scene.control.ContextMenu; import javafx.scene.control.Label; @@ -113,34 +113,34 @@ error = new Label(); error.setId(ERROR_ID); - controls.getChildren().add( - ButtonBuilder.create() - .text(CLEAR_BTN_ID).id(CLEAR_BTN_ID) - .onAction(new EventHandler() { - public void handle(ActionEvent t) { - tabPane.getTabs().clear(); - } - }).build()); - - controls.getChildren().add( - ButtonBuilder.create() - .text(RESET_BTN_ID).id(RESET_BTN_ID) - .onAction(new EventHandler() { - - public void handle(ActionEvent t) { - reset(); - } - }).build()); - - controls.getChildren().add( - ButtonBuilder.create() - .text(ADD_SINGLE_BTN_ID).id(ADD_SINGLE_BTN_ID) - .onAction(new EventHandler() { - - public void handle(ActionEvent t) { - tabPane.getTabs().add(new NamedTab(TAB_ITEM + tabPane.getTabs().size())); - } - }).build()); + Button temp; + + temp = new Button(CLEAR_BTN_ID); + temp.setId(CLEAR_BTN_ID); + temp.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + tabPane.getTabs().clear(); + } + }); + controls.getChildren().add(temp); + + temp = new Button(RESET_BTN_ID); + temp.setId(RESET_BTN_ID); + temp.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + reset(); + } + }); + controls.getChildren().add(temp); + + temp = new Button(ADD_SINGLE_BTN_ID); + temp.setId(ADD_SINGLE_BTN_ID); + temp.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + tabPane.getTabs().add(new NamedTab(TAB_ITEM + tabPane.getTabs().size())); + } + }); + controls.getChildren().add(temp); HBox add_position_box = new HBox(5); controls.getChildren().add(add_position_box); @@ -148,15 +148,14 @@ final TextField add_position = new TextField("0"); add_position.setId(ADD_POS_EDIT_ID); - add_position_box.getChildren().add( - ButtonBuilder.create() - .text(ADD_SINGLE_AT_POS_BTN_ID).id(ADD_SINGLE_AT_POS_BTN_ID) - .onAction(new EventHandler() { - - public void handle(ActionEvent t) { - tabPane.getTabs().add(new NamedTab("Tab " + tabPane.getTabs().size())); - } - }).build()); + temp = new Button(ADD_SINGLE_AT_POS_BTN_ID); + temp.setId(ADD_SINGLE_AT_POS_BTN_ID); + temp.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + tabPane.getTabs().add(new NamedTab("Tab " + tabPane.getTabs().size())); + } + }); + add_position_box.getChildren().add(temp); final Label add_label = new Label("at"); add_position_box.getChildren().add(add_label); @@ -170,17 +169,16 @@ final TextField disable_position = new TextField("0"); disable_position.setId(DISABLE_POS_EDIT_ID); - disable_position_box.getChildren().add( - ButtonBuilder.create() - .text(DISABLE_SINGLE_AT_POS_BTN_ID).id(DISABLE_SINGLE_AT_POS_BTN_ID) - .onAction(new EventHandler() { - - public void handle(ActionEvent t) { - Integer pos = Integer.valueOf(disable_position.getText()); - Tab tab = tabPane.getTabs().get(pos.intValue()); - tab.setDisable(!tab.isDisable()); - } - }).build()); + temp = new Button(DISABLE_SINGLE_AT_POS_BTN_ID); + temp.setId(DISABLE_SINGLE_AT_POS_BTN_ID); + temp.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + Integer pos = Integer.valueOf(disable_position.getText()); + Tab tab = tabPane.getTabs().get(pos.intValue()); + tab.setDisable(!tab.isDisable()); + } + }); + disable_position_box.getChildren().add(temp); final Label disable_label = new Label("at"); disable_position_box.getChildren().add(disable_label); @@ -194,15 +192,14 @@ final TextField remove_position = new TextField("0"); remove_position.setId(REMOVE_POS_EDIT_ID); - remove_position_box.getChildren().add( - ButtonBuilder.create() - .text(REMOVE_SINGLE_AT_POS_BTN_ID).id(REMOVE_SINGLE_AT_POS_BTN_ID) - .onAction(new EventHandler() { - - public void handle(ActionEvent t) { - tabPane.getTabs().remove(Integer.valueOf(remove_position.getText()).intValue()); - } - }).build()); + temp = new Button(REMOVE_SINGLE_AT_POS_BTN_ID); + temp.setId(REMOVE_SINGLE_AT_POS_BTN_ID); + temp.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + tabPane.getTabs().remove(Integer.valueOf(remove_position.getText()).intValue()); + } + }); + remove_position_box.getChildren().add(temp); final Label remove_label = new Label("at"); remove_position_box.getChildren().add(remove_label); --- old/functional/ControlsTests/src/javafx/scene/control/test/textinput/TextAreaPropertiesApp.java 2016-12-22 11:26:25.561041839 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/textinput/TextAreaPropertiesApp.java 2016-12-22 11:26:25.513041376 +0300 @@ -1,97 +1,96 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.textinput; - -import javafx.event.Event; -import javafx.event.EventHandler; -import javafx.scene.Scene; -import javafx.scene.control.Button; -import javafx.scene.control.ButtonBuilder; -import javafx.scene.control.TextArea; -import javafx.scene.control.TextField; -import javafx.scene.layout.Pane; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class TextAreaPropertiesApp extends TextControlApp { - public static void main(String[] args) { - Utils.launch(TextAreaPropertiesApp.class, args); - } - - @Override - protected Scene getScene() { - setTitle(); - return new TextAreaScene(); - } - - public class TextAreaScene extends TextInputScene { - - @Override - public void setNewControl() { - testedTextInput = new TextArea(); - } - - @Override - public void resetControl() { - TextArea fresh = new TextArea(); - TextArea tested = (TextArea) testedTextInput; - tested.setPrefWidth(fresh.getPrefWidth()); - tested.setPrefHeight(fresh.getPrefHeight()); - tested.setDisable(fresh.isDisable()); - tested.setEditable(fresh.isEditable()); - tested.setPrefColumnCount(fresh.getPrefColumnCount()); - tested.setPrefRowCount(fresh.getPrefRowCount()); - tested.setText(fresh.getText()); - tested.setFocusTraversable(fresh.isFocusTraversable()); - tested.setWrapText(fresh.isWrapText()); - } - - @Override - public void addControlSpecificButtons(Pane pane) { - Button button = ButtonBuilder.create().id(ADD_TEXT_BUTTON_ID).text("Add much text").build(); - button.setOnAction(new EventHandler() { - - public void handle(Event t) { - for (int i = 0; i < 1000; i++) { - TextArea ta = (TextArea) testedTextInput; - ta.setText(ta.getText() + " some text"); - if (i % 10 == 0) { - ta.setText(ta.getText() + "\n"); - } - } - } - }); - pane.getChildren().add(button); - } - - @Override - protected void addControlDependentProperties() { - TextArea textArea = (TextArea) testedTextInput; - tb.addSimpleListener(textArea.focusedProperty(), textArea); - } - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.textinput; + +import javafx.event.Event; +import javafx.event.EventHandler; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.TextArea; +import javafx.scene.layout.Pane; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class TextAreaPropertiesApp extends TextControlApp { + public static void main(String[] args) { + Utils.launch(TextAreaPropertiesApp.class, args); + } + + @Override + protected Scene getScene() { + setTitle(); + return new TextAreaScene(); + } + + public class TextAreaScene extends TextInputScene { + + @Override + public void setNewControl() { + testedTextInput = new TextArea(); + } + + @Override + public void resetControl() { + TextArea fresh = new TextArea(); + TextArea tested = (TextArea) testedTextInput; + tested.setPrefWidth(fresh.getPrefWidth()); + tested.setPrefHeight(fresh.getPrefHeight()); + tested.setDisable(fresh.isDisable()); + tested.setEditable(fresh.isEditable()); + tested.setPrefColumnCount(fresh.getPrefColumnCount()); + tested.setPrefRowCount(fresh.getPrefRowCount()); + tested.setText(fresh.getText()); + tested.setFocusTraversable(fresh.isFocusTraversable()); + tested.setWrapText(fresh.isWrapText()); + } + + @Override + public void addControlSpecificButtons(Pane pane) { + Button button = new Button("Add much text"); + button.setId(ADD_TEXT_BUTTON_ID); + button.setOnAction(new EventHandler() { + + public void handle(Event t) { + for (int i = 0; i < 1000; i++) { + TextArea ta = (TextArea) testedTextInput; + ta.setText(ta.getText() + " some text"); + if (i % 10 == 0) { + ta.setText(ta.getText() + "\n"); + } + } + } + }); + pane.getChildren().add(button); + } + + @Override + protected void addControlDependentProperties() { + TextArea textArea = (TextArea) testedTextInput; + tb.addSimpleListener(textArea.focusedProperty(), textArea); + } + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/textinput/TextControlApp.java 2016-12-22 11:26:25.745043615 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/textinput/TextControlApp.java 2016-12-22 11:26:25.697043151 +0300 @@ -1,107 +1,108 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.textinput; - -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.geometry.Insets; -import javafx.scene.control.*; -import javafx.scene.control.test.utils.CommonPropertiesScene; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; -import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Pane; -import javafx.scene.layout.VBox; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public abstract class TextControlApp extends InteroperabilityApp { - - public final static String ADD_TEXT_BUTTON_ID = "ADD_TEXT_BUTTON_ID"; - public final static String TESTED_TEXT_INPUT_CONTROL_ID = "TESTED_CONTROL_ID"; - public final static String RESET_BUTTON_ID = "RESET_BUTTON_ID"; - - public abstract class TextInputScene extends CommonPropertiesScene { - - PropertiesTable tb; - //Control to be tested. - TextInputControl testedTextInput; - - public TextInputScene() { - super("TextInput", 800, 600); - - prepareScene(); - } - - public abstract void setNewControl(); - - public abstract void resetControl(); - - public abstract void addControlSpecificButtons(Pane pane); - - @Override - final protected void prepareScene() { - setNewControl(); - tb = new PropertiesTable(testedTextInput); - testedTextInput.setId(TESTED_TEXT_INPUT_CONTROL_ID); - - PropertyTablesFactory.explorePropertiesList(testedTextInput, tb); - SpecialTablePropertiesProvider.provideForControl(testedTextInput, tb); - - VBox vb = new VBox(); - vb.setSpacing(5); - - HBox hb = (HBox) getRoot(); - hb.setPadding(new Insets(5, 5, 5, 5)); - hb.setStyle("-fx-border-color : green;"); - - Button resetButton = ButtonBuilder.create().id(RESET_BUTTON_ID).text("RESET").build(); - resetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - tb.refresh(); - resetControl(); - } - }); - VBox resetButtonsHBox = new VBox(5); - resetButtonsHBox.getChildren().addAll(resetButton); - vb.getChildren().addAll(resetButtonsHBox); - addControlDependentProperties(); - addControlSpecificButtons(vb); - setTestedControl(testedTextInput); - setControllersContent(vb); - setPropertiesContent(tb); - } - - protected void addControlDependentProperties() {} - } - - protected void setTitle() { - Utils.setTitleToStage(stage, "TextInputTestApp"); - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.textinput; + +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.geometry.Insets; +import javafx.scene.control.*; +import javafx.scene.control.test.utils.CommonPropertiesScene; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; +import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public abstract class TextControlApp extends InteroperabilityApp { + + public final static String ADD_TEXT_BUTTON_ID = "ADD_TEXT_BUTTON_ID"; + public final static String TESTED_TEXT_INPUT_CONTROL_ID = "TESTED_CONTROL_ID"; + public final static String RESET_BUTTON_ID = "RESET_BUTTON_ID"; + + public abstract class TextInputScene extends CommonPropertiesScene { + + PropertiesTable tb; + //Control to be tested. + TextInputControl testedTextInput; + + public TextInputScene() { + super("TextInput", 800, 600); + + prepareScene(); + } + + public abstract void setNewControl(); + + public abstract void resetControl(); + + public abstract void addControlSpecificButtons(Pane pane); + + @Override + final protected void prepareScene() { + setNewControl(); + tb = new PropertiesTable(testedTextInput); + testedTextInput.setId(TESTED_TEXT_INPUT_CONTROL_ID); + + PropertyTablesFactory.explorePropertiesList(testedTextInput, tb); + SpecialTablePropertiesProvider.provideForControl(testedTextInput, tb); + + VBox vb = new VBox(); + vb.setSpacing(5); + + HBox hb = (HBox) getRoot(); + hb.setPadding(new Insets(5, 5, 5, 5)); + hb.setStyle("-fx-border-color : green;"); + + Button resetButton = new Button("RESET"); + resetButton.setId(RESET_BUTTON_ID); + resetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + tb.refresh(); + resetControl(); + } + }); + VBox resetButtonsHBox = new VBox(5); + resetButtonsHBox.getChildren().addAll(resetButton); + vb.getChildren().addAll(resetButtonsHBox); + addControlDependentProperties(); + addControlSpecificButtons(vb); + setTestedControl(testedTextInput); + setControllersContent(vb); + setPropertiesContent(tb); + } + + protected void addControlDependentProperties() {} + } + + protected void setTitle() { + Utils.setTitleToStage(stage, "TextInputTestApp"); + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/textinput/TextFieldPropertiesApp.java 2016-12-22 11:26:25.933045428 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/textinput/TextFieldPropertiesApp.java 2016-12-22 11:26:25.881044926 +0300 @@ -1,106 +1,108 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.textinput; - -import javafx.event.ActionEvent; -import javafx.event.Event; -import javafx.event.EventHandler; -import javafx.scene.Scene; -import javafx.scene.control.Button; -import javafx.scene.control.ButtonBuilder; -import javafx.scene.control.TextField; -import javafx.scene.layout.Pane; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class TextFieldPropertiesApp extends TextControlApp { - public final static String SET_ON_ACTION_BUTTON_ID = "SET_ON_ACTION_BUTTON_ID"; - public final static String ON_ACTION_COUNTER = "ON_ACTION_COUNTER"; - - public static void main(String[] args) { - Utils.launch(TextFieldPropertiesApp.class, args); - } - - @Override - protected Scene getScene() { - setTitle(); - return new TextFieldScene(); - } - - public class TextFieldScene extends TextInputScene { - - @Override - public void setNewControl() { - testedTextInput = new TextField(); - } - - @Override - protected void addControlDependentProperties() { - tb.addCounter(ON_ACTION_COUNTER); - } - - @Override - public void resetControl() { - TextField fresh = new TextField(); - TextField tested = (TextField) testedTextInput; - tested.setPrefWidth(fresh.getPrefWidth()); - tested.setPrefHeight(fresh.getPrefHeight()); - tested.setDisable(fresh.isDisable()); - tested.setEditable(fresh.isEditable()); - tested.setPrefColumnCount(fresh.getPrefColumnCount()); - tested.setText(fresh.getText()); - tested.setPromptText(fresh.getPromptText()); - tested.setFocusTraversable(fresh.isFocusTraversable()); - } - - @Override - public void addControlSpecificButtons(Pane pane) { - Button setOnActionListenerButton = ButtonBuilder.create().id(SET_ON_ACTION_BUTTON_ID).text("Set on action listener").build(); - setOnActionListenerButton.setOnAction(new EventHandler() { - - public void handle(Event t) { - ((TextField) testedTextInput).onActionProperty().setValue(new EventHandler() { - - public void handle(ActionEvent t) { - tb.incrementCounter(ON_ACTION_COUNTER); - } - }); - } - }); - - Button addTextButton = ButtonBuilder.create().id(ADD_TEXT_BUTTON_ID).text("Add \"sometext\"").build(); - addTextButton.setOnAction(new EventHandler() { - - public void handle(Event t) { - testedTextInput.setText(testedTextInput.getText() + "some\ntext"); - } - }); - - pane.getChildren().addAll(setOnActionListenerButton, addTextButton); - } - } +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.textinput; + +import javafx.event.ActionEvent; +import javafx.event.Event; +import javafx.event.EventHandler; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.TextField; +import static javafx.scene.control.test.textinput.TextControlApp.ADD_TEXT_BUTTON_ID; +import javafx.scene.layout.Pane; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class TextFieldPropertiesApp extends TextControlApp { + public final static String SET_ON_ACTION_BUTTON_ID = "SET_ON_ACTION_BUTTON_ID"; + public final static String ON_ACTION_COUNTER = "ON_ACTION_COUNTER"; + + public static void main(String[] args) { + Utils.launch(TextFieldPropertiesApp.class, args); + } + + @Override + protected Scene getScene() { + setTitle(); + return new TextFieldScene(); + } + + public class TextFieldScene extends TextInputScene { + + @Override + public void setNewControl() { + testedTextInput = new TextField(); + } + + @Override + protected void addControlDependentProperties() { + tb.addCounter(ON_ACTION_COUNTER); + } + + @Override + public void resetControl() { + TextField fresh = new TextField(); + TextField tested = (TextField) testedTextInput; + tested.setPrefWidth(fresh.getPrefWidth()); + tested.setPrefHeight(fresh.getPrefHeight()); + tested.setDisable(fresh.isDisable()); + tested.setEditable(fresh.isEditable()); + tested.setPrefColumnCount(fresh.getPrefColumnCount()); + tested.setText(fresh.getText()); + tested.setPromptText(fresh.getPromptText()); + tested.setFocusTraversable(fresh.isFocusTraversable()); + } + + @Override + public void addControlSpecificButtons(Pane pane) { + Button setOnActionListenerButton = new Button("Set on action listener"); + setOnActionListenerButton.setId(SET_ON_ACTION_BUTTON_ID); + setOnActionListenerButton.setOnAction(new EventHandler() { + + public void handle(Event t) { + ((TextField) testedTextInput).onActionProperty().setValue(new EventHandler() { + + public void handle(ActionEvent t) { + tb.incrementCounter(ON_ACTION_COUNTER); + } + }); + } + }); + + Button addTextButton = new Button("Add \"sometext\""); + addTextButton.setId(ADD_TEXT_BUTTON_ID); + addTextButton.setOnAction(new EventHandler() { + + public void handle(Event t) { + testedTextInput.setText(testedTextInput.getText() + "some\ntext"); + } + }); + + pane.getChildren().addAll(setOnActionListenerButton, addTextButton); + } + } } \ No newline at end of file --- old/functional/ControlsTests/src/javafx/scene/control/test/textinput/TextInputExternalWrap.java 2016-12-22 11:26:26.125047279 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/textinput/TextInputExternalWrap.java 2016-12-22 11:26:26.077046816 +0300 @@ -25,7 +25,6 @@ package javafx.scene.control.test.textinput; -import com.sun.javafx.scene.text.HitInfo; import javafx.scene.Node; import javafx.scene.control.TextInputControl; import javafx.scene.control.test.textinput.TextInputChanger.TextInputControlWrapInterface; --- old/functional/ControlsTests/src/javafx/scene/control/test/toolbar/NewToolbarApp.java 2016-12-22 11:26:26.333049285 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/toolbar/NewToolbarApp.java 2016-12-22 11:26:26.277048745 +0300 @@ -1,148 +1,152 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.Toolbar; - -import javafx.scene.control.test.utils.ptables.TabPaneWithControl; -import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.NodesChoserFactory; -import javafx.scene.control.test.utils.ptables.NodeControllerFactory; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.geometry.Insets; -import javafx.scene.Node; -import javafx.scene.Scene; -import javafx.scene.control.*; -import javafx.scene.control.test.utils.*; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Pane; -import javafx.scene.layout.VBox; -import javafx.scene.shape.Shape; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class NewToolbarApp extends InteroperabilityApp { - - public final static String TESTED_TOOLBAR_ID = "TESTED_TOOLBAR_ID"; - public final static String RESET_BUTTON_ID = "RESET_Toolbar_BUTTON_ID"; - public final String TOOLBAR_ADD_INDEX_TEXT_FIELD_ID = "TOOLBAR_ADD_INDEX_TEXT_FIELD_ID"; - - public static void main(String[] args) { - Utils.launch(NewToolbarApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "ToolbarTestApp"); - return new NewToolbarApp.ToolbarScene(); - } - - class ToolbarScene extends Scene { - - //VBox which contain tested ToolBar. - Pane pane; - //Toolbar to be tested. - ToolBar testedToolbar; - - public ToolbarScene() { - super(new HBox(), 800, 600); - - prepareScene(); - } - - private void prepareScene() { - pane = new Pane(); - testedToolbar = ToolBarBuilder.create().id(TESTED_TOOLBAR_ID).build(); - - PropertiesTable tb = new PropertiesTable(testedToolbar); - PropertyTablesFactory.explorePropertiesList(testedToolbar, tb); - - final TabPaneWithControl tabPane = new TabPaneWithControl("ToolBar", tb); - - final TextField tf = TextFieldBuilder.create().id(TOOLBAR_ADD_INDEX_TEXT_FIELD_ID).text("0").prefWidth(40).build(); - - HBox nodeshb = new NodesChoserFactory("Add!", new NodesChoserFactory.NodeAction() { - - @Override - public void execute(Node node) { - testedToolbar.getItems().add(Integer.parseInt(tf.getText()), node); - tabPane.addPropertiesTable(node.getClass().getSimpleName(), NodeControllerFactory.createFullController(node, tabPane)); - } - }, tf); - - pane.setMinSize(220, 220); - pane.setPrefSize(220, 220); - pane.setStyle("-fx-border-color : red;"); - pane.getChildren().add(testedToolbar); - - VBox vb = new VBox(); - vb.setSpacing(5); - - HBox hb = (HBox) getRoot(); - hb.setPadding(new Insets(5, 5, 5, 5)); - hb.setStyle("-fx-border-color : green;"); - - Button resetButton = ButtonBuilder.create().id(RESET_BUTTON_ID).text("Reset").build(); - resetButton.setOnAction(new EventHandler() { - - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareScene(); - } - }); - - final ToggleButton compactStateToggle = new ToggleButton("Compact"); - compactStateToggle.setSelected(true); - compactStateToggle.selectedProperty().addListener(new ChangeListener() { - - public void changed(ObservableValue ov, Boolean t, Boolean t1) { - if (t1) { - compactStateToggle.setText("Compact"); - pane.setMinSize(220, 220); - pane.setPrefSize(220, 220); - ToolbarScene.this.getWindow().setWidth(1200); - ToolbarScene.this.getWindow().setHeight(700); - } else { - compactStateToggle.setText("Free"); - pane.setMinSize(600, 600); - pane.setPrefSize(600, 600); - ToolbarScene.this.getWindow().setWidth(800); - ToolbarScene.this.getWindow().setHeight(600); - } - } - }); - - vb.getChildren().addAll(new Label("Pane with tested Toolbar"), pane, resetButton, compactStateToggle, nodeshb); - - hb.getChildren().addAll(vb, tabPane); - } - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.Toolbar; + +import javafx.scene.control.test.utils.ptables.TabPaneWithControl; +import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.NodesChoserFactory; +import javafx.scene.control.test.utils.ptables.NodeControllerFactory; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.geometry.Insets; +import javafx.scene.Node; +import javafx.scene.Scene; +import javafx.scene.control.*; +import javafx.scene.control.test.utils.*; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; +import javafx.scene.shape.Shape; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class NewToolbarApp extends InteroperabilityApp { + + public final static String TESTED_TOOLBAR_ID = "TESTED_TOOLBAR_ID"; + public final static String RESET_BUTTON_ID = "RESET_Toolbar_BUTTON_ID"; + public final String TOOLBAR_ADD_INDEX_TEXT_FIELD_ID = "TOOLBAR_ADD_INDEX_TEXT_FIELD_ID"; + + public static void main(String[] args) { + Utils.launch(NewToolbarApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "ToolbarTestApp"); + return new NewToolbarApp.ToolbarScene(); + } + + class ToolbarScene extends Scene { + + //VBox which contain tested ToolBar. + Pane pane; + //Toolbar to be tested. + ToolBar testedToolbar; + + public ToolbarScene() { + super(new HBox(), 800, 600); + + prepareScene(); + } + + private void prepareScene() { + pane = new Pane(); + testedToolbar = new ToolBar(); + testedToolbar.setId(TESTED_TOOLBAR_ID); + + PropertiesTable tb = new PropertiesTable(testedToolbar); + PropertyTablesFactory.explorePropertiesList(testedToolbar, tb); + + final TabPaneWithControl tabPane = new TabPaneWithControl("ToolBar", tb); + + final TextField tf = new TextField("0"); + tf.setId(TOOLBAR_ADD_INDEX_TEXT_FIELD_ID); + tf.setPrefWidth(40); + + HBox nodeshb = new NodesChoserFactory("Add!", new NodesChoserFactory.NodeAction() { + + @Override + public void execute(Node node) { + testedToolbar.getItems().add(Integer.parseInt(tf.getText()), node); + tabPane.addPropertiesTable(node.getClass().getSimpleName(), NodeControllerFactory.createFullController(node, tabPane)); + } + }, tf); + + pane.setMinSize(220, 220); + pane.setPrefSize(220, 220); + pane.setStyle("-fx-border-color : red;"); + pane.getChildren().add(testedToolbar); + + VBox vb = new VBox(); + vb.setSpacing(5); + + HBox hb = (HBox) getRoot(); + hb.setPadding(new Insets(5, 5, 5, 5)); + hb.setStyle("-fx-border-color : green;"); + + Button resetButton = new Button("Reset"); + resetButton.setId(RESET_BUTTON_ID); + resetButton.setOnAction(new EventHandler() { + + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareScene(); + } + }); + + final ToggleButton compactStateToggle = new ToggleButton("Compact"); + compactStateToggle.setSelected(true); + compactStateToggle.selectedProperty().addListener(new ChangeListener() { + + public void changed(ObservableValue ov, Boolean t, Boolean t1) { + if (t1) { + compactStateToggle.setText("Compact"); + pane.setMinSize(220, 220); + pane.setPrefSize(220, 220); + ToolbarScene.this.getWindow().setWidth(1200); + ToolbarScene.this.getWindow().setHeight(700); + } else { + compactStateToggle.setText("Free"); + pane.setMinSize(600, 600); + pane.setPrefSize(600, 600); + ToolbarScene.this.getWindow().setWidth(800); + ToolbarScene.this.getWindow().setHeight(600); + } + } + }); + + vb.getChildren().addAll(new Label("Pane with tested Toolbar"), pane, resetButton, compactStateToggle, nodeshb); + + hb.getChildren().addAll(vb, tabPane); + } + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/tooltip/NewTooltipApp.java 2016-12-22 11:26:26.529051177 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/tooltip/NewTooltipApp.java 2016-12-22 11:26:26.473050636 +0300 @@ -1,109 +1,111 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.Tooltip; - -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.geometry.Insets; -import javafx.scene.Scene; -import javafx.scene.control.*; -import javafx.scene.control.test.utils.CommonPropertiesScene; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Pane; -import javafx.scene.layout.VBox; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class NewTooltipApp extends InteroperabilityApp { - - public final static String TESTED_TOOLTIP_ID = "TESTED_TOOLTIP_ID"; - public final static String RESET_BUTTON_ID = "RESET_Tooltip_BUTTON_ID"; - - public static void main(String[] args) { - Utils.launch(NewTooltipApp.class, args); - } - - @Override - protected Scene getScene() { - Utils.setTitleToStage(stage, "TooltipTestApp"); - return new NewTooltipApp.TooltipScene(); - } - - class TooltipScene extends CommonPropertiesScene { - - //VBox which contain tested tooltip. - Pane pane; - PropertiesTable tb; - //Tooltip to be tested. - Tooltip testedTooltip; - - public TooltipScene() { - super("Tooltip", 800, 600); - - prepareScene(); - } - - @Override - final protected void prepareScene() { - pane = new Pane(); - testedTooltip = TooltipBuilder.create().id(TESTED_TOOLTIP_ID).build(); - - tb = new PropertiesTable(testedTooltip); - PropertyTablesFactory.explorePropertiesList(testedTooltip, tb); - - Button button = new Button("Tooltip attached."); - button.setTooltip(testedTooltip); - - pane.setMinSize(220, 220); - pane.setPrefSize(220, 220); - pane.setStyle("-fx-border-color : red;"); - pane.getChildren().add(button); - - VBox vb = new VBox(); - vb.setSpacing(5); - - HBox hb = (HBox) getRoot(); - hb.setPadding(new Insets(5, 5, 5, 5)); - hb.setStyle("-fx-border-color : green;"); - - Button resetButton = ButtonBuilder.create().id(RESET_BUTTON_ID).text("Reset").build(); - resetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareScene(); - } - }); - - setControllersContent(resetButton); - setPropertiesContent(tb); - } - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.Tooltip; + +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.*; +import javafx.scene.control.test.utils.CommonPropertiesScene; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class NewTooltipApp extends InteroperabilityApp { + + public final static String TESTED_TOOLTIP_ID = "TESTED_TOOLTIP_ID"; + public final static String RESET_BUTTON_ID = "RESET_Tooltip_BUTTON_ID"; + + public static void main(String[] args) { + Utils.launch(NewTooltipApp.class, args); + } + + @Override + protected Scene getScene() { + Utils.setTitleToStage(stage, "TooltipTestApp"); + return new NewTooltipApp.TooltipScene(); + } + + class TooltipScene extends CommonPropertiesScene { + + //VBox which contain tested tooltip. + Pane pane; + PropertiesTable tb; + //Tooltip to be tested. + Tooltip testedTooltip; + + public TooltipScene() { + super("Tooltip", 800, 600); + + prepareScene(); + } + + @Override + final protected void prepareScene() { + pane = new Pane(); + testedTooltip = new Tooltip(); + testedTooltip.setId(TESTED_TOOLTIP_ID); + + tb = new PropertiesTable(testedTooltip); + PropertyTablesFactory.explorePropertiesList(testedTooltip, tb); + + Button button = new Button("Tooltip attached."); + button.setTooltip(testedTooltip); + + pane.setMinSize(220, 220); + pane.setPrefSize(220, 220); + pane.setStyle("-fx-border-color : red;"); + pane.getChildren().add(button); + + VBox vb = new VBox(); + vb.setSpacing(5); + + HBox hb = (HBox) getRoot(); + hb.setPadding(new Insets(5, 5, 5, 5)); + hb.setStyle("-fx-border-color : green;"); + + Button resetButton = new Button("Reset"); + resetButton.setId(RESET_BUTTON_ID); + resetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareScene(); + } + }); + + setControllersContent(resetButton); + setPropertiesContent(tb); + } + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/treetable/TreeTableNewApp.java 2016-12-22 11:26:26.725053066 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/treetable/TreeTableNewApp.java 2016-12-22 11:26:26.669052526 +0300 @@ -24,10 +24,10 @@ */ package javafx.scene.control.test.treetable; -import com.sun.javafx.scene.control.skin.NestedTableColumnHeader; -import com.sun.javafx.scene.control.skin.TableColumnHeader; -import com.sun.javafx.scene.control.skin.TableHeaderRow; -import com.sun.javafx.scene.control.skin.TreeTableViewSkin; +import javafx.scene.control.skin.NestedTableColumnHeader; +import javafx.scene.control.skin.TableColumnHeader; +import javafx.scene.control.skin.TableHeaderRow; +import javafx.scene.control.skin.TreeTableViewSkin; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; @@ -54,6 +54,7 @@ import javafx.scene.control.cell.ComboBoxTreeTableCell; import javafx.scene.control.cell.TextFieldTreeTableCell; import javafx.scene.control.test.tableview.NewTableViewApp; +import static javafx.scene.control.test.treetable.ResetButtonNames.HARD_RESET_BUTTON_ID; import javafx.scene.control.test.treeview.TreeViewConstants; import javafx.scene.control.test.utils.CommonPropertiesScene; import javafx.scene.control.test.utils.ComponentsFactory.MultipleIndexFormComponent; @@ -193,7 +194,8 @@ hb.setPadding(new Insets(5, 5, 5, 5)); hb.setStyle("-fx-border-color : green;"); - Button resetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Reset").build(); + Button resetButton = new Button("Reset"); + resetButton.setId(HARD_RESET_BUTTON_ID); resetButton.setOnAction(new EventHandler() { public void handle(ActionEvent t) { HBox hb = (HBox) getRoot(); @@ -628,7 +630,7 @@ public String toString() { return "CUSTOM " + super.toString(); } - +/* @Override protected TableHeaderRow createTableHeaderRow() { return new TableHeaderRow(this) { @@ -651,6 +653,7 @@ } }; } +*/ }); } }); @@ -707,8 +710,11 @@ private HBox getScrollToHBox() { HBox hb = new HBox(); - Button button = ButtonBuilder.create().text("ScrollTo").id(SCROLL_TO_BUTTON_ID).build(); - final TextField tf = TextFieldBuilder.create().text("0").id(SCROLL_TO_TEXT_FIELD_ID).prefWidth(50).build(); + Button button = new Button("ScrollTo"); + button.setId(SCROLL_TO_BUTTON_ID); + final TextField tf = new TextField("0"); + tf.setId(SCROLL_TO_TEXT_FIELD_ID); + tf.setPrefWidth(50); button.setOnAction(new EventHandler() { public void handle(ActionEvent t) { @@ -722,8 +728,12 @@ private HBox getEditHBox() { HBox hb = new HBox(); - Button button = ButtonBuilder.create().text("Edit").id(EDIT_BUTTON_ID).build(); - final TextField tf = TextFieldBuilder.create().promptText("name").id(EDIT_TEXT_FIELD_ID).prefWidth(50).build(); + Button button = new Button("Edit"); + button.setId(EDIT_BUTTON_ID); + final TextField tf = new TextField(); + tf.setPromptText("name"); + tf.setId(EDIT_TEXT_FIELD_ID); + tf.setPrefWidth(50); button.setOnAction(new EventHandler() { public void handle(ActionEvent t) { @@ -739,11 +749,8 @@ private VBox setEventHandlersHBox() { VBox vb = new VBox(); - Button btn = ButtonBuilder.create() - .text("Set onEdit event hadlers") - .id(BTN_SET_ON_EDIT_EVENT_HANDLERS) - .build(); - + Button btn = new Button("Set onEdit event hadlers"); + btn.setId(BTN_SET_ON_EDIT_EVENT_HANDLERS); btn.setOnAction(new EventHandler() { final EventHandler eventHandlerOnEditStart = new EventHandler() { public void handle(Event t) { @@ -780,11 +787,8 @@ } }); - Button btnAddFactory = ButtonBuilder.create() - .text("Set cell factory for editing") - .id(SET_CELL_FACTORY_FOR_EDITING) - .build(); - + Button btnAddFactory = new Button("Set cell factory for editing"); + btnAddFactory.setId(SET_CELL_FACTORY_FOR_EDITING); btnAddFactory.setOnAction(new EventHandler() { public void handle(ActionEvent t) { for (Object obj : testedControl.getColumns()) { --- old/functional/ControlsTests/src/javafx/scene/control/test/treeview/TreeViewNewApp.java 2016-12-22 11:26:26.929055034 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/treeview/TreeViewNewApp.java 2016-12-22 11:26:26.873054494 +0300 @@ -1,555 +1,560 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.treeview; - -import java.util.ArrayList; -import static javafx.commons.Consts.BTN_SET_ON_EDIT_EVENT_HANDLERS; -import javafx.event.ActionEvent; -import javafx.event.Event; -import javafx.event.EventHandler; -import javafx.geometry.Orientation; -import javafx.scene.Scene; -import javafx.scene.control.*; -import javafx.scene.control.test.treetable.ResetButtonNames; -import static javafx.scene.control.test.treeview.TreeViewConstants.ROOT_NAME; -import javafx.scene.control.test.utils.CommonPropertiesScene; -import javafx.scene.control.test.utils.ptables.NodeControllerFactory; -import javafx.scene.control.test.utils.ptables.NodeControllerFactory.NodesStorage; -import javafx.scene.control.test.utils.ptables.PropertiesTable; -import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; -import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider; -import javafx.scene.control.test.utils.ptables.TabPaneWithControl; -import javafx.scene.input.KeyCode; -import javafx.scene.input.KeyEvent; -import javafx.scene.layout.HBox; -import javafx.scene.layout.VBox; -import javafx.util.Callback; -import test.javaclient.shared.InteroperabilityApp; -import test.javaclient.shared.Utils; - -/** - * @author Alexander Kirov - */ -public class TreeViewNewApp extends InteroperabilityApp implements TreeViewConstants, ResetButtonNames { - - public final static String TESTED_TREEVIEW_ID = "TESTED_TREEVIEW_ID"; - public final static String POPULATE_TREE = "POPULATE_TREE"; - public final static String TREE_VIEW_TAB_NAME = "TreeView"; - - public static void main(String[] args) { - Utils.launch(TreeViewNewApp.class, args); - } - - @Override - protected Scene getScene() { - Scene scene = new TreeViewScene(); - Utils.addBrowser(scene); - Utils.setTitleToStage(stage, "TreeViewTestApp"); - return scene; - } - - public static TreeItem searchTreeItem(TreeView treeView, String content) { - if (treeView.getRoot() != null) { - return recursiveSearch(content, treeView.getRoot()); - } - return null; - } - - protected static TreeItem recursiveSearch(String content, TreeItem itemToStart) { - if (content.equals(itemToStart.getValue())) { - return itemToStart; - } else { - for (TreeItem child : itemToStart.getChildren()) { - TreeItem recResult = recursiveSearch(content, child); - if (recResult != null) { - return recResult; - } - } - return null; - } - } - - protected class TreeViewScene extends CommonPropertiesScene { - - TreeView testedControl; - //TabPane with PropertiesTable. - TabPaneWithControl tabPane; - PropertiesTable tb; - //This list contains all properties tables, which were created during testing. - ArrayList allPropertiesTables; - - public TreeViewScene() { - super("TreeView", 800, 600); - prepareScene(); - } - - protected TreeView getNewTestedControl() { - TreeView tv = new TreeView(new TreeItem(ROOT_NAME)); - tv.setId(TESTED_TREEVIEW_ID); - return tv; - } - - @Override - final protected void prepareScene() { - testedControl = getNewTestedControl(); - tb = new PropertiesTable(testedControl); - - allPropertiesTables = new ArrayList(); - allPropertiesTables.add(tb); - - PropertyTablesFactory.explorePropertiesList(testedControl, tb); - PropertyTablesFactory.explorePropertiesList(testedControl.getSelectionModel(), tb); - PropertyTablesFactory.explorePropertiesList(testedControl.getFocusModel(), tb); - SpecialTablePropertiesProvider.provideForControl(testedControl, tb); - - tb.addCounter(EDIT_START_COUNTER); - tb.addCounter(EDIT_COMMIT_COUNTER); - tb.addCounter(EDIT_CANCEL_COUNTER); - - tabPane = new TabPaneWithControl("TreeView", tb); - getControlOverItem(ROOT_NAME); - - Button hardResetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Hard reset").build(); - hardResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - HBox hb = (HBox) getRoot(); - hb.getChildren().clear(); - prepareMainSceneStructure(); - prepareScene(); - } - }); - - Button softResetButton = ButtonBuilder.create().id(SOFT_RESET_BUTTON_ID).text("Soft reset").build(); - softResetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - refreshProcedure(2); - testedControl.getRoot().setValue(ROOT_NAME); - TreeItem someNewOneTreeItem = new TreeItem(); - testedControl.getRoot().setExpanded(someNewOneTreeItem.isExpanded()); - testedControl.getRoot().setGraphic(someNewOneTreeItem.getGraphic()); - - TreeView someNewOneTreeView = new TreeView(); - testedControl.setDisable(someNewOneTreeView.isDisabled()); - testedControl.setEditable(someNewOneTreeView.isEditable()); - testedControl.setShowRoot(someNewOneTreeView.isShowRoot()); - testedControl.getSelectionModel().setSelectionMode(someNewOneTreeView.getSelectionModel().getSelectionMode()); - testedControl.setMinHeight(someNewOneTreeView.getMinHeight()); - testedControl.setMinWidth(someNewOneTreeView.getMinWidth()); - testedControl.setPrefHeight(someNewOneTreeView.getPrefHeight()); - testedControl.setPrefWidth(someNewOneTreeView.getPrefWidth()); - } - }); - - Button populate = new Button("Populate"); - populate.setId(POPULATE_TREE); - populate.setOnAction(new EventHandler() { - - public void handle(ActionEvent t) { - TreeItem root = new TreeItem("ROOT"); - root.setExpanded(true); - for (int i = 0; i < 4; i++) { - TreeItem parent = new TreeItem("item-" + String.valueOf(i)); - parent.setExpanded(true); - root.getChildren().add(parent); - for (int j = 0; j < 4; j++) { - TreeItem child = new TreeItem("item-" + String.valueOf(i) + "-" + String.valueOf(j)); - parent.getChildren().add(child); - } - } - testedControl.setRoot(root); - } - }); - - HBox hboxWithResetButtons = new HBox(); - hboxWithResetButtons.getChildren().addAll(hardResetButton, softResetButton, populate); - - Button autosize = new Button("Autosize"); - autosize.setId(AUTOSIZE_BUTTON_ID); - autosize.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - testedControl.autosize(); - } - }); - - VBox vb = new VBox(); - vb.setSpacing(5); - //Different action makers. - vb.getChildren().addAll(hboxWithResetButtons, autosize, new Separator(Orientation.HORIZONTAL), - getTreeViewAddItemController(), new Separator(Orientation.HORIZONTAL), - getTreeViewRemoveItemController(), new Separator(Orientation.HORIZONTAL), - getTabOverItemThroughGetItemMethodController(), new Separator(Orientation.HORIZONTAL), - getTabOverItemController(), new Separator(Orientation.HORIZONTAL), - getObjectTitleThroughGetItemMethodController(), new Separator(Orientation.HORIZONTAL), - getLineOfItemController(), new Separator(Orientation.HORIZONTAL), - getScrollToHBox(), new Separator(Orientation.HORIZONTAL), - getEditHBox(), new Separator(Orientation.HORIZONTAL), - setEventHandlersHBox()); - - setTestedControl(testedControl); - setPropertiesContent(tabPane); - setControllersContent(vb); - } - - /* - * In this function TabPane with control will be refreshed, and all - * properties table will be refreshed and cleared. - */ - private void refreshProcedure(int exceptFirstPropertiesTable) { - for (int i = allPropertiesTables.size() - 1; i >= 0; i--) { - allPropertiesTables.get(i).refresh(); - if (i >= exceptFirstPropertiesTable) { - allPropertiesTables.remove(i); - } - } - - tabPane.removePropertiesTablesExceptFirstOnes(exceptFirstPropertiesTable); - - testedControl.getRoot().getChildren().clear(); - } - - protected void getControlOverItem(String name) { - TreeItem treeItem = searchTreeItem(name); - NodesStorage node = NodeControllerFactory.createFullController(treeItem, tabPane); - allPropertiesTables.add(node.pt); - tabPane.addPropertiesTable(name, node); - } - - protected VBox getTreeViewAddItemController() { - VBox vb = new VBox(3); - - final TextField tfParentName = new TextField(); - tfParentName.setId(ADD_ITEM_PARENT_TEXT_FIELD_ID); - tfParentName.setPromptText("parent name"); - - final TextField tfName = new TextField(); - tfName.setId(ADD_ITEM_TEXT_FIELD_ID); - tfName.setPromptText("new item name"); - - final TextField tfPosition = new TextField(); - tfPosition.setId(ADD_ITEM_POSITION_TEXT_FIELD_ID);; - tfPosition.setPromptText("position"); - tfPosition.setPrefWidth(50); - - Button button = new Button("add to pos"); - button.setId(ADD_ITEM_BUTTON_ID); - button.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - TreeItem treeItem = searchTreeItem(tfParentName.getText()); - treeItem.getChildren().add(Integer.parseInt(tfPosition.getText()), new TreeItem(tfName.getText())); - } - }); - - HBox hb1 = new HBox(3); - hb1.getChildren().addAll(new Label("Add child to "), tfParentName); - - HBox hb2 = new HBox(3); - hb2.getChildren().addAll(new Label(" named "), tfName); - - HBox hb3 = new HBox(3); - hb3.getChildren().addAll(tfPosition, button); - - vb.getChildren().addAll(hb1, hb2, hb3); - - return vb; - } - - protected VBox getTreeViewRemoveItemController() { - VBox vb = new VBox(3); - - final TextField tfName = new TextField(); - tfName.setId(REMOVE_ITEM_TEXT_FIELD_ID); - tfName.setPromptText("new item name"); - - Button button = new Button("remove!"); - button.setId(REMOVE_ITEM_BUTTON_ID); - button.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - TreeItem treeItem = searchTreeItem(tfName.getText()); - treeItem.getParent().getChildren().remove(treeItem); - } - }); - - HBox hb1 = new HBox(3); - hb1.getChildren().addAll(new Label("Named item"), tfName); - - HBox hb2 = new HBox(3); - hb2.getChildren().addAll(button); - - vb.getChildren().addAll(hb1, hb2); - - return vb; - } - - protected VBox getTabOverItemController() { - final TextField tfParentName = new TextField(); - tfParentName.setId(GET_CONTROL_OVER_TREEITEM_TEXTFIELD_ID); - tfParentName.setPromptText("item name"); - - Button button = new Button("get table over"); - button.setId(GET_CONTROL_OVER_TREEITEM_BUTTON_ID); - button.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - getControlOverItem(tfParentName.getText()); - } - }); - - HBox hb1 = new HBox(3); - hb1.getChildren().addAll(tfParentName, button); - - VBox vb = new VBox(); - vb.getChildren().addAll(hb1); - return vb; - } - - protected VBox getObjectTitleThroughGetItemMethodController() { - final TextField tfParentName = new TextField(); - tfParentName.setPromptText("index"); - tfParentName.setPrefWidth(50); - - final TextField content = new TextField(); - content.setPromptText("content"); - - Button button = new Button("getTreeItem! index:"); - button.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - TreeItem item = testedControl.getTreeItem(Integer.parseInt(tfParentName.getText())); - if (item == null) { - content.setText("null"); - } else { - content.setText(item.getValue().toString()); - } - } - }); - - HBox hb1 = new HBox(3); - hb1.getChildren().addAll(new Label("Get tree item at"), tfParentName); - - HBox hb2 = new HBox(3); - hb2.getChildren().addAll(button, content); - - VBox vb = new VBox(); - vb.getChildren().addAll(hb1, hb2); - return vb; - } - - protected VBox getTabOverItemThroughGetItemMethodController() { - final TextField tfParentName = new TextField(); - tfParentName.setPromptText("index"); - tfParentName.setPrefWidth(50); - - Button button = new Button("get table over"); - button.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - getControlOverItem(testedControl.getTreeItem(Integer.parseInt(tfParentName.getText())).getValue().toString()); - } - }); - - HBox hb1 = new HBox(3); - hb1.getChildren().addAll(tfParentName, button); - - VBox vb = new VBox(); - vb.getChildren().addAll(hb1); - return vb; - } - - protected VBox getLineOfItemController() { - final TextField tfParentName = new TextField(); - tfParentName.setPromptText("name"); - - final TextField index = new TextField(); - index.setPromptText("found index"); - index.setPrefWidth(50); - - Button button = new Button("getRow! index :"); - button.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - int found = testedControl.getRow(searchTreeItem(tfParentName.getText())); - index.setText(((Integer) found).toString()); - } - }); - - HBox hb1 = new HBox(3); - hb1.getChildren().addAll(new Label("Get index of"), tfParentName); - - HBox hb2 = new HBox(3); - hb2.getChildren().addAll(index, button); - - VBox vb = new VBox(); - vb.getChildren().addAll(hb1, hb2); - return vb; - } - - private HBox getScrollToHBox() { - HBox hb = new HBox(); - Button button = ButtonBuilder.create().text("ScrollTo").id(SCROLL_TO_BUTTON_ID).build(); - final TextField tf = TextFieldBuilder.create().text("0").id(SCROLL_TO_TEXT_FIELD_ID).prefWidth(50).build(); - - button.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - testedControl.scrollTo(Integer.parseInt(tf.getText())); - } - }); - - hb.getChildren().addAll(tf, button); - return hb; - } - - private HBox getEditHBox() { - HBox hb = new HBox(); - Button button = ButtonBuilder.create().text("Edit").id(EDIT_BUTTON_ID).build(); - final TextField tf = TextFieldBuilder.create().promptText("name").id(EDIT_TEXT_FIELD_ID).prefWidth(50).build(); - - button.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - testedControl.edit(searchTreeItem(tf.getText())); - } - }); - - hb.getChildren().addAll(tf, button); - return hb; - } - - private VBox setEventHandlersHBox() { - VBox vb = new VBox(); - - Button btn = ButtonBuilder.create() - .text("Set onEdit event hadlers") - .id(BTN_SET_ON_EDIT_EVENT_HANDLERS) - .build(); - - btn.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - testedControl.setOnEditStart(new EventHandler() { - public void handle(Event t) { - tb.incrementCounter(EDIT_START_COUNTER); - } - }); - - testedControl.setOnEditCommit(new EventHandler() { - public void handle(Event t) { - tb.incrementCounter(EDIT_COMMIT_COUNTER); - } - }); - - testedControl.setOnEditCancel(new EventHandler() { - public void handle(Event t) { - tb.incrementCounter(EDIT_CANCEL_COUNTER); - } - }); - } - }); - - Button btnAddFactory = ButtonBuilder.create() - .text("Set cell factory for editing") - .id(SET_CELL_FACTORY_FOR_EDITING) - .build(); - - btnAddFactory.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - testedControl.setCellFactory(new Callback, TreeCell>() { - @Override - public TreeCell call(TreeView p) { - return new TextFieldTreeCellImpl(); - } - }); - } - }); - - vb.getChildren().addAll(btn, btnAddFactory); - return vb; - } - - private TreeItem searchTreeItem(String content) { - return TreeViewNewApp.searchTreeItem(testedControl, content); - } - - private final class TextFieldTreeCellImpl extends TreeCell { - - private TextField textField; - - public TextFieldTreeCellImpl() { - } - - @Override - public void startEdit() { - super.startEdit(); - - if (textField == null) { - createTextField(); - } - setText(null); - setGraphic(textField); - textField.setText(getString()); - textField.requestFocus(); - } - - @Override - public void cancelEdit() { - super.cancelEdit(); - setText((String) getItem()); - setGraphic(getTreeItem().getGraphic()); - } - - @Override - public void updateItem(String item, boolean empty) { - super.updateItem(item, empty); - - if (empty) { - setText(null); - setGraphic(null); - } else { - if (isEditing()) { - if (textField != null) { - textField.setText(getString()); - } - setText(null); - setGraphic(textField); - } else { - setText(getString()); - setGraphic(getTreeItem().getGraphic()); - } - } - } - - private void createTextField() { - textField = new TextField(getString()); - textField.setOnKeyReleased(new EventHandler() { - @Override - public void handle(KeyEvent t) { - if (t.getCode() == KeyCode.ENTER) { - commitEdit(textField.getText()); - } else if (t.getCode() == KeyCode.ESCAPE) { - cancelEdit(); - } - } - }); - } - - private String getString() { - return getItem() == null ? "" : getItem().toString(); - } - } - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.treeview; + +import java.util.ArrayList; +import static javafx.commons.Consts.BTN_SET_ON_EDIT_EVENT_HANDLERS; +import javafx.event.ActionEvent; +import javafx.event.Event; +import javafx.event.EventHandler; +import javafx.geometry.Orientation; +import javafx.scene.Scene; +import javafx.scene.control.*; +import javafx.scene.control.test.treetable.ResetButtonNames; +import static javafx.scene.control.test.treetable.ResetButtonNames.HARD_RESET_BUTTON_ID; +import static javafx.scene.control.test.treetable.ResetButtonNames.SOFT_RESET_BUTTON_ID; +import static javafx.scene.control.test.treeview.TreeViewConstants.ROOT_NAME; +import javafx.scene.control.test.utils.CommonPropertiesScene; +import javafx.scene.control.test.utils.ptables.NodeControllerFactory; +import javafx.scene.control.test.utils.ptables.NodeControllerFactory.NodesStorage; +import javafx.scene.control.test.utils.ptables.PropertiesTable; +import javafx.scene.control.test.utils.ptables.PropertyTablesFactory; +import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider; +import javafx.scene.control.test.utils.ptables.TabPaneWithControl; +import javafx.scene.input.KeyCode; +import javafx.scene.input.KeyEvent; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import javafx.util.Callback; +import test.javaclient.shared.InteroperabilityApp; +import test.javaclient.shared.Utils; + +/** + * @author Alexander Kirov + */ +public class TreeViewNewApp extends InteroperabilityApp implements TreeViewConstants, ResetButtonNames { + + public final static String TESTED_TREEVIEW_ID = "TESTED_TREEVIEW_ID"; + public final static String POPULATE_TREE = "POPULATE_TREE"; + public final static String TREE_VIEW_TAB_NAME = "TreeView"; + + public static void main(String[] args) { + Utils.launch(TreeViewNewApp.class, args); + } + + @Override + protected Scene getScene() { + Scene scene = new TreeViewScene(); + Utils.addBrowser(scene); + Utils.setTitleToStage(stage, "TreeViewTestApp"); + return scene; + } + + public static TreeItem searchTreeItem(TreeView treeView, String content) { + if (treeView.getRoot() != null) { + return recursiveSearch(content, treeView.getRoot()); + } + return null; + } + + protected static TreeItem recursiveSearch(String content, TreeItem itemToStart) { + if (content.equals(itemToStart.getValue())) { + return itemToStart; + } else { + for (TreeItem child : itemToStart.getChildren()) { + TreeItem recResult = recursiveSearch(content, child); + if (recResult != null) { + return recResult; + } + } + return null; + } + } + + protected class TreeViewScene extends CommonPropertiesScene { + + TreeView testedControl; + //TabPane with PropertiesTable. + TabPaneWithControl tabPane; + PropertiesTable tb; + //This list contains all properties tables, which were created during testing. + ArrayList allPropertiesTables; + + public TreeViewScene() { + super("TreeView", 800, 600); + prepareScene(); + } + + protected TreeView getNewTestedControl() { + TreeView tv = new TreeView(new TreeItem(ROOT_NAME)); + tv.setId(TESTED_TREEVIEW_ID); + return tv; + } + + @Override + final protected void prepareScene() { + testedControl = getNewTestedControl(); + tb = new PropertiesTable(testedControl); + + allPropertiesTables = new ArrayList(); + allPropertiesTables.add(tb); + + PropertyTablesFactory.explorePropertiesList(testedControl, tb); + PropertyTablesFactory.explorePropertiesList(testedControl.getSelectionModel(), tb); + PropertyTablesFactory.explorePropertiesList(testedControl.getFocusModel(), tb); + SpecialTablePropertiesProvider.provideForControl(testedControl, tb); + + tb.addCounter(EDIT_START_COUNTER); + tb.addCounter(EDIT_COMMIT_COUNTER); + tb.addCounter(EDIT_CANCEL_COUNTER); + + tabPane = new TabPaneWithControl("TreeView", tb); + getControlOverItem(ROOT_NAME); + + Button hardResetButton = new Button("Hard reset"); + hardResetButton.setId(HARD_RESET_BUTTON_ID); + hardResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + HBox hb = (HBox) getRoot(); + hb.getChildren().clear(); + prepareMainSceneStructure(); + prepareScene(); + } + }); + + Button softResetButton = new Button("Soft reset"); + softResetButton.setId(SOFT_RESET_BUTTON_ID); + softResetButton.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + refreshProcedure(2); + testedControl.getRoot().setValue(ROOT_NAME); + TreeItem someNewOneTreeItem = new TreeItem(); + testedControl.getRoot().setExpanded(someNewOneTreeItem.isExpanded()); + testedControl.getRoot().setGraphic(someNewOneTreeItem.getGraphic()); + + TreeView someNewOneTreeView = new TreeView(); + testedControl.setDisable(someNewOneTreeView.isDisabled()); + testedControl.setEditable(someNewOneTreeView.isEditable()); + testedControl.setShowRoot(someNewOneTreeView.isShowRoot()); + testedControl.getSelectionModel().setSelectionMode(someNewOneTreeView.getSelectionModel().getSelectionMode()); + testedControl.setMinHeight(someNewOneTreeView.getMinHeight()); + testedControl.setMinWidth(someNewOneTreeView.getMinWidth()); + testedControl.setPrefHeight(someNewOneTreeView.getPrefHeight()); + testedControl.setPrefWidth(someNewOneTreeView.getPrefWidth()); + } + }); + + Button populate = new Button("Populate"); + populate.setId(POPULATE_TREE); + populate.setOnAction(new EventHandler() { + + public void handle(ActionEvent t) { + TreeItem root = new TreeItem("ROOT"); + root.setExpanded(true); + for (int i = 0; i < 4; i++) { + TreeItem parent = new TreeItem("item-" + String.valueOf(i)); + parent.setExpanded(true); + root.getChildren().add(parent); + for (int j = 0; j < 4; j++) { + TreeItem child = new TreeItem("item-" + String.valueOf(i) + "-" + String.valueOf(j)); + parent.getChildren().add(child); + } + } + testedControl.setRoot(root); + } + }); + + HBox hboxWithResetButtons = new HBox(); + hboxWithResetButtons.getChildren().addAll(hardResetButton, softResetButton, populate); + + Button autosize = new Button("Autosize"); + autosize.setId(AUTOSIZE_BUTTON_ID); + autosize.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + testedControl.autosize(); + } + }); + + VBox vb = new VBox(); + vb.setSpacing(5); + //Different action makers. + vb.getChildren().addAll(hboxWithResetButtons, autosize, new Separator(Orientation.HORIZONTAL), + getTreeViewAddItemController(), new Separator(Orientation.HORIZONTAL), + getTreeViewRemoveItemController(), new Separator(Orientation.HORIZONTAL), + getTabOverItemThroughGetItemMethodController(), new Separator(Orientation.HORIZONTAL), + getTabOverItemController(), new Separator(Orientation.HORIZONTAL), + getObjectTitleThroughGetItemMethodController(), new Separator(Orientation.HORIZONTAL), + getLineOfItemController(), new Separator(Orientation.HORIZONTAL), + getScrollToHBox(), new Separator(Orientation.HORIZONTAL), + getEditHBox(), new Separator(Orientation.HORIZONTAL), + setEventHandlersHBox()); + + setTestedControl(testedControl); + setPropertiesContent(tabPane); + setControllersContent(vb); + } + + /* + * In this function TabPane with control will be refreshed, and all + * properties table will be refreshed and cleared. + */ + private void refreshProcedure(int exceptFirstPropertiesTable) { + for (int i = allPropertiesTables.size() - 1; i >= 0; i--) { + allPropertiesTables.get(i).refresh(); + if (i >= exceptFirstPropertiesTable) { + allPropertiesTables.remove(i); + } + } + + tabPane.removePropertiesTablesExceptFirstOnes(exceptFirstPropertiesTable); + + testedControl.getRoot().getChildren().clear(); + } + + protected void getControlOverItem(String name) { + TreeItem treeItem = searchTreeItem(name); + NodesStorage node = NodeControllerFactory.createFullController(treeItem, tabPane); + allPropertiesTables.add(node.pt); + tabPane.addPropertiesTable(name, node); + } + + protected VBox getTreeViewAddItemController() { + VBox vb = new VBox(3); + + final TextField tfParentName = new TextField(); + tfParentName.setId(ADD_ITEM_PARENT_TEXT_FIELD_ID); + tfParentName.setPromptText("parent name"); + + final TextField tfName = new TextField(); + tfName.setId(ADD_ITEM_TEXT_FIELD_ID); + tfName.setPromptText("new item name"); + + final TextField tfPosition = new TextField(); + tfPosition.setId(ADD_ITEM_POSITION_TEXT_FIELD_ID);; + tfPosition.setPromptText("position"); + tfPosition.setPrefWidth(50); + + Button button = new Button("add to pos"); + button.setId(ADD_ITEM_BUTTON_ID); + button.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + TreeItem treeItem = searchTreeItem(tfParentName.getText()); + treeItem.getChildren().add(Integer.parseInt(tfPosition.getText()), new TreeItem(tfName.getText())); + } + }); + + HBox hb1 = new HBox(3); + hb1.getChildren().addAll(new Label("Add child to "), tfParentName); + + HBox hb2 = new HBox(3); + hb2.getChildren().addAll(new Label(" named "), tfName); + + HBox hb3 = new HBox(3); + hb3.getChildren().addAll(tfPosition, button); + + vb.getChildren().addAll(hb1, hb2, hb3); + + return vb; + } + + protected VBox getTreeViewRemoveItemController() { + VBox vb = new VBox(3); + + final TextField tfName = new TextField(); + tfName.setId(REMOVE_ITEM_TEXT_FIELD_ID); + tfName.setPromptText("new item name"); + + Button button = new Button("remove!"); + button.setId(REMOVE_ITEM_BUTTON_ID); + button.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + TreeItem treeItem = searchTreeItem(tfName.getText()); + treeItem.getParent().getChildren().remove(treeItem); + } + }); + + HBox hb1 = new HBox(3); + hb1.getChildren().addAll(new Label("Named item"), tfName); + + HBox hb2 = new HBox(3); + hb2.getChildren().addAll(button); + + vb.getChildren().addAll(hb1, hb2); + + return vb; + } + + protected VBox getTabOverItemController() { + final TextField tfParentName = new TextField(); + tfParentName.setId(GET_CONTROL_OVER_TREEITEM_TEXTFIELD_ID); + tfParentName.setPromptText("item name"); + + Button button = new Button("get table over"); + button.setId(GET_CONTROL_OVER_TREEITEM_BUTTON_ID); + button.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + getControlOverItem(tfParentName.getText()); + } + }); + + HBox hb1 = new HBox(3); + hb1.getChildren().addAll(tfParentName, button); + + VBox vb = new VBox(); + vb.getChildren().addAll(hb1); + return vb; + } + + protected VBox getObjectTitleThroughGetItemMethodController() { + final TextField tfParentName = new TextField(); + tfParentName.setPromptText("index"); + tfParentName.setPrefWidth(50); + + final TextField content = new TextField(); + content.setPromptText("content"); + + Button button = new Button("getTreeItem! index:"); + button.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + TreeItem item = testedControl.getTreeItem(Integer.parseInt(tfParentName.getText())); + if (item == null) { + content.setText("null"); + } else { + content.setText(item.getValue().toString()); + } + } + }); + + HBox hb1 = new HBox(3); + hb1.getChildren().addAll(new Label("Get tree item at"), tfParentName); + + HBox hb2 = new HBox(3); + hb2.getChildren().addAll(button, content); + + VBox vb = new VBox(); + vb.getChildren().addAll(hb1, hb2); + return vb; + } + + protected VBox getTabOverItemThroughGetItemMethodController() { + final TextField tfParentName = new TextField(); + tfParentName.setPromptText("index"); + tfParentName.setPrefWidth(50); + + Button button = new Button("get table over"); + button.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + getControlOverItem(testedControl.getTreeItem(Integer.parseInt(tfParentName.getText())).getValue().toString()); + } + }); + + HBox hb1 = new HBox(3); + hb1.getChildren().addAll(tfParentName, button); + + VBox vb = new VBox(); + vb.getChildren().addAll(hb1); + return vb; + } + + protected VBox getLineOfItemController() { + final TextField tfParentName = new TextField(); + tfParentName.setPromptText("name"); + + final TextField index = new TextField(); + index.setPromptText("found index"); + index.setPrefWidth(50); + + Button button = new Button("getRow! index :"); + button.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + int found = testedControl.getRow(searchTreeItem(tfParentName.getText())); + index.setText(((Integer) found).toString()); + } + }); + + HBox hb1 = new HBox(3); + hb1.getChildren().addAll(new Label("Get index of"), tfParentName); + + HBox hb2 = new HBox(3); + hb2.getChildren().addAll(index, button); + + VBox vb = new VBox(); + vb.getChildren().addAll(hb1, hb2); + return vb; + } + + private HBox getScrollToHBox() { + HBox hb = new HBox(); + Button button = new Button("ScrollTo"); + button.setId(SCROLL_TO_BUTTON_ID); + final TextField tf = new TextField("0"); + tf.setId(SCROLL_TO_TEXT_FIELD_ID); + tf.setPrefWidth(50); + + button.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + testedControl.scrollTo(Integer.parseInt(tf.getText())); + } + }); + + hb.getChildren().addAll(tf, button); + return hb; + } + + private HBox getEditHBox() { + HBox hb = new HBox(); + Button button = new Button("Edit"); + button.setId(EDIT_BUTTON_ID); + final TextField tf = new TextField(); + tf.setPromptText("name"); + tf.setId(EDIT_TEXT_FIELD_ID); + tf.setPrefWidth(50); + + button.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + testedControl.edit(searchTreeItem(tf.getText())); + } + }); + + hb.getChildren().addAll(tf, button); + return hb; + } + + private VBox setEventHandlersHBox() { + VBox vb = new VBox(); + + Button btn = new Button("Set onEdit event hadlers"); + btn.setId(BTN_SET_ON_EDIT_EVENT_HANDLERS); + btn.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + testedControl.setOnEditStart(new EventHandler() { + public void handle(Event t) { + tb.incrementCounter(EDIT_START_COUNTER); + } + }); + + testedControl.setOnEditCommit(new EventHandler() { + public void handle(Event t) { + tb.incrementCounter(EDIT_COMMIT_COUNTER); + } + }); + + testedControl.setOnEditCancel(new EventHandler() { + public void handle(Event t) { + tb.incrementCounter(EDIT_CANCEL_COUNTER); + } + }); + } + }); + + Button btnAddFactory = new Button("Set cell factory for editing"); + btnAddFactory.setId(SET_CELL_FACTORY_FOR_EDITING); + btnAddFactory.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + testedControl.setCellFactory(new Callback, TreeCell>() { + @Override + public TreeCell call(TreeView p) { + return new TextFieldTreeCellImpl(); + } + }); + } + }); + + vb.getChildren().addAll(btn, btnAddFactory); + return vb; + } + + private TreeItem searchTreeItem(String content) { + return TreeViewNewApp.searchTreeItem(testedControl, content); + } + + private final class TextFieldTreeCellImpl extends TreeCell { + + private TextField textField; + + public TextFieldTreeCellImpl() { + } + + @Override + public void startEdit() { + super.startEdit(); + + if (textField == null) { + createTextField(); + } + setText(null); + setGraphic(textField); + textField.setText(getString()); + textField.requestFocus(); + } + + @Override + public void cancelEdit() { + super.cancelEdit(); + setText((String) getItem()); + setGraphic(getTreeItem().getGraphic()); + } + + @Override + public void updateItem(String item, boolean empty) { + super.updateItem(item, empty); + + if (empty) { + setText(null); + setGraphic(null); + } else { + if (isEditing()) { + if (textField != null) { + textField.setText(getString()); + } + setText(null); + setGraphic(textField); + } else { + setText(getString()); + setGraphic(getTreeItem().getGraphic()); + } + } + } + + private void createTextField() { + textField = new TextField(getString()); + textField.setOnKeyReleased(new EventHandler() { + @Override + public void handle(KeyEvent t) { + if (t.getCode() == KeyCode.ENTER) { + commitEdit(textField.getText()); + } else if (t.getCode() == KeyCode.ESCAPE) { + cancelEdit(); + } + } + }); + } + + private String getString() { + return getItem() == null ? "" : getItem().toString(); + } + } + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/utils/ColorHelper.java 2016-12-22 11:26:27.133057002 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/utils/ColorHelper.java 2016-12-22 11:26:27.081056501 +0300 @@ -1,112 +1,114 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.utils; - -import javafx.application.Application; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.scene.Scene; -import javafx.scene.control.Button; -import javafx.scene.control.TextArea; -import javafx.scene.control.TextAreaBuilder; -import javafx.scene.control.TextField; -import javafx.scene.control.TextFieldBuilder; -import javafx.scene.layout.VBox; -import javafx.scene.paint.Color; -import javafx.stage.Stage; -import javafx.stage.StageStyle; -import org.jemmy.action.GetAction; -import org.jemmy.fx.Root; - -/** - * @author Alexander Kirov - * - * This helper helps to determine, what say awt and glass robots about color at - * some coordinate. Enter coordinates. X and Y of stage will be set at that - * position, and you can see the result of robot calls. - */ -public class ColorHelper extends Application { - - public static void main(String[] args) { - launch(args); - } - - @Override - public void start(final Stage stage) throws Exception { - final TextField xField = TextFieldBuilder.create().promptText("x").build(); - final TextField yField = TextFieldBuilder.create().promptText("y").build(); - - final TextArea awtField = TextAreaBuilder.create().promptText("awt").build(); - final TextArea glassField = TextAreaBuilder.create().promptText("glass").build(); - - Button act = new Button("Get colors"); - act.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - try { - int x = Integer.parseInt(xField.getText()); - int y = Integer.parseInt(yField.getText()); - - stage.setX(x + 1); - stage.setY(y + 1); - - java.awt.Robot robotAwt = new java.awt.Robot(); - com.sun.glass.ui.Robot robotGlass = new GetAction() { - @Override - public void run(Object... os) throws Exception { - setResult(com.sun.glass.ui.Application.GetApplication().createRobot()); - } - }.dispatch(Root.ROOT.getEnvironment()); - - java.awt.Color glassColor = new java.awt.Color(robotGlass.getPixelColor((int) Math.round(x), (int) Math.round(y))); - java.awt.Color awtColor = robotAwt.getPixelColor((int) Math.round(x), (int) Math.round(y)); - - awtField.setText("AWT robot " + getColorDescription(awtColor)); - glassField.setText("Glass robot " + getColorDescription(glassColor)); - } catch (Throwable ex) { - ex.printStackTrace(); - } - } - }); - - stage.initStyle(StageStyle.UNDECORATED); - stage.setScene(new Scene(new VBox(5, xField, yField, act, awtField, glassField))); - stage.show(); - } - - static public String getColorDescription(java.awt.Color colorAwt) { - Color color = AWTtoFXcolorConvert(colorAwt); - StringBuilder b = new StringBuilder("Color : \n"); - - b.append(" R : ").append(color.getRed() * 255).append(" G : ").append(color.getGreen() * 255).append(" B : ").append(color.getBlue() * 255).append(";\n"); - b.append(" H : ").append(color.getHue() * 360).append(" S : ").append(color.getSaturation() * 100).append(" B : ").append(color.getBrightness() * 100).append(";\n"); - b.append(" W : ").append(color.toString()).append(".\n"); - - return b.toString(); - } - - static public Color AWTtoFXcolorConvert(java.awt.Color col) { - return new Color(col.getRed() / 255.0, col.getGreen() / 255.0, col.getBlue() / 255.0, col.getAlpha() / 255.0); - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.utils; + +import javafx.application.Application; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.TextArea; +import javafx.scene.control.TextField; +import javafx.scene.layout.VBox; +import javafx.scene.paint.Color; +import javafx.stage.Stage; +import javafx.stage.StageStyle; +import org.jemmy.action.GetAction; +import org.jemmy.fx.Root; + +/** + * @author Alexander Kirov + * + * This helper helps to determine, what say awt and glass robots about color at + * some coordinate. Enter coordinates. X and Y of stage will be set at that + * position, and you can see the result of robot calls. + */ +public class ColorHelper extends Application { + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(final Stage stage) throws Exception { + final TextField xField = new TextField(); + xField.setPromptText("x"); + final TextField yField = new TextField(); + yField.setPromptText("y"); + + final TextArea awtField = new TextArea(); + awtField.setPromptText("awt"); + final TextArea glassField = new TextArea(); + glassField.setPromptText("glass"); + + Button act = new Button("Get colors"); + act.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + try { + int x = Integer.parseInt(xField.getText()); + int y = Integer.parseInt(yField.getText()); + + stage.setX(x + 1); + stage.setY(y + 1); + + java.awt.Robot robotAwt = new java.awt.Robot(); + com.sun.glass.ui.Robot robotGlass = new GetAction() { + @Override + public void run(Object... os) throws Exception { + setResult(com.sun.glass.ui.Application.GetApplication().createRobot()); + } + }.dispatch(Root.ROOT.getEnvironment()); + + java.awt.Color glassColor = new java.awt.Color(robotGlass.getPixelColor((int) Math.round(x), (int) Math.round(y))); + java.awt.Color awtColor = robotAwt.getPixelColor((int) Math.round(x), (int) Math.round(y)); + + awtField.setText("AWT robot " + getColorDescription(awtColor)); + glassField.setText("Glass robot " + getColorDescription(glassColor)); + } catch (Throwable ex) { + ex.printStackTrace(); + } + } + }); + + stage.initStyle(StageStyle.UNDECORATED); + stage.setScene(new Scene(new VBox(5, xField, yField, act, awtField, glassField))); + stage.show(); + } + + static public String getColorDescription(java.awt.Color colorAwt) { + Color color = AWTtoFXcolorConvert(colorAwt); + StringBuilder b = new StringBuilder("Color : \n"); + + b.append(" R : ").append(color.getRed() * 255).append(" G : ").append(color.getGreen() * 255).append(" B : ").append(color.getBlue() * 255).append(";\n"); + b.append(" H : ").append(color.getHue() * 360).append(" S : ").append(color.getSaturation() * 100).append(" B : ").append(color.getBrightness() * 100).append(";\n"); + b.append(" W : ").append(color.toString()).append(".\n"); + + return b.toString(); + } + + static public Color AWTtoFXcolorConvert(java.awt.Color col) { + return new Color(col.getRed() / 255.0, col.getGreen() / 255.0, col.getBlue() / 255.0, col.getAlpha() / 255.0); + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/utils/ComponentsFactory.java 2016-12-22 11:26:27.321058815 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/utils/ComponentsFactory.java 2016-12-22 11:26:27.269058314 +0300 @@ -65,8 +65,11 @@ VBox vb = new VBox(); HBox hb1 = new HBox(); - Button button = ButtonBuilder.create().id(FORM_BUTTON_ID).text("Press me").build(); - final TextField tf1 = TextFieldBuilder.create().id(FORM_CLICK_TEXT_FIELD_ID).prefWidth(50).text("0").build(); + Button button = new Button("Press me"); + button.setId(FORM_BUTTON_ID); + final TextField tf1 = new TextField("0"); + tf1.setId(FORM_CLICK_TEXT_FIELD_ID); + tf1.setPrefWidth(50); button.setOnAction((ActionEvent t) -> { tf1.setText(String.valueOf(Integer.parseInt(tf1.getText()) + 1)); }); @@ -76,13 +79,19 @@ ScrollBar sb = new ScrollBar(); sb.setMax(10); sb.setId(FORM_SCROLLBAR_ID); - final TextField tf2 = TextFieldBuilder.create().id(FORM_SCROLL_TEXT_FIELD_ID).prefWidth(50).text("0").build(); + final TextField tf2 = new TextField("0"); + tf2.setId(FORM_SCROLL_TEXT_FIELD_ID); + tf2.setPrefWidth(50); sb.addEventHandler(ScrollEvent.ANY, (ScrollEvent t) -> { tf2.setText(String.valueOf(Integer.parseInt(tf2.getText()) + 1)); }); hb2.getChildren().addAll(sb, tf2); - TextArea ta = TextAreaBuilder.create().minHeight(50).prefHeight(100).prefWidth(50).id(FORM_TEXT_AREA_ID).build(); + TextArea ta = new TextArea(); + ta.setMinHeight(50); + ta.setPrefHeight(100); + ta.setPrefWidth(50); + ta.setId(FORM_TEXT_AREA_ID); for (int i = 0; i < 15; i++) { ta.appendText("text" + i + "\n"); } --- old/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/AbstractPropertyValueSetter.java 2016-12-22 11:26:27.517060706 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/AbstractPropertyValueSetter.java 2016-12-22 11:26:27.465060204 +0300 @@ -1,182 +1,183 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.utils.ptables; - -import java.lang.reflect.Method; -import javafx.beans.property.Property; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.scene.control.Button; -import javafx.scene.control.ButtonBuilder; -import javafx.scene.control.Control; -import javafx.scene.control.Label; -import static javafx.scene.control.test.utils.ptables.StaticLogger.*; -import javafx.scene.layout.HBox; - -/** - * @author Alexander Kirov - * - * Partial implementation of mechanism of binding and unbinding, setters - * implementing, and this functionality aggregating. - */ -public abstract class AbstractPropertyValueSetter extends HBox implements AbstractPropertySetter { - - public final static String BIND_BUTTON_SUFFIX = "_BIND_BUTTON_ID"; - public final static String BIDIR_PREFIX = "BIDIR_"; - public final static String UNIDIR_PREFIX = "UNIDIR_"; - public final static String SET_PREFIX = "SETTER_"; - public final static String CONTROLLER_SUFFIX = "_CONTROLLER_ID"; - protected Property leadingProperty; - protected Property listeningProperty; - protected AbstractBindingSwitcher binding; - protected Control leadingControl; - protected Object initialValue1; - protected Object initialValue2; - protected Object initialValue3; - protected PropertyValueType propertyValueType; - private BindingType btype; - private EventHandler setAction; - - protected void bindComponent(final BindingType btype, final Object testedControl) { - this.btype = btype; - String bindButtonId = ((btype == BindingType.UNIDIRECTIONAL) ? UNIDIR_PREFIX : BIDIR_PREFIX) + listeningProperty.getName().toUpperCase() + BIND_BUTTON_SUFFIX; - setStyle("-fx-border-color : black;"); - setSpacing(3); - - binding = new ToggleBindingSwitcher(leadingProperty, listeningProperty, btype); - binding.getVisualRepresentation().setId(bindButtonId); - - String labelDescription = btype.equals(BindingType.UNIDIRECTIONAL) ? "UNIDIR" : "BIDIR"; - getChildren().addAll(new Label(labelDescription.toUpperCase().substring(0, Math.min(15, labelDescription.length()) - 1)), leadingControl, binding.getVisualRepresentation()); - - if (btype == BindingType.UNIDIRECTIONAL) { - Button setButton = ButtonBuilder.create().text("set").minWidth(38).id(SET_PREFIX + listeningProperty.getName().toUpperCase()).build(); - setAction = new EventHandler() { - public void handle(ActionEvent t) { - //bindingTB.setSelected(false);I think, that is not obligative. - //But otherwise, exception will be thrown each time, when unidirectional binding is switched on. - Method setter; - try { - Object value = listeningProperty.getValue(); - - Class returnClass; - - - if (value instanceof Boolean) { - returnClass = boolean.class; - } else { - returnClass = testedControl.getClass().getMethod("get" + listeningProperty.getName().substring(0, 1).toUpperCase() + listeningProperty.getName().substring(1, listeningProperty.getName().length())).getReturnType(); - } - - Object argument = leadingProperty.getValue(); - if (value instanceof Integer) { - argument = (int) Math.round((Double) argument); - } - - setter = testedControl.getClass().getMethod("set" + listeningProperty.getName().substring(0, 1).toUpperCase() + listeningProperty.getName().substring(1, listeningProperty.getName().length()), returnClass); - setter.invoke(testedControl, argument); - } catch (Throwable ex) { - log(ex); - } - } - }; - setButton.setOnAction(setAction); - getChildren().add(setButton); - } - } - - public static String createId(Property property, BindingType btype) { - try { - return btype.getPrefix() + property.getName().toUpperCase() + CONTROLLER_SUFFIX; - } catch (Throwable ex) { - log(ex); - } - return null; - } - - public void setBindingState(Boolean newState) { - binding.setBindingState(newState); - } - - public Boolean getBindingState() { - return binding.getBindingState(); - } - - public PropertyValueType getPropertyValueType() { - return propertyValueType; - } - - public void setValueThroughtBidirectionalBinding(ValueType value) { - if (btype.equals(BindingType.UNIDIRECTIONAL)) { - throw new IllegalStateException("Bidirectional setting is not applicable with unirectional binding option."); - } - try { - leadingProperty.setValue(value); - } catch (Throwable ex) { - log(ex); - } - } - - public void setValueThroughtUnidirectionalBinding(ValueType value) { - if (btype.equals(BindingType.BIDIRECTIONAL)) { - throw new IllegalStateException("Unidirectional setting is not applicable with bidirectional binding option."); - } - try { - leadingProperty.setValue(value); - } catch (Throwable ex) { - log(ex); - } - } - - public void setValueThroughtSetter(ValueType value) { - if (btype.equals(BindingType.BIDIRECTIONAL)) { - throw new IllegalStateException("Setter setting is not applicable with bidirectional binding option."); - } - if (setAction == null) { - throw new IllegalArgumentException("Set action cannot be done."); - } - try { - leadingProperty.setValue(value); - setAction.handle(null); - } catch (Throwable ex) { - log(ex); - } - } - - public static enum BindingType { - - UNIDIRECTIONAL, BIDIRECTIONAL; - - public String getPrefix() { - if (this.equals(BindingType.BIDIRECTIONAL)) { - return "BIDIR_"; - } - if (this.equals(BindingType.UNIDIRECTIONAL)) { - return "UNIDIR_"; - } - return null; - } - }; -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.utils.ptables; + +import java.lang.reflect.Method; +import javafx.beans.property.Property; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.scene.control.Button; +import javafx.scene.control.Control; +import javafx.scene.control.Label; +import static javafx.scene.control.test.utils.ptables.StaticLogger.*; +import javafx.scene.layout.HBox; + +/** + * @author Alexander Kirov + * + * Partial implementation of mechanism of binding and unbinding, setters + * implementing, and this functionality aggregating. + */ +public abstract class AbstractPropertyValueSetter extends HBox implements AbstractPropertySetter { + + public final static String BIND_BUTTON_SUFFIX = "_BIND_BUTTON_ID"; + public final static String BIDIR_PREFIX = "BIDIR_"; + public final static String UNIDIR_PREFIX = "UNIDIR_"; + public final static String SET_PREFIX = "SETTER_"; + public final static String CONTROLLER_SUFFIX = "_CONTROLLER_ID"; + protected Property leadingProperty; + protected Property listeningProperty; + protected AbstractBindingSwitcher binding; + protected Control leadingControl; + protected Object initialValue1; + protected Object initialValue2; + protected Object initialValue3; + protected PropertyValueType propertyValueType; + private BindingType btype; + private EventHandler setAction; + + protected void bindComponent(final BindingType btype, final Object testedControl) { + this.btype = btype; + String bindButtonId = ((btype == BindingType.UNIDIRECTIONAL) ? UNIDIR_PREFIX : BIDIR_PREFIX) + listeningProperty.getName().toUpperCase() + BIND_BUTTON_SUFFIX; + setStyle("-fx-border-color : black;"); + setSpacing(3); + + binding = new ToggleBindingSwitcher(leadingProperty, listeningProperty, btype); + binding.getVisualRepresentation().setId(bindButtonId); + + String labelDescription = btype.equals(BindingType.UNIDIRECTIONAL) ? "UNIDIR" : "BIDIR"; + getChildren().addAll(new Label(labelDescription.toUpperCase().substring(0, Math.min(15, labelDescription.length()) - 1)), leadingControl, binding.getVisualRepresentation()); + + if (btype == BindingType.UNIDIRECTIONAL) { + Button setButton = new Button("set"); + setButton.setMinWidth(38); + setButton.setId(SET_PREFIX + listeningProperty.getName().toUpperCase()); + setAction = new EventHandler() { + public void handle(ActionEvent t) { + //bindingTB.setSelected(false);I think, that is not obligative. + //But otherwise, exception will be thrown each time, when unidirectional binding is switched on. + Method setter; + try { + Object value = listeningProperty.getValue(); + + Class returnClass; + + + if (value instanceof Boolean) { + returnClass = boolean.class; + } else { + returnClass = testedControl.getClass().getMethod("get" + listeningProperty.getName().substring(0, 1).toUpperCase() + listeningProperty.getName().substring(1, listeningProperty.getName().length())).getReturnType(); + } + + Object argument = leadingProperty.getValue(); + if (value instanceof Integer) { + argument = (int) Math.round((Double) argument); + } + + setter = testedControl.getClass().getMethod("set" + listeningProperty.getName().substring(0, 1).toUpperCase() + listeningProperty.getName().substring(1, listeningProperty.getName().length()), returnClass); + setter.invoke(testedControl, argument); + } catch (Throwable ex) { + log(ex); + } + } + }; + setButton.setOnAction(setAction); + getChildren().add(setButton); + } + } + + public static String createId(Property property, BindingType btype) { + try { + return btype.getPrefix() + property.getName().toUpperCase() + CONTROLLER_SUFFIX; + } catch (Throwable ex) { + log(ex); + } + return null; + } + + public void setBindingState(Boolean newState) { + binding.setBindingState(newState); + } + + public Boolean getBindingState() { + return binding.getBindingState(); + } + + public PropertyValueType getPropertyValueType() { + return propertyValueType; + } + + public void setValueThroughtBidirectionalBinding(ValueType value) { + if (btype.equals(BindingType.UNIDIRECTIONAL)) { + throw new IllegalStateException("Bidirectional setting is not applicable with unirectional binding option."); + } + try { + leadingProperty.setValue(value); + } catch (Throwable ex) { + log(ex); + } + } + + public void setValueThroughtUnidirectionalBinding(ValueType value) { + if (btype.equals(BindingType.BIDIRECTIONAL)) { + throw new IllegalStateException("Unidirectional setting is not applicable with bidirectional binding option."); + } + try { + leadingProperty.setValue(value); + } catch (Throwable ex) { + log(ex); + } + } + + public void setValueThroughtSetter(ValueType value) { + if (btype.equals(BindingType.BIDIRECTIONAL)) { + throw new IllegalStateException("Setter setting is not applicable with bidirectional binding option."); + } + if (setAction == null) { + throw new IllegalArgumentException("Set action cannot be done."); + } + try { + leadingProperty.setValue(value); + setAction.handle(null); + } catch (Throwable ex) { + log(ex); + } + } + + public static enum BindingType { + + UNIDIRECTIONAL, BIDIRECTIONAL; + + public String getPrefix() { + if (this.equals(BindingType.BIDIRECTIONAL)) { + return "BIDIR_"; + } + if (this.equals(BindingType.UNIDIRECTIONAL)) { + return "UNIDIR_"; + } + return null; + } + }; +} --- old/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/BooleanPropertyValueSetter.java 2016-12-22 11:26:27.705062520 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/BooleanPropertyValueSetter.java 2016-12-22 11:26:27.653062018 +0300 @@ -1,65 +1,64 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.utils.ptables; - -import javafx.beans.property.Property; -import javafx.scene.Node; -import javafx.scene.control.ToggleButton; -import javafx.scene.control.ToggleButtonBuilder; -import static javafx.scene.control.test.utils.ptables.StaticLogger.*; - -/** - * @author Alexander Kirov - * - * Implementation for boolean properties, using toggle buttons. - */ -public class BooleanPropertyValueSetter extends AbstractPropertyValueSetter { - - private ToggleButton tb = ToggleButtonBuilder.create().text("false").build(); - - public BooleanPropertyValueSetter(Property listeningProperty, BindingType btype, Object testedControl) { - try { - tb.setId(createId(listeningProperty, btype)); - tb.textProperty().bind(tb.selectedProperty().asString()); - this.leadingControl = tb; - this.listeningProperty = listeningProperty; - this.leadingProperty = (Property) tb.selectedProperty(); - initialValue1 = Boolean.FALSE; - propertyValueType = PropertyValueType.BOOLEAN; - bindComponent(btype, testedControl); - } catch (Throwable ex) { - log(ex); - } - } - - public void refresh() { - setBindingState(Boolean.FALSE); - leadingProperty.setValue(initialValue1); - } - - public Node getVisualRepresentation() { - return this; - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.utils.ptables; + +import javafx.beans.property.Property; +import javafx.scene.Node; +import javafx.scene.control.ToggleButton; +import static javafx.scene.control.test.utils.ptables.StaticLogger.*; + +/** + * @author Alexander Kirov + * + * Implementation for boolean properties, using toggle buttons. + */ +public class BooleanPropertyValueSetter extends AbstractPropertyValueSetter { + + private ToggleButton tb = new ToggleButton("false"); + + public BooleanPropertyValueSetter(Property listeningProperty, BindingType btype, Object testedControl) { + try { + tb.setId(createId(listeningProperty, btype)); + tb.textProperty().bind(tb.selectedProperty().asString()); + this.leadingControl = tb; + this.listeningProperty = listeningProperty; + this.leadingProperty = (Property) tb.selectedProperty(); + initialValue1 = Boolean.FALSE; + propertyValueType = PropertyValueType.BOOLEAN; + bindComponent(btype, testedControl); + } catch (Throwable ex) { + log(ex); + } + } + + public void refresh() { + setBindingState(Boolean.FALSE); + leadingProperty.setValue(initialValue1); + } + + public Node getVisualRepresentation() { + return this; + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/NodeControllerFactory.java 2016-12-22 11:26:27.889064294 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/NodeControllerFactory.java 2016-12-22 11:26:27.837063792 +0300 @@ -1,221 +1,239 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.utils.ptables; - -import java.util.logging.Level; -import java.util.logging.Logger; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.scene.Node; -import javafx.scene.control.*; -import javafx.scene.layout.FlowPane; -import javafx.scene.layout.HBox; -import javafx.scene.layout.VBox; - -/** - * @author Alexander Kirov - * - * NOTION: this class should be instantiated on JavaFX thread. - */ -public class NodeControllerFactory { - - public static NodesStorage createFullController(Object node, TabPaneWithControl tabPane) { - PropertiesTable pt = new PropertiesTable(node); - PropertyTablesFactory.explorePropertiesList(node, pt); - SpecialTablePropertiesProvider.provideForControl(node, pt); - - VBox vb = new VBox(); - - if (node instanceof ToolBar) { - vb.getChildren().add(new ToolBarControllers().getForNode((ToolBar) node, tabPane)); - } - - if (node instanceof Menu) { - vb.getChildren().add(new MenuControllers().getForNode((Menu) node, tabPane)); - } - - if (node instanceof TreeItem) { - vb.getChildren().add(new TreeItemControllers().getForNode((TreeItem) node, tabPane)); - } - - return new NodesStorage(pt, vb); - } - - public static class NodesStorage extends VBox { - - public PropertiesTable pt; - public Node storageOfTable; - public Node storageOfControlElements; - - public NodesStorage(PropertiesTable pt, Node storageOfControlElements) { - this.pt = pt; - this.storageOfControlElements = storageOfControlElements; - this.storageOfTable = pt; - - this.getChildren().addAll(storageOfControlElements, storageOfTable); - } - } - - public interface ControllingNodesCreator { - - public abstract Node getForNode(T node, TabPaneWithControl tabPane); - } - - public static class ToolBarControllers extends HBox implements ControllingNodesCreator { - - public final String TOOLBAR_ADD_INDEX_TEXT_FIELD_ID = "TOOLBAR_ADD_INDEX_TEXT_FIELD_ID"; - - @Override - public Node getForNode(final ToolBar toolBar, final TabPaneWithControl tabPane) { - final TextField tf = TextFieldBuilder.create().id(TOOLBAR_ADD_INDEX_TEXT_FIELD_ID).text("0").prefWidth(40).build(); - - this.getChildren().addAll(new NodesChoserFactory("Add!", new NodesChoserFactory.NodeAction() { - @Override - public void execute(Node node) { - toolBar.getItems().add(Integer.parseInt(tf.getText()), node); - try { - tabPane.addPropertiesTable(node.getClass().getSimpleName(), NodeControllerFactory.createFullController(node, tabPane)); - } catch (Throwable ex) { - Logger.getLogger(NodeControllerFactory.class.getName()).log(Level.SEVERE, null, ex); - } - } - }, tf).getChildren()); - - return this; - } - } - - public static class MenuControllers extends HBox implements ControllingNodesCreator { - - public final String MENU_ADD_INDEX_TEXT_FIELD_ID = "MENU_ADD_INDEX_TEXT_FIELD_ID"; - public final String MENU_ADD_NAME_TEXT_FIELD_ID = "MENU_ADD_NAME_TEXT_FIELD_ID"; - - @Override - public Node getForNode(final Menu menu, final TabPaneWithControl tabPane) { - final TextField tf = TextFieldBuilder.create().id(MENU_ADD_INDEX_TEXT_FIELD_ID).text("0").prefWidth(40).build(); - final TextField nameTF = TextFieldBuilder.create().id(MENU_ADD_NAME_TEXT_FIELD_ID).text("Menu").prefWidth(40).build(); - this.getChildren().addAll(new NodesChoserFactory("Add!", new NodesChoserFactory.NodeAction() { - @Override - public void execute(MenuItem node) { - node.setText(nameTF.getText()); - menu.getItems().add(Integer.parseInt(tf.getText()), node); - try { - tabPane.addPropertiesTable(nameTF.getText(), NodeControllerFactory.createFullController(node, tabPane)); - } catch (Throwable ex) { - Logger.getLogger(NodeControllerFactory.class.getName()).log(Level.SEVERE, null, ex); - } - } - }, tf, nameTF).getChildren()); - - return this; - } - } - - public static class TreeItemControllers extends FlowPane implements ControllingNodesCreator { - - public static final String GET_NEXT_SIBLING_TREEITEM_BUTTON_ID = "GET_NEXT_SIBLING_TREEITEM_BUTTON_ID"; - public static final String GET_NEXT_SIBLING_TREEITEM_TEXTFIELD_ID = "GET_NEXT_SIBLING_TREEITEM_TEXTFIELD_ID"; - public static final String GET_PREVIOUS_SIBLING_TREEITEM_BUTTON_ID = "GET_PREVIOUS_SIBLING_TREEITEM_BUTTON_ID"; - public static final String GET_PREVIOUS_SIBLING_TREEITEM_TEXTFIELD_ID = "GET_PREVIOUS_SIBLING_TREEITEM_TEXTFIELD_ID"; - public final static String CHANGE_VALUE_BUTTON_ID = "CHANGE_VALUE_BUTTON_ID"; - public final static String NEW_VALUE_TEXT_FIELD_ID = "NEW_VALUE_TEXT_FIELD_ID"; - - @Override - public Node getForNode(final TreeItem item, final TabPaneWithControl tabPane) { - HBox hb1 = getNextSiblingHBox(item); - HBox hb2 = getPreviousSiblingHBox(item); - HBox hb3 = getChangeValueHBox(item); - - this.getChildren().addAll(hb1, hb2, hb3); - - return this; - } - - private HBox getPreviousSiblingHBox(final TreeItem item) { - HBox hb = new HBox(); - Button button = ButtonBuilder.create().text("Get previous sibling").id(GET_PREVIOUS_SIBLING_TREEITEM_BUTTON_ID).build(); - final TextField tf = TextFieldBuilder.create().text("").promptText("Next sibling").id(GET_PREVIOUS_SIBLING_TREEITEM_TEXTFIELD_ID).prefWidth(100).build(); - - button.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - TreeItem sibling = item.previousSibling(); - TreeItem sibling2 = item.previousSibling(item); - if (sibling == null) { - if (sibling2 == null) { - tf.setText("null"); - } else { - tf.setText("ERROR"); - } - } else { - if (sibling.equals(sibling2)) { - tf.setText(sibling.getValue().toString()); - } else { - tf.setText("ERROR"); - } - } - } - }); - - hb.getChildren().addAll(button, tf); - return hb; - } - - private HBox getNextSiblingHBox(final TreeItem item) { - HBox hb = new HBox(); - Button button = ButtonBuilder.create().text("Get next sibling").id(GET_NEXT_SIBLING_TREEITEM_BUTTON_ID).build(); - final TextField tf = TextFieldBuilder.create().text("").promptText("Next sibling").id(GET_NEXT_SIBLING_TREEITEM_TEXTFIELD_ID).prefWidth(100).build(); - - button.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - TreeItem sibling = item.nextSibling(); - if (sibling == null) { - tf.setText("null"); - } else { - tf.setText(sibling.getValue().toString()); - } - } - }); - - hb.getChildren().addAll(button, tf); - return hb; - } - - private HBox getChangeValueHBox(final TreeItem item) { - Button button = ButtonBuilder.create().text("change value to").id(CHANGE_VALUE_BUTTON_ID).build(); - final TextField tfNew = TextFieldBuilder.create().promptText("new value").id(NEW_VALUE_TEXT_FIELD_ID).prefWidth(50).build(); - - button.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { - item.setValue(tfNew.getText()); - } - }); - - HBox hb = new HBox(); - hb.getChildren().addAll(button, tfNew); - - return hb; - } - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.utils.ptables; + +import java.util.logging.Level; +import java.util.logging.Logger; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.scene.Node; +import javafx.scene.control.*; +import javafx.scene.layout.FlowPane; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; + +/** + * @author Alexander Kirov + * + * NOTION: this class should be instantiated on JavaFX thread. + */ +public class NodeControllerFactory { + + public static NodesStorage createFullController(Object node, TabPaneWithControl tabPane) { + PropertiesTable pt = new PropertiesTable(node); + PropertyTablesFactory.explorePropertiesList(node, pt); + SpecialTablePropertiesProvider.provideForControl(node, pt); + + VBox vb = new VBox(); + + if (node instanceof ToolBar) { + vb.getChildren().add(new ToolBarControllers().getForNode((ToolBar) node, tabPane)); + } + + if (node instanceof Menu) { + vb.getChildren().add(new MenuControllers().getForNode((Menu) node, tabPane)); + } + + if (node instanceof TreeItem) { + vb.getChildren().add(new TreeItemControllers().getForNode((TreeItem) node, tabPane)); + } + + return new NodesStorage(pt, vb); + } + + public static class NodesStorage extends VBox { + + public PropertiesTable pt; + public Node storageOfTable; + public Node storageOfControlElements; + + public NodesStorage(PropertiesTable pt, Node storageOfControlElements) { + this.pt = pt; + this.storageOfControlElements = storageOfControlElements; + this.storageOfTable = pt; + + this.getChildren().addAll(storageOfControlElements, storageOfTable); + } + } + + public interface ControllingNodesCreator { + + public abstract Node getForNode(T node, TabPaneWithControl tabPane); + } + + public static class ToolBarControllers extends HBox implements ControllingNodesCreator { + + public final String TOOLBAR_ADD_INDEX_TEXT_FIELD_ID = "TOOLBAR_ADD_INDEX_TEXT_FIELD_ID"; + + @Override + public Node getForNode(final ToolBar toolBar, final TabPaneWithControl tabPane) { + final TextField tf = new TextField("0"); + tf.setId(TOOLBAR_ADD_INDEX_TEXT_FIELD_ID); + tf.setPrefWidth(40); + + this.getChildren().addAll(new NodesChoserFactory("Add!", new NodesChoserFactory.NodeAction() { + @Override + public void execute(Node node) { + toolBar.getItems().add(Integer.parseInt(tf.getText()), node); + try { + tabPane.addPropertiesTable(node.getClass().getSimpleName(), NodeControllerFactory.createFullController(node, tabPane)); + } catch (Throwable ex) { + Logger.getLogger(NodeControllerFactory.class.getName()).log(Level.SEVERE, null, ex); + } + } + }, tf).getChildren()); + + return this; + } + } + + public static class MenuControllers extends HBox implements ControllingNodesCreator { + + public final String MENU_ADD_INDEX_TEXT_FIELD_ID = "MENU_ADD_INDEX_TEXT_FIELD_ID"; + public final String MENU_ADD_NAME_TEXT_FIELD_ID = "MENU_ADD_NAME_TEXT_FIELD_ID"; + + @Override + public Node getForNode(final Menu menu, final TabPaneWithControl tabPane) { + final TextField tf = new TextField("0"); + tf.setId(MENU_ADD_INDEX_TEXT_FIELD_ID); + tf.setPrefWidth(40); + final TextField nameTF = new TextField("Menu"); + nameTF.setId(MENU_ADD_NAME_TEXT_FIELD_ID); + nameTF.setPrefWidth(40); + this.getChildren().addAll(new NodesChoserFactory("Add!", new NodesChoserFactory.NodeAction() { + @Override + public void execute(MenuItem node) { + node.setText(nameTF.getText()); + menu.getItems().add(Integer.parseInt(tf.getText()), node); + try { + tabPane.addPropertiesTable(nameTF.getText(), NodeControllerFactory.createFullController(node, tabPane)); + } catch (Throwable ex) { + Logger.getLogger(NodeControllerFactory.class.getName()).log(Level.SEVERE, null, ex); + } + } + }, tf, nameTF).getChildren()); + + return this; + } + } + + public static class TreeItemControllers extends FlowPane implements ControllingNodesCreator { + + public static final String GET_NEXT_SIBLING_TREEITEM_BUTTON_ID = "GET_NEXT_SIBLING_TREEITEM_BUTTON_ID"; + public static final String GET_NEXT_SIBLING_TREEITEM_TEXTFIELD_ID = "GET_NEXT_SIBLING_TREEITEM_TEXTFIELD_ID"; + public static final String GET_PREVIOUS_SIBLING_TREEITEM_BUTTON_ID = "GET_PREVIOUS_SIBLING_TREEITEM_BUTTON_ID"; + public static final String GET_PREVIOUS_SIBLING_TREEITEM_TEXTFIELD_ID = "GET_PREVIOUS_SIBLING_TREEITEM_TEXTFIELD_ID"; + public final static String CHANGE_VALUE_BUTTON_ID = "CHANGE_VALUE_BUTTON_ID"; + public final static String NEW_VALUE_TEXT_FIELD_ID = "NEW_VALUE_TEXT_FIELD_ID"; + + @Override + public Node getForNode(final TreeItem item, final TabPaneWithControl tabPane) { + HBox hb1 = getNextSiblingHBox(item); + HBox hb2 = getPreviousSiblingHBox(item); + HBox hb3 = getChangeValueHBox(item); + + this.getChildren().addAll(hb1, hb2, hb3); + + return this; + } + + private HBox getPreviousSiblingHBox(final TreeItem item) { + HBox hb = new HBox(); + Button button = new Button("Get previous sibling"); + button.setId(GET_PREVIOUS_SIBLING_TREEITEM_BUTTON_ID); + final TextField tf = new TextField(""); + tf.setPromptText("Next sibling"); + tf.setId(GET_PREVIOUS_SIBLING_TREEITEM_TEXTFIELD_ID); + tf.setPrefWidth(100); + + button.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + TreeItem sibling = item.previousSibling(); + TreeItem sibling2 = item.previousSibling(item); + if (sibling == null) { + if (sibling2 == null) { + tf.setText("null"); + } else { + tf.setText("ERROR"); + } + } else { + if (sibling.equals(sibling2)) { + tf.setText(sibling.getValue().toString()); + } else { + tf.setText("ERROR"); + } + } + } + }); + + hb.getChildren().addAll(button, tf); + return hb; + } + + private HBox getNextSiblingHBox(final TreeItem item) { + HBox hb = new HBox(); + Button button = new Button("Get next sibling"); + button.setId(GET_NEXT_SIBLING_TREEITEM_BUTTON_ID); + final TextField tf = new TextField(""); + tf.setPromptText("Next sibling"); + tf.setId(GET_NEXT_SIBLING_TREEITEM_TEXTFIELD_ID); + tf.setPrefWidth(100); + + button.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + TreeItem sibling = item.nextSibling(); + if (sibling == null) { + tf.setText("null"); + } else { + tf.setText(sibling.getValue().toString()); + } + } + }); + + hb.getChildren().addAll(button, tf); + return hb; + } + + private HBox getChangeValueHBox(final TreeItem item) { + Button button = new Button("change value to"); + button.setId(CHANGE_VALUE_BUTTON_ID); + final TextField tfNew = new TextField(); + tfNew.setPromptText("new value"); + tfNew.setId(NEW_VALUE_TEXT_FIELD_ID); + tfNew.setPrefWidth(50); + + button.setOnAction(new EventHandler() { + public void handle(ActionEvent t) { + item.setValue(tfNew.getText()); + } + }); + + HBox hb = new HBox(); + hb.getChildren().addAll(button, tfNew); + + return hb; + } + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/NumberPropertyValueSetter.java 2016-12-22 11:26:28.081066146 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/NumberPropertyValueSetter.java 2016-12-22 11:26:28.029065645 +0300 @@ -1,163 +1,186 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.utils.ptables; - -import javafx.beans.property.DoubleProperty; -import javafx.beans.property.IntegerProperty; -import javafx.beans.property.Property; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; -import javafx.event.EventHandler; -import javafx.scene.Node; -import javafx.scene.control.Label; -import javafx.scene.control.Slider; -import javafx.scene.control.SliderBuilder; -import static javafx.scene.control.test.utils.ptables.StaticLogger.*; -import javafx.scene.input.MouseEvent; -import javafx.scene.layout.VBox; -import javafx.stage.Popup; - -/** - * @author Alexander Kirov - * - * You can use ctrl+LMBclick, to change min and max ranges of slider (additional - * popup with logarithmic sliders must appear). - */ -public class NumberPropertyValueSetter extends AbstractPropertyValueSetter { - - private DoubleProperty sliderMinProperty; - private DoubleProperty sliderMaxProperty; - - public NumberPropertyValueSetter(Property listeningProperty, AbstractPropertyValueSetter.BindingType btype, Object testedControl, Number minValue, Number initialValue, Number maxValue) { - try { - this.initialValue1 = minValue; - this.initialValue2 = initialValue; - this.initialValue3 = maxValue; - this.listeningProperty = listeningProperty; - - if ((listeningProperty instanceof DoubleProperty) || (listeningProperty instanceof IntegerProperty)) { - Slider slider = null; - if (listeningProperty instanceof DoubleProperty) { - slider = createSlider((Double) minValue, (Double) maxValue, (Double) initialValue, createId(listeningProperty, btype)); - } - if (listeningProperty instanceof IntegerProperty) { - slider = createSlider((Integer) minValue, (Integer) maxValue, (Integer) initialValue, createId(listeningProperty, btype)); - } - slider.setId(createId(listeningProperty, btype)); - sliderMinProperty = slider.minProperty(); - sliderMaxProperty = slider.maxProperty(); - leadingProperty = (Property) slider.valueProperty(); - leadingControl = slider; - - if (listeningProperty instanceof IntegerProperty) { - propertyValueType = PropertyValueType.INTEGER; - } else { - propertyValueType = PropertyValueType.DOUBLE; - } - - bindComponent(btype, testedControl); - applyRangesChangers(slider); - } - } catch (Throwable ex) { - log(ex); - } - } - - private void applyRangesChangers(final Slider slider) { - final Popup popupWithControllers = new Popup(); - Slider minValue = SliderBuilder.create().prefWidth(300).min(1).max(9).minorTickCount(4).majorTickUnit(2).showTickLabels(true).showTickMarks(true).build(); - Slider maxValue = SliderBuilder.create().prefWidth(300).min(1).max(9).minorTickCount(4).majorTickUnit(2).showTickLabels(true).showTickMarks(true).build(); - - maxValue.valueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - try { - slider.setMinorTickCount(0); - Double newValue = Math.pow(10, (Double) t1); - slider.setMajorTickUnit(Math.max((newValue - slider.getMin()), 1) / 4); - slider.maxProperty().setValue(Math.max(newValue, slider.getValue())); - } catch (Throwable ex) { - log(ex); - } - } - }); - - minValue.valueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Object t, Object t1) { - try { - slider.setMinorTickCount(0); - Double newValue = -Math.pow(10, (Double) t1); - slider.setMajorTickUnit(Math.max((slider.getMax() - newValue), 1) / 4); - slider.minProperty().setValue(Math.min(newValue, slider.getValue())); - } catch (Throwable ex) { - log(ex); - } - } - }); - - VBox vb = new VBox(); - vb.getChildren().addAll(new Label("Maximum exponent"), maxValue, new Label("Minimum exponent"), minValue); - vb.setStyle("-fx-background-color: RED;"); - - popupWithControllers.setAutoHide(true); - popupWithControllers.setAutoFix(true); - popupWithControllers.getContent().addAll(vb); - - slider.setOnMouseClicked(new EventHandler() { - public void handle(MouseEvent t) { - try { - if (t.isControlDown()) { - popupWithControllers.show(slider, slider.getScene().getX() + slider.getLayoutX(), slider.getScene().getY() + slider.getLayoutY()); - } - } catch (Throwable ex) { - log(ex); - } - } - }); - } - - private Slider createSlider(int minValue, int maxValue, int defaultValue, String sliderId) { - return createSlider((double) minValue, (double) maxValue, (double) defaultValue, sliderId); - } - - private Slider createSlider(double minValue, double maxValue, double defaultValue, String sliderId) { - try { - return SliderBuilder.create().prefWidth(100).id(sliderId).min(minValue).max(maxValue).value(defaultValue).minorTickCount(4).majorTickUnit((maxValue - minValue) / 4).showTickLabels(true).showTickMarks(true).build(); - } catch (Throwable ex) { - log(ex); - } - return null; - } - - public void refresh() { - setBindingState(Boolean.FALSE); - sliderMinProperty.setValue((Number) initialValue1); - leadingProperty.setValue(initialValue2); - sliderMaxProperty.setValue((Number) initialValue3); - } - - public Node getVisualRepresentation() { - return this; - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.utils.ptables; + +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.IntegerProperty; +import javafx.beans.property.Property; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.event.EventHandler; +import javafx.scene.Node; +import javafx.scene.control.Label; +import javafx.scene.control.Slider; +import static javafx.scene.control.test.utils.ptables.StaticLogger.*; +import javafx.scene.input.MouseEvent; +import javafx.scene.layout.VBox; +import javafx.stage.Popup; + +/** + * @author Alexander Kirov + * + * You can use ctrl+LMBclick, to change min and max ranges of slider (additional + * popup with logarithmic sliders must appear). + */ +public class NumberPropertyValueSetter extends AbstractPropertyValueSetter { + + private DoubleProperty sliderMinProperty; + private DoubleProperty sliderMaxProperty; + + public NumberPropertyValueSetter(Property listeningProperty, AbstractPropertyValueSetter.BindingType btype, Object testedControl, Number minValue, Number initialValue, Number maxValue) { + try { + this.initialValue1 = minValue; + this.initialValue2 = initialValue; + this.initialValue3 = maxValue; + this.listeningProperty = listeningProperty; + + if ((listeningProperty instanceof DoubleProperty) || (listeningProperty instanceof IntegerProperty)) { + Slider slider = null; + if (listeningProperty instanceof DoubleProperty) { + slider = createSlider((Double) minValue, (Double) maxValue, (Double) initialValue, createId(listeningProperty, btype)); + } + if (listeningProperty instanceof IntegerProperty) { + slider = createSlider((Integer) minValue, (Integer) maxValue, (Integer) initialValue, createId(listeningProperty, btype)); + } + slider.setId(createId(listeningProperty, btype)); + sliderMinProperty = slider.minProperty(); + sliderMaxProperty = slider.maxProperty(); + leadingProperty = (Property) slider.valueProperty(); + leadingControl = slider; + + if (listeningProperty instanceof IntegerProperty) { + propertyValueType = PropertyValueType.INTEGER; + } else { + propertyValueType = PropertyValueType.DOUBLE; + } + + bindComponent(btype, testedControl); + applyRangesChangers(slider); + } + } catch (Throwable ex) { + log(ex); + } + } + + private void applyRangesChangers(final Slider slider) { + final Popup popupWithControllers = new Popup(); + Slider minValue = new Slider(); + minValue.setPrefWidth(300); + minValue.setMin(1); + minValue.setMax(9); + minValue.setMinorTickCount(4); + minValue.setMajorTickUnit(2); + minValue.setShowTickLabels(true); + minValue.setShowTickMarks(true); + Slider maxValue = new Slider(); + maxValue.setPrefWidth(300); + maxValue.setMin(1); + maxValue.setMax(9); + maxValue.setMinorTickCount(4); + maxValue.setMajorTickUnit(2); + maxValue.setShowTickLabels(true); + maxValue.setShowTickMarks(true); + + maxValue.valueProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + try { + slider.setMinorTickCount(0); + Double newValue = Math.pow(10, (Double) t1); + slider.setMajorTickUnit(Math.max((newValue - slider.getMin()), 1) / 4); + slider.maxProperty().setValue(Math.max(newValue, slider.getValue())); + } catch (Throwable ex) { + log(ex); + } + } + }); + + minValue.valueProperty().addListener(new ChangeListener() { + public void changed(ObservableValue ov, Object t, Object t1) { + try { + slider.setMinorTickCount(0); + Double newValue = -Math.pow(10, (Double) t1); + slider.setMajorTickUnit(Math.max((slider.getMax() - newValue), 1) / 4); + slider.minProperty().setValue(Math.min(newValue, slider.getValue())); + } catch (Throwable ex) { + log(ex); + } + } + }); + + VBox vb = new VBox(); + vb.getChildren().addAll(new Label("Maximum exponent"), maxValue, new Label("Minimum exponent"), minValue); + vb.setStyle("-fx-background-color: RED;"); + + popupWithControllers.setAutoHide(true); + popupWithControllers.setAutoFix(true); + popupWithControllers.getContent().addAll(vb); + + slider.setOnMouseClicked(new EventHandler() { + public void handle(MouseEvent t) { + try { + if (t.isControlDown()) { + popupWithControllers.show(slider, slider.getScene().getX() + slider.getLayoutX(), slider.getScene().getY() + slider.getLayoutY()); + } + } catch (Throwable ex) { + log(ex); + } + } + }); + } + + private Slider createSlider(int minValue, int maxValue, int defaultValue, String sliderId) { + return createSlider((double) minValue, (double) maxValue, (double) defaultValue, sliderId); + } + + private Slider createSlider(double minValue, double maxValue, double defaultValue, String sliderId) { + try { + Slider temp = new Slider(); + temp.setPrefWidth(100); + temp.setId(sliderId); + temp.setMin(minValue); + temp.setMax(maxValue); + temp.setValue(defaultValue); + temp.setMinorTickCount(4); + temp.setMajorTickUnit((maxValue - minValue) / 4); + temp.setShowTickLabels(true); + temp.setShowTickMarks(true); + return temp; + } catch (Throwable ex) { + log(ex); + } + return null; + } + + public void refresh() { + setBindingState(Boolean.FALSE); + sliderMinProperty.setValue((Number) initialValue1); + leadingProperty.setValue(initialValue2); + sliderMaxProperty.setValue((Number) initialValue3); + } + + public Node getVisualRepresentation() { + return this; + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/PropertiesTable.java 2016-12-22 11:26:28.265067922 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/PropertiesTable.java 2016-12-22 11:26:28.213067419 +0300 @@ -36,7 +36,6 @@ import javafx.beans.property.ReadOnlyProperty; import javafx.scene.Node; import javafx.scene.layout.FlowPane; -import javafx.scene.layout.FlowPaneBuilder; import javafx.scene.layout.VBox; import static javafx.scene.control.test.utils.ptables.AbstractApplicationPropertiesRegystry.DEFAULT_DOMAIN_NAME; @@ -78,8 +77,8 @@ public final static String PROPERTIES_TABLE_SUFFIX_ID = "_PROPERTY_TABLE_ID"; private final VBox linesVBox = new VBox(5); - private final FlowPane countersFlowPane = FlowPaneBuilder.create().vgap(5).hgap(5).build(); - private final FlowPane listenersFlowPane = FlowPaneBuilder.create().vgap(5).hgap(5).build(); + private final FlowPane countersFlowPane; + private final FlowPane listenersFlowPane; private final Object testedControl; private String domainName; /** @@ -97,6 +96,12 @@ public PropertiesTable(Object testedControl) { super(5); + countersFlowPane = new FlowPane(); + countersFlowPane.setVgap(5); + countersFlowPane.setHgap(5); + listenersFlowPane = new FlowPane(); + listenersFlowPane.setVgap(5); + listenersFlowPane.setHgap(5); this.domainName = DEFAULT_DOMAIN_NAME; this.setId(DEFAULT_DOMAIN_NAME + PROPERTIES_TABLE_SUFFIX_ID); getChildren().add(0, countersFlowPane); @@ -151,7 +156,10 @@ @Override public void addDoublePropertyLine(final DoubleProperty bindableProperty, double min, double max, double initial, Object owningObject) { AbstractPropertyController controller = new PropertyValueController(bindableProperty, testedControl, min, initial, max); - propertyControllers.put(bindableProperty.getName().toUpperCase(), controller); + AbstractPropertyController old_controller = propertyControllers.put(bindableProperty.getName().toUpperCase(), controller); + if (old_controller != null) { + linesVBox.getChildren().remove(old_controller.getVisualRepresentation()); + } linesVBox.getChildren().add(controller.getVisualRepresentation()); } --- old/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/PropertyTablesFactory.java 2016-12-22 11:26:28.485070043 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/PropertyTablesFactory.java 2016-12-22 11:26:28.437069580 +0300 @@ -1,254 +1,256 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.utils.ptables; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.List; -import javafx.beans.property.*; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.scene.Cursor; -import javafx.scene.ImageCursor; -import javafx.scene.Node; -import javafx.scene.control.ContextMenu; -import javafx.scene.control.Label; -import javafx.scene.control.MenuItem; -import javafx.scene.control.TableColumn; -import javafx.scene.control.Tooltip; -import javafx.scene.control.test.utils.ComponentsFactory; -import javafx.scene.image.Image; -import javafx.scene.paint.Color; -import javafx.scene.shape.Circle; -import javafx.scene.shape.PolygonBuilder; -import javafx.scene.shape.Rectangle; -import javafx.scene.text.Font; -import javafx.scene.text.Text; -import java.time.chrono.Chronology; - -/** - * @author Alexander Kirov - * - * NOTION: this class should be instantiated on JavaFX thread. - */ -public class PropertyTablesFactory { - - static ObservableList excludeList = FXCollections.observableArrayList(); - - static { - /* - * These properties are from Node so they are not needed for control - * testing. They can anyway be added manually to the accordiong - * PropertiesTable. - */ - excludeList.addAll("id", "blendMode", "cache", "style", "clip", "cacheHint", "depthTest", - "pickOnBounds", "managed", "layoutX", "layoutY", "layoutZ", "scene", "needsLayout", - "translateX", "translateY", "translateZ", "scaleX", "scaleY", "scaleZ", - "minWidth", "maxWidth", "minHeight", "maxHeight", "impl_showMnemonics"); - } - - private static boolean propertyIsExculded(String propertyName) { - return excludeList.contains(propertyName); - } - - public static void explorePropertiesList(Object control, PropertiesTable tb) { - Method[] all_methods = control.getClass().getMethods(); - for (Method method : all_methods) { - try { - if (method.getName().endsWith("Property")) { - String propertyName = method.getName().substring(0, method.getName().indexOf("Property")); - if (!propertyIsExculded(propertyName)) { - Class storedObjectClass = null; - - try { - Method getter = control.getClass().getMethod("get" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1, propertyName.length())); - storedObjectClass = getter.getReturnType(); - } catch (Exception ex) { - } - - if (method.getReturnType() == ObjectProperty.class) { - if ((method.getReturnType().getGenericInterfaces().length > 0)) { - if (storedObjectClass == Tooltip.class) { - provideTooltipObjectEnumPropertyLine((ObjectProperty) method.invoke(control), tb, control); - } - - if (storedObjectClass == Comparator.class) { - provideComparatorPropertyLine((ObjectProperty) method.invoke(control), tb, control); - } - - if (storedObjectClass == ContextMenu.class) { - provideContextMenuObjectEnumPropertyLine((ObjectProperty) method.invoke(control), tb, control); - } - - if (storedObjectClass == Cursor.class) { - provideCursorObjectEnumPropertyLine((ObjectProperty) method.invoke(control), tb, control); - } - - if (storedObjectClass == Font.class) { - provideFontObjectEnumPropertyLine((ObjectProperty) method.invoke(control), tb, control); - } - - if (storedObjectClass == Node.class) { - provideCustomNodeObjectEnumPropertyLine((ObjectProperty) method.invoke(control), tb, control); - } - - if (storedObjectClass == Chronology.class) { - provideChronologyObjectEnumPropertyLine((ObjectProperty) method.invoke(control), tb, control); - } - - if (!(storedObjectClass == null) && storedObjectClass.isEnum()) { - tb.addObjectEnumPropertyLine((ObjectProperty) method.invoke(control), Arrays.asList(storedObjectClass.getEnumConstants()), control); - } - } - } - if (method.getReturnType() == DoubleProperty.class) { - PropertiesConstraints.NumericConstraints constr = PropertiesConstraints.getNumericConstraint(propertyName); - tb.addDoublePropertyLine((DoubleProperty) method.invoke(control), constr.min, constr.max, constr.default_value, control); - } - if (method.getReturnType() == IntegerProperty.class) { - PropertiesConstraints.NumericConstraints constr = PropertiesConstraints.getNumericConstraint(propertyName); - tb.addIntegerPropertyLine((IntegerProperty) method.invoke(control), (int) Math.round(constr.min), (int) Math.round(constr.max), (int) Math.round(constr.default_value)); - } - if (method.getReturnType() == StringProperty.class) { - tb.addStringLine((Property) method.invoke(control), "Some text"); - } - if (method.getReturnType() == BooleanProperty.class) { - tb.addBooleanPropertyLine((Property) method.invoke(control), control); - } - - try { - Object ob = method.invoke(control); - if (ob.getClass().getName().contains("ReadOnly")) { - tb.addSimpleListener((ReadOnlyProperty) ob, control); - } - } catch (Exception ex) { - } - } - } - } catch (Throwable ex) { - System.err.println("Was an error, on invoke the method : " + method + ", parsing control " + control); - ex.printStackTrace(System.out); - } - } - } - - public static void provideFontObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) { - List possibleFonts = new ArrayList(); - possibleFonts.add(null); - possibleFonts.add(new Font(20)); - possibleFonts.add(new Font("ArialW7", 15)); - possibleFonts.add(new Font("Verdana", 10)); - tb.addObjectEnumPropertyLine(property, possibleFonts, owningObject); - } - - public static Tooltip provideTooltipObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) { - Tooltip tp = new Tooltip("Tooltip"); - List possibleTooltips = new ArrayList(); - possibleTooltips.add(null); - possibleTooltips.add(tp); - tb.addObjectEnumPropertyLine(property, possibleTooltips, owningObject); - return tp; - } - - public static ContextMenu provideContextMenuObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) { - ContextMenu cm = new ContextMenu(); - cm.getItems().add(new MenuItem("SomeItem")); - List possibleMenus = new ArrayList(); - possibleMenus.add(null); - possibleMenus.add(cm); - tb.addObjectEnumPropertyLine(property, possibleMenus, owningObject); - return cm; - } - - public static void provideCustomNodeObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) { - List possibleNodes = new ArrayList(); - possibleNodes.add(null); - possibleNodes.add(new Text("This is custom node")); - possibleNodes.add(new Label("Label text", new Text("Label node"))); - possibleNodes.add(new Rectangle(0, 0, 10, 10)); - possibleNodes.add(ComponentsFactory.createCustomContent(25, 25)); - possibleNodes.add(new Circle(6.75, Color.RED)); - possibleNodes.add(PolygonBuilder.create().fill(Color.GREEN).points(new Double[]{ - 0.0, 7.0, - 5.0, 20.0, - 15.0, 20.0, - 20.0, 7.0, - 10.0, 0.0,}).build()); - tb.addObjectEnumPropertyLine(property, possibleNodes, owningObject); - } - -// public static void provideChronologyObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) { -// List possibleChronologies = new ArrayList(); -// possibleChronologies.add(null); -// possibleChronologies.addAll(java.time.chrono.Chronology.getAvailableChronologies()); -// tb.addObjectEnumPropertyLine(property, possibleChronologies, owningObject); -// } - - public static Cursor provideCursorObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) { - ImageCursor c1 = new ImageCursor(new Image("https://svn.java.net/svn/fxtest-golden~images-svn/ControlsTests/JavaProgBarInd80x80.gif")); - List possibleTooltips = new ArrayList(); - possibleTooltips.add(null); - possibleTooltips.add(c1); - tb.addObjectEnumPropertyLine(property, possibleTooltips, owningObject); - return c1; - } - - public static void provideComparatorPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) { - List possibleComparators = new ArrayList(); - possibleComparators.add(null); - possibleComparators.add(new CustomReversedComparator()); - possibleComparators.add(TableColumn.DEFAULT_COMPARATOR); - tb.addObjectEnumPropertyLine(property, possibleComparators, owningObject); - } - - private static void provideChronologyObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object control) { - ArrayList values = new ArrayList(); - values.add(null); - values.add(Chronology.of("ISO")); - values.add(Chronology.of("Minguo")); - values.add(Chronology.of("ThaiBuddhist")); - values.add(Chronology.of("Japanese")); - values.add(Chronology.of("Hijrah-umalqura")); - - tb.addObjectEnumPropertyLine(property, values, control); - } - - public static class CustomReversedComparator implements Comparator { - //This is reversed comparator. - - public static final String comparatorName = "Custom reversed comparator"; - - public int compare(Object t1, Object t2) { - return -t1.toString().compareTo(t2.toString()); - } - - @Override - public String toString() { - return comparatorName; - } - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.utils.ptables; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; +import javafx.beans.property.*; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.scene.Cursor; +import javafx.scene.ImageCursor; +import javafx.scene.Node; +import javafx.scene.control.ContextMenu; +import javafx.scene.control.Label; +import javafx.scene.control.MenuItem; +import javafx.scene.control.TableColumn; +import javafx.scene.control.Tooltip; +import javafx.scene.control.test.utils.ComponentsFactory; +import javafx.scene.image.Image; +import javafx.scene.paint.Color; +import javafx.scene.shape.Circle; +import javafx.scene.shape.Rectangle; +import javafx.scene.text.Font; +import javafx.scene.text.Text; +import java.time.chrono.Chronology; +import javafx.scene.shape.Polygon; + +/** + * @author Alexander Kirov + * + * NOTION: this class should be instantiated on JavaFX thread. + */ +public class PropertyTablesFactory { + + static ObservableList excludeList = FXCollections.observableArrayList(); + + static { + /* + * These properties are from Node so they are not needed for control + * testing. They can anyway be added manually to the accordiong + * PropertiesTable. + */ + excludeList.addAll("id", "blendMode", "cache", "style", "clip", "cacheHint", "depthTest", + "pickOnBounds", "managed", "layoutX", "layoutY", "layoutZ", "scene", "needsLayout", + "translateX", "translateY", "translateZ", "scaleX", "scaleY", "scaleZ", + "minWidth", "maxWidth", "minHeight", "maxHeight", "impl_showMnemonics"); + } + + private static boolean propertyIsExculded(String propertyName) { + return excludeList.contains(propertyName); + } + + public static void explorePropertiesList(Object control, PropertiesTable tb) { + Method[] all_methods = control.getClass().getMethods(); + for (Method method : all_methods) { + try { + if (method.getName().endsWith("Property")) { + String propertyName = method.getName().substring(0, method.getName().indexOf("Property")); + if (!propertyIsExculded(propertyName)) { + Class storedObjectClass = null; + + try { + Method getter = control.getClass().getMethod("get" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1, propertyName.length())); + storedObjectClass = getter.getReturnType(); + } catch (Exception ex) { + } + + if (method.getReturnType() == ObjectProperty.class) { + if ((method.getReturnType().getGenericInterfaces().length > 0)) { + if (storedObjectClass == Tooltip.class) { + provideTooltipObjectEnumPropertyLine((ObjectProperty) method.invoke(control), tb, control); + } + + if (storedObjectClass == Comparator.class) { + provideComparatorPropertyLine((ObjectProperty) method.invoke(control), tb, control); + } + + if (storedObjectClass == ContextMenu.class) { + provideContextMenuObjectEnumPropertyLine((ObjectProperty) method.invoke(control), tb, control); + } + + if (storedObjectClass == Cursor.class) { + provideCursorObjectEnumPropertyLine((ObjectProperty) method.invoke(control), tb, control); + } + + if (storedObjectClass == Font.class) { + provideFontObjectEnumPropertyLine((ObjectProperty) method.invoke(control), tb, control); + } + + if (storedObjectClass == Node.class) { + provideCustomNodeObjectEnumPropertyLine((ObjectProperty) method.invoke(control), tb, control); + } + + if (storedObjectClass == Chronology.class) { + provideChronologyObjectEnumPropertyLine((ObjectProperty) method.invoke(control), tb, control); + } + + if (!(storedObjectClass == null) && storedObjectClass.isEnum()) { + tb.addObjectEnumPropertyLine((ObjectProperty) method.invoke(control), Arrays.asList(storedObjectClass.getEnumConstants()), control); + } + } + } + if (method.getReturnType() == DoubleProperty.class) { + PropertiesConstraints.NumericConstraints constr = PropertiesConstraints.getNumericConstraint(propertyName); + tb.addDoublePropertyLine((DoubleProperty) method.invoke(control), constr.min, constr.max, constr.default_value, control); + } + if (method.getReturnType() == IntegerProperty.class) { + PropertiesConstraints.NumericConstraints constr = PropertiesConstraints.getNumericConstraint(propertyName); + tb.addIntegerPropertyLine((IntegerProperty) method.invoke(control), (int) Math.round(constr.min), (int) Math.round(constr.max), (int) Math.round(constr.default_value)); + } + if (method.getReturnType() == StringProperty.class) { + tb.addStringLine((Property) method.invoke(control), "Some text"); + } + if (method.getReturnType() == BooleanProperty.class) { + tb.addBooleanPropertyLine((Property) method.invoke(control), control); + } + + try { + Object ob = method.invoke(control); + if (ob.getClass().getName().contains("ReadOnly")) { + tb.addSimpleListener((ReadOnlyProperty) ob, control); + } + } catch (Exception ex) { + } + } + } + } catch (Throwable ex) { + System.err.println("Was an error, on invoke the method : " + method + ", parsing control " + control); + ex.printStackTrace(System.out); + } + } + } + + public static void provideFontObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) { + List possibleFonts = new ArrayList(); + possibleFonts.add(null); + possibleFonts.add(new Font(20)); + possibleFonts.add(new Font("ArialW7", 15)); + possibleFonts.add(new Font("Verdana", 10)); + tb.addObjectEnumPropertyLine(property, possibleFonts, owningObject); + } + + public static Tooltip provideTooltipObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) { + Tooltip tp = new Tooltip("Tooltip"); + List possibleTooltips = new ArrayList(); + possibleTooltips.add(null); + possibleTooltips.add(tp); + tb.addObjectEnumPropertyLine(property, possibleTooltips, owningObject); + return tp; + } + + public static ContextMenu provideContextMenuObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) { + ContextMenu cm = new ContextMenu(); + cm.getItems().add(new MenuItem("SomeItem")); + List possibleMenus = new ArrayList(); + possibleMenus.add(null); + possibleMenus.add(cm); + tb.addObjectEnumPropertyLine(property, possibleMenus, owningObject); + return cm; + } + + public static void provideCustomNodeObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) { + List possibleNodes = new ArrayList(); + possibleNodes.add(null); + possibleNodes.add(new Text("This is custom node")); + possibleNodes.add(new Label("Label text", new Text("Label node"))); + possibleNodes.add(new Rectangle(0, 0, 10, 10)); + possibleNodes.add(ComponentsFactory.createCustomContent(25, 25)); + possibleNodes.add(new Circle(6.75, Color.RED)); + Polygon temp = new Polygon(new double[]{ + 0.0, 7.0, + 5.0, 20.0, + 15.0, 20.0, + 20.0, 7.0, + 10.0, 0.0,}); + temp.setFill(Color.GREEN); + possibleNodes.add(temp); + tb.addObjectEnumPropertyLine(property, possibleNodes, owningObject); + } + +// public static void provideChronologyObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) { +// List possibleChronologies = new ArrayList(); +// possibleChronologies.add(null); +// possibleChronologies.addAll(java.time.chrono.Chronology.getAvailableChronologies()); +// tb.addObjectEnumPropertyLine(property, possibleChronologies, owningObject); +// } + + public static Cursor provideCursorObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) { + ImageCursor c1 = new ImageCursor(new Image("https://svn.java.net/svn/fxtest-golden~images-svn/ControlsTests/JavaProgBarInd80x80.gif")); + List possibleTooltips = new ArrayList(); + possibleTooltips.add(null); + possibleTooltips.add(c1); + tb.addObjectEnumPropertyLine(property, possibleTooltips, owningObject); + return c1; + } + + public static void provideComparatorPropertyLine(ObjectProperty property, PropertiesTable tb, Object owningObject) { + List possibleComparators = new ArrayList(); + possibleComparators.add(null); + possibleComparators.add(new CustomReversedComparator()); + possibleComparators.add(TableColumn.DEFAULT_COMPARATOR); + tb.addObjectEnumPropertyLine(property, possibleComparators, owningObject); + } + + private static void provideChronologyObjectEnumPropertyLine(ObjectProperty property, PropertiesTable tb, Object control) { + ArrayList values = new ArrayList(); + values.add(null); + values.add(Chronology.of("ISO")); + values.add(Chronology.of("Minguo")); + values.add(Chronology.of("ThaiBuddhist")); + values.add(Chronology.of("Japanese")); + values.add(Chronology.of("Hijrah-umalqura")); + + tb.addObjectEnumPropertyLine(property, values, control); + } + + public static class CustomReversedComparator implements Comparator { + //This is reversed comparator. + + public static final String comparatorName = "Custom reversed comparator"; + + public int compare(Object t1, Object t2) { + return -t1.toString().compareTo(t2.toString()); + } + + @Override + public String toString() { + return comparatorName; + } + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/PropertyValueListener.java 2016-12-22 11:26:28.681071934 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/PropertyValueListener.java 2016-12-22 11:26:28.629071432 +0300 @@ -28,13 +28,11 @@ import javafx.beans.property.ReadOnlyProperty; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; -import javafx.scene.control.LabelBuilder; +import javafx.scene.control.Label; import javafx.scene.control.TextField; -import javafx.scene.control.TextFieldBuilder; import javafx.scene.control.Tooltip; -import javafx.scene.control.TreeTableColumn; -import javafx.scene.layout.HBox; import static javafx.scene.control.test.utils.ptables.StaticLogger.*; +import javafx.scene.layout.HBox; /** * @author Alexander Kirov @@ -57,7 +55,7 @@ public final static String LISTENER_SUFFIX = "_LISTENER_ID"; private ReadOnlyProperty listenedProperty; private Object owningObject; - private TextField receivedValueTF = TextFieldBuilder.create().minWidth(50).maxWidth(110).build(); + private TextField receivedValueTF = new TextField(); private boolean someStateWasRemembered = false; private ValueType rememberedState = null; private int rememberedChangeCountValue = -1; @@ -77,6 +75,8 @@ public PropertyValueListener(String labelDescription, ReadOnlyProperty listenedProperty, String textFieldId, Object owningObject, Boolean showCounters) { this.owningObject = owningObject; + receivedValueTF.setMinWidth(50); + receivedValueTF.setMaxWidth(110); receivedValueTF.setId(textFieldId); receivedValueTF.setTooltip(new Tooltip()); if (listenedProperty.getName().contains("BOUNDS")) { @@ -85,7 +85,9 @@ } this.listenedProperty = listenedProperty; counter = new PropertyValueCounter(listenedProperty); - getChildren().add(LabelBuilder.create().text(labelDescription).prefWidth(100).build()); + Label temp = new Label(labelDescription); + temp.setPrefWidth(100); + getChildren().add(temp); if (showCounters) { getChildren().add(counter.getVisualRepresentation()); } --- old/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/StringPropertyValueSetter.java 2016-12-22 11:26:28.869073747 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/StringPropertyValueSetter.java 2016-12-22 11:26:28.817073245 +0300 @@ -1,65 +1,65 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.utils.ptables; - -import javafx.beans.property.Property; -import javafx.scene.Node; -import javafx.scene.control.TextField; -import javafx.scene.control.TextFieldBuilder; -import static javafx.scene.control.test.utils.ptables.StaticLogger.*; - -/** - * @author Alexander Kirov - * - * Implementation to control StringProperty using TextField. - */ -public class StringPropertyValueSetter extends AbstractPropertyValueSetter { - - public StringPropertyValueSetter(Property listeningProperty, BindingType btype, Object testedControl, String initialString) { - try { - final TextField tf = TextFieldBuilder.create().text(initialString).id(createId(listeningProperty, btype)).build(); - this.leadingControl = tf; - this.leadingProperty = (Property) tf.textProperty(); - this.listeningProperty = listeningProperty; - tf.setId(createId(listeningProperty, btype)); - - propertyValueType = PropertyValueType.STRING; - initialValue1 = initialString; - - bindComponent(btype, testedControl); - } catch (Throwable ex) { - log(ex); - } - } - - public void refresh() { - setBindingState(Boolean.FALSE); - leadingProperty.setValue((String) initialValue1); - } - - public Node getVisualRepresentation() { - return this; - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.utils.ptables; + +import javafx.beans.property.Property; +import javafx.scene.Node; +import javafx.scene.control.TextField; +import static javafx.scene.control.test.utils.ptables.StaticLogger.*; + +/** + * @author Alexander Kirov + * + * Implementation to control StringProperty using TextField. + */ +public class StringPropertyValueSetter extends AbstractPropertyValueSetter { + + public StringPropertyValueSetter(Property listeningProperty, BindingType btype, Object testedControl, String initialString) { + try { + final TextField tf = new TextField(initialString); + tf.setId(createId(listeningProperty, btype)); + this.leadingControl = tf; + this.leadingProperty = (Property) tf.textProperty(); + this.listeningProperty = listeningProperty; + tf.setId(createId(listeningProperty, btype)); + + propertyValueType = PropertyValueType.STRING; + initialValue1 = initialString; + + bindComponent(btype, testedControl); + } catch (Throwable ex) { + log(ex); + } + } + + public void refresh() { + setBindingState(Boolean.FALSE); + leadingProperty.setValue((String) initialValue1); + } + + public Node getVisualRepresentation() { + return this; + } +} --- old/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/TextFieldEventsCounter.java 2016-12-22 11:26:29.057075560 +0300 +++ new/functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/TextFieldEventsCounter.java 2016-12-22 11:26:29.005075059 +0300 @@ -1,128 +1,129 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.utils.ptables; - -import javafx.beans.property.IntegerProperty; -import javafx.beans.property.SimpleIntegerProperty; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; -import javafx.scene.Node; -import javafx.scene.control.Label; -import javafx.scene.control.LabelBuilder; -import javafx.scene.control.TextField; -import javafx.scene.control.TextFieldBuilder; -import static javafx.scene.control.test.utils.ptables.StaticLogger.*; -import javafx.scene.control.test.utils.ptables.TextFieldEventsCounter.Count; -import javafx.scene.layout.HBox; -import javafx.scene.text.Text; - -/** - * @author Alexander Kirov - */ -public class TextFieldEventsCounter extends HBox implements AbstractEventsCounter { - - final private IntegerProperty counter = new SimpleIntegerProperty(0); - public static final String COUNTER_SUFFIX = "_COUNTER_TEXT_FIELD_ID"; - private Count rememberedCount; - private String counterName; - - public TextFieldEventsCounter(final String counterName) { - if (counterName == null) { - throw new IllegalArgumentException("Counter name cannot be null."); - } - try { - this.counterName = counterName; - Label label = LabelBuilder.create().text(counterName + " : ").prefWidth((new Text(counterName + " : ")).getBoundsInParent().getWidth() + 30).build(); - final TextField tf = TextFieldBuilder.create().text("0").prefWidth(50).id(counterName.toUpperCase() + COUNTER_SUFFIX).build(); - counter.addListener(new ChangeListener() { - public void changed(ObservableValue ov, Number t, Number t1) { - log("Counter " + counterName + ": new value : <" + t1 + ">."); - tf.setText(t1.toString()); - } - }); - getChildren().addAll(label, tf); - } catch (Throwable ex) { - log(ex); - } - } - - public int getCurrentValue() { - return counter.getValue(); - } - - public void increment() { - increment(1); - } - - public void increment(int increment) { - try { - counter.setValue(counter.getValue() + increment); - } catch (Throwable ex) { - log(ex); - } - } - - public Node getVisualRepresentation() { - return this; - } - - public void refresh() { - try { - counter.setValue(0); - } catch (Throwable ex) { - log(ex); - } - } - - public void rememberCurrentState() { - this.rememberedCount = new Count(getCurrentValue()); - } - - public void checkCurrentStateEquality() throws StateChangedException { - if (rememberedCount == null) { - throw new IllegalStateException("Before comparation, some state must be remembered"); - } - rememberedCount.compareOnEquality(new Count(getCurrentValue())); - } - - public String getName() { - return counterName; - } - - public class Count { - - private final int count; - - public Count(int count) { - this.count = count; - } - - public void compareOnEquality(Count newCount) throws StateChangedException { - if (newCount.count != this.count) { - throw new StateChangedException("Counter comparation error : expect to find <" + count + ">, but has found : <" + newCount.count + ">."); - } - } - } -} +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package javafx.scene.control.test.utils.ptables; + +import javafx.beans.property.IntegerProperty; +import javafx.beans.property.SimpleIntegerProperty; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.scene.Node; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import static javafx.scene.control.test.utils.ptables.StaticLogger.*; +import javafx.scene.control.test.utils.ptables.TextFieldEventsCounter.Count; +import javafx.scene.layout.HBox; +import javafx.scene.text.Text; + +/** + * @author Alexander Kirov + */ +public class TextFieldEventsCounter extends HBox implements AbstractEventsCounter { + + final private IntegerProperty counter = new SimpleIntegerProperty(0); + public static final String COUNTER_SUFFIX = "_COUNTER_TEXT_FIELD_ID"; + private Count rememberedCount; + private String counterName; + + public TextFieldEventsCounter(final String counterName) { + if (counterName == null) { + throw new IllegalArgumentException("Counter name cannot be null."); + } + try { + this.counterName = counterName; + Label label = new Label(counterName + " : "); + label.setPrefWidth((new Text(counterName + " : ")).getBoundsInParent().getWidth() + 30); + final TextField tf = new TextField("0"); + tf.setPrefWidth(50); + tf.setId(counterName.toUpperCase() + COUNTER_SUFFIX); + counter.addListener(new ChangeListener() { + public void changed(ObservableValue ov, Number t, Number t1) { + log("Counter " + counterName + ": new value : <" + t1 + ">."); + tf.setText(t1.toString()); + } + }); + getChildren().addAll(label, tf); + } catch (Throwable ex) { + log(ex); + } + } + + public int getCurrentValue() { + return counter.getValue(); + } + + public void increment() { + increment(1); + } + + public void increment(int increment) { + try { + counter.setValue(counter.getValue() + increment); + } catch (Throwable ex) { + log(ex); + } + } + + public Node getVisualRepresentation() { + return this; + } + + public void refresh() { + try { + counter.setValue(0); + } catch (Throwable ex) { + log(ex); + } + } + + public void rememberCurrentState() { + this.rememberedCount = new Count(getCurrentValue()); + } + + public void checkCurrentStateEquality() throws StateChangedException { + if (rememberedCount == null) { + throw new IllegalStateException("Before comparation, some state must be remembered"); + } + rememberedCount.compareOnEquality(new Count(getCurrentValue())); + } + + public String getName() { + return counterName; + } + + public class Count { + + private final int count; + + public Count(int count) { + this.count = count; + } + + public void compareOnEquality(Count newCount) throws StateChangedException { + if (newCount.count != this.count) { + throw new StateChangedException("Counter comparation error : expect to find <" + count + ">, but has found : <" + newCount.count + ">."); + } + } + } +} --- old/functional/ControlsTests/src/javafx/scrollEvent/ScrollEventApp.java 2016-12-22 11:26:29.273077645 +0300 +++ new/functional/ControlsTests/src/javafx/scrollEvent/ScrollEventApp.java 2016-12-22 11:26:29.197076911 +0300 @@ -38,14 +38,15 @@ import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Button; -import javafx.scene.control.ButtonBuilder; import javafx.scene.control.CheckBox; import javafx.scene.control.ChoiceBox; +import javafx.scene.control.ComboBox; import javafx.scene.control.ContextMenu; +import javafx.scene.control.Control; +import javafx.scene.control.DatePicker; import javafx.scene.control.Label; import javafx.scene.control.MenuItem; import javafx.scene.control.TextField; -import javafx.scene.control.TextFieldBuilder; import javafx.scene.input.ContextMenuEvent; import javafx.scene.input.ScrollEvent; import javafx.scene.layout.FlowPane; @@ -96,13 +97,14 @@ private Node createNodeChooser() { VBox vb = new VBox(5); Label scrollEventCame = new Label("Scroll event came : "); - final TextField eventComeIndicator = TextFieldBuilder.create().text("None").id(EVENT_COME_INDICATOR_TEXT_FIELD_ID).build(); + final TextField eventComeIndicator = new TextField("None"); + eventComeIndicator.setId(EVENT_COME_INDICATOR_TEXT_FIELD_ID); HBox hb = new HBox(); hb.getChildren().addAll(scrollEventCame, eventComeIndicator); - Button resetButton = ButtonBuilder.create().text("Reset").id(RESET_BUTTON_ID).build(); + Button resetButton = new Button("Reset"); + resetButton.setId(RESET_BUTTON_ID); resetButton.setOnAction(new EventHandler() { - public void handle(ActionEvent t) { eventComeIndicator.setText("None"); clearListenersState(); @@ -140,7 +142,7 @@ } }); } else { - node.setOnContextMenuRequested(new EventHandler() { + EventHandler handler = new EventHandler() { public void handle(ContextMenuEvent t) { renewListenerValue("eventType", t.getEventType()); renewListenerValue("consumed", t.isConsumed()); @@ -149,13 +151,30 @@ getContextMenu().show(node, t.getScreenX(), t.getScreenY()); t.consume(); } - }); + }; + node.setOnContextMenuRequested(handler); + TextField editor = null; + if (node instanceof DatePicker) { + editor = ((DatePicker)node).getEditor(); + } + if (node instanceof ComboBox) { + editor = ((ComboBox)node).getEditor(); + } + if (editor != null) { + editor.setOnContextMenuRequested(handler); + } } node.setId(ID_TARGET_NODE); spaceForNode.getChildren().clear(); spaceForNode.getChildren().add(node); - + node.setPickOnBounds(true); + if (node instanceof Control) { + ((Control)node).setPrefWidth(200); + ((Control)node).setPrefHeight(200); + ((Control)node).setMinWidth(200); + ((Control)node).setMinHeight(200); + } clearListenersState(); } }); @@ -196,7 +215,8 @@ private HBox getListener(String name) { HBox hb = new HBox(); Label label = new Label(name + " : "); - TextField tf = TextFieldBuilder.create().id(getListenerTextFieldID(name)).build(); + TextField tf = new TextField(); + tf.setId(getListenerTextFieldID(name)); hm.put(name, tf); hb.getChildren().addAll(label, tf); --- old/functional/ControlsTests/test/javafx/scene/control/test/ListView/NewListViewTest.java 2016-12-22 11:26:29.469079534 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/ListView/NewListViewTest.java 2016-12-22 11:26:29.417079033 +0300 @@ -239,8 +239,6 @@ requestFocusOnControl(testedControl); - testedControl.keyboard().pushKey(KeyboardButtons.DOWN); - testedControl.keyboard().pressKey(KeyboardButtons.SHIFT); try { for (int i = 1; i < 5; i++) { @@ -314,10 +312,10 @@ } private void checkScrollingState(final double scrollValue, boolean beginVisible, boolean endVisible, int size, final Orientation orientation) { - //assertEquals(findScrollBar(testedControl.as(Parent.class, Node.class), orientation, true).getControl().getValue(), scrollValue, 0.01); + //assertEquals(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), orientation, true).getControl().getValue(), scrollValue, 0.01); testedControl.waitState(new State() { public Object reached() { - Wrap sb = findScrollBar(testedControl.as(Parent.class, Node.class), orientation, true); + Wrap sb = findScrollBar((Parent) testedControl.as(Parent.class, Node.class), orientation, true); if (Math.abs(sb.getControl().getValue() - scrollValue) < 0.01) { return true; } else { @@ -370,16 +368,16 @@ @Test(timeout = 300000) public void verticalScrollBarBehaviorOnAddingDeletingTest() throws InterruptedException { setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 50); - assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null); + assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null); addElements(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); - assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true) == null); + assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true) == null); setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 500); - assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null); + assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null); setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 50); for (int i = 0; i < 10; i++) { removeFromPos(0); } - assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null); + assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null); } //Test//RT-17538//Test removed, as non actual (bug - is not a bug). @@ -390,11 +388,11 @@ addTextFieldAtPos(1); addRectangleAtPos(2); - Wrap sb = findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true); + Wrap sb = findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true); ScrollingChecker sc = new ScrollingChecker(sb.getControl().valueProperty()); testedControl.mouse().move(); for (int i = 0; i < 8; i++) { - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+1); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+1); sc.checkChanging(+1); } } @@ -460,8 +458,8 @@ setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, Orientation.HORIZONTAL, Properties.orientation); - checkScreenshot("ListView_scrollBarSize1Test_HorizontalScroll_1", findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true)); - checkScreenshot("ListView_scrollBarSize1Test_VerticalScroll_1", findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true)); + checkScreenshot("ListView_scrollBarSize1Test_HorizontalScroll_1", findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true)); + checkScreenshot("ListView_scrollBarSize1Test_VerticalScroll_1", findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true)); throwScreenshotError(); } @@ -473,7 +471,7 @@ addRectangleAtPos(0); addRectangleAtPos(0); - checkScreenshot("ListView_HorizontalScroll_2", findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true)); + checkScreenshot("ListView_HorizontalScroll_2", findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true)); throwScreenshotError(); } @@ -487,10 +485,10 @@ addRectangleAtPos(0); for (int i = 0; i < 100; i++) { - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+1); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+1); } - assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true) == null); + assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true) == null); } @ScreenshotCheck @@ -517,9 +515,10 @@ setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, Orientation.HORIZONTAL, Properties.orientation); setSize(150, 150); addRectangleAtPos(0); - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+20); + int scroll_value = Utils.isMacOS() ? -20 : +20; + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(scroll_value); - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+20); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(scroll_value); checkScreenshot("ListView_ScrollingIssue_1", testedControl); throwScreenshotError(); @@ -534,15 +533,15 @@ Thread.sleep(500); for (int i = 0; i < 20; i++) { - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+1); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+1); } for (int i = 0; i < 20; i++) { - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+1); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+1); } setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, Orientation.HORIZONTAL, Properties.orientation); - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+20); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+20); checkScreenshot("ListView_ScrollingIssue_2", testedControl); throwScreenshotError(); } @@ -554,8 +553,8 @@ setSize(150, 150); addRectangleAtPos(0); - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+20); - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+20); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+20); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+20); checkScreenshot("ListView_ScrollingIssue_3", testedControl); throwScreenshotError(); } @@ -569,13 +568,13 @@ testedControl.keyboard().pushKey(KeyboardButtons.DOWN); testedControl.keyboard().pushKey(KeyboardButtons.DOWN); - checkListener(Listeners.focusedIndex, 1); - addElement("0", 0); checkListener(Listeners.focusedIndex, 2); - addElement("0", 2); + addElement("0", 0); checkListener(Listeners.focusedIndex, 3); + addElement("0", 2); + checkListener(Listeners.focusedIndex, 4); addElement("0", 4); - checkListener(Listeners.focusedIndex, 3); + checkListener(Listeners.focusedIndex, 5); } //Test//RT-17539//Test removed because developers don't count size of content. @@ -589,12 +588,12 @@ checkScreenshot("ListView_ScrollBarKnobSizeIssue_1", testedControl); for (int i = 0; i < 20; i++) { - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+1); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+1); } checkScreenshot("ListView_ScrollBarKnobSizeIssue_2", testedControl); - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+10); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+10); checkScreenshot("ListView_ScrollBarKnobSizeIssue_3", testedControl); throwScreenshotError(); @@ -614,12 +613,6 @@ requestFocusOnControl(testedControl); - Thread.sleep(SLEEP); - - testedControl.keyboard().pushKey(KeyboardButtons.DOWN); - - Thread.sleep(SLEEP); - //Testing section try { for (int i = 0; i < 5; i++) { @@ -652,18 +645,12 @@ setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, SelectionMode.MULTIPLE, Properties.selectionMode); setSize(130, 130); - selectionHelper = new MultipleSelectionHelper(1, DATA_ITEMS_NUM); + selectionHelper = new MultipleSelectionHelper(1, 10); selectionHelper.setSingleCell(false); selectionHelper.setMultiple(true); requestFocusOnControl(testedControl); - Thread.sleep(SLEEP); - - testedControl.keyboard().pushKey(KeyboardButtons.DOWN); - - Thread.sleep(SLEEP); - //Testing section try { for (int i = 0; i < 2; i++) { @@ -733,12 +720,6 @@ requestFocusOnControl(testedControl); - Thread.sleep(SLEEP); - - testedControl.keyboard().pushKey(KeyboardButtons.DOWN); - - Thread.sleep(SLEEP); - //Testing section try { for (int i = 0; i < 2; i++) { @@ -786,12 +767,6 @@ requestFocusOnControl(testedControl); - Thread.sleep(SLEEP); - - testedControl.keyboard().pushKey(KeyboardButtons.DOWN); - - Thread.sleep(SLEEP); - //Testing section try { for (int i = 0; i < 2; i++) { @@ -899,6 +874,7 @@ setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 200); setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefWidth, 200); setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, SelectionMode.MULTIPLE, Properties.selectionMode); + selectionHelper.setMultiple(true); setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, Orientation.HORIZONTAL, Properties.orientation); final int elementsCount = 50; @@ -910,6 +886,8 @@ Wrap cellWrap = getCellWrap((Integer) (0)); //mouse will be over the second item. cellWrap.as(Showable.class).shower().show(); cellWrap.mouse().click(1, cellWrap.getClickPoint(), Mouse.MouseButtons.BUTTON1, CTRL_DOWN_MASK_OS); + selectionHelper.click(0, 0, KeyboardButtons.CONTROL); + checkSelection(); KeyboardButtons lessKey = (orientation == Orientation.HORIZONTAL ? KeyboardButtons.LEFT : KeyboardButtons.UP); KeyboardButtons moreKey = (orientation == Orientation.HORIZONTAL ? KeyboardButtons.RIGHT : KeyboardButtons.DOWN); --- old/functional/ControlsTests/test/javafx/scene/control/test/ListView/TestBase.java 2016-12-22 11:26:29.673081502 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/ListView/TestBase.java 2016-12-22 11:26:29.621081001 +0300 @@ -49,6 +49,7 @@ import org.jemmy.fx.control.ListItemWrap.ListItemByObjectLookup; import org.jemmy.interfaces.Keyboard.KeyboardButtons; import org.jemmy.interfaces.Keyboard.KeyboardModifiers; +import static org.jemmy.interfaces.Keyboard.KeyboardModifiers.META_DOWN_MASK; import org.jemmy.interfaces.Mouse; import org.jemmy.interfaces.Parent; import org.jemmy.interfaces.Selectable; @@ -235,8 +236,8 @@ * Checks visibility states of horizontal and vertical scrollBars. */ protected void checkScrollbarsStates(boolean horizontalVisibility, boolean verticalVisibility) { - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, horizontalVisibility) == null); - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, verticalVisibility) == null); + Assert.assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, horizontalVisibility) == null); + Assert.assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, verticalVisibility) == null); } /** @@ -261,9 +262,13 @@ @Override public void run(Object... os) throws Exception { ListView lv = (ListView) os[0]; + selectionHelper.setRowsNum(elemCount); for (int i = 0; i < elemCount; i++) { if (Integer.valueOf((String) lv.getItems().get(i)) % 2 == 0) { lv.getSelectionModel().select(i); + selectionHelper.push(KeyboardButtons.SPACE, KeyboardModifiers.CTRL_DOWN_MASK); + selectionHelper.push(KeyboardButtons.DOWN, KeyboardModifiers.CTRL_DOWN_MASK); + selectionHelper.push(KeyboardButtons.DOWN, KeyboardModifiers.CTRL_DOWN_MASK); } } } @@ -273,10 +278,10 @@ protected void checkScreenshotsWithStep(String name, final int elementsCount, final int step) throws Throwable { Wrap cellWrap = getCellWrap((Integer) (0)); //mouse will be over the second item. cellWrap.as(Showable.class).shower().show(); - cellWrap.mouse().click(1, cellWrap.getClickPoint(), Mouse.MouseButtons.BUTTON1, CTRL_DOWN_MASK_OS); + cellWrap.mouse().click(1, cellWrap.getClickPoint(), Mouse.MouseButtons.BUTTON1, Utils.isMacOS() ? META_DOWN_MASK : CTRL_DOWN_MASK_OS); for (int i = 0; i < elementsCount / step; i++) { for (int j = 0; j < step; j++) { - testedControl.keyboard().pushKey(KeyboardButtons.RIGHT, CTRL_DOWN_MASK_OS); + testedControl.keyboard().pushKey(KeyboardButtons.RIGHT, Utils.isMacOS() ? META_DOWN_MASK : CTRL_DOWN_MASK_OS); } checkScreenshot("ListView_" + name + "_" + i, testedControl); } @@ -296,6 +301,7 @@ System.out.println(SelectionFormatter.format("Helper selection: ", helper_selected, "Selection: ", selected)); System.out.println("Helper focus : " + helper_selection); System.out.println("Focus : " + selection); + System.out.println("Helper anchor : " + selectionHelper.anchor + "\n\n"); System.out.println("Anchor : " + selectionHelper.anchor + "\n\n"); if (((helper_selected.size() == selected.size()) --- old/functional/ControlsTests/test/javafx/scene/control/test/Mnemonics/LabelsMnemonicsTest.java 2016-12-22 11:26:29.869083393 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/Mnemonics/LabelsMnemonicsTest.java 2016-12-22 11:26:29.817082892 +0300 @@ -46,7 +46,7 @@ /** * Class provides tests for mnemonics behavior. - * According to the Mnemonics spec + * According to the mnemonics spec, * mnemonics are platform specific. Therefore tests design is aimed to * consider the difference between platforms and to avoid boilerplate. * @@ -227,4 +227,4 @@ scene.keyboard().pushKey(KeyboardButtons.ALT); } } -} \ No newline at end of file +} --- old/functional/ControlsTests/test/javafx/scene/control/test/Mnemonics/MnemonicsTestBase.java 2016-12-22 11:26:30.065085284 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/Mnemonics/MnemonicsTestBase.java 2016-12-22 11:26:30.017084821 +0300 @@ -123,9 +123,8 @@ for (int x = 0; x < text_bounds.width; x++) { final Text control = text_wrap.getControl(); final int charIndex = new GetAction() { - @Override public void run(Object... os) throws Exception { - setResult(control.impl_hitTestChar(new Point2D((Integer)os[0], (Integer)os[1] - control.getBaselineOffset())).getCharIndex()); + setResult(control.hitTest(new Point2D((Integer)os[0], (Integer)os[1] - control.getBaselineOffset())).getCharIndex()); } }.dispatch(wrap.getEnvironment(), x, y); if (bounds_array.get(charIndex) == null) { --- old/functional/ControlsTests/test/javafx/scene/control/test/ScrollPane/ScrollPaneTest.java 2016-12-22 11:26:30.257087136 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/ScrollPane/ScrollPaneTest.java 2016-12-22 11:26:30.205086635 +0300 @@ -77,6 +77,9 @@ @Test(timeout = 300000) @Covers(value = {"javafx.scene.control.ScrollPane.vmax.DEFAULT", "javafx.scene.control.ScrollPane.vmax.GET"}, level = Level.FULL) public void checkVMaxOptionTest() throws InterruptedException { + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 100); + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefWidth, 100); + Assert.assertEquals((new ScrollPane()).vmaxProperty().getValue(), 1, commonComparePrecision); setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.vmax, 200); @@ -85,17 +88,17 @@ setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.vvalue, 200); checkTextFieldValue(Properties.vvalue, 200); - Wrap sb1 = findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true); + Wrap sb1 = findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true); sb1.as(AbstractScroll.class).to(0); checkTextFieldValue(Properties.vvalue, 0); - Wrap sb2 = findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true); + Wrap sb2 = findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true); sb2.as(AbstractScroll.class).to(200); checkTextFieldValue(Properties.vvalue, 200); - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(-1 * (Utils.isMacOS() ? -1 : 1)); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(-1 * (Utils.isMacOS() ? -1 : 1)); - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+1 * (Utils.isMacOS() ? -1 : 1)); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+1 * (Utils.isMacOS() ? -1 : 1)); checkTextFieldValue(Properties.vvalue, 200); setPropertyBySlider(SettingType.UNIDIRECTIONAL, Properties.vmax, 150); @@ -109,6 +112,9 @@ @Test(timeout = 300000) @Covers(value = {"javafx.scene.control.ScrollPane.vmin.DEFAULT", "javafx.scene.control.ScrollPane.vmin.GET"}, level = Level.FULL) public void checkVMinOptionTest() throws InterruptedException { + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 100); + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefWidth, 100); + Assert.assertEquals((new ScrollPane()).vminProperty().getValue(), 0, commonComparePrecision); setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.vmin, -100); @@ -117,17 +123,17 @@ setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.vvalue, -100); checkTextFieldValue(Properties.vvalue, -100); - Wrap sb1 = findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true); + Wrap sb1 = findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true); sb1.as(AbstractScroll.class).to(1); checkTextFieldValue(Properties.vvalue, 1); - Wrap sb2 = findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true); + Wrap sb2 = findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true); sb2.as(AbstractScroll.class).to(-100); checkTextFieldValue(Properties.vvalue, -100); - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+1 * (Utils.isMacOS() ? -1 : 1)); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(+1 * (Utils.isMacOS() ? -1 : 1)); - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(-1 * (Utils.isMacOS() ? -1 : 1)); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).mouse().turnWheel(-1 * (Utils.isMacOS() ? -1 : 1)); checkTextFieldValue(Properties.vvalue, -100); setPropertyBySlider(SettingType.UNIDIRECTIONAL, Properties.vmin, -50); @@ -141,6 +147,9 @@ @Test(timeout = 300000) @Covers(value = {"javafx.scene.control.ScrollPane.hmax.DEFAULT", "javafx.scene.control.ScrollPane.hmax.GET"}, level = Level.FULL) public void checkHMaxOptionTest() throws InterruptedException { + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 100); + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefWidth, 100); + Assert.assertEquals((new ScrollPane()).hmaxProperty().getValue(), 1, commonComparePrecision); setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.hmax, 200); @@ -149,17 +158,17 @@ setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.hvalue, 200); checkTextFieldValue(Properties.hvalue, 200); - Wrap sb1 = findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true); + Wrap sb1 = findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true); sb1.as(AbstractScroll.class).to(0); checkTextFieldValue(Properties.hvalue, 0); - Wrap sb2 = findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true); + Wrap sb2 = findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true); sb2.as(AbstractScroll.class).to(200); checkTextFieldValue(Properties.hvalue, 200); - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(-1); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(-1); - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+1); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+1); checkTextFieldValue(Properties.hvalue, 200); setPropertyBySlider(SettingType.UNIDIRECTIONAL, Properties.hmax, 150); @@ -173,6 +182,9 @@ @Test(timeout = 300000) @Covers(value = {"javafx.scene.control.ScrollPane.hmin.DEFAULT", "javafx.scene.control.ScrollPane.hmin.GET"}, level = Level.FULL) public void checkHMinOptionTest() throws InterruptedException { + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 100); + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefWidth, 100); + Assert.assertEquals((new ScrollPane()).vminProperty().getValue(), 0, commonComparePrecision); setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.hmin, -100); @@ -181,17 +193,17 @@ setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.hvalue, -100); checkTextFieldValue(Properties.hvalue, -100); - Wrap sb1 = findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true); + Wrap sb1 = findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true); sb1.as(AbstractScroll.class).to(1); checkTextFieldValue(Properties.hvalue, 1); - Wrap sb2 = findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true); + Wrap sb2 = findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true); sb2.as(AbstractScroll.class).to(-100); checkTextFieldValue(Properties.hvalue, -100); - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+1); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(+1); - findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(-1); + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).mouse().turnWheel(-1); checkTextFieldValue(Properties.hvalue, -100); setPropertyBySlider(SettingType.UNIDIRECTIONAL, Properties.hmin, -50); @@ -207,6 +219,9 @@ Assert.assertEquals((new ScrollPane()).hvalueProperty().getValue(), 0, commonComparePrecision); Assert.assertEquals((new ScrollPane()).vvalueProperty().getValue(), 0, commonComparePrecision); + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 100); + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefWidth, 100); + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.hvalue, 200); checkTextFieldValue(Properties.hvalue, 1); @@ -228,11 +243,11 @@ setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefViewportHeight, 150); checkTextFieldValue(Properties.prefViewportHeight, 150); - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true) == null); + Assert.assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true) == null); setPropertyBySlider(SettingType.UNIDIRECTIONAL, Properties.prefViewportHeight, 230); checkTextFieldValue(Properties.prefViewportHeight, 230); - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null); + Assert.assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null); } /** @@ -246,11 +261,11 @@ setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefViewportWidth, 150); checkTextFieldValue(Properties.prefViewportWidth, 150); - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true) == null); + Assert.assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true) == null); setPropertyBySlider(SettingType.UNIDIRECTIONAL, Properties.prefViewportWidth, 230); checkTextFieldValue(Properties.prefViewportWidth, 230); - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, false) == null); + Assert.assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, false) == null); } @Test(timeout = 300000) @@ -321,8 +336,8 @@ }; private void checkScrollbarsVisibility(boolean horizontalVisible, boolean verticalVisible) { - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, horizontalVisible) == null); - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, verticalVisible) == null); + Assert.assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, horizontalVisible) == null); + Assert.assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, verticalVisible) == null); } @Smoke @@ -372,7 +387,7 @@ checkScrollbarsVisibility(true, true); break; case AS_NEEDED: - checkScrollbarsVisibility(true, true); + checkScrollbarsVisibility(false, false); break; case NEVER: checkScrollbarsVisibility(false, false); @@ -402,6 +417,9 @@ @ScreenshotCheck @Test(timeout = 300000) public void dynamicContentChangingTest() throws Throwable { + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 100); + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefWidth, 100); + changeContent(); //If content has really changed, button will be searchable. //If content didn't change, button won't be on scene. @@ -443,8 +461,8 @@ setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, size * 2); setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefWidth, size * 2); - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true) == null); - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true) == null); + Assert.assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true) == null); + Assert.assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true) == null); Point controlSize = new GetAction() { @Override @@ -460,8 +478,8 @@ } }.dispatch(Root.ROOT.getEnvironment(), testedControl.getControl()); - double verticalScrollBarWidth = findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).getScreenBounds().width; - double horizontalScrollBarHeight = findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).getScreenBounds().height; + double verticalScrollBarWidth = findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).getScreenBounds().width; + double horizontalScrollBarHeight = findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).getScreenBounds().height; Assert.assertEquals(viewPortSize.x + verticalScrollBarWidth, controlSize.x, commonComparePrecision); Assert.assertEquals(viewPortSize.y + horizontalScrollBarHeight, controlSize.y, commonComparePrecision); @@ -471,6 +489,9 @@ @ScreenshotCheck @Test(timeout = 300000) public void whiteGapTest() throws InterruptedException, Throwable { + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 100); + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefWidth, 100); + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.hmax, 200); setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.hmin, 50); setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.hvalue, 200); @@ -489,6 +510,9 @@ @ScreenshotCheck @Test(timeout = 300000)//RT-17350 public void immediateHVBarPoliticApplyingTest() throws Throwable { + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 100); + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefWidth, 100); + setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, ScrollPane.ScrollBarPolicy.ALWAYS, Properties.hbarPolicy); setPropertyByChoiceBox(SettingType.BIDIRECTIONAL, ScrollPane.ScrollBarPolicy.NEVER, Properties.hbarPolicy); @@ -531,6 +555,9 @@ @ScreenshotCheck @Test(timeout = 300000) public void insideTraversalCheckTest() throws Throwable { + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, 100); + setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefWidth, 100); + changeContent(); clickContentButton(); @@ -562,14 +589,14 @@ setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefViewportWidth, 201); setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefViewportHeight, 201); - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, false) == null); - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null); + Assert.assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, false) == null); + Assert.assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null); setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefViewportWidth, 200); setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefViewportHeight, 200); - Assert.assertTrue(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true) != null); - Assert.assertTrue(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true) != null); + Assert.assertTrue(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true) != null); + Assert.assertTrue(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true) != null); currentSettingOption = temp; } @@ -721,8 +748,8 @@ setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefViewportHeight, 100); setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefViewportWidth, 100); - Wrap vertical = findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true); - Wrap horizontal = findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true); + Wrap vertical = findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true); + Wrap horizontal = findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true); ScrollingChecker scV = new ScrollingChecker(vertical.getControl().valueProperty()); ScrollingChecker scH = new ScrollingChecker(horizontal.getControl().valueProperty()); @@ -765,8 +792,8 @@ setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefHeight, size * 2); setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.prefWidth, size * 2); - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true) == null); - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true) == null); + Assert.assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true) == null); + Assert.assertFalse(findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true) == null); Bounds bounds = new GetAction() { @Override @@ -782,8 +809,8 @@ } }.dispatch(Root.ROOT.getEnvironment(), testedControl.getControl()); - Assert.assertEquals(viewPortSize.x, bounds.getWidth() + findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).getScreenBounds().getWidth(), commonComparePrecision); - Assert.assertEquals(viewPortSize.y, bounds.getHeight() + findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).getScreenBounds().getHeight(), commonComparePrecision); + Assert.assertEquals(viewPortSize.x, bounds.getWidth() + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true).getScreenBounds().getWidth(), commonComparePrecision); + Assert.assertEquals(viewPortSize.y, bounds.getHeight() + findScrollBar((Parent) testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true).getScreenBounds().getHeight(), commonComparePrecision); } } --- old/functional/ControlsTests/test/javafx/scene/control/test/cell/CellsTestBase.java 2016-12-22 11:26:30.465089143 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/cell/CellsTestBase.java 2016-12-22 11:26:30.413088640 +0300 @@ -26,11 +26,9 @@ import client.test.Smoke; import com.sun.glass.ui.Application; -import com.sun.javafx.scene.control.skin.LabeledText; +import com.sun.javafx.scene.control.LabeledText; import java.util.ArrayList; import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; import javafx.collections.ObservableList; import javafx.scene.Node; import javafx.scene.Scene; --- old/functional/ControlsTests/test/javafx/scene/control/test/cell/TableCellsTest.java 2016-12-22 11:26:30.649090917 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/cell/TableCellsTest.java 2016-12-22 11:26:30.601090455 +0300 @@ -25,7 +25,7 @@ package javafx.scene.control.test.cell; import client.test.Smoke; -import com.sun.javafx.scene.control.skin.LabeledText; +import com.sun.javafx.scene.control.LabeledText; import java.util.Map; import javafx.collections.FXCollections; import javafx.collections.ObservableList; @@ -155,4 +155,4 @@ } }.dispatch(testedControl.getEnvironment()); } -} \ No newline at end of file +} --- old/functional/ControlsTests/test/javafx/scene/control/test/choicebox/ChoiceTest.java 2016-12-22 11:26:30.833092693 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/choicebox/ChoiceTest.java 2016-12-22 11:26:30.785092229 +0300 @@ -26,7 +26,7 @@ import client.test.ScreenshotCheck; import client.test.Smoke; -import com.sun.javafx.scene.control.skin.LabeledText; +import com.sun.javafx.scene.control.LabeledText; import javafx.collections.ObservableList; import javafx.commons.SortValidator; import javafx.scene.Node; @@ -358,4 +358,4 @@ checkScreenshot("ChoiceBox-selection" + (i + 1), testPane); } } -} \ No newline at end of file +} --- old/functional/ControlsTests/test/javafx/scene/control/test/combobox/ComboBoxTest.java 2016-12-22 11:26:31.025094545 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/combobox/ComboBoxTest.java 2016-12-22 11:26:30.977094081 +0300 @@ -33,6 +33,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.commons.SortValidator; @@ -61,6 +62,7 @@ import javafx.util.Callback; import javafx.util.StringConverter; import javafx.util.converter.FormatStringConverter; +import org.jemmy.Point; import org.jemmy.action.GetAction; import org.jemmy.control.Wrap; import org.jemmy.fx.ByStyleClass; @@ -88,8 +90,6 @@ /** * @author Alexander Kirov * - * Specification: - * http://xdesign.us.oracle.com/projects/javaFX/fxcontrols-ue/specifications/combobox/combobox.html */ @RunWith(FilteredTestRunner.class) public class ComboBoxTest extends TestBase { @@ -163,13 +163,19 @@ testedControl.mouse().press(); - checkTextFieldText(Properties.armed, "false"); + checkTextFieldText(Properties.armed, "true"); checkTextFieldText(Properties.showing, "false"); testedControl.mouse().release(); checkTextFieldText(Properties.armed, "false"); checkTextFieldText(Properties.showing, "false"); + + testedControl.mouse().press(); + org.jemmy.Rectangle bounds = testedControl.getScreenBounds(); + testedControl.mouse().move(new Point(bounds.getWidth() + 5, testedControl.getScreenBounds().getHeight() + 5)); + + checkTextFieldText(Properties.armed, "false"); } @Smoke @@ -219,7 +225,7 @@ @ScreenshotCheck @Test(timeout = 300000)//RT-19225 public void promptPropertyTest() throws Throwable { - assertEquals((new ComboBox()).promptTextProperty().getValue(), ""); + assertEquals((new ComboBox()).promptTextProperty().getValue(), null); //move focus from control. otherwise, we will not see prompt. requestFocusOnControl(testedControl); @@ -335,7 +341,7 @@ addElement(element3, 2); testedControl.as(Selectable.class).selector().select(element3); checkSimpleListenerValue(Properties.selectedItem, element3); - assertEquals(getTextFieldText(), TO_STRING_PREFIX + "1"); + assertEquals(getTextFieldText(), TO_STRING_PREFIX + "3"); setPropertyByToggleClick(SettingType.BIDIRECTIONAL, Properties.editable); testedControl.as(Selectable.class).selector().select(element2); @@ -423,13 +429,13 @@ testedControl.mouse().click(); testedControl.keyboard().pushKey(KeyboardButtons.A); - checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 4); + checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 3); testedControl.keyboard().pushKey(KeyboardButtons.ENTER); - checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 5); + checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 4); setPropertyByTextField(SettingType.BIDIRECTIONAL, Properties.value, NEW_VALUE_1); - checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 7); + checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 6); setPropertyByTextField(SettingType.UNIDIRECTIONAL, Properties.value, NEW_VALUE_2); - checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 9); + checkCounterValue(ON_ACTION_EVENT_COUNTER_ID, 8); } @Smoke @@ -641,7 +647,9 @@ addElements(1, 2, 3, 4, 5, 6); setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.visibleRowCount, 5); clickDropDownButton(); - Wrap sb = findScrollBar(((Wrap) getPopupWrap().as(Parent.class, Node.class).lookup(ListView.class).wrap()).as(Parent.class, Node.class), Orientation.VERTICAL, true); + Wrap sb = findScrollBar( + ((Parent) ((Wrap) ((Parent) getPopupWrap().as(Parent.class, Node.class)) + .lookup(ListView.class).wrap()).as(Parent.class, Node.class)), Orientation.VERTICAL, true); sb.as(AbstractScroll.class).caret().to(1); checkTextFieldText(Properties.showing, "true"); testedControl.as(Selectable.class).selector().select("6"); @@ -699,12 +707,12 @@ checkSelectionState(5, 6); assertEquals(getTextFieldText(), "6"); checkTextFieldText(Properties.value, "6"); + checkSimpleListenerValue(Properties.selectedIndex, 5); testedControl.mouse().click(); testedControl.as(Text.class).type("abc"); testedControl.keyboard().pushKey(KeyboardButtons.ENTER); - checkSimpleListenerValue(Properties.selectedIndex, 5); checkSimpleListenerValue(Properties.selectedItem, "6abc"); checkTextFieldText(Properties.value, "6abc"); @@ -1273,8 +1281,6 @@ setPropertyByToggleClick(SettingType.UNIDIRECTIONAL, Properties.editable); } - Wrap textFieldWrap = testedControl.as(Parent.class, Node.class) - .lookup(javafx.scene.text.Text.class).wrap(); final double initialButtonHeight = testedControl.getScreenBounds().getHeight(); double prevCellTextHeight = 0f; @@ -1287,6 +1293,8 @@ assertEquals(initialButtonHeight, testedControl.getScreenBounds().getHeight(), 0.001); /* text node should be alwas rendered inside ComboBox button */ + Wrap textFieldWrap = testedControl.as(Parent.class, Node.class) + .lookup(javafx.scene.text.Text.class).wrap(); assertTrue(textFieldWrap.getScreenBounds().getY() >= testedControl.getScreenBounds().getY()); assertTrue(textFieldWrap.getScreenBounds().getY() + textFieldWrap.getScreenBounds().getHeight() <= testedControl.getScreenBounds().getY() + testedControl.getScreenBounds().getHeight()); @@ -1422,7 +1430,7 @@ testedControl.keyboard().pushKey(KeyboardButtons.ENTER); - checkTextFieldText(Properties.value, FROM_STRING_PREFIX + "1"); + checkTextFieldText(Properties.value, FROM_STRING_PREFIX); } /** @@ -1647,4 +1655,4 @@ clickDropDownButton(); } } -} \ No newline at end of file +} --- old/functional/ControlsTests/test/javafx/scene/control/test/combobox/TestBase.java 2016-12-22 11:26:31.241096628 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/combobox/TestBase.java 2016-12-22 11:26:31.189096127 +0300 @@ -245,7 +245,8 @@ protected void checkScrollBarVisibility(boolean visible) throws InterruptedException { Wrap popup = getPopupWrap(); if (popup != null) { - Assert.assertTrue(findScrollBar(((Wrap) popup.as(Parent.class, Node.class).lookup(ListView.class).wrap()).as(Parent.class, Node.class), Orientation.VERTICAL, visible) != null); + Assert.assertTrue(findScrollBar(((Parent) ((Wrap) ((Parent) popup.as(Parent.class, Node.class)) + .lookup(ListView.class).wrap()).as(Parent.class, Node.class)), Orientation.VERTICAL, visible) != null); } } --- old/functional/ControlsTests/test/javafx/scene/control/test/datepicker/TestBase.java 2016-12-22 11:26:31.437098519 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/datepicker/TestBase.java 2016-12-22 11:26:31.385098018 +0300 @@ -24,7 +24,7 @@ */ package javafx.scene.control.test.datepicker; -import com.sun.javafx.scene.control.skin.LabeledText; +import com.sun.javafx.scene.control.LabeledText; import java.time.LocalDate; import java.time.Month; import java.time.YearMonth; --- old/functional/ControlsTests/test/javafx/scene/control/test/labeled/LabeledsBase.java 2016-12-22 11:26:31.641100487 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/labeled/LabeledsBase.java 2016-12-22 11:26:31.589099985 +0300 @@ -26,7 +26,7 @@ import client.test.ScreenshotCheck; import client.test.Smoke; -import com.sun.javafx.scene.control.skin.LabeledText; +import com.sun.javafx.scene.control.LabeledText; import javafx.collections.ObservableList; import javafx.geometry.Bounds; import javafx.scene.Node; --- old/functional/ControlsTests/test/javafx/scene/control/test/nchart/AxisDescriptionProvider.java 2016-12-22 11:26:31.829102300 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/nchart/AxisDescriptionProvider.java 2016-12-22 11:26:31.777101798 +0300 @@ -24,7 +24,7 @@ */ package javafx.scene.control.test.nchart; -import com.sun.javafx.scene.control.skin.LabeledText; +import com.sun.javafx.scene.control.LabeledText; import java.util.ArrayList; import java.util.List; import javafx.geometry.Side; @@ -188,4 +188,4 @@ } }.dispatch(Root.ROOT.getEnvironment()); } -} \ No newline at end of file +} --- old/functional/ControlsTests/test/javafx/scene/control/test/pagination/TestBase.java 2016-12-22 11:26:32.021104152 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/pagination/TestBase.java 2016-12-22 11:26:31.973103689 +0300 @@ -24,7 +24,7 @@ */ package javafx.scene.control.test.pagination; -import com.sun.javafx.scene.control.skin.LabeledText; +import com.sun.javafx.scene.control.LabeledText; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -147,7 +147,7 @@ } protected void checkScrollingOfFormComponentScrollBar() { - Wrap scrollBar = findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true); + Wrap scrollBar = findScrollBar((Parent)testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true); scrollBar.mouse().turnWheel(-1); testedControl.waitState(new State() { public Integer reached() { @@ -273,7 +273,7 @@ } protected Wrap getScrollbarWrap(boolean visible) { - return findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, visible); + return findScrollBar((Parent)testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, visible); } protected void checkNumberOfVisiblePageIndeces(int expectedIndeces) { --- old/functional/ControlsTests/test/javafx/scene/control/test/tableview/ApplicationInteractionFunctions.java 2016-12-22 11:26:32.217106043 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/tableview/ApplicationInteractionFunctions.java 2016-12-22 11:26:32.165105541 +0300 @@ -24,8 +24,8 @@ */ package javafx.scene.control.test.tableview; -import com.sun.javafx.scene.control.skin.NestedTableColumnHeader; -import com.sun.javafx.scene.control.skin.TableColumnHeader; +import javafx.scene.control.skin.NestedTableColumnHeader; +import javafx.scene.control.skin.TableColumnHeader; import java.util.Collection; import java.util.Comparator; import java.util.concurrent.TimeUnit; @@ -397,4 +397,4 @@ } catch (Exception e) { } } -} \ No newline at end of file +} --- old/functional/ControlsTests/test/javafx/scene/control/test/tableview/TableViewNewTest.java 2016-12-22 11:26:32.409107895 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/tableview/TableViewNewTest.java 2016-12-22 11:26:32.357107394 +0300 @@ -26,9 +26,9 @@ package javafx.scene.control.test.tableview; import client.test.Smoke; -import com.sun.javafx.scene.control.skin.NestedTableColumnHeader; -import com.sun.javafx.scene.control.skin.TableColumnHeader; -import com.sun.javafx.scene.control.skin.TableHeaderRow; +import javafx.scene.control.skin.NestedTableColumnHeader; +import javafx.scene.control.skin.TableColumnHeader; +import javafx.scene.control.skin.TableHeaderRow; import java.awt.Robot; import java.awt.event.InputEvent; import java.util.ArrayList; @@ -210,14 +210,14 @@ private void checkSortNotScrollingFor(String name, int index) { scrollTo(index, 0); - final double initialScrollPos = getScrollBarValue(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true)); + final double initialScrollPos = getScrollBarValue(findScrollBar((Parent)testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true)); getTableColumnHeaderWrap(name).mouse().click(); getTableColumnHeaderWrap(name).mouse().click(); getTableColumnHeaderWrap(name).mouse().click(); getTableColumnHeaderWrap(name).mouse().click(); new Waiter(new Timeout("", 500)).ensureState(new State() { public Object reached() { - if (Math.abs(initialScrollPos - getScrollBarValue(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true))) < 0.001) { + if (Math.abs(initialScrollPos - getScrollBarValue(findScrollBar((Parent)testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true))) < 0.001) { return true; } else { return null; --- old/functional/ControlsTests/test/javafx/scene/control/test/tableview/TableViewTest.java 2016-12-22 11:26:32.621109940 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/tableview/TableViewTest.java 2016-12-22 11:26:32.569109439 +0300 @@ -143,7 +143,6 @@ * Checks that sort works for the column. According to the spec there are * three states of sorting and all of them are checked * - * http://xdesign.us.oracle.com/projects/javaFX/fxcontrols-ue/specifications/treetable/treetable.html#sorting */ @Smoke @Test(timeout = 300000) @@ -459,4 +458,4 @@ txtColumnRemoveIndex.type(String.valueOf(pos)); btnRemoveColumn.mouse().click(); } -} \ No newline at end of file +} --- old/functional/ControlsTests/test/javafx/scene/control/test/tableview/TestBase.java 2016-12-22 11:26:32.809111755 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/tableview/TestBase.java 2016-12-22 11:26:32.761111291 +0300 @@ -24,7 +24,7 @@ */ package javafx.scene.control.test.tableview; -import com.sun.javafx.scene.control.skin.TableColumnHeader; +import javafx.scene.control.skin.TableColumnHeader; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; --- old/functional/ControlsTests/test/javafx/scene/control/test/tableview/TestBaseCommon.java 2016-12-22 11:26:33.005113645 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/tableview/TestBaseCommon.java 2016-12-22 11:26:32.953113143 +0300 @@ -198,11 +198,11 @@ * @return wrap of parent container that contains Cells */ static Wrap getContainerWrap(Wrap parent) { - return getParentWrap(parent.as(Parent.class, Node.class), VIRTIAL_FLOW_CLASS_NAME); + return getParentWrap((Parent)parent.as(Parent.class, Node.class), VIRTIAL_FLOW_CLASS_NAME); } static Wrap getClippedContainerWrap(Wrap parent) { - return getParentWrap(parent.as(Parent.class, Node.class), CLIPPED_CONTAINER_CLASS_NAME); + return getParentWrap((Parent)parent.as(Parent.class, Node.class), CLIPPED_CONTAINER_CLASS_NAME); } static private Wrap getParentWrap(Parent parent, final String className) { @@ -466,4 +466,4 @@ } private static final String VIRTIAL_FLOW_CLASS_NAME = "VirtualFlow"; private static final String CLIPPED_CONTAINER_CLASS_NAME = "VirtualFlow$ClippedContainer"; -} \ No newline at end of file +} --- old/functional/ControlsTests/test/javafx/scene/control/test/tabpane/NewTabPaneTest.java 2016-12-22 11:26:33.197115498 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/tabpane/NewTabPaneTest.java 2016-12-22 11:26:33.149115034 +0300 @@ -36,7 +36,6 @@ import javafx.scene.Node; import javafx.scene.control.Label; import javafx.scene.control.Tab; -import javafx.scene.control.TabBuilder; import static javafx.scene.control.test.tabpane.NewTabPaneApp.*; import javafx.scene.control.test.utils.ptables.AbstractPropertyController.SettingType; import javafx.util.StringConverter; @@ -333,7 +332,9 @@ @Override public String toString(Tab t) { return t.getText(); } @Override public Tab fromString(String s) { - return TabBuilder.create().text(s).content(new Label("CONTENT!")).build(); + Tab t = new Tab(s); + t.setContent(new Label("CONTENT!")); + return t; } }; --- old/functional/ControlsTests/test/javafx/scene/control/test/textinput/TextAreaPropertiesTest.java 2016-12-22 11:26:33.389117350 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/textinput/TextAreaPropertiesTest.java 2016-12-22 11:26:33.337116847 +0300 @@ -77,18 +77,18 @@ addText(); //There are both scrollBars must exist - assertEquals(getScrollBarValue(findScrollBar(testedControl.as(Parent.class, Node.class), orientation, true)), 0, 0); + assertEquals(getScrollBarValue(findScrollBar((Parent)testedControl.as(Parent.class, Node.class), orientation, true)), 0, 0); double[] values = {10, 0, 50, 0, 100}; setPropertyBySlider(SettingType.BIDIRECTIONAL, property, 10); - double item = getScrollBarValue(findScrollBar(testedControl.as(Parent.class, Node.class), orientation, true)) / 10; + double item = getScrollBarValue(findScrollBar((Parent)testedControl.as(Parent.class, Node.class), orientation, true)) / 10; for (SettingType type : EnumSet.of(SettingType.BIDIRECTIONAL, SettingType.SETTER, SettingType.UNIDIRECTIONAL)) { for (double value : values) { setPropertyBySlider(type, property, value); checkTextFieldValue(property, value); - assertEquals(getScrollBarValue(findScrollBar(testedControl.as(Parent.class, Node.class), orientation, true)), value * item, 0.1 * item); + assertEquals(getScrollBarValue(findScrollBar((Parent)testedControl.as(Parent.class, Node.class), orientation, true)), value * item, 0.1 * item); } } @@ -133,13 +133,13 @@ for (SettingType type : EnumSet.of(SettingType.BIDIRECTIONAL, SettingType.SETTER, SettingType.UNIDIRECTIONAL)) { setPropertyByToggleClick(type, Properties.wraptext);//true//bind checkTextFieldText(Properties.wraptext, "true");//getter - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, false) == null);//behavior - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true) == null);//behavior + Assert.assertFalse(findScrollBar((Parent)testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, false) == null);//behavior + Assert.assertFalse(findScrollBar((Parent)testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, true) == null);//behavior setPropertyByToggleClick(type, Properties.wraptext);//false//bind checkTextFieldText(Properties.wraptext, "false");//getter - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true) == null);//behavior - Assert.assertFalse(findScrollBar(testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null);//behavior + Assert.assertFalse(findScrollBar((Parent)testedControl.as(Parent.class, Node.class), Orientation.HORIZONTAL, true) == null);//behavior + Assert.assertFalse(findScrollBar((Parent)testedControl.as(Parent.class, Node.class), Orientation.VERTICAL, false) == null);//behavior } } --- old/functional/ControlsTests/test/javafx/scene/control/test/textinput/TextInputBase.java 2016-12-22 11:26:33.589119279 +0300 +++ new/functional/ControlsTests/test/javafx/scene/control/test/textinput/TextInputBase.java 2016-12-22 11:26:33.537118777 +0300 @@ -1,1013 +1,1028 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package javafx.scene.control.test.textinput; - -import client.test.ScreenshotCheck; -import com.sun.javafx.scene.control.skin.TextInputControlSkin; -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; -import javafx.beans.property.BooleanProperty; -import javafx.scene.Node; -import javafx.scene.Scene; -import javafx.scene.control.Button; -import javafx.scene.control.Control; -import javafx.scene.control.MenuItem; -import javafx.scene.control.PasswordField; -import javafx.scene.control.TextInputControl; -import javafx.scene.control.test.Change; -import javafx.scene.control.test.mix.PopupMenuTest; -import javafx.scene.control.test.textinput.TextInputBaseApp.Pages; -import javafx.scene.control.test.textinput.TextInputChanger.TextInputControlWrapInterface; -import javafx.scene.control.test.textinput.TextInputChanger.TextInputPages; -import javafx.scene.input.Clipboard; -import javafx.scene.input.DataFormat; -import javafx.scene.layout.Pane; -import org.jemmy.Point; -import org.jemmy.action.GetAction; -import org.jemmy.control.Wrap; -import org.jemmy.fx.ByID; -import org.jemmy.fx.Root; -import org.jemmy.interfaces.Keyboard; -import org.jemmy.interfaces.Keyboard.KeyboardButtons; -import org.jemmy.interfaces.Keyboard.KeyboardModifiers; -import org.jemmy.interfaces.Mouse.MouseButtons; -import org.jemmy.interfaces.Parent; -import org.jemmy.interfaces.Text; -import org.jemmy.lookup.LookupCriteria; -import org.jemmy.timing.State; -import org.junit.Assert; -import static org.junit.Assert.*; -import org.junit.Test; -import org.junit.runner.RunWith; -import test.javaclient.shared.FilteredTestRunner; -import test.javaclient.shared.TestBase; -import test.javaclient.shared.Utils; -import test.javaclient.shared.screenshots.ScreenshotUtils; - -/** - * @author Oleg Barbashov - */ -@RunWith(FilteredTestRunner.class) -public class TextInputBase extends TestBase { - - { - ScreenshotUtils.setComparatorDistance(0.003f); - } - private Wrap taTesting = null; - - static final KeyboardModifiers CTRL = Utils.isMacOS() ? KeyboardModifiers.META_DOWN_MASK : KeyboardModifiers.CTRL_DOWN_MASK; -// /** -// * Test for TextInput setMaximumLength API -// */ -// @ScreenshotCheck -// @Test(timeout=300000) -// public void maximumLengthTest() throws InterruptedException, Throwable { -// openPage(Pages.MaximumLength.name()); -// -// verifyFailures(); -// -// Parent parent = scene.as(Parent.class, Node.class); -// Lookup lookup = parent.lookup(TextInput.class); -// for (int i = 0; i < lookup.size(); i++) { -// final Wrap wrap = lookup.wrap(i); -// final Integer maximumLength = new GetAction() { -// @Override -// public void run(Object... parameters) { -// setResult(wrap.getControl().getMaximumLength()); -// } -// }.dispatch(Root.ROOT.getEnvironment()); -// Text text = wrap.as(Text.class); -// long timeout = Wrap.WAIT_STATE_TIMEOUT.getValue(); -// String str = createLongString(maximumLength + 2); -// try { -// text.type(str); -// } catch (Exception ex) { -// // expected as text length is limited but Jemmy does not expect limitation and wait for all sequence -// } -// Wrap.WAIT_STATE_TIMEOUT.setValue(timeout); -// wrap.waitProperty(Wrap.TEXT_PROP_NAME, str.subSequence(0, maximumLength)); -// } -// checkScreenshot(getClass().getSimpleName() + "-" + Pages.MaximumLength.name()); -// throwScreenshotError(); -// } - /** - * Test for backward API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void backwardInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.backward.name(), true); - } - - /** - * Test for copy API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void copyInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.copy.name(), true); - } - - /** - * Test for cut API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void cutInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.cut.name(), true); - } - - /** - * Test for deleteNextChar API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void deleteNextCharInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.deleteNextChar.name(), true); - } - - /** - * Test for deletePreviousChar API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void deletePreviousCharInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.deletePreviousChar.name(), true); - } - - /** - * Test for end API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void endInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.end.name(), true); - } - - /** - * Test for forward API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void forwardInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.forward.name(), true); - } - - /** - * Test for home API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void homeInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.home.name(), true); - } - - /** - * Test for isEditableTextBoxWrap API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void isEditableTextBoxWrapInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.isEditable.name(), true); - } - - /** - * Test for nextWord API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void nextWordInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.nextWord.name(), true); - } - - /** - * Test for paste API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void pasteInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.paste.name(), true); - } - - /** - * Test for positionCaret API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void positionCaretInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.positionCaret.name(), true); - } - - /** - * Test for previousWord API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void previousWordInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.previousWord.name(), true); - } - - /** - * Test for selectAll API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void selectAllInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.selectAll.name(), true); - } - - /** - * Test for selectBackward API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void selectBackwardInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.selectBackward.name(), true); - } - - /** - * Test for selectEnd API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void selectEndInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.selectEnd.name(), true); - } - - /** - * Test for selectForward API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void selectForwardInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.selectForward.name(), true); - } - - /** - * Test for selectHome API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void selectHomeInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.selectHome.name(), true); - } - - /** - * Test for selectNext API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void selectNextWordInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.selectNextWord.name(), true); - } - - /** - * Test for selectPreviousWord API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void selectPreviousWordInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.selectPreviousWord.name(), true); - } - - /** - * Test for setText API - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void setTextInternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.setText.name(), true); - } - - /** - * Test for backward API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void backwardExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.backward.name(), false); - } - - /** - * Test for copy API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void copyExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.copy.name(), false); - } - - /** - * Test for cut API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void cutExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.cut.name(), false); - } - - /** - * Test for deleteNextChar API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void deleteNextCharExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.deleteNextChar.name(), false); - } - - /** - * Test for deletePreviousChar API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void deletePreviousCharExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.deletePreviousChar.name(), false); - } - - /** - * Test for end API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void endExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.end.name(), false); - } - - /** - * Test for forward API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void forwardExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.forward.name(), false); - } - - /** - * Test for home API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void homeExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.home.name(), false); - } - - /** - * Test for isEditableTextBoxWrap API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void isEditableTextBoxWrapExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.isEditable.name(), false); - } - - /** - * Test for nextWord API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void nextWordExternalTest() throws InterruptedException { - if (Utils.isMacOS()) { - textInputControlInput(TextInputPages.macNextWordExternal.name(), false); - } else { - textInputControlInput(TextInputPages.nextWord.name(), false); - } - } - - /** - * Test for paste API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void pasteExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.paste.name(), false); - } - - /** - * Test for positionCaret API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void positionCaretExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.positionCaret.name(), false); - } - - /** - * Test for previousWord API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void previousWordExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.previousWord.name(), false); - } - - /** - * Test for selectAll API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void selectAllExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.selectAll.name(), false); - } - - /** - * Test for selectBackward API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void selectBackwardExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.selectBackward.name(), false); - } - - /** - * Test for selectEnd API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void selectEndExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.selectEnd.name(), false); - } - - /** - * Test for selectForward API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void selectForwardExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.selectForward.name(), false); - } - - /** - * Test for selectHome API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void selectHomeExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.selectHome.name(), false); - } - - /** - * Test for selectNext API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void selectNextWordExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.selectNextWord.name(), false); - } - - /** - * Test for selectPreviousWord API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void selectPreviousWordExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.selectPreviousWord.name(), false); - } - - /** - * Test for setText API by simulating user input - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void setTextExternalTest() throws InterruptedException { - textInputControlInput(TextInputPages.setText.name(), false); - } - - /** - * Test for Context Menu - */ - @ScreenshotCheck - @Test(timeout = 300000) - public void contextMenuTest() throws InterruptedException { - openPage(Pages.InputTest.name()); - - final Wrap wrap = getScene().as(Parent.class, Node.class).lookup(TextInputControl.class).wrap(); - final Text text = wrap.as(Text.class); - - initContext(); - boolean password = PasswordField.class.isAssignableFrom(wrap.getControl().getClass()); - if (!password) { - getMenuItem("Select All").mouse().move(); - getMenuItem("Copy").mouse().click(); - checkClipboard(SAMPLE_STRING); - - getMenuItem("Cut").mouse().click(); - checkClipboard(SAMPLE_STRING); - checkText(text, ""); - } else { - checkState("Copy", true); - checkState("Cut", true); - } - - initContext(); - getMenuItem("Delete").mouse().click(); - checkText(text, ""); - - initContext(); - getMenuItem("Select All").mouse().click(); - getScene().waitState(new State() { - public Object reached() { - return wrap.getControl().getSelection().getLength() == SAMPLE_STRING.length() ? true : null; - } - }); - - initContext(); - final Map data_map = new HashMap(); - data_map.put(DataFormat.PLAIN_TEXT, SAMPLE_STRING); - - new GetAction() { - @Override - public void run(Object... os) throws Exception { - Clipboard.getSystemClipboard().setContent(data_map); - } - }.dispatch(Root.ROOT.getEnvironment()); - - getMenuItem("Paste").mouse().click(); - checkText(text, SAMPLE_STRING); - - wrap.keyboard().pushKey(KeyboardButtons.HOME); - checkState("Copy", true); - checkState("Cut", true); - checkState("Paste", false); - - new GetAction() { - @Override - public void run(Object... os) throws Exception { - Clipboard.getSystemClipboard().clear(); - } - }.dispatch(Root.ROOT.getEnvironment()); - - checkState("Paste", true); - checkState("Delete", true); - checkState("Select All", false); - } - - @ScreenshotCheck - @Test - public void ctrlBackspaceMultilineTest() { - openPage(Pages.CtrlBackspaceTest.name()); - Wrap btn = getScene().as(org.jemmy.interfaces.Parent.class, Node.class).lookup(new ByID