Example usage for com.vaadin.ui AbstractSplitPanel getSplitPosition

List of usage examples for com.vaadin.ui AbstractSplitPanel getSplitPosition

Introduction

In this page you can find the example usage for com.vaadin.ui AbstractSplitPanel getSplitPosition.

Prototype

public float getSplitPosition() 

Source Link

Document

Returns the current position of the splitter, in #getSplitPositionUnit() units.

Usage

From source file:org.lunifera.runtime.web.vaadin.databinding.component.internal.SplitPanelSplitPositionProperty.java

License:Open Source License

protected Object doGetValue(Object source) {
    AbstractSplitPanel component = (AbstractSplitPanel) source;
    return component.getSplitPosition();
}

From source file:org.lunifera.runtime.web.vaadin.databinding.component.internal.SplitPanelSplitPositionUnitProperty.java

License:Open Source License

protected void doSetValue(Object source, Object value) {
    AbstractSplitPanel component = (AbstractSplitPanel) source;
    component.setSplitPosition(component.getSplitPosition(), (Unit) value);
}

From source file:org.semanticsoft.vaaclipse.widgets.WorkbenchWindow.java

License:Open Source License

private void updateBounds(ComponentContainer container, Bounds currentBounds) {
    if (container instanceof BoundsinfoVerticalLayout) {
        BoundsinfoVerticalLayout bvl = (BoundsinfoVerticalLayout) container;
        bvl.setBounds(currentBounds);//from   w w w .j  av a  2s. c om
    } else if (container instanceof StackWidget) {
        StackWidget bvl = (StackWidget) container;
        bvl.setBounds(currentBounds);
    }

    if (container instanceof SashWidget) {
        AbstractSplitPanel splitPanel = (AbstractSplitPanel) container;
        float splitPos = splitPanel.getSplitPosition() / 100;
        if (splitPanel instanceof HorizontalSplitPanel) {
            int firstBoundsWidth = (int) (splitPos * currentBounds.w);
            if (splitPanel.getFirstComponent() instanceof ComponentContainer) {
                Bounds leftBounds = new Bounds(currentBounds.x, currentBounds.y, firstBoundsWidth,
                        currentBounds.h);
                updateBounds((ComponentContainer) splitPanel.getFirstComponent(), leftBounds);
            }

            if (splitPanel.getSecondComponent() instanceof ComponentContainer) {
                Bounds rightBounds = new Bounds(currentBounds.x + firstBoundsWidth, currentBounds.y,
                        (int) (currentBounds.w - firstBoundsWidth), currentBounds.h);
                updateBounds((ComponentContainer) splitPanel.getSecondComponent(), rightBounds);
            }
        } else if (splitPanel instanceof VerticalSplitPanel) {
            int firstBoundsHeight = (int) (splitPos * currentBounds.h);
            if (splitPanel.getFirstComponent() instanceof ComponentContainer) {
                Bounds leftBounds = new Bounds(currentBounds.x, currentBounds.y, currentBounds.w,
                        firstBoundsHeight);
                updateBounds((ComponentContainer) splitPanel.getFirstComponent(), leftBounds);
            }

            if (splitPanel.getSecondComponent() instanceof ComponentContainer) {
                Bounds rightBounds = new Bounds(currentBounds.x, currentBounds.y + firstBoundsHeight,
                        (int) (currentBounds.w), currentBounds.h - firstBoundsHeight);
                updateBounds((ComponentContainer) splitPanel.getSecondComponent(), rightBounds);
            }
        }
    } else if (container instanceof ComponentContainer) {
        Iterator<Component> it = container.getComponentIterator();
        while (it.hasNext()) {
            Component c = it.next();
            if (c instanceof ComponentContainer) {
                updateBounds((ComponentContainer) c, currentBounds);
            }
        }
    }
}