Example usage for javafx.scene.control CheckBox CheckBox

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

Introduction

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

Prototype

public CheckBox() 

Source Link

Document

Creates a check box with an empty string for its label.

Usage

From source file:com.github.drbookings.ui.controller.BookingDetailsController.java

private void addRow5(final Pane content, final BookingBean be) {
    final HBox box = new HBox();
    box.setPadding(new Insets(4));
    box.setFillHeight(true);/*from   www . jav  a 2 s  . c o m*/
    final Text text = new Text("Welcome Mail sent: ");
    final CheckBox checkBox = new CheckBox();
    checkBox.setSelected(be.isWelcomeMailSend());
    booking2WelcomeMail.put(be, checkBox);
    final Text t1 = new Text(" \tPayment done: ");

    final CheckBox cb1 = new CheckBox();
    cb1.setSelected(be.isPaymentDone());

    //if (logger.isDebugEnabled()) {
    //   logger.debug("DateOfPayment for " + be + "(" + be.hashCode() + ") is " + be.getDateOfPayment());
    //}

    final DatePicker dp = new DatePicker();
    dp.setValue(be.getDateOfPayment());

    dp.setPrefWidth(140);
    booking2PaymentDate.put(be, dp);

    booking2Payment.put(be, cb1);
    final TextFlow tf = new TextFlow();
    tf.getChildren().addAll(text, checkBox, t1, cb1, dp);
    box.getChildren().add(tf);
    if (!be.isWelcomeMailSend() || !be.isPaymentDone()) {
        box.getStyleClass().addAll("warning", "warning-bg");
    } else {
        box.getStyleClass().removeAll("warning", "warning-bg");
    }

    HBox box2 = new HBox();
    box2.setPadding(new Insets(4));
    box2.setFillHeight(true);
    TextField newPayment = new TextField();
    Button addNewPaymentButton = new Button("Add payment");
    addNewPaymentButton.setOnAction(e -> {
        addNewPayment(newPayment.getText(), be);
    });
    box2.getChildren().addAll(newPayment, addNewPaymentButton);

    content.getChildren().addAll(box, box2);

}

From source file:de.pixida.logtest.designer.logreader.LogReaderEditor.java

private List<Triple<String, Node, String>> createConfigurationForm() {
    final List<Triple<String, Node, String>> formItems = new ArrayList<>();

    // Headline pattern
    final TextField textInput = new TextField(this.logReader.getHeadlinePattern());
    textInput.textProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> {
        this.logReader.setHeadlinePattern(newValue);
        this.setChanged(true);
    });//from w  w w  .  j ava2  s. co  m
    textInput.setStyle("-fx-font-family: monospace");
    formItems.add(Triple.of("Headline Pattern", textInput,
            "The perl style regular expression is used to spot the beginning of"
                    + " log entries in the log file. If a log entry consists of multiple lines, this pattern must only match the first"
                    + " line, called \"head line\". Groups can intentionally be matched to spot values like timestamp or channel name."
                    + " All matching groups are removed from the payload before they are processed by an automaton."));

    // Index of timestamp
    Supplier<Integer> getter = () -> this.logReader.getHeadlinePatternIndexOfTimestamp();
    Consumer<Integer> setter = value -> this.logReader.setHeadlinePatternIndexOfTimestamp(value);
    final TextField indexOfTimestampInput = this.createIntegerInputField(textInput, getter, setter);
    formItems.add(Triple.of("Timestamp Group", indexOfTimestampInput,
            "Denotes which matching group in the headline pattern contains"
                    + " the timestamp. Index 0 references the whole pattern match, index 1 is the first matching group etc. The timestamp must"
                    + " always be a valid integer. Currently, this integer is always interpreted as milliseconds. If no value is set, no"
                    + " timestamp will be extracted and timing conditions cannot be used. If the referenced matching group is optional"
                    + " and does not match for a specific head line, the last recent timestamp will be used for the extracted log entry."));

    // Index of channel
    getter = () -> this.logReader.getHeadlinePatternIndexOfChannel();
    setter = value -> this.logReader.setHeadlinePatternIndexOfChannel(value);
    final TextField indexOfChannelInput = this.createIntegerInputField(textInput, getter, setter);
    formItems.add(Triple.of("Channel Group", indexOfChannelInput,
            "Denotes which matching group in the headline pattern contains"
                    + " the channel. If the value is empty or the matching group is optional and it did not match, the default channel is used"
                    + " for the extracted log entry."));

    // Trim payload
    CheckBox cb = new CheckBox();
    cb.setSelected(this.logReader.getTrimPayload());
    cb.selectedProperty().addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> {
        this.logReader.setTrimPayload(BooleanUtils.toBoolean(newValue));
        this.setChanged(true);
    });
    formItems.add(Triple.of("Trim Payload", cb, "Only has effect on multiline payloads."
            + " If enabled, all leading and trailing whitespaces are removed from the payload"
            + " after the matching groups are removed. This allows for regular expressions in the automaton that match the beginning"
            + " and the end of the payload, without having to take care too much for whitespaces in the source log file."));

    // Handling of non headline lines
    this.createInputForHandlingOfNonHeadlineLines(formItems);

    // Trim payload
    cb = new CheckBox();
    cb.setSelected(this.logReader.getRemoveEmptyPayloadLinesFromMultilineEntry());
    cb.selectedProperty().addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> {
        this.logReader.setRemoveEmptyPayloadLinesFromMultilineEntry(BooleanUtils.toBoolean(newValue));
        this.setChanged(true);
    });
    formItems.add(Triple.of("Remove Empty Lines", cb,
            "If enabled, empty lines will be removed from multiline payload entries."));

    // Charset
    final SortedMap<String, Charset> charsets = Charset.availableCharsets();
    final ChoiceBox<String> encodingInput = new ChoiceBox<>(
            FXCollections.observableArrayList(charsets.keySet()));
    encodingInput.getSelectionModel().select(this.logReader.getLogFileCharset().name());
    encodingInput.getSelectionModel().selectedItemProperty()
            .addListener((ChangeListener<String>) (observable, oldValue, newValue) -> {
                this.logReader.setLogFileCharset(charsets.get(newValue));
                this.setChanged(true);
            });
    formItems.add(Triple.of("Log File Encoding", encodingInput,
            "Encoding of the log file. Note that some of the encodings are"
                    + " platform specific such that reading the log on a different platform might fail. Usually, log files are written"
                    + " using UTF-8, UTF-16, ISO-8859-1 or ASCII."));

    return formItems;
}

From source file:de.pixida.logtest.designer.testrun.TestRunEditor.java

private List<Triple<String, Node, String>> createConfigurationForm() {
    final List<Triple<String, Node, String>> formItems = new ArrayList<>();

    // Automaton file
    final TextField automatonFilePath = new TextField();
    this.automatonFilePathProperty.bind(automatonFilePath.textProperty());
    HBox.setHgrow(automatonFilePath, Priority.ALWAYS);
    final Button selectAutomatonFilePathButton = SelectFileButton.createButtonWithFileSelection(
            automatonFilePath, Editor.Type.AUTOMATON.getIconName(), "Select " + Editor.Type.AUTOMATON.getName(),
            Editor.Type.AUTOMATON.getFileMask(), Editor.Type.AUTOMATON.getFileDescription());
    final HBox automatonFilePathConfig = new HBox(automatonFilePath, selectAutomatonFilePathButton);
    formItems.add(Triple.of("Automaton", automatonFilePathConfig, null));

    // Automaton parameters
    final TextArea parametersInputText = new TextArea();
    parametersInputText.setStyle("-fx-font-family: monospace");
    HBox.setHgrow(parametersInputText, Priority.ALWAYS);
    final int parametersInputLinesSize = 4;
    parametersInputText.setPrefRowCount(parametersInputLinesSize);
    this.parametersProperty.bind(parametersInputText.textProperty());
    formItems.add(Triple.of("Parameters", parametersInputText,
            "Set parameters for the execution. Each line can contain a parameter as follows: ${PARAMETER}=value, e.g. ${TIMEOUT}=10."));

    // Log file//w ww . j  a va2 s . co m
    this.createLogFileSourceInputItems(formItems);

    // Log reader configuration file
    final TextField logReaderConfigurationFilePath = new TextField();
    this.logReaderConfigurationFilePathProperty.bind(logReaderConfigurationFilePath.textProperty());
    HBox.setHgrow(logReaderConfigurationFilePath, Priority.ALWAYS);
    final Button selectLogReaderConfigurationFilePathButton = SelectFileButton.createButtonWithFileSelection(
            logReaderConfigurationFilePath, Editor.Type.LOG_READER_CONFIG.getIconName(),
            "Select " + Editor.Type.LOG_READER_CONFIG.getName(), Editor.Type.LOG_READER_CONFIG.getFileMask(),
            Editor.Type.LOG_READER_CONFIG.getFileDescription());
    final HBox logReaderConfigurationFilePathConfig = new HBox(logReaderConfigurationFilePath,
            selectLogReaderConfigurationFilePathButton);
    formItems.add(Triple.of("Log Reader Configuration", logReaderConfigurationFilePathConfig, null));

    // Debug output
    final CheckBox cb = new CheckBox();
    this.showDebugOutputProperty.bind(cb.selectedProperty());
    formItems.add(Triple.of("Show Debug Output", cb,
            "Show verbose debug output. Might generate lots of text and slows down the"
                    + " evaluation, but is very helpful for debugging automatons while developing them."));

    return formItems;
}

From source file:mesclasses.view.JourneeController.java

/**
 * dessine la grid vie scolaire/*from  w  w w .  ja  va 2  s  .  c  o m*/
 * @param eleve
 * @param rowIndex 
 */
private void drawVieScolaire(Eleve eleve, int rowIndex) {
    EleveData eleveData = seanceSelect.getValue().getDonnees().get(eleve);
    drawEleveName(vieScolaireGrid, eleve, rowIndex);
    if (!eleve.isInClasse(currentDate.getValue())) {
        return;
    }
    CheckBox box = new CheckBox();
    Bindings.bindBidirectional(box.selectedProperty(), eleveData.absentProperty());
    vieScolaireGrid.add(box, 3, rowIndex, null);

    TextField retardField = new TextField();
    retardField.setMaxWidth(50);
    Bindings.bindBidirectional(retardField.textProperty(), eleveData.retardProperty(),
            new IntegerOnlyConverter());
    markAsInteger(retardField);

    vieScolaireGrid.add(retardField, 4, rowIndex, HPos.CENTER);

    Label cumulRetard = new Label();
    retardField.textProperty().addListener((observable, oldValue, newValue) -> {
        writeAndMarkInRed(cumulRetard, stats.getNbRetardsUntil(eleve, currentDate.getValue()), 3);
    });

    writeAndMarkInRed(cumulRetard, stats.getNbRetardsUntil(eleve, currentDate.getValue()), 3);
    vieScolaireGrid.add(cumulRetard, 5, rowIndex, null);
}

From source file:mesclasses.view.JourneeController.java

/**
 * dessine la grid travail/*from w w  w  .  j a va2  s  .co  m*/
 * @param eleve
 * @param rowIndex 
 */
private void drawTravail(Eleve eleve, int rowIndex) {

    EleveData eleveData = seanceSelect.getValue().getDonnees().get(eleve);
    drawEleveName(travailGrid, eleve, rowIndex);
    if (!eleve.isInClasse(currentDate.getValue())) {
        return;
    }
    CheckBox travailBox = new CheckBox();
    Bindings.bindBidirectional(travailBox.selectedProperty(), eleveData.travailPasFaitProperty());
    travailGrid.add(travailBox, 3, rowIndex, null);
    Label cumulTravail = new Label();
    travailBox.selectedProperty().addListener((observable, oldValue, newValue) -> {
        writeAndMarkInRed(cumulTravail, stats.getNbTravailUntil(eleve, currentDate.getValue()), 3);
    });
    writeAndMarkInRed(cumulTravail, stats.getNbTravailUntil(eleve, currentDate.getValue()), 3);
    travailGrid.add(cumulTravail, 4, rowIndex, null);

    CheckBox devoirBox = new CheckBox();
    devoirBox.setSelected(model.getDevoirForSeance(eleve, seanceSelect.getValue()) != null);
    devoirBox.selectedProperty().addListener((ob, o, checked) -> {
        Devoir devoir = model.getDevoirForSeance(eleve, seanceSelect.getValue());
        if (checked && devoir == null) {
            model.createDevoir(eleve, seanceSelect.getValue());
        } else if (devoir != null) {
            model.delete(devoir);
        }
    });
    travailGrid.add(devoirBox, 5, rowIndex, null);

    TextField oubliMaterielField = new TextField();
    Bindings.bindBidirectional(oubliMaterielField.textProperty(), eleveData.oubliMaterielProperty());
    travailGrid.add(oubliMaterielField, 6, rowIndex, HPos.LEFT);
    Label cumulOubli = new Label();
    oubliMaterielField.textProperty().addListener((observable, oldValue, newValue) -> {
        writeAndMarkInRed(cumulOubli, stats.getNbOublisUntil(eleve, currentDate.getValue()), 3);
    });

    writeAndMarkInRed(cumulOubli, stats.getNbOublisUntil(eleve, currentDate.getValue()), 3);
    travailGrid.add(cumulOubli, 7, rowIndex, null);

}

From source file:io.bitsquare.gui.main.funds.withdrawal.WithdrawalView.java

private void setSelectColumnCellFactory() {
    selectColumn/*  w  w  w  .  j  a v  a  2s  . co m*/
            .setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
    selectColumn.setCellFactory(
            new Callback<TableColumn<WithdrawalListItem, WithdrawalListItem>, TableCell<WithdrawalListItem, WithdrawalListItem>>() {

                @Override
                public TableCell<WithdrawalListItem, WithdrawalListItem> call(
                        TableColumn<WithdrawalListItem, WithdrawalListItem> column) {
                    return new TableCell<WithdrawalListItem, WithdrawalListItem>() {

                        CheckBox checkBox;

                        @Override
                        public void updateItem(final WithdrawalListItem item, boolean empty) {
                            super.updateItem(item, empty);
                            if (item != null && !empty) {
                                if (checkBox == null) {
                                    checkBox = new CheckBox();
                                    checkBox.setOnAction(e -> selectForWithdrawal(item, checkBox.isSelected()));
                                    setGraphic(checkBox);
                                }
                            } else {
                                setGraphic(null);
                                if (checkBox != null) {
                                    checkBox.setOnAction(null);
                                    checkBox = null;
                                }
                            }
                        }
                    };
                }
            });
}

From source file:mesclasses.view.JourneeController.java

/**
 * dessine la grid sanctions/*  ww  w  .ja va 2 s .c o  m*/
 * @param eleve
 * @param rowIndex 
 */
private void drawSanctions(Eleve eleve, int rowIndex) {
    EleveData eleveData = seanceSelect.getValue().getDonnees().get(eleve);

    drawEleveName(sanctionsGrid, eleve, rowIndex);
    if (!eleve.isInClasse(currentDate.getValue())) {
        return;
    }
    HBox punitionsBox = new HBox();
    punitionsBox.setAlignment(Pos.CENTER_LEFT);
    TextFlow nbPunitions = new TextFlow();
    Label nbPunitionLabel = new Label(
            "" + eleve.getPunitions().stream().filter(p -> p.getSeance() == seanceSelect.getValue()).count());
    nbPunitionLabel.setPrefHeight(20);
    nbPunitions.getChildren().add(new Label(" ("));
    nbPunitions.getChildren().add(nbPunitionLabel);
    nbPunitions.getChildren().add(new Label(")"));

    nbPunitions.visibleProperty().bind(nbPunitionLabel.textProperty().isNotEqualTo("0"));
    nbPunitions.managedProperty().bind(nbPunitionLabel.textProperty().isNotEqualTo("0"));

    Button punitionBtn = Btns.punitionBtn();
    punitionBtn.setOnAction((event) -> {
        if (openPunitionDialog(eleve)) {
            int nbPunition = Integer.parseInt(nbPunitionLabel.getText());
            nbPunitionLabel.setText("" + (nbPunition + 1));
        }
    });
    punitionsBox.getChildren().add(punitionBtn);
    punitionsBox.getChildren().add(nbPunitions);

    sanctionsGrid.add(punitionsBox, 3, rowIndex, HPos.LEFT);

    CheckBox motCarnet = new CheckBox();
    Label cumulMot = new Label();
    motCarnet.setSelected(model.getMotForSeance(eleve, seanceSelect.getValue()) != null);
    motCarnet.selectedProperty().addListener((ob, o, checked) -> {
        Mot mot = model.getMotForSeance(eleve, seanceSelect.getValue());
        if (checked && mot == null) {
            model.createMot(eleve, seanceSelect.getValue());
        } else if (mot != null) {
            model.delete(mot);
        }
        writeAndMarkInRed(cumulMot, stats.getMotsUntil(eleve, currentDate.getValue()).size(), 3);
    });
    sanctionsGrid.add(motCarnet, 4, rowIndex, null);
    writeAndMarkInRed(cumulMot, stats.getMotsUntil(eleve, currentDate.getValue()).size(), 3);
    sanctionsGrid.add(cumulMot, 5, rowIndex, null);

    CheckBox exclus = new CheckBox();
    TextField motif = new TextField();
    Bindings.bindBidirectional(exclus.selectedProperty(), eleveData.exclusProperty());
    sanctionsGrid.add(exclus, 6, rowIndex, null);
    exclus.selectedProperty().addListener((o, oldV, newV) -> {
        if (!newV && StringUtils.isNotBlank(motif.getText())
                && ModalUtil.confirm("Effacer le motif ?", "Effacer le motif ?")) {
            motif.clear();
        }
    });

    Bindings.bindBidirectional(motif.textProperty(), eleveData.MotifProperty());
    motif.textProperty().addListener((o, oldV, newV) -> {
        if (StringUtils.isNotBlank(newV)) {
            exclus.setSelected(true);
        }
    });
    GridPane.setMargin(motif, new Insets(0, 10, 0, 0));
    sanctionsGrid.add(motif, 7, rowIndex, HPos.LEFT);

}

From source file:condorclient.CreateJobDialogController.java

public void configAvailMachinesPane() {

    URL collector_url = null;/*w  ww .  jav a2  s  .  com*/
    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);

}