×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Corey Magick
Added: Feb 25, 2015 10:05 PM
Views: 9
Tags: no tags
setting up table columns for editing
  1.  private void setTableView() {
  2.         generalTableView.setItems(data);
  3.          toolColumn.setCellValueFactory(cellData -> cellData.getValue().getNameProp());
  4.          toolColumn.setCellFactory(TextFieldTableCell.<GeneralHardware>forTableColumn());
  5.          toolColumn.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<GeneralHardware, String>>() {
  6.              /*  */
  7.             @Override
  8.             public void handle(TableColumn.CellEditEvent<GeneralHardware, String> event) {
  9.                 ((GeneralHardware) event.getTableView().getItems().get(event.getTablePosition().getRow())).setTool(event.getNewValue());
  10.             }
  11.         });
  12.          serialColumn.setCellValueFactory(cellData -> cellData.getValue().getSerNumberProp());
  13.          serialColumn.setCellFactory(TextFieldTableCell.<GeneralHardware>forTableColumn());
  14.          serialColumn.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<GeneralHardware, String>>() {
  15.              /*  */
  16.             @Override
  17.             public void handle(TableColumn.CellEditEvent<GeneralHardware, String> event) {
  18.                 ((GeneralHardware) event.getTableView().getItems().get(event.getTablePosition().getRow())).setSerial(event.getNewValue());
  19.             }
  20.         });
  21.     }