Example usage for javafx.scene.control ContentDisplay RIGHT

List of usage examples for javafx.scene.control ContentDisplay RIGHT

Introduction

In this page you can find the example usage for javafx.scene.control ContentDisplay RIGHT.

Prototype

ContentDisplay RIGHT

To view the source code for javafx.scene.control ContentDisplay RIGHT.

Click Source Link

Document

Content will be placed at the right of the Label.

Usage

From source file:ijfx.ui.plugin.panel.OverlayPanel.java

public OverlayPanel() throws IOException {
    super();//from  w  w  w .j  a  va  2 s  .  c o m

    FXUtilities.injectFXML(this);

    keyColumn.setCellValueFactory(new PropertyValueFactory("name"));
    valueColumn.setCellValueFactory(new PropertyValueFactory("value"));

    tableView.setItems(entries);

    entries.add(new MyEntry("nothing", 0d));

    overlayNameField.setPromptText(EMPTY_FIELD);
    overlayNameField.textProperty().addListener(this::onOverlayNameChanged);

    overlayProperty.addListener(this::onOverlaySelectionChanged);

    chartVBox.getChildren().removeAll(areaChart, lineChart);

    overlayOptions = new OverlayOptions();

    optionsPane = new PopOver(overlayOptions);
    optionsPane.setArrowLocation(PopOver.ArrowLocation.RIGHT_TOP);
    optionsPane.setDetachable(true);
    optionsPane.setAutoHide(false);
    optionsPane.titleProperty().setValue("Overlay settings");
    optionsPane.setConsumeAutoHidingEvents(false);

    gearIcon = GlyphsDude.createIcon(FontAwesomeIcon.GEAR, "15");
    gearIcon.setOpacity(BASAL_OPACITY);
    gearIcon.setOnMouseEntered(e -> gearIcon.setOpacity(1.0));
    gearIcon.setOnMouseExited(e -> gearIcon.setOpacity(BASAL_OPACITY));
    gearIcon.addEventHandler(MouseEvent.MOUSE_CLICKED, this::onGearClicked);
    gearIcon.addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
        e.consume();
    });
    gearIcon.addEventHandler(MouseEvent.MOUSE_RELEASED, e -> {
        e.consume();
    });

    chartTitledPane.setGraphic(gearIcon);
    chartTitledPane.setContentDisplay(ContentDisplay.RIGHT);
    chartTitledPane.graphicTextGapProperty().setValue(TEXT_GAP);
}

From source file:ijfx.ui.plugin.overlay.OverlayPanel.java

public OverlayPanel() throws IOException {
    super();//  w  w  w . jav  a2s. c  o m

    FXUtilities.injectFXML(this);

    keyColumn.setCellValueFactory(new PropertyValueFactory("name"));
    valueColumn.setCellValueFactory(new PropertyValueFactory("value"));

    tableView.setItems(entries);

    entries.add(new MyEntry("nothing", 0d));

    overlayNameField.setPromptText(EMPTY_FIELD);
    overlayNameField.textProperty().addListener(this::onOverlayNameChanged);

    overlayProperty.addListener(this::onOverlaySelectionChanged);

    chartVBox.getChildren().removeAll(areaChart, lineChart);

    overlayOptions = new OverlayOptions();

    optionsPane = new PopOver(overlayOptions);
    optionsPane.setArrowLocation(PopOver.ArrowLocation.RIGHT_TOP);
    optionsPane.setDetachable(true);
    optionsPane.setAutoHide(false);
    optionsPane.titleProperty().setValue("Overlay settings");
    optionsPane.setConsumeAutoHidingEvents(false);

    gearIcon = GlyphsDude.createIcon(FontAwesomeIcon.GEAR, "15");
    gearIcon.setOpacity(BASAL_OPACITY);
    gearIcon.setOnMouseEntered(e -> gearIcon.setOpacity(1.0));
    gearIcon.setOnMouseExited(e -> gearIcon.setOpacity(BASAL_OPACITY));
    gearIcon.addEventHandler(MouseEvent.MOUSE_CLICKED, this::onGearClicked);
    gearIcon.addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
        e.consume();
    });
    gearIcon.addEventHandler(MouseEvent.MOUSE_RELEASED, e -> {
        e.consume();
    });

    chartTitledPane.setGraphic(gearIcon);
    chartTitledPane.setContentDisplay(ContentDisplay.RIGHT);
    chartTitledPane.graphicTextGapProperty().setValue(TEXT_GAP);

    // channeling all the DataViewUpdatedEvent so it updates the
    // current selected overlay
    eventBus.getStream(OverlayUpdatedEvent.class)
            .filter(event -> event.getObject().equals(overlayProperty.getValue()))
            .subscribe(event -> Platform.runLater(this::updateStats));

    eventBus.getStream(DataViewUpdatedEvent.class).map(event -> event.getView())
            .filter(view -> view instanceof OverlayView).cast(OverlayView.class)
            .filter(view -> view.isSelected()).throttleWithTimeout(1000, TimeUnit.MILLISECONDS)
            .subscribe(overlay -> {
                overlayProperty.setValue(overlay.getData());
            });

    eventBus.getStream(DataViewUpdatedEvent.class).filter(event -> event.getView() instanceof DatasetView)
            .map(event -> event.getView()).cast(DatasetView.class).map(view -> {
                return view;
            }).filter(view -> currentDisplay().contains(view)).throttleWithTimeout(100, TimeUnit.MILLISECONDS)
            .subscribe(event -> Platform.runLater(this::updateStats));
    eventBus.getStream(DisplayUpdatedEvent.class).filter(event -> event.getDisplay() instanceof ImageDisplay)
            .subscribe(this::checkCurrentOverlay);
}