Example usage for com.intellij.openapi.ui ThreeComponentsSplitter setLastSize

List of usage examples for com.intellij.openapi.ui ThreeComponentsSplitter setLastSize

Introduction

In this page you can find the example usage for com.intellij.openapi.ui ThreeComponentsSplitter setLastSize.

Prototype

public void setLastSize(final int size) 

Source Link

Usage

From source file:com.android.tools.idea.editors.gfxtrace.GfxTraceViewPanel.java

License:Apache License

public void resize() {
    ThreeComponentsSplitter threePane = getThreePanes();

    assert (threePane.getLastComponent() instanceof JBSplitter);
    JBSplitter bottomSplitter = (JBSplitter) threePane.getLastComponent();

    assert (threePane.getInnerComponent() instanceof JBSplitter);
    JBSplitter middleSplitter = (JBSplitter) threePane.getInnerComponent();

    int scrubberHeight = getScrubberScrollPane().getMinimumSize().height;
    if (threePane.getFirstSize() < scrubberHeight) {
        int totalHeight = threePane.getHeight();
        int residualHeightAfter = Math.max(0, totalHeight - scrubberHeight);

        threePane.setFirstSize(scrubberHeight);
        int middleSize = middleSplitter.getPreferredSize().height;
        int bottomSize = bottomSplitter.getPreferredSize().height;
        if (bottomSize + middleSize > 0) {
            threePane.setLastSize(residualHeightAfter * bottomSize / (bottomSize + middleSize)); // Split the middle and bottom panes evenly.
        } else {/* w w  w .  ja v a2s .  c om*/
            threePane.setLastSize(residualHeightAfter / 2);
        }
    }
}