Java 类javafx.scene.control.cell.ChoiceBoxListCell 实例源码

项目:marathonv5    文件:RFXListViewChoiceBoxListCell.java   
@Test public void select() {
    @SuppressWarnings("unchecked")
    ListView<String> listView = (ListView<String>) getPrimaryStage().getScene().getRoot().lookup(".list-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        @SuppressWarnings("unchecked")
        ChoiceBoxListCell<String> cell = (ChoiceBoxListCell<String>) getCellAt(listView, 3);
        Point2D point = getPoint(listView, 3);
        RFXListView rfxListView = new RFXListView(listView, null, point, lr);
        rfxListView.focusGained(rfxListView);
        cell.startEdit();
        cell.updateItem("Option 3", false);
        cell.commitEdit("Option 3");
        rfxListView.focusLost(rfxListView);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("Option 3", recording.getParameters()[0]);
}
项目:openjfx-8u-dev-tests    文件:NewListViewApp.java   
private ComboBox getEditFactoryComboBoxChoser() {
    ComboBox<CellsApp.CellType> cb = new ComboBox<CellsApp.CellType>();
    cb.getItems().addAll(FXCollections.observableArrayList(CellsApp.CellType.values()));
    cb.setId(LIST_FACTORY_CHOICE_ID);
    cb.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<CellsApp.CellType>() {
        public void changed(ObservableValue<? extends CellsApp.CellType> ov, CellsApp.CellType t, CellsApp.CellType t1) {

            switch (t1) {
                case ChoiceBox:
                    testedControl.setCellFactory(ChoiceBoxListCell.forListView(new CellCustomStringConverter(), someValues));
                    break;
                case ComboBox:
                    testedControl.setCellFactory(ComboBoxListCell.forListView(new CellCustomStringConverter(), someValues));
                    break;
                case TextField:
                    testedControl.setCellFactory(TextFieldListCell.forListView(new CellCustomStringConverter()));
                    break;
                default:
                    testedControl.setCellFactory(new ListView().getCellFactory());
            }
        }
    });
    return cb;
}
项目: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    文件:JavaFXChoiceBoxListCellElement.java   
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public String _getValue() {
    ChoiceBoxListCell cell = (ChoiceBoxListCell) node;
    StringConverter converter = cell.getConverter();
    if (converter != null) {
        return converter.toString(cell.getItem());
    }
    return cell.getItem().toString();
}
项目:marathonv5    文件:ChoiceBoxListViewSample.java   
public ChoiceBoxListViewSample() {
    ListView<Object> listView = new ListView<>();
    listView.getItems().addAll(items);
    listView.setEditable(true);
    listView.setCellFactory(ChoiceBoxListCell.forListView(items));
    getChildren().addAll(listView, new Button("Click me"));
}
项目:marathonv5    文件:RFXChoiceBoxListCell.java   
@SuppressWarnings("unchecked") @Override public String _getValue() {
    @SuppressWarnings("rawtypes")
    ChoiceBoxListCell cell = (ChoiceBoxListCell) node;
    @SuppressWarnings("rawtypes")
    StringConverter converter = cell.getConverter();
    if (converter != null) {
        return converter.toString(cell.getItem());
    }
    return cell.getItem().toString();
}
项目:javafx-dpi-scaling    文件:AdjusterTest.java   
@Test
public void testGetChoiceBoxListCellAdjuster() {
    Adjuster adjuster = Adjuster.getAdjuster(ChoiceBoxListCell.class);

    assertThat(adjuster, is(instanceOf(ControlAdjuster.class)));
    assertThat(adjuster.getNodeClass(), is(sameInstance(Control.class)));
}