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);
}
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);
}
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);
}
}
Aggregations