From fd35564b2155aabab1d6130e3bed96950ff34b0b Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 14 Jun 2022 13:38:08 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-73557=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=E9=A2=84?= =?UTF-8?q?=E6=9C=9F=E5=A4=96=E7=9A=84=E5=90=AF=E5=8A=A8=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E4=B8=8E=E8=AE=BE=E8=AE=A1=E7=A8=BF=E4=B8=8D?= =?UTF-8?q?=E4=B8=80=E8=87=B4=201-=E6=B7=BB=E5=8A=A0=E5=9B=BE=E6=A0=87=202?= =?UTF-8?q?-=E5=A4=84=E7=90=86=20html=20=E7=9A=84=20style,=20=E4=BD=BF?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/utils/LinkStrUtils.java | 8 ++++ .../com/fr/env/detect/base/DetectorUtil.java | 5 +-- .../fr/env/detect/ui/DetectorErrorDialog.java | 41 ++++++++++++++----- .../reminder/reminder_warning_window.svg | 9 ++++ 4 files changed, 49 insertions(+), 14 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/standard/reminder/reminder_warning_window.svg diff --git a/designer-base/src/main/java/com/fr/design/utils/LinkStrUtils.java b/designer-base/src/main/java/com/fr/design/utils/LinkStrUtils.java index d02c9abff2..b7f8217b44 100644 --- a/designer-base/src/main/java/com/fr/design/utils/LinkStrUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/LinkStrUtils.java @@ -3,6 +3,7 @@ package com.fr.design.utils; import com.fr.design.gui.ilable.UILabel; import com.fr.stable.StringUtils; +import javax.swing.JComponent; import java.awt.Color; import java.awt.Font; @@ -13,6 +14,13 @@ public class LinkStrUtils { public static final UILabel LABEL = new UILabel(); + public static UILabel generateLabel(String html, JComponent templateLabel) { + + String style = generateStyle(templateLabel.getBackground(), templateLabel.getFont(), templateLabel.getForeground()); + String fullHtml = generateHtmlTag(style, html); + return new UILabel(fullHtml); + } + public static String generateHtmlTag(String html) { String defaultStyle = generateDefaultStyle(); 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 fd6c33607c..b9253ed4cc 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 @@ -7,7 +7,6 @@ import com.fr.design.components.notification.NotificationMessage; import com.fr.design.components.notification.NotificationModel; import com.fr.design.components.notification.NotificationType; import com.fr.design.dialog.link.MessageWithLink; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.LinkStrUtils; import com.fr.env.detect.bean.DetectorResult; import com.fr.env.detect.bean.ExceptionSolution; @@ -121,7 +120,7 @@ public class DetectorUtil { * @param message 信息 * @return 组件 */ - public static JComponent convert2TextComponent(@NotNull Message message) { + public static JComponent convert2TextComponent(@NotNull Message message, JComponent template) { if (message.getType() == Message.Type.LINK) { Message.Link linkMsg = (Message.Link) message; @@ -129,7 +128,7 @@ public class DetectorUtil { Desktop.getDesktop().browse(URI.create(linkMsg.getLink())); })); } - return new UILabel(LinkStrUtils.generateHtmlTag(message.get())); + return LinkStrUtils.generateLabel(message.get(), template); } /** diff --git a/designer-base/src/main/java/com/fr/env/detect/ui/DetectorErrorDialog.java b/designer-base/src/main/java/com/fr/env/detect/ui/DetectorErrorDialog.java index 9b85c61af2..43a2f00b9d 100644 --- a/designer-base/src/main/java/com/fr/env/detect/ui/DetectorErrorDialog.java +++ b/designer-base/src/main/java/com/fr/env/detect/ui/DetectorErrorDialog.java @@ -1,5 +1,6 @@ package com.fr.env.detect.ui; +import com.fr.base.svg.IconUtils; import com.fr.design.RestartHelper; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; @@ -47,36 +48,54 @@ public class DetectorErrorDialog extends JDialog implements ActionListener { super(parent, true); JPanel northPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + JPanel headerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + headerPane.setLayout(new BorderLayout(15, 0)); + + UILabel iconLabel = new UILabel(IconUtils.readIcon("/com/fr/design/standard/reminder/reminder_warning_window.svg")); + headerPane.add(iconLabel, BorderLayout.WEST); + JPanel messagePane = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); + { + UILabel boldHeader = new UILabel(Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message")); + Font font = FRFont.getInstance(boldHeader.getFont().getFontName(), Font.PLAIN, 16); + boldHeader.setFont(font); + messagePane.add(boldHeader); + + UILabel description = new UILabel(Toolkit.i18nText("Fine-Design_Send_Report_To_Us")); + messagePane.add(description); + } + headerPane.add(messagePane, BorderLayout.CENTER); - UILabel boldHeader = new UILabel(Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message")); - Font font = FRFont.getInstance(boldHeader.getFont().getFontName(), Font.BOLD, 20); - boldHeader.setFont(font); - messagePane.add(boldHeader); - - UILabel description = new UILabel(Toolkit.i18nText("Fine-Design_Send_Report_To_Us")); - messagePane.add(description); - northPane.add(messagePane); + northPane.add(headerPane); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + centerPane.setLayout(new BorderLayout(0, 5)); UILabel detailDesc = new UILabel(Toolkit.i18nText("Fine-Design_Problem_Detail_Message")); centerPane.add(detailDesc, BorderLayout.NORTH); JPanel detailPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); detailPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 10, 10)); + detailPanel.setLayout(new BorderLayout(0, 8)); for (DetectorResult result : results) { + JPanel detailItemPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + detailItemPanel.setLayout(new BorderLayout(0, 8)); ExceptionTips tips = result.getTips(); + + UILabel template = new UILabel(); + template.setBackground(Color.white); + if (tips != null) { Message tipsMsg = tips.getMessage(); - detailPanel.add(DetectorUtil.convert2TextComponent(tipsMsg), BorderLayout.NORTH); + detailItemPanel.add(DetectorUtil.convert2TextComponent(tipsMsg, template), BorderLayout.NORTH); } ExceptionSolution solution = result.getSolution(); if (solution != null) { Message solutionMsg = solution.getMessage(); - detailPanel.add(DetectorUtil.convert2TextComponent(solutionMsg), BorderLayout.CENTER); + detailItemPanel.add(DetectorUtil.convert2TextComponent(solutionMsg, template), BorderLayout.CENTER); } + detailPanel.add(detailItemPanel, BorderLayout.CENTER); } JScrollPane detailPanelWrapper = new JScrollPane(detailPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); @@ -110,7 +129,7 @@ public class DetectorErrorDialog extends JDialog implements ActionListener { this.add(northPane, BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); this.add(southPane, BorderLayout.SOUTH); - this.setSize(new Dimension(600, 500)); + this.setSize(new Dimension(650, 500)); GUICoreUtils.centerWindow(this); } diff --git a/designer-base/src/main/resources/com/fr/design/standard/reminder/reminder_warning_window.svg b/designer-base/src/main/resources/com/fr/design/standard/reminder/reminder_warning_window.svg new file mode 100644 index 0000000000..66dde59232 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/standard/reminder/reminder_warning_window.svg @@ -0,0 +1,9 @@ + + + + + + + + +