Example usage for javafx.geometry Bounds getMaxY

List of usage examples for javafx.geometry Bounds getMaxY

Introduction

In this page you can find the example usage for javafx.geometry Bounds getMaxY.

Prototype

public final double getMaxY() 

Source Link

Document

The y coordinate of the lower-right corner of this Bounds .

Usage

From source file:Main.java

private void playLayoutBoundsPathTransition() {
    Bounds b = mainRect.getLayoutBounds();
    Path path = new Path();
    path.getElements().add(new MoveTo(b.getMinX(), b.getMinY()));
    path.getElements().add(new LineTo(b.getMaxX(), b.getMinY()));
    path.getElements().add(new LineTo(b.getMaxX(), b.getMaxY()));
    path.getElements().add(new LineTo(b.getMinX(), b.getMaxY()));
    path.getElements().add(new LineTo(b.getMinX(), b.getMinY()));

    LAYOUT_BOUNDS_PATH_TRANSITION.setPath(path);
    LAYOUT_BOUNDS_PATH_TRANSITION.play();
}

From source file:Main.java

private void playParentBoundsPathTransition() {
    Bounds b = mainRect.getBoundsInParent();

    Path path = new Path();
    path.getElements().add(new MoveTo(b.getMinX(), b.getMinY()));
    path.getElements().add(new LineTo(b.getMaxX(), b.getMinY()));
    path.getElements().add(new LineTo(b.getMaxX(), b.getMaxY()));
    path.getElements().add(new LineTo(b.getMinX(), b.getMaxY()));
    path.getElements().add(new LineTo(b.getMinX(), b.getMinY()));

    PARENT_BOUNDS_PATH_TRANSITION.setPath(path);
    PARENT_BOUNDS_PATH_TRANSITION.play();
}

From source file:Main.java

private void playLocalBoundsPathTransition() {
    Bounds b = mainRect.getBoundsInLocal();
    Path path = new Path();
    path.getElements().add(new MoveTo(b.getMinX(), b.getMinY()));
    //path.getElements().add(new LineTo(b.getMinX(), b.getMinY()));
    path.getElements().add(new LineTo(b.getMaxX(), b.getMinY()));
    path.getElements().add(new LineTo(b.getMaxX(), b.getMaxY()));
    path.getElements().add(new LineTo(b.getMinX(), b.getMaxY()));
    path.getElements().add(new LineTo(b.getMinX(), b.getMinY()));

    LOCAL_BOUNDS_PATH_TRANSITION.setPath(path);
    LOCAL_BOUNDS_PATH_TRANSITION.play();
}

From source file:org.sleuthkit.autopsy.imageanalyzer.gui.GroupPane.java

@ThreadConfined(type = ThreadType.UI)
private void scrollToFileID(final Long newFileID) {
    if (newFileID == null) {
        //scrolling to no file doesn't make sense, so abort.
        return;/*from   w  w  w .  j a v  a  2s .  c  o m*/
    }

    int selectedIndex = grouping.get().fileIds().indexOf(newFileID);

    if (selectedIndex == -1) {
        //somehow we got passed a file id that isn't in the curent group.
        //this should never happen, but if it does everything is going to fail, so abort.
        return;
    }

    Optional<ScrollBar> scrollBarOptional = getScrollBar();
    scrollBarOptional.ifPresent((ScrollBar scrollBar) -> {
        DrawableCell cell = cellMap.get(newFileID);

        //while there is no tile/cell for the given id, scroll based on index in group
        while (cell == null) {
            Integer minIndex = cellMap.keySet().stream().map(grouping.get().fileIds()::indexOf)
                    .min(Integer::compare).get();
            Integer maxIndex = cellMap.keySet().stream().map(grouping.get().fileIds()::indexOf)
                    .max(Integer::compare).get();

            if (selectedIndex < minIndex) {
                scrollBar.decrement();
            } else if (selectedIndex > maxIndex) {
                scrollBar.increment();
            } else {
                //sometimes the cellMap isn't up to date, so move the position arbitrarily to update the cellMap
                //TODO: this is clunky and slow, find a better way to do this
                scrollBar.adjustValue(.5);
            }
            cell = cellMap.get(newFileID);

        }

        final Bounds gridViewBounds = gridView.localToScene(gridView.getBoundsInLocal());

        Bounds tileBounds = cell.localToScene(cell.getBoundsInLocal());

        //while the cell is not within the visisble bounds of the gridview, scroll based on screen coordinates
        int i = 0;

        while (gridViewBounds.contains(tileBounds) == false && (i++ < 100)) {

            if (tileBounds.getMinY() < gridViewBounds.getMinY()) {
                scrollBar.decrement();
            } else if (tileBounds.getMaxY() > gridViewBounds.getMaxY()) {
                scrollBar.increment();
            }
            tileBounds = cell.localToScene(cell.getBoundsInLocal());
        }
    });
}

From source file:org.sleuthkit.autopsy.imagegallery.gui.drawableviews.GroupPane.java

@ThreadConfined(type = ThreadType.JFX)
private void scrollToFileID(final Long newFileID) {
    if (newFileID == null) {
        return; //scrolling to no file doesn't make sense, so abort.
    }/*w  w w .  j ava2s .c om*/

    final ObservableList<Long> fileIds = gridView.getItems();

    int selectedIndex = fileIds.indexOf(newFileID);
    if (selectedIndex == -1) {
        //somehow we got passed a file id that isn't in the curent group.
        //this should never happen, but if it does everything is going to fail, so abort.
        return;
    }

    getScrollBar().ifPresent(scrollBar -> {
        DrawableCell cell = cellMap.get(newFileID);

        //while there is no tile/cell for the given id, scroll based on index in group
        while (isNull(cell)) {
            //TODO:  can we maintain a cached mapping from fileID-> index to speed up performance
            //get the min and max index of files that are in the cellMap
            Integer minIndex = cellMap.keySet().stream().mapToInt(fileID -> fileIds.indexOf(fileID)).min()
                    .getAsInt();
            Integer maxIndex = cellMap.keySet().stream().mapToInt(fileID -> fileIds.indexOf(fileID)).max()
                    .getAsInt();

            //[minIndex, maxIndex] is the range of indexes in the fileIDs list that are currently displayed
            if (selectedIndex < minIndex) {
                scrollBar.decrement();
            } else if (selectedIndex > maxIndex) {
                scrollBar.increment();
            } else {
                //sometimes the cellMap isn't up to date, so move the position arbitrarily to update the cellMap
                //TODO: this is clunky and slow, find a better way to do this
                scrollBar.adjustValue(.5);
            }
            cell = cellMap.get(newFileID);
        }

        final Bounds gridViewBounds = gridView.localToScene(gridView.getBoundsInLocal());
        Bounds tileBounds = cell.localToScene(cell.getBoundsInLocal());

        //while the cell is not within the visisble bounds of the gridview, scroll based on screen coordinates
        int i = 0;
        while (gridViewBounds.contains(tileBounds) == false && (i++ < 100)) {

            if (tileBounds.getMinY() < gridViewBounds.getMinY()) {
                scrollBar.decrement();
            } else if (tileBounds.getMaxY() > gridViewBounds.getMaxY()) {
                scrollBar.increment();
            }
            tileBounds = cell.localToScene(cell.getBoundsInLocal());
        }
    });
}

From source file:view.EditorView.java

@FXML
void insertRoomOnMouseDragged(MouseEvent event) {
    Bounds scrollPaneBounds = scrollPaneContainer.localToScene(scrollPane.getBoundsInLocal());
    if (event.getSceneX() >= scrollPaneBounds.getMinX() && event.getSceneX() <= scrollPaneBounds.getMaxX()
            && event.getSceneY() >= scrollPaneBounds.getMinY()
            && event.getSceneY() <= scrollPaneBounds.getMaxY()) {
        // we're in the scroll pane
        if (!isMouseOverDrawing) {
            scrollPaneOnMouseEntered(event);
        }/*ww w .j  a  va2 s .  c om*/
    } else {
        if (isMouseOverDrawing) {
            scrollPaneOnMouseExited(event);
        }
    }
    scrollPaneOnMouseMoved(event);
}