List of usage examples for javafx.scene.text Text Text
public Text(String text)
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 {//www .j a v a 2 s . co 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.cooksys.postmaster.PostmasterModelSingleton.java
public static PostmasterModelSingleton getInstance() { if (_instance == null) { try {/* ww w .j av a2 s .c o m*/ //see if we can read the object from the file first FileInputStream fileInputStream = new FileInputStream(POSTMASTER_DATA_FILE); ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream); _instance = (PostmasterModelSingleton) objectInputStream.readObject(); //fill in transient variables from their serializable counterparts _instance.createTransientPropertyInstances(); for (ParsedHttpRequest request : _instance.requestList) { _instance.incomingMessagesList.add(request.getRequestLine()); } int index = 0; for (ParsedHttpResponse response : _instance.responseList) { Text defaultResponseText = new Text(response.getName()); if (index == _instance.defaultResponseIndex) { defaultResponseText.setFont(Font.font(null, FontWeight.BOLD, 12)); } _instance.savedResponsesList.add(defaultResponseText); index++; } _instance.messageConsole.set(_instance.messageConsoleSerializable); } catch (FileNotFoundException ex) { //File does not exist, so create a new instance _instance = new PostmasterModelSingleton(); } catch (IOException | ClassNotFoundException ex) { //for these exceptions, just create a new instance Logger.getLogger(PostmasterModelSingleton.class.getName()).log(Level.SEVERE, null, ex); _instance = new PostmasterModelSingleton(); } } return _instance; }
From source file:de.pixida.logtest.designer.logreader.LogReaderEditor.java
public LogReaderEditor(final IMainWindow mainWindow) { super(Editor.Type.LOG_READER_CONFIG, mainWindow); this.parsedLogEntries = new TableView<>(this.parsedLogEntryItems); this.parsedLogEntries.setPlaceholder(new Text("No log entries to display.")); final TableColumn<LogEntryTableRow, String> lineNoCol = new TableColumn<LogEntryTableRow, String>("LineNo"); lineNoCol.setCellValueFactory(new PropertyValueFactory<>("lineNumber")); lineNoCol.setSortable(false);/* w w w . jav a 2s .c om*/ lineNoCol.setGraphic(Icons.getIconGraphics("key")); final TableColumn<LogEntryTableRow, String> timeCol = new TableColumn<LogEntryTableRow, String>("Time"); timeCol.setCellValueFactory(new PropertyValueFactory<>("time")); timeCol.setSortable(false); timeCol.setGraphic(Icons.getIconGraphics("clock")); final TableColumn<LogEntryTableRow, String> channelCol = new TableColumn<LogEntryTableRow, String>( "Channel"); channelCol.setCellValueFactory(new PropertyValueFactory<>("channel")); channelCol.setSortable(false); channelCol.setGraphic(Icons.getIconGraphics("connect")); final TableColumn<LogEntryTableRow, String> payloadCol = new TableColumn<LogEntryTableRow, String>( "Payload"); payloadCol.setCellValueFactory(new PropertyValueFactory<>("payload")); payloadCol.setSortable(false); payloadCol.setGraphic(Icons.getIconGraphics("page_white_text_width")); this.parsedLogEntries.getColumns().add(lineNoCol); this.parsedLogEntries.getColumns().add(timeCol); this.parsedLogEntries.getColumns().add(channelCol); this.parsedLogEntries.getColumns().add(payloadCol); }
From source file:Main.java
private VBox addVBox() { VBox vbox = new VBox(); vbox.setPadding(new Insets(10)); // Set all sides to 10 vbox.setSpacing(8); // Gap between nodes Text title = new Text("Data"); title.setFont(Font.font("Arial", FontWeight.BOLD, 14)); vbox.getChildren().add(title);//ww w . j a v a 2s . c om Hyperlink options[] = new Hyperlink[] { new Hyperlink("Sales"), new Hyperlink("Marketing"), new Hyperlink("Distribution"), new Hyperlink("Costs") }; for (int i = 0; i < 4; i++) { // Add offset to left side to indent from title VBox.setMargin(options[i], new Insets(0, 0, 0, 8)); vbox.getChildren().add(options[i]); } return vbox; }
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);//from w w w.j a v a 2 s . c om } }
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);/* w w w . ja va 2s . com*/ 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:org.sleuthkit.autopsy.imagegallery.gui.MetaDataPane.java
@FXML void initialize() { assert attributeColumn != null : "fx:id=\"attributeColumn\" was not injected: check your FXML file 'MetaDataPane.fxml'."; assert imageView != null : "fx:id=\"imageView\" was not injected: check your FXML file 'MetaDataPane.fxml'."; assert tableView != null : "fx:id=\"tableView\" was not injected: check your FXML file 'MetaDataPane.fxml'."; assert valueColumn != null : "fx:id=\"valueColumn\" was not injected: check your FXML file 'MetaDataPane.fxml'."; TagUtils.registerListener(this); ImageGalleryController.getDefault().getCategoryManager().registerListener(this); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); tableView.setPlaceholder(new Label("Select a file to show its details here.")); attributeColumn.setCellValueFactory((param) -> new SimpleObjectProperty<>(param.getValue().getKey())); attributeColumn.setCellFactory(/*from w w w . j a v a2s .c o m*/ (param) -> new TableCell<Pair<DrawableAttribute<?>, ? extends Object>, DrawableAttribute<?>>() { @Override protected void updateItem(DrawableAttribute<?> item, boolean empty) { super.updateItem(item, empty); //To change body of generated methods, choose Tools | Templates. if (item != null) { setText(item.getDisplayName()); setGraphic(new ImageView(item.getIcon())); } else { setGraphic(null); setText(null); } } }); attributeColumn.setPrefWidth(USE_COMPUTED_SIZE); valueColumn.setCellValueFactory((p) -> { if (p.getValue().getKey() == DrawableAttribute.TAGS) { return new SimpleStringProperty( ((Collection<TagName>) p.getValue().getValue()).stream().map(TagName::getDisplayName) .filter((String t) -> t.startsWith(Category.CATEGORY_PREFIX) == false) .collect(Collectors.joining(" ; ", "", ""))); } else { return new SimpleStringProperty(StringUtils.join((Iterable<?>) p.getValue().getValue(), " ; ")); } }); valueColumn.setPrefWidth(USE_COMPUTED_SIZE); valueColumn.setCellFactory((p) -> new TableCell<Pair<DrawableAttribute<?>, ? extends Object>, String>() { @Override public void updateItem(String item, boolean empty) { super.updateItem(item, empty); if (!isEmpty()) { Text text = new Text(item); text.wrappingWidthProperty().bind(getTableColumn().widthProperty()); setGraphic(text); } else { setGraphic(null); } } }); tableView.getColumns().setAll(Arrays.asList(attributeColumn, valueColumn)); //listen for selection change controller.getSelectionModel().lastSelectedProperty().addListener((observable, oldFileID, newFileID) -> { setFile(newFileID); }); // MetaDataPane.this.visibleProperty().bind(controller.getMetaDataCollapsed().not()); // MetaDataPane.this.managedProperty().bind(controller.getMetaDataCollapsed().not()); }
From source file:org.sleuthkit.autopsy.imageanalyzer.gui.MetaDataPane.java
@FXML void initialize() { assert attributeColumn != null : "fx:id=\"attributeColumn\" was not injected: check your FXML file 'MetaDataPane.fxml'."; assert imageView != null : "fx:id=\"imageView\" was not injected: check your FXML file 'MetaDataPane.fxml'."; assert tableView != null : "fx:id=\"tableView\" was not injected: check your FXML file 'MetaDataPane.fxml'."; assert valueColumn != null : "fx:id=\"valueColumn\" was not injected: check your FXML file 'MetaDataPane.fxml'."; TagUtils.registerListener(this); Category.registerListener(this); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); tableView.setPlaceholder(new Label("Select a file to show its details here.")); attributeColumn.setCellValueFactory((param) -> new SimpleObjectProperty<>(param.getValue().getKey())); attributeColumn.setCellFactory(/*from www . j a v a 2 s . co m*/ (param) -> new TableCell<Pair<DrawableAttribute<?>, ? extends Object>, DrawableAttribute<?>>() { @Override protected void updateItem(DrawableAttribute<?> item, boolean empty) { super.updateItem(item, empty); //To change body of generated methods, choose Tools | Templates. if (item != null) { setText(item.getDisplayName()); setGraphic(new ImageView(item.getIcon())); } else { setGraphic(null); setText(null); } } }); attributeColumn.setPrefWidth(USE_COMPUTED_SIZE); valueColumn.setCellValueFactory((p) -> { if (p.getValue().getKey() == DrawableAttribute.TAGS) { return new SimpleStringProperty( ((Collection<TagName>) p.getValue().getValue()).stream().map(TagName::getDisplayName) .filter((String t) -> t.startsWith(Category.CATEGORY_PREFIX) == false) .collect(Collectors.joining(" ; ", "", ""))); } else { return new SimpleStringProperty(StringUtils.join((Collection<?>) p.getValue().getValue(), " ; ")); } }); valueColumn.setPrefWidth(USE_COMPUTED_SIZE); valueColumn.setCellFactory((p) -> new TableCell<Pair<DrawableAttribute<?>, ? extends Object>, String>() { @Override public void updateItem(String item, boolean empty) { super.updateItem(item, empty); if (!isEmpty()) { Text text = new Text(item); text.wrappingWidthProperty().bind(getTableColumn().widthProperty()); setGraphic(text); } else { setGraphic(null); } } }); tableView.getColumns().setAll(Arrays.asList(attributeColumn, valueColumn)); //listen for selection change controller.getSelectionModel().lastSelectedProperty().addListener((observable, oldFileID, newFileID) -> { setFile(newFileID); }); // MetaDataPane.this.visibleProperty().bind(controller.getMetaDataCollapsed().not()); // MetaDataPane.this.managedProperty().bind(controller.getMetaDataCollapsed().not()); }
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 {/* ww w .j a v a2 s .c o m*/ 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:Main.java
private void addStackPane(HBox hb) { StackPane stack = new StackPane(); Rectangle helpIcon = new Rectangle(30.0, 25.0); helpIcon.setFill(new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop[] { new Stop(0, Color.web("#4977A3")), new Stop(0.5, Color.web("#B0C6DA")), new Stop(1, Color.web("#9CB6CF")), })); helpIcon.setStroke(Color.web("#D0E6FA")); helpIcon.setArcHeight(3.5);/*from w w w. ja v a 2s . c o m*/ helpIcon.setArcWidth(3.5); Text helpText = new Text("?"); helpText.setFont(Font.font("Verdana", FontWeight.BOLD, 18)); helpText.setFill(Color.WHITE); helpText.setStroke(Color.web("#7080A0")); stack.getChildren().addAll(helpIcon, helpText); stack.setAlignment(Pos.CENTER_RIGHT); // Add offset to right for question mark to compensate for RIGHT // alignment of all nodes StackPane.setMargin(helpText, new Insets(0, 10, 0, 0)); hb.getChildren().add(stack); HBox.setHgrow(stack, Priority.ALWAYS); }