Example usage for javafx.scene.control OverrunStyle CENTER_ELLIPSIS

List of usage examples for javafx.scene.control OverrunStyle CENTER_ELLIPSIS

Introduction

In this page you can find the example usage for javafx.scene.control OverrunStyle CENTER_ELLIPSIS.

Prototype

OverrunStyle CENTER_ELLIPSIS

To view the source code for javafx.scene.control OverrunStyle CENTER_ELLIPSIS.

Click Source Link

Document

Trims out the center of the string being displayed and replaces the middle three characters with "...".

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setWidth(300);//from   w  w  w  .jav a  2 s.com
    stage.setHeight(150);

    Button button = new Button("Hover Over Me");
    Tooltip toolTip = new Tooltip("Tooltip for Button");

    toolTip.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);

    button.setTooltip(toolTip);

    ((Group) scene.getRoot()).getChildren().add(button);

    stage.setScene(scene);
    stage.show();
}

From source file:dpfmanager.shell.interfaces.gui.fragment.wizard.Wizard1Fragment.java

private void addCheckBox(String id, String name, String path, boolean selected, boolean delete) {
    HBox hbox = new HBox();
    hbox.setAlignment(Pos.CENTER_LEFT);/*ww  w . ja  va 2  s .c om*/

    CheckBox chk = new CheckBox(name);
    chk.setId(id);
    chk.getStyleClass().add("checkreport");
    chk.setSelected(selected);
    chk.setEllipsisString(" ... ");
    chk.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);
    chk.setTooltip(new Tooltip(path));
    hbox.getChildren().add(chk);

    // EDIT
    Button edit = new Button();
    edit.getStyleClass().addAll("edit-img", "action-img-16");
    edit.setCursor(Cursor.HAND);
    edit.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
            String iso = chk.getId();
            String path = null;
            if (iso.startsWith("external")) {
                iso = chk.getText();
                path = iso;
            } else if (chk.getId().startsWith("config")) {
                iso = chk.getId().replace("config", "");
                path = DPFManagerProperties.getIsosDir() + "/" + iso;
            }
            controller.editIso(iso, path);
        }
    });
    hbox.getChildren().add(edit);
    HBox.setMargin(edit, new Insets(0, 0, 0, 10));

    // DELETE
    if (delete) {
        Button icon = new Button();
        icon.getStyleClass().addAll("delete-img", "action-img-16");
        icon.setCursor(Cursor.HAND);
        icon.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                if (chk.getId().startsWith("external")) {
                    // Only from gui
                    vboxRadios.getChildren().remove(hbox);
                } else if (chk.getId().startsWith("config")) {
                    // From system
                    String name = chk.getId().replace("config", "");
                    File file = new File(DPFManagerProperties.getIsosDir() + "/" + name);
                    if (file.exists() && file.isFile() && acceptDelete(file)) {
                        file.delete();
                        vboxRadios.getChildren().remove(hbox);
                    }
                }
            }
        });
        hbox.getChildren().add(icon);
        HBox.setMargin(icon, new Insets(0, 0, 0, 10));
    }

    vboxRadios.getChildren().add(hbox);
}

From source file:org.sleuthkit.autopsy.timeline.ui.detailview.AggregateEventNode.java

public AggregateEventNode(final AggregateEvent event, AggregateEventNode parentEventNode,
        EventDetailChart chart) {//from w  w w  .  ja  v  a 2 s. c o m
    this.event = event;
    descLOD.set(event.getLOD());
    this.parentEventNode = parentEventNode;
    this.chart = chart;
    final Region region = new Region();
    HBox.setHgrow(region, Priority.ALWAYS);
    final HBox hBox = new HBox(descrLabel, countLabel, region, minusButton, plusButton);
    hBox.setPrefWidth(USE_COMPUTED_SIZE);
    hBox.setMinWidth(USE_PREF_SIZE);
    hBox.setPadding(new Insets(2, 5, 2, 5));
    hBox.setAlignment(Pos.CENTER_LEFT);

    minusButton.setVisible(false);
    plusButton.setVisible(false);
    minusButton.setManaged(false);
    plusButton.setManaged(false);
    final BorderPane borderPane = new BorderPane(subNodePane, hBox, null, null, null);
    BorderPane.setAlignment(subNodePane, Pos.TOP_LEFT);
    borderPane.setPrefWidth(USE_COMPUTED_SIZE);

    getChildren().addAll(spanRegion, borderPane);

    setAlignment(Pos.TOP_LEFT);
    setMinHeight(24);
    minWidthProperty().bind(spanRegion.widthProperty());
    setPrefHeight(USE_COMPUTED_SIZE);
    setMaxHeight(USE_PREF_SIZE);

    //set up subnode pane sizing contraints
    subNodePane.setPrefHeight(USE_COMPUTED_SIZE);
    subNodePane.setMinHeight(USE_PREF_SIZE);
    subNodePane.setMinWidth(USE_PREF_SIZE);
    subNodePane.setMaxHeight(USE_PREF_SIZE);
    subNodePane.setMaxWidth(USE_PREF_SIZE);
    subNodePane.setPickOnBounds(false);

    //setup description label
    eventTypeImageView.setImage(event.getType().getFXImage());
    descrLabel.setGraphic(eventTypeImageView);
    descrLabel.setPrefWidth(USE_COMPUTED_SIZE);
    descrLabel.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);

    descrLabel.setMouseTransparent(true);
    setDescriptionVisibility(chart.getDescrVisibility().get());

    //setup backgrounds
    final Color evtColor = event.getType().getColor();
    spanFill = new Background(
            new BackgroundFill(evtColor.deriveColor(0, 1, 1, .1), CORNER_RADII, Insets.EMPTY));
    setBackground(
            new Background(new BackgroundFill(evtColor.deriveColor(0, 1, 1, .1), CORNER_RADII, Insets.EMPTY)));
    setCursor(Cursor.HAND);
    spanRegion.setStyle("-fx-border-width:2 0 2 2; -fx-border-radius: 2; -fx-border-color: "
            + ColorUtilities.getRGBCode(evtColor) + ";"); // NON-NLS
    spanRegion.setBackground(spanFill);

    //set up mouse hover effect and tooltip
    setOnMouseEntered((MouseEvent e) -> {
        //defer tooltip creation till needed, this had a surprisingly large impact on speed of loading the chart
        installTooltip();
        spanRegion.setEffect(new DropShadow(10, evtColor));
        minusButton.setVisible(true);
        plusButton.setVisible(true);
        minusButton.setManaged(true);
        plusButton.setManaged(true);
        toFront();

    });

    setOnMouseExited((MouseEvent e) -> {
        spanRegion.setEffect(null);
        minusButton.setVisible(false);
        plusButton.setVisible(false);
        minusButton.setManaged(false);
        plusButton.setManaged(false);

    });

    setOnMouseClicked(new EventMouseHandler());

    plusButton.disableProperty().bind(descLOD.isEqualTo(DescriptionLOD.FULL));
    minusButton.disableProperty().bind(descLOD.isEqualTo(event.getLOD()));

    plusButton.setOnMouseClicked(e -> {
        final DescriptionLOD next = descLOD.get().next();
        if (next != null) {
            loadSubClusters(next);
            descLOD.set(next);
        }
    });
    minusButton.setOnMouseClicked(e -> {
        final DescriptionLOD previous = descLOD.get().previous();
        if (previous != null) {
            loadSubClusters(previous);
            descLOD.set(previous);
        }
    });
}

From source file:org.sleuthkit.autopsy.timeline.ui.detailview.EventStripeNode.java

public EventStripeNode(EventDetailsChart chart, EventStripe eventStripe, EventClusterNode parentNode) {
    super(chart, eventStripe, parentNode);

    setMinHeight(48);/*from  w  w  w . ja v a 2s  . c o m*/

    EventDetailsChart.HideDescriptionAction hideClusterAction = chart.new HideDescriptionAction(
            getDescription(), eventBundle.getDescriptionLoD());
    hideButton = ActionUtils.createButton(hideClusterAction, ActionUtils.ActionTextBehavior.HIDE);
    configureLoDButton(hideButton);

    infoHBox.getChildren().add(hideButton);
    //setup description label
    eventTypeImageView.setImage(getEventType().getFXImage());
    descrLabel.setPrefWidth(USE_COMPUTED_SIZE);
    descrLabel.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);
    descrLabel.setGraphic(eventTypeImageView);

    setAlignment(subNodePane, Pos.BOTTOM_LEFT);
    for (EventCluster cluster : eventStripe.getClusters()) {
        EventClusterNode clusterNode = new EventClusterNode(chart, cluster, this);
        subNodes.add(clusterNode);
        subNodePane.getChildren().addAll(clusterNode);
    }

    getChildren().addAll(new VBox(infoHBox, subNodePane));
    setOnMouseClicked(new MouseClickHandler());
}