diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java index 8eb068fd6..399a644b4 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java @@ -8,11 +8,14 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.gui.imenu.UIMenuItem; +import com.fr.design.gui.imenu.UIMenuItemUI; import com.fr.design.i18n.Toolkit; import com.fr.design.login.DesignerLoginHelper; import com.fr.design.login.DesignerLoginSource; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.share.ui.constants.ColorConstants; import com.fr.design.mainframe.share.util.DownloadUtils; import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog; import com.fr.stable.StringUtils; @@ -22,6 +25,7 @@ import com.fr.workspace.WorkContext; import javax.swing.Action; import javax.swing.JOptionPane; import javax.swing.SwingWorker; +import java.awt.Color; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.WindowAdapter; @@ -44,6 +48,15 @@ public class DownloadSuitableThemeAction extends UpdateAction { this.setName(Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme")); } + @Override + public UIMenuItem createMenuItem() { + UIMenuItem menuItem = super.createMenuItem(); + menuItem.setOpaque(true); + menuItem.setBackground(ColorConstants.BACKGROUND); + menuItem.setUI(new SharedComponentActionMenuItemUI()); + return menuItem; + } + @Override public void actionPerformed(ActionEvent e) { currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java index 73a91fc87..698ec7545 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java @@ -1,11 +1,14 @@ package com.fr.design.mainframe.share.ui.actions; import com.fr.design.actions.UpdateAction; +import com.fr.design.gui.imenu.UIMenuItem; +import com.fr.design.gui.imenu.UIMenuItemUI; import com.fr.design.i18n.Toolkit; -import com.fr.form.share.bean.OnlineShareWidget; +import com.fr.design.mainframe.share.ui.constants.ColorConstants; import com.fr.stable.StringUtils; import javax.swing.Action; +import java.awt.Color; import java.awt.Desktop; import java.awt.event.ActionEvent; import java.io.IOException; @@ -27,6 +30,15 @@ public class Jump2DetailAction extends UpdateAction { this.setName(Toolkit.i18nText("Fine-Design_Share_Jump_To_Detail")); } + @Override + public UIMenuItem createMenuItem() { + UIMenuItem menuItem = super.createMenuItem(); + menuItem.setOpaque(true); + menuItem.setBackground(ColorConstants.BACKGROUND); + menuItem.setUI(new SharedComponentActionMenuItemUI()); + return menuItem; + } + @Override public void actionPerformed(ActionEvent e) { if (StringUtils.isNotEmpty(id)) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/SharedComponentActionMenuItemUI.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/SharedComponentActionMenuItemUI.java new file mode 100644 index 000000000..ca4d499b1 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/SharedComponentActionMenuItemUI.java @@ -0,0 +1,44 @@ +package com.fr.design.mainframe.share.ui.actions; + +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.imenu.UIMenuItemUI; +import com.fr.design.utils.gui.GUIPaintUtils; +import com.fr.stable.Constants; + +import javax.swing.ButtonModel; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/10/18 + */ +public class SharedComponentActionMenuItemUI extends UIMenuItemUI { + + @Override + protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) { + ButtonModel model = menuItem.getModel(); + Color oldColor = g.getColor(); + int menuWidth = menuItem.getWidth(); + int menuHeight = menuItem.getHeight(); + + g.setColor(UIConstants.NORMAL_BACKGROUND); + g.fillRect(0, 0, menuWidth, menuHeight); + if (menuItem.isOpaque()) { + if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) { + GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7); + } else { + GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, menuItem.getBackground(), 7); + } + g.setColor(oldColor); + } else if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) { + GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7); + g.setColor(oldColor); + } + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java index 54a813c43..5ce5b57dd 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java @@ -1,10 +1,10 @@ package com.fr.design.mainframe.share.ui.block; -import com.fr.design.constants.UIConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.share.ui.actions.DownloadSuitableThemeAction; import com.fr.design.mainframe.share.ui.actions.Jump2DetailAction; +import com.fr.design.mainframe.share.ui.constants.ColorConstants; import com.fr.design.mainframe.share.ui.online.OnlineResourceManager; import com.fr.design.mainframe.share.ui.online.OnlineWidgetSelectPane; import com.fr.design.mainframe.share.ui.online.ResourceLoader; @@ -116,7 +116,7 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock UIPopupMenu popupMenu = new UIPopupMenu(); popupMenu.setOnlyText(true); - popupMenu.setBackground(UIConstants.DEFAULT_BG_RULER); - popupMenu.add(new PopupMenuItem(new MoveGroupAction())); - popupMenu.add(new PopupMenuItem(new RemoveAction())); + popupMenu.setOpaque(true); + popupMenu.setBackground(ColorConstants.BACKGROUND); + popupMenu.add(new MoveGroupAction().createMenuItem()); + popupMenu.add(new RemoveAction().createMenuItem()); return popupMenu; } @@ -288,6 +292,15 @@ public class LocalWidgetBlock extends PreviewWidgetBlock this.setName(Toolkit.i18nText("Fine-Design_Share_Group_Move")); } + @Override + public UIMenuItem createMenuItem() { + UIMenuItem menuItem = super.createMenuItem(); + menuItem.setOpaque(true); + menuItem.setBackground(ColorConstants.BACKGROUND); + menuItem.setUI(new SharedComponentActionMenuItemUI()); + return menuItem; + } + @Override public void actionPerformed(ActionEvent e) { new GroupMoveDialog(DesignerContext.getDesignerFrame()) { @@ -314,6 +327,15 @@ public class LocalWidgetBlock extends PreviewWidgetBlock this.setName(Toolkit.i18nText("Fine-Design_Share_Remove")); } + @Override + public UIMenuItem createMenuItem() { + UIMenuItem menuItem = super.createMenuItem(); + menuItem.setOpaque(true); + menuItem.setBackground(ColorConstants.BACKGROUND); + menuItem.setUI(new SharedComponentActionMenuItemUI()); + return menuItem; + } + @Override public void actionPerformed(ActionEvent e) { int rv = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/constants/ColorConstants.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/constants/ColorConstants.java new file mode 100644 index 000000000..6bd815142 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/constants/ColorConstants.java @@ -0,0 +1,12 @@ +package com.fr.design.mainframe.share.ui.constants; + +import java.awt.Color; + +/** + * @author Starryi + * @version 1.0 + * Created by Starryi on 2021/10/19 + */ +public class ColorConstants { + public static final Color BACKGROUND = new Color(0xF0F0F1); +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java index 84083b404..3113fd06f 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java @@ -5,6 +5,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.share.ui.base.AbstractWidgetPopupPreviewPane; import com.fr.design.mainframe.share.ui.block.PreviewWidgetBlock; +import com.fr.design.mainframe.share.ui.constants.ColorConstants; import com.fr.form.share.bean.OnlineShareWidget; import com.fr.general.FRFont; import com.fr.general.IOUtils; @@ -15,6 +16,7 @@ import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JSeparator; import javax.swing.SwingConstants; +import javax.swing.plaf.basic.BasicLabelUI; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; @@ -43,10 +45,13 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane private UILabel suitableThemeNameLabel; public OnlineWidgetPopupPreviewPane() { + super(); setPreferredSize(new Dimension(POPUP_WIDTH, getPreferredSize().height)); setLayout(new BorderLayout(0, 0)); - setOpaque(true); - setBackground(new Color(0xF0F0F1)); + setBorder(BorderFactory.createLineBorder(new Color(0xDADADD))); + setBorderPainted(true); + setOpaque(false); + setBackground(ColorConstants.BACKGROUND); suitableThemeNamePane = createSuitableThemeNamePane(); JPanel previewImagePane = createPreviewImagePane(); @@ -57,8 +62,9 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane private JPanel createSuitableThemeNamePane() { suitableThemeNameLabel = new UILabel(); + suitableThemeNameLabel.setUI(new BasicLabelUI()); suitableThemeNameLabel.setOpaque(false); - suitableThemeNameLabel.setBackground(new Color(0xF5F5F7)); + suitableThemeNameLabel.setBackground(null); suitableThemeNameLabel.setIcon(IOUtils.readIcon("/com/fr/design/icon/icon_predefined_style.png")); suitableThemeNameLabel.setIconTextGap(IntervalConstants.INTERVAL_L6); @@ -92,10 +98,12 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane versionLabel = new UILabel(); versionLabel.setVerticalAlignment(SwingConstants.CENTER); versionLabel.setFont(FRFont.getInstance(versionLabel.getFont()).deriveFont(12.0F)); + versionLabel.setForeground(new Color(0x333334)); downloadsLabel = new UILabel(); downloadsLabel.setVerticalAlignment(SwingConstants.TOP); downloadsLabel.setFont(FRFont.getInstance(downloadsLabel.getFont()).deriveFont(12.0F)); + downloadsLabel.setForeground(new Color(0x333334)); priceLabel = new UILabel(); priceLabel.setVerticalAlignment(SwingConstants.CENTER); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java index 4e8f9ffc5..7623c2e0a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java @@ -151,7 +151,7 @@ public class FilterPane extends JPanel { Point p = FilterPane.this.getLocationOnScreen(); popup = pf.getPopup(FilterPane.this, filterPopupPane, p.x, p.y + FilterPane.this.getHeight()); popup.show(); - filterPopupPane.setPreferredSize(new Dimension(228, filterPopupPane.getHeight())); + filterPopupPane.setPreferredSize(new Dimension(filterPopupPane.getWidth(), filterPopupPane.getHeight())); showPopup = true; arrowButton.setIcon(FILTER_COMBO_UP); firePopupStateChange(true); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java index e2bcd5344..f0d3714c7 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java @@ -31,6 +31,8 @@ public abstract class FilterPopupPane extends JPanel { private static final Color BORDER_COLOR = Color.decode("#D9DADD"); private static final String FILTER_ALL_ID = "0"; + public static final int CONTENT_WIDTH = 225; + FilterPane filterPane; private List filterList = new ArrayList<>(); private final List checkBoxList = new ArrayList<>(); @@ -101,7 +103,7 @@ public abstract class FilterPopupPane extends JPanel { jPanel.setBackground(Color.WHITE); UILabel titleLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Type")); titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); - titleLabel.setPreferredSize(new Dimension(226, 20)); + titleLabel.setPreferredSize(new Dimension(CONTENT_WIDTH - 2, 20)); titleLabel.setOpaque(true); titleLabel.setBackground(Color.decode("#EDEDEE")); jPanel.add(titleLabel, BorderLayout.NORTH); @@ -131,7 +133,7 @@ public abstract class FilterPopupPane extends JPanel { jPanel.setBackground(Color.WHITE); UILabel titleLabel = new UILabel(filterTypeInfo.getTitle()); titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); - titleLabel.setPreferredSize(new Dimension(226, 20)); + titleLabel.setPreferredSize(new Dimension(CONTENT_WIDTH - 2, 20)); titleLabel.setOpaque(true); titleLabel.setBackground(Color.decode("#EDEDEE")); jPanel.add(titleLabel, BorderLayout.NORTH); @@ -150,7 +152,7 @@ public abstract class FilterPopupPane extends JPanel { } } int contentPaneHeight = ((displayCount + 1) / 2) * 27; - contentPane.setPreferredSize(new Dimension(228, contentPaneHeight)); + contentPane.setPreferredSize(new Dimension(CONTENT_WIDTH, contentPaneHeight)); for (final WidgetFilterInfo filterInfo : filterTypeInfo.getFilterItems()) { if (ComparatorUtils.equals(FILTER_ALL_ID, filterInfo.getId())) { continue; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java index 302cc45b7..cafbf7d54 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/CustomStylePane.java @@ -114,11 +114,10 @@ public class CustomStylePane extends MultiTabPane