List of usage examples for javafx.scene.text TextFlow managedProperty
public final BooleanProperty managedProperty()
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); }