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 @@ + + + + + + + + +