本文整理汇总了Java中javafx.scene.control.TableColumn.CellDataFeatures类的典型用法代码示例。如果您正苦于以下问题:Java CellDataFeatures类的具体用法?Java CellDataFeatures怎么用?Java CellDataFeatures使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CellDataFeatures类属于javafx.scene.control.TableColumn包,在下文中一共展示了CellDataFeatures类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addCol
import javafx.scene.control.TableColumn.CellDataFeatures; //导入依赖的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();
}
示例2: getTableColumn
import javafx.scene.control.TableColumn.CellDataFeatures; //导入依赖的package包/类
@Override
public TableColumn<SelectionTableRowData, Boolean> getTableColumn() {
TableColumn<SelectionTableRowData, Boolean> tableColumn = new TableColumn<>(getColumnTitle());
tableColumn.setCellFactory(CheckBoxTableCell.forTableColumn(tableColumn));
tableColumn.setCellValueFactory(
new Callback<CellDataFeatures<SelectionTableRowData, Boolean>, ObservableValue<Boolean>>() {
@Override
public ObservableValue<Boolean> call(CellDataFeatures<SelectionTableRowData, Boolean> param) {
if (param.getValue() != null) {
return param.getValue().reverse;
}
return null;
}
});
return tableColumn;
}
示例3: buildFilterTable
import javafx.scene.control.TableColumn.CellDataFeatures; //导入依赖的package包/类
/** build FILTER table */
private TableView<String> buildFilterTable()
{
final TableView<String> table=new TableView<>();
final TableColumn<String,String> scol = new TableColumn<>("Filter");
scol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<String,String>, ObservableValue<String>>() {
@Override
public ObservableValue<String> call(CellDataFeatures<String, String> param) {
return new ReadOnlyObjectWrapper<String>(param.getValue());
}
});
table.getColumns().add(scol);
table.setPlaceholder(new Label("No Variant or Variant contains no Filter"));
return table;
}
示例4: call
import javafx.scene.control.TableColumn.CellDataFeatures; //导入依赖的package包/类
@Override
public ObservableValue<String> call(CellDataFeatures<EventInstance, String> p) {
EventInstance event = p.getValue();
Object refValue = event.getParameters().get(reference);
if (refValue != null) {
String string = stringGetter.apply(refValue);
ObservableValue<String> result = new ReadOnlyObjectWrapper<String>(string);
return result;
}
return null;
}
示例5: updateNameColumn
import javafx.scene.control.TableColumn.CellDataFeatures; //导入依赖的package包/类
private void updateNameColumn(TableColumn<TableCreature, String> nameColumn) {
nameColumn.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<TableCreature, String>, ObservableValue<String>>() {
@Override
public ObservableValue<String> call(CellDataFeatures<TableCreature, String> p) {
return new SimpleStringProperty(p.getValue().name);
}
});
}
示例6: updateDnaSequenceColumn
import javafx.scene.control.TableColumn.CellDataFeatures; //导入依赖的package包/类
private void updateDnaSequenceColumn(TableColumn<TableCreature, String> dnaSequenceColumn) {
dnaSequenceColumn.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<TableCreature, String>, ObservableValue<String>>() {
@Override
public ObservableValue<String> call(CellDataFeatures<TableCreature, String> p) {
return new SimpleStringProperty(p.getValue().dnaSequence);
}
});
}
示例7: updateAmountColumn
import javafx.scene.control.TableColumn.CellDataFeatures; //导入依赖的package包/类
private void updateAmountColumn(TableColumn<TableCreature, String> amountColumn) {
amountColumn.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<TableCreature, String>, ObservableValue<String>>() {
@Override
public ObservableValue<String> call(CellDataFeatures<TableCreature, String> p) {
return new SimpleStringProperty(p.getValue().amount);
}
});
}
示例8: createColumn
import javafx.scene.control.TableColumn.CellDataFeatures; //导入依赖的package包/类
@Deprecated
TableColumn<Map<String, Object>, Object> createColumn(String column) {
TableColumn<Map<String, Object>, Object> tableColumn = new TableColumn<>(column);
tableColumn.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Map<String, Object>, Object>, ObservableValue<Object>>() {
@Override
public ObservableValue<Object> call(CellDataFeatures<Map<String, Object>, Object> param) {
return new SimpleObjectProperty<>(param.getValue().get(column));
}
});
return tableColumn;
}
示例9: getCellValueFactory
import javafx.scene.control.TableColumn.CellDataFeatures; //导入依赖的package包/类
public static <D>
Callback<CellDataFeatures<D,?>, ObservableValue<?>> getCellValueFactory(PropertyDescriptor pds) {
return a -> {
try {
return ObservableConstant.of(pds.getReadMethod().invoke(a.getValue()));
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new UndeclaredThrowableException(e);
}
};
}
示例10: mapIndexesToCellValues
import javafx.scene.control.TableColumn.CellDataFeatures; //导入依赖的package包/类
/**
* map indexs of the items to the items
*/
private void mapIndexesToCellValues() {
mapCellValuesToRowIndexes.clear();
for (int i = 0; i < tableFilter.getUnfilteredItems().size(); i++) {
S item = tableFilter.getUnfilteredItems().get(i);
T cellValue = column.getCellValueFactory().call(new CellDataFeatures<>(tableFilter.getTableView(), column, item)).getValue();
List<Integer> indexes = mapCellValuesToRowIndexes.get(cellValue);
if (indexes == null) {
indexes = new ArrayList<>();
mapCellValuesToRowIndexes.put(cellValue, indexes);
}
indexes.add(i);
}
}
示例11: initialize
import javafx.scene.control.TableColumn.CellDataFeatures; //导入依赖的package包/类
@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 );
}
示例12: addShotTimerColumn
import javafx.scene.control.TableColumn.CellDataFeatures; //导入依赖的package包/类
/**
* Adds a column to the shot timer table. The <tt>name</tt> is used to
* reference this column for the purposes of setting text and cleaning up.
*
* @param name
* both the text that will appear for name of the column and the
* name used to reference this column whenever it needs to be
* looked up
* @param width
* the width of the new column
*
* @since 1.3
*/
public void addShotTimerColumn(String name, int width) {
final TableColumn<ShotEntry, String> newCol = new TableColumn<>(name);
newCol.setPrefWidth(width);
newCol.setCellValueFactory(new Callback<CellDataFeatures<ShotEntry, String>, ObservableValue<String>>() {
@Override
public ObservableValue<String> call(CellDataFeatures<ShotEntry, String> p) {
return new SimpleStringProperty(p.getValue().getExerciseValue(name));
}
});
exerciseColumns.put(name, newCol);
shotTimerTable.getColumns().add(newCol);
}
示例13: buildColumnMappings
import javafx.scene.control.TableColumn.CellDataFeatures; //导入依赖的package包/类
private LinkedHashMap<String, TableColumn<TorrentView, ?>> buildColumnMappings() {
final Callback<CellDataFeatures<TorrentView, String>, ObservableValue<String>> priorityValueFactory =
tj -> tj.getValue().lifeCycleChangeProperty();
final Callback<CellDataFeatures<TorrentView, String>, ObservableValue<String>> nameValueFactory =
tj -> new ReadOnlyObjectWrapper<>(tj.getValue().getFileName());
final Callback<CellDataFeatures<TorrentView, Number>, ObservableValue<Number>> sizeValueFactory =
tj -> new ReadOnlyObjectWrapper<>(tj.getValue().getTotalLength());
final Callback<CellDataFeatures<TorrentView, Number>, ObservableValue<Number>> selectedSizeValueFactory =
tj -> tj.getValue().selectedLengthProperty();
final Callback<CellDataFeatures<TorrentView, Number>, ObservableValue<Number>> addedValueFactory =
tj -> new ReadOnlyObjectWrapper<>(tj.getValue().getAddedOnTime());
final Callback<CellDataFeatures<TorrentView, String>, ObservableValue<String>> trackerValueFactory =
tj -> new ReadOnlyObjectWrapper<>(tj.getValue().getTrackerUrl());
final TableColumn<TorrentView, ?> priorityColumn = TableUtils.buildColumn(priorityValueFactory,
val -> val.getLifeCycleChange(),
GuiUtils.RIGHT_ALIGNED_COLUMN_HEADER_TYPE_NAME, PRIORITY_COLUMN_LABEL);
torrentTable.getSortOrder().add(priorityColumn);
final LinkedHashMap<String, TableColumn<TorrentView, ?>> columnMappings = new LinkedHashMap<>();
columnMappings.put(PRIORITY_COLUMN_LABEL, priorityColumn);
columnMappings.put(NAME_COLUMN_LABEL, TableUtils.buildColumn(nameValueFactory, tj -> tj.getFileName(),
GuiUtils.LEFT_ALIGNED_COLUMN_HEADER_TYPE_NAME, NAME_COLUMN_LABEL));
columnMappings.put(SIZE_COLUMN_LABEL, TableUtils.buildColumn(sizeValueFactory, tj ->
UnitConverter.formatByteCount(tj.getTotalLength()),
GuiUtils.RIGHT_ALIGNED_COLUMN_HEADER_TYPE_NAME, SIZE_COLUMN_LABEL));
columnMappings.put(SELECTED_SIZE_COLUMN_LABEL, TableUtils.buildColumn(selectedSizeValueFactory, tj ->
UnitConverter.formatByteCount(tj.getSelectedLength()),
GuiUtils.LEFT_ALIGNED_COLUMN_HEADER_TYPE_NAME, SELECTED_SIZE_COLUMN_LABEL));
columnMappings.put(ADDED_COLUMN_LABEL, TableUtils.buildColumn(addedValueFactory, tj ->
UnitConverter.formatMillisToDate(tj.getAddedOnTime(), TimeZone.getDefault()),
GuiUtils.LEFT_ALIGNED_COLUMN_HEADER_TYPE_NAME, ADDED_COLUMN_LABEL));
columnMappings.put(TRACKER_COLUMN_LABEL, TableUtils.buildColumn(trackerValueFactory, tj -> tj.getTrackerUrl(),
GuiUtils.LEFT_ALIGNED_COLUMN_HEADER_TYPE_NAME, TRACKER_COLUMN_LABEL));
return columnMappings;
}
示例14: call
import javafx.scene.control.TableColumn.CellDataFeatures; //导入依赖的package包/类
@Override
public ObservableValue<String> call(CellDataFeatures<EObject, String> p) {
EObject object = p.getValue();
Object refValue = object.eGet(reference);
if (refValue != null) {
String string = stringGetter.apply(refValue);
ObservableValue<String> result = new ReadOnlyObjectWrapper<String>(string);
return result;
}
return null;
}
示例15: call
import javafx.scene.control.TableColumn.CellDataFeatures; //导入依赖的package包/类
public ObservableValue<String> call(CellDataFeatures<EntityType, String> features) {
try {
EntityType entity = features.getValue();
Method m = entity.getClass().getMethod(getterName);
BigDecimal bigDecimal = (BigDecimal) m.invoke(entity);
String formattedBigDecimal = formatter.format(bigDecimal);
return new SimpleObservableValue<String>(formattedBigDecimal);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}