Package javafx.geometry

Examples of javafx.geometry.Side


        timeline.getKeyFrames().add(new KeyFrame(duration, func, keyValue));
        return timeline;
    }

    private boolean isHorizontal() {
        Side tabPosition = getSkinnable().getSide();
        return Side.TOP.equals(tabPosition) || Side.BOTTOM.equals(tabPosition);
    }
View Full Code Here


    }

    @Override protected void layoutChildren(final double x, final double y,
            final double w, final double h) {
        TabPane tabPane = getSkinnable();
        Side tabPosition = tabPane.getSide();

        double headerHeight = snapSize(tabHeaderArea.prefHeight(-1));
        double tabsStartX = tabPosition.equals(Side.RIGHT)? x + w - headerHeight : x;
        double tabsStartY = tabPosition.equals(Side.BOTTOM)? y + h - headerHeight : y;

        if (tabPosition.equals(tabPosition.TOP)) {
            tabHeaderArea.resize(w, headerHeight);
            tabHeaderArea.relocate(tabsStartX, tabsStartY);
            tabHeaderArea.getTransforms().clear();
            tabHeaderArea.getTransforms().add(new Rotate(getRotation(tabPosition.TOP)));
        } else if (tabPosition.equals(tabPosition.BOTTOM)) {
            tabHeaderArea.resize(w, headerHeight);
            tabHeaderArea.relocate(w, tabsStartY - headerHeight);
            tabHeaderArea.getTransforms().clear();
            tabHeaderArea.getTransforms().add(new Rotate(getRotation(tabPosition.BOTTOM), 0, headerHeight));
        } else if (tabPosition.equals(tabPosition.LEFT)) {
            tabHeaderArea.resize(h, headerHeight);
            tabHeaderArea.relocate(tabsStartX + headerHeight, h - headerHeight);
            tabHeaderArea.getTransforms().clear();
            tabHeaderArea.getTransforms().add(new Rotate(getRotation(tabPosition.LEFT), 0, headerHeight));
        } else if (tabPosition.equals(tabPosition.RIGHT)) {
            tabHeaderArea.resize(h, headerHeight);
            tabHeaderArea.relocate(tabsStartX, y - headerHeight);
            tabHeaderArea.getTransforms().clear();
            tabHeaderArea.getTransforms().add(new Rotate(getRotation(tabPosition.RIGHT), 0, headerHeight));
        }

        tabHeaderAreaClipRect.setX(0);
        tabHeaderAreaClipRect.setY(0);
        if (isHorizontal()) {
            tabHeaderAreaClipRect.setWidth(w);
        } else {
            tabHeaderAreaClipRect.setWidth(h);
        }
        tabHeaderAreaClipRect.setHeight(headerHeight);

        // ==================================
        // position the tab content for the selected tab only
        // ==================================
        // if the tabs are on the left, the content needs to be indented
        double contentStartX = 0;
        double contentStartY = 0;

        if (tabPosition.equals(tabPosition.TOP)) {
            contentStartX = x;
            contentStartY = y + headerHeight;
            if (isFloatingStyleClass()) {
                // This is to hide the top border content
                contentStartY -= 1;
            }
        } else if (tabPosition.equals(tabPosition.BOTTOM)) {
            contentStartX = x;
            contentStartY = y;
            if (isFloatingStyleClass()) {
                // This is to hide the bottom border content
                contentStartY = 1;
            }
        } else if (tabPosition.equals(tabPosition.LEFT)) {
            contentStartX = x + headerHeight;
            contentStartY = y;
            if (isFloatingStyleClass()) {
                // This is to hide the left border content
                contentStartX -= 1;
            }
        } else if (tabPosition.equals(tabPosition.RIGHT)) {
            contentStartX = x;
            contentStartY = y;
            if (isFloatingStyleClass()) {
                // This is to hide the right border content
                contentStartX = 1;
View Full Code Here

                            scrollToSelectedTab(selectedTabOffset, previousSelectedTabOffset);
                        }
                        isSelectingTab = false;
                    }

                    Side tabPosition = getSkinnable().getSide();
                    double tabBackgroundHeight = snapSize(prefHeight(-1));
                    double tabX = (tabPosition.equals(Side.LEFT) || tabPosition.equals(Side.BOTTOM)) ?
                        snapSize(getWidth()) - getScrollOffset() : getScrollOffset();

                    updateHeaderClip();
                    for (Node node : getChildren()) {
                        TabHeaderSkin tabHeader = (TabHeaderSkin)node;
                        // size and position the header relative to the other headers
                        double tabHeaderPrefWidth = snapSize(tabHeader.prefWidth(-1));
                        double tabHeaderPrefHeight = snapSize(tabHeader.prefHeight(-1));
                        tabHeader.resize(tabHeaderPrefWidth, tabHeaderPrefHeight);
                        // This ensures that the tabs are located in the correct position
                        // when there are tabs of differing heights.
                        double startY = tabPosition.equals(Side.BOTTOM) ?
                            0 : tabBackgroundHeight - tabHeaderPrefHeight - snappedBottomInset();
                        if (tabPosition.equals(Side.LEFT) || tabPosition.equals(Side.BOTTOM)) {
                            // build from the right
                            tabX -= tabHeaderPrefWidth;
                            tabHeader.relocate(tabX, startY);
                        } else {
                            // build from the left
View Full Code Here

            getChildren().addAll(headerBackground, headersRegion, controlButtons);

        }

        private void updateHeaderClip() {
            Side tabPosition = getSkinnable().getSide();

            double x = 0;
            double y = 0;
            double clipWidth = 0;
            double clipHeight = 0;
            double maxWidth = 0;
            double shadowRadius = 0;
            double clipOffset = firstTabIndent();
            double controlButtonPrefWidth = snapSize(controlButtons.prefWidth(-1));
            double headersPrefWidth = snapSize(headersRegion.prefWidth(-1));
            double headersPrefHeight = snapSize(headersRegion.prefHeight(-1));

            // Add the spacer if isShowTabsMenu is true.
            if (controlButtonPrefWidth > 0) {
                controlButtonPrefWidth = controlButtonPrefWidth + SPACER;
            }

            if (headersRegion.getEffect() instanceof DropShadow) {
                DropShadow shadow = (DropShadow)headersRegion.getEffect();
                shadowRadius = shadow.getRadius();
            }

            maxWidth = snapSize(getWidth()) - controlButtonPrefWidth - clipOffset;
            if (tabPosition.equals(Side.LEFT) || tabPosition.equals(Side.BOTTOM)) {
                if (headersPrefWidth < maxWidth) {
                    clipWidth = headersPrefWidth + shadowRadius;
                } else {
                    x = headersPrefWidth - maxWidth;
                    clipWidth = maxWidth + shadowRadius;
View Full Code Here

        // ----- End of control button scrolling support
        private void scroll(double d) {
            if (tabsFit()) {
                return;
            }
            Side tabPosition = getSkinnable().getSide();
            double headerPrefWidth = snapSize(headersRegion.prefWidth(-1));
            double controlTabWidth = snapSize(controlButtons.prefWidth(-1));
            double max = getWidth() - headerPrefWidth - controlTabWidth;
            double delta = tabPosition.equals(Side.LEFT) || tabPosition.equals(Side.BOTTOM) ? -d : d;
            double newOffset = getScrollOffset() + delta;
            setScrollOffset(newOffset >= 0 ? 0.0F : (newOffset <= max ? max : newOffset));
        }
View Full Code Here

           
            double startX = 0;
            double startY = 0;
            double controlStartX = 0;
            double controlStartY = 0;
            Side tabPosition = getSkinnable().getSide();

            if (tabPosition.equals(Side.TOP)) {
                if (getWidth() > headersPrefWidth + leftInset || alignment == HPos.LEFT) {
                    startX = snapSize(leftInset);
                } else if (alignment == HPos.CENTER) {
                    startX = snapSize(leftInset * 2 + (headersPrefWidth - getWidth()) / 2);
                } else if (alignment == HPos.RIGHT) {
                    startX = snapSize(leftInset * 3 + (headersPrefWidth - getWidth()));
                }
                startY = tabBackgroundHeight - headersPrefHeight - snapSize(bottomInset);
                controlStartX = w - btnWidth + snapSize(leftInset);
                controlStartY = snapSize(getHeight()) - controlButtons.getControlTabHeight() - snapSize(bottomInset);
            } else if (tabPosition.equals(Side.RIGHT)) {
                if (getWidth() > headersPrefWidth + topInset || alignment == HPos.LEFT) {
                    startX = snapSize(topInset);
                } else if (alignment == HPos.RIGHT) {
                    startX = snapSize(topInset * 3 + (headersPrefWidth - getWidth()));
                } else if (alignment == HPos.CENTER) {
                    startX = snapSize(topInset * 2 + (headersPrefWidth - getWidth()) / 2);
                }
                startY = tabBackgroundHeight - headersPrefHeight - snapSize(leftInset);
                controlStartX = w - btnWidth + snapSize(topInset);
                controlStartY = snapSize(getHeight()) - controlButtons.getControlTabHeight() - snapSize(leftInset);
            } else if (tabPosition.equals(Side.BOTTOM)) {
                if (getWidth() > headersPrefWidth + leftInset || alignment == HPos.RIGHT) {
                    startX = snapSize(leftInset);
                } else if (alignment == HPos.CENTER) {
                    startX = snapSize(leftInset / 3 - (headersPrefWidth - getWidth()) / 2);
                } else if (alignment == HPos.LEFT) {
                    startX = snapSize(getWidth() - leftInset - headersPrefWidth);
                }
                startY = tabBackgroundHeight - headersPrefHeight - snapSize(topInset);
                controlStartX = snapSize(rightInset);
                controlStartY = snapSize(getHeight()) - controlButtons.getControlTabHeight() - snapSize(topInset);
            } else if (tabPosition.equals(Side.LEFT)) {
                if (getWidth() > headersPrefWidth + topInset || alignment == HPos.RIGHT) {
                    startX = snapSize(topInset);
                } else if(alignment == HPos.LEFT){
                    startX = snapSize(getWidth()) - headersPrefWidth - snapSize(getInsets().getTop());
                } else if(alignment == HPos.CENTER ) {
View Full Code Here

            });   

            // initialize pseudo-class state
            pseudoClassStateChanged(SELECTED_PSEUDOCLASS_STATE, tab.isSelected());
            pseudoClassStateChanged(DISABLED_PSEUDOCLASS_STATE, tab.isDisable());
            final Side side = getSkinnable().getSide();
            pseudoClassStateChanged(TOP_PSEUDOCLASS_STATE, (side == Side.TOP));
            pseudoClassStateChanged(RIGHT_PSEUDOCLASS_STATE, (side == Side.RIGHT));
            pseudoClassStateChanged(BOTTOM_PSEUDOCLASS_STATE, (side == Side.BOTTOM));
            pseudoClassStateChanged(LEFT_PSEUDOCLASS_STATE, (side == Side.LEFT));
        }
View Full Code Here

            // --- Skinnable properties
            else if ("TAB_CLOSING_POLICY".equals(p)) {
                inner.requestLayout();
                requestLayout();
            } else if ("SIDE".equals(p)) {
                final Side side = getSkinnable().getSide();
                pseudoClassStateChanged(TOP_PSEUDOCLASS_STATE, (side == Side.TOP));
                pseudoClassStateChanged(RIGHT_PSEUDOCLASS_STATE, (side == Side.RIGHT));
                pseudoClassStateChanged(BOTTOM_PSEUDOCLASS_STATE, (side == Side.BOTTOM));
                pseudoClassStateChanged(LEFT_PSEUDOCLASS_STATE, (side == Side.LEFT));
                inner.setRotate(side == Side.BOTTOM ? 180.0F : 0.0F);
View Full Code Here

                    }
                    return height;
                }

                @Override protected void layoutChildren() {
                    Side tabPosition = getSkinnable().getSide();
                    double x = 0.0F;
                    //padding.left;
                    double y = snappedTopInset();
                    double h = snapSize(getHeight()) - y + snappedBottomInset();
                    // when on the left or bottom, we need to position the tabs controls
                    // button such that it is the furtherest button away from the tabs.
                    if (tabPosition.equals(Side.BOTTOM) || tabPosition.equals(Side.LEFT)) {
                        x += positionTabsMenu(x, y, h, true);
                    } else {
                        x += positionTabsMenu(x, y, h, false);
                    }
                }

                private double positionTabsMenu(double x, double y, double h, boolean showSep) {
                    double newX = x;
                    if (isShowTabsMenu()) {
                        // DOWN ARROW BUTTON
                        positionArrow(downArrowBtn, downArrow, newX, y, maxArrowWidth, h);
                        newX += maxArrowWidth;
                    }
                    return newX;
                }

                private void positionArrow(Pane btn, StackPane arrow, double x, double y, double width, double height) {
                    btn.resize(width, height);
                    positionInArea(btn, x, y, width, height, /*baseline ignored*/0,
                            HPos.CENTER, VPos.CENTER);
                    // center arrow region within arrow button
                    double arrowWidth = snapSize(arrow.prefWidth(-1));
                    double arrowHeight = snapSize(arrow.prefHeight(-1));
                    arrow.resize(arrowWidth, arrowHeight);
                    positionInArea(arrow, btn.snappedLeftInset(), btn.snappedTopInset(),
                            width - btn.snappedLeftInset() - btn.snappedRightInset(),
                            height - btn.snappedTopInset() - btn.snappedBottomInset(),
                            /*baseline ignored*/0, HPos.CENTER, VPos.CENTER);
                }
            };
            inner.getStyleClass().add("container");
            inner.getChildren().add(downArrowBtn);

            getChildren().add(inner);

            tabPane.sideProperty().addListener(new InvalidationListener() {
                @Override public void invalidated(Observable valueModel) {
                    Side tabPosition = getSkinnable().getSide();
                    downArrow.setRotate(tabPosition.equals(Side.BOTTOM)? 180.0F : 0.0F);
                }
            });
            tabPane.getTabs().addListener(new ListChangeListener<Tab>() {
                @Override public void onChanged(Change<? extends Tab> c) {
                    setupPopupMenu();
View Full Code Here

TOP

Related Classes of javafx.geometry.Side

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.