Example usage for javafx.scene.control CheckBox getText

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

Introduction

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

Prototype

public final String getText() 

Source Link

Usage

From source file:dpfmanager.shell.interfaces.gui.fragment.wizard.Wizard1Fragment.java

public void saveIsos(Configuration config) {
    config.getIsos().clear();/*  www.j a  va 2s . c o m*/
    for (CheckBox chk : getCheckBoxs()) {
        if (chk.isSelected()) {
            if (chk.getId().startsWith("external")) {
                // Path
                config.addISO(chk.getText());
            } else if (chk.getId().startsWith("config")) {
                // Config
                config.addISO(chk.getId().replace("config", ""));
            } else {
                // Internal
                config.addISO(chk.getId());
            }
        }
    }
}

From source file:dpfmanager.shell.interfaces.gui.fragment.wizard.Wizard1Fragment.java

private void addCheckBox(String id, String name, String path, boolean selected, boolean delete) {
    HBox hbox = new HBox();
    hbox.setAlignment(Pos.CENTER_LEFT);//w  ww.  j  a v  a 2  s. co  m

    CheckBox chk = new CheckBox(name);
    chk.setId(id);
    chk.getStyleClass().add("checkreport");
    chk.setSelected(selected);
    chk.setEllipsisString(" ... ");
    chk.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);
    chk.setTooltip(new Tooltip(path));
    hbox.getChildren().add(chk);

    // EDIT
    Button edit = new Button();
    edit.getStyleClass().addAll("edit-img", "action-img-16");
    edit.setCursor(Cursor.HAND);
    edit.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
            String iso = chk.getId();
            String path = null;
            if (iso.startsWith("external")) {
                iso = chk.getText();
                path = iso;
            } else if (chk.getId().startsWith("config")) {
                iso = chk.getId().replace("config", "");
                path = DPFManagerProperties.getIsosDir() + "/" + iso;
            }
            controller.editIso(iso, path);
        }
    });
    hbox.getChildren().add(edit);
    HBox.setMargin(edit, new Insets(0, 0, 0, 10));

    // DELETE
    if (delete) {
        Button icon = new Button();
        icon.getStyleClass().addAll("delete-img", "action-img-16");
        icon.setCursor(Cursor.HAND);
        icon.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                if (chk.getId().startsWith("external")) {
                    // Only from gui
                    vboxRadios.getChildren().remove(hbox);
                } else if (chk.getId().startsWith("config")) {
                    // From system
                    String name = chk.getId().replace("config", "");
                    File file = new File(DPFManagerProperties.getIsosDir() + "/" + name);
                    if (file.exists() && file.isFile() && acceptDelete(file)) {
                        file.delete();
                        vboxRadios.getChildren().remove(hbox);
                    }
                }
            }
        });
        hbox.getChildren().add(icon);
        HBox.setMargin(icon, new Insets(0, 0, 0, 10));
    }

    vboxRadios.getChildren().add(hbox);
}

From source file:condorclient.CreateJobDialogController.java

public void configAvailMachinesPane() {

    URL collector_url = null;/*w w w.  j a 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);

}

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  ww  w . java2s .c o  m*/
    }

    return pointClassificationsToDiscard;
}