use of com.intellij.ui.tabs.impl.TabLabel in project intellij-community by JetBrains.
the class TableLayout method layoutTable.
public LayoutPassInfo layoutTable(List<TabInfo> visibleInfos) {
myTabs.resetLayout(true);
final TablePassInfo data = computeLayoutTable(visibleInfos);
final Insets insets = myTabs.getLayoutInsets();
int eachY = insets.top;
int eachX;
int row = 0;
final int tabUnderlineFix = myTabs.isEditorTabs() ? myTabs.getActiveTabUnderlineHeight() : 0;
for (TableRow eachRow : data.table) {
eachX = insets.left;
int deltaToFit = 0;
boolean toAjust = false;
if (eachRow.width < data.toFitRec.width && data.table.size() > 1) {
deltaToFit = (int) Math.floor((double) (data.toFitRec.width - eachRow.width) / (double) eachRow.myColumns.size());
toAjust = true;
}
for (int i = 0; i < eachRow.myColumns.size(); i++) {
TabInfo tabInfo = eachRow.myColumns.get(i);
final TabLabel label = myTabs.myInfo2Label.get(tabInfo);
label.putClientProperty(JBTabsImpl.STRETCHED_BY_WIDTH, Boolean.valueOf(toAjust));
int width;
if (i < eachRow.myColumns.size() - 1 || !toAjust) {
width = label.getPreferredSize().width + deltaToFit;
} else {
width = data.toFitRec.width + insets.left - eachX;
}
myTabs.layout(label, eachX, eachY, width, row < data.table.size() - 1 ? myTabs.myHeaderFitSize.height - tabUnderlineFix : myTabs.myHeaderFitSize.height);
label.setAlignmentToCenter(deltaToFit > 0);
boolean lastCell = i == eachRow.myColumns.size() - 1;
eachX += width + (lastCell ? 0 : myTabs.getInterTabSpaceLength());
}
eachY += myTabs.myHeaderFitSize.height - 1 + myTabs.getInterTabSpaceLength() - (row < data.table.size() - 1 ? tabUnderlineFix : 0);
row++;
}
if (myTabs.getSelectedInfo() != null) {
final JBTabsImpl.Toolbar selectedToolbar = myTabs.myInfo2Toolbar.get(myTabs.getSelectedInfo());
int xAddin = 0;
if (!myTabs.myHorizontalSide && selectedToolbar != null && !selectedToolbar.isEmpty()) {
xAddin = selectedToolbar.getPreferredSize().width + 1;
myTabs.layout(selectedToolbar, insets.left + 1, eachY + 1, selectedToolbar.getPreferredSize().width, myTabs.getHeight() - eachY - insets.bottom - 2);
}
myTabs.layoutComp(xAddin, eachY + (myTabs.isEditorTabs() ? 0 : 2) - myTabs.getLayoutInsets().top, myTabs.getSelectedInfo().getComponent(), 0, 0);
}
myLastTableLayout = data;
return data;
}
Aggregations