Browse Source

REPORT-61108 【视觉验收】--主题获取

【问题原因】
调整共享组件面板的样式

【改动思路】
同上
bugfix/11.0
Starryi 3 years ago
parent
commit
022b4af184
  1. 13
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java
  2. 14
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java
  3. 44
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/SharedComponentActionMenuItemUI.java
  4. 4
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java
  5. 28
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java
  6. 12
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/constants/ColorConstants.java
  7. 14
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetPopupPreviewPane.java
  8. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java
  9. 8
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPopupPane.java

13
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.actions.UpdateAction;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache; 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.i18n.Toolkit;
import com.fr.design.login.DesignerLoginHelper; import com.fr.design.login.DesignerLoginHelper;
import com.fr.design.login.DesignerLoginSource; import com.fr.design.login.DesignerLoginSource;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; 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.share.util.DownloadUtils;
import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog; import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -22,6 +25,7 @@ import com.fr.workspace.WorkContext;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import java.awt.Color;
import java.awt.Window; import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
@ -44,6 +48,15 @@ public class DownloadSuitableThemeAction extends UpdateAction {
this.setName(Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme")); 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 @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();

14
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; package com.fr.design.mainframe.share.ui.actions;
import com.fr.design.actions.UpdateAction; 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.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 com.fr.stable.StringUtils;
import javax.swing.Action; import javax.swing.Action;
import java.awt.Color;
import java.awt.Desktop; import java.awt.Desktop;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.IOException; import java.io.IOException;
@ -27,6 +30,15 @@ public class Jump2DetailAction extends UpdateAction {
this.setName(Toolkit.i18nText("Fine-Design_Share_Jump_To_Detail")); 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 @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (StringUtils.isNotEmpty(id)) { if (StringUtils.isNotEmpty(id)) {

44
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);
}
}
}

4
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; 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.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.share.ui.actions.DownloadSuitableThemeAction; 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.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.OnlineResourceManager;
import com.fr.design.mainframe.share.ui.online.OnlineWidgetSelectPane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetSelectPane;
import com.fr.design.mainframe.share.ui.online.ResourceLoader; import com.fr.design.mainframe.share.ui.online.ResourceLoader;
@ -116,7 +116,7 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<Onlin
public JPopupMenu createRightClickPopupMenu() { public JPopupMenu createRightClickPopupMenu() {
UIPopupMenu popupMenu = new UIPopupMenu(); UIPopupMenu popupMenu = new UIPopupMenu();
popupMenu.setOnlyText(true); popupMenu.setOnlyText(true);
popupMenu.setBackground(UIConstants.DEFAULT_BG_RULER); popupMenu.setBackground(ColorConstants.BACKGROUND);
OnlineShareWidget widget = getWidget(); OnlineShareWidget widget = getWidget();
String suitableThemeFile = widget.getThemePath(); String suitableThemeFile = widget.getThemePath();

28
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java

@ -9,13 +9,16 @@ import com.fr.design.designer.creator.XCreator;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.WidgetToolBarPane; import com.fr.design.mainframe.WidgetToolBarPane;
import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.group.ui.GroupMoveDialog; import com.fr.design.mainframe.share.group.ui.GroupMoveDialog;
import com.fr.design.mainframe.share.ui.actions.SharedComponentActionMenuItemUI;
import com.fr.design.mainframe.share.ui.base.PopupMenuItem; import com.fr.design.mainframe.share.ui.base.PopupMenuItem;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane;
import com.fr.design.mainframe.share.ui.local.LocalWidgetSelectPane; import com.fr.design.mainframe.share.ui.local.LocalWidgetSelectPane;
import com.fr.design.mainframe.share.ui.local.WidgetSelectedManager; import com.fr.design.mainframe.share.ui.local.WidgetSelectedManager;
@ -275,9 +278,10 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
UIPopupMenu popupMenu = new UIPopupMenu(); UIPopupMenu popupMenu = new UIPopupMenu();
popupMenu.setOnlyText(true); popupMenu.setOnlyText(true);
popupMenu.setBackground(UIConstants.DEFAULT_BG_RULER); popupMenu.setOpaque(true);
popupMenu.add(new PopupMenuItem(new MoveGroupAction())); popupMenu.setBackground(ColorConstants.BACKGROUND);
popupMenu.add(new PopupMenuItem(new RemoveAction())); popupMenu.add(new MoveGroupAction().createMenuItem());
popupMenu.add(new RemoveAction().createMenuItem());
return popupMenu; return popupMenu;
} }
@ -288,6 +292,15 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
this.setName(Toolkit.i18nText("Fine-Design_Share_Group_Move")); 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 @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
new GroupMoveDialog(DesignerContext.getDesignerFrame()) { new GroupMoveDialog(DesignerContext.getDesignerFrame()) {
@ -314,6 +327,15 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
this.setName(Toolkit.i18nText("Fine-Design_Share_Remove")); 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 @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
int rv = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), int rv = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),

12
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);
}

14
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.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.share.ui.base.AbstractWidgetPopupPreviewPane; 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.block.PreviewWidgetBlock;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.form.share.bean.OnlineShareWidget; import com.fr.form.share.bean.OnlineShareWidget;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
@ -15,6 +16,7 @@ import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JSeparator; import javax.swing.JSeparator;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.plaf.basic.BasicLabelUI;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
@ -43,10 +45,13 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane
private UILabel suitableThemeNameLabel; private UILabel suitableThemeNameLabel;
public OnlineWidgetPopupPreviewPane() { public OnlineWidgetPopupPreviewPane() {
super();
setPreferredSize(new Dimension(POPUP_WIDTH, getPreferredSize().height)); setPreferredSize(new Dimension(POPUP_WIDTH, getPreferredSize().height));
setLayout(new BorderLayout(0, 0)); setLayout(new BorderLayout(0, 0));
setOpaque(true); setBorder(BorderFactory.createLineBorder(new Color(0xDADADD)));
setBackground(new Color(0xF0F0F1)); setBorderPainted(true);
setOpaque(false);
setBackground(ColorConstants.BACKGROUND);
suitableThemeNamePane = createSuitableThemeNamePane(); suitableThemeNamePane = createSuitableThemeNamePane();
JPanel previewImagePane = createPreviewImagePane(); JPanel previewImagePane = createPreviewImagePane();
@ -57,8 +62,9 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane
private JPanel createSuitableThemeNamePane() { private JPanel createSuitableThemeNamePane() {
suitableThemeNameLabel = new UILabel(); suitableThemeNameLabel = new UILabel();
suitableThemeNameLabel.setUI(new BasicLabelUI());
suitableThemeNameLabel.setOpaque(false); suitableThemeNameLabel.setOpaque(false);
suitableThemeNameLabel.setBackground(new Color(0xF5F5F7)); suitableThemeNameLabel.setBackground(null);
suitableThemeNameLabel.setIcon(IOUtils.readIcon("/com/fr/design/icon/icon_predefined_style.png")); suitableThemeNameLabel.setIcon(IOUtils.readIcon("/com/fr/design/icon/icon_predefined_style.png"));
suitableThemeNameLabel.setIconTextGap(IntervalConstants.INTERVAL_L6); suitableThemeNameLabel.setIconTextGap(IntervalConstants.INTERVAL_L6);
@ -92,10 +98,12 @@ public class OnlineWidgetPopupPreviewPane extends AbstractWidgetPopupPreviewPane
versionLabel = new UILabel(); versionLabel = new UILabel();
versionLabel.setVerticalAlignment(SwingConstants.CENTER); versionLabel.setVerticalAlignment(SwingConstants.CENTER);
versionLabel.setFont(FRFont.getInstance(versionLabel.getFont()).deriveFont(12.0F)); versionLabel.setFont(FRFont.getInstance(versionLabel.getFont()).deriveFont(12.0F));
versionLabel.setForeground(new Color(0x333334));
downloadsLabel = new UILabel(); downloadsLabel = new UILabel();
downloadsLabel.setVerticalAlignment(SwingConstants.TOP); downloadsLabel.setVerticalAlignment(SwingConstants.TOP);
downloadsLabel.setFont(FRFont.getInstance(downloadsLabel.getFont()).deriveFont(12.0F)); downloadsLabel.setFont(FRFont.getInstance(downloadsLabel.getFont()).deriveFont(12.0F));
downloadsLabel.setForeground(new Color(0x333334));
priceLabel = new UILabel(); priceLabel = new UILabel();
priceLabel.setVerticalAlignment(SwingConstants.CENTER); priceLabel.setVerticalAlignment(SwingConstants.CENTER);

2
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(); Point p = FilterPane.this.getLocationOnScreen();
popup = pf.getPopup(FilterPane.this, filterPopupPane, p.x, p.y + FilterPane.this.getHeight()); popup = pf.getPopup(FilterPane.this, filterPopupPane, p.x, p.y + FilterPane.this.getHeight());
popup.show(); popup.show();
filterPopupPane.setPreferredSize(new Dimension(228, filterPopupPane.getHeight())); filterPopupPane.setPreferredSize(new Dimension(filterPopupPane.getWidth(), filterPopupPane.getHeight()));
showPopup = true; showPopup = true;
arrowButton.setIcon(FILTER_COMBO_UP); arrowButton.setIcon(FILTER_COMBO_UP);
firePopupStateChange(true); firePopupStateChange(true);

8
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 Color BORDER_COLOR = Color.decode("#D9DADD");
private static final String FILTER_ALL_ID = "0"; private static final String FILTER_ALL_ID = "0";
public static final int CONTENT_WIDTH = 225;
FilterPane filterPane; FilterPane filterPane;
private List<WidgetFilterInfo> filterList = new ArrayList<>(); private List<WidgetFilterInfo> filterList = new ArrayList<>();
private final List<UICheckBox> checkBoxList = new ArrayList<>(); private final List<UICheckBox> checkBoxList = new ArrayList<>();
@ -101,7 +103,7 @@ public abstract class FilterPopupPane extends JPanel {
jPanel.setBackground(Color.WHITE); jPanel.setBackground(Color.WHITE);
UILabel titleLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Type")); UILabel titleLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Type"));
titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); 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.setOpaque(true);
titleLabel.setBackground(Color.decode("#EDEDEE")); titleLabel.setBackground(Color.decode("#EDEDEE"));
jPanel.add(titleLabel, BorderLayout.NORTH); jPanel.add(titleLabel, BorderLayout.NORTH);
@ -131,7 +133,7 @@ public abstract class FilterPopupPane extends JPanel {
jPanel.setBackground(Color.WHITE); jPanel.setBackground(Color.WHITE);
UILabel titleLabel = new UILabel(filterTypeInfo.getTitle()); UILabel titleLabel = new UILabel(filterTypeInfo.getTitle());
titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); 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.setOpaque(true);
titleLabel.setBackground(Color.decode("#EDEDEE")); titleLabel.setBackground(Color.decode("#EDEDEE"));
jPanel.add(titleLabel, BorderLayout.NORTH); jPanel.add(titleLabel, BorderLayout.NORTH);
@ -150,7 +152,7 @@ public abstract class FilterPopupPane extends JPanel {
} }
} }
int contentPaneHeight = ((displayCount + 1) / 2) * 27; 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()) { for (final WidgetFilterInfo filterInfo : filterTypeInfo.getFilterItems()) {
if (ComparatorUtils.equals(FILTER_ALL_ID, filterInfo.getId())) { if (ComparatorUtils.equals(FILTER_ALL_ID, filterInfo.getId())) {
continue; continue;

Loading…
Cancel
Save