use of javafx.scene.control.ComboBox in project Smartcity-Smarthouse by TechnionYP5777.
the class MessageViewController method buildStreamModePane.
void buildStreamModePane() {
streamFieldMap = new HashMap<>();
int currentRow = 0;
streamMode.add(new Label("Name"), 0, currentRow);
streamMode.add(new Label("From"), 1, currentRow);
streamMode.add(new Label("To"), 2, currentRow++);
for (final SensorField ¢ : currentSensor.getFields()) {
streamMode.add(new Label(¢.getName()), 0, currentRow);
final List<Node> nodes = new ArrayList<>();
if (¢.getType() == Types.BOOLEAN) {
final ComboBox<BooleanValues> b = new ComboBox<>();
b.getItems().addAll(BooleanValues.values());
streamMode.add(b, 1, currentRow);
nodes.add(b);
} else {
final TextField t1 = new TextField(), t2 = new TextField();
streamMode.add(t1, 1, currentRow);
nodes.add(t1);
if (¢.getType() != Types.STRING) {
streamMode.add(t2, 2, currentRow);
nodes.add(t2);
}
}
streamFieldMap.put(¢, nodes);
++currentRow;
}
streamMode.add(new Label("Send Interval(integer only):"), 0, currentRow);
final TextField t1 = new TextField(), t2 = new TextField();
streamMode.add(t1, 1, currentRow);
streamMode.add(t2, 2, currentRow);
timeInput = new Pair<>(t1, t2);
}
use of javafx.scene.control.ComboBox in project POL-POM-5 by PlayOnLinux.
the class WinePrefixContainerDisplayTab method populate.
private void populate() {
final VBox displayPane = new VBox();
final Text title = new TextWithStyle(tr("Display settings"), TITLE_CSS_CLASS);
displayPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS);
displayPane.getChildren().add(title);
final GridPane displayContentPane = new GridPane();
displayContentPane.getStyleClass().add("grid");
final ComboBox<UseGLSL> glslComboBox = new ComboBox<>();
glslComboBox.setMaxWidth(Double.MAX_VALUE);
glslComboBox.setValue(container.getUseGlslValue());
glslComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(glslComboBox, UseGLSL.class);
displayContentPane.add(new TextWithStyle(tr("GLSL support"), CAPTION_TITLE_CSS_CLASS), 0, 0);
displayContentPane.add(glslComboBox, 1, 0);
final ComboBox<DirectDrawRenderer> directDrawRendererComboBox = new ComboBox<>();
directDrawRendererComboBox.setMaxWidth(Double.MAX_VALUE);
directDrawRendererComboBox.setValue(container.getDirectDrawRenderer());
directDrawRendererComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(directDrawRendererComboBox, DirectDrawRenderer.class);
displayContentPane.add(new TextWithStyle(tr("Direct Draw Renderer"), CAPTION_TITLE_CSS_CLASS), 0, 1);
displayContentPane.add(directDrawRendererComboBox, 1, 1);
final ComboBox<VideoMemorySize> videoMemorySizeComboBox = new ComboBox<>();
videoMemorySizeComboBox.setMaxWidth(Double.MAX_VALUE);
videoMemorySizeComboBox.setValue(container.getVideoMemorySize());
videoMemorySizeComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItemsVideoMemorySize(videoMemorySizeComboBox);
displayContentPane.add(new TextWithStyle(tr("Video memory size"), CAPTION_TITLE_CSS_CLASS), 0, 2);
displayContentPane.add(videoMemorySizeComboBox, 1, 2);
final ComboBox<OffscreenRenderingMode> offscreenRenderingModeComboBox = new ComboBox<>();
offscreenRenderingModeComboBox.setMaxWidth(Double.MAX_VALUE);
offscreenRenderingModeComboBox.setValue(container.getOffscreenRenderingMode());
offscreenRenderingModeComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(offscreenRenderingModeComboBox, OffscreenRenderingMode.class);
displayContentPane.add(new TextWithStyle(tr("Offscreen rendering mode"), CAPTION_TITLE_CSS_CLASS), 0, 3);
displayContentPane.add(offscreenRenderingModeComboBox, 1, 3);
final ComboBox<RenderTargetModeLock> renderTargetModeLockComboBox = new ComboBox<>();
renderTargetModeLockComboBox.setMaxWidth(Double.MAX_VALUE);
renderTargetModeLockComboBox.setValue(container.getRenderTargetModeLock());
renderTargetModeLockComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(renderTargetModeLockComboBox, RenderTargetModeLock.class);
displayContentPane.add(new TextWithStyle(tr("Render target lock mode"), CAPTION_TITLE_CSS_CLASS), 0, 4);
displayContentPane.add(renderTargetModeLockComboBox, 1, 4);
final ComboBox<Multisampling> multisamplingComboBox = new ComboBox<>();
multisamplingComboBox.setMaxWidth(Double.MAX_VALUE);
multisamplingComboBox.setValue(container.getMultisampling());
multisamplingComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(multisamplingComboBox, Multisampling.class);
displayContentPane.add(new TextWithStyle(tr("Multisampling"), CAPTION_TITLE_CSS_CLASS), 0, 5);
displayContentPane.add(multisamplingComboBox, 1, 5);
final ComboBox<StrictDrawOrdering> strictDrawOrderingComboBox = new ComboBox<>();
strictDrawOrderingComboBox.setMaxWidth(Double.MAX_VALUE);
strictDrawOrderingComboBox.setValue(container.getStrictDrawOrdering());
strictDrawOrderingComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(strictDrawOrderingComboBox, StrictDrawOrdering.class);
displayContentPane.add(new TextWithStyle(tr("Strict Draw Ordering"), CAPTION_TITLE_CSS_CLASS), 0, 6);
displayContentPane.add(strictDrawOrderingComboBox, 1, 6);
final ComboBox<AlwaysOffscreen> alwaysOffscreenComboBox = new ComboBox<>();
alwaysOffscreenComboBox.setMaxWidth(Double.MAX_VALUE);
alwaysOffscreenComboBox.setValue(container.getAlwaysOffscreen());
alwaysOffscreenComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(alwaysOffscreenComboBox, AlwaysOffscreen.class);
displayContentPane.add(new TextWithStyle(tr("Always Offscreen"), CAPTION_TITLE_CSS_CLASS), 0, 7);
displayContentPane.add(alwaysOffscreenComboBox, 1, 7);
Region spacer = new Region();
GridPane.setHgrow(spacer, Priority.ALWAYS);
displayContentPane.add(spacer, 2, 0);
displayPane.getChildren().addAll(displayContentPane);
this.setContent(displayPane);
lockableElements.addAll(Arrays.asList(glslComboBox, directDrawRendererComboBox, offscreenRenderingModeComboBox, renderTargetModeLockComboBox, multisamplingComboBox, strictDrawOrderingComboBox, alwaysOffscreenComboBox, videoMemorySizeComboBox));
}
use of javafx.scene.control.ComboBox in project POL-POM-5 by PlayOnLinux.
the class WinePrefixContainerInformationTab method populate.
private void populate() {
final VBox informationPane = new VBox();
final Text title = new TextWithStyle(tr("Information"), TITLE_CSS_CLASS);
informationPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS);
informationPane.getChildren().add(title);
final GridPane informationContentPane = new GridPane();
informationContentPane.getStyleClass().add("grid");
informationContentPane.add(new TextWithStyle(tr("Name:"), CAPTION_TITLE_CSS_CLASS), 0, 0);
Label name = new Label(container.getName());
name.setWrapText(true);
informationContentPane.add(name, 1, 0);
informationContentPane.add(new TextWithStyle(tr("Path:"), CAPTION_TITLE_CSS_CLASS), 0, 1);
Label path = new Label(container.getPath());
path.setWrapText(true);
informationContentPane.add(path, 1, 1);
informationContentPane.add(new TextWithStyle(tr("Wine version:"), CAPTION_TITLE_CSS_CLASS), 0, 2);
Label version = new Label(container.getVersion());
version.setWrapText(true);
informationContentPane.add(version, 1, 2);
informationContentPane.add(new TextWithStyle(tr("Wine architecture:"), CAPTION_TITLE_CSS_CLASS), 0, 3);
Label architecture = new Label(container.getArchitecture());
architecture.setWrapText(true);
informationContentPane.add(architecture, 1, 3);
informationContentPane.add(new TextWithStyle(tr("Wine distribution:"), CAPTION_TITLE_CSS_CLASS), 0, 4);
Label distribution = new Label(container.getDistribution());
distribution.setWrapText(true);
informationContentPane.add(distribution, 1, 4);
Region spacer = new Region();
spacer.setPrefHeight(20);
VBox.setVgrow(spacer, Priority.NEVER);
ComboBox<EngineVersionDTO> changeEngineComboBox = new ComboBox<EngineVersionDTO>(FXCollections.observableList(engineVersions));
changeEngineComboBox.setConverter(new StringConverter<EngineVersionDTO>() {
@Override
public String toString(EngineVersionDTO object) {
return object.getVersion();
}
@Override
public EngineVersionDTO fromString(String string) {
return engineVersions.stream().filter(engineVersion -> engineVersion.getVersion().equals(string)).findFirst().get();
}
});
changeEngineComboBox.getSelectionModel().select(engineVersions.stream().filter(engineVersion -> engineVersion.getVersion().equals(container.getVersion())).findFirst().get());
Button deleteButton = new Button(tr("Delete container"));
deleteButton.setOnMouseClicked(event -> this.onDeletePrefix.accept(container));
informationPane.getChildren().addAll(informationContentPane, spacer, changeEngineComboBox, deleteButton);
this.setContent(informationPane);
}
use of javafx.scene.control.ComboBox in project aima-java by aimacode.
the class SimulationPaneBuilder method getResultFor.
/**
* Adds a toolbar, a state view, and a status label to the provided pane and returns
* a controller class instance. The toolbar contains combo boxes to control parameter settings
* and buttons for simulation control. The controller class instance handles user events and provides
* access to user settings (parameter settings, simulation speed, status text, ...).
*/
public SimulationPaneCtrl getResultFor(BorderPane pane) {
List<ComboBox<String>> combos = new ArrayList<>();
parameters.add(createSimSpeedParam());
for (Parameter param : parameters) {
ComboBox<String> combo = new ComboBox<>();
combo.setId(param.getName());
combo.getItems().addAll(param.getValueNames());
combo.getSelectionModel().select(param.getDefaultValueIndex());
combos.add(combo);
}
Button simBtn = new Button();
Node[] tools = new Node[combos.size() + 2];
for (int i = 0; i < combos.size() - 1; i++) tools[i] = combos.get(i);
tools[combos.size() - 1] = new Separator();
tools[combos.size() + 0] = combos.get(combos.size() - 1);
tools[combos.size() + 1] = simBtn;
ToolBar toolBar = new ToolBar(tools);
Label statusLabel = new Label();
statusLabel.setMaxWidth(Double.MAX_VALUE);
statusLabel.setAlignment(Pos.CENTER);
statusLabel.setFont(Font.font(16));
pane.setTop(toolBar);
if (stateView.isPresent()) {
if (stateView.get() instanceof Canvas) {
// make canvas resizable
Canvas canvas = (Canvas) stateView.get();
Pane canvasPane = new Pane();
canvasPane.getChildren().add(canvas);
canvas.widthProperty().bind(canvasPane.widthProperty());
canvas.heightProperty().bind(canvasPane.heightProperty());
pane.setCenter(canvasPane);
pane.setStyle("-fx-background-color: white");
} else
pane.setCenter(stateView.get());
}
pane.setBottom(statusLabel);
if (!initMethod.isPresent())
throw new IllegalStateException("No initialization method defined.");
if (!simMethod.isPresent())
throw new IllegalStateException("No simulation method defined.");
return new SimulationPaneCtrl(parameters, combos, initMethod.get(), simMethod.get(), simBtn, statusLabel);
}
use of javafx.scene.control.ComboBox in project bitsquare by bitsquare.
the class CashDepositForm method addFormForAddAccount.
@Override
public void addFormForAddAccount() {
gridRowFrom = gridRow + 1;
Tuple3<Label, ComboBox, ComboBox> tuple3 = addLabelComboBoxComboBox(gridPane, ++gridRow, "Country:");
ComboBox<Region> regionComboBox = tuple3.second;
regionComboBox.setPromptText("Select region");
regionComboBox.setConverter(new StringConverter<Region>() {
@Override
public String toString(Region region) {
return region.name;
}
@Override
public Region fromString(String s) {
return null;
}
});
regionComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllRegions()));
ComboBox<Country> countryComboBox = tuple3.third;
countryComboBox.setVisibleRowCount(15);
countryComboBox.setDisable(true);
countryComboBox.setPromptText("Select country");
countryComboBox.setConverter(new StringConverter<Country>() {
@Override
public String toString(Country country) {
return country.name + " (" + country.code + ")";
}
@Override
public Country fromString(String s) {
return null;
}
});
countryComboBox.setOnAction(e -> {
Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem();
if (selectedItem != null) {
getCountryBasedPaymentAccount().setCountry(selectedItem);
String countryCode = selectedItem.code;
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(countryCode);
paymentAccount.setSingleTradeCurrency(currency);
currencyComboBox.setDisable(false);
currencyComboBox.getSelectionModel().select(currency);
bankIdLabel.setText(BankUtil.getBankIdLabel(countryCode));
branchIdLabel.setText(BankUtil.getBranchIdLabel(countryCode));
accountNrLabel.setText(BankUtil.getAccountNrLabel(countryCode));
accountTypeLabel.setText(BankUtil.getAccountTypeLabel(countryCode));
bankNameInputTextField.setText("");
bankIdInputTextField.setText("");
branchIdInputTextField.setText("");
accountNrInputTextField.setText("");
accountTypeComboBox.getSelectionModel().clearSelection();
accountTypeComboBox.setItems(FXCollections.observableArrayList(BankUtil.getAccountTypeValues(countryCode)));
if (BankUtil.useValidation(countryCode) && !validatorsApplied) {
validatorsApplied = true;
if (useHolderID)
holderIdInputTextField.setValidator(inputValidator);
bankNameInputTextField.setValidator(inputValidator);
bankIdInputTextField.setValidator(new BankIdValidator(countryCode));
branchIdInputTextField.setValidator(new BranchIdValidator(countryCode));
accountNrInputTextField.setValidator(new AccountNrValidator(countryCode));
} else {
validatorsApplied = false;
if (useHolderID)
holderIdInputTextField.setValidator(null);
bankNameInputTextField.setValidator(null);
bankIdInputTextField.setValidator(null);
branchIdInputTextField.setValidator(null);
accountNrInputTextField.setValidator(null);
}
holderNameInputTextField.resetValidation();
holderEmailInputTextField.resetValidation();
bankNameInputTextField.resetValidation();
bankIdInputTextField.resetValidation();
branchIdInputTextField.resetValidation();
accountNrInputTextField.resetValidation();
boolean requiresHolderId = BankUtil.isHolderIdRequired(countryCode);
if (requiresHolderId) {
holderNameInputTextField.minWidthProperty().unbind();
holderNameInputTextField.setMinWidth(300);
} else {
holderNameInputTextField.minWidthProperty().bind(currencyComboBox.widthProperty());
}
if (useHolderID) {
if (!requiresHolderId)
holderIdInputTextField.setText("");
holderIdInputTextField.resetValidation();
holderIdInputTextField.setVisible(requiresHolderId);
holderIdInputTextField.setManaged(requiresHolderId);
holderIdLabel.setText(BankUtil.getHolderIdLabel(countryCode));
holderIdLabel.setVisible(requiresHolderId);
holderIdLabel.setManaged(requiresHolderId);
}
boolean bankNameRequired = BankUtil.isBankNameRequired(countryCode);
bankNameTuple.first.setVisible(bankNameRequired);
bankNameTuple.first.setManaged(bankNameRequired);
bankNameInputTextField.setVisible(bankNameRequired);
bankNameInputTextField.setManaged(bankNameRequired);
boolean bankIdRequired = BankUtil.isBankIdRequired(countryCode);
bankIdTuple.first.setVisible(bankIdRequired);
bankIdTuple.first.setManaged(bankIdRequired);
bankIdInputTextField.setVisible(bankIdRequired);
bankIdInputTextField.setManaged(bankIdRequired);
boolean branchIdRequired = BankUtil.isBranchIdRequired(countryCode);
branchIdTuple.first.setVisible(branchIdRequired);
branchIdTuple.first.setManaged(branchIdRequired);
branchIdInputTextField.setVisible(branchIdRequired);
branchIdInputTextField.setManaged(branchIdRequired);
boolean accountNrRequired = BankUtil.isAccountNrRequired(countryCode);
accountNrTuple.first.setVisible(accountNrRequired);
accountNrTuple.first.setManaged(accountNrRequired);
accountNrInputTextField.setVisible(accountNrRequired);
accountNrInputTextField.setManaged(accountNrRequired);
boolean accountTypeRequired = BankUtil.isAccountTypeRequired(countryCode);
accountTypeTuple.first.setVisible(accountTypeRequired);
accountTypeTuple.first.setManaged(accountTypeRequired);
accountTypeTuple.second.setVisible(accountTypeRequired);
accountTypeTuple.second.setManaged(accountTypeRequired);
updateFromInputs();
onCountryChanged();
}
});
regionComboBox.setOnAction(e -> {
Region selectedItem = regionComboBox.getSelectionModel().getSelectedItem();
if (selectedItem != null) {
countryComboBox.setDisable(false);
countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllCountriesForRegion(selectedItem)));
}
});
currencyComboBox = addLabelComboBox(gridPane, ++gridRow, "Currency:").second;
currencyComboBox.setPromptText("Select currency");
currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedFiatCurrencies()));
currencyComboBox.setOnAction(e -> {
TradeCurrency selectedItem = currencyComboBox.getSelectionModel().getSelectedItem();
FiatCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(countryComboBox.getSelectionModel().getSelectedItem().code);
if (!defaultCurrency.equals(selectedItem)) {
new Popup<>().warning("Are you sure you want to choose a currency other than the country's default currency?").actionButtonText("Yes").onAction(() -> {
paymentAccount.setSingleTradeCurrency(selectedItem);
autoFillNameTextField();
}).closeButtonText("No, restore default currency").onClose(() -> currencyComboBox.getSelectionModel().select(defaultCurrency)).show();
} else {
paymentAccount.setSingleTradeCurrency(selectedItem);
autoFillNameTextField();
}
});
currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
@Override
public String toString(TradeCurrency currency) {
return currency.getNameAndCode();
}
@Override
public TradeCurrency fromString(String string) {
return null;
}
});
currencyComboBox.setDisable(true);
addAcceptedBanksForAddAccount();
addHolderNameAndId();
bankNameTuple = addLabelInputTextField(gridPane, ++gridRow, "Bank name:");
bankNameInputTextField = bankNameTuple.second;
bankNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
cashDepositAccountContractData.setBankName(newValue);
updateFromInputs();
});
bankIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBankIdLabel(""));
bankIdLabel = bankIdTuple.first;
bankIdInputTextField = bankIdTuple.second;
bankIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
cashDepositAccountContractData.setBankId(newValue);
updateFromInputs();
});
branchIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBranchIdLabel(""));
branchIdLabel = branchIdTuple.first;
branchIdInputTextField = branchIdTuple.second;
branchIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
cashDepositAccountContractData.setBranchId(newValue);
updateFromInputs();
});
accountNrTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getAccountNrLabel(""));
accountNrLabel = accountNrTuple.first;
accountNrInputTextField = accountNrTuple.second;
accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
cashDepositAccountContractData.setAccountNr(newValue);
updateFromInputs();
});
accountTypeTuple = addLabelComboBox(gridPane, ++gridRow, "");
accountTypeLabel = accountTypeTuple.first;
accountTypeComboBox = accountTypeTuple.second;
accountTypeComboBox.setPromptText("Select account type");
accountTypeComboBox.setOnAction(e -> {
if (BankUtil.isAccountTypeRequired(cashDepositAccountContractData.getCountryCode())) {
cashDepositAccountContractData.setAccountType(accountTypeComboBox.getSelectionModel().getSelectedItem());
updateFromInputs();
}
});
TextArea requirementsTextArea = addLabelTextArea(gridPane, ++gridRow, "Extra requirements:", "").second;
requirementsTextArea.setMinHeight(30);
requirementsTextArea.setMaxHeight(30);
requirementsTextArea.textProperty().addListener((ov, oldValue, newValue) -> {
cashDepositAccountContractData.setRequirements(newValue);
updateFromInputs();
});
addAllowedPeriod();
addAccountNameTextFieldWithAutoFillCheckBox();
updateFromInputs();
}
Aggregations