Search in sources :

Example 46 with ComboBox

use of javafx.scene.control.ComboBox in project trex-stateless-gui by cisco-system-traffic-generator.

the class TrafficProfileTestBase method addPayload.

/**
 * Add payload
 * @param type
 */
protected void addPayload(String type) {
    clickOn("#protocolDataTab");
    waitForNode("Payload Data");
    clickOn("Payload Data");
    waitForNode("#payloadType");
    ComboBox payloadType = find("#payloadType");
    payloadType.getSelectionModel().select(type);
}
Also used : ComboBox(javafx.scene.control.ComboBox)

Example 47 with ComboBox

use of javafx.scene.control.ComboBox in project POL-POM-5 by PlayOnLinux.

the class ChooseRepositoryTypePanel method populate.

/**
 * Populates the content of this component
 */
private void populate() {
    choiceBox = new ComboBox<>(repositoryChoices);
    choiceBox.setPromptText(tr("Please select the repository type you want to add"));
    choiceBox.setConverter(new StringConverter<RepositoryType>() {

        @Override
        public String toString(RepositoryType repositoryType) {
            return repositoryType.getLabel();
        }

        @Override
        public RepositoryType fromString(String string) {
            return Arrays.stream(RepositoryType.values()).filter(type -> type.getLabel().equals(string)).findAny().orElse(null);
        }
    });
    choiceBox.setOnAction(event -> onRepositoryTypeSelection.accept(choiceBox.getSelectionModel().getSelectedItem()));
    Label choiceBoxLabel = new Label(tr("Repository type:"));
    choiceBoxLabel.setLabelFor(choiceBox);
    HBox content = new HBox(choiceBoxLabel, choiceBox);
    content.setId("repositoryTypeSelection");
    HBox.setHgrow(choiceBox, Priority.ALWAYS);
    this.setCenter(content);
}
Also used : Consumer(java.util.function.Consumer) HBox(javafx.scene.layout.HBox) Priority(javafx.scene.layout.Priority) Arrays(java.util.Arrays) Label(javafx.scene.control.Label) ComboBox(javafx.scene.control.ComboBox) FXCollections(javafx.collections.FXCollections) Localisation.tr(org.phoenicis.configuration.localisation.Localisation.tr) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) StringConverter(javafx.util.StringConverter) HBox(javafx.scene.layout.HBox) Label(javafx.scene.control.Label)

Example 48 with ComboBox

use of javafx.scene.control.ComboBox in project POL-POM-5 by PhoenicisOrg.

the class ContainerEngineSettingsPanelSkin method updateEngineSettingsGrid.

/**
 * Updates the engine settings in the given {@link GridPane engineSettingsGrid}
 *
 * @param engineSettingsGrid The GridPane containing the shown engine settings
 */
private void updateEngineSettingsGrid(final GridPane engineSettingsGrid) {
    engineSettingsGrid.getChildren().clear();
    final ContainerDTO container = getControl().getContainer();
    for (EngineSetting engineSetting : getControl().getEngineSettings()) {
        final int row = engineSettingsGrid.getRowCount();
        final Text engineSettingDescription = new Text(engineSetting.getText());
        engineSettingDescription.getStyleClass().add("captionTitle");
        final ObservableList<String> items = FXCollections.observableArrayList(engineSetting.getOptions());
        final ComboBox<String> engineSettingComboBox = new ComboBox<>(items);
        engineSettingComboBox.getStyleClass().add("engine-setting-combo-box");
        engineSettingComboBox.disableProperty().bind(getControl().lockEngineSettingsProperty());
        // if the container is not specified set no default values
        if (container != null) {
            try {
                engineSettingComboBox.setValue(engineSetting.getCurrentOption(container.getName()));
            } catch (Exception e) {
                engineSettingComboBox.getSelectionModel().select(0);
                LOGGER.warn(String.format("Could not fetch current option for engine setting \"%s\", will use default.", engineSetting.getText()));
                LOGGER.debug("Caused by: ", e);
            }
            engineSettingComboBox.valueProperty().addListener((Observable invalidation) -> Platform.runLater(() -> {
                getControl().setLockEngineSettings(true);
                engineSetting.setOption(container.getName(), items.indexOf(engineSettingComboBox.getValue()));
                getControl().setLockEngineSettings(false);
            }));
        }
        engineSettingsGrid.addRow(row, engineSettingDescription, engineSettingComboBox);
    }
}
Also used : EngineSetting(org.phoenicis.engines.EngineSetting) ComboBox(javafx.scene.control.ComboBox) Text(javafx.scene.text.Text) ContainerDTO(org.phoenicis.containers.dto.ContainerDTO) Observable(javafx.beans.Observable)

Aggregations

ComboBox (javafx.scene.control.ComboBox)48 Label (javafx.scene.control.Label)30 Insets (javafx.geometry.Insets)15 HBox (javafx.scene.layout.HBox)15 Button (javafx.scene.control.Button)14 TextField (javafx.scene.control.TextField)14 GridPane (javafx.scene.layout.GridPane)14 VBox (javafx.scene.layout.VBox)12 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)10 BorderPane (javafx.scene.layout.BorderPane)9 Text (javafx.scene.text.Text)9 TradeCurrency (bisq.core.locale.TradeCurrency)8 List (java.util.List)8 FXCollections (javafx.collections.FXCollections)8 Tooltip (javafx.scene.control.Tooltip)8 Priority (javafx.scene.layout.Priority)8 Popup (bisq.desktop.main.overlays.popups.Popup)7 Node (javafx.scene.Node)7 ImageView (javafx.scene.image.ImageView)7 TextWithStyle (org.phoenicis.javafx.views.common.TextWithStyle)7