functional/ControlsTests/src/javafx/scene/control/test/treetable/TreeTableNewApp.java

Print this page




   7  * published by the Free Software Foundation. Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package javafx.scene.control.test.treetable;
  26 
  27 import com.sun.javafx.scene.control.skin.NestedTableColumnHeader;
  28 import com.sun.javafx.scene.control.skin.TableColumnHeader;
  29 import com.sun.javafx.scene.control.skin.TableHeaderRow;
  30 import com.sun.javafx.scene.control.skin.TreeTableViewSkin;
  31 import java.util.ArrayList;
  32 import java.util.Comparator;
  33 import java.util.HashMap;
  34 import java.util.Iterator;
  35 import java.util.Map;
  36 import javafx.beans.property.SimpleStringProperty;
  37 import javafx.beans.property.StringProperty;
  38 import javafx.beans.value.ChangeListener;
  39 import javafx.beans.value.ObservableValue;
  40 import javafx.collections.FXCollections;
  41 import javafx.collections.ObservableList;
  42 import static javafx.commons.Consts.*;
  43 import javafx.commons.Consts.CellEditorType;
  44 import javafx.event.ActionEvent;
  45 import javafx.event.Event;
  46 import javafx.event.EventHandler;
  47 import javafx.geometry.Insets;
  48 import javafx.geometry.Orientation;
  49 import javafx.scene.Node;
  50 import javafx.scene.Scene;
  51 import javafx.scene.control.*;
  52 import javafx.scene.control.TreeTableColumn.CellDataFeatures;
  53 import javafx.scene.control.cell.ChoiceBoxTreeTableCell;
  54 import javafx.scene.control.cell.ComboBoxTreeTableCell;
  55 import javafx.scene.control.cell.TextFieldTreeTableCell;
  56 import javafx.scene.control.test.tableview.NewTableViewApp;

  57 import javafx.scene.control.test.treeview.TreeViewConstants;
  58 import javafx.scene.control.test.utils.CommonPropertiesScene;
  59 import javafx.scene.control.test.utils.ComponentsFactory.MultipleIndexFormComponent;
  60 import javafx.scene.control.test.utils.ComponentsFactory.MultipleIndexFormComponent.MultipleIndicesAction;
  61 import javafx.scene.control.test.utils.ptables.NodeControllerFactory;
  62 import javafx.scene.control.test.utils.ptables.PropertiesTable;
  63 import javafx.scene.control.test.utils.ptables.PropertyTablesFactory;
  64 import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider;
  65 import javafx.scene.control.test.utils.ptables.TabPaneWithControl;
  66 import javafx.scene.input.KeyCode;
  67 import javafx.scene.input.KeyEvent;
  68 import javafx.scene.layout.HBox;
  69 import javafx.scene.layout.Pane;
  70 import javafx.scene.layout.VBox;
  71 import javafx.util.Callback;
  72 import test.javaclient.shared.InteroperabilityApp;
  73 import test.javaclient.shared.Utils;
  74 import static org.junit.Assert.assertTrue;
  75 
  76 /**


 176 
 177             allPropertiesTables = new ArrayList<PropertiesTable>();
 178 
 179             PropertyTablesFactory.explorePropertiesList(testedControl, tb);
 180             PropertyTablesFactory.explorePropertiesList(testedControl.getSelectionModel(), tb);
 181             PropertyTablesFactory.explorePropertiesList(testedControl.getFocusModel(), tb);
 182             SpecialTablePropertiesProvider.provideForControl(testedControl, tb);
 183 
 184             tabPane = new TabPaneWithControl(TREE_TABLE_VIEW_TAB_NAME, tb);
 185             getControlOverItem(ROOT_NAME);
 186 
 187             tb.setStyle("-fx-border-color : yellow;");
 188 
 189             VBox vb = new VBox();
 190             vb.setSpacing(5);
 191 
 192             HBox hb = (HBox) getRoot();
 193             hb.setPadding(new Insets(5, 5, 5, 5));
 194             hb.setStyle("-fx-border-color : green;");
 195 
 196             Button resetButton = ButtonBuilder.create().id(HARD_RESET_BUTTON_ID).text("Reset").build();

 197             resetButton.setOnAction(new EventHandler<ActionEvent>() {
 198                 public void handle(ActionEvent t) {
 199                     HBox hb = (HBox) getRoot();
 200                     hb.getChildren().clear();
 201                     prepareMainSceneStructure();
 202                     prepareScene();
 203                 }
 204             });
 205 
 206             Button autosize = new Button("Autosize");
 207             autosize.setId(AUTOSIZE_BUTTON_ID);
 208             autosize.setOnAction(new EventHandler<ActionEvent>() {
 209                 public void handle(ActionEvent t) {
 210                     testedControl.autosize();
 211                 }
 212             });
 213 
 214             VBox vbActionMakers = new VBox();
 215 
 216             vbActionMakers.getChildren().addAll(resetButton, autosize, new Separator(Orientation.HORIZONTAL),


 611             hb1.getChildren().addAll(new Label("Get tree item at"), tfParentName);
 612 
 613             HBox hb2 = new HBox(3);
 614             hb2.getChildren().addAll(button, content);
 615 
 616             VBox vb = new VBox();
 617             vb.getChildren().addAll(hb1, hb2);
 618             return vb;
 619         }
 620 
 621         Node getReplaceTableHeaderImplementationButton() {
 622             Button replaceButton = new Button("Replace skin implementation");
 623             replaceButton.setId(REPLACE_SKIN_IMPLEMENTATION_BUTTON_ID);
 624             replaceButton.setOnAction(new EventHandler<ActionEvent>() {
 625                 public void handle(ActionEvent t) {
 626                     testedControl.setSkin(new TreeTableViewSkin(testedControl) {
 627                         @Override
 628                         public String toString() {
 629                             return "CUSTOM " + super.toString();
 630                         }
 631 
 632                         @Override
 633                         protected TableHeaderRow createTableHeaderRow() {
 634                             return new TableHeaderRow(this) {
 635                                 @Override
 636                                 protected NestedTableColumnHeader createRootHeader() {
 637                                     return new NestedTableColumnHeader((TreeTableViewSkin) testedControl.getSkin(), null) {
 638                                         @Override
 639                                         protected TableColumnHeader createTableColumnHeader(TableColumnBase col) {
 640                                             if (col.getColumns().isEmpty()) {
 641                                                 final TableColumnHeader tableColumnHeader = new TableColumnHeader(getTableViewSkin(), col);
 642                                                 tableColumnHeader.setId(CUSTOM_IMPLEMENTATION_MARKER);
 643                                                 return tableColumnHeader;
 644                                             } else {
 645                                                 final NestedTableColumnHeader nestedTableColumnHeader = new NestedTableColumnHeader(getTableViewSkin(), col);
 646                                                 nestedTableColumnHeader.setId(CUSTOM_IMPLEMENTATION_MARKER);
 647                                                 return nestedTableColumnHeader;
 648                                             }
 649                                         }
 650                                     };
 651                                 }
 652                             };
 653                         }

 654                     });
 655                 }
 656             });
 657 
 658             return replaceButton;
 659         }
 660 
 661         protected VBox getTabOverItemThroughGetItemMethodController() {
 662             final TextField tfParentName = new TextField();
 663             tfParentName.setPromptText("index");
 664             tfParentName.setPrefWidth(50);
 665 
 666             Button button = new Button("get table over");
 667             button.setOnAction(new EventHandler<ActionEvent>() {
 668                 public void handle(ActionEvent t) {
 669                     getControlOverItem(testedControl.getTreeItem(Integer.parseInt(tfParentName.getText())).getValue().toString());
 670                 }
 671             });
 672 
 673             HBox hb1 = new HBox(3);


 690             button.setOnAction(new EventHandler<ActionEvent>() {
 691                 public void handle(ActionEvent t) {
 692                     int found = testedControl.getRow(searchTreeItem(tfParentName.getText()));
 693                     index.setText(((Integer) found).toString());
 694                 }
 695             });
 696 
 697             HBox hb1 = new HBox(3);
 698             hb1.getChildren().addAll(new Label("Get index of"), tfParentName);
 699 
 700             HBox hb2 = new HBox(3);
 701             hb2.getChildren().addAll(index, button);
 702 
 703             VBox vb = new VBox();
 704             vb.getChildren().addAll(hb1, hb2);
 705             return vb;
 706         }
 707 
 708         private HBox getScrollToHBox() {
 709             HBox hb = new HBox();
 710             Button button = ButtonBuilder.create().text("ScrollTo").id(SCROLL_TO_BUTTON_ID).build();
 711             final TextField tf = TextFieldBuilder.create().text("0").id(SCROLL_TO_TEXT_FIELD_ID).prefWidth(50).build();



 712 
 713             button.setOnAction(new EventHandler<ActionEvent>() {
 714                 public void handle(ActionEvent t) {
 715                     testedControl.scrollTo(Integer.parseInt(tf.getText()));
 716                 }
 717             });
 718 
 719             hb.getChildren().addAll(tf, button);
 720             return hb;
 721         }
 722 
 723         private HBox getEditHBox() {
 724             HBox hb = new HBox();
 725             Button button = ButtonBuilder.create().text("Edit").id(EDIT_BUTTON_ID).build();
 726             final TextField tf = TextFieldBuilder.create().promptText("name").id(EDIT_TEXT_FIELD_ID).prefWidth(50).build();




 727 
 728             button.setOnAction(new EventHandler<ActionEvent>() {
 729                 public void handle(ActionEvent t) {
 730                     throw new IllegalStateException("In build 101 was changed API of this function. Instead of 0, write index of edited treeItem please.");
 731                     //testedControl.edit(0/* searchTreeItem(tf.getText()) */, (TreeTableColumn) testedControl.getColumns().get(0));
 732                 }
 733             });
 734 
 735             hb.getChildren().addAll(tf, button);
 736             return hb;
 737         }
 738 
 739         private VBox setEventHandlersHBox() {
 740             VBox vb = new VBox();
 741 
 742             Button btn = ButtonBuilder.create()
 743                     .text("Set onEdit event hadlers")
 744                     .id(BTN_SET_ON_EDIT_EVENT_HANDLERS)
 745                     .build();
 746 
 747             btn.setOnAction(new EventHandler<ActionEvent>() {
 748                 final EventHandler eventHandlerOnEditStart = new EventHandler() {
 749                     public void handle(Event t) {
 750                         tb.incrementCounter(COUNTER_EDIT_START);
 751                     }
 752                 };
 753                 final EventHandler eventHandlerOnEditCommit = new EventHandler<TreeTableColumn.CellEditEvent<DataItem, String>>() {
 754                     public void handle(TreeTableColumn.CellEditEvent<DataItem, String> event) {
 755                         tb.incrementCounter(COUNTER_EDIT_COMMIT);
 756                         DataItem data = event.getTreeTablePosition().getTreeItem().getValue();
 757                         StringProperty prop = data.get(event.getTableColumn().getText());
 758                         prop.setValue(event.getNewValue());
 759                     }
 760                 };
 761                 final EventHandler eventHandlerOnEditCancel = new EventHandler() {
 762                     public void handle(Event t) {
 763                         tb.incrementCounter(COUNTER_EDIT_CANCEL);
 764                     }
 765                 };
 766 
 767                 public void handle(ActionEvent t) {
 768                     for (Iterator it = testedControl.getColumns().iterator(); it.hasNext();) {
 769                         TreeTableColumn col = (TreeTableColumn) it.next();
 770 
 771                         col.setOnEditStart(eventHandlerOnEditStart);
 772                         assertTrue(eventHandlerOnEditStart == col.getOnEditStart());
 773 
 774                         col.setOnEditCommit(eventHandlerOnEditCommit);
 775                         assertTrue(eventHandlerOnEditCommit == col.getOnEditCommit());
 776 
 777                         col.setOnEditCancel(eventHandlerOnEditCancel);
 778                         assertTrue(eventHandlerOnEditCancel == col.getOnEditCancel());
 779                     }
 780                 }
 781             });
 782 
 783             Button btnAddFactory = ButtonBuilder.create()
 784                     .text("Set cell factory for editing")
 785                     .id(SET_CELL_FACTORY_FOR_EDITING)
 786                     .build();
 787 
 788             btnAddFactory.setOnAction(new EventHandler<ActionEvent>() {
 789                 public void handle(ActionEvent t) {
 790                     for (Object obj : testedControl.getColumns()) {
 791                         TreeTableColumn col = (TreeTableColumn) obj;
 792                         col.setCellFactory(TextFieldTreeTableCell.forTreeTableColumn());
 793                     }
 794                 }
 795             });
 796 
 797             vb.getChildren().addAll(btn, btnAddFactory);
 798             return vb;
 799         }
 800 
 801         private TreeItem<DataItem> searchTreeItem(String content) {
 802             return TreeTableNewApp.searchTreeItem(testedControl, content);
 803         }
 804 
 805         private Pane controlsForEditing() {
 806 
 807             VBox topContainer = new VBox(3.5);




   7  * published by the Free Software Foundation. Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package javafx.scene.control.test.treetable;
  26 
  27 import javafx.scene.control.skin.NestedTableColumnHeader;
  28 import javafx.scene.control.skin.TableColumnHeader;
  29 import javafx.scene.control.skin.TableHeaderRow;
  30 import javafx.scene.control.skin.TreeTableViewSkin;
  31 import java.util.ArrayList;
  32 import java.util.Comparator;
  33 import java.util.HashMap;
  34 import java.util.Iterator;
  35 import java.util.Map;
  36 import javafx.beans.property.SimpleStringProperty;
  37 import javafx.beans.property.StringProperty;
  38 import javafx.beans.value.ChangeListener;
  39 import javafx.beans.value.ObservableValue;
  40 import javafx.collections.FXCollections;
  41 import javafx.collections.ObservableList;
  42 import static javafx.commons.Consts.*;
  43 import javafx.commons.Consts.CellEditorType;
  44 import javafx.event.ActionEvent;
  45 import javafx.event.Event;
  46 import javafx.event.EventHandler;
  47 import javafx.geometry.Insets;
  48 import javafx.geometry.Orientation;
  49 import javafx.scene.Node;
  50 import javafx.scene.Scene;
  51 import javafx.scene.control.*;
  52 import javafx.scene.control.TreeTableColumn.CellDataFeatures;
  53 import javafx.scene.control.cell.ChoiceBoxTreeTableCell;
  54 import javafx.scene.control.cell.ComboBoxTreeTableCell;
  55 import javafx.scene.control.cell.TextFieldTreeTableCell;
  56 import javafx.scene.control.test.tableview.NewTableViewApp;
  57 import static javafx.scene.control.test.treetable.ResetButtonNames.HARD_RESET_BUTTON_ID;
  58 import javafx.scene.control.test.treeview.TreeViewConstants;
  59 import javafx.scene.control.test.utils.CommonPropertiesScene;
  60 import javafx.scene.control.test.utils.ComponentsFactory.MultipleIndexFormComponent;
  61 import javafx.scene.control.test.utils.ComponentsFactory.MultipleIndexFormComponent.MultipleIndicesAction;
  62 import javafx.scene.control.test.utils.ptables.NodeControllerFactory;
  63 import javafx.scene.control.test.utils.ptables.PropertiesTable;
  64 import javafx.scene.control.test.utils.ptables.PropertyTablesFactory;
  65 import javafx.scene.control.test.utils.ptables.SpecialTablePropertiesProvider;
  66 import javafx.scene.control.test.utils.ptables.TabPaneWithControl;
  67 import javafx.scene.input.KeyCode;
  68 import javafx.scene.input.KeyEvent;
  69 import javafx.scene.layout.HBox;
  70 import javafx.scene.layout.Pane;
  71 import javafx.scene.layout.VBox;
  72 import javafx.util.Callback;
  73 import test.javaclient.shared.InteroperabilityApp;
  74 import test.javaclient.shared.Utils;
  75 import static org.junit.Assert.assertTrue;
  76 
  77 /**


 177 
 178             allPropertiesTables = new ArrayList<PropertiesTable>();
 179 
 180             PropertyTablesFactory.explorePropertiesList(testedControl, tb);
 181             PropertyTablesFactory.explorePropertiesList(testedControl.getSelectionModel(), tb);
 182             PropertyTablesFactory.explorePropertiesList(testedControl.getFocusModel(), tb);
 183             SpecialTablePropertiesProvider.provideForControl(testedControl, tb);
 184 
 185             tabPane = new TabPaneWithControl(TREE_TABLE_VIEW_TAB_NAME, tb);
 186             getControlOverItem(ROOT_NAME);
 187 
 188             tb.setStyle("-fx-border-color : yellow;");
 189 
 190             VBox vb = new VBox();
 191             vb.setSpacing(5);
 192 
 193             HBox hb = (HBox) getRoot();
 194             hb.setPadding(new Insets(5, 5, 5, 5));
 195             hb.setStyle("-fx-border-color : green;");
 196 
 197             Button resetButton = new Button("Reset");
 198             resetButton.setId(HARD_RESET_BUTTON_ID);
 199             resetButton.setOnAction(new EventHandler<ActionEvent>() {
 200                 public void handle(ActionEvent t) {
 201                     HBox hb = (HBox) getRoot();
 202                     hb.getChildren().clear();
 203                     prepareMainSceneStructure();
 204                     prepareScene();
 205                 }
 206             });
 207 
 208             Button autosize = new Button("Autosize");
 209             autosize.setId(AUTOSIZE_BUTTON_ID);
 210             autosize.setOnAction(new EventHandler<ActionEvent>() {
 211                 public void handle(ActionEvent t) {
 212                     testedControl.autosize();
 213                 }
 214             });
 215 
 216             VBox vbActionMakers = new VBox();
 217 
 218             vbActionMakers.getChildren().addAll(resetButton, autosize, new Separator(Orientation.HORIZONTAL),


 613             hb1.getChildren().addAll(new Label("Get tree item at"), tfParentName);
 614 
 615             HBox hb2 = new HBox(3);
 616             hb2.getChildren().addAll(button, content);
 617 
 618             VBox vb = new VBox();
 619             vb.getChildren().addAll(hb1, hb2);
 620             return vb;
 621         }
 622 
 623         Node getReplaceTableHeaderImplementationButton() {
 624             Button replaceButton = new Button("Replace skin implementation");
 625             replaceButton.setId(REPLACE_SKIN_IMPLEMENTATION_BUTTON_ID);
 626             replaceButton.setOnAction(new EventHandler<ActionEvent>() {
 627                 public void handle(ActionEvent t) {
 628                     testedControl.setSkin(new TreeTableViewSkin(testedControl) {
 629                         @Override
 630                         public String toString() {
 631                             return "CUSTOM " + super.toString();
 632                         }
 633 /*
 634                         @Override
 635                         protected TableHeaderRow createTableHeaderRow() {
 636                             return new TableHeaderRow(this) {
 637                                 @Override
 638                                 protected NestedTableColumnHeader createRootHeader() {
 639                                     return new NestedTableColumnHeader((TreeTableViewSkin) testedControl.getSkin(), null) {
 640                                         @Override
 641                                         protected TableColumnHeader createTableColumnHeader(TableColumnBase col) {
 642                                             if (col.getColumns().isEmpty()) {
 643                                                 final TableColumnHeader tableColumnHeader = new TableColumnHeader(getTableViewSkin(), col);
 644                                                 tableColumnHeader.setId(CUSTOM_IMPLEMENTATION_MARKER);
 645                                                 return tableColumnHeader;
 646                                             } else {
 647                                                 final NestedTableColumnHeader nestedTableColumnHeader = new NestedTableColumnHeader(getTableViewSkin(), col);
 648                                                 nestedTableColumnHeader.setId(CUSTOM_IMPLEMENTATION_MARKER);
 649                                                 return nestedTableColumnHeader;
 650                                             }
 651                                         }
 652                                     };
 653                                 }
 654                             };
 655                         }
 656 */
 657                     });
 658                 }
 659             });
 660 
 661             return replaceButton;
 662         }
 663 
 664         protected VBox getTabOverItemThroughGetItemMethodController() {
 665             final TextField tfParentName = new TextField();
 666             tfParentName.setPromptText("index");
 667             tfParentName.setPrefWidth(50);
 668 
 669             Button button = new Button("get table over");
 670             button.setOnAction(new EventHandler<ActionEvent>() {
 671                 public void handle(ActionEvent t) {
 672                     getControlOverItem(testedControl.getTreeItem(Integer.parseInt(tfParentName.getText())).getValue().toString());
 673                 }
 674             });
 675 
 676             HBox hb1 = new HBox(3);


 693             button.setOnAction(new EventHandler<ActionEvent>() {
 694                 public void handle(ActionEvent t) {
 695                     int found = testedControl.getRow(searchTreeItem(tfParentName.getText()));
 696                     index.setText(((Integer) found).toString());
 697                 }
 698             });
 699 
 700             HBox hb1 = new HBox(3);
 701             hb1.getChildren().addAll(new Label("Get index of"), tfParentName);
 702 
 703             HBox hb2 = new HBox(3);
 704             hb2.getChildren().addAll(index, button);
 705 
 706             VBox vb = new VBox();
 707             vb.getChildren().addAll(hb1, hb2);
 708             return vb;
 709         }
 710 
 711         private HBox getScrollToHBox() {
 712             HBox hb = new HBox();
 713             Button button = new Button("ScrollTo");
 714             button.setId(SCROLL_TO_BUTTON_ID);
 715             final TextField tf = new TextField("0");
 716             tf.setId(SCROLL_TO_TEXT_FIELD_ID);
 717             tf.setPrefWidth(50);
 718 
 719             button.setOnAction(new EventHandler<ActionEvent>() {
 720                 public void handle(ActionEvent t) {
 721                     testedControl.scrollTo(Integer.parseInt(tf.getText()));
 722                 }
 723             });
 724 
 725             hb.getChildren().addAll(tf, button);
 726             return hb;
 727         }
 728 
 729         private HBox getEditHBox() {
 730             HBox hb = new HBox();
 731             Button button = new Button("Edit");
 732             button.setId(EDIT_BUTTON_ID);
 733             final TextField tf = new TextField();
 734             tf.setPromptText("name");
 735             tf.setId(EDIT_TEXT_FIELD_ID);
 736             tf.setPrefWidth(50);
 737 
 738             button.setOnAction(new EventHandler<ActionEvent>() {
 739                 public void handle(ActionEvent t) {
 740                     throw new IllegalStateException("In build 101 was changed API of this function. Instead of 0, write index of edited treeItem please.");
 741                     //testedControl.edit(0/* searchTreeItem(tf.getText()) */, (TreeTableColumn) testedControl.getColumns().get(0));
 742                 }
 743             });
 744 
 745             hb.getChildren().addAll(tf, button);
 746             return hb;
 747         }
 748 
 749         private VBox setEventHandlersHBox() {
 750             VBox vb = new VBox();
 751 
 752             Button btn = new Button("Set onEdit event hadlers");
 753             btn.setId(BTN_SET_ON_EDIT_EVENT_HANDLERS);



 754             btn.setOnAction(new EventHandler<ActionEvent>() {
 755                 final EventHandler eventHandlerOnEditStart = new EventHandler() {
 756                     public void handle(Event t) {
 757                         tb.incrementCounter(COUNTER_EDIT_START);
 758                     }
 759                 };
 760                 final EventHandler eventHandlerOnEditCommit = new EventHandler<TreeTableColumn.CellEditEvent<DataItem, String>>() {
 761                     public void handle(TreeTableColumn.CellEditEvent<DataItem, String> event) {
 762                         tb.incrementCounter(COUNTER_EDIT_COMMIT);
 763                         DataItem data = event.getTreeTablePosition().getTreeItem().getValue();
 764                         StringProperty prop = data.get(event.getTableColumn().getText());
 765                         prop.setValue(event.getNewValue());
 766                     }
 767                 };
 768                 final EventHandler eventHandlerOnEditCancel = new EventHandler() {
 769                     public void handle(Event t) {
 770                         tb.incrementCounter(COUNTER_EDIT_CANCEL);
 771                     }
 772                 };
 773 
 774                 public void handle(ActionEvent t) {
 775                     for (Iterator it = testedControl.getColumns().iterator(); it.hasNext();) {
 776                         TreeTableColumn col = (TreeTableColumn) it.next();
 777 
 778                         col.setOnEditStart(eventHandlerOnEditStart);
 779                         assertTrue(eventHandlerOnEditStart == col.getOnEditStart());
 780 
 781                         col.setOnEditCommit(eventHandlerOnEditCommit);
 782                         assertTrue(eventHandlerOnEditCommit == col.getOnEditCommit());
 783 
 784                         col.setOnEditCancel(eventHandlerOnEditCancel);
 785                         assertTrue(eventHandlerOnEditCancel == col.getOnEditCancel());
 786                     }
 787                 }
 788             });
 789 
 790             Button btnAddFactory = new Button("Set cell factory for editing");
 791             btnAddFactory.setId(SET_CELL_FACTORY_FOR_EDITING);



 792             btnAddFactory.setOnAction(new EventHandler<ActionEvent>() {
 793                 public void handle(ActionEvent t) {
 794                     for (Object obj : testedControl.getColumns()) {
 795                         TreeTableColumn col = (TreeTableColumn) obj;
 796                         col.setCellFactory(TextFieldTreeTableCell.forTreeTableColumn());
 797                     }
 798                 }
 799             });
 800 
 801             vb.getChildren().addAll(btn, btnAddFactory);
 802             return vb;
 803         }
 804 
 805         private TreeItem<DataItem> searchTreeItem(String content) {
 806             return TreeTableNewApp.searchTreeItem(testedControl, content);
 807         }
 808 
 809         private Pane controlsForEditing() {
 810 
 811             VBox topContainer = new VBox(3.5);