Example usage for javafx.scene.effect DropShadow DropShadow

List of usage examples for javafx.scene.effect DropShadow DropShadow

Introduction

In this page you can find the example usage for javafx.scene.effect DropShadow DropShadow.

Prototype

public DropShadow(double radius, Color color) 

Source Link

Document

Creates a new instance of DropShadow with specified radius and color.

Usage

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

public AggregateEventNode(final AggregateEvent event, AggregateEventNode parentEventNode,
        EventDetailChart chart) {/*from   w  ww.j  a v a2  s . c  om*/
    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.EventNodeBase.java

final void showHoverControls(final boolean showControls) {
    Effect dropShadow = dropShadowMap.computeIfAbsent(getEventType(),
            eventType -> new DropShadow(-10, eventType.getColor()));
    setEffect(showControls ? dropShadow : null);
    installTooltip();// w ww.java 2  s .co  m
    enableTooltip(showControls);
    installActionButtons();

    TimeLineController controller = getChartLane().getController();

    if (controller.getPinnedEvents().contains(tlEvent)) {
        pinButton.setOnAction(actionEvent -> {
            new UnPinEventAction(controller, tlEvent).handle(actionEvent);
            showHoverControls(true);
        });
        pinButton.setGraphic(new ImageView(UNPIN));
    } else {
        pinButton.setOnAction(actionEvent -> {
            new PinEventAction(controller, tlEvent).handle(actionEvent);
            showHoverControls(true);
        });
        pinButton.setGraphic(new ImageView(PIN));
    }

    show(controlsHBox, showControls);
    if (parentNode != null) {
        parentNode.showHoverControls(false);
    }
}