javafx.scene.control.OverrunStyle Java Examples
The following examples show how to use
javafx.scene.control.OverrunStyle.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutoCompleteItem.java From BlockMap with MIT License | 6 votes |
public AutoCompleteItem() { name = new Label(); name.setAlignment(Pos.CENTER_LEFT); name.setStyle("-fx-font-weight: bold;"); path = new Label(); path.setMaxWidth(Double.POSITIVE_INFINITY); HBox.setHgrow(path, Priority.ALWAYS); HBox.setMargin(path, new Insets(0, 8, 0, 0)); path.setAlignment(Pos.CENTER_RIGHT); path.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS); graphic = new ImageView(); graphic.setPreserveRatio(true); graphic.fitHeightProperty().bind(Bindings.createDoubleBinding(() -> name.getFont().getSize() * 1.2, name.fontProperty())); setText(null); setGraphic(new HBox(2, graphic, name, path)); setPrefWidth(0); }
Example #2
Source File: DateTileSkin.java From OEE-Designer with MIT License | 6 votes |
@Override protected void initGraphics() { super.initGraphics(); final ZonedDateTime TIME = tile.getTime(); titleText = new Text(DAY_FORMATTER.format(TIME)); titleText.setFill(tile.getTitleColor()); description = new Label(Integer.toString(TIME.getDayOfMonth())); description.setAlignment(Pos.CENTER); description.setTextAlignment(TextAlignment.CENTER); description.setWrapText(true); description.setTextOverrun(OverrunStyle.WORD_ELLIPSIS); description.setTextFill(tile.getTextColor()); description.setPrefSize(PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.72); description.setFont(Fonts.latoLight(PREFERRED_HEIGHT * 0.65)); text = new Text(MONTH_YEAR_FORMATTER.format(TIME)); text.setFill(tile.getTextColor()); getPane().getChildren().addAll(titleText, text, description); }
Example #3
Source File: TextTileSkin.java From OEE-Designer with MIT License | 6 votes |
@Override protected void initGraphics() { super.initGraphics(); titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); description = new Label(tile.getDescription()); description.setAlignment(tile.getDescriptionAlignment()); description.setTextAlignment(TextAlignment.RIGHT); description.setWrapText(true); description.setTextOverrun(OverrunStyle.WORD_ELLIPSIS); description.setTextFill(tile.getDescriptionColor()); description.setPrefSize(PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.795); Helper.enableNode(description, tile.isTextVisible()); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); getPane().getChildren().addAll(titleText, text, description); }
Example #4
Source File: CharacterTileSkin.java From OEE-Designer with MIT License | 6 votes |
@Override protected void initGraphics() { super.initGraphics(); titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); description = new Label(tile.getDescription()); description.setAlignment(Pos.CENTER); description.setTextAlignment(TextAlignment.CENTER); description.setWrapText(true); description.setTextOverrun(OverrunStyle.WORD_ELLIPSIS); description.setTextFill(tile.getTextColor()); description.setPrefSize(PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.795); Helper.enableNode(description, tile.isTextVisible()); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); getPane().getChildren().addAll(titleText, text, description); }
Example #5
Source File: DateTileSkin.java From tilesfx with Apache License 2.0 | 6 votes |
@Override protected void initGraphics() { super.initGraphics(); final ZonedDateTime TIME = tile.getTime(); titleText = new Text(DAY_FORMATTER.format(TIME)); titleText.setFill(tile.getTitleColor()); description = new Label(Integer.toString(TIME.getDayOfMonth())); description.setAlignment(Pos.CENTER); description.setTextAlignment(TextAlignment.CENTER); description.setWrapText(true); description.setTextOverrun(OverrunStyle.WORD_ELLIPSIS); description.setTextFill(tile.getTextColor()); description.setPrefSize(PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.72); description.setFont(Fonts.latoLight(PREFERRED_HEIGHT * 0.65)); text = new Text(MONTH_YEAR_FORMATTER.format(TIME)); text.setFill(tile.getTextColor()); getPane().getChildren().addAll(titleText, text, description); }
Example #6
Source File: TextTileSkin.java From tilesfx with Apache License 2.0 | 6 votes |
@Override protected void initGraphics() { super.initGraphics(); titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); description = new Label(tile.getDescription()); description.setAlignment(tile.getDescriptionAlignment()); description.setTextAlignment(TextAlignment.RIGHT); description.setWrapText(true); description.setTextOverrun(OverrunStyle.WORD_ELLIPSIS); description.setTextFill(tile.getTextColor()); description.setPrefSize(PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.795); Helper.enableNode(description, tile.isTextVisible()); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); getPane().getChildren().addAll(titleText, text, description); }
Example #7
Source File: CharacterTileSkin.java From tilesfx with Apache License 2.0 | 6 votes |
@Override protected void initGraphics() { super.initGraphics(); titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); description = new Label(tile.getDescription()); description.setAlignment(Pos.CENTER); description.setTextAlignment(TextAlignment.CENTER); description.setWrapText(true); description.setTextOverrun(OverrunStyle.WORD_ELLIPSIS); description.setTextFill(tile.getTextColor()); description.setPrefSize(PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.795); Helper.enableNode(description, tile.isTextVisible()); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); getPane().getChildren().addAll(titleText, text, description); }
Example #8
Source File: ArtistsMainController.java From MusicPlayer with MIT License | 6 votes |
ArtistCell() { super(); artistImage.setFitWidth(40); artistImage.setFitHeight(40); artistImage.setPreserveRatio(true); artistImage.setSmooth(true); artistImage.setCache(true); title.setTextOverrun(OverrunStyle.CLIP); cell.getChildren().addAll(artistImage, title); cell.setAlignment(Pos.CENTER_LEFT); HBox.setMargin(artistImage, new Insets(0, 10, 0, 0)); this.setPrefWidth(248); this.setOnMouseClicked(event -> artistList.getSelectionModel().select(artist)); this.setOnDragDetected(event -> { Dragboard db = this.startDragAndDrop(TransferMode.ANY); ClipboardContent content = new ClipboardContent(); content.putString("Artist"); db.setContent(content); MusicPlayer.setDraggedItem(artist); db.setDragView(this.snapshot(null, null), 125, 25); event.consume(); }); }
Example #9
Source File: CssTools.java From FxDock with Apache License 2.0 | 6 votes |
public static String toValue(OverrunStyle s) { switch(s) { case CENTER_ELLIPSIS: return "center-ellipsis"; case CENTER_WORD_ELLIPSIS: return "center-word-ellipsis"; case CLIP: return "clip"; case ELLIPSIS: return "ellipsis"; case LEADING_ELLIPSIS: return "leading-ellipsis"; case LEADING_WORD_ELLIPSIS: return "leading-word-ellipsis"; case WORD_ELLIPSIS: return "word-ellipsis"; } throw new Error("?" + s); }
Example #10
Source File: CGrid.java From Open-Lowcode with Eclipse Public License 2.0 | 5 votes |
private TableView<CObjectGridLine<String>> generateTableViewModel() { TableView<CObjectGridLine<String>> returntable = new TableView<CObjectGridLine<String>>(); Collections.sort(arraycolumns); for (int i = 0; i < arraycolumns.size(); i++) { TableColumn<CObjectGridLine<String>, String> thiscolumn = arraycolumns.get(i).column; logger.fine(" GTVM --- " + thiscolumn.getId()); ObservableList<TableColumn<CObjectGridLine<String>, ?>> subcolumns = thiscolumn.getColumns(); for (int k = 0; k < subcolumns.size(); k++) logger.fine(" GTVM ++ " + subcolumns.get(k).getId()); returntable.getColumns().add(thiscolumn); } double finalheightinpixel = 29; returntable.setRowFactory(tv -> new TableRow<CObjectGridLine<String>>() { @Override public void updateItem(CObjectGridLine<String> object, boolean empty) { super.updateItem(object, empty); this.setMaxHeight(finalheightinpixel); this.setMinHeight(finalheightinpixel); this.setPrefHeight(finalheightinpixel); this.setTextOverrun(OverrunStyle.ELLIPSIS); this.setEllipsisString("..."); } }); returntable.getSelectionModel().setCellSelectionEnabled(true); returntable.setTooltip(tooltip); return returntable; }
Example #11
Source File: CObjectArrayColumnModel.java From Open-Lowcode with Eclipse Public License 2.0 | 5 votes |
@Override public void updateItem(ObjectTableRow object, boolean empty) { super.updateItem(object, empty); logger.finer(" --- final row height set to pixelheight = " + finalheightinpixel + "---"); this.setMaxHeight(finalheightinpixel); this.setMinHeight(finalheightinpixel); this.setPrefHeight(finalheightinpixel); this.setTextOverrun(OverrunStyle.ELLIPSIS); this.setEllipsisString("..."); }
Example #12
Source File: MediaListCell.java From dolphin-platform with Apache License 2.0 | 5 votes |
public MediaListCell() { getStyleClass().add("media-list-cell"); title = new SimpleStringProperty(); description = new SimpleStringProperty(); textSpacing = CssHelper.createProperty(StyleableProperties.TEXT_SPACING, this); showDescription = CssHelper.createProperty(StyleableProperties.SHOW_DESCRIPTION, this); centerBox = new VBox(); centerBox.spacingProperty().bind(textSpacing); titleLabel = new Label(); titleLabel.getStyleClass().add("media-cell-title"); titleLabel.textProperty().bind(title); VBox.setVgrow(titleLabel, Priority.NEVER); descriptionLabel = new Label(); //TODO: CSS descriptionLabel.setWrapText(true); descriptionLabel.setTextOverrun(OverrunStyle.WORD_ELLIPSIS); descriptionLabel.getStyleClass().add("media-cell-description"); descriptionLabel.textProperty().bind(description); VBox.setVgrow(titleLabel, Priority.ALWAYS); centerBox.getChildren().addAll(titleLabel, descriptionLabel); setCenterContent(centerBox); showDescription.addListener(e -> { descriptionLabel.setManaged(isShowDescription()); descriptionLabel.setVisible(isShowDescription()); }); }
Example #13
Source File: FXMLResultsController.java From pikatimer with GNU General Public License v3.0 | 4 votes |
OutputPortalListCell(){ topLine.setSpacing(5); topLine.setStyle("-fx-font-size: 14px;"); enabledCheckBox.setStyle("-fx-font-size: 12px;"); spring.setMinWidth(1); spring.setPrefWidth(1); spring.setMaxWidth(MAX_VALUE); protocolLabel.setMinWidth(USE_COMPUTED_SIZE); //transferStatusLabel.setMinWidth(1); //transferStatusLabel.setPrefWidth(2); HBox.setHgrow(protocolLabel, Priority.NEVER); HBox.setHgrow(spring, Priority.ALWAYS); topLine.getChildren().addAll(protocolLabel, spring, enabledCheckBox); serverLabel.setMinWidth(USE_COMPUTED_SIZE); serverLabel.setPrefWidth(USE_COMPUTED_SIZE); pathLabel.setMinWidth(1); //pathLabel.setPrefWidth(1); pathLabel.setTextOverrun(OverrunStyle.LEADING_ELLIPSIS); //HBox.setHgrow(serverLabel, Priority.NEVER); HBox.setHgrow(pathLabel, Priority.ALWAYS); middleLine.setSpacing(2); middleLine.getChildren().addAll(pathLabel); bottomLine.getChildren().addAll(transferStatusLabel); container.getChildren().addAll(topLine, middleLine,bottomLine); // TODO: Find the right way to constrain a cell to the // Note that the serverLabel will shrink despite the minWidth setting // The entire thing is beyond frustrating container.setMaxWidth(230); }
Example #14
Source File: InfoDisplay.java From bisq with GNU Affero General Public License v3.0 | 4 votes |
public InfoDisplay() { icon.setId("non-clickable-icon"); icon.visibleProperty().bind(visibleProperty()); GridPane.setValignment(icon, VPos.TOP); GridPane.setMargin(icon, new Insets(-2, 0, 0, 0)); GridPane.setRowSpan(icon, 2); label = new AutoTooltipLabel(); label.textProperty().bind(text); label.setTextOverrun(OverrunStyle.WORD_ELLIPSIS); // width is set a frame later so we hide it first label.setVisible(false); link = new Hyperlink(Res.get("shared.readMore")); link.setPadding(new Insets(0, 0, 0, -2)); // We need that to know if we have a wrapping or not. // Did not find a way to get that from the API. Label testLabel = new AutoTooltipLabel(); testLabel.textProperty().bind(text); textFlow = new TextFlow(); textFlow.visibleProperty().bind(visibleProperty()); textFlow.getChildren().addAll(testLabel); testLabel.widthProperty().addListener((ov, o, n) -> { useReadMore = (double) n > textFlow.getWidth(); link.setText(Res.get(useReadMore ? "shared.readMore" : "shared.openHelp")); UserThread.execute(() -> textFlow.getChildren().setAll(label, link)); }); // update the width when the window gets resized ChangeListener<Number> listener = (ov2, oldValue2, windowWidth) -> { if (label.prefWidthProperty().isBound()) label.prefWidthProperty().unbind(); label.setPrefWidth((double) windowWidth - localToScene(0, 0).getX() - 35); }; // when clicking "Read more..." we expand and change the link to the Help link.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { if (useReadMore) { label.setWrapText(true); link.setText(Res.get("shared.openHelp")); getScene().getWindow().widthProperty().removeListener(listener); if (label.prefWidthProperty().isBound()) label.prefWidthProperty().unbind(); label.prefWidthProperty().bind(textFlow.widthProperty()); link.setVisited(false); // focus border is a bit confusing here so we remove it link.getStyleClass().add("hide-focus"); link.setOnAction(onAction.get()); getParent().layout(); } else { onAction.get().handle(actionEvent); } } }); sceneProperty().addListener((ov, oldValue, newValue) -> { if (oldValue == null && newValue != null && newValue.getWindow() != null) { newValue.getWindow().widthProperty().addListener(listener); // localToScene does deliver 0 instead of the correct x position when scene property gets set, // so we delay for 1 render cycle UserThread.execute(() -> { label.setVisible(true); label.prefWidthProperty().unbind(); label.setPrefWidth(newValue.getWindow().getWidth() - localToScene(0, 0).getX() - 35); }); } }); }
Example #15
Source File: ControlPanelTableCell.java From MusicPlayer with MIT License | 4 votes |
@Override protected void updateItem(T item, boolean empty) { super.updateItem(item, empty); Song song = (Song) this.getTableRow().getItem(); if (empty || item == null || song == null) { setText(null); setGraphic(null); } else if (!song.getSelected()) { setText(item.toString()); setGraphic(null); song.selectedProperty().removeListener(listener); song.selectedProperty().addListener(listener); } else { String fileName; // Selects the correct control panel based on whether the user is in a play list or not. if (MusicPlayer.getMainController().getSubViewController() instanceof PlaylistsController) { fileName = Resources.FXML + "ControlPanelPlaylists.fxml"; } else { fileName = Resources.FXML + "ControlPanel.fxml"; } try { Label text = new Label(item.toString()); text.setTextOverrun(OverrunStyle.CLIP); FXMLLoader loader = new FXMLLoader(this.getClass().getResource(fileName)); HBox controlPanel = loader.load(); BorderPane cell = new BorderPane(); cell.setRight(controlPanel); cell.setCenter(text); BorderPane.setAlignment(text, Pos.CENTER_LEFT); BorderPane.setAlignment(controlPanel, Pos.CENTER_LEFT); setText(null); setGraphic(cell); song.selectedProperty().removeListener(listener); song.selectedProperty().addListener(listener); } catch (Exception ex) { ex.printStackTrace(); } } }
Example #16
Source File: ArtistsController.java From MusicPlayer with MIT License | 4 votes |
private VBox createCell(Artist artist) { VBox cell = new VBox(); Label title = new Label(artist.getTitle()); ImageView image = new ImageView(artist.getArtistImage()); image.imageProperty().bind(artist.artistImageProperty()); VBox imageBox = new VBox(); title.setTextOverrun(OverrunStyle.CLIP); title.setWrapText(true); title.setPadding(new Insets(10, 0, 10, 0)); title.setAlignment(Pos.TOP_LEFT); title.setPrefHeight(66); title.prefWidthProperty().bind(grid.widthProperty().subtract(100).divide(5).subtract(1)); image.fitWidthProperty().bind(grid.widthProperty().subtract(100).divide(5).subtract(1)); image.fitHeightProperty().bind(grid.widthProperty().subtract(100).divide(5).subtract(1)); image.setPreserveRatio(true); image.setSmooth(true); imageBox.prefWidthProperty().bind(grid.widthProperty().subtract(100).divide(5).subtract(1)); imageBox.prefHeightProperty().bind(grid.widthProperty().subtract(100).divide(5).subtract(1)); imageBox.setAlignment(Pos.CENTER); imageBox.getChildren().add(image); cell.getChildren().addAll(imageBox, title); cell.setPadding(new Insets(10, 10, 0, 10)); cell.getStyleClass().add("artist-cell"); cell.setAlignment(Pos.CENTER); cell.setOnMouseClicked(event -> { MainController mainController = MusicPlayer.getMainController(); ArtistsMainController artistsMainController = (ArtistsMainController) mainController.loadView("ArtistsMain"); VBox artistCell = (VBox) event.getSource(); String artistTitle = ((Label) artistCell.getChildren().get(1)).getText(); Artist a = Library.getArtist(artistTitle); artistsMainController.selectArtist(a); }); cell.setOnDragDetected(event -> { PseudoClass pressed = PseudoClass.getPseudoClass("pressed"); cell.pseudoClassStateChanged(pressed, false); Dragboard db = cell.startDragAndDrop(TransferMode.ANY); ClipboardContent content = new ClipboardContent(); content.putString("Artist"); db.setContent(content); MusicPlayer.setDraggedItem(artist); db.setDragView(cell.snapshot(null, null), cell.widthProperty().divide(2).get(), cell.heightProperty().divide(2).get()); event.consume(); }); return cell; }
Example #17
Source File: FX.java From FxDock with Apache License 2.0 | 4 votes |
/** creates a label. accepts: CssStyle, CssID, FxCtl, Insets, OverrunStyle, Pos, TextAlignment, Color, Node, Background */ public static Label label(Object ... attrs) { Label n = new Label(); for(Object a: attrs) { if(a == null) { // ignore } else if(a instanceof CssStyle) { n.getStyleClass().add(((CssStyle)a).getName()); } else if(a instanceof CssID) { n.setId(((CssID)a).getID()); } else if(a instanceof FxCtl) { switch((FxCtl)a) { case BOLD: n.getStyleClass().add(CssTools.BOLD.getName()); break; case FOCUSABLE: n.setFocusTraversable(true); break; case FORCE_MAX_WIDTH: n.setMaxWidth(Double.MAX_VALUE); break; case FORCE_MIN_HEIGHT: n.setMinHeight(Control.USE_PREF_SIZE); break; case FORCE_MIN_WIDTH: n.setMinWidth(Control.USE_PREF_SIZE); break; case NON_FOCUSABLE: n.setFocusTraversable(false); break; case WRAP_TEXT: n.setWrapText(true); break; default: throw new Error("?" + a); } } else if(a instanceof Insets) { n.setPadding((Insets)a); } else if(a instanceof OverrunStyle) { n.setTextOverrun((OverrunStyle)a); } else if(a instanceof Pos) { n.setAlignment((Pos)a); } else if(a instanceof String) { n.setText((String)a); } else if(a instanceof TextAlignment) { n.setTextAlignment((TextAlignment)a); } else if(a instanceof Color) { n.setTextFill((Color)a); } else if(a instanceof StringProperty) { n.textProperty().bind((StringProperty)a); } else if(a instanceof Node) { n.setGraphic((Node)a); } else if(a instanceof Background) { n.setBackground((Background)a); } else { throw new Error("?" + a); } } return n; }
Example #18
Source File: MessageItem.java From helloiot with GNU General Public License v3.0 | 4 votes |
public MessageItem(EventMessage message) { getStyleClass().add("message"); setMaxSize(Double.MAX_VALUE, 60.0); setMinSize(Control.USE_COMPUTED_SIZE, 60.0); setPrefSize(Control.USE_COMPUTED_SIZE, 60.0); HBox.setHgrow(this, Priority.SOMETIMES); StringFormat format = StringFormatIdentity.INSTANCE; String txt = format.format(format.value(message.getMessage())); Label messageview = new Label(txt); messageview.setTextOverrun(OverrunStyle.ELLIPSIS); messageview.getStyleClass().add("unitinputview"); BorderPane.setAlignment(messageview, Pos.CENTER_LEFT); setCenter(messageview); HBox footer = new HBox(); Label topictext = new Label(message.getTopic()); topictext.setTextOverrun(OverrunStyle.ELLIPSIS); topictext.getStyleClass().add("messagefooter"); topictext.setMaxWidth(Double.MAX_VALUE); HBox.setHgrow(topictext, Priority.ALWAYS); footer.getChildren().add(topictext); DateTimeFormatter dtf = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM); Label datetext = new Label(LocalDateTime.now().format(dtf)); datetext.getStyleClass().add("messagefooter"); footer.getChildren().add(datetext); MiniVar v2 = message.getProperty("mqtt.retained"); if (v2 != null && v2.asBoolean()) { Label retainedtext = new Label(resources.getString("badge.retained")); retainedtext.getStyleClass().addAll("badge", "badgeretained"); footer.getChildren().add(retainedtext); } MiniVar v = message.getProperty("mqtt.qos"); if (v != null) { Label qostext = new Label(String.format(resources.getString("badge.qos"), v.asInt())); qostext.getStyleClass().addAll("badge", "badgeqos"); footer.getChildren().add(qostext); } setBottom(footer); }
Example #19
Source File: SearchCommentsListItem.java From youtube-comment-suite with MIT License | 4 votes |
SearchCommentsListItem(YouTubeComment comment) throws IOException { this.comment = comment; configData = FXMLSuite.getConfig().getDataObject(); FXMLLoader loader = new FXMLLoader(getClass().getResource("SearchCommentsListItem.fxml")); loader.setController(this); loader.setRoot(this); loader.load(); channel = comment.getChannel(); thumbnail.setImage(channel.getDefaultThumb()); checkProfileThumb(); author.setText(channel.getTitle()); author.setOnAction(ae -> browserUtil.open(channel.buildYouTubeLink())); author.setBorder(Border.EMPTY); commentText.setText(comment.getCleanText(false)); commentText.setTextOverrun(OverrunStyle.ELLIPSIS); date.setText(DateUtils.epochMillisToDateTime(comment.getPublished()).toString()); if (comment.getReplyCount() > 0 || comment.isReply()) { viewTree.setManaged(true); viewTree.setVisible(true); if (!comment.isReply()) { viewTree.setText(String.format("View Thread (%,d)", comment.getReplyCount())); } } if (comment.isReply()) { type.setText("Reply"); this.getStyleClass().add("reply"); } if (comment.getLikes() > 0) { likes.setText(String.format("+%,d", comment.getLikes())); } else { likes.setVisible(false); likes.setManaged(false); } reply.setManaged(!configData.getAccounts().isEmpty()); reply.setVisible(!configData.getAccounts().isEmpty()); configData.accountListChangedProperty().addListener((o, ov, nv) -> { reply.setManaged(!configData.getAccounts().isEmpty()); reply.setVisible(!configData.getAccounts().isEmpty()); }); }
Example #20
Source File: CPopupButton.java From Open-Lowcode with Eclipse Public License 2.0 | 4 votes |
@Override public Node getNode( PageActionManager actionmanager, CPageData inputdata, Window parentwindow, TabPane[] parenttabpanes, CollapsibleNode nodetocollapsewhenactiontriggered) { Button button = new Button(label); button.setStyle("-fx-base: #ffffff; -fx-hover-base: #ddeeff;"); Label hamburgerlabel = new Label("\u2630"); hamburgerlabel.setFont(Font.font(hamburgerlabel.getFont().getFamily(), FontWeight.THIN, hamburgerlabel.getFont().getSize() * 0.5f)); button.setGraphic(hamburgerlabel); button.setContentDisplay(ContentDisplay.RIGHT); button.setMinSize(Button.USE_PREF_SIZE, Button.USE_PREF_SIZE); button.textOverrunProperty().set(OverrunStyle.CLIP); if (rollovertip != null) if (rollovertip.length() > 0) button.setTooltip(new Tooltip(rollovertip)); // --------- setup popup window button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { try { CPopupButton.generateAndShowPopup(button, payload.getNode(actionmanager, inputdata, parentwindow, new TabPane[0],nodetocollapsewhenactiontriggered), inputdata, parentwindow, allowscroll, showunderwidget); } catch (Exception e) { logger.severe("Unexpected exception " + e.getMessage()); for (int i = 0; i < e.getStackTrace().length; i++) logger.severe(" + " + e.getStackTrace()[i].toString()); } } }); // ------------------------ return button; }
Example #21
Source File: StatusTileSkin.java From tilesfx with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { super.initGraphics(); titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); description = new Label(tile.getDescription()); description.setAlignment(tile.getDescriptionAlignment()); description.setTextAlignment(TextAlignment.RIGHT); description.setWrapText(true); description.setTextOverrun(OverrunStyle.WORD_ELLIPSIS); description.setTextFill(tile.getTextColor()); description.setPrefSize(PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.795); Helper.enableNode(description, tile.isTextVisible()); Color foregroundColor = getSkinnable().getForegroundColor(); Color halfTranslucent = Helper.getColorWithOpacity(foregroundColor, 0.5); verticalDivider = new Line(0, PREFERRED_HEIGHT * 0.35, PREFERRED_WIDTH, PREFERRED_HEIGHT * 0.35); verticalDivider.getStrokeDashArray().addAll(2.0, 2.0); verticalDivider.setStrokeDashOffset(1); verticalDivider.setStroke(halfTranslucent); verticalDivider.setStrokeWidth(1); horizontal1Divider = new Line(PREFERRED_WIDTH / 3, PREFERRED_HEIGHT * 0.45, PREFERRED_WIDTH / 3, PREFERRED_HEIGHT * 0.85); horizontal1Divider.getStrokeDashArray().addAll(2.0, 2.0); horizontal1Divider.setStrokeDashOffset(1); horizontal1Divider.setStroke(halfTranslucent); horizontal1Divider.setStrokeWidth(1); horizontal2Divider = new Line(2 * PREFERRED_WIDTH / 3, PREFERRED_HEIGHT * 0.45, 2 * PREFERRED_WIDTH / 3, PREFERRED_HEIGHT * 0.85); horizontal2Divider.getStrokeDashArray().addAll(2.0, 2.0); horizontal2Divider.setStrokeDashOffset(1); horizontal2Divider.setStroke(halfTranslucent); horizontal2Divider.setStrokeWidth(1); leftGraphicsPane = new StackPane(); middleGraphicsPane = new StackPane(); rightGraphicsPane = new StackPane(); if (null != tile.getLeftGraphics()) { leftGraphicsPane.getChildren().setAll(tile.getLeftGraphics()); } if (null != tile.getMiddleGraphics()) { middleGraphicsPane.getChildren().setAll(tile.getMiddleGraphics()); } if (null != tile.getRightGraphics()) { rightGraphicsPane.getChildren().setAll(tile.getRightGraphics()); } leftValueLabel = new Label(); leftValueLabel.setAlignment(Pos.CENTER); middleValueLabel = new Label(); middleValueLabel.setAlignment(Pos.CENTER); rightValueLabel = new Label(); rightValueLabel.setAlignment(Pos.CENTER); leftLabel = new Label(); leftLabel.setAlignment(Pos.CENTER); middleLabel = new Label(); middleLabel.setAlignment(Pos.CENTER); rightLabel = new Label(); rightLabel.setAlignment(Pos.CENTER); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); getPane().getChildren().addAll(titleText, description, verticalDivider, horizontal1Divider, horizontal2Divider, leftGraphicsPane, middleGraphicsPane, rightGraphicsPane, leftValueLabel, middleValueLabel, rightValueLabel, leftLabel, middleLabel, rightLabel, text); }
Example #22
Source File: LabeledDetailPaneInfo.java From scenic-view with GNU General Public License v3.0 | 4 votes |
@Override protected void updateDetail(final String propertyName) { final boolean all = propertyName.equals("*") ? true : false; final Labeled labeled = (Labeled) getTarget(); if (all || propertyName.equals("text")) { textDetail.setValue(labeled != null ? "\"" + labeled.getText() + "\"" : "-"); textDetail.setIsDefault(labeled == null || labeled.getText() == null); textDetail.setSimpleProperty(labeled != null ? labeled.textProperty() : null); if (!all) textDetail.updated(); if (!all) return; } if (all || propertyName.equals("font")) { fontDetail.setValue(labeled != null ? labeled.getFont().getName() : "-"); fontDetail.setIsDefault(labeled == null); if (!all) fontDetail.updated(); if (!all) return; } if (all || propertyName.equals("graphic")) { final Node graphic = labeled != null ? labeled.getGraphic() : null; graphicDetail.setValue(graphic != null ? graphic.getClass().getSimpleName() : "-"); graphicDetail.setIsDefault(graphic == null); if (!all) graphicDetail.updated(); if (!all) return; } if (all || propertyName.equals("graphicTextGap")) { graphicTextGapDetail.setValue(labeled != null ? f.format(labeled.getGraphicTextGap()) : "-"); graphicTextGapDetail.setIsDefault(labeled == null || labeled.getGraphic() == null); graphicTextGapDetail.setSimpleProperty(labeled != null ? labeled.graphicTextGapProperty() : null); if (!all) graphicTextGapDetail.updated(); if (!all) return; } if (all || propertyName.equals("alignment")) { alignmentDetail.setValue(labeled != null ? labeled.getAlignment().toString() : "-"); alignmentDetail.setIsDefault(labeled == null); alignmentDetail.setEnumProperty(labeled != null ? labeled.alignmentProperty() : null, Pos.class); if (!all) alignmentDetail.updated(); if (!all) return; } if (all || propertyName.equals("textAlignment")) { textAlignmentDetail.setValue(labeled != null ? labeled.getTextAlignment().toString() : "-"); textAlignmentDetail.setIsDefault(labeled == null); textAlignmentDetail.setEnumProperty(labeled != null ? labeled.textAlignmentProperty() : null, TextAlignment.class); if (!all) textAlignmentDetail.updated(); if (!all) return; } if (all || propertyName.equals("textOverrun")) { textOverrunDetail.setValue(labeled != null ? labeled.getTextOverrun().toString() : "-"); textOverrunDetail.setIsDefault(labeled == null); textOverrunDetail.setEnumProperty(labeled != null ? labeled.textOverrunProperty() : null, OverrunStyle.class); if (!all) textOverrunDetail.updated(); if (!all) return; } if (all || propertyName.equals("contentDisplay")) { contentDisplayDetail.setValue(labeled != null ? labeled.getContentDisplay().toString() : "-"); contentDisplayDetail.setIsDefault(labeled == null); contentDisplayDetail.setEnumProperty(labeled != null ? labeled.contentDisplayProperty() : null, ContentDisplay.class); if (!all) contentDisplayDetail.updated(); if (!all) return; } if (all || propertyName.equals("underline")) { underlineDetail.setValue(labeled != null ? Boolean.toString(labeled.isUnderline()) : "-"); underlineDetail.setIsDefault(labeled == null || !labeled.isUnderline()); underlineDetail.setSimpleProperty(labeled != null ? labeled.underlineProperty() : null); if (!all) underlineDetail.updated(); if (!all) return; } if (all || propertyName.equals("wrapText")) { wrapTextDetail.setValue(labeled != null ? Boolean.toString(labeled.isWrapText()) : "-"); wrapTextDetail.setIsDefault(labeled == null || !labeled.isWrapText()); wrapTextDetail.setSimpleProperty(labeled != null ? labeled.wrapTextProperty() : null); if (!all) wrapTextDetail.updated(); if (!all) return; } if (all) sendAllDetails(); }
Example #23
Source File: CActionButton.java From Open-Lowcode with Eclipse Public License 2.0 | 4 votes |
@Override public Node getNode( PageActionManager actionmanager, CPageData inputdata, Window parentwindow, TabPane[] parenttabpanes, CollapsibleNode nodetocollapsewhenactiontriggered) { if (this.conditionalshow) { DataElt thiselement = inputdata.lookupDataElementByName(conditionalshowdatareference.getName()); if (thiselement == null) throw new RuntimeException(String.format( "could not find any page data with name = %s" + conditionalshowdatareference.getName())); if (!thiselement.getType().equals(conditionalshowdatareference.getType())) throw new RuntimeException( String.format("page data with name = %s does not have expected %s type, actually found %s", conditionalshowdatareference.getName(), conditionalshowdatareference.getType(), thiselement.getType())); ChoiceDataElt<?> thischoiceelement = (ChoiceDataElt<?>) thiselement; if (thischoiceelement.getStoredValue().compareTo("YES") != 0) return new Label(""); } button = new Button(label); button.setStyle("-fx-base: #ffffff; -fx-hover-base: #ddeeff;"); button.setMinSize(Button.USE_PREF_SIZE, Button.USE_PREF_SIZE); button.textOverrunProperty().set(OverrunStyle.CLIP); // button.setMinWidth((new // Text(this.label).getBoundsInLocal().getWidth()+20)*1.3); if (tooltip != null) button.setTooltip(new Tooltip("tooltip")); if (!this.hasconfirmationmessage) { if (action != null) { actionmanager.registerEvent(button, action); if (callback != null) actionmanager.registerCallback(button, callback); buttonhandler = new ButtonHandler(actionmanager); button.setOnMouseClicked(buttonhandler); } if (inlineaction != null) { if (nodetocollapsewhenactiontriggered != null) inlineaction.setNodeToCollapse(nodetocollapsewhenactiontriggered); if (this.forcepopuphidewheninline) { actionmanager.registerInlineActionwithPopupClose(button, inlineaction); } else { actionmanager.registerInlineAction(button, inlineaction); } buttonhandler = new ButtonHandler(actionmanager); button.setOnMouseClicked(buttonhandler); } } if (this.hasconfirmationmessage) { button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle("User Confirmation"); alert.setContentText(confirmationmessage); ButtonType continuetype = new ButtonType(confirmationmessagecontinuelabel); ButtonType stoptype = new ButtonType(confirmationmessagestoplabel); alert.getButtonTypes().setAll(continuetype, stoptype); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == continuetype) { if (action != null) { if (callback != null) actionmanager.directfireEvent(action, callback); if (callback == null) actionmanager.directfireEvent(action); } if (inlineaction != null) { if (forcepopuphidewheninline) inlineaction.forcePopupClose(); actionmanager.directfireInlineEvent(inlineaction); } } } }); } return button; }
Example #24
Source File: ClippedTableCell.java From MusicPlayer with MIT License | 2 votes |
public ClippedTableCell() { setTextOverrun(OverrunStyle.CLIP); }
Example #25
Source File: StandardFxProperties.java From FxDock with Apache License 2.0 | votes |
public static FxCssProp overrunStyle(OverrunStyle x) { return new FxCssProp("-fx-text-overrun", CssTools.toValue(x)); }
Example #26
Source File: StandardFxProperties.java From FxDock with Apache License 2.0 | votes |
public static FxCssProp textOverrun(OverrunStyle x) { return new FxCssProp("-fx-text-overrun", CssTools.toColor(x)); }