|
|
@ -760,12 +760,11 @@ public class MultiTemplateTabPane extends JComponent { |
|
|
|
checkActualPaintIndex(); |
|
|
|
checkActualPaintIndex(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 由于可能存在宽度为0的tab,所以这边需要重新check下 |
|
|
|
* 先计算出需要补充的tab个数 |
|
|
|
|
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void checkActualPaintIndex(){ |
|
|
|
private int calTabCountComplemented(){ |
|
|
|
//先计算出需要补充的tab个数
|
|
|
|
|
|
|
|
int a = 0; |
|
|
|
int a = 0; |
|
|
|
for (int i = minPaintIndex; i <= maxPaintIndex; i++) { |
|
|
|
for (int i = minPaintIndex; i <= maxPaintIndex; i++) { |
|
|
|
JTemplate template = openedTemplate.get(i); |
|
|
|
JTemplate template = openedTemplate.get(i); |
|
|
@ -773,37 +772,42 @@ public class MultiTemplateTabPane extends JComponent { |
|
|
|
a++; |
|
|
|
a++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (a == 0){ |
|
|
|
return a; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 由于可能存在宽度为0的tab,所以这边需要重新check下,先往后补,再往前补 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void checkActualPaintIndex(){ |
|
|
|
|
|
|
|
int tabCount = calTabCountComplemented(); |
|
|
|
|
|
|
|
if (tabCount == 0){ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
//先往后补
|
|
|
|
|
|
|
|
if (maxPaintIndex < openedTemplate.size() - 1) { |
|
|
|
if (maxPaintIndex < openedTemplate.size() - 1) { |
|
|
|
for (int i = maxPaintIndex + 1; i < openedTemplate.size(); i++) { |
|
|
|
for (int i = maxPaintIndex + 1; i < openedTemplate.size(); i++) { |
|
|
|
JTemplate template = openedTemplate.get(i); |
|
|
|
JTemplate template = openedTemplate.get(i); |
|
|
|
if (showJTemplateTab(template)) { |
|
|
|
if (showJTemplateTab(template)) { |
|
|
|
a--; |
|
|
|
tabCount--; |
|
|
|
} |
|
|
|
} |
|
|
|
maxPaintIndex++; |
|
|
|
maxPaintIndex++; |
|
|
|
if (a == 0){ |
|
|
|
if (tabCount == 0){ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//再往前补
|
|
|
|
|
|
|
|
if (minPaintIndex > 0){ |
|
|
|
if (minPaintIndex > 0){ |
|
|
|
for (int i = minPaintIndex - 1; i >= 0; i--) { |
|
|
|
for (int i = minPaintIndex - 1; i >= 0; i--) { |
|
|
|
JTemplate template = openedTemplate.get(i); |
|
|
|
JTemplate template = openedTemplate.get(i); |
|
|
|
if (showJTemplateTab(template)) { |
|
|
|
if (showJTemplateTab(template)) { |
|
|
|
a--; |
|
|
|
tabCount--; |
|
|
|
} |
|
|
|
} |
|
|
|
minPaintIndex--; |
|
|
|
minPaintIndex--; |
|
|
|
if (a == 0){ |
|
|
|
if (tabCount == 0){ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|