List of usage examples for javafx.scene.text TextFlow TextFlow
public TextFlow()
From source file:com.github.drbookings.LocalDates.java
public static TextFlow getDateText(final LocalDate date) { final TextFlow tf = new TextFlow(); final Text t0 = new Text(getDateString(date)); tf.getChildren().addAll(t0);/* ww w .j a v a 2 s .c om*/ return tf; }
From source file:com.github.drbookings.ui.controller.UpcomingController.java
private static void addCheckInNotes(final LocalDate date, final VBox box, final List<CheckInOutDetails> checkInNotes) { if (checkInNotes.size() > 0) { for (final CheckInOutDetails next : checkInNotes) { final TextFlow tf = new TextFlow(); final Text t0 = new Text("Room " + next.room); t0.getStyleClass().add("emphasis"); final Text t1 = new Text(" (" + next.bookingOrigin + ")"); tf.getChildren().addAll(t0, t1); if (!StringUtils.isBlank(next.notes)) { final Text t2 = new Text(": " + next.notes); t2.getStyleClass().add("guest-message"); tf.getChildren().add(t2); }//from ww w. j a va2 s .c o m box.getChildren().add(tf); } box.getChildren().add(new Separator()); } }
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 w w w . j a v 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:com.github.drbookings.LocalDates.java
public static TextFlow getYearText(final LocalDate date) { final TextFlow tf = new TextFlow(); final Text t0 = new Text(getYearString(date)); t0.getStyleClass().add("center-text"); tf.getChildren().addAll(t0);/*from ww w . java 2s . c o m*/ return tf; }
From source file:com.github.drbookings.ui.controller.UpcomingController.java
private static void addCheckInSummary(final LocalDate date, final VBox box, final List<CheckInOutDetails> checkInNotes) { final TextFlow tf = new TextFlow(); if (checkInNotes.size() > 0) { final Text t1 = new Text(checkInNotes.size() + " "); t1.getStyleClass().add("emphasis"); t1.getStyleClass().add("copyable-label"); final Text t2; if (checkInNotes.size() > 1) { t2 = new Text("check-ins,"); } else {//from ww w. j a v a 2 s .com t2 = new Text("check-in,"); } t2.getStyleClass().add("emphasis"); tf.getStyleClass().add("copyable-label"); tf.getChildren().addAll(t1, t2); } if (checkInNotes.isEmpty()) { // tf.getChildren().add(new Text("no check-ins,")); } box.getChildren().add(tf); }
From source file:com.github.drbookings.ui.controller.BookingDetailsController.java
private static void addDates(final HBox content, final BookingBean be) { final TextFlow checkIn = LocalDates.getDateText(be.getCheckIn()); final TextFlow checkOut = LocalDates.getDateText(be.getCheckOut()); final TextFlow year = LocalDates.getYearText(be.getCheckOut()); final TextFlow tf = new TextFlow(); tf.getChildren().addAll(checkIn, new Text("\n"), checkOut, new Text("\n"), year); // tf.getChildren().addAll(checkIn, new Text(" "), checkOut); // HBox.setHgrow(tf, Priority.SOMETIMES); content.getChildren().add(tf);/*from www . j ava 2 s . c om*/ }
From source file:com.github.drbookings.ui.controller.UpcomingController.java
private static void addCheckOutNotes(final LocalDate date, final VBox box, final List<CheckInOutDetails> checkOutNotes) { if (checkOutNotes.size() > 0) { for (final CheckInOutDetails next : checkOutNotes) { final TextFlow tf = new TextFlow(); final Text t0 = new Text("Room " + next.room); t0.getStyleClass().add("emphasis"); final Text t1 = new Text(" (" + next.bookingOrigin + ")"); tf.getChildren().addAll(t0, t1); if (!StringUtils.isBlank(next.notes)) { final Text t2 = new Text(": " + next.notes); t2.getStyleClass().add("guest-message"); tf.getChildren().add(t2); }//from w w w .j a va2 s .co m box.getChildren().add(tf); } box.getChildren().add(new Separator()); } }
From source file:com.github.drbookings.ui.controller.UpcomingController.java
private static void addCheckOutSummary(final LocalDate date, final VBox box, final List<CheckInOutDetails> checkOutNotes) { final TextFlow tf = new TextFlow(); if (checkOutNotes.size() > 0) { final Text t0; t0 = new Text(""); final Text t1 = new Text(checkOutNotes.size() + " "); t1.getStyleClass().add("emphasis"); final Text t2; if (checkOutNotes.size() > 1) { t2 = new Text("check-outs,"); } else {/*from ww w.jav a2 s .c o m*/ t2 = new Text("check-out,"); } t2.getStyleClass().add("emphasis"); tf.getChildren().addAll(t0, t1, t2); } if (checkOutNotes.isEmpty()) { // tf.getChildren().add(new Text("no check-outs,")); } box.getChildren().add(tf); }
From source file:com.github.drbookings.ui.controller.UpcomingController.java
private static void addCleanings(final LocalDate date, final VBox box, final Collection<CleaningEntry> upcomingBookings) { for (final CleaningEntry c : upcomingBookings) { final TextFlow tf = new TextFlow(); final Text t0 = new Text("Room " + c.getRoom() + ": "); t0.getStyleClass().add("emphasis"); final Text t1 = new Text(c.getName()); tf.getChildren().addAll(t0, t1); box.getChildren().add(tf);// ww w . jav a 2 s . c o m } }
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 w w . j a va 2s. c om 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); }