public GridImpl(ViewContextEx viewContext, String sessionName) { myViewContext = viewContext; mySessionName = sessionName; Disposer.register(myViewContext, this); Disposer.register(this, myTopSplit); Placeholder left = new Placeholder(); myPlaceInGrid2Cell.put( PlaceInGrid.left, new GridCellImpl(myViewContext, this, left, PlaceInGrid.left)); Placeholder center = new Placeholder(); myPlaceInGrid2Cell.put( PlaceInGrid.center, new GridCellImpl(myViewContext, this, center, PlaceInGrid.center)); Placeholder right = new Placeholder(); myPlaceInGrid2Cell.put( PlaceInGrid.right, new GridCellImpl(myViewContext, this, right, PlaceInGrid.right)); Placeholder bottom = new Placeholder(); myPlaceInGrid2Cell.put( PlaceInGrid.bottom, new GridCellImpl(myViewContext, this, bottom, PlaceInGrid.bottom)); setContent(mySplitter); setOpaque(false); setFocusCycleRoot(true); myTopSplit.setFirstComponent(left); myTopSplit.setInnerComponent(center); myTopSplit.setLastComponent(right); myTopSplit.setMinSize(48); mySplitter.setFirstComponent(myTopSplit); mySplitter.setSecondComponent(bottom); }
float getRightProportion() { final float totalSize = myTopSplit.getOrientation() ? myTopSplit.getHeight() : myTopSplit.getWidth(); final float componentSize = myTopSplit.getLastSize(); return componentSize / (totalSize - 2.0f * myTopSplit.getDividerWidth()); }
void setRightProportion(float proportion) { final int componentSize = myTopSplit.getOrientation() ? myTopSplit.getHeight() : myTopSplit.getWidth(); myTopSplit.setLastSize( (int) (proportion * (float) (componentSize - 2 * myTopSplit.getDividerWidth()))); }
void setLeftProportion(float proportion) { final int totalSize = myTopSplit.getOrientation() ? myTopSplit.getHeight() : myTopSplit.getWidth(); myTopSplit.setFirstSize( (int) (proportion * (float) (totalSize - 2 * myTopSplit.getDividerWidth()))); }