private void setChoiceboxCellEditor(boolean isCustom) { for (Iterator it = testedControl.getColumns().iterator(); it.hasNext();) { TreeTableColumn col = (TreeTableColumn) it.next(); String colName = col.getText(); final ObservableList<String> items = FXCollections.observableArrayList(); for (DataItem dataItem : allData) { items.add(dataItem.get(colName).get()); } if (!isCustom) { col.setCellFactory(ChoiceBoxTreeTableCell.forTreeTableColumn(items)); } else { col.setCellFactory(new Callback() { public Object call(Object p) { return new EditingChoiceBoxCell(items); } }); } } }
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); }
@SuppressWarnings("unchecked") @Override public String _getValue() { @SuppressWarnings("rawtypes") ChoiceBoxTreeTableCell cell = (ChoiceBoxTreeTableCell) node; @SuppressWarnings("rawtypes") StringConverter converter = cell.getConverter(); if (converter != null) { return converter.toString(cell.getItem()); } return cell.getItem().toString(); }
@Test public void testGetChoiceBoxTreeTableCellAdjuster() { Adjuster adjuster = Adjuster.getAdjuster(ChoiceBoxTreeTableCell.class); assertThat(adjuster, is(instanceOf(ControlAdjuster.class))); assertThat(adjuster.getNodeClass(), is(sameInstance(Control.class))); }