Example usage for javafx.scene.control CheckBox selectedProperty

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

Introduction

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

Prototype

public final BooleanProperty selectedProperty() 

Source Link

Usage

From source file:ninja.javafx.smartcsv.fx.validation.ValidationEditorController.java

private void addDependencyListener(CheckBox rule, CheckBox... dependentRules) {
    rule.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue) {
            for (CheckBox dependentRule : dependentRules) {
                dependentRule.selectedProperty().setValue(false);
            }/* www . j av  a 2s  .co m*/
        }
    });
}

From source file:ninja.javafx.smartcsv.fx.validation.ValidationEditorController.java

private void initSpinner(Spinner rule, CheckBox ruleEnabled) {
    rule.disableProperty().bind(ruleEnabled.selectedProperty().not());
    ruleEnabled.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (!newValue) {
            rule.getValueFactory().setValue(0);
        }//from w w w.  ja  v  a  2  s  . c  o  m
    });
}

From source file:ninja.javafx.smartcsv.fx.validation.ValidationEditorController.java

private void initTextInputControl(TextInputControl rule, CheckBox ruleEnabled) {
    rule.disableProperty().bind(ruleEnabled.selectedProperty().not());
    ruleEnabled.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (!newValue) {
            rule.setText("");
        }//from  w  ww .j  a va2s .c om
    });
}

From source file:ninja.javafx.smartcsv.fx.validation.ValidationEditorController.java

private void initCodeAreaControl(CodeArea rule, CheckBox ruleEnabled) {
    rule.disableProperty().bind(ruleEnabled.selectedProperty().not());
    ruleEnabled.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (!newValue) {
            rule.clear();//from w ww.j a  v  a2  s . c  o m
        }
    });
    rule.setParagraphGraphicFactory(LineNumberFactory.get(rule));
    rule.richChanges().filter(ch -> !ch.getInserted().equals(ch.getRemoved())) // XXX
            .subscribe(change -> {
                rule.setStyleSpans(0, computeHighlighting(rule.getText()));
            });
}

From source file:de.rkl.tools.tzconv.TimezoneConverter.java

private Node createTemplateCheckbox() {
    final CheckBox templateCheckBox = new CheckBox("Use text template");
    templateCheckBox.setSelected(applicationModel.templateFile.getValue() != null);
    applicationModel.templateFile.addListener((observable, oldValue, newValue) -> {
        templateCheckBox.setSelected(newValue != null);
    });/*from ww w  .  j a v  a  2 s  . co m*/
    templateCheckBox.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (oldValue)
            applicationModel.templateFile.set(null);
    });
    return templateCheckBox;
}

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/*from   w  ww . j  a  v  a  2  s . c o 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: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);
    });/*  w w w.  j a v  a 2 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:mesclasses.view.JourneeController.java

/**
 * dessine la grid vie scolaire//w  w  w.jav  a2  s. c om
 * @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 av  a 2  s  . c o 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:mesclasses.view.JourneeController.java

/**
 * dessine la grid sanctions/*from   w w  w. j  a  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);

}