List of usage examples for javafx.scene.control ComboBox getItems
public final ObservableList<T> getItems()
From source file:com.saiton.ccs.validations.FormatAndValidate.java
public boolean validCombobox(ComboBox combo) { boolean valid = false; if (!combo.getItems().isEmpty()) { valid = true;/* w w w . ja v a 2s . c o m*/ } else { valid = false; } return valid; }
From source file:nl.mvdr.umvc3replayanalyser.controller.Umvc3ReplayManagerController.java
/** Initialises the character combo box values. */ private void initCharacterComboBoxValues() { for (ComboBox<Umvc3Character> comboBox : Arrays.asList(playerOneCharacterOneComboBox, playerOneCharacterTwoComboBox, playerOneCharacterThreeComboBox, playerTwoCharacterOneComboBox, playerTwoCharacterTwoComboBox, playerTwoCharacterThreeComboBox)) { comboBox.getItems().add(null); comboBox.getItems().addAll(Umvc3Character.values()); }/*www.j ava2 s .c om*/ }
From source file:nl.mvdr.umvc3replayanalyser.controller.Umvc3ReplayManagerController.java
/** * If observable is a character, updates the corresponding assist combo box. * //from www. ja v a 2 s . c o m * @param observable * observable whose value has changed */ private void updateAssistComboBox(ObservableValue<? extends Object> observable) { ComboBox<Assist> comboBox = this.assistComboBoxes.get(observable); if (comboBox != null) { // Character value has changed. Rebuild the contents of the combo box. Umvc3Character selectedCharacter = (Umvc3Character) observable.getValue(); comboBox.getSelectionModel().clearSelection(); comboBox.getItems().clear(); if (selectedCharacter != null) { comboBox.getItems().add(null); for (AssistType type : AssistType.values()) { comboBox.getItems().add(new Assist(type, selectedCharacter)); } } comboBox.setDisable(selectedCharacter == null); } }
From source file:genrsa.GenRSAController.java
/** * Mtodo usado para cargar la ventana de Firma * @param event /*from w w w .ja va 2 s .com*/ */ public void Sign(ActionEvent event) { FXMLLoader fxmlLoader; Parent root; int iterator; try { secondStage = new Stage(); fxmlLoader = new FXMLLoader(getClass().getResource("/Sign/Sign.fxml")); root = fxmlLoader.load(); SignController SignCtr = fxmlLoader.<SignController>getController(); SignCtr.setPubKeyBI(this.RSA.getE()); SignCtr.setModulusBI(this.RSA.getN()); SignCtr.setRadix(this.radix); //parte grfica SignCtr.getModulus().setText( this.utilidades.putPoints(this.RSA.getN().toString(this.radix).toUpperCase(), this.radix)); SignCtr.getPubKey().setText( this.utilidades.putPoints(this.RSA.getE().toString(this.radix).toUpperCase(), this.radix)); SignCtr.getModulus1().setText( this.utilidades.putPoints(this.RSA.getN().toString(this.radix).toUpperCase(), this.radix)); //obtengo todas las claves privadas parejas String[] PPK = this.claves_parejas.getText().split("\n"); //quito la informacion acerca de los bits "--> XXbits" //las meto en el comboBox ComboBox comboBox = SignCtr.getPrivKeys(); comboBox.getItems().add("Clave Privada"); comboBox.getItems() .add(this.utilidades.putPoints(this.RSA.getD().toString(this.radix).toUpperCase(), this.radix)); comboBox.getItems().add("Claves Privadas Parejas"); for (iterator = 0; iterator < PPK.length; iterator++) { comboBox.getItems().add(PPK[iterator]); } comboBox.setValue( this.utilidades.putPoints(this.RSA.getD().toString(this.radix).toUpperCase(), this.radix)); comboBox.setVisibleRowCount(7); disableOnProgress(true); Scene scene = new Scene(root); secondStage.initModality(Modality.NONE); secondStage.getIcons() .add(new Image(GenRSAController.class.getResourceAsStream("/allImages/genRSA.png"))); secondStage.setTitle("genRSA - Firma y Validacin"); secondStage.setScene(scene); secondStage.show(); secondStage.setOnCloseRequest(closeEvent -> { this.disableOnProgress(false); this.disableButtons(); }); } catch (IOException ex) { //no pongo mensaje de error, porque no se puede dar el caso } }
From source file:genrsa.GenRSAController.java
/** * Mtodo usado para cargar la ventana de Cifra * @param event //from www . j a v a2 s. com */ public void DeCipher(ActionEvent event) { FXMLLoader fxmlLoader; Parent root; int iterator; try { secondStage = new Stage(); fxmlLoader = new FXMLLoader(getClass().getResource("/DeCipher/DeCipher.fxml")); root = fxmlLoader.load(); DeCipherController DeCipherCtr = fxmlLoader.<DeCipherController>getController(); DeCipherCtr.setPubKeyBI(this.RSA.getE()); DeCipherCtr.setModulusBI(this.RSA.getN()); DeCipherCtr.setRadix(this.radix); //parte grfica DeCipherCtr.getModulus().setText( this.utilidades.putPoints(this.RSA.getN().toString(this.radix).toUpperCase(), this.radix)); DeCipherCtr.getPubKey().setText( this.utilidades.putPoints(this.RSA.getE().toString(this.radix).toUpperCase(), this.radix)); DeCipherCtr.getModulus1().setText( this.utilidades.putPoints(this.RSA.getN().toString(this.radix).toUpperCase(), this.radix)); //obtengo todas las claves privadas parejas String[] PPK = this.claves_parejas.getText().split("\n"); //las meto en el comboBox ComboBox comboBox = DeCipherCtr.getPrivKeys(); comboBox.getItems().add("Clave Privada"); comboBox.getItems() .add(this.utilidades.putPoints(this.RSA.getD().toString(this.radix).toUpperCase(), this.radix)); comboBox.getItems().add("Claves Privadas Parejas"); for (iterator = 0; iterator < PPK.length; iterator++) { comboBox.getItems().add(PPK[iterator]); } comboBox.setValue( this.utilidades.putPoints(this.RSA.getD().toString(this.radix).toUpperCase(), this.radix)); comboBox.setVisibleRowCount(7); disableOnProgress(true); Scene scene = new Scene(root); secondStage.initModality(Modality.NONE); secondStage.getIcons() .add(new Image(GenRSAController.class.getResourceAsStream("/allImages/genRSA.png"))); secondStage.setTitle("genRSA - Cifrado y Descifrado"); secondStage.setScene(scene); secondStage.show(); secondStage.setOnCloseRequest(closeEvent -> { this.disableOnProgress(false); this.disableButtons(); }); } catch (IOException ex) { //no pongo mensaje de error, porque no se puede dar el caso } }
From source file:account.management.controller.inventory.InsertStockController.java
public void addRow() { ComboBox<Product> select_item = new ComboBox(); select_item.setPromptText("Select Item"); select_item.setPrefWidth(190);//from www . j a v a 2 s . co m select_item.setPrefHeight(25); new AutoCompleteComboBoxListener<>(select_item); select_item.setOnHiding((e) -> { Product a = select_item.getSelectionModel().getSelectedItem(); select_item.setEditable(false); select_item.getSelectionModel().select(a); }); select_item.setOnShowing((e) -> { select_item.setEditable(true); }); TextField qty = new TextField(); qty.setPromptText("Quantity"); qty.setPrefWidth(97); qty.setPrefHeight(25); TextField rate = new TextField(); rate.setPrefWidth(100); rate.setPrefHeight(25); if (this.voucher_type.getSelectionModel().getSelectedItem().equals("Purchase")) { rate.setPromptText("Purchase Rate"); } else { rate.setPromptText("Sell Rate"); } Button del = new Button("Delete"); HBox row = new HBox(); row.getChildren().addAll(select_item, qty, rate, del); row.setSpacing(10); row.setPadding(new Insets(0, 0, 0, 15)); this.conatiner.getChildren().add(row); del.setOnAction((e) -> { this.conatiner.getChildren().remove(row); this.add_row.setDisable(false); calculateTotal(); }); select_item.getItems().addAll(this.products_list); select_item.setOnAction((e) -> { qty.setText("0"); if (this.voucher_type.getSelectionModel().getSelectedItem().equals("Purchase")) { rate.setText(String.valueOf(select_item.getSelectionModel().getSelectedItem().getLast_p_rate())); } else { rate.setText(String.valueOf(select_item.getSelectionModel().getSelectedItem().getLast_s_rate())); } calculateTotal(); }); qty.setOnKeyReleased((e) -> { calculateTotal(); }); rate.setOnKeyReleased((e) -> { calculateTotal(); }); if (this.conatiner.getChildren().size() >= 8) { this.add_row.setDisable(true); return; } }
From source file:gov.va.isaac.gui.refexViews.refexEdit.AddRefexPopup.java
private void buildDataFields(boolean assemblageValid, RefexDynamicDataBI[] currentValues) { if (assemblageValid) { for (ReadOnlyStringProperty ssp : currentDataFieldWarnings_) { allValid_.removeBinding(ssp); }//from w w w .java2s . co m currentDataFieldWarnings_.clear(); for (RefexDataTypeNodeDetails nd : currentDataFields_) { nd.cleanupListener(); } currentDataFields_.clear(); GridPane gp = new GridPane(); gp.setHgap(10.0); gp.setVgap(10.0); gp.setStyle("-fx-padding: 5;"); int row = 0; boolean extraInfoColumnIsRequired = false; for (RefexDynamicColumnInfo ci : assemblageInfo_.getColumnInfo()) { SimpleStringProperty valueIsRequired = (ci.isColumnRequired() ? new SimpleStringProperty("") : null); SimpleStringProperty defaultValueTooltip = ((ci.getDefaultColumnValue() == null && ci.getValidator() == null) ? null : new SimpleStringProperty()); ComboBox<RefexDynamicDataType> polymorphicType = null; Label l = new Label(ci.getColumnName()); l.getStyleClass().add("boldLabel"); l.setMinWidth(FxUtils.calculateNecessaryWidthOfBoldLabel(l)); Tooltip.install(l, new Tooltip(ci.getColumnDescription())); int col = 0; gp.add(l, col++, row); if (ci.getColumnDataType() == RefexDynamicDataType.POLYMORPHIC) { polymorphicType = new ComboBox<>(); polymorphicType.setEditable(false); polymorphicType.setConverter(new StringConverter<RefexDynamicDataType>() { @Override public String toString(RefexDynamicDataType object) { return object.getDisplayName(); } @Override public RefexDynamicDataType fromString(String string) { throw new RuntimeException("unecessary"); } }); for (RefexDynamicDataType type : RefexDynamicDataType.values()) { if (type == RefexDynamicDataType.POLYMORPHIC || type == RefexDynamicDataType.UNKNOWN) { continue; } else { polymorphicType.getItems().add(type); } } polymorphicType.getSelectionModel() .select((currentValues == null ? RefexDynamicDataType.STRING : (currentValues[row] == null ? RefexDynamicDataType.STRING : currentValues[row].getRefexDataType()))); } RefexDataTypeNodeDetails nd = RefexDataTypeFXNodeBuilder.buildNodeForType(ci.getColumnDataType(), ci.getDefaultColumnValue(), (currentValues == null ? null : currentValues[row]), valueIsRequired, defaultValueTooltip, (polymorphicType == null ? null : polymorphicType.getSelectionModel().selectedItemProperty()), allValid_, new SimpleObjectProperty<>(ci.getValidator()), new SimpleObjectProperty<>(ci.getValidatorData())); currentDataFieldWarnings_.addAll(nd.getBoundToAllValid()); if (ci.getColumnDataType() == RefexDynamicDataType.POLYMORPHIC) { nd.addUpdateParentListListener(currentDataFieldWarnings_); } currentDataFields_.add(nd); gp.add(nd.getNodeForDisplay(), col++, row); Label colType = new Label(ci.getColumnDataType().getDisplayName()); colType.setMinWidth(FxUtils.calculateNecessaryWidthOfLabel(colType)); gp.add((polymorphicType == null ? colType : polymorphicType), col++, row); if (ci.isColumnRequired() || ci.getDefaultColumnValue() != null || ci.getValidator() != null) { extraInfoColumnIsRequired = true; StackPane stackPane = new StackPane(); stackPane.setMaxWidth(Double.MAX_VALUE); if (ci.getDefaultColumnValue() != null || ci.getValidator() != null) { ImageView information = Images.INFORMATION.createImageView(); Tooltip tooltip = new Tooltip(); tooltip.textProperty().bind(defaultValueTooltip); Tooltip.install(information, tooltip); tooltip.setAutoHide(true); information.setOnMouseClicked( event -> tooltip.show(information, event.getScreenX(), event.getScreenY())); stackPane.getChildren().add(information); } if (ci.isColumnRequired()) { ImageView exclamation = Images.EXCLAMATION.createImageView(); final BooleanProperty showExclamation = new SimpleBooleanProperty( StringUtils.isNotBlank(valueIsRequired.get())); valueIsRequired.addListener((ChangeListener<String>) (observable, oldValue, newValue) -> showExclamation.set(StringUtils.isNotBlank(newValue))); exclamation.visibleProperty().bind(showExclamation); Tooltip tooltip = new Tooltip(); tooltip.textProperty().bind(valueIsRequired); Tooltip.install(exclamation, tooltip); tooltip.setAutoHide(true); exclamation.setOnMouseClicked( event -> tooltip.show(exclamation, event.getScreenX(), event.getScreenY())); stackPane.getChildren().add(exclamation); } gp.add(stackPane, col++, row); } row++; } ColumnConstraints cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); gp.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.ALWAYS); gp.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); gp.getColumnConstraints().add(cc); if (extraInfoColumnIsRequired) { cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); gp.getColumnConstraints().add(cc); } if (row == 0) { sp_.setContent(new Label("This assemblage does not allow data fields")); } else { sp_.setContent(gp); } allValid_.invalidate(); } else { sp_.setContent(null); } }
From source file:gov.va.isaac.gui.refexViews.refexEdit.AddSememePopup.java
private void buildDataFields(boolean assemblageValid, DynamicSememeDataBI[] currentValues) { if (assemblageValid) { for (ReadOnlyStringProperty ssp : currentDataFieldWarnings_) { allValid_.removeBinding(ssp); }/*from w w w . j a va 2 s .co m*/ currentDataFieldWarnings_.clear(); for (SememeGUIDataTypeNodeDetails nd : currentDataFields_) { nd.cleanupListener(); } currentDataFields_.clear(); GridPane gp = new GridPane(); gp.setHgap(10.0); gp.setVgap(10.0); gp.setStyle("-fx-padding: 5;"); int row = 0; boolean extraInfoColumnIsRequired = false; for (DynamicSememeColumnInfo ci : assemblageInfo_.getColumnInfo()) { SimpleStringProperty valueIsRequired = (ci.isColumnRequired() ? new SimpleStringProperty("") : null); SimpleStringProperty defaultValueTooltip = ((ci.getDefaultColumnValue() == null && ci.getValidator() == null) ? null : new SimpleStringProperty()); ComboBox<DynamicSememeDataType> polymorphicType = null; Label l = new Label(ci.getColumnName()); l.getStyleClass().add("boldLabel"); l.setMinWidth(FxUtils.calculateNecessaryWidthOfBoldLabel(l)); Tooltip.install(l, new Tooltip(ci.getColumnDescription())); int col = 0; gp.add(l, col++, row); if (ci.getColumnDataType() == DynamicSememeDataType.POLYMORPHIC) { polymorphicType = new ComboBox<>(); polymorphicType.setEditable(false); polymorphicType.setConverter(new StringConverter<DynamicSememeDataType>() { @Override public String toString(DynamicSememeDataType object) { return object.getDisplayName(); } @Override public DynamicSememeDataType fromString(String string) { throw new RuntimeException("unecessary"); } }); for (DynamicSememeDataType type : DynamicSememeDataType.values()) { if (type == DynamicSememeDataType.POLYMORPHIC || type == DynamicSememeDataType.UNKNOWN) { continue; } else { polymorphicType.getItems().add(type); } } polymorphicType.getSelectionModel() .select((currentValues == null ? DynamicSememeDataType.STRING : (currentValues[row] == null ? DynamicSememeDataType.STRING : currentValues[row].getDynamicSememeDataType()))); } SememeGUIDataTypeNodeDetails nd = SememeGUIDataTypeFXNodeBuilder.buildNodeForType( ci.getColumnDataType(), ci.getDefaultColumnValue(), (currentValues == null ? null : currentValues[row]), valueIsRequired, defaultValueTooltip, (polymorphicType == null ? null : polymorphicType.getSelectionModel().selectedItemProperty()), allValid_, ci.getValidator(), ci.getValidatorData()); currentDataFieldWarnings_.addAll(nd.getBoundToAllValid()); if (ci.getColumnDataType() == DynamicSememeDataType.POLYMORPHIC) { nd.addUpdateParentListListener(currentDataFieldWarnings_); } currentDataFields_.add(nd); gp.add(nd.getNodeForDisplay(), col++, row); Label colType = new Label(ci.getColumnDataType().getDisplayName()); colType.setMinWidth(FxUtils.calculateNecessaryWidthOfLabel(colType)); gp.add((polymorphicType == null ? colType : polymorphicType), col++, row); if (ci.isColumnRequired() || ci.getDefaultColumnValue() != null || ci.getValidator() != null) { extraInfoColumnIsRequired = true; StackPane stackPane = new StackPane(); stackPane.setMaxWidth(Double.MAX_VALUE); if (ci.getDefaultColumnValue() != null || ci.getValidator() != null) { ImageView information = Images.INFORMATION.createImageView(); Tooltip tooltip = new Tooltip(); tooltip.textProperty().bind(defaultValueTooltip); Tooltip.install(information, tooltip); tooltip.setAutoHide(true); information.setOnMouseClicked( event -> tooltip.show(information, event.getScreenX(), event.getScreenY())); stackPane.getChildren().add(information); } if (ci.isColumnRequired()) { ImageView exclamation = Images.EXCLAMATION.createImageView(); final BooleanProperty showExclamation = new SimpleBooleanProperty( StringUtils.isNotBlank(valueIsRequired.get())); valueIsRequired.addListener((ChangeListener<String>) (observable, oldValue, newValue) -> showExclamation.set(StringUtils.isNotBlank(newValue))); exclamation.visibleProperty().bind(showExclamation); Tooltip tooltip = new Tooltip(); tooltip.textProperty().bind(valueIsRequired); Tooltip.install(exclamation, tooltip); tooltip.setAutoHide(true); exclamation.setOnMouseClicked( event -> tooltip.show(exclamation, event.getScreenX(), event.getScreenY())); stackPane.getChildren().add(exclamation); } gp.add(stackPane, col++, row); } row++; } ColumnConstraints cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); gp.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.ALWAYS); gp.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); gp.getColumnConstraints().add(cc); if (extraInfoColumnIsRequired) { cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); gp.getColumnConstraints().add(cc); } if (row == 0) { sp_.setContent(new Label("This assemblage does not allow data fields")); } else { sp_.setContent(gp); } allValid_.invalidate(); } else { sp_.setContent(null); } }
From source file:de.bayern.gdi.gui.Controller.java
/** * Resets all marks at the processing chain container, items are kept. *//*w w w .j ava 2 s. co m*/ private void resetProcessingChainContainer() { for (Node o : chainContainer.getChildren()) { if (o instanceof VBox) { VBox v = (VBox) o; HBox hbox = (HBox) v.getChildren().get(0); Node cBox = hbox.getChildren().get(0); if (cBox instanceof ComboBox) { cBox.setStyle(FX_BORDER_COLOR_NULL); ComboBox box = (ComboBox) cBox; ObservableList<ProcessingStepConfiguration> confs = (ObservableList<ProcessingStepConfiguration>) box .getItems(); for (ProcessingStepConfiguration cfgI : confs) { cfgI.setCompatible(true); confs.set(confs.indexOf(cfgI), cfgI); } } } } }
From source file:de.bayern.gdi.gui.Controller.java
/** * Validates the chain items of a ComboBox * and marks the box according to the chosen item. * * @param box Item to validate//from www.j av a2s. c o m * @return True if chosen item is valid, else false */ private boolean validateChainContainer(ComboBox box) { String format = this.dataBean.getAttributeValue(OUTPUTFORMAT); if (format == null) { box.setStyle(FX_BORDER_COLOR_RED); setStatusTextUI(I18n.format(GUI_PROCESS_NO_FORMAT)); } MIMETypes mtypes = Config.getInstance().getMimeTypes(); MIMEType mtype = mtypes.findByName(format); ProcessingStepConfiguration cfg = (ProcessingStepConfiguration) box.getValue(); ObservableList<ProcessingStepConfiguration> items = (ObservableList<ProcessingStepConfiguration>) box .getItems(); if (format != null && mtype == null) { box.setStyle(FX_BORDER_COLOR_RED); for (ProcessingStepConfiguration cfgI : items) { cfgI.setCompatible(false); //Workaround to force cell update items.set(items.indexOf(cfgI), cfgI); } setStatusTextUI(I18n.format(GUI_PROCESS_FORMAT_NOT_FOUND)); return false; } //Mark items that are incompatible for (ProcessingStepConfiguration cfgI : items) { if (format != null) { cfgI.setCompatible(cfgI.isCompatibleWithFormat(mtype.getType())); } else { cfgI.setCompatible(false); } items.set(items.indexOf(cfgI), cfgI); } if (format == null) { return false; } if (cfg == null) { box.setStyle(FX_BORDER_COLOR_NULL); return true; } if (cfg.isCompatible()) { box.setStyle(FX_BORDER_COLOR_NULL); } else { box.setStyle(FX_BORDER_COLOR_RED); setStatusTextUI(I18n.format(GUI_PROCESS_NOT_COMPATIBLE, box.getValue())); } return cfg.isCompatible(); }