From 182d70f604ada283eac66543e37ea6e347247c8b Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 20 May 2022 14:27:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-71957=20=E7=BB=84=E4=BB=B6=E5=A4=8D?= =?UTF-8?q?=E7=94=A8-=E5=88=9B=E5=BB=BA=E7=BB=84=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E5=90=8E=E6=8F=90=E7=A4=BA=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=88=9B=E5=BB=BA=E5=A4=B1=E8=B4=A5=EF=BC=8C?= =?UTF-8?q?=E4=B8=94=E6=97=A5=E5=BF=97=E6=9C=89=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 生成组件时需要使用组件名称作为文件名创建临时文件,而组件名称中可能 包含不合法字符,导致临时文件创建失败。虽然这种文件创建失败的情况 只会在特定操作系统上出现,但考虑到共享组件跨平台应用的可能性,因此 需要统一检查组件名称的合法性,以便在使用时能使用此名称创建文件。 若创建组件时名称非法,则给出提示。 【改动思路】 同上 【review建议】 --- .../com/fr/design/share/ui/generate/ShareMainPane.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java index ea5298cf2..6ec3fa61e 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java @@ -32,6 +32,7 @@ import com.fr.design.mainframe.share.ui.base.ui.PlaceHolderUI; import com.fr.design.mainframe.share.util.ShareUIUtils; import com.fr.design.share.effect.EffectItemGroup; import com.fr.design.share.utils.ShareDialogUtils; +import com.fr.file.FileCommonUtils; import com.fr.form.share.DefaultSharableWidget; import com.fr.form.share.bean.StyleThemeBean; import com.fr.form.share.constants.ShareComponentConstants; @@ -581,6 +582,15 @@ public class ShareMainPane extends JPanel { Toolkit.i18nText("Fine-Design_Basic_Error"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); return false; } + if (FileCommonUtils.isFileNameValid(name)) { + FineJOptionPane.showMessageDialog( + shareDialog, + Toolkit.i18nText("Fine-Design_Share_Generate_Failure_Illegal_Component_Name_Tip"), + Toolkit.i18nText("Fine-Design_Basic_Error"), + ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon")); + return false; + } if (upload && StringUtils.isEmpty(content.getText())) { FineJOptionPane.showMessageDialog(shareDialog, Toolkit.i18nText("Fine-Design_Share_Lack_Content"), Toolkit.i18nText("Fine-Design_Basic_Error"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); From 76d77a6e9ee10449dc4d5836fa8c30d5ef3cb9a3 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 2 Jun 2022 10:19:52 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-72073=20alphafine,=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=8A=80=E5=B7=A7=E4=BA=A4=E4=BA=92=E6=95=88=E6=9E=9C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineConstants.java | 4 +- .../alphafine/component/AlphaFineFrame.java | 59 ++++++++++++++++--- .../alphafine/images/light_yellow_bulb.svg | 4 ++ .../alphafine/images/yellow_bulb.svg | 4 ++ 4 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/light_yellow_bulb.svg create mode 100644 designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/yellow_bulb.svg diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index 9ceec2a2f..8de2a0d63 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -191,7 +191,9 @@ public class AlphaFineConstants { public static final Icon BULB_ICON = IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/bulb.svg"); - public static final Icon BLUE_BULB_ICON = IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/blue_bulb.svg"); + public static final Icon YELLOW_BULB_ICON = IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/yellow_bulb.svg"); + + public static final Icon LIGHT_YELLOW_BULB_ICON = IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/light_yellow_bulb.svg"); public static final String HOT_SEARCH = Toolkit.i18nText("Fine-Design_Report_AlphaFine_Hot_Search"); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java index db89cf348..b6819f56c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java @@ -33,6 +33,7 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.PluginSearchManager import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.SegmentationManager; import com.fr.design.utils.DesignUtils; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; import java.awt.BorderLayout; @@ -66,8 +67,11 @@ import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; +import javax.swing.JPopupMenu; import javax.swing.SwingConstants; import javax.swing.Timer; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; /** * @author hades @@ -241,13 +245,10 @@ public class AlphaFineFrame extends JFrame { topRightPane.setBackground(Color.WHITE); JPanel tipPane = new JPanel(new BorderLayout()); tipPane.setBackground(Color.WHITE); - String toolTip = AlphaFineShortCutUtil.getDisplayShortCut(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Short_Cut", DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortcuts())); tipIconLabel = new UILabel(AlphaFineConstants.BULB_ICON); tipIconLabel.addMouseListener(tipMouseListener); - tipIconLabel.setToolTipText(toolTip); useTipLabel = new UILabel(SKILLS); useTipLabel.addMouseListener(tipMouseListener); - useTipLabel.setToolTipText(toolTip); useTipLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_6); tipPane.add(tipIconLabel, BorderLayout.WEST); tipPane.add(useTipLabel, BorderLayout.CENTER); @@ -264,19 +265,63 @@ public class AlphaFineFrame extends JFrame { private MouseAdapter tipMouseListener = new MouseAdapter() { + private JPopupMenu popupMenu; + @Override public void mouseEntered(MouseEvent e) { - useTipLabel.setForeground(UIConstants.FLESH_BLUE); - tipIconLabel.setIcon(AlphaFineConstants.BLUE_BULB_ICON); + tipIconLabel.setIcon(AlphaFineConstants.YELLOW_BULB_ICON); } @Override public void mouseExited(MouseEvent e) { - useTipLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_6); - tipIconLabel.setIcon(AlphaFineConstants.BULB_ICON); + if (popupMenu == null || !popupMenu.isShowing()) { + useTipLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_6); + tipIconLabel.setIcon(AlphaFineConstants.BULB_ICON); + } + } + + @Override + public void mousePressed(MouseEvent e) { + useTipLabel.setForeground(UIConstants.FLESH_BLUE); + tipIconLabel.setIcon(AlphaFineConstants.LIGHT_YELLOW_BULB_ICON); + popupMenu = createTipPop(); + GUICoreUtils.showPopupMenu(popupMenu, e.getComponent(), e.getComponent().getX() - 60, e.getComponent().getY() + 20); } }; + + private JPopupMenu createTipPop() { + JPanel panel = new JPanel(new BorderLayout()); + String toolTip = AlphaFineShortCutUtil.getDisplayShortCut(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Short_Cut", DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortcuts())); + UILabel label = new UILabel(toolTip); + label.setForeground(AlphaFineConstants.FOREGROUND_COLOR_8); + label.setBackground(Color.WHITE); + panel.add(label); + panel.setBackground(Color.WHITE); + JPopupMenu popupMenu = new JPopupMenu(); + popupMenu.setBorder(BorderFactory.createEmptyBorder(20, 5, 10, 5)); + popupMenu.add(panel); + popupMenu.setBackground(Color.WHITE); + popupMenu.addPopupMenuListener(new PopupMenuListener() { + @Override + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + // do nothing + } + + @Override + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + useTipLabel.setForeground(AlphaFineConstants.FOREGROUND_COLOR_6); + tipIconLabel.setIcon(AlphaFineConstants.BULB_ICON); + } + + @Override + public void popupMenuCanceled(PopupMenuEvent e) { + // do nothing + } + }); + return popupMenu; + } + private JPanel createSearchPane() { JPanel searchPane = new JPanel(new BorderLayout()); searchPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/light_yellow_bulb.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/light_yellow_bulb.svg new file mode 100644 index 000000000..16608753f --- /dev/null +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/light_yellow_bulb.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/yellow_bulb.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/yellow_bulb.svg new file mode 100644 index 000000000..cabda1d9d --- /dev/null +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/yellow_bulb.svg @@ -0,0 +1,4 @@ + + + +