|
|
|
@ -756,6 +756,54 @@ public class MultiTemplateTabPane extends JComponent {
|
|
|
|
|
minPaintIndex = 0; |
|
|
|
|
maxPaintIndex = openedTemplate.size() - 1; |
|
|
|
|
} |
|
|
|
|
//需要根据每个tab的宽度重新check下实际的maxPaintIndex和minPaintIndex
|
|
|
|
|
checkActualPaintIndex(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 由于可能存在宽度为0的tab,所以这边需要重新check下 |
|
|
|
|
*/ |
|
|
|
|
private void checkActualPaintIndex(){ |
|
|
|
|
//先计算出需要补充的tab个数
|
|
|
|
|
int a = 0; |
|
|
|
|
for (int i = minPaintIndex; i <= maxPaintIndex; i++) { |
|
|
|
|
JTemplate template = openedTemplate.get(i); |
|
|
|
|
if (!showJTemplateTab(template)) { |
|
|
|
|
a++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (a == 0){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
//先往后补
|
|
|
|
|
if (maxPaintIndex < openedTemplate.size() - 1) { |
|
|
|
|
for (int i = maxPaintIndex + 1; i < openedTemplate.size(); i++) { |
|
|
|
|
JTemplate template = openedTemplate.get(i); |
|
|
|
|
if (showJTemplateTab(template)) { |
|
|
|
|
a--; |
|
|
|
|
} |
|
|
|
|
maxPaintIndex++; |
|
|
|
|
if (a == 0){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//再往前补
|
|
|
|
|
if (minPaintIndex > 0){ |
|
|
|
|
for (int i = minPaintIndex - 1; i > 0; i--) { |
|
|
|
|
JTemplate template = openedTemplate.get(i); |
|
|
|
|
if (showJTemplateTab(template)) { |
|
|
|
|
a--; |
|
|
|
|
} |
|
|
|
|
minPaintIndex--; |
|
|
|
|
if (a == 0){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|