javafx.scene.control.cell.ComboBoxListCell Java Examples

The following examples show how to use javafx.scene.control.cell.ComboBoxListCell. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RFXListViewComboBoxListCell.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@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")
        ComboBoxListCell<String> cell = (ComboBoxListCell<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]);
}
 
Example #2
Source File: RFXListViewComboBoxListCell.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Test
public void selectEditable() {
    @SuppressWarnings("unchecked")
    ListView<String> listView = (ListView<String>) getPrimaryStage().getScene().getRoot().lookup(".list-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        @SuppressWarnings("unchecked")
        ComboBoxListCell<String> cell = (ComboBoxListCell<String>) getCellAt(listView, 3);
        cell.setComboBoxEditable(true);
        Point2D point = getPoint(listView, 3);
        RFXListView rfxListView = new RFXListView(listView, null, point, lr);
        rfxListView.focusGained(rfxListView);
        cell.startEdit();
        cell.updateItem("Option 5", false);
        cell.commitEdit("Option 5");
        rfxListView.focusLost(rfxListView);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("Option 5", recording.getParameters()[0]);
}
 
Example #3
Source File: JavaFXElementFactory.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
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, JavaFXChoiceBoxCellElement.class);
    add(ComboBoxListCell.class, JavaFXComboBoxCellElement.class);
    add(CheckBoxTreeCell.class, JavaFXCheckBoxTreeCellElement.class);
    add(ChoiceBoxTreeCell.class, JavaFXChoiceBoxCellElement.class);
    add(ComboBoxTreeCell.class, JavaFXComboBoxCellElement.class);
    add(TableCell.class, JavaFXTableViewCellElement.class);
    add(CheckBoxTableCell.class, JavaFXCheckBoxTableCellElement.class);
    add(ChoiceBoxTableCell.class, JavaFXChoiceBoxCellElement.class);
    add(ComboBoxTableCell.class, JavaFXComboBoxCellElement.class);
    add(TreeTableCell.class, JavaFXTreeTableCellElement.class);
    add(CheckBoxTreeTableCell.class, JavaFXCheckBoxTreeTableCell.class);
    add(ChoiceBoxTreeTableCell.class, JavaFXChoiceBoxCellElement.class);
    add(ComboBoxTreeTableCell.class, JavaFXComboBoxCellElement.class);
    add(WebView.class, JavaFXWebViewElement.class);
    add(GenericStyledArea.GENERIC_STYLED_AREA_CLASS, RichTextFXGenericStyledAreaElement.class);
}
 
Example #4
Source File: JavaFXComboBoxCellElement.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
private StringConverter getConverter() {
    if (node instanceof ComboBoxListCell<?>) {
        return ((ComboBoxListCell) node).getConverter();
    } else if (node instanceof ComboBoxTableCell<?, ?>)
        return ((ComboBoxTableCell) node).getConverter();
    else if (node instanceof ComboBoxTreeCell<?>)
        return ((ComboBoxTreeCell) node).getConverter();
    else if (node instanceof ComboBoxTreeTableCell<?, ?>)
        return ((ComboBoxTreeTableCell) node).getConverter();
    return null;
}
 
Example #5
Source File: ComboBoxListViewSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public ComboBoxListViewSample() {
    ListView<Object> listView = new ListView<>();
    listView.getItems().addAll(items);
    listView.setEditable(true);
    listView.setCellFactory(ComboBoxListCell.forListView(items));
    getChildren().add(listView);
}
 
Example #6
Source File: RFXComboBoxListCell.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public String _getValue() {
    @SuppressWarnings("rawtypes")
    ComboBoxListCell cell = (ComboBoxListCell) node;
    return cell.getConverter().toString(cell.getItem());
}