Browse Source

修改代码行数

newui
kerry 2 years ago
parent
commit
47164404ad
  1. 30
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java

30
designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java

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

Loading…
Cancel
Save