Example usage for javafx.scene.text TextFlow getChildren

List of usage examples for javafx.scene.text TextFlow getChildren

Introduction

In this page you can find the example usage for javafx.scene.text TextFlow getChildren.

Prototype

@Override
public ObservableList<Node> getChildren() 

Source Link

Usage

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

private static void addRow4(final Pane content, final BookingBean be) {
    final HBox box = new HBox();
    box.setPadding(new Insets(4));
    box.setAlignment(Pos.CENTER_LEFT);/*from w ww  .  ja  va  2 s  . c o  m*/
    box.setFillHeight(true);
    final TextFlow tf = new TextFlow();
    final Text t0 = new Text("Net Earnings: \t");
    final Text netEarnings = new Text(String.format("%3.2f", be.getNetEarnings()));
    final Text t1 = new Text(" total \t");
    final Text netEarningsDay = new Text(String.format("%3.2f", be.getNetEarnings() / be.getNumberOfNights()));
    final Text t2 = new Text(" /night");
    tf.getChildren().addAll(t0, netEarnings, t1, netEarningsDay, t2);
    box.getChildren().addAll(tf);
    if (be.getNetEarnings() <= 0) {
        box.getStyleClass().addAll("warning", "warning-bg");
    }
    content.getChildren().add(box);

}

From source file:de.micromata.mgc.javafx.launcher.gui.AboutDialogController.java

@Override
public void initializeWithModel() {
    MgcApplicationInfo ai = model.getApplicationInfo();

    AnchorPane.setTopAnchor(aboutLogoPanel, 2.0);
    AnchorPane.setRightAnchor(aboutLogoPanel, 2.0);
    AnchorPane.setLeftAnchor(aboutLogoPanel, 2.0);
    AnchorPane.setTopAnchor(aboutLogoPanel, 2.0);
    AnchorPane.setRightAnchor(licensePanel, 2.0);
    AnchorPane.setLeftAnchor(licensePanel, 2.0);
    AnchorPane.setRightAnchor(licenceTextArea, 5.0);
    AnchorPane.setLeftAnchor(licenceTextArea, 2.0);
    //    AnchorPane.setTopAnchor(licensePanel, 100.0);
    //    AnchorPane.setBottomAnchor(configurationTabs, 5.0);
    AnchorPane.setRightAnchor(buttonPanel, 2.0);
    AnchorPane.setLeftAnchor(buttonPanel, 2.0);
    AnchorPane.setBottomAnchor(buttonPanel, 2.0);

    okButton.setOnAction(event -> getStage().close());

    String name = ai.getName() + " " + ai.getVersion();
    Text text1 = new Text(name);
    text1.setFont(Font.font("Verdana", FontWeight.BOLD, 20));
    Text text2 = new Text("\n\n" + ai.getCopyright() + "\n");
    TextFlow apptext = new TextFlow(text1, text2);
    appInfo.getChildren().add(apptext);/*from   w  w w  . j a v  a 2 s . c o  m*/

    if (ai.getLogoLargePath() != null) {
        logo.setImage(new Image(this.getClass().getResource(ai.getLogoLargePath()).toString()));
    }

    String sdetailText = ai.getDetailInfo();
    if (StringUtils.isNotBlank(ai.getLicense()) == true) {
        sdetailText += "\n\nLicense: " + ai.getLicense();
    }
    TextFlow detailText = new TextFlow();
    detailText.getChildren().add(new Text(sdetailText));

    if (StringUtils.isNotBlank(ai.getHomeUrl()) == true) {
        detailText.getChildren().add(new Text("\n\nHomepage: "));
        Hyperlink hlink = new Hyperlink(ai.getHomeUrl());
        hlink.setOnAction(event -> SystemService.get().openUrlInBrowser(ai.getHomeUrl()));
        detailText.getChildren().add(hlink);
    }
    appDetails.getChildren().add(detailText);
    initLicenseText();
}

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");
    }//from  w ww.  ja  va2s  .c o  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: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);// w  ww .  j  a v a  2s .co 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.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 -> {//  w  ww  .  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.playonlinux.javafx.mainwindow.console.ConsoleTab.java

public ConsoleTab(CommandLineInterpreterFactory commandLineInterpreterFactory) {
    final VBox content = new VBox();

    commandInterpreter = commandLineInterpreterFactory.createInstance();

    this.setText(translate("Console"));
    this.setContent(content);

    final TextField command = new TextField();
    command.getStyleClass().add("consoleCommandType");
    final TextFlow console = new TextFlow();
    final ScrollPane consolePane = new ScrollPane(console);
    content.getStyleClass().add("rightPane");

    consolePane.getStyleClass().add("console");
    consolePane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    content.getChildren().addAll(consolePane, command);

    command.requestFocus();/*from   www.jav  a2s  .  c om*/

    command.setOnKeyPressed(event -> {
        if (event.getCode() == KeyCode.ENTER) {
            final String commandToSend = command.getText();
            final int cursorPosition = command.getCaretPosition();
            command.setDisable(true);
            commandHistory.add(new CommandHistory.Item(commandToSend, cursorPosition));
            Text commandText = new Text(nextSymbol + commandToSend + "\n");
            commandText.getStyleClass().add("commandText");
            console.getChildren().add(commandText);
            command.setText("");

            if (commandInterpreter.sendLine(commandToSend, message -> {
                Platform.runLater(() -> {
                    if (!StringUtils.isBlank(message)) {
                        Text resultText = new Text(message);
                        resultText.getStyleClass().add("resultText");
                        console.getChildren().add(resultText);
                    }
                    command.setDisable(false);
                    command.requestFocus();
                    consolePane.setVvalue(consolePane.getVmax());
                });
            })) {
                nextSymbol = NOT_INSIDE_BLOCK;
            } else {
                nextSymbol = INSIDE_BLOCK;
            }
        }
    });

    command.setOnKeyReleased(event -> {
        if (event.getCode() == KeyCode.UP) {
            CommandHistory.Item historyItem = commandHistory.up();
            command.setText(historyItem.getCommand());
            command.positionCaret(historyItem.getCursorPosition());
        } else if (event.getCode() == KeyCode.DOWN) {
            CommandHistory.Item historyItem = commandHistory.down();
            command.setText(historyItem.getCommand());
            command.positionCaret(historyItem.getCursorPosition());
        }
    });

    this.setOnCloseRequest(event -> commandInterpreter.close());
}

From source file:mesclasses.view.JourneeController.java

/**
 * dessine la grid sanctions// w w  w.  j a  v  a  2 s  .  co  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(" "));
    }//from  www.  ja  va  2s. com

    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);
}