Java 类javafx.scene.control.ComboBox 实例源码

项目:vars-annotation    文件:FilteredComboBoxDecoratorDemo.java   
@Override
public void start(Stage stage) throws Exception {
    ComboBox<String> cmb = new JFXComboBox<>();
    new FilteredComboBoxDecorator<>(cmb, FilteredComboBoxDecorator.STARTSWITH_IGNORE_SPACES);
    cmb.setItems(FXCollections.observableArrayList(LISTA));
    Initializer.getToolBox()
            .getServices()
            .getConceptService()
            .findAllNames()
            .thenAccept(names -> {
               Platform.runLater(() -> cmb.setItems(FXCollections.observableArrayList(names)));
            });
    Scene scene = new Scene(new StackPane(cmb));
    scene.getStylesheets().addAll(Initializer.getToolBox().getStylesheets());
    stage.setScene(scene);
    stage.show();
    stage.setTitle("Filtered ComboBox");
    stage.setWidth(300);
    stage.setHeight(300);
}
项目:jmonkeybuilder    文件:CreateTerrainDialog.java   
/**
 * Update a list of available path sizes.
 */
@FXThread
private void updatePathSizeValues() {

    final ComboBox<Integer> pathSizeComboBox = getPatchSizeComboBox();
    final SingleSelectionModel<Integer> selectionModel = pathSizeComboBox.getSelectionModel();
    final Integer current = selectionModel.getSelectedItem();

    final ObservableList<Integer> items = pathSizeComboBox.getItems();
    items.clear();

    final ComboBox<Integer> totalSizeComboBox = getTotalSizeComboBox();
    final Integer naxValue = totalSizeComboBox.getSelectionModel().getSelectedItem();

    for (final Integer value : PATCH_SIZE_VARIANTS) {
        if (value >= naxValue) break;
        items.add(value);
    }

    if (items.contains(current)) {
        selectionModel.select(current);
    } else {
        selectionModel.select(items.get(items.size() - 1));
    }
}
项目:marathonv5    文件:ComboBoxSample.java   
public ComboBoxSample() {

        HBox hbox = HBoxBuilder.create().alignment(Pos.CENTER).spacing(15).build();

        //Non-editable combobox. Created with a builder
        ComboBox uneditableComboBox = ComboBoxBuilder.create()
                .id("uneditable-combobox")
                .promptText("Make a choice...")
                .items(FXCollections.observableArrayList(strings.subList(0, 8))).build();

        //Editable combobox. Use the default item display length
        ComboBox<String> editableComboBox = new ComboBox<String>();
        editableComboBox.setId("second-editable");
        editableComboBox.setPromptText("Edit or Choose...");
        editableComboBox.setItems(strings);
        editableComboBox.setEditable(true);

        hbox.getChildren().addAll(uneditableComboBox, editableComboBox);
        getChildren().add(hbox);
    }
项目:marathonv5    文件:FormPane.java   
private void setFormConstraints(Node field) {
    if (field instanceof ISetConstraints) {
        ((ISetConstraints) field).setFormConstraints(this);
    } else if (field instanceof Button) {
        _setFormConstraints((Button) field);
    } else if (field instanceof TextField) {
        _setFormConstraints((TextField) field);
    } else if (field instanceof TextArea) {
        _setFormConstraints((TextArea) field);
    } else if (field instanceof ComboBox<?>) {
        _setFormConstraints((ComboBox<?>) field);
    } else if (field instanceof ChoiceBox<?>) {
        _setFormConstraints((ChoiceBox<?>) field);
    } else if (field instanceof CheckBox) {
        _setFormConstraints((CheckBox) field);
    } else if (field instanceof Spinner<?>) {
        _setFormConstraints((Spinner<?>) field);
    } else if (field instanceof VBox) {
        _setFormConstraints((VBox) field);
    } else if (field instanceof Label) {
        _setFormConstraints((Label) field);
    } else {
        LOGGER.info("FormPane.setFormConstraints(): unknown field type: " + field.getClass().getName());
    }
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
public String getComboBoxText(ComboBox<?> comboBox, int index, boolean appendText) {
    if (index == -1) {
        return null;
    }
    String original = getComboBoxItemText(comboBox, index);
    String itemText = original;
    int suffixIndex = 0;
    for (int i = 0; i < index; i++) {
        String current = getComboBoxItemText(comboBox, i);
        if (current.equals(original)) {
            if (appendText) {
                itemText = String.format("%s(%d)", original, ++suffixIndex);
            } else {
                itemText = original;
            }
        }
    }
    return itemText;
}
项目:jmonkeybuilder    文件:LodLevelPropertyControl.java   
@Override
@FXThread
protected void reload() {
    if (!hasEditObject()) return;

    final Geometry geometry = getEditObject();
    final Mesh mesh = geometry.getMesh();
    if (mesh == null) return;

    final Integer element = getPropertyValue();
    final ComboBox<Integer> levelComboBox = getLevelComboBox();
    final ObservableList<Integer> items = levelComboBox.getItems();
    items.clear();

    final int numLodLevels = mesh.getNumLodLevels();

    for (int i = 0; i < numLodLevels; i++) {
        items.add(i);
    }

    if (items.isEmpty()) {
        items.add(0);
    }

    levelComboBox.getSelectionModel().select(element);
}
项目:jmonkeybuilder    文件:LayerModelPropertyControl.java   
@Override
@FXThread
protected void createComponents(@NotNull final HBox container) {
    super.createComponents(container);

    layerComboBox = new ComboBox<>();
    layerComboBox.setCellFactory(param -> new LayerCell());
    layerComboBox.setButtonCell(new LayerCell());
    layerComboBox.setEditable(false);
    layerComboBox.prefWidthProperty().bind(widthProperty().multiply(CONTROL_WIDTH_PERCENT));
    layerComboBox.getSelectionModel().selectedItemProperty()
            .addListener((observable, oldValue, newValue) -> updateLevel(newValue));

    FXUtils.addToPane(layerComboBox, container);
    FXUtils.addClassTo(layerComboBox, CSSClasses.ABSTRACT_PARAM_CONTROL_COMBO_BOX);
}
项目:Himalaya-JavaFX    文件:ActionsFXMLController.java   
@FXML
public void comboBoxValueChanged(Event evt) {
    ComboBox actionBox = ((ComboBox) evt.getSource());

    switch (actionBox.getId()) {
        case "action1":
            region1.setDisable(!actionBox.getValue().equals("Delegation"));
            break;
        case "action2":
            region2.setDisable(!actionBox.getValue().equals("Delegation"));
            break;
        case "action3":
            region3.setDisable(!actionBox.getValue().equals("Delegation"));
            break;
        case "action4":
            region4.setDisable(!actionBox.getValue().equals("Delegation"));
            break;
        case "action5":
            region5.setDisable(!actionBox.getValue().equals("Delegation"));
            break;
        case "action6":
            region6.setDisable(!actionBox.getValue().equals("Delegation"));
            break;
    }
}
项目:marathonv5    文件:ComboBoxSample.java   
public ComboBoxSample() {

        HBox hbox = HBoxBuilder.create().alignment(Pos.CENTER).spacing(15).build();

        //Non-editable combobox. Created with a builder
        ComboBox uneditableComboBox = ComboBoxBuilder.create()
                .id("uneditable-combobox")
                .promptText("Make a choice...")
                .items(FXCollections.observableArrayList(strings.subList(0, 8))).build();

        //Editable combobox. Use the default item display length
        ComboBox<String> editableComboBox = new ComboBox<String>();
        editableComboBox.setId("second-editable");
        editableComboBox.setPromptText("Edit or Choose...");
        editableComboBox.setItems(strings);
        editableComboBox.setEditable(true);

        hbox.getChildren().addAll(uneditableComboBox, editableComboBox);
        getChildren().add(hbox);
    }
项目:marathonv5    文件:RFXComboBox.java   
@Override public void focusLost(RFXComponent next) {
    ComboBox<?> comboBox = (ComboBox<?>) node;
    Object selectedItem = comboBox.getSelectionModel().getSelectedItem();
    if (comboBox.isEditable() && comboBox.getEditor().getText()
            .equals(getComboBoxText(comboBox, comboBox.getItems().indexOf(prevSelectedItem), false))) {
        return;
    } else if (!comboBox.isEditable() && selectedItem != null && selectedItem.equals(prevSelectedItem)) {
        return;
    }
    if (!comboBox.isEditable()) {
        recorder.recordSelect(this, getComboBoxText(comboBox, comboBox.getSelectionModel().getSelectedIndex(), true));
    } else {
        String editorText = comboBox.getEditor().getText();
        String selectedItemText = getComboBoxText(comboBox, comboBox.getSelectionModel().getSelectedIndex(), false);
        if (editorText.equals(selectedItemText)) {
            recorder.recordSelect(this, getComboBoxText(comboBox, comboBox.getSelectionModel().getSelectedIndex(), true));
        } else {
            recorder.recordSelect(this, editorText);
        }
    }
}
项目:jmonkeybuilder    文件:LayerModelPropertyControl.java   
@Override
@FXThread
protected void reload() {

    final SceneChangeConsumer changeConsumer = (SceneChangeConsumer) getChangeConsumer();
    final SceneNode currentModel = changeConsumer.getCurrentModel();
    final SceneLayer sceneLayer = getPropertyValue();

    final ComboBox<SceneLayer> levelComboBox = getLayerComboBox();
    final ObservableList<SceneLayer> items = levelComboBox.getItems();
    items.clear();
    items.add(SceneLayer.NO_LAYER);
    items.addAll(currentModel.getLayers());

    levelComboBox.getSelectionModel().select(sceneLayer == null ? SceneLayer.NO_LAYER : sceneLayer);
}
项目:GameAuthoringEnvironment    文件:TransitionView.java   
private ComboBox<ILevel> createCombo (ObservableList<ILevel> levels) {
    ComboBox<ILevel> comboBox = new ComboBox<>(levels);
    comboBox.setCellFactory(c -> new NameCellView<>());
    comboBox.setButtonCell(new NameCellView<>());
    myCombos.add(comboBox);
    return comboBox;
}
项目:OftenPorter    文件:ComboBoxBinder.java   
@Override
public void set(AttrEnum attrEnum, Object value)
{
    if (attrEnum == AttrEnum.ATTR_OTHER)
    {
        if (value instanceof ObservableList)
        {
            ObservableList observableList = (ObservableList) value;
            ComboBox comboBox = (ComboBox) view;
            comboBox.setItems(observableList);
        }
    } else
    {
        super.set(attrEnum, value);
    }
}
项目:ChessMaster    文件:RenderEngineSelector.java   
@Override
public void start(Stage primaryStage) throws Exception {
    GridPane pane = new GridPane();
    pane.setAlignment(Pos.CENTER);
    pane.setMaxSize(800, 600);
    pane.setPrefSize(800, 600);
    pane.setManaged(true);
    pane.setVgap(3);
    pane.setHgap(3);
    pane.addRow(1, new Label("Chess Master"));
    ComboBox<RenderWrapper> renderCombo = new ComboBox<>();
    renderCombo.getItems().addAll(new RenderWrapper(new BGFXRenderer()), new RenderWrapper(new OpenGLRenderer()));
    ChessMaster.getPluginManager().getExtensions(Renderer.class).stream().map(RenderWrapper::new).forEach(renderCombo.getItems()::add);
    pane.addRow(2, new Label("Select a renderer:"), renderCombo);
    Button button = new Button("Start!");
    button.setOnAction(event -> {
        ChessMaster.getLogger().info("Using renderer: {} ({})", renderCombo.getSelectionModel().getSelectedItem().renderer.getName(), renderCombo.getSelectionModel().getSelectedItem().renderer.getClass().getName());
        renderCombo.getSelectionModel().getSelectedItem().renderer.render();
        primaryStage.close();
    });
    pane.addRow(3, button);
    primaryStage.setScene(new Scene(pane));
    primaryStage.show();
}
项目:jmonkeybuilder    文件:ParticlesAssetEditorDialog.java   
@Override
@FXThread
protected void processOpen(@NotNull final ResourceElement element) {
    super.processOpen(element);

    final ComboBox<String> textureParamNameBox = getTextureParamNameComboBox();
    final SingleSelectionModel<String> selectionModel = textureParamNameBox.getSelectionModel();
    final String textureParamName = selectionModel.getSelectedItem();

    final CheckBox transformBox = getApplyLightingTransformCheckBox();

    final AssetManager assetManager = EDITOR.getAssetManager();

    final Path file = element.getFile();
    final Path assetFile = getAssetFile(file);

    if (assetFile == null) {
        throw new RuntimeException("AssetFile can't be null.");
    }

    final Material material = assetManager.loadAsset(new MaterialKey(toAssetPath(assetFile)));

    final Consumer<ParticlesMaterial> consumer = getConsumer();
    consumer.accept(new ParticlesMaterial(material, textureParamName, transformBox.isSelected()));
}
项目:jmonkeybuilder    文件:CreateTerrainDialog.java   
public CreateTerrainDialog(@NotNull final TreeNode<?> parentNode, @NotNull final NodeTree<?> nodeTree) {
    this.parentNode = parentNode;
    this.nodeTree = nodeTree;

    final ComboBox<Integer> totalSizeComboBox = getTotalSizeComboBox();
    totalSizeComboBox.getSelectionModel().select(DEFAULT_TOTAL_SIZE);

    final ComboBox<Integer> patchSizeComboBox = getPatchSizeComboBox();
    patchSizeComboBox.getSelectionModel().select(DEFAULT_PATH_SIZE);

    final ComboBox<Integer> alphaBlendTextureSizeComboBox = getAlphaBlendTextureSizeComboBox();
    alphaBlendTextureSizeComboBox.getSelectionModel().select(DEFAULT_BLEND_TEXTURE_SIZE);

    final ComboBox<HeightMapType> heightMapTypeComboBox = getHeightMapTypeComboBox();
    heightMapTypeComboBox.getSelectionModel().select(HeightMapType.FLAT);

    updatePathSizeValues();
}
项目:WebPLP    文件:EditorSettingsPanel.java   
private Node editorModeSelection( EditorSettingDetails settingDetails, ObservableList<String> editorModes )
{
    HBox hBox = new HBox();

    Text editorModeLabel = new Text("Editor Mode: ");
    editorModeLabel.setId(UIConstants.TEXT_COLOR);

    ComboBox<String> editorModeComboBox = new ComboBox<>(editorModes);
    editorModeComboBox.getSelectionModel().select(settingDetails.getEditorMode());

    editorModeSelectionModel = editorModeComboBox.getSelectionModel();

    hBox.getChildren().addAll(editorModeLabel, editorModeComboBox);
    hBox.setAlignment(Pos.CENTER_LEFT);

    return hBox;
}
项目:CalendarFX    文件:WeekFieldsViewSkin.java   
public WeekFieldsViewSkin(final WeekFieldsView view) {
    super(view);

    dayOfWeekComboBox = new ComboBox<>();
    dayOfWeekComboBox.getItems().addAll(DayOfWeek.values());
    dayOfWeekComboBox.setValue(view.getFirstDayOfWeek());

    minimalDaysInFirstWeekComboBox = new ComboBox<>();
    minimalDaysInFirstWeekComboBox.getItems().addAll(1, 2, 3, 4, 5, 6, 7);
    minimalDaysInFirstWeekComboBox.setValue(view.getMinimalDaysInFirstWeek());

    GridPane pane = new GridPane();
    pane.getStyleClass().add("content");
    pane.add(new Label("First day:"), 0, 0);
    pane.add(new Label("Minimum days:"), 0, 1);
    pane.add(dayOfWeekComboBox, 1, 0);
    pane.add(minimalDaysInFirstWeekComboBox, 1, 1);

    getChildren().add(pane);

    // listeners

    InvalidationListener updateListener = it -> updateValues();
    dayOfWeekComboBox.valueProperty().addListener(updateListener);
    minimalDaysInFirstWeekComboBox.valueProperty().addListener(updateListener);

    view.weekFieldsProperty().addListener(it -> {
        WeekFields fields = view.getWeekFields();
        dayOfWeekComboBox.setValue(fields.getFirstDayOfWeek());
        minimalDaysInFirstWeekComboBox.setValue(fields.getMinimalDaysInFirstWeek());
    });
}
项目:jmonkeybuilder    文件:StringFromListPropertyEditorControl.java   
protected StringFromListPropertyEditorControl(@NotNull final VarTable vars, @NotNull final PropertyDefinition definition,
                                              @NotNull final Runnable validationCallback, @NotNull final Array<?> options) {
    super(vars, definition, validationCallback);

    final ComboBox<String> comboBox = getComboBox();
    options.forEach(comboBox.getItems(), (option, items) -> items.add(option.toString()));

    if (options.size() > comboBox.getVisibleRowCount()) {
        setIgnoreListener(true);
        try {

            //FIXME need to find more userfriendly control
            //comboBox.setEditable(true);

            //final TextField editor = comboBox.getEditor();
            //final SingleSelectionModel<String> selectionModel = comboBox.getSelectionModel();
            //final AutoCompletionBinding<String> binding = TextFields.bindAutoCompletion(editor, comboBox.getItems());
            //binding.setOnAutoCompleted(event -> selectionModel.select(event.getCompletion()));

            //FXUtils.addClassesTo(editor, CSSClasses.TRANSPARENT_TEXT_FIELD, CSSClasses.TEXT_FIELD_IN_COMBO_BOX);
            //reload();
        } finally {
            setIgnoreListener(false);
        }
    }
}
项目:jmonkeybuilder    文件:AwtFontPropertyEditorControl.java   
@Override
@FXThread
protected void createComponents() {
    super.createComponents();

    comboBox = new ComboBox<>();
    comboBox.prefWidthProperty().bind(widthProperty().multiply(DEFAULT_FIELD_W_PERCENT));
    comboBox.getItems().addAll(FONTS);
    comboBox.setVisibleRowCount(20);
    comboBox.setConverter(STRING_CONVERTER);
    comboBox.setEditable(true);

    final SingleSelectionModel<Font> selectionModel = comboBox.getSelectionModel();
    selectionModel.selectedItemProperty().addListener((observable, oldValue, newValue) -> change());

    final AutoCompletionTextFieldBinding<Font> binding =
            new AutoCompletionTextFieldBinding<>(comboBox.getEditor(),
                    SuggestionProvider.create(comboBox.getItems()), STRING_CONVERTER);
    binding.setOnAutoCompleted(event -> selectionModel.select(event.getCompletion()));

    FXUtils.addClassesTo(comboBox.getEditor(), CSSClasses.TRANSPARENT_TEXT_FIELD, CSSClasses.TEXT_FIELD_IN_COMBO_BOX);
    FXUtils.addClassTo(comboBox, CSSClasses.ABSTRACT_PARAM_CONTROL_COMBO_BOX);
    FXUtils.addToPane(comboBox, this);
}
项目:jmonkeybuilder    文件:MaterialFileEditor.java   
@Override
@FXThread
protected void createToolbar(@NotNull final HBox container) {
    super.createToolbar(container);

    final Label materialDefinitionLabel = new Label(Messages.MATERIAL_EDITOR_MATERIAL_TYPE_LABEL + ":");

    materialDefinitionBox = new ComboBox<>();
    materialDefinitionBox.getSelectionModel()
            .selectedItemProperty()
            .addListener((observable, oldValue, newValue) -> changeType(newValue));

    FXUtils.addToPane(materialDefinitionLabel, container);
    FXUtils.addToPane(materialDefinitionBox, container);

    FXUtils.addClassTo(materialDefinitionLabel, CSSClasses.FILE_EDITOR_TOOLBAR_LABEL);
    FXUtils.addClassTo(materialDefinitionBox, CSSClasses.FILE_EDITOR_TOOLBAR_FIELD);
}
项目:titanium    文件:MapSelectorDialog.java   
public MapSelectorDialog(String title) {
    super();
    // Create the custom dialog.
    this.setTitle(title);

    // Set the button types.
    ButtonType addButtonType = new ButtonType("Select map", ButtonData.OK_DONE);
    this.getDialogPane().getButtonTypes().addAll(addButtonType, ButtonType.CANCEL);

    // Create the username and password labels and fields.
    VBox inputPane = new VBox();

    ComboBox<String> maps = new ComboBox<>();

    maps.getItems().addAll(MapListLoader.loadMapList());

    inputPane.getChildren().addAll(new Label("Select a map"), maps);


    this.getDialogPane().setContent(inputPane);

    this.setResultConverter(dialogButton -> {
        try {
            if (dialogButton == addButtonType) {
                return maps.getSelectionModel().getSelectedItem();
            }
        } catch (NumberFormatException e) {
            return null;
        }
        return null;
    });

}
项目:phone-simulator    文件:Impl.java   
private void addCboChanel(ComboBox<EnumeratedBase> cb) {
    EnumeratedBase[] ebb = m3ua.getSctpIPChannelType().getList();
    EnumeratedBase dv = null;
    for (EnumeratedBase eb : ebb) {
        cb.getItems().add(eb);
        if (eb.intValue() == m3ua.getSctpIPChannelType().intValue()) {
            dv = eb;
        }
    }
    if (dv != null) {
        cb.getSelectionModel().select(dv);
    }

}
项目:phone-simulator    文件:Impl.java   
void showData(ComboBox<EnumeratedBase> cboChanel, ComboBox<String> cboRole, TextField txtLocalHost, TextField txtLocalPort, TextField txtRemoteHost, TextField txtRemotePort, TextField txtPhone) {
    addCboChanel(cboChanel);
    cboRole.getItems().addAll("Client", "Server");
    setCboRole(cboRole);
    txtLocalHost.setText(m3ua.getSctpLocalHost());
    txtLocalPort.setText(m3ua.getSctpLocalPort() + "");
    txtRemoteHost.setText(m3ua.getSctpRemoteHost());
    txtRemotePort.setText(m3ua.getSctpRemotePort() + "");
    txtPhone.setText(host.getMapMan().getOrigReference());
}
项目:phone-simulator    文件:Impl.java   
void saveData(ComboBox<EnumeratedBase> cboChanel, ComboBox<String> cboRole, TextField txtLocalHost, TextField txtLocalPort, TextField txtRemoteHost, TextField txtRemotePort, TextField txtPhone) {

        m3ua.setSctpIPChannelType((BIpChannelType) cboChanel.getSelectionModel().getSelectedItem());
        if (cboRole.getSelectionModel().getSelectedIndex() == 0) {
            this.m3ua.setSctpIsServer(false);
        } else {
            this.m3ua.setSctpIsServer(true);
        }
        m3ua.setSctpLocalHost(txtLocalHost.getText());
        m3ua.setSctpLocalPort(Integer.parseInt(txtLocalPort.getText()));
        m3ua.setSctpRemoteHost(txtRemoteHost.getText());
        m3ua.setSctpRemotePort(Integer.parseInt(txtRemotePort.getText()));
        host.getMapMan().setOrigReference(txtPhone.getText());

    }
项目:marathonv5    文件:FunctionStage.java   
private String[] getArguments(ObservableList<Node> children) {
    String[] args = new String[children.size() / 2];
    for (int i = 1; i < children.size(); i += 2) {
        if (children.get(i) instanceof TextField) {
            args[i / 2] = ((TextField) children.get(i)).getText();
        } else {
            args[i / 2] = ((ComboBox<?>) children.get(i)).getSelectionModel().getSelectedItem().toString();
        }
    }
    return args;
}
项目:voogasalad-ltub    文件:ComboBoxParameterInput.java   
private void createCombo(List<String> options){
    this.combo = new ComboBox<String>();
    this.combo.getItems().addAll(options);
    if(options.size() > 0){
        this.combo.setValue(options.get(0));
    }
}
项目:marathonv5    文件:JavaFXComboBoxElement.java   
@Override public List<IJavaFXElement> getByPseudoElement(String selector, Object[] params) {
    if (selector.equals("nth-option")) {
        return Arrays.asList(new JavaFXComboBoxOptionElement(this, ((Integer) params[0]).intValue() - 1));
    } else if (selector.equals("all-options") || selector.equals("all-cells")) {
        ComboBox<?> listView = (ComboBox<?>) getComponent();
        ArrayList<IJavaFXElement> r = new ArrayList<>();
        int nItems = listView.getItems().size();
        for (int i = 0; i < nItems; i++) {
            r.add(new JavaFXComboBoxOptionElement(this, i));
        }
        return r;
    }
    return super.getByPseudoElement(selector, params);
}
项目:marathonv5    文件:JavaFXComboBoxElement.java   
@Override public boolean marathon_select(String value) {
    ComboBox<?> comboBox = (ComboBox<?>) getComponent();
    String text = stripHTMLTags(value);
    int selectedItem = getComboBoxItemIndex(comboBox, text);
    if (selectedItem == -1) {
        if (comboBox.isEditable()) {
            comboBox.getEditor().setText(value);
            return true;
        }
        return false;
    }
    comboBox.getSelectionModel().select(selectedItem);
    return true;
}
项目:jmonkeybuilder    文件:ParticlesAssetEditorDialog.java   
@Override
@FXThread
protected @NotNull ObservableBooleanValue buildAdditionalDisableCondition() {
    final ComboBox<String> comboBox = getTextureParamNameComboBox();
    final SingleSelectionModel<String> selectionModel = comboBox.getSelectionModel();
    final ReadOnlyObjectProperty<String> itemProperty = selectionModel.selectedItemProperty();
    final ObservableBooleanValue parent = super.buildAdditionalDisableCondition();
    return Bindings.and(parent, itemProperty.isNull().or(itemProperty.isEqualTo("")));
}
项目:marathonv5    文件:JavaFXComboBoxTest.java   
@Test public void selectOption() {
    ComboBox<?> comboNode = (ComboBox<?>) getPrimaryStage().getScene().getRoot().lookup(".combo-box");
    IJavaFXElement comboBox = combos.get(0);
    Platform.runLater(() -> comboBox.marathon_select("Option 2"));
    new Wait("Waiting for combo box option to be set.") {
        @Override public boolean until() {
            return comboNode.getSelectionModel().getSelectedIndex() == 1;
        }
    };
}
项目:marathonv5    文件:JavaFXComboBoxTest.java   
@Test public void selectMultipleDuplicateOption() {
    @SuppressWarnings("unchecked")
    ComboBox<String> comboNode = (ComboBox<String>) getPrimaryStage().getScene().getRoot().lookup(".combo-box");
    IJavaFXElement comboBox = combos.get(0);
    Platform.runLater(() -> {
        comboNode.getItems().add(3, "Option 2");
        comboNode.getItems().add(5, "Option 2");
        comboBox.marathon_select("Option 2(2)");
    });
    new Wait("Waiting for combo box option to be set.") {
        @Override public boolean until() {
            return comboNode.getSelectionModel().getSelectedIndex() == 5;
        }
    };
}
项目:main_carauto_board    文件:WebCamPreviewController.java   
public WebCamPreviewController(final Button btnStartCamera, final Button btnStopCamera, final Button btnDisposeCamera,
                               final ComboBox<WebCamInfo> cbCameraOptions, final Pane bpWebCamPaneHolder,
                               final FlowPane fpBottomPane, final ImageView imgWebCamCapturedImage) {
    this.btnStartCamera = btnStartCamera;
    this.btnStopCamera = btnStopCamera;
    this.btnDisposeCamera = btnDisposeCamera;
    this.cbCameraOptions = cbCameraOptions;
    this.bpWebCamPaneHolder = bpWebCamPaneHolder;
    this.fpBottomPane = fpBottomPane;
    this.imgWebCamCapturedImage = imgWebCamCapturedImage;
}
项目:CSS-Editor-FX    文件:OptionsController.java   
private <T> ComboBox<T> add(ValueOption<T> vo) {
  ComboBox<T> cb = new ComboBox<>();
  cb.getItems().addAll(vo.getValues());
  cb.getSelectionModel().select(vo.get());
  onSubmit.add(() -> vo.set(cb.getSelectionModel().getSelectedItem()));
  add(wrapWithText(cb, vo.getDescribe()));
  return cb;
}
项目:marathonv5    文件:RFXComboBoxTest.java   
@Test public void selectOption() {
    ComboBox<?> comboBox = (ComboBox<?>) getPrimaryStage().getScene().getRoot().lookup(".combo-box");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        RFXComboBox rfxComboBoxBase = new RFXComboBox(comboBox, null, null, lr);
        comboBox.getSelectionModel().select(1);
        rfxComboBoxBase.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("Option 2", recording.getParameters()[0]);
}
项目:marathonv5    文件:RFXComboBoxTest.java   
@Test public void selectOptionWithQuotes() {
    @SuppressWarnings("unchecked")
    ComboBox<String> comboBox = (ComboBox<String>) getPrimaryStage().getScene().getRoot().lookup(".combo-box");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        RFXComboBox rfxComboBoxBase = new RFXComboBox(comboBox, null, null, lr);
        comboBox.getItems().add(" \"Option 13\" ");
        comboBox.getSelectionModel().select(" \"Option 13\" ");
        rfxComboBoxBase.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals(" \"Option 13\" ", recording.getParameters()[0]);
}
项目:stvs    文件:IoVariableDefinitionPane.java   
/**
 * Creates an instance with given default values to display.
 * @param initialCategory Default category
 * @param initialName Default name
 * @param initialType Default type
 */
public IoVariableDefinitionPane(VariableCategory initialCategory, VariableRole initialRole, String initialName,
    String initialType) {
  super();

  setVgap(10);
  setHgap(10);

  this.categoryComboBox = new ComboBox<>(
      FXCollections.observableArrayList(VariableCategory.values()));
  this.variableRoleComboBox = new ComboBox<>(
      FXCollections.observableArrayList(VariableRole.values()));
  this.nameTextField = new TextField(initialName);
  this.typeTextField = new TextField(initialType);

  categoryComboBox.valueProperty().set(initialCategory);

  add(new Label("category: "), 0, 0);
  add(new Label("verification-role: "), 0, 1);
  add(new Label("name: "), 0, 2);
  add(new Label("type: "), 0, 3);
  add(categoryComboBox, 1, 0);
  add(variableRoleComboBox, 1, 1);
  add(nameTextField, 1, 2);
  add(typeTextField, 1, 3);
  ViewUtils.setupClass(this);
}
项目:marathonv5    文件:RFXComboBoxTest.java   
@Test public void selectEditorOption() {
    Set<Node> comboBoxNodes = getPrimaryStage().getScene().getRoot().lookupAll(".combo-box");
    List<Node> boxes = new ArrayList<>(comboBoxNodes);
    ComboBox<?> comboBox = (ComboBox<?>) boxes.get(1);
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        RFXComboBox rfxComboBoxBase = new RFXComboBox(comboBox, null, null, lr);
        comboBox.getEditor().setText("Option 2");
        rfxComboBoxBase.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("Option 2", recording.getParameters()[0]);
}
项目:strongbox    文件:EnumComboBox.java   
public static <T extends Enum<T>> ComboBox<T> create(Class<T> enumType, T defaultEnumValue) {

        List<T> entries = new ArrayList<>();
        Collections.addAll(entries, enumType.getEnumConstants());

        ObservableList<T> observableList = FXCollections.observableList(entries);
        ComboBox<T> comboBox = new ComboBox<T>(observableList);
        comboBox.setValue(defaultEnumValue);

        return comboBox;
    }
项目:Goliath-Overclocking-Utility-FX    文件:PerformanceModePane.java   
public PerformanceModePane()
{
    super();
    super.getStyleClass().add("hbox");
    super.setPadding(new Insets(10,10,10,10));
    super.setSpacing(5);

    modes = new ComboBox<>(FXCollections.observableArrayList("Adaptive", "Max Performance", "Driver Controlled(Auto)"));
    modes.getSelectionModel().select(InstanceProvider.getPowerMizerController().getCurrentValue());
    modes.getSelectionModel().selectedItemProperty().addListener(new ModeHandler());

    super.getChildren().addAll(new Label("Performance Mode:"), modes);
}