Java 类javafx.scene.control.cell.ChoiceBoxTableCell 实例源码
项目:xbrowser
文件:TableView.java
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;
}
项目:marathonv5
文件:RFXTableViewChoiceBoxTableCell.java
@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]);
}
项目:openjfx-8u-dev-tests
文件:NewTableViewApp.java
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);
}
});
}
}
}
项目:manami
文件:AnimeTypeCallback.java
@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;
}
项目:marathonv5
文件:JavaFXElementFactory.java
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);
}
项目:marathonv5
文件:JavaFXChoiceBoxTableCellElement.java
@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();
}
项目:marathonv5
文件:RFXChoiceBoxTableCell.java
@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();
}
项目:CSLMusicModStationCreator
文件:ScheduleEditor.java
@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();
}
});
}
项目:population
文件:PrimaryController.java
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);
}
项目:population
文件:PrimaryController.java
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);
}
项目:population
文件:PrimaryController.java
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);
}
项目:Gargoyle
文件:CommboBoxTableColumn.java
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();
}
项目:Gargoyle
文件:ClassTypeCheckBoxCellFactory.java
@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;
}
项目:Gargoyle
文件:ComboBoxTableColumn.java
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();
}
项目:certmgr
文件:CRLOptionsController.java
@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"));
}
项目: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));
});
}
});
}
项目:javafx-dpi-scaling
文件:AdjusterTest.java
@Test
public void testGetChoiceBoxTableCellAdjuster() {
Adjuster adjuster = Adjuster.getAdjuster(ChoiceBoxTableCell.class);
assertThat(adjuster, is(instanceOf(ControlAdjuster.class)));
assertThat(adjuster.getNodeClass(), is(sameInstance(Control.class)));
}
项目:ulviewer
文件:LogParseWizardController.java
public void initialize(URL location, ResourceBundle resources) {
decorations = null;
fieldColumn.setCellValueFactory(new PropertyValueFactory<>("logdata"));
decorationColumn.setCellValueFactory(new PropertyValueFactory<>("logDecoration"));
decorationColumn.setCellFactory(ChoiceBoxTableCell.forTableColumn(LogDecoration.values()));
}
项目:Gargoyle
文件:CommboBoxTableColumn.java
/**
* 생성자
*
* @param columnName
* T 형태에 맵핑되는 VO컬럼명
* @param items
* <K> 콤보박스로 사용할 데이터셋 리스트
* @param kCommCode
* K 콤보박스로 사용할 데이터셋의 코드부(실제 값에 바인드되는 컬럼명을 기술)
* @param kColumnName
* K 콤보박스로 사용할 데이터셋의 코드명부(디스플레이되는 컬럼명을 기술)
*/
public CommboBoxTableColumn(String columnName, ObservableList<K> items, String kCommCode, String kColumnName) {
this.cellSupplier = () -> new ChoiceBoxTableCell<T, K>(items);
this.columnName = columnName;
this.items = items;
this.kCommCode = kCommCode;
this.kColumnName = kColumnName;
initialize();
}
项目:Gargoyle
文件:ComboBoxTableColumn.java
/**
* 생성자
*
* @param columnName
* T 형태에 맵핑되는 VO컬럼명
* @param items
* <K> 콤보박스로 사용할 데이터셋 리스트
* @param kCommCode
* K 콤보박스로 사용할 데이터셋의 코드부(실제 값에 바인드되는 컬럼명을 기술)
* @param kColumnName
* K 콤보박스로 사용할 데이터셋의 코드명부(디스플레이되는 컬럼명을 기술)
*/
public ComboBoxTableColumn(String columnName, ObservableList<K> items, String kCommCode, String kColumnName) {
this.cellSupplier = () -> new ChoiceBoxTableCell<T, K>(items);
this.columnName = columnName;
this.items = items;
this.kCommCode = kCommCode;
this.kColumnName = kColumnName;
initialize();
}