From 78027aae0ede70dc5e7768c93d26bc625e88876f Mon Sep 17 00:00:00 2001 From: kerry Date: Sat, 6 May 2023 15:45:19 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-95401=20&&=20REPORT-95218=E3=80=90FV?= =?UTF-8?q?S=E6=94=AF=E6=8C=81=E5=A4=9A=E5=BC=80=E3=80=91=E6=89=93?= =?UTF-8?q?=E5=BC=80=E5=A4=9A=E4=B8=AAfvs=E4=B9=8B=E5=90=8E=E6=89=93?= =?UTF-8?q?=E5=BC=80frm=EF=BC=8C=E5=86=8D=E6=AC=A1=E6=89=93=E5=BC=80fvs?= =?UTF-8?q?=EF=BC=8Ctab=E6=A0=8F=E8=87=AA=E9=80=82=E5=BA=94=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E3=80=90FVS=E6=94=AF=E6=8C=81=E5=A4=9A=E5=BC=80?= =?UTF-8?q?=E3=80=91=E7=A6=81=E7=94=A8=E6=8F=92=E4=BB=B6=EF=BC=8C=E5=BC=BA?= =?UTF-8?q?=E5=88=B6=E4=BF=9D=E5=AD=98fvs=E6=A8=A1=E6=9D=BF=EF=BC=8C?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E5=8F=96=E6=B6=88=E5=8B=BE=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/file/MultiTemplateTabPane.java | 48 +++++++++++++++++++ .../fr/design/file/SaveSomeTemplatePane.java | 4 +- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java index aa64244dee..98c98a1846 100644 --- a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java @@ -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; + } + } + } + } diff --git a/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java b/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java index 18c34e808c..0bdd48b359 100644 --- a/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java @@ -124,8 +124,10 @@ public class SaveSomeTemplatePane extends BasicPane { if (index < 0) { return; } + boolean mustSaveBeforeSwitchEnv = judgeJTemplateMustSave + && unSavedTemplate.get(index).needSaveBeforeSwitchEnv(); UICheckBox checkBox = (UICheckBox) templatesList.getModel().getElementAt(index); - checkBox.setSelected(!checkBox.isSelected()); + checkBox.setSelected(mustSaveBeforeSwitchEnv ||!checkBox.isSelected()); //根据templateCheckBoxes中的选择情况来更新全选框的状态 int selectedCount = calculateSelectedNum(); From 51adfa34e9a2b8a4abb458716a7729e99d30d5bb Mon Sep 17 00:00:00 2001 From: kerry Date: Sat, 6 May 2023 15:54:28 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=BE=80=E5=89=8D=E9=81=8D=E5=8E=86?= =?UTF-8?q?=E8=A6=81=E5=88=B00?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/file/MultiTemplateTabPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java index 98c98a1846..af772dc7ec 100644 --- a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java @@ -792,7 +792,7 @@ public class MultiTemplateTabPane extends JComponent { //再往前补 if (minPaintIndex > 0){ - for (int i = minPaintIndex - 1; i > 0; i--) { + for (int i = minPaintIndex - 1; i >= 0; i--) { JTemplate template = openedTemplate.get(i); if (showJTemplateTab(template)) { a--; From 47164404ad526fff6f629237ad0d42f45873c050 Mon Sep 17 00:00:00 2001 From: kerry Date: Sat, 6 May 2023 17:02:34 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A1=8C=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/file/MultiTemplateTabPane.java | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java index af772dc7ec..2bac8fcad0 100644 --- a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java +++ b/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; } } } - }