From 49a9e321720fa2ced48c097a6084b97c60d7fe19 Mon Sep 17 00:00:00 2001 From: richie Date: Thu, 7 Nov 2019 11:39:32 +0800 Subject: [PATCH 01/76] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E7=9F=AD=E4=BF=A1=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/designer/creator/XCreatorUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index f51f6710b..433f7c4f7 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -66,7 +66,7 @@ import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.StringUtils; -import com.fr.third.javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; import javax.swing.Icon; import java.awt.Container; @@ -286,7 +286,7 @@ public class XCreatorUtils { * @param creator 组件 * @return 返回顶层容器 */ - public static XLayoutContainer getHotspotContainer(@Nonnull XCreator creator) { + public static XLayoutContainer getHotspotContainer(@NotNull XCreator creator) { if (creator.isDedicateContainer()) { return (XLayoutContainer) creator.getParent(); } From c93febc5847b2a84189d2f179f2814dc5addb602 Mon Sep 17 00:00:00 2001 From: Maksim Date: Thu, 27 Feb 2020 16:16:13 +0800 Subject: [PATCH 02/76] =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E5=90=8E=EF=BC=8C=E5=AF=B9=E5=88=9D=E5=A7=8B=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=81=9A=E4=B8=80=E6=AC=A1=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 78 ++++++++++++------- .../module/DesignerWorkspaceProvider.java | 16 ++++ 2 files changed, 64 insertions(+), 30 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index a60791c6b..e998ad904 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -132,36 +132,7 @@ public class EnvChangeEntrance { if (template != null) { template.refreshToolArea(); } - - //是否需要做服务校验 - if(needCheckBranch(selectedEnv)) { - String localBranch; - String remoteBranch; - localBranch = GeneralUtils.readFullBuildNO(); - try { - remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch(); - } catch (WorkspaceConnectionException e) { - remoteBranch = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") + formatBranch(localBranch); - } - //通过是否包含#来避免当前版本为非安装版本(主要是内部开发版本) - if (localBranch.contains("#") && localBranch.equals(remoteBranch)) { - //说明版本一致,仅做日志记录 - FineLoggerFactory.getLogger().info("Remote Designer version consistency"); - } else { - localBranch = formatBranch(localBranch); - remoteBranch = formatBranch(remoteBranch); - Set noExistServiceSet = getNoExistServiceSet(connectionInfo); - StringBuilder textBuilder = new StringBuilder(); - for (Class clazz : noExistServiceSet) { - WorkspaceAPI workspaceAPI = (WorkspaceAPI) clazz.getAnnotation(WorkspaceAPI.class); - String descriptionOfCN = InterProviderFactory.getProvider().getLocText(workspaceAPI.description()); - textBuilder.append(descriptionOfCN).append("\n"); - } - String areaText = textBuilder.toString(); - CheckServiceDialog dialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), areaText, localBranch, remoteBranch); - dialog.setVisible(true); - } - } + serviceDialog(selectedEnv); } catch (WorkspaceAuthException | RegistEditionException e) { // String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed"); // String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote"); @@ -238,6 +209,43 @@ public class EnvChangeEntrance { return true; } + /** + * 对选择的环境做服务检测 + * @param selectedEnv 选择的工作环境 + */ + public void serviceDialog(DesignerWorkspaceInfo selectedEnv) throws Exception { + //是否需要做服务校验 + if(needCheckBranch(selectedEnv)) { + String localBranch; + String remoteBranch; + WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection(); + localBranch = GeneralUtils.readFullBuildNO(); + try { + remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch(); + } catch (WorkspaceConnectionException e) { + remoteBranch = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") + formatBranch(localBranch); + } + //通过是否包含#来避免当前版本为非安装版本(主要是内部开发版本) + if (localBranch.contains("#") && localBranch.equals(remoteBranch)) { + //说明版本一致,仅做日志记录 + FineLoggerFactory.getLogger().info("Remote Designer version consistency"); + } else { + localBranch = formatBranch(localBranch); + remoteBranch = formatBranch(remoteBranch); + Set noExistServiceSet = getNoExistServiceSet(connectionInfo); + StringBuilder textBuilder = new StringBuilder(); + for (Class clazz : noExistServiceSet) { + WorkspaceAPI workspaceAPI = (WorkspaceAPI) clazz.getAnnotation(WorkspaceAPI.class); + String descriptionOfCN = InterProviderFactory.getProvider().getLocText(workspaceAPI.description()); + textBuilder.append(descriptionOfCN).append("\n"); + } + String areaText = textBuilder.toString(); + CheckServiceDialog dialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), areaText, localBranch, remoteBranch); + dialog.setVisible(true); + } + } + } + /** * 判断是否需要做版本验证,判断依据为 * 1、选择的环境为远程环境 @@ -249,6 +257,11 @@ public class EnvChangeEntrance { return selectedEnv.getType() == DesignerWorkspaceType.Remote; } + /** + * 获取不存在的服务列表 + * @param info 环境连接信息 + * @return 以Set形式返回不存在的服务 + */ public Set getNoExistServiceSet(WorkspaceConnectionInfo info){ Set noExistServiceSet = new HashSet(); Set remoteServiceSet = new HashSet(); @@ -295,6 +308,11 @@ public class EnvChangeEntrance { } } + /** + * 格式化分支版本号 + * @param branch 初始的分支版本号 + * @return 格式化后的版本号 + */ private String formatBranch(String branch){ if(branch.contains("#")){ return branch.substring(branch.lastIndexOf("#") + 1, branch.length() - 13); diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java index 7d63571ad..c8622d679 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java @@ -6,6 +6,10 @@ import com.fr.design.constants.DesignerLaunchStatus; import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.LocalDesignerWorkspaceInfo; +import com.fr.event.Event; +import com.fr.event.EventDispatcher; +import com.fr.event.Listener; +import com.fr.event.Null; import com.fr.log.FineLoggerFactory; import com.fr.module.Activator; import com.fr.stable.StringUtils; @@ -54,6 +58,18 @@ public class DesignerWorkspaceProvider extends Activator { EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner(); } else { WorkContext.switchTo(workspace); + //在设计器完全启动完成后,对初始环境进行一次服务检测,对主要功能无影响,异常仅做日志提示即可 + final DesignerWorkspaceInfo selectEnv = workspaceInfo; + EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { + @Override + public void on(Event event, Null aNull) { + try { + EnvChangeEntrance.getInstance().serviceDialog(selectEnv); + } catch (Exception e) { + FineLoggerFactory.getLogger().warn("Check Service Failed"); + } + } + }); } } catch (Throwable e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); From f7a37afe40caba55bf2f005fc05fa3328461e9fb Mon Sep 17 00:00:00 2001 From: Maksim Date: Thu, 27 Feb 2020 17:59:04 +0800 Subject: [PATCH 03/76] =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=90=8D=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/EnvChangeEntrance.java | 4 ++-- .../java/com/fr/start/module/DesignerWorkspaceProvider.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index e998ad904..48c5576bc 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -132,7 +132,7 @@ public class EnvChangeEntrance { if (template != null) { template.refreshToolArea(); } - serviceDialog(selectedEnv); + showServiceDialog(selectedEnv); } catch (WorkspaceAuthException | RegistEditionException e) { // String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed"); // String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote"); @@ -213,7 +213,7 @@ public class EnvChangeEntrance { * 对选择的环境做服务检测 * @param selectedEnv 选择的工作环境 */ - public void serviceDialog(DesignerWorkspaceInfo selectedEnv) throws Exception { + public void showServiceDialog(DesignerWorkspaceInfo selectedEnv) throws Exception { //是否需要做服务校验 if(needCheckBranch(selectedEnv)) { String localBranch; diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java index c8622d679..e0fc4dfe9 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java @@ -64,7 +64,7 @@ public class DesignerWorkspaceProvider extends Activator { @Override public void on(Event event, Null aNull) { try { - EnvChangeEntrance.getInstance().serviceDialog(selectEnv); + EnvChangeEntrance.getInstance().showServiceDialog(selectEnv); } catch (Exception e) { FineLoggerFactory.getLogger().warn("Check Service Failed"); } From b1a3ee6f1f725c6dfd9329e48fbf32a2d2aed801 Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 23 Mar 2020 10:59:47 +0800 Subject: [PATCH 04/76] =?UTF-8?q?REPORT-27647=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=89=E8=A3=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=20ui=20=E7=95=8C=E9=9D=A2=201=E3=80=81=20?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E7=BB=84=E4=BB=B6=E5=BA=93=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=202=E3=80=81=20=E5=B0=8F=E5=9C=86=E7=82=B9=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 25 +- .../fun/ComponentLibraryPaneProcessor.java | 31 ++ ...AbstractComponentLibraryPaneProcessor.java | 25 ++ .../com/fr/design/gui/imenu/UIMenuItem.java | 75 +--- .../com/fr/design/gui/imenu/UIMenuItemUI.java | 81 ++++ .../mainframe/toolbar/ToolBarMenuDock.java | 20 +- .../main/java/com/fr/design/menu/MenuDef.java | 35 +- .../com/fr/design/menu/SnapChatMenuDef.java | 161 +++++++ .../fr/design/menu/SnapChatMenuItemUI.java | 31 ++ .../com/fr/design/menu/SnapChatMenuUI.java | 29 ++ .../fr/design/menu/SnapChatUpdateAction.java | 74 ++++ .../java/com/fr/design/menu/SnapChatUtil.java | 33 ++ .../com/fr/design/notification/SnapChat.java | 28 ++ .../design/notification/SnapChatAllTypes.java | 38 ++ .../design/notification/SnapChatConfig.java | 88 ++++ .../fr/design/notification/SnapChatKey.java | 9 + .../mainframe/FormWidgetDetailPane.java | 391 ++--------------- .../component/ComponentLibraryManager.java | 23 + .../pane/ComponentLibraryPaneCreator.java | 68 +++ .../ComponentLibraryPaneProcessorImpl.java | 412 ++++++++++++++++++ 20 files changed, 1230 insertions(+), 447 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractComponentLibraryPaneProcessor.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItemUI.java create mode 100644 designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java create mode 100644 designer-base/src/main/java/com/fr/design/menu/SnapChatMenuItemUI.java create mode 100644 designer-base/src/main/java/com/fr/design/menu/SnapChatMenuUI.java create mode 100644 designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java create mode 100644 designer-base/src/main/java/com/fr/design/menu/SnapChatUtil.java create mode 100644 designer-base/src/main/java/com/fr/design/notification/SnapChat.java create mode 100644 designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java create mode 100644 designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java create mode 100644 designer-base/src/main/java/com/fr/design/notification/SnapChatKey.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/component/ComponentLibraryManager.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneProcessorImpl.java diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index cb8634c00..661b4fa5c 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -16,6 +16,7 @@ import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.mainframe.vcs.VcsConfigManager; +import com.fr.design.notification.SnapChatConfig; import com.fr.design.update.push.DesignerPushUpdateConfigManager; import com.fr.design.style.color.ColorSelectConfigManager; import com.fr.design.utils.DesignUtils; @@ -154,6 +155,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * alphafine */ private AlphaFineConfigManager alphaFineConfigManager = AlphaFineConfigManager.getInstance(); + + /** + * 阅后即焚的配置项 + */ + private SnapChatConfig snapChatConfig = SnapChatConfig.getInstance(); private DesignerPushUpdateConfigManager designerPushUpdateConfigManager = DesignerPushUpdateConfigManager.getInstance(); @@ -1548,12 +1554,17 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { readVcsAttr(reader); } else if (DesignerPort.XML_TAG.equals(name)) { readDesignerPort(reader); - } - else { + } else if (name.equals(SnapChatConfig.XML_TAG)) { + readSnapChatConfig(reader); + } else { readLayout(reader, name); } } } + + private void readSnapChatConfig(XMLableReader reader) { + reader.readXMLObject(this.snapChatConfig = SnapChatConfig.getInstance()); + } private void readAlphaFineAttr(XMLableReader reader) { reader.readXMLObject(this.alphaFineConfigManager = AlphaFineConfigManager.getInstance()); @@ -1770,9 +1781,17 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { writeDesignerPushUpdateAttr(writer); writeVcsAttr(writer); writeDesignerPort(writer); + writeSnapChatConfig(writer); writer.end(); } - + + private void writeSnapChatConfig(XMLPrintWriter writer) { + + if (this.snapChatConfig != null) { + this.snapChatConfig.writeXML(writer); + } + } + private void writeAlphaFineAttr(XMLPrintWriter writer) { if (this.alphaFineConfigManager != null) { this.alphaFineConfigManager.writeXML(writer); diff --git a/designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java b/designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java new file mode 100644 index 000000000..88385a11b --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java @@ -0,0 +1,31 @@ +package com.fr.design.fun; + +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.mainframe.DockingView; +import com.fr.stable.fun.mark.Immutable; + +import javax.swing.JPanel; + +/** + * created by Harrison on 2020/03/16 + **/ +public interface ComponentLibraryPaneProcessor extends Immutable { + + String XML_TAG = "ParameterExpandablePaneUIProvider"; + + int CURRENT_LEVEL = 1; + + UIScrollPane createShowPanel(boolean isEdit); + + JPanel createMenuNorthPane(); + + UIComboBox createMenuComBox(); + + void parentView(DockingView dockingView); + + void parentPane(JPanel panel); + + void complete(); + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractComponentLibraryPaneProcessor.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractComponentLibraryPaneProcessor.java new file mode 100644 index 000000000..f376ad788 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractComponentLibraryPaneProcessor.java @@ -0,0 +1,25 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.ComponentLibraryPaneProcessor; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; +import com.fr.stable.fun.mark.Layer; + +/** + * created by Harrison on 2020/03/16 + **/ +@API(level = ComponentLibraryPaneProcessor.CURRENT_LEVEL) +public abstract class AbstractComponentLibraryPaneProcessor extends AbstractProvider implements ComponentLibraryPaneProcessor { + + @Override + public int currentAPILevel() { + + return ComponentLibraryPaneProcessor.CURRENT_LEVEL; + } + + @Override + public int layerIndex() { + + return Layer.DEFAULT_LAYER_INDEX; + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItem.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItem.java index 37f1fe052..3230dbda2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItem.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItem.java @@ -1,15 +1,11 @@ package com.fr.design.gui.imenu; -import java.awt.*; - -import javax.swing.*; -import javax.swing.plaf.basic.BasicMenuItemUI; - import com.fr.design.constants.UIConstants; -import com.fr.stable.Constants; import com.fr.stable.StringUtils; -import com.fr.design.utils.gui.GUIPaintUtils; -import sun.swing.SwingUtilities2; + +import javax.swing.Action; +import javax.swing.Icon; +import javax.swing.JMenuItem; public class UIMenuItem extends JMenuItem{ public UIMenuItem() { @@ -42,66 +38,5 @@ public class UIMenuItem extends JMenuItem{ public String getText() { return StringUtils.BLANK + super.getText(); } - - private class UIMenuItemUI extends BasicMenuItemUI { - @Override - protected void paintBackground(Graphics g, JMenuItem menuItem,Color bgColor) { - if(menuItem.getIcon() == null) { - super.paintBackground(g, menuItem, bgColor); - return; - } - 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, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7); - } else { - GUIPaintUtils.fillPaint((Graphics2D)g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, menuItem.getBackground(), 7); - } - g.setColor(oldColor); - } - else if (model.isArmed() || (menuItem instanceof JMenu && - model.isSelected())) { - GUIPaintUtils.fillPaint((Graphics2D)g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7); - g.setColor(oldColor); - } - } - - protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) { - ButtonModel model = menuItem.getModel(); - FontMetrics fm = SwingUtilities2.getFontMetrics(menuItem, g); - int mnemIndex = menuItem.getDisplayedMnemonicIndex(); - - if(!model.isEnabled()) { - // *** paint the text disabled - if ( UIManager.get("MenuItem.disabledForeground") instanceof Color ) { - g.setColor( UIManager.getColor("MenuItem.disabledForeground") ); - SwingUtilities2.drawStringUnderlineCharAt(menuItem, g,text, - -1, textRect.x, textRect.y + fm.getAscent()); - } else { - g.setColor(menuItem.getBackground().brighter()); - SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text, - -1, textRect.x, textRect.y + fm.getAscent()); - g.setColor(menuItem.getBackground().darker()); - SwingUtilities2.drawStringUnderlineCharAt(menuItem, g,text, - -1, textRect.x - 1, textRect.y + - fm.getAscent() - 1); - } - } else { - // *** paint the text normally - if (model.isArmed()|| (menuItem instanceof JMenu && model.isSelected())) { - g.setColor(Color.WHITE); // Uses protected field. - } - SwingUtilities2.drawStringUnderlineCharAt(menuItem, g,text, - -1, textRect.x, textRect.y + fm.getAscent()); - } - } - - } - + } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItemUI.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItemUI.java new file mode 100644 index 000000000..0d883abfb --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItemUI.java @@ -0,0 +1,81 @@ +package com.fr.design.gui.imenu; + +import com.fr.design.constants.UIConstants; +import com.fr.design.utils.gui.GUIPaintUtils; +import com.fr.stable.Constants; +import sun.swing.SwingUtilities2; + +import javax.swing.ButtonModel; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.UIManager; +import javax.swing.plaf.basic.BasicMenuItemUI; +import java.awt.Color; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Rectangle; + +/** + * created by Harrison on 2020/03/22 + **/ +public class UIMenuItemUI extends BasicMenuItemUI { + + @Override + protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) { + if (menuItem.getIcon() == null) { + super.paintBackground(g, menuItem, bgColor); + return; + } + 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, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7); + } else { + GUIPaintUtils.fillPaint((Graphics2D) g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, menuItem.getBackground(), 7); + } + g.setColor(oldColor); + } else if (model.isArmed() || (menuItem instanceof JMenu && + model.isSelected())) { + GUIPaintUtils.fillPaint((Graphics2D) g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7); + g.setColor(oldColor); + } + } + + protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) { + ButtonModel model = menuItem.getModel(); + FontMetrics fm = SwingUtilities2.getFontMetrics(menuItem, g); + int mnemIndex = menuItem.getDisplayedMnemonicIndex(); + + if (!model.isEnabled()) { + // *** paint the text disabled + if (UIManager.get("MenuItem.disabledForeground") instanceof Color) { + g.setColor(UIManager.getColor("MenuItem.disabledForeground")); + SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text, + -1, textRect.x, textRect.y + fm.getAscent()); + } else { + g.setColor(menuItem.getBackground().brighter()); + SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text, + -1, textRect.x, textRect.y + fm.getAscent()); + g.setColor(menuItem.getBackground().darker()); + SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text, + -1, textRect.x - 1, textRect.y + + fm.getAscent() - 1); + } + } else { + // *** paint the text normally + if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) { + g.setColor(Color.WHITE); // Uses protected field. + } + SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text, + -1, textRect.x, textRect.y + fm.getAscent()); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index cdafa8c41..bc4b85ced 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -12,7 +12,6 @@ import com.fr.design.actions.UpdateAction; import com.fr.design.actions.community.BBSAction; import com.fr.design.actions.community.BugAction; import com.fr.design.actions.community.CenterAction; -import com.fr.design.actions.community.CusDemandAction; import com.fr.design.actions.community.FacebookFansAction; import com.fr.design.actions.community.NeedAction; import com.fr.design.actions.community.QuestionAction; @@ -53,7 +52,9 @@ import com.fr.design.mainframe.ToolBarNewTemplatePane; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ShortCut; +import com.fr.design.menu.SnapChatMenuDef; import com.fr.design.menu.ToolBarDef; +import com.fr.design.notification.SnapChatAllTypes; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.update.actions.SoftwareUpdateAction; @@ -563,15 +564,24 @@ public abstract class ToolBarMenuDock { * @return 社区菜单的子菜单 */ public ShortCut[] createCommunityShortCuts() { + final java.util.List shortCuts = new ArrayList(); shortCuts.add(new BBSAction()); + + shortCuts.add(SeparatorDef.DEFAULT); + shortCuts.add(new VideoAction()); shortCuts.add(new TutorialAction()); shortCuts.add(new QuestionAction()); shortCuts.add(new TechSolutionAction()); + + shortCuts.add(SeparatorDef.DEFAULT); + shortCuts.add(new BugAction()); shortCuts.add(new NeedAction()); - shortCuts.add(new CusDemandAction()); + + shortCuts.add(SeparatorDef.DEFAULT); + shortCuts.add(new CenterAction()); shortCuts.add(new SignAction()); LocaleCenter.buildAction(new LocaleAction() { @@ -594,7 +604,11 @@ public abstract class ToolBarMenuDock { } public MenuDef createCommunityMenuDef() { - MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community"), 'C'); + + MenuDef menuDef = new SnapChatMenuDef( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community"), + 'C', + SnapChatAllTypes.Menu.BBS); ShortCut[] otherCommunityShortCuts = createCommunityShortCuts(); for (ShortCut shortCut : otherCommunityShortCuts) { menuDef.addShortCut(shortCut); diff --git a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java index c18749c12..f495e03f1 100644 --- a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java @@ -38,8 +38,8 @@ public class MenuDef extends ShortCut { protected UIMenu createdJMenu; protected UIButton createdButton; protected JPopupMenu popupMenu; - private boolean hasScrollSubMenu; - private boolean isHeadMenu; + protected boolean hasScrollSubMenu; + protected boolean isHeadMenu; private String anchor; @@ -187,18 +187,13 @@ public class MenuDef extends ShortCut { */ public UIMenu createJMenu() { if (createdJMenu == null) { - if (hasScrollSubMenu) { - createdJMenu = new UIScrollMenu(this.getName()); - } else if (isHeadMenu){ - createdJMenu = new UIHeadMenu(this.getName()); - } else { - createdJMenu = new UIMenu(this.getName()); - } + createdJMenu = createJMenu0(); createdJMenu.setMnemonic(this.getMnemonic()); if (this.iconPath != null) { createdJMenu.setIcon(BaseUtils.readIcon(this.iconPath)); } - createdJMenu.addMenuListener(menuDefListener); + MenuListener menuListener = createMenuListener(); + createdJMenu.addMenuListener(menuListener); ContainerListener listener = getContainerListener(); if (listener != null) { createdJMenu.getPopupMenu().addContainerListener(listener); @@ -207,7 +202,20 @@ public class MenuDef extends ShortCut { return createdJMenu; } - + + protected UIMenu createJMenu0() { + + UIMenu createdJMenu; + if (hasScrollSubMenu) { + createdJMenu = new UIScrollMenu(this.getName()); + } else if (isHeadMenu){ + createdJMenu = new UIHeadMenu(this.getName()); + } else { + createdJMenu = new UIMenu(this.getName()); + } + return createdJMenu; + } + protected ContainerListener getContainerListener() { return null; } @@ -377,6 +385,11 @@ public class MenuDef extends ShortCut { public void intoJToolBar(JToolBar toolBar) { toolBar.add(this.createUIButton()); } + + protected MenuListener createMenuListener() { + + return menuDefListener; + } private MenuListener menuDefListener = new MenuListener() { diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java new file mode 100644 index 000000000..473c17f25 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java @@ -0,0 +1,161 @@ +package com.fr.design.menu; + +import com.fr.design.gui.imenu.UIMenu; +import com.fr.design.gui.imenu.UIScrollMenu; +import com.fr.design.notification.SnapChat; +import com.fr.design.notification.SnapChatConfig; +import com.fr.design.notification.SnapChatKey; + +import javax.swing.JMenu; +import javax.swing.event.MenuEvent; +import javax.swing.event.MenuListener; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.geom.Ellipse2D; +import java.awt.image.BufferedImage; + +/** + * created by Harrison on 2020/03/16 + **/ +public class SnapChatMenuDef extends MenuDef implements SnapChat { + + private SnapChatKey uniqueKey; + private SnapChatMenuUI menuUI = new SnapChatMenuUI(this); + + public SnapChatMenuDef(String name, SnapChatKey uniqueKey) { + super(name); + this.uniqueKey = uniqueKey; + } + + public SnapChatMenuDef(Boolean rePaint, SnapChatKey uniqueKey) { + super(rePaint); + this.uniqueKey = uniqueKey; + } + + public SnapChatMenuDef(String name, char mnemonic, SnapChatKey uniqueKey) { + super(name, mnemonic); + this.uniqueKey = uniqueKey; + } + + @Override + public boolean hasRead() { + + String calcKey = calcKey(); + return SnapChatConfig.getInstance().hasRead(calcKey); + } + + @Override + public void markRead() { + + String calcKey = calcKey(); + SnapChatConfig.getInstance().markRead(calcKey); + } + + @Override + public SnapChatKey key() { + + return this.uniqueKey; + } + + @Override + protected MenuListener createMenuListener() { + + return new SnapChatMenuListener(); + } + + private String calcKey() { + + return key().calc(); + } + + @Override + protected UIMenu createJMenu0() { + + UIMenu createdJMenu; + if (hasScrollSubMenu) { + createdJMenu = new SnapChatUIScrollMenu(this.getName()); + } else if (isHeadMenu){ + createdJMenu = new SnapChatUIHeadMenu(this.getName()); + } else { + createdJMenu = new SnapChatUIMenu(this.getName()); + } + return createdJMenu; + } + + private class SnapChatMenuListener implements MenuListener { + + @Override + public void menuSelected(MenuEvent e) { + + markRead(); + Object source = e.getSource(); + if (!(source instanceof JMenu)) { + return; + } + updateMenu(); + } + + @Override + public void menuDeselected(MenuEvent e) { + + } + + @Override + public void menuCanceled(MenuEvent e) { + + } + } + + private class SnapChatUIScrollMenu extends UIScrollMenu { + + public SnapChatUIScrollMenu(String s) { + super(s); + } + + @Override + public void updateUI() { + setUI(menuUI); + } + } + + private class SnapChatUIMenu extends UIMenu { + + public SnapChatUIMenu(String name) { + + super(name); + } + + @Override + public void updateUI() { + + setUI(menuUI); + } + } + + private class SnapChatUIHeadMenu extends UIMenu { + + public SnapChatUIHeadMenu(String name) { + + super(name); + } + + @Override + public void updateUI() { + + setUI(menuUI); + } + } + + public static void main(String[] args) { + + BufferedImage image = new BufferedImage(16, 16, Image.SCALE_DEFAULT); + Graphics2D g2d = image.createGraphics(); + g2d.setColor(Color.green); + Ellipse2D.Double shape = + new Ellipse2D.Double(2, 2, 1, 1); + g2d.fill(shape); + g2d.draw(shape); + System.out.println(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuItemUI.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuItemUI.java new file mode 100644 index 000000000..c9ab8532d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuItemUI.java @@ -0,0 +1,31 @@ +package com.fr.design.menu; + +import com.fr.design.gui.imenu.UIMenuItemUI; + +import javax.swing.JMenuItem; +import java.awt.Graphics; +import java.awt.Rectangle; + +/** + * created by Harrison on 2020/03/22 + **/ +class SnapChatMenuItemUI extends UIMenuItemUI { + + private final SnapChatUpdateAction snapChatUpdateAction; + + public SnapChatMenuItemUI(SnapChatUpdateAction snapChatUpdateAction) { + + this.snapChatUpdateAction = snapChatUpdateAction; + } + + @Override + protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) { + + super.paintText(g, menuItem, textRect, text); + + if (!snapChatUpdateAction.hasRead()) { + SnapChatUtil.paintSnapChat(g, textRect); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuUI.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuUI.java new file mode 100644 index 000000000..47bc3c663 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuUI.java @@ -0,0 +1,29 @@ +package com.fr.design.menu; + +import com.fr.design.gui.imenu.UIMenuUI; + +import javax.swing.JMenuItem; +import java.awt.Graphics; +import java.awt.Rectangle; + +/** + * created by Harrison on 2020/03/22 + **/ +public class SnapChatMenuUI extends UIMenuUI { + + private SnapChatMenuDef menuDef; + + public SnapChatMenuUI(SnapChatMenuDef menuDef) { + this.menuDef = menuDef; + } + + @Override + protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) { + + super.paintText(g, menuItem, textRect, text); + + if (!menuDef.hasRead()) { + SnapChatUtil.paintSnapChat(g, textRect); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java new file mode 100644 index 000000000..fe1088ea8 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java @@ -0,0 +1,74 @@ +package com.fr.design.menu; + +import com.fr.design.actions.UpdateAction; +import com.fr.design.gui.imenu.UIMenuItem; +import com.fr.design.notification.SnapChat; +import com.fr.design.notification.SnapChatConfig; +import com.fr.design.notification.SnapChatKey; + +import java.awt.event.ActionEvent; + +/** + * created by Harrison on 2020/03/22 + **/ +public class SnapChatUpdateAction extends UpdateAction implements SnapChat { + + private SnapChatKey uniqueKey; + + public SnapChatUpdateAction(SnapChatKey uniqueKey) { + this.uniqueKey = uniqueKey; + } + + @Override + public void actionPerformed(ActionEvent e) { + + markRead(); + actionPerformed0(e); + } + + protected void actionPerformed0(ActionEvent e) { + + } + + @Override + public boolean hasRead() { + + String calcKey = calcKey(); + return SnapChatConfig.getInstance().hasRead(calcKey); + } + + @Override + public void markRead() { + + String calcKey = calcKey(); + SnapChatConfig.getInstance().markRead(calcKey); + } + + @Override + public SnapChatKey key() { + + return this.uniqueKey; + } + + private String calcKey() { + + return key().calc(); + } + + @Override + public UIMenuItem createMenuItem() { + + Object object = this.getValue(UIMenuItem.class.getName()); + if (object == null && !(object instanceof UIMenuItem)) { + UIMenuItem menuItem = new UIMenuItem(this); + // 设置名字用作单元测 + menuItem.setName(getName()); + menuItem.setUI(new SnapChatMenuItemUI(this)); + object = menuItem; + + this.putValue(UIMenuItem.class.getName(), object); + } + return (UIMenuItem) object; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatUtil.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatUtil.java new file mode 100644 index 000000000..6eb648055 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatUtil.java @@ -0,0 +1,33 @@ +package com.fr.design.menu; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.geom.Ellipse2D; + +/** + * created by Harrison on 2020/03/22 + **/ +public class SnapChatUtil { + + public static void paintSnapChat(Graphics g, Rectangle textRect) { + + Color oldColor = g.getColor(); + + double x = textRect.getWidth(); + x += textRect.getX(); + x += 2; + + double y = textRect.getY(); + + Graphics2D g2d = (Graphics2D) g; + g2d.setColor(Color.red); + Ellipse2D.Double shape = + new Ellipse2D.Double(x, y, 4, 4); + g2d.fill(shape); + g2d.draw(shape); + + g2d.setColor(oldColor); + } +} diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChat.java b/designer-base/src/main/java/com/fr/design/notification/SnapChat.java new file mode 100644 index 000000000..8dd6f8aa2 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChat.java @@ -0,0 +1,28 @@ +package com.fr.design.notification; + +/** + * 阅后即焚的消息提醒 + * + * created by Harrison on 2020/03/16 + **/ +public interface SnapChat { + + /** + * 已读 + * + * @return 是否为已读 + */ + boolean hasRead(); + + /** + * 标记为已读 + */ + void markRead(); + + /** + * 独一无二的标志 + * + * @return 字符标志 + */ + SnapChatKey key(); +} diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java b/designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java new file mode 100644 index 000000000..6aeb384df --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChatAllTypes.java @@ -0,0 +1,38 @@ +package com.fr.design.notification; + +import com.fr.stable.CommonUtils; + +/** + * created by Harrison on 2020/03/16 + **/ +public abstract class SnapChatAllTypes { + + public enum Menu implements SnapChatKey { + + /** + * 社区按钮 + */ + BBS("BBS"); + + private static final String SIGN = "0001"; + + private String key; + + Menu(String key) { + this.key = key; + } + + public String getKey() { + return key; + } + + @Override + public String calc() { + + return CommonUtils.join( + new String[]{SIGN, getKey()}, "-" + ); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java new file mode 100644 index 000000000..c9cc17764 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java @@ -0,0 +1,88 @@ +package com.fr.design.notification; + +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLReadable; +import com.fr.stable.xml.XMLable; +import com.fr.stable.xml.XMLableReader; + +import java.util.HashMap; +import java.util.Map; + +/** + * created by Harrison on 2020/03/16 + **/ +@SuppressWarnings("unchecked") +public class SnapChatConfig implements XMLable { + + public static final String XML_TAG = "SnapChatConfig"; + + /** + * 已经阅读过的属性 + */ + private Map markReadMap = new HashMap<>(8); + + private static final SnapChatConfig INSTANCE = new SnapChatConfig(); + + public static SnapChatConfig getInstance() { + return INSTANCE; + } + + public Boolean hasRead(String key) { + + Map map = markReadMap; + Boolean val = map.get(key); + return val == null ? Boolean.FALSE : val; + } + + public void markRead(String key) { + + markReadMap.put(key, Boolean.TRUE); + } + + @Override + public void readXML(XMLableReader reader) { + + String tagName = reader.getTagName(); + if ("MarkReadMap".equals(tagName)) { + readMarkReadMapXML(reader); + } + } + + @Override + public void writeXML(XMLPrintWriter writer) { + + writer.startTAG(XML_TAG); + writeMarkReadMapXML(writer); + writer.end(); + } + + private void readMarkReadMapXML(XMLableReader reader) { + + reader.readXMLObject(new XMLReadable() { + @Override + public void readXML(XMLableReader reader) { + String tmpVal = reader.getElementValue(); + Boolean markRead = Boolean.valueOf(tmpVal); + markReadMap.put(reader.getAttrAsString("key", ""), markRead); + } + }); + } + + /** + * 写入map + */ + private void writeMarkReadMapXML(XMLPrintWriter writer) { + + writer.startTAG("MarkReadMap"); + for (Map.Entry item : markReadMap.entrySet()) { + writer.startTAG("item").attr("key", item.getKey()).textNode(item.getValue().toString()).end(); + } + writer.end(); + } + + @Override + public Object clone() throws CloneNotSupportedException { + + return null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChatKey.java b/designer-base/src/main/java/com/fr/design/notification/SnapChatKey.java new file mode 100644 index 000000000..fa316db35 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChatKey.java @@ -0,0 +1,9 @@ +package com.fr.design.notification; + +/** + * created by Harrison on 2020/03/16 + **/ +public interface SnapChatKey { + + String calc(); +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index c32abb2ff..7d00e367c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -1,42 +1,19 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.icontainer.UIScrollPane; -import com.fr.design.gui.ilable.UILabel; +import com.fr.design.fun.ComponentLibraryPaneProcessor; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.widget.FRWidgetFactory; -import com.fr.form.share.ShareLoader; -import com.fr.form.ui.SharableWidgetBindInfo; -import com.fr.general.CloudCenter; -import com.fr.log.FineLoggerFactory; -import com.fr.share.ShareConstants; -import com.fr.stable.ArrayUtils; -import com.fr.stable.StringUtils; +import com.fr.design.mainframe.component.pane.ComponentLibraryPaneCreator; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; +import com.fr.plugin.observer.PluginListenerRegistration; -import javax.swing.BorderFactory; -import javax.swing.DefaultComboBoxModel; import javax.swing.Icon; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.SwingWorker; -import javax.swing.filechooser.FileNameExtensionFilter; import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Desktop; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; /** * Created with IntelliJ IDEA. @@ -45,19 +22,6 @@ import java.net.URISyntaxException; * Time: 下午8:18 */ public class FormWidgetDetailPane extends FormDockView{ - private static final int LOCAL_WIDGET_LABEL_WIDTH = 90; - - private UIScrollPane downPane; - private JPanel reuWidgetPanel; - private UIComboBox comboBox; - private SharableWidgetBindInfo[] elCaseBindInfoList; - private UIButton deleteButton; - private JPanel editPanel; - private JPanel resetPanel; - private JPanel menutPanelNorthPane; - private SwingWorker sw; - //组件面板是否可以编辑 - private boolean isEdit; public static FormWidgetDetailPane getInstance() { if (HOLDER.singleton == null) { @@ -68,6 +32,7 @@ public class FormWidgetDetailPane extends FormDockView{ private FormWidgetDetailPane(){ setLayout(FRGUIPaneFactory.createBorderLayout()); + listenPluginComponentPane(); } @@ -89,350 +54,56 @@ public class FormWidgetDetailPane extends FormDockView{ public Icon getViewIcon() { return BaseUtils.readIcon("/com/fr/design/images/m_report/attributes.png"); } - + /** * 初始化 */ + @Override public void refreshDockingView(){ + FormDesigner designer = this.getEditingFormDesigner(); removeAll(); if(designer == null){ clearDockingView(); return; } - reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - reuWidgetPanel.setBorder(null); - if (elCaseBindInfoList == null) { - if (sw != null) { - sw.cancel(true); - } - sw = new SwingWorker() { - @Override - protected Object doInBackground() throws Exception { - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - refreshDownPanel(false); - return null; - } - }; - sw.execute(); - } - initReuWidgetPanel(); - initMenuPanel(); - - add(reuWidgetPanel, BorderLayout.CENTER); - - } - - /** - * 初始化组件共享和复用面板 - */ - private void initReuWidgetPanel() { - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, false)); - downPane.setBorder(null); - reuWidgetPanel.add(downPane); - } - - /** - * 初始化菜单栏面板 - */ - private void initMenuPanel() { - JPanel menutPanel = new JPanel(); - menutPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); - menutPanel.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 15)); - - menutPanelNorthPane = new JPanel(new BorderLayout()); - UILabel localWidgetLabel = FRWidgetFactory.createLineWrapLabel( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Local_Widget"), - LOCAL_WIDGET_LABEL_WIDTH); - menutPanelNorthPane.add(localWidgetLabel, BorderLayout.WEST); - menutPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); - menutPanelNorthPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); - - menutPanel.add(menutPanelNorthPane, BorderLayout.NORTH); - comboBox = new UIComboBox(getFormCategories()); - comboBox.setPreferredSize(new Dimension(240, comboBox.getPreferredSize().height)); - initComboBoxSelectedListener(); - menutPanel.add(comboBox, BorderLayout.CENTER); - reuWidgetPanel.add(menutPanel, BorderLayout.NORTH); - - } - - /** - * 创建菜单栏按钮面板 - */ - private JPanel initEditButtonPane() { - editPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); - - editPanel.add(createRefreshButton()); - editPanel.add(createDownloadButton()); - editPanel.add(createInstallButton()); - editPanel.add(createDeleteButton()); - - return editPanel; + + initComponentPane(); } - - /** - * 创建取消删除面板 - */ - private JPanel initResetButtonPane() { - resetPanel = new JPanel(); - UIButton resetButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Reset")); - resetPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); - resetButton.setBackground(Color.white); - resetButton.setForeground(new Color(0x333334)); - resetButton.addActionListener(new ActionListener() { + + private void listenPluginComponentPane() { + + PluginFilter filter = new PluginFilter() { @Override - public void actionPerformed(ActionEvent e) { - refreshDownPanel(false); - replaceButtonPanel(false); - reuWidgetPanel.remove(deleteButton); + public boolean accept(PluginContext context) { + return context.contain(ComponentLibraryPaneProcessor.XML_TAG); } - }); - - deleteButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Remove_Item")); - deleteButton.setBackground(Color.white); - deleteButton.setForeground(new Color(0xeb1d1f)); - deleteButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (ShareLoader.getLoader().removeModulesFromList()) { - refreshShareMoudule(); - reuWidgetPanel.remove(deleteButton); - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_Removed_Successful")); - refreshDownPanel(false); - replaceButtonPanel(false); - refreshComboxData(); - } else { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_Removed_Failed")); - } - - } - }); - JPanel deletePane = new JPanel(new BorderLayout()); - deletePane.add(deleteButton, BorderLayout.CENTER); - deletePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); - - resetPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); - resetPanel.add(resetButton, BorderLayout.CENTER); - resetPanel.add(deletePane, BorderLayout.WEST); - - refreshDownPanel(true); - - return resetPanel; - - } - - - private void initComboBoxSelectedListener() { - comboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - ShareLoader.getLoader().resetRemovedModuleList(); - int filterIndex = comboBox.getSelectedIndex(); - if (filterIndex == 0) { - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - } else { - String filterName = comboBox.getSelectedItem().toString(); - elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName); - } - refreshDownPanel(isEdit); - - } - }); - } - - /** - * 创建工具条按钮 - */ - private UIButton createToolButton(Icon icon, String toolTip, ActionListener actionListener) { - UIButton toolButton = new UIButton(); - toolButton.setIcon(icon); - toolButton.setToolTipText(toolTip); - toolButton.set4ToolbarButton(); - toolButton.addActionListener(actionListener); - return toolButton; - - } - - /** - * 创建刷新按钮 - */ - private UIButton createRefreshButton() { - return createToolButton( - BaseUtils.readIcon("/com/fr/design/form/images/refresh.png"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh"), - new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (sw != null) { - sw.cancel(true); - } - sw = new SwingWorker() { - @Override - protected Object doInBackground() throws Exception { - ShareLoader.getLoader().refreshModule(); - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - refreshComboxData(); - refreshDownPanel(false); - return null; - } - }; - sw.execute(); - } - } - ); - } - - private void refreshComboxData() { - comboBox.setSelectedIndex(0); - comboBox.setModel(new DefaultComboBoxModel(getFormCategories())); - } - - /** - * 创建下载模板的按钮 - */ - private UIButton createDownloadButton() { - UIButton downloadButton = new UIButton(); - downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/download icon.png")); - downloadButton.set4ToolbarButton(); - downloadButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Download_Template")); - downloadButton.addActionListener(new ActionListener() { + }; + PluginListenerRegistration.getInstance().listenRunningChanged(new PluginEventListener() { @Override - public void actionPerformed(ActionEvent e) { - String url = CloudCenter.getInstance().acquireUrlByKind("reuse.url"); - if (StringUtils.isEmpty(url)) { - FineLoggerFactory.getLogger().info("The URL is empty!"); - return; - } - try { - Desktop.getDesktop().browse(new URI(url)); - } catch (IOException exp) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser_Duplicate")); - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - } catch (URISyntaxException exp) { - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - } catch (Exception exp) { - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url); - } - } - }); - return downloadButton; - } - - /** - * 创建安装模板的按钮 - */ - private UIButton createInstallButton() { - return createToolButton( - BaseUtils.readIcon("/com/fr/design/form/images/install icon.png"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Install_Template"), - new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JFileChooser fileChooser = new JFileChooser(); - fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); - int returnValue = fileChooser.showDialog(new UILabel(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); - if (returnValue == JFileChooser.APPROVE_OPTION) { - final File chosenFile = fileChooser.getSelectedFile(); - installFromDiskZipFile(chosenFile); - } - } - } - ); - } - - /** - * 创建删除模板的按钮 - */ - private UIButton createDeleteButton() { - return createToolButton( - BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Delete_Template"), - new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - replaceButtonPanel(true); - } - } - ); - } - - private void replaceButtonPanel(boolean isEdit) { - this.isEdit = isEdit; - if (isEdit) { - menutPanelNorthPane.remove(editPanel); - menutPanelNorthPane.add(initResetButtonPane(), BorderLayout.EAST); - } else { - menutPanelNorthPane.remove(resetPanel); - menutPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); - ShareLoader.getLoader().resetRemovedModuleList(); - } - } - - private void installFromDiskZipFile(File chosenFile) { - if (chosenFile != null && chosenFile.getName().endsWith(ShareConstants.SUFFIX_MODULE)) { - try { - if (ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile)) { - refreshShareMoudule(); - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - refreshDownPanel(false); - refreshComboxData(); - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_OK")); - } else { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Share_Module_Error")); - } - } catch (IOException e) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Share_Module_Error")); - FineLoggerFactory.getLogger().error(e.getMessage(), e); + public void on(PluginEvent event) { + refreshDockingView(); } - } + }, filter); } - - private void refreshShareMoudule() { - try { - ShareLoader.getLoader().refreshModule(); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - - /** - * 获取报表块组件分类 - */ - public String[] getFormCategories() { - return ArrayUtils.addAll(new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_AllCategories")}, ShareLoader.getLoader().getModuleCategory()); - } - - public void refreshDownPanel(boolean isEdit) { - reuWidgetPanel.remove(downPane); - downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit)); - downPane.setBorder(null); - reuWidgetPanel.add(downPane); - repaintContainer(); - - } - - public void repaintContainer() { - validate(); - repaint(); - revalidate(); + + private void initComponentPane() { + + ComponentLibraryPaneCreator creator = ComponentLibraryPaneCreator.getNew(); + JPanel componentLibraryPane = creator.create(this); + add(componentLibraryPane, BorderLayout.CENTER); } /** * 清除数据 */ public void clearDockingView() { + JScrollPane psp = new JScrollPane(); psp.setBorder(null); this.add(psp, BorderLayout.CENTER); } - - /** * 定位 * @return 位置 diff --git a/designer-form/src/main/java/com/fr/design/mainframe/component/ComponentLibraryManager.java b/designer-form/src/main/java/com/fr/design/mainframe/component/ComponentLibraryManager.java new file mode 100644 index 000000000..7cd5e6e82 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/component/ComponentLibraryManager.java @@ -0,0 +1,23 @@ +package com.fr.design.mainframe.component; + +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.fun.ComponentLibraryPaneProcessor; +import com.fr.design.mainframe.component.pane.ComponentLibraryPaneProcessorImpl; + +/** + * created by Harrison on 2020/03/16 + **/ +public class ComponentLibraryManager { + + private static ComponentLibraryPaneProcessor DEFAULT = new ComponentLibraryPaneProcessorImpl(); + + public static ComponentLibraryPaneProcessor selectPaneProcessor() { + + ComponentLibraryPaneProcessor right = ExtraDesignClassManager.getInstance().getSingle(ComponentLibraryPaneProcessor.XML_TAG); + + if (right == null || DEFAULT.layerIndex() > right.layerIndex()) { + right = DEFAULT; + } + return right; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java b/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java new file mode 100644 index 000000000..97425fdb4 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java @@ -0,0 +1,68 @@ +package com.fr.design.mainframe.component.pane; + +import com.fr.design.fun.ComponentLibraryPaneProcessor; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DockingView; +import com.fr.design.mainframe.component.ComponentLibraryManager; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * created by Harrison on 2020/03/22 + **/ +public class ComponentLibraryPaneCreator { + + private ComponentLibraryPaneProcessor processor; + + public ComponentLibraryPaneCreator() { + + processor = ComponentLibraryManager.selectPaneProcessor(); + } + + public static ComponentLibraryPaneCreator getNew() { + + return new ComponentLibraryPaneCreator(); + } + + public JPanel create(DockingView dockingView) { + + JPanel componentLibPanel = createComponentLibPanel(); + processor.parentView(dockingView); + processor.parentPane(componentLibPanel); + + JPanel menuPanel = createMenuPanel(); + componentLibPanel.add(menuPanel, BorderLayout.NORTH); + + UIScrollPane showPane = processor.createShowPanel(false); + componentLibPanel.add(showPane); + return componentLibPanel; + } + + private JPanel createComponentLibPanel() { + + JPanel reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + reuWidgetPanel.setBorder(null); + return reuWidgetPanel; + } + + /** + * 初始化菜单栏面板 + */ + private JPanel createMenuPanel() { + + JPanel menuPanel = new JPanel(); + menuPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + menuPanel.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 15)); + + JPanel menuPanelNorthPane = processor.createMenuNorthPane(); + menuPanel.add(menuPanelNorthPane, BorderLayout.NORTH); + + UIComboBox menuPanelComboBox = processor.createMenuComBox(); + menuPanel.add(menuPanelComboBox, BorderLayout.CENTER); + return menuPanel; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneProcessorImpl.java b/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneProcessorImpl.java new file mode 100644 index 000000000..18148ce0d --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneProcessorImpl.java @@ -0,0 +1,412 @@ +package com.fr.design.mainframe.component.pane; + +import com.fr.base.BaseUtils; +import com.fr.design.fun.impl.AbstractComponentLibraryPaneProcessor; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DockingView; +import com.fr.design.mainframe.ShareWidgetPane; +import com.fr.design.widget.FRWidgetFactory; +import com.fr.form.share.ShareLoader; +import com.fr.form.ui.SharableWidgetBindInfo; +import com.fr.general.CloudCenter; +import com.fr.log.FineLoggerFactory; +import com.fr.share.ShareConstants; +import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; + +import javax.swing.BorderFactory; +import javax.swing.DefaultComboBoxModel; +import javax.swing.Icon; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.SwingWorker; +import javax.swing.filechooser.FileNameExtensionFilter; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Desktop; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +/** + * created by Harrison on 2020/03/16 + **/ +public class ComponentLibraryPaneProcessorImpl extends AbstractComponentLibraryPaneProcessor { + + private static final int LOCAL_WIDGET_LABEL_WIDTH = 90; + + private DockingView parentView; + + private SwingWorker sw; + + private JPanel componentLibPane; + private UIScrollPane showPane; + + private UIComboBox menuPanelComboBox; + private JPanel menuPanelNorthPane; + private SharableWidgetBindInfo[] bindInfoArray; + + private UIButton deleteButton; + private JPanel editPanel; + private JPanel resetPanel; + /** + * 组件面板是否可以编辑 + */ + private boolean isEdit; + + public ComponentLibraryPaneProcessorImpl() { + + } + + @Override + public void parentView(DockingView dockingView) { + + parentView = dockingView; + if (bindInfoArray == null) { + if (sw != null) { + sw.cancel(true); + } + sw = new SwingWorker() { + @Override + protected Object doInBackground() throws Exception { + bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); + refreshShowPanel(false); + return null; + } + }; + sw.execute(); + } + } + + @Override + public void parentPane(JPanel panel) { + this.componentLibPane = panel; + } + + @Override + public void complete() { + + } + + /** + * 初始化组件共享和复用面板 + */ + @Override + public UIScrollPane createShowPanel(boolean isEdit) { + + showPane = new UIScrollPane( + new ShareWidgetPane(bindInfoArray, isEdit) + ); + showPane.setBorder(null); + return showPane; + } + + + @Override + public UIComboBox createMenuComBox() { + + menuPanelComboBox = new UIComboBox(getFormCategories()); + menuPanelComboBox.setPreferredSize(new Dimension(240, menuPanelComboBox.getPreferredSize().height)); + addComboBoxListener(); + return menuPanelComboBox; + } + + private void addComboBoxListener() { + + menuPanelComboBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + ShareLoader.getLoader().resetRemovedModuleList(); + int filterIndex = menuPanelComboBox.getSelectedIndex(); + if (filterIndex == 0) { + bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); + } else { + String filterName = menuPanelComboBox.getSelectedItem().toString(); + bindInfoArray = ShareLoader.getLoader().getFilterBindInfoList(filterName); + } + refreshShowPanel(isEdit); + } + }); + } + + @Override + public JPanel createMenuNorthPane() { + + menuPanelNorthPane = new JPanel(new BorderLayout()); + UILabel localWidgetLabel = FRWidgetFactory.createLineWrapLabel( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Local_Widget"), + LOCAL_WIDGET_LABEL_WIDTH); + menuPanelNorthPane.add(localWidgetLabel, BorderLayout.WEST); + menuPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); + menuPanelNorthPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); + return menuPanelNorthPane; + + } + + /** + * 创建菜单栏按钮面板 + */ + protected JPanel initEditButtonPane() { + + editPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); + + editPanel.add(createRefreshButton()); + editPanel.add(createDownloadButton()); + editPanel.add(createInstallButton()); + editPanel.add(createDeleteButton()); + + return editPanel; + } + + /** + * 创建取消删除面板 + */ + protected JPanel initResetButtonPane() { + + resetPanel = new JPanel(); + UIButton resetButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Reset")); + resetPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); + resetButton.setBackground(Color.white); + resetButton.setForeground(new Color(0x333334)); + resetButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + refreshShowPanel(false); + replaceButtonPanel(false); + componentLibPane.remove(deleteButton); + } + }); + + deleteButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Remove_Item")); + deleteButton.setBackground(Color.white); + deleteButton.setForeground(new Color(0xeb1d1f)); + deleteButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (ShareLoader.getLoader().removeModulesFromList()) { + refreshShareModule(); + componentLibPane.remove(deleteButton); + bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_Removed_Successful")); + refreshShowPanel(false); + replaceButtonPanel(false); + refreshComboBoxData(); + } else { + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_Removed_Failed")); + } + + } + }); + JPanel deletePane = new JPanel(new BorderLayout()); + deletePane.add(deleteButton, BorderLayout.CENTER); + deletePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); + + resetPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + resetPanel.add(resetButton, BorderLayout.CENTER); + resetPanel.add(deletePane, BorderLayout.WEST); + + refreshShowPanel(true); + + return resetPanel; + + } + + + /** + * 创建工具条按钮 + */ + protected UIButton createToolButton(Icon icon, String toolTip, ActionListener actionListener) { + + UIButton toolButton = new UIButton(); + toolButton.setIcon(icon); + toolButton.setToolTipText(toolTip); + toolButton.set4ToolbarButton(); + toolButton.addActionListener(actionListener); + return toolButton; + + } + + /** + * 创建刷新按钮 + */ + protected UIButton createRefreshButton() { + + return createToolButton( + BaseUtils.readIcon("/com/fr/design/form/images/refresh.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh"), + new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (sw != null) { + sw.cancel(true); + } + sw = new SwingWorker() { + @Override + protected Object doInBackground() throws Exception { + ShareLoader.getLoader().refreshModule(); + bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); + refreshComboBoxData(); + refreshShowPanel(false); + return null; + } + }; + sw.execute(); + } + } + ); + } + + /** + * 创建下载模板的按钮 + */ + protected UIButton createDownloadButton() { + UIButton downloadButton = new UIButton(); + downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/download icon.png")); + downloadButton.set4ToolbarButton(); + downloadButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Download_Template")); + downloadButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String url = CloudCenter.getInstance().acquireUrlByKind("reuse.url"); + if (StringUtils.isEmpty(url)) { + FineLoggerFactory.getLogger().info("The URL is empty!"); + return; + } + try { + Desktop.getDesktop().browse(new URI(url)); + } catch (IOException exp) { + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser_Duplicate")); + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + } catch (URISyntaxException exp) { + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + } catch (Exception exp) { + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url); + } + } + }); + return downloadButton; + } + + /** + * 创建安装模板的按钮 + */ + protected UIButton createInstallButton() { + return createToolButton( + BaseUtils.readIcon("/com/fr/design/form/images/install icon.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Install_Template"), + new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); + fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); + int returnValue = fileChooser.showDialog(new UILabel(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); + if (returnValue == JFileChooser.APPROVE_OPTION) { + final File chosenFile = fileChooser.getSelectedFile(); + installFromDiskZipFile(chosenFile); + } + } + } + ); + } + + /** + * 创建删除模板的按钮 + */ + protected UIButton createDeleteButton() { + return createToolButton( + BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Delete_Template"), + new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + replaceButtonPanel(true); + } + } + ); + } + + /** + * 获取报表块组件分类 + */ + protected String[] getFormCategories() { + + return ArrayUtils.addAll(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_AllCategories")}, ShareLoader.getLoader().getModuleCategory()); + } + + protected void refreshShowPanel(boolean isEdit) { + + componentLibPane.remove(showPane); + showPane = createShowPanel(isEdit); + componentLibPane.add(showPane); + repaint(); + } + + private void refreshComboBoxData() { + + menuPanelComboBox.setSelectedIndex(0); + menuPanelComboBox.setModel(new DefaultComboBoxModel(getFormCategories())); + } + + private void replaceButtonPanel(boolean isEdit) { + + this.isEdit = isEdit; + if (isEdit) { + menuPanelNorthPane.remove(editPanel); + menuPanelNorthPane.add(initResetButtonPane(), BorderLayout.EAST); + } else { + menuPanelNorthPane.remove(resetPanel); + menuPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); + ShareLoader.getLoader().resetRemovedModuleList(); + } + } + + private void installFromDiskZipFile(File chosenFile) { + + if (chosenFile != null && chosenFile.getName().endsWith(ShareConstants.SUFFIX_MODULE)) { + try { + if (ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile)) { + refreshShareModule(); + bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); + refreshShowPanel(false); + refreshComboBoxData(); + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_OK")); + } else { + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Share_Module_Error")); + } + } catch (IOException e) { + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Share_Module_Error")); + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } + + private void refreshShareModule() { + try { + ShareLoader.getLoader().refreshModule(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + + public void repaint() { + + parentView.validate(); + parentView.repaint(); + parentView.revalidate(); + } + +} From 1807f814ef3249652778872aa8ee02905d3b92de Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 23 Mar 2020 11:06:14 +0800 Subject: [PATCH 05/76] =?UTF-8?q?=E5=8E=BB=E6=8E=89=20main=20=E5=87=BD?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/menu/SnapChatMenuDef.java | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java index 473c17f25..f3c5735f0 100644 --- a/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java @@ -9,11 +9,6 @@ import com.fr.design.notification.SnapChatKey; import javax.swing.JMenu; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.geom.Ellipse2D; -import java.awt.image.BufferedImage; /** * created by Harrison on 2020/03/16 @@ -146,16 +141,4 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat { setUI(menuUI); } } - - public static void main(String[] args) { - - BufferedImage image = new BufferedImage(16, 16, Image.SCALE_DEFAULT); - Graphics2D g2d = image.createGraphics(); - g2d.setColor(Color.green); - Ellipse2D.Double shape = - new Ellipse2D.Double(2, 2, 1, 1); - g2d.fill(shape); - g2d.draw(shape); - System.out.println(); - } } From f279194bba6b963ca30facc4e4c479efca434d83 Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 23 Mar 2020 14:12:58 +0800 Subject: [PATCH 06/76] =?UTF-8?q?REPORT-27647=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=89=E8=A3=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=201=E3=80=81=E7=A9=BA=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=202=E3=80=81=E5=88=A4=E7=A9=BA=203=E3=80=81=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20xml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/ComponentLibraryPaneProcessor.java | 28 ++++++++++++++++++- .../design/notification/SnapChatConfig.java | 7 +++-- .../pane/ComponentLibraryPaneCreator.java | 8 ++++-- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java b/designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java index 88385a11b..7b484b156 100644 --- a/designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java +++ b/designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java @@ -8,24 +8,50 @@ import com.fr.stable.fun.mark.Immutable; import javax.swing.JPanel; /** + * 组件库面板处理器 + * * created by Harrison on 2020/03/16 **/ public interface ComponentLibraryPaneProcessor extends Immutable { - String XML_TAG = "ParameterExpandablePaneUIProvider"; + String XML_TAG = "ComponentLibraryPaneProcessor"; int CURRENT_LEVEL = 1; + /** + * 创建展示面板 + * + * @param isEdit 是否可以编辑 + * @return 展示面板 + */ UIScrollPane createShowPanel(boolean isEdit); + /** + * 创建菜单的上部面板 + * + * @return 面板 + */ JPanel createMenuNorthPane(); + /** + * 创建复选框 + * + * @return 复选框 + */ UIComboBox createMenuComBox(); void parentView(DockingView dockingView); + /** + * 父面板 + * + * @param panel 面板 + */ void parentPane(JPanel panel); + /** + * 创建完成 + */ void complete(); } diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java index c9cc17764..04170e3be 100644 --- a/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java @@ -1,5 +1,6 @@ package com.fr.design.notification; +import com.fr.stable.StringUtils; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLable; @@ -63,7 +64,7 @@ public class SnapChatConfig implements XMLable { public void readXML(XMLableReader reader) { String tmpVal = reader.getElementValue(); Boolean markRead = Boolean.valueOf(tmpVal); - markReadMap.put(reader.getAttrAsString("key", ""), markRead); + markReadMap.put(reader.getAttrAsString("key", StringUtils.EMPTY), markRead); } }); } @@ -82,7 +83,7 @@ public class SnapChatConfig implements XMLable { @Override public Object clone() throws CloneNotSupportedException { - - return null; + + return super.clone(); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java b/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java index 97425fdb4..8cb5d1533 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java @@ -59,10 +59,14 @@ public class ComponentLibraryPaneCreator { menuPanel.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 15)); JPanel menuPanelNorthPane = processor.createMenuNorthPane(); - menuPanel.add(menuPanelNorthPane, BorderLayout.NORTH); + if (menuPanelNorthPane != null) { + menuPanel.add(menuPanelNorthPane, BorderLayout.NORTH); + } UIComboBox menuPanelComboBox = processor.createMenuComBox(); - menuPanel.add(menuPanelComboBox, BorderLayout.CENTER); + if (menuPanelComboBox != null) { + menuPanel.add(menuPanelComboBox, BorderLayout.CENTER); + } return menuPanel; } } From 5b0c5dc2998ac3ad2e69bb6a3ee9a0146cab7658 Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 24 Mar 2020 14:23:15 +0800 Subject: [PATCH 07/76] =?UTF-8?q?REPORT-27647=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=89=E8=A3=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=201=E3=80=81=E6=8A=BD=E5=87=BA=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=9B=B4=E9=80=9A=E7=94=A8=E7=9A=84=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=9D=A5=E6=B7=BB=E5=8A=A0=E9=9D=A2=E6=9D=BF=202=E3=80=81?= =?UTF-8?q?=E4=B8=BA=E5=85=B1=E4=BA=AB=E5=8A=A0=E8=BD=BD=E5=99=A8=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=8F=92=E4=BB=B6=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/fun/PropertyItemPaneProvider.java | 25 ++ .../AbstractPropertyItemPaneProvider.java | 31 ++ .../mainframe/EastRegionContainerPane.java | 139 +++++- .../com/fr/design/mainframe/PaneHolder.java | 17 + .../fr/design/mainframe/PropertyItemBean.java | 68 +++ .../fr/design/menu/SnapChatUpdateAction.java | 8 +- .../mainframe/FormWidgetDetailPane.java | 392 +++++++++++++++-- .../java/com/fr/design/mainframe/JForm.java | 61 ++- .../component/ComponentLibraryManager.java | 23 - .../pane/ComponentLibraryPaneCreator.java | 72 --- .../ComponentLibraryPaneProcessorImpl.java | 412 ------------------ 11 files changed, 697 insertions(+), 551 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractPropertyItemPaneProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/PaneHolder.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/component/ComponentLibraryManager.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneProcessorImpl.java diff --git a/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java b/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java new file mode 100644 index 000000000..2dbead9ed --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java @@ -0,0 +1,25 @@ +package com.fr.design.fun; + +import com.fr.design.mainframe.PaneHolder; +import com.fr.design.mainframe.PropertyItemBean; +import com.fr.stable.fun.mark.Mutable; +import org.jetbrains.annotations.Nullable; + +/** + * created by Harrison on 2020/03/23 + **/ +public interface PropertyItemPaneProvider extends Mutable { + + int CURRENT_LEVEL = 1; + + String XML_TAG = "PropertyItemPaneProvider"; + + String key(); + + PropertyItemBean getItem(); + + @Nullable + PaneHolder getPaneHolder(Class clazz); + + String replaceKey(); +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractPropertyItemPaneProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractPropertyItemPaneProvider.java new file mode 100644 index 000000000..44e4abd4d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractPropertyItemPaneProvider.java @@ -0,0 +1,31 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.PropertyItemPaneProvider; +import com.fr.design.mainframe.PaneHolder; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +/** + * created by Harrison on 2020/03/23 + **/ +@API(level = PropertyItemPaneProvider.CURRENT_LEVEL) +public abstract class AbstractPropertyItemPaneProvider extends AbstractProvider implements PropertyItemPaneProvider { + + @Override + public PaneHolder getPaneHolder(Class clazz) { + + if (sign().equals(clazz)) { + return getPathHolder0(); + } + return null; + } + + protected abstract PaneHolder getPathHolder0(); + + protected abstract Class sign(); + + @Override + public int currentAPILevel() { + return PropertyItemPaneProvider.CURRENT_LEVEL; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 07191d536..790c0eb39 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -3,7 +3,9 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.constants.UIConstants; +import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.icontainer.UIEastResizableContainer; @@ -12,12 +14,38 @@ import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.general.FRFont; - +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.context.PluginRuntime; +import com.fr.plugin.injectable.PluginModule; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; +import com.fr.plugin.observer.PluginEventType; +import com.fr.plugin.observer.PluginListenerRegistration; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.SwingConstants; +import javax.swing.SwingUtilities; import javax.swing.border.EmptyBorder; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsEnvironment; +import java.awt.Image; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -26,6 +54,7 @@ import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.util.HashSet; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import java.util.Set; @@ -101,9 +130,95 @@ public class EastRegionContainerPane extends UIEastResizableContainer { defaultAuthorityPane = getDefaultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Not_Support_Authority_Edit")); switchMode(PropertyMode.REPORT); setContainerWidth(CONTAINER_WIDTH); + + initPluginPane(); + listenPlugin(); } - + + private void listenPlugin() { + + PluginFilter filter = new PluginFilter() { + @Override + public boolean accept(PluginContext context) { + return context.contain(PropertyItemPaneProvider.XML_TAG); + } + }; + PluginListenerRegistration.getInstance().listen( + PluginEventType.AfterRun, + new PluginEventListener() { + @Override + public void on(PluginEvent event) { + PluginContext context = event.getContext(); + PluginRuntime runtime = context.getRuntime(); + Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); + for (PropertyItemPaneProvider provider : providers) { + addPropertyItem(provider); + } + updateAllPropertyPane(); + } + }, filter); + PluginListenerRegistration.getInstance().listen( + PluginEventType.BeforeStop, + new PluginEventListener(10) { + @Override + public void on(PluginEvent event) { + PluginContext context = event.getContext(); + PluginRuntime runtime = context.getRuntime(); + Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); + for (PropertyItemPaneProvider provider : providers) { + removePropertyItem(provider); + + } + updateAllPropertyPane(); + } + }, filter); + } + + private void removePropertyItem(PropertyItemPaneProvider provider) { + + propertyItemMap.remove(provider.key()); + String replaceKey = provider.replaceKey(); + PropertyItem replaceItem = propertyItemMap.get(replaceKey); + if (replaceItem != null) { + replaceItem.setReplace(false); + } + } + + private void initPluginPane() { + + ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign); + Set providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG); + for (PropertyItemPaneProvider provider : providers) { + addPropertyItem(provider); + } + } + + private void addPropertyItem(PropertyItemPaneProvider provider) { + + String key = provider.key(); + PropertyItemBean itemBean = provider.getItem(); + PropertyItem propertyItem = new PropertyItem(itemBean.getName(), + itemBean.getTitle(), + itemBean.getBtnIconName(), + itemBean.getVisibleModes(), + itemBean.getEnableModes()); + UIButton button = propertyItem.getButton(); + List buttonListeners = itemBean.getButtonListeners(); + for (ActionListener buttonListener : buttonListeners) { + button.addActionListener(buttonListener); + } + propertyItemMap.put(key, propertyItem); + + String replaceKey = provider.replaceKey(); + PropertyItem replaceItem = propertyItemMap.get(replaceKey); + if (replaceItem != null) { + replaceItem.setReplace(true); + } + + } + private void initPropertyItemList() { + propertyItemMap = new LinkedHashMap<>(); // 有序map // 单元格元素 PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Element"), @@ -360,6 +475,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void replaceConfiguredRolesPane(JComponent pane) { propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane); } + + public void replaceKeyPane(String key, JComponent pane) { + + propertyItemMap.get(key).replaceContentPane(pane); + } public JComponent getConfiguredRolesPane() { return propertyItemMap.get(KEY_CONFIGURED_ROLES).getContentPane(); @@ -511,6 +631,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private PopupDialog popupDialog; // 弹出框 private boolean isPoppedOut = false; // 是否弹出 private boolean isVisible = true; // 是否可见 + private boolean replace = false; // 是否被替代 private boolean isEnabled = true; // 是否可用 private Set visibleModes; private Set enableModes; @@ -563,13 +684,19 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } public boolean isVisible() { - return isVisible; + // 取决于可见且未替代 + return isVisible && !replace; } public void setVisible(boolean isVisible) { this.isVisible = isVisible; } - + + public void setReplace(boolean replace) { + + this.replace = replace; + } + public boolean isEnabled() { return isEnabled; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/PaneHolder.java b/designer-base/src/main/java/com/fr/design/mainframe/PaneHolder.java new file mode 100644 index 000000000..aef5e0b13 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/PaneHolder.java @@ -0,0 +1,17 @@ +package com.fr.design.mainframe; + +import javax.swing.JPanel; + +/** + * created by Harrison on 2020/03/23 + **/ +public interface PaneHolder { + + /** + * 得到 Pane + * + * @param arg 参数 + * @return 面板 + */ + JPanel getInstance(T arg); +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java b/designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java new file mode 100644 index 000000000..f6a250def --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java @@ -0,0 +1,68 @@ +package com.fr.design.mainframe; + +import java.awt.event.ActionListener; +import java.util.List; + +/** + * created by Harrison on 2020/03/23 + **/ +public class PropertyItemBean { + + private String name; + private String title; + private String btnIconName; + private EastRegionContainerPane.PropertyMode[] visibleModes; + private EastRegionContainerPane.PropertyMode[] enableModes; + private List buttonListeners; + + public PropertyItemBean() { + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getBtnIconName() { + return btnIconName; + } + + public void setBtnIconName(String btnIconName) { + this.btnIconName = btnIconName; + } + + public EastRegionContainerPane.PropertyMode[] getVisibleModes() { + return visibleModes; + } + + public void setVisibleModes(EastRegionContainerPane.PropertyMode[] visibleModes) { + this.visibleModes = visibleModes; + } + + public EastRegionContainerPane.PropertyMode[] getEnableModes() { + return enableModes; + } + + public void setEnableModes(EastRegionContainerPane.PropertyMode[] enableModes) { + this.enableModes = enableModes; + } + + public List getButtonListeners() { + return buttonListeners; + } + + public void setButtonListeners(List buttonListeners) { + this.buttonListeners = buttonListeners; + } +} diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java index fe1088ea8..482954546 100644 --- a/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java @@ -11,7 +11,7 @@ import java.awt.event.ActionEvent; /** * created by Harrison on 2020/03/22 **/ -public class SnapChatUpdateAction extends UpdateAction implements SnapChat { +public abstract class SnapChatUpdateAction extends UpdateAction implements SnapChat { private SnapChatKey uniqueKey; @@ -20,15 +20,13 @@ public class SnapChatUpdateAction extends UpdateAction implements SnapChat { } @Override - public void actionPerformed(ActionEvent e) { + public final void actionPerformed(ActionEvent e) { markRead(); actionPerformed0(e); } - protected void actionPerformed0(ActionEvent e) { - - } + protected abstract void actionPerformed0(ActionEvent e); @Override public boolean hasRead() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index 7d00e367c..f49f2859b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -1,19 +1,43 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; -import com.fr.design.fun.ComponentLibraryPaneProcessor; +import com.fr.base.FRContext; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.component.pane.ComponentLibraryPaneCreator; -import com.fr.plugin.context.PluginContext; -import com.fr.plugin.manage.PluginFilter; -import com.fr.plugin.observer.PluginEvent; -import com.fr.plugin.observer.PluginEventListener; -import com.fr.plugin.observer.PluginListenerRegistration; +import com.fr.design.widget.FRWidgetFactory; +import com.fr.form.share.ShareLoader; +import com.fr.form.ui.SharableWidgetBindInfo; +import com.fr.general.CloudCenter; +import com.fr.log.FineLoggerFactory; +import com.fr.share.ShareConstants; +import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; +import javax.swing.BorderFactory; +import javax.swing.DefaultComboBoxModel; import javax.swing.Icon; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.SwingWorker; +import javax.swing.filechooser.FileNameExtensionFilter; import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Desktop; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; /** * Created with IntelliJ IDEA. @@ -22,6 +46,19 @@ import java.awt.BorderLayout; * Time: 下午8:18 */ public class FormWidgetDetailPane extends FormDockView{ + private static final int LOCAL_WIDGET_LABEL_WIDTH = 90; + + private UIScrollPane downPane; + private JPanel reuWidgetPanel; + private UIComboBox comboBox; + private SharableWidgetBindInfo[] elCaseBindInfoList; + private UIButton deleteButton; + private JPanel editPanel; + private JPanel resetPanel; + private JPanel menutPanelNorthPane; + private SwingWorker sw; + //组件面板是否可以编辑 + private boolean isEdit; public static FormWidgetDetailPane getInstance() { if (HOLDER.singleton == null) { @@ -32,7 +69,6 @@ public class FormWidgetDetailPane extends FormDockView{ private FormWidgetDetailPane(){ setLayout(FRGUIPaneFactory.createBorderLayout()); - listenPluginComponentPane(); } @@ -54,56 +90,350 @@ public class FormWidgetDetailPane extends FormDockView{ public Icon getViewIcon() { return BaseUtils.readIcon("/com/fr/design/images/m_report/attributes.png"); } - + /** * 初始化 */ - @Override public void refreshDockingView(){ - FormDesigner designer = this.getEditingFormDesigner(); removeAll(); if(designer == null){ clearDockingView(); return; } - - initComponentPane(); + reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + reuWidgetPanel.setBorder(null); + if (elCaseBindInfoList == null) { + if (sw != null) { + sw.cancel(true); + } + sw = new SwingWorker() { + @Override + protected Object doInBackground() throws Exception { + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshDownPanel(false); + return null; + } + }; + sw.execute(); + } + initReuWidgetPanel(); + initMenuPanel(); + + add(reuWidgetPanel, BorderLayout.CENTER); + + } + + /** + * 初始化组件共享和复用面板 + */ + private void initReuWidgetPanel() { + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, false)); + downPane.setBorder(null); + reuWidgetPanel.add(downPane); + } + + /** + * 初始化菜单栏面板 + */ + private void initMenuPanel() { + JPanel menutPanel = new JPanel(); + menutPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + menutPanel.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 15)); + + menutPanelNorthPane = new JPanel(new BorderLayout()); + UILabel localWidgetLabel = FRWidgetFactory.createLineWrapLabel( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Local_Widget"), + LOCAL_WIDGET_LABEL_WIDTH); + menutPanelNorthPane.add(localWidgetLabel, BorderLayout.WEST); + menutPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); + menutPanelNorthPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); + + menutPanel.add(menutPanelNorthPane, BorderLayout.NORTH); + comboBox = new UIComboBox(getFormCategories()); + comboBox.setPreferredSize(new Dimension(240, comboBox.getPreferredSize().height)); + initComboBoxSelectedListener(); + menutPanel.add(comboBox, BorderLayout.CENTER); + reuWidgetPanel.add(menutPanel, BorderLayout.NORTH); + + } + + /** + * 创建菜单栏按钮面板 + */ + private JPanel initEditButtonPane() { + editPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); + + editPanel.add(createRefreshButton()); + editPanel.add(createDownloadButton()); + editPanel.add(createInstallButton()); + editPanel.add(createDeleteButton()); + + return editPanel; } - - private void listenPluginComponentPane() { - - PluginFilter filter = new PluginFilter() { + + /** + * 创建取消删除面板 + */ + private JPanel initResetButtonPane() { + resetPanel = new JPanel(); + UIButton resetButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Reset")); + resetPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); + resetButton.setBackground(Color.white); + resetButton.setForeground(new Color(0x333334)); + resetButton.addActionListener(new ActionListener() { @Override - public boolean accept(PluginContext context) { - return context.contain(ComponentLibraryPaneProcessor.XML_TAG); + public void actionPerformed(ActionEvent e) { + refreshDownPanel(false); + replaceButtonPanel(false); + reuWidgetPanel.remove(deleteButton); } - }; - PluginListenerRegistration.getInstance().listenRunningChanged(new PluginEventListener() { + }); + + deleteButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Remove_Item")); + deleteButton.setBackground(Color.white); + deleteButton.setForeground(new Color(0xeb1d1f)); + deleteButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (ShareLoader.getLoader().removeModulesFromList()) { + refreshShareMoudule(); + reuWidgetPanel.remove(deleteButton); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_Removed_Successful")); + refreshDownPanel(false); + replaceButtonPanel(false); + refreshComboxData(); + } else { + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_Removed_Failed")); + } + + } + }); + JPanel deletePane = new JPanel(new BorderLayout()); + deletePane.add(deleteButton, BorderLayout.CENTER); + deletePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); + + resetPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + resetPanel.add(resetButton, BorderLayout.CENTER); + resetPanel.add(deletePane, BorderLayout.WEST); + + refreshDownPanel(true); + + return resetPanel; + + } + + + private void initComboBoxSelectedListener() { + comboBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + ShareLoader.getLoader().resetRemovedModuleList(); + int filterIndex = comboBox.getSelectedIndex(); + if (filterIndex == 0) { + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + } else { + String filterName = comboBox.getSelectedItem().toString(); + elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName); + } + refreshDownPanel(isEdit); + + } + }); + } + + /** + * 创建工具条按钮 + */ + private UIButton createToolButton(Icon icon, String toolTip, ActionListener actionListener) { + UIButton toolButton = new UIButton(); + toolButton.setIcon(icon); + toolButton.setToolTipText(toolTip); + toolButton.set4ToolbarButton(); + toolButton.addActionListener(actionListener); + return toolButton; + + } + + /** + * 创建刷新按钮 + */ + private UIButton createRefreshButton() { + return createToolButton( + BaseUtils.readIcon("/com/fr/design/form/images/refresh.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh"), + new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (sw != null) { + sw.cancel(true); + } + sw = new SwingWorker() { + @Override + protected Object doInBackground() throws Exception { + ShareLoader.getLoader().refreshModule(); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshComboxData(); + refreshDownPanel(false); + return null; + } + }; + sw.execute(); + } + } + ); + } + + private void refreshComboxData() { + comboBox.setSelectedIndex(0); + comboBox.setModel(new DefaultComboBoxModel(getFormCategories())); + } + + /** + * 创建下载模板的按钮 + */ + private UIButton createDownloadButton() { + UIButton downloadButton = new UIButton(); + downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/download icon.png")); + downloadButton.set4ToolbarButton(); + downloadButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Download_Template")); + downloadButton.addActionListener(new ActionListener() { @Override - public void on(PluginEvent event) { - refreshDockingView(); + public void actionPerformed(ActionEvent e) { + String url = CloudCenter.getInstance().acquireUrlByKind("reuse.url"); + if (StringUtils.isEmpty(url)) { + FRContext.getLogger().info("The URL is empty!"); + return; + } + try { + Desktop.getDesktop().browse(new URI(url)); + } catch (IOException exp) { + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser_Duplicate")); + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + } catch (URISyntaxException exp) { + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + } catch (Exception exp) { + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url); + } + } + }); + return downloadButton; + } + + /** + * 创建安装模板的按钮 + */ + private UIButton createInstallButton() { + return createToolButton( + BaseUtils.readIcon("/com/fr/design/form/images/install icon.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Install_Template"), + new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); + fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); + int returnValue = fileChooser.showDialog(new UILabel(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); + if (returnValue == JFileChooser.APPROVE_OPTION) { + final File chosenFile = fileChooser.getSelectedFile(); + installFromDiskZipFile(chosenFile); + } + } + } + ); + } + + /** + * 创建删除模板的按钮 + */ + private UIButton createDeleteButton() { + return createToolButton( + BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Delete_Template"), + new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + replaceButtonPanel(true); + } + } + ); + } + + private void replaceButtonPanel(boolean isEdit) { + this.isEdit = isEdit; + if (isEdit) { + menutPanelNorthPane.remove(editPanel); + menutPanelNorthPane.add(initResetButtonPane(), BorderLayout.EAST); + } else { + menutPanelNorthPane.remove(resetPanel); + menutPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); + ShareLoader.getLoader().resetRemovedModuleList(); + } + } + + private void installFromDiskZipFile(File chosenFile) { + if (chosenFile != null && chosenFile.getName().endsWith(ShareConstants.SUFFIX_MODULE)) { + try { + if (ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile)) { + refreshShareMoudule(); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshDownPanel(false); + refreshComboxData(); + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_OK")); + } else { + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Share_Module_Error")); + } + } catch (IOException e) { + JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Share_Module_Error")); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } - }, filter); + } } - - private void initComponentPane() { - - ComponentLibraryPaneCreator creator = ComponentLibraryPaneCreator.getNew(); - JPanel componentLibraryPane = creator.create(this); - add(componentLibraryPane, BorderLayout.CENTER); + + private void refreshShareMoudule() { + try { + ShareLoader.getLoader().refreshModule(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + + /** + * 获取报表块组件分类 + */ + public String[] getFormCategories() { + return ArrayUtils.addAll(new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_AllCategories")}, ShareLoader.getLoader().getModuleCategory()); + } + + public void refreshDownPanel(boolean isEdit) { + reuWidgetPanel.remove(downPane); + downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit)); + downPane.setBorder(null); + reuWidgetPanel.add(downPane); + repaintContainer(); + + } + + public void repaintContainer() { + validate(); + repaint(); + revalidate(); } /** * 清除数据 */ public void clearDockingView() { - JScrollPane psp = new JScrollPane(); psp.setBorder(null); this.add(psp, BorderLayout.CENTER); } + + /** * 定位 * @return 位置 diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index ab19002c1..74c14a604 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -6,6 +6,7 @@ import com.fr.base.Parameter; import com.fr.base.extension.FileExtension; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.FormMobileAttrAction; import com.fr.design.actions.TemplateParameterAction; import com.fr.design.actions.core.WorkBookSupportable; @@ -29,6 +30,7 @@ import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; import com.fr.design.fun.PreviewProvider; +import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.ilable.UILabel; @@ -65,6 +67,14 @@ import com.fr.form.ui.container.WLayout; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.page.PaperSettingProvider; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.context.PluginRuntime; +import com.fr.plugin.injectable.PluginModule; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; +import com.fr.plugin.observer.PluginEventType; +import com.fr.plugin.observer.PluginListenerRegistration; import com.fr.report.cell.Elem; import com.fr.report.cell.cellattr.CellImage; import com.fr.report.worksheet.FormElementCase; @@ -91,6 +101,7 @@ import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Set; public class JForm extends JTemplate implements BaseJForm
{ private static final String FORM_CARD = "FORM"; @@ -116,12 +127,58 @@ public class JForm extends JTemplate implements BaseJForm providers = runtime.get(PropertyItemPaneProvider.XML_TAG); + for (PropertyItemPaneProvider provider : providers) { + addPane(provider); + } + } + }, filter); + } + + private void initPluginPane() { + + ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign); + Set providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG); + for (PropertyItemPaneProvider provider : providers) { + addPane(provider); + } } - + + private void addPane(PropertyItemPaneProvider provider) { + + PaneHolder holder = provider.getPaneHolder(FormDesigner.class); + if (holder != null) { + JPanel panel = holder.getInstance(formDesign); + EastRegionContainerPane.getInstance().replaceKeyPane(provider.key(), panel); + } + } + @Override public void refreshEastPropertiesPane() { // 暂时用不到,遇到的时候再加刷新右侧tab面板的代码 @@ -765,7 +822,7 @@ public class JForm extends JTemplate implements BaseJForm right.layerIndex()) { - right = DEFAULT; - } - return right; - } -} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java b/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java deleted file mode 100644 index 8cb5d1533..000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneCreator.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.fr.design.mainframe.component.pane; - -import com.fr.design.fun.ComponentLibraryPaneProcessor; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.icontainer.UIScrollPane; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.DockingView; -import com.fr.design.mainframe.component.ComponentLibraryManager; - -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import java.awt.BorderLayout; - -/** - * created by Harrison on 2020/03/22 - **/ -public class ComponentLibraryPaneCreator { - - private ComponentLibraryPaneProcessor processor; - - public ComponentLibraryPaneCreator() { - - processor = ComponentLibraryManager.selectPaneProcessor(); - } - - public static ComponentLibraryPaneCreator getNew() { - - return new ComponentLibraryPaneCreator(); - } - - public JPanel create(DockingView dockingView) { - - JPanel componentLibPanel = createComponentLibPanel(); - processor.parentView(dockingView); - processor.parentPane(componentLibPanel); - - JPanel menuPanel = createMenuPanel(); - componentLibPanel.add(menuPanel, BorderLayout.NORTH); - - UIScrollPane showPane = processor.createShowPanel(false); - componentLibPanel.add(showPane); - return componentLibPanel; - } - - private JPanel createComponentLibPanel() { - - JPanel reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - reuWidgetPanel.setBorder(null); - return reuWidgetPanel; - } - - /** - * 初始化菜单栏面板 - */ - private JPanel createMenuPanel() { - - JPanel menuPanel = new JPanel(); - menuPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); - menuPanel.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 15)); - - JPanel menuPanelNorthPane = processor.createMenuNorthPane(); - if (menuPanelNorthPane != null) { - menuPanel.add(menuPanelNorthPane, BorderLayout.NORTH); - } - - UIComboBox menuPanelComboBox = processor.createMenuComBox(); - if (menuPanelComboBox != null) { - menuPanel.add(menuPanelComboBox, BorderLayout.CENTER); - } - return menuPanel; - } -} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneProcessorImpl.java b/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneProcessorImpl.java deleted file mode 100644 index 18148ce0d..000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/component/pane/ComponentLibraryPaneProcessorImpl.java +++ /dev/null @@ -1,412 +0,0 @@ -package com.fr.design.mainframe.component.pane; - -import com.fr.base.BaseUtils; -import com.fr.design.fun.impl.AbstractComponentLibraryPaneProcessor; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.icontainer.UIScrollPane; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.DockingView; -import com.fr.design.mainframe.ShareWidgetPane; -import com.fr.design.widget.FRWidgetFactory; -import com.fr.form.share.ShareLoader; -import com.fr.form.ui.SharableWidgetBindInfo; -import com.fr.general.CloudCenter; -import com.fr.log.FineLoggerFactory; -import com.fr.share.ShareConstants; -import com.fr.stable.ArrayUtils; -import com.fr.stable.StringUtils; - -import javax.swing.BorderFactory; -import javax.swing.DefaultComboBoxModel; -import javax.swing.Icon; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.SwingWorker; -import javax.swing.filechooser.FileNameExtensionFilter; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Desktop; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -/** - * created by Harrison on 2020/03/16 - **/ -public class ComponentLibraryPaneProcessorImpl extends AbstractComponentLibraryPaneProcessor { - - private static final int LOCAL_WIDGET_LABEL_WIDTH = 90; - - private DockingView parentView; - - private SwingWorker sw; - - private JPanel componentLibPane; - private UIScrollPane showPane; - - private UIComboBox menuPanelComboBox; - private JPanel menuPanelNorthPane; - private SharableWidgetBindInfo[] bindInfoArray; - - private UIButton deleteButton; - private JPanel editPanel; - private JPanel resetPanel; - /** - * 组件面板是否可以编辑 - */ - private boolean isEdit; - - public ComponentLibraryPaneProcessorImpl() { - - } - - @Override - public void parentView(DockingView dockingView) { - - parentView = dockingView; - if (bindInfoArray == null) { - if (sw != null) { - sw.cancel(true); - } - sw = new SwingWorker() { - @Override - protected Object doInBackground() throws Exception { - bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); - refreshShowPanel(false); - return null; - } - }; - sw.execute(); - } - } - - @Override - public void parentPane(JPanel panel) { - this.componentLibPane = panel; - } - - @Override - public void complete() { - - } - - /** - * 初始化组件共享和复用面板 - */ - @Override - public UIScrollPane createShowPanel(boolean isEdit) { - - showPane = new UIScrollPane( - new ShareWidgetPane(bindInfoArray, isEdit) - ); - showPane.setBorder(null); - return showPane; - } - - - @Override - public UIComboBox createMenuComBox() { - - menuPanelComboBox = new UIComboBox(getFormCategories()); - menuPanelComboBox.setPreferredSize(new Dimension(240, menuPanelComboBox.getPreferredSize().height)); - addComboBoxListener(); - return menuPanelComboBox; - } - - private void addComboBoxListener() { - - menuPanelComboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - ShareLoader.getLoader().resetRemovedModuleList(); - int filterIndex = menuPanelComboBox.getSelectedIndex(); - if (filterIndex == 0) { - bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); - } else { - String filterName = menuPanelComboBox.getSelectedItem().toString(); - bindInfoArray = ShareLoader.getLoader().getFilterBindInfoList(filterName); - } - refreshShowPanel(isEdit); - } - }); - } - - @Override - public JPanel createMenuNorthPane() { - - menuPanelNorthPane = new JPanel(new BorderLayout()); - UILabel localWidgetLabel = FRWidgetFactory.createLineWrapLabel( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Local_Widget"), - LOCAL_WIDGET_LABEL_WIDTH); - menuPanelNorthPane.add(localWidgetLabel, BorderLayout.WEST); - menuPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); - menuPanelNorthPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); - return menuPanelNorthPane; - - } - - /** - * 创建菜单栏按钮面板 - */ - protected JPanel initEditButtonPane() { - - editPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); - - editPanel.add(createRefreshButton()); - editPanel.add(createDownloadButton()); - editPanel.add(createInstallButton()); - editPanel.add(createDeleteButton()); - - return editPanel; - } - - /** - * 创建取消删除面板 - */ - protected JPanel initResetButtonPane() { - - resetPanel = new JPanel(); - UIButton resetButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Reset")); - resetPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); - resetButton.setBackground(Color.white); - resetButton.setForeground(new Color(0x333334)); - resetButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - refreshShowPanel(false); - replaceButtonPanel(false); - componentLibPane.remove(deleteButton); - } - }); - - deleteButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Remove_Item")); - deleteButton.setBackground(Color.white); - deleteButton.setForeground(new Color(0xeb1d1f)); - deleteButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (ShareLoader.getLoader().removeModulesFromList()) { - refreshShareModule(); - componentLibPane.remove(deleteButton); - bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_Removed_Successful")); - refreshShowPanel(false); - replaceButtonPanel(false); - refreshComboBoxData(); - } else { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_Removed_Failed")); - } - - } - }); - JPanel deletePane = new JPanel(new BorderLayout()); - deletePane.add(deleteButton, BorderLayout.CENTER); - deletePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); - - resetPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); - resetPanel.add(resetButton, BorderLayout.CENTER); - resetPanel.add(deletePane, BorderLayout.WEST); - - refreshShowPanel(true); - - return resetPanel; - - } - - - /** - * 创建工具条按钮 - */ - protected UIButton createToolButton(Icon icon, String toolTip, ActionListener actionListener) { - - UIButton toolButton = new UIButton(); - toolButton.setIcon(icon); - toolButton.setToolTipText(toolTip); - toolButton.set4ToolbarButton(); - toolButton.addActionListener(actionListener); - return toolButton; - - } - - /** - * 创建刷新按钮 - */ - protected UIButton createRefreshButton() { - - return createToolButton( - BaseUtils.readIcon("/com/fr/design/form/images/refresh.png"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh"), - new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (sw != null) { - sw.cancel(true); - } - sw = new SwingWorker() { - @Override - protected Object doInBackground() throws Exception { - ShareLoader.getLoader().refreshModule(); - bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); - refreshComboBoxData(); - refreshShowPanel(false); - return null; - } - }; - sw.execute(); - } - } - ); - } - - /** - * 创建下载模板的按钮 - */ - protected UIButton createDownloadButton() { - UIButton downloadButton = new UIButton(); - downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/download icon.png")); - downloadButton.set4ToolbarButton(); - downloadButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Download_Template")); - downloadButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - String url = CloudCenter.getInstance().acquireUrlByKind("reuse.url"); - if (StringUtils.isEmpty(url)) { - FineLoggerFactory.getLogger().info("The URL is empty!"); - return; - } - try { - Desktop.getDesktop().browse(new URI(url)); - } catch (IOException exp) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser_Duplicate")); - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - } catch (URISyntaxException exp) { - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - } catch (Exception exp) { - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url); - } - } - }); - return downloadButton; - } - - /** - * 创建安装模板的按钮 - */ - protected UIButton createInstallButton() { - return createToolButton( - BaseUtils.readIcon("/com/fr/design/form/images/install icon.png"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Install_Template"), - new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JFileChooser fileChooser = new JFileChooser(); - fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); - int returnValue = fileChooser.showDialog(new UILabel(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); - if (returnValue == JFileChooser.APPROVE_OPTION) { - final File chosenFile = fileChooser.getSelectedFile(); - installFromDiskZipFile(chosenFile); - } - } - } - ); - } - - /** - * 创建删除模板的按钮 - */ - protected UIButton createDeleteButton() { - return createToolButton( - BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Delete_Template"), - new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - replaceButtonPanel(true); - } - } - ); - } - - /** - * 获取报表块组件分类 - */ - protected String[] getFormCategories() { - - return ArrayUtils.addAll(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_AllCategories")}, ShareLoader.getLoader().getModuleCategory()); - } - - protected void refreshShowPanel(boolean isEdit) { - - componentLibPane.remove(showPane); - showPane = createShowPanel(isEdit); - componentLibPane.add(showPane); - repaint(); - } - - private void refreshComboBoxData() { - - menuPanelComboBox.setSelectedIndex(0); - menuPanelComboBox.setModel(new DefaultComboBoxModel(getFormCategories())); - } - - private void replaceButtonPanel(boolean isEdit) { - - this.isEdit = isEdit; - if (isEdit) { - menuPanelNorthPane.remove(editPanel); - menuPanelNorthPane.add(initResetButtonPane(), BorderLayout.EAST); - } else { - menuPanelNorthPane.remove(resetPanel); - menuPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); - ShareLoader.getLoader().resetRemovedModuleList(); - } - } - - private void installFromDiskZipFile(File chosenFile) { - - if (chosenFile != null && chosenFile.getName().endsWith(ShareConstants.SUFFIX_MODULE)) { - try { - if (ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile)) { - refreshShareModule(); - bindInfoArray = ShareLoader.getLoader().getAllBindInfoList(); - refreshShowPanel(false); - refreshComboBoxData(); - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Share_Module_OK")); - } else { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Share_Module_Error")); - } - } catch (IOException e) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Share_Module_Error")); - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - } - - private void refreshShareModule() { - try { - ShareLoader.getLoader().refreshModule(); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - - public void repaint() { - - parentView.validate(); - parentView.repaint(); - parentView.revalidate(); - } - -} From f89a5d3171f9de2a09101f06650e7155b4363a9b Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 24 Mar 2020 14:38:48 +0800 Subject: [PATCH 08/76] =?UTF-8?q?REPORT-27647=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=89=E8=A3=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=20=E5=88=A0=E6=8E=89=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/fun/PropertyItemPaneProvider.java | 21 ++++++++++++++++ ...AbstractComponentLibraryPaneProcessor.java | 25 ------------------- .../mainframe/EastRegionContainerPane.java | 6 +++++ 3 files changed, 27 insertions(+), 25 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractComponentLibraryPaneProcessor.java diff --git a/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java b/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java index 2dbead9ed..2c5c3f2d4 100644 --- a/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java @@ -14,12 +14,33 @@ public interface PropertyItemPaneProvider extends Mutable { String XML_TAG = "PropertyItemPaneProvider"; + /** + * 独一无二的标志 + * + * @return 标志 + */ String key(); + /** + * 配置属性 + * + * @return 熟悉 + */ PropertyItemBean getItem(); + /** + * 面板持有者 + * + * @param clazz 类型 + * @return 持有者 + */ @Nullable PaneHolder getPaneHolder(Class clazz); + /** + * 想要替代的类型 + * + * @return 替代类型 + */ String replaceKey(); } diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractComponentLibraryPaneProcessor.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractComponentLibraryPaneProcessor.java deleted file mode 100644 index f376ad788..000000000 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractComponentLibraryPaneProcessor.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.fr.design.fun.impl; - -import com.fr.design.fun.ComponentLibraryPaneProcessor; -import com.fr.stable.fun.impl.AbstractProvider; -import com.fr.stable.fun.mark.API; -import com.fr.stable.fun.mark.Layer; - -/** - * created by Harrison on 2020/03/16 - **/ -@API(level = ComponentLibraryPaneProcessor.CURRENT_LEVEL) -public abstract class AbstractComponentLibraryPaneProcessor extends AbstractProvider implements ComponentLibraryPaneProcessor { - - @Override - public int currentAPILevel() { - - return ComponentLibraryPaneProcessor.CURRENT_LEVEL; - } - - @Override - public int layerIndex() { - - return Layer.DEFAULT_LAYER_INDEX; - } -} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 790c0eb39..0c23e8658 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -178,6 +178,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyItemMap.remove(provider.key()); String replaceKey = provider.replaceKey(); + if (replaceKey == null) { + return; + } PropertyItem replaceItem = propertyItemMap.get(replaceKey); if (replaceItem != null) { replaceItem.setReplace(false); @@ -210,6 +213,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyItemMap.put(key, propertyItem); String replaceKey = provider.replaceKey(); + if (replaceKey == null) { + return; + } PropertyItem replaceItem = propertyItemMap.get(replaceKey); if (replaceItem != null) { replaceItem.setReplace(true); From 2a0bbc69bc773513d92b25dbb03b50fc1b4db77d Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 24 Mar 2020 14:46:47 +0800 Subject: [PATCH 09/76] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/ComponentLibraryPaneProcessor.java | 57 ------------------- 1 file changed, 57 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java diff --git a/designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java b/designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java deleted file mode 100644 index 7b484b156..000000000 --- a/designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.fr.design.fun; - -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.icontainer.UIScrollPane; -import com.fr.design.mainframe.DockingView; -import com.fr.stable.fun.mark.Immutable; - -import javax.swing.JPanel; - -/** - * 组件库面板处理器 - * - * created by Harrison on 2020/03/16 - **/ -public interface ComponentLibraryPaneProcessor extends Immutable { - - String XML_TAG = "ComponentLibraryPaneProcessor"; - - int CURRENT_LEVEL = 1; - - /** - * 创建展示面板 - * - * @param isEdit 是否可以编辑 - * @return 展示面板 - */ - UIScrollPane createShowPanel(boolean isEdit); - - /** - * 创建菜单的上部面板 - * - * @return 面板 - */ - JPanel createMenuNorthPane(); - - /** - * 创建复选框 - * - * @return 复选框 - */ - UIComboBox createMenuComBox(); - - void parentView(DockingView dockingView); - - /** - * 父面板 - * - * @param panel 面板 - */ - void parentPane(JPanel panel); - - /** - * 创建完成 - */ - void complete(); - -} From 713b72cded5d886b417e5d696f1fe3c3c24aeb6f Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 24 Mar 2020 18:08:10 +0800 Subject: [PATCH 10/76] =?UTF-8?q?REPORT-27647=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=89=E8=A3=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=20=E8=B0=83=E6=95=B4=E6=9A=B4=E9=9C=B2?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3=EF=BC=8C=E8=BF=94=E5=9B=9E=E5=90=88?= =?UTF-8?q?=E9=80=82=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/FormCreatorDropTarget.java | 6 +++--- .../fr/design/mainframe/FormWidgetDetailPane.java | 4 ++-- .../com/fr/design/mainframe/ShareWidgetButton.java | 12 ++++++------ .../com/fr/design/mainframe/ShareWidgetPane.java | 7 ++++--- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 756a89f56..0a6e692f4 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -22,15 +22,14 @@ import com.fr.design.icon.IconPathConstants; import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.utils.ComponentUtils; import com.fr.form.share.SharableEditorProvider; +import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.ShareLoader; import com.fr.form.ui.ChartEditor; -import com.fr.form.ui.SharableWidgetBindInfo; import com.fr.form.ui.Widget; import com.fr.stable.Constants; import javax.swing.BorderFactory; import javax.swing.JWindow; -import java.util.Map; import java.awt.Color; import java.awt.Component; import java.awt.Point; @@ -40,6 +39,7 @@ import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetEvent; +import java.util.Map; /** * 添加模式下鼠标事件处理器。 @@ -99,7 +99,7 @@ public class FormCreatorDropTarget extends DropTarget { if (addingXCreator.isShared()) { String shareId = addingXCreator.getShareId(); SharableEditorProvider sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(shareId); - SharableWidgetBindInfo bindInfo = ShareLoader.getLoader().getElCaseBindInfoById(shareId); + SharableWidgetProvider bindInfo = ShareLoader.getLoader().getElCaseBindInfoById(shareId); if (sharableEditor != null && bindInfo != null) { Map tdNameMap = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(), sharableEditor.getTableDataSource()); //合并数据集之后,可能会有数据集名称变化,做一下联动 diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index f49f2859b..ecb3faa70 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -8,8 +8,8 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.widget.FRWidgetFactory; +import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.ShareLoader; -import com.fr.form.ui.SharableWidgetBindInfo; import com.fr.general.CloudCenter; import com.fr.log.FineLoggerFactory; import com.fr.share.ShareConstants; @@ -51,7 +51,7 @@ public class FormWidgetDetailPane extends FormDockView{ private UIScrollPane downPane; private JPanel reuWidgetPanel; private UIComboBox comboBox; - private SharableWidgetBindInfo[] elCaseBindInfoList; + private SharableWidgetProvider[] elCaseBindInfoList; private UIButton deleteButton; private JPanel editPanel; private JPanel resetPanel; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java b/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java index a79ac17a5..7e7d76d89 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java @@ -1,14 +1,13 @@ package com.fr.design.mainframe; -import com.fr.base.BaseUtils; import com.fr.base.iofile.attr.SharableAttrMark; import com.fr.base.vcs.DesignerMode; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.ilable.UILabel; +import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.ShareLoader; import com.fr.form.ui.AbstractBorderStyleWidget; -import com.fr.form.ui.SharableWidgetBindInfo; import com.fr.form.ui.Widget; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.general.ComparatorUtils; @@ -52,8 +51,9 @@ import java.io.Serializable; * Time: 16:14 */ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMotionListener, Serializable { + private static final Dimension TAB_DEFAULT_SIZE = new Dimension(500, 300); - private SharableWidgetBindInfo bindInfo; + private SharableWidgetProvider bindInfo; private MouseEvent lastPressEvent; private JPanel reportPane; private boolean isEdit; @@ -72,7 +72,7 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot } }; - public ShareWidgetButton(SharableWidgetBindInfo bindInfo) { + public ShareWidgetButton(SharableWidgetProvider bindInfo) { this.bindInfo = bindInfo; this.setPreferredSize(new Dimension(108, 68)); initUI(); @@ -149,11 +149,11 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot }; } - public SharableWidgetBindInfo getBindInfo() { + public SharableWidgetProvider getBindInfo() { return bindInfo; } - public void setBindInfo(SharableWidgetBindInfo bindInfo) { + public void setBindInfo(SharableWidgetProvider bindInfo) { this.bindInfo = bindInfo; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetPane.java index 32ce586c7..549a4b174 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetPane.java @@ -1,7 +1,8 @@ package com.fr.design.mainframe; -import com.fr.form.ui.SharableWidgetBindInfo; + +import com.fr.form.share.SharableWidgetProvider; import javax.swing.*; import java.awt.*; @@ -12,12 +13,12 @@ import java.awt.*; */ public class ShareWidgetPane extends JPanel { - public ShareWidgetPane(SharableWidgetBindInfo[] elCaseBindInfoList, boolean isEdit) { + public ShareWidgetPane(SharableWidgetProvider[] elCaseBindInfoList, boolean isEdit) { this.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离 if (elCaseBindInfoList != null) { int rowCount = (elCaseBindInfoList.length + 1) / 2; this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 10)); - for (SharableWidgetBindInfo rbModuleInfo : elCaseBindInfoList) { + for (SharableWidgetProvider rbModuleInfo : elCaseBindInfoList) { ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); widgetButton.setElementCaseEdit(isEdit); this.add(widgetButton); From 11d99d7f223165dd90bda3025598077e67d38f8b Mon Sep 17 00:00:00 2001 From: Harrison Date: Wed, 25 Mar 2020 14:43:34 +0800 Subject: [PATCH 11/76] =?UTF-8?q?REPORT-27647=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=89=E8=A3=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E7=9B=91=E5=90=AC=E4=B8=8A=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/fun/PropertyItemPaneProvider.java | 4 +++ .../mainframe/EastRegionContainerPane.java | 36 ++++++++++++++----- .../fr/design/mainframe/PropertyItemBean.java | 10 ++++++ .../design/notification/SnapChatConfig.java | 12 +++---- .../java/com/fr/design/mainframe/JForm.java | 2 +- 5 files changed, 48 insertions(+), 16 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java b/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java index 2c5c3f2d4..4e5112d8c 100644 --- a/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java @@ -14,6 +14,10 @@ public interface PropertyItemPaneProvider extends Mutable { String XML_TAG = "PropertyItemPaneProvider"; + int FIRST = 100; + + int LAST = -100; + /** * 独一无二的标志 * diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 0c23e8658..d73f36a7a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -145,7 +145,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { }; PluginListenerRegistration.getInstance().listen( PluginEventType.AfterRun, - new PluginEventListener() { + new PluginEventListener(PropertyItemPaneProvider.FIRST) { @Override public void on(PluginEvent event) { PluginContext context = event.getContext(); @@ -159,7 +159,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { }, filter); PluginListenerRegistration.getInstance().listen( PluginEventType.BeforeStop, - new PluginEventListener(10) { + new PluginEventListener(PropertyItemPaneProvider.FIRST) { @Override public void on(PluginEvent event) { PluginContext context = event.getContext(); @@ -200,11 +200,22 @@ public class EastRegionContainerPane extends UIEastResizableContainer { String key = provider.key(); PropertyItemBean itemBean = provider.getItem(); - PropertyItem propertyItem = new PropertyItem(itemBean.getName(), - itemBean.getTitle(), - itemBean.getBtnIconName(), - itemBean.getVisibleModes(), - itemBean.getEnableModes()); + String btnIconBaseDir = itemBean.getBtnIconBaseDir(); + PropertyItem propertyItem; + if (StringUtils.isEmpty(btnIconBaseDir)) { + propertyItem = new PropertyItem(itemBean.getName(), + itemBean.getTitle(), + itemBean.getBtnIconName(), + itemBean.getVisibleModes(), + itemBean.getEnableModes()); + } else{ + propertyItem = new PropertyItem(itemBean.getName(), + itemBean.getTitle(), + itemBean.getBtnIconName(), + btnIconBaseDir, + itemBean.getVisibleModes(), + itemBean.getEnableModes()); + } UIButton button = propertyItem.getButton(); List buttonListeners = itemBean.getButtonListeners(); for (ActionListener buttonListener : buttonListeners) { @@ -648,14 +659,21 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private static final String ICON_SUFFIX_DISABLED = "_disabled.png"; private static final String ICON_SUFFIX_SELECTED = "_selected.png"; private String btnIconName; + private String iconBaseDir; private String iconSuffix = ICON_SUFFIX_NORMAL; // normal, diabled, selected, 三者之一 private final Color selectedBtnBackground = new Color(0xF5F5F7); private Color originBtnBackground; - + + public PropertyItem(String name, String title, String btnIconName, PropertyMode[] visibleModes, PropertyMode[] enableModes) { + this(name, title, btnIconName, ICON_BASE_DIR, visibleModes, enableModes); + } + + public PropertyItem(String name, String title, String btnIconName, String iconBaseDir, PropertyMode[] visibleModes, PropertyMode[] enableModes) { this.name = name; this.title = title; this.btnIconName = btnIconName; + this.iconBaseDir = iconBaseDir; initButton(); initPropertyPanel(); initModes(visibleModes, enableModes); @@ -793,7 +811,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } private String getBtnIconUrl() { - return ICON_BASE_DIR + btnIconName + iconSuffix; + return iconBaseDir + btnIconName + iconSuffix; } public void resetButtonIcon() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java b/designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java index f6a250def..ee54364ba 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java @@ -11,6 +11,7 @@ public class PropertyItemBean { private String name; private String title; private String btnIconName; + private String btnIconBaseDir; private EastRegionContainerPane.PropertyMode[] visibleModes; private EastRegionContainerPane.PropertyMode[] enableModes; private List buttonListeners; @@ -42,6 +43,15 @@ public class PropertyItemBean { this.btnIconName = btnIconName; } + public String getBtnIconBaseDir() { + + return btnIconBaseDir; + } + + public void setBtnIconBaseDir(String btnIconBaseDir) { + this.btnIconBaseDir = btnIconBaseDir; + } + public EastRegionContainerPane.PropertyMode[] getVisibleModes() { return visibleModes; } diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java index 04170e3be..ed6b7a6d8 100644 --- a/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java @@ -43,9 +43,12 @@ public class SnapChatConfig implements XMLable { @Override public void readXML(XMLableReader reader) { - String tagName = reader.getTagName(); - if ("MarkReadMap".equals(tagName)) { - readMarkReadMapXML(reader); + if (reader.isChildNode()) { + if ("item".equals(reader.getTagName())) { + String tmpVal = reader.getElementValue(); + Boolean markRead = Boolean.valueOf(tmpVal); + markReadMap.put(reader.getAttrAsString("key", StringUtils.EMPTY), markRead); + } } } @@ -62,9 +65,6 @@ public class SnapChatConfig implements XMLable { reader.readXMLObject(new XMLReadable() { @Override public void readXML(XMLableReader reader) { - String tmpVal = reader.getElementValue(); - Boolean markRead = Boolean.valueOf(tmpVal); - markReadMap.put(reader.getAttrAsString("key", StringUtils.EMPTY), markRead); } }); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 74c14a604..e464d7e05 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -148,7 +148,7 @@ public class JForm extends JTemplate implements BaseJForm Date: Wed, 25 Mar 2020 14:55:58 +0800 Subject: [PATCH 12/76] =?UTF-8?q?REPORT-27647=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=89=E8=A3=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=20=E5=A4=84=E7=90=86=E4=B8=8B=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E7=9A=84=20npe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index d73f36a7a..9276bd5c6 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -200,21 +200,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer { String key = provider.key(); PropertyItemBean itemBean = provider.getItem(); - String btnIconBaseDir = itemBean.getBtnIconBaseDir(); - PropertyItem propertyItem; - if (StringUtils.isEmpty(btnIconBaseDir)) { - propertyItem = new PropertyItem(itemBean.getName(), - itemBean.getTitle(), - itemBean.getBtnIconName(), - itemBean.getVisibleModes(), - itemBean.getEnableModes()); - } else{ - propertyItem = new PropertyItem(itemBean.getName(), + PropertyItem propertyItem = new PropertyItem(itemBean.getName(), itemBean.getTitle(), itemBean.getBtnIconName(), - btnIconBaseDir, itemBean.getVisibleModes(), itemBean.getEnableModes()); + String btnIconBaseDir = itemBean.getBtnIconBaseDir(); + if (StringUtils.isNotEmpty(btnIconBaseDir)) { + propertyItem.setIconBaseDir(btnIconBaseDir); } UIButton button = propertyItem.getButton(); List buttonListeners = itemBean.getButtonListeners(); @@ -730,7 +723,16 @@ public class EastRegionContainerPane extends UIEastResizableContainer { this.isEnabled = isEnabled; button.setEnabled(isEnabled); } - + + public void setIconBaseDir(String iconBaseDir) { + this.iconBaseDir = iconBaseDir; + } + + private String getIconBaseDir() { + + return StringUtils.isEmpty(iconBaseDir) ? ICON_BASE_DIR : iconBaseDir; + } + private void initPropertyPanel() { propertyPanel = new JPanel(); propertyPanel.setBackground(Color.pink); @@ -811,7 +813,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } private String getBtnIconUrl() { - return iconBaseDir + btnIconName + iconSuffix; + + return getIconBaseDir() + btnIconName + iconSuffix; } public void resetButtonIcon() { From 2379bd527e5778ac60b58ceefdc0f07aebf6e236 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 26 Mar 2020 12:58:10 +0800 Subject: [PATCH 13/76] =?UTF-8?q?=E6=97=A0jira=20=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=88=B0feature?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/start/DesignerLauncher.java | 16 +++++++++++++++- .../src/main/java/com/fr/start/FineDesigner.java | 14 ++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 designer-realize/src/main/java/com/fr/start/FineDesigner.java diff --git a/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java b/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java index 38f28346a..48cf9e4d0 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java +++ b/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java @@ -3,6 +3,9 @@ package com.fr.start; import com.fr.process.FineProcess; import com.fr.process.engine.FineJavaProcessFactory; import com.fr.process.engine.core.FineProcessContext; +import com.fr.stable.StableUtils; + +import java.io.File; /** * @author hades @@ -11,6 +14,10 @@ import com.fr.process.engine.core.FineProcessContext; */ public class DesignerLauncher { + private static final String BIN = "bin"; + private static final String DOT ="."; + private static final String BIN_HOME = generateBinHome(); + private static final DesignerLauncher INSTANCE = new DesignerLauncher(); private String[] args; @@ -19,6 +26,11 @@ public class DesignerLauncher { } + private static String generateBinHome() { + return DOT.equals(StableUtils.getInstallHome()) ? + DOT : StableUtils.getInstallHome() + File.separator + BIN; + } + public static DesignerLauncher getInstance() { return INSTANCE; } @@ -26,12 +38,14 @@ public class DesignerLauncher { public void start(String[] args) { this.args = args; FineJavaProcessFactory.create(). - entry("com.fr.start.MainDesigner"). + entry(MainDesigner.class). javaRuntime(DesignerJavaRuntime.getInstance().getJavaExec()). classPath(DesignerJavaRuntime.getInstance().getClassPath()). inheritJvmSettings(). jvmSettings(DesignerJavaRuntime.getInstance().getJvmOptions()). arguments(args). + directory(BIN_HOME). + entryPackage(FineDesigner.class). startProcess(DesignerProcessType.INSTANCE); DesignerSuperListener.getInstance().start(); } diff --git a/designer-realize/src/main/java/com/fr/start/FineDesigner.java b/designer-realize/src/main/java/com/fr/start/FineDesigner.java new file mode 100644 index 000000000..a3e202308 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/start/FineDesigner.java @@ -0,0 +1,14 @@ +package com.fr.start; + +import com.fr.process.engine.core.FineProcessEntry; + +/** + * 包装类 改变子进程的进程名 + * + * @author hades + * @version 10.0 + * Created by hades on 2020/3/24 + */ +public class FineDesigner extends FineProcessEntry { + +} From 455caa72fcdf5f86332d325bd64f1bdcc81c81a6 Mon Sep 17 00:00:00 2001 From: richie Date: Thu, 26 Mar 2020 14:49:12 +0800 Subject: [PATCH 14/76] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E6=96=B0=E7=9A=84JxBrowser+language=20level?= =?UTF-8?q?=E6=8F=90=E5=8D=87=E5=88=B01.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/bridge/exec/JSExecutor.java | 3 + .../fr/design/dcm/UniversalDatabasePane.java | 18 +- .../com/fr/design/dcm/UniversalDcmBridge.java | 12 +- .../main/java/com/fr/design/ui/Assistant.java | 68 ------ .../com/fr/design/ui/EmbProtocolHandler.java | 130 ---------- .../java/com/fr/design/ui/ModernUIPane.java | 147 ++++++----- .../ui/NxComplexInterceptRequestCallback.java | 85 +++++++ .../design/ui/NxInterceptRequestCallback.java | 134 ++++++++++ .../java/com/fr/design/upm/UpmBridge.java | 230 +++++++++++------- .../java/com/fr/design/upm/UpmFinder.java | 2 +- .../java/com/fr/design/upm/UpmShowPane.java | 15 +- .../design/upm/exec/UpmBrowserExecutor.java | 15 +- pom.xml | 4 +- 13 files changed, 471 insertions(+), 392 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/ui/Assistant.java delete mode 100644 designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java create mode 100644 designer-base/src/main/java/com/fr/design/ui/NxComplexInterceptRequestCallback.java create mode 100644 designer-base/src/main/java/com/fr/design/ui/NxInterceptRequestCallback.java diff --git a/designer-base/src/main/java/com/fr/design/bridge/exec/JSExecutor.java b/designer-base/src/main/java/com/fr/design/bridge/exec/JSExecutor.java index 9ded472eb..1efa613ab 100644 --- a/designer-base/src/main/java/com/fr/design/bridge/exec/JSExecutor.java +++ b/designer-base/src/main/java/com/fr/design/bridge/exec/JSExecutor.java @@ -4,5 +4,8 @@ package com.fr.design.bridge.exec; * Created by ibm on 2017/6/21. */ public interface JSExecutor { + + String CALLBACK_FUNCTION_NAME = "action"; + void executor(String newValue); } diff --git a/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java b/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java index e29a9f669..f16fa0b11 100644 --- a/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java +++ b/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java @@ -2,9 +2,8 @@ package com.fr.design.dcm; import com.fr.design.dialog.BasicPane; import com.fr.design.ui.ModernUIPane; -import com.teamdev.jxbrowser.chromium.JSValue; -import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; -import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; +import com.teamdev.jxbrowser.browser.callback.InjectJsCallback; +import com.teamdev.jxbrowser.js.JsObject; import java.awt.*; @@ -26,14 +25,13 @@ public class UniversalDatabasePane extends BasicPane { setLayout(new BorderLayout()); modernUIPane = new ModernUIPane.Builder<>() .withComponent(UniversalDatabaseComponent.KEY) - .prepare(new ScriptContextAdapter() { - @Override - public void onScriptContextCreated(ScriptContextEvent event) { - JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); - window.asObject().setProperty("DcmHelper", UniversalDcmBridge.getBridge(event.getBrowser())); + .prepare(params -> { + JsObject window = params.frame().executeJavaScript("window"); + if (window != null) { + window.putProperty("DcmHelper", UniversalDcmBridge.getBridge()); } - }) - .build(); + return InjectJsCallback.Response.proceed(); + }).build(); add(modernUIPane, BorderLayout.CENTER); } } diff --git a/designer-base/src/main/java/com/fr/design/dcm/UniversalDcmBridge.java b/designer-base/src/main/java/com/fr/design/dcm/UniversalDcmBridge.java index 577acada9..db43c3c79 100644 --- a/designer-base/src/main/java/com/fr/design/dcm/UniversalDcmBridge.java +++ b/designer-base/src/main/java/com/fr/design/dcm/UniversalDcmBridge.java @@ -2,8 +2,6 @@ package com.fr.design.dcm; import com.fr.decision.webservice.bean.BaseBean; import com.fr.design.bridge.exec.JSBridge; -import com.teamdev.jxbrowser.chromium.Browser; -import com.teamdev.jxbrowser.chromium.JSObject; /** * @author richie @@ -13,18 +11,18 @@ import com.teamdev.jxbrowser.chromium.JSObject; */ public class UniversalDcmBridge { - public static UniversalDcmBridge getBridge(Browser browser) { - return new UniversalDcmBridge(browser); + public static UniversalDcmBridge getBridge() { + return new UniversalDcmBridge(); } - private JSObject window; - private UniversalDcmBridge(Browser browser) { - this.window = browser.executeJavaScriptAndReturnValue("window").asObject(); + private UniversalDcmBridge() { + } /** * 获取所有的数据连接 + * * @return 数据连接集合 */ @JSBridge diff --git a/designer-base/src/main/java/com/fr/design/ui/Assistant.java b/designer-base/src/main/java/com/fr/design/ui/Assistant.java deleted file mode 100644 index 3962692c7..000000000 --- a/designer-base/src/main/java/com/fr/design/ui/Assistant.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.fr.design.ui; - -import com.fr.stable.StringUtils; -import com.teamdev.jxbrowser.chromium.Browser; -import com.teamdev.jxbrowser.chromium.BrowserContext; -import com.teamdev.jxbrowser.chromium.ProtocolService; -import com.teamdev.jxbrowser.chromium.URLResponse; - -import javax.activation.MimetypesFileTypeMap; -import java.io.DataInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -/** - * @author richie - * @version 10.0 - * Created by richie on 2019-03-07 - */ -public class Assistant { - - public static URLResponse inputStream2Response(InputStream inputStream, String filePath) throws Exception { - URLResponse response = new URLResponse(); - DataInputStream stream = new DataInputStream(inputStream); - byte[] data = new byte[stream.available()]; - stream.readFully(data); - response.setData(data); - String mimeType = getMimeType(filePath); - response.getHeaders().setHeader("Content-Type", mimeType); - return response; - } - - - private static String getMimeType(String path) { - if (StringUtils.isBlank(path)) { - return "text/html"; - } - if (path.endsWith(".html")) { - return "text/html"; - } - if (path.endsWith(".css")) { - return "text/css"; - } - if (path.endsWith(".js")) { - return "text/javascript"; - } - if (path.endsWith(".svg")) { - return "image/svg+xml"; - } - Path file = new File(path).toPath(); - try { - return Files.probeContentType(file); - } catch (IOException e) { - return "text/html"; - } - } - - public static void setEmbProtocolHandler(Browser browser, EmbProtocolHandler handler) { - BrowserContext browserContext = browser.getContext(); - ProtocolService protocolService = browserContext.getProtocolService(); - // 支持读取jar包中文件的自定义协议————emb:/com/fr/design/images/bbs.png - protocolService.setProtocolHandler("emb", handler); - protocolService.setProtocolHandler("file", handler); - } -} diff --git a/designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java b/designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java deleted file mode 100644 index 04d2f0f85..000000000 --- a/designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.fr.design.ui; - -import com.fr.base.TemplateUtils; -import com.fr.general.IOUtils; -import com.fr.log.FineLoggerFactory; -import com.fr.stable.EncodeConstants; -import com.fr.stable.StringUtils; -import com.fr.third.org.apache.commons.codec.net.URLCodec; -import com.fr.third.org.apache.commons.io.FileUtils; -import com.fr.third.org.apache.commons.io.FilenameUtils; -import com.fr.web.struct.AssembleComponent; -import com.fr.web.struct.AtomBuilder; -import com.fr.web.struct.PathGroup; -import com.fr.web.struct.category.ScriptPath; -import com.fr.web.struct.category.StylePath; -import com.teamdev.jxbrowser.chromium.ProtocolHandler; -import com.teamdev.jxbrowser.chromium.URLRequest; -import com.teamdev.jxbrowser.chromium.URLResponse; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.StringReader; -import java.net.URI; -import java.nio.charset.StandardCharsets; -import java.util.Map; - -/** - * @author richie - * @version 10.0 - * Created by richie on 2019-03-07 - */ -public class EmbProtocolHandler implements ProtocolHandler { - - private AssembleComponent component; - private Map map; - - public EmbProtocolHandler() { - - } - - public EmbProtocolHandler(AssembleComponent component) { - this.component = component; - } - - public EmbProtocolHandler(AssembleComponent component, Map map) { - this.component = component; - this.map = map; - } - - public EmbProtocolHandler(Map map) { - this.map = map; - } - - @Override - public URLResponse onRequest(URLRequest req) { - InputStream inputStream = null; - try { - String path = req.getURL(); - if (path.startsWith("file:")) { - String url = new URLCodec().decode(path); - String filePath = TemplateUtils.renderParameter4Tpl(url, map); - File file = new File(URI.create(filePath).getPath()); - inputStream = IOUtils.readResource(file.getAbsolutePath()); - String text = IOUtils.inputStream2String(inputStream, EncodeConstants.ENCODING_UTF_8); - text = TemplateUtils.renderParameter4Tpl(text, map); - return Assistant.inputStream2Response(new ByteArrayInputStream(text.getBytes(StandardCharsets.UTF_8)), path); - } else if (path.startsWith("emb:dynamic")) { - URLResponse response = new URLResponse(); - response.setData(htmlText(map).getBytes()); - response.getHeaders().setHeader("Content-Type", "text/html"); - return response; - } else { - int index = path.indexOf("="); - if (index > 0) { - path = path.substring(index + 1); - } else { - path = path.substring(4); - } - inputStream = IOUtils.readResource(path); - return Assistant.inputStream2Response(inputStream, path); - } - } catch (Exception e) { - FineLoggerFactory.getLogger().info(e.getMessage()); - } finally { - if (inputStream != null) { - try { - inputStream.close(); - } catch (IOException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - } - return null; - } - - private String htmlText(Map map) { - PathGroup pathGroup = AtomBuilder.create().buildAssembleFilePath(ModernRequestClient.KEY, component); - StylePath[] stylePaths = pathGroup.toStylePathGroup(); - StringBuilder styleText = new StringBuilder(); - for (StylePath path : stylePaths) { - if (StringUtils.isNotBlank(path.toFilePath())) { - styleText.append(""); - } - } - String result = ModernUIConstants.HTML_TPL.replaceAll("##style##", styleText.toString()); - ScriptPath[] scriptPaths = pathGroup.toScriptPathGroup(); - StringBuilder scriptText = new StringBuilder(); - for (ScriptPath path : scriptPaths) { - if (StringUtils.isNotBlank(path.toFilePath())) { - scriptText.append(""); - } - } - result = result.replaceAll("##script##", scriptText.toString()); - if (map != null) { - for (Map.Entry entry : map.entrySet()) { - String key = entry.getKey(); - String value = entry.getValue(); - result = result.replaceAll("\\$\\{" + key + "}", value); - } - } - return result; - } -} diff --git a/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java b/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java index 4a92d3715..5b53e2ba8 100644 --- a/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java +++ b/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java @@ -7,21 +7,18 @@ import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.i18n.Toolkit; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.web.struct.AssembleComponent; -import com.teamdev.jxbrowser.chromium.Browser; -import com.teamdev.jxbrowser.chromium.BrowserPreferences; -import com.teamdev.jxbrowser.chromium.JSValue; -import com.teamdev.jxbrowser.chromium.events.FinishLoadingEvent; -import com.teamdev.jxbrowser.chromium.events.LoadAdapter; -import com.teamdev.jxbrowser.chromium.events.LoadListener; -import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; -import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; -import com.teamdev.jxbrowser.chromium.events.ScriptContextListener; -import com.teamdev.jxbrowser.chromium.swing.BrowserView; +import com.teamdev.jxbrowser.browser.Browser; +import com.teamdev.jxbrowser.browser.callback.InjectJsCallback; +import com.teamdev.jxbrowser.engine.Engine; +import com.teamdev.jxbrowser.engine.EngineOptions; +import com.teamdev.jxbrowser.engine.RenderingMode; +import com.teamdev.jxbrowser.js.JsObject; +import com.teamdev.jxbrowser.net.Network; +import com.teamdev.jxbrowser.net.callback.InterceptRequestCallback; +import com.teamdev.jxbrowser.view.swing.BrowserView; import javax.swing.*; import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.util.Map; /** @@ -42,9 +39,8 @@ public class ModernUIPane extends BasicPane { } private void initialize() { + setLayout(new BorderLayout()); if (browser == null) { - setLayout(new BorderLayout()); - BrowserPreferences.setChromiumSwitches("--disable-google-traffic"); if (DesignerEnvManager.getEnvManager().isOpenDebug()) { UIToolbar toolbar = new UIToolbar(); add(toolbar, BorderLayout.NORTH); @@ -55,75 +51,67 @@ public class ModernUIPane extends BasicPane { UIButton closeButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Close_Window")); toolbar.add(closeButton); - openDebugButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - showDebuggerDialog(); - } - }); + openDebugButton.addActionListener(e -> showDebuggerDialog()); - reloadButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - browser.reloadIgnoringCache(); - } - }); + reloadButton.addActionListener(e -> browser.navigation().reloadIgnoringCache()); - closeButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - SwingUtilities.getWindowAncestor(ModernUIPane.this).setVisible(false); - } - }); - BrowserPreferences.setChromiumSwitches("--remote-debugging-port=9222"); + closeButton.addActionListener(e -> SwingUtilities.getWindowAncestor(ModernUIPane.this).setVisible(false)); initializeBrowser(); - add(new BrowserView(browser), BorderLayout.CENTER); + add(BrowserView.newInstance(browser), BorderLayout.CENTER); } else { initializeBrowser(); - add(new BrowserView(browser), BorderLayout.CENTER); + add(BrowserView.newInstance(browser), BorderLayout.CENTER); } } } private void showDebuggerDialog() { JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(this)); - Browser debugger = new Browser(); - BrowserView debuggerView = new BrowserView(debugger); + Engine engine = Engine.newInstance( + EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED) + .addSwitch("--disable-google-traffic") + .remoteDebuggingPort(9222).build()); + Browser debugger = engine.newBrowser(); + BrowserView debuggerView = BrowserView.newInstance(debugger); dialog.add(debuggerView, BorderLayout.CENTER); dialog.setSize(new Dimension(800, 400)); GUICoreUtils.centerWindow(dialog); dialog.setVisible(true); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - debugger.loadURL(browser.getRemoteDebuggingURL()); + browser.devTools().remoteDebuggingUrl().ifPresent(url -> { + debugger.navigation().loadUrl(url); + }); } private void initializeBrowser() { - browser = new Browser(); + Engine engine = Engine.newInstance(EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").build()); + browser = engine.newBrowser(); // 初始化的时候,就把命名空间对象初始化好,确保window.a.b.c("a.b.c"为命名空间)对象都是初始化过的 - browser.addScriptContextListener(new ScriptContextAdapter() { - @Override - public void onScriptContextCreated(ScriptContextEvent event) { - event.getBrowser().executeJavaScript(String.format(ModernUIConstants.SCRIPT_INIT_NAME_SPACE, namespace)); - } + browser.set(InjectJsCallback.class, params -> { + params.frame().executeJavaScript(String.format(ModernUIConstants.SCRIPT_INIT_NAME_SPACE, namespace)); + return InjectJsCallback.Response.proceed(); }); } /** * 转向一个新的地址,相当于重新加载 + * * @param url 新的地址 */ public void redirect(String url) { - browser.loadURL(url); + browser.navigation().loadUrl(url); } /** * 转向一个新的地址,相当于重新加载 + * * @param url 新的地址 * @param map 初始化参数 */ public void redirect(String url, Map map) { - Assistant.setEmbProtocolHandler(browser, new EmbProtocolHandler(map)); - browser.loadURL(url); + Network network = browser.engine().network(); + network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network, map)); + browser.navigation().loadUrl(url); } @Override @@ -133,19 +121,18 @@ public class ModernUIPane extends BasicPane { public void populate(final T t) { - browser.addScriptContextListener(new ScriptContextAdapter() { - @Override - public void onScriptContextCreated(ScriptContextEvent event) { - JSValue ns = event.getBrowser().executeJavaScriptAndReturnValue("window." + namespace); - ns.asObject().setProperty(variable, t); + browser.set(InjectJsCallback.class, params -> { + JsObject ns = params.frame().executeJavaScript("window." + namespace); + if (ns != null) { + ns.putProperty(variable, t); } + return InjectJsCallback.Response.proceed(); }); } public T update() { - JSValue jsValue = browser.executeJavaScriptAndReturnValue("window." + namespace + "." + expression); - if (jsValue.isObject()) { - return (T)jsValue.asJavaObject(); + if (browser.mainFrame().isPresent()) { + return browser.mainFrame().get().executeJavaScript("window." + namespace + "." + expression); } return null; } @@ -154,79 +141,89 @@ public class ModernUIPane extends BasicPane { private ModernUIPane pane = new ModernUIPane<>(); - public Builder prepare(ScriptContextListener contextListener) { - pane.browser.addScriptContextListener(contextListener); - return this; - } - - public Builder prepare(LoadListener loadListener) { - pane.browser.addLoadListener(loadListener); + public Builder prepare(InjectJsCallback callback) { + pane.browser.set(InjectJsCallback.class, callback); return this; } /** * 加载jar包中的资源 + * * @param path 资源路径 */ public Builder withEMB(final String path) { - Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler()); - pane.browser.loadURL("emb:" + path); + Network network = pane.browser.engine().network(); + network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network)); + pane.browser.navigation().loadUrl("emb:" + path); return this; } /** * 加载url指向的资源 + * * @param url 文件的地址 */ public Builder withURL(final String url) { - Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler()); - pane.browser.loadURL(url); + Network network = pane.browser.engine().network(); + network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network)); + pane.browser.navigation().loadUrl(url); return this; } /** * 加载url指向的资源 + * * @param url 文件的地址 */ public Builder withURL(final String url, Map map) { - Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler(map)); - pane.browser.loadURL(url); + Network network = pane.browser.engine().network(); + network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network, map)); + pane.browser.navigation().loadUrl(url); return this; } /** * 加载Atom组件 + * * @param component Atom组件 */ public Builder withComponent(AssembleComponent component) { - Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler(component)); - pane.browser.loadURL("emb:dynamic"); + Network network = pane.browser.engine().network(); + network.set(InterceptRequestCallback.class, new NxComplexInterceptRequestCallback(network, component)); + pane.browser.navigation().loadUrl("emb:dynamic"); return this; } /** * 加载Atom组件 + * * @param component Atom组件 */ public Builder withComponent(AssembleComponent component, Map map) { - Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler(component, map)); - pane.browser.loadURL("emb:dynamic"); + Network network = pane.browser.engine().network(); + network.set(InterceptRequestCallback.class, new NxComplexInterceptRequestCallback(network, component, map)); + pane.browser.navigation().loadUrl("emb:dynamic"); return this; } /** * 加载html文本内容 + * * @param html 要加载html文本内容 */ public Builder withHTML(String html) { - Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler()); - pane.browser.loadHTML(html); + Network network = pane.browser.engine().network(); + network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network)); + pane.browser.mainFrame().ifPresent(frame -> { + frame.loadHtml(html); + }); return this; } /** * 设置该前端页面做数据交换所使用的对象 + * * @param namespace 对象名 */ public Builder namespace(String namespace) { @@ -236,6 +233,7 @@ public class ModernUIPane extends BasicPane { /** * java端往js端传数据时使用的变量名字 + * * @param name 变量的名字 */ public Builder variable(String name) { @@ -245,6 +243,7 @@ public class ModernUIPane extends BasicPane { /** * js端往java端传数据时执行的函数表达式 + * * @param expression 函数表达式 */ public Builder expression(String expression) { diff --git a/designer-base/src/main/java/com/fr/design/ui/NxComplexInterceptRequestCallback.java b/designer-base/src/main/java/com/fr/design/ui/NxComplexInterceptRequestCallback.java new file mode 100644 index 000000000..9e9705695 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/ui/NxComplexInterceptRequestCallback.java @@ -0,0 +1,85 @@ +package com.fr.design.ui; + +import com.fr.general.IOUtils; +import com.fr.stable.StringUtils; +import com.fr.web.struct.AssembleComponent; +import com.fr.web.struct.AtomBuilder; +import com.fr.web.struct.PathGroup; +import com.fr.web.struct.category.ScriptPath; +import com.fr.web.struct.category.StylePath; +import com.teamdev.jxbrowser.net.Network; +import com.teamdev.jxbrowser.net.UrlRequest; +import com.teamdev.jxbrowser.net.callback.InterceptRequestCallback; + +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.Map; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2020/3/25 + */ +public class NxComplexInterceptRequestCallback extends NxInterceptRequestCallback { + + private AssembleComponent component; + + public NxComplexInterceptRequestCallback(Network network, AssembleComponent component) { + super(network); + this.component = component; + } + + public NxComplexInterceptRequestCallback(Network network, AssembleComponent component, Map map) { + super(network, map); + this.component = component; + } + + @Override + protected Response next(UrlRequest urlRequest, String path) { + if (path.startsWith("emb:dynamic")) { + String text = htmlText(map); + return InterceptRequestCallback.Response.intercept(generateBasicUrlRequestJob(urlRequest, "text/html", text.getBytes(StandardCharsets.UTF_8))); + } else { + int index = path.indexOf("="); + if (index > 0) { + path = path.substring(index + 1); + } else { + path = path.substring(4); + } + InputStream inputStream = IOUtils.readResource(path); + return InterceptRequestCallback.Response.intercept(generateBasicUrlRequestJob(urlRequest, getMimeType(path), IOUtils.inputStream2Bytes(inputStream))); + } + } + + private String htmlText(Map map) { + PathGroup pathGroup = AtomBuilder.create().buildAssembleFilePath(ModernRequestClient.KEY, component); + StylePath[] stylePaths = pathGroup.toStylePathGroup(); + StringBuilder styleText = new StringBuilder(); + for (StylePath path : stylePaths) { + if (StringUtils.isNotBlank(path.toFilePath())) { + styleText.append(""); + } + } + String result = ModernUIConstants.HTML_TPL.replaceAll("##style##", styleText.toString()); + ScriptPath[] scriptPaths = pathGroup.toScriptPathGroup(); + StringBuilder scriptText = new StringBuilder(); + for (ScriptPath path : scriptPaths) { + if (StringUtils.isNotBlank(path.toFilePath())) { + scriptText.append(""); + } + } + result = result.replaceAll("##script##", scriptText.toString()); + if (map != null) { + for (Map.Entry entry : map.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + result = result.replaceAll("\\$\\{" + key + "}", value); + } + } + return result; + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/ui/NxInterceptRequestCallback.java b/designer-base/src/main/java/com/fr/design/ui/NxInterceptRequestCallback.java new file mode 100644 index 000000000..ea921efe0 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/ui/NxInterceptRequestCallback.java @@ -0,0 +1,134 @@ +package com.fr.design.ui; + +import com.fr.base.TemplateUtils; +import com.fr.general.IOUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.ArrayUtils; +import com.fr.stable.EncodeConstants; +import com.fr.stable.StringUtils; +import com.fr.third.org.apache.commons.codec.net.URLCodec; +import com.teamdev.jxbrowser.net.HttpHeader; +import com.teamdev.jxbrowser.net.HttpStatus; +import com.teamdev.jxbrowser.net.Network; +import com.teamdev.jxbrowser.net.UrlRequest; +import com.teamdev.jxbrowser.net.UrlRequestJob; +import com.teamdev.jxbrowser.net.callback.InterceptRequestCallback; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Map; +import java.util.Optional; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2020/3/25 + */ +public class NxInterceptRequestCallback implements InterceptRequestCallback { + + Network network; + Map map; + + public NxInterceptRequestCallback(Network network) { + this.network = network; + } + + public NxInterceptRequestCallback(Network network, Map map) { + this.network = network; + this.map = map; + } + + @Override + public Response on(Params params) { + UrlRequest urlRequest = params.urlRequest(); + String path = urlRequest.url(); + if (path.startsWith("file:")) { + Optional optional = generateFileProtocolUrlRequestJob(urlRequest, path); + if (optional.isPresent()) { + return InterceptRequestCallback.Response.intercept(optional.get()); + } + } else { + return next(urlRequest, path); + } + return Response.proceed(); + } + + Response next(UrlRequest urlRequest, String path) { + return Response.proceed(); + } + + private Optional generateFileProtocolUrlRequestJob(UrlRequest urlRequest, String path) { + try { + String url = new URLCodec().decode(path); + String filePath = TemplateUtils.renderParameter4Tpl(url, map); + File file = new File(URI.create(filePath).getPath()); + InputStream inputStream = IOUtils.readResource(file.getAbsolutePath()); + String mimeType = getMimeType(path); + byte[] bytes; + if (isPlainText(mimeType)) { + String text = IOUtils.inputStream2String(inputStream, EncodeConstants.ENCODING_UTF_8); + text = TemplateUtils.renderParameter4Tpl(text, map); + bytes = text.getBytes(StandardCharsets.UTF_8); + } else { + bytes = IOUtils.inputStream2Bytes(inputStream); + } + return Optional.of(generateBasicUrlRequestJob(urlRequest, mimeType, bytes)); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return Optional.empty(); + } + + private boolean isPlainText(String mimeType) { + return ArrayUtils.contains(new String[]{"text/html", "text/javascript", "text/css"}, mimeType); + } + + UrlRequestJob generateBasicUrlRequestJob(UrlRequest urlRequest, String mimeType, byte[] bytes) { + UrlRequestJob.Options options = UrlRequestJob.Options + .newBuilder(urlRequest.id(), HttpStatus.OK) + .addHttpHeader(HttpHeader.of("Content-Type", mimeType)) + .build(); + UrlRequestJob urlRequestJob = network.newUrlRequestJob(options); + urlRequestJob.write(bytes); + urlRequestJob.complete(); + return urlRequestJob; + } + + String getMimeType(String path) { + if (StringUtils.isBlank(path)) { + return "text/html"; + } + if (path.endsWith(".html")) { + return "text/html"; + } + if (path.endsWith(".css")) { + return "text/css"; + } + if (path.endsWith(".js")) { + return "text/javascript"; + } + if (path.endsWith(".svg")) { + return "image/svg+xml"; + } + if (path.endsWith(".png")) { + return "image/png"; + } + if (path.endsWith(".jpeg")) { + return "image/jpeg"; + } + if (path.endsWith(".gif")) { + return "image/gif"; + } + Path file = new File(path).toPath(); + try { + return Files.probeContentType(file); + } catch (IOException e) { + return "text/html"; + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java index e7d134808..65b1c6b3b 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java @@ -6,6 +6,7 @@ import com.fr.config.ServerPreferenceConfig; import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader; import com.fr.design.bridge.exec.JSBridge; import com.fr.design.bridge.exec.JSCallback; +import com.fr.design.bridge.exec.JSExecutor; import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginUtils; import com.fr.design.extra.exe.GetInstalledPluginsExecutor; @@ -28,10 +29,8 @@ import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginMarker; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import com.teamdev.jxbrowser.chromium.Browser; -import com.teamdev.jxbrowser.chromium.JSArray; -import com.teamdev.jxbrowser.chromium.JSFunction; -import com.teamdev.jxbrowser.chromium.JSObject; +import com.teamdev.jxbrowser.js.JsAccessible; +import com.teamdev.jxbrowser.js.JsObject; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; @@ -52,42 +51,45 @@ import java.util.concurrent.RunnableFuture; */ public class UpmBridge { - public static UpmBridge getBridge(Browser browser) { - return new UpmBridge(browser); + public static UpmBridge getBridge() { + return new UpmBridge(); } - private JSObject window; - private UpmBridge(Browser browser) { - this.window = browser.executeJavaScriptAndReturnValue("window").asObject(); + private UpmBridge() { + } /** * 更新插件管理中心资源文件,这个方法仅仅是为了语义上的作用(更新) + * * @param callback 安装完成后的回调函数 */ @JSBridge - public void update(final JSFunction callback) { - callback.invoke(window, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start")); + @JsAccessible + public void update(final JsObject callback) { + callback.call(JSExecutor.CALLBACK_FUNCTION_NAME, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start")); try { UpmResourceLoader.INSTANCE.download(); UpmResourceLoader.INSTANCE.install(); - callback.invoke(window, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success")); + callback.call(JSExecutor.CALLBACK_FUNCTION_NAME, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success")); EventDispatcher.fire(DownloadEvent.UPDATE, "success"); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - callback.invoke(window, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error")); + callback.call(JSExecutor.CALLBACK_FUNCTION_NAME, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error")); } } /** * 下载并安装插件管理中心的资源文件 + * * @param callback 安装完成后的回调函数 */ @JSBridge - public void startDownload(final JSFunction callback) { - callback.invoke(window, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start")); - new SwingWorker(){ + @JsAccessible + public void startDownload(final JsObject callback) { + callback.call(JSExecutor.CALLBACK_FUNCTION_NAME, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start")); + new SwingWorker() { @Override protected Void doInBackground() throws Exception { UpmResourceLoader.INSTANCE.download(); @@ -99,10 +101,10 @@ public class UpmBridge { protected void done() { try { get(); - callback.invoke(window, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success")); + callback.call(JSExecutor.CALLBACK_FUNCTION_NAME, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success")); EventDispatcher.fire(DownloadEvent.SUCCESS, "success"); } catch (Exception e) { - callback.invoke(window, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error")); + callback.call(JSExecutor.CALLBACK_FUNCTION_NAME, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error")); FineLoggerFactory.getLogger().error(e.getMessage(), e); EventDispatcher.fire(DownloadEvent.ERROR, "error"); } @@ -112,37 +114,44 @@ public class UpmBridge { /** * 获取upm的版本信息 + * * @return 版本信息 */ @JSBridge + @JsAccessible public String getVersion() { return ServerPreferenceConfig.getInstance().getOptimizedUPMVersion(); } @JSBridge + @JsAccessible public String i18nText(String key) { return Toolkit.i18nText(key); } @JSBridge + @JsAccessible public void closeWindow() { UpmFinder.closeWindow(); } @JSBridge + @JsAccessible public boolean isDesigner() { return true; } @JSBridge - public void getPackInfo(final JSFunction callback) { - callback.invoke(window, StringUtils.EMPTY); + @JsAccessible + public void getPackInfo(final JsObject callback) { + callback.call(JSExecutor.CALLBACK_FUNCTION_NAME, StringUtils.EMPTY); } @JSBridge - public void getPluginPrefix(final JSFunction callback) { - UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new GetPluginPrefixExecutor()); + @JsAccessible + public void getPluginPrefix(final JsObject callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(callback)), new GetPluginPrefixExecutor()); task.execute(); } @@ -152,8 +161,9 @@ public class UpmBridge { * @param callback 回调函数 */ @JSBridge - public void getPluginCategories(final JSFunction callback) { - UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new GetPluginCategoriesExecutor()); + @JsAccessible + public void getPluginCategories(final JsObject callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(callback)), new GetPluginCategoriesExecutor()); task.execute(); } @@ -164,8 +174,9 @@ public class UpmBridge { * @param callback 回调函数 */ @JSBridge - public void getPluginFromStoreNew(String info, final JSFunction callback) { - UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new GetPluginFromStoreExecutor(new JSONObject(info))); + @JsAccessible + public void getPluginFromStoreNew(String info, final JsObject callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(callback)), new GetPluginFromStoreExecutor(new JSONObject(info))); task.execute(); } @@ -173,8 +184,9 @@ public class UpmBridge { * 已安装插件检查更新 */ @JSBridge - public void readUpdateOnline(final JSFunction callback) { - UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new ReadUpdateOnlineExecutor()); + @JsAccessible + public void readUpdateOnline(final JsObject callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(callback)), new ReadUpdateOnlineExecutor()); task.execute(); } @@ -182,8 +194,9 @@ public class UpmBridge { * 获取已经安装的插件的数组 */ @JSBridge - public void getInstalledPlugins(final JSFunction callback) { - UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new GetInstalledPluginsExecutor()); + @JsAccessible + public void getInstalledPlugins(final JsObject callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(callback)), new GetInstalledPluginsExecutor()); task.execute(); } @@ -193,29 +206,36 @@ public class UpmBridge { * @param pluginIDs 插件集合 */ @JSBridge - public void updatePluginOnline(Object pluginIDs, final JSFunction callback) { - JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); + @JsAccessible + public void updatePluginOnline(JsObject pluginIDs, final JsObject callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(callback)); List pluginMarkerList = new ArrayList<>(); - if (pluginIDs instanceof String) { - pluginMarkerList.add(PluginUtils.createPluginMarker(pluginIDs.toString())); - } else if (pluginIDs instanceof JSArray) { - JSArray pluginInfos = (JSArray) pluginIDs; - for (int i = 0, len = pluginInfos.length(); i < len; i++) { - String value = pluginInfos.get(i).asString().getValue(); - pluginMarkerList.add(PluginUtils.createPluginMarker(value)); - } + for (String key : pluginIDs.propertyNames()) { + pluginIDs.property(key).ifPresent(v -> { + pluginMarkerList.add(PluginUtils.createPluginMarker(GeneralUtils.objectToString(v))); + }); } PluginOperateUtils.updatePluginOnline(pluginMarkerList, jsCallback); } + @JSBridge + @JsAccessible + public void updatePluginOnline(String pluginID, final JsObject callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(callback)); + List pluginMarkerList = new ArrayList<>(); + pluginMarkerList.add(PluginUtils.createPluginMarker(pluginID)); + PluginOperateUtils.updatePluginOnline(pluginMarkerList, jsCallback); + } + /** * 搜索在线插件 * * @param keyword 关键字 */ @JSBridge - public void searchPlugin(String keyword, final JSFunction callback) { - UpmTaskWorker worker = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new SearchOnlineExecutor(keyword)); + @JsAccessible + public void searchPlugin(String keyword, final JsObject callback) { + UpmTaskWorker worker = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(callback)), new SearchOnlineExecutor(keyword)); worker.execute(); } @@ -225,8 +245,9 @@ public class UpmBridge { * @param filePath 插件包的路径 */ @JSBridge - public void installPluginFromDisk(final String filePath, final JSFunction callback) { - JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); + @JsAccessible + public void installPluginFromDisk(final String filePath, final JsObject callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(callback)); File file = new File(filePath); PluginOperateUtils.installPluginFromDisk(file, jsCallback); } @@ -237,8 +258,9 @@ public class UpmBridge { * @param pluginInfo 插件信息 */ @JSBridge - public void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSFunction callback) { - JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); + @JsAccessible + public void uninstallPlugin(final String pluginInfo, final boolean isForce, final JsObject callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(callback)); PluginOperateUtils.uninstallPlugin(pluginInfo, isForce, jsCallback); } @@ -249,8 +271,9 @@ public class UpmBridge { * @param callback 回调函数 */ @JSBridge - public void installPluginOnline(final String pluginInfo, final JSFunction callback) { - JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); + @JsAccessible + public void installPluginOnline(final String pluginInfo, final JsObject callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(callback)); PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); PluginOperateUtils.installPluginOnline(pluginMarker, jsCallback); } @@ -260,8 +283,10 @@ public class UpmBridge { * * @param filePath 插件包的路径 */ - public void updatePluginFromDisk(String filePath, final JSFunction callback) { - JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); + @JSBridge + @JsAccessible + public void updatePluginFromDisk(String filePath, final JsObject callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(callback)); File file = new File(filePath); PluginOperateUtils.updatePluginFromDisk(file, jsCallback); } @@ -272,8 +297,9 @@ public class UpmBridge { * @param pluginID 插件ID */ @JSBridge - public void setPluginActive(String pluginID, final JSFunction callback) { - JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); + @JsAccessible + public void setPluginActive(String pluginID, final JsObject callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(callback)); PluginOperateUtils.setPluginActive(pluginID, jsCallback); } @@ -283,6 +309,7 @@ public class UpmBridge { * @return 选择的文件的路径 */ @JSBridge + @JsAccessible public String showFileChooser() { return showFileChooserWithFilter(StringUtils.EMPTY, StringUtils.EMPTY); } @@ -296,6 +323,7 @@ public class UpmBridge { * 这里换用JFileChooser会卡死,不知道为什么 */ @JSBridge + @JsAccessible public String showFileChooserWithFilter(final String des, final String filter) { RunnableFuture future = new FutureTask<>(new Callable() { @Override @@ -318,7 +346,7 @@ public class UpmBridge { try { return future.get(); } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return null; } @@ -331,31 +359,60 @@ public class UpmBridge { * @return 选择的文件的路径 */ @JSBridge - public String showFileChooserWithFilters(final String des, final Object args) { - RunnableFuture future = new FutureTask<>(new Callable() { - @Override - public String call() { - JFileChooser fileChooser = new JFileChooser(); - List filterList = new ArrayList<>(); - if (args instanceof String) { - filterList.add(GeneralUtils.objectToString(args)); - } else if (args instanceof JSArray) { - JSArray array = (JSArray)args; - for (int i = 0, len = array.length(); i < len; i ++) { - filterList.add(array.get(i).getStringValue()); - } - } - String[] filters = filterList.toArray(new String[0]); - if (ArrayUtils.isNotEmpty(filters)) { - FileNameExtensionFilter filter = new FileNameExtensionFilter(des, UpmUtils.findMatchedExtension(filters)); - fileChooser.setFileFilter(filter); - } - int result = fileChooser.showOpenDialog(UpmFinder.getDialog()); - if (result == JFileChooser.APPROVE_OPTION) { - return fileChooser.getSelectedFile().getAbsolutePath(); - } - return null; + @JsAccessible + public String showFileChooserWithFilters(final String des, final String args) { + RunnableFuture future = new FutureTask<>(() -> { + JFileChooser fileChooser = new JFileChooser(); + List filterList = new ArrayList<>(); + filterList.add(args); + String[] filters = filterList.toArray(new String[0]); + if (ArrayUtils.isNotEmpty(filters)) { + FileNameExtensionFilter filter = new FileNameExtensionFilter(des, UpmUtils.findMatchedExtension(filters)); + fileChooser.setFileFilter(filter); } + int result = fileChooser.showOpenDialog(UpmFinder.getDialog()); + if (result == JFileChooser.APPROVE_OPTION) { + return fileChooser.getSelectedFile().getAbsolutePath(); + } + return null; + }); + SwingUtilities.invokeLater(future); + try { + return future.get(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return null; + } + + /** + * 选择文件对话框 + * + * @param des 过滤文件描述 + * @param args 文件的后缀 + * @return 选择的文件的路径 + */ + @JSBridge + @JsAccessible + public String showFileChooserWithFilters(final String des, final JsObject args) { + RunnableFuture future = new FutureTask<>(() -> { + JFileChooser fileChooser = new JFileChooser(); + List filterList = new ArrayList<>(); + for (String key : args.propertyNames()) { + args.property(key).ifPresent(v -> { + filterList.add(GeneralUtils.objectToString(v)); + }); + } + String[] filters = filterList.toArray(new String[0]); + if (ArrayUtils.isNotEmpty(filters)) { + FileNameExtensionFilter filter = new FileNameExtensionFilter(des, UpmUtils.findMatchedExtension(filters)); + fileChooser.setFileFilter(filter); + } + int result = fileChooser.showOpenDialog(UpmFinder.getDialog()); + if (result == JFileChooser.APPROVE_OPTION) { + return fileChooser.getSelectedFile().getAbsolutePath(); + } + return null; }); SwingUtilities.invokeLater(future); try { @@ -372,7 +429,8 @@ public class UpmBridge { * 获取系统登录的用户名 */ @JSBridge - public String getLoginInfo(final JSFunction callback) { + @JsAccessible + public String getLoginInfo(final JsObject callback) { registerLoginInfo(callback); return MarketConfig.getInstance().getBbsUsername(); } @@ -383,8 +441,9 @@ public class UpmBridge { * @param callback 回调函数 */ @JSBridge - public void registerLoginInfo(final JSFunction callback) { - JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); + @JsAccessible + public void registerLoginInfo(final JsObject callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(callback)); String username = MarketConfig.getInstance().getBbsUsername(); if (StringUtils.isEmpty(username)) { jsCallback.execute(StringUtils.EMPTY); @@ -404,14 +463,16 @@ public class UpmBridge { * @param callback 回调函数 */ @JSBridge - public void defaultLogin(String username, String password, final JSFunction callback) { - UpmTaskWorker worker = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new PluginLoginExecutor(username, password)); + @JsAccessible + public void defaultLogin(String username, String password, final JsObject callback) { + UpmTaskWorker worker = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(callback)), new PluginLoginExecutor(username, password)); worker.execute(); } /** * 清除用户信息 */ + @JsAccessible public void clearUserInfo() { MarketConfig.getInstance().setInShowBBsName(StringUtils.EMPTY); FinePassportManager.getInstance().logout(); @@ -422,6 +483,7 @@ public class UpmBridge { * 打开论坛消息界面 */ @JSBridge + @JsAccessible public void getPriviteMessage() { try { String loginUrl = CloudCenter.getInstance().acquireUrlByKind("bbs.default"); @@ -435,6 +497,7 @@ public class UpmBridge { * 忘记密码 */ @JSBridge + @JsAccessible public void forgetHref() { try { Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.reset"))); @@ -447,6 +510,7 @@ public class UpmBridge { * 立即注册 */ @JSBridge + @JsAccessible public void registerHref() { try { Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.register"))); @@ -457,9 +521,11 @@ public class UpmBridge { /** * 使用系统浏览器打开网页 + * * @param url 要打开的网页 */ @JSBridge + @JsAccessible public void openShopUrlAtWebBrowser(String url) { if (Desktop.isDesktopSupported()) { try { diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java index 4febad3a9..689c89942 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java @@ -58,7 +58,7 @@ public class UpmFinder { public static void showUPMDialog() { boolean flag = true; try { - Class.forName("com.teamdev.jxbrowser.chromium.Browser"); + Class.forName("com.teamdev.jxbrowser.browser.Browser"); } catch (ClassNotFoundException e) { flag = false; } diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java b/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java index 1bc4b9e94..f4019cf06 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java @@ -6,9 +6,8 @@ import com.fr.design.upm.event.DownloadEvent; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; -import com.teamdev.jxbrowser.chromium.JSValue; -import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; -import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; +import com.teamdev.jxbrowser.browser.callback.InjectJsCallback; +import com.teamdev.jxbrowser.js.JsObject; import java.awt.*; @@ -32,12 +31,10 @@ public class UpmShowPane extends BasicPane { // 先屏蔽掉这个判断,后续可能修改交互 // if (UpmFinder.checkUPMResourcesExist()) { modernUIPane = new ModernUIPane.Builder<>() - .prepare(new ScriptContextAdapter() { - @Override - public void onScriptContextCreated(ScriptContextEvent event) { - JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); - window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser())); - } + .prepare(params -> { + JsObject window = params.frame().executeJavaScript("window"); + window.putProperty("PluginHelper", UpmBridge.getBridge()); + return InjectJsCallback.Response.proceed(); }) .withURL(UpmFinder.getMainResourcePath(), UpmUtils.renderMap()) .build(); diff --git a/designer-base/src/main/java/com/fr/design/upm/exec/UpmBrowserExecutor.java b/designer-base/src/main/java/com/fr/design/upm/exec/UpmBrowserExecutor.java index 572f7b5f2..f2f10ffdf 100644 --- a/designer-base/src/main/java/com/fr/design/upm/exec/UpmBrowserExecutor.java +++ b/designer-base/src/main/java/com/fr/design/upm/exec/UpmBrowserExecutor.java @@ -1,8 +1,7 @@ package com.fr.design.upm.exec; import com.fr.design.bridge.exec.JSExecutor; -import com.teamdev.jxbrowser.chromium.JSFunction; -import com.teamdev.jxbrowser.chromium.JSObject; +import com.teamdev.jxbrowser.js.JsObject; /** * @author richie @@ -11,20 +10,18 @@ import com.teamdev.jxbrowser.chromium.JSObject; */ public class UpmBrowserExecutor implements JSExecutor { - public static UpmBrowserExecutor create(JSObject window, JSFunction callback) { - return new UpmBrowserExecutor(window, callback); + public static UpmBrowserExecutor create(JsObject callback) { + return new UpmBrowserExecutor(callback); } - private JSObject window; - private JSFunction callback; + private JsObject callback; - private UpmBrowserExecutor(JSObject window, JSFunction callback) { - this.window = window; + private UpmBrowserExecutor(JsObject callback) { this.callback = callback; } @Override public void executor(String newValue) { - callback.invoke(window, newValue); + callback.call(JSExecutor.CALLBACK_FUNCTION_NAME, newValue); } } diff --git a/pom.xml b/pom.xml index 407f1fd17..711751c9f 100644 --- a/pom.xml +++ b/pom.xml @@ -28,8 +28,8 @@ maven-compiler-plugin 3.1 - 1.7 - 1.7 + 1.8 + 1.8 From c24078b110d2eec4077b2956150e4e84be8efa85 Mon Sep 17 00:00:00 2001 From: Harrison Date: Thu, 26 Mar 2020 15:33:40 +0800 Subject: [PATCH 15/76] =?UTF-8?q?REPORT-27647=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=89=E8=A3=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?-=E6=A8=A1=E6=9D=BF=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=20=E5=9B=BE=E7=89=87=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=85=88=E5=8A=A0=E8=BD=BD=E8=BF=9B=E5=8E=BB=E3=80=82=20set=20?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E5=B0=B1=E6=99=9A=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/EastRegionContainerPane.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 9276bd5c6..cf8f4f74d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -203,12 +203,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { PropertyItem propertyItem = new PropertyItem(itemBean.getName(), itemBean.getTitle(), itemBean.getBtnIconName(), + itemBean.getBtnIconBaseDir(), itemBean.getVisibleModes(), itemBean.getEnableModes()); - String btnIconBaseDir = itemBean.getBtnIconBaseDir(); - if (StringUtils.isNotEmpty(btnIconBaseDir)) { - propertyItem.setIconBaseDir(btnIconBaseDir); - } UIButton button = propertyItem.getButton(); List buttonListeners = itemBean.getButtonListeners(); for (ActionListener buttonListener : buttonListeners) { From bfe2d205322f0fd4fb8b5a684cacd710120c3775 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 1 Apr 2020 16:03:54 +0800 Subject: [PATCH 16/76] =?UTF-8?q?REPORT-28701=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8-=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E6=9B=BF=E6=8D=A2=E4=B8=BA=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E5=8E=9F=E7=94=9F=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/ifilechooser/AbstractFileChooser.java | 94 +++++++++++ .../gui/ifilechooser/UINativeFileChooser.java | 148 ++++++++++++++++++ 2 files changed, 242 insertions(+) create mode 100644 designer-base/src/main/java/com/fr/design/gui/ifilechooser/AbstractFileChooser.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/AbstractFileChooser.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/AbstractFileChooser.java new file mode 100644 index 000000000..ca460aa0f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/AbstractFileChooser.java @@ -0,0 +1,94 @@ +package com.fr.design.gui.ifilechooser; + +import javax.swing.filechooser.FileFilter; +import java.awt.*; +import java.io.File; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/3/31 + */ +public abstract class AbstractFileChooser { + + /** + * 返回当前目录 + * + */ + public abstract File getCurrentDirectory(); + + /** + * 返回当前的文件选择过滤器 + * + */ + public abstract FileFilter getFileFilter(); + + /** + * 返回选择的文件 + * + */ + public abstract File getSelectedFile(); + + /** + * 多文件选择模式下 返回选择的多个文件 + * + */ + public abstract File[] getSelectedFiles(); + + /** + * 是否可以选择多个文件 + * + */ + public abstract boolean isMultiSelectionEnabled(); + + /** + * 设置当前选择的目录 + * + */ + public abstract void setCurrentDirectory(File dir); + + /** + * 设置左上角标题 + * + */ + public abstract void setDialogTitle(String title); + + /** + * 设置当前的文件过滤器 + * + */ + public abstract void setFileFilter(final FileFilter filter); + + /** + * 设置文件选择器模式 + * + * JFileChooser.FILES_ONLY + * JFileChooser.DIRECTORIES_ONLY + * JFileChooser.FILES_AND_DIRECTORIES + */ + public abstract void setFileSelectionMode(int selectionMode); + + /** + * 设置是否允许选择多个文件 + * + */ + public abstract void setMultiSelectionEnabled(boolean multiple); + + /** + * 设置选择的文件 用于showSaveDialog + * + */ + public abstract void setSelectedFile(File file); + + /** + * 弹出文件选择器 打开文件 + * + */ + public abstract int showOpenDialog(Component parent); + + /** + * 弹出文件选择器 保存文件 + * + */ + public abstract int showSaveDialog(Component parent); +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java new file mode 100644 index 000000000..9c956372d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java @@ -0,0 +1,148 @@ +package com.fr.design.gui.ifilechooser; + +import com.fr.design.mainframe.DesignerContext; +import com.fr.stable.os.OperatingSystem; + +import javax.swing.*; +import javax.swing.filechooser.FileFilter; +import java.awt.*; +import java.io.File; +import java.io.FilenameFilter; + + +/** + * 系统原生风格的文件选择器 + * + * jdk问题: + * https://bugs.openjdk.java.net/browse/JDK-4811090 不支持文件扩展选择 + * https://stackoverflow.com/questions/40713398/filter-not-working-in-filedialog windows下 setFilenameFilter不work + * + * @author hades + * @version 10.0 + * Created by hades on 2020/3/31 + */ +public class UINativeFileChooser extends AbstractFileChooser { + + private final FileDialog fileDialog; + private FileFilter fileFilter; + private int selectionMode; + + public UINativeFileChooser(File file) { + fileDialog = new FileDialog(DesignerContext.getDesignerFrame()); + if (file != null) { + fileDialog.setDirectory(file.getAbsolutePath()); + fileDialog.setFile(file.toString()); + } + } + + public UINativeFileChooser() { + this(null); + } + + @Override + public File getCurrentDirectory() { + return new File(fileDialog.getDirectory()); + } + + @Override + public FileFilter getFileFilter() { + return fileFilter; + } + + @Override + public File getSelectedFile() { + return new File(fileDialog.getDirectory() + fileDialog.getFile()); + } + + @Override + public File[] getSelectedFiles() { + return fileDialog.getFiles(); + } + + @Override + public boolean isMultiSelectionEnabled() { + return fileDialog.isMultipleMode(); + } + + @Override + public void setCurrentDirectory(File f) { + fileDialog.setDirectory(f.toString()); + } + + @Override + public void setDialogTitle(String title) { + fileDialog.setTitle(title); + } + + @Override + public void setFileFilter(final FileFilter cff) { + FilenameFilter filter = new FilenameFilter() { + @Override + public boolean accept(File Directory, String fileName) { + return cff.accept(new File(Directory.getAbsolutePath() + fileName)); + } + }; + fileDialog.setFilenameFilter(filter); + fileFilter = cff; + } + + @Override + public void setFileSelectionMode(int selectionMode) { + this.selectionMode = selectionMode; + } + + @Override + public void setMultiSelectionEnabled(boolean multiple) { + fileDialog.setMultipleMode(multiple); + } + + @Override + public void setSelectedFile(File file) { + fileDialog.setDirectory(file.getAbsolutePath()); + fileDialog.setFile(file.getName()); + } + + @Override + public int showOpenDialog(Component parent) { + boolean appleProperty = OperatingSystem.isMacos() && selectionMode == JFileChooser.DIRECTORIES_ONLY; + if (appleProperty) { + System.setProperty("apple.awt.fileDialogForDirectories", "true"); + } + try { + fileDialog.setLocale(JComponent.getDefaultLocale()); + fileDialog.setMode(FileDialog.LOAD); + fileDialog.setVisible(true); + return fileDialog.getFile() == null ? JFileChooser.CANCEL_OPTION : JFileChooser.APPROVE_OPTION; + } finally { + if (appleProperty) { + System.setProperty("apple.awt.fileDialogForDirectories", "false"); + } + } + } + + @Override + public int showSaveDialog(Component parent) { + fileDialog.setLocale(JComponent.getDefaultLocale()); + fileDialog.setMode(FileDialog.SAVE); + fileDialog.setVisible(true); + return fileDialog.getFile() == null ? JFileChooser.CANCEL_OPTION : JFileChooser.APPROVE_OPTION; + } + + /** + * 确认本地文件选择器是否支持选择模式 + * @param selectionMode 选择模式 + * @return 是否支持选择模式 + */ + public static boolean supportsSelectionMode(int selectionMode) { + switch (selectionMode) { + case JFileChooser.FILES_AND_DIRECTORIES: + return false; + case JFileChooser.DIRECTORIES_ONLY: + return OperatingSystem.isMacos(); + case JFileChooser.FILES_ONLY: + default: + return true; + } + } + +} From e0f894f244b99e6d19ba172e237bfc85aa27d7a1 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 3 Apr 2020 09:51:34 +0800 Subject: [PATCH 17/76] =?UTF-8?q?REPORT-29149=20=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6-=E5=A4=8D=E9=80=89=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=8F=AF=E4=B8=8D=E6=98=BE=E7=A4=BA=E2=80=9C?= =?UTF-8?q?=E5=85=A8=E9=80=89=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/icombocheckbox/UICheckListPopup.java | 16 ++++++++++++---- .../gui/icombocheckbox/UIComboCheckBox.java | 17 ++++++++++++++--- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java index b0b57f29c..9592eb517 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java @@ -36,14 +36,20 @@ public class UICheckListPopup extends UIPopupMenu { private UIScrollPane jScrollPane; private Color mouseEnteredColor = UIConstants.CHECKBOX_HOVER_SELECTED; private int maxDisplayNumber = 8; + private boolean supportSelectAll = true; public static final String COMMIT_EVENT = "commit"; - public static final String SELECT_ALL = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Choose_All"); + private static final String SELECT_ALL = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Choose_All"); private static final int CHECKBOX_HEIGHT = 25; - public UICheckListPopup(Object[] value) { + public UICheckListPopup(Object[] values) { + this(values, true); + } + + public UICheckListPopup(Object[] value, boolean supportSelectAll) { super(); values = value; + this.supportSelectAll = supportSelectAll; initComponent(); } @@ -73,7 +79,9 @@ public class UICheckListPopup extends UIPopupMenu { checkBoxList.clear(); //全选加在第一个位置 - addOneCheckValue(SELECT_ALL); + if (supportSelectAll) { + addOneCheckValue(SELECT_ALL); + } for (Object checkValue : value) { addOneCheckValue(checkValue); } @@ -146,7 +154,7 @@ public class UICheckListPopup extends UIPopupMenu { private void addSelectListener() { for (int i = 0; i < checkBoxList.size(); i++) { JCheckBox checkBox = checkBoxList.get(i); - if (i == 0) { + if (supportSelectAll && i == 0) { checkBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { diff --git a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java index e2a5719d4..6eba4a6da 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java @@ -59,8 +59,18 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam private String multiComboName = StringUtils.EMPTY; private boolean showOmitText = true; + private boolean supportSelectAll = true; + public UIComboCheckBox(Object[] value) { - this(value, DEFAULT_VALUE_SPERATOR); + this(value, DEFAULT_VALUE_SPERATOR, true); + } + + public UIComboCheckBox(Object[] value, boolean supportSelectAll) { + this(value, DEFAULT_VALUE_SPERATOR, supportSelectAll); + } + + public UIComboCheckBox(Object[] values, String valueSperator) { + this(values, valueSperator, true); } /** @@ -69,8 +79,9 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam * @param value * @param valueSperator */ - public UIComboCheckBox(Object[] value, String valueSperator) { + public UIComboCheckBox(Object[] value, String valueSperator, boolean supportSelectAll) { values = value; + this.supportSelectAll = supportSelectAll; this.valueSperator = valueSperator; initComponent(); } @@ -102,7 +113,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam private void initComponent() { this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); - this.popup = new UICheckListPopup(values); + this.popup = new UICheckListPopup(values, supportSelectAll); this.popup.addActionListener(new PopupAction()); this.editor = createEditor(); this.arrowButton = createArrowButton(); From d5388b0040c7c991e6a48e321d22d9bcdb8c5074 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 3 Apr 2020 15:00:54 +0800 Subject: [PATCH 18/76] =?UTF-8?q?REPORT-29149=20=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6-=E5=A4=8D=E9=80=89=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=8F=AF=E4=B8=8D=E6=98=BE=E7=A4=BA=E2=80=9C?= =?UTF-8?q?=E5=85=A8=E9=80=89=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/icombocheckbox/UICheckListPopup.java | 15 ++++--- .../icombocheckbox/UICheckListPopupTest.java | 41 +++++++++++++++++++ 2 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 designer-base/src/test/java/com/fr/design/gui/icombocheckbox/UICheckListPopupTest.java diff --git a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java index 9592eb517..66f4bfcbc 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java @@ -192,7 +192,8 @@ public class UICheckListPopup extends UIPopupMenu { List allValue = Arrays.asList(values); for (Object value : selectedValues.keySet()) { int index = allValue.indexOf(value); - checkBoxList.get(index + 1).setSelected(selectedValues.get(value)); + index = supportSelectAll ? index + 1 : index; + checkBoxList.get(index).setSelected(selectedValues.get(value)); } } @@ -204,15 +205,19 @@ public class UICheckListPopup extends UIPopupMenu { public Object[] getSelectedValues() { List selectedValues = new ArrayList(); int selectCount = 0; - - for (int i = 1; i < checkBoxList.size(); i++) { + int startIndex = supportSelectAll ? 1 : 0; + for (int i = startIndex; i < checkBoxList.size(); i++) { if (checkBoxList.get(i).isSelected()) { - selectedValues.add(values[i - 1]); + int valueIndex = supportSelectAll ? i - 1 : i; + selectedValues.add(values[valueIndex]); selectCount++; } } + //全选半选切换 - switchSelectIcon(selectCount); + if (supportSelectAll) { + switchSelectIcon(selectCount); + } return selectedValues.toArray(new Object[selectedValues.size()]); } diff --git a/designer-base/src/test/java/com/fr/design/gui/icombocheckbox/UICheckListPopupTest.java b/designer-base/src/test/java/com/fr/design/gui/icombocheckbox/UICheckListPopupTest.java new file mode 100644 index 000000000..33a98e078 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/gui/icombocheckbox/UICheckListPopupTest.java @@ -0,0 +1,41 @@ +package com.fr.design.gui.icombocheckbox; + +import junit.framework.TestCase; +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/4/3 + */ +public class UICheckListPopupTest extends TestCase { + + @Test + public void testGetSelectedValues() { + Object[] values = new Object[]{"a", "b", "c"}; + Map map = new TreeMap<>(); + map.put("a", true); + map.put("b", false); + map.put("c", true); + List list = new ArrayList<>(); + for (Map.Entry entry : map.entrySet()) { + if (entry.getValue()) { + list.add(entry.getKey()); + } + } + Object[] selectValues = list.toArray(); + UICheckListPopup uiCheckListPopup1 = new UICheckListPopup(values); + uiCheckListPopup1.setSelectedValue(map); + Assert.assertArrayEquals(selectValues, uiCheckListPopup1.getSelectedValues()); + UICheckListPopup uiCheckListPopup2 = new UICheckListPopup(values, false); + uiCheckListPopup2.setSelectedValue(map); + Assert.assertArrayEquals(selectValues, uiCheckListPopup2.getSelectedValues()); + } + +} \ No newline at end of file From f1c2b334f1b8b512e0a0891e514910807717b35f Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 7 Apr 2020 10:52:19 +0800 Subject: [PATCH 19/76] =?UTF-8?q?REPORT-28701=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8-=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E6=9B=BF=E6=8D=A2=E4=B8=BA=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E5=8E=9F=E7=94=9F=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ifilechooser/FRFileChooserFactory.java | 27 ++ .../javafx/UINativeFileChooser.java | 348 ++++++++++++++++++ .../{ => swing}/AbstractFileChooser.java | 2 +- .../{ => swing}/UINativeFileChooser.java | 3 +- 4 files changed, 378 insertions(+), 2 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/gui/ifilechooser/FRFileChooserFactory.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/ifilechooser/javafx/UINativeFileChooser.java rename designer-base/src/main/java/com/fr/design/gui/ifilechooser/{ => swing}/AbstractFileChooser.java (97%) rename designer-base/src/main/java/com/fr/design/gui/ifilechooser/{ => swing}/UINativeFileChooser.java (97%) diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/FRFileChooserFactory.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/FRFileChooserFactory.java new file mode 100644 index 000000000..0bc57dd43 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/FRFileChooserFactory.java @@ -0,0 +1,27 @@ +package com.fr.design.gui.ifilechooser; + +import com.fr.design.gui.ifilechooser.javafx.UINativeFileChooser; + +import javax.swing.*; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/4/7 + */ +public class FRFileChooserFactory { + + /** + * 默认提供原生风格 + * + * @return 文件选择器 + */ + public static JFileChooser createFileChooser() { + if (UINativeFileChooser.isAvailable()) { + return new UINativeFileChooser(); + } else { + return new JFileChooser(); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/javafx/UINativeFileChooser.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/javafx/UINativeFileChooser.java new file mode 100644 index 000000000..b1a1576af --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/javafx/UINativeFileChooser.java @@ -0,0 +1,348 @@ +package com.fr.design.gui.ifilechooser.javafx; + +import java.awt.*; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import javafx.application.Platform; +import javafx.embed.swing.JFXPanel; +import javafx.stage.DirectoryChooser; +import javafx.stage.FileChooser; + +import javax.swing.*; +import javax.swing.filechooser.FileFilter; +import javax.swing.filechooser.FileNameExtensionFilter; +import javax.swing.filechooser.FileSystemView; + + +/** + * 基于javafx的原生风格文件选择器 + * 解决swing原生文件选择器不支持文件过滤的问题 + * + * @author hades + * @version 10.0 + * Created by hades on 2020/4/2 + */ +public class UINativeFileChooser extends JFileChooser { + + private static final boolean FX_AVAILABLE; + private List currentFiles; + private FileChooser fileChooser; + private File currentFile; + private DirectoryChooser directoryChooser; + + static { + boolean isFx; + try { + Class.forName("javafx.stage.FileChooser"); + isFx = true; + JFXPanel jfxPanel = new JFXPanel(); + } catch (ClassNotFoundException e) { + isFx = false; + } + + FX_AVAILABLE = isFx; + } + + public static boolean isAvailable() { + return FX_AVAILABLE; + } + + public UINativeFileChooser() { + initFxFileChooser(null); + } + + public UINativeFileChooser(String currentDirectoryPath) { + super(currentDirectoryPath); + initFxFileChooser(new File(currentDirectoryPath)); + } + + public UINativeFileChooser(File currentDirectory) { + super(currentDirectory); + initFxFileChooser(currentDirectory); + } + + public UINativeFileChooser(FileSystemView fsv) { + super(fsv); + initFxFileChooser(fsv.getDefaultDirectory()); + } + + public UINativeFileChooser(File currentDirectory, FileSystemView fsv) { + super(currentDirectory, fsv); + initFxFileChooser(currentDirectory); + } + + public UINativeFileChooser(String currentDirectoryPath, FileSystemView fsv) { + super(currentDirectoryPath, fsv); + initFxFileChooser(new File(currentDirectoryPath)); + } + + @Override + public int showOpenDialog(final Component parent) throws HeadlessException { + if (!FX_AVAILABLE) { + return super.showOpenDialog(parent); + } + + final CountDownLatch latch = new CountDownLatch(1); + Platform.runLater(new Runnable() { + @Override + public void run() { + + if (parent != null) { + parent.setEnabled(false); + } + + if (DIRECTORIES_ONLY == getFileSelectionMode()) { + currentFile = directoryChooser.showDialog(null); + } else { + if (isMultiSelectionEnabled()) { + currentFiles = fileChooser.showOpenMultipleDialog(null); + } else { + currentFile = fileChooser.showOpenDialog(null); + } + } + latch.countDown(); + } + + }); + try { + latch.await(); + } catch (InterruptedException ex) { + throw new RuntimeException(ex); + } finally { + if (parent != null) { + parent.setEnabled(true); + } + } + + if (isMultiSelectionEnabled()) { + if (currentFiles != null) { + return JFileChooser.APPROVE_OPTION; + } else { + return JFileChooser.CANCEL_OPTION; + } + } else { + if (currentFile != null) { + return JFileChooser.APPROVE_OPTION; + } else { + return JFileChooser.CANCEL_OPTION; + } + } + + } + + @Override + public int showSaveDialog(final Component parent) throws HeadlessException { + if (!FX_AVAILABLE) { + return super.showSaveDialog(parent); + } + + final CountDownLatch latch = new CountDownLatch(1); + + Platform.runLater(new Runnable() { + @Override + public void run() { + + if (parent != null) { + parent.setEnabled(false); + } + + if (DIRECTORIES_ONLY == getFileSelectionMode()) { + currentFile = directoryChooser.showDialog(null); + } else { + currentFile = fileChooser.showSaveDialog(null); + } + latch.countDown(); + } + + }); + try { + latch.await(); + } catch (InterruptedException ex) { + throw new RuntimeException(ex); + } finally { + if (parent != null) { + parent.setEnabled(true); + } + } + + if (currentFile != null) { + return JFileChooser.APPROVE_OPTION; + } else { + return JFileChooser.CANCEL_OPTION; + } + } + + @Override + public int showDialog(Component parent, String approveButtonText) { + if (!FX_AVAILABLE) { + return super.showDialog(parent, approveButtonText); + } + return showOpenDialog(parent); + } + + @Override + public File[] getSelectedFiles() { + if (!FX_AVAILABLE) { + return super.getSelectedFiles(); + } + if (currentFiles == null) { + return null; + } + return currentFiles.toArray(new File[currentFiles.size()]); + } + + @Override + public File getSelectedFile() { + if (!FX_AVAILABLE) { + return super.getSelectedFile(); + } + return currentFile; + } + + @Override + public void setSelectedFiles(File[] selectedFiles) { + if (!FX_AVAILABLE) { + super.setSelectedFiles(selectedFiles); + return; + } + if (selectedFiles == null || selectedFiles.length == 0) { + currentFiles = null; + } else { + setSelectedFile(selectedFiles[0]); + currentFiles = new ArrayList<>(Arrays.asList(selectedFiles)); + } + } + + @Override + public void setSelectedFile(File file) { + if (!FX_AVAILABLE) { + super.setSelectedFile(file); + return; + } + currentFile = file; + if (file != null) { + if (file.isDirectory()) { + fileChooser.setInitialDirectory(file.getAbsoluteFile()); + + if (directoryChooser != null) { + directoryChooser.setInitialDirectory(file.getAbsoluteFile()); + } + } else if (file.isFile()) { + fileChooser.setInitialDirectory(file.getParentFile()); + fileChooser.setInitialFileName(file.getName()); + + if (directoryChooser != null) { + directoryChooser.setInitialDirectory(file.getParentFile()); + } + } + + } + } + + @Override + public void setFileSelectionMode(int mode) { + super.setFileSelectionMode(mode); + if (!FX_AVAILABLE) { + return; + } + if (mode == DIRECTORIES_ONLY) { + if (directoryChooser == null) { + directoryChooser = new DirectoryChooser(); + } + setSelectedFile(currentFile); + setDialogTitle(getDialogTitle()); + } + } + + @Override + public void setDialogTitle(String dialogTitle) { + if (!FX_AVAILABLE) { + super.setDialogTitle(dialogTitle); + return; + } + fileChooser.setTitle(dialogTitle); + if (directoryChooser != null) { + directoryChooser.setTitle(dialogTitle); + } + } + + @Override + public String getDialogTitle() { + if (!FX_AVAILABLE) { + return super.getDialogTitle(); + } + return fileChooser.getTitle(); + } + + @Override + public void changeToParentDirectory() { + if (!FX_AVAILABLE) { + super.changeToParentDirectory(); + return; + } + File parentDir = fileChooser.getInitialDirectory().getParentFile(); + if (parentDir.isDirectory()) { + fileChooser.setInitialDirectory(parentDir); + if (directoryChooser != null) { + directoryChooser.setInitialDirectory(parentDir); + } + } + } + + @Override + public void addChoosableFileFilter(FileFilter filter) { + super.addChoosableFileFilter(filter); + if (!FX_AVAILABLE || filter == null) { + return; + } + if (filter.getClass().equals(FileNameExtensionFilter.class)) { + FileNameExtensionFilter f = (FileNameExtensionFilter) filter; + + List ext = new ArrayList<>(); + for (String extension : f.getExtensions()) { + ext.add(extension.replaceAll("^\\*?\\.?(.*)$", "*.$1")); + } + fileChooser.getExtensionFilters() + .add(new FileChooser.ExtensionFilter(f.getDescription(), ext)); + } + } + + @Override + public void setAcceptAllFileFilterUsed(boolean bool) { + boolean differs = isAcceptAllFileFilterUsed() ^ bool; + super.setAcceptAllFileFilterUsed(bool); + if (!FX_AVAILABLE) { + return; + } + if (!differs) { + return; + } + if (bool) { + fileChooser.getExtensionFilters() + .add(new FileChooser.ExtensionFilter("All files", "*.*")); + } else { + for (Iterator it + = fileChooser.getExtensionFilters().iterator(); it.hasNext();) { + FileChooser.ExtensionFilter filter = it.next(); + if (filter.getExtensions().size() == 1 + && filter.getExtensions().contains("*.*")) { + it.remove(); + } + } + } + + } + + private void initFxFileChooser(File currentFile) { + if (FX_AVAILABLE) { + fileChooser = new FileChooser(); + this.currentFile = currentFile; + setSelectedFile(currentFile); + } + } + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/AbstractFileChooser.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/swing/AbstractFileChooser.java similarity index 97% rename from designer-base/src/main/java/com/fr/design/gui/ifilechooser/AbstractFileChooser.java rename to designer-base/src/main/java/com/fr/design/gui/ifilechooser/swing/AbstractFileChooser.java index ca460aa0f..682f60e35 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/AbstractFileChooser.java +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/swing/AbstractFileChooser.java @@ -1,4 +1,4 @@ -package com.fr.design.gui.ifilechooser; +package com.fr.design.gui.ifilechooser.swing; import javax.swing.filechooser.FileFilter; import java.awt.*; diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/swing/UINativeFileChooser.java similarity index 97% rename from designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java rename to designer-base/src/main/java/com/fr/design/gui/ifilechooser/swing/UINativeFileChooser.java index 9c956372d..dd2394f79 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/swing/UINativeFileChooser.java @@ -1,5 +1,6 @@ -package com.fr.design.gui.ifilechooser; +package com.fr.design.gui.ifilechooser.swing; +import com.fr.design.gui.ifilechooser.swing.AbstractFileChooser; import com.fr.design.mainframe.DesignerContext; import com.fr.stable.os.OperatingSystem; From 2f5f07cf2a960a8b51ce54e25cfe7eb5791b9622 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 7 Apr 2020 10:53:17 +0800 Subject: [PATCH 20/76] =?UTF-8?q?REPORT-28701=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8-=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E6=9B=BF=E6=8D=A2=E4=B8=BA=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E5=8E=9F=E7=94=9F=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/FormWidgetDetailPane.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index ecb3faa70..480a4b3db 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -5,6 +5,7 @@ import com.fr.base.FRContext; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ifilechooser.FRFileChooserFactory; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.widget.FRWidgetFactory; @@ -16,20 +17,9 @@ import com.fr.share.ShareConstants; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; -import javax.swing.DefaultComboBoxModel; -import javax.swing.Icon; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.SwingWorker; +import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Desktop; -import java.awt.Dimension; -import java.awt.FlowLayout; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -333,7 +323,7 @@ public class FormWidgetDetailPane extends FormDockView{ new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - JFileChooser fileChooser = new JFileChooser(); + JFileChooser fileChooser = FRFileChooserFactory.createFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); int returnValue = fileChooser.showDialog(new UILabel(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); From b68c0a25fa7295b37129c8f2d97061f620e94464 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 7 Apr 2020 14:08:59 +0800 Subject: [PATCH 21/76] fix --- .../{swing => }/AbstractFileChooser.java | 11 +- .../ifilechooser/FRFileChooserFactory.java | 27 -- .../{swing => }/UINativeFileChooser.java | 9 +- .../javafx/UINativeFileChooser.java | 348 ------------------ 4 files changed, 17 insertions(+), 378 deletions(-) rename designer-base/src/main/java/com/fr/design/gui/ifilechooser/{swing => }/AbstractFileChooser.java (87%) delete mode 100644 designer-base/src/main/java/com/fr/design/gui/ifilechooser/FRFileChooserFactory.java rename designer-base/src/main/java/com/fr/design/gui/ifilechooser/{swing => }/UINativeFileChooser.java (95%) delete mode 100644 designer-base/src/main/java/com/fr/design/gui/ifilechooser/javafx/UINativeFileChooser.java diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/swing/AbstractFileChooser.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/AbstractFileChooser.java similarity index 87% rename from designer-base/src/main/java/com/fr/design/gui/ifilechooser/swing/AbstractFileChooser.java rename to designer-base/src/main/java/com/fr/design/gui/ifilechooser/AbstractFileChooser.java index 682f60e35..ee61fd81f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/swing/AbstractFileChooser.java +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/AbstractFileChooser.java @@ -1,4 +1,4 @@ -package com.fr.design.gui.ifilechooser.swing; +package com.fr.design.gui.ifilechooser; import javax.swing.filechooser.FileFilter; import java.awt.*; @@ -91,4 +91,13 @@ public abstract class AbstractFileChooser { * */ public abstract int showSaveDialog(Component parent); + + + /** + * https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4031440 + * + * 设置文件名后缀 起到文件过滤的作用 形如 "*.jpg;*.jpeg" + * + */ + public abstract void setExtensionFilter(String file); } diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/FRFileChooserFactory.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/FRFileChooserFactory.java deleted file mode 100644 index 0bc57dd43..000000000 --- a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/FRFileChooserFactory.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.fr.design.gui.ifilechooser; - -import com.fr.design.gui.ifilechooser.javafx.UINativeFileChooser; - -import javax.swing.*; - -/** - * @author hades - * @version 10.0 - * Created by hades on 2020/4/7 - */ -public class FRFileChooserFactory { - - /** - * 默认提供原生风格 - * - * @return 文件选择器 - */ - public static JFileChooser createFileChooser() { - if (UINativeFileChooser.isAvailable()) { - return new UINativeFileChooser(); - } else { - return new JFileChooser(); - } - } - -} diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/swing/UINativeFileChooser.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java similarity index 95% rename from designer-base/src/main/java/com/fr/design/gui/ifilechooser/swing/UINativeFileChooser.java rename to designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java index dd2394f79..c1418f834 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/swing/UINativeFileChooser.java +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java @@ -1,6 +1,6 @@ -package com.fr.design.gui.ifilechooser.swing; +package com.fr.design.gui.ifilechooser; -import com.fr.design.gui.ifilechooser.swing.AbstractFileChooser; +import com.fr.design.gui.ifilechooser.AbstractFileChooser; import com.fr.design.mainframe.DesignerContext; import com.fr.stable.os.OperatingSystem; @@ -129,6 +129,11 @@ public class UINativeFileChooser extends AbstractFileChooser { return fileDialog.getFile() == null ? JFileChooser.CANCEL_OPTION : JFileChooser.APPROVE_OPTION; } + @Override + public void setExtensionFilter(String file) { + fileDialog.setFile(file); + } + /** * 确认本地文件选择器是否支持选择模式 * @param selectionMode 选择模式 diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/javafx/UINativeFileChooser.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/javafx/UINativeFileChooser.java deleted file mode 100644 index b1a1576af..000000000 --- a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/javafx/UINativeFileChooser.java +++ /dev/null @@ -1,348 +0,0 @@ -package com.fr.design.gui.ifilechooser.javafx; - -import java.awt.*; -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import javafx.application.Platform; -import javafx.embed.swing.JFXPanel; -import javafx.stage.DirectoryChooser; -import javafx.stage.FileChooser; - -import javax.swing.*; -import javax.swing.filechooser.FileFilter; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.filechooser.FileSystemView; - - -/** - * 基于javafx的原生风格文件选择器 - * 解决swing原生文件选择器不支持文件过滤的问题 - * - * @author hades - * @version 10.0 - * Created by hades on 2020/4/2 - */ -public class UINativeFileChooser extends JFileChooser { - - private static final boolean FX_AVAILABLE; - private List currentFiles; - private FileChooser fileChooser; - private File currentFile; - private DirectoryChooser directoryChooser; - - static { - boolean isFx; - try { - Class.forName("javafx.stage.FileChooser"); - isFx = true; - JFXPanel jfxPanel = new JFXPanel(); - } catch (ClassNotFoundException e) { - isFx = false; - } - - FX_AVAILABLE = isFx; - } - - public static boolean isAvailable() { - return FX_AVAILABLE; - } - - public UINativeFileChooser() { - initFxFileChooser(null); - } - - public UINativeFileChooser(String currentDirectoryPath) { - super(currentDirectoryPath); - initFxFileChooser(new File(currentDirectoryPath)); - } - - public UINativeFileChooser(File currentDirectory) { - super(currentDirectory); - initFxFileChooser(currentDirectory); - } - - public UINativeFileChooser(FileSystemView fsv) { - super(fsv); - initFxFileChooser(fsv.getDefaultDirectory()); - } - - public UINativeFileChooser(File currentDirectory, FileSystemView fsv) { - super(currentDirectory, fsv); - initFxFileChooser(currentDirectory); - } - - public UINativeFileChooser(String currentDirectoryPath, FileSystemView fsv) { - super(currentDirectoryPath, fsv); - initFxFileChooser(new File(currentDirectoryPath)); - } - - @Override - public int showOpenDialog(final Component parent) throws HeadlessException { - if (!FX_AVAILABLE) { - return super.showOpenDialog(parent); - } - - final CountDownLatch latch = new CountDownLatch(1); - Platform.runLater(new Runnable() { - @Override - public void run() { - - if (parent != null) { - parent.setEnabled(false); - } - - if (DIRECTORIES_ONLY == getFileSelectionMode()) { - currentFile = directoryChooser.showDialog(null); - } else { - if (isMultiSelectionEnabled()) { - currentFiles = fileChooser.showOpenMultipleDialog(null); - } else { - currentFile = fileChooser.showOpenDialog(null); - } - } - latch.countDown(); - } - - }); - try { - latch.await(); - } catch (InterruptedException ex) { - throw new RuntimeException(ex); - } finally { - if (parent != null) { - parent.setEnabled(true); - } - } - - if (isMultiSelectionEnabled()) { - if (currentFiles != null) { - return JFileChooser.APPROVE_OPTION; - } else { - return JFileChooser.CANCEL_OPTION; - } - } else { - if (currentFile != null) { - return JFileChooser.APPROVE_OPTION; - } else { - return JFileChooser.CANCEL_OPTION; - } - } - - } - - @Override - public int showSaveDialog(final Component parent) throws HeadlessException { - if (!FX_AVAILABLE) { - return super.showSaveDialog(parent); - } - - final CountDownLatch latch = new CountDownLatch(1); - - Platform.runLater(new Runnable() { - @Override - public void run() { - - if (parent != null) { - parent.setEnabled(false); - } - - if (DIRECTORIES_ONLY == getFileSelectionMode()) { - currentFile = directoryChooser.showDialog(null); - } else { - currentFile = fileChooser.showSaveDialog(null); - } - latch.countDown(); - } - - }); - try { - latch.await(); - } catch (InterruptedException ex) { - throw new RuntimeException(ex); - } finally { - if (parent != null) { - parent.setEnabled(true); - } - } - - if (currentFile != null) { - return JFileChooser.APPROVE_OPTION; - } else { - return JFileChooser.CANCEL_OPTION; - } - } - - @Override - public int showDialog(Component parent, String approveButtonText) { - if (!FX_AVAILABLE) { - return super.showDialog(parent, approveButtonText); - } - return showOpenDialog(parent); - } - - @Override - public File[] getSelectedFiles() { - if (!FX_AVAILABLE) { - return super.getSelectedFiles(); - } - if (currentFiles == null) { - return null; - } - return currentFiles.toArray(new File[currentFiles.size()]); - } - - @Override - public File getSelectedFile() { - if (!FX_AVAILABLE) { - return super.getSelectedFile(); - } - return currentFile; - } - - @Override - public void setSelectedFiles(File[] selectedFiles) { - if (!FX_AVAILABLE) { - super.setSelectedFiles(selectedFiles); - return; - } - if (selectedFiles == null || selectedFiles.length == 0) { - currentFiles = null; - } else { - setSelectedFile(selectedFiles[0]); - currentFiles = new ArrayList<>(Arrays.asList(selectedFiles)); - } - } - - @Override - public void setSelectedFile(File file) { - if (!FX_AVAILABLE) { - super.setSelectedFile(file); - return; - } - currentFile = file; - if (file != null) { - if (file.isDirectory()) { - fileChooser.setInitialDirectory(file.getAbsoluteFile()); - - if (directoryChooser != null) { - directoryChooser.setInitialDirectory(file.getAbsoluteFile()); - } - } else if (file.isFile()) { - fileChooser.setInitialDirectory(file.getParentFile()); - fileChooser.setInitialFileName(file.getName()); - - if (directoryChooser != null) { - directoryChooser.setInitialDirectory(file.getParentFile()); - } - } - - } - } - - @Override - public void setFileSelectionMode(int mode) { - super.setFileSelectionMode(mode); - if (!FX_AVAILABLE) { - return; - } - if (mode == DIRECTORIES_ONLY) { - if (directoryChooser == null) { - directoryChooser = new DirectoryChooser(); - } - setSelectedFile(currentFile); - setDialogTitle(getDialogTitle()); - } - } - - @Override - public void setDialogTitle(String dialogTitle) { - if (!FX_AVAILABLE) { - super.setDialogTitle(dialogTitle); - return; - } - fileChooser.setTitle(dialogTitle); - if (directoryChooser != null) { - directoryChooser.setTitle(dialogTitle); - } - } - - @Override - public String getDialogTitle() { - if (!FX_AVAILABLE) { - return super.getDialogTitle(); - } - return fileChooser.getTitle(); - } - - @Override - public void changeToParentDirectory() { - if (!FX_AVAILABLE) { - super.changeToParentDirectory(); - return; - } - File parentDir = fileChooser.getInitialDirectory().getParentFile(); - if (parentDir.isDirectory()) { - fileChooser.setInitialDirectory(parentDir); - if (directoryChooser != null) { - directoryChooser.setInitialDirectory(parentDir); - } - } - } - - @Override - public void addChoosableFileFilter(FileFilter filter) { - super.addChoosableFileFilter(filter); - if (!FX_AVAILABLE || filter == null) { - return; - } - if (filter.getClass().equals(FileNameExtensionFilter.class)) { - FileNameExtensionFilter f = (FileNameExtensionFilter) filter; - - List ext = new ArrayList<>(); - for (String extension : f.getExtensions()) { - ext.add(extension.replaceAll("^\\*?\\.?(.*)$", "*.$1")); - } - fileChooser.getExtensionFilters() - .add(new FileChooser.ExtensionFilter(f.getDescription(), ext)); - } - } - - @Override - public void setAcceptAllFileFilterUsed(boolean bool) { - boolean differs = isAcceptAllFileFilterUsed() ^ bool; - super.setAcceptAllFileFilterUsed(bool); - if (!FX_AVAILABLE) { - return; - } - if (!differs) { - return; - } - if (bool) { - fileChooser.getExtensionFilters() - .add(new FileChooser.ExtensionFilter("All files", "*.*")); - } else { - for (Iterator it - = fileChooser.getExtensionFilters().iterator(); it.hasNext();) { - FileChooser.ExtensionFilter filter = it.next(); - if (filter.getExtensions().size() == 1 - && filter.getExtensions().contains("*.*")) { - it.remove(); - } - } - } - - } - - private void initFxFileChooser(File currentFile) { - if (FX_AVAILABLE) { - fileChooser = new FileChooser(); - this.currentFile = currentFile; - setSelectedFile(currentFile); - } - } - -} \ No newline at end of file From 748c2b8e91971d9c7bd028a3a47cb281a87e637c Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 7 Apr 2020 14:10:14 +0800 Subject: [PATCH 22/76] fix --- .../com/fr/design/mainframe/FormWidgetDetailPane.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index 480a4b3db..043a11d40 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -5,7 +5,7 @@ import com.fr.base.FRContext; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icontainer.UIScrollPane; -import com.fr.design.gui.ifilechooser.FRFileChooserFactory; +import com.fr.design.gui.ifilechooser.UINativeFileChooser; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.widget.FRWidgetFactory; @@ -323,10 +323,13 @@ public class FormWidgetDetailPane extends FormDockView{ new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - JFileChooser fileChooser = FRFileChooserFactory.createFileChooser(); + UINativeFileChooser fileChooser = new UINativeFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); - int returnValue = fileChooser.showDialog(new UILabel(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); + FileNameExtensionFilter extensionFilter = new FileNameExtensionFilter(".reu", "reu"); + fileChooser.setFileFilter(extensionFilter); + fileChooser.setExtensionFilter("*.reu"); + fileChooser.setDialogTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); + int returnValue = fileChooser.showOpenDialog(new UILabel()); if (returnValue == JFileChooser.APPROVE_OPTION) { final File chosenFile = fileChooser.getSelectedFile(); installFromDiskZipFile(chosenFile); From 2df36513fb1344e150532dbb2fc90434ba8d9d6c Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 18 Apr 2020 22:18:58 +0800 Subject: [PATCH 23/76] =?UTF-8?q?MOBILE-26189=20=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=88=B0final?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/creator/cardlayout/XWCardMainBorderLayout.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java index 682b92e69..c51fe491e 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java @@ -16,7 +16,7 @@ import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWBorderLayout; import com.fr.design.designer.creator.XWidgetCreator; -import com.fr.design.designer.properties.mobile.MobileBookMarkCombinePropertyUI; +import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI; import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.fun.WidgetPropertyUIProvider; @@ -518,7 +518,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout { @Override public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { if (FormDesignerUtils.isAppRelayout(WidgetPropertyPane.getInstance().getEditingFormDesigner())) { - return new WidgetPropertyUIProvider[] {new MobileBookMarkCombinePropertyUI(this)}; + return new WidgetPropertyUIProvider[] {new MobileBooKMarkUsePropertyUI(this)}; } else { return super.getWidgetPropertyUIProviders(); } From b08c9f9ec17905a9c81d6e4203e51d58bd5181c0 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 22 Apr 2020 15:15:22 +0800 Subject: [PATCH 24/76] =?UTF-8?q?REPORT-30347=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/start/LifecycleFatalErrorHandler.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java b/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java index 252b01dc1..ef416416c 100644 --- a/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java +++ b/designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java @@ -1,5 +1,6 @@ package com.fr.start; +import com.fr.common.report.ReportState; import com.fr.design.RestartHelper; import com.fr.design.dialog.ErrorDialog; import com.fr.design.dialog.FineJOptionPane; @@ -10,6 +11,9 @@ import com.fr.exit.DesignerExiter; import com.fr.general.IOUtils; import com.fr.io.utils.ResourceIOUtils; import com.fr.log.FineLoggerFactory; +import com.fr.process.ProcessEventPipe; +import com.fr.process.engine.core.CarryMessageEvent; +import com.fr.process.engine.core.FineProcessContext; import com.fr.stable.StableUtils; import com.fr.stable.lifecycle.ErrorType; import com.fr.stable.lifecycle.FineLifecycleFatalError; @@ -45,6 +49,10 @@ public class LifecycleFatalErrorHandler { public void handle(FineLifecycleFatalError fatal) { SplashContext.getInstance().hide(); + ProcessEventPipe eventPipe = FineProcessContext.getParentPipe(); + if (eventPipe != null) { + eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue())); + } map.get(fatal.getErrorType()).handle(fatal); } From 7f08ca3560099aa19dcfd6388e0ed85d9f4c20c0 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 22 Apr 2020 22:20:20 +0800 Subject: [PATCH 25/76] =?UTF-8?q?REPORT-30369=20=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=88=B0final?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../creator/cardlayout/XWCardMainBorderLayout.java | 9 --------- .../designer/creator/cardlayout/XWTabFitLayout.java | 6 +----- .../com/fr/design/mainframe/WidgetPropertyPane.java | 2 +- .../ui/designer/mobile/TabMobileWidgetDefinePane.java | 10 ---------- 4 files changed, 2 insertions(+), 25 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java index c51fe491e..25da3e775 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java @@ -514,13 +514,4 @@ public class XWCardMainBorderLayout extends XWBorderLayout { public boolean isSupportShared() { return true; } - - @Override - public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { - if (FormDesignerUtils.isAppRelayout(WidgetPropertyPane.getInstance().getEditingFormDesigner())) { - return new WidgetPropertyUIProvider[] {new MobileBooKMarkUsePropertyUI(this)}; - } else { - return super.getWidgetPropertyUIProviders(); - } - } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java index f17ac0925..508f3f7df 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java @@ -593,11 +593,7 @@ public class XWTabFitLayout extends XWFitLayout { */ @Override public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { - if (FormDesignerUtils.isAppRelayout(WidgetPropertyPane.getInstance().getEditingFormDesigner())) { - return new WidgetPropertyUIProvider[] {new MobileBookMarkPropertyUI(this), new MobileBooKMarkUsePropertyUI(this)}; - } else { - return new WidgetPropertyUIProvider[0]; - } + return new WidgetPropertyUIProvider[0]; } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java index 7fb6f2014..c37b4ba9a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java @@ -181,7 +181,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper if (selection != null && xCreator != null) { embeddedPropertyUIProviders = selection.getSelectedCreator().getWidgetPropertyUIProviders(); if(!designer.getDesignerMode().isFormParameterEditor()) { - if (!xCreator.acceptType(XWAbsoluteLayout.class, XWFitLayout.class, XWCardTagLayout.class, XWCardMainBorderLayout.class) && FormDesignerUtils.isAppRelayout(designer)) { + if (!xCreator.acceptType(XWAbsoluteLayout.class, XWFitLayout.class, XWCardTagLayout.class) && FormDesignerUtils.isAppRelayout(designer)) { embeddedPropertyUIProviders = ArrayUtils.insert(0, embeddedPropertyUIProviders, new MobileBookMarkPropertyUI(xCreator)); } if (xCreator.supportMobileStyle()) { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java index d4f1c0a11..5919985d5 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java @@ -34,7 +34,6 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { private MobileComponentMarginPane marginPane; private MobileComponentLayoutIntervalPane intervalPane; private MobileBookMarkUsePane mobileBookMarkUsePane; - private MobileAdvanceInnerPane mobileAdvanceInnerPane; public TabMobileWidgetDefinePane(XCreator xCreator) { this.xCreator = xCreator; @@ -72,10 +71,7 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { intervalPane = new MobileComponentLayoutIntervalPane(FormTabPaddingAttrMark.XML_TAG); if (FormDesignerUtils.isAppRelayout(designer)) { mobileBookMarkUsePane = new MobileBookMarkUsePane(); - mobileAdvanceInnerPane = new MobileAdvanceInnerPane(xCreator); innerAdvancePane.add(mobileBookMarkUsePane, BorderLayout.CENTER); - innerAdvancePane.add(mobileAdvanceInnerPane, BorderLayout.SOUTH); - } innerAdvancePane.add(marginPane, BorderLayout.NORTH); UIExpandablePane advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, innerAdvancePane); @@ -105,9 +101,6 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { if (mobileBookMarkUsePane != null) { mobileBookMarkUsePane.populate(xCreator); } - if (mobileAdvanceInnerPane != null) { - mobileAdvanceInnerPane.populate(); - } } @Override @@ -124,8 +117,5 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { if (mobileBookMarkUsePane != null) { mobileBookMarkUsePane.update(xCreator); } - if (mobileAdvanceInnerPane != null) { - this.mobileAdvanceInnerPane.update(); - } } } From c600b1ef2e99126657f464c61c9c229779502cde Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 23 Apr 2020 15:33:37 +0800 Subject: [PATCH 26/76] =?UTF-8?q?REPORT-29815=20=20=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E4=B8=8B=E6=8A=A5=E8=A1=A8=E5=92=8C=E8=A1=A8=E5=8D=95=E7=9A=84?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=B1=9E=E6=80=A7=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/actions/FormMobileAttrAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java index deec25c0b..6227c169b 100644 --- a/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java @@ -112,7 +112,7 @@ public class FormMobileAttrAction extends JTemplateAction { private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() { @Override public char getMnemonic() { - return 'T'; + return 'P'; } @Override From 6a1934fd1b7597720e3dba9f9b4e316765f05912 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 23 Apr 2020 17:45:51 +0800 Subject: [PATCH 27/76] =?UTF-8?q?REPORT-29815=20=20=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/unit/UnitConvertUtil.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java b/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java index 406ddcfdd..520430d51 100644 --- a/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java +++ b/designer-base/src/main/java/com/fr/design/unit/UnitConvertUtil.java @@ -6,7 +6,11 @@ import com.fr.design.unit.impl.CMReportLengthUNIT; import com.fr.design.unit.impl.INCHReportLengthUNIT; import com.fr.design.unit.impl.MMReportLengthUNIT; import com.fr.design.unit.impl.PTReportLengthUNIT; - +import com.fr.general.GeneralContext; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -18,6 +22,23 @@ public class UnitConvertUtil { private static List lengthUNITList = new ArrayList(); static { + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + @Override + public void on(PluginEvent pluginEvent) { + initSupportedReportLengthUNIT(); + } + }, new PluginFilter() { + @Override + public boolean accept(PluginContext pluginContext) { + return pluginContext.contain(ReportLengthUNITProvider.MARK_STRING); + } + }); + + initSupportedReportLengthUNIT(); + } + + private static void initSupportedReportLengthUNIT(){ + lengthUNITList.clear(); lengthUNITList.add(new MMReportLengthUNIT()); lengthUNITList.add(new CMReportLengthUNIT()); lengthUNITList.add(new INCHReportLengthUNIT()); From ad08ec0ec4fba0d7217aea72b82f09e9b9c8274c Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 23 Apr 2020 14:51:17 +0800 Subject: [PATCH 28/76] =?UTF-8?q?REPORT-29118=20mac=E4=B8=8B=E5=B1=8F?= =?UTF-8?q?=E8=94=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/os/impl/SupportOSImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java index 5b8d4d2e8..d799d0046 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java @@ -88,7 +88,7 @@ public enum SupportOSImpl implements SupportOS { NON_GUARDIAN_START { @Override public boolean support() { - return OperatingSystem.isLinux() || Arch.getArch() == Arch.ARM; + return OperatingSystem.isLinux() || Arch.getArch() == Arch.ARM || OperatingSystem.isMacos(); } }, From a95a41adcb75bad379730ac30f87cd5cb1188cbf Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 24 Apr 2020 11:07:08 +0800 Subject: [PATCH 29/76] =?UTF-8?q?REPORT-30467=20=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E6=97=B6=E9=95=BF=E5=BB=B6=E9=95=BF=20=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E4=B8=8E=E7=A1=AE=E5=AE=9A=E5=AF=B9=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/start/DesignerSuperListener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java b/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java index f6fa3c937..f5c917464 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java +++ b/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java @@ -31,7 +31,7 @@ import java.util.concurrent.TimeUnit; public class DesignerSuperListener { private static final DesignerSuperListener INSTANCE = new DesignerSuperListener(); - private static final int ONCE_DELAY = 90; + private static final int ONCE_DELAY = 180; private static final int FIXED_DELAY = 0; private static final int FIXED_FREQ = 2; @@ -116,6 +116,7 @@ public class DesignerSuperListener { @Override protected void okEvent() { dispose(); + DesignerLauncher.getInstance().exit(); } @Override @@ -125,7 +126,6 @@ public class DesignerSuperListener { } }; dialog.setVisible(true); - DesignerLauncher.getInstance().exit(); } private void startFallBackListener() { From 54bd1da0c7228be7de2490e09956b4545b1c96ab Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 30 Apr 2020 17:39:48 +0800 Subject: [PATCH 30/76] =?UTF-8?q?REPORT-30947=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=96=87=E4=BB=B6-=E9=80=89=E9=A1=B9-=E9=AB=98?= =?UTF-8?q?=E7=BA=A7-=E4=BD=BF=E7=94=A8=E9=80=9A=E7=94=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E7=AE=A1=E7=90=86=E5=99=A8=E5=8B=BE?= =?UTF-8?q?=E9=80=89=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/actions/file/PreferencePane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 387082ed0..57d9bbcb9 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -225,8 +225,8 @@ public class PreferencePane extends BasicPane { JPanel dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Database_Manager")); useUniverseDBMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_Universe_Database_Manager")); - dbmSelectorPane.add(useUniverseDBMCheckbox); - advancePane.add(dbmSelectorPane); + //dbmSelectorPane.add(useUniverseDBMCheckbox); + //advancePane.add(dbmSelectorPane); JPanel improvePane = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Basic_Product_Improve")); joinProductImproveCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Join_Product_Improve")); From bd4c7a6f6bc24bfa8a7708862dd1b50269051d81 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 12 May 2020 23:26:22 -0700 Subject: [PATCH 31/76] =?UTF-8?q?REPORT-28701=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E7=BB=84=E4=BB=B6=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/FormWidgetDetailPane.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index 043a11d40..3273e89dc 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -325,14 +325,17 @@ public class FormWidgetDetailPane extends FormDockView{ public void actionPerformed(ActionEvent e) { UINativeFileChooser fileChooser = new UINativeFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); + fileChooser.setMultiSelectionEnabled(true); FileNameExtensionFilter extensionFilter = new FileNameExtensionFilter(".reu", "reu"); fileChooser.setFileFilter(extensionFilter); fileChooser.setExtensionFilter("*.reu"); fileChooser.setDialogTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); int returnValue = fileChooser.showOpenDialog(new UILabel()); if (returnValue == JFileChooser.APPROVE_OPTION) { - final File chosenFile = fileChooser.getSelectedFile(); - installFromDiskZipFile(chosenFile); + final File[] chosenFiles = fileChooser.getSelectedFiles(); + for (File file : chosenFiles) { + installFromDiskZipFile(file); + } } } } From 2e315d7ce2a1ee7cb8bead38c00c9891f6e9efe4 Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 13 May 2020 15:40:32 +0800 Subject: [PATCH 32/76] =?UTF-8?q?REPORT-28950=20=E6=8A=A5=E8=A1=A8feature?= =?UTF-8?q?=E5=B7=A5=E7=A8=8B=E5=88=87=E6=8D=A2=E4=B8=BAgradle=E5=B7=A5?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 + build.gradle | 77 +++++++++++++++ designer-chart/build.gradle | 3 + designer-form/build.gradle | 3 + designer-realize/build.gradle | 4 + globalConfigHook.gradle | 29 ++++++ gradlew | 172 ++++++++++++++++++++++++++++++++++ gradlew.bat | 84 +++++++++++++++++ settings.gradle | 12 +++ 9 files changed, 386 insertions(+) create mode 100644 build.gradle create mode 100644 designer-chart/build.gradle create mode 100644 designer-form/build.gradle create mode 100644 designer-realize/build.gradle create mode 100644 globalConfigHook.gradle create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle diff --git a/.gitignore b/.gitignore index 417bed08c..4e6fdbfbd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ .DS_Store .classpath .project +.gradle target/ +*/build diff --git a/build.gradle b/build.gradle new file mode 100644 index 000000000..159d799c4 --- /dev/null +++ b/build.gradle @@ -0,0 +1,77 @@ +import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel + +plugins { + id 'java' + id 'java-library' + id 'com.fr.common' version '1.0-SNAPSHOT' +} + +// 模块参数 +ext { + frVersion = "10.0-FEATURE-SNAPSHOT" + outputPath = "build" + ignoreTestFailureSetting = true + languageLevelSetting = 1.8 +} + +apply from: 'globalConfigHook.gradle' + +dependencies { + api project(':designer-base') + api project(':designer-chart') + api project(':designer-form') + api project(':designer-realize') +} + +allprojects { + apply plugin: 'java' + apply plugin: 'java-library' + apply plugin: 'idea' + + group 'com.fr.design' + version frVersion + sourceCompatibility = languageLevelSetting + targetCompatibility = languageLevelSetting + + tasks.withType(JavaCompile) { + options.encoding = "UTF-8" + } + + repositories { + mavenLocal() + } + + idea { + module { + inheritOutputDirs = false + outputDir = file(outputPath +"/classes") + testOutputDir = file(outputPath +"/test-classes") + languageLevel = new IdeaLanguageLevel(sourceCompatibility) + targetBytecodeVersion = targetCompatibility + } + } + + dependencies { + implementation 'com.fr.third:jxbrowser:7.5' + implementation 'com.fr.third:jxbrowser-swing:7.5' + implementation 'com.fr.third:jxbrowser-mac:7.5' + implementation 'com.fr.third:jxbrowser-win64:7.5' + implementation 'com.fr.third.server:servlet-api:3.0' + implementation 'org.swingexplorer:swexpl:2.0.1' + implementation 'org.swingexplorer:swag:1.0' + implementation 'net.java.dev.jna:jna:5.4.0' + implementation 'org.apache.tomcat:tomcat-catalina:8.5.32' + implementation 'io.socket:socket.io-client:0.7.0' + implementation 'com.fr.third:fine-third:' + frVersion + implementation 'com.fr.core:fine-core:' + frVersion + implementation 'com.fr.activator:fine-activator:' + frVersion + implementation 'com.fr.datasource:fine-datasource:' + frVersion + implementation 'com.fr.decision:fine-decision:' + frVersion + implementation 'com.fr.schedule:fine-schedule:' + frVersion + implementation 'com.fr.report:fine-report-engine:' + frVersion + testImplementation 'org.easymock:easymock:3.5.1' + testImplementation 'org.powermock:powermock-module-junit4:1.7.1' + testImplementation 'org.powermock:powermock-api-easymock:1.7.1' + testImplementation 'junit:junit:4.12' + } +} diff --git a/designer-chart/build.gradle b/designer-chart/build.gradle new file mode 100644 index 000000000..e59f9ef2f --- /dev/null +++ b/designer-chart/build.gradle @@ -0,0 +1,3 @@ +dependencies { + compile project(':designer-base') +} diff --git a/designer-form/build.gradle b/designer-form/build.gradle new file mode 100644 index 000000000..e59f9ef2f --- /dev/null +++ b/designer-form/build.gradle @@ -0,0 +1,3 @@ +dependencies { + compile project(':designer-base') +} diff --git a/designer-realize/build.gradle b/designer-realize/build.gradle new file mode 100644 index 000000000..ffb6823e8 --- /dev/null +++ b/designer-realize/build.gradle @@ -0,0 +1,4 @@ +dependencies { + compile project(':designer-form') + compile project(':designer-chart') +} diff --git a/globalConfigHook.gradle b/globalConfigHook.gradle new file mode 100644 index 000000000..c625d05b1 --- /dev/null +++ b/globalConfigHook.gradle @@ -0,0 +1,29 @@ +def getRootGradle() { + def currentGradle = gradle + while (currentGradle.parent) { + currentGradle = currentGradle.parent + } + return currentGradle +} + +def findHookIncludedBuild() { + def rootGradle = getRootGradle() + def hookProject = rootGradle.getIncludedBuilds() + .find({ build -> build.name == 'hook' }) + return hookProject +} + +def findGlobalConfig() { + def hookProject = findHookIncludedBuild() + if (hookProject) { + def path = hookProject.projectDir.parent + '/globalConfig.gradle' + if (file(path).exists()) { + return path + } + } +} + +def globalConfigPath = findGlobalConfig() +if (globalConfigPath) { + apply from: globalConfigPath +} \ No newline at end of file diff --git a/gradlew b/gradlew new file mode 100644 index 000000000..af6708ff2 --- /dev/null +++ b/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 000000000..6d57edc70 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 000000000..077d17597 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,12 @@ +pluginManagement { + repositories { + maven { + url 'http://mvn.finedevelop.com/repository/maven-public/' + } + gradlePluginPortal() + } +} + +rootProject.name = 'design' + +include 'designer-base', 'designer-chart', 'designer-form', 'designer-realize' From 6f63969355a4415aeafbe83b7cd20da7b856eba3 Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 13 May 2020 16:45:16 +0800 Subject: [PATCH 33/76] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E7=BB=9F=E4=B8=80wraper=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 58695 bytes gradle/wrapper/gradle-wrapper.properties | 6 ++++++ 2 files changed, 6 insertions(+) create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..f3d88b1c2faf2fc91d853cd5d4242b5547257070 GIT binary patch literal 58695 zcma&OV~}Oh(k5J8>Mq;vvTfV8ZQE5{wr$(iDciPf+tV}m-if*I+;_h3N1nY;M6TF7 zBc7A_WUgl&IY|&uNFbnJzkq;%`2QLZ5b*!{1OkHidzBVe;-?mu5upVElKVGD>pC88 zzP}E3wRHBgaO?2nzd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oY3rPBNaLmL{QM};9dke>ujP^j@z-N;fNlKb|edn>)YaafDaJ>GWKP$ z5}l&#$QFhN!CMT;WH&z-5E)kvM|36lV!^#3z{@2FF>HsgUO4PMqO#U$X%+U>K!xJ@ zBFs|+woG_9HZQs_Tw*vnCPGhlXG@>y|6pJT$I67!aP&b0o$AF2JwFy9OoapQAk>k7 z**+$_5L;5fKof<;NBX%_;vP@eyD=Z0(QW)5AF7 zp|=tk3p?5)*e~Inuydz-U?%Kuj4%zToS5I|lolPT!B)ZuRVkVa>f*-2aPeV3R79xh zB)3A$>X~szg#}>uNkpLPG#3IKyeMHM*pUuV5=-Jji7S6PSQ9oCLo{oXxzOZfF$PP) zrYwlmSQ-~n94uO3CD{K0QTmj@g%Yzn7_xQ4fTduU0Yqvln`e_`CdXH5iQ5qRr1 zBC;}%YZ2!4I>*=sR)O~jBPx6sxmIEBnq)s-fHz_y0z8-gPl2Us4BiBXNR5CIF!YR@ zb9B305SilU*@4|+ x6JBtc8JSt5M0pkooaq!^FqtuD_KdXXTo>Mw54>`rP&>h&58!3a6l6r9{sG7g--!SK literal 0 HcmV?d00001 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..e0c5e220c --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 22 15:17:12 CST 2020 +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-all.zip +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME From 82fede2fe208a04c1354d0cd33197dc52f2fa8f9 Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 13 May 2020 18:14:30 +0800 Subject: [PATCH 34/76] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E5=8E=BB=E5=88=86=E6=94=AF=E5=90=8D=E7=A1=AC=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 159d799c4..ebec6e770 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { // 模块参数 ext { - frVersion = "10.0-FEATURE-SNAPSHOT" + frVersion = "" outputPath = "build" ignoreTestFailureSetting = true languageLevelSetting = 1.8 @@ -16,6 +16,10 @@ ext { apply from: 'globalConfigHook.gradle' +if(versions.frVersion){ + frVersion = versions.frVersion +} + dependencies { api project(':designer-base') api project(':designer-chart') From 6ae8ef494ef9e6d8fac1c5730d22b3327baaffd6 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 22 May 2020 16:58:03 +0800 Subject: [PATCH 35/76] =?UTF-8?q?REPORT-32162=20=E6=9B=BF=E6=8D=A2=20ui=20?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C=E9=9C=80=E8=A6=81=E5=9C=A8?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=88=86=E5=8F=91=E7=BA=BF=E7=A8=8B=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 622e9a59c..394dfca1e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -485,24 +485,30 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void replaceAuthorityEditionPane(JComponent pane) { propertyItemMap.get(KEY_AUTHORITY_EDITION).replaceContentPane(pane); } - + public JComponent getAuthorityEditionPane() { return propertyItemMap.get(KEY_AUTHORITY_EDITION).getContentPane(); } - + public void replaceConfiguredRolesPane(JComponent pane) { propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane); } - - public void replaceKeyPane(String key, JComponent pane) { - - propertyItemMap.get(key).replaceContentPane(pane); + + public void replaceKeyPane(final String key, final JComponent pane) { + + //需要放到 ui 线程中处理 + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + propertyItemMap.get(key).replaceContentPane(pane); + } + }); } - + public JComponent getConfiguredRolesPane() { return propertyItemMap.get(KEY_CONFIGURED_ROLES).getContentPane(); } - + public void addParameterPane(JComponent paraPane) { propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceHeaderPane(paraPane); } From 9c03a0c208a207cdbc14cb9d70a7c592e84431a4 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 May 2020 15:42:27 +0800 Subject: [PATCH 36/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 43 +------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 88d2625d0..661b4fa5c 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -8,14 +8,12 @@ import com.fr.base.Utils; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; -import com.fr.design.dialog.ErrorDialog; import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.LocalDesignerWorkspaceInfo; import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.i18n.Toolkit; import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.notification.SnapChatConfig; @@ -23,7 +21,6 @@ import com.fr.design.update.push.DesignerPushUpdateConfigManager; import com.fr.design.style.color.ColorSelectConfigManager; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignerPort; -import com.fr.exit.DesignerExiter; import com.fr.file.FILEFactory; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogFormatter; @@ -58,7 +55,6 @@ import javax.swing.SwingWorker.StateValue; import java.awt.Color; import java.awt.Rectangle; import java.io.File; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; @@ -87,10 +83,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private static final String VERSION_80 = "80"; private static final int CACHINGTEMPLATE_LIMIT = 5; private static final String WEB_NAME = "webapps"; - /** - * 指定默认工作空间 - */ - public static final String DEFAULT_WORKSPACE_PATH = "fr.designer.workspace.default"; private static DesignerEnvManager designerEnvManager; // gui. private String activationKey = null; @@ -207,9 +199,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { GeneralContext.setLocale(designerEnvManager.getLanguage()); try { XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile()); - } catch (FileNotFoundException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - XmlHandler.Self.handle(e); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -358,7 +347,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - XmlHandler.Self.handle(e); } finally { if (null != fileWriter) { try { @@ -573,10 +561,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private String getDefaultenvPath(String installHome) { - String defaultWorkspacePath = System.getProperty(DEFAULT_WORKSPACE_PATH); - if (defaultWorkspacePath != null) { - return defaultWorkspacePath; - } //这里需要转成反斜杠和生成默认路径一致 return new File(StableUtils.pathJoin(installHome, WEB_NAME, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME)).getPath(); } @@ -1419,7 +1403,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { /** * 对国际化进行校验 * 非简繁英日韩的默认环境 设计器全部默认为英文版本 - * * @param locale * @return */ @@ -1571,7 +1554,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { readVcsAttr(reader); } else if (DesignerPort.XML_TAG.equals(name)) { readDesignerPort(reader); - }else if (name.equals(SnapChatConfig.XML_TAG)) { + } else if (name.equals(SnapChatConfig.XML_TAG)) { readSnapChatConfig(reader); } else { readLayout(reader, name); @@ -2067,28 +2050,4 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { public void setVcsConfigManager(VcsConfigManager vcsConfigManager) { this.vcsConfigManager = vcsConfigManager; } - - enum XmlHandler { - Self; - public void handle(Throwable throwable) { - ErrorDialog dialog = new ErrorDialog(null, - Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"), - Toolkit.i18nText("Fine-Design_Error_Start_Report"), - throwable.getMessage()) { - @Override - protected void okEvent() { - dispose(); - DesignerExiter.getInstance().execute(); - } - - @Override - protected void restartEvent() { - dispose(); - RestartHelper.restart(); - } - }; - dialog.setVisible(true); - DesignerExiter.getInstance().execute(); - } - }; } From 711cbd62f1784f54bfad3000b49d6ee5f3aac527 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 May 2020 15:44:32 +0800 Subject: [PATCH 37/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java index 597f733f1..c1418f834 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java @@ -1,5 +1,6 @@ package com.fr.design.gui.ifilechooser; +import com.fr.design.gui.ifilechooser.AbstractFileChooser; import com.fr.design.mainframe.DesignerContext; import com.fr.stable.os.OperatingSystem; From 7483d9d7c63524581fe40d960c62a5da6d74ff39 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 May 2020 15:47:48 +0800 Subject: [PATCH 38/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 101 ++++++++---------- 1 file changed, 42 insertions(+), 59 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 394dfca1e..cf8f4f74d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -11,7 +11,6 @@ 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.ui.util.UIUtil; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.general.FRFont; @@ -131,13 +130,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer { defaultAuthorityPane = getDefaultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Not_Support_Authority_Edit")); switchMode(PropertyMode.REPORT); setContainerWidth(CONTAINER_WIDTH); - + initPluginPane(); listenPlugin(); } - + private void listenPlugin() { - + PluginFilter filter = new PluginFilter() { @Override public boolean accept(PluginContext context) { @@ -151,18 +150,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void on(PluginEvent event) { PluginContext context = event.getContext(); PluginRuntime runtime = context.getRuntime(); - final Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); - // UI相关的逻辑 用UI线程执行 不走FinePluginController线程 走FinePluginController线程有几率出问题 - // 容易导致FinePluginController持有Swing内部的java.awt.Component$AWTTreeLock 这个锁不能被UI线程之外的线程持有 否则容易造成UI线程被Blocked住 - UIUtil.invokeLaterIfNeeded(new Runnable() { - @Override - public void run() { - for (PropertyItemPaneProvider provider : providers) { - addPropertyItem(provider); - } - updateAllPropertyPane(); - } - }); } + Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); + for (PropertyItemPaneProvider provider : providers) { + addPropertyItem(provider); + } + updateAllPropertyPane(); + } }, filter); PluginListenerRegistration.getInstance().listen( PluginEventType.BeforeStop, @@ -171,22 +164,18 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void on(PluginEvent event) { PluginContext context = event.getContext(); PluginRuntime runtime = context.getRuntime(); - final Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); - UIUtil.invokeLaterIfNeeded(new Runnable() { - @Override - public void run() { - for (PropertyItemPaneProvider provider : providers) { - removePropertyItem(provider); - } - updateAllPropertyPane(); - } - }); + Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); + for (PropertyItemPaneProvider provider : providers) { + removePropertyItem(provider); + + } + updateAllPropertyPane(); } }, filter); } - + private void removePropertyItem(PropertyItemPaneProvider provider) { - + propertyItemMap.remove(provider.key()); String replaceKey = provider.replaceKey(); if (replaceKey == null) { @@ -197,18 +186,18 @@ public class EastRegionContainerPane extends UIEastResizableContainer { replaceItem.setReplace(false); } } - + private void initPluginPane() { - + ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign); Set providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG); for (PropertyItemPaneProvider provider : providers) { addPropertyItem(provider); } } - + private void addPropertyItem(PropertyItemPaneProvider provider) { - + String key = provider.key(); PropertyItemBean itemBean = provider.getItem(); PropertyItem propertyItem = new PropertyItem(itemBean.getName(), @@ -223,7 +212,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { button.addActionListener(buttonListener); } propertyItemMap.put(key, propertyItem); - + String replaceKey = provider.replaceKey(); if (replaceKey == null) { return; @@ -232,11 +221,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer { if (replaceItem != null) { replaceItem.setReplace(true); } - + } - + private void initPropertyItemList() { - + propertyItemMap = new LinkedHashMap<>(); // 有序map // 单元格元素 PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Element"), @@ -251,7 +240,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { "floatelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT}); // 控件设置 - PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings"), + PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Settings"), "widgetsettings", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART}); // 条件属性 @@ -485,30 +474,24 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void replaceAuthorityEditionPane(JComponent pane) { propertyItemMap.get(KEY_AUTHORITY_EDITION).replaceContentPane(pane); } - + public JComponent getAuthorityEditionPane() { return propertyItemMap.get(KEY_AUTHORITY_EDITION).getContentPane(); } - + public void replaceConfiguredRolesPane(JComponent pane) { propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane); } - public void replaceKeyPane(final String key, final JComponent pane) { + public void replaceKeyPane(String key, JComponent pane) { - //需要放到 ui 线程中处理 - UIUtil.invokeLaterIfNeeded(new Runnable() { - @Override - public void run() { - propertyItemMap.get(key).replaceContentPane(pane); - } - }); + propertyItemMap.get(key).replaceContentPane(pane); } - + public JComponent getConfiguredRolesPane() { return propertyItemMap.get(KEY_CONFIGURED_ROLES).getContentPane(); } - + public void addParameterPane(JComponent paraPane) { propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceHeaderPane(paraPane); } @@ -670,8 +653,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private String iconSuffix = ICON_SUFFIX_NORMAL; // normal, diabled, selected, 三者之一 private final Color selectedBtnBackground = new Color(0xF5F5F7); private Color originBtnBackground; - - + + public PropertyItem(String name, String title, String btnIconName, PropertyMode[] visibleModes, PropertyMode[] enableModes) { this(name, title, btnIconName, ICON_BASE_DIR, visibleModes, enableModes); } @@ -722,12 +705,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void setVisible(boolean isVisible) { this.isVisible = isVisible; } - + public void setReplace(boolean replace) { - + this.replace = replace; } - + public boolean isEnabled() { return isEnabled; } @@ -737,16 +720,16 @@ public class EastRegionContainerPane extends UIEastResizableContainer { this.isEnabled = isEnabled; button.setEnabled(isEnabled); } - + public void setIconBaseDir(String iconBaseDir) { this.iconBaseDir = iconBaseDir; } - + private String getIconBaseDir() { - + return StringUtils.isEmpty(iconBaseDir) ? ICON_BASE_DIR : iconBaseDir; } - + private void initPropertyPanel() { propertyPanel = new JPanel(); propertyPanel.setBackground(Color.pink); @@ -827,7 +810,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } private String getBtnIconUrl() { - + return getIconBaseDir() + btnIconName + iconSuffix; } From 80c234165064566e59facff7550b463e50766e79 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 May 2020 15:48:49 +0800 Subject: [PATCH 39/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/menu/SnapChatMenuDef.java | 58 +------------------ 1 file changed, 1 insertion(+), 57 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java index 2ec3f6c7e..f3c5735f0 100644 --- a/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java @@ -9,11 +9,6 @@ import com.fr.design.notification.SnapChatKey; import javax.swing.JMenu; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.geom.Ellipse2D; -import java.awt.image.BufferedImage; /** * created by Harrison on 2020/03/16 @@ -42,9 +37,7 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat { public boolean hasRead() { String calcKey = calcKey(); - Boolean val = SnapChatConfig.getInstance().hasRead(calcKey); - // 默认读过了。 - return val == null ? defaultStatus() : val; + return SnapChatConfig.getInstance().hasRead(calcKey); } @Override @@ -54,27 +47,6 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat { SnapChatConfig.getInstance().markRead(calcKey); } - @Override - public boolean defaultStatus() { - - return true; - } - - @Override - public void addShortCut(ShortCut shortCut) { - - addSnapChatNotification(shortCut); - super.addShortCut(shortCut); - } - - @Override - public void insertShortCut(int index, ShortCut shortCut) { - - addSnapChatNotification(shortCut); - super.insertShortCut(index, shortCut); - } - - @Override public SnapChatKey key() { @@ -87,22 +59,6 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat { return new SnapChatMenuListener(); } - /** - * 添加提醒 - * - * @param shortCut 快捷方式 - */ - private void addSnapChatNotification(ShortCut shortCut) { - - if (shortCut instanceof SnapChatUpdateAction) { - SnapChatUpdateAction action = (SnapChatUpdateAction) shortCut; - if (!action.hasRead()) { - String calcKey = calcKey(); - SnapChatConfig.getInstance().resetRead(calcKey); - } - } - } - private String calcKey() { return key().calc(); @@ -185,16 +141,4 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat { setUI(menuUI); } } - - public static void main(String[] args) { - - BufferedImage image = new BufferedImage(16, 16, Image.SCALE_DEFAULT); - Graphics2D g2d = image.createGraphics(); - g2d.setColor(Color.green); - Ellipse2D.Double shape = - new Ellipse2D.Double(2, 2, 1, 1); - g2d.fill(shape); - g2d.draw(shape); - System.out.println(); - } } From 05dc598bf9ae422870a7c51a65689d0e5b50a1ad Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 May 2020 15:49:52 +0800 Subject: [PATCH 40/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/menu/SnapChatUpdateAction.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java index 9ade76250..482954546 100644 --- a/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java @@ -32,8 +32,7 @@ public abstract class SnapChatUpdateAction extends UpdateAction implements SnapC public boolean hasRead() { String calcKey = calcKey(); - Boolean val = SnapChatConfig.getInstance().hasRead(calcKey); - return val == null ? defaultStatus() : val; + return SnapChatConfig.getInstance().hasRead(calcKey); } @Override @@ -43,12 +42,6 @@ public abstract class SnapChatUpdateAction extends UpdateAction implements SnapC SnapChatConfig.getInstance().markRead(calcKey); } - @Override - public boolean defaultStatus() { - - return false; - } - @Override public SnapChatKey key() { From 7df731ed52b7c6031ff19d2cc25849ec834e47c7 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 May 2020 15:50:55 +0800 Subject: [PATCH 41/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/notification/SnapChat.java | 7 ------- .../java/com/fr/design/notification/SnapChatConfig.java | 8 ++------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChat.java b/designer-base/src/main/java/com/fr/design/notification/SnapChat.java index 4f610c060..8dd6f8aa2 100644 --- a/designer-base/src/main/java/com/fr/design/notification/SnapChat.java +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChat.java @@ -7,13 +7,6 @@ package com.fr.design.notification; **/ public interface SnapChat { - /** - * 默认状态 - * - * @return 默认状态 - */ - boolean defaultStatus(); - /** * 已读 * diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java index c192d054c..ed6b7a6d8 100644 --- a/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java @@ -31,7 +31,8 @@ public class SnapChatConfig implements XMLable { public Boolean hasRead(String key) { Map map = markReadMap; - return map.get(key); + Boolean val = map.get(key); + return val == null ? Boolean.FALSE : val; } public void markRead(String key) { @@ -39,11 +40,6 @@ public class SnapChatConfig implements XMLable { markReadMap.put(key, Boolean.TRUE); } - public void resetRead(String key) { - - markReadMap.put(key, Boolean.FALSE); - } - @Override public void readXML(XMLableReader reader) { From 231b41f01a73694777e340109cd40cd495b164aa Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 May 2020 15:52:34 +0800 Subject: [PATCH 42/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/creator/XCreatorUtils.java | 38 ++++--------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index d14780054..433f7c4f7 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -66,8 +66,7 @@ import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.StringUtils; -import com.fr.third.javax.annotation.Nonnull; -import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; import javax.swing.Icon; import java.awt.Container; @@ -165,44 +164,21 @@ public class XCreatorUtils { } private static void reInitExtra() { - + extraObjectMap.clear(); extraObjectMap.putAll(ExtraDesignClassManager.getInstance().getParameterWidgetOptionsMap()); extraObjectMap.putAll(ExtraDesignClassManager.getInstance().getFormWidgetOptionsMap()); } - + private static void putExtraEditor() { if (DesignModuleFactory.getChartEditorClass() != null) { objectMap.put(DesignModuleFactory.getChartEditorClass(), XChartEditor.class); } } - - /** - * 对于继承的子组件来说,可能并没有对应的 XCreator - * 这个时候,就需要递归的找父类 - * - * @param clazz 组件类 - * @return 创建类 - */ - @SuppressWarnings("unchecked") - @Nullable - private static Class similarXCreatorClass(Class clazz) { - - Class target = clazz; - Class xClazz = null; - //判断条件有两个 - //1.还没找到对应的 xClazz - //2.一直到 终极父类-Widget 都找不到 - while (xClazz == null && Widget.class.isAssignableFrom(target)) { - xClazz = searchXCreatorClass((Class) target); - target = target.getSuperclass(); - } - return xClazz; - } - + @SuppressWarnings("unchecked") private static Class searchXCreatorClass(Class clazz) { - + Class xClazz = (Class) objectMap.get(clazz); if (xClazz == null) { xClazz = (Class) extraObjectMap.get(clazz); @@ -238,7 +214,7 @@ public class XCreatorUtils { clazz = NullCreator.class; } else { widgetClass = widget.getClass(); - clazz = XCreatorUtils.similarXCreatorClass(widgetClass); + clazz = XCreatorUtils.searchXCreatorClass(widgetClass); if (clazz == null) { FineLoggerFactory.getLogger().error(widget + "'s" + " xcreator doesn't exsit!"); clazz = NullCreator.class; @@ -310,7 +286,7 @@ public class XCreatorUtils { * @param creator 组件 * @return 返回顶层容器 */ - public static XLayoutContainer getHotspotContainer(@Nonnull XCreator creator) { + public static XLayoutContainer getHotspotContainer(@NotNull XCreator creator) { if (creator.isDedicateContainer()) { return (XLayoutContainer) creator.getParent(); } From 031b17b3dbbcdef6e8ae926f88587b71df2f5135 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 May 2020 15:53:43 +0800 Subject: [PATCH 43/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/FormCreatorDropTarget.java | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 06cb19d0a..0a6e692f4 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -1,7 +1,6 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; -import com.fr.base.chart.BaseChartCollection; import com.fr.chart.chartattr.ChartCollection; import com.fr.chartx.attr.ChartProvider; import com.fr.design.DesignModelAdapter; @@ -28,12 +27,9 @@ import com.fr.form.share.ShareLoader; import com.fr.form.ui.ChartEditor; import com.fr.form.ui.Widget; import com.fr.stable.Constants; -import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.JWindow; -import java.util.List; -import java.util.Map; import java.awt.Color; import java.awt.Component; import java.awt.Point; @@ -97,7 +93,7 @@ public class FormCreatorDropTarget extends DropTarget { //SetSelection时要确保选中的是最顶层的布局 //tab布局添加的时候是初始化了XWCardLayout,实际上最顶层的布局是XWCardMainBorderLayout XCreator addingXCreator = addingModel.getXCreator(); - Widget widget = (addingXCreator.getBackupParent() != null && addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData(); + Widget widget = (addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData(); //图表埋点 dealChartBuryingPoint(widget); if (addingXCreator.isShared()) { @@ -288,16 +284,9 @@ public class FormCreatorDropTarget extends DropTarget { } private void dealChartBuryingPoint(Widget widget) { - List chartCollections = widget.getChartCollections(); - for (BaseChartCollection baseChartCollection : chartCollections) { - ChartCollection chartCollection = (ChartCollection) baseChartCollection; - for (int i = 0, size = chartCollection.getChartCount(); i < size; i++) { - ChartProvider chart = chartCollection.getChart(i, ChartProvider.class); - //是否是共享的复用组件 - boolean isReuse = StringUtils.isNotEmpty(this.addingModel.getXCreator().getShareId()); - ChartInfoCollector.getInstance().collection(chart, null, isReuse); - ChartInfoCollector.getInstance().checkTestChart(chart); - } + if (widget instanceof ChartEditor) { + ChartCollection chartCollection = (ChartCollection)((ChartEditor) widget).getChartCollection(); + ChartInfoCollector.getInstance().collection(chartCollection.getSelectedChartProvider(ChartProvider.class), null); } } } From 2e1f43c2a08bd8be235a741553d01253d7ade965 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 May 2020 15:55:45 +0800 Subject: [PATCH 44/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/FormWidgetDetailPane.java | 52 +++++-------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index 311ea4cb7..3273e89dc 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -8,7 +8,6 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ifilechooser.UINativeFileChooser; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.widget.FRWidgetFactory; import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.ShareLoader; @@ -18,20 +17,9 @@ import com.fr.share.ShareConstants; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; -import javax.swing.DefaultComboBoxModel; -import javax.swing.Icon; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.SwingWorker; +import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Desktop; -import java.awt.Dimension; -import java.awt.FlowLayout; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -335,30 +323,18 @@ public class FormWidgetDetailPane extends FormDockView{ new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - if (SupportOSImpl.NATIVE_CHOOSER.support()) { - UINativeFileChooser nativeFileChooser = new UINativeFileChooser(); - nativeFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - nativeFileChooser.setMultiSelectionEnabled(true); - nativeFileChooser.setExtensionFilter("*.reu"); - nativeFileChooser.setDialogTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); - int returnValue = nativeFileChooser.showOpenDialog(new UILabel()); - if (returnValue == JFileChooser.APPROVE_OPTION) { - final File[] chosenFiles = nativeFileChooser.getSelectedFiles(); - for (File file : chosenFiles) { - installFromDiskZipFile(file); - } - } - } else { - JFileChooser fileChooser = new JFileChooser(); - fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - fileChooser.setMultiSelectionEnabled(true); - fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); - int returnValue = fileChooser.showDialog(new UILabel(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); - if (returnValue == JFileChooser.APPROVE_OPTION) { - final File[] chosenFiles = fileChooser.getSelectedFiles(); - for (File file : chosenFiles) { - installFromDiskZipFile(file); - } + UINativeFileChooser fileChooser = new UINativeFileChooser(); + fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); + fileChooser.setMultiSelectionEnabled(true); + FileNameExtensionFilter extensionFilter = new FileNameExtensionFilter(".reu", "reu"); + fileChooser.setFileFilter(extensionFilter); + fileChooser.setExtensionFilter("*.reu"); + fileChooser.setDialogTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); + int returnValue = fileChooser.showOpenDialog(new UILabel()); + if (returnValue == JFileChooser.APPROVE_OPTION) { + final File[] chosenFiles = fileChooser.getSelectedFiles(); + for (File file : chosenFiles) { + installFromDiskZipFile(file); } } } From c4d9d5213862f1acef4b738380025af8d42cc81c Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 May 2020 15:58:04 +0800 Subject: [PATCH 45/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/JForm.java | 74 +++++++------------ 1 file changed, 25 insertions(+), 49 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index e2112f4f3..e464d7e05 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -5,7 +5,6 @@ import com.fr.base.PaperSize; import com.fr.base.Parameter; import com.fr.base.extension.FileExtension; import com.fr.base.vcs.DesignerMode; -import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.FormMobileAttrAction; @@ -14,7 +13,6 @@ import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.cell.FloatElementsProvider; -import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.designer.TargetComponent; import com.fr.design.designer.beans.actions.CopyAction; import com.fr.design.designer.beans.actions.CutAction; @@ -31,7 +29,6 @@ import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; -import com.fr.design.fun.FormAdaptiveConfigUIProcessor; import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.gui.frpane.HyperlinkGroupPane; @@ -128,63 +125,60 @@ public class JForm extends JTemplate implements BaseJForm providers = runtime.get(PropertyItemPaneProvider.XML_TAG); - for (PropertyItemPaneProvider provider : providers) { - addPane(provider); - } - } - }; - PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginListener, filter); + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, + new PluginEventListener(PropertyItemPaneProvider.LAST) { + @Override + public void on(PluginEvent event) { + PluginContext context = event.getContext(); + PluginRuntime runtime = context.getRuntime(); + Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); + for (PropertyItemPaneProvider provider : providers) { + addPane(provider); + } + } + }, filter); } - + private void initPluginPane() { - + ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign); Set providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG); for (PropertyItemPaneProvider provider : providers) { addPane(provider); } } - + private void addPane(PropertyItemPaneProvider provider) { - + PaneHolder holder = provider.getPaneHolder(FormDesigner.class); if (holder != null) { JPanel panel = holder.getInstance(formDesign); EastRegionContainerPane.getInstance().replaceKeyPane(provider.key(), panel); } } - + @Override public void refreshEastPropertiesPane() { // 暂时用不到,遇到的时候再加刷新右侧tab面板的代码 @@ -209,14 +203,12 @@ public class JForm extends JTemplate implements BaseJForm getProcessInfo() { - //这边需要判空,图表的埋点信息收集时可能没有初始化processInfo if (processInfo == null) { processInfo = new JFormProcessInfo(template); } return processInfo; } - public FormECCompositeProvider getReportComposite() { return this.reportComposite; } @@ -567,19 +559,10 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm implements BaseJForm implements BaseJForm implements BaseJForm implements BaseJForm Date: Mon, 25 May 2020 16:00:08 +0800 Subject: [PATCH 46/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/JForm.java | 74 ++++++++++++------- 1 file changed, 49 insertions(+), 25 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index e464d7e05..e2112f4f3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -5,6 +5,7 @@ import com.fr.base.PaperSize; import com.fr.base.Parameter; import com.fr.base.extension.FileExtension; import com.fr.base.vcs.DesignerMode; +import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.FormMobileAttrAction; @@ -13,6 +14,7 @@ import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.cell.FloatElementsProvider; +import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.designer.TargetComponent; import com.fr.design.designer.beans.actions.CopyAction; import com.fr.design.designer.beans.actions.CutAction; @@ -29,6 +31,7 @@ import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; +import com.fr.design.fun.FormAdaptiveConfigUIProcessor; import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.gui.frpane.HyperlinkGroupPane; @@ -125,60 +128,63 @@ public class JForm extends JTemplate implements BaseJForm providers = runtime.get(PropertyItemPaneProvider.XML_TAG); - for (PropertyItemPaneProvider provider : providers) { - addPane(provider); - } - } - }, filter); + this.pluginListener = new PluginEventListener(PropertyItemPaneProvider.LAST) { + @Override + public void on(PluginEvent event) { + PluginContext context = event.getContext(); + PluginRuntime runtime = context.getRuntime(); + Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); + for (PropertyItemPaneProvider provider : providers) { + addPane(provider); + } + } + }; + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginListener, filter); } - + private void initPluginPane() { - + ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign); Set providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG); for (PropertyItemPaneProvider provider : providers) { addPane(provider); } } - + private void addPane(PropertyItemPaneProvider provider) { - + PaneHolder holder = provider.getPaneHolder(FormDesigner.class); if (holder != null) { JPanel panel = holder.getInstance(formDesign); EastRegionContainerPane.getInstance().replaceKeyPane(provider.key(), panel); } } - + @Override public void refreshEastPropertiesPane() { // 暂时用不到,遇到的时候再加刷新右侧tab面板的代码 @@ -203,12 +209,14 @@ public class JForm extends JTemplate implements BaseJForm getProcessInfo() { + //这边需要判空,图表的埋点信息收集时可能没有初始化processInfo if (processInfo == null) { processInfo = new JFormProcessInfo(template); } return processInfo; } + public FormECCompositeProvider getReportComposite() { return this.reportComposite; } @@ -559,10 +567,19 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm implements BaseJForm implements BaseJForm implements BaseJForm implements BaseJForm Date: Mon, 25 May 2020 16:00:45 +0800 Subject: [PATCH 47/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/notification/SnapChat.java | 7 +++++++ .../java/com/fr/design/notification/SnapChatConfig.java | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChat.java b/designer-base/src/main/java/com/fr/design/notification/SnapChat.java index 8dd6f8aa2..4f610c060 100644 --- a/designer-base/src/main/java/com/fr/design/notification/SnapChat.java +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChat.java @@ -7,6 +7,13 @@ package com.fr.design.notification; **/ public interface SnapChat { + /** + * 默认状态 + * + * @return 默认状态 + */ + boolean defaultStatus(); + /** * 已读 * diff --git a/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java index ed6b7a6d8..c192d054c 100644 --- a/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java +++ b/designer-base/src/main/java/com/fr/design/notification/SnapChatConfig.java @@ -31,8 +31,7 @@ public class SnapChatConfig implements XMLable { public Boolean hasRead(String key) { Map map = markReadMap; - Boolean val = map.get(key); - return val == null ? Boolean.FALSE : val; + return map.get(key); } public void markRead(String key) { @@ -40,6 +39,11 @@ public class SnapChatConfig implements XMLable { markReadMap.put(key, Boolean.TRUE); } + public void resetRead(String key) { + + markReadMap.put(key, Boolean.FALSE); + } + @Override public void readXML(XMLableReader reader) { From 55bfb305d9f2aacf8b795d8b190fbab773f63f52 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 May 2020 16:01:47 +0800 Subject: [PATCH 48/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/menu/SnapChatMenuDef.java | 58 ++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java index f3c5735f0..2ec3f6c7e 100644 --- a/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatMenuDef.java @@ -9,6 +9,11 @@ import com.fr.design.notification.SnapChatKey; import javax.swing.JMenu; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.geom.Ellipse2D; +import java.awt.image.BufferedImage; /** * created by Harrison on 2020/03/16 @@ -37,7 +42,9 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat { public boolean hasRead() { String calcKey = calcKey(); - return SnapChatConfig.getInstance().hasRead(calcKey); + Boolean val = SnapChatConfig.getInstance().hasRead(calcKey); + // 默认读过了。 + return val == null ? defaultStatus() : val; } @Override @@ -47,6 +54,27 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat { SnapChatConfig.getInstance().markRead(calcKey); } + @Override + public boolean defaultStatus() { + + return true; + } + + @Override + public void addShortCut(ShortCut shortCut) { + + addSnapChatNotification(shortCut); + super.addShortCut(shortCut); + } + + @Override + public void insertShortCut(int index, ShortCut shortCut) { + + addSnapChatNotification(shortCut); + super.insertShortCut(index, shortCut); + } + + @Override public SnapChatKey key() { @@ -59,6 +87,22 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat { return new SnapChatMenuListener(); } + /** + * 添加提醒 + * + * @param shortCut 快捷方式 + */ + private void addSnapChatNotification(ShortCut shortCut) { + + if (shortCut instanceof SnapChatUpdateAction) { + SnapChatUpdateAction action = (SnapChatUpdateAction) shortCut; + if (!action.hasRead()) { + String calcKey = calcKey(); + SnapChatConfig.getInstance().resetRead(calcKey); + } + } + } + private String calcKey() { return key().calc(); @@ -141,4 +185,16 @@ public class SnapChatMenuDef extends MenuDef implements SnapChat { setUI(menuUI); } } + + public static void main(String[] args) { + + BufferedImage image = new BufferedImage(16, 16, Image.SCALE_DEFAULT); + Graphics2D g2d = image.createGraphics(); + g2d.setColor(Color.green); + Ellipse2D.Double shape = + new Ellipse2D.Double(2, 2, 1, 1); + g2d.fill(shape); + g2d.draw(shape); + System.out.println(); + } } From b3ab7ae77341b3978374654dde06a2a47d2edb91 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 May 2020 16:02:28 +0800 Subject: [PATCH 49/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/creator/XCreatorUtils.java | 38 +++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index 433f7c4f7..d14780054 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -66,7 +66,8 @@ import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.StringUtils; -import org.jetbrains.annotations.NotNull; +import com.fr.third.javax.annotation.Nonnull; +import org.jetbrains.annotations.Nullable; import javax.swing.Icon; import java.awt.Container; @@ -164,21 +165,44 @@ public class XCreatorUtils { } private static void reInitExtra() { - + extraObjectMap.clear(); extraObjectMap.putAll(ExtraDesignClassManager.getInstance().getParameterWidgetOptionsMap()); extraObjectMap.putAll(ExtraDesignClassManager.getInstance().getFormWidgetOptionsMap()); } - + private static void putExtraEditor() { if (DesignModuleFactory.getChartEditorClass() != null) { objectMap.put(DesignModuleFactory.getChartEditorClass(), XChartEditor.class); } } - + + /** + * 对于继承的子组件来说,可能并没有对应的 XCreator + * 这个时候,就需要递归的找父类 + * + * @param clazz 组件类 + * @return 创建类 + */ + @SuppressWarnings("unchecked") + @Nullable + private static Class similarXCreatorClass(Class clazz) { + + Class target = clazz; + Class xClazz = null; + //判断条件有两个 + //1.还没找到对应的 xClazz + //2.一直到 终极父类-Widget 都找不到 + while (xClazz == null && Widget.class.isAssignableFrom(target)) { + xClazz = searchXCreatorClass((Class) target); + target = target.getSuperclass(); + } + return xClazz; + } + @SuppressWarnings("unchecked") private static Class searchXCreatorClass(Class clazz) { - + Class xClazz = (Class) objectMap.get(clazz); if (xClazz == null) { xClazz = (Class) extraObjectMap.get(clazz); @@ -214,7 +238,7 @@ public class XCreatorUtils { clazz = NullCreator.class; } else { widgetClass = widget.getClass(); - clazz = XCreatorUtils.searchXCreatorClass(widgetClass); + clazz = XCreatorUtils.similarXCreatorClass(widgetClass); if (clazz == null) { FineLoggerFactory.getLogger().error(widget + "'s" + " xcreator doesn't exsit!"); clazz = NullCreator.class; @@ -286,7 +310,7 @@ public class XCreatorUtils { * @param creator 组件 * @return 返回顶层容器 */ - public static XLayoutContainer getHotspotContainer(@NotNull XCreator creator) { + public static XLayoutContainer getHotspotContainer(@Nonnull XCreator creator) { if (creator.isDedicateContainer()) { return (XLayoutContainer) creator.getParent(); } From 492375bbb95c7631e5b6ff09cb2384c0af86e487 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 May 2020 16:03:01 +0800 Subject: [PATCH 50/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/menu/SnapChatUpdateAction.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java b/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java index 482954546..9ade76250 100644 --- a/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/menu/SnapChatUpdateAction.java @@ -32,7 +32,8 @@ public abstract class SnapChatUpdateAction extends UpdateAction implements SnapC public boolean hasRead() { String calcKey = calcKey(); - return SnapChatConfig.getInstance().hasRead(calcKey); + Boolean val = SnapChatConfig.getInstance().hasRead(calcKey); + return val == null ? defaultStatus() : val; } @Override @@ -42,6 +43,12 @@ public abstract class SnapChatUpdateAction extends UpdateAction implements SnapC SnapChatConfig.getInstance().markRead(calcKey); } + @Override + public boolean defaultStatus() { + + return false; + } + @Override public SnapChatKey key() { From f28611c3e86876c594520cba59db30cadb16105c Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 May 2020 16:03:39 +0800 Subject: [PATCH 51/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/FormWidgetDetailPane.java | 52 ++++++++++++++----- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index 3273e89dc..311ea4cb7 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -8,6 +8,7 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ifilechooser.UINativeFileChooser; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.widget.FRWidgetFactory; import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.ShareLoader; @@ -17,9 +18,20 @@ import com.fr.share.ShareConstants; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.DefaultComboBoxModel; +import javax.swing.Icon; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.SwingWorker; import javax.swing.filechooser.FileNameExtensionFilter; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Desktop; +import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -323,18 +335,30 @@ public class FormWidgetDetailPane extends FormDockView{ new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - UINativeFileChooser fileChooser = new UINativeFileChooser(); - fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - fileChooser.setMultiSelectionEnabled(true); - FileNameExtensionFilter extensionFilter = new FileNameExtensionFilter(".reu", "reu"); - fileChooser.setFileFilter(extensionFilter); - fileChooser.setExtensionFilter("*.reu"); - fileChooser.setDialogTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); - int returnValue = fileChooser.showOpenDialog(new UILabel()); - if (returnValue == JFileChooser.APPROVE_OPTION) { - final File[] chosenFiles = fileChooser.getSelectedFiles(); - for (File file : chosenFiles) { - installFromDiskZipFile(file); + if (SupportOSImpl.NATIVE_CHOOSER.support()) { + UINativeFileChooser nativeFileChooser = new UINativeFileChooser(); + nativeFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); + nativeFileChooser.setMultiSelectionEnabled(true); + nativeFileChooser.setExtensionFilter("*.reu"); + nativeFileChooser.setDialogTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); + int returnValue = nativeFileChooser.showOpenDialog(new UILabel()); + if (returnValue == JFileChooser.APPROVE_OPTION) { + final File[] chosenFiles = nativeFileChooser.getSelectedFiles(); + for (File file : chosenFiles) { + installFromDiskZipFile(file); + } + } + } else { + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); + fileChooser.setMultiSelectionEnabled(true); + fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); + int returnValue = fileChooser.showDialog(new UILabel(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select")); + if (returnValue == JFileChooser.APPROVE_OPTION) { + final File[] chosenFiles = fileChooser.getSelectedFiles(); + for (File file : chosenFiles) { + installFromDiskZipFile(file); + } } } } From c69f90e782691f6a780d6b0808c6cb46094e4282 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 May 2020 16:04:21 +0800 Subject: [PATCH 52/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/FormCreatorDropTarget.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 0a6e692f4..06cb19d0a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.chart.BaseChartCollection; import com.fr.chart.chartattr.ChartCollection; import com.fr.chartx.attr.ChartProvider; import com.fr.design.DesignModelAdapter; @@ -27,9 +28,12 @@ import com.fr.form.share.ShareLoader; import com.fr.form.ui.ChartEditor; import com.fr.form.ui.Widget; import com.fr.stable.Constants; +import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.JWindow; +import java.util.List; +import java.util.Map; import java.awt.Color; import java.awt.Component; import java.awt.Point; @@ -93,7 +97,7 @@ public class FormCreatorDropTarget extends DropTarget { //SetSelection时要确保选中的是最顶层的布局 //tab布局添加的时候是初始化了XWCardLayout,实际上最顶层的布局是XWCardMainBorderLayout XCreator addingXCreator = addingModel.getXCreator(); - Widget widget = (addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData(); + Widget widget = (addingXCreator.getBackupParent() != null && addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData(); //图表埋点 dealChartBuryingPoint(widget); if (addingXCreator.isShared()) { @@ -284,9 +288,16 @@ public class FormCreatorDropTarget extends DropTarget { } private void dealChartBuryingPoint(Widget widget) { - if (widget instanceof ChartEditor) { - ChartCollection chartCollection = (ChartCollection)((ChartEditor) widget).getChartCollection(); - ChartInfoCollector.getInstance().collection(chartCollection.getSelectedChartProvider(ChartProvider.class), null); + List chartCollections = widget.getChartCollections(); + for (BaseChartCollection baseChartCollection : chartCollections) { + ChartCollection chartCollection = (ChartCollection) baseChartCollection; + for (int i = 0, size = chartCollection.getChartCount(); i < size; i++) { + ChartProvider chart = chartCollection.getChart(i, ChartProvider.class); + //是否是共享的复用组件 + boolean isReuse = StringUtils.isNotEmpty(this.addingModel.getXCreator().getShareId()); + ChartInfoCollector.getInstance().collection(chart, null, isReuse); + ChartInfoCollector.getInstance().checkTestChart(chart); + } } } } From 1823b7487d49ef4eb090083c478365509f183c12 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 May 2020 16:04:53 +0800 Subject: [PATCH 53/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 101 ++++++++++-------- 1 file changed, 59 insertions(+), 42 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index cf8f4f74d..394dfca1e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -11,6 +11,7 @@ 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.ui.util.UIUtil; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.general.FRFont; @@ -130,13 +131,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer { defaultAuthorityPane = getDefaultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Not_Support_Authority_Edit")); switchMode(PropertyMode.REPORT); setContainerWidth(CONTAINER_WIDTH); - + initPluginPane(); listenPlugin(); } - + private void listenPlugin() { - + PluginFilter filter = new PluginFilter() { @Override public boolean accept(PluginContext context) { @@ -150,12 +151,18 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void on(PluginEvent event) { PluginContext context = event.getContext(); PluginRuntime runtime = context.getRuntime(); - Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); - for (PropertyItemPaneProvider provider : providers) { - addPropertyItem(provider); - } - updateAllPropertyPane(); - } + final Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); + // UI相关的逻辑 用UI线程执行 不走FinePluginController线程 走FinePluginController线程有几率出问题 + // 容易导致FinePluginController持有Swing内部的java.awt.Component$AWTTreeLock 这个锁不能被UI线程之外的线程持有 否则容易造成UI线程被Blocked住 + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + for (PropertyItemPaneProvider provider : providers) { + addPropertyItem(provider); + } + updateAllPropertyPane(); + } + }); } }, filter); PluginListenerRegistration.getInstance().listen( PluginEventType.BeforeStop, @@ -164,18 +171,22 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void on(PluginEvent event) { PluginContext context = event.getContext(); PluginRuntime runtime = context.getRuntime(); - Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); - for (PropertyItemPaneProvider provider : providers) { - removePropertyItem(provider); - - } - updateAllPropertyPane(); + final Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + for (PropertyItemPaneProvider provider : providers) { + removePropertyItem(provider); + } + updateAllPropertyPane(); + } + }); } }, filter); } - + private void removePropertyItem(PropertyItemPaneProvider provider) { - + propertyItemMap.remove(provider.key()); String replaceKey = provider.replaceKey(); if (replaceKey == null) { @@ -186,18 +197,18 @@ public class EastRegionContainerPane extends UIEastResizableContainer { replaceItem.setReplace(false); } } - + private void initPluginPane() { - + ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign); Set providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG); for (PropertyItemPaneProvider provider : providers) { addPropertyItem(provider); } } - + private void addPropertyItem(PropertyItemPaneProvider provider) { - + String key = provider.key(); PropertyItemBean itemBean = provider.getItem(); PropertyItem propertyItem = new PropertyItem(itemBean.getName(), @@ -212,7 +223,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { button.addActionListener(buttonListener); } propertyItemMap.put(key, propertyItem); - + String replaceKey = provider.replaceKey(); if (replaceKey == null) { return; @@ -221,11 +232,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer { if (replaceItem != null) { replaceItem.setReplace(true); } - + } - + private void initPropertyItemList() { - + propertyItemMap = new LinkedHashMap<>(); // 有序map // 单元格元素 PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Element"), @@ -240,7 +251,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { "floatelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT}); // 控件设置 - PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Settings"), + PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings"), "widgetsettings", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART}); // 条件属性 @@ -474,24 +485,30 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void replaceAuthorityEditionPane(JComponent pane) { propertyItemMap.get(KEY_AUTHORITY_EDITION).replaceContentPane(pane); } - + public JComponent getAuthorityEditionPane() { return propertyItemMap.get(KEY_AUTHORITY_EDITION).getContentPane(); } - + public void replaceConfiguredRolesPane(JComponent pane) { propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane); } - public void replaceKeyPane(String key, JComponent pane) { + public void replaceKeyPane(final String key, final JComponent pane) { - propertyItemMap.get(key).replaceContentPane(pane); + //需要放到 ui 线程中处理 + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + propertyItemMap.get(key).replaceContentPane(pane); + } + }); } - + public JComponent getConfiguredRolesPane() { return propertyItemMap.get(KEY_CONFIGURED_ROLES).getContentPane(); } - + public void addParameterPane(JComponent paraPane) { propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceHeaderPane(paraPane); } @@ -653,8 +670,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private String iconSuffix = ICON_SUFFIX_NORMAL; // normal, diabled, selected, 三者之一 private final Color selectedBtnBackground = new Color(0xF5F5F7); private Color originBtnBackground; - - + + public PropertyItem(String name, String title, String btnIconName, PropertyMode[] visibleModes, PropertyMode[] enableModes) { this(name, title, btnIconName, ICON_BASE_DIR, visibleModes, enableModes); } @@ -705,12 +722,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void setVisible(boolean isVisible) { this.isVisible = isVisible; } - + public void setReplace(boolean replace) { - + this.replace = replace; } - + public boolean isEnabled() { return isEnabled; } @@ -720,16 +737,16 @@ public class EastRegionContainerPane extends UIEastResizableContainer { this.isEnabled = isEnabled; button.setEnabled(isEnabled); } - + public void setIconBaseDir(String iconBaseDir) { this.iconBaseDir = iconBaseDir; } - + private String getIconBaseDir() { - + return StringUtils.isEmpty(iconBaseDir) ? ICON_BASE_DIR : iconBaseDir; } - + private void initPropertyPanel() { propertyPanel = new JPanel(); propertyPanel.setBackground(Color.pink); @@ -810,7 +827,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } private String getBtnIconUrl() { - + return getIconBaseDir() + btnIconName + iconSuffix; } From e4679bbb8ea55a4f7e866b7cd39e8fa91a2eb793 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 May 2020 16:05:24 +0800 Subject: [PATCH 54/76] =?UTF-8?q?=E5=90=88=E4=BB=A3=E7=A0=81=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 661b4fa5c..88d2625d0 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -8,12 +8,14 @@ import com.fr.base.Utils; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; +import com.fr.design.dialog.ErrorDialog; import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.LocalDesignerWorkspaceInfo; import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.notification.SnapChatConfig; @@ -21,6 +23,7 @@ import com.fr.design.update.push.DesignerPushUpdateConfigManager; import com.fr.design.style.color.ColorSelectConfigManager; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignerPort; +import com.fr.exit.DesignerExiter; import com.fr.file.FILEFactory; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogFormatter; @@ -55,6 +58,7 @@ import javax.swing.SwingWorker.StateValue; import java.awt.Color; import java.awt.Rectangle; import java.io.File; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; @@ -83,6 +87,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private static final String VERSION_80 = "80"; private static final int CACHINGTEMPLATE_LIMIT = 5; private static final String WEB_NAME = "webapps"; + /** + * 指定默认工作空间 + */ + public static final String DEFAULT_WORKSPACE_PATH = "fr.designer.workspace.default"; private static DesignerEnvManager designerEnvManager; // gui. private String activationKey = null; @@ -199,6 +207,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { GeneralContext.setLocale(designerEnvManager.getLanguage()); try { XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile()); + } catch (FileNotFoundException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + XmlHandler.Self.handle(e); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -347,6 +358,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); + XmlHandler.Self.handle(e); } finally { if (null != fileWriter) { try { @@ -561,6 +573,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private String getDefaultenvPath(String installHome) { + String defaultWorkspacePath = System.getProperty(DEFAULT_WORKSPACE_PATH); + if (defaultWorkspacePath != null) { + return defaultWorkspacePath; + } //这里需要转成反斜杠和生成默认路径一致 return new File(StableUtils.pathJoin(installHome, WEB_NAME, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME)).getPath(); } @@ -1403,6 +1419,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { /** * 对国际化进行校验 * 非简繁英日韩的默认环境 设计器全部默认为英文版本 + * * @param locale * @return */ @@ -1554,7 +1571,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { readVcsAttr(reader); } else if (DesignerPort.XML_TAG.equals(name)) { readDesignerPort(reader); - } else if (name.equals(SnapChatConfig.XML_TAG)) { + }else if (name.equals(SnapChatConfig.XML_TAG)) { readSnapChatConfig(reader); } else { readLayout(reader, name); @@ -2050,4 +2067,28 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { public void setVcsConfigManager(VcsConfigManager vcsConfigManager) { this.vcsConfigManager = vcsConfigManager; } + + enum XmlHandler { + Self; + public void handle(Throwable throwable) { + ErrorDialog dialog = new ErrorDialog(null, + Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"), + Toolkit.i18nText("Fine-Design_Error_Start_Report"), + throwable.getMessage()) { + @Override + protected void okEvent() { + dispose(); + DesignerExiter.getInstance().execute(); + } + + @Override + protected void restartEvent() { + dispose(); + RestartHelper.restart(); + } + }; + dialog.setVisible(true); + DesignerExiter.getInstance().execute(); + } + }; } From 43894e0d3fe0d1acde3017ef544c017482b51d3a Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 28 May 2020 13:44:59 +0800 Subject: [PATCH 55/76] =?UTF-8?q?REPORT-31879=20gauss=E8=A1=A8=E7=9A=84?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E8=8E=B7=E5=8F=96=E4=B8=8D=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/data/datapane/ChoosePane.java | 32 ++++++++++++------- .../design/present/dict/DatabaseDictPane.java | 10 ++++-- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java index eda641467..ca761bb57 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java @@ -1,10 +1,10 @@ package com.fr.design.data.datapane; -import com.fr.base.BaseUtils; import com.fr.base.TableData; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.DBUtils; import com.fr.data.core.db.TableProcedure; +import com.fr.data.core.db.dialect.Dialect; import com.fr.data.core.db.dialect.DialectFactory; import com.fr.data.impl.Connection; import com.fr.data.impl.DBTableData; @@ -38,11 +38,7 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; -import javax.swing.JList; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JTree; -import javax.swing.SwingWorker; +import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.PopupMenuEvent; @@ -53,9 +49,7 @@ import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; +import java.awt.*; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.ItemEvent; @@ -455,6 +449,15 @@ public class ChoosePane extends BasicBeanPane implements Refresha * @return 数据集数据 */ public TableData createSelectTableData() { + return createSelectTableData(new SelectSqlProcessor() { + @Override + public String createSelectSql(String schema, String tableName, Dialect dialect) { + return DataCoreUtils.createSelectSQL(schema, tableName, dialect); + } + }); + } + + public TableData createSelectTableData(SelectSqlProcessor sqlProcessor) { DataBaseItems paras = this.updateBean(); boolean connect = false; com.fr.data.impl.Connection database = DBUtils.checkDBConnection(paras.getDatabaseName()); @@ -477,11 +480,11 @@ public class ChoosePane extends BasicBeanPane implements Refresha TableData tableData = null; if (WorkContext.getCurrent().isLocal()) { - tableData = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), + tableData = new DBTableData(database, sqlProcessor.createSelectSql(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName()))); } else { try { - TableData tableDataLocal = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName()))); + TableData tableDataLocal = new DBTableData(database, sqlProcessor.createSelectSql(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName()))); tableData = DataOperator.getInstance().previewTableData(tableDataLocal, java.util.Collections.EMPTY_MAP, DesignerEnvManager.getEnvManager().getMaxNumberOrPreviewRow()); } catch (Exception e) { @@ -591,6 +594,13 @@ public class ChoosePane extends BasicBeanPane implements Refresha }); } + /** + * 数据集选择面板里的生成sql语句的接口 + */ + public interface SelectSqlProcessor { + String createSelectSql(String schema, String tableName, Dialect dialect); + } + protected class StringUIComboBox extends UIComboBox { private boolean refreshingModel = false; diff --git a/designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java b/designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java index 668bcd9be..7ffb4e61e 100644 --- a/designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java +++ b/designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java @@ -2,7 +2,9 @@ package com.fr.design.present.dict; import com.fr.base.BaseFormula; import com.fr.base.TableData; +import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.DBUtils; +import com.fr.data.core.db.dialect.Dialect; import com.fr.data.impl.DatabaseDictionary; import com.fr.data.impl.NameDatabaseConnection; import com.fr.design.beans.FurtherBasicBeanPane; @@ -23,7 +25,6 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; - import com.fr.stable.StringUtils; import javax.swing.*; @@ -215,7 +216,12 @@ public class DatabaseDictPane extends FurtherBasicBeanPane i * */ public void dbChange() { - TableData tableData = this.chooseTable.createSelectTableData(); + TableData tableData = this.chooseTable.createSelectTableData(new ChoosePane.SelectSqlProcessor() { + @Override + public String createSelectSql(String schema, String tableName, Dialect dialect) { + return DataCoreUtils.createColumnSelectSQL(schema, tableName, dialect); + } + }); String[] columnNames = DesignTableDataManager.getColumnNamesByTableData(tableData).toArray(new String[0]); ColumnNameEditor columnNameEditor1 = new ColumnNameEditor(columnNames); columnNameEditor1.addItemListener(itemListener); From 775438b1f890a36082da0d405d4ca4ffcbbbb48c Mon Sep 17 00:00:00 2001 From: Bruce Date: Thu, 28 May 2020 18:11:17 +0800 Subject: [PATCH 56/76] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E6=89=93=E5=8C=85=E5=A4=B1=E8=B4=A5=EF=BC=8C=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 37 ------------------- 1 file changed, 37 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 9d59ef187..595f812af 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -270,43 +270,6 @@ public class EnvChangeEntrance { } } - /** - * 对选择的环境做服务检测 - * @param selectedEnv 选择的工作环境 - */ - public void showServiceDialog(DesignerWorkspaceInfo selectedEnv) throws Exception { - //是否需要做服务校验 - if(needCheckBranch(selectedEnv)) { - String localBranch; - String remoteBranch; - WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection(); - localBranch = GeneralUtils.readFullBuildNO(); - try { - remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch(); - } catch (WorkspaceConnectionException e) { - remoteBranch = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") + formatBranch(localBranch); - } - //通过是否包含#来避免当前版本为非安装版本(主要是内部开发版本) - if (localBranch.contains("#") && localBranch.equals(remoteBranch)) { - //说明版本一致,仅做日志记录 - FineLoggerFactory.getLogger().info("Remote Designer version consistency"); - } else { - localBranch = formatBranch(localBranch); - remoteBranch = formatBranch(remoteBranch); - Set noExistServiceSet = getNoExistServiceSet(connectionInfo); - StringBuilder textBuilder = new StringBuilder(); - for (Class clazz : noExistServiceSet) { - WorkspaceAPI workspaceAPI = (WorkspaceAPI) clazz.getAnnotation(WorkspaceAPI.class); - String descriptionOfCN = InterProviderFactory.getProvider().getLocText(workspaceAPI.description()); - textBuilder.append(descriptionOfCN).append("\n"); - } - String areaText = textBuilder.toString(); - CheckServiceDialog dialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), areaText, localBranch, remoteBranch); - dialog.setVisible(true); - } - } - } - /** * 判断是否需要做版本验证,判断依据为 * 1、选择的环境为远程环境 From e347eae9ddbf7415d09b27843c0f940eb03133b8 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 28 May 2020 18:50:42 +0800 Subject: [PATCH 57/76] =?UTF-8?q?=E6=97=A0jira=20feature=E6=89=93=E5=8C=85?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/DesignerFrame.java | 3 ++- .../java/com/fr/design/os/impl/MacOsAddListenerAction.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 2cf8d8c35..69a262bdf 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -509,7 +509,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta if (OperatingSystem.isMacos()) { Class clazz = Class.forName("com.apple.eawt.Application"); BufferedImage icon = image.isEmpty() ? IOUtils.readImage("/com/fr/base/images/oem/logo.png") : image.get(image.size() - 1); - Reflect.on(Reflect.on(clazz).call("getApplication").get()).call("setDockIconImage", icon); + Object application = Reflect.on(clazz).call("getApplication").get(); + Reflect.on(application).call("setDockIconImage", icon); } else { this.setIconImages(image); } diff --git a/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java b/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java index 1ff796a1d..6386ecd73 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java @@ -28,7 +28,8 @@ public class MacOsAddListenerAction implements OSBasedAction { Object quitInstance = getProxy(quitHandler, "handleQuitRequestWith", new QuitAction()); Class aboutHandler = Class.forName("com.apple.eawt.AboutHandler"); Object aboutInstance = getProxy(aboutHandler, "handleAbout", new AboutAction()); - Reflect.on(Reflect.on(app).call("getApplication").get()).call("setQuitHandler", quitInstance) + Object application = Reflect.on(app).call("getApplication").get(); + Reflect.on(application).call("setQuitHandler", quitInstance) .call("setAboutHandler", aboutInstance); } catch (ClassNotFoundException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); From 2b32762482309867d625fed1d9e001627dd824d8 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 29 May 2020 11:23:11 +0800 Subject: [PATCH 58/76] =?UTF-8?q?KERNEL-4069=20=E9=85=8D=E5=90=88=E5=AE=8C?= =?UTF-8?q?=E6=88=90JDK11=E6=9E=84=E5=BB=BA=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E7=9A=84=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/frpane/UIBubbleFloatPane.java | 2 +- .../ui/rsyntaxtextarea/RSyntaxTextArea.java | 13 +- .../com/fr/design/utils/AWTUtilities.java | 200 ++++++++++++++++++ .../main/java/com/fr/start/SplashWindow.java | 3 +- 4 files changed, 204 insertions(+), 14 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/utils/AWTUtilities.java diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java index c41cc9f7a..0297353ee 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java @@ -2,9 +2,9 @@ package com.fr.design.gui.frpane; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.UIDialog; +import com.fr.design.utils.AWTUtilities; import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; -import com.sun.awt.AWTUtilities; import javax.swing.JComponent; import javax.swing.JPanel; diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextArea.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextArea.java index 30fc7b871..9cdc3b0ef 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextArea.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextArea.java @@ -9,16 +9,7 @@ */ package com.fr.design.gui.syntax.ui.rsyntaxtextarea; -import java.awt.Color; -import java.awt.Cursor; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Insets; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.RenderingHints; +import java.awt.*; import java.awt.datatransfer.Clipboard; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -604,7 +595,7 @@ private boolean fractionalFontMetricsEnabled; SecurityManager sm = System.getSecurityManager(); if (sm!=null) { try { - sm.checkSystemClipboardAccess(); + sm.checkPermission(new AWTPermission("accessClipboard")); } catch (SecurityException se) { UIManager.getLookAndFeel().provideErrorFeedback(null); return; diff --git a/designer-base/src/main/java/com/fr/design/utils/AWTUtilities.java b/designer-base/src/main/java/com/fr/design/utils/AWTUtilities.java new file mode 100644 index 000000000..12bf2ac4d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/utils/AWTUtilities.java @@ -0,0 +1,200 @@ +package com.fr.design.utils; + +import sun.awt.SunToolkit; + +import java.awt.*; + +/** + * 适配jdk10之后被移除的 com.sun.awt.AWTUtilities + * 参照 https://github.com/frohoff/jdk8u-dev-jdk/blob/master/src/share/classes/com/sun/awt/AWTUtilities.java中实现 + * + * @author hades + * @version 10.0 + * Created by hades on 2020/5/29 + */ +public class AWTUtilities { + + /** + * @param window the window to set the shape to + * @param shape the shape to set to the window + * + */ + public static void setWindowShape(Window window, Shape shape) { + if (window == null) { + throw new NullPointerException("The window argument should not be null."); + } + window.setShape(shape); + } + + /** + * + * + * @param window the window to set the shape to + * @param opaque whether the window must be opaque (true), + * or translucent (false) + * + */ + public static void setWindowOpaque(Window window, boolean opaque) { + if (window == null) { + throw new NullPointerException("The window argument should not be null."); + } + if (!opaque && !isTranslucencySupported(Translucency.PERPIXEL_TRANSLUCENT)) { + throw new UnsupportedOperationException("The PERPIXEL_TRANSLUCENT translucency kind is not supported"); + } + Color color = window.getBackground(); + if (color == null) { + color = new Color(0, 0, 0, 0); + } + window.setBackground(new Color(color.getRed(), color.getGreen(), color.getBlue(), opaque ? 255 : 0)); + } + + + public static enum Translucency { + /** + * Represents support in the underlying system for windows each pixel + * of which is guaranteed to be either completely opaque, with + * an alpha value of 1.0, or completely transparent, with an alpha + * value of 0.0. + */ + PERPIXEL_TRANSPARENT, + + /** + * Represents support in the underlying system for windows all of + * the pixels of which have the same alpha value between or including + * 0.0 and 1.0. + */ + TRANSLUCENT, + + /** + * Represents support in the underlying system for windows that + * contain or might contain pixels with arbitrary alpha values + * between and including 0.0 and 1.0. + */ + PERPIXEL_TRANSLUCENT; + } + + + /** + * Returns whether the given level of translucency is supported by + * the underlying system. + * + * Note that this method may sometimes return the value + * indicating that the particular level is supported, but + * the native windowing system may still not support the + * given level of translucency (due to the bugs in + * the windowing system). + * + * @param translucencyKind a kind of translucency support + * (either PERPIXEL_TRANSPARENT, + * TRANSLUCENT, or PERPIXEL_TRANSLUCENT) + * @return whether the given translucency kind is supported + */ + private static boolean isTranslucencySupported(Translucency translucencyKind) { + switch (translucencyKind) { + case PERPIXEL_TRANSPARENT: + return isWindowShapingSupported(); + case TRANSLUCENT: + return isWindowOpacitySupported(); + case PERPIXEL_TRANSLUCENT: + return isWindowTranslucencySupported(); + } + return false; + } + + /** + * Returns whether the windowing system supports changing the opacity + * value of top-level windows. + * Note that this method may sometimes return true, but the native + * windowing system may still not support the concept of + * translucency (due to the bugs in the windowing system). + */ + private static boolean isWindowOpacitySupported() { + Toolkit curToolkit = Toolkit.getDefaultToolkit(); + if (!(curToolkit instanceof SunToolkit)) { + return false; + } + return ((SunToolkit)curToolkit).isWindowOpacitySupported(); + } + + /** + * Returns whether the windowing system supports changing the shape + * of top-level windows. + * Note that this method may sometimes return true, but the native + * windowing system may still not support the concept of + * shaping (due to the bugs in the windowing system). + */ + private static boolean isWindowShapingSupported() { + Toolkit curToolkit = Toolkit.getDefaultToolkit(); + if (!(curToolkit instanceof SunToolkit)) { + return false; + } + return ((SunToolkit)curToolkit).isWindowShapingSupported(); + } + + private static boolean isWindowTranslucencySupported() { + /* + * Per-pixel alpha is supported if all the conditions are TRUE: + * 1. The toolkit is a sort of SunToolkit + * 2. The toolkit supports translucency in general + * (isWindowTranslucencySupported()) + * 3. There's at least one translucency-capable + * GraphicsConfiguration + */ + + Toolkit curToolkit = Toolkit.getDefaultToolkit(); + if (!(curToolkit instanceof SunToolkit)) { + return false; + } + + if (!((SunToolkit)curToolkit).isWindowTranslucencySupported()) { + return false; + } + + GraphicsEnvironment env = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + + // If the default GC supports translucency return true. + // It is important to optimize the verification this way, + // see CR 6661196 for more details. + if (isTranslucencyCapable(env.getDefaultScreenDevice() + .getDefaultConfiguration())) + { + return true; + } + + // ... otherwise iterate through all the GCs. + GraphicsDevice[] devices = env.getScreenDevices(); + + for (int i = 0; i < devices.length; i++) { + GraphicsConfiguration[] configs = devices[i].getConfigurations(); + for (int j = 0; j < configs.length; j++) { + if (isTranslucencyCapable(configs[j])) { + return true; + } + } + } + + return false; + } + + private static boolean isTranslucencyCapable(GraphicsConfiguration gc) { + if (gc == null) { + throw new NullPointerException("The gc argument should not be null"); + } + /* + return gc.isTranslucencyCapable(); + */ + Toolkit curToolkit = Toolkit.getDefaultToolkit(); + if (!(curToolkit instanceof SunToolkit)) { + return false; + } + return ((SunToolkit)curToolkit).isTranslucencyCapable(gc); + } + + + + + + + +} diff --git a/designer-base/src/main/java/com/fr/start/SplashWindow.java b/designer-base/src/main/java/com/fr/start/SplashWindow.java index 0176883f5..b6a012f95 100644 --- a/designer-base/src/main/java/com/fr/start/SplashWindow.java +++ b/designer-base/src/main/java/com/fr/start/SplashWindow.java @@ -2,9 +2,9 @@ package com.fr.start; import com.fr.base.BaseUtils; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.utils.AWTUtilities; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.OperatingSystem; -import com.sun.awt.AWTUtilities; import javax.swing.ImageIcon; import javax.swing.JFrame; @@ -41,7 +41,6 @@ public class SplashWindow extends JFrame { this.setAlwaysOnTop(false); this.setUndecorated(true); AWTUtilities.setWindowOpaque(this, false); - //使窗体背景透明 if (OperatingSystem.isWindows()) { this.setBackground(new Color(0, 0, 0, 0)); From 974e6d677ad2b7715014161851b5a8f391537dc9 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 29 May 2020 11:25:33 +0800 Subject: [PATCH 59/76] =?UTF-8?q?KERNEL-4069=20fix=20=E6=BC=8F=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/alphafine/listener/ComponentHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/listener/ComponentHandler.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/listener/ComponentHandler.java index 1294fd7d0..17f12f9dd 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/listener/ComponentHandler.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/listener/ComponentHandler.java @@ -1,6 +1,6 @@ package com.fr.design.mainframe.alphafine.listener; -import com.sun.awt.AWTUtilities; +import com.fr.design.utils.AWTUtilities; import java.awt.*; import java.awt.event.ComponentAdapter; From 04a90491bfd60a02ec1487cd8e50365557832924 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 1 Jun 2020 10:48:53 +0800 Subject: [PATCH 60/76] =?UTF-8?q?KERNEL-4069=20JDK11=E9=80=82=E9=85=8D=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8=E7=9A=84=E7=B1=BB=E4=B8=8E?= =?UTF-8?q?mac=E4=B8=8B=E7=9A=84=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/extra/LoginWebBridge.java | 12 - .../com/fr/design/extra/PluginWebBridge.java | 7 - .../com/fr/design/extra/QQLoginWebPane.java | 234 ------------------ .../com/fr/design/extra/WebViewDlgHelper.java | 15 -- .../os/impl/MacOsAddListenerAction.java | 11 +- 5 files changed, 10 insertions(+), 269 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java diff --git a/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java b/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java index 471e25109..0862c7447 100644 --- a/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java +++ b/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java @@ -196,18 +196,6 @@ public class LoginWebBridge { uiLabel.setBackground(LOGIN_BACKGROUND); } - /** - * 弹出QQ授权页面 - */ - public void showQQ() { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - WebViewDlgHelper.createQQLoginDialog(); - } - }); - } - /** * 关闭QQ授权窗口 */ diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java b/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java index 10f65fa2b..159e6d6d9 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java @@ -533,13 +533,6 @@ public class PluginWebBridge { threadPoolExecutor.submit(task); } - /** - * 弹出QQ授权页面 - */ - public void showQQ() { - LoginWebBridge.getHelper().showQQ(); - } - /** * 通过QQ登录后通知登录 */ diff --git a/designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java b/designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java deleted file mode 100644 index 9c56738b4..000000000 --- a/designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java +++ /dev/null @@ -1,234 +0,0 @@ -package com.fr.design.extra; - -import com.fr.design.dialog.FineJOptionPane; -import com.fr.general.CloudCenter; -import com.fr.general.ComparatorUtils; -import com.fr.general.IOUtils; -import com.fr.log.FineLoggerFactory; -import javafx.application.Platform; -import javafx.beans.property.BooleanProperty; -import javafx.beans.property.SimpleBooleanProperty; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; -import javafx.concurrent.Worker; -import javafx.embed.swing.JFXPanel; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.scene.Group; -import javafx.scene.Node; -import javafx.scene.Scene; -import javafx.scene.control.ButtonBuilder; -import javafx.scene.control.LabelBuilder; -import javafx.scene.input.MouseEvent; -import javafx.scene.layout.BorderPane; -import javafx.scene.layout.HBox; -import javafx.scene.layout.HBoxBuilder; -import javafx.scene.paint.Color; -import javafx.scene.web.WebEngine; -import javafx.scene.web.WebEvent; -import javafx.scene.web.WebView; -import javafx.stage.Modality; -import javafx.stage.Screen; -import javafx.stage.Stage; -import javafx.stage.StageStyle; -import javafx.stage.WindowEvent; -import javafx.util.Callback; -import netscape.javascript.JSObject; - -import javax.swing.JOptionPane; -import javax.swing.SwingUtilities; -import java.awt.Toolkit; - -/** - * Created by zhaohehe on 16/7/28. - */ -public class QQLoginWebPane extends JFXPanel { - - private WebEngine webEngine; - private String url; - - private static JSObject window; - - private static int DEFAULT_PRIMARYSTAGE_WIDTH = 100; - private static int DEFAULT_PRIMARYSTAGE_HEIGHT = 100; - - private static int DEFAULT_CONFIRM_WIDTH = 450; - private static int DEFAULT_CONFIRM_HEIGHT = 160; - private static int DEFAULT_OFFEST = 20; - - class Delta { - double x, y; - } - - public QQLoginWebPane(final String installHome) { - Platform.setImplicitExit(false); - Platform.runLater(new Runnable() { - @Override - public void run() { - BorderPane root = new BorderPane(); - Scene scene = new Scene(root); - QQLoginWebPane.this.setScene(scene); - final WebView webView = new WebView(); - webEngine = webView.getEngine(); - url = "file:///" + installHome + "/scripts/qqLogin.html"; - webEngine.load(url); - - final Stage primaryStage = new Stage(); - - HBox layout = new HBox(); - try { - primaryStage.initStyle(StageStyle.TRANSPARENT); - primaryStage.setScene(new Scene(layout)); - webView.getScene().getStylesheets().add(IOUtils.getResource("modal-dialog.css", getClass()).toExternalForm()); - primaryStage.initStyle(StageStyle.UTILITY); - primaryStage.setScene(new Scene(new Group(), DEFAULT_PRIMARYSTAGE_WIDTH, DEFAULT_PRIMARYSTAGE_HEIGHT)); - primaryStage.setX(0); - primaryStage.setY(Screen.getPrimary().getBounds().getHeight() + DEFAULT_PRIMARYSTAGE_HEIGHT); - primaryStage.show(); - } catch (Exception e) { - FineLoggerFactory.getLogger().info(e.getMessage()); - } - webEngine.setConfirmHandler(new Callback() { - @Override - public Boolean call(String msg) { - Boolean confirmed = confirm(primaryStage, msg, webView); - return confirmed; - } - }); - configWebEngine(); - webView.setContextMenuEnabled(false);//屏蔽右键 - root.setCenter(webView); - } - }); - } - - private void configWebEngine() { - - webEngine.locationProperty().addListener(new ChangeListener() { - @Override - public void changed(ObservableValue observable, final String oldValue, String newValue) { - disableLink(webEngine); - // webView好像默认以手机版显示网页,浏览器里过滤掉这个跳转 - if (ComparatorUtils.equals(newValue, url) || ComparatorUtils.equals(newValue, CloudCenter.getInstance().acquireUrlByKind("bbs.mobile"))) { - return; - } - LoginWebBridge.getHelper().openUrlAtLocalWebBrowser(webEngine, newValue); - } - }); - - webEngine.setOnAlert(new EventHandler>() { - @Override - public void handle(WebEvent event) { - showAlert(event.getData()); - } - }); - - webEngine.getLoadWorker().stateProperty().addListener( - new ChangeListener() { - public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) { - if (newState == Worker.State.SUCCEEDED) { - window = (JSObject) webEngine.executeScript("window"); - window.setMember("QQLoginHelper", LoginWebBridge.getHelper()); - } - } - } - ); - } - - private void showAlert(final String message) { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - FineJOptionPane.showMessageDialog(QQLoginWebPane.this, message); - } - }); - } - - private void disableLink(final WebEngine eng) { - try { - // webView端不跳转 虽然webView可以指定本地浏览器打开某个链接,但是当本地浏览器跳转到指定链接的同时,webView也做了跳转, - // 为了避免出现在一个600*400的资讯框里加载整个网页的情况,webView不跳转到新网页 - Platform.runLater(new Runnable() { - @Override - public void run() { - eng.executeScript("location.reload()"); - LoginWebBridge.getHelper().closeQQWindow(); - } - }); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - - private Boolean confirm(final Stage parent, String msg, final WebView webView) { - final BooleanProperty confirmationResult = new SimpleBooleanProperty(); - // initialize the confirmation dialog - final Stage dialog = new Stage(StageStyle.UTILITY); - dialog.setX(Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 2 - DEFAULT_CONFIRM_WIDTH / 2.0D + DEFAULT_OFFEST); - dialog.setY(Toolkit.getDefaultToolkit().getScreenSize().getHeight() / 2 + DEFAULT_OFFEST); - dialog.setHeight(DEFAULT_CONFIRM_HEIGHT); - dialog.setWidth(DEFAULT_CONFIRM_WIDTH); - dialog.setIconified(false); - dialog.initOwner(parent); - dialog.initModality(Modality.WINDOW_MODAL); - dialog.setScene( - new Scene( - HBoxBuilder.create().styleClass("modal-dialog").children( - LabelBuilder.create().text(msg).build(), - ButtonBuilder.create().text(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_BBSLogin_Switch_Account")).defaultButton(true).onAction(new EventHandler() { - @Override - public void handle(ActionEvent actionEvent) { - // take action and close the dialog. - confirmationResult.set(true); - webView.getEngine().reload(); - dialog.close(); - } - }).build(), - ButtonBuilder.create().text(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_Cancel")).cancelButton(true).onAction(new EventHandler() { - @Override - public void handle(ActionEvent actionEvent) { - // abort action and close the dialog. - confirmationResult.set(false); - dialog.close(); - } - }).build() - ).build() - , Color.TRANSPARENT - ) - ); - configDrag(dialog); - // style and show the dialog. - dialog.getScene().getStylesheets().add(IOUtils.getResource("modal-dialog.css", getClass()).toExternalForm()); - dialog.setOnCloseRequest(new EventHandler() { - @Override - public void handle(WindowEvent event) { - event.consume(); - dialog.close(); - } - }); - dialog.showAndWait(); - return confirmationResult.get(); - } - - private void configDrag(final Stage dialog) { - // allow the dialog to be dragged around. - final Node root = dialog.getScene().getRoot(); - final Delta dragDelta = new Delta(); - - root.setOnMousePressed(new EventHandler() { - @Override - public void handle(MouseEvent mouseEvent) { - // record a delta distance for the drag and drop operation. - dragDelta.x = dialog.getX() - mouseEvent.getScreenX(); - dragDelta.y = dialog.getY() - mouseEvent.getScreenY(); - } - }); - root.setOnMouseDragged(new EventHandler() { - @Override - public void handle(MouseEvent mouseEvent) { - dialog.setX(mouseEvent.getScreenX() + dragDelta.x); - dialog.setY(mouseEvent.getScreenY() + dragDelta.y); - } - }); - } -} diff --git a/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java b/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java index 47d154146..2dea7108e 100644 --- a/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java +++ b/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java @@ -184,21 +184,6 @@ public class WebViewDlgHelper { } } - public static void createQQLoginDialog() { - try { - Class clazz = Class.forName("com.fr.design.extra.QQLoginWebPane"); - Constructor constructor = clazz.getConstructor(String.class); - Component webPane = (Component) constructor.newInstance(new File(installHome).getAbsolutePath()); - - UIDialog qqLoginDialog = new QQLoginDialog(DesignerContext.getDesignerFrame(), webPane); - LoginWebBridge.getHelper().setQQDialog(qqLoginDialog); - qqLoginDialog.setVisible(true); - } catch (Throwable ignored) { - // ignored - } - } - - private static void confirmDownLoadShopJS() { int rv = FineJOptionPane.showConfirmDialog( null, diff --git a/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java b/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java index 6386ecd73..3dd462b8f 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java @@ -9,6 +9,7 @@ import com.fr.invoke.Reflect; import com.fr.log.FineLoggerFactory; import com.fr.stable.os.support.OSBasedAction; +import java.awt.*; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; @@ -32,7 +33,15 @@ public class MacOsAddListenerAction implements OSBasedAction { Reflect.on(application).call("setQuitHandler", quitInstance) .call("setAboutHandler", aboutInstance); } catch (ClassNotFoundException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + try { + Class quitHandler = Class.forName("java.awt.desktop.QuitHandler"); + Object quitInstance = getProxy(quitHandler, "handleQuitRequestWith", new QuitAction()); + Class aboutHandler = Class.forName("java.awt.desktop.AboutHandler"); + Object aboutInstance = getProxy(aboutHandler, "handleAbout", new AboutAction()); + Reflect.on(Desktop.getDesktop()).call("setQuitHandler", quitInstance).call("setAboutHandler", aboutInstance); + } catch (ClassNotFoundException ex) { + FineLoggerFactory.getLogger().error(ex.getMessage(), ex); + } } } From ff753001c487d64032ecb95aef35b7cffe418701 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 1 Jun 2020 11:50:11 +0800 Subject: [PATCH 61/76] =?UTF-8?q?KERNEL-4069=20=E6=B7=BB=E5=8A=A0=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/os/impl/MacOsAddListenerAction.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java b/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java index 3dd462b8f..d2ab57620 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java @@ -15,6 +15,10 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy; /** + * com.apple.eawt.Application属于jdk1.8及以下mac jdk特有的api + * 在jdk9中被移除,由Desktop.getDesktop().setQuitHandler等jdk9.0引入的新api替代 + * 参见 https://stackoverflow.com/questions/38381824/how-can-i-use-apple-com-apple-eawt-functionality-on-java-8 + * * @author hades * @version 10.0 * Created by hades on 2020/3/13 @@ -33,6 +37,8 @@ public class MacOsAddListenerAction implements OSBasedAction { Reflect.on(application).call("setQuitHandler", quitInstance) .call("setAboutHandler", aboutInstance); } catch (ClassNotFoundException e) { + // 上面的不能移除,同时要保证再jdk1.8下面能运行 + // 抛出异常时 说明使用>=jdk9运行行设计器,但由于编译使用1.8构建,使用反射运行 try { Class quitHandler = Class.forName("java.awt.desktop.QuitHandler"); Object quitInstance = getProxy(quitHandler, "handleQuitRequestWith", new QuitAction()); From f47a1d27867415a133400d32652627042510f82e Mon Sep 17 00:00:00 2001 From: hiram Date: Tue, 2 Jun 2020 09:56:03 +0800 Subject: [PATCH 62/76] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20gradle?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index ebec6e770..011268767 100644 --- a/build.gradle +++ b/build.gradle @@ -14,11 +14,12 @@ ext { languageLevelSetting = 1.8 } -apply from: 'globalConfigHook.gradle' +applyGlobalConfigPathIfExist() -if(versions.frVersion){ - frVersion = versions.frVersion +if (versions.frVersion) { + frVersion = versions.frVersion } +def frDevVersion = "DEV" + frVersion dependencies { api project(':designer-base') @@ -33,7 +34,7 @@ allprojects { apply plugin: 'idea' group 'com.fr.design' - version frVersion + version frDevVersion sourceCompatibility = languageLevelSetting targetCompatibility = languageLevelSetting @@ -72,7 +73,7 @@ allprojects { implementation 'com.fr.datasource:fine-datasource:' + frVersion implementation 'com.fr.decision:fine-decision:' + frVersion implementation 'com.fr.schedule:fine-schedule:' + frVersion - implementation 'com.fr.report:fine-report-engine:' + frVersion + implementation 'com.fr.report:fine-report-engine:' + frDevVersion testImplementation 'org.easymock:easymock:3.5.1' testImplementation 'org.powermock:powermock-module-junit4:1.7.1' testImplementation 'org.powermock:powermock-api-easymock:1.7.1' From cb90f91fc72f9edd72bd5266d210a37f70352099 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 5 Jun 2020 18:15:24 +0800 Subject: [PATCH 63/76] =?UTF-8?q?REPORT-32149=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8A=A0=E5=AF=86=E3=80=91@harrison=E4=B8=A4=E4=B8=AA=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=BF=9B=E8=A1=8C=E6=8B=96=E5=85=A5=EF=BC=8C=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E9=A2=84=E8=A7=88=E5=BE=88=E5=A5=87=E6=80=AA=20[?= =?UTF-8?q?=E5=85=B3=E8=81=94=E5=9C=BA=E6=99=AF]=20https://kms.fineres.com?= =?UTF-8?q?/pages/viewpage.action=3FpageId=3D116725800=20[=E5=A4=84?= =?UTF-8?q?=E7=90=86=E6=96=B9=E6=A1=88]=201=E3=80=81=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=20creator=202=E3=80=81=E5=AF=B9=20creator=20?= =?UTF-8?q?=E7=9A=84=E5=90=8D=E5=AD=97=E8=BF=9B=E8=A1=8C=E5=A4=84=E7=90=86?= =?UTF-8?q?=E3=80=82=203=E3=80=81=E5=AD=98=E5=9C=A8=20widgetname=20?= =?UTF-8?q?=EF=BC=8C=20=E8=AF=B4=E6=98=8E=E5=B7=B2=E7=BB=8F=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E4=BA=86=EF=BC=8C=20=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E9=80=9A=E8=BF=87=20widgetname=20=E5=A4=84=E7=90=86=204?= =?UTF-8?q?=E3=80=81=E4=B8=8D=E5=AD=98=E5=9C=A8=EF=BC=8C=20=E5=88=99?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E8=B5=8B=E4=BA=88=E4=B8=80=E4=B8=AA=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E7=9A=84=20widgetname?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/models/AddingModel.java | 11 +-- .../designer/beans/models/ModelUtil.java | 60 ++++++++++++ .../beans/models/AddingModelTest.java | 94 +++++++++++++++++++ 3 files changed, 159 insertions(+), 6 deletions(-) create mode 100644 designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java create mode 100644 designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java index 9285b35ca..fd98adc18 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java @@ -26,9 +26,8 @@ public class AddingModel { private boolean added; public AddingModel(FormDesigner designer, XCreator xCreator) { - String creatorName = getXCreatorName(designer, xCreator); this.creator = xCreator; - instantiateCreator(designer, creatorName); + instantiateCreator(designer); // 初始的时候隐藏该组件的图标 currentY = -this.creator.getWidth(); currentX = -this.creator.getHeight(); @@ -37,11 +36,11 @@ public class AddingModel { /** * 待说明 * - * @param designer 设计器 - * @param creatorName 组件名 + * @param designer 设计器 */ - public void instantiateCreator(FormDesigner designer, String creatorName) { - creator.toData().setWidgetName(creatorName); + public void instantiateCreator(FormDesigner designer) { + + ModelUtil.renameWidgetName(designer.getTarget(), creator); ComponentAdapter adapter = new CompositeComponentAdapter(designer, creator); adapter.initialize(); creator.addNotify(); diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java new file mode 100644 index 000000000..e1efd3141 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java @@ -0,0 +1,60 @@ +package com.fr.design.designer.beans.models; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.form.main.Form; +import com.fr.form.ui.Widget; +import com.fr.stable.StringUtils; + +import java.util.HashSet; +import java.util.Set; + +/** + * created by Harrison on 2020/06/05 + **/ +abstract class ModelUtil { + + public static void renameWidgetName(Form form, XCreator xCreator) { + + Set duplicated = new HashSet<>(); + recursiveRenameWidgetName(form, xCreator, duplicated); + } + + private static void recursiveRenameWidgetName(Form form, XCreator xCreator, Set duplicated) { + + //有可能并不需要对自己处理,而是对其他的组件处理。所以要找到目标值 + XCreator target = xCreator.getXCreator(); + String uniqueName = uniqueName(form, target, duplicated); + target.toData().setWidgetName(uniqueName); + //将名字加入重复集合中 + duplicated.add(uniqueName); + + int count = target.getComponentCount(); + for (int a = 0; a < count; a++) { + if (target.getComponent(a) instanceof XCreator) { + XCreator child = (XCreator) target.getComponent(a); + recursiveRenameWidgetName(form, child, duplicated); + } + } + } + + private static String uniqueName(Form form, XCreator xCreator, Set duplicated) { + + if (xCreator.acceptType(XWParameterLayout.class)) { + return xCreator.createDefaultName(); + } + Widget widget = xCreator.toData(); + String widgetName = widget.getWidgetName(); + if (StringUtils.isEmpty(widgetName)) { + widgetName = xCreator.createDefaultName(); + } + String raw = widgetName; + int i = 0; + while (form.isNameExist(widgetName) || duplicated.contains(widgetName)) { + widgetName = raw + i; + i++; + } + return widgetName; + } + +} diff --git a/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java b/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java new file mode 100644 index 000000000..e7eca1c03 --- /dev/null +++ b/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java @@ -0,0 +1,94 @@ +package com.fr.design.designer.beans.models; + +import com.fr.design.designer.creator.CRPropertyDescriptor; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.mainframe.FormDesigner; +import com.fr.form.main.Form; +import com.fr.form.ui.ChartEditor; +import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.form.ui.container.WTitleLayout; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; + +import javax.swing.JComponent; +import java.awt.Dimension; +import java.awt.Rectangle; +import java.beans.IntrospectionException; + +public class AddingModelTest { + + @Test + public void testInstantiateCreator() throws Exception { + + Dimension dimension = new Dimension(20, 20); + + ChartEditor chartEditor1 = new ChartEditor(); + XCreator xCreator1 = new DemoCreator(chartEditor1, dimension, "test"); + + ChartEditor chartEditor2 = new ChartEditor(); + chartEditor2.setWidgetName("test02"); + XCreator xCreator2 = new DemoCreator(chartEditor2, dimension, "test02"); + xCreator1.add(xCreator2); + + ChartEditor chartEditor3 = new ChartEditor(); + chartEditor3.setWidgetName("test03"); + WAbsoluteLayout.BoundsWidget boundsWidget = new WAbsoluteLayout.BoundsWidget(chartEditor3, new Rectangle(dimension)); + WTitleLayout wTitleLayout03 = new WTitleLayout(); + wTitleLayout03.addWidget(boundsWidget); + DemoCreator xCreator3 = new DemoCreator(wTitleLayout03, dimension, "test03"); + xCreator1.add(xCreator3); + + AddingModel addingModel = new AddingModel(xCreator1, 20, 20); + + Form form = EasyMock.mock(Form.class); + EasyMock.expect(form.isNameExist("test")).andReturn(true).once(); + EasyMock.expect(form.isNameExist("test03")).andReturn(true).once(); + EasyMock.expect(form.isNameExist(EasyMock.anyString())).andReturn(false).anyTimes(); + EasyMock.replay(form); + + FormDesigner mock = EasyMock.mock(FormDesigner.class); + EasyMock.expect(mock.getTarget()).andReturn(form).anyTimes(); + EasyMock.replay(mock); + + addingModel.instantiateCreator(mock); + //没有默认参数, 但已经存在 test + Assert.assertEquals("test0", xCreator1.toData().getWidgetName()); + //直接返回 + Assert.assertEquals("test02", xCreator2.toData().getWidgetName()); + //已经存在,后接0 + Assert.assertEquals("test030", xCreator3.toData().getWidgetName()); + } + + private static class DemoCreator extends XCreator { + + private String widgetName; + + public DemoCreator(Widget ob, Dimension initSize, String widgetName) { + super(ob, initSize); + this.widgetName = widgetName; + } + + @Override + public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { + return new CRPropertyDescriptor[0]; + } + + @Override + protected JComponent initEditor() { + return null; + } + + @Override + protected void initXCreatorProperties() { + + } + + @Override + public String createDefaultName() { + return this.widgetName; + } + } + +} \ No newline at end of file From 4d85a74ecac09cec5ce5fd08350120a9329eadb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 8 Jun 2020 17:33:07 +0800 Subject: [PATCH 64/76] =?UTF-8?q?CHART-11701=20=E4=BB=AA=E8=A1=A8=E7=9B=98?= =?UTF-8?q?=E7=99=BE=E5=88=86=E6=AF=94=E8=AE=BE=E7=BD=AE=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MeterPlotReportDataContentPane.java | 167 ++++++++------ .../table/MeterPlotTableDataContentPane.java | 210 ++++++++++++------ ...eDimensionalPlotReportDataContentPane.java | 27 ++- .../gauge/VanChartGaugeDetailAxisPane.java | 77 ++++--- 4 files changed, 313 insertions(+), 168 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java index c456b2a03..43084ef23 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java @@ -6,11 +6,11 @@ import com.fr.chart.chartattr.MeterPlot; import com.fr.chart.chartdata.MeterReportDefinition; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; - import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.BorderFactory; @@ -20,19 +20,22 @@ import java.awt.Component; /** * 仪表盘 属性表 单元格数据界面 + * * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2012-12-21 下午02:47:57 */ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPane { - - private static final String CATENAME = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Name"); - private static final String NVALUE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Pointer_Value"); - - private TinyFormulaPane singCatePane; - private TinyFormulaPane singValuePane; - private ChartDataFilterPane filterPane; - - public MeterPlotReportDataContentPane(ChartDataPane parent) { + + private static final String CATENAME = Toolkit.i18nText("Fine-Design_Chart_Category_Name"); + private static final String NVALUE = Toolkit.i18nText("Fine-Design_Chart_Pointer_Value"); + private static final String TARGET_VALUE = Toolkit.i18nText("Fine-Design_Chart_Target_Value"); + + private TinyFormulaPane singCatePane; + public TinyFormulaPane singValuePane; + private TinyFormulaPane customPane; + private ChartDataFilterPane filterPane; + + public MeterPlotReportDataContentPane(ChartDataPane parent) { // initEveryPane(); // // List list = new ArrayList(); @@ -41,73 +44,97 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan // seriesPane.populateBean(list); // // seriesPane.noAddUse(); - - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = { p, f }; - double[] rowSize = { p, p, p}; - - Component[][] components = new Component[][]{ - new Component[]{new UILabel(getCateNameString()), getSingCatePane()}, - new Component[]{new UILabel(getNValueString()), singValuePane = new TinyFormulaPane()}, - new Component[]{null, null} - }; - - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components,rowSize,columnSize,24,6); - panel.setBorder(BorderFactory.createEmptyBorder(0,24,0,15)); - - this.setLayout(new BorderLayout()); - this.add(panel, BorderLayout.NORTH); - filterPane = new ChartDataFilterPane(new MeterPlot(), parent); - JPanel pane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"),filterPane); - pane.setBorder(getSidesBorder()); - filterPane.setBorder(getFilterPaneBorder()); - - this.add(pane, BorderLayout.CENTER); - } - - protected String getCateNameString() { - return CATENAME; - } - - protected String getNValueString() { - return NVALUE; - } - - public void populateBean(ChartCollection collection) { - TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); - if(definition instanceof MeterReportDefinition) { - MeterReportDefinition meterDefinition = (MeterReportDefinition)definition; - - if (meterDefinition.getName() != null) { + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = getRowSize(); + + Component[][] components = getShowComponents(); + + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 24, 6); + panel.setBorder(BorderFactory.createEmptyBorder(0, 24, 5, 15)); + + this.setLayout(new BorderLayout()); + this.add(panel, BorderLayout.NORTH); + filterPane = new ChartDataFilterPane(new MeterPlot(), parent); + JPanel pane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), filterPane); + pane.setBorder(getSidesBorder()); + filterPane.setBorder(getFilterPaneBorder()); + + this.add(pane, BorderLayout.CENTER); + } + + protected double[] getRowSize() { + double p = TableLayout.PREFERRED; + return new double[]{p, p, p}; + } + + protected Component[][] getShowComponents() { + return new Component[][]{ + new Component[]{new UILabel(getCateNameString()), getSingCatePane()}, + new Component[]{new UILabel(getNValueString()), singValuePane = new TinyFormulaPane()}, + new Component[]{new UILabel(TARGET_VALUE), customPane = new TinyFormulaPane()} + }; + } + + protected String getCateNameString() { + return CATENAME; + } + + protected String getNValueString() { + return NVALUE; + } + + public void populateBean(ChartCollection collection) { + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + if (definition instanceof MeterReportDefinition) { + MeterReportDefinition meterDefinition = (MeterReportDefinition) definition; + + if (meterDefinition.getName() != null) { populateSingCatePane(meterDefinition.getName().toString()); - } - if (meterDefinition.getValue() != null) { - singValuePane.getUITextField().setText(meterDefinition.getValue().toString()); - } - } - - filterPane.populateBean(collection); - } + } + if (meterDefinition.getValue() != null) { + singValuePane.getUITextField().setText(meterDefinition.getValue().toString()); + } + if (meterDefinition.getTarget() != null) { + populateCustomPane(meterDefinition.getTarget().toString()); + } + } + + filterPane.populateBean(collection); + } + + protected void populateCustomPane(String target) { + customPane.getUITextField().setText(target); + } protected void populateSingCatePane(String name) { singCatePane.getUITextField().setText(name); } public void updateBean(ChartCollection collection) { - - if (collection != null) { - MeterReportDefinition meterDefinition = new MeterReportDefinition(); + + if (collection != null) { + MeterReportDefinition meterDefinition = new MeterReportDefinition(); updateSingCatePane(meterDefinition); - meterDefinition.setValue(canBeFormula(singValuePane.getUITextField().getText())); - - collection.getSelectedChart().setFilterDefinition(meterDefinition); - - filterPane.updateBean(collection); - } - } + meterDefinition.setValue(canBeFormula(singValuePane.getUITextField().getText())); + + updateCustomPane(meterDefinition); + + collection.getSelectedChart().setFilterDefinition(meterDefinition); + + filterPane.updateBean(collection); + } + } + + protected void updateCustomPane(MeterReportDefinition meterDefinition) { + + meterDefinition.setTarget(canBeFormula(customPane.getUITextField().getText())); + + } protected void updateSingCatePane(MeterReportDefinition meterDefinition) { @@ -116,9 +143,9 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan } @Override - protected String[] columnNames() { - return new String[]{"", ""}; - } + protected String[] columnNames() { + return new String[]{"", ""}; + } protected Component getSingCatePane() { return singCatePane = new TinyFormulaPane(); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java index da5c28c5b..3566ab263 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java @@ -4,117 +4,183 @@ import com.fr.base.Utils; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.MeterPlot; import com.fr.chart.chartdata.MeterTableDefinition; +import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.BoldFontTextLabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; - +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.extended.chart.StringFormula; +import com.fr.extended.chart.UIComboBoxWithNone; +import com.fr.general.GeneralUtils; +import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.BorderFactory; +import javax.swing.BoxLayout; import javax.swing.JPanel; +import java.util.List; import java.awt.BorderLayout; import java.awt.Component; -import java.util.List; +import java.awt.Dimension; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; /** * 仪表盘, 属性表, 数据集数据界面. + * * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2012-12-21 下午04:51:50 */ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane { - private static final String METER_NAME = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name"); - private static final String METER_VALUE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Pointer_Value"); - - private UIComboBox nameBox; - private UIComboBox valueBox; - private ChartDataFilterPane filterPane; - - public MeterPlotTableDataContentPane(ChartDataPane parent) { - this.setLayout(new BorderLayout()); - - nameBox = new UIComboBox(); - valueBox = new UIComboBox(); - filterPane = new ChartDataFilterPane(new MeterPlot(), parent); - - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f, COMPONENT_WIDTH}; - double[] rowSize = {p, p}; - - Component[][] components = createComponents(); - - JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"),filterPane); - JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); - - filterPane.setBorder(BorderFactory.createEmptyBorder(0,10,0,15)); - panel.setBorder(BorderFactory.createEmptyBorder(10,24,10,15)); - jPanel.setBorder(BorderFactory.createEmptyBorder(0,12,0,5)); - - this.add(getJSeparator(),BorderLayout.NORTH); - this.add(panel,BorderLayout.CENTER); - this.add(jPanel,BorderLayout.SOUTH); + private static final String METER_NAME = Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name"); + private static final String METER_VALUE = Toolkit.i18nText("Fine-Design_Chart_Pointer_Value"); + private static final String TARGET_VALUE = Toolkit.i18nText("Fine-Design_Chart_Target_Value"); + + private static final int COMBOBOX_WIDTH = 115; + private static final int COMBOBOX_HEIGHT = 20; + + private static final int LABEL_WIDTH = 85; + + private UIComboBox nameBox; + private UIComboBox valueBox; + private UIComboBox targetBox; + private TinyFormulaPane custom; + private ChartDataFilterPane filterPane; + + private JPanel boxPane; + + public MeterPlotTableDataContentPane(ChartDataPane parent) { + this.setLayout(new BorderLayout()); + + nameBox = new UIComboBoxWithNone(); + valueBox = new UIComboBox(); + targetBox = new UIComboBox(); + custom = new TinyFormulaPane(); + filterPane = new ChartDataFilterPane(new MeterPlot(), parent); + + boxPane = new JPanel(); + boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS)); + + JPanel namePane = createPaneWithLabel(Toolkit.i18nText(METER_NAME), getNameComponent()); + boxPane.add(namePane); + + JPanel valuePane = createPaneWithLabel(Toolkit.i18nText(METER_VALUE), valueBox); + boxPane.add(valuePane); + + JPanel targetPane = createPaneWithLabel(Toolkit.i18nText(TARGET_VALUE), targetBox); + boxPane.add(targetPane); + + final JPanel customPane = createPaneWithLabel(StringUtils.EMPTY, custom); + boxPane.add(customPane); + + customPane.setVisible(false); + + initTargetBoxValue(); + targetBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (targetBox.getSelectedIndex() == targetBox.getItemCount() - 1) { + customPane.setVisible(true); + } else { + customPane.setVisible(false); + } + } + }); + + JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), filterPane); + + filterPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); + boxPane.setBorder(BorderFactory.createEmptyBorder(7, 24, 7, 15)); + jPanel.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 5)); + + this.add(getJSeparator(), BorderLayout.NORTH); + this.add(boxPane, BorderLayout.CENTER); + this.add(jPanel, BorderLayout.SOUTH); nameBox.addItemListener(tooltipListener); valueBox.addItemListener(tooltipListener); - } + targetBox.addItemListener(tooltipListener); + } - private Component[][] createComponents() { - return new Component[][]{ - new Component[]{new BoldFontTextLabel(METER_NAME), getNameComponent()}, - new Component[]{new BoldFontTextLabel(METER_VALUE), valueBox}, - }; + private JPanel createPaneWithLabel(String labelName, Component component) { + component.setPreferredSize(new Dimension(COMBOBOX_WIDTH, COMBOBOX_HEIGHT)); + UILabel label = new BoldFontTextLabel(labelName); + label.setPreferredSize(new Dimension(LABEL_WIDTH, COMBOBOX_HEIGHT)); + JPanel paneWithLabel = GUICoreUtils.createBorderLayoutPane(new Component[]{component, null, null, label, null}); + paneWithLabel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0)); + return paneWithLabel; } protected void refreshBoxListWithSelectTableData(List list) { - refreshBoxItems(nameBox, list); - refreshBoxItems(valueBox, list); - } + refreshBoxItems(nameBox, list); + refreshBoxItems(valueBox, list); + refreshBoxItems(targetBox, list); + initTargetBoxValue(); + } /** * 清空所有的box设置 */ - public void clearAllBoxList(){ + public void clearAllBoxList() { clearBoxItems(nameBox); clearBoxItems(valueBox); } - /** - * 更新仪表盘数据界面 - */ - public void populateBean(ChartCollection ob) { - if(ob != null && ob.getSelectedChart().getFilterDefinition() instanceof MeterTableDefinition) { - MeterTableDefinition meter = (MeterTableDefinition)ob.getSelectedChart().getFilterDefinition(); - + private void initTargetBoxValue() { + targetBox.addItem(Toolkit.i18nText("Fine-Design_Chart_Custom")); + targetBox.setSelectedItem(null); + } + + /** + * 更新仪表盘数据界面 + */ + public void populateBean(ChartCollection ob) { + if (ob != null && ob.getSelectedChart().getFilterDefinition() instanceof MeterTableDefinition) { + MeterTableDefinition meter = (MeterTableDefinition) ob.getSelectedChart().getFilterDefinition(); + populateNameComponent(meter); - - valueBox.setSelectedItem(meter.getValue()); - filterPane.populateBean(ob); - } - } + + valueBox.setSelectedItem(meter.getValue()); + custom.getUITextField().setText(meter.getCustomTarget().getContent()); + if (meter.isCustom()) { + targetBox.setSelectedIndex(targetBox.getItemCount() - 1); + } else { + targetBox.setSelectedItem(meter.getTargetValue()); + } + filterPane.populateBean(ob); + } + } protected void populateNameComponent(MeterTableDefinition meter) { nameBox.setSelectedItem(meter.getName()); } /** - * 保存界面属性. - */ - public void updateBean(ChartCollection ob) { - if(ob != null) { - MeterTableDefinition meter = getMeterTableDefinition(); - ob.getSelectedChart().setFilterDefinition(meter); - + * 保存界面属性. + */ + public void updateBean(ChartCollection ob) { + if (ob != null) { + MeterTableDefinition meter = getMeterTableDefinition(); + ob.getSelectedChart().setFilterDefinition(meter); + updateNameComponent(meter); - meter.setValue(Utils.objectToString(valueBox.getSelectedItem())); - filterPane.updateBean(ob); - } - } + meter.setValue(Utils.objectToString(valueBox.getSelectedItem())); + if (targetBox.getSelectedIndex() == targetBox.getItemCount() - 1) { + meter.setCustom(true); + meter.setCustomTarget(new StringFormula(custom.getUITextField().getText())); + } else { + meter.setCustom(false); + meter.setTargetValue(GeneralUtils.objectToString(targetBox.getSelectedItem())); + } + filterPane.updateBean(ob); + } + } - protected MeterTableDefinition getMeterTableDefinition(){ + protected MeterTableDefinition getMeterTableDefinition() { return new MeterTableDefinition(); } @@ -125,9 +191,9 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane /** * 重新布局整个面板 */ - public void redoLayoutPane(){ - filterPane.relayoutPane(this.isNeedSummaryCaculateMethod()); - } + public void redoLayoutPane() { + filterPane.relayoutPane(this.isNeedSummaryCaculateMethod()); + } protected Component getNameComponent() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/data/OneDimensionalPlotReportDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/data/OneDimensionalPlotReportDataContentPane.java index da07def4e..708ff95e9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/data/OneDimensionalPlotReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/data/OneDimensionalPlotReportDataContentPane.java @@ -1,15 +1,20 @@ package com.fr.van.chart.designer.data; +import com.fr.chart.chartdata.MeterReportDefinition; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.report.MeterPlotReportDataContentPane; +import java.awt.Component; /** * Created by Mitisky on 16/10/25. * 一维 单元格数据配置界面.系列名,值. */ -public class OneDimensionalPlotReportDataContentPane extends MeterPlotReportDataContentPane{ +public class OneDimensionalPlotReportDataContentPane extends MeterPlotReportDataContentPane { public OneDimensionalPlotReportDataContentPane(ChartDataPane parent) { super(parent); } @@ -23,4 +28,24 @@ public class OneDimensionalPlotReportDataContentPane extends MeterPlotReportData protected String getNValueString() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Value"); } + + @Override + protected double[] getRowSize() { + double p = TableLayout.PREFERRED; + return new double[]{p, p, p}; + } + + @Override + protected Component[][] getShowComponents() { + return new Component[][]{ + new Component[]{new UILabel(getCateNameString()), getSingCatePane()}, + new Component[]{new UILabel(getNValueString()), singValuePane = new TinyFormulaPane()}, + }; + } + + protected void populateCustomPane(String target) { + } + + protected void updateCustomPane(MeterReportDefinition meterDefinition) { + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java index cdb6b04b4..39c6321a2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java @@ -9,7 +9,6 @@ import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto; import com.fr.design.style.color.ColorSelectBox; - import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartGaugeAxis; import com.fr.plugin.chart.gauge.VanChartGaugePlot; @@ -18,7 +17,6 @@ import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.axis.VanChartValueAxisPane; -import com.fr.van.chart.designer.style.axis.component.MinMaxValuePaneWithOutTick; import com.fr.van.chart.designer.style.axis.component.VanChartMinMaxValuePane; import javax.swing.BorderFactory; @@ -43,19 +41,19 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { public VanChartGaugeDetailAxisPane() { } - protected JPanel createContentPane(boolean isXAxis){ - if(gaugeStyle == null){ + protected JPanel createContentPane(boolean isXAxis) { + if (gaugeStyle == null) { gaugeStyle = GaugeStyle.POINTER; } double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {f, p}; - double[] rowSize = {p,p,p,p,p,p,p,p}; + double[] rowSize = {p, p, p, p, p, p, p, p}; return TableLayoutHelper.createTableLayoutPane(getPanelComponents(p, f, columnSize), rowSize, columnSize); } private Component[][] getPanelComponents(double p, double f, double[] columnSize) { - switch (gaugeStyle){ + switch (gaugeStyle) { case THERMOMETER: return new Component[][]{ new Component[]{createLabelPane(new double[]{p, p}, columnSize), null}, @@ -80,12 +78,12 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { } } - protected JPanel createLabelPane(double[] row, double[] col){ + protected JPanel createLabelPane(double[] row, double[] col) { showLabel = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Show"), Toolkit.i18nText("Fine-Design_Chart_Hidden")}); labelTextAttrPane = getChartTextAttrPane(); labelPanel = new JPanel(new BorderLayout()); labelPanel.add(labelTextAttrPane); - labelPanel.setBorder(BorderFactory.createEmptyBorder(0,15,0,0)); + labelPanel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0)); JPanel panel = new JPanel(new BorderLayout(0, 6)); panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label"), showLabel), BorderLayout.NORTH); panel.add(labelPanel, BorderLayout.CENTER); @@ -96,7 +94,7 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { } }); JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, panel); - panel.setBorder(BorderFactory.createEmptyBorder(10,10,0,15)); + panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 15)); return jPanel; } @@ -108,11 +106,40 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { } } - private JPanel createValueDefinition(){ - switch (gaugeStyle){ + private JPanel createValueDefinition() { + switch (gaugeStyle) { case RING: case SLOT: - minMaxValuePane = new MinMaxValuePaneWithOutTick(); + minMaxValuePane = new VanChartMinMaxValuePane() { + @Override + protected double[] getRowSize(double p) { + return new double[]{p}; + } + + @Override + protected Component[][] getShowComponents(JPanel minPaneWithCheckBox, JPanel maxPaneWithCheckBox, JPanel mainPaneWithCheckBox, JPanel secPaneWithCheckBox) { + return new Component[][]{ + {minPaneWithCheckBox}, + }; + } + }; + break; + case THERMOMETER: + minMaxValuePane = new VanChartMinMaxValuePane() { + @Override + protected double[] getRowSize(double p) { + return new double[]{p, p, p}; + } + + @Override + protected Component[][] getShowComponents(JPanel minPaneWithCheckBox, JPanel maxPaneWithCheckBox, JPanel mainPaneWithCheckBox, JPanel secPaneWithCheckBox) { + return new Component[][]{ + {minPaneWithCheckBox}, + {mainPaneWithCheckBox}, + {secPaneWithCheckBox}, + }; + } + }; break; default: minMaxValuePane = new VanChartMinMaxValuePane(); @@ -121,7 +148,7 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), minMaxValuePane); } - private JPanel createTickColorPane(double[] row, double[] col){ + private JPanel createTickColorPane(double[] row, double[] col) { mainTickColor = new ColorSelectBox(100); secTickColor = new ColorSelectBox(100); Component[][] components = new Component[][]{ @@ -130,20 +157,20 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { }; JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_TickColor"), panel); - panel.setBorder(BorderFactory.createEmptyBorder(10,10,0,15)); + panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 15)); return jPanel; } - private boolean isMulti(GaugeStyle style){ + private boolean isMulti(GaugeStyle style) { return style == GaugeStyle.POINTER || style == GaugeStyle.POINTER_SEMI; } - private boolean samePane(GaugeStyle style1, GaugeStyle style2){ + private boolean samePane(GaugeStyle style1, GaugeStyle style2) { return style1 == style2 || (isMulti(style1) && isMulti(style2)); } - public void populateBean(VanChartGaugePlot gaugePlot, VanChartStylePane parent){ - if(!samePane(gaugePlot.getGaugeStyle(), gaugeStyle)){ + public void populateBean(VanChartGaugePlot gaugePlot, VanChartStylePane parent) { + if (!samePane(gaugePlot.getGaugeStyle(), gaugeStyle)) { gaugeStyle = gaugePlot.getGaugeStyle(); reLayoutPane(false); parent.initAllListeners(); @@ -151,23 +178,23 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { populateBean(gaugePlot.getGaugeAxis()); } - public void populateBean(VanChartAxis axis){ - VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis)axis; - if(mainTickColor != null){ + public void populateBean(VanChartAxis axis) { + VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis) axis; + if (mainTickColor != null) { mainTickColor.setSelectObject(gaugeAxis.getMainTickColor()); } - if(secTickColor != null){ + if (secTickColor != null) { secTickColor.setSelectObject(gaugeAxis.getSecTickColor()); } super.populateBean(gaugeAxis); } public void updateBean(VanChartAxis axis) { - VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis)axis; - if(mainTickColor != null){ + VanChartGaugeAxis gaugeAxis = (VanChartGaugeAxis) axis; + if (mainTickColor != null) { gaugeAxis.setMainTickColor(mainTickColor.getSelectObject()); } - if(secTickColor != null){ + if (secTickColor != null) { gaugeAxis.setSecTickColor(secTickColor.getSelectObject()); } super.updateBean(gaugeAxis); From c8eea04ce7946cb73a86d6399c7e418eb01fe9dd Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 9 Jun 2020 16:41:04 +0800 Subject: [PATCH 65/76] =?UTF-8?q?REPORT-32149=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8A=A0=E5=AF=86=E3=80=91@harrison=E4=B8=A4=E4=B8=AA=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=BF=9B=E8=A1=8C=E6=8B=96=E5=85=A5=EF=BC=8C=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E9=A2=84=E8=A7=88=E5=BE=88=E5=A5=87=E6=80=AA=20?= =?UTF-8?q?=E8=80=83=E8=99=91=E4=B8=93=E5=B1=9E=E5=AE=B9=E5=99=A8=20+=20ca?= =?UTF-8?q?rdLayout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/models/ModelUtil.java | 22 ++++++-- .../beans/models/AddingModelTest.java | 53 ++++++++++++++++++- 2 files changed, 69 insertions(+), 6 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java index e1efd3141..ddd9e0e31 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java @@ -21,14 +21,24 @@ abstract class ModelUtil { } private static void recursiveRenameWidgetName(Form form, XCreator xCreator, Set duplicated) { - + //有可能并不需要对自己处理,而是对其他的组件处理。所以要找到目标值 XCreator target = xCreator.getXCreator(); String uniqueName = uniqueName(form, target, duplicated); - target.toData().setWidgetName(uniqueName); - //将名字加入重复集合中 - duplicated.add(uniqueName); - + + int componentCount = target.getComponentCount(); + //如果没有子类,说明是刚创建的,直接对自己处理就好啦 + if (componentCount == 0) { + target.toData().setWidgetName(uniqueName); + return; + } + //专属容器,直接返回啦 + if (target.isDedicateContainer()) { + target.resetCreatorName(uniqueName); + return; + } + target.resetCreatorName(uniqueName); + int count = target.getComponentCount(); for (int a = 0; a < count; a++) { if (target.getComponent(a) instanceof XCreator) { @@ -54,6 +64,8 @@ abstract class ModelUtil { widgetName = raw + i; i++; } + //将名字加入重复集合中 + duplicated.add(widgetName); return widgetName; } diff --git a/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java b/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java index e7eca1c03..689044fe9 100644 --- a/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java +++ b/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java @@ -1,15 +1,25 @@ package com.fr.design.designer.beans.models; +import com.fr.config.dao.DaoContext; +import com.fr.config.dao.impl.LocalClassHelperDao; +import com.fr.config.dao.impl.LocalEntityDao; +import com.fr.config.dao.impl.LocalXmlEntityDao; import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWTitleLayout; +import com.fr.design.designer.creator.cardlayout.XWCardLayout; import com.fr.design.mainframe.FormDesigner; import com.fr.form.main.Form; import com.fr.form.ui.ChartEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WTitleLayout; import org.easymock.EasyMock; +import org.junit.After; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; import javax.swing.JComponent; @@ -19,6 +29,20 @@ import java.beans.IntrospectionException; public class AddingModelTest { + @Before + public void setUp() { + DaoContext.setXmlEntityDao(new LocalXmlEntityDao()); + DaoContext.setClassHelperDao(new LocalClassHelperDao()); + DaoContext.setEntityDao(new LocalEntityDao()); + } + + @After + public void tearDown() { + DaoContext.setXmlEntityDao(null); + DaoContext.setClassHelperDao(null); + DaoContext.setEntityDao(null); + } + @Test public void testInstantiateCreator() throws Exception { @@ -37,7 +61,9 @@ public class AddingModelTest { WAbsoluteLayout.BoundsWidget boundsWidget = new WAbsoluteLayout.BoundsWidget(chartEditor3, new Rectangle(dimension)); WTitleLayout wTitleLayout03 = new WTitleLayout(); wTitleLayout03.addWidget(boundsWidget); - DemoCreator xCreator3 = new DemoCreator(wTitleLayout03, dimension, "test03"); + //需要和内部的 widget 一样 + wTitleLayout03.setWidgetName("test03"); + XWTitleLayout xCreator3 = new XWTitleLayout(wTitleLayout03, dimension); xCreator1.add(xCreator3); AddingModel addingModel = new AddingModel(xCreator1, 20, 20); @@ -61,6 +87,31 @@ public class AddingModelTest { Assert.assertEquals("test030", xCreator3.toData().getWidgetName()); } + @Test + public void testInstantiateCreator_cardLayout() throws Exception { + + Form form = EasyMock.mock(Form.class); + EasyMock.expect(form.isNameExist("cardlayout")).andReturn(true).once(); + EasyMock.expect(form.isNameExist(EasyMock.anyString())).andReturn(false).anyTimes(); + EasyMock.replay(form); + + FormDesigner mock = EasyMock.mock(FormDesigner.class); + EasyMock.expect(mock.getTarget()).andReturn(form).anyTimes(); + EasyMock.replay(mock); + + WCardLayout wCardLayout = new WCardLayout(20, 20); + XWCardLayout xwCardLayout = new XWCardLayout(wCardLayout, new Dimension(20, 20)); + AddingModel addingModel = new AddingModel(mock, xwCardLayout); + Assert.assertEquals("cardlayout1", xwCardLayout.toData().getWidgetName()); + + //依赖于 cardlayout 创建 container + XLayoutContainer parentLayOut = xwCardLayout.initCreatorWrapper(20); + AddingModel parentModel = new AddingModel(mock, parentLayOut); + Assert.assertEquals("tablayout1", parentLayOut.toData().getWidgetName()); + Assert.assertEquals("tabpane1", ((XCreator) (parentLayOut.getComponent(0))).getXCreator().toData().getWidgetName()); + + } + private static class DemoCreator extends XCreator { private String widgetName; From 36f6037b2175512b038df7ffc9f4d7246026a7d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 9 Jun 2020 17:05:41 +0800 Subject: [PATCH 66/76] =?UTF-8?q?CHART-14181=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E7=A9=BA=E6=95=B0=E6=8D=AE=E6=8F=90=E7=A4=BA=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/ChartEmptyDataStylePane.java | 92 +++++++++++++------ 1 file changed, 64 insertions(+), 28 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java b/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java index bc5d4ca9b..31718fda8 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java @@ -2,11 +2,13 @@ package com.fr.design.module; import com.fr.base.BaseUtils; import com.fr.base.ChartEmptyDataStyleConf; +import com.fr.base.Style; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.style.background.image.ImageFileChooser; import com.fr.design.style.background.image.ImagePreviewPane; @@ -14,7 +16,7 @@ import com.fr.design.utils.ImageUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; - +import com.fr.stable.Constants; import com.fr.stable.CoreGraphHelper; import com.fr.stable.StringUtils; @@ -24,6 +26,7 @@ import javax.swing.JFileChooser; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.SwingWorker; +import java.io.File; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; @@ -32,7 +35,6 @@ import java.awt.GridLayout; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.io.File; /** * Created by mengao on 2017/11/23. @@ -47,8 +49,10 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { private UIButtonGroup emptyData; + private UILabel imageContent; + private UIButtonGroup imageData; private UIRadioButton defaultRadioButton; - private UIRadioButton customRadioButton; + private UIRadioButton adjustRadioButton; private UIButton selectPictureButton; private ImagePreviewPane previewPane; @@ -72,7 +76,7 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { } private JPanel creatNorthPane() { - emptyData = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); + emptyData = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")}); emptyData.setSelectedIndex(0); emptyData.setPreferredSize(new Dimension(WIDTH, HEIGHT)); emptyData.addActionListener(new ActionListener() { @@ -83,8 +87,24 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { } }); - UILabel promptContent = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Tip_Content")); - JPanel northPane = GUICoreUtils.createFlowPane(new Component[]{promptContent, emptyData}, FlowLayout.LEFT, TEN, 0); + imageData = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Mode_Auto"), Toolkit.i18nText("Fine-Design_Chart_Mode_Custom")}); + imageData.setSelectedIndex(0); + imageData.setPreferredSize(new Dimension(WIDTH, HEIGHT)); + imageData.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + emptyDataImage = null; + checkIsCustom(); + repaintPreviewPane(); + } + }); + + UILabel promptContent = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Tip_Content")); + imageContent = new UILabel(Toolkit.i18nText("Fine-Design_Report_Image")); + JPanel emptyPane = GUICoreUtils.createFlowPane(new Component[]{promptContent, emptyData}, FlowLayout.LEFT, TEN, 0); + JPanel imagePane = GUICoreUtils.createFlowPane(new Component[]{imageContent, imageData}, FlowLayout.LEFT, TEN, 0); + imagePane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); + JPanel northPane = GUICoreUtils.createFlowPane(new Component[]{emptyPane, imagePane}, FlowLayout.LEFT, 0, 0); northPane.setBorder(BorderFactory.createEmptyBorder(0, FIVE, 0, 0)); return northPane; } @@ -96,7 +116,7 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { JPanel previewContainerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); centerPane.add(previewContainerPane, BorderLayout.CENTER); - JPanel previewOwnerPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); + JPanel previewOwnerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_Preview")); previewOwnerPane.setLayout(new BorderLayout()); previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER); previewContainerPane.add(initSelectFilePane(), BorderLayout.EAST); @@ -116,25 +136,27 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { selectFilePane.setBorder(BorderFactory.createEmptyBorder(TEN, FIVE, 0, THIRTY)); - defaultRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); - customRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Custom")); + defaultRadioButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Report_Default")); + adjustRadioButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Report_Image_Adjust")); ButtonGroup buttonGroup = new ButtonGroup(); defaultRadioButton.setSelected(true); buttonGroup.add(defaultRadioButton); - buttonGroup.add(customRadioButton); + buttonGroup.add(adjustRadioButton); + defaultRadioButton.setEnabled(false); + adjustRadioButton.setEnabled(false); defaultRadioButton.addActionListener(getLayoutActionListener()); - customRadioButton.addActionListener(getLayoutActionListener()); - - JPanel jp = new JPanel(new GridLayout(3, 1, 0, TEN)); - jp.add(defaultRadioButton); - jp.add(customRadioButton); + adjustRadioButton.addActionListener(getLayoutActionListener()); selectPictureButton = new UIButton( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Image_Select")); + Toolkit.i18nText("Fine-Design_Basic_Background_Image_Select")); + selectPictureButton.setEnabled(false); selectPictureButton.addActionListener(getSelectPictureActionListener()); - jp.add(selectPictureButton); + JPanel jp = new JPanel(new GridLayout(3, 1, 0, TEN)); + jp.add(selectPictureButton); + jp.add(defaultRadioButton); + jp.add(adjustRadioButton); selectFilePane.add(jp, BorderLayout.NORTH); return selectFilePane; @@ -142,10 +164,8 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { private ActionListener getLayoutActionListener() { return new ActionListener() { - public void actionPerformed(ActionEvent evt) { - emptyDataImage = null; - checkCustomImage(); + setImageStyle(); repaintPreviewPane(); } }; @@ -188,17 +208,30 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { private void checkEmptyDataStyle() { boolean b = emptyData.getSelectedIndex() == 0; + defaultRadioButton.setVisible(b); + adjustRadioButton.setVisible(b); + selectPictureButton.setVisible(b); + imageContent.setVisible(b); + imageData.setVisible(b); + } + + private void checkIsCustom() { + boolean b = imageData.getSelectedIndex() == 1; defaultRadioButton.setEnabled(b); - customRadioButton.setEnabled(b); + adjustRadioButton.setEnabled(b); selectPictureButton.setEnabled(b); } - private void checkCustomImage() { - selectPictureButton.setVisible(customRadioButton.isSelected()); + private void setImageStyle() { + if (adjustRadioButton.isSelected()) { + previewPane.setImageStyle(Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST)); + } else { + previewPane.setImageStyle(Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER)); + } } private void repaintPreviewPane() { - emptyDataImage = customRadioButton.isSelected() ? emptyDataImage : DEFAULT_EMPTY_DATA_IMAGE; + emptyDataImage = imageData.getSelectedIndex() == 1 ? emptyDataImage : DEFAULT_EMPTY_DATA_IMAGE; previewPane.setImage(emptyData.getSelectedIndex() == 0 ? emptyDataImage : null); previewPane.repaint(); } @@ -215,12 +248,14 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { public void populateBean() { ChartEmptyDataStyleConf manager = ChartEmptyDataStyleConf.getInstance(); - emptyData.setSelectedIndex(manager.isOpenEmptyDataStyle() == true ? 0 : 1); - customRadioButton.setSelected(manager.isCustomEmptyDataStyle()); + emptyData.setSelectedIndex(manager.isOpenEmptyDataStyle() ? 0 : 1); + imageData.setSelectedIndex(manager.isCustomEmptyDataStyle() ? 1 : 0); + adjustRadioButton.setSelected(manager.isAdjust()); emptyDataImage = manager.getEmptyDataImage(); checkEmptyDataStyle(); - checkCustomImage(); + checkIsCustom(); + setImageStyle(); repaintPreviewPane(); } @@ -228,7 +263,8 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { ChartEmptyDataStyleConf manager = ChartEmptyDataStyleConf.getInstance(); manager.setOpenEmptyDataStyle(emptyData.getSelectedIndex() == 0); - manager.setCustomEmptyDataStyle(customRadioButton.isSelected()); + manager.setCustomEmptyDataStyle(imageData.getSelectedIndex() == 1); + manager.setAdjust(adjustRadioButton.isSelected()); manager.setEmptyDataImage(emptyDataImage); } } From 628727d69e9770c4a10571f43303e23298d1f160 Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 9 Jun 2020 19:19:07 +0800 Subject: [PATCH 67/76] =?UTF-8?q?REPORT-32149=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8A=A0=E5=AF=86=E3=80=91@harrison=E4=B8=A4=E4=B8=AA=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=BF=9B=E8=A1=8C=E6=8B=96=E5=85=A5=EF=BC=8C=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E9=A2=84=E8=A7=88=E5=BE=88=E5=A5=87=E6=80=AA=20?= =?UTF-8?q?=E5=B0=86=E9=80=BB=E8=BE=91=E5=88=86=E6=95=A3=E5=88=B0=E5=90=84?= =?UTF-8?q?=E4=B8=AA=E7=BB=84=E4=BB=B6=E4=B8=AD=E3=80=82=20=E5=87=8F?= =?UTF-8?q?=E5=B0=91=E5=90=8C=E4=B8=80=E4=B8=AA=E6=96=B9=E6=B3=95=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E8=80=A6=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/models/ModelUtil.java | 27 ++++-------------- .../creator/DedicateLayoutContainer.java | 11 ++++++-- .../fr/design/designer/creator/XCreator.java | 28 ++++++++++++++++--- .../creator/cardlayout/XWCardLayout.java | 17 ++++++----- .../beans/models/AddingModelTest.java | 7 +++-- 5 files changed, 52 insertions(+), 38 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java index ddd9e0e31..b6f073f10 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java @@ -22,29 +22,12 @@ abstract class ModelUtil { private static void recursiveRenameWidgetName(Form form, XCreator xCreator, Set duplicated) { - //有可能并不需要对自己处理,而是对其他的组件处理。所以要找到目标值 - XCreator target = xCreator.getXCreator(); - String uniqueName = uniqueName(form, target, duplicated); - - int componentCount = target.getComponentCount(); - //如果没有子类,说明是刚创建的,直接对自己处理就好啦 - if (componentCount == 0) { - target.toData().setWidgetName(uniqueName); - return; - } - //专属容器,直接返回啦 - if (target.isDedicateContainer()) { + Set nameRelatedCreators = new HashSet<>(); + //直接遍历出来目标值,然后按需处理 + xCreator.traversalNameRelatedXCreators(nameRelatedCreators); + for (XCreator target : nameRelatedCreators) { + String uniqueName = uniqueName(form, target, duplicated); target.resetCreatorName(uniqueName); - return; - } - target.resetCreatorName(uniqueName); - - int count = target.getComponentCount(); - for (int a = 0; a < count; a++) { - if (target.getComponent(a) instanceof XCreator) { - XCreator child = (XCreator) target.getComponent(a); - recursiveRenameWidgetName(form, child, duplicated); - } } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/DedicateLayoutContainer.java b/designer-form/src/main/java/com/fr/design/designer/creator/DedicateLayoutContainer.java index d7f073b45..c8abd8d39 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/DedicateLayoutContainer.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/DedicateLayoutContainer.java @@ -9,6 +9,7 @@ import java.awt.Component; import java.awt.Dimension; import java.beans.IntrospectionException; import java.util.List; +import java.util.Set; /** * 一些控件专属的容器,如标题容器,sclae容器 @@ -69,13 +70,19 @@ public abstract class DedicateLayoutContainer extends XLayoutContainer { //实现WTitleLayout的SetWidgetName child.toData().setWidgetName(name); } - + + @Override + public void traversalNameRelatedXCreators(Set xCreators) { + xCreators.add(this); + } + /** * 重置组件的可见性 + * * @param visible 可见性 */ @Override - public void resetVisible(boolean visible){ + public void resetVisible(boolean visible) { super.resetVisible(visible); XCreator child = getXCreator(XWScaleLayout.INDEX); child.toData().setVisible(visible); diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index bef18f96f..a5a59acc8 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -41,6 +41,7 @@ import java.awt.event.MouseEvent; import java.beans.IntrospectionException; import java.util.ArrayList; import java.util.List; +import java.util.Set; /** * @author richer @@ -407,24 +408,43 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public Component getParentShow(){ return this.getParent(); } - + /** * 重置组件的名称 + * * @param name 名称 */ @Override public void resetCreatorName(String name) { toData().setWidgetName(name); } - + + /** + * 遍历所有命名相关的组件到集合中 + * + * @param xCreators 集合 + */ + public void traversalNameRelatedXCreators(Set xCreators) { + + xCreators.add(this); + int componentCount = getComponentCount(); + for (int i = 0; i < componentCount; i++) { + XCreator xCreator = (XCreator) getComponent(i); + //获取真实的 creator + XCreator realCreator = xCreator.getXCreator(); + realCreator.traversalNameRelatedXCreators(xCreators); + } + } + /** * 重置组件的可见性 + * * @param visible 可见性 */ - public void resetVisible(boolean visible){ + public void resetVisible(boolean visible) { toData().setVisible(visible); } - + /** * 返回编辑的子组件,scale为其内部组件 * @return 组件 diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java index c91d34654..1ff3f41c5 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java @@ -433,13 +433,16 @@ public class XWCardLayout extends XLayoutContainer { //修改相关SwitchButton所绑定的cardLayout控件名 private void changeRelateSwitchCardName(String cardLayoutName) { XWCardMainBorderLayout borderLayout = (XWCardMainBorderLayout) this.getBackupParent(); - WCardMainBorderLayout border = borderLayout.toData(); - WCardTitleLayout titleLayout = border.getTitlePart(); - titleLayout.setCardName(cardLayoutName); - WCardTagLayout tagLayout = titleLayout.getTagPart(); - for (int i = 0, len = tagLayout.getWidgetCount(); i < len; i++) { - CardSwitchButton button = tagLayout.getSwitchButton(i); - button.setCardLayoutName(cardLayoutName); + //可能为空 + if (borderLayout != null) { + WCardMainBorderLayout border = borderLayout.toData(); + WCardTitleLayout titleLayout = border.getTitlePart(); + titleLayout.setCardName(cardLayoutName); + WCardTagLayout tagLayout = titleLayout.getTagPart(); + for (int i = 0, len = tagLayout.getWidgetCount(); i < len; i++) { + CardSwitchButton button = tagLayout.getSwitchButton(i); + button.setCardLayoutName(cardLayoutName); + } } } diff --git a/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java b/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java index 689044fe9..a6bd82300 100644 --- a/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java +++ b/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java @@ -92,20 +92,21 @@ public class AddingModelTest { Form form = EasyMock.mock(Form.class); EasyMock.expect(form.isNameExist("cardlayout")).andReturn(true).once(); + EasyMock.expect(form.isNameExist("cardlayout0")).andReturn(true).once(); EasyMock.expect(form.isNameExist(EasyMock.anyString())).andReturn(false).anyTimes(); EasyMock.replay(form); FormDesigner mock = EasyMock.mock(FormDesigner.class); EasyMock.expect(mock.getTarget()).andReturn(form).anyTimes(); EasyMock.replay(mock); - + WCardLayout wCardLayout = new WCardLayout(20, 20); - XWCardLayout xwCardLayout = new XWCardLayout(wCardLayout, new Dimension(20, 20)); + XWCardLayout xwCardLayout = new XWCardLayout(wCardLayout, new Dimension(40, 40)); AddingModel addingModel = new AddingModel(mock, xwCardLayout); Assert.assertEquals("cardlayout1", xwCardLayout.toData().getWidgetName()); //依赖于 cardlayout 创建 container - XLayoutContainer parentLayOut = xwCardLayout.initCreatorWrapper(20); + XLayoutContainer parentLayOut = xwCardLayout.initCreatorWrapper(80); AddingModel parentModel = new AddingModel(mock, parentLayOut); Assert.assertEquals("tablayout1", parentLayOut.toData().getWidgetName()); Assert.assertEquals("tabpane1", ((XCreator) (parentLayOut.getComponent(0))).getXCreator().toData().getWidgetName()); From 064c0975f5efa5d760520f91bfc23cf0814ec2b0 Mon Sep 17 00:00:00 2001 From: lucian Date: Tue, 9 Jun 2020 19:23:00 +0800 Subject: [PATCH 68/76] =?UTF-8?q?REPORT-31418=20=E3=80=9010.0.7=E3=80=91?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E8=BF=9E=E6=8E=A5=E8=BF=9C?= =?UTF-8?q?=E7=A8=8B=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=97=B6=EF=BC=8C=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E4=B8=8D=E8=AE=B0=E5=BD=95=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 29 +++++++++++++++++- .../design/actions/file/SwitchExistEnv.java | 9 +++++- .../env/RemoteDesignerWorkspaceInfo.java | 4 ++- .../main/java/com/fr/env/RemoteEnvPane.java | 28 +++++++++++++++-- .../com/fr/design/EnvChangeEntranceTest.java | 30 ++++++++++++++++++- .../fr/design/env/RemoteWorkspaceTest.java | 3 +- 6 files changed, 96 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 595f812af..687a3fea0 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -8,6 +8,7 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceType; +import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.env.RemoteWorkspace; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.TemplateTreePane; @@ -380,15 +381,21 @@ public class EnvChangeEntrance { * 出现对话框,选择使用的工作环境 */ public void chooseEnv() { + chooseEnv(currentEnvName); + } + + public void chooseEnv(final String envName) { final EnvListPane envListPane = new EnvListPane(); final BasicDialog envListDialog = envListPane.showWindow(SwingUtilities.getWindowAncestor(DesignerContext.getDesignerFrame())); - envListPane.populateEnvManager(currentEnvName); + envListPane.populateEnvManager(envName); envListDialog.addDialogActionListener(new DialogActionAdapter() { @Override public void doOk() { envListOkAction(envListPane, PopTipStrategy.LATER); + // 切换完成后清理密码 + updateSelectEnv(envName); } @Override @@ -418,6 +425,8 @@ public class EnvChangeEntrance { FineProcessContext.getParentPipe().fire(new CarryMessageEvent(ReportState.ACTIVE.getValue())); if (!envListOkAction(envListPane, PopTipStrategy.NOW)) { DesignerExiter.getInstance().execute(); + } else { + updateSelectEnv(currentEnvName); } } @@ -429,6 +438,24 @@ public class EnvChangeEntrance { envListDialog.setVisible(true); } + /** + * 切换环境后 刷新远程目录需要忘记密码的情况 + * @param envName 环境名 + */ + private void updateSelectEnv(String envName) { + DesignerEnvManager mgr = DesignerEnvManager.getEnvManager(); + DesignerWorkspaceInfo info = mgr.getWorkspaceInfo(envName); + if (info != null) { + WorkspaceConnectionInfo connection = info.getConnection(); + if (connection != null && !connection.isRememberPwd()) { + + DesignerWorkspaceInfo workspaceInfo = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo( + connection.getUrl(), connection.getUserName(), StringUtils.EMPTY, connection.getCertPath(), connection.getCertSecretKey(), false)); + mgr.putEnv(envName, workspaceInfo); + } + } + } + /** * 提示显示策略 diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java index 568e713bb..1e222dd26 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java @@ -59,7 +59,14 @@ public class SwitchExistEnv extends MenuDef { */ public void actionPerformed(ActionEvent e) { final String envName = getName(); - EnvChangeEntrance.getInstance().switch2Env(envName); + DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); + DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName); + if (selectedEnv.getConnection() != null && !selectedEnv.getConnection().isRememberPwd()) { + // 打开配置目录面板 + EnvChangeEntrance.getInstance().chooseEnv(envName); + } else { + EnvChangeEntrance.getInstance().switch2Env(envName); + } } } } diff --git a/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java b/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java index af0b8a01c..0e3f68897 100644 --- a/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java +++ b/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java @@ -72,7 +72,8 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo { String password = SecurityToolbox.defaultDecrypt(reader.getAttrAsString("password", StringUtils.EMPTY).replaceAll(" ", "\r\n")); String certPath = reader.getAttrAsString("certPath", StringUtils.EMPTY); String certSecretKey = reader.getAttrAsString("certSecretKey", StringUtils.EMPTY); - this.connection = new WorkspaceConnectionInfo(url, username, password, certPath, certSecretKey); + boolean rememberPwd = reader.getAttrAsBoolean("rememberPwd", true); + this.connection = new WorkspaceConnectionInfo(url, username, password, certPath, certSecretKey, rememberPwd); } } } @@ -89,6 +90,7 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo { writer.attr("password", SecurityToolbox.defaultEncrypt(connection.getPassword())); writer.attr("certPath", connection.getCertPath()); writer.attr("certSecretKey", connection.getCertSecretKey()); + writer.attr("rememberPwd", connection.isRememberPwd()); writer.end(); } } diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 9ea2f7019..3c481ba30 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -96,6 +96,10 @@ public class RemoteEnvPane extends BasicBeanPane { * 密码 */ private UIPassWordField passwordInput = new UIPassWordField(); + /** + * 是否记住密码 + */ + private UICheckBox rememberPwdCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Remember_Password")); /** * https证书路径 */ @@ -212,7 +216,7 @@ public class RemoteEnvPane extends BasicBeanPane { updateHttpsConfigPanel(); remoteWorkspaceURL.setHttps(isHttps); - // reset下url,将勾选状态是否htpps加到url里 + // reset下url,将勾选状态是否https加到url里 remoteWorkspaceURL.resetUrl(); fillRemoteEnvURLField(); @@ -286,6 +290,7 @@ public class RemoteEnvPane extends BasicBeanPane { contentPanel.add(configPanel, BorderLayout.NORTH); contentPanel.add(accountPanel, BorderLayout.CENTER); + contentPanel.add(packRememberPwdConfigPanel(), BorderLayout.SOUTH); JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); panel.add(contentPanel, BorderLayout.NORTH); panel.add(testPanel, BorderLayout.CENTER); @@ -306,15 +311,18 @@ public class RemoteEnvPane extends BasicBeanPane { String pwd = fromNullable(connection.getPassword()).or(StringUtils.EMPTY); String certPath = fromNullable(connection.getCertPath()).or(StringUtils.EMPTY); String certSecretKey = fromNullable(connection.getCertSecretKey()).or(StringUtils.EMPTY); + boolean rememberPwd = fromNullable(connection.isRememberPwd()).or(true); this.usernameInput.setText(username); this.passwordInput.setText(pwd); this.certPathInput.setText(certPath); this.certSecretKeyInput.setText(certSecretKey); + this.rememberPwdCheckbox.setSelected(rememberPwd); } else { this.remoteWorkspaceURL = RemoteWorkspaceURL.createDefaultURL(); this.usernameInput.setText(StringUtils.EMPTY); this.passwordInput.setText(StringUtils.EMPTY); + this.rememberPwdCheckbox.setSelected(true); } fillRemoteEnvURLField(); @@ -333,6 +341,7 @@ public class RemoteEnvPane extends BasicBeanPane { String url = this.remoteWorkspaceURL.getURL(); String username = this.usernameInput.getText(); String password = new String(this.passwordInput.getPassword()); + boolean rememberPwd = this.rememberPwdCheckbox.isSelected(); DesignerEnvProcessor envProcessor = ExtraDesignClassManager.getInstance().getSingle(DesignerEnvProcessor.XML_TAG); if (envProcessor != null) { url = envProcessor.changeEnvPathBeforeConnect(username, password, url); @@ -342,7 +351,8 @@ public class RemoteEnvPane extends BasicBeanPane { username, password, this.certPathInput.getText(), - new String(this.certSecretKeyInput.getPassword())); + new String(this.certSecretKeyInput.getPassword()), + rememberPwd); return RemoteDesignerWorkspaceInfo.create(connection); } @@ -522,6 +532,20 @@ public class RemoteEnvPane extends BasicBeanPane { accountPanel.add(content, BorderLayout.CENTER); } + private JPanel packRememberPwdConfigPanel() { + + JPanel panel = TableLayoutHelper.createGapTableLayoutPane( + new Component[][]{ + new Component[]{rememberPwdCheckbox} + }, + new double[]{PREFERRED}, + new double[]{PREFERRED}, + 5, + 10 + ); + TableLayoutHelper.modifyTableLayoutIndexHGap(panel, 0, 50); + return panel; + } private JPanel createHttpsCertFileInputPanel() { JPanel inputPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); diff --git a/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java b/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java index f37c6e73d..672f17e37 100644 --- a/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java +++ b/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java @@ -2,7 +2,9 @@ package com.fr.design; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceType; +import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.env.CheckServiceDialog; +import com.fr.invoke.Reflect; import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import org.easymock.EasyMock; @@ -19,7 +21,7 @@ import org.powermock.modules.junit4.PowerMockRunner; * @Description: */ @RunWith(PowerMockRunner.class) -@PrepareForTest({FunctionalHttpRequest.class,EnvChangeEntrance.class,CheckServiceDialog.class}) +@PrepareForTest({FunctionalHttpRequest.class,EnvChangeEntrance.class,CheckServiceDialog.class, DesignerEnvManager.class}) public class EnvChangeEntranceTest { @Test @@ -55,4 +57,30 @@ public class EnvChangeEntranceTest { } } + @Test + public void testUpdateSelectEnv() { + + DesignerEnvManager manager = new DesignerEnvManager(); + + PowerMock.mockStatic(DesignerEnvManager.class); + EasyMock.expect(DesignerEnvManager.getEnvManager()).andReturn(manager).anyTimes(); + + PowerMock.replayAll(); + + EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); + + manager.putEnv("test1", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true))); + manager.putEnv("test2", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", false))); + + Reflect.on(entrance).call("updateSelectEnv", "test1"); + Reflect.on(entrance).call("updateSelectEnv", "test2"); + + + Assert.assertEquals(manager.getWorkspaceInfo("test1").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)).getConnection()); + Assert.assertEquals(manager.getWorkspaceInfo("test2").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "", "", "", false)).getConnection()); + + PowerMock.verifyAll(); + + } + } \ No newline at end of file diff --git a/designer-base/src/test/java/com/fr/design/env/RemoteWorkspaceTest.java b/designer-base/src/test/java/com/fr/design/env/RemoteWorkspaceTest.java index fe7f365e6..35b18fbf1 100644 --- a/designer-base/src/test/java/com/fr/design/env/RemoteWorkspaceTest.java +++ b/designer-base/src/test/java/com/fr/design/env/RemoteWorkspaceTest.java @@ -38,7 +38,7 @@ public class RemoteWorkspaceTest { EasyMock.replay(workspace, operator); PowerMock.replayAll(); - WorkspaceConnectionInfo info = new WorkspaceConnectionInfo("url", "username", "password", "certPath", "certSecretKey"); + WorkspaceConnectionInfo info = new WorkspaceConnectionInfo("url", "username", "password", "certPath", "certSecretKey", true); RemoteWorkspace remoteWorkspace= new RemoteWorkspace(null, info); @@ -51,4 +51,5 @@ public class RemoteWorkspaceTest { } + } \ No newline at end of file From bf021e82340c3cee7a3c7002d1da72446ac8eac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 9 Jun 2020 20:04:59 +0800 Subject: [PATCH 69/76] =?UTF-8?q?CHART-14181=20=E5=9B=BE=E8=A1=A8=E7=A9=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/module/ChartEmptyDataStylePane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java b/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java index 31718fda8..1b0d19346 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java @@ -250,7 +250,7 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { ChartEmptyDataStyleConf manager = ChartEmptyDataStyleConf.getInstance(); emptyData.setSelectedIndex(manager.isOpenEmptyDataStyle() ? 0 : 1); imageData.setSelectedIndex(manager.isCustomEmptyDataStyle() ? 1 : 0); - adjustRadioButton.setSelected(manager.isAdjust()); + //adjustRadioButton.setSelected(manager.isAdjust()); emptyDataImage = manager.getEmptyDataImage(); checkEmptyDataStyle(); @@ -264,7 +264,7 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { manager.setOpenEmptyDataStyle(emptyData.getSelectedIndex() == 0); manager.setCustomEmptyDataStyle(imageData.getSelectedIndex() == 1); - manager.setAdjust(adjustRadioButton.isSelected()); + //manager.setAdjust(adjustRadioButton.isSelected()); manager.setEmptyDataImage(emptyDataImage); } } From 9133f8e4d823595a67ead4c3afb8641a384123cf Mon Sep 17 00:00:00 2001 From: Bryant Date: Tue, 9 Jun 2020 21:46:24 +0800 Subject: [PATCH 70/76] =?UTF-8?q?=E6=97=A0jira=20=E8=AF=A2=E9=97=AE?= =?UTF-8?q?=E4=BA=86richie=EF=BC=8C=E5=85=88=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/dcm/UniversalDatabasePane.java | 18 +- .../com/fr/design/dcm/UniversalDcmBridge.java | 12 +- .../main/java/com/fr/design/ui/Assistant.java | 68 ++++++ .../com/fr/design/ui/EmbProtocolHandler.java | 130 ++++++++++ .../java/com/fr/design/ui/ModernUIPane.java | 147 +++++------ .../ui/NxComplexInterceptRequestCallback.java | 85 ------- .../design/ui/NxInterceptRequestCallback.java | 134 ---------- .../java/com/fr/design/upm/UpmBridge.java | 228 +++++++----------- .../java/com/fr/design/upm/UpmFinder.java | 4 +- .../java/com/fr/design/upm/UpmShowPane.java | 15 +- .../design/upm/exec/UpmBrowserExecutor.java | 15 +- pom.xml | 4 +- 12 files changed, 392 insertions(+), 468 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/ui/Assistant.java create mode 100644 designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java delete mode 100644 designer-base/src/main/java/com/fr/design/ui/NxComplexInterceptRequestCallback.java delete mode 100644 designer-base/src/main/java/com/fr/design/ui/NxInterceptRequestCallback.java diff --git a/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java b/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java index f16fa0b11..e29a9f669 100644 --- a/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java +++ b/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java @@ -2,8 +2,9 @@ package com.fr.design.dcm; import com.fr.design.dialog.BasicPane; import com.fr.design.ui.ModernUIPane; -import com.teamdev.jxbrowser.browser.callback.InjectJsCallback; -import com.teamdev.jxbrowser.js.JsObject; +import com.teamdev.jxbrowser.chromium.JSValue; +import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; +import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; import java.awt.*; @@ -25,13 +26,14 @@ public class UniversalDatabasePane extends BasicPane { setLayout(new BorderLayout()); modernUIPane = new ModernUIPane.Builder<>() .withComponent(UniversalDatabaseComponent.KEY) - .prepare(params -> { - JsObject window = params.frame().executeJavaScript("window"); - if (window != null) { - window.putProperty("DcmHelper", UniversalDcmBridge.getBridge()); + .prepare(new ScriptContextAdapter() { + @Override + public void onScriptContextCreated(ScriptContextEvent event) { + JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); + window.asObject().setProperty("DcmHelper", UniversalDcmBridge.getBridge(event.getBrowser())); } - return InjectJsCallback.Response.proceed(); - }).build(); + }) + .build(); add(modernUIPane, BorderLayout.CENTER); } } diff --git a/designer-base/src/main/java/com/fr/design/dcm/UniversalDcmBridge.java b/designer-base/src/main/java/com/fr/design/dcm/UniversalDcmBridge.java index db43c3c79..577acada9 100644 --- a/designer-base/src/main/java/com/fr/design/dcm/UniversalDcmBridge.java +++ b/designer-base/src/main/java/com/fr/design/dcm/UniversalDcmBridge.java @@ -2,6 +2,8 @@ package com.fr.design.dcm; import com.fr.decision.webservice.bean.BaseBean; import com.fr.design.bridge.exec.JSBridge; +import com.teamdev.jxbrowser.chromium.Browser; +import com.teamdev.jxbrowser.chromium.JSObject; /** * @author richie @@ -11,18 +13,18 @@ import com.fr.design.bridge.exec.JSBridge; */ public class UniversalDcmBridge { - public static UniversalDcmBridge getBridge() { - return new UniversalDcmBridge(); + public static UniversalDcmBridge getBridge(Browser browser) { + return new UniversalDcmBridge(browser); } + private JSObject window; - private UniversalDcmBridge() { - + private UniversalDcmBridge(Browser browser) { + this.window = browser.executeJavaScriptAndReturnValue("window").asObject(); } /** * 获取所有的数据连接 - * * @return 数据连接集合 */ @JSBridge diff --git a/designer-base/src/main/java/com/fr/design/ui/Assistant.java b/designer-base/src/main/java/com/fr/design/ui/Assistant.java new file mode 100644 index 000000000..3962692c7 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/ui/Assistant.java @@ -0,0 +1,68 @@ +package com.fr.design.ui; + +import com.fr.stable.StringUtils; +import com.teamdev.jxbrowser.chromium.Browser; +import com.teamdev.jxbrowser.chromium.BrowserContext; +import com.teamdev.jxbrowser.chromium.ProtocolService; +import com.teamdev.jxbrowser.chromium.URLResponse; + +import javax.activation.MimetypesFileTypeMap; +import java.io.DataInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-03-07 + */ +public class Assistant { + + public static URLResponse inputStream2Response(InputStream inputStream, String filePath) throws Exception { + URLResponse response = new URLResponse(); + DataInputStream stream = new DataInputStream(inputStream); + byte[] data = new byte[stream.available()]; + stream.readFully(data); + response.setData(data); + String mimeType = getMimeType(filePath); + response.getHeaders().setHeader("Content-Type", mimeType); + return response; + } + + + private static String getMimeType(String path) { + if (StringUtils.isBlank(path)) { + return "text/html"; + } + if (path.endsWith(".html")) { + return "text/html"; + } + if (path.endsWith(".css")) { + return "text/css"; + } + if (path.endsWith(".js")) { + return "text/javascript"; + } + if (path.endsWith(".svg")) { + return "image/svg+xml"; + } + Path file = new File(path).toPath(); + try { + return Files.probeContentType(file); + } catch (IOException e) { + return "text/html"; + } + } + + public static void setEmbProtocolHandler(Browser browser, EmbProtocolHandler handler) { + BrowserContext browserContext = browser.getContext(); + ProtocolService protocolService = browserContext.getProtocolService(); + // 支持读取jar包中文件的自定义协议————emb:/com/fr/design/images/bbs.png + protocolService.setProtocolHandler("emb", handler); + protocolService.setProtocolHandler("file", handler); + } +} diff --git a/designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java b/designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java new file mode 100644 index 000000000..04d2f0f85 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java @@ -0,0 +1,130 @@ +package com.fr.design.ui; + +import com.fr.base.TemplateUtils; +import com.fr.general.IOUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.EncodeConstants; +import com.fr.stable.StringUtils; +import com.fr.third.org.apache.commons.codec.net.URLCodec; +import com.fr.third.org.apache.commons.io.FileUtils; +import com.fr.third.org.apache.commons.io.FilenameUtils; +import com.fr.web.struct.AssembleComponent; +import com.fr.web.struct.AtomBuilder; +import com.fr.web.struct.PathGroup; +import com.fr.web.struct.category.ScriptPath; +import com.fr.web.struct.category.StylePath; +import com.teamdev.jxbrowser.chromium.ProtocolHandler; +import com.teamdev.jxbrowser.chromium.URLRequest; +import com.teamdev.jxbrowser.chromium.URLResponse; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringReader; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.util.Map; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-03-07 + */ +public class EmbProtocolHandler implements ProtocolHandler { + + private AssembleComponent component; + private Map map; + + public EmbProtocolHandler() { + + } + + public EmbProtocolHandler(AssembleComponent component) { + this.component = component; + } + + public EmbProtocolHandler(AssembleComponent component, Map map) { + this.component = component; + this.map = map; + } + + public EmbProtocolHandler(Map map) { + this.map = map; + } + + @Override + public URLResponse onRequest(URLRequest req) { + InputStream inputStream = null; + try { + String path = req.getURL(); + if (path.startsWith("file:")) { + String url = new URLCodec().decode(path); + String filePath = TemplateUtils.renderParameter4Tpl(url, map); + File file = new File(URI.create(filePath).getPath()); + inputStream = IOUtils.readResource(file.getAbsolutePath()); + String text = IOUtils.inputStream2String(inputStream, EncodeConstants.ENCODING_UTF_8); + text = TemplateUtils.renderParameter4Tpl(text, map); + return Assistant.inputStream2Response(new ByteArrayInputStream(text.getBytes(StandardCharsets.UTF_8)), path); + } else if (path.startsWith("emb:dynamic")) { + URLResponse response = new URLResponse(); + response.setData(htmlText(map).getBytes()); + response.getHeaders().setHeader("Content-Type", "text/html"); + return response; + } else { + int index = path.indexOf("="); + if (index > 0) { + path = path.substring(index + 1); + } else { + path = path.substring(4); + } + inputStream = IOUtils.readResource(path); + return Assistant.inputStream2Response(inputStream, path); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().info(e.getMessage()); + } finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } + return null; + } + + private String htmlText(Map map) { + PathGroup pathGroup = AtomBuilder.create().buildAssembleFilePath(ModernRequestClient.KEY, component); + StylePath[] stylePaths = pathGroup.toStylePathGroup(); + StringBuilder styleText = new StringBuilder(); + for (StylePath path : stylePaths) { + if (StringUtils.isNotBlank(path.toFilePath())) { + styleText.append(""); + } + } + String result = ModernUIConstants.HTML_TPL.replaceAll("##style##", styleText.toString()); + ScriptPath[] scriptPaths = pathGroup.toScriptPathGroup(); + StringBuilder scriptText = new StringBuilder(); + for (ScriptPath path : scriptPaths) { + if (StringUtils.isNotBlank(path.toFilePath())) { + scriptText.append(""); + } + } + result = result.replaceAll("##script##", scriptText.toString()); + if (map != null) { + for (Map.Entry entry : map.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + result = result.replaceAll("\\$\\{" + key + "}", value); + } + } + return result; + } +} diff --git a/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java b/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java index 5b53e2ba8..4a92d3715 100644 --- a/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java +++ b/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java @@ -7,18 +7,21 @@ import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.i18n.Toolkit; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.web.struct.AssembleComponent; -import com.teamdev.jxbrowser.browser.Browser; -import com.teamdev.jxbrowser.browser.callback.InjectJsCallback; -import com.teamdev.jxbrowser.engine.Engine; -import com.teamdev.jxbrowser.engine.EngineOptions; -import com.teamdev.jxbrowser.engine.RenderingMode; -import com.teamdev.jxbrowser.js.JsObject; -import com.teamdev.jxbrowser.net.Network; -import com.teamdev.jxbrowser.net.callback.InterceptRequestCallback; -import com.teamdev.jxbrowser.view.swing.BrowserView; +import com.teamdev.jxbrowser.chromium.Browser; +import com.teamdev.jxbrowser.chromium.BrowserPreferences; +import com.teamdev.jxbrowser.chromium.JSValue; +import com.teamdev.jxbrowser.chromium.events.FinishLoadingEvent; +import com.teamdev.jxbrowser.chromium.events.LoadAdapter; +import com.teamdev.jxbrowser.chromium.events.LoadListener; +import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; +import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; +import com.teamdev.jxbrowser.chromium.events.ScriptContextListener; +import com.teamdev.jxbrowser.chromium.swing.BrowserView; import javax.swing.*; import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.util.Map; /** @@ -39,8 +42,9 @@ public class ModernUIPane extends BasicPane { } private void initialize() { - setLayout(new BorderLayout()); if (browser == null) { + setLayout(new BorderLayout()); + BrowserPreferences.setChromiumSwitches("--disable-google-traffic"); if (DesignerEnvManager.getEnvManager().isOpenDebug()) { UIToolbar toolbar = new UIToolbar(); add(toolbar, BorderLayout.NORTH); @@ -51,67 +55,75 @@ public class ModernUIPane extends BasicPane { UIButton closeButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Close_Window")); toolbar.add(closeButton); - openDebugButton.addActionListener(e -> showDebuggerDialog()); + openDebugButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + showDebuggerDialog(); + } + }); - reloadButton.addActionListener(e -> browser.navigation().reloadIgnoringCache()); + reloadButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + browser.reloadIgnoringCache(); + } + }); - closeButton.addActionListener(e -> SwingUtilities.getWindowAncestor(ModernUIPane.this).setVisible(false)); + closeButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + SwingUtilities.getWindowAncestor(ModernUIPane.this).setVisible(false); + } + }); + BrowserPreferences.setChromiumSwitches("--remote-debugging-port=9222"); initializeBrowser(); - add(BrowserView.newInstance(browser), BorderLayout.CENTER); + add(new BrowserView(browser), BorderLayout.CENTER); } else { initializeBrowser(); - add(BrowserView.newInstance(browser), BorderLayout.CENTER); + add(new BrowserView(browser), BorderLayout.CENTER); } } } private void showDebuggerDialog() { JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(this)); - Engine engine = Engine.newInstance( - EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED) - .addSwitch("--disable-google-traffic") - .remoteDebuggingPort(9222).build()); - Browser debugger = engine.newBrowser(); - BrowserView debuggerView = BrowserView.newInstance(debugger); + Browser debugger = new Browser(); + BrowserView debuggerView = new BrowserView(debugger); dialog.add(debuggerView, BorderLayout.CENTER); dialog.setSize(new Dimension(800, 400)); GUICoreUtils.centerWindow(dialog); dialog.setVisible(true); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - browser.devTools().remoteDebuggingUrl().ifPresent(url -> { - debugger.navigation().loadUrl(url); - }); + debugger.loadURL(browser.getRemoteDebuggingURL()); } private void initializeBrowser() { - Engine engine = Engine.newInstance(EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").build()); - browser = engine.newBrowser(); + browser = new Browser(); // 初始化的时候,就把命名空间对象初始化好,确保window.a.b.c("a.b.c"为命名空间)对象都是初始化过的 - browser.set(InjectJsCallback.class, params -> { - params.frame().executeJavaScript(String.format(ModernUIConstants.SCRIPT_INIT_NAME_SPACE, namespace)); - return InjectJsCallback.Response.proceed(); + browser.addScriptContextListener(new ScriptContextAdapter() { + @Override + public void onScriptContextCreated(ScriptContextEvent event) { + event.getBrowser().executeJavaScript(String.format(ModernUIConstants.SCRIPT_INIT_NAME_SPACE, namespace)); + } }); } /** * 转向一个新的地址,相当于重新加载 - * * @param url 新的地址 */ public void redirect(String url) { - browser.navigation().loadUrl(url); + browser.loadURL(url); } /** * 转向一个新的地址,相当于重新加载 - * * @param url 新的地址 * @param map 初始化参数 */ public void redirect(String url, Map map) { - Network network = browser.engine().network(); - network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network, map)); - browser.navigation().loadUrl(url); + Assistant.setEmbProtocolHandler(browser, new EmbProtocolHandler(map)); + browser.loadURL(url); } @Override @@ -121,18 +133,19 @@ public class ModernUIPane extends BasicPane { public void populate(final T t) { - browser.set(InjectJsCallback.class, params -> { - JsObject ns = params.frame().executeJavaScript("window." + namespace); - if (ns != null) { - ns.putProperty(variable, t); + browser.addScriptContextListener(new ScriptContextAdapter() { + @Override + public void onScriptContextCreated(ScriptContextEvent event) { + JSValue ns = event.getBrowser().executeJavaScriptAndReturnValue("window." + namespace); + ns.asObject().setProperty(variable, t); } - return InjectJsCallback.Response.proceed(); }); } public T update() { - if (browser.mainFrame().isPresent()) { - return browser.mainFrame().get().executeJavaScript("window." + namespace + "." + expression); + JSValue jsValue = browser.executeJavaScriptAndReturnValue("window." + namespace + "." + expression); + if (jsValue.isObject()) { + return (T)jsValue.asJavaObject(); } return null; } @@ -141,89 +154,79 @@ public class ModernUIPane extends BasicPane { private ModernUIPane pane = new ModernUIPane<>(); - public Builder prepare(InjectJsCallback callback) { - pane.browser.set(InjectJsCallback.class, callback); + public Builder prepare(ScriptContextListener contextListener) { + pane.browser.addScriptContextListener(contextListener); + return this; + } + + public Builder prepare(LoadListener loadListener) { + pane.browser.addLoadListener(loadListener); return this; } /** * 加载jar包中的资源 - * * @param path 资源路径 */ public Builder withEMB(final String path) { - Network network = pane.browser.engine().network(); - network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network)); - pane.browser.navigation().loadUrl("emb:" + path); + Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler()); + pane.browser.loadURL("emb:" + path); return this; } /** * 加载url指向的资源 - * * @param url 文件的地址 */ public Builder withURL(final String url) { - Network network = pane.browser.engine().network(); - network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network)); - pane.browser.navigation().loadUrl(url); + Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler()); + pane.browser.loadURL(url); return this; } /** * 加载url指向的资源 - * * @param url 文件的地址 */ public Builder withURL(final String url, Map map) { - Network network = pane.browser.engine().network(); - network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network, map)); - pane.browser.navigation().loadUrl(url); + Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler(map)); + pane.browser.loadURL(url); return this; } /** * 加载Atom组件 - * * @param component Atom组件 */ public Builder withComponent(AssembleComponent component) { - Network network = pane.browser.engine().network(); - network.set(InterceptRequestCallback.class, new NxComplexInterceptRequestCallback(network, component)); - pane.browser.navigation().loadUrl("emb:dynamic"); + Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler(component)); + pane.browser.loadURL("emb:dynamic"); return this; } /** * 加载Atom组件 - * * @param component Atom组件 */ public Builder withComponent(AssembleComponent component, Map map) { - Network network = pane.browser.engine().network(); - network.set(InterceptRequestCallback.class, new NxComplexInterceptRequestCallback(network, component, map)); - pane.browser.navigation().loadUrl("emb:dynamic"); + Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler(component, map)); + pane.browser.loadURL("emb:dynamic"); return this; } /** * 加载html文本内容 - * * @param html 要加载html文本内容 */ public Builder withHTML(String html) { - Network network = pane.browser.engine().network(); - network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network)); - pane.browser.mainFrame().ifPresent(frame -> { - frame.loadHtml(html); - }); + Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler()); + pane.browser.loadHTML(html); return this; } /** * 设置该前端页面做数据交换所使用的对象 - * * @param namespace 对象名 */ public Builder namespace(String namespace) { @@ -233,7 +236,6 @@ public class ModernUIPane extends BasicPane { /** * java端往js端传数据时使用的变量名字 - * * @param name 变量的名字 */ public Builder variable(String name) { @@ -243,7 +245,6 @@ public class ModernUIPane extends BasicPane { /** * js端往java端传数据时执行的函数表达式 - * * @param expression 函数表达式 */ public Builder expression(String expression) { diff --git a/designer-base/src/main/java/com/fr/design/ui/NxComplexInterceptRequestCallback.java b/designer-base/src/main/java/com/fr/design/ui/NxComplexInterceptRequestCallback.java deleted file mode 100644 index 9e9705695..000000000 --- a/designer-base/src/main/java/com/fr/design/ui/NxComplexInterceptRequestCallback.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.fr.design.ui; - -import com.fr.general.IOUtils; -import com.fr.stable.StringUtils; -import com.fr.web.struct.AssembleComponent; -import com.fr.web.struct.AtomBuilder; -import com.fr.web.struct.PathGroup; -import com.fr.web.struct.category.ScriptPath; -import com.fr.web.struct.category.StylePath; -import com.teamdev.jxbrowser.net.Network; -import com.teamdev.jxbrowser.net.UrlRequest; -import com.teamdev.jxbrowser.net.callback.InterceptRequestCallback; - -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.Map; - -/** - * @author richie - * @version 10.0 - * Created by richie on 2020/3/25 - */ -public class NxComplexInterceptRequestCallback extends NxInterceptRequestCallback { - - private AssembleComponent component; - - public NxComplexInterceptRequestCallback(Network network, AssembleComponent component) { - super(network); - this.component = component; - } - - public NxComplexInterceptRequestCallback(Network network, AssembleComponent component, Map map) { - super(network, map); - this.component = component; - } - - @Override - protected Response next(UrlRequest urlRequest, String path) { - if (path.startsWith("emb:dynamic")) { - String text = htmlText(map); - return InterceptRequestCallback.Response.intercept(generateBasicUrlRequestJob(urlRequest, "text/html", text.getBytes(StandardCharsets.UTF_8))); - } else { - int index = path.indexOf("="); - if (index > 0) { - path = path.substring(index + 1); - } else { - path = path.substring(4); - } - InputStream inputStream = IOUtils.readResource(path); - return InterceptRequestCallback.Response.intercept(generateBasicUrlRequestJob(urlRequest, getMimeType(path), IOUtils.inputStream2Bytes(inputStream))); - } - } - - private String htmlText(Map map) { - PathGroup pathGroup = AtomBuilder.create().buildAssembleFilePath(ModernRequestClient.KEY, component); - StylePath[] stylePaths = pathGroup.toStylePathGroup(); - StringBuilder styleText = new StringBuilder(); - for (StylePath path : stylePaths) { - if (StringUtils.isNotBlank(path.toFilePath())) { - styleText.append(""); - } - } - String result = ModernUIConstants.HTML_TPL.replaceAll("##style##", styleText.toString()); - ScriptPath[] scriptPaths = pathGroup.toScriptPathGroup(); - StringBuilder scriptText = new StringBuilder(); - for (ScriptPath path : scriptPaths) { - if (StringUtils.isNotBlank(path.toFilePath())) { - scriptText.append(""); - } - } - result = result.replaceAll("##script##", scriptText.toString()); - if (map != null) { - for (Map.Entry entry : map.entrySet()) { - String key = entry.getKey(); - String value = entry.getValue(); - result = result.replaceAll("\\$\\{" + key + "}", value); - } - } - return result; - } -} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/ui/NxInterceptRequestCallback.java b/designer-base/src/main/java/com/fr/design/ui/NxInterceptRequestCallback.java deleted file mode 100644 index ea921efe0..000000000 --- a/designer-base/src/main/java/com/fr/design/ui/NxInterceptRequestCallback.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.fr.design.ui; - -import com.fr.base.TemplateUtils; -import com.fr.general.IOUtils; -import com.fr.log.FineLoggerFactory; -import com.fr.stable.ArrayUtils; -import com.fr.stable.EncodeConstants; -import com.fr.stable.StringUtils; -import com.fr.third.org.apache.commons.codec.net.URLCodec; -import com.teamdev.jxbrowser.net.HttpHeader; -import com.teamdev.jxbrowser.net.HttpStatus; -import com.teamdev.jxbrowser.net.Network; -import com.teamdev.jxbrowser.net.UrlRequest; -import com.teamdev.jxbrowser.net.UrlRequestJob; -import com.teamdev.jxbrowser.net.callback.InterceptRequestCallback; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Map; -import java.util.Optional; - -/** - * @author richie - * @version 10.0 - * Created by richie on 2020/3/25 - */ -public class NxInterceptRequestCallback implements InterceptRequestCallback { - - Network network; - Map map; - - public NxInterceptRequestCallback(Network network) { - this.network = network; - } - - public NxInterceptRequestCallback(Network network, Map map) { - this.network = network; - this.map = map; - } - - @Override - public Response on(Params params) { - UrlRequest urlRequest = params.urlRequest(); - String path = urlRequest.url(); - if (path.startsWith("file:")) { - Optional optional = generateFileProtocolUrlRequestJob(urlRequest, path); - if (optional.isPresent()) { - return InterceptRequestCallback.Response.intercept(optional.get()); - } - } else { - return next(urlRequest, path); - } - return Response.proceed(); - } - - Response next(UrlRequest urlRequest, String path) { - return Response.proceed(); - } - - private Optional generateFileProtocolUrlRequestJob(UrlRequest urlRequest, String path) { - try { - String url = new URLCodec().decode(path); - String filePath = TemplateUtils.renderParameter4Tpl(url, map); - File file = new File(URI.create(filePath).getPath()); - InputStream inputStream = IOUtils.readResource(file.getAbsolutePath()); - String mimeType = getMimeType(path); - byte[] bytes; - if (isPlainText(mimeType)) { - String text = IOUtils.inputStream2String(inputStream, EncodeConstants.ENCODING_UTF_8); - text = TemplateUtils.renderParameter4Tpl(text, map); - bytes = text.getBytes(StandardCharsets.UTF_8); - } else { - bytes = IOUtils.inputStream2Bytes(inputStream); - } - return Optional.of(generateBasicUrlRequestJob(urlRequest, mimeType, bytes)); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - return Optional.empty(); - } - - private boolean isPlainText(String mimeType) { - return ArrayUtils.contains(new String[]{"text/html", "text/javascript", "text/css"}, mimeType); - } - - UrlRequestJob generateBasicUrlRequestJob(UrlRequest urlRequest, String mimeType, byte[] bytes) { - UrlRequestJob.Options options = UrlRequestJob.Options - .newBuilder(urlRequest.id(), HttpStatus.OK) - .addHttpHeader(HttpHeader.of("Content-Type", mimeType)) - .build(); - UrlRequestJob urlRequestJob = network.newUrlRequestJob(options); - urlRequestJob.write(bytes); - urlRequestJob.complete(); - return urlRequestJob; - } - - String getMimeType(String path) { - if (StringUtils.isBlank(path)) { - return "text/html"; - } - if (path.endsWith(".html")) { - return "text/html"; - } - if (path.endsWith(".css")) { - return "text/css"; - } - if (path.endsWith(".js")) { - return "text/javascript"; - } - if (path.endsWith(".svg")) { - return "image/svg+xml"; - } - if (path.endsWith(".png")) { - return "image/png"; - } - if (path.endsWith(".jpeg")) { - return "image/jpeg"; - } - if (path.endsWith(".gif")) { - return "image/gif"; - } - Path file = new File(path).toPath(); - try { - return Files.probeContentType(file); - } catch (IOException e) { - return "text/html"; - } - } -} diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java index 65b1c6b3b..46bb11b3c 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java @@ -6,7 +6,6 @@ import com.fr.config.ServerPreferenceConfig; import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader; import com.fr.design.bridge.exec.JSBridge; import com.fr.design.bridge.exec.JSCallback; -import com.fr.design.bridge.exec.JSExecutor; import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginUtils; import com.fr.design.extra.exe.GetInstalledPluginsExecutor; @@ -29,8 +28,10 @@ import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginMarker; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import com.teamdev.jxbrowser.js.JsAccessible; -import com.teamdev.jxbrowser.js.JsObject; +import com.teamdev.jxbrowser.chromium.Browser; +import com.teamdev.jxbrowser.chromium.JSArray; +import com.teamdev.jxbrowser.chromium.JSFunction; +import com.teamdev.jxbrowser.chromium.JSObject; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; @@ -51,45 +52,42 @@ import java.util.concurrent.RunnableFuture; */ public class UpmBridge { - public static UpmBridge getBridge() { - return new UpmBridge(); + public static UpmBridge getBridge(Browser browser) { + return new UpmBridge(browser); } + private JSObject window; - private UpmBridge() { - + private UpmBridge(Browser browser) { + this.window = browser.executeJavaScriptAndReturnValue("window").asObject(); } /** * 更新插件管理中心资源文件,这个方法仅仅是为了语义上的作用(更新) - * * @param callback 安装完成后的回调函数 */ @JSBridge - @JsAccessible - public void update(final JsObject callback) { - callback.call(JSExecutor.CALLBACK_FUNCTION_NAME, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start")); + public void update(final JSFunction callback) { + callback.invoke(window, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start")); try { UpmResourceLoader.INSTANCE.download(); UpmResourceLoader.INSTANCE.install(); - callback.call(JSExecutor.CALLBACK_FUNCTION_NAME, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success")); + callback.invoke(window, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success")); EventDispatcher.fire(DownloadEvent.UPDATE, "success"); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - callback.call(JSExecutor.CALLBACK_FUNCTION_NAME, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error")); + callback.invoke(window, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error")); } } /** * 下载并安装插件管理中心的资源文件 - * * @param callback 安装完成后的回调函数 */ @JSBridge - @JsAccessible - public void startDownload(final JsObject callback) { - callback.call(JSExecutor.CALLBACK_FUNCTION_NAME, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start")); - new SwingWorker() { + public void startDownload(final JSFunction callback) { + callback.invoke(window, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start")); + new SwingWorker(){ @Override protected Void doInBackground() throws Exception { UpmResourceLoader.INSTANCE.download(); @@ -101,10 +99,10 @@ public class UpmBridge { protected void done() { try { get(); - callback.call(JSExecutor.CALLBACK_FUNCTION_NAME, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success")); + callback.invoke(window, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success")); EventDispatcher.fire(DownloadEvent.SUCCESS, "success"); } catch (Exception e) { - callback.call(JSExecutor.CALLBACK_FUNCTION_NAME, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error")); + callback.invoke(window, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error")); FineLoggerFactory.getLogger().error(e.getMessage(), e); EventDispatcher.fire(DownloadEvent.ERROR, "error"); } @@ -114,44 +112,37 @@ public class UpmBridge { /** * 获取upm的版本信息 - * * @return 版本信息 */ @JSBridge - @JsAccessible public String getVersion() { return ServerPreferenceConfig.getInstance().getOptimizedUPMVersion(); } @JSBridge - @JsAccessible public String i18nText(String key) { return Toolkit.i18nText(key); } @JSBridge - @JsAccessible public void closeWindow() { UpmFinder.closeWindow(); } @JSBridge - @JsAccessible public boolean isDesigner() { return true; } @JSBridge - @JsAccessible - public void getPackInfo(final JsObject callback) { - callback.call(JSExecutor.CALLBACK_FUNCTION_NAME, StringUtils.EMPTY); + public void getPackInfo(final JSFunction callback) { + callback.invoke(window, StringUtils.EMPTY); } @JSBridge - @JsAccessible - public void getPluginPrefix(final JsObject callback) { - UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(callback)), new GetPluginPrefixExecutor()); + public void getPluginPrefix(final JSFunction callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new GetPluginPrefixExecutor()); task.execute(); } @@ -161,9 +152,8 @@ public class UpmBridge { * @param callback 回调函数 */ @JSBridge - @JsAccessible - public void getPluginCategories(final JsObject callback) { - UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(callback)), new GetPluginCategoriesExecutor()); + public void getPluginCategories(final JSFunction callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new GetPluginCategoriesExecutor()); task.execute(); } @@ -174,9 +164,8 @@ public class UpmBridge { * @param callback 回调函数 */ @JSBridge - @JsAccessible - public void getPluginFromStoreNew(String info, final JsObject callback) { - UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(callback)), new GetPluginFromStoreExecutor(new JSONObject(info))); + public void getPluginFromStoreNew(String info, final JSFunction callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new GetPluginFromStoreExecutor(new JSONObject(info))); task.execute(); } @@ -184,9 +173,8 @@ public class UpmBridge { * 已安装插件检查更新 */ @JSBridge - @JsAccessible - public void readUpdateOnline(final JsObject callback) { - UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(callback)), new ReadUpdateOnlineExecutor()); + public void readUpdateOnline(final JSFunction callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new ReadUpdateOnlineExecutor()); task.execute(); } @@ -194,9 +182,8 @@ public class UpmBridge { * 获取已经安装的插件的数组 */ @JSBridge - @JsAccessible - public void getInstalledPlugins(final JsObject callback) { - UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(callback)), new GetInstalledPluginsExecutor()); + public void getInstalledPlugins(final JSFunction callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new GetInstalledPluginsExecutor()); task.execute(); } @@ -206,36 +193,29 @@ public class UpmBridge { * @param pluginIDs 插件集合 */ @JSBridge - @JsAccessible - public void updatePluginOnline(JsObject pluginIDs, final JsObject callback) { - JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(callback)); + public void updatePluginOnline(Object pluginIDs, final JSFunction callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); List pluginMarkerList = new ArrayList<>(); - for (String key : pluginIDs.propertyNames()) { - pluginIDs.property(key).ifPresent(v -> { - pluginMarkerList.add(PluginUtils.createPluginMarker(GeneralUtils.objectToString(v))); - }); + if (pluginIDs instanceof String) { + pluginMarkerList.add(PluginUtils.createPluginMarker(pluginIDs.toString())); + } else if (pluginIDs instanceof JSArray) { + JSArray pluginInfos = (JSArray) pluginIDs; + for (int i = 0, len = pluginInfos.length(); i < len; i++) { + String value = pluginInfos.get(i).asString().getValue(); + pluginMarkerList.add(PluginUtils.createPluginMarker(value)); + } } PluginOperateUtils.updatePluginOnline(pluginMarkerList, jsCallback); } - @JSBridge - @JsAccessible - public void updatePluginOnline(String pluginID, final JsObject callback) { - JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(callback)); - List pluginMarkerList = new ArrayList<>(); - pluginMarkerList.add(PluginUtils.createPluginMarker(pluginID)); - PluginOperateUtils.updatePluginOnline(pluginMarkerList, jsCallback); - } - /** * 搜索在线插件 * * @param keyword 关键字 */ @JSBridge - @JsAccessible - public void searchPlugin(String keyword, final JsObject callback) { - UpmTaskWorker worker = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(callback)), new SearchOnlineExecutor(keyword)); + public void searchPlugin(String keyword, final JSFunction callback) { + UpmTaskWorker worker = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new SearchOnlineExecutor(keyword)); worker.execute(); } @@ -245,9 +225,8 @@ public class UpmBridge { * @param filePath 插件包的路径 */ @JSBridge - @JsAccessible - public void installPluginFromDisk(final String filePath, final JsObject callback) { - JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(callback)); + public void installPluginFromDisk(final String filePath, final JSFunction callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); File file = new File(filePath); PluginOperateUtils.installPluginFromDisk(file, jsCallback); } @@ -258,9 +237,8 @@ public class UpmBridge { * @param pluginInfo 插件信息 */ @JSBridge - @JsAccessible - public void uninstallPlugin(final String pluginInfo, final boolean isForce, final JsObject callback) { - JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(callback)); + public void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSFunction callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); PluginOperateUtils.uninstallPlugin(pluginInfo, isForce, jsCallback); } @@ -271,9 +249,8 @@ public class UpmBridge { * @param callback 回调函数 */ @JSBridge - @JsAccessible - public void installPluginOnline(final String pluginInfo, final JsObject callback) { - JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(callback)); + public void installPluginOnline(final String pluginInfo, final JSFunction callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); PluginOperateUtils.installPluginOnline(pluginMarker, jsCallback); } @@ -283,10 +260,8 @@ public class UpmBridge { * * @param filePath 插件包的路径 */ - @JSBridge - @JsAccessible - public void updatePluginFromDisk(String filePath, final JsObject callback) { - JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(callback)); + public void updatePluginFromDisk(String filePath, final JSFunction callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); File file = new File(filePath); PluginOperateUtils.updatePluginFromDisk(file, jsCallback); } @@ -297,9 +272,8 @@ public class UpmBridge { * @param pluginID 插件ID */ @JSBridge - @JsAccessible - public void setPluginActive(String pluginID, final JsObject callback) { - JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(callback)); + public void setPluginActive(String pluginID, final JSFunction callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); PluginOperateUtils.setPluginActive(pluginID, jsCallback); } @@ -309,7 +283,6 @@ public class UpmBridge { * @return 选择的文件的路径 */ @JSBridge - @JsAccessible public String showFileChooser() { return showFileChooserWithFilter(StringUtils.EMPTY, StringUtils.EMPTY); } @@ -323,7 +296,6 @@ public class UpmBridge { * 这里换用JFileChooser会卡死,不知道为什么 */ @JSBridge - @JsAccessible public String showFileChooserWithFilter(final String des, final String filter) { RunnableFuture future = new FutureTask<>(new Callable() { @Override @@ -359,60 +331,31 @@ public class UpmBridge { * @return 选择的文件的路径 */ @JSBridge - @JsAccessible - public String showFileChooserWithFilters(final String des, final String args) { - RunnableFuture future = new FutureTask<>(() -> { - JFileChooser fileChooser = new JFileChooser(); - List filterList = new ArrayList<>(); - filterList.add(args); - String[] filters = filterList.toArray(new String[0]); - if (ArrayUtils.isNotEmpty(filters)) { - FileNameExtensionFilter filter = new FileNameExtensionFilter(des, UpmUtils.findMatchedExtension(filters)); - fileChooser.setFileFilter(filter); - } - int result = fileChooser.showOpenDialog(UpmFinder.getDialog()); - if (result == JFileChooser.APPROVE_OPTION) { - return fileChooser.getSelectedFile().getAbsolutePath(); - } - return null; - }); - SwingUtilities.invokeLater(future); - try { - return future.get(); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - return null; - } - - /** - * 选择文件对话框 - * - * @param des 过滤文件描述 - * @param args 文件的后缀 - * @return 选择的文件的路径 - */ - @JSBridge - @JsAccessible - public String showFileChooserWithFilters(final String des, final JsObject args) { - RunnableFuture future = new FutureTask<>(() -> { - JFileChooser fileChooser = new JFileChooser(); - List filterList = new ArrayList<>(); - for (String key : args.propertyNames()) { - args.property(key).ifPresent(v -> { - filterList.add(GeneralUtils.objectToString(v)); - }); - } - String[] filters = filterList.toArray(new String[0]); - if (ArrayUtils.isNotEmpty(filters)) { - FileNameExtensionFilter filter = new FileNameExtensionFilter(des, UpmUtils.findMatchedExtension(filters)); - fileChooser.setFileFilter(filter); - } - int result = fileChooser.showOpenDialog(UpmFinder.getDialog()); - if (result == JFileChooser.APPROVE_OPTION) { - return fileChooser.getSelectedFile().getAbsolutePath(); + public String showFileChooserWithFilters(final String des, final Object args) { + RunnableFuture future = new FutureTask<>(new Callable() { + @Override + public String call() { + JFileChooser fileChooser = new JFileChooser(); + List filterList = new ArrayList<>(); + if (args instanceof String) { + filterList.add(GeneralUtils.objectToString(args)); + } else if (args instanceof JSArray) { + JSArray array = (JSArray)args; + for (int i = 0, len = array.length(); i < len; i ++) { + filterList.add(array.get(i).getStringValue()); + } + } + String[] filters = filterList.toArray(new String[0]); + if (ArrayUtils.isNotEmpty(filters)) { + FileNameExtensionFilter filter = new FileNameExtensionFilter(des, UpmUtils.findMatchedExtension(filters)); + fileChooser.setFileFilter(filter); + } + int result = fileChooser.showOpenDialog(UpmFinder.getDialog()); + if (result == JFileChooser.APPROVE_OPTION) { + return fileChooser.getSelectedFile().getAbsolutePath(); + } + return null; } - return null; }); SwingUtilities.invokeLater(future); try { @@ -429,8 +372,7 @@ public class UpmBridge { * 获取系统登录的用户名 */ @JSBridge - @JsAccessible - public String getLoginInfo(final JsObject callback) { + public String getLoginInfo(final JSFunction callback) { registerLoginInfo(callback); return MarketConfig.getInstance().getBbsUsername(); } @@ -441,9 +383,8 @@ public class UpmBridge { * @param callback 回调函数 */ @JSBridge - @JsAccessible - public void registerLoginInfo(final JsObject callback) { - JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(callback)); + public void registerLoginInfo(final JSFunction callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); String username = MarketConfig.getInstance().getBbsUsername(); if (StringUtils.isEmpty(username)) { jsCallback.execute(StringUtils.EMPTY); @@ -463,16 +404,14 @@ public class UpmBridge { * @param callback 回调函数 */ @JSBridge - @JsAccessible - public void defaultLogin(String username, String password, final JsObject callback) { - UpmTaskWorker worker = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(callback)), new PluginLoginExecutor(username, password)); + public void defaultLogin(String username, String password, final JSFunction callback) { + UpmTaskWorker worker = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new PluginLoginExecutor(username, password)); worker.execute(); } /** * 清除用户信息 */ - @JsAccessible public void clearUserInfo() { MarketConfig.getInstance().setInShowBBsName(StringUtils.EMPTY); FinePassportManager.getInstance().logout(); @@ -483,7 +422,6 @@ public class UpmBridge { * 打开论坛消息界面 */ @JSBridge - @JsAccessible public void getPriviteMessage() { try { String loginUrl = CloudCenter.getInstance().acquireUrlByKind("bbs.default"); @@ -497,7 +435,6 @@ public class UpmBridge { * 忘记密码 */ @JSBridge - @JsAccessible public void forgetHref() { try { Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.reset"))); @@ -510,7 +447,6 @@ public class UpmBridge { * 立即注册 */ @JSBridge - @JsAccessible public void registerHref() { try { Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.register"))); @@ -521,11 +457,9 @@ public class UpmBridge { /** * 使用系统浏览器打开网页 - * * @param url 要打开的网页 */ @JSBridge - @JsAccessible public void openShopUrlAtWebBrowser(String url) { if (Desktop.isDesktopSupported()) { try { diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java index ea55c7537..4febad3a9 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java @@ -58,7 +58,7 @@ public class UpmFinder { public static void showUPMDialog() { boolean flag = true; try { - Class.forName("com.teamdev.jxbrowser.browser.Browser"); + Class.forName("com.teamdev.jxbrowser.chromium.Browser"); } catch (ClassNotFoundException e) { flag = false; } @@ -88,7 +88,7 @@ public class UpmFinder { dialog.setVisible(true); } } else { - FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message")); + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message")); UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); dialog.setAutoUpdateAfterInit(); dialog.showDialog(); diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java b/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java index f4019cf06..1bc4b9e94 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java @@ -6,8 +6,9 @@ import com.fr.design.upm.event.DownloadEvent; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; -import com.teamdev.jxbrowser.browser.callback.InjectJsCallback; -import com.teamdev.jxbrowser.js.JsObject; +import com.teamdev.jxbrowser.chromium.JSValue; +import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; +import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; import java.awt.*; @@ -31,10 +32,12 @@ public class UpmShowPane extends BasicPane { // 先屏蔽掉这个判断,后续可能修改交互 // if (UpmFinder.checkUPMResourcesExist()) { modernUIPane = new ModernUIPane.Builder<>() - .prepare(params -> { - JsObject window = params.frame().executeJavaScript("window"); - window.putProperty("PluginHelper", UpmBridge.getBridge()); - return InjectJsCallback.Response.proceed(); + .prepare(new ScriptContextAdapter() { + @Override + public void onScriptContextCreated(ScriptContextEvent event) { + JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); + window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser())); + } }) .withURL(UpmFinder.getMainResourcePath(), UpmUtils.renderMap()) .build(); diff --git a/designer-base/src/main/java/com/fr/design/upm/exec/UpmBrowserExecutor.java b/designer-base/src/main/java/com/fr/design/upm/exec/UpmBrowserExecutor.java index f2f10ffdf..572f7b5f2 100644 --- a/designer-base/src/main/java/com/fr/design/upm/exec/UpmBrowserExecutor.java +++ b/designer-base/src/main/java/com/fr/design/upm/exec/UpmBrowserExecutor.java @@ -1,7 +1,8 @@ package com.fr.design.upm.exec; import com.fr.design.bridge.exec.JSExecutor; -import com.teamdev.jxbrowser.js.JsObject; +import com.teamdev.jxbrowser.chromium.JSFunction; +import com.teamdev.jxbrowser.chromium.JSObject; /** * @author richie @@ -10,18 +11,20 @@ import com.teamdev.jxbrowser.js.JsObject; */ public class UpmBrowserExecutor implements JSExecutor { - public static UpmBrowserExecutor create(JsObject callback) { - return new UpmBrowserExecutor(callback); + public static UpmBrowserExecutor create(JSObject window, JSFunction callback) { + return new UpmBrowserExecutor(window, callback); } - private JsObject callback; + private JSObject window; + private JSFunction callback; - private UpmBrowserExecutor(JsObject callback) { + private UpmBrowserExecutor(JSObject window, JSFunction callback) { + this.window = window; this.callback = callback; } @Override public void executor(String newValue) { - callback.call(JSExecutor.CALLBACK_FUNCTION_NAME, newValue); + callback.invoke(window, newValue); } } diff --git a/pom.xml b/pom.xml index 711751c9f..407f1fd17 100644 --- a/pom.xml +++ b/pom.xml @@ -28,8 +28,8 @@ maven-compiler-plugin 3.1 - 1.8 - 1.8 + 1.7 + 1.7 From c937d1a162351ceb46b5a95bed713016711d1fa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 10 Jun 2020 11:12:45 +0800 Subject: [PATCH 71/76] =?UTF-8?q?CHART-14181=20=E5=9B=BE=E8=A1=A8=E7=A9=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/module/ChartEmptyDataStylePane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java b/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java index 1b0d19346..31718fda8 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java @@ -250,7 +250,7 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { ChartEmptyDataStyleConf manager = ChartEmptyDataStyleConf.getInstance(); emptyData.setSelectedIndex(manager.isOpenEmptyDataStyle() ? 0 : 1); imageData.setSelectedIndex(manager.isCustomEmptyDataStyle() ? 1 : 0); - //adjustRadioButton.setSelected(manager.isAdjust()); + adjustRadioButton.setSelected(manager.isAdjust()); emptyDataImage = manager.getEmptyDataImage(); checkEmptyDataStyle(); @@ -264,7 +264,7 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane { manager.setOpenEmptyDataStyle(emptyData.getSelectedIndex() == 0); manager.setCustomEmptyDataStyle(imageData.getSelectedIndex() == 1); - //manager.setAdjust(adjustRadioButton.isSelected()); + manager.setAdjust(adjustRadioButton.isSelected()); manager.setEmptyDataImage(emptyDataImage); } } From 9f7ae36eee9903209276c524c1dd5800ff96bda5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 10 Jun 2020 14:40:00 +0800 Subject: [PATCH 72/76] =?UTF-8?q?CHART-14106=20=E6=8E=A7=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E9=BC=A0=E6=A0=87=E6=97=B6=E9=97=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/style/VanChartPlotLegendPane.java | 18 +++++------------- .../designer/style/VanChartTitlePane.java | 17 ++++------------- 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java index 7e597bd5d..3c5e992b9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java @@ -253,23 +253,15 @@ public class VanChartPlotLegendPane extends BasicPane { }); customFloatPositionButton.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - if(!customFloatPositionButton.isSelected()){ - customFloatPositionButton.setSelected(true); - checkLayoutPaneVisible(); - checkDisplayStrategyUse(); - } - } - - @Override - public void mousePressed(MouseEvent e) { - location.setSelectedIndex(-1); - } @Override public void mouseReleased(MouseEvent e) { super.mouseReleased(e); + location.setSelectedIndex(-1); + customFloatPositionButton.setSelected(true); + checkLayoutPaneVisible(); + checkDisplayStrategyUse(); + if(customFloatPositionPane == null) { customFloatPositionPane = new VanChartFloatPositionPane(); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java index 908a75d21..761bf12fd 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java @@ -214,23 +214,14 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { }); customFloatPositionButton.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - if (!customFloatPositionButton.isSelected()) { - customFloatPositionButton.setSelected(true); - checkDisplayStrategyUse(); - } - } - - @Override - public void mousePressed(MouseEvent e) { - alignmentPane.setSelectedIndex(-1); - } - @Override public void mouseReleased(MouseEvent e) { super.mouseReleased(e); + alignmentPane.setSelectedIndex(-1); + customFloatPositionButton.setSelected(true); + checkDisplayStrategyUse(); + if (customFloatPositionPane == null) { customFloatPositionPane = new VanChartFloatPositionPane(); } From 47b66204eae7a2e20f8a8a27e129c8eca4e3fcac Mon Sep 17 00:00:00 2001 From: Harrison Date: Wed, 10 Jun 2020 15:40:07 +0800 Subject: [PATCH 73/76] =?UTF-8?q?REPORT-32149=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8A=A0=E5=AF=86=E3=80=91@harrison=E4=B8=A4=E4=B8=AA=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=BF=9B=E8=A1=8C=E6=8B=96=E5=85=A5=EF=BC=8C=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E9=A2=84=E8=A7=88=E5=BE=88=E5=A5=87=E6=80=AA=20?= =?UTF-8?q?=E5=8A=A0=E4=B8=80=E5=B1=82=E5=88=A4=E6=96=AD=EF=BC=8C=20?= =?UTF-8?q?=E5=86=85=E9=83=A8=E5=8F=AF=E8=83=BD=E6=9C=89=E5=BE=88=E5=A4=9A?= =?UTF-8?q?=E4=B8=AD=E4=B8=8D=E5=90=8C=E7=9A=84=20component.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/designer/creator/XCreator.java | 12 ++-- .../beans/models/AddingModelTest.java | 62 ++++++++++++++++++- 2 files changed, 69 insertions(+), 5 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index a5a59acc8..f4554069e 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -429,10 +429,14 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo xCreators.add(this); int componentCount = getComponentCount(); for (int i = 0; i < componentCount; i++) { - XCreator xCreator = (XCreator) getComponent(i); - //获取真实的 creator - XCreator realCreator = xCreator.getXCreator(); - realCreator.traversalNameRelatedXCreators(xCreators); + + Component component = getComponent(i); + if (component instanceof XCreator) { + XCreator xCreator = (XCreator) component; + //获取真实的 creator + XCreator realCreator = xCreator.getXCreator(); + realCreator.traversalNameRelatedXCreators(xCreators); + } } } diff --git a/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java b/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java index a6bd82300..7f17ef3a2 100644 --- a/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java +++ b/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java @@ -1,32 +1,45 @@ package com.fr.design.designer.beans.models; +import com.fr.base.chart.BaseChartCollection; import com.fr.config.dao.DaoContext; import com.fr.config.dao.impl.LocalClassHelperDao; import com.fr.config.dao.impl.LocalEntityDao; import com.fr.config.dao.impl.LocalXmlEntityDao; import com.fr.design.designer.creator.CRPropertyDescriptor; +import com.fr.design.designer.creator.XChartEditor; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.cardlayout.XWCardLayout; +import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.mainframe.FormDesigner; +import com.fr.design.module.DesignModuleFactory; import com.fr.form.main.Form; import com.fr.form.ui.ChartEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WTitleLayout; +import com.fr.stable.core.PropertyChangeListener; import org.easymock.EasyMock; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; import javax.swing.JComponent; import java.awt.Dimension; import java.awt.Rectangle; import java.beans.IntrospectionException; +@PrepareForTest({DesignModuleFactory.class}) +@PowerMockIgnore({"com.sun.*", "javax.*", "com.fr.jvm.assist.*"}) +@RunWith(PowerMockRunner.class) public class AddingModelTest { @Before @@ -99,7 +112,7 @@ public class AddingModelTest { FormDesigner mock = EasyMock.mock(FormDesigner.class); EasyMock.expect(mock.getTarget()).andReturn(form).anyTimes(); EasyMock.replay(mock); - + WCardLayout wCardLayout = new WCardLayout(20, 20); XWCardLayout xwCardLayout = new XWCardLayout(wCardLayout, new Dimension(40, 40)); AddingModel addingModel = new AddingModel(mock, xwCardLayout); @@ -113,6 +126,53 @@ public class AddingModelTest { } + @Test + public void testInstantiateCreator_containsNotXCreator() throws Exception { + + Form form = EasyMock.mock(Form.class); + EasyMock.expect(form.isNameExist("cardlayout")).andReturn(true).once(); + EasyMock.expect(form.isNameExist("cardlayout0")).andReturn(true).once(); + EasyMock.expect(form.isNameExist(EasyMock.anyString())).andReturn(false).anyTimes(); + EasyMock.replay(form); + + FormDesigner mock = EasyMock.mock(FormDesigner.class); + EasyMock.expect(mock.getTarget()).andReturn(form).anyTimes(); + EasyMock.replay(mock); + + PowerMock.mockStaticPartial(DesignModuleFactory.class, "getChartComponent"); + EasyMock.expect(DesignModuleFactory.getChartComponent(EasyMock.anyObject(BaseChartCollection.class))).andReturn(new MiddleChartComponent() { + @Override + public void populate(BaseChartCollection cc) { + + } + + @Override + public BaseChartCollection update() { + return null; + } + + @Override + public void reset() { + + } + + @Override + public void addStopEditingListener(PropertyChangeListener list) { + + } + }).anyTimes(); + PowerMock.replayAll(); + + Dimension dimension = new Dimension(20, 20); + + ChartEditor chartEditor1 = new ChartEditor(); + XCreator xCreator1 = new XChartEditor(chartEditor1, dimension); + + + AddingModel chartModel = new AddingModel(mock, xCreator1); + Assert.assertEquals("chart", xCreator1.toData().getWidgetName()); + } + private static class DemoCreator extends XCreator { private String widgetName; From c8d7663f3edad2755894bed798ead361bef3bd04 Mon Sep 17 00:00:00 2001 From: lucian Date: Wed, 10 Jun 2020 15:56:52 +0800 Subject: [PATCH 74/76] =?UTF-8?q?REPORT-33348=20=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E4=B8=8D=E5=8B=BE=E9=80=89=E8=AE=B0=E4=BD=8F?= =?UTF-8?q?=E5=AF=86=E7=A0=81=EF=BC=8C=E5=AF=86=E7=A0=81=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=B8=85=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 687a3fea0..cfe0840af 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -19,7 +19,6 @@ import com.fr.design.utils.DesignUtils; import com.fr.env.CheckServiceDialog; import com.fr.env.EnvListPane; import com.fr.exit.DesignerExiter; -import com.fr.general.GeneralContext; import com.fr.general.GeneralUtils; import com.fr.invoke.Reflect; import com.fr.json.JSONArray; @@ -31,7 +30,6 @@ import com.fr.process.engine.core.CarryMessageEvent; import com.fr.process.engine.core.FineProcessContext; import com.fr.rpc.Result; import com.fr.stable.AssistUtils; -import com.fr.stable.EnvChangedListener; import com.fr.stable.StringUtils; import com.fr.start.server.ServerTray; import com.fr.workspace.WorkContext; @@ -64,8 +62,6 @@ import static javax.swing.JOptionPane.QUESTION_MESSAGE; public class EnvChangeEntrance { - private String currentEnvName = ""; - public static EnvChangeEntrance getInstance() { return HOLDER.singleton; } @@ -76,13 +72,7 @@ public class EnvChangeEntrance { private EnvChangeEntrance() { - currentEnvName = DesignerEnvManager.getEnvManager().getCurEnvName(); - GeneralContext.addEnvChangedListener(new EnvChangedListener() { - @Override - public void envChanged() { - currentEnvName = DesignerEnvManager.getEnvManager().getCurEnvName(); - } - }); + } private boolean envListOkAction(EnvListPane envListPane, PopTipStrategy strategy) { @@ -381,7 +371,7 @@ public class EnvChangeEntrance { * 出现对话框,选择使用的工作环境 */ public void chooseEnv() { - chooseEnv(currentEnvName); + chooseEnv(DesignerEnvManager.getEnvManager().getCurEnvName()); } public void chooseEnv(final String envName) { @@ -395,7 +385,7 @@ public class EnvChangeEntrance { public void doOk() { envListOkAction(envListPane, PopTipStrategy.LATER); // 切换完成后清理密码 - updateSelectEnv(envName); + updateSelectEnv(DesignerEnvManager.getEnvManager().getCurEnvName()); } @Override @@ -416,7 +406,7 @@ public class EnvChangeEntrance { eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue())); } final EnvListPane envListPane = new EnvListPane(); - envListPane.populateEnvManager(currentEnvName); + envListPane.populateEnvManager(DesignerEnvManager.getEnvManager().getCurEnvName()); BasicDialog envListDialog = envListPane.showWindow(SwingUtilities.getWindowAncestor(DesignerContext.getDesignerFrame())); envListDialog.addDialogActionListener(new DialogActionAdapter() { @@ -426,7 +416,7 @@ public class EnvChangeEntrance { if (!envListOkAction(envListPane, PopTipStrategy.NOW)) { DesignerExiter.getInstance().execute(); } else { - updateSelectEnv(currentEnvName); + updateSelectEnv(DesignerEnvManager.getEnvManager().getCurEnvName()); } } From 1db565b58cfec6482668d9237b3463c3f4ba7b23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 10 Jun 2020 16:24:27 +0800 Subject: [PATCH 75/76] =?UTF-8?q?CHART-14062=20=E9=A2=84=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E9=85=8D=E8=89=B2=E9=83=BD=E8=A2=AB=E5=88=A0=E5=85=89=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../combobox/ColorSchemeComboBox.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java b/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java index db59179a3..e7a7ab929 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java @@ -2,6 +2,8 @@ package com.fr.design.chartx.component.combobox; import com.fr.base.ChartColorMatching; import com.fr.base.ChartPreStyleConfig; +import com.fr.cert.token.lang.Collections; +import com.fr.chart.base.ChartConstants; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.i18n.Toolkit; @@ -60,13 +62,20 @@ public class ColorSchemeComboBox extends UIComboBox { //添加默认的方案和第一个方案 String defaultName = config.getCurrentStyle(); ChartColorMatching defaultStyle = (ChartColorMatching) config.getPreStyle(defaultName); - Object firstName = names.next(); - ChartColorMatching firstStyle = (ChartColorMatching) config.getPreStyle(firstName); - if (defaultStyle == null) { - defaultStyle = firstStyle; + if (names.hasNext()) { + Object firstName = names.next(); + ChartColorMatching firstStyle = (ChartColorMatching) config.getPreStyle(firstName); + if (defaultStyle == null) { + defaultStyle = firstStyle; + } + colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorMatchingToColorInfo(defaultStyle)); + colorSchemes.put(firstStyle.getId(), colorMatchingToColorInfo(firstStyle)); + } else { + ColorInfo colorInfo = new ColorInfo(); + colorInfo.setGradient(false); + colorInfo.setColors(Collections.arrayToList(ChartConstants.CHART_COLOR_ARRAY)); + colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorInfo); } - colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorMatchingToColorInfo(defaultStyle)); - colorSchemes.put(firstStyle.getId(), colorMatchingToColorInfo(firstStyle)); //添加其他的配色方案 while (names.hasNext()) { From a34c04c25102839a44be3824b4ee6ac3d84a3ce6 Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 10 Jun 2020 17:02:48 +0800 Subject: [PATCH 76/76] =?UTF-8?q?REPORT-33370=20=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=A3=80=E6=B5=8B=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=EF=BC=8C=E4=BE=9D=E8=B5=96dev=E7=89=88=E6=9C=AC=E7=9A=84core?= =?UTF-8?q?=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 011268767..5439b950b 100644 --- a/build.gradle +++ b/build.gradle @@ -68,7 +68,7 @@ allprojects { implementation 'org.apache.tomcat:tomcat-catalina:8.5.32' implementation 'io.socket:socket.io-client:0.7.0' implementation 'com.fr.third:fine-third:' + frVersion - implementation 'com.fr.core:fine-core:' + frVersion + implementation 'com.fr.core:fine-core:' + frDevVersion implementation 'com.fr.activator:fine-activator:' + frVersion implementation 'com.fr.datasource:fine-datasource:' + frVersion implementation 'com.fr.decision:fine-decision:' + frVersion