List of usage examples for javafx.scene.text TextFlow TextFlow
public TextFlow()
From source file:com.github.drbookings.ui.controller.UpcomingController.java
private static void addCleaningSummary(final LocalDate date, final VBox box, final Collection<CleaningEntry> upcomingBookings) { final TextFlow tf = new TextFlow(); if (upcomingBookings.isEmpty()) { // final Text t0 = new Text("and no cleaning."); // tf.getChildren().add(t0); } else {// w w w. jav a2 s. c om final Text t0 = new Text("and "); final Text t1 = new Text(upcomingBookings.size() + " "); t1.getStyleClass().add("emphasis"); final Text t2 = new Text(" cleaning" + (upcomingBookings.size() > 1 ? "s." : ".")); t2.getStyleClass().add("emphasis"); tf.getChildren().addAll(t0, t1, t2); } box.getChildren().add(tf); }
From source file:com.github.drbookings.ui.controller.UpcomingController.java
private static void addGeneralSummary(final LocalDate date, final VBox box, final List<CheckInOutDetails> checkInNotes) { final Text t0 = new Text(getDateString(date)); final Text t1 = new Text(", there " + (checkInNotes.size() > 1 ? " are " : "is ")); t0.getStyleClass().add("emphasis"); final TextFlow tf = new TextFlow(); tf.getChildren().addAll(t0, t1);//w w w . j av a2s. c om box.getChildren().add(tf); }
From source file:com.github.drbookings.ui.controller.UpcomingController.java
private void addEvents(final LocalDate date, final Collection<BookingEntry> upcomingBookings, final Collection<CleaningEntry> upcomingCleanings) { final VBox box = new VBox(4); if (date.equals(LocalDate.now())) { box.getStyleClass().add("first-day"); } else if (date.equals(LocalDate.now().plusDays(1))) { box.getStyleClass().add("second-day"); } else if (date.isAfter(LocalDate.now().plusDays(1))) { box.getStyleClass().add("later"); }/* ww w. j a v a 2 s . co m*/ if (upcomingBookings.stream().filter(b -> b.isCheckIn() || b.isCheckOut()).collect(Collectors.toList()) .isEmpty() && upcomingCleanings.isEmpty()) { final Text t0 = new Text(getDateString(date)); final Text t1 = new Text(" there are no events."); t0.getStyleClass().add("emphasis"); final TextFlow tf = new TextFlow(); tf.getChildren().addAll(t0, t1); box.getChildren().addAll(tf); } else { final List<CheckInOutDetails> checkInNotes = Collections.synchronizedList(new ArrayList<>()); final List<CheckInOutDetails> checkOutNotes = Collections.synchronizedList(new ArrayList<>()); upcomingBookings.forEach(b -> { if (b.isCheckIn()) { String note = ""; if (b.getElement().getCheckInNote() != null) { note = b.getElement().getCheckInNote(); } if (b.getElement().getSpecialRequestNote() != null) { note = note + "\n" + b.getElement().getSpecialRequestNote(); } checkInNotes.add(new CheckInOutDetails(b.getRoom().getName(), b.getElement().getBookingOrigin().getName(), note)); } else if (b.isCheckOut()) { checkOutNotes.add(new CheckInOutDetails(b.getRoom().getName(), b.getElement().getBookingOrigin().getName(), b.getElement().getCheckOutNote())); } }); Collections.sort(checkInNotes); Collections.sort(checkOutNotes); addGeneralSummary(date, box, checkInNotes); addCheckOutSummary(date, box, checkOutNotes); addCheckOutNotes(date, box, checkOutNotes); addCheckInSummary(date, box, checkInNotes); addCheckInNotes(date, box, checkInNotes); addCleaningSummary(date, box, upcomingCleanings); addCleanings(date, box, upcomingCleanings); } this.box.getChildren().add(box); }
From source file:de.pixida.logtest.designer.testrun.TestRunEditor.java
public TitledPane createPanelForLaunchingTests() { final Button startBtn = new Button("Run Test"); startBtn.disableProperty().bind(this.testRunService.runningProperty()); final double startButtonPadding = 8d; startBtn.setPadding(new Insets(startButtonPadding)); startBtn.setGraphic(Icons.getIconGraphics("control_play_blue")); HBox.setHgrow(startBtn, Priority.ALWAYS); startBtn.setMaxWidth(Double.MAX_VALUE); startBtn.setOnAction(event -> {// ww w . j a v a 2 s . c o m final Job job = this.createJobFromConfig(); this.testRunService.setJob(job); this.testRunService.start(); }); final HBox startLine = new HBox(); startLine.getChildren().add(startBtn); final VBox runLines = new VBox(); final double linesSpacing = 10d; runLines.setSpacing(linesSpacing); final TextFlow resultBar = new TextFlow(); resultBar.backgroundProperty().bind(this.resultBarBackgroundProperty); this.resultBarBackgroundProperty.set(RESULT_BAR_BACKGROUND_IDLE); resultBar.setStyle("-fx-border-color: black; -fx-border-width:1"); final Text resultBarText = new Text(); resultBarText.textProperty().bind(this.resultBarTextProperty); this.resultBarTextProperty.set("Idle"); resultBar.getChildren().add(resultBarText); resultBar.setTextAlignment(TextAlignment.CENTER); final double resultBarPadding = 2d; resultBar.setPadding(new Insets(resultBarPadding)); final int logOutputLinesSize = 25; this.resultLogOutputText.setPrefRowCount(logOutputLinesSize); this.resultLogOutputText.setEditable(false); this.resultLogOutputText.setStyle("-fx-font-family: monospace"); HBox.setHgrow(this.resultLogOutputText, Priority.ALWAYS); runLines.getChildren().addAll(startLine, new Text("Recent results:"), resultBar, this.resultLogOutputText); final TitledPane runPane = new TitledPane("Run", runLines); runPane.setGraphic(Icons.getIconGraphics("lightning_go")); runPane.setCollapsible(false); return runPane; }
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);/* ww w.j a va2s . c om*/ 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:mesclasses.view.JourneeController.java
/** * dessine la grid sanctions/*from w ww . ja v a2s.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:org.pdfsam.ui.news.News.java
News(NewsData data) { this.getStyleClass().add("news-box"); TextFlow flow = new TextFlow(); if (data.isImportant()) { Text megaphone = GlyphsDude.createIcon(FontAwesomeIcon.BULLHORN, "1.2em"); megaphone.getStyleClass().clear(); megaphone.getStyleClass().add("news-box-title-important"); flow.getChildren().addAll(megaphone, new Text(" ")); }/* w w w.j a v a 2 s . c o m*/ Text titleText = new Text(data.getTitle() + System.lineSeparator()); titleText.setOnMouseClicked(e -> eventStudio().broadcast(new OpenUrlRequest(data.getLink()))); titleText.getStyleClass().add("news-box-title"); Text contentText = new Text(data.getContent()); contentText.setTextAlignment(TextAlignment.JUSTIFY); contentText.getStyleClass().add("news-content"); flow.getChildren().addAll(titleText, contentText); flow.setTextAlignment(TextAlignment.JUSTIFY); Label labelDate = new Label(FORMATTER.format(data.getDate()), GlyphsDude.createIcon(MaterialDesignIcon.CLOCK)); labelDate.setPrefWidth(Integer.MAX_VALUE); HBox.setHgrow(labelDate, Priority.ALWAYS); HBox bottom = new HBox(labelDate); bottom.setAlignment(Pos.CENTER_LEFT); bottom.getStyleClass().add("news-box-footer"); if (isNotBlank(data.getLink())) { Button link = UrlButton.urlButton(null, data.getLink(), FontAwesomeIcon.EXTERNAL_LINK_SQUARE, "pdfsam-toolbar-button"); bottom.getChildren().add(link); } getChildren().addAll(flow, bottom); }