Example usage for javafx.scene.control CheckBox getId

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

Introduction

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

Prototype

public final String getId() 

Source Link

Document

The id of this Node .

Usage

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

private CheckBox getCheckById(String id) {
    for (CheckBox chk : getCheckBoxs()) {
        if (chk.getId().equals(id)) {
            return chk;
        }//ww w  . j a  v  a2s .co  m
    }
    return null;
}

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

public void saveIsos(Configuration config) {
    config.getIsos().clear();/*  w  w w .  j av  a  2  s.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

public void clear() {
    List<HBox> toDelete = new ArrayList<>();
    for (Node node : vboxRadios.getChildren()) {
        HBox hbox = (HBox) node;/*from  w  w w  . j ava  2 s.c  o m*/
        boolean delete = false;
        for (Node hNode : hbox.getChildren()) {
            if (hNode instanceof CheckBox) {
                CheckBox chk = (CheckBox) hNode;
                chk.setSelected(false);
                delete = chk.getId().startsWith("external");
            }
        }
        if (delete) {
            toDelete.add(hbox);
        }
    }
    vboxRadios.getChildren().removeAll(toDelete);
}

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);/*from  w w  w . j av a  2  s.  c o  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);
}