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

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

Introduction

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

Prototype

public int getFirstSize() 

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 {//www  . j  a v a 2s .  com
            threePane.setLastSize(residualHeightAfter / 2);
        }
    }
}