Search in sources :

Example 6 with SplitPane

use of org.apache.pivot.wtk.SplitPane in project pivot by apache.

the class TerraSplitPaneSkin method install.

@Override
public void install(Component component) {
    super.install(component);
    SplitPane splitPane = (SplitPane) component;
    splitPane.getSplitPaneListeners().add(this);
    splitPane.add(splitter);
    updateSplitterCursor();
}
Also used : SplitPane(org.apache.pivot.wtk.SplitPane)

Example 7 with SplitPane

use of org.apache.pivot.wtk.SplitPane in project pivot by apache.

the class TerraSplitPaneSkin method getPreferredSize.

@Override
public Dimensions getPreferredSize() {
    int preferredWidth = splitterThickness;
    int preferredHeight = splitterThickness;
    SplitPane splitPane = (SplitPane) getComponent();
    Component topLeft = splitPane.getTopLeft();
    if (topLeft != null) {
        Dimensions size = topLeft.getPreferredSize();
        preferredWidth += size.width;
        preferredHeight += size.height;
    }
    Component bottomRight = splitPane.getBottomRight();
    if (bottomRight != null) {
        Dimensions size = bottomRight.getPreferredSize();
        preferredWidth += size.width;
        preferredHeight += size.height;
    }
    return new Dimensions(preferredWidth, preferredHeight);
}
Also used : Dimensions(org.apache.pivot.wtk.Dimensions) SplitPane(org.apache.pivot.wtk.SplitPane) Component(org.apache.pivot.wtk.Component)

Example 8 with SplitPane

use of org.apache.pivot.wtk.SplitPane in project pivot by apache.

the class TerraSplitPaneSkin method updateSplitterCursor.

private void updateSplitterCursor() {
    Cursor cursor = Cursor.DEFAULT;
    SplitPane splitPane = (SplitPane) getComponent();
    if (!splitPane.isLocked()) {
        switch(splitPane.getOrientation()) {
            case HORIZONTAL:
                {
                    switch(splitPane.getPrimaryRegion()) {
                        case TOP_LEFT:
                            {
                                cursor = Cursor.RESIZE_EAST;
                                break;
                            }
                        case BOTTOM_RIGHT:
                            {
                                cursor = Cursor.RESIZE_WEST;
                                break;
                            }
                        default:
                            {
                                break;
                            }
                    }
                    break;
                }
            case VERTICAL:
                {
                    switch(splitPane.getPrimaryRegion()) {
                        case TOP_LEFT:
                            {
                                cursor = Cursor.RESIZE_SOUTH;
                                break;
                            }
                        case BOTTOM_RIGHT:
                            {
                                cursor = Cursor.RESIZE_NORTH;
                                break;
                            }
                        default:
                            {
                                break;
                            }
                    }
                    break;
                }
            default:
                {
                    break;
                }
        }
    }
    splitter.setCursor(cursor);
}
Also used : SplitPane(org.apache.pivot.wtk.SplitPane) Cursor(org.apache.pivot.wtk.Cursor)

Aggregations

SplitPane (org.apache.pivot.wtk.SplitPane)8 Component (org.apache.pivot.wtk.Component)5 Cursor (org.apache.pivot.wtk.Cursor)1 Dimensions (org.apache.pivot.wtk.Dimensions)1 Orientation (org.apache.pivot.wtk.Orientation)1