Browse Source

Pull request #4304: REPORT-51678 组件复用插件代码合并--补充SnapChat相关逻辑

Merge in DESIGN/design from ~TOMMY/design:feature/10.0 to feature/10.0

* commit '4f70159da57d5a2e3731f8fa9040a5872f677b36':
  REPORT-51678 同步部分插件修复代码
  REPORT-52364 SnapChat弹窗资源路径修改与国际化
  REPORT-52490 社区菜单添加模板商城入口
  REPORT-51678 promptWindow逻辑反了
  REPORT-51678 组件复用插件代码合并--补充SnapChat相关逻辑
feature/10.0
Tommy 3 years ago
parent
commit
89997d193c
  1. 9
      designer-base/src/main/java/com/fr/design/actions/community/TemplateStoreAction.java
  2. 33
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  3. 167
      designer-base/src/main/java/com/fr/design/mainframe/reuse/ReuseGuideDialog.java
  4. 2
      designer-base/src/main/java/com/fr/design/mainframe/reuse/SnapChatKeys.java
  5. 0
      designer-base/src/main/java/com/fr/design/mainframe/share/collect/CollectorManager.java
  6. 0
      designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java
  7. 0
      designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentSender.java
  8. 1
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  9. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/ToolbarPane.java
  10. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java
  11. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetShowPane.java
  12. 10
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java
  13. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallComponentHelper.java
  14. 2
      designer-realize/src/main/java/com/fr/design/share/ui/config/ShareConfigPane.java
  15. 5
      designer-realize/src/main/java/com/fr/design/share/ui/generate/EffectContent.java

9
designer-form/src/main/java/com/fr/design/mainframe/share/ui/menu/TemplateStoreMenu.java → designer-base/src/main/java/com/fr/design/actions/community/TemplateStoreAction.java

@ -1,8 +1,7 @@
package com.fr.design.mainframe.share.ui.menu;
package com.fr.design.actions.community;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
@ -14,9 +13,9 @@ import java.awt.event.ActionEvent;
/**
* created by Harrison on 2020/03/24
**/
public class TemplateStoreMenu extends UpdateAction {
public class TemplateStoreAction extends UpdateAction {
public TemplateStoreMenu() {
public TemplateStoreAction() {
this.setMenuKeySet(TEMPLATE);
this.setName(getMenuKeySet().getMenuName());
@ -29,7 +28,7 @@ public class TemplateStoreMenu extends UpdateAction {
@Override
public String getMenuName() {
return Toolkit.i18nText("Fine-Design_Share_Template_Store");
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Template_Store");
}
@Override

33
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -13,8 +13,11 @@ import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.icontainer.UIEastResizableContainer;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.mainframe.reuse.ReuseGuideDialog;
import com.fr.design.mainframe.reuse.SnapChatKeys;
import com.fr.design.menu.SnapChatUtil;
import com.fr.design.notification.SnapChat;
import com.fr.design.notification.SnapChatFactory;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
@ -97,6 +100,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private JPanel defaultPane; // "无可用配置项"面板
private JPanel defaultAuthorityPane; // "该元素不支持权限编辑"
private PropertyItem selectedItem; // 当前被选中的属性配置项
private SnapChat widgetLibSnapChat;
public enum PropertyMode {
REPORT, // 报表
@ -297,9 +301,16 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
"hyperlink", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 组件库
PropertyItem widgetLib = new PropertyItem(KEY_WIDGET_LIB, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Library"),
"widgetlib", new PropertyMode[]{PropertyMode.FORM},
new PropertyMode[]{PropertyMode.FORM}, new ActionListener() {
widgetLibSnapChat = SnapChatFactory.createSnapChat(false, SnapChatKeys.COMPONENT);
PropertyItem widgetLib = new PropertyItem(
KEY_WIDGET_LIB,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Library"),
"widgetlib",
new PropertyMode[]{PropertyMode.FORM},
new PropertyMode[]{PropertyMode.FORM},
getWidgetLibSnapChat(),
getWidgetLibPromptWindow(),
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ComponentReuseNotifyUtil.enterWidgetLibExtraAction();
@ -519,6 +530,17 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
propertyItemMap.get(KEY_WIDGET_LIB).replaceContentPane(pane);
}
public SnapChat getWidgetLibSnapChat() {
return widgetLibSnapChat;
}
public PromptWindow getWidgetLibPromptWindow() {
if (!getWidgetLibSnapChat().hasRead()) {
return new ReuseGuideDialog(DesignerContext.getDesignerFrame());
}
return null;
}
public JComponent getWidgetLibPane() {
return propertyItemMap.get(KEY_WIDGET_LIB).getContentPane();
}
@ -726,11 +748,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
this(name, title, btnIconName, ICON_BASE_DIR, visibleModes, enableModes, null, null);
}
public PropertyItem(String name, String title, String btnIconName, PropertyMode[] visibleModes, PropertyMode[] enableModes, SnapChat snapChat, PromptWindow promptWindow, ActionListener actionListener) {
this(name, title, btnIconName, ICON_BASE_DIR, visibleModes, enableModes, snapChat, promptWindow, actionListener);
}
public PropertyItem(String name, String title, String btnIconName, PropertyMode[] visibleModes, PropertyMode[] enableModes, ActionListener actionListener) {
this(name, title, btnIconName, ICON_BASE_DIR, visibleModes, enableModes, null, null, actionListener);
}
public PropertyItem(String name, String title, String btnIconName, String iconBaseDir, PropertyMode[] visibleModes, PropertyMode[] enableModes, SnapChat snapChat, PromptWindow promptWindow) {
this(name, title, btnIconName, iconBaseDir, visibleModes, enableModes, snapChat, promptWindow, null);
}

167
designer-base/src/main/java/com/fr/design/mainframe/reuse/ReuseGuideDialog.java

@ -0,0 +1,167 @@
package com.fr.design.mainframe.reuse;
import com.fr.base.background.ColorBackground;
import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.PromptWindow;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.geom.RoundRectangle2D;
public class ReuseGuideDialog extends UIDialog implements PromptWindow {
InnerDialog innerDialog;
private static final Dimension DEFAULT = new Dimension(735, 510);
public ReuseGuideDialog(Frame parent) {
super(parent);
}
@Override
public void showWindow() {
innerDialog = new InnerDialog(this);
JPanel backGroundPane = new JPanel() {
@Override
protected void paintComponent(Graphics g) {
Image icon = IOUtils.readImage("com/fr/base/images/share/background.png");// 003.jpg是测试图片在项目的根目录下
g.drawImage(icon, 0, 0, getSize().width, getSize().height, this);// 图片会自动缩放
}
};
add(backGroundPane, BorderLayout.CENTER);
initStyle();
innerDialog.showWindow();
}
private void initStyle() {
setSize(DEFAULT);
setUndecorated(true);
setBackground(new Color(0, 0, 0, 0));
GUICoreUtils.centerWindow(this);
}
@Override
public void hideWindow() {
this.setVisible(false);
if (innerDialog != null) {
innerDialog.setVisible(false);
innerDialog.dispose();
innerDialog = null;
}
this.dispose();
}
@Override
public void checkValid() {
}
class InnerDialog extends UIDialog {
private final Dimension DEFAULT = new Dimension(700, 475);
private static final int TITLE_FONT_SIZE = 20;
public InnerDialog(Dialog dialog) {
super(dialog);
}
public void showWindow() {
add(createCenterPanel(), BorderLayout.CENTER);
add(createSouthPanel(), BorderLayout.SOUTH);
add(createNorthPanel(), BorderLayout.NORTH);
showDialog();
}
private JPanel createNorthPanel() {
JPanel northPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
//右上角关闭按钮
JButton button = new JButton(new ImageIcon(IOUtils.readImage("/com/fr/base/images/share/close.png").getScaledInstance(15, 15, Image.SCALE_SMOOTH)));
button.setBorder(null);
button.setOpaque(false);
button.addActionListener(e -> ReuseGuideDialog.this.hideWindow());
northPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 15));
northPanel.setOpaque(false);
northPanel.add(button);
return northPanel;
}
private JPanel createCenterPanel() {
JPanel centerPanel = new JPanel(new BorderLayout());
UILabel titleLabel = new UILabel(Toolkit.i18nText("Fine-Design_Share_Drag_And_Make_Component"));
UILabel imageLabel = new UILabel(new ImageIcon(IOUtils.readImage("com/fr/base/images/share/guide.png").getScaledInstance(DEFAULT.width, DEFAULT.height, Image.SCALE_SMOOTH)));
titleLabel.setFont(new Font(titleLabel.getFont().getName(), Font.BOLD, TITLE_FONT_SIZE));
titleLabel.setBorder(BorderFactory.createEmptyBorder());
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
panel.setOpaque(false);
panel.add(titleLabel);
centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
centerPanel.setOpaque(false);
centerPanel.add(imageLabel, BorderLayout.CENTER);
centerPanel.add(panel, BorderLayout.NORTH);
return centerPanel;
}
private JPanel createSouthPanel() {
JPanel southPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
JButton button = new JButton(Toolkit.i18nText("Fine-Design_Share_Try_Drag")) {
@Override
public void paint(Graphics g) {
ColorBackground buttonBackground = ColorBackground.getInstance(Color.decode("#419BF9"));
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
buttonBackground.paint(g2d, new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), 8, 8));
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
super.paint(g);
}
};
button.setBorder(null);
button.setForeground(Color.WHITE);
button.setOpaque(false);
button.addActionListener(e -> ReuseGuideDialog.this.hideWindow());
southPanel.setBorder(BorderFactory.createEmptyBorder(0, 290, 19, 290));
southPanel.setPreferredSize(new Dimension(DEFAULT.width, 51));
southPanel.setOpaque(false);
southPanel.add(button);
return southPanel;
}
/**
* 显示窗口
*/
private void showDialog() {
setSize(DEFAULT);
setUndecorated(true);
GUICoreUtils.centerWindow(this);
setModalityType(ModalityType.APPLICATION_MODAL);
ReuseGuideDialog.this.setVisible(true);
setVisible(true);
}
@Override
public void checkValid() {
}
}
}

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/menu/SnapChatKeys.java → designer-base/src/main/java/com/fr/design/mainframe/reuse/SnapChatKeys.java

@ -1,4 +1,4 @@
package com.fr.design.mainframe.share.ui.menu;
package com.fr.design.mainframe.reuse;
import com.fr.design.notification.SnapChatKey;

0
designer-form/src/main/java/com/fr/design/mainframe/share/collect/CollectorManager.java → designer-base/src/main/java/com/fr/design/mainframe/share/collect/CollectorManager.java

0
designer-form/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java → designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java

0
designer-form/src/main/java/com/fr/design/mainframe/share/collect/ComponentSender.java → designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentSender.java

1
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -591,6 +591,7 @@ public abstract class ToolBarMenuDock {
shortCuts.add(new TechSolutionAction());
shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new TemplateStoreAction());
LocaleCenter.buildAction(new LocaleAction() {
@Override

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/ToolbarPane.java

@ -119,7 +119,7 @@ class ToolbarPane extends JPanel {
private FilterPane createFilterPane() {
filterPanel = FilterPane.createLocalFilterPane();
filterPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
filterPanel.registerChangeListerner(e -> LocalWidgetRepoPane.getInstance().refreshShowPanel());
filterPanel.registerChangeListener(e -> LocalWidgetRepoPane.getInstance().refreshShowPanel());
return filterPanel;
}

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java

@ -138,7 +138,7 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel {
}
public void initFilterPaneListener(FilterPane filterPane) {
filterPane.registerChangeListerner(new ChangeListener() {
filterPane.registerChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
String filterStr = e.getSource().toString();

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetShowPane.java

@ -90,7 +90,7 @@ public class OnlineWidgetShowPane extends AbstractOnlineWidgetShowPane {
@Override
public void initFilterPaneListener(FilterPane filterPane) {
super.initFilterPaneListener(filterPane);
filterPane.registerChangeListerner(new ChangeListener() {
filterPane.registerChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
lastFilter = e.getSource().toString();

10
designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/FilterPane.java

@ -46,7 +46,7 @@ public class FilterPane extends JPanel {
private Popup popup;
private boolean showPopup = false;
private FilterPopupPane filterPopupPane;
private ChangeListener changeListener;
private List<ChangeListener> changeListenerList = new ArrayList<>();
private final AWTEventListener awtEventListener;
List<PopStateChangeListener> listenerList = new ArrayList<>();
@ -191,12 +191,14 @@ public class FilterPane extends JPanel {
&& !ComparatorUtils.equals(mv.getSource(), filterLabel);
}
public void registerChangeListerner(ChangeListener changeListener) {
this.changeListener = changeListener;
public void registerChangeListener(ChangeListener changeListener) {
changeListenerList.add(changeListener);
}
public void fireChangeListener(ChangeEvent e) {
this.changeListener.stateChanged(e);
for (ChangeListener changeListener : changeListenerList) {
changeListener.stateChanged(e);
}
}
public void reset() {

2
designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallComponentHelper.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe.share.util;
import com.fr.design.mainframe.share.ui.menu.SnapChatKeys;
import com.fr.design.mainframe.reuse.SnapChatKeys;
import com.fr.design.notification.SnapChat;
import com.fr.design.notification.SnapChatFactory;
import com.fr.form.share.constants.ComponentPath;

2
designer-realize/src/main/java/com/fr/design/share/ui/config/ShareConfigPane.java

@ -155,7 +155,7 @@ public class ShareConfigPane extends BasicPane {
private JPanel createInfoPane() {
JPanel infoPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Share_Introduce"));
PlaceholderTextArea textArea = new PlaceholderTextArea();
textArea.setText(this.widget.getDescription());
textArea.setText(getDescription());
textArea.setPlaceholder(Toolkit.i18nText("Fine-Design_Share_No_Introduction"));
textArea.setEditable(false);
UIScrollPane scrollPane = new UIScrollPane(textArea);

5
designer-realize/src/main/java/com/fr/design/share/ui/generate/EffectContent.java

@ -17,6 +17,7 @@ import com.fr.locale.InterProviderFactory;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTree;
import javax.swing.event.TreeSelectionListener;
@ -144,8 +145,8 @@ public class EffectContent extends JPanel {
}
private void setPaneDisabled(Component component) {
if (component instanceof UIScrollPane) {
UIScrollPane pane = (UIScrollPane) component;
if (component instanceof JScrollPane) {
JScrollPane pane = (JScrollPane) component;
setPaneDisabled(pane.getViewport().getView());
return;
}

Loading…
Cancel
Save