List of usage examples for javafx.scene.control CheckBox setOnAction
public final void setOnAction(EventHandler<ActionEvent> value)
From source file:de.pixida.logtest.designer.automaton.AutomatonNode.java
@Override public Node getConfigFrame() { // TODO: Remove code redundancies; element creating methods have been created in class AutomatonEdge and should be centralized! final ConfigFrame cf = new ConfigFrame("State properties"); final int nameInputLines = 1; final TextArea nameInput = new TextArea(this.name); nameInput.setPrefRowCount(nameInputLines); nameInput.setWrapText(true);// w w w . j av a 2s .com nameInput.textProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> { this.setName(newValue); this.getGraph().handleChange(); }); cf.addOption("Name", nameInput); final int descriptionInputLines = 3; this.createTextAreaInput(descriptionInputLines, cf, "Description", this.getDescription(), newValue -> this.setDescription(newValue)); final VBox typeAttributes = new VBox(); final ToggleGroup flagToggleGroup = new ToggleGroup(); typeAttributes.getChildren() .add(this.createRadioButtonForType(null, "None (intermediate node)", flagToggleGroup)); typeAttributes.getChildren().add(this.createRadioButtonForType(Type.INITIAL, "Initial", flagToggleGroup)); final RadioButton successOption = this.createRadioButtonForType(Type.SUCCESS, "Success", flagToggleGroup); typeAttributes.getChildren().add(successOption); typeAttributes.getChildren().add(this.createRadioButtonForType(Type.FAILURE, "Failure", flagToggleGroup)); cf.addOption("Type", typeAttributes); final CheckBox waitCheckBox = new CheckBox("Active"); waitCheckBox.setSelected(this.wait); waitCheckBox.setOnAction(event -> { this.setWait(waitCheckBox.isSelected()); this.getGraph().handleChange(); }); cf.addOption("Wait", waitCheckBox); final int expressionInputLines = 1; final TextArea successCheckExpInput = new TextArea(this.successCheckExp); successCheckExpInput.setStyle("-fx-font-family: monospace"); successCheckExpInput.setPrefRowCount(expressionInputLines); successCheckExpInput.setWrapText(false); successCheckExpInput.textProperty() .addListener((ChangeListener<String>) (observable, oldValue, newValue) -> { this.setSuccessCheckExp(newValue); this.getGraph().handleChange(); }); successCheckExpInput.disableProperty().bind(successOption.selectedProperty().not()); cf.addOption("Script expression to verify if node is successful", successCheckExpInput); this.createEnterAndLeaveScriptConfig(cf); return cf; }
From source file:com.bdb.weather.display.preferences.ColorPreferencePanel.java
public ColorPreferencePanel() { VBox vbox = new VBox(); GridPane colorPanel = new GridPane(); for (ColorPreferenceEntry entry : entries2) { ColorPicker colorPicker = new ColorPicker(preferences.getColorPref(entry.preferenceName)); entry.button = colorPicker;// w w w . j av a2 s . com colorPanel.add(new Label(entry.preferenceName), 0, entry.row); colorPanel.add(colorPicker, 1, entry.row); } GridPane plotColorPanel = new GridPane(); int gridx = 0; int gridy = 0; // // Layout the column headers // for (int i = 0; i < COLOR_COL_HEADERS.length; i++) { gridx = i; plotColorPanel.add(new Label(COLOR_COL_HEADERS[i]), gridx, gridy); } // // Layout the row leaders // //c.anchor = GridBagConstraints.EAST; for (String header : COLOR_ROW_HEADERS) { gridx = 0; gridy++; plotColorPanel.add(new Label(header), gridx, gridy); gridx = 5; Set<String> names = ColorSchemeCollection.getColorSchemeNames(); ComboBox<String> scheme = new ComboBox<>(); scheme.getItems().addAll(names); scheme.setUserData(gridy); plotColorPanel.add(scheme, gridx, gridy); scheme.setOnAction((ActionEvent e) -> { ComboBox<String> cb = (ComboBox<String>) e.getSource(); applyColorScheme((Integer) cb.getUserData(), cb.getSelectionModel().getSelectedItem()); }); gridx = 6; CheckBox showSeries = new CheckBox(); showSeries.setUserData(gridy); plotColorPanel.add(showSeries, gridx, gridy); showSeries.setOnAction((ActionEvent e) -> { CheckBox cb = (CheckBox) e.getSource(); int row = (Integer) cb.getUserData(); for (ColorPreferenceEntry entry : entries) { if (entry.row == row) { addRemoveSeries(entry.preferenceName, cb.isSelected()); } } createSeriesData(); configureRenderer(); }); } //c.anchor = GridBagConstraints.CENTER; for (ColorPreferenceEntry entry : entries) { gridx = entry.column; gridy = entry.row; ColorPicker button = new ColorPicker(); button.setValue(preferences.getColorPref(entry.preferenceName)); //button.setPrefSize(10, 10); button.setUserData(entry); plotColorPanel.add(button, gridx, gridy); entry.button = button; } JFreeChart chart = ChartFactory.createXYLineChart("Example", "X Axis", "Y Axis", dataset, PlotOrientation.VERTICAL, true, false, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setRenderer(renderer); ChartViewer graphExamplePanel = new ChartViewer(chart); vbox.getChildren().addAll(colorPanel, plotColorPanel); setTop(vbox); setCenter(graphExamplePanel); FlowPane buttonPanel = new FlowPane(); Button button = new Button("OK"); button.setOnAction((ActionEvent e) -> { saveData(); }); buttonPanel.getChildren().add(button); setBottom(buttonPanel); }
From source file:io.bitsquare.gui.components.paymentmethods.OKPayForm.java
private void addCurrenciesGrid(boolean isEditable) { Label label = addLabel(gridPane, ++gridRow, "Supported currencies:", 0); GridPane.setValignment(label, VPos.TOP); FlowPane flowPane = new FlowPane(); flowPane.setPadding(new Insets(10, 10, 10, 10)); flowPane.setVgap(10);/*from w ww . j a v a2s . c o m*/ flowPane.setHgap(10); if (isEditable) flowPane.setId("flow-pane-checkboxes-bg"); else flowPane.setId("flow-pane-checkboxes-non-editable-bg"); CurrencyUtil.getAllOKPayCurrencies().stream().forEach(e -> { CheckBox checkBox = new CheckBox(e.getCode()); checkBox.setMouseTransparent(!isEditable); checkBox.setSelected(okPayAccount.getTradeCurrencies().contains(e)); checkBox.setMinWidth(60); checkBox.setMaxWidth(checkBox.getMinWidth()); checkBox.setTooltip(new Tooltip(e.getName())); checkBox.setOnAction(event -> { if (checkBox.isSelected()) okPayAccount.addCurrency(e); else okPayAccount.removeCurrency(e); updateAllInputsValid(); }); flowPane.getChildren().add(checkBox); }); GridPane.setRowIndex(flowPane, gridRow); GridPane.setColumnIndex(flowPane, 1); gridPane.getChildren().add(flowPane); }
From source file:io.bitsquare.gui.components.paymentmethods.SepaForm.java
private void addCountriesGrid(boolean isEditable, String title, List<CheckBox> checkBoxList, List<Country> dataProvider) { Label label = addLabel(gridPane, ++gridRow, title, 0); label.setWrapText(true);//from ww w . j a va2 s . c o m label.setMaxWidth(180); label.setTextAlignment(TextAlignment.RIGHT); GridPane.setHalignment(label, HPos.RIGHT); GridPane.setValignment(label, VPos.TOP); FlowPane flowPane = new FlowPane(); flowPane.setPadding(new Insets(10, 10, 10, 10)); flowPane.setVgap(10); flowPane.setHgap(10); flowPane.setMinHeight(55); if (isEditable) flowPane.setId("flow-pane-checkboxes-bg"); else flowPane.setId("flow-pane-checkboxes-non-editable-bg"); dataProvider.stream().forEach(country -> { final String countryCode = country.code; CheckBox checkBox = new CheckBox(countryCode); checkBox.setUserData(countryCode); checkBoxList.add(checkBox); checkBox.setMouseTransparent(!isEditable); checkBox.setMinWidth(45); checkBox.setMaxWidth(45); checkBox.setTooltip(new Tooltip(country.name)); checkBox.setOnAction(event -> { if (checkBox.isSelected()) sepaAccount.addAcceptedCountry(countryCode); else sepaAccount.removeAcceptedCountry(countryCode); updateAllInputsValid(); }); flowPane.getChildren().add(checkBox); }); updateCountriesSelection(isEditable, checkBoxList); GridPane.setRowIndex(flowPane, gridRow); GridPane.setColumnIndex(flowPane, 1); gridPane.getChildren().add(flowPane); }
From source file:de.pixida.logtest.designer.automaton.AutomatonEdge.java
private Node createCheckBoxInput(final String propertyName, final Boolean initialValue, final Consumer<Boolean> applyValue) { final CheckBox result = new CheckBox(propertyName); result.setSelected(BooleanUtils.isTrue(initialValue)); result.setOnAction(event -> { applyValue.accept(result.isSelected()); this.getGraph().handleChange(); });//from w ww .j a va 2 s . c o m return result; }
From source file:io.bitsquare.gui.main.overlays.Overlay.java
protected void addDontShowAgainCheckBox() { if (dontShowAgainId != null && preferences != null) { if (dontShowAgainText == null) dontShowAgainText = "Don't show again"; CheckBox dontShowAgainCheckBox = addCheckBox(gridPane, rowIndex, dontShowAgainText, buttonDistance - 1); GridPane.setColumnIndex(dontShowAgainCheckBox, 0); GridPane.setHalignment(dontShowAgainCheckBox, HPos.LEFT); dontShowAgainCheckBox.setOnAction( e -> preferences.dontShowAgain(dontShowAgainId, dontShowAgainCheckBox.isSelected())); }//from w w w .ja v a2s . co m }
From source file:condorclient.CreateJobDialogController.java
public void configAvailMachinesPane() { URL collector_url = null;/*from w w w. ja va 2 s . c o m*/ XMLHandler handler = new XMLHandler(); String collectorStr = handler.getURL("collector"); try { collector_url = new URL(collectorStr); } catch (MalformedURLException e3) { // TODO Auto-generated catch block e3.printStackTrace(); } ClassAd ad = null;//birdbath.ClassAd; ClassAdStructAttr[][] startdAdsArray = null; Collector c = null; try { c = new Collector(collector_url); } catch (ServiceException ex) { Logger.getLogger(CondorClient.class.getName()).log(Level.SEVERE, null, ex); } try { startdAdsArray = c.queryStartdAds("");//owner==\"lianxiang\" } catch (RemoteException ex) { Logger.getLogger(CondorClient.class.getName()).log(Level.SEVERE, null, ex); } String ip = null; String slotName = null; resourcesClassAds.clear(); map.clear(); for (ClassAdStructAttr[] x : startdAdsArray) { ad = new ClassAd(x); ip = ad.get("MyAddress"); String ipStr = ip.substring(ip.indexOf("<") + 1, ip.indexOf(":")); // System.out.println(ad.toString()); ObservableList<String> slotlist; slotlist = FXCollections.<String>observableArrayList(); slotName = ad.get("Name");// if (!map.containsKey(ipStr)) { map.put(ipStr, slotlist); } map.get(ipStr).add(slotName); //PublicClaimId } showBoxNum = map.size(); nodeNum = showBoxNum; selectedMachine = new int[nodeNum]; // vb=new VBox(); // machineBox.setSpacing(3); int i = 0; for (String s : map.keySet()) { CheckBox n = new CheckBox(); String boxId = "box" + i; n.setId(boxId); n.setText(s); slotNum = slotNum + map.get(s).size(); n.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { String s = event.getTarget().toString(); // System.out.println(s); String id = s.substring(s.indexOf("=box") + 4, s.indexOf(",")); System.out.println("boxid" + id); //String ip = s.substring(s.indexOf("]'") + 2, s.indexOf("'")); int intid = Integer.parseInt(id);//Integer.getInteger(id); // System.out.println(intid + "id" + id); // CheckBox sbox = (CheckBox) availMachines.getChildren().get(intid); CheckBox sbox = (CheckBox) machineBox.getChildren().get(intid); if (sbox.isSelected()) { selectedMachine[intid] = 1; // System.out.println(selectedMachine[intid]); apponitmap.putIfAbsent(sbox.getText().trim(), map.get(sbox.getText().trim()));//?ipslots appointslotNum = appointslotNum + map.get(sbox.getText().trim()).size();// System.out.println("machine id " + sbox.getText().trim() + "machine size" + map.get(sbox.getText().trim()).size()); } else { selectedMachine[intid] = 0; System.out.println("weixuanzhoong:" + selectedMachine[intid]); if (apponitmap.containsKey(sbox.getText())) { apponitmap.remove(sbox.getText()); } appointslotNum = appointslotNum - map.get(sbox.getText().trim()).size();// } otherError.setText(""); availCpuNumText.setText(""); availCpuNumText.setText("" + appointslotNum); availCpuNumText.setDisable(true); availNodeNumText.setText(""); availNodeNumText.setText("" + apponitmap.size()); availNodeNumText.setDisable(true); // System.out.println("apponitmap.size():" + apponitmap.size() + "apponitmap.values().size():" + apponitmap.values().size()); } }); //availMachines.getChildren().add(n); machineBox.getChildren().add(n); // boxContainer.getChildren().get(showBoxNum - 1).setVisible(true); i++; } // availMachines.getChildren().add(vb); }