本文整理汇总了Java中javafx.scene.control.cell.ChoiceBoxTableCell类的典型用法代码示例。如果您正苦于以下问题:Java ChoiceBoxTableCell类的具体用法?Java ChoiceBoxTableCell怎么用?Java ChoiceBoxTableCell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChoiceBoxTableCell类属于javafx.scene.control.cell包,在下文中一共展示了ChoiceBoxTableCell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processChoiceBoxColumnName
import javafx.scene.control.cell.ChoiceBoxTableCell; //导入依赖的package包/类
private TableColumn processChoiceBoxColumnName(String name, JsonArray items){
TableColumn column = new TableColumn(name);
column.setCellValueFactory( p -> ((TableColumn.CellDataFeatures<Item, Object>)p).getValue().getStringProperty(name));
ObservableList list = FXCollections.observableArrayList();
if(items!=null) list.addAll(items.getList());
column.setCellFactory(ChoiceBoxTableCell.forTableColumn(list));
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;
}
示例2: select
import javafx.scene.control.cell.ChoiceBoxTableCell; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void select() {
TableView<?> tableView = (TableView<?>) getPrimaryStage().getScene().getRoot().lookup(".table-view");
LoggingRecorder lr = new LoggingRecorder();
Platform.runLater(() -> {
Point2D point = getPoint(tableView, 2, 1);
ChoiceBoxTableCell cell = (ChoiceBoxTableCell) getCellAt(tableView, 1, 2);
RFXTableView rfxTableView = new RFXTableView(tableView, null, point, lr);
rfxTableView.focusGained(null);
cell.startEdit();
tableView.edit(1, (TableColumn) tableView.getColumns().get(2));
Person person = (Person) tableView.getItems().get(1);
person.setLastName("Jones");
cell.commitEdit("Jones");
rfxTableView.focusLost(null);
});
List<Recording> recordings = lr.waitAndGetRecordings(1);
Recording recording = recordings.get(0);
AssertJUnit.assertEquals("recordSelect", recording.getCall());
AssertJUnit.assertEquals("Jones", recording.getParameters()[0]);
}
示例3: setChoiceboxCellEditor
import javafx.scene.control.cell.ChoiceBoxTableCell; //导入依赖的package包/类
private void setChoiceboxCellEditor(boolean isCustom) {
for (int i = 0; i < testedTableView.getColumns().size(); i++) {
TableColumn col = testedTableView.getColumns().get(i);
String colName = col.getText();
final ObservableList<String> items = FXCollections.observableArrayList();
for (DataItem dataItem : allData) {
items.add(dataItem.get(colName).get());
}
if (!isCustom) {
col.setCellFactory(ChoiceBoxTableCell.forTableColumn(items));
} else {
col.setCellFactory(new Callback() {
public Object call(Object p) {
return new EditingChoiceBoxCell(items);
}
});
}
}
}
示例4: call
import javafx.scene.control.cell.ChoiceBoxTableCell; //导入依赖的package包/类
@Override
public TableCell<Anime, String> call(final TableColumn<Anime, String> arg0) {
final ChoiceBoxTableCell<Anime, String> cellFactory = new ChoiceBoxTableCell<Anime, String>(new DefaultStringConverter()) {
@Override
public void updateItem(final String value, final boolean empty) {
super.updateItem(value, empty);
}
};
cellFactory.getItems().clear();
for (final AnimeType element : AnimeType.values()) {
cellFactory.getItems().add(element.getValue());
}
return cellFactory;
}
示例5: reset
import javafx.scene.control.cell.ChoiceBoxTableCell; //导入依赖的package包/类
public static void reset() {
add(Node.class, JavaFXElement.class);
add(TextInputControl.class, JavaFXTextInputControlElement.class);
add(HTMLEditor.class, JavaFXHTMLEditor.class);
add(CheckBox.class, JavaFXCheckBoxElement.class);
add(ToggleButton.class, JavaFXToggleButtonElement.class);
add(Slider.class, JavaFXSliderElement.class);
add(Spinner.class, JavaFXSpinnerElement.class);
add(SplitPane.class, JavaFXSplitPaneElement.class);
add(ProgressBar.class, JavaFXProgressBarElement.class);
add(ChoiceBox.class, JavaFXChoiceBoxElement.class);
add(ColorPicker.class, JavaFXColorPickerElement.class);
add(ComboBox.class, JavaFXComboBoxElement.class);
add(DatePicker.class, JavaFXDatePickerElement.class);
add(TabPane.class, JavaFXTabPaneElement.class);
add(ListView.class, JavaFXListViewElement.class);
add(TreeView.class, JavaFXTreeViewElement.class);
add(TableView.class, JavaFXTableViewElement.class);
add(TreeTableView.class, JavaFXTreeTableViewElement.class);
add(CheckBoxListCell.class, JavaFXCheckBoxListCellElement.class);
add(ChoiceBoxListCell.class, JavaFXChoiceBoxListCellElement.class);
add(ComboBoxListCell.class, JavaFXComboBoxListCellElemnt.class);
add(CheckBoxTreeCell.class, JavaFXCheckBoxTreeCellElement.class);
add(ChoiceBoxTreeCell.class, JavaFXChoiceBoxTreeCellElement.class);
add(ComboBoxTreeCell.class, JavaFXComboBoxTreeCellElement.class);
add(TableCell.class, JavaFXTableViewCellElement.class);
add(CheckBoxTableCell.class, JavaFXCheckBoxTableCellElement.class);
add(ChoiceBoxTableCell.class, JavaFXChoiceBoxTableCellElement.class);
add(ComboBoxTableCell.class, JavaFXComboBoxTableCellElemnt.class);
add(TreeTableCell.class, JavaFXTreeTableCellElement.class);
add(CheckBoxTreeTableCell.class, JavaFXCheckBoxTreeTableCell.class);
add(ChoiceBoxTreeTableCell.class, JavaFXChoiceBoxTreeTableCell.class);
add(ComboBoxTreeTableCell.class, JavaFXComboBoxTreeTableCell.class);
}
示例6: _getValue
import javafx.scene.control.cell.ChoiceBoxTableCell; //导入依赖的package包/类
@SuppressWarnings("unchecked") @Override public String _getValue() {
@SuppressWarnings("rawtypes")
ChoiceBoxTableCell cell = (ChoiceBoxTableCell) node;
@SuppressWarnings("rawtypes")
StringConverter converter = cell.getConverter();
if (converter != null) {
return converter.toString(cell.getItem());
}
return cell.getItem().toString();
}
示例7: initialize
import javafx.scene.control.cell.ChoiceBoxTableCell; //导入依赖的package包/类
@FXML
public void initialize() {
ScheduleEntry.ALLOWED_TYPES.stream().forEach(x -> newItemType.getItems().add(x));
newItemType.getSelectionModel().select(0);
newItemRange.setTarget(new IntRange(0, 3), ScheduleEntry.RANGE_BORDERS);
content.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
content.setEditable(false);
contentPriorityColumn.setSortable(false);
contentPriorityColumn.setCellValueFactory(value -> new ReadOnlyObjectWrapper<>(value.getValue().getStation().getSchedule().indexOf(value.getValue()) + 1));
contentTypeColumn.setSortable(false);
contentTypeColumn.setCellValueFactory((value) -> {
return new ReadOnlyObjectWrapper<>("Play " + value.getValue().getType());
});
contentTypeColumn.setCellFactory(ChoiceBoxTableCell.forTableColumn(ScheduleEntry.ALLOWED_TYPES.toArray(new String[0])));
contentNumberColumn.setSortable(false);
contentNumberColumn.setCellValueFactory((value) -> {
return new ReadOnlyObjectWrapper<>(new IntRange(value.getValue().getMin(), value.getValue().getMax()));
});
editColumn.setCellFactory(value -> new TriggerRowEditCell<>());
editColumn.setCellValueFactory(value -> new ReadOnlyObjectWrapper<>(value.getValue()));
content.setRowFactory(ControlsHelper.dragDropReorderRowFactory(content, new ScheduleEntryEditRow()));
content.setOnKeyPressed(keyEvent -> {
if(keyEvent.getCode() == KeyCode.DELETE) {
removeEntries();
}
});
}
示例8: stateCell
import javafx.scene.control.cell.ChoiceBoxTableCell; //导入依赖的package包/类
private Callback<TableColumn<Transition, Number>, TableCell<Transition, Number>> stateCell() {
return ChoiceBoxTableCell.forTableColumn(new StringConverter<Number>() {
@Override
public String toString(Number object) {
if (object == null) {
return getString("unselected");
}
if (object.intValue() == State.EXTERNAL) {
return getString("state_external");
}
State state = mStatesIdMap.get(object);
if (state == null) {
return getString("unselected");
}
String name = state.getName();
if (Utils.isNullOrEmpty(name)) {
return getString("unnamed");
}
return name;
}
@Override
public Number fromString(String string) {
return null;
}
}, mStatesIdList);
}
示例9: typeCell
import javafx.scene.control.cell.ChoiceBoxTableCell; //导入依赖的package包/类
private Callback<TableColumn<Transition, Number>, TableCell<Transition, Number>> typeCell() {
return ChoiceBoxTableCell.forTableColumn(new StringConverter<Number>() {
@Override
public String toString(Number object) {
return TransitionType.getName((int) object, getResources());
}
@Override
public Number fromString(String string) {
return null;
}
}, TransitionType.TYPES);
}
示例10: modeCell
import javafx.scene.control.cell.ChoiceBoxTableCell; //导入依赖的package包/类
private Callback<TableColumn<Transition, Number>, TableCell<Transition, Number>> modeCell() {
return ChoiceBoxTableCell.forTableColumn(new StringConverter<Number>() {
@Override
public String toString(Number object) {
return TransitionMode.getName((int) object, getResources());
}
@Override
public Number fromString(String string) {
return null;
}
}, TransitionMode.MODES);
}
示例11: CommboBoxTableColumn
import javafx.scene.control.cell.ChoiceBoxTableCell; //导入依赖的package包/类
public CommboBoxTableColumn(Supplier<ChoiceBoxTableCell<T, K>> cellSupplier, String columnName, ObservableList<K> items,
String kCommCode, String kColumnName) {
this.cellSupplier = cellSupplier;
this.columnName = columnName;
this.items = items;
this.kCommCode = kCommCode;
this.kColumnName = kColumnName;
initialize();
}
示例12: call
import javafx.scene.control.cell.ChoiceBoxTableCell; //导入依赖的package包/类
@Override
public TableCell<TableModelDVO, String> call(TableColumn<TableModelDVO, String> param) {
ChoiceBoxTableCell<TableModelDVO, String> choiceBoxTableCell = new ChoiceBoxTableCell<>();
choiceBoxTableCell.getItems().addAll(ClassTypeResourceLoader.getInstance().getKeyList());
choiceBoxTableCell.setConverter(value);
return choiceBoxTableCell;
}
示例13: ComboBoxTableColumn
import javafx.scene.control.cell.ChoiceBoxTableCell; //导入依赖的package包/类
public ComboBoxTableColumn(Supplier<ChoiceBoxTableCell<T, K>> cellSupplier, String columnName, ObservableList<K> items,
String kCommCode, String kColumnName) {
this.cellSupplier = cellSupplier;
this.columnName = columnName;
this.items = items;
this.kCommCode = kCommCode;
this.kColumnName = kColumnName;
initialize();
}
示例14: setupStage
import javafx.scene.control.cell.ChoiceBoxTableCell; //导入依赖的package包/类
@Override
protected void setupStage(Stage stage) {
stage.setTitle(CRLOptionsI18N.formatSTR_STAGE_TITLE());
this.ctlEntryOptionRevoked.setCellFactory(CheckBoxTableCell.forTableColumn(this.ctlEntryOptionRevoked));
this.ctlEntryOptionRevoked.setCellValueFactory(new PropertyValueFactory<>("revoked"));
this.ctlEntryOptionName.setCellValueFactory(new PropertyValueFactory<>("name"));
this.ctlEntryOptionSerial.setCellValueFactory(new PropertyValueFactory<>("serial"));
ObservableList<ReasonFlag> reasons = FXCollections.observableArrayList(ReasonFlag.instances());
reasons.sort((o1, o2) -> o1.name().compareTo(o2.name()));
this.ctlEntryOptionReason.setCellFactory(ChoiceBoxTableCell.forTableColumn(reasons));
this.ctlEntryOptionReason.setCellValueFactory(new PropertyValueFactory<>("reason"));
this.ctlEntryOptionDate.setCellValueFactory(new PropertyValueFactory<>("date"));
}
示例15: initialize
import javafx.scene.control.cell.ChoiceBoxTableCell; //导入依赖的package包/类
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));
});
}
});
}