From c564a875cf7b4bb24eb86aa93cf73b7e0995be58 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 10 Jun 2022 11:39:31 +0800 Subject: [PATCH 01/13] =?UTF-8?q?REPORT-73262=E3=80=90=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=8E=AF=E5=A2=83=E7=9B=91=E6=B5=8B=E3=80=91=E5=8F=B3?= =?UTF-8?q?=E4=B8=8B=E8=A7=92=E5=BC=B9=E7=AA=97=E6=96=87=E5=AD=97=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=8D=E5=85=A8=20=E6=B5=8B=E8=AF=95=E5=8F=B3?= =?UTF-8?q?=E4=B8=8B=E8=A7=92=E5=BC=B9=E7=AA=97=E6=96=87=E5=AD=97=E7=9A=84?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notification/NotificationDialog.java | 22 +++++++++++++++---- .../notification/NotificationDialogTest.java | 2 +- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java b/designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java index 5956cc9e3..05a3149b8 100644 --- a/designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java +++ b/designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java @@ -32,6 +32,7 @@ import java.awt.event.MouseEvent; import java.net.URI; import java.util.Arrays; import java.util.List; +import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -151,18 +152,31 @@ public class NotificationDialog extends JDialog { } return new UILabel(LinkStrUtils.generateHtmlTag(messageModel.format())); }) + .collect(Collectors.toList()); + + Function calStandardWidth = e -> e > 4 ? 280 : 300; + + int widthUnit = messageComponents.stream() + .map((component) -> { + Dimension preferredSize = component.getPreferredSize(); + return preferredSize.getHeight(); + }) + .reduce(Double::sum) + .map(calStandardWidth) + .orElse(300); + + messageComponents = messageComponents.stream() .peek((component) -> { Dimension preferredSize = component.getPreferredSize(); double componentWidth = preferredSize.getWidth(); double componentHeight = preferredSize.getHeight(); - double widthFactor = Math.ceil(componentWidth / 300); double heightFactor = Math.ceil(componentHeight / 15); + double widthFactor = Math.ceil(componentWidth / widthUnit); int realHeight = (int) (heightFactor + widthFactor - 1) * 15; - component.setPreferredSize(new Dimension(300, realHeight)); - + component.setPreferredSize(new Dimension(widthUnit, realHeight)); }) .collect(Collectors.toList()); - + // 竖向排列 JPanel messageSummaryPanel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, VerticalFlowLayout.TOP, 0, 0); messageComponents.forEach(messageSummaryPanel::add); diff --git a/designer-base/src/test/java/com/fr/design/components/notification/NotificationDialogTest.java b/designer-base/src/test/java/com/fr/design/components/notification/NotificationDialogTest.java index 1536dd262..b4ae29397 100644 --- a/designer-base/src/test/java/com/fr/design/components/notification/NotificationDialogTest.java +++ b/designer-base/src/test/java/com/fr/design/components/notification/NotificationDialogTest.java @@ -31,7 +31,7 @@ public class NotificationDialogTest { public void run(Object... args) { System.out.println("1111"); } - }, new NotificationMessage.LinkMessage("1111 2222 33333333 4444 555 6666 66555 888 999 333
3333", ""),new NotificationMessage.LinkMessage("display model2 test", "abc")); + }, new NotificationMessage.LinkMessage("1111 2222 33333333 4444 555 6666 66555 888 999 333
3333
444
555
", ""),new NotificationMessage.LinkMessage("display model2 test", "abc")); NotificationDialogProperties properties = new NotificationDialogProperties(frame, "test"); NotificationDialog dialog = new NotificationDialog(properties, Lists.newArrayList(model1, model2)); From 8561268d74d5934248b9095310f9ed8d39f760b3 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 10 Jun 2022 14:13:56 +0800 Subject: [PATCH 02/13] =?UTF-8?q?REPORT-73335=E3=80=90=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=8E=AF=E5=A2=83=E7=9B=91=E6=B5=8B=E3=80=91=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E6=A3=80=E6=B5=8B=E5=AE=8C=E6=88=90=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E6=96=87=E5=AD=97=E6=8F=90=E7=A4=BA=E4=B8=A2?= =?UTF-8?q?=E5=A4=B1=20=E5=92=8C=E4=BA=A7=E5=93=81=E6=B2=9F=E9=80=9A?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E4=BA=A4=E4=BA=92=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/env/detect/ui/EnvDetectorDialog.java | 62 +++++++++++++++++-- 1 file changed, 56 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java b/designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java index 96120e317..2cde3dd89 100644 --- a/designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java +++ b/designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java @@ -54,9 +54,11 @@ public class EnvDetectorDialog extends JDialog { private static final ImageIcon LOADING_ICON = getLoadingIcon(); public static final int TIMEOUT = 1000; - private JPanel body; + private final JPanel body; private final JPanel headerPanel; + private UIButton detectButton; + private JPanel resultSummaryPane; private final TablePanel tablePanel; @@ -128,7 +130,7 @@ public class EnvDetectorDialog extends JDialog { JPanel headerPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); headerPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 12, 0)); - UIButton detectButton = new UIButton(buttonStatus.getDesc()) { + this.detectButton = new UIButton(buttonStatus.getDesc()) { @Override public ButtonUI getUI() { @@ -152,7 +154,7 @@ public class EnvDetectorDialog extends JDialog { detectButton.setForeground(Color.WHITE); detectButton.addActionListener(event -> { if (buttonStatus.isNotExecuting()) { - startDetecting(detectButton); + startDetecting(); } else { stopDetecting(detectButton); } @@ -165,7 +167,7 @@ public class EnvDetectorDialog extends JDialog { return headerPanel; } - private void startDetecting(UIButton detectButton) { + private void startDetecting() { // 重新检测的时候需要处理一些逻辑 if (buttonStatus == EnvDetectorButtonStatus.A_NEW) { @@ -173,7 +175,7 @@ public class EnvDetectorDialog extends JDialog { } // 执行前 buttonStatus = buttonStatus.next(); - UIUtil.invokeLaterIfNeeded(() -> detectButton.setText(buttonStatus.getDesc())); + UIUtil.invokeLaterIfNeeded(EnvDetectorDialog.this::refreshHeaderPanel); detectWorker = new SwingWorker() { @Override @@ -218,7 +220,7 @@ public class EnvDetectorDialog extends JDialog { if (buttonStatus.isExecuting()) { // 执行结束 buttonStatus = EnvDetectorButtonStatus.A_NEW; - UIUtil.invokeLaterIfNeeded(() -> detectButton.setText(buttonStatus.getDesc())); + UIUtil.invokeLaterIfNeeded(EnvDetectorDialog.this::refreshHeaderPanel); } } }; @@ -251,6 +253,42 @@ public class EnvDetectorDialog extends JDialog { }); } + private void updateHeaderPanel() { + + // 刷新按钮 + detectButton.setText(buttonStatus.getDesc()); + if (buttonStatus == EnvDetectorButtonStatus.A_NEW) { + this.resultSummaryPane = new JPanel(); + this.resultSummaryPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); + this.resultSummaryPane.setLayout(new BorderLayout(5, 0)); + Boolean success = model.getResults() + .map((e) -> { + if (e.getStatus() == DetectorStatus.NORMAL) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).reduce((a, b) -> a && b) + .orElse(Boolean.FALSE); + + if (success) { + resultSummaryPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Detect_Result_Label")), BorderLayout.WEST); + UILabel successLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Detect_Result_Success")); + successLabel.setForeground(Color.GREEN); + resultSummaryPane.add(successLabel, BorderLayout.CENTER); + } else { + resultSummaryPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Exception")), BorderLayout.WEST); + UILabel resultLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Detect_Result_Error")); + resultLabel.setForeground(Color.RED); + resultSummaryPane.add(resultLabel, BorderLayout.CENTER); + } + this.headerPanel.add(BorderLayout.CENTER, resultSummaryPane); + } else { + if (resultSummaryPane != null) { + this.headerPanel.remove(resultSummaryPane); + } + } + } + /* table */ @@ -394,6 +432,13 @@ public class EnvDetectorDialog extends JDialog { return tailPanel; } + private void refreshHeaderPanel() { + + updateHeaderPanel(); + pack(); + repaint(); + } + private void refresh() { updateTable(this.tablePanel); @@ -504,4 +549,9 @@ public class EnvDetectorDialog extends JDialog { public abstract EnvDetectorButtonStatus next(); } + + private class EnvDetectorHeaderPanel extends JPanel { + + + } } From d567cf0a69979d6cf17918ff90c9c427f59affc8 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 10 Jun 2022 14:14:45 +0800 Subject: [PATCH 03/13] =?UTF-8?q?REPORT-73292=E3=80=90=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=8E=AF=E5=A2=83=E7=9B=91=E6=B5=8B=E3=80=91=E7=BC=BA?= =?UTF-8?q?=E5=B0=91=E7=9A=84jar=E5=9C=A8=E7=89=88=E6=9C=AC=E4=B8=8D?= =?UTF-8?q?=E4=B8=80=E8=87=B4=E4=B8=AD=E4=B9=9F=E4=BC=9A=E8=A2=AB=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E5=88=B0=20=E5=A4=84=E7=90=86=E4=B8=8D=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=8C=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E5=BF=98=E4=BA=86=E5=88=A4=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/env/detect/impl/JarInconsistentDetector.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/detect/impl/JarInconsistentDetector.java b/designer-base/src/main/java/com/fr/env/detect/impl/JarInconsistentDetector.java index b13195067..e10f18052 100644 --- a/designer-base/src/main/java/com/fr/env/detect/impl/JarInconsistentDetector.java +++ b/designer-base/src/main/java/com/fr/env/detect/impl/JarInconsistentDetector.java @@ -114,7 +114,11 @@ public class JarInconsistentDetector extends AbstractExceptionDetector { // 获取所有的不一致的 build List inConsistentInfos = buildInfos.stream() - .filter((e) -> !StringUtils.equals(designerBuild.get(), e.getGroupBuild())) + .filter((e) -> { + // 不为空,且不相等 + return StringUtils.isNotEmpty(e.getGroupBuild()) + && !StringUtils.equals(designerBuild.get(), e.getGroupBuild()); + }) .collect(Collectors.toList()); // 没有直接返回 @@ -141,7 +145,9 @@ public class JarInconsistentDetector extends AbstractExceptionDetector { for (BuildInfo localInfo : localInfos) { String jar = localInfo.getJar(); String groupContent = localInfo.getGroupBuild(); - localMap.put(jar, groupContent); + if (StringUtils.isNotEmpty(groupContent)) { + localMap.put(jar, groupContent); + } } return localMap; } From 6bcad8f5f71afc625755d7c75009ac3d818956e4 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 10 Jun 2022 14:15:39 +0800 Subject: [PATCH 04/13] =?UTF-8?q?REPORT-73331=E3=80=90=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=8E=AF=E5=A2=83=E7=9B=91=E6=B5=8B=E3=80=91=E8=BF=9C?= =?UTF-8?q?=E7=A8=8B=E7=8E=AF=E5=A2=83=E7=BC=BA=E5=B0=91jar=EF=BC=8C?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=A3=80=E6=B5=8B=E5=88=B0=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E8=BF=9C=E7=A8=8B=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E7=BC=BA=E5=B0=91=20JAR=20=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/env/detect/impl/JarLackDetector.java | 47 +++++++++++++++---- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java b/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java index 8c85da202..a769921b0 100644 --- a/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java +++ b/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java @@ -12,6 +12,7 @@ import com.fr.env.detect.bean.ExceptionSolution; import com.fr.env.detect.bean.ExceptionTips; import com.fr.env.detect.bean.Message; import com.fr.general.build.BuildInfo; +import com.fr.general.build.BuildInfoManager; import com.fr.general.build.BuildInfoOperator; import com.fr.general.build.impl.BuildInfoOperatorImpl; import com.fr.third.guava.collect.Lists; @@ -22,6 +23,8 @@ import org.jetbrains.annotations.NotNull; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.function.Predicate; import java.util.stream.Collectors; /** @@ -42,17 +45,38 @@ public class JarLackDetector extends AbstractExceptionDetector { @Override public DetectorResult detect() { - // 不支持远程 + List lackInfos; + + // 远程 if (!WorkContext.getCurrent().isLocal()) { - return DetectorResult.normal(type()); + // 检测有哪些 JAR 包, 当前是否缺少对应的 JAR 包 + BuildInfoOperator buildInfoOperator = WorkContext.getCurrent().get(BuildInfoOperator.class); + // 远程情况 + List remoteInfos = buildInfoOperator.getBuildInfos(); + // 本地情况 + List localInfos = BuildInfoManager.getInstance().getInfos(); + + Set remoteSet = remoteInfos.stream() + .filter(this::isExistInfo) + .map(BuildInfo::getJar) + .collect(Collectors.toSet()); + + Predicate remoteNotContains = (e) -> !remoteSet.contains(e.getJar()); + + lackInfos = localInfos.stream() + .filter(this::isExistInfo) + .filter(remoteNotContains) + .collect(Collectors.toList()); + + } else { + // 本地 + // 检测有哪些 JAR 包, 当前是否缺少对应的 JAR 包 + BuildInfoOperator buildInfoOperator = new BuildInfoOperatorImpl(); + List buildInfos = buildInfoOperator.getBuildInfos(); + lackInfos = buildInfos.stream() + .filter(this::isLackInfo) + .collect(Collectors.toList()); } - - // 检测有哪些 JAR 包, 当前是否缺少对应的 JAR 包 - BuildInfoOperator buildInfoOperator = new BuildInfoOperatorImpl(); - List buildInfos = buildInfoOperator.getBuildInfos(); - List lackInfos = buildInfos.stream() - .filter(this::isLackInfo) - .collect(Collectors.toList()); if (Collections.isEmpty(lackInfos)) { return DetectorResult.normal(type()); @@ -77,6 +101,11 @@ public class JarLackDetector extends AbstractExceptionDetector { return ExceptionLog.create(Toolkit.i18nText(type().getLogLocale()) + message); } + private boolean isExistInfo(BuildInfo e) { + + return !isLackInfo(e); + } + private boolean isLackInfo(BuildInfo e) { return StringUtils.isEmpty(e.getGroupBuild()); From 639d5f6d8e504edfe0601e92bcfa61e33762cda9 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 10 Jun 2022 14:47:22 +0800 Subject: [PATCH 05/13] =?UTF-8?q?REPORT-73391=E3=80=90=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=8E=AF=E5=A2=83=E7=9B=91=E6=B5=8B=E3=80=91=E7=BC=BA?= =?UTF-8?q?=E5=B0=91fine-activator-11.0=EF=BC=8C=E9=A2=84=E6=9C=9F?= =?UTF-8?q?=E5=A4=96=E5=90=AF=E5=8A=A8=E7=9A=84=E5=BC=B9=E7=AA=97=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=8D=95=E8=8E=B7=20=E5=AE=88=E6=8A=A4=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E7=9A=84=E6=A3=80=E6=B5=8B=E9=80=BB=E8=BE=91=E5=A4=84?= =?UTF-8?q?=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/start/FineDesigner.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/start/FineDesigner.java b/designer-realize/src/main/java/com/fr/start/FineDesigner.java index a3e202308..a1bd3591c 100644 --- a/designer-realize/src/main/java/com/fr/start/FineDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/FineDesigner.java @@ -1,5 +1,7 @@ package com.fr.start; +import com.fr.exit.DesignerExiter; +import com.fr.process.engine.FineProcessUtils; import com.fr.process.engine.core.FineProcessEntry; /** @@ -10,5 +12,20 @@ import com.fr.process.engine.core.FineProcessEntry; * Created by hades on 2020/3/24 */ public class FineDesigner extends FineProcessEntry { - + + public static void main(String[] args) { + + FineDesigner fineDesigner = new FineDesigner(); + FineProcessUtils.run(fineDesigner, args); + } + + @Override + public void run(String[] args) { + + try { + super.run(args); + } catch (Throwable throwable) { + DesignerExiter.getInstance().exit(throwable); + } + } } From 8cbd251beb00a8c0bf1207334a318bca3497dd0e Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 10 Jun 2022 15:36:18 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=20REPORT-73312=20=E3=80=90=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E7=8E=AF=E5=A2=83=E7=9B=91=E6=B5=8B=E3=80=91?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E5=88=87=E6=8D=A2=E6=97=B6=EF=BC=8Cfine-repo?= =?UTF-8?q?rt-designer-11.0=E4=B8=80=E5=AE=9A=E4=BC=9A=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E4=B8=8D=E4=B8=80=E8=87=B4=E7=9A=84=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=20=20=E8=BF=87=E6=BB=A4=E6=8E=89=20designer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/env/detect/impl/JarLackDetector.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java b/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java index a769921b0..82b906270 100644 --- a/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java +++ b/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java @@ -65,6 +65,8 @@ public class JarLackDetector extends AbstractExceptionDetector { lackInfos = localInfos.stream() .filter(this::isExistInfo) + // 不是设计器的 JAR + .filter((e) -> !DetectorUtil.isDesignerJar(e)) .filter(remoteNotContains) .collect(Collectors.toList()); From 293fd4ff876010afb0e9245d1a26eb24e0495881 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 10 Jun 2022 15:37:14 +0800 Subject: [PATCH 07/13] =?UTF-8?q?REPORT-73396=E3=80=90=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=8E=AF=E5=A2=83=E7=9B=91=E6=B5=8B=E3=80=91=E5=88=A0?= =?UTF-8?q?=E9=99=A4fine-decision-11.0=EF=BC=8C=E8=A7=A6=E5=8F=91=E7=9A=84?= =?UTF-8?q?=E6=98=AF=E9=87=8D=E7=BD=AEfinedb=20=E5=BD=93=E9=81=87=E5=88=B0?= =?UTF-8?q?=20finedb=20=E5=BC=82=E5=B8=B8=E5=8D=B4=E6=98=AF=E7=BC=BA?= =?UTF-8?q?=E5=B0=91=20JAR=20=E5=AF=BC=E8=87=B4=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=EF=BC=8C=E4=BA=A4=E4=BA=92=E8=A1=A5=E5=85=85=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/start/LifecycleFatalErrorHandler.java | 64 +++++++++++++------ 1 file changed, 45 insertions(+), 19 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java b/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java index 37f608ee1..fbe8f1962 100644 --- a/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java +++ b/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java @@ -1,15 +1,19 @@ package com.fr.start; import com.fr.common.report.ReportState; +import com.fr.common.util.Collections; import com.fr.design.RestartHelper; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector; import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage; import com.fr.env.detect.base.DetectorBridge; import com.fr.env.detect.bean.DetectorResult; import com.fr.env.detect.bean.DetectorStatus; import com.fr.env.detect.bean.DetectorType; +import com.fr.env.detect.ui.DetectorErrorDialog; import com.fr.exit.DesignerExiter; import com.fr.general.IOUtils; import com.fr.io.utils.ResourceIOUtils; @@ -17,14 +21,19 @@ import com.fr.log.FineLoggerFactory; import com.fr.process.engine.core.CarryMessageEvent; import com.fr.process.engine.core.FineProcessContext; import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; import com.fr.stable.lifecycle.ErrorType; import com.fr.stable.lifecycle.ErrorTypeHelper; import com.fr.stable.lifecycle.FineLifecycleFatalError; import com.fr.stable.project.ProjectConstants; import javax.swing.JOptionPane; +import java.util.EnumMap; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; /** * @author hades @@ -68,10 +77,30 @@ public class LifecycleFatalErrorHandler { * 自检测 */ SELF { + final EnumMap solutionMap = new EnumMap<>(DetectorType.class); + + { + solutionMap.put(DetectorType.FINE_DB_LOCKED, "Fine-Design_Error_Finedb_Dirty_Backup_Reset"); + solutionMap.put(DetectorType.FINE_DB_PERMISSION, "Fine-Design_Error_Finedb_Permission_Backup_Reset"); + solutionMap.put(DetectorType.FINE_DB_DIRTY, "Fine-Design_Error_Finedb_Dirty_Backup_Reset"); + } + @Override public void handle(FineLifecycleFatalError fatal) { - String showText = generateShowText(fatal); + Stream resultStream = DetectorBridge.getInstance().detect(fatal); + List results = resultStream + .filter((e) -> e.getStatus() == DetectorStatus.EXCEPTION) + .collect(Collectors.toList()); + + String showText = generateShowText(results); + // 如果还是异常,则抛出预期外的错误 + if (StringUtils.isEmpty(showText)) { + DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); + DetectorErrorDialog errorDialog = new DetectorErrorDialog(designerFrame, results); + errorDialog.setVisible(true); + return; + } StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.FINEDB_PROBLEM.getId(), DesignerErrorMessage.FINEDB_PROBLEM.getMessage(), @@ -107,26 +136,23 @@ public class LifecycleFatalErrorHandler { /** * 生成展示信息 - * - * @param fatal 异常 - * @return 文本 */ - private String generateShowText(FineLifecycleFatalError fatal) { - - // todo 其实这里的交互还是有问题, 为什么在锁住和没权限的场景下,要重置 FineDB 呢。 - DetectorResult detectorResult = DetectorBridge.getInstance().detect(DetectorType.FINE_DB_LOCKED, fatal); - if (detectorResult.getStatus() == DetectorStatus.EXCEPTION) { - return Toolkit.i18nText("Fine-Design_Error_Finedb_Locked_Backup_Reset"); - } - detectorResult = DetectorBridge.getInstance().detect(DetectorType.FINE_DB_PERMISSION, fatal); - if (detectorResult.getStatus() == DetectorStatus.EXCEPTION) { - return Toolkit.i18nText("Fine-Design_Error_Finedb_Permission_Backup_Reset"); - } - detectorResult = DetectorBridge.getInstance().detect(DetectorType.FINE_DB_DIRTY, fatal); - if (detectorResult.getStatus() == DetectorStatus.EXCEPTION) { - return Toolkit.i18nText("Fine-Design_Error_Finedb_Dirty_Backup_Reset"); + private String generateShowText(List results) { + + String showText = StringUtils.EMPTY; + if (Collections.isEmpty(results)) { + showText = Toolkit.i18nText("Fine-Design_Error_Finedb_Backup_Reset"); + } else { + for (DetectorResult result : results) { + DetectorType type = result.getType(); + String solutionLocale = solutionMap.get(type); + if (StringUtils.isNotEmpty(solutionLocale)) { + showText = Toolkit.i18nText(solutionLocale); + break; + } + } } - return Toolkit.i18nText("Fine-Design_Error_Finedb_Backup_Reset"); + return showText; } private void afterBackupFailed() { From 0e4183ca6460dbf065530aeeabed421fa3db6cb4 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 10 Jun 2022 16:27:05 +0800 Subject: [PATCH 08/13] =?UTF-8?q?REPORT-73318=E3=80=90=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=8E=AF=E5=A2=83=E7=9B=91=E6=B5=8B=E3=80=91=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8finedb=E6=9C=89=E8=84=8F=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=EF=BC=8C=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=BF=9C=E7=A8=8B=E5=88=87?= =?UTF-8?q?=E6=8D=A2=EF=BC=8C=E8=BF=87=E7=A8=8B=E5=BE=88=E6=85=A2=E4=B8=94?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=87=AA=E5=8A=A8=E7=9B=91=E6=B5=8B=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=20=E5=A4=84=E7=90=86=E5=88=87=E6=8D=A2=E8=BF=9C?= =?UTF-8?q?=E7=A8=8B=E6=97=B6=E4=B8=8D=E7=94=9F=E6=95=88=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/env/detect/EnvDetectorCenter.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java b/designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java index 070d63d85..e73aa673b 100644 --- a/designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java +++ b/designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java @@ -18,6 +18,7 @@ import com.fr.event.EventDispatcher; import com.fr.event.Listener; import com.fr.event.Null; import com.fr.start.server.EmbedServerEvent; +import com.fr.task.Once; import com.fr.update.delay.DelayHelper; import com.fr.workspace.Workspace; import com.fr.workspace.WorkspaceEvent; @@ -72,6 +73,14 @@ public class EnvDetectorCenter { } }; + private final Once launchOnce = new Once(() -> { + + // 添加启动完成监听 + EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, START_UP_COMPLETE_LISTENER); + // 切换完成后的监听 + EventDispatcher.listen(WorkspaceEvent.AfterSwitch, AFTER_SWITCH_LISTENER); + }); + private final AtomicReference PROCESS = new AtomicReference<>(); public static EnvDetectorCenter getInstance() { @@ -96,6 +105,7 @@ public class EnvDetectorCenter { // 默认是启动 PROCESS.set(DetectorProcess.DESIGN_LAUNCH); + launchOnce.run(); listen(); } @@ -189,12 +199,6 @@ public class EnvDetectorCenter { private void listen() { - // 添加启动完成监听 - EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, START_UP_COMPLETE_LISTENER); - - // 切换完成后的监听 - EventDispatcher.listen(WorkspaceEvent.AfterSwitch, AFTER_SWITCH_LISTENER); - // 内置服务器监听 EventDispatcher.listen(EmbedServerEvent.BeforeStart, BEFORE_START_LISTENER); EventDispatcher.listen(EmbedServerEvent.AfterStart, AFTER_START_LISTENER); @@ -202,8 +206,6 @@ public class EnvDetectorCenter { private void stopListen() { - EventDispatcher.stopListen(START_UP_COMPLETE_LISTENER); - EventDispatcher.stopListen(AFTER_SWITCH_LISTENER); EventDispatcher.stopListen(BEFORE_START_LISTENER); EventDispatcher.stopListen(AFTER_START_LISTENER); } From 945994e032ef138fd802e0f3b2a6ef917a097b8d Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 10 Jun 2022 16:31:28 +0800 Subject: [PATCH 09/13] =?UTF-8?q?REPORT-73403=E3=80=90=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=8E=AF=E5=A2=83=E7=9B=91=E6=B5=8B=E3=80=91jar?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=BC=B9=E7=AA=97=EF=BC=8C%FR=5FHOME%\lib?= =?UTF-8?q?=E5=92=8C\WEB-INF\lib=E4=B8=8B=E7=9A=84jar=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=8C=BA=E5=88=86=E6=98=BE=E7=A4=BA=20=E9=80=82=E9=85=8D?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E7=9A=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/env/detect/base/DetectorConstants.java | 7 ++++ .../com/fr/env/detect/base/DetectorUtil.java | 42 ++++++++++++++++++- .../fr/env/detect/impl/JarLackDetector.java | 35 +++------------- .../converter/ClassConflictConvertor.java | 20 +++++---- 4 files changed, 67 insertions(+), 37 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/detect/base/DetectorConstants.java b/designer-base/src/main/java/com/fr/env/detect/base/DetectorConstants.java index be1036f0d..4e4592dcd 100644 --- a/designer-base/src/main/java/com/fr/env/detect/base/DetectorConstants.java +++ b/designer-base/src/main/java/com/fr/env/detect/base/DetectorConstants.java @@ -8,4 +8,11 @@ public class DetectorConstants { public static final String JAR_HELP_LINK = "https://help.fanruan.com/finereport/doc-view-4700.html?source=3"; public static final String FINE_DB_HELP_LINK = "https://help.fanruan.com/finereport/doc-view-4701.html?source=3"; + + public static final String SEPARATOR = "、"; + public static final String BR_TAG = "
"; + + public static final String WEB_LIB_PATH = "%FR_HOME%\\webapps\\webroot\\WEB-INF\\lib:"; + + public static final String FR_HOME_LIB = "%FR_HOME%\\lib:"; } diff --git a/designer-base/src/main/java/com/fr/env/detect/base/DetectorUtil.java b/designer-base/src/main/java/com/fr/env/detect/base/DetectorUtil.java index fdfccf216..fd6c33607 100644 --- a/designer-base/src/main/java/com/fr/env/detect/base/DetectorUtil.java +++ b/designer-base/src/main/java/com/fr/env/detect/base/DetectorUtil.java @@ -1,6 +1,7 @@ package com.fr.env.detect.base; import com.fr.base.function.ThrowableRunnable; +import com.fr.common.util.Collections; import com.fr.design.components.notification.NotificationAction; import com.fr.design.components.notification.NotificationMessage; import com.fr.design.components.notification.NotificationModel; @@ -14,7 +15,7 @@ import com.fr.env.detect.bean.ExceptionTips; import com.fr.env.detect.bean.Message; import com.fr.env.detect.bean.SolutionAction; import com.fr.general.build.BuildInfo; -import com.fr.stable.StringUtils; +import com.fr.third.org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import javax.swing.JComponent; @@ -22,9 +23,15 @@ import java.awt.Desktop; import java.net.URI; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Optional; import java.util.function.Function; +import static com.fr.env.detect.base.DetectorConstants.BR_TAG; +import static com.fr.env.detect.base.DetectorConstants.FR_HOME_LIB; +import static com.fr.env.detect.base.DetectorConstants.SEPARATOR; +import static com.fr.env.detect.base.DetectorConstants.WEB_LIB_PATH; + /** * created by Harrison on 2022/05/25 **/ @@ -124,4 +131,37 @@ public class DetectorUtil { } return new UILabel(LinkStrUtils.generateHtmlTag(message.get())); } + + /** + * 将 lib 转化成合适的格式 + * %FR_HOME%/lib + * %FR_HOME%/webapps/webroot/WEB-INF/lib + * + * @param libMap jar 路径, key为前缀 + * @return 信息 + */ + public static String concatLibFormatMsg(Map> libMap) { + + String webLibPath = WEB_LIB_PATH; + String homeLibPath = FR_HOME_LIB; + + StringBuilder sb = new StringBuilder(); + + List homeLibs = libMap.get(homeLibPath); + if (!Collections.isEmpty(homeLibs)) { + sb.append(homeLibPath); + sb.append(StringUtils.join(homeLibs, SEPARATOR)); + } + + List webLibs = libMap.get(webLibPath); + if (!Collections.isEmpty(webLibs)) { + if (sb.length() != 0) { + sb.append(BR_TAG); + } + sb.append(webLibPath); + sb.append(StringUtils.join(webLibs, SEPARATOR)); + } + return sb.toString(); + } + } diff --git a/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java b/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java index 82b906270..322c15d50 100644 --- a/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java +++ b/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java @@ -27,16 +27,14 @@ import java.util.Set; import java.util.function.Predicate; import java.util.stream.Collectors; +import static com.fr.env.detect.base.DetectorConstants.FR_HOME_LIB; +import static com.fr.env.detect.base.DetectorConstants.WEB_LIB_PATH; + /** * created by Harrison on 2022/05/24 **/ public class JarLackDetector extends AbstractExceptionDetector { - public static final String SEPARATOR = "、"; - public static final String BR_TAG = "
"; - public static final String WEB_LIB_PATH = "%FR_HOME%\\webapps\\webroot\\WEB-INF\\lib:"; - public static final String FR_HOME_LIB = "%FR_HOME%\\lib:"; - public JarLackDetector() { super(DetectorType.LACK_OF_JAR); @@ -115,33 +113,12 @@ public class JarLackDetector extends AbstractExceptionDetector { private Message tipsMessage(List infos) { - String webLibPath = WEB_LIB_PATH; - String homeLibPath = FR_HOME_LIB; - - Map> libMap = groupByPath(infos, homeLibPath, webLibPath); - - StringBuilder sb = new StringBuilder(); - - List homeLibs = libMap.get(homeLibPath); - if (!Collections.isEmpty(homeLibs)) { - sb.append(homeLibPath); - sb.append(StringUtils.join(homeLibs, SEPARATOR)); - } - - List webLibs = libMap.get(webLibPath); - if (!Collections.isEmpty(webLibs)) { - if (sb.length() != 0) { - sb.append(BR_TAG); - } - sb.append(webLibPath); - sb.append(StringUtils.join(webLibs, SEPARATOR)); - } - - String mainContent = sb.toString(); + Map> libMap = groupByPath(infos, FR_HOME_LIB, WEB_LIB_PATH); + String content = DetectorUtil.concatLibFormatMsg(libMap); DetectorType type = this.type(); String header = Toolkit.i18nText(type.getTipsLocale()); - return new Message.Simple(header + mainContent); + return new Message.Simple(header + content); } @NotNull diff --git a/designer-base/src/main/java/com/fr/env/detect/impl/converter/ClassConflictConvertor.java b/designer-base/src/main/java/com/fr/env/detect/impl/converter/ClassConflictConvertor.java index ab2b16ed9..ef5be1339 100644 --- a/designer-base/src/main/java/com/fr/env/detect/impl/converter/ClassConflictConvertor.java +++ b/designer-base/src/main/java/com/fr/env/detect/impl/converter/ClassConflictConvertor.java @@ -2,6 +2,7 @@ package com.fr.env.detect.impl.converter; import com.fr.design.i18n.Toolkit; import com.fr.env.detect.base.DetectorConstants; +import com.fr.env.detect.base.DetectorUtil; import com.fr.env.detect.bean.DetectorResult; import com.fr.env.detect.bean.DetectorType; import com.fr.env.detect.bean.ExceptionLog; @@ -9,7 +10,6 @@ import com.fr.env.detect.bean.ExceptionSolution; import com.fr.env.detect.bean.ExceptionTips; import com.fr.env.detect.thowable.ThrowableConverter; import com.fr.stable.resource.ResourceLoader; -import com.fr.third.org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import javax.el.MethodNotFoundException; @@ -83,6 +83,10 @@ public class ClassConflictConvertor implements ThrowableConverter { sign = sign.getCause(); } + Map> libMap = new HashMap<>(); + libMap.put(DetectorConstants.FR_HOME_LIB, new ArrayList<>()); + libMap.put(DetectorConstants.WEB_LIB_PATH, new ArrayList<>()); + Set allPath = new HashSet<>(); for (String className : classNames) { String classFile = convertClass2Path(className); @@ -98,12 +102,14 @@ public class ClassConflictConvertor implements ThrowableConverter { Matcher matcher = JAR_NAME_PATTERN.matcher(url.getFile()); if (matcher.find()) { String jar = matcher.group(); - allPath.add(jar); - } else { - boolean containsClasses = file.contains(CLASSES); - if (containsClasses) { - allPath.add(CLASSES); + List libPath = null; + if (file.contains("WEB-INF")) { + libPath = libMap.get(DetectorConstants.WEB_LIB_PATH); + } else { + libPath = libMap.get(DetectorConstants.FR_HOME_LIB); } + libPath.add(jar); + allPath.add(jar); } } } catch (IOException ignore) { @@ -115,7 +121,7 @@ public class ClassConflictConvertor implements ThrowableConverter { return null; } - String msg = StringUtils.join(allPath, SEPARATOR); + String msg = DetectorUtil.concatLibFormatMsg(libMap); DetectorType type = DetectorType.JAR_CONFLICT; return DetectorResult.exception(type, From 3910005fe8381e8d8c586b217a4b5b3f8de1f798 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 10 Jun 2022 16:41:25 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E6=97=A0=20JIRA=20=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E8=A1=A5=E5=85=85=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/components/notification/NotificationDialog.java | 4 +++- .../java/com/fr/env/detect/impl/JarInconsistentDetector.java | 1 + designer-realize/src/main/java/com/fr/start/FineDesigner.java | 1 + .../main/java/com/fr/start/LifecycleFatalErrorHandler.java | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java b/designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java index 05a3149b8..14fb6d007 100644 --- a/designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java +++ b/designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java @@ -154,7 +154,9 @@ public class NotificationDialog extends JDialog { }) .collect(Collectors.toList()); - Function calStandardWidth = e -> e > 4 ? 280 : 300; + // 当高度 / 15(每个字的大小) 大于 4 时,就会出现滚动条。 + // 当出现滚动条时,需要将内部的宽度限制为 280, 否则会展示不出来 + Function calStandardWidth = heightFactor -> heightFactor > 4 ? 280 : 300; int widthUnit = messageComponents.stream() .map((component) -> { diff --git a/designer-base/src/main/java/com/fr/env/detect/impl/JarInconsistentDetector.java b/designer-base/src/main/java/com/fr/env/detect/impl/JarInconsistentDetector.java index e10f18052..8cfc988a9 100644 --- a/designer-base/src/main/java/com/fr/env/detect/impl/JarInconsistentDetector.java +++ b/designer-base/src/main/java/com/fr/env/detect/impl/JarInconsistentDetector.java @@ -145,6 +145,7 @@ public class JarInconsistentDetector extends AbstractExceptionDetector { for (BuildInfo localInfo : localInfos) { String jar = localInfo.getJar(); String groupContent = localInfo.getGroupBuild(); + // 不一致的 JAR 检测,忽视缺少的情况 if (StringUtils.isNotEmpty(groupContent)) { localMap.put(jar, groupContent); } diff --git a/designer-realize/src/main/java/com/fr/start/FineDesigner.java b/designer-realize/src/main/java/com/fr/start/FineDesigner.java index a1bd3591c..e70575708 100644 --- a/designer-realize/src/main/java/com/fr/start/FineDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/FineDesigner.java @@ -25,6 +25,7 @@ public class FineDesigner extends FineProcessEntry { try { super.run(args); } catch (Throwable throwable) { + // 守护进程启动时,需要捕获异常。并且退出。 DesignerExiter.getInstance().exit(throwable); } } diff --git a/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java b/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java index fbe8f1962..92b8ac6c6 100644 --- a/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java +++ b/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java @@ -94,7 +94,7 @@ public class LifecycleFatalErrorHandler { .collect(Collectors.toList()); String showText = generateShowText(results); - // 如果还是异常,则抛出预期外的错误 + // 如果还是异常,说明并不是 DB 的异常,抛出预期外的错误 if (StringUtils.isEmpty(showText)) { DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); DetectorErrorDialog errorDialog = new DetectorErrorDialog(designerFrame, results); From 52fb4b227e87a9166d03059bef1765dff7ec2176 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 10 Jun 2022 17:50:30 +0800 Subject: [PATCH 11/13] =?UTF-8?q?REPORT-73403=E3=80=90=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=8E=AF=E5=A2=83=E7=9B=91=E6=B5=8B=E3=80=91jar?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=BC=B9=E7=AA=97=EF=BC=8C%FR=5FHOME%\lib?= =?UTF-8?q?=E5=92=8C\WEB-INF\lib=E4=B8=8B=E7=9A=84jar=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=8C=BA=E5=88=86=E6=98=BE=E7=A4=BA=20=E6=8A=BD=E8=B1=A1?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/env/detect/impl/converter/ClassConflictConvertor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/env/detect/impl/converter/ClassConflictConvertor.java b/designer-base/src/main/java/com/fr/env/detect/impl/converter/ClassConflictConvertor.java index ef5be1339..b1f9e507d 100644 --- a/designer-base/src/main/java/com/fr/env/detect/impl/converter/ClassConflictConvertor.java +++ b/designer-base/src/main/java/com/fr/env/detect/impl/converter/ClassConflictConvertor.java @@ -41,6 +41,8 @@ public class ClassConflictConvertor implements ThrowableConverter { */ private static final Pattern JAR_NAME_PATTERN = Pattern.compile("([\\w+-\\.]*\\.jar)"); + private static final String WEB_INF_STRING = "WEB-INF"; + private final Map, ClassNameConverter> throwableMap = new HashMap<>(); public ClassConflictConvertor() { @@ -103,7 +105,7 @@ public class ClassConflictConvertor implements ThrowableConverter { if (matcher.find()) { String jar = matcher.group(); List libPath = null; - if (file.contains("WEB-INF")) { + if (file.contains(WEB_INF_STRING)) { libPath = libMap.get(DetectorConstants.WEB_LIB_PATH); } else { libPath = libMap.get(DetectorConstants.FR_HOME_LIB); From f539d9293a904db0449e11a6afa6ba59d4a74151 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 10 Jun 2022 18:19:01 +0800 Subject: [PATCH 12/13] =?UTF-8?q?REPORT-73403=E3=80=90=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=8E=AF=E5=A2=83=E7=9B=91=E6=B5=8B=E3=80=91jar?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=BC=B9=E7=AA=97=EF=BC=8C%FR=5FHOME%\lib?= =?UTF-8?q?=E5=92=8C\WEB-INF\lib=E4=B8=8B=E7=9A=84jar=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=8C=BA=E5=88=86=E6=98=BE=E7=A4=BA=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E7=9A=84=E9=AD=94=E6=9C=AF=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notification/NotificationDialog.java | 39 ++++++++++++++----- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java b/designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java index 14fb6d007..4df430b06 100644 --- a/designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java +++ b/designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java @@ -44,8 +44,26 @@ import java.util.stream.Collectors; **/ public class NotificationDialog extends JDialog { - private Dimension contentSize = new Dimension(300, 100); - private Dimension buttonDimension = new Dimension(68, 20); + /** + * 通知框的内部高度 + */ + private static final int CONTENT_INNER_HEIGHT = 60; + /** + * 通知框如果出现滚动条后的内部宽度 + */ + private static final int CONTENT_SCROLL_WIDTH = 280; + + private static final int CONTENT_WIDTH = 300; + private static final int CONTENT_HEIGHT = 100; + /** + * 通知框的外部宽高 + */ + private static final Dimension CONTENT_SIZE = new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT); + private static final Dimension BUTTON_DIMENSION = new Dimension(68, 20); + + private static final UILabel SIGN_LABEL = new UILabel("#"); + + private static final Dimension SIGN_LABEL_DIMENSION = SIGN_LABEL.getPreferredSize(); private NotificationDialogProperties properties; @@ -154,9 +172,9 @@ public class NotificationDialog extends JDialog { }) .collect(Collectors.toList()); - // 当高度 / 15(每个字的大小) 大于 4 时,就会出现滚动条。 + // 当高度 大于 60 时,就会出现滚动条。 // 当出现滚动条时,需要将内部的宽度限制为 280, 否则会展示不出来 - Function calStandardWidth = heightFactor -> heightFactor > 4 ? 280 : 300; + Function calStandardWidth = height -> height > CONTENT_INNER_HEIGHT ? CONTENT_SCROLL_WIDTH : CONTENT_WIDTH; int widthUnit = messageComponents.stream() .map((component) -> { @@ -165,16 +183,17 @@ public class NotificationDialog extends JDialog { }) .reduce(Double::sum) .map(calStandardWidth) - .orElse(300); + .orElse(CONTENT_WIDTH); messageComponents = messageComponents.stream() .peek((component) -> { + int size = component.getFont().getSize(); Dimension preferredSize = component.getPreferredSize(); double componentWidth = preferredSize.getWidth(); double componentHeight = preferredSize.getHeight(); - double heightFactor = Math.ceil(componentHeight / 15); + double heightFactor = Math.ceil(componentHeight / SIGN_LABEL_DIMENSION.getHeight()); double widthFactor = Math.ceil(componentWidth / widthUnit); - int realHeight = (int) (heightFactor + widthFactor - 1) * 15; + int realHeight = (int)Math.ceil(heightFactor + widthFactor - 1) * (int)(Math.ceil(SIGN_LABEL_DIMENSION.getHeight())); component.setPreferredSize(new Dimension(widthUnit, realHeight)); }) .collect(Collectors.toList()); @@ -187,7 +206,7 @@ public class NotificationDialog extends JDialog { jScrollPane.setBorder(BorderFactory.createEmptyBorder()); centerPanel.add(jScrollPane, BorderLayout.CENTER); - centerPanel.setPreferredSize(contentSize); + centerPanel.setPreferredSize(CONTENT_SIZE); contentPanel.add(centerPanel, BorderLayout.CENTER); @@ -256,7 +275,7 @@ public class NotificationDialog extends JDialog { NotificationAction action = currentModel.getAction(); if (action != null) { UIButton actionButton = new UIButton(action.name()); - actionButton.setPreferredSize(buttonDimension); + actionButton.setPreferredSize(BUTTON_DIMENSION); actionButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -267,7 +286,7 @@ public class NotificationDialog extends JDialog { } UIButton knowButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Know")); - knowButton.setPreferredSize(buttonDimension); + knowButton.setPreferredSize(BUTTON_DIMENSION); knowButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { From f6cf059be1768012a407c0b40f051b711bcd5af2 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 10 Jun 2022 18:21:51 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E6=97=A0=20JIRA=20=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E8=A1=A5=E5=85=85=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/notification/NotificationDialog.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java b/designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java index 4df430b06..4be51f1a1 100644 --- a/designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java +++ b/designer-base/src/main/java/com/fr/design/components/notification/NotificationDialog.java @@ -61,8 +61,13 @@ public class NotificationDialog extends JDialog { private static final Dimension CONTENT_SIZE = new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT); private static final Dimension BUTTON_DIMENSION = new Dimension(68, 20); + /** + * 标记 LABEL, 没有作用 + */ private static final UILabel SIGN_LABEL = new UILabel("#"); - + /** + * 确认一个 LABEL 的宽高 + */ private static final Dimension SIGN_LABEL_DIMENSION = SIGN_LABEL.getPreferredSize(); private NotificationDialogProperties properties; @@ -187,7 +192,6 @@ public class NotificationDialog extends JDialog { messageComponents = messageComponents.stream() .peek((component) -> { - int size = component.getFont().getSize(); Dimension preferredSize = component.getPreferredSize(); double componentWidth = preferredSize.getWidth(); double componentHeight = preferredSize.getHeight();