本文整理汇总了Java中javafx.scene.control.cell.TextFieldTableCell类的典型用法代码示例。如果您正苦于以下问题:Java TextFieldTableCell类的具体用法?Java TextFieldTableCell怎么用?Java TextFieldTableCell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextFieldTableCell类属于javafx.scene.control.cell包,在下文中一共展示了TextFieldTableCell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeParameterTable
import javafx.scene.control.cell.TextFieldTableCell; //导入依赖的package包/类
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);
}
示例2: initialize
import javafx.scene.control.cell.TextFieldTableCell; //导入依赖的package包/类
@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());
}
示例3: integerCell
import javafx.scene.control.cell.TextFieldTableCell; //导入依赖的package包/类
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;
}
}
});
}
示例4: initialize
import javafx.scene.control.cell.TextFieldTableCell; //导入依赖的package包/类
@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());
}
示例5: addCol
import javafx.scene.control.cell.TextFieldTableCell; //导入依赖的package包/类
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();
}
示例6: initializeColumnsTable
import javafx.scene.control.cell.TextFieldTableCell; //导入依赖的package包/类
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();
}
示例7: initializeTable
import javafx.scene.control.cell.TextFieldTableCell; //导入依赖的package包/类
@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);
}
示例8: initializeTable
import javafx.scene.control.cell.TextFieldTableCell; //导入依赖的package包/类
@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);
}
示例9: initialize
import javafx.scene.control.cell.TextFieldTableCell; //导入依赖的package包/类
@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")
);
}
示例10: call
import javafx.scene.control.cell.TextFieldTableCell; //导入依赖的package包/类
@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);
}
});
}
示例11: createMacros
import javafx.scene.control.cell.TextFieldTableCell; //导入依赖的package包/类
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);
}
示例12: ServerPane
import javafx.scene.control.cell.TextFieldTableCell; //导入依赖的package包/类
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();
}
示例13: initializeParameterTable
import javafx.scene.control.cell.TextFieldTableCell; //导入依赖的package包/类
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);
}
示例14: unsignedIntegerTextFieldTableCell
import javafx.scene.control.cell.TextFieldTableCell; //导入依赖的package包/类
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;
}
示例15: initTownZipCol
import javafx.scene.control.cell.TextFieldTableCell; //导入依赖的package包/类
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());
}