Java 类javafx.scene.control.cell.TextFieldTableCell 实例源码

项目:SONDY    文件:EventDetectionUI.java   
public final void initializeParameterTable(){
    parameterTable.setEditable(true);
    TableColumn keyColumn = new TableColumn("Parameter");
    keyColumn.setMinWidth(Main.columnWidthRIGHT/2-1);
    keyColumn.setCellValueFactory(new PropertyValueFactory<>("name"));
    TableColumn valueColumn = new TableColumn("Value");
    valueColumn.setMinWidth(Main.columnWidthRIGHT/2-1);
    valueColumn.setCellFactory(TextFieldTableCell.forTableColumn());
    valueColumn.setCellValueFactory(new PropertyValueFactory<>("value")); 
    valueColumn.setOnEditCommit(
        new EventHandler<CellEditEvent<Parameter, String>>() {
            @Override
            public void handle(CellEditEvent<Parameter, String> t) {
                ((Parameter) t.getTableView().getItems().get(t.getTablePosition().getRow())).setValue(t.getNewValue());
            }
        }
    );
    parameterTable.getColumns().addAll(keyColumn,valueColumn);
}
项目:drd    文件:ShopWeaponRangedController.java   
@Override
public void initialize(URL location, ResourceBundle resources) {
    this.resources = resources;
    tableRangedWeapons.setItems(rangedWeapons);
    tableRangedWeapons.getSelectionModel().selectedIndexProperty()
        .addListener((observable, oldValue, newValue) -> selectedRowIndex.setValue(newValue));

    columnImage.setCellValueFactory(new PropertyValueFactory<>("image"));
    columnImage.setCellFactory(param -> CellUtils.forImage());
    columnName.setCellValueFactory(new PropertyValueFactory<>("name"));
    columnAuthor.setCellValueFactory(new PropertyValueFactory<>("author"));
    columnStrength.setCellValueFactory(new PropertyValueFactory<>("strength"));
    columnRampancy.setCellValueFactory(new PropertyValueFactory<>("rampancy"));
    columnType.setCellValueFactory(new PropertyValueFactory<>("weaponType"));
    columnRangeLow.setCellValueFactory(new PropertyValueFactory<>("rangeLow"));
    columnRangeMedium.setCellValueFactory(new PropertyValueFactory<>("rangeMedium"));
    columnRangeLong.setCellValueFactory(new PropertyValueFactory<>("rangeLong"));
    columnType.setCellFactory(
        TextFieldTableCell.forTableColumn(StringConvertors.forRangedWeaponType(translator)));
    columnWeight.setCellValueFactory(new PropertyValueFactory<>("weight"));
    columnPrice.setCellValueFactory(new PropertyValueFactory<>("price"));
    columnAmmount.setCellValueFactory(new PropertyValueFactory<>("ammount"));
    columnAmmount.setCellFactory(param -> CellUtils.forMaxActValue());

    ObservableMergers.mergeList(RangedWeaponEntry::new, rangedWeapons, manager.selectAll());
}
项目:population    文件:PrimaryController.java   
private <T> Callback<TableColumn<T, Number>, TableCell<T, Number>> integerCell(
        Predicate<Integer> validator, int defaultValue) {
    return TextFieldTableCell.forTableColumn(new StringConverter<Number>() {
        @Override
        public String toString(Number object) {
            if (object == null) {
                return null;
            }
            return object.toString();
        }

        @Override
        public Number fromString(String string) {
            try {
                int value = Integer.parseInt(string);
                if (validator.test(value)) {
                    return value;
                } else {
                    return defaultValue;
                }
            } catch (NumberFormatException e) {
                return defaultValue;
            }
        }
    });
}
项目:Gargoyle    文件:HttpActionComposite.java   
@FXML
public void initialize() {
    tbhHeaders.setEditable(true);
    colHeaderKey.setEditable(true);
    colHeaderValue.setEditable(true);

    colHeaderKey.setCellFactory(TextFieldTableCell.forTableColumn());
    colHeaderKey.setCellValueFactory(val -> {
        return val.getValue().keyProperty();
    });
    colHeaderValue.setCellFactory(TextFieldTableCell.forTableColumn());
    colHeaderValue.setCellValueFactory(val -> {
        return val.getValue().valueProperty();
    });

    // CodeAreaHelper : 기본 텍스트 기능 지원.
    new CodeAreaHelper(txtRequest);
    new CodeAreaHelper(txtResponse);

    // 클립보드 기능
    FxUtil.installClipboardKeyEvent(tbhHeaders);
    // 컨텍스트 기능
    FxUtil.installContextMenu(contextMenu());
}
项目:zest-writer    文件:TableController.java   
private void addCol() {
    TableColumn tc = new TableColumn();
    tc.setEditable(true);
    tc.setCellValueFactory(param -> {
        CellDataFeatures<ZRow, String> dtf = (CellDataFeatures<ZRow, String>) param;
        return new SimpleStringProperty(dtf.getValue().getRow().get(0));
    });

    tc.setCellFactory(TextFieldTableCell.forTableColumn());
    tc.setOnEditCommit(t -> {
        CellEditEvent<ZRow, String> evt = (CellEditEvent<ZRow, String>) t;
        List<String> row = evt.getTableView().getItems().get(evt.getTablePosition().getRow()).getRow();
        row.set(evt.getTablePosition().getColumn(), evt.getNewValue());
    });
    tc.setPrefWidth(150);
    TextField txf = new TextField();
    txf.setPrefWidth(150);
    txf.setPromptText(Configuration.getBundle().getString("ui.dialog.table_editor.colon") +
            (tableView.getColumns().size()+1));
    tc.setGraphic(txf);
    tableView.getColumns().addAll(tc);
    postAddColumn();
}
项目:fx-log    文件:ColumnizersController.java   
private void initializeColumnsTable() {
    columnsTable.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    newColumnHeaderField.setMaxWidth(headerColumn.getPrefWidth());
    newColumnGroupField.setMaxWidth(capturingGroupColumn.getPrefWidth());

    ListBinding<ColumnDefinition> columnDefinitions =
            UIUtils.selectList(columnizersPane.selectedItemProperty(), Columnizer::getColumnDefinitions);

    visibleColumn.setCellFactory(
            CheckBoxTableCell.forTableColumn(index -> columnDefinitions.get(index).visibleProperty()));
    visibleColumn.setCellValueFactory(data -> data.getValue().headerLabelProperty());

    headerColumn.setCellFactory(TextFieldTableCell.forTableColumn());
    headerColumn.setCellValueFactory(data -> data.getValue().headerLabelProperty());

    capturingGroupColumn.setCellFactory(TextFieldTableCell.forTableColumn());
    capturingGroupColumn.setCellValueFactory(data -> data.getValue().capturingGroupNameProperty());

    descriptionColumn.setCellFactory(TextFieldTableCell.forTableColumn());
    descriptionColumn.setCellValueFactory(data -> data.getValue().descriptionProperty());

    columnsTable.itemsProperty().bind(columnDefinitions);

    initializeDeleteButtons();
}
项目:slogo    文件:Variables.java   
@SuppressWarnings("unchecked")
private void initializeTable () {
    this.setEditable(true);
    this.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    TableColumn<IVariable, String> nameColumn = new TableColumn<IVariable, String>("Name");
    TableColumn<IVariable, Double> valueColumn = new TableColumn<IVariable, Double>("Value");

    // set where to read values from
    nameColumn.setCellValueFactory(new PropertyValueFactory<IVariable, String>("name"));
    valueColumn.setCellValueFactory(new PropertyValueFactory<IVariable, Double>("value"));

    // set editable column (valueColumn)
    valueColumn.setCellFactory(TextFieldTableCell
            .<IVariable, Double> forTableColumn(new DoubleStringConverter()));

    // Set listener to execute when on edit commit runs
    valueColumn.setOnEditCommit( (CellEditEvent<IVariable, Double> event) -> setVariableValue(event));
    valueColumn.setEditable(true);

    this.getColumns().addAll(nameColumn, valueColumn);
}
项目:slogo    文件:TableWindow.java   
@SuppressWarnings("unchecked")
private void initializeTable () {
    this.setEditable(true);
    this.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    TableColumn<Object, String> nameColumn = new TableColumn<Object, String>("Name");
    TableColumn<Object, Double> valueColumn = new TableColumn<Object, Double>("Value");

    // set where to read values from
    nameColumn.setCellValueFactory(new PropertyValueFactory<Object, String>("name"));
    valueColumn.setCellValueFactory(new PropertyValueFactory<Object, Double>("value"));

    // set editable column (valueColumn)
    valueColumn.setCellFactory(TextFieldTableCell.<Object, Double> forTableColumn(new DoubleStringConverter()));

    // Set listener to execute when on edit commit runs
    valueColumn.setOnEditCommit( (CellEditEvent<Object, Double> event) -> setVariableValue(event));
    valueColumn.setEditable(true);

    this.getColumns().addAll(nameColumn, valueColumn);
}
项目:PVI    文件:ProvisionDialogController.java   
@Override
public void initialize(URL location, ResourceBundle resources) {

    nameColumn.setCellValueFactory(new PropertyValueFactory<>("name"));
    nameColumn.setCellFactory(TextFieldTableCell.forTableColumn());
    nameColumn.setOnEditCommit(event -> {
        event.getTableView().getItems().get(event.getTablePosition().getRow()).setName(event.getNewValue());
    });

    valueColumn.setCellValueFactory(new PropertyValueFactory<>("value"));
    valueColumn.setCellFactory(TextFieldTableCell.forTableColumn());
    valueColumn.setOnEditCommit(event -> {
        event.getTableView().getItems().get(event.getTablePosition().getRow()).setValue(event.getNewValue());
    });

    propertyTable.getItems().addAll(
            new PropertyValue("id", ""),
            new PropertyValue("port", ""),
            new PropertyValue("managed_by", "user")
    );
}
项目:manami    文件:AnimeInfoLinkCallback.java   
@Override
public TableCell<Anime, InfoLink> call(final TableColumn<Anime, InfoLink> arg0) {
    return new TextFieldTableCell<>(new StringConverter<InfoLink>() {

        @Override
        public String toString(final InfoLink infoLink) {
            if (infoLink == null) {
                return EMPTY;
            }

            return infoLink.getUrl();
        }


        @Override
        public InfoLink fromString(final String url) {
            return new InfoLink(url);
        }
    });
}
项目:org.csstudio.display.builder    文件:WidgetInfoDialog.java   
private Tab createMacros(Macros orig_macros)
{
    final Macros macros = (orig_macros == null) ? new Macros() : orig_macros;
    // Use text field to allow copying the name and value
    // Table uses list of macro names as input
    // Name column just displays the macro name,..
    final TableColumn<String, String> name = new TableColumn<>(Messages.WidgetInfoDialog_Name);
    name.setCellFactory(TextFieldTableCell.forTableColumn());
    name.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));

    // .. value column fetches the macro value
    final TableColumn<String, String> value = new TableColumn<>(Messages.WidgetInfoDialog_Value);
    value.setCellFactory(TextFieldTableCell.forTableColumn());
    value.setCellValueFactory(param -> new ReadOnlyStringWrapper(macros.getValue(param.getValue())));

    final TableView<String> table =
        new TableView<>(FXCollections.observableArrayList(macros.getNames()));
    table.getColumns().add(name);
    table.getColumns().add(value);
    table.setEditable(true);
    table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    return new Tab(Messages.WidgetInfoDialog_TabMacros, table);
}
项目:subshare    文件:ServerPane.java   
public ServerPane(final Server server) {
        this.server = assertNotNull(server, "server");
        loadDynamicComponentFxml(ServerPane.class, this);
        tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        tableView.getSelectionModel().getSelectedItems().addListener(selectionListener);
        for (final TableColumn<ServerRepoListItem, ?> tableColumn : tableView.getColumns()) {
            if ("nameColumn".equals(tableColumn.getId())) {
                final TableColumn<ServerRepoListItem, String> tc = cast(tableColumn);
                tc.setCellFactory(cast(TextFieldTableCell.forTableColumn()));
//              tc.setOnEditCommit(new EventHandler<CellEditEvent<ServerRepoListItem, String>>() { // not needed, anymore, because we use a StringProperty, now - only needed with plain getters+setters.
//                  @Override
//                  public void handle(CellEditEvent<ServerRepoListItem, String> event) {
//                      event.getRowValue().setName(event.getNewValue());
//                      getServerRepoRegistry().writeIfNeeded();
//                  }
//              });
            }
        }
        populateTableViewAsync();
        updateEnabled();
    }
项目:SONDY    文件:InfluenceAnalysisUI.java   
public final void initializeParameterTable(){
    parameterTable.setEditable(true);
    TableColumn keyColumn = new TableColumn("Parameter");
    keyColumn.setMinWidth(Main.columnWidthRIGHT/2-1);
    keyColumn.setCellValueFactory(new PropertyValueFactory<>("name"));
    TableColumn valueColumn = new TableColumn("Value");
    valueColumn.setMinWidth(Main.columnWidthRIGHT/2-1);
    valueColumn.setCellFactory(TextFieldTableCell.forTableColumn());
    valueColumn.setCellValueFactory(new PropertyValueFactory<>("value")); 
    valueColumn.setOnEditCommit(
        new EventHandler<TableColumn.CellEditEvent<Parameter, String>>() {
            @Override
            public void handle(TableColumn.CellEditEvent<Parameter, String> t) {
                ((Parameter) t.getTableView().getItems().get(t.getTablePosition().getRow())).setValue(t.getNewValue());
            }
        }
    );
    parameterTable.getColumns().addAll(keyColumn,valueColumn);
}
项目:LesPatternsDuSwag    文件:ParkingFloorTableView.java   
private TextFieldTableCell<ParkingTableViewRow, Integer> unsignedIntegerTextFieldTableCell() {
    TextFieldTableCell<ParkingTableViewRow, Integer> field = new TextFieldTableCell<>();
    field.setConverter(new IntegerStringConverter() {
        @Override
        public Integer fromString(String value) {
            try {
                Integer intValue = Math.max(1, Math.min(99, super.fromString(value)));
                return intValue > 0 ? intValue : 1;
            } catch (NumberFormatException e) {
                field.cancelEdit();
            }
            return Integer.MAX_VALUE;
        }
    });

    return field;
}
项目:jfxtables    文件:PersonTable.java   
private void initTownZipCol() {
    townZipCode.setCellFactory(TextFieldTableCell.forTableColumn(new StringConverter<Town>() {

        @Override
        public String toString(Town object) {
            if (object == null) {
                return DEFAULT_FILL;
            }
            return String.valueOf(object.getZipCode());
        }

        @Override
        public Town fromString(String string) {
            try {
                return townService.getTownForZip(Integer.parseInt(string));
            } catch (NumberFormatException e) {
                return null;
            }

        }
    }));
    townZipCode.setCellValueFactory(cellDataFeature -> cellDataFeature.getValue().townProperty());

}
项目:junit    文件:PolicyComposerController.java   
protected void setupPolicies() {
    // Bind to model
    policiesTable.itemsProperty().bindBidirectional(compositePoliciesProperty());
    // Bind selected policy
    selectedPolicyProperty().bind(policiesTable.getSelectionModel().selectedItemProperty());

    // Disable when no policy selected
    removeComposed.disableProperty().bind(selectedPolicyProperty().isNull());

    // Set up columns
    TableColumn<CompositePolicyModel, String> nameColumn = new TableColumn<>("Name");
    nameColumn.setCellValueFactory(new PropertyValueFactory<CompositePolicyModel, String>("name"));
    nameColumn.setCellFactory(TextFieldTableCell.<CompositePolicyModel> forTableColumn());
    nameColumn.setEditable(true);
    nameColumn.setPrefWidth(120);

    policiesTable.getColumns().setAll(ImmutableList.of(nameColumn));
}
项目:marathonv5    文件:RFXTextFieldTableCell.java   
@SuppressWarnings("unchecked") @Override public String _getValue() {
    TextFieldTableCell<?, ?> cell = (TextFieldTableCell<?, ?>) node;
    @SuppressWarnings("rawtypes")
    StringConverter converter = cell.getConverter();
    if (converter != null) {
        return converter.toString(cell.getItem());
    }
    return cell.getItem().toString();
}
项目:drd    文件:ShopWeaponMeleController.java   
@Override
public void initialize(URL location, ResourceBundle resources) {
    this.resources = resources;
    tableMeleWeapon.setItems(meleWeapons);
    tableMeleWeapon.getSelectionModel().selectedIndexProperty()
        .addListener((observable, oldValue, newValue) -> selectedRowIndex.setValue(newValue));

    columnImage.setCellValueFactory(new PropertyValueFactory<>("image"));
    columnImage.setCellFactory(param -> CellUtils.forImage());
    columnName.setCellValueFactory(new PropertyValueFactory<>("name"));
    columnAuthor.setCellValueFactory(new PropertyValueFactory<>("author"));
    columnStrength.setCellValueFactory(new PropertyValueFactory<>("strength"));
    columnRampancy.setCellValueFactory(new PropertyValueFactory<>("rampancy"));
    columnDefence.setCellValueFactory(new PropertyValueFactory<>("defence"));
    columnClass.setCellValueFactory(new PropertyValueFactory<>("weaponClass"));
    columnClass.setCellFactory(
        TextFieldTableCell.forTableColumn(StringConvertors.forMeleWeaponClass(translator)));
    columnType.setCellValueFactory(new PropertyValueFactory<>("weaponType"));
    columnType.setCellFactory(
        TextFieldTableCell.forTableColumn(StringConvertors.forMeleWeaponType(translator)));
    columnWeight.setCellValueFactory(new PropertyValueFactory<>("weight"));
    columnPrice.setCellValueFactory(new PropertyValueFactory<>("price"));
    columnAmmount.setCellValueFactory(new PropertyValueFactory<>("ammount"));
    columnAmmount.setCellFactory(param -> CellUtils.forMaxActValue());

    ObservableMergers.mergeList(MeleWeaponEntry::new, meleWeapons, manager.selectAll());
}
项目:cassandra-client    文件:UIUtil.java   
public static <S, T> Callback<TableColumn<S, T>, TableCell<S, T>> cellFactory(
        TypeCodec<T> codec) {
    return TextFieldTableCell.forTableColumn(new StringConverter<T>() {
        @Override
        public String toString(T object) {
            return codec.format(object);
        }

        @Override
        public T fromString(String string) {
            return codec.parse(string);
        }
    });
}
项目:stvs    文件:VariableCollectionController.java   
private TableCell<FreeVariable, String> cellFactory(
        TableColumn<FreeVariable, String> tableColumn) {
    return new TextFieldTableCell<FreeVariable, String>(new DefaultStringConverter()) {
        {
            validator.problemsProperty().addListener((Observable o) -> onProblemsChanged());
            getStyleClass().add("freevar");
            onProblemsChanged();
        }

        private void configureProblematic(String tooltip) {
            getStyleClass().remove("freevar-problem");
            getStyleClass().add("freevar-problem");
            setTooltip(new Tooltip(tooltip));
        }

        private void configureUnproblematic() {
            getStyleClass().remove("freevar-problem");
            setTooltip(null);
        }

        @Override
        public void updateItem(String item, boolean empty) {
            super.updateItem(item, empty);
            onProblemsChanged();
        }

        private void onProblemsChanged() {
            if (!isEmpty()) {
                List<FreeVariableProblem> problems = validator.problemsProperty().get()
                        .getOrDefault(getTableRow().getItem(), Collections.emptyList());
                if (problems.isEmpty()) {
                    configureUnproblematic();
                } else {
                    configureProblematic(String.join("\n\n", problems.stream()
                            .map(FreeVariableProblem::getGuiMessage).collect(Collectors.toList())));
                }
            }
        }
    };
}
项目:xbrowser    文件:TableView.java   
private TableColumn processStringColumnName(String name){
    TableColumn column = new TableColumn(name);
    column.setCellValueFactory( p -> ((TableColumn.CellDataFeatures<Item, Object>)p).getValue().getStringProperty(name));
    column.setCellFactory(TextFieldTableCell.forTableColumn());
    column.setOnEditCommit( t -> {
        int index = ((TableColumn.CellEditEvent<Item, Object>) t).getTablePosition().getRow();
        Item item = ((TableColumn.CellEditEvent<Item, Object>) t).getTableView().getItems().get(index);
        item.setProperty(name,((TableColumn.CellEditEvent<Item, Object>) t).getNewValue());
            });
    columnMap.put(name, column);
    return column;
}
项目:population    文件:PrimaryController.java   
private <T> Callback<TableColumn<T, Number>, TableCell<T, Number>> doubleCell(
        Predicate<Double> validator, double defaultValue, String format) {
    DecimalFormat formatter = new DecimalFormat(format);
    return TextFieldTableCell.forTableColumn(new StringConverter<Number>() {
        @Override
        public String toString(Number object) {
            if (object == null) {
                return null;
            }
            return formatter.format(object.doubleValue());
        }

        @Override
        public Number fromString(String string) {
            try {
                double value = NumberFormat.getInstance().parse(string).doubleValue();
                if (validator.test(value)) {
                    return value;
                } else {
                    return defaultValue;
                }
            } catch (NumberFormatException | ParseException | NullPointerException e) {
                return defaultValue;
            }
        }
    });
}
项目:Gargoyle    文件:FixedTableViewExam.java   
public CTableColumn(String text, String fieldName) {
    super(text);
    setCellFactory(param -> new TextFieldTableCell<TbmSysDaoDVO, String>());

    Callback<javafx.scene.control.TableColumn.CellDataFeatures<TbmSysDaoDVO, String>, ObservableValue<String>> value = param -> {
        try {
            Object fieldValue = ObjectUtil.getDeclaredFieldValue(param.getValue(), fieldName);
            return (ObservableValue<String>) fieldValue;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return param.getValue().classNameProperty();
    };
    setCellValueFactory(value);
}
项目:Gargoyle    文件:CrudBaseColumnMapper.java   
/**
 * 타입 컨버터
 *
 * @param textFieldTableCell
 *
 * @Date 2015. 10. 8.
 * @param classType
 * @return
 * @User KYJ
 */
private StringConverter<Object> converter(TextFieldTableCell<T, Object> textFieldTableCell, Class<?> classType) {

    return new StringConverter<Object>() {

        @Override
        public String toString(Object object) {
            if (object == null)
                return "";

            return object.toString();
        }

        @Override
        public Object fromString(String string) {

            if (Property.class.isAssignableFrom(classType)) {
                if (classType == BooleanProperty.class) {
                    return Boolean.valueOf(string);
                }
            } else if (classType == boolean.class || classType == Boolean.class) {
                return Boolean.valueOf(string);
            }
            return string;
        }

    };
}
项目:Gargoyle    文件:SqlMappingTableViewRegister.java   
private void binding(List<Map<String, Object>> query) {
    Map<String, Object> map = query.get(0);
    Iterator<String> iterator = map.keySet().iterator();
    // tbResult.getColumns().add(tcSelectRow);
    while (iterator.hasNext()) {
        String column = iterator.next();
        TableColumn<Map<String, Object>, Object> e = new TableColumn<>(column);

        e.setCellFactory(arg -> {
            return new TextFieldTableCell<>();
        });

        e.setCellValueFactory(arg -> {
            Object value = arg.getValue().get(column);
            return new SimpleObjectProperty<>(value);
        });
        e.setComparator((a, b) -> {

            if (a == null && b == null)
                return 0;

            if (a == null)
                return -1;

            if (b == null)
                return -1;

            if (ValueUtil.isNumber(a.toString()) && ValueUtil.isNumber(b.toString())) {
                return Double.compare(Double.parseDouble(a.toString()), Double.parseDouble(b.toString()));
            } else {
                return Strings.compareTo(a.toString(), b.toString());
            }

        });
        tbData.getColumns().add(e);
    }
}
项目:boolean-simplifier-visualizer    文件:Main.java   
public TableColumn<TTRow, String> createTableColumn(String name, String input, TruthTable m) {
    TableColumn<TTRow, String> tc = new TableColumn<TTRow, String>(name);
    tc.setMinWidth((tableSize / (tt.getInputs().size() + 1)) + 1);
    tc.setMaxWidth((tableSize / (tt.getInputs().size() + 1)) + 1);
    tc.setCellValueFactory(new PropertyValueFactory<>(input));

    if (input.equals("4")) {
        if (!tt.isTrue() && m==tt) {

            tc.setCellFactory(TextFieldTableCell.forTableColumn());
            tc.setOnEditCommit(new EventHandler<CellEditEvent<TTRow, String>>() {
                TableView<TTRow> old = tableV1;

                public void handle(CellEditEvent<TTRow, String> t) {

                    if (t.getNewValue().equals("1") || t.getNewValue().equals("0")) {
                        System.out.println(t.getOldValue());
                        ((TTRow) t.getTableView().getItems().get(t.getTablePosition().getRow())).getCol()[t
                                                                                                          .getTablePosition().getColumn()] = t.getNewValue();
                        tt.edit(t.getTablePosition().getColumn(), t.getTablePosition().getRow(), t.getNewValue());
                        updatetableV2();
                        kmap.drawKMap(tt, tt.getInputs().size(), pane, (int)(Screen.getPrimary().getVisualBounds().getWidth()/2)-(15*tt.getInputs().size()), 10);
                    } else {
                        tableV1 = old;
                    }
                    refreshTable(tableV1);
                    refreshTableV2(tableV2);
                }
            });
        }
    }
    tc.getStyleClass().add("tablecolumn");
    return tc;
}
项目:neural-style-gui    文件:MainController.java   
private void setupContentLayersTable() {
    log.log(Level.FINER, "Setting content layer table list.");
    contentLayersTable.setItems(contentLayers);
    contentLayersTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    log.log(Level.FINER, "Setting content layer table selection listener.");
    EventStreams.changesOf(contentLayers).subscribe(change -> {
        log.log(Level.FINE, "contentLayers changed");

        List<NamedSelection> selectedContentLayers = contentLayers.stream()
                .filter(NamedSelection::isSelected)
                .collect(Collectors.toList());

        String[] newContentLayers = new String[selectedContentLayers.size()];
        for (int i = 0; i < selectedContentLayers.size(); i++)
            newContentLayers[i] = selectedContentLayers.get(i).getName();
        neuralStyle.setContentLayers(newContentLayers);

        toggleStyleButtons();
    });

    log.log(Level.FINER, "Setting style layer table shortcut listener");
    EventStreams.eventsOf(contentLayersTable, KeyEvent.KEY_RELEASED).filter(spaceBar::match).subscribe(keyEvent -> {
        ObservableList<NamedSelection> selectedStyleLayers =
                contentLayersTable.getSelectionModel().getSelectedItems();
        for (NamedSelection neuralLayer : selectedStyleLayers)
            neuralLayer.setSelected(!neuralLayer.isSelected());
    });

    log.log(Level.FINER, "Setting content layer table column factories.");
    contentLayersTableSelected.setCellValueFactory(new PropertyValueFactory<>("selected"));
    contentLayersTableSelected.setCellFactory(CheckBoxTableCell.forTableColumn(contentLayersTableSelected));

    contentLayersTableName.setCellValueFactory(new PropertyValueFactory<>("name"));
    contentLayersTableName.setCellFactory(TextFieldTableCell.forTableColumn());
}
项目:opc-ua-client    文件:AttributeItemCellFactory.java   
@Override
public TableCell<AttributeItem, String> call(TableColumn<AttributeItem, String> param) {

  return new TextFieldTableCell<AttributeItem, String>(converter) {
    @Override
    public void startEdit() {
      AttributeItem model = getTableView().getSelectionModel().getSelectedItem();
      setEditable(model != null && model.isEditable());
      super.startEdit();
    }
  };
}
项目:openjfx-8u-dev-tests    文件:NewTableViewApp.java   
private void setTextFieldCellEditor(boolean isCustom) {
    for (TableColumn col : testedTableView.getColumns()) {
        if (!isCustom) {
            col.setCellFactory(TextFieldTableCell.forTableColumn());
        } else {
            col.setCellFactory(new Callback() {
                public Object call(Object p) {
                    return new EditingTextFieldCell();
                }
            });
        }
    }
}
项目:TableFilterFX    文件:SampleFilteredTable.java   
private TableView<Pojo> buildTable() {
    TableView<Pojo> table = new TableView<>();
    table.setEditable(true);
    table.getItems().addAll(buildPojoList());
    TableColumn<Pojo, String> columnA = new TableColumn<>("ColA");
    TableColumn<Pojo, String> columnB = new TableColumn<>("ColB");
    TableColumn<Pojo, Number> columnC = new TableColumn<>("ColB");
    columnA.setCellValueFactory(new PropertyValueFactory<Pojo, String>("a"));
    columnB.setCellValueFactory(new PropertyValueFactory<Pojo, String>("b"));
    columnC.setCellValueFactory(new PropertyValueFactory<Pojo, Number>("c"));
    columnA.setCellFactory(TextFieldTableCell.forTableColumn());
    columnB.setCellFactory(TextFieldTableCell.forTableColumn());
    columnC.setCellFactory(param -> new TextFieldTableCell<>(new NumberStringConverter()));
    columnA.setOnEditCommit(event -> event.getRowValue().setA(event.getNewValue()));
    columnB.setOnEditCommit(event -> event.getRowValue().setB(event.getNewValue()));
    columnC.setOnEditCommit(event -> event.getRowValue().setC(event.getNewValue().intValue()));
    columnA.setSortable(true);
    columnB.setSortable(true);
    columnC.setSortable(true);
    table.getColumns().add(columnA);
    table.getColumns().add(columnB);
    table.getColumns().add(columnC);
    columnA.prefWidthProperty().bind(table.widthProperty().multiply(0.33));
    columnB.prefWidthProperty().bind(table.widthProperty().multiply(0.33));
    columnC.prefWidthProperty().bind(table.widthProperty().multiply(0.33));

    TableFilter<Pojo> tableFilter = new TableFilter<>(table);
    tableFilter.filterColumn(columnA);
    tableFilter.filterColumn(columnB);
    tableFilter.filterColumn(columnC);

    return table;
}
项目:examples-javafx-repos1    文件:BigTableController.java   
@FXML
    public void initialize() {

        btnSave.disableProperty().bind( dirtyFlag.not() );

        // id is read-only
/*      tcId.setCellValueFactory(new PropertyValueFactory<MyObject,Number>("id") {

            @Override
            public ObservableValue<Number> call(CellDataFeatures<MyObject, Number> param) {
                return new ReadOnlyObjectWrapper<Number>(param.getValue().getId());
            }

        });     
*/
        tcId.setCellValueFactory(new PropertyValueFactory<MyObject,Number>("id"));      

        tcData.setCellValueFactory(new PropertyValueFactory<MyObject,String>("data"){           
            @Override
            public ObservableValue<String> call(CellDataFeatures<MyObject, String> param) {
                System.out.println("pvCounter=" + pvCounter++);
                return new ReadOnlyObjectWrapper<String>(param.getValue().getData());
            }

        });
        tcData.setCellFactory(TextFieldTableCell.forTableColumn());             
        tcData.setOnEditCommit( dataEditCommitHandler );        

    }
项目:WhoWhatWhere    文件:AppearanceCounterUI.java   
private void setIPNotesColumnBehavior()
{
    columnNotes.setCellFactory(TextFieldTableCell.forTableColumn()); //make Notes column editable
    columnNotes.setOnEditStart(rowModel ->
    {
        editedNotedWasEmpty = rowModel.getOldValue().equals(emptyNotesString);
        if (editedNotedWasEmpty)
        {
            rowModel.getRowValue().setNotes("");
            rowWithNoteBeingEdited = rowModel.getRowValue();
        }
    });
    columnNotes.setOnEditCancel(rowModel -> 
    {
        if (editedNotedWasEmpty)
            rowWithNoteBeingEdited.setNotes(emptyNotesString);
    });
    columnNotes.setOnEditCommit(rowModel ->
    {
        String newContent = rowModel.getNewValue().isEmpty() ? emptyNotesString : rowModel.getNewValue();
        String ipAddress = rowModel.getRowValue().ipAddressProperty().get();

        rowModel.getRowValue().setNotes(newContent);

        if (newContent.equals(emptyNotesString)) //if user deleted an existing note
            ipNotes.removeIPNote(ipAddress); //doesn't do anything if the key didn't exist
        else
            ipNotes.addIPNote(ipAddress, newContent);

        ipNotes.saveIPNotes();
    });
}
项目:WhoWhatWhere    文件:ManageIPNotesController.java   
@Override
public void initialize(URL location, ResourceBundle resources)
{
    columnIP.setCellValueFactory(new PropertyValueFactory<IPNotesRowModel, String>("ipAddress"));
    columnIP.setCellFactory(TextFieldTableCell.forTableColumn());

    columnNotes.setCellValueFactory(new PropertyValueFactory<IPNotesRowModel, String>("notes"));
    columnNotes.setCellFactory(TextFieldTableCell.forTableColumn());

    tableEntries.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    GUIController.setCommonGraphicOnLabeled(btnAddRow, GUIController.CommonGraphicImages.ADD);
    GUIController.setCommonGraphicOnLabeled(btnRemoveRow, GUIController.CommonGraphicImages.REMOVE);
    GUIController.setCommonGraphicOnLabeled(btnClose, GUIController.CommonGraphicImages.OK);
}
项目:ShootOFF    文件:TagEditorPane.java   
@SuppressWarnings("unchecked")
public TagEditorPane(Map<String, String> tags) {
    tagTable.setEditable(true);
    tagTable.setPrefHeight(200);
    tagTable.setPrefWidth(200);

    final TableColumn<Tag, String> nameCol = new TableColumn<>("Name");
    nameCol.setCellValueFactory(new PropertyValueFactory<Tag, String>("name"));
    nameCol.setCellFactory(TextFieldTableCell.<Tag> forTableColumn());
    nameCol.setOnEditCommit((t) -> {
        t.getTableView().getItems().get(t.getTablePosition().getRow()).setName(t.getNewValue());
    });

    final TableColumn<Tag, String> valueCol = new TableColumn<>("Value");
    valueCol.setCellFactory(TextFieldTableCell.<Tag> forTableColumn());
    valueCol.setCellValueFactory(new PropertyValueFactory<Tag, String>("value"));
    valueCol.setOnEditCommit((t) -> {
        t.getTableView().getItems().get(t.getTablePosition().getRow()).setValue(t.getNewValue());
    });

    tagTable.getColumns().addAll(nameCol, valueCol);
    final ObservableList<Tag> data = FXCollections.observableArrayList();

    for (final Entry<String, String> entry : tags.entrySet())
        data.add(new Tag(entry.getKey(), entry.getValue()));

    tagTable.setItems(data);

    tagTable.setOnMouseClicked((event) -> {
        if (event.getClickCount() == 2) {
            data.add(new Tag("", ""));
        }
    });

    getChildren().add(tagTable);
}
项目:mzmine3    文件:MsSpectrumLayersDialogController.java   
public void initialize() {

    final ObservableList<MsSpectrumType> renderingChoices =
        FXCollections.observableArrayList(MsSpectrumType.CENTROIDED, MsSpectrumType.PROFILE);
    renderingTypeColumn.setCellFactory(ChoiceBoxTableCell.forTableColumn(renderingChoices));

    colorColumn.setCellFactory(column -> new ColorTableCell<MsSpectrumDataSet>(column));

    lineThicknessColumn
        .setCellFactory(column -> new SpinnerTableCell<MsSpectrumDataSet>(column, 1, 5));

    intensityScaleColumn.setCellFactory(TextFieldTableCell.forTableColumn(
        new NumberStringConverter(MZmineCore.getConfiguration().getIntensityFormat())));

    showDataPointsColumn
        .setCellFactory(column -> new CheckBoxTableCell<MsSpectrumDataSet, Boolean>() {
          {
            tableRowProperty().addListener(e -> {
              TableRow<?> row = getTableRow();
              if (row == null)
                return;
              MsSpectrumDataSet dataSet = (MsSpectrumDataSet) row.getItem();
              if (dataSet == null)
                return;
              disableProperty()
                  .bind(dataSet.renderingTypeProperty().isEqualTo(MsSpectrumType.CENTROIDED));

            });
          }
        });
  }
项目:manami    文件:DefaultCallback.java   
@Override
public TableCell<Anime, String> call(final TableColumn<Anime, String> column) {
    return new TextFieldTableCell<Anime, String>(new DefaultStringConverter()) {

        @Override
        public void updateItem(final String value, final boolean empty) {
            super.updateItem(value, empty);
        }
    };
}
项目:manami    文件:AnimeEpisodesCallback.java   
@Override
public TableCell<Anime, Integer> call(final TableColumn<Anime, Integer> arg0) {
    return new TextFieldTableCell<Anime, Integer>(new IntegerStringConverter()) {

        @Override
        public void updateItem(final Integer value, final boolean empty) {
            super.updateItem(value, empty);
        }
    };
}
项目:org.csstudio.display.builder    文件:WidgetInfoDialog.java   
private Tab createProperties(final Widget widget)
 {
     // Use text field to allow copying the name (for use in scripts)
     // and value, but not the localized description and category
     // which are just for information
     final TableColumn<WidgetProperty<?>, String> cat = new TableColumn<>(Messages.WidgetInfoDialog_Category);
     cat.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue().getCategory().getDescription()));

     final TableColumn<WidgetProperty<?>, String> descr = new TableColumn<>(Messages.WidgetInfoDialog_Property);
     descr.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue().getDescription()));

     final TableColumn<WidgetProperty<?>, String> name = new TableColumn<>(Messages.WidgetInfoDialog_Name);
     name.setCellFactory(TextFieldTableCell.forTableColumn());
     name.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue().getName()));

     final TableColumn<WidgetProperty<?>, String> value = new TableColumn<>(Messages.WidgetInfoDialog_Value);
     value.setCellFactory(TextFieldTableCell.forTableColumn());
     value.setCellValueFactory(param -> new ReadOnlyStringWrapper(Objects.toString(param.getValue().getValue())));

     final TableView<WidgetProperty<?>> table =
         new TableView<>(FXCollections.observableArrayList(widget.getProperties()));
     table.getColumns().add(cat);
     table.getColumns().add(descr);
     table.getColumns().add(name);
     table.getColumns().add(value);
     table.setEditable(true);
     table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

     return new Tab(Messages.WidgetInfoDialog_TabProperties, table);
}
项目:javafx-dpi-scaling    文件:AdjusterTest.java   
@Test
public void testGetTextFieldTableCellAdjuster() {
    Adjuster adjuster = Adjuster.getAdjuster(TextFieldTableCell.class);

    assertThat(adjuster, is(instanceOf(ControlAdjuster.class)));
    assertThat(adjuster.getNodeClass(), is(sameInstance(Control.class)));
}
项目:aws-client    文件:Controller.java   
private TableColumn<List<StringProperty>, String> createColumn(
        final int columnIndex,
        String columnTitle
) {

    TableColumn<List<StringProperty>, String> column = new TableColumn<>();
    column.setText(columnTitle);

    column.setCellValueFactory(cellDataFeatures -> {
        List<StringProperty> row = cellDataFeatures.getValue();
        if (columnIndex >= row.size()) {
            return new SimpleStringProperty("");
        } else {
            return row.get(columnIndex);
        }

    });

    column.setCellFactory(column1 -> {
        TableCell<List<StringProperty>, String> cell = new TextFieldTableCell<>();
        cell.addEventFilter(MouseEvent.MOUSE_CLICKED, e ->
                cell.setStyle("-fx-border-color:black black black black;-fx-background-color:#005BD1;-fx-text-fill:white")
        );
        cell.addEventFilter(MouseEvent.MOUSE_EXITED, e ->
                cell.setStyle("")
        );
        return cell;

    });
    return column;
}