Browse Source

REPORT-73557【设计器环境监测】预期外的启动弹窗交互与设计稿不一致

1-添加图标
2-处理 html 的 style, 使背景保持一致。
feature/x
Harrison 2 years ago
parent
commit
fd35564b21
  1. 8
      designer-base/src/main/java/com/fr/design/utils/LinkStrUtils.java
  2. 5
      designer-base/src/main/java/com/fr/env/detect/base/DetectorUtil.java
  3. 41
      designer-base/src/main/java/com/fr/env/detect/ui/DetectorErrorDialog.java
  4. 9
      designer-base/src/main/resources/com/fr/design/standard/reminder/reminder_warning_window.svg

8
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.design.gui.ilable.UILabel;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.JComponent;
import java.awt.Color; import java.awt.Color;
import java.awt.Font; import java.awt.Font;
@ -13,6 +14,13 @@ public class LinkStrUtils {
public static final UILabel LABEL = new UILabel(); 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) { public static String generateHtmlTag(String html) {
String defaultStyle = generateDefaultStyle(); String defaultStyle = generateDefaultStyle();

5
designer-base/src/main/java/com/fr/env/detect/base/DetectorUtil.java vendored

@ -7,7 +7,6 @@ import com.fr.design.components.notification.NotificationMessage;
import com.fr.design.components.notification.NotificationModel; import com.fr.design.components.notification.NotificationModel;
import com.fr.design.components.notification.NotificationType; import com.fr.design.components.notification.NotificationType;
import com.fr.design.dialog.link.MessageWithLink; import com.fr.design.dialog.link.MessageWithLink;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.LinkStrUtils; import com.fr.design.utils.LinkStrUtils;
import com.fr.env.detect.bean.DetectorResult; import com.fr.env.detect.bean.DetectorResult;
import com.fr.env.detect.bean.ExceptionSolution; import com.fr.env.detect.bean.ExceptionSolution;
@ -121,7 +120,7 @@ public class DetectorUtil {
* @param message 信息 * @param message 信息
* @return 组件 * @return 组件
*/ */
public static JComponent convert2TextComponent(@NotNull Message message) { public static JComponent convert2TextComponent(@NotNull Message message, JComponent template) {
if (message.getType() == Message.Type.LINK) { if (message.getType() == Message.Type.LINK) {
Message.Link linkMsg = (Message.Link) message; Message.Link linkMsg = (Message.Link) message;
@ -129,7 +128,7 @@ public class DetectorUtil {
Desktop.getDesktop().browse(URI.create(linkMsg.getLink())); Desktop.getDesktop().browse(URI.create(linkMsg.getLink()));
})); }));
} }
return new UILabel(LinkStrUtils.generateHtmlTag(message.get())); return LinkStrUtils.generateLabel(message.get(), template);
} }
/** /**

41
designer-base/src/main/java/com/fr/env/detect/ui/DetectorErrorDialog.java vendored

@ -1,5 +1,6 @@
package com.fr.env.detect.ui; package com.fr.env.detect.ui;
import com.fr.base.svg.IconUtils;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -47,36 +48,54 @@ public class DetectorErrorDialog extends JDialog implements ActionListener {
super(parent, true); super(parent, true);
JPanel northPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); 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); 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")); northPane.add(headerPane);
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);
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
centerPane.setLayout(new BorderLayout(0, 5));
UILabel detailDesc = new UILabel(Toolkit.i18nText("Fine-Design_Problem_Detail_Message")); UILabel detailDesc = new UILabel(Toolkit.i18nText("Fine-Design_Problem_Detail_Message"));
centerPane.add(detailDesc, BorderLayout.NORTH); centerPane.add(detailDesc, BorderLayout.NORTH);
JPanel detailPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel detailPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
detailPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 10, 10)); detailPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 10, 10));
detailPanel.setLayout(new BorderLayout(0, 8));
for (DetectorResult result : results) { for (DetectorResult result : results) {
JPanel detailItemPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
detailItemPanel.setLayout(new BorderLayout(0, 8));
ExceptionTips tips = result.getTips(); ExceptionTips tips = result.getTips();
UILabel template = new UILabel();
template.setBackground(Color.white);
if (tips != null) { if (tips != null) {
Message tipsMsg = tips.getMessage(); Message tipsMsg = tips.getMessage();
detailPanel.add(DetectorUtil.convert2TextComponent(tipsMsg), BorderLayout.NORTH); detailItemPanel.add(DetectorUtil.convert2TextComponent(tipsMsg, template), BorderLayout.NORTH);
} }
ExceptionSolution solution = result.getSolution(); ExceptionSolution solution = result.getSolution();
if (solution != null) { if (solution != null) {
Message solutionMsg = solution.getMessage(); 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); 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(northPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
this.add(southPane, BorderLayout.SOUTH); this.add(southPane, BorderLayout.SOUTH);
this.setSize(new Dimension(600, 500)); this.setSize(new Dimension(650, 500));
GUICoreUtils.centerWindow(this); GUICoreUtils.centerWindow(this);
} }

9
designer-base/src/main/resources/com/fr/design/standard/reminder/reminder_warning_window.svg

@ -0,0 +1,9 @@
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.70605 45C1.40405 45 0.0540464 42.646 1.70505 39.771L20.998 6.157C22.649 3.281 25.351 3.281 27.001 6.157L46.295 39.771C47.946 42.646 46.596 45 43.294 45H4.70605Z" fill="#FBB03B"/>
<mask id="mask0_1308_50594" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="1" y="4" width="46" height="41">
<path fill-rule="evenodd" clip-rule="evenodd" d="M1 45H47V4H1V45Z" fill="white"/>
</mask>
<g mask="url(#mask0_1308_50594)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M22 39H26V35H22V39ZM27 17L26 33H22L21 17H27Z" fill="white"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 688 B

Loading…
Cancel
Save