Example usage for javafx.scene.control CheckBox isSelected

List of usage examples for javafx.scene.control CheckBox isSelected

Introduction

In this page you can find the example usage for javafx.scene.control CheckBox isSelected.

Prototype

public final boolean isSelected() 

Source Link

Usage

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);/*from ww w . java2  s. 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: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);/*w  w w  .j  a  v a 2s. co 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   www.  j a v a2s  .co 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 -> {//from   w  w w.  j  av  a 2 s.  c  o m
        applyValue.accept(result.isSelected());
        this.getGraph().handleChange();
    });
    return result;
}

From source file:de.perdoctus.ebikeconnect.gui.dialogs.LoginDialog.java

@PostConstruct
public void init() {
    final ImageView graphic = new ImageView(
            new Image(getClass().getResource("/app-icon.png").toExternalForm()));
    graphic.setPreserveRatio(true);/*from  w  ww .  j a  va  2 s .c  o m*/
    graphic.setFitHeight(64);
    setGraphic(graphic);
    setResizable(true);
    setWidth(400);
    setResizable(false);

    setTitle(rb.getString("dialogTitle"));
    setHeaderText(rb.getString("dialogMessage"));

    final ButtonType loginButtonType = new ButtonType(rb.getString("loginButton"),
            ButtonBar.ButtonData.OK_DONE);
    getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);

    // Create the username and password labels and fields.
    final GridPane grid = new GridPane();
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(20, 10, 10, 10));
    grid.setPrefWidth(getWidth());
    grid.getColumnConstraints().add(new ColumnConstraints(-1, -1, -1, Priority.NEVER, HPos.LEFT, true));
    grid.getColumnConstraints().add(new ColumnConstraints(-1, -1, -1, Priority.ALWAYS, HPos.LEFT, true));

    final String rbUsername = rb.getString(CFG_USERNAME);
    final TextField txtUsername = new TextField();
    txtUsername.setPromptText(rbUsername);
    txtUsername.setText(config.getString(CFG_USERNAME, ""));

    final Label lblUsername = new Label(rbUsername);
    lblUsername.setLabelFor(txtUsername);
    grid.add(lblUsername, 0, 0);
    grid.add(txtUsername, 1, 0);

    final String rbPassword = rb.getString(CFG_PASSWORD);
    final PasswordField txtPassword = new PasswordField();
    txtPassword.setPromptText(rbPassword);
    if (config.getBoolean(CFG_SAVE_PASSWORD, false)) {
        txtPassword.setText(config.getString(CFG_PASSWORD, ""));
    }

    final Label lblPassword = new Label(rbPassword);
    lblPassword.setLabelFor(txtPassword);
    grid.add(lblPassword, 0, 1);
    grid.add(txtPassword, 1, 1);

    final CheckBox cbSavePassword = new CheckBox(rb.getString("save-password"));
    cbSavePassword.setSelected(config.getBoolean(CFG_SAVE_PASSWORD, false));
    grid.add(cbSavePassword, 1, 2);

    getDialogPane().setContent(grid);

    // Enable/Disable login button depending on whether a username was entered.
    final Node loginButton = getDialogPane().lookupButton(loginButtonType);
    loginButton.disableProperty()
            .bind(txtUsername.textProperty().isEmpty().or(txtPassword.textProperty().isEmpty()));

    setResultConverter(buttonType -> {
        if (buttonType == loginButtonType) {
            config.setProperty(CFG_USERNAME, txtUsername.getText());
            config.setProperty(CFG_SAVE_PASSWORD, cbSavePassword.isSelected());
            if (cbSavePassword.isSelected()) {
                config.setProperty(CFG_PASSWORD, txtPassword.getText());
                config.setProperty(CFG_PASSWORD, txtPassword.getText());
            } else {
                config.clearProperty(CFG_PASSWORD);
            }
            return new Credentials(txtUsername.getText(), txtPassword.getText());
        } else {
            return null;
        }
    });

    if (txtUsername.getText().isEmpty()) {
        txtUsername.requestFocus();
    } else {
        txtPassword.requestFocus();
        txtPassword.selectAll();
    }
}

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()));
    }// ww w  . j a  v  a 2s  .  c  o  m
}

From source file:condorclient.CreateJobDialogController.java

public void configAvailMachinesPane() {

    URL collector_url = null;/*from  ww w . java2 s.c om*/
    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);

}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 *///w ww.  ja v  a 2  s. c  o m
private void valideHS() {

    for (int i = 0; i < panoramiquesProjet[panoActuel].getNombreHotspots(); i++) {
        ComboBox cbx = (ComboBox) outils.lookup("#cbpano" + i);
        TextArea txtTexteHS = (TextArea) outils.lookup("#txtHS" + i);
        if (txtTexteHS != null) {
            panoramiquesProjet[panoActuel].getHotspot(i).setInfo(txtTexteHS.getText());
        }
        if (cbx != null) {
            panoramiquesProjet[panoActuel].getHotspot(i).setFichierXML(cbx.getValue() + ".xml");
        }
        CheckBox cbAnime = (CheckBox) outils.lookup("#anime" + i);
        if (cbAnime != null) {
            if (cbAnime.isSelected()) {
                panoramiquesProjet[panoActuel].getHotspot(i).setAnime(true);
            } else {
                panoramiquesProjet[panoActuel].getHotspot(i).setAnime(false);
            }
        }
    }
    for (int i = 0; i < panoramiquesProjet[panoActuel].getNombreHotspotImage(); i++) {
        TextArea txtTexteHS = (TextArea) outils.lookup("#txtHSImage" + i);
        if (txtTexteHS != null) {
            panoramiquesProjet[panoActuel].getHotspotImage(i).setInfo(txtTexteHS.getText());
        }
        CheckBox cbAnime = (CheckBox) outils.lookup("#animeImage" + i);
        if (cbAnime != null) {
            if (cbAnime.isSelected()) {
                panoramiquesProjet[panoActuel].getHotspotImage(i).setAnime(true);
            } else {
                panoramiquesProjet[panoActuel].getHotspotImage(i).setAnime(false);
            }
        }
    }

}

From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java

private List<Integer> getListOfClassificationPointToDiscard() {

    List<Integer> pointClassificationsToDiscard = new ArrayList<>();
    List<CheckBox> classifications = listviewClassifications.getItems();

    for (CheckBox checkBox : classifications) {
        if (!checkBox.isSelected()) {

            String s = checkBox.getText().substring(0, checkBox.getText().indexOf("-") - 1);
            pointClassificationsToDiscard.add(Integer.valueOf(s));
        }//from  www  .j  a v  a  2s.  c  o  m
    }

    return pointClassificationsToDiscard;
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 *//*from  w  w  w . j a v  a2 s. com*/
private static void valideHS() {

    for (int i = 0; i < getPanoramiquesProjet()[getiPanoActuel()].getNombreHotspots(); i++) {
        ComboBox cbPanos = (ComboBox) vbOutils.lookup("#cbpano" + i);
        TextField tfTexteHS = (TextField) vbOutils.lookup("#txtHS" + i);
        if (tfTexteHS != null) {
            getPanoramiquesProjet()[getiPanoActuel()].getHotspot(i).setStrInfo(tfTexteHS.getText());
        }
        if (cbPanos != null) {
            getPanoramiquesProjet()[getiPanoActuel()].getHotspot(i)
                    .setStrFichierXML(cbPanos.getValue() + ".xml");
            getPanoramiquesProjet()[getiPanoActuel()].getHotspot(i)
                    .setNumeroPano(cbPanos.getSelectionModel().getSelectedIndex());
        }
        CheckBox cbAnime = (CheckBox) vbOutils.lookup("#anime" + i);
        if (cbAnime != null) {
            getPanoramiquesProjet()[getiPanoActuel()].getHotspot(i).setAnime(cbAnime.isSelected());
        }
    }
    for (int i = 0; i < getPanoramiquesProjet()[getiPanoActuel()].getNombreHotspotImage(); i++) {
        TextField tfTexteHS = (TextField) vbOutils.lookup("#txtHSImage" + i);
        if (tfTexteHS != null) {
            getPanoramiquesProjet()[getiPanoActuel()].getHotspotImage(i).setStrInfo(tfTexteHS.getText());
        }
        CheckBox cbAnime = (CheckBox) vbOutils.lookup("#animeImage" + i);
        if (cbAnime != null) {
            getPanoramiquesProjet()[getiPanoActuel()].getHotspotImage(i).setAnime(cbAnime.isSelected());
        }
    }
    for (int i = 0; i < getPanoramiquesProjet()[getiPanoActuel()].getNombreHotspotHTML(); i++) {
        TextField tfTexteHS = (TextField) vbOutils.lookup("#txtHSHTML" + i);
        if (tfTexteHS != null) {
            getPanoramiquesProjet()[getiPanoActuel()].getHotspotHTML(i).setStrInfo(tfTexteHS.getText());
        }
        CheckBox cbAnime = (CheckBox) vbOutils.lookup("#animeHTML" + i);
        if (cbAnime != null) {
            getPanoramiquesProjet()[getiPanoActuel()].getHotspotHTML(i).setAnime(cbAnime.isSelected());
        }
    }
    for (int i = 0; i < getPanoramiquesProjet()[getiPanoActuel()].getiNombreHotspotDiapo(); i++) {
        TextField tfTexteHS = (TextField) vbOutils.lookup("#txtDIA" + i);
        if (tfTexteHS != null) {
            getPanoramiquesProjet()[getiPanoActuel()].getHotspotDiapo(i).setStrInfo(tfTexteHS.getText());
        }
        CheckBox cbAnime = (CheckBox) vbOutils.lookup("#animeDIA" + i);
        if (cbAnime != null) {
            getPanoramiquesProjet()[getiPanoActuel()].getHotspotDiapo(i).setbAnime(cbAnime.isSelected());
        }
    }

}