From 8833f95adeb3e88365ef9f687da04f3c993352d6 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 5 Dec 2018 10:00:58 +0800 Subject: [PATCH 01/93] =?UTF-8?q?REPORT-13194=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=E4=B8=80=E4=B8=8B=E5=8F=AF=E8=83=BD=E5=87=BA=E7=8E=B0=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E8=B6=8A=E7=95=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java b/designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java index 769ff4a60d..f205cca92f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java @@ -100,10 +100,9 @@ public class CheckBoxTreeCellRenderer extends NullPanel implements TreeCellRende Border border = treeCellRendererComponent.getBorder(); setBorder(border); treeCellRendererComponent.setBorder(BorderFactory.createEmptyBorder()); - //todo 可能会发生数组越界,需要处理一下 - if (getComponentCount() == 2) { - remove(1); - } + + remove((Component) this._actualTreeRenderer); + add(treeCellRendererComponent); } From 683ee67089bf8cc448dd9f0a7440005b187fe66a Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 5 Dec 2018 15:48:19 +0800 Subject: [PATCH 02/93] =?UTF-8?q?REPORT-12974=20pc=E7=AB=AF=E3=80=8B?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E3=80=81=E8=A1=A8=E5=8D=95=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E3=80=8B=E6=89=AB=E7=A0=81=E4=BC=98=E5=8C=96=E3=80=8B=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E5=B1=9E=E6=80=A7=E6=B2=A1=E6=9C=89=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=89=AB=E7=A0=81=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/WidgetPropertyPane.java | 7 +++++++ 1 file changed, 7 insertions(+) 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 af17389be0..da3e56ec13 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 @@ -16,6 +16,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.widget.ui.FormWidgetCardPane; import com.fr.design.widget.ui.designer.mobile.MobileWidgetDefinePane; +import com.fr.general.ComparatorUtils; import com.fr.stable.ArrayUtils; import javax.swing.*; @@ -173,7 +174,13 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper FormSelection selection = designer.getSelectionModel().getSelection(); WidgetPropertyUIProvider[] embeddedPropertyUIProviders = null; if (selection != null && selection.getSelectedCreator() != null) { + XCreator xCreator = selection.getSelectedCreator(); embeddedPropertyUIProviders = selection.getSelectedCreator().getWidgetPropertyUIProviders(); + if (xCreator instanceof XWScaleLayout + && ComparatorUtils.equals(((XWScaleLayout) xCreator).getXCreatorCount(), 1) + && ((XWScaleLayout) xCreator).getXCreator(0) instanceof XTextEditor) { + embeddedPropertyUIProviders = ((XWScaleLayout) xCreator).getXCreator(0).getWidgetPropertyUIProviders(); + } } Set set = ExtraDesignClassManager.getInstance().getArray(WidgetPropertyUIProvider.XML_TAG); return ArrayUtils.addAll(embeddedPropertyUIProviders, set.toArray(new WidgetPropertyUIProvider[set.size()])); From 67e4444afcf3bdbf66f020553608b6deb20faefe Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 5 Dec 2018 15:51:29 +0800 Subject: [PATCH 03/93] =?UTF-8?q?REPORT-12974=20pc=E7=AB=AF=E3=80=8B?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E3=80=81=E8=A1=A8=E5=8D=95=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E3=80=8B=E6=89=AB=E7=A0=81=E4=BC=98=E5=8C=96=E3=80=8B=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E5=B1=9E=E6=80=A7=E6=B2=A1=E6=9C=89=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=89=AB=E7=A0=81=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/WidgetPropertyPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 da3e56ec13..d355c2420b 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 @@ -175,7 +175,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper WidgetPropertyUIProvider[] embeddedPropertyUIProviders = null; if (selection != null && selection.getSelectedCreator() != null) { XCreator xCreator = selection.getSelectedCreator(); - embeddedPropertyUIProviders = selection.getSelectedCreator().getWidgetPropertyUIProviders(); + embeddedPropertyUIProviders = xCreator.getWidgetPropertyUIProviders(); if (xCreator instanceof XWScaleLayout && ComparatorUtils.equals(((XWScaleLayout) xCreator).getXCreatorCount(), 1) && ((XWScaleLayout) xCreator).getXCreator(0) instanceof XTextEditor) { From ac98b10c8090d476bb699946f862a2eca7f0d0e3 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 5 Dec 2018 15:56:16 +0800 Subject: [PATCH 04/93] =?UTF-8?q?REPORT-11830=20=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=8F=90=E7=A4=BA=E7=9A=84=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E6=A1=86=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/file/export/AbstractExportAction.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java index 4d9c976ce9..536fc87ee5 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -9,9 +9,9 @@ import com.fr.design.mainframe.JTemplate; import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.file.FILE; import com.fr.file.FILEChooserPane; -import com.fr.io.exporter.ExporterKey; import com.fr.file.filter.ChooseFileFilter; import com.fr.io.exporter.DesignExportType; +import com.fr.io.exporter.ExporterKey; import com.fr.log.FineLoggerFactory; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; @@ -178,7 +178,7 @@ public abstract class AbstractExportAction> extends JT JOptionPane.showMessageDialog( DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Engine_Remote_Design_Permission_Denied"), - null, + UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon") ); @@ -189,7 +189,7 @@ public abstract class AbstractExportAction> extends JT JOptionPane.showMessageDialog( DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + path, - null, + UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon") ); From 8066d95cf7aae08451abac65d72659b42008daeb Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 5 Dec 2018 16:50:08 +0800 Subject: [PATCH 05/93] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/WidgetPropertyPane.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) 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 d355c2420b..5a25ad1ecf 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 @@ -174,18 +174,26 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper FormSelection selection = designer.getSelectionModel().getSelection(); WidgetPropertyUIProvider[] embeddedPropertyUIProviders = null; if (selection != null && selection.getSelectedCreator() != null) { - XCreator xCreator = selection.getSelectedCreator(); - embeddedPropertyUIProviders = xCreator.getWidgetPropertyUIProviders(); - if (xCreator instanceof XWScaleLayout - && ComparatorUtils.equals(((XWScaleLayout) xCreator).getXCreatorCount(), 1) - && ((XWScaleLayout) xCreator).getXCreator(0) instanceof XTextEditor) { - embeddedPropertyUIProviders = ((XWScaleLayout) xCreator).getXCreator(0).getWidgetPropertyUIProviders(); - } + embeddedPropertyUIProviders = getEmbeddedPropertyUIProviders(selection.getSelectedCreator()); } Set set = ExtraDesignClassManager.getInstance().getArray(WidgetPropertyUIProvider.XML_TAG); return ArrayUtils.addAll(embeddedPropertyUIProviders, set.toArray(new WidgetPropertyUIProvider[set.size()])); } + /** + * 获取当前控件扩展的属性tab + * @param xCreator + * @return + */ + private WidgetPropertyUIProvider[] getEmbeddedPropertyUIProviders(XCreator xCreator) { + if (xCreator instanceof XWScaleLayout + && ComparatorUtils.equals(((XWScaleLayout) xCreator).getXCreatorCount(), 1) + && ((XWScaleLayout) xCreator).getXCreator(0) instanceof XTextEditor) { + return ((XWScaleLayout) xCreator).getXCreator(0).getWidgetPropertyUIProviders(); + } + return xCreator.getWidgetPropertyUIProviders(); + } + /** * 判断是将拓展的tab放入属性表还是将原来的tab放入属性表 * From b38901e8b13ed29e0842f37299bf9a95eaa7b528 Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 5 Dec 2018 19:20:18 +0800 Subject: [PATCH 06/93] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/creator/XWScaleLayout.java | 13 +++++++++++++ .../fr/design/mainframe/WidgetPropertyPane.java | 17 +---------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWScaleLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWScaleLayout.java index 2ffe6c6eb7..1db5e40451 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWScaleLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWScaleLayout.java @@ -10,6 +10,7 @@ import java.awt.event.ContainerEvent; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRScaleLayoutAdapter; import com.fr.design.form.layout.FRScaleLayout; +import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WScaleLayout; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; @@ -166,4 +167,16 @@ public class XWScaleLayout extends DedicateLayoutContainer { XCreator child = getXCreator(INDEX); child.firePropertyChange(); } + + /** + * 获取被包装的XCreator扩展的属性tab + * @return + */ + @Override + public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { + if (this.getXCreatorCount() > 0) { + return this.getXCreator(0).getWidgetPropertyUIProviders(); + } + return super.getWidgetPropertyUIProviders(); + } } \ No newline at end of file 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 5a25ad1ecf..af17389be0 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 @@ -16,7 +16,6 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.widget.ui.FormWidgetCardPane; import com.fr.design.widget.ui.designer.mobile.MobileWidgetDefinePane; -import com.fr.general.ComparatorUtils; import com.fr.stable.ArrayUtils; import javax.swing.*; @@ -174,26 +173,12 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper FormSelection selection = designer.getSelectionModel().getSelection(); WidgetPropertyUIProvider[] embeddedPropertyUIProviders = null; if (selection != null && selection.getSelectedCreator() != null) { - embeddedPropertyUIProviders = getEmbeddedPropertyUIProviders(selection.getSelectedCreator()); + embeddedPropertyUIProviders = selection.getSelectedCreator().getWidgetPropertyUIProviders(); } Set set = ExtraDesignClassManager.getInstance().getArray(WidgetPropertyUIProvider.XML_TAG); return ArrayUtils.addAll(embeddedPropertyUIProviders, set.toArray(new WidgetPropertyUIProvider[set.size()])); } - /** - * 获取当前控件扩展的属性tab - * @param xCreator - * @return - */ - private WidgetPropertyUIProvider[] getEmbeddedPropertyUIProviders(XCreator xCreator) { - if (xCreator instanceof XWScaleLayout - && ComparatorUtils.equals(((XWScaleLayout) xCreator).getXCreatorCount(), 1) - && ((XWScaleLayout) xCreator).getXCreator(0) instanceof XTextEditor) { - return ((XWScaleLayout) xCreator).getXCreator(0).getWidgetPropertyUIProviders(); - } - return xCreator.getWidgetPropertyUIProviders(); - } - /** * 判断是将拓展的tab放入属性表还是将原来的tab放入属性表 * From 1e3fb2584ca2d5ef808df331763ab34d8acf99bc Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 5 Dec 2018 20:08:35 +0800 Subject: [PATCH 07/93] =?UTF-8?q?REPORT-11611=20=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E4=B8=89=E6=9C=9F=3D>=E4=BA=A4=E4=BA=92=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webattr/printsettings/AbstractNativePrintSettingPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java index f32e0c1153..2b22297837 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java @@ -373,7 +373,7 @@ public abstract class AbstractNativePrintSettingPane extends JPanel { {customPageRadioButton, specifiedAreaField, areaFieldTip}, {doublePrintRadioButton, doublePrintComboBox, new JPanel()} }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 8); } private JPanel getScalePane() { From 82c1c501287dc8d6a815c2ad1526ce9f85d5fce0 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 6 Dec 2018 15:41:47 +0800 Subject: [PATCH 08/93] =?UTF-8?q?REPORT-13276=20release=E4=BC=A0=E4=B8=80?= =?UTF-8?q?=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/bbs/BBSLoginUtils.java | 60 +--- .../com/fr/design/extra/LoginWebBridge.java | 83 +----- .../com/fr/design/extra/PluginWebBridge.java | 4 +- .../design/extra/ucenter/AbstractClient.java | 120 -------- .../com/fr/design/extra/ucenter/Client.java | 264 ------------------ .../fr/design/extra/ucenter/XMLHelper.java | 41 --- 6 files changed, 17 insertions(+), 555 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/extra/ucenter/AbstractClient.java delete mode 100644 designer-base/src/main/java/com/fr/design/extra/ucenter/Client.java delete mode 100644 designer-base/src/main/java/com/fr/design/extra/ucenter/XMLHelper.java diff --git a/designer-base/src/main/java/com/fr/design/bbs/BBSLoginUtils.java b/designer-base/src/main/java/com/fr/design/bbs/BBSLoginUtils.java index ea24c49da0..9e2ba9a733 100644 --- a/designer-base/src/main/java/com/fr/design/bbs/BBSLoginUtils.java +++ b/designer-base/src/main/java/com/fr/design/bbs/BBSLoginUtils.java @@ -1,14 +1,8 @@ package com.fr.design.bbs; -import com.fr.config.BBSAttr; -import com.fr.config.Configuration; -import com.fr.config.MarketConfig; +import com.fr.base.passport.FinePassportManager; import com.fr.log.FineLoggerFactory; -import com.fr.stable.StringUtils; -import com.fr.transaction.Configurations; -import com.fr.transaction.Worker; -import java.util.List; /** * Created by ibm on 2017/8/21. @@ -16,62 +10,14 @@ import java.util.List; public class BBSLoginUtils { public static void bbsLogin(final String username, final String password) { - final BBSAttr bbsAttr = new BBSAttr(); - bbsAttr.setBbsUsername(username); - bbsAttr.setBbsPassword(password); try { - Configurations.update(new Worker() { - @Override - public void run() { - MarketConfig.getInstance().setBBsAttr(bbsAttr); - } - @Override - public Class[] targets() { - return new Class[]{MarketConfig.class}; - } - }); - - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - - public static void bbsLogin(List list) { - try { - String uid = list.get(0); - String username = list.get(1); - String password = list.get(2); - final BBSAttr bbsAttr = new BBSAttr(); - bbsAttr.setBbsUsername(username); - bbsAttr.setBbsPassword(password); - bbsAttr.setBbsUid(Integer.parseInt(uid)); - bbsAttr.setInShowBBsName(username); - Configurations.update(new Worker() { - @Override - public void run() { - MarketConfig.getInstance().setBBsAttr(bbsAttr); - } - @Override - public Class[] targets() { - return new Class[]{MarketConfig.class}; - } - }); - + FinePassportManager.getInstance().login(username, password); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } public static void bbsLogout() { - final BBSAttr bbsAttr = new BBSAttr(); - bbsAttr.setBbsUsername(StringUtils.EMPTY); - bbsAttr.setBbsPassword(StringUtils.EMPTY); - bbsAttr.setBbsUid(0); - bbsAttr.setInShowBBsName(StringUtils.EMPTY); - try { - MarketConfig.getInstance().setBBsAttr(bbsAttr); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + FinePassportManager.getInstance().logout(); } } 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 a89a4df031..43bb8131a4 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 @@ -1,23 +1,18 @@ package com.fr.design.extra; -import com.fr.base.FRContext; +import com.fr.base.passport.FinePassportManager; import com.fr.config.MarketConfig; -import com.fr.design.bbs.BBSLoginUtils; import com.fr.design.dialog.UIDialog; import com.fr.design.extra.exe.PluginLoginExecutor; -import com.fr.design.extra.ucenter.Client; -import com.fr.design.extra.ucenter.XMLHelper; import com.fr.design.gui.ilable.UILabel; import com.fr.general.CloudCenter; -import com.fr.general.ComparatorUtils; import com.fr.general.http.HttpClient; -import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; import com.fr.stable.EncodeConstants; import com.fr.stable.StringUtils; import javafx.concurrent.Task; import javafx.scene.web.WebEngine; import netscape.javascript.JSObject; - import javax.swing.JDialog; import javax.swing.SwingUtilities; import java.awt.Color; @@ -25,8 +20,6 @@ import java.awt.Desktop; import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URLEncoder; -import java.util.LinkedList; -import java.util.List; /** * @author vito @@ -150,7 +143,7 @@ public class LoginWebBridge { try { Thread.sleep(millis); } catch (InterruptedException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -161,7 +154,7 @@ public class LoginWebBridge { try { Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.register"))); } catch (Exception e) { - FRContext.getLogger().info(e.getMessage()); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -172,7 +165,7 @@ public class LoginWebBridge { try { Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.reset"))); } catch (Exception e) { - FRContext.getLogger().info(e.getMessage()); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -202,35 +195,16 @@ public class LoginWebBridge { if (!testConnection()) { return NET_FAILED; } - List loginResult = frPassport(userInfo, password); - String uid = loginResult.get(0); - String username = loginResult.get(1); - if (Integer.parseInt(uid) > 0) { - loginSuccess(username); - } - return uid; - } - - private List frPassport(String username, String password) { - LinkedList list = new LinkedList<>(); + int uid = 0; try { - Client uc = new Client(); - String result = uc.ucUserLogin(username, password); - result = new String(result.getBytes("iso-8859-1"), "gbk"); - list = XMLHelper.ucUnserialize(result); - if (list.size() > 0) { - int uid = Integer.parseInt(list.get(0)); - if (uid > 0) { - BBSLoginUtils.bbsLogin(list); - } - } else { - list.push(NET_FAILED); - } + uid = FinePassportManager.getInstance().login(userInfo, password); } catch (Exception e) { - FRContext.getLogger().info(e.getMessage()); - list.push(UNKNOWN_ERROR); + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + if (uid > 0) { + loginSuccess(MarketConfig.getInstance().getBbsUsername()); } - return list; + return String.valueOf(uid); } /** @@ -276,39 +250,6 @@ public class LoginWebBridge { } } - /** - * 获取用户信息 - * - * @param userInfo - */ - public void getLoginInfo(String userInfo) { - try { - JSONObject jo = new JSONObject(userInfo); - String status = jo.get("status").toString(); - if (ComparatorUtils.equals(status, LOGIN_SUCCESS)) { - String username = jo.get("username").toString(); - int uid = Integer.parseInt(jo.get("uid") == null ? StringUtils.EMPTY : jo.get("uid").toString()); - closeQQWindow(); - loginSuccess(username); - - LinkedList list = new LinkedList<>(); - list.add(String.valueOf(uid)); - list.add(username); - list.add(StringUtils.EMPTY); - BBSLoginUtils.bbsLogin(list); - } else if (ComparatorUtils.equals(status, LOGIN_FAILED)) { - //账号没有QQ授权 - closeQQWindow(); - try { - Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("QQ_binding"))); - } catch (Exception ignored) { - // ignored - } - } - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); - } - } public void openUrlAtLocalWebBrowser(WebEngine eng, String url) { if (url.indexOf("qqLogin.html") > 0) { 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 33d5276453..903418ec93 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 @@ -1,8 +1,8 @@ package com.fr.design.extra; +import com.fr.base.passport.FinePassportManager; import com.fr.config.MarketConfig; import com.fr.design.RestartHelper; -import com.fr.design.bbs.BBSLoginUtils; import com.fr.design.dialog.UIDialog; import com.fr.design.extra.exe.GetInstalledPluginsExecutor; import com.fr.design.extra.exe.GetPluginCategoriesExecutor; @@ -554,7 +554,7 @@ public class PluginWebBridge { */ public void clearUserInfo() { MarketConfig.getInstance().setInShowBBsName(StringUtils.EMPTY); - BBSLoginUtils.bbsLogout(); + FinePassportManager.getInstance().logout(); uiLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_UnSignIn")); } diff --git a/designer-base/src/main/java/com/fr/design/extra/ucenter/AbstractClient.java b/designer-base/src/main/java/com/fr/design/extra/ucenter/AbstractClient.java deleted file mode 100644 index 855e5a96e6..0000000000 --- a/designer-base/src/main/java/com/fr/design/extra/ucenter/AbstractClient.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.fr.design.extra.ucenter; - -import com.fr.base.Base64; -import com.fr.base.FRContext; -import com.fr.stable.StringUtils; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.Map; - -/** - * @author lp - * @date 2016/9/9 - */ -public abstract class AbstractClient { - - static final String UC_API_MYSQL = "ucApiMysql"; - static final String UC_API_POST = "ucApiPost"; - - protected String urlEncode(String value) { - return URLEncoder.encode(value); - } - - protected String md5(String input) { - MessageDigest md; - try { - md = MessageDigest.getInstance("MD5"); - } catch (NoSuchAlgorithmException e) { - FRContext.getLogger().info(e.getMessage()); - return ""; - } - return byte2hex(md.digest(input.getBytes())); - } - - protected String md5(long input) { - return md5(String.valueOf(input)); - } - - protected String base64Decode(String input) { - try { - return new String(Base64.decode(input)); - } catch (Exception e) { - FRContext.getLogger().info(e.getMessage()); - return ""; - } - } - - protected String base64Encode(String input) { - try { - return Base64.encode(input.getBytes("iso-8859-1")); - } catch (Exception e) { - FRContext.getLogger().info(e.getMessage()); - return ""; - } - } - - protected String byte2hex(byte[] b) { - StringBuilder hs = new StringBuilder(); - String stmp = ""; - for (byte aB : b) { - stmp = (Integer.toHexString(aB & 0XFF)); - if (stmp.length() == 1) { - hs.append("0").append(stmp); - } else { - hs.append(stmp); - } - } - return hs.toString(); - } - - protected String subStr(String input, int begin, int length) { - return input.substring(begin, begin + length); - } - - protected String subStr(String input, int begin) { - if (begin > 0) { - return input.substring(begin); - } else { - return input.substring(input.length() + begin); - } - } - - protected long microTime() { - return System.currentTimeMillis(); - } - - protected long time() { - return System.currentTimeMillis() / 1000; - } - - protected String sprintf(String format, long input) { - String temp = "0000000000" + input; - return temp.substring(temp.length() - 10); - } - - protected String callUserFunc(String function, String model, String action, Map args) { - if (UC_API_MYSQL.equals(function)) { - return this.ucApiMysql(model, action, args); - } - if (UC_API_POST.equals(function)) { - return this.ucApiPost(model, action, args); - } - return StringUtils.EMPTY; - } - - public abstract String ucApiPost(String module, String action, Map arg); - - public abstract String ucApiMysql(String model, String action, Map args); - - protected String urlEncode(String value, String code) { - try { - return URLEncoder.encode(value, code); - } catch (UnsupportedEncodingException e) { - FRContext.getLogger().info(e.getMessage()); - } - return ""; - } -} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/extra/ucenter/Client.java b/designer-base/src/main/java/com/fr/design/extra/ucenter/Client.java deleted file mode 100644 index 903286476e..0000000000 --- a/designer-base/src/main/java/com/fr/design/extra/ucenter/Client.java +++ /dev/null @@ -1,264 +0,0 @@ -package com.fr.design.extra.ucenter; - -import com.fr.base.FRContext; -import com.fr.general.CloudCenter; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.Socket; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** - * - * @author lp - * @date 2016/9/9 - */ -public class Client extends AbstractClient { - - private static String UC_IP = ""; - private static String UC_API = ""; - private static String UC_CONNECT = ""; - private static String UC_KEY = "Rc85U37411p4zdvcedm8D4t4D3l9Sa42H0kd98Gbd82aA99a61S2Z5LbQ9u430M0"; - private static String UC_APPID = "4"; - private static String UC_CLIENT_RELEASE = "20090212"; - public static String UC_ROOT = ""; - private static String UC_API_FUNC = "mysql".equals(UC_CONNECT) ? UC_API_MYSQL : UC_API_POST; - - public String ucUserLogin(String username, String password) { - return ucUserLogin(username, password, 0, 0); - } - - public String ucUserLogin(String username, String password, int isUid, int checkQues) { - return ucUserLogin(username, password, isUid, checkQues, "", ""); - } - - /** - * 用户登录 - * - * @param username 用户名 - * @param password 密码 - * @param isUid 是否为uid - * @param checkQues 是否使用安全问题 - * @param questionId 安全提问 - * @param answer 安全提问答案 - * @return array (uid/status, username, password, email) - */ - public String ucUserLogin(String username, String password, int isUid, int checkQues, String questionId, String answer) { - Map args = new HashMap<>(6); - args.put("username", username); - args.put("password", password); - args.put("isUid", isUid); - args.put("checkQues", checkQues); - args.put("questionId", questionId); - args.put("answer", answer); - String res = callUserFunc(UC_API_FUNC, "user", "login", args); - return "mysql".equals(UC_CONNECT) ? res : res; - } - - /** - * 拼接发送的post请求 - * - * @param module 模块 - * @param action 操作模式 - * @param arg 参数 - * @return 发送的请求加密内容 - */ - @Override - public String ucApiPost(String module, String action, Map arg) { - StringBuilder str = new StringBuilder(); - String sep = ""; - for (String k : arg.keySet()) { - Object v = arg.get(k); - k = urlEncode(k); - if (v.getClass().isAssignableFrom(Map.class)) { - StringBuilder s2 = new StringBuilder(); - String sep2 = ""; - for (String k2 : ((Map) v).keySet()) { - Object v2 = ((Map) v).get(k2); - k2 = urlEncode(k2); - s2.append(sep2).append("{").append(k).append("}[").append(k2).append("]=").append(urlEncode(String.valueOf(v2))); - sep2 = "&"; - } - str.append(sep).append(s2); - } else { - str.append(sep).append(k).append("=").append(urlEncode(String.valueOf(v), "GBK")); - } - sep = "&"; - } - String postData = ucApiRequestdata(module, action, str.toString(), ""); - UC_API = CloudCenter.getInstance().acquireUrlByKind("bbs.ucapi"); - UC_IP = CloudCenter.getInstance().acquireUrlByKind("bbs.ip"); - return ucFopen2(UC_API + "/index.php", 500000, postData, "", true, UC_IP, 20, true); - } - - @Override - public String ucApiMysql(String model, String action, Map args) { - return ""; - } - - public String ucApiInput(String data) { - return urlEncode(ucAuthCode(data + "&agent=" + md5("") + "&time=" + time(), "ENCODE", UC_KEY), "GBK"); - } - - protected String ucApiRequestdata(String module, String action, String arg, String extra) { - String input = ucApiInput(arg); - return "m=" + module + "&a=" + action + "&inajax=2&release=" + UC_CLIENT_RELEASE + "&input=" + input + "&appid=" + UC_APPID + extra; - } - - public String ucAuthCode(String string, String operation, String key) { - return ucAuthCode(string, operation, key, 0); - } - - /** - * 内容加密 - * - * @param string 原文 - * @param operation decode或者encode - * @param key 密钥 - * @param expiry 密文有效时限 - * @return 加密之后的原文 - */ - public String ucAuthCode(String string, String operation, String key, int expiry) { - int ckeyLength = 4; - key = md5(key != null ? key : UC_KEY); - String keya = md5(subStr(key, 0, 16)); - String keyb = md5(subStr(key, 16, 16)); - String keyc = "DECODE".equals(operation) ? subStr(string, 0, ckeyLength) : subStr(md5(microTime()), -ckeyLength); - String cryptkey = keya + md5(keya + keyc); - int keyLength = cryptkey.length(); - string = "DECODE".equals(operation) ? base64Decode(subStr(string, ckeyLength)) : sprintf("%010d", expiry > 0 ? expiry + time() : 0) + subStr(md5(string + keyb), 0, 16) + string; - int stringLength = string.length(); - StringBuilder result1 = new StringBuilder(); - int[] box = new int[256]; - for (int i = 0; i < 256; i++) { - box[i] = i; - } - int[] rndkey = new int[256]; - for (int i = 0; i <= 255; i++) { - rndkey[i] = (int) cryptkey.charAt(i % keyLength); - } - int j = 0; - for (int i = 0; i < 256; i++) { - j = (j + box[i] + rndkey[i]) % 256; - int tmp = box[i]; - box[i] = box[j]; - box[j] = tmp; - } - j = 0; - int a = 0; - for (int i = 0; i < stringLength; i++) { - a = (a + 1) % 256; - j = (j + box[a]) % 256; - int tmp = box[a]; - box[a] = box[j]; - box[j] = tmp; - result1.append((char) (((int) string.charAt(i)) ^ (box[(box[a] + box[j]) % 256]))); - } - if ("DECODE".equals(operation)) { - String result = result1.toString(); - try { - result = new String(result.getBytes("iso-8859-1"), "gbk"); - } catch (Exception e) { - result = result1.substring(0, result1.length()); - } - if ((Integer.parseInt(subStr(result, 0, 10)) == 0 || Long.parseLong(subStr(result, 0, 10)) - time() > 0) && subStr(result, 10, 16).equals(subStr(md5(subStr(result, 26) + keyb), 0, 16))) { - return subStr(result, 26); - } else { - return ""; - } - } else { - return keyc + base64Encode(result1.toString()).replaceAll("=", ""); - } - } - - protected String ucFopen2(String url, int limit, String post, String cookie, boolean bysocket, String ip, int timeout, boolean block) { - url += url.indexOf("?") > 0 ? "&" : "?" + "__times__=1"; - return ucFopen(url, limit, post, cookie, bysocket, ip, timeout, block); - } - - /** - * 本地模网络请求取数据 - * - * @param url 打开的url - * @param limit 取返回的数据的长度 - * @param post 要发送的 POST 数据,如uid=1&password=1234 - * @param cookie 要模拟的 COOKIE 数据,如uid=123&auth=a2323sd2323 - * @param bysocket TRUE/FALSE 是否通过SOCKET打开 - * @param ip IP地址 - * @param timeout 连接超时时间 - * @param block 是否为阻塞模式 defaul valuet:true - * @return 取到的字符串 - */ - private String ucFopen(String url, int limit, String post, String cookie, boolean bysocket, String ip, int timeout, boolean block) { - StringBuilder result = new StringBuilder(); - URL matches; - String host = ""; - String path = ""; - int port = 80; - try { - matches = new URL(url); - host = matches.getHost(); - path = matches.getPath() != null ? matches.getPath() + (matches.getQuery() != null ? "?" + matches.getQuery() : "") : "/"; - if (matches.getPort() > 0) port = matches.getPort(); - } catch (Exception e1) { - FRContext.getLogger().info(e1.getMessage()); - } - StringBuilder out = new StringBuilder(); - if (post != null && post.length() > 0) { - out.append("POST ").append(path).append(" HTTP/1.0\r\n"); - out.append("Accept: */*\r\n"); - out.append("Accept-Language: zh-cn\r\n"); - out.append("Content-Type: application/x-www-form-urlencoded\r\n"); - out.append("User-Agent: \r\n"); - out.append("Host: ").append(host).append("\r\n"); - out.append("Content-Length: ").append(post.length()).append("\r\n"); - out.append("Connection: Close\r\n"); - out.append("Cache-Control: no-cache\r\n"); - out.append("Cookie: \r\n\r\n"); - out.append(post); - } else { - out.append("GET $path HTTP/1.0\r\n"); - out.append("Accept: */*\r\n"); - out.append("Accept-Language: zh-cn\r\n"); - out.append("User-Agent: Java/1.5.0_01\r\n"); - out.append("Host: $host\r\n"); - out.append("Connection: Close\r\n"); - out.append("Cookie: $cookie\r\n\r\n"); - } - try { - Socket fp = new Socket(ip != null && ip.length() > 10 ? ip : host, port); - if (!fp.isConnected()) { - return ""; - } else { - OutputStream os = fp.getOutputStream(); - os.write(out.toString().getBytes()); - InputStream ins = fp.getInputStream(); - BufferedReader reader = new BufferedReader(new InputStreamReader(ins, "iso-8859-1")); - while (true) { - String header = reader.readLine(); - if (header == null || "".equals(header) || Objects.equals(header, "\r\n") || Objects.equals(header, "\n")) { - break; - } - } - while (true) { - String data = reader.readLine(); - if (data == null || "".equals(data)) { - break; - } else { - result.append(data); - } - } - fp.close(); - } - } catch (IOException e) { - FRContext.getLogger().info(e.getMessage()); - } - return result.toString(); - } -} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/extra/ucenter/XMLHelper.java b/designer-base/src/main/java/com/fr/design/extra/ucenter/XMLHelper.java deleted file mode 100644 index 697da6c56c..0000000000 --- a/designer-base/src/main/java/com/fr/design/extra/ucenter/XMLHelper.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.fr.design.extra.ucenter; - -import com.fr.base.FRContext; -import com.sun.org.apache.xerces.internal.parsers.DOMParser; -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -import java.io.IOException; -import java.io.StringReader; -import java.util.LinkedList; - -/** - * @author lp - * @date 2016/9/9 - */ -public class XMLHelper { - - public static LinkedList ucUnserialize(String input) { - - LinkedList result = new LinkedList(); - DOMParser parser = new DOMParser(); - try { - parser.parse(new InputSource(new StringReader(input))); - Document doc = parser.getDocument(); - NodeList nl = doc.getChildNodes().item(0).getChildNodes(); - int length = nl.getLength(); - for (int i = 0; i < length; i++) { - if (nl.item(i).getNodeType() == Document.ELEMENT_NODE) { - result.add(nl.item(i).getTextContent()); - } - } - } catch (SAXException e) { - FRContext.getLogger().info(e.getMessage()); - } catch (IOException e1) { - FRContext.getLogger().info(e1.getLocalizedMessage()); - } - return result; - } -} \ No newline at end of file From 3f7908f36ddc0e70e5f087567c9a700a9f39b53e Mon Sep 17 00:00:00 2001 From: qinghuiliu Date: Thu, 6 Dec 2018 17:53:42 +0800 Subject: [PATCH 09/93] =?UTF-8?q?CHART-3252=20=E8=B0=83=E8=8A=82=E8=BD=AE?= =?UTF-8?q?=E6=92=ADGis=E5=9C=B0=E5=9B=BE=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=8E=A7=E4=BB=B6=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/extended/chart/ExtendedCustomFieldComboBoxPane.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java b/designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java index ff1c9db411..ceeea71c2d 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java @@ -13,6 +13,7 @@ import com.fr.design.gui.itable.UITableEditor; import com.fr.design.gui.itextfield.UITextField; 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.CalculateComboBox; import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper; import com.fr.stable.StringUtils; @@ -49,7 +50,7 @@ public class ExtendedCustomFieldComboBoxPane extends UIComboBoxPane Date: Thu, 6 Dec 2018 18:58:00 +0800 Subject: [PATCH 10/93] =?UTF-8?q?REPORT-13018=20=E5=A4=A7=E8=B5=9B?= =?UTF-8?q?=E5=90=8E=E7=BB=AD=E5=BC=80=E4=B8=A4=E4=B8=AA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/loghandler/LogMessageBar.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java index 73f9ce9bdf..6209152433 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java @@ -68,4 +68,10 @@ public class LogMessageBar extends JPanel { public Dimension getPreferredSize() { return new Dimension(width, 24); } + + public void disposeLogDialog() { + if (dlg != null) { + dlg.dispose(); + } + } } \ No newline at end of file From b5a7103d22ddb908582bbb8c353faeebe506d846 Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 7 Dec 2018 11:10:24 +0800 Subject: [PATCH 11/93] =?UTF-8?q?REPORT-12850=2010.0mac=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=3D>=E5=85=AC=E5=BC=8F=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E7=AE=80=E5=8D=95=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaPane.java | 71 +++++++++++-------- .../FormulaPaneWhenReserveFormula.java | 2 +- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index c2c69299d1..e994bc1053 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -63,21 +63,21 @@ import java.util.Locale; */ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { - protected VariableTreeAndDescriptionArea variableTreeAndDescriptionArea; - protected RSyntaxTextArea formulaTextArea; - protected UITextField keyWordTextField = new UITextField(18); - protected int currentPosition = 0; - protected int beginPosition = 0; - protected int insertPosition = 0; - protected JList tipsList; + private VariableTreeAndDescriptionArea variableTreeAndDescriptionArea; + private RSyntaxTextArea formulaTextArea; + private UITextField keyWordTextField = new UITextField(18); + private int currentPosition = 0; + private int beginPosition = 0; + private int insertPosition = 0; + private JList tipsList; protected DefaultListModel listModel = new DefaultListModel(); - protected int ifHasBeenWriten = 0; - protected DefaultListModel functionTypeListModel = new DefaultListModel(); - protected QuickList functionTypeList; - protected DefaultListModel functionNameModel; - protected JList functionNameList; + private int ifHasBeenWriten = 0; + private DefaultListModel functionTypeListModel = new DefaultListModel(); + private QuickList functionTypeList; + private DefaultListModel functionNameModel; + private JList functionNameList; - public FormulaPane() { + FormulaPane() { initComponents(); } @@ -184,6 +184,18 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { protected void initComponents() { this.setLayout(new BorderLayout(4, 4)); + + initTextPane(); + initTipsPane(); + initVariableTreeAndDescriptionArea(); + } + + private void initVariableTreeAndDescriptionArea() { + variableTreeAndDescriptionArea = new VariableTreeAndDescriptionArea(); + this.add(variableTreeAndDescriptionArea, BorderLayout.SOUTH); + } + + private void initTextPane() { // text JPanel textPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); this.add(textPane, BorderLayout.CENTER); @@ -199,7 +211,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { textPane.add(formulaTextAreaScrollPane, BorderLayout.CENTER); textPane.add(checkBoxandbuttonPane, BorderLayout.SOUTH); - initTipsPane(); UIButton checkValidButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Check_Valid")); checkValidButton.addActionListener(checkValidActionListener); @@ -209,8 +220,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { checkBoxandbuttonPane.add(checkBoxPane, BorderLayout.WEST); checkBoxandbuttonPane.add(checkValidButton, BorderLayout.EAST); extendCheckBoxPane(checkBoxPane); - variableTreeAndDescriptionArea = new VariableTreeAndDescriptionArea(); - this.add(variableTreeAndDescriptionArea, BorderLayout.SOUTH); } @@ -218,7 +227,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } - protected void configFormulaArea() { + private void configFormulaArea() { formulaTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_FORMULA); formulaTextArea.setAnimateBracketMatching(true); formulaTextArea.setAntiAliasingEnabled(true); @@ -313,7 +322,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } } - protected void fixFunctionNameList() { + private void fixFunctionNameList() { if (tipsList.getSelectedValue() != null) { int signOfContinue = 1; int indexOfFunction = 0; @@ -346,7 +355,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } - protected int getBeginPosition() { + private int getBeginPosition() { int i = currentPosition; String textArea = formulaTextArea.getText(); for (; i > 0; i--) { @@ -361,7 +370,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { return i; } - protected void firstStepToFindTips(int theBeginPosition) { + private void firstStepToFindTips(int theBeginPosition) { String textArea = formulaTextArea.getText(); if (currentPosition > 0 && theBeginPosition < currentPosition) { @@ -443,7 +452,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { /** * Apply text. */ - public void applyText(String text) { + private void applyText(String text) { if (text == null || text.length() <= 0) { return; } @@ -541,7 +550,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } // check valid - protected ActionListener checkValidActionListener = new ActionListener() { + private ActionListener checkValidActionListener = new ActionListener() { public void actionPerformed(ActionEvent evt) { // Execute Formula default cell element. @@ -579,7 +588,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private JTree variablesTree; private UITextArea descriptionTextArea; - public VariableTreeAndDescriptionArea() { + VariableTreeAndDescriptionArea() { this.initComponents(); } @@ -802,13 +811,15 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void initComponents() { this.setLayout(new BorderLayout(4, 4)); - // Function + initVariablesTree(); + initFunctionPane(); + } + + private void initFunctionPane() { JPanel functionPane = new JPanel(new BorderLayout(4, 4)); this.add(functionPane, BorderLayout.WEST); initFunctionTypeList(functionPane); initFunctionNameList(functionPane); - initVariablesTree(); - // 选择: functionTypeList.setSelectedIndex(0); } @@ -959,7 +970,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private Icon icon; private String[] subNodes = new String[0]; - public TextFolderUserObject(String text, Icon icon, String[] subNodes) { + TextFolderUserObject(String text, Icon icon, String[] subNodes) { this.text = text; this.icon = icon; this.subNodes = subNodes; @@ -986,11 +997,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { public static class TextUserObject { - public TextUserObject(String text) { + TextUserObject(String text) { this(text, text); } - public TextUserObject(String text, String displayText) { + TextUserObject(String text, String displayText) { this.text = text; this.displayText = displayText; } @@ -999,7 +1010,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { return this.text; } - public String getDisplayText() { + String getDisplayText() { return this.displayText; } diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java index e08f7e3b40..d689c54df9 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java @@ -18,7 +18,7 @@ public class FormulaPaneWhenReserveFormula extends FormulaPane { private UICheckBox reserveCheckBox4Result; private UICheckBox reserveCheckBox4Write; - public FormulaPaneWhenReserveFormula() { + FormulaPaneWhenReserveFormula() { super(); } From b9b04e753d832a343f4dfe5bde559997cb30118e Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 7 Dec 2018 11:11:14 +0800 Subject: [PATCH 12/93] =?UTF-8?q?REPORT-12850=2010.0mac=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/formula/FunctionConstants.java | 64 +++++++++++-------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 4595b04ac0..0abc2f46e7 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -13,6 +13,7 @@ import com.fr.function.SUM; import com.fr.function.TIME; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.ExtraClassManager; import com.fr.stable.EncodeConstants; import com.fr.stable.OperatingSystem; @@ -225,39 +226,48 @@ public abstract class FunctionConstants { String pkgName = "com.fr.function"; Class iface = Function.class; ClassLoader classloader = iface.getClassLoader(); - URL url = classloader.getResource(pkgName.replace('.', '/')); - String classFilePath = url.getFile(); - - /* - * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 - * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 - */ + Enumeration urlEnumeration = null; try { - classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); - } catch (UnsupportedEncodingException e1) { - FRContext.getLogger().error(e1.getMessage(), e1); + urlEnumeration = classloader.getResources(pkgName.replace('.', '/')); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage()); } - FRContext.getLogger().info("ClassFilePath:" + classFilePath); - /* - * alex:如果是jar包中的class文件 - * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function - */ - for (String fileName : findClassNamesUnderFilePath(classFilePath)) { + while (urlEnumeration.hasMoreElements()) { + URL url = urlEnumeration.nextElement(); + String classFilePath = url.getFile(); + + /* + * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 + * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 + */ try { - Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); - if (StableUtils.classInstanceOf(cls, iface)) { - Function inst; - inst = (Function)cls.newInstance(); - for (int fi = 0; fi < EMBFUNCTIONS.length; fi++) { - if (EMBFUNCTIONS[fi].test(inst)) { - break; + classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); + } catch (UnsupportedEncodingException e1) { + FRContext.getLogger().error(e1.getMessage(), e1); + } + FRContext.getLogger().info("ClassFilePath:" + classFilePath); + /* + * alex:如果是jar包中的class文件 + * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function + */ + for (String fileName : findClassNamesUnderFilePath(classFilePath)) { + try { + Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); + System.out.println(pkgName + "." + fileName.substring(0, fileName.length() - 6)); + if (StableUtils.classInstanceOf(cls, iface)) { + Function inst; + inst = (Function)cls.newInstance(); + for (int fi = 0; fi < EMBFUNCTIONS.length; fi++) { + if (EMBFUNCTIONS[fi].test(inst)) { + break; + } } + } - + } catch (ClassNotFoundException e) { + } catch (InstantiationException e) { + } catch (IllegalAccessException e) { } - } catch (ClassNotFoundException e) { - } catch (InstantiationException e) { - } catch (IllegalAccessException e) { } } } From 4dccaabbbfc8a8c55cb996358a04c4d2b036d783 Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 7 Dec 2018 11:13:53 +0800 Subject: [PATCH 13/93] =?UTF-8?q?REPORT-13280=20=E3=80=90=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8=E3=80=91=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E5=90=8E=EF=BC=8C=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=8D=A1=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/CellElementPropertyPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/CellElementPropertyPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/CellElementPropertyPane.java index 42d4f1d397..7324300eba 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/CellElementPropertyPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/CellElementPropertyPane.java @@ -67,7 +67,7 @@ public class CellElementPropertyPane extends DockingView { } - public synchronized static CellElementPropertyPane getInstance() { + public static CellElementPropertyPane getInstance() { if (singleton == null) { synchronized (CellElementPropertyPane.class) { if (singleton == null) { From b8455e82a40a05e5030fc9f165ae0954ccc50f0d Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 7 Dec 2018 13:53:04 +0800 Subject: [PATCH 14/93] =?UTF-8?q?REPORT-12850=2010.0mac=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=3D>FunctionConstants=20=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/formula/FunctionConstants.java | 315 ++++++++++-------- .../design/formula/FunctionConstantsTest.java | 40 +++ 2 files changed, 208 insertions(+), 147 deletions(-) create mode 100644 designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 0abc2f46e7..750df1bad1 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -35,13 +35,75 @@ import java.util.zip.ZipFile; import javax.swing.DefaultListModel; -public abstract class FunctionConstants { - +public final class FunctionConstants { + + public static FunctionGroup PLUGIN = getPluginFunctionGroup(); + public static FunctionGroup CUSTOM = getCustomFunctionGroup(); + static NameAndFunctionList COMMON = getCommonFunctionList(); + static NameAndTypeAndFunctionList[] EMBFUNCTIONS = getEmbededFunctionListArray(); + public static FunctionGroup ALL = getAllFunctionGroup(); + + static { + loadEmbededFunctions(); + } + + /** + * Don't let anyone instantiate this class. + */ + private FunctionConstants() {} + + private static void loadEmbededFunctions() { + String pkgName = "com.fr.function"; + Class iface = Function.class; + ClassLoader classloader = iface.getClassLoader(); + Enumeration urlEnumeration = null; + try { + urlEnumeration = classloader.getResources(pkgName.replace('.', '/')); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + return; + } + while (urlEnumeration.hasMoreElements()) { + URL url = urlEnumeration.nextElement(); + String classFilePath = url.getFile(); + + /* + * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 + * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 + */ + try { + classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); + } catch (UnsupportedEncodingException e1) { + FRContext.getLogger().error(e1.getMessage(), e1); + } + FRContext.getLogger().info("ClassFilePath:" + classFilePath); + /* + * alex:如果是jar包中的class文件 + * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function + */ + for (String fileName : findClassNamesUnderFilePath(classFilePath)) { + try { + Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); + if (StableUtils.classInstanceOf(cls, iface)) { + Function inst; + inst = (Function)cls.newInstance(); + for (NameAndTypeAndFunctionList EMBFUNCTION : EMBFUNCTIONS) { + if (EMBFUNCTION.test(inst)) { + break; + } + } + } + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ignore) { + } + } + } + } + /** * 将函数分组插件中的函数添加到对应的列表中 * @param listModel */ - public static void addFunctionGroupFromPlugins(DefaultListModel listModel){ + static void addFunctionGroupFromPlugins(DefaultListModel listModel){ //hugh:自定义函数分组 Set containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); if(!containers.isEmpty()){ @@ -75,107 +137,15 @@ public abstract class FunctionConstants { } }; } - - public static FunctionGroup PLUGIN = new FunctionGroup() { - @Override - public String getGroupName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Formula_Plugin"); - } - - @Override - public NameAndDescription[] getDescriptions() { - FunctionDef[] fs = ExtraClassManager.getInstance().getFunctionDef(); - int count = fs.length; - FunctionDefNAD[] nads = new FunctionDefNAD[count]; - for (int i = 0; i < count; i ++) { - nads[i] = new FunctionDefNAD(fs[i]); - } - return nads; - } - }; - - public static FunctionGroup CUSTOM = new FunctionGroup() { - @Override - public String getGroupName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Custom_Function"); - } - - @Override - public NameAndDescription[] getDescriptions() { - FunctionConfig funtionManager = FunctionConfig.getInstance(); - if (funtionManager != null) { - int functionDefCount = funtionManager.getFunctionDefCount(); - - FunctionDefNAD[] nads = new FunctionDefNAD[functionDefCount]; - for (int i = 0; i < functionDefCount; i++) { - nads[i] = new FunctionDefNAD(funtionManager.getFunctionDef(i)); - } - - return nads; - } - - return new NameAndDescription[0]; - } - }; - - public static NameAndFunctionList COMMON = new NameAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Most_Recently_Used"), new Function[] { - new SUM(), new COUNT(), new AVERAGE(), new CHAR(), new DATE(), new MAX(), new MIN(), new TIME(), new RANGE() - }); - - public static NameAndTypeAndFunctionList[] EMBFUNCTIONS = new NameAndTypeAndFunctionList[] { - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Math_&_Trig"), Function.MATH), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Text"), Function.TEXT), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Date_&_Time"), Function.DATETIME), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Logical"), Function.LOGIC), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Array"), Function.ARRAY), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Report"), Function.REPORT), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Other"), Function.OTHER), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_Type_Hierarchy"), Function.HA) - }; - - public static FunctionGroup ALL = new FunctionGroup() { - @Override - public String getGroupName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_All"); - } - - @Override - public NameAndDescription[] getDescriptions() { - List all = new ArrayList(); - for (int i = 0; i < EMBFUNCTIONS.length; i++) { - all.addAll(Arrays.asList(EMBFUNCTIONS[i].getDescriptions())); - } - Collections.addAll(all, PLUGIN.getDescriptions()); - Collections.addAll(all, CUSTOM.getDescriptions()); - //hugh:自定义函数分组 - Set containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); - if(!containers.isEmpty()){ - for(Mutable container : containers){ - Collections.addAll(all,createFunctionGroup(((FunctionDefContainer)container)).getDescriptions()); - } - } - java.util.Collections.sort(all, NameAndDescriptionComparator); - - return all.toArray(new NameAndDescription[all.size()]); - } - }; - - private static Comparator NameAndDescriptionComparator = new Comparator() { - @Override - public int compare(NameAndDescription o1, NameAndDescription o2) { - return ComparatorUtils.compare(o1.getName(), o2.getName()); - } - }; - private static String[] findClassNamesUnderFilePath(String filePath) { java.util.List classNameList = new ArrayList(); /* * alex:如果是jar包中的class文件 * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function */ - if (filePath.indexOf("!/") >= 0) { + if (filePath.contains("!/")) { String[] arr = filePath.split("!/"); String jarPath = arr[0].substring(6); // alex:substring(6)去掉前面的file:/这六个字符 String classPath = arr[1]; @@ -198,7 +168,7 @@ public abstract class FunctionConstants { } String entryName = entry.getName(); - if (entryName.indexOf(classPath) < 0 || !entryName.endsWith(".class")) { + if (!entryName.contains(classPath) || !entryName.endsWith(".class")) { continue; } @@ -209,66 +179,117 @@ public abstract class FunctionConstants { } } else { File dir = new File(filePath); - - for (File f : dir.listFiles()) { - String fileName = f.getName(); - if (fileName.endsWith(".class")) { - classNameList.add(fileName); + File[] files = dir.listFiles(); + if (files != null) { + for (File f : files) { + String fileName = f.getName(); + if (fileName.endsWith(".class")) { + classNameList.add(fileName); + } } } } - return classNameList.toArray(new String[classNameList.size()]); + return classNameList.toArray(new String[0]); } - - // alex:读取com.fr.script.function包下面所有的Function类 - static { - String pkgName = "com.fr.function"; - Class iface = Function.class; - ClassLoader classloader = iface.getClassLoader(); - Enumeration urlEnumeration = null; - try { - urlEnumeration = classloader.getResources(pkgName.replace('.', '/')); - } catch (IOException e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } - while (urlEnumeration.hasMoreElements()) { - URL url = urlEnumeration.nextElement(); - String classFilePath = url.getFile(); - /* - * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 - * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 - */ - try { - classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); - } catch (UnsupportedEncodingException e1) { - FRContext.getLogger().error(e1.getMessage(), e1); + private static FunctionGroup getPluginFunctionGroup() { + return new FunctionGroup() { + @Override + public String getGroupName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Formula_Plugin"); } - FRContext.getLogger().info("ClassFilePath:" + classFilePath); - /* - * alex:如果是jar包中的class文件 - * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function - */ - for (String fileName : findClassNamesUnderFilePath(classFilePath)) { - try { - Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); - System.out.println(pkgName + "." + fileName.substring(0, fileName.length() - 6)); - if (StableUtils.classInstanceOf(cls, iface)) { - Function inst; - inst = (Function)cls.newInstance(); - for (int fi = 0; fi < EMBFUNCTIONS.length; fi++) { - if (EMBFUNCTIONS[fi].test(inst)) { - break; - } - } + @Override + public NameAndDescription[] getDescriptions() { + FunctionDef[] fs = ExtraClassManager.getInstance().getFunctionDef(); + int count = fs.length; + FunctionDefNAD[] nads = new FunctionDefNAD[count]; + for (int i = 0; i < count; i ++) { + nads[i] = new FunctionDefNAD(fs[i]); + } + return nads; + } + }; + } + + private static FunctionGroup getCustomFunctionGroup() { + return new FunctionGroup() { + @Override + public String getGroupName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Custom_Function"); + } + + @Override + public NameAndDescription[] getDescriptions() { + FunctionConfig funtionManager = FunctionConfig.getInstance(); + if (funtionManager != null) { + int functionDefCount = funtionManager.getFunctionDefCount(); + + FunctionDefNAD[] nads = new FunctionDefNAD[functionDefCount]; + for (int i = 0; i < functionDefCount; i++) { + nads[i] = new FunctionDefNAD(funtionManager.getFunctionDef(i)); + } + + return nads; + } + + return new NameAndDescription[0]; + } + }; + } + + private static NameAndFunctionList getCommonFunctionList() { + return new NameAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Most_Recently_Used"), new Function[] { + new SUM(), new COUNT(), new AVERAGE(), new CHAR(), new DATE(), new MAX(), new MIN(), new TIME(), new RANGE() + }); + } + + private static NameAndTypeAndFunctionList[] getEmbededFunctionListArray() { + return new NameAndTypeAndFunctionList[] { + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Math_&_Trig"), Function.MATH), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Text"), Function.TEXT), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Date_&_Time"), Function.DATETIME), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Logical"), Function.LOGIC), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Array"), Function.ARRAY), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Report"), Function.REPORT), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Other"), Function.OTHER), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_Type_Hierarchy"), Function.HA) + }; + } + + private static FunctionGroup getAllFunctionGroup() { + return new FunctionGroup() { + @Override + public String getGroupName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_All"); + } + + @Override + public NameAndDescription[] getDescriptions() { + List all = new ArrayList(); + for (int i = 0; i < EMBFUNCTIONS.length; i++) { + all.addAll(Arrays.asList(EMBFUNCTIONS[i].getDescriptions())); + } + Collections.addAll(all, PLUGIN.getDescriptions()); + Collections.addAll(all, CUSTOM.getDescriptions()); + //hugh:自定义函数分组 + Set containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); + if(!containers.isEmpty()){ + for(Mutable container : containers){ + Collections.addAll(all,createFunctionGroup(((FunctionDefContainer)container)).getDescriptions()); } - } catch (ClassNotFoundException e) { - } catch (InstantiationException e) { - } catch (IllegalAccessException e) { } + + Collections.sort(all, new Comparator() { + @Override + public int compare(NameAndDescription o1, NameAndDescription o2) { + return ComparatorUtils.compare(o1.getName(), o2.getName()); + } + }); + + return all.toArray(new NameAndDescription[0]); } - } + }; } } diff --git a/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java b/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java new file mode 100644 index 0000000000..33cfd577da --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java @@ -0,0 +1,40 @@ +package com.fr.design.formula; + +import org.junit.Test; + +import static junit.framework.Assert.fail; +import static junit.framework.TestCase.assertEquals; +import static junit.framework.TestCase.assertTrue; + +/** + * Created by plough on 2018/12/7. + */ +public class FunctionConstantsTest { + @Test + public void testNewInstanceFail() throws Exception { + try { + FunctionConstants.class.newInstance(); + fail("Not allowed to instantiate FunctionConstants!"); + } catch (IllegalAccessException e) { + assertTrue(true); + } + } + + @Test + public void testEmbedFuntionsAfterStaticInit() { + NameAndTypeAndFunctionList[] embFunctionLists = FunctionConstants.EMBFUNCTIONS; + // 一共有 8 个分类 + assertEquals(8, embFunctionLists.length); + for (NameAndTypeAndFunctionList embFunctionsList : embFunctionLists) { + // 每个分类下都有函数 + NameAndDescription[] nameAndDescriptions = embFunctionsList.getDescriptions(); + assertTrue(nameAndDescriptions.length > 0); + } + } + + @Test + public void testCommonFuntionsAfterStaticInit() { + NameAndFunctionList commonFunctionList = FunctionConstants.COMMON; + assertEquals(9, commonFunctionList.getDescriptions().length); + } +} From 8559c8ee12f8d9b86963d53b124899f4792512d4 Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 7 Dec 2018 15:14:19 +0800 Subject: [PATCH 15/93] =?UTF-8?q?REPORT-13018=20=E5=A4=A7=E8=B5=9B?= =?UTF-8?q?=E5=90=8E=E7=BB=AD=E5=BC=80=E4=B8=A4=E4=B8=AA=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20,=E5=8F=B3=E9=94=AE=E8=8F=9C=E5=8D=95=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=90=8C=E6=AD=A510.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/RightSelectionHandlerProvider.java | 55 +++++++++++++++++++ ...AbstractRightSelectionHandlerProvider.java | 45 +++++++++++++++ .../com/fr/design/mainframe/JTemplate.java | 2 +- .../form/parameter/FormParaDesigner.java | 8 ++- .../com/fr/design/mainframe/FormDesigner.java | 29 ++++++++-- .../java/com/fr/design/mainframe/JForm.java | 2 +- .../cell/clipboard/CellElementsClip.java | 48 ++++++++++++++-- .../fr/design/mainframe/ElementCasePane.java | 2 +- .../java/com/fr/grid/selection/Selection.java | 27 +++++++-- 9 files changed, 199 insertions(+), 19 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java diff --git a/designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java b/designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java new file mode 100644 index 0000000000..5e7d414236 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java @@ -0,0 +1,55 @@ +package com.fr.design.fun; + +import com.fr.design.actions.UpdateAction; +import com.fr.design.designer.TargetComponent; +import com.fr.design.gui.imenu.UIPopupMenu; +import com.fr.design.mainframe.BaseFormDesigner; +import com.fr.design.selection.SelectableElement; +import com.fr.stable.fun.mark.Mutable; + +import java.util.List; + +/** + * 设计器右键菜单接口 + */ +public interface RightSelectionHandlerProvider extends Mutable { + + int CURRENT_LEVEL = 1; + + String XML_TAG = "RightSelectionHandlerProvider"; + + + /** + * 对单元格或者悬浮元素的右键菜单项进行增删改 + * + * @param ePane 选择的元素 + * @param popupMenu 右键主菜单 + */ + void dmlMenu(TargetComponent ePane, UIPopupMenu popupMenu); + + + /** + * 当前实现是否可以作用于当前元素 + * + * @param selectableElement 当前选中元素分为CellSelection和FloatSelection(单元格和悬浮元素) + * @return + */ + boolean accept(SelectableElement selectableElement); + + + /** + * 对表单,参数面板内置的右键选项进行增删改处理 + * + * @param actions 默认的action集合 注意:主体代码要求这边的action必须是UndoableAction 的子类而非updateAction + */ + void dmlUpdateActions(BaseFormDesigner formDesigner, List actions); + + /** + * 当前实现是否可以作用于当前元素 + * + * @param formDesigner 当前选中元素分为表单编辑器和参数面板(表单组件元素以及各种控件) + * @return + */ + boolean accept(BaseFormDesigner formDesigner); + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java new file mode 100644 index 0000000000..6ec8282ed8 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java @@ -0,0 +1,45 @@ +package com.fr.design.fun.impl; + +import com.fr.design.actions.UpdateAction; +import com.fr.design.designer.TargetComponent; +import com.fr.design.fun.RightSelectionHandlerProvider; +import com.fr.design.gui.imenu.UIPopupMenu; +import com.fr.design.mainframe.BaseFormDesigner; +import com.fr.design.selection.SelectableElement; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +import java.util.List; + +@API(level = RightSelectionHandlerProvider.CURRENT_LEVEL) +public abstract class AbstractRightSelectionHandlerProvider extends AbstractProvider implements RightSelectionHandlerProvider { + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } + + @Override + public void dmlUpdateActions(BaseFormDesigner formDesigner, List actions) { + + } + + @Override + public boolean accept(BaseFormDesigner formDesigner) { + return false; + } + + @Override + public void dmlMenu(TargetComponent ePane, UIPopupMenu popupMenu) { + + } + + @Override + public boolean accept(SelectableElement selectableElement) { + return false; + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index c2557a5b9c..fa9b181a57 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -419,7 +419,7 @@ public abstract class JTemplate> fireSuperTargetModified(); } - protected boolean accept(Object o) { + public boolean accept(Object o) { return true; } diff --git a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java index 0895d4c1dc..62cea356d6 100644 --- a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java @@ -11,6 +11,7 @@ import java.awt.Image; import java.awt.Insets; import java.awt.Rectangle; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import javax.swing.BorderFactory; @@ -324,10 +325,11 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP */ public UpdateAction[] getActions() { if (designerActions == null) { - designerActions = new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), - new FormDeleteAction(this)}; + designerActions = new ArrayList(Arrays.asList(new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), + new FormDeleteAction(this)})); + dmlActions(designerActions); } - return designerActions; + return designerActions.toArray(new UpdateAction[designerActions.size()]); } private boolean searchQueryCreators(XLayoutContainer rootContainer) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index b313bc1433..fd0de4b257 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -1,9 +1,11 @@ package com.fr.design.mainframe; +import com.fr.base.FRContext; import com.fr.base.Parameter; import com.fr.base.ScreenResolution; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.TargetComponent; @@ -39,6 +41,7 @@ import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.util.XCreatorConstants; +import com.fr.design.fun.RightSelectionHandlerProvider; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.menu.MenuDef; import com.fr.design.menu.ShortCut; @@ -89,6 +92,7 @@ import java.lang.reflect.Proxy; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Set; /** * 设计界面组件。该组件是界面设计工具的核心,主要负责的是被设计界面的显示,界面设计操作状态的 显示,编辑状态的显示等等。 @@ -132,7 +136,7 @@ public class FormDesigner extends TargetComponent
implements TreeSelection private int resolution = ScreenResolution.getScreenResolution(); // 编辑状态的事件表 private CreatorEventListenerTable edit; - protected UpdateAction[] designerActions; + protected List designerActions; private FormDesignerModeForSpecial desigerMode; private Action switchAction; private FormElementCaseContainerProvider elementCaseContainer; @@ -1180,11 +1184,28 @@ public class FormDesigner extends TargetComponent implements TreeSelection */ public UpdateAction[] getActions() { if (designerActions == null) { - designerActions = new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), + designerActions = new ArrayList(Arrays.asList(new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), new FormDeleteAction(this), new MoveToTopAction(this), new MoveToBottomAction(this), - new MoveUpAction(this), new MoveDownAction(this)}; + new MoveUpAction(this), new MoveDownAction(this)})); + dmlActions(designerActions); + } + return designerActions.toArray(new UpdateAction[designerActions.size()]); + } + /** + * 扩展菜单项 + * @param actions + */ + public void dmlActions(List actions) { + try { + Set selectionHandlerProviders = ExtraDesignClassManager.getInstance().getArray(RightSelectionHandlerProvider.XML_TAG); + for (RightSelectionHandlerProvider handler : selectionHandlerProviders) { + if (handler.accept(this)) { + handler.dmlUpdateActions(this,actions); + } + } + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); } - return designerActions; } // 当前选中控件可以上移一层吗? 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 ec8020fd21..cc3ba96f5c 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 @@ -160,7 +160,7 @@ public class JForm extends JTemplate implements BaseJForm { } @Override - protected boolean accept(Object o) { + public boolean accept(Object o) { return !(o instanceof FloatElementsProvider); } diff --git a/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java b/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java index 2579e37c2e..84edad71fb 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java +++ b/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java @@ -3,9 +3,6 @@ */ package com.fr.design.cell.clipboard; -import java.util.Arrays; -import java.util.Iterator; - import com.fr.base.FRContext; import com.fr.grid.selection.CellSelection; import com.fr.report.cell.CellElement; @@ -15,6 +12,9 @@ import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.StringUtils; import com.fr.stable.unit.FU; +import java.util.Arrays; +import java.util.Iterator; + /** * The clip of CellElement. */ @@ -39,7 +39,47 @@ public class CellElementsClip implements Cloneable, java.io.Serializable { this.clips = clips; } - public String compateExcelPaste() { + public int getColumnSpan() { + return columnSpan; + } + + public void setColumnSpan(int columnSpan) { + this.columnSpan = columnSpan; + } + + public int getRowSpan() { + return rowSpan; + } + + public void setRowSpan(int rowSpan) { + this.rowSpan = rowSpan; + } + + public FU[] getColumnWidth() { + return columnWidth; + } + + public void setColumnWidth(FU[] columnWidth) { + this.columnWidth = columnWidth; + } + + public FU[] getRowHeight() { + return rowHeight; + } + + public void setRowHeight(FU[] rowHeight) { + this.rowHeight = rowHeight; + } + + public TemplateCellElement[] getClips() { + return clips; + } + + public void setClips(TemplateCellElement[] clips) { + this.clips = clips; + } + + public String compateExcelPaste() { Arrays.sort(this.clips, CellElementComparator.getRowFirstComparator()); // 排序 diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java index c47b142c1c..4112ac6c44 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java @@ -663,7 +663,7 @@ public abstract class ElementCasePane extends Tar } } - private Object getClipObject() { + public Object getClipObject() { // 需要检查是否可以编辑。 Clipboard clipboard = DesignerContext.getClipboard(this.getGrid()); Transferable clipData = clipboard.getContents(this); diff --git a/designer-realize/src/main/java/com/fr/grid/selection/Selection.java b/designer-realize/src/main/java/com/fr/grid/selection/Selection.java index 6787e36a5c..1d7a8b3fcf 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/Selection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/Selection.java @@ -1,19 +1,22 @@ package com.fr.grid.selection; -import java.io.Serializable; - -import javax.swing.JPopupMenu; - import com.fr.base.FRContext; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.cell.clipboard.CellElementsClip; import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.FloatElementsClip; +import com.fr.design.fun.RightSelectionHandlerProvider; +import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.ElementCasePane; -import com.fr.report.elementcase.TemplateElementCase; import com.fr.design.selection.SelectableElement; +import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.ColumnRow; import com.fr.stable.FCloneable; +import javax.swing.JPopupMenu; +import java.io.Serializable; +import java.util.Set; + /* * TODO ALEX_SEP Selection是跟ElementCasePane绑定的,能不能把ElementCasePane保存在Selection里面呢? * @@ -65,6 +68,20 @@ public abstract class Selection implements FCloneable, Serializable , Selectable // ///////////////////////////////popup//////////////////////////////// public abstract JPopupMenu createPopupMenu(ElementCasePane ePane); + /** + * 添加插件菜单(增删改都可以) + * @param ePane + * @param popupMenu + */ + public void addExtraMenu(ElementCasePane ePane, UIPopupMenu popupMenu) { + Set selectionHandlerProviders = ExtraDesignClassManager.getInstance().getArray(RightSelectionHandlerProvider.XML_TAG); + for (RightSelectionHandlerProvider handler : selectionHandlerProviders) { + if (handler.accept(this)) { + handler.dmlMenu(ePane, popupMenu); + } + } + } + // ///////////////////////////////clear//////////////////////////////// public abstract boolean clear(ElementCasePane.Clear type, ElementCasePane ePane); From 350665eab47b8b6e853aef73c270e36cae2f29da Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 7 Dec 2018 15:16:49 +0800 Subject: [PATCH 16/93] rt --- .../src/main/java/com/fr/grid/selection/Selection.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/selection/Selection.java b/designer-realize/src/main/java/com/fr/grid/selection/Selection.java index 1d7a8b3fcf..6adcd49643 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/Selection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/Selection.java @@ -27,10 +27,8 @@ import java.util.Set; public abstract class Selection implements FCloneable, Serializable , SelectableElement { public abstract boolean isSelectedOneCell(ElementCasePane ePane); - // ///////////////////////////////copy///////////////////////////////// public abstract void asTransferable(ElementsTransferable transferable, ElementCasePane ePane); - // ///////////////////////////////paste//////////////////////////////// public boolean pasteFloatElementClip(FloatElementsClip feClip, ElementCasePane ePane) { FloatElementsClip floatElementClip; try { @@ -56,7 +54,6 @@ public abstract class Selection implements FCloneable, Serializable , Selectable public abstract boolean pasteOtherType(Object ob, ElementCasePane ePane); - // ///////////////////////////////merge//////////////////////////////// public abstract boolean canMergeCells(ElementCasePane ePane); public abstract boolean mergeCells(ElementCasePane ePane); @@ -65,7 +62,6 @@ public abstract class Selection implements FCloneable, Serializable , Selectable public abstract boolean unMergeCells(ElementCasePane ePane); - // ///////////////////////////////popup//////////////////////////////// public abstract JPopupMenu createPopupMenu(ElementCasePane ePane); /** @@ -82,15 +78,12 @@ public abstract class Selection implements FCloneable, Serializable , Selectable } } - // ///////////////////////////////clear//////////////////////////////// public abstract boolean clear(ElementCasePane.Clear type, ElementCasePane ePane); - // //////////////////////////////////////////////////////////////////// public abstract int[] getSelectedRows(); public abstract int[] getSelectedColumns(); - // //////////////////////////////move////////////////////////////////// public abstract void moveLeft(ElementCasePane ePane); public abstract void moveRight(ElementCasePane ePane); @@ -99,10 +92,8 @@ public abstract class Selection implements FCloneable, Serializable , Selectable public abstract void moveDown(ElementCasePane ePane); - // //////////////////////////DeleteAction/////////////////////////////// public abstract boolean triggerDeleteAction(ElementCasePane ePane); - // //////////////////////////Just4CellSelection/////////////////////////////// public abstract boolean containsColumnRow(ColumnRow cr); public abstract void populatePropertyPane(ElementCasePane ePane); From 474aafec64d445e69dcfe5b4e46efae2a3c6042d Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 7 Dec 2018 16:46:04 +0800 Subject: [PATCH 17/93] =?UTF-8?q?REPORT-12850=2010.0mac=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=3D>=E8=B0=83=E6=95=B4=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/formula/FormulaPane.java | 2 +- .../com/fr/design/formula/FormulaPaneWhenReserveFormula.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index e994bc1053..bff2080e46 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -77,7 +77,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private DefaultListModel functionNameModel; private JList functionNameList; - FormulaPane() { + public FormulaPane() { initComponents(); } diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java index d689c54df9..e08f7e3b40 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java @@ -18,7 +18,7 @@ public class FormulaPaneWhenReserveFormula extends FormulaPane { private UICheckBox reserveCheckBox4Result; private UICheckBox reserveCheckBox4Write; - FormulaPaneWhenReserveFormula() { + public FormulaPaneWhenReserveFormula() { super(); } From 3c0a90601d03b25ae3819c7ffee9514b5c830698 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 7 Dec 2018 16:47:20 +0800 Subject: [PATCH 18/93] =?UTF-8?q?MOBILE-18551=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E3=80=8B=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8=E3=80=8B?= =?UTF-8?q?tab=E6=A0=B7=E5=BC=8F=E5=A4=9A=E6=A0=B7=E5=8C=96=E3=80=8B?= =?UTF-8?q?=E8=AE=BE=E7=BD=AEtab=E7=9A=84=E5=AD=97=E7=AC=A6=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E3=80=81=E6=96=9C=E4=BD=93=E9=A2=9C=E8=89=B2=E6=97=A0?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/mobile/ui/MobileTemplateStyleDefinePane.java | 4 +++- .../mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java index b499e18d78..feb19463da 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java @@ -208,8 +208,10 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane Date: Fri, 7 Dec 2018 17:49:45 +0800 Subject: [PATCH 19/93] =?UTF-8?q?REPORT-13176=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E5=B1=9E=E6=80=A7=E3=80=8Btab=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=A4=9A=E6=A0=B7=E5=8C=96=E3=80=8B=E9=BB=98=E8=AE=A4=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E3=80=8B=E9=A2=84=E8=A7=88=E5=A4=84=E5=AD=97=E4=BD=93?= =?UTF-8?q?=E5=A4=AA=E5=B0=8F=EF=BC=8C=E5=A6=82=E6=88=AA=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/mobile/ui/DefaultMobileStyleDefinePane.java | 2 ++ .../fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java | 2 ++ .../fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java | 2 ++ .../fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java | 2 ++ 4 files changed, 8 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java index 6b2ecec669..2a14bea078 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -12,6 +12,7 @@ import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.RenderingHints; public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane { @@ -84,6 +85,7 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane int panelWidth = dimension.width; int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FRFont frFont = DefaultMobileTemplateStyle.DEFAULT_TAB_FONT.getFont(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = DefaultMobileStyleDefinePane.this.getTagLayout(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java index 1a0472cbb5..70499f3028 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java @@ -27,6 +27,7 @@ import java.awt.FlowLayout; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.RenderingHints; import java.awt.Stroke; import java.util.ArrayList; @@ -151,6 +152,7 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { int panelWidth = dimension.width; int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FRFont frFont = this.getTabFontConfig().getFont(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = DownMenuStyleDefinePane.this.getTagLayout(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java index a4cf4e3339..a3c1382130 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java @@ -24,6 +24,7 @@ import java.awt.FlowLayout; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.RenderingHints; public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane { private NewColorSelectBox initDotColor; @@ -131,6 +132,7 @@ public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane { Dimension dimension = this.getSize(); int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FRFont frFont = this.getTabFontConfig().getFont(); g2d.setFont(frFont); g2d.setColor(frFont.getForeground()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java index ea0dba6590..003dd04bf7 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java @@ -27,6 +27,7 @@ import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.RenderingHints; import java.awt.Stroke; public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { @@ -171,6 +172,7 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { int panelWidth = dimension.width; int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FRFont frFont = UpMenuStyleDefinePane.this.fontConfPane.update(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = UpMenuStyleDefinePane.this.getTagLayout(); From 4e40e10c53650cdaedbb01d2eab453e0b6055b22 Mon Sep 17 00:00:00 2001 From: kerry Date: Sat, 8 Dec 2018 10:45:38 +0800 Subject: [PATCH 20/93] =?UTF-8?q?REPORT-13340=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E5=B1=9E=E6=80=A7=E3=80=8Btab=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=A4=9A=E6=A0=B7=E5=8C=96=E3=80=8B=E6=BB=91=E5=8A=A8=E5=BC=8F?= =?UTF-8?q?=E5=92=8C=E4=B8=8A=E8=8F=9C=E5=8D=95=E5=BC=8F=20=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E5=8C=BA=E5=9F=9F=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/mobile/ui/DefaultMobileStyleDefinePane.java | 2 +- .../fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java index 2a14bea078..7ffd0abe21 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -86,7 +86,7 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - FRFont frFont = DefaultMobileTemplateStyle.DEFAULT_TAB_FONT.getFont(); + FRFont frFont = this.getTabFontConfig().getFont(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = DefaultMobileStyleDefinePane.this.getTagLayout(); int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java index 003dd04bf7..ddd4c202d0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java @@ -173,7 +173,7 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - FRFont frFont = UpMenuStyleDefinePane.this.fontConfPane.update(); + FRFont frFont = this.getTabFontConfig().getFont(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = UpMenuStyleDefinePane.this.getTagLayout(); int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); From e5d23733bacfea9711f85d80deb170830c4eea4f Mon Sep 17 00:00:00 2001 From: abel Date: Sat, 8 Dec 2018 11:00:15 +0800 Subject: [PATCH 21/93] =?UTF-8?q?REPORT-13029=20JNDI=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/data/datapane/connect/JNDIDefPane.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java index 32bc4d4b71..e99d99ca4d 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java @@ -125,7 +125,7 @@ public class JNDIDefPane extends JPanel { } // Properties. - Hashtable contextHashtable = jndiDatabase.getContextHashtable(); + Map contextHashtable = jndiDatabase.getContextHashtable(); Object INITIAL_CONTEXT_FACTORY = contextHashtable.get(Context.INITIAL_CONTEXT_FACTORY); this.JNDIFactoryComboBox.setSelectedItem(INITIAL_CONTEXT_FACTORY == null ? "" : INITIAL_CONTEXT_FACTORY); @@ -148,7 +148,7 @@ public class JNDIDefPane extends JPanel { populateContextAttributes(contextHashtable, this.APPLET_TF, Context.APPLET); } - private void populateContextAttributes(Hashtable properties, UITextField textField, String contextAttr) { + private void populateContextAttributes(Map properties, UITextField textField, String contextAttr) { String PROVIDER_URL = properties.get(contextAttr); if (PROVIDER_URL != null) { textField.setText(PROVIDER_URL); @@ -160,7 +160,7 @@ public class JNDIDefPane extends JPanel { jndiDatabase.setJNDIName(this.jndiNameTextField.getText()); - Hashtable contextHashtable = jndiDatabase.getContextHashtable(); + Map contextHashtable = jndiDatabase.getContextHashtable(); String factoryString = (String)this.JNDIFactoryComboBox.getEditor().getItem(); if (factoryString != null && factoryString.trim().length() > 0) { @@ -186,7 +186,7 @@ public class JNDIDefPane extends JPanel { return jndiDatabase; } - private void updateContextAttributes(Hashtable contextHashtable, UITextField textField, String contextAttr) { + private void updateContextAttributes(Map contextHashtable, UITextField textField, String contextAttr) { String tValue = textField.getText(); if (tValue != null && tValue.trim().length() > 0) { contextHashtable.put(contextAttr, tValue); From 30de22f58db92499d5be7c30ea44511a0d74d32a Mon Sep 17 00:00:00 2001 From: Hades Date: Sat, 8 Dec 2018 15:30:29 +0800 Subject: [PATCH 22/93] =?UTF-8?q?REPORT-13310=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=9D=A5=E5=9B=9E=E5=88=87=E6=8D=A2=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?,=20=E9=9D=9E=E5=B8=B8=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/imenu/UIBasicMenuItemUI.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java index 74c65e8eed..61587beef2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java @@ -667,18 +667,10 @@ public class UIBasicMenuItemUI extends MenuItemUI { } private void installFont(final String prefix, final JComponent menuItem) { - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - if (menuItem == null) { - return; - } - LookAndFeel.installColorsAndFont(menuItem, prefix + ".background", prefix + ".foreground", prefix + ".font"); - } - }); - thread.setName("UIBasicMenuItemUI"); - thread.setDaemon(true); - thread.start(); + if (menuItem == null) { + return; + } + LookAndFeel.installColorsAndFont(menuItem, prefix + ".background", prefix + ".foreground", prefix + ".font"); } protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, From de75ef5d1f0ad1acfad68e88897a2c12cfa5584b Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Sat, 8 Dec 2018 15:43:19 +0800 Subject: [PATCH 23/93] =?UTF-8?q?REPORT-12854=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=20=E4=BA=A4=E4=BA=92=E4=BF=AE=E6=94=B9=20bug?= =?UTF-8?q?=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../connect/DatabaseConnectionPane.java | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 0f52a4c5c7..0b37855c92 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -17,6 +17,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; +import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; @@ -36,8 +37,8 @@ public abstract class DatabaseConnectionPane Date: Sat, 8 Dec 2018 16:00:43 +0800 Subject: [PATCH 24/93] rt --- .../fr/design/data/datapane/connect/DatabaseConnectionPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 0b37855c92..fc2045161c 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -73,7 +73,7 @@ public abstract class DatabaseConnectionPane Date: Sat, 8 Dec 2018 16:29:56 +0800 Subject: [PATCH 25/93] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/data/datapane/connect/DatabaseConnectionPane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index fc2045161c..fc666f15fd 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -85,7 +85,6 @@ public abstract class DatabaseConnectionPane Date: Sat, 8 Dec 2018 16:44:40 +0800 Subject: [PATCH 26/93] =?UTF-8?q?REPORT-12916=20=E5=8F=A6=E5=AD=98?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9=E5=AF=B9=E8=AF=9D=E6=A1=86?= =?UTF-8?q?=E8=A2=AB=E5=8F=A6=E5=AD=98=E6=96=87=E4=BB=B6icon=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=94=81=E5=AE=9A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/itree/filetree/EnvFileTree.java | 4 +--- .../fr/design/gui/itree/filetree/FileTreeIcon.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java index 550ba715e5..d5a9044d5e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java @@ -69,10 +69,8 @@ public class EnvFileTree extends RefreshableJTree { if (treeNode.hasFullAuthority()) { if (lock != null && !node.getUserID().equals(lock)) { name = name + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked", "(", ")"); - this.setIcon(FileTreeIcon.getIcon(node)); - } else { - this.setIcon(FileTreeIcon.getIcon(node, false)); } + this.setIcon(FileTreeIcon.getIcon(node)); } else { this.setIcon(FileTreeIcon.getFolderHalfImageIcon()); } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java index 130240aead..b0e26cc80e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java @@ -3,6 +3,7 @@ package com.fr.design.gui.itree.filetree; import com.fr.base.BaseUtils; import com.fr.design.icon.LockIcon; import com.fr.file.filetree.FileNode; +import com.fr.general.ComparatorUtils; import com.fr.stable.StableUtils; import com.fr.workspace.WorkContext; @@ -125,8 +126,16 @@ public class FileTreeIcon { return FOLDER_HALF_IMAGE_ICON; } + /** + * 获取文件节点对应的图标 + * + * @param node 文件节点 + * @return 文件节点的图标 + */ public static Icon getIcon(FileNode node) { - return getIcon(node, node.getLock() != null); + // 如果文件节点锁不为空且不是当前用户锁定的该模板,那么模板ICON 提示用户当前文件节点被锁 + boolean showLock = node.getLock() != null && !ComparatorUtils.equals(node.getUserID(), node.getLock()); + return getIcon(node, showLock); } public static Icon getIcon(FileNode node, boolean isShowLock) { From 3f3bb397cc785c97acc079dccce95d3d789bafc4 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Sat, 8 Dec 2018 20:10:18 +0800 Subject: [PATCH 27/93] =?UTF-8?q?=E4=B8=8D=E6=98=AF=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E5=86=85=E7=9A=84=E6=96=87=E4=BB=B6=E4=B8=8D=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E8=A7=A3=E9=94=81=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/file/MutilTempalteTabPane.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index b6f18a1882..2a00df0720 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -206,8 +206,7 @@ public class MutilTempalteTabPane extends JComponent { openedTemplate.remove(jTemplate); closeFormat(jTemplate); HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate); - // release lock - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(jTemplate.getPath()); + closeAndFreeLock(jTemplate); } } JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); @@ -221,7 +220,6 @@ public class MutilTempalteTabPane extends JComponent { if (openedTemplate.size() == 1) { closeOther.setEnabled(false); } - return closeOther; } @@ -698,11 +696,19 @@ public class MutilTempalteTabPane extends JComponent { private void closeTpl(@Nonnull JTemplate specifiedTemplate, @Nonnull String fileName) { HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate); - // release lock - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(specifiedTemplate.getPath()); + closeAndFreeLock(specifiedTemplate); activeTemplate(fileName); } + private void closeAndFreeLock(@Nonnull JTemplate template) { + FILE file = template.getEditingFILE(); + // 只有是环境内的文件,才执行释放锁 + if (file != null && file.isEnvFile()) { + // release lock + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(template.getPath()); + } + } + /** * 关闭模板 * From fa38f5327954c87da6e0d1a73a76864de0b9fb2f Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Sat, 8 Dec 2018 21:11:42 +0800 Subject: [PATCH 28/93] =?UTF-8?q?REPORT-12916=20=E5=8F=A6=E5=AD=98?= =?UTF-8?q?=E4=B8=BA=E6=97=B6=E7=9A=84=E6=96=87=E4=BB=B6=E9=94=81=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/file/MutilTempalteTabPane.java | 2 +- .../com/fr/design/mainframe/JTemplate.java | 29 +++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index 2a00df0720..ab4f2aae32 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -705,7 +705,7 @@ public class MutilTempalteTabPane extends JComponent { // 只有是环境内的文件,才执行释放锁 if (file != null && file.isEnvFile()) { // release lock - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(template.getPath()); + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index fa9b181a57..7b80c3fd74 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -32,6 +32,7 @@ import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.itree.filetree.TemplateFileTree; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; @@ -56,6 +57,8 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.core.UUID; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.lock.TplOperator; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -587,6 +590,8 @@ public abstract class JTemplate> if (isCancelOperation(chooseResult)) { return false; } + // 源文件 + FILE sourceFile = editingFILE; if (isOkOperation(chooseResult)) { boolean access = false; @@ -596,13 +601,33 @@ public abstract class JTemplate> FineLoggerFactory.getLogger().error(e.getMessage(), e); } if (!access) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.WARNING_MESSAGE); + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + "!", + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), + JOptionPane.WARNING_MESSAGE); return false; } + // 目标文件 editingFILE = fileChooser.getSelectedFILE(); } - return saveNewFile(editingFILE, oldName); + boolean lockedTarget = WorkContext.getCurrent().get(TplOperator.class).saveAs(editingFILE.getPath()); + if (lockedTarget) { + boolean saved = saveNewFile(editingFILE, oldName); + // 目标文件保存成功并且源文件不一致的情况下,把源文件锁释放掉 + if (saved && !ComparatorUtils.equals(editingFILE.getPath(), sourceFile.getPath())) { + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(sourceFile.getPath()); + } + return saved; + } else { + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), + JOptionPane.WARNING_MESSAGE); + return false; + } } protected boolean saveNewFile(FILE editingFILE, String oldName) { From c6679a32832db047bafdd06b58df77f70f2238e1 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 10 Dec 2018 11:39:50 +0800 Subject: [PATCH 29/93] =?UTF-8?q?REPORT-13418=2010.0=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E9=BB=98=E8=AE=A4=E8=AF=AD=E8=A8=80=E6=94=B9=E6=88=90?= =?UTF-8?q?=E8=B7=9F9=E4=B8=80=E6=A0=B7,=20=E5=8F=96=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E9=BB=98=E8=AE=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/DesignerEnvManager.java | 2 +- 1 file changed, 1 insertion(+), 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 d054ab959f..73da53d4b8 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -112,7 +112,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private Color paginationLineColor = Color.black; // line color of paper private boolean supportCellEditorDef = false; private boolean isDragPermited = false; - private Locale language = Locale.SIMPLIFIED_CHINESE; + private Locale language = Locale.getDefault(); //2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容 private boolean useOracleSystemSpace = true; private int cachingTemplateLimit = CACHINGTEMPLATE_LIMIT; From 17031ef1b2d2026ccd20e6e2d417fbad7ddf3926 Mon Sep 17 00:00:00 2001 From: Hades Date: Mon, 10 Dec 2018 12:43:48 +0800 Subject: [PATCH 30/93] =?UTF-8?q?REPORT-12698=20=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E8=83=8C=E6=99=AF=E8=AE=BE=E7=BD=AE=E4=B8=BA=E5=9B=BE?= =?UTF-8?q?=E6=A1=88,=20=E5=85=B3=E9=97=AD=E6=A8=A1=E6=9D=BF=E5=90=8E?= =?UTF-8?q?=E5=86=8D=E6=89=93=E5=BC=80,=20=E4=BC=9A=E5=8F=98=E6=88=90?= =?UTF-8?q?=E7=BA=AF=E9=BB=91=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backgroundpane/PatternBackgroundQuickPane.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java index d965151cb8..bb8038ac4a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java @@ -52,7 +52,8 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { } foregroundColorPane = new ColorSelectBox(60); backgroundColorPane = new ColorSelectBox(60); - + foregroundColorPane.setSelectObject(Color.lightGray); + foregroundColorPane.setSelectObject(Color.black); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ @@ -219,7 +220,7 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { @Override public void reset() { patternButtonArray[0].setSelected(true); - foregroundColorPane.setSelectObject(null); - backgroundColorPane.setSelectObject(null); + foregroundColorPane.setSelectObject(Color.lightGray); + backgroundColorPane.setSelectObject(Color.black); } } From 8456349de848306cf1dfed55a3fa6fcfcd852689 Mon Sep 17 00:00:00 2001 From: Hades Date: Mon, 10 Dec 2018 13:36:16 +0800 Subject: [PATCH 31/93] =?UTF-8?q?=E5=8A=A0=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backgroundpane/PatternBackgroundQuickPane.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java index bb8038ac4a..5e69d9f829 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java @@ -30,6 +30,8 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { private int patternIndex = 0; // pattern setIndex. private final static int DEFAULT_DIM_HEIGHT = 210; + private final static Color DEFAULT_FOREGROUND = Color.lightGray; + private final static Color DEFAULT_BACKGROUND = Color.black; private ColorSelectBox foregroundColorPane; private ColorSelectBox backgroundColorPane; private PatternButton[] patternButtonArray; @@ -52,8 +54,8 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { } foregroundColorPane = new ColorSelectBox(60); backgroundColorPane = new ColorSelectBox(60); - foregroundColorPane.setSelectObject(Color.lightGray); - foregroundColorPane.setSelectObject(Color.black); + foregroundColorPane.setSelectObject(DEFAULT_FOREGROUND); + foregroundColorPane.setSelectObject(DEFAULT_BACKGROUND); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ @@ -220,7 +222,7 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { @Override public void reset() { patternButtonArray[0].setSelected(true); - foregroundColorPane.setSelectObject(Color.lightGray); - backgroundColorPane.setSelectObject(Color.black); + foregroundColorPane.setSelectObject(DEFAULT_FOREGROUND); + backgroundColorPane.setSelectObject(DEFAULT_BACKGROUND); } } From d88f4f9dd8c9388f06db45c37e9cc4bf2e08b012 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Mon, 10 Dec 2018 16:41:28 +0800 Subject: [PATCH 32/93] =?UTF-8?q?REPORT-13431=20=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=82=B9=E8=AE=B0=E5=BD=95,=20=E9=9C=80=E8=A6=81=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E9=80=81=20=E6=8D=A2=E7=94=A8multiple?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E5=90=88=E5=B9=B6=E5=A4=9A=E6=9D=A1=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 6f3c9bdea7..4dafbeccd6 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -104,6 +104,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { private static final String ATTR_TITLE = "title"; private static final String ATTR_USER_NAME = "username"; private static final String ATTR_UUID = "uuid"; + private static final String ATTR_FUNCTION_ARRAY = "functionArray"; private static InformationCollector collector; @@ -232,21 +233,23 @@ public class InformationCollector implements XMLReadable, XMLWriter { if (currentTime - lastTime <= DELTA) { return; } - ArrayList> content = null; - content = getFunctionsContent(current, new Date(lastTime)); + JSONArray content = null; + try { + content = getFunctionsContent(current, new Date(lastTime)); + } catch (JSONException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } boolean success = false; FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); - if(content.size() > 0){ - for(int i=0; i 0){ + success = sendFunctionRecord(url, content); //服务器返回true, 说明已经获取成功, 更新最后一次发送时间 if (success) { this.lastTime = dateToString(); + FineLoggerFactory.getLogger().info("Function records successfully sent to the cloud center."); } } - FineLoggerFactory.getLogger().info("Function records successfully sent to the cloud center."); // //先将发送压缩文件这段代码注释,之后提任务 //大数据量下发送压缩zip数据不容易丢失 // try { @@ -265,12 +268,14 @@ public class InformationCollector implements XMLReadable, XMLWriter { // } } - private boolean sendFunctionRecord(String url, Map record) { + private boolean sendFunctionRecord(String url, JSONArray record) { boolean success = false; try { - String recordUrl = url+"?token=" + SiteCenterToken.generateToken() + "&content="+URLEncoder.encode(new JSONObject(record).toString(), EncodeConstants.ENCODING_UTF_8); - String res = HttpToolbox.get(recordUrl); - success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); + HashMap para = new HashMap<>(); + para.put("token", SiteCenterToken.generateToken()); + para.put("content", record); + String res = HttpToolbox.post(url, para); + success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -437,33 +442,33 @@ public class InformationCollector implements XMLReadable, XMLWriter { }); } - public static ArrayList getFunctionsContent(Date current, Date last){ - ArrayList> records = new ArrayList>(); + public static JSONArray getFunctionsContent(Date current, Date last) throws JSONException{ + JSONArray functionArray = new JSONArray(); QueryCondition condition = QueryFactory.create() .addRestriction(RestrictionFactory.lte(COLUMN_TIME, current)) .addRestriction(RestrictionFactory.gte(COLUMN_TIME, last)); try { DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); - DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); - String bbsUserName = MarketConfig.getInstance().getBbsUsername(); - String uuid = envManager.getUUID(); + if(!focusPoints.isEmpty()){ for(FocusPoint focusPoint : focusPoints.getList()){ - Map record = new HashMap<>(); + com.fr.json.JSONObject record = new com.fr.json.JSONObject(); record.put(ATTR_ID, focusPoint.getId()); record.put(ATTR_TEXT, focusPoint.getText()); record.put(ATTR_SOURCE, focusPoint.getSource()); record.put(ATTR_TIME, focusPoint.getTime().getTime()); record.put(ATTR_TITLE, focusPoint.getTitle()); - record.put(ATTR_USER_NAME, bbsUserName); - record.put(ATTR_UUID, uuid); - records.add(record); + record.put(ATTR_USER_NAME, MarketConfig.getInstance().getBbsUsername()); + record.put(ATTR_UUID, DesignerEnvManager.getEnvManager().getUUID()); + record.put(ATTR_FUNCTION_ARRAY, functionArray); + functionArray.put(record); } } + } catch (MetricException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } - return records; + return functionArray; } private class StartStopTime implements XMLReadable, XMLWriter { From 560b0fb626b90e7d46fe23b08d9709f6bd0e59e8 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Mon, 10 Dec 2018 19:02:52 +0800 Subject: [PATCH 33/93] =?UTF-8?q?=E6=AF=8F=E8=BE=BE=E5=88=B0200=E6=9D=A1?= =?UTF-8?q?=E6=97=B6=E5=90=88=E5=B9=B6=E8=AF=B7=E6=B1=82=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 57 ++++++++++++++----- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 4dafbeccd6..047ffc6717 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -105,6 +105,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { private static final String ATTR_USER_NAME = "username"; private static final String ATTR_UUID = "uuid"; private static final String ATTR_FUNCTION_ARRAY = "functionArray"; + private static final int MAX_EACH_REQUEST_RECORD_COUNT = 200; private static InformationCollector collector; @@ -242,14 +243,22 @@ public class InformationCollector implements XMLReadable, XMLWriter { boolean success = false; FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); - if(content.length() > 0){ - success = sendFunctionRecord(url, content); + try { + for(int i=0;i 0){ + success = sendFunctionRecord(url, functionArray); + } + } //服务器返回true, 说明已经获取成功, 更新最后一次发送时间 if (success) { this.lastTime = dateToString(); FineLoggerFactory.getLogger().info("Function records successfully sent to the cloud center."); } + }catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } + // //先将发送压缩文件这段代码注释,之后提任务 //大数据量下发送压缩zip数据不容易丢失 // try { @@ -443,34 +452,52 @@ public class InformationCollector implements XMLReadable, XMLWriter { } public static JSONArray getFunctionsContent(Date current, Date last) throws JSONException{ + //记录当前条数,达到200条合并成一个请求 + int count = 0; JSONArray functionArray = new JSONArray(); QueryCondition condition = QueryFactory.create() .addRestriction(RestrictionFactory.lte(COLUMN_TIME, current)) .addRestriction(RestrictionFactory.gte(COLUMN_TIME, last)); try { DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); - + JSONArray temp = new JSONArray(); if(!focusPoints.isEmpty()){ - for(FocusPoint focusPoint : focusPoints.getList()){ - com.fr.json.JSONObject record = new com.fr.json.JSONObject(); - record.put(ATTR_ID, focusPoint.getId()); - record.put(ATTR_TEXT, focusPoint.getText()); - record.put(ATTR_SOURCE, focusPoint.getSource()); - record.put(ATTR_TIME, focusPoint.getTime().getTime()); - record.put(ATTR_TITLE, focusPoint.getTitle()); - record.put(ATTR_USER_NAME, MarketConfig.getInstance().getBbsUsername()); - record.put(ATTR_UUID, DesignerEnvManager.getEnvManager().getUUID()); - record.put(ATTR_FUNCTION_ARRAY, functionArray); - functionArray.put(record); + for(int i=0;i< focusPoints.getList().size();i++){ + FocusPoint focusPoint = focusPoints.getList().get(i); + if(focusPoint != null){ + if((++count <= MAX_EACH_REQUEST_RECORD_COUNT)){ + temp.put(getOneRecord(focusPoint)); + } else { + count = 0; + functionArray.put(temp); + temp = new JSONArray(); + temp.put(getOneRecord(focusPoint)); + } + if(i == (focusPoints.getList().size() -1)){ + functionArray.put(temp); + } + } } } - } catch (MetricException e) { + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } return functionArray; } + private static JSONObject getOneRecord(FocusPoint focusPoint) throws JSONException{ + com.fr.json.JSONObject record = new com.fr.json.JSONObject(); + record.put(ATTR_ID, focusPoint.getId()); + record.put(ATTR_TEXT, focusPoint.getText()); + record.put(ATTR_SOURCE, focusPoint.getSource()); + record.put(ATTR_TIME, focusPoint.getTime().getTime()); + record.put(ATTR_TITLE, focusPoint.getTitle()); + record.put(ATTR_USER_NAME, MarketConfig.getInstance().getBbsUsername()); + record.put(ATTR_UUID, DesignerEnvManager.getEnvManager().getUUID()); + return record; + } + private class StartStopTime implements XMLReadable, XMLWriter { private String startDate; From a6bab815bcca3db158fb53aeab3e023f968d7893 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 10 Dec 2018 20:02:11 +0800 Subject: [PATCH 34/93] REPORT-13441 & REPORT-13442 --- .../design/condition/LiteConditionPane.java | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java index 36fa874ccf..b14c8cde12 100644 --- a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java @@ -121,7 +121,7 @@ public abstract class LiteConditionPane extends BasicBeanPa JoinCondition newJoinCondition = new JoinCondition(andRadioButton.isSelected() ? DataConstants.AND : DataConstants.OR, liteCondition); ExpandMutableTreeNode parentTreeNode = getParentTreeNode(); - boolean result = isExistedInParentTreeNode(parentTreeNode, newJoinCondition); + boolean result = isExistedInParentTreeNode(parentTreeNode, liteCondition, false); if (result) { JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_BindColumn_This_Condition_Has_Been_Existed")); @@ -162,7 +162,7 @@ public abstract class LiteConditionPane extends BasicBeanPa @Override public void mouseExited(MouseEvent evt) { - GUICoreUtils.setEnabled(conditionCardPane, conditionCardPane.isEnabled()); + GUICoreUtils.setEnabled(conditionCardPane, conditionCardPane.isEnabled()); } }; @@ -596,6 +596,8 @@ public abstract class LiteConditionPane extends BasicBeanPa oldJoinCondition.setJoin(andRadioButton.isSelected() ? DataConstants.AND : DataConstants.OR); Condition oldLiteCondition = oldJoinCondition.getCondition(); + DefaultTreeModel defaultTreeModel = (DefaultTreeModel) conditionsTree.getModel(); + ExpandMutableTreeNode parentTreeNode = (ExpandMutableTreeNode) selectedTreeNode.getParent(); // peter:如果当前选中的是ListCondition,只要改变Join为AND或者OR,直接返回. if (oldLiteCondition != null && !(oldLiteCondition instanceof ListCondition)) { // peter:先获得当前的LiteCondition. @@ -605,13 +607,18 @@ public abstract class LiteConditionPane extends BasicBeanPa } else { liteCondition = new FormulaCondition(formulaTextArea.getText()); } + //修改的时候加入判断条件类型 REPORT-13441 + boolean result = isExistedInParentTreeNode(parentTreeNode, liteCondition, true); + if (result) { + JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_BindColumn_This_Condition_Has_Been_Existed")); + return; + } oldJoinCondition.setCondition(liteCondition); } // peter:需要reload parent - DefaultTreeModel defaultTreeModel = (DefaultTreeModel) conditionsTree.getModel(); - ExpandMutableTreeNode parentTreeNode = (ExpandMutableTreeNode) selectedTreeNode.getParent(); defaultTreeModel.reload(parentTreeNode); parentTreeNode.expandCurrentTreeNode(conditionsTree); conditionsTree.setSelectionPath(GUICoreUtils.getTreePath(selectedTreeNode)); @@ -745,22 +752,31 @@ public abstract class LiteConditionPane extends BasicBeanPa return parentTreeNode; } - private boolean isExistedInParentTreeNode(ExpandMutableTreeNode parentTreeNode, JoinCondition newJoinCondition) { + private boolean isExistedInParentTreeNode(ExpandMutableTreeNode parentTreeNode, Condition liteCondition, boolean isModify) { if (parentTreeNode == null) { return false; } JoinCondition parentJoinCondition = (JoinCondition) parentTreeNode.getUserObject(); Condition parentLiteCondition = parentJoinCondition.getCondition(); + Object oldJoinCondition = null; + //获取当前选中的条件用于修改判断 + TreePath selectedTreePath = conditionsTree.getSelectionPath(); + if (selectedTreePath != null) { + ExpandMutableTreeNode selectedTreeNode = (ExpandMutableTreeNode) selectedTreePath.getLastPathComponent(); + oldJoinCondition = selectedTreeNode.getUserObject(); + } if (parentLiteCondition instanceof ListCondition) { // peter:在添加UserObject的节点. for (int i = 0; i < parentTreeNode.getChildCount(); i++) { ExpandMutableTreeNode tempTreeNode = (ExpandMutableTreeNode) parentTreeNode.getChildAt(i); Object tempObject = tempTreeNode.getUserObject(); - if (tempObject instanceof JoinCondition) { + //修改的时候需要排除所选条件,和其他条件比较。增加的时候全盘比较 + if (tempObject instanceof JoinCondition && isModify ? (!tempObject.equals(oldJoinCondition)) : true) { JoinCondition tempJoinCondition = (JoinCondition) tempObject; - if (ComparatorUtils.equals(tempJoinCondition, newJoinCondition)) { + //条件内容一样就视为相同条件,join类型无关 + if (ComparatorUtils.equals(tempJoinCondition.getCondition(), liteCondition)) { return true; } } @@ -941,7 +957,7 @@ public abstract class LiteConditionPane extends BasicBeanPa @Override public Condition updateBean() { // Samuel:先按modifybutton - modify(); + //modify(); REPORT-13442 需要点修改按钮才能修改 // peter: 先删除所有的节点 DefaultTreeModel defaultTreeModel = (DefaultTreeModel) this.conditionsTree.getModel(); ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) defaultTreeModel.getRoot(); @@ -963,9 +979,9 @@ public abstract class LiteConditionPane extends BasicBeanPa JoinCondition joinCondition = (JoinCondition) rootTreeNode.getUserObject(); Condition newCondition = joinCondition.getCondition(); //clone(),防止多个条件分组使用同一个condition对象 - try{ - newCondition = (Condition)joinCondition.getCondition().clone(); - }catch (CloneNotSupportedException e){ + try { + newCondition = (Condition) joinCondition.getCondition().clone(); + } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } return newCondition; From aabedeaa0b495c352b1891f2e50676ded9e98466 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 10 Dec 2018 20:04:07 +0800 Subject: [PATCH 35/93] REPORT-13441 & REPORT-13442 --- .../main/java/com/fr/design/condition/LiteConditionPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java index b14c8cde12..193c35775a 100644 --- a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java @@ -607,7 +607,7 @@ public abstract class LiteConditionPane extends BasicBeanPa } else { liteCondition = new FormulaCondition(formulaTextArea.getText()); } - //修改的时候加入判断条件类型 REPORT-13441 + //修改的时候加入判断条件重复 REPORT-13441 boolean result = isExistedInParentTreeNode(parentTreeNode, liteCondition, true); if (result) { JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), From cee61dfe26bab4fd5168fdb9b9077983a3226c75 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 11 Dec 2018 10:34:57 +0800 Subject: [PATCH 36/93] =?UTF-8?q?REPORT-13402=20=E3=80=90=E9=98=BB?= =?UTF-8?q?=E5=A1=9E=E3=80=91=E3=80=9010.0.2=E5=9B=9E=E5=BD=92=E3=80=91?= =?UTF-8?q?=E5=85=AC=E5=BC=8F=E9=9D=A2=E6=9D=BF=E7=82=B9=E4=B8=8D=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/formula/FunctionConstants.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 750df1bad1..9df15fd8f9 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -13,6 +13,7 @@ import com.fr.function.SUM; import com.fr.function.TIME; import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.ExtraClassManager; import com.fr.stable.EncodeConstants; @@ -66,7 +67,6 @@ public final class FunctionConstants { while (urlEnumeration.hasMoreElements()) { URL url = urlEnumeration.nextElement(); String classFilePath = url.getFile(); - /* * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 @@ -77,10 +77,9 @@ public final class FunctionConstants { FRContext.getLogger().error(e1.getMessage(), e1); } FRContext.getLogger().info("ClassFilePath:" + classFilePath); - /* - * alex:如果是jar包中的class文件 - * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function - */ + if (isCustomFormulaPath(classFilePath)) { + continue; + } for (String fileName : findClassNamesUnderFilePath(classFilePath)) { try { Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); @@ -94,11 +93,19 @@ public final class FunctionConstants { } } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ignore) { + } catch (Throwable e) { + // 不要因为个别公式加载失败,而导致整个函数面板无法启动 + FineLoggerFactory.getLogger().error(e.getMessage()); } } } } + private static boolean isCustomFormulaPath(String classFilePath) { + // 除非是代码启动,否则不读取 WEB-INF/classes/com/fr/function 目录下的类 + return !classFilePath.contains("!/") && GeneralUtils.readBuildNO().contains("-"); + } + /** * 将函数分组插件中的函数添加到对应的列表中 * @param listModel From 8ec239644ff9ef04cb7fc01277b9f79d7fb0aa8d Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 11 Dec 2018 10:42:31 +0800 Subject: [PATCH 37/93] =?UTF-8?q?REPORT-13402=20=E3=80=90=E9=98=BB?= =?UTF-8?q?=E5=A1=9E=E3=80=91=E3=80=9010.0.2=E5=9B=9E=E5=BD=92=E3=80=91?= =?UTF-8?q?=E5=85=AC=E5=BC=8F=E9=9D=A2=E6=9D=BF=E7=82=B9=E4=B8=8D=E5=BC=80?= =?UTF-8?q?=3D>=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FunctionConstants.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 9df15fd8f9..0166c269be 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -102,11 +102,18 @@ public final class FunctionConstants { } private static boolean isCustomFormulaPath(String classFilePath) { - // 除非是代码启动,否则不读取 WEB-INF/classes/com/fr/function 目录下的类 - return !classFilePath.contains("!/") && GeneralUtils.readBuildNO().contains("-"); + return !isJarPath(classFilePath) && isDebugMode(); } - /** + private static boolean isDebugMode() { + return !GeneralUtils.readBuildNO().contains("-"); + } + + private static boolean isJarPath(String classFilePath) { + return classFilePath.contains("!/"); + } + + /** * 将函数分组插件中的函数添加到对应的列表中 * @param listModel */ @@ -152,7 +159,7 @@ public final class FunctionConstants { * alex:如果是jar包中的class文件 * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function */ - if (filePath.contains("!/")) { + if (isJarPath(filePath)) { String[] arr = filePath.split("!/"); String jarPath = arr[0].substring(6); // alex:substring(6)去掉前面的file:/这六个字符 String classPath = arr[1]; From 40f367e1d2b3fff16568dd4cdaa18dffb7edc9a8 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 11 Dec 2018 11:22:49 +0800 Subject: [PATCH 38/93] =?UTF-8?q?REPORT-13402=20=E3=80=90=E9=98=BB?= =?UTF-8?q?=E5=A1=9E=E3=80=91=E3=80=9010.0.2=E5=9B=9E=E5=BD=92=E3=80=91?= =?UTF-8?q?=E5=85=AC=E5=BC=8F=E9=9D=A2=E6=9D=BF=E7=82=B9=E4=B8=8D=E5=BC=80?= =?UTF-8?q?=3D>=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/formula/FunctionConstants.java | 6 ++-- .../design/formula/FunctionConstantsTest.java | 36 +++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 0166c269be..eee75a2220 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -102,11 +102,11 @@ public final class FunctionConstants { } private static boolean isCustomFormulaPath(String classFilePath) { - return !isJarPath(classFilePath) && isDebugMode(); + return !isJarPath(classFilePath) && isNotDebugMode(); } - private static boolean isDebugMode() { - return !GeneralUtils.readBuildNO().contains("-"); + private static boolean isNotDebugMode() { + return GeneralUtils.readBuildNO().contains("-"); } private static boolean isJarPath(String classFilePath) { diff --git a/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java b/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java index 33cfd577da..75c9c9e5ba 100644 --- a/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java +++ b/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java @@ -1,14 +1,24 @@ package com.fr.design.formula; +import com.fr.general.GeneralUtils; +import com.fr.invoke.Reflect; +import org.easymock.EasyMock; import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; import static junit.framework.Assert.fail; import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.assertFalse; /** * Created by plough on 2018/12/7. */ +@RunWith(PowerMockRunner.class) +@PrepareForTest(GeneralUtils.class) public class FunctionConstantsTest { @Test public void testNewInstanceFail() throws Exception { @@ -37,4 +47,30 @@ public class FunctionConstantsTest { NameAndFunctionList commonFunctionList = FunctionConstants.COMMON; assertEquals(9, commonFunctionList.getDescriptions().length); } + + @Test + public void testIsCustomFormulaPathRunWithCode() { + PowerMock.mockStatic(GeneralUtils.class); + EasyMock.expect(GeneralUtils.readBuildNO()).andReturn("不是安装版本").anyTimes(); + PowerMock.replayAll(); + + String classFilePath = "/Users/plough/.m2/repository/com/fr/core/fine-core/10.0-RELEASE-SNAPSHOT/fine-core-10.0-RELEASE-20181211.024527-499.jar!/com/fr/function"; + assertFalse(Reflect.on(FunctionConstants.class).call("isCustomFormulaPath", classFilePath).get()); + + classFilePath = "/Users/plough/work/new_10_release_finereport/engine-settings/env/webroot/WEB-INF/classes/com/fr/function"; + assertFalse(Reflect.on(FunctionConstants.class).call("isCustomFormulaPath", classFilePath).get()); + } + + @Test + public void testIsCustomFormulaPathRunWithJar() { + PowerMock.mockStatic(GeneralUtils.class); + EasyMock.expect(GeneralUtils.readBuildNO()).andReturn("Build#release-2018.12.10.12.11.09.95").anyTimes(); + PowerMock.replayAll(); + + String classFilePath = "file:/Applications/FineReport_10.0_12_10/webapps/webroot/WEB-INF/lib/fine-report-engine-10.0.jar!/com/fr/function"; + assertFalse(Reflect.on(FunctionConstants.class).call("isCustomFormulaPath", classFilePath).get()); + + classFilePath = "/Applications/FineReport_10.0_12_10/webapps/webroot/WEB-INF/classes/com/fr/function"; + assertTrue(Reflect.on(FunctionConstants.class).call("isCustomFormulaPath", classFilePath).get()); + } } From 1537cf742b7498f1f073e91d61546a2f3a4372d7 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 11 Dec 2018 17:08:09 +0800 Subject: [PATCH 39/93] =?UTF-8?q?REPORT-13363=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=90=8E=EF=BC=8C=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E9=97=AA=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-realize/src/main/java/com/fr/start/Designer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index 756cd12623..ca32ff565d 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -59,6 +59,7 @@ import com.fr.start.server.ServerTray; import com.fr.workspace.WorkContext; import javax.swing.JComponent; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.border.MatteBorder; import java.awt.Component; @@ -121,6 +122,9 @@ public class Designer extends BaseDesigner { try { designerRoot.start(); } catch (LifecycleFatalError fatal) { + SplashContext.getInstance().hide(); + JOptionPane.showMessageDialog(null, fatal.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE); + FineLoggerFactory.getLogger().error(fatal.getMessage(), fatal); System.exit(0); } From a5a4dc4db6e501187ac58340735969589815c6d2 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 12 Dec 2018 10:10:29 +0800 Subject: [PATCH 40/93] =?UTF-8?q?REPORT-13477=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E5=B1=9E=E6=80=A7=E3=80=8B=E5=86=B3=E7=AD=96=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E3=80=8Btab=E6=A0=B7=E5=BC=8F=E3=80=8Btab=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E8=BF=87=E9=95=BF=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C?= =?UTF-8?q?=E4=B8=8A=E8=8F=9C=E5=8D=95=E5=BC=8F/=E4=B8=8B=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E5=BC=8F=E7=9A=84=E9=A2=84=E8=A7=88=E6=95=88=E6=9E=9C?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/DefaultMobileStyleDefinePane.java | 6 +++--- .../mobile/ui/DownMenuStyleDefinePane.java | 6 +++--- .../mobile/ui/UpMenuStyleDefinePane.java | 6 +++--- .../preview/MobileTemplatePreviewPane.java | 21 ++++++++++++++++--- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java index 7ffd0abe21..10fc42e8f1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -95,9 +95,9 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane int ascentHeight = fm.getAscent(); for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); - String widgetName = cardSwitchButton.getText(); - int width = fm.stringWidth(widgetName); - g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); + String displayName = calculateDisplayName(cardSwitchButton.getText(), fm, eachWidth); + int width = fm.stringWidth(displayName); + g2d.drawString(displayName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); if (i == 0) { g2d.setStroke(new BasicStroke(2.0f)); g2d.drawLine(0, panelHeight - 1, eachWidth, panelHeight - 1); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java index 70499f3028..ff76e5fed5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java @@ -163,8 +163,8 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { g2d.setColor(i == 0 ? selectFontColor : frFont.getForeground()); CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); - String widgetName = cardSwitchButton.getText(); - int width = fm.stringWidth(widgetName); + String displayName = calculateDisplayName(cardSwitchButton.getText(), fm, eachWidth); + int width = fm.stringWidth(displayName); if(i == 0){ Color oldColor = g2d.getColor(); g2d.setColor(this.getSelectColor()); @@ -173,7 +173,7 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { } Icon icon = new Icon(PAINT_ICON, ICON_PATH); g2d.drawImage(IconManager.getIconManager().getDefaultIconImage(icon), (eachWidth - ICON_OFFSET) / 2, (panelHeight - ICON_OFFSET - GAP - fontHeight) / 2, null); - g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight + ICON_OFFSET + GAP - fontHeight) / 2 + ascent); + g2d.drawString(displayName, (eachWidth - width) / 2, (panelHeight + ICON_OFFSET + GAP - fontHeight) / 2 + ascent); Stroke oldStroke = g2d.getStroke(); if (splitLine.getLineStyle() != 0) { g2d.setColor(splitLine.getColor()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java index ddd4c202d0..be8ff823a9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java @@ -188,15 +188,15 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { g2d.setColor(i == 0 ? selectFontColor : frFont.getForeground()); CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); - String widgetName = cardSwitchButton.getText(); - int width = fm.stringWidth(widgetName); + String displayName = calculateDisplayName(cardSwitchButton.getText(), fm, eachWidth); + int width = fm.stringWidth(displayName); if(i == 0){ Color oldColor = g2d.getColor(); g2d.setColor(this.getSelectColor()); g2d.fillRect(0, 0 ,eachWidth, panelHeight - 2); g2d.setColor(oldColor); } - g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); + g2d.drawString(displayName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); Stroke oldStroke = g2d.getStroke(); if (i == 0) { g2d.setColor(this.underLine.getColor()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java index d5ddbb6b9f..73f09f04e0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java @@ -5,6 +5,7 @@ import com.fr.general.cardtag.mobile.TabFontConfig; import javax.swing.JPanel; import java.awt.Color; +import java.awt.FontMetrics; public abstract class MobileTemplatePreviewPane extends JPanel { private Color initialColor; @@ -35,18 +36,32 @@ public abstract class MobileTemplatePreviewPane extends JPanel { this.tabFontConfig = tabFontConfig; } - public MobileTemplatePreviewPane(){ + public MobileTemplatePreviewPane() { } - public void populateConfig(MobileTemplateStyle templateStyle){ + public void populateConfig(MobileTemplateStyle templateStyle) { this.setInitialColor(templateStyle.getInitialColor()); this.setBackground(templateStyle.getInitialColor()); this.setSelectColor(templateStyle.getSelectColor()); this.setTabFontConfig(templateStyle.getTabFontConfig()); } - public void repaint (){ + protected String calculateDisplayName(String widgetName, FontMetrics fm, int eachWidth) { + StringBuffer buffer = new StringBuffer(); + String result; + for (int i = 0; i < widgetName.length(); i++) { + result = buffer.toString(); + buffer.append(widgetName.charAt(i)); + if (fm.stringWidth(buffer.toString()) > eachWidth) { + return result; + } + } + return buffer.toString(); + + } + + public void repaint() { super.repaint(); } From b749d6115ef64057b211900d6510dfb5f44aa3b8 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 12 Dec 2018 11:58:04 +0800 Subject: [PATCH 41/93] =?UTF-8?q?REPORT-13457=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF=E6=8B=96?= =?UTF-8?q?=E6=8B=BD=E5=8D=A1=E9=A1=BF=E9=97=AE=E9=A2=98=20&=20=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=8B=96=E6=8B=BD=E5=9C=BA=E6=99=AF=E7=9A=84=E7=A9=BA?= =?UTF-8?q?=E6=8C=87=E9=92=88=E5=92=8C=E6=95=B0=E7=BB=84=E8=B6=8A=E7=95=8C?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=EF=BC=8C=E6=B3=9B=E5=9E=8B=E6=94=B9=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignModelAdapter.java | 170 +++++++++--- .../fr/design/designer/TargetComponent.java | 5 +- .../design/file/HistoryTemplateListCache.java | 5 + .../design/file/HistoryTemplateListPane.java | 5 + .../com/fr/design/mainframe/BaseJForm.java | 11 +- .../com/fr/design/mainframe/JTemplate.java | 2 +- .../design/mainframe/JTemplateProvider.java | 6 +- .../designer/beans/models/StateModel.java | 66 +++-- .../designer/creator/XCreatorUtils.java | 8 +- .../fr/design/mainframe/ComponentTree.java | 30 ++- .../com/fr/design/mainframe/FormDesigner.java | 8 +- .../fr/design/mainframe/FormModelAdapter.java | 187 +++++++------- .../java/com/fr/design/mainframe/JForm.java | 4 +- .../actions/report/ReportParameterAction.java | 22 +- .../fr/design/mainframe/ElementCasePane.java | 1 + .../com/fr/design/mainframe/JWorkBook.java | 11 +- .../mainframe/WorkBookModelAdapter.java | 244 +++++++++--------- 17 files changed, 480 insertions(+), 305 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java index 251ee7af86..4ebc64103d 100644 --- a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java +++ b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java @@ -3,6 +3,8 @@ package com.fr.design; import com.fr.base.Parameter; import com.fr.base.io.BaseBook; import com.fr.data.TableDataSource; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplateProvider; import com.fr.form.ui.Widget; @@ -14,68 +16,159 @@ import java.util.List; import java.util.Map; /** - * 当前的设计器模式 + * 设计器模式 FormModel or WorkBookModel + *

+ * 指的是编辑的模板是普通报表还是决策报表 * * @author zhou * @since 2012-7-26上午11:24:54 */ -public abstract class DesignModelAdapter { +public abstract class DesignModelAdapter> { + /** + * 当前的设计模式 FormModel or WorkBookModel + */ private static DesignModelAdapter currentModelAdapter; + /** + * 模板 + */ protected S jTemplate; + /** + * 全部的参数,包括全局参数,模板参数和数据集参数 + */ + private Parameter[] parameters; + + /** + * 数据集参数 + */ + private Parameter[] tableDataParameters; + + /** + * 模板参数 + */ + private Parameter[] templateParameters; + + public DesignModelAdapter(S jTemplate) { this.jTemplate = jTemplate; - setCurrentModelAdapter(this); + updateCachedParameter(); + setCurrentModelAdapter(this); + } + + public static void setCurrentModelAdapter(DesignModelAdapter model) { + currentModelAdapter = model; + } + + public static DesignModelAdapter getCurrentModelAdapter() { + return currentModelAdapter; } + /** + * 获取当前编辑的模板 + * + * @return template + * @see DesignerFrameFileDealerPane#setCurrentEditingTemplate(JTemplate) + * @see HistoryTemplateListCache#getCurrentEditingTemplate() + * @deprecated use {@link HistoryTemplateListCache#setCurrentEditingTemplate(JTemplate)} instead + */ + @Deprecated public S getjTemplate() { return jTemplate; } + /** + * 设置当前编辑的模板 + * 不要脱离上下文直接调用 + * + * @param jTemplate jt + * @see DesignerFrameFileDealerPane#setCurrentEditingTemplate(JTemplate) + * @deprecated use {@link HistoryTemplateListCache#setCurrentEditingTemplate(JTemplate)} instead + */ + @Deprecated public void setjTemplate(S jTemplate) { this.jTemplate = jTemplate; } public T getBook() { - return (T) ((JTemplate) jTemplate).getTarget(); + return jTemplate.getTarget(); } - public static void setCurrentModelAdapter(DesignModelAdapter model) { - currentModelAdapter = model; - } - - public static DesignModelAdapter getCurrentModelAdapter() { - return currentModelAdapter; - } /** - * 响应目标改变事件. + * 响应正在编辑的模板改变事件. */ public void fireTargetModified() { - ((JTemplate) this.jTemplate).fireTargetModified(); + this.jTemplate.fireTargetModified(); } + /** + * 获取悬浮元素名称数组 + * + * @return String[] 悬浮元素名称数组 + */ public String[] getFloatNames() { return new String[0]; } + /** + * 获取编辑模板的所有参数 + *

+ * 由于在参数面板拖动过程中频繁获取 + * 远程设计时数据集参数rpc 调用需要考虑网络等因素,因此会比较缓慢,引起参数面板拖动卡顿, + * 所以缓存一下,并且在参数改动时及时缓存 + * + * @return Parameter[] 模板的所有参数 + */ public Parameter[] getParameters() { - return new Parameter[0]; + return parameters == null ? new Parameter[0] : parameters; } - // 报表参数 + /** + * 模板参数(报表参数) + *

+ * 既然全部参数都,那么这个也缓存一下,并且在参数改动时及时缓存 + * + * @return Parameter[] 模板参数 + * @deprecated use {@link DesignModelAdapter#getTemplateParameters()} instead + */ + @Deprecated public Parameter[] getReportParameters() { - return new Parameter[0]; + return getTableDataParameters(); + } + + /** + * 模板参数(报表参数) + *

+ * 既然全部参数都,那么这个也缓存一下,并且在参数改动时及时缓存 + * + * @return Parameter[] 模板参数 + */ + public Parameter[] getTemplateParameters() { + return templateParameters == null ? new Parameter[0] : templateParameters; } /** * 数据源参数 + *

+ * 既然全部参数都,那么这个也缓存一下,并且在参数改动时及时缓存 * - * @return + * @return Parameter[] 数据源参数 */ public Parameter[] getTableDataParameters() { - return new Parameter[0]; + return tableDataParameters == null ? new Parameter[0] : tableDataParameters; + } + + + /** + * 重命名TableData后的一些操作 + * + * @param oldName 旧名字 + * @param newName 新名字. + * @return 返回是否名字一样. + */ + public boolean renameTableData(String oldName, String newName) { + return renameTableData(oldName, newName, true); } /** @@ -101,17 +194,6 @@ public abstract class DesignModelAdapter getWidgetsName(); + /** + * 更新缓存的参数 + */ + public void updateCachedParameter() { + // 全部参数 + this.parameters = getLatestParameters(); + // 数据及参数 + this.tableDataParameters = getLatestTableDataParameters(); + // 模板参数 + this.templateParameters = getLatestTemplateParameters(); + + } + /** * 环境改变. */ @@ -146,4 +241,19 @@ public abstract class DesignModelAdapter extends JComponent { +public abstract class TargetComponent extends JComponent implements JTemplateProvider { private T target; public TargetComponent(T t) { @@ -34,6 +35,7 @@ public abstract class TargetComponent extends JComponent { public abstract void stopEditing(); + @Override public T getTarget() { return target; } @@ -82,6 +84,7 @@ public abstract class TargetComponent extends JComponent { /** * Fire template modified listeners. */ + @Override public void fireTargetModified() { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index b73805ee66..e4bd1db952 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -5,6 +5,7 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.data.DesignTableDataManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JVirtualTemplate; import com.fr.design.module.DesignModuleFactory; @@ -99,6 +100,10 @@ public class HistoryTemplateListCache implements CallbackEvent { return this.editingTemplate; } + /** + * @param jt jt + * @see DesignerFrameFileDealerPane#setCurrentEditingTemplate(JTemplate) + */ public void setCurrentEditingTemplate(JTemplate jt) { this.editingTemplate = jt; //如果当前历史面板中没有 diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java index a51735f641..2dc56cc9da 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java @@ -1,6 +1,7 @@ package com.fr.design.file; import com.fr.base.chart.chartdata.CallbackEvent; +import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; @@ -60,6 +61,10 @@ public class HistoryTemplateListPane implements CallbackEvent { return instead().getCurrentEditingTemplate(); } + /** + * @param jt jt + * @see DesignerFrameFileDealerPane#setCurrentEditingTemplate(JTemplate) + */ public void setCurrentEditingTemplate(JTemplate jt) { instead().setCurrentEditingTemplate(jt); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java b/designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java index 559387b208..d3cff1ff95 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java @@ -1,16 +1,16 @@ package com.fr.design.mainframe; -import javax.swing.JComponent; - import com.fr.form.FormElementCaseContainerProvider; +import javax.swing.JComponent; + /** * Author : Shockway * Date: 13-7-15 * Time: 上午10:28 */ -public interface BaseJForm extends JTemplateProvider { +public interface BaseJForm extends JTemplateProvider { String XML_TAG = "JForm"; int FORM_TAB = 0; @@ -32,11 +32,6 @@ public interface BaseJForm extends JTemplateProvider { */ void refreshSelectedWidget(); - /** - * 获取当前的Target - */ - Object getTarget(); - /** * 执行撤销 * diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 7b80c3fd74..7f5cab7448 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -75,7 +75,7 @@ import java.util.regex.Pattern; /** * 报表设计和表单设计的编辑区域(设计器编辑的IO文件) */ -public abstract class JTemplate> extends TargetComponent implements ToolBarMenuDockPlus, JTemplateProvider, DesignerProxy { +public abstract class JTemplate> extends TargetComponent implements ToolBarMenuDockPlus, DesignerProxy { // TODO ALEX_SEP editingFILE这个属性一定要吗?如果非要不可,有没有可能保证不为null private static final int PREFIX_NUM = 3000; private FILE editingFILE = null; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateProvider.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateProvider.java index 7df132d6e9..fb87f7f049 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateProvider.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateProvider.java @@ -1,6 +1,8 @@ package com.fr.design.mainframe; -public interface JTemplateProvider { +public interface JTemplateProvider { - public void fireTargetModified(); + void fireTargetModified(); + + T getTarget(); } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java index 5eee1aca8d..1e7badb8a3 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java @@ -7,12 +7,22 @@ import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.beans.location.Location; -import com.fr.design.designer.creator.*; +import com.fr.design.designer.creator.XConnector; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteBodyLayout; +import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelectionUtils; import com.fr.design.utils.ComponentUtils; -import java.awt.*; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Graphics; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Toolkit; import java.awt.event.MouseEvent; import java.util.ArrayList; @@ -94,8 +104,11 @@ public class StateModel { return; } - XCreator comp = designer.getComponentAt(e.getX(), e.getY(), selectionModel.getSelection().getSelectedCreators()); - XLayoutContainer container = XCreatorUtils.getHotspotContainer(comp); + XLayoutContainer container = getMouseLocationContainer(e); + if (container == null) { + return; + } + XCreator creator = selectionModel.getSelection().getSelectedCreator(); Component creatorContainer = XCreatorUtils.getParentXLayoutContainer(creator); if (creatorContainer != null && creatorContainer != container @@ -141,11 +154,8 @@ public class StateModel { * @param mouseReleasedY 鼠标释放位置Y */ private void adding(int mouseReleasedX, int mouseReleasedY) { - // 当前鼠标所在的组件 - XCreator hoveredComponent = designer.getComponentAt(mouseReleasedX, mouseReleasedY, selectionModel.getSelection().getSelectedCreators()); - - // 获取该组件所在的焦点容器 - XLayoutContainer container = XCreatorUtils.getHotspotContainer(hoveredComponent); + // 当前鼠标所在组件的容器 + XLayoutContainer container = getMouseLocationContainer(mouseReleasedX, mouseReleasedY); boolean success = false; @@ -166,6 +176,33 @@ public class StateModel { designer.setPainter(null); } + /** + * 获取鼠标所在位置组件的容器 + * + * @param e MouseEvent + * @return 鼠标所在位置的组件的容器 + */ + private XLayoutContainer getMouseLocationContainer(MouseEvent e) { + return getMouseLocationContainer(e.getX(), e.getY()); + } + + /** + * 获取鼠标所在位置组件的容器 + * + * @param x x 鼠标所在位置x + * @param y y 鼠标所在位置y + * @return 鼠标所在位置的组件的容器 + */ + private XLayoutContainer getMouseLocationContainer(int x, int y) { + // 当前鼠标所在的组件 + XCreator hoveredComponent = designer.getComponentAt(x, y, selectionModel.getSelection().getSelectedCreators()); + if (hoveredComponent == null) { + return null; + } + // 获取该组件所在的焦点容器 + return XCreatorUtils.getHotspotContainer(hoveredComponent); + } + /** * 是否拖拽 * @@ -246,7 +283,7 @@ public class StateModel { if (p != null) { try { designer.setCursor(XConnector.connectorCursor); - } catch (Exception e) { + } catch (Exception ignored) { } } else { designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); @@ -433,11 +470,11 @@ public class StateModel { // 拖拽时画依附线用到的painter private void setDependLinePainter(MouseEvent e) { - XCreator comp = designer.getComponentAt(e.getX(), e.getY(), selectionModel.getSelection().getSelectedCreators()); - if (comp == null) { + XLayoutContainer container = getMouseLocationContainer(e); + if (container == null) { return; } - XLayoutContainer container = XCreatorUtils.getHotspotContainer(comp); + XCreator creator = selectionModel.getSelection().getSelectedCreator(); HoverPainter painter = AdapterBus.getContainerPainter(designer, container); designer.setPainter(painter); @@ -479,9 +516,8 @@ public class StateModel { * @return xy值 */ public Point getMouseXY(MouseEvent e) { - Point p1 = new Point(e.getX() + designer.getArea().getHorizontalValue(), e.getY() + return new Point(e.getX() + designer.getArea().getHorizontalValue(), e.getY() + designer.getArea().getVerticalValue()); - return p1; } } \ No newline at end of file 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 748c377836..774010136c 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,9 +66,11 @@ 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 javax.swing.*; -import java.awt.*; +import javax.swing.Icon; +import java.awt.Container; +import java.awt.Dimension; /** * XCreator的相关处理 @@ -284,7 +286,7 @@ public class XCreatorUtils { * @param creator 组件 * @return 返回顶层容器 */ - public static XLayoutContainer getHotspotContainer(XCreator creator) { + public static XLayoutContainer getHotspotContainer(@Nonnull XCreator creator) { if (creator.isDedicateContainer()) { return (XLayoutContainer) creator.getParent(); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java b/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java index 02abef0105..a2f295f87d 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java @@ -3,19 +3,28 @@ package com.fr.design.mainframe; import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWAbsoluteBodyLayout; -import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.treeview.ComponentTreeCellRenderer; import com.fr.design.designer.treeview.ComponentTreeModel; import com.fr.design.gui.itree.UITreeUI; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.DropMode; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JTree; +import javax.swing.SwingUtilities; import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Point; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; @@ -118,7 +127,9 @@ public class ComponentTree extends JTree { public void setAndScrollSelectionPath(TreePath[] treepath) { setSelectionPaths(treepath); - scrollPathToVisible(treepath[0]); + if (treepath.length > 0) { + scrollPathToVisible(treepath[0]); + } } @Override @@ -330,8 +341,7 @@ public class ComponentTree extends JTree { return contentPane; } - private BufferedImage componentToImage(Component comp) throws IOException - { + private BufferedImage componentToImage(Component comp) throws IOException { BufferedImage im = new BufferedImage(comp.getWidth(), comp.getHeight(), BufferedImage.TYPE_INT_ARGB); comp.paint(im.getGraphics()); return im; @@ -341,14 +351,14 @@ public class ComponentTree extends JTree { private void updateSize() { int width = compImage.getWidth(); int height = compImage.getHeight(); - double aspectRatio = (double)width / height; + double aspectRatio = (double) width / height; if (width > MAX_WIDTH) { width = MAX_WIDTH; - height = (int)(width / aspectRatio); + height = (int) (width / aspectRatio); } if (height > MAX_HEIGHT) { height = MAX_HEIGHT; - width = (int)(height * aspectRatio); + width = (int) (height * aspectRatio); } this.setPreferredSize(new Dimension(width, height)); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index fd0de4b257..5dd42de8d9 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -65,6 +65,7 @@ import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.stable.ArrayUtils; import com.fr.stable.bridge.StableFactory; +import com.fr.third.javax.annotation.Nullable; import javax.swing.Action; import javax.swing.JComponent; @@ -918,7 +919,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection * @return 是则返回true */ public boolean isRoot(XCreator comp) { - return comp == rootComponent || comp.acceptType(XWAbsoluteBodyLayout.class); + return comp != null && (comp == rootComponent || comp.acceptType(XWAbsoluteBodyLayout.class)); } // 计算鼠标事件e所发生的位置相对根组件的位置关系 @@ -980,6 +981,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection return getComponentAt(x, y, null); } + @Nullable public XCreator getComponentAt(int x, int y, XCreator[] except) { XLayoutContainer container = y < paraHeight - formArea.getVerticalValue() ? paraComponent : rootComponent; XCreator comp = xCreatorAt(x + formArea.getHorizontalValue(), y + formArea.getVerticalValue(), container, @@ -1191,8 +1193,10 @@ public class FormDesigner extends TargetComponent implements TreeSelection } return designerActions.toArray(new UpdateAction[designerActions.size()]); } + /** * 扩展菜单项 + * * @param actions */ public void dmlActions(List actions) { @@ -1200,7 +1204,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection Set selectionHandlerProviders = ExtraDesignClassManager.getInstance().getArray(RightSelectionHandlerProvider.XML_TAG); for (RightSelectionHandlerProvider handler : selectionHandlerProviders) { if (handler.accept(this)) { - handler.dmlUpdateActions(this,actions); + handler.dmlUpdateActions(this, actions); } } } catch (Exception e) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java b/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java index 3c1233fab0..670c2fa489 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java @@ -12,7 +12,6 @@ import com.fr.form.ui.DataControl; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.Widget; -import com.fr.main.parameter.ReportParameterAttr; import com.fr.script.Calculator; import com.fr.stable.ParameterProvider; import com.fr.stable.js.WidgetName; @@ -20,35 +19,38 @@ import com.fr.stable.js.WidgetName; import java.util.ArrayList; import java.util.List; -public class FormModelAdapter extends DesignModelAdapter { +public class FormModelAdapter extends DesignModelAdapter> { - public FormModelAdapter(BaseJForm jForm) { - super(jForm); - } + public FormModelAdapter(BaseJForm jForm) { + super(jForm); + } /** * 环境改变. */ - public void envChanged() { - WidgetToolBarPane.refresh(); - jTemplate.refreshAllNameWidgets(); - } + public void envChanged() { + WidgetToolBarPane.refresh(); + jTemplate.refreshAllNameWidgets(); + + } /** * 参数改变. */ - public void parameterChanged() { - //实时更新参数 - jTemplate.populateParameter(); - } + public void parameterChanged() { + //实时更新参数 + jTemplate.populateParameter(); + // 更新缓存的参数 + updateCachedParameter(); + } /** * 控件配置改变. */ - public void widgetConfigChanged() { - WidgetToolBarPane.refresh(); - jTemplate.refreshAllNameWidgets(); - } + public void widgetConfigChanged() { + WidgetToolBarPane.refresh(); + jTemplate.refreshAllNameWidgets(); + } /** * 重命名TableData后的一些操作 @@ -57,81 +59,80 @@ public class FormModelAdapter extends DesignModelAdapter { * @param newName 新名字. * @return 返回是否名字一样. */ - public boolean renameTableData(String oldName, String newName) { - if (super.renameTableData(oldName, newName)) { - jTemplate.refreshSelectedWidget(); - return true; - } - return false; - } - - @Override - public List getWidgetsName() { - final List list = new ArrayList(); - Form.traversalFormWidget(this.getBook().getContainer(), new WidgetGatherAdapter() { - - @Override - public void dealWith(Widget widget) { - if (widget instanceof DataControl || widget instanceof MultiFileEditor) { - list.add(new WidgetName(widget.getWidgetName())); - } - } - }); - return list; - } - - /** - * 获取可以被超链的对象,表单主体中的所有控件 - */ - public Widget[] getLinkableWidgets() { - final ArrayList linkAbleList = new ArrayList(); + public boolean renameTableData(String oldName, String newName) { + if (super.renameTableData(oldName, newName)) { + jTemplate.refreshSelectedWidget(); + return true; + } + return false; + } + + @Override + public List getWidgetsName() { + final List list = new ArrayList(); + Form.traversalFormWidget(this.getBook().getContainer(), new WidgetGatherAdapter() { + + @Override + public void dealWith(Widget widget) { + if (widget instanceof DataControl || widget instanceof MultiFileEditor) { + list.add(new WidgetName(widget.getWidgetName())); + } + } + }); + return list; + } + + /** + * 获取可以被超链的对象,表单主体中的所有控件 + */ + public Widget[] getLinkableWidgets() { + final ArrayList linkAbleList = new ArrayList(); final JForm currentJForm = ((JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); - Form.traversalWidget(currentJForm.getRootLayout(), new WidgetGatherAdapter() { - - @Override - public boolean dealWithAllCards() { - return true; - } - - public void dealWith(Widget widget) { - boolean isSupportAsHypelink = widget.acceptType(ElementCaseEditor.class) || widget.acceptType(BaseChartEditor.class); - //可以超链的对象不包含本身; 目前只有图表和报表块可以 - // bug66182 删了条件:!ComparatorUtils.equals(editingECName, widget.getWidgetName()) 让当前表单对象可以选到自己 - if (isSupportAsHypelink) { - linkAbleList.add(widget); - } - } - }, Widget.class); - - return linkAbleList.toArray(new Widget[linkAbleList.size()]); - } - - // 报表参数 - @Override - public Parameter[] getReportParameters() { - Parameter[] rpa = this.getBook().getTemplateParameters(); - return rpa == null ? new Parameter[0] : rpa; - } - - // 数据源参数 - @Override - public Parameter[] getTableDataParameters() { - TableDataSource source = this.getBook(); - Calculator c = Calculator.createCalculator(); - c.setAttribute(TableDataSource.KEY, source); - java.util.List list = new java.util.ArrayList(); - java.util.Iterator nameIt = this.getBook().getTableDataNameIterator(); - while (nameIt.hasNext()) { - TableData td = source.getTableData(nameIt.next()); - if (td.getParameters(c) != null) { - list.addAll(java.util.Arrays.asList(td.getParameters(c))); - } - } - return list.toArray(new Parameter[list.size()]); - } - - @Override - public Parameter[] getParameters() { - return this.getBook().getParameters(); - } + Form.traversalWidget(currentJForm.getRootLayout(), new WidgetGatherAdapter() { + + @Override + public boolean dealWithAllCards() { + return true; + } + + public void dealWith(Widget widget) { + boolean isSupportAsHypelink = widget.acceptType(ElementCaseEditor.class) || widget.acceptType(BaseChartEditor.class); + //可以超链的对象不包含本身; 目前只有图表和报表块可以 + // bug66182 删了条件:!ComparatorUtils.equals(editingECName, widget.getWidgetName()) 让当前表单对象可以选到自己 + if (isSupportAsHypelink) { + linkAbleList.add(widget); + } + } + }, Widget.class); + + return linkAbleList.toArray(new Widget[linkAbleList.size()]); + } + + + @Override + protected Parameter[] getLatestTemplateParameters() { + Parameter[] rpa = this.getBook().getTemplateParameters(); + return rpa == null ? new Parameter[0] : rpa; + } + + @Override + protected Parameter[] getLatestTableDataParameters() { + TableDataSource source = this.getBook(); + Calculator c = Calculator.createCalculator(); + c.setAttribute(TableDataSource.KEY, source); + java.util.List list = new java.util.ArrayList(); + java.util.Iterator nameIt = this.getBook().getTableDataNameIterator(); + while (nameIt.hasNext()) { + TableData td = source.getTableData(nameIt.next()); + if (td.getParameters(c) != null) { + list.addAll(java.util.Arrays.asList(td.getParameters(c))); + } + } + return list.toArray(new Parameter[list.size()]); + } + + @Override + protected Parameter[] getLatestParameters() { + return this.getBook().getParameters(); + } } \ No newline at end of file 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 cc3ba96f5c..06f7632265 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 @@ -86,7 +86,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -public class JForm extends JTemplate implements BaseJForm { +public class JForm extends JTemplate implements BaseJForm { private static final String FORM_CARD = "FORM"; private static final String ELEMENTCASE_CARD = "ELEMENTCASE"; @@ -139,7 +139,7 @@ public class JForm extends JTemplate implements BaseJForm { return DesignState.JFORM; } - public TemplateProcessInfo getProcessInfo() { + public TemplateProcessInfo getProcessInfo() { if (processInfo == null) { processInfo = new JFormProcessInfo(template); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportParameterAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportParameterAction.java index 5a72fd13c8..1d044909cb 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportParameterAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportParameterAction.java @@ -3,25 +3,25 @@ */ package com.fr.design.actions.report; -import java.awt.event.ActionEvent; - -import javax.swing.SwingUtilities; - import com.fr.base.BaseUtils; import com.fr.base.Parameter; +import com.fr.design.DesignModelAdapter; import com.fr.design.actions.JWorkBookAction; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.design.parameter.ParameterArrayPane; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.DialogActionAdapter; import com.fr.main.TemplateWorkBook; import com.fr.main.parameter.ReportParameterAttr; +import javax.swing.SwingUtilities; +import java.awt.event.ActionEvent; + /** * Report Parameter */ -public class ReportParameterAction extends JWorkBookAction{ +public class ReportParameterAction extends JWorkBookAction { public ReportParameterAction(JWorkBook jwb) { super(jwb); @@ -37,7 +37,7 @@ public class ReportParameterAction extends JWorkBookAction{ * @return 是否执行成功 */ public void actionPerformed(ActionEvent evt) { - final JWorkBook jwb = getEditingComponent(); + JWorkBook jwb = getEditingComponent(); if (jwb == null) { return; } @@ -59,10 +59,8 @@ public class ReportParameterAction extends JWorkBookAction{ for (int i = 0; i < parameters.length; i++) { copyReportParameterAttr.addParameter(parameters[i]); } - jwb.fireTargetModified(); - jwb.updateReportParameterAttr(); - jwb.populateReportParameterAttr(); - + DesignModelAdapter.getCurrentModelAdapter().fireTargetModified(); + DesignModelAdapter.getCurrentModelAdapter().parameterChanged(); } }); parameterArrayDialog.setVisible(true); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java index 4112ac6c44..5bc5cd791d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java @@ -862,6 +862,7 @@ public abstract class ElementCasePane extends Tar /** * 响应目标变动. */ + @Override public void fireTargetModified() { // marks:自动计算 TemplateElementCase report = this.getEditingElementCase(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index 569f02bb6f..58ecb1ea85 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -204,7 +204,7 @@ public class JWorkBook extends JTemplate { } @Override - public TemplateProcessInfo getProcessInfo() { + public TemplateProcessInfo getProcessInfo() { if (processInfo == null) { processInfo = new JWorkBookProcessInfo(template); } @@ -309,10 +309,10 @@ public class JWorkBook extends JTemplate { centerPane.setUpPaneHeight(hasParameterPane() ? parameterPane.getPreferredSize().height : 0); } - @Override /** * */ + @Override public void setComposite() { super.setComposite(); reportComposite.setComponents(); @@ -544,10 +544,11 @@ public class JWorkBook extends JTemplate { // //////////////////////OLD BELOW///////////////////////// // //////////////////////////////////////////////////////// - @Override + /** * set target */ + @Override public void setTarget(WorkBook book) { if (book == null) { return; @@ -1098,7 +1099,7 @@ public class JWorkBook extends JTemplate { FILE newFile = createNewEmptyFile(); //如果文件已经打开, 那么就覆盖关闭掉他 MutilTempalteTabPane.getInstance().closeFileTemplate(newFile); - final TemplateWorkBook tpl = this.getTarget(); + final WorkBook tpl = this.getTarget(); // 弹出输入参数 java.util.Map parameterMap = inputParameters(tpl); @@ -1106,7 +1107,7 @@ public class JWorkBook extends JTemplate { String fullPath = StableUtils.pathJoin(WorkContext.getCurrent().getPath(), newFile.getPath()); FileOutputStream fileOutputStream = new FileOutputStream(fullPath); EmbeddedTableDataExporter exporter = new EmbeddedTableDataExporter(); - exporter.export(fileOutputStream, (WorkBook) tpl, parameterMap); + exporter.export(fileOutputStream, tpl, parameterMap); } catch (Exception e1) { FRContext.getLogger().error(e1.getMessage()); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java b/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java index d84090b181..1e55d3c9b0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java @@ -25,132 +25,134 @@ import java.util.Iterator; import java.util.List; /** - * * @author zhou * @since 2012-7-26下午2:03:12 */ public class WorkBookModelAdapter extends DesignModelAdapter { - public WorkBookModelAdapter(JWorkBook jworkbook) { - super(jworkbook); - } - - @Override - public Parameter[] getParameters() { - return this.getBook().getParameters(); - } - - // 报表参数 - @Override - public Parameter[] getReportParameters() { - ReportParameterAttr rpa = this.getBook().getReportParameterAttr(); - return rpa == null ? new Parameter[0] : rpa.getParameters(); - } - - // 数据源参数 - @Override - public Parameter[] getTableDataParameters() { - TableDataSource source = this.getBook(); - Calculator c = Calculator.createCalculator(); - c.setAttribute(TableDataSource.KEY, source); - java.util.List list = new java.util.ArrayList(); - java.util.Iterator nameIt = this.getBook().getTableDataNameIterator(); - while (nameIt.hasNext()) { - TableData td = source.getTableData(nameIt.next()); - if (td.getParameters(c) != null) { - list.addAll(java.util.Arrays.asList(td.getParameters(c))); - } - } - return list.toArray(new Parameter[list.size()]); - } - - /** - * 重命名TableData后的一些操作 - * @param oldName 旧名字 - * @param newName 新名字 - * @return 返回是否刷新. - */ - public boolean renameTableData(String oldName, String newName) { - if (super.renameTableData(oldName, newName)) { - if (this.getBook().getTableData(oldName) == null) { - jTemplate.refreshParameterPane4TableData(oldName,newName); - } - return true; - } - return false; - } - - /** - * 环境改变. - */ - public void envChanged() { - DesignToolbarProvider provider = StableFactory.getMarkedObject(DesignToolbarProvider.STRING_MARKED, DesignToolbarProvider.class); - if (provider != null) { - provider.refreshToolbar(); - } - jTemplate.refreshAllNameWidgets(); - } - - /** - * 参数改变. - */ - public void parameterChanged() { - jTemplate.updateReportParameterAttr(); - jTemplate.populateReportParameterAttr(); - } - - /** - * 控件改变. - */ - public void widgetConfigChanged() { - DesignToolbarProvider provider = StableFactory.getMarkedObject(DesignToolbarProvider.STRING_MARKED, DesignToolbarProvider.class); - if (provider != null) { - provider.refreshToolbar(); - } - jTemplate.refreshAllNameWidgets(); - } - - /** - * 返回控件的名字 - * @return widgetName 控件列表. - */ - public List getWidgetsName() { - List list = new ArrayList(); - WorkBook wb = this.getBook(); - for (int i = 0, len = wb.getReportCount(); i < len; i++) { - Report report = wb.getReport(i); - Iterator it = report.iteratorOfElementCase(); - while (it.hasNext()) { - ElementCase ec = (ElementCase)it.next(); - Iterator cs = ec.cellIterator(); - while (cs.hasNext()) { - CellElement ce = (CellElement)cs.next(); - if (ce instanceof DefaultTemplateCellElement) { - Widget widget = ((DefaultTemplateCellElement)ce).getWidget(); - if (widget != null && StringUtils.isNotEmpty(widget.getWidgetName())) { - list.add(new WidgetName(widget.getWidgetName())); - } - } - } - } - } - return list; - } - - /** - * 返回悬浮元素的名字数组 - * @return 返回数组. - */ - public String[] getFloatNames() { - TemplateElementCase elementCase = jTemplate.getEditingElementCase(); - - List nameList = new ArrayList(); - Iterator it = elementCase.floatIterator(); - while (it.hasNext()) { - nameList.add(it.next().getName()); - } - return nameList.toArray(new String[nameList.size()]); - } + public WorkBookModelAdapter(JWorkBook jworkbook) { + super(jworkbook); + } + + + /** + * 重命名TableData后的一些操作 + * + * @param oldName 旧名字 + * @param newName 新名字 + * @return 返回是否刷新. + */ + public boolean renameTableData(String oldName, String newName) { + if (super.renameTableData(oldName, newName)) { + if (this.getBook().getTableData(oldName) == null) { + jTemplate.refreshParameterPane4TableData(oldName, newName); + } + return true; + } + return false; + } + + /** + * 环境改变. + */ + public void envChanged() { + DesignToolbarProvider provider = StableFactory.getMarkedObject(DesignToolbarProvider.STRING_MARKED, DesignToolbarProvider.class); + if (provider != null) { + provider.refreshToolbar(); + } + jTemplate.refreshAllNameWidgets(); + } + + /** + * 参数改变. + */ + public void parameterChanged() { + jTemplate.updateReportParameterAttr(); + jTemplate.populateReportParameterAttr(); + updateCachedParameter(); + } + + /** + * 控件改变. + */ + public void widgetConfigChanged() { + DesignToolbarProvider provider = StableFactory.getMarkedObject(DesignToolbarProvider.STRING_MARKED, DesignToolbarProvider.class); + if (provider != null) { + provider.refreshToolbar(); + } + jTemplate.refreshAllNameWidgets(); + } + + @Override + protected Parameter[] getLatestTemplateParameters() { + ReportParameterAttr rpa = this.getBook().getReportParameterAttr(); + return rpa == null ? new Parameter[0] : rpa.getParameters(); + } + + @Override + protected Parameter[] getLatestTableDataParameters() { + TableDataSource source = this.getBook(); + Calculator c = Calculator.createCalculator(); + c.setAttribute(TableDataSource.KEY, source); + java.util.List list = new java.util.ArrayList(); + java.util.Iterator nameIt = this.getBook().getTableDataNameIterator(); + while (nameIt.hasNext()) { + TableData td = source.getTableData(nameIt.next()); + if (td.getParameters(c) != null) { + list.addAll(java.util.Arrays.asList(td.getParameters(c))); + } + } + return list.toArray(new Parameter[list.size()]); + } + + @Override + protected Parameter[] getLatestParameters() { + return this.getBook().getParameters(); + } + + /** + * 返回控件的名字 + * + * @return widgetName 控件列表. + */ + public List getWidgetsName() { + List list = new ArrayList(); + WorkBook wb = this.getBook(); + for (int i = 0, len = wb.getReportCount(); i < len; i++) { + Report report = wb.getReport(i); + Iterator it = report.iteratorOfElementCase(); + while (it.hasNext()) { + ElementCase ec = (ElementCase) it.next(); + Iterator cs = ec.cellIterator(); + while (cs.hasNext()) { + CellElement ce = (CellElement) cs.next(); + if (ce instanceof DefaultTemplateCellElement) { + Widget widget = ((DefaultTemplateCellElement) ce).getWidget(); + if (widget != null && StringUtils.isNotEmpty(widget.getWidgetName())) { + list.add(new WidgetName(widget.getWidgetName())); + } + } + } + } + } + return list; + } + + /** + * 返回悬浮元素的名字数组 + * + * @return 返回数组. + */ + public String[] getFloatNames() { + TemplateElementCase elementCase = jTemplate.getEditingElementCase(); + + List nameList = new ArrayList(); + Iterator it = elementCase.floatIterator(); + while (it.hasNext()) { + nameList.add(it.next().getName()); + } + return nameList.toArray(new String[nameList.size()]); + } public Widget[] getLinkableWidgets() { From a515a01364cc684cba27e8814b8ee977214f5488 Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 13 Dec 2018 09:42:04 +0800 Subject: [PATCH 42/93] =?UTF-8?q?REPORT-12885=20=E9=83=A8=E5=88=86?= =?UTF-8?q?=E7=94=B5=E8=84=91=E5=9C=A8=E7=BD=91=E7=BB=9C=E7=95=85=E9=80=9A?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B3=E7=A7=92=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E4=B8=8D=E5=88=B0=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-realize/src/main/java/com/fr/start/SplashContext.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/start/SplashContext.java b/designer-realize/src/main/java/com/fr/start/SplashContext.java index 2e5467557c..a8a542a581 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -24,7 +24,7 @@ public class SplashContext { public static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif"; public static final String SPLASH_CACHE_NAME = "splash_10.gif"; - private static final int FETCH_ONLINE_MAX_TIMES = 10; + private static final int FETCH_ONLINE_MAX_TIMES = 50; private static final SplashContext SPLASH_CONTEXT = new SplashContext(); From 2c50f3d1dd33482648882b64543c3c4b895d9531 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Fri, 14 Dec 2018 15:52:34 +0800 Subject: [PATCH 43/93] =?UTF-8?q?REPORT-13431=20=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=82=B9=E8=AE=B0=E5=BD=95,=20=E9=9C=80=E8=A6=81=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E9=80=81=201.=E7=94=A8=E6=88=B7=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=8E=9F=E5=85=88=E6=94=B6=E9=9B=86=E5=9C=A8feedback?= =?UTF-8?q?=EF=BC=8C10.0=E9=9C=80=E8=A6=81=E9=80=82=E9=85=8D=202.=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E7=82=B9=E4=BB=8Emetric=E5=8F=96=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E4=BC=A0=E5=85=A5Date=E4=BB=8E12=E6=9C=8810?= =?UTF-8?q?=E5=8F=B7=E5=BC=80=E5=A7=8B=E5=B0=B1=E6=8B=BF=E4=B8=8D=E5=88=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BA=86=EF=BC=8C=E6=8D=A2=E7=94=A8long?= =?UTF-8?q?=E6=98=AF=E5=8F=AF=E4=BB=A5=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 047ffc6717..0398189d9c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -170,7 +170,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { } - private byte[] getJSONContentAsByte(){ + private JSONObject getJSONContentAsByte(){ JSONObject content = new JSONObject(); JSONArray startStopArray = new JSONArray(); @@ -192,13 +192,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { FRContext.getLogger().error(e.getMessage(), e); } } - - try { - return content.toString().getBytes(EncodeConstants.ENCODING_UTF_8); - } catch (UnsupportedEncodingException e) { - FRContext.getLogger().error(e.getMessage(), e); - return ArrayUtils.EMPTY_BYTE_ARRAY; - } + return content; } private void sendUserInfo(){ @@ -208,19 +202,17 @@ public class InformationCollector implements XMLReadable, XMLWriter { if (currentTime - lastTime <= DELTA) { return; } - byte[] content = getJSONContentAsByte(); - HttpClient hc = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("user.info")); - hc.setContent(content); - if (!hc.isServerAlive()) { - return; - } - String res = hc.getResponseText(); - //服务器返回true,说明已经取得成功,清空当前记录的信息 + JSONObject content = getJSONContentAsByte(); + String url = CloudCenter.getInstance().acquireUrlByKind("user.info.v10"); boolean success = false; try { + HashMap para = new HashMap<>(); + para.put("token", SiteCenterToken.generateToken()); + para.put("content", content); + String res = HttpToolbox.post(url, para); success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); - } catch (JSONException e) { - FRContext.getLogger().error(e.getMessage(), e); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } if (success){ this.reset(); @@ -236,7 +228,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { } JSONArray content = null; try { - content = getFunctionsContent(current, new Date(lastTime)); + content = getFunctionsContent(currentTime, lastTime); } catch (JSONException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -451,7 +443,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { }); } - public static JSONArray getFunctionsContent(Date current, Date last) throws JSONException{ + public static JSONArray getFunctionsContent(long current, long last) throws JSONException{ //记录当前条数,达到200条合并成一个请求 int count = 0; JSONArray functionArray = new JSONArray(); From 9d2d79d44c3e250131c7c8f63fbd3cde43ed4033 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 17 Dec 2018 09:38:46 +0800 Subject: [PATCH 44/93] =?UTF-8?q?REPORT-13548=E3=80=9010.0.2=E5=9B=9E?= =?UTF-8?q?=E5=BD=92=E3=80=91tab=E5=9D=97=E5=A4=8D=E5=88=B6=E7=B2=98?= =?UTF-8?q?=E8=B4=B4=E5=90=8E=E7=82=B9=E5=87=BB=E4=BC=9A=E4=BA=A7=E7=94=9F?= =?UTF-8?q?=E8=81=94=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../creator/cardlayout/XWCardLayout.java | 10 ++++ .../design/mainframe/FormSelectionUtils.java | 58 ++++++++++++------- 2 files changed, 47 insertions(+), 21 deletions(-) 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 53a72e9112..107e31ed12 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 @@ -106,6 +106,16 @@ public class XWCardLayout extends XLayoutContainer { return new Dimension(500, 300); } + /** + * 重置组件的名称 + * @param name 名称 + */ + public void resetCreatorName(String name) { + super.resetCreatorName(name); + changeRelateSwitchCardName(name); + } + + @Override protected void initLayoutManager() { cardLayout = new FRCardLayout(toData().getHgap(), toData().getVgap()); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java index 9a6a5d546e..f88b9e5400 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java @@ -14,12 +14,11 @@ import com.fr.design.designer.creator.XWScaleLayout; import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.utils.ComponentUtils; +import com.fr.form.main.Form; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WTitleLayout; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; - - import java.awt.Component; import java.awt.Point; import java.awt.Rectangle; @@ -97,8 +96,7 @@ public class FormSelectionUtils { Rectangle rec = clipboard.getSelctionBounds(); for (XCreator creator : clipboard.getSelectedCreators()) { try { - Widget copied = copyWidget(designer, creator); - XCreator copiedCreator = XCreatorUtils.createXCreator(copied, creator.getSize()); + XCreator copiedCreator = copyXcreator(designer.getTarget(), creator); // 获取位置 Point point = getPasteLocation((AbstractLayoutAdapter) adapter, copiedCreator, @@ -181,8 +179,7 @@ public class FormSelectionUtils { private static void relativePasteXCreator(FormDesigner designer, XCreator creator, LayoutAdapter adapter, Rectangle tabContainerRect, int x, int y) { try { - Widget copied = copyWidget(designer, creator); - XCreator copiedXCreator = XCreatorUtils.createXCreator(copied, creator.getSize()); + XCreator copiedXCreator = copyXcreator(designer.getTarget(), creator); if (adapter.getClass().equals(FRTabFitLayoutAdapter.class)) { if (!adapter.accept(copiedXCreator, x - tabContainerRect.x, y - tabContainerRect.y)) { designer.showMessageDialog(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Too_Small_To_Paste")); @@ -235,33 +232,52 @@ public class FormSelectionUtils { return new Point(x, y); } - /** * 拷贝组件 + * @param form 当前表单 + * @param xCreator 待拷贝的组件 + * @return XCreator 拷贝的组件 */ - private static Widget copyWidget(FormDesigner formDesigner, XCreator xCreator) throws - CloneNotSupportedException { - ArrayList nameSpace = new ArrayList<>(); + public static XCreator copyXcreator(Form form, XCreator xCreator) throws CloneNotSupportedException{ Widget copied = (Widget) xCreator.toData().clone(); - //重命名拷贝的组件 - String name = getCopiedName(formDesigner, copied, nameSpace); - if (copied instanceof WTitleLayout) { - XWTitleLayout xwTitleLayout = new XWTitleLayout((WTitleLayout) copied, xCreator.getSize()); - xwTitleLayout.resetCreatorName(name); - } else { - copied.setWidgetName(name); + XCreator copiedCreator = XCreatorUtils.createXCreator(copied, xCreator.getSize()); + ArrayList nameSpace = new ArrayList<>(); + copyWidgetName(form, nameSpace, copiedCreator); + return copiedCreator; + } + + /** + * 拷贝组件 + * @param form 当前表单 + * @param nameSpace 命名空间 + * @param xCreator 拷贝的组件 + */ + private static void copyWidgetName(Form form, ArrayList nameSpace, XCreator xCreator){ + String copyName = FormSelectionUtils.getCopiedName(form, xCreator.toData(), nameSpace); + if (xCreator.toData() instanceof WTitleLayout) { + XWTitleLayout xwTitleLayout = new XWTitleLayout((WTitleLayout) xCreator.toData(), xCreator.getSize()); + xwTitleLayout.resetCreatorName(copyName); + return; + } + xCreator.resetCreatorName(copyName); + int count = xCreator.getComponentCount(); + for(int a = 0; a nameSpace) { + private static String getCopiedName(Form form, Widget copied, ArrayList nameSpace) { StringBuilder name = new StringBuilder(copied.getWidgetName()); do { name.append(POSTFIX); - } while (formDesigner.getTarget().isNameExist(name.toString()) || nameSpace.contains(name.toString())); + } while (form.isNameExist(name.toString()) || nameSpace.contains(name.toString())); nameSpace.add(name.toString()); return name.toString(); } @@ -308,4 +324,4 @@ public class FormSelectionUtils { } } } -} +} \ No newline at end of file From 0b837ebfb2ef0f8523b5db9655abccc2024b9409 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 17 Dec 2018 11:38:40 +0800 Subject: [PATCH 45/93] =?UTF-8?q?REPORT-13626=E3=80=9010.0.2=E5=9B=9E?= =?UTF-8?q?=E5=BD=92=E3=80=91=E4=BF=9D=E5=AD=98=E6=A8=A1=E7=89=88-?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E6=B2=A1=E6=9C=89=E5=AE=9E=E6=97=B6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/itextfield/UIAutoCompletionField.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java index de6bccd865..5672a8502d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java @@ -1,11 +1,9 @@ package com.fr.design.gui.itextfield; import com.fr.design.gui.imenu.UIListPopup; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; -import com.fr.stable.OperatingSystem; - -import javax.swing.*; +import javax.swing.JList; +import javax.swing.UIManager; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.event.ListSelectionEvent; @@ -13,10 +11,12 @@ import javax.swing.event.ListSelectionListener; import javax.swing.text.AbstractDocument; import javax.swing.text.BadLocationException; import javax.swing.text.Document; - -import java.awt.Dimension; -import java.awt.LayoutManager; -import java.awt.event.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; import java.util.ArrayList; public class UIAutoCompletionField extends UITextField implements DocumentListener, MouseListener, ListSelectionListener, ActionListener, KeyListener { @@ -82,9 +82,6 @@ public class UIAutoCompletionField extends UITextField implements DocumentListen } private void textChanged() { - if (OperatingSystem.isMacOS()) { - return; - } if (!popup.isVisible()) { showPopup(); requestFocus(); From 62c14cfe072e138ee0874d651b7b1520f78d6f6d Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 17 Dec 2018 14:51:11 +0800 Subject: [PATCH 46/93] REPORT-13629 & REPORT-13572 --- .../src/main/java/com/fr/design/mainframe/JForm.java | 5 +++-- .../main/java/com/fr/design/mainframe/SheetNameTabPane.java | 6 ++++-- 2 files changed, 7 insertions(+), 4 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 cc3ba96f5c..fb58e21eff 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.vcs.DesignerMode; import com.fr.design.DesignState; +import com.fr.design.actions.FormMobileAttrAction; import com.fr.design.actions.TemplateParameterAction; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; @@ -496,9 +497,9 @@ public class JForm extends JTemplate implements BaseJForm { @Override public ShortCut[] shortcut4TemplateMenu() { if (this.index == FORM_TAB) { - return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); + return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); } else { - return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); + return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), new ReportFitAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java index 3ecd2caf42..09f1ff9e1b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java @@ -335,7 +335,8 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse checkButton(showCount < widthArray.length); // richie:当linearray不为空时,说明有了鼠标拖动,下面画由于鼠标拖动产生的效果. - if (!lineArray.isEmpty()) { + //REPORT-13572 点击切换会出现重影,保证:此时鼠标点击是没有放开的,才会绘制轨迹 + if (!lineArray.isEmpty() && !isReleased) { paintDragTab(g2d, textHeight, charWidth, textAscent); } @@ -568,6 +569,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse * @param evt 鼠标事件 */ public void mousePressed(MouseEvent evt) { + isReleased = false; int reportcount = reportComposite.getEditingWorkBook().getReportCount(); if (scrollIndex < 0 || scrollIndex >= reportcount) { return; @@ -749,7 +751,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse /** * exchange workSheet * - * @param workBook + * @param * @param index1 * @param index2 * @return workBook From e10d3b580abbda023f6dd149e5e55299eacf7da8 Mon Sep 17 00:00:00 2001 From: zheng Date: Mon, 17 Dec 2018 14:53:21 +0800 Subject: [PATCH 47/93] =?UTF-8?q?CHART-2554=20=E6=BC=8F=E6=96=97=E5=9B=BE?= =?UTF-8?q?=20=E7=95=8C=E9=9D=A2=20=E9=A3=8E=E6=A0=BC=2010.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/funnel/designer/style/VanChartFunnelSeriesPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java index a6a8dcb9a9..8a02cd5f44 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java @@ -44,7 +44,7 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane { //设置色彩面板内容 protected void setColorPaneContent (JPanel panel) { if (stylePane != null) { - panel.add(createStylePane(), BorderLayout.CENTER); + panel.add(stylePane, BorderLayout.CENTER); } panel.add(createAlphaPane(), BorderLayout.SOUTH); } From 31088893d87d2830e25a9a3e543bdd37159e1c58 Mon Sep 17 00:00:00 2001 From: Hades Date: Mon, 17 Dec 2018 16:18:03 +0800 Subject: [PATCH 48/93] =?UTF-8?q?REPORT-13614=20=E3=80=9010.0.2=E5=9B=9E?= =?UTF-8?q?=E5=BD=92=E3=80=91=E9=A2=84=E5=AE=9A=E4=B9=89=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=8D=E5=8F=AF=E7=94=A8=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/core/UserDefinedWidgetOption.java | 9 +++++++-- .../main/java/com/fr/design/mainframe/FormParaPane.java | 5 ++++- .../java/com/fr/design/mainframe/FormParaWidgetPane.java | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java b/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java index 40490702de..d57875e38c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java +++ b/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java @@ -9,14 +9,19 @@ import com.fr.form.ui.Widget; public class UserDefinedWidgetOption extends WidgetOption { private String widgetConfigName; + private Widget widget; - public UserDefinedWidgetOption(String name) { + public UserDefinedWidgetOption(String name, Widget widget) { this.widgetConfigName = name; + this.widget = widget; } @Override public Widget createWidget() { - return new NameWidget(widgetConfigName); + Widget widget = new NameWidget(widgetConfigName); + widget.setEnabled(this.widget.isEnabled()); + widget.setVisible(this.widget.isVisible()); + return widget; } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java index 647a0dd8a5..1d990aeb69 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java @@ -1,10 +1,12 @@ package com.fr.design.mainframe; +import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.core.UserDefinedWidgetOption; import com.fr.design.gui.core.WidgetOption; +import com.fr.design.gui.core.WidgetOptionFactory; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.gui.LayoutUtils; @@ -25,6 +27,7 @@ import java.awt.event.ComponentEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; +import java.util.Arrays; import java.util.Iterator; /** @@ -154,7 +157,7 @@ public class FormParaPane extends JPanel { //预定义控件工具栏这儿不显示工具栏中没有的预定义控件 continue; } - predifinedwidgeList.add(new UserDefinedWidgetOption(name)); + predifinedwidgeList.add(new UserDefinedWidgetOption(name, widget)); } } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index 1958056b35..76cf264397 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -256,7 +256,7 @@ public class FormParaWidgetPane extends JPanel { //预定义控件工具栏这儿不显示工具栏中没有的预定义控件 continue; } - predifinedwidgeList.add(new UserDefinedWidgetOption(name)); + predifinedwidgeList.add(new UserDefinedWidgetOption(name, widget)); } } } From 84d6fdb7ec249916cec6038941e095526feac668 Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 18 Dec 2018 21:56:27 +0800 Subject: [PATCH 49/93] =?UTF-8?q?=E7=9C=9F=E6=AD=A3=E6=88=90=E5=9B=A0:=20X?= =?UTF-8?q?NameWidegt=E6=BC=8F=E5=8A=A0setEnable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/core/UserDefinedWidgetOption.java | 9 ++------- .../java/com/fr/design/designer/creator/XNameWidget.java | 4 +++- .../main/java/com/fr/design/mainframe/FormParaPane.java | 2 +- .../java/com/fr/design/mainframe/FormParaWidgetPane.java | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java b/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java index d57875e38c..40490702de 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java +++ b/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java @@ -9,19 +9,14 @@ import com.fr.form.ui.Widget; public class UserDefinedWidgetOption extends WidgetOption { private String widgetConfigName; - private Widget widget; - public UserDefinedWidgetOption(String name, Widget widget) { + public UserDefinedWidgetOption(String name) { this.widgetConfigName = name; - this.widget = widget; } @Override public Widget createWidget() { - Widget widget = new NameWidget(widgetConfigName); - widget.setEnabled(this.widget.isEnabled()); - widget.setVisible(this.widget.isVisible()); - return widget; + return new NameWidget(widgetConfigName); } @Override diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java b/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java index b886ad6c49..2671017878 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java @@ -68,7 +68,9 @@ public class XNameWidget extends XWidgetCreator { Widget widget; if (wc != null && (widget= wc.toWidget()) != null) { editor = XCreatorUtils.createXCreator(widget); - toData().setVisible(widget.isVisible()); + Widget currentWidget = toData(); + currentWidget.setVisible(widget.isVisible()); + currentWidget.setEnabled(widget.isEnabled()); this.setBorder(null); } else { this.setBorder(DEFALUTBORDER); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java index 1d990aeb69..9de2484202 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java @@ -157,7 +157,7 @@ public class FormParaPane extends JPanel { //预定义控件工具栏这儿不显示工具栏中没有的预定义控件 continue; } - predifinedwidgeList.add(new UserDefinedWidgetOption(name, widget)); + predifinedwidgeList.add(new UserDefinedWidgetOption(name)); } } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index 76cf264397..1958056b35 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -256,7 +256,7 @@ public class FormParaWidgetPane extends JPanel { //预定义控件工具栏这儿不显示工具栏中没有的预定义控件 continue; } - predifinedwidgeList.add(new UserDefinedWidgetOption(name, widget)); + predifinedwidgeList.add(new UserDefinedWidgetOption(name)); } } } From 582c2890c99f42745d0a6ff4358f1a30a2d2e96f Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 18 Dec 2018 21:58:58 +0800 Subject: [PATCH 50/93] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/FormParaPane.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java index 9de2484202..647a0dd8a5 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java @@ -1,12 +1,10 @@ package com.fr.design.mainframe; -import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.core.UserDefinedWidgetOption; import com.fr.design.gui.core.WidgetOption; -import com.fr.design.gui.core.WidgetOptionFactory; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.gui.LayoutUtils; @@ -27,7 +25,6 @@ import java.awt.event.ComponentEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; /** From 82517ab7436bddd1277b62dd8f3cff16ceb22c17 Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 19 Dec 2018 10:27:04 +0800 Subject: [PATCH 51/93] =?UTF-8?q?REPORT-13528=20=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=9A=84jar=EF=BC=8C=E5=9B=BE=E7=89=87=E8=B6=85=E9=93=BE?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E5=8F=96=E5=88=B0=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SeriesCondition/impl/FormHyperlinkNorthPane.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java index 63d94bbb2a..5159e318cf 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java @@ -110,12 +110,14 @@ public class FormHyperlinkNorthPane extends BasicBeanPane } String editorName = formHyperlink.getRelateEditorName(); //防止初始的时候有空白选项 - if (editorName == null) { - return; + String[] formHyperlinkEditNames = getFormHyperlinkEditNames(); + if (editorName == null && formHyperlinkEditNames.length > 0) { + editorName = formHyperlinkEditNames[0]; + formHyperlink.setRelateEditorName(editorName); } if (targetFrameComboBox != null) { //noinspection unchecked - targetFrameComboBox.setModel(new DefaultComboBoxModel(getFormHyperlinkEditNames())); + targetFrameComboBox.setModel(new DefaultComboBoxModel(formHyperlinkEditNames)); targetFrameComboBox.setSelectedItem(editorName); } } From 630ad3cf0c223ffa29132528d2baf177b4a39b86 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 19 Dec 2018 14:56:48 +0800 Subject: [PATCH 52/93] =?UTF-8?q?MOBILE-18837=E3=80=90RN=E3=80=91=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E3=80=8Btabpane=E3=80=8B=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E6=A8=A1=E6=9D=BF=E8=AE=BE=E4=B8=BA=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=EF=BC=8Ctabpane=E4=B8=80=E4=BA=9B=E5=AD=97=E4=BD=93?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobile/ui/DefaultMobileStyleDefinePane.java | 15 ++++++++++++--- .../mobile/ui/TemplateStyleDefinePaneFactory.java | 5 +++-- .../designer/layout/WCardTagLayoutDefinePane.java | 5 ++++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java index 10fc42e8f1..860a0c9fb9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -7,7 +7,10 @@ import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.general.FRFont; import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle; import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.general.cardtag.mobile.TabFontConfig; + import java.awt.BasicStroke; +import java.awt.Color; import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; @@ -41,17 +44,17 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane @Override public MobileTemplateStyle updateBean() { - return new DefaultMobileTemplateStyle(); + return getDefaultTemplateStyle(); } public MobileTemplateStyle updateConfig(){ - return new DefaultMobileTemplateStyle(); + return getDefaultTemplateStyle(); } @Override protected MobileTemplateStyle getDefaultTemplateStyle() { - return new DefaultMobileTemplateStyle(); + return new DefaultMobileTemplateStyle(new TabFontConfig(getTagLayout().getTitleFont())); } @Override @@ -74,6 +77,10 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane this.setBackground(DefaultMobileTemplateStyle.DEFAULT_INITIAL_COLOR); } + public Color getInitialColor() { + return DefaultMobileTemplateStyle.DEFAULT_INITIAL_COLOR; + } + public void repaint() { super.repaint(); } @@ -94,11 +101,13 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane int fontHeight = fm.getHeight(); int ascentHeight = fm.getAscent(); for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { + g2d.setColor(frFont.getForeground()); CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); String displayName = calculateDisplayName(cardSwitchButton.getText(), fm, eachWidth); int width = fm.stringWidth(displayName); g2d.drawString(displayName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); if (i == 0) { + g2d.setColor(Color.BLACK); g2d.setStroke(new BasicStroke(2.0f)); g2d.drawLine(0, panelHeight - 1, eachWidth, panelHeight - 1); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java index 9b287de07f..dab5a03ba7 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java @@ -24,9 +24,10 @@ public class TemplateStyleDefinePaneFactory { public static BasicBeanPane createDefinePane(String style, WCardTagLayout tagLayout) { StyleDefinePaneUI styleDefinePaneUI = defineMap.get(style); - Class> clazz = styleDefinePaneUI.getaClass(); - if (clazz == null) { + if(styleDefinePaneUI == null){ + styleDefinePaneUI = defineMap.get(DefaultMobileTemplateStyle.STYLE_NAME); } + Class> clazz = styleDefinePaneUI.getaClass(); BasicBeanPane quickPane = null; try { quickPane = Reflect.on(clazz).create(tagLayout).get(); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java index d1e68baf39..41ea1c1c7d 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java @@ -115,6 +115,7 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify templateStyleEditor.setValue(ob.getTemplateStyle()); FRFont frFont = layoutBorderStyle.getTitle().getFrFont(); if (frFont != null) { + ob.setTitleFont(frFont); frFontPane.populateBean(frFont); } } @@ -126,8 +127,10 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify XWCardLayout xCardLayout = ((XWCardMainBorderLayout) topLayout).getCardPart(); LayoutBorderStyle layoutBorderStyle = xCardLayout.toData().getBorderStyle(); FRFont frFont = layoutBorderStyle.getTitle().getFrFont() == null ? FRFont.getInstance() : layoutBorderStyle.getTitle().getFrFont(); - layoutBorderStyle.getTitle().setFrFont(frFontPane.update(frFont)); + FRFont titleFont = frFontPane.update(frFont); + layoutBorderStyle.getTitle().setFrFont(titleFont); WCardTagLayout layout = (WCardTagLayout) creator.toData(); + layout.setTitleFont(titleFont); boolean isHori = displayPositionGroup.getSelectedIndex() == WTabDisplayPosition.TOP_POSITION.getType() || displayPositionGroup.getSelectedIndex() == WTabDisplayPosition.BOTTOM_POSITION.getType(); if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Tab_Style_Template"))) { layout.setDisplayPosition(WTabDisplayPosition.parse(displayPositionGroup.getSelectedIndex())); From 42f0405e0c6f27667820027e9bf24f837612a442 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 19 Dec 2018 16:04:10 +0800 Subject: [PATCH 53/93] =?UTF-8?q?REPORT-13654=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=8D=A2=E4=B8=8A12=E5=8F=B7=E7=9A=84release?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E8=B0=83=E8=89=B2=E6=9D=BF=E5=87=BA=E4=B8=8D?= =?UTF-8?q?=E6=9D=A5=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/color/NewColorSelectPane.java | 21 +++++++++++----- .../style/color/PickColorButtonFactory.java | 24 ++++++++++++------- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index 0f5e629e28..d532324165 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java @@ -8,11 +8,16 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; - -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -92,11 +97,15 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { centerPane.add(Box.createVerticalStrut(1)); // mod by anchore 16/11/16 - UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color")); + final UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color")); - customButton.addActionListener(new ActionListener() { + // 不能使用 ActionListener,否则设计器工具栏中的"更多颜色"按钮会有问题(REPORT-13654) + customButton.addMouseListener(new MouseAdapter() { @Override - public void actionPerformed(ActionEvent e) { + public void mousePressed(MouseEvent e) { + if (!customButton.isEnabled()) { + return; + } customButtonPressed(); } }); diff --git a/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java b/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java index 67d99819d7..f394801c89 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java +++ b/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java @@ -4,11 +4,15 @@ import com.fr.base.BaseUtils; import com.fr.design.gui.ibutton.SpecialUIButton; import com.fr.design.gui.ibutton.UIBasicButtonUI; -import javax.swing.*; -import javax.swing.plaf.ButtonUI; -import javax.swing.plaf.basic.BasicButtonUI; -import java.awt.*; -import java.awt.event.*; +import javax.swing.JButton; +import javax.swing.JComponent; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; /** * Created by plough on 2016/12/22. @@ -28,7 +32,7 @@ class PickColorButtonFactory { * @return SpecialUIButton 屏幕取色按钮 */ static JButton getPickColorButton(final ColorSelectable colorSelectable, IconType iconType, final boolean setColorRealTime) { - SpecialUIButton pickColorButton = new SpecialUIButton(new WhiteButtonUI()); + final SpecialUIButton pickColorButton = new SpecialUIButton(new WhiteButtonUI()); PickColorButtonFactory.iconType = iconType; if (iconType == IconType.ICON16) { @@ -42,9 +46,13 @@ class PickColorButtonFactory { pickColorButton.setPreferredSize(new Dimension(iconSize, iconSize)); pickColorButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); - pickColorButton.addActionListener(new ActionListener() { + // 不能使用 ActionListener,否则设计器工具栏中的取色按钮会有问题(REPORT-13654) + pickColorButton.addMouseListener(new MouseAdapter() { @Override - public void actionPerformed(ActionEvent e) { + public void mousePressed(MouseEvent e) { + if (!pickColorButton.isEnabled()) { + return; + } new ColorPicker(colorSelectable, setColorRealTime); } }); From 6b7bb5b6c3fc4c1e58a41da6fae0ad629e11ab7d Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 20 Dec 2018 09:47:40 +0800 Subject: [PATCH 54/93] =?UTF-8?q?REPORT-10829=20=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E8=80=85=E5=A4=A7=E8=B5=9B=E6=94=AF=E6=92=91,=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=90=8C=E6=AD=A510.0=20,=E6=9C=89=E9=81=97=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/grid/selection/CellSelection.java | 4 ++++ .../src/main/java/com/fr/grid/selection/FloatSelection.java | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java index e6eb983c6b..ee80f22a24 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java @@ -508,6 +508,10 @@ public class CellSelection extends Selection { popup.add(DeprecatedActionManager.getInsertMenu(ePane)); popup.add(DeprecatedActionManager.getDeleteMenu(ePane)); popup.add(DeprecatedActionManager.getClearMenu(ePane)); + + popup.addSeparator(); + + addExtraMenu(ePane, popup); return popup; } diff --git a/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java index c982934a03..6ce0d736fc 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java @@ -1,6 +1,5 @@ package com.fr.grid.selection; -import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.cell.CleanAuthorityAction; @@ -27,7 +26,6 @@ import com.fr.design.mainframe.ElementCasePane.Clear; import com.fr.design.selection.QuickEditor; import com.fr.design.utils.DesignUtils; import com.fr.general.ComparatorUtils; - import com.fr.report.cell.FloatElement; import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.ColumnRow; @@ -149,6 +147,10 @@ public class FloatSelection extends Selection { popup.add(new EditFloatElementNameAction(ePane).createMenuItem()); + popup.addSeparator(); + + addExtraMenu(ePane, popup); + return popup; } From 553f5172645e30f3f58d1f0d887d1be01e624168 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Thu, 20 Dec 2018 14:07:10 +0800 Subject: [PATCH 55/93] =?UTF-8?q?REPORT-13717=20=E6=89=93=E5=BC=80?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E5=B7=A5=E4=BD=9C=E7=9B=AE=E5=BD=95=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E5=90=8C=E5=90=8D=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/file/HistoryTemplateListCache.java | 3 ++ .../fr/design/file/MutilTempalteTabPane.java | 47 ++++++++----------- .../fr/design/mainframe/DesignerFrame.java | 31 ++++++------ 3 files changed, 39 insertions(+), 42 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index e4bd1db952..6d069eba81 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -183,10 +183,13 @@ public class HistoryTemplateListCache implements CallbackEvent { /** * 判断是否打开过该模板 + * 由于切换环境不会关闭模板,可能存在同名的模板,所以该方法不能准确找到所选的模板, * * @param filename 文件名 * @return 文件位置 + * @deprecated use HistoryTemplateListCache#contains(com.fr.design.mainframe.JTemplate) instead */ + @Deprecated public int contains(String filename) { for (int i = 0; i < historyList.size(); i++) { String historyPath = historyList.get(i).getPath(); diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index ab4f2aae32..65989dfccf 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -18,7 +18,6 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.ProductConstants; import com.fr.third.javax.annotation.Nonnull; -import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; @@ -674,9 +673,6 @@ public class MutilTempalteTabPane extends JComponent { return; } - //当前激活的模板 - String filename = openedTemplate.get(selectedIndex).getPath(); - filename = FilenameUtils.standard(filename); if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) { specifiedTemplate.stopEditing(); int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?", @@ -684,20 +680,20 @@ public class MutilTempalteTabPane extends JComponent { if (returnVal == JOptionPane.YES_OPTION) { specifiedTemplate.saveTemplate(); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName())); - closeTpl(specifiedTemplate, filename); + closeTpl(specifiedTemplate); } else if (returnVal == JOptionPane.NO_OPTION) { - closeTpl(specifiedTemplate, filename); + closeTpl(specifiedTemplate); } } else { - closeTpl(specifiedTemplate, filename); + closeTpl(specifiedTemplate); } } - private void closeTpl(@Nonnull JTemplate specifiedTemplate, @Nonnull String fileName) { + private void closeTpl(@Nonnull JTemplate specifiedTemplate) { HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate); closeAndFreeLock(specifiedTemplate); - activeTemplate(fileName); + activePrevTemplateAfterClose(); } private void closeAndFreeLock(@Nonnull JTemplate template) { @@ -729,11 +725,9 @@ public class MutilTempalteTabPane extends JComponent { } /** - * 关闭掉一个模板之后该激活的Tab - * - * @param fileName 关闭掉一个模板之后该激活的Tab的文件名,绝对路径 + * 关闭掉一个模板之后激活新的待显示模板 */ - private void activeTemplate(String fileName) { + private void activePrevTemplateAfterClose() { if (openedTemplate.isEmpty()) { //新建并激活模板 DesignerContext.getDesignerFrame().addAndActivateJTemplate(); @@ -742,23 +736,20 @@ public class MutilTempalteTabPane extends JComponent { temTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); } else { - //如果关闭的模板是当前选中的模板,则重新激活 - if (closeIconIndex == selectedIndex) { - if (closeIconIndex == maxPaintIndex) { + // 如果关闭的模板是当前选中的模板,则重新激活当前 selectIndex 的模板; + // selectIndex 没有变化,但是对应的模板已经变成了前一张模板 + if (closeIconIndex == selectedIndex || isCloseCurrent) { + // 如果 closeIconIndex 是最后一个被渲染画出的,那么预览上一个,防止数组越界 + if (closeIconIndex >= maxPaintIndex) { + // selectIndex 不会 <0 因为如果关闭的是打开的最后一个模板,那么关闭之后 openedTemplate.isEmpty() = true selectedIndex--; } - } else if (isCloseCurrent) { - //不是通过关闭按钮,而是通过文件关闭菜单关闭的当前模板的,也重新激活 - if (selectedIndex > openedTemplate.size() - 1) { - selectedIndex -= 1; - if (selectedIndex < 0) { - selectedIndex = 0; - } - isCloseCurrent = false; - } - } else { - //如果关闭的模板不是当前选中的模板,则激活的模板不变 - selectedIndex = HistoryTemplateListCache.getInstance().contains(fileName); + isCloseCurrent = false; + } + // 如果关闭的模板不是当前选中的模板,那么重新获取一下当前模板的 index,激活该 index + else { + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + selectedIndex = HistoryTemplateListCache.getInstance().contains(template); } //如果是已后台关闭的模板,则重新打开文件 openedTemplate.get(selectedIndex).activeOldJTemplate(); 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 5c262da9de..72994fca77 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 @@ -29,6 +29,7 @@ import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.gui.iprogressbar.ProgressDialog; import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; @@ -76,7 +77,6 @@ import java.awt.Graphics; import java.awt.Insets; import java.awt.Point; import java.awt.Rectangle; -import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; @@ -160,9 +160,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta //用于判断设计器是否打开了 private boolean designerOpened = false; - private int contentWidth = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth()); + private int contentWidth = (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize().getWidth()); - private int contentHeight = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight()); + private int contentHeight = (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize().getHeight()); private WindowAdapter windowAdapter = new WindowAdapter() { @@ -849,18 +849,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta editingTemplate.stopEditing(); if (!editingTemplate.getEditingFILE().exists()) { int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + editingTemplate.getEditingFILE() + Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + editingTemplate.getEditingFILE() + "\" ?", ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (returnVal == JOptionPane.YES_OPTION && editingTemplate.saveTemplate()) { editingTemplate.saveTemplate(); - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", editingTemplate.getEditingFILE().getName())); } } else { if (editingTemplate.saveTemplate()) { editingTemplate.saveTemplate(); - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", editingTemplate.getEditingFILE().getName())); } } @@ -957,8 +957,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta // p:判断一下,如何文件为空或者文件不存在,直接返回. if (tplFile == null || !tplFile.exists()) { - JOptionPane.showMessageDialog(this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"), - ProductConstants.PRODUCT_NAME, JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog( + this, + Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"), + ProductConstants.PRODUCT_NAME, + JOptionPane.INFORMATION_MESSAGE + ); DesignerFrameFileDealerPane.getInstance().refresh(); return; } @@ -968,7 +972,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } catch (DecryptTemplateException e) { JOptionPane.showMessageDialog( this, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Encrypt_Decrypt_Exception"), + Toolkit.i18nText("Fine-Design_Encrypt_Decrypt_Exception"), UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.WARNING_MESSAGE, UIManager.getIcon("OptionPane.errorIcon") @@ -1027,7 +1031,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta MutilTempalteTabPane.getInstance().setTemTemplate( HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); } else { - activeTemplate(tplFile, jt); + activeTemplate(jt); } opened = true; break; @@ -1042,13 +1046,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta /** * 激活指定的模板 * - * @param tplFile 模板文件 - * @param jt 当前报表 + * @param jt 当前报表 * @date 2014-10-14-下午6:31:23 */ - private void activeTemplate(FILE tplFile, JTemplate jt) { + private void activeTemplate(JTemplate jt) { // 如果该模板已经打开,则进行激活就可以了 - int index = HistoryTemplateListPane.getInstance().contains(tplFile.getPath()); + int index = HistoryTemplateListPane.getInstance().contains(jt); List> historyList = HistoryTemplateListPane.getInstance().getHistoryList(); if (index != -1) { historyList.get(index).activeJTemplate(index, jt); From fcb58a3448c87d95554f99c2dfada0eeda64a693 Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 20 Dec 2018 15:26:44 +0800 Subject: [PATCH 56/93] =?UTF-8?q?REPORT-13018=20=E5=A4=A7=E8=B5=9B?= =?UTF-8?q?=E5=90=8E=E7=BB=AD=E5=BC=80=E4=B8=A4=E4=B8=AA=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/mainframe/loghandler/LogMessageBar.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java index 6209152433..bf815e1d74 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java @@ -73,5 +73,6 @@ public class LogMessageBar extends JPanel { if (dlg != null) { dlg.dispose(); } + THIS = null; } } \ No newline at end of file From ef2d65581066c301ae265f881e778a63a59a26b9 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Thu, 20 Dec 2018 16:30:52 +0800 Subject: [PATCH 57/93] REPORT-13689 & REPORT-13733 & REPORT-13716 & REPORT-13720 --- .../design/file/HistoryTemplateListCache.java | 5 ++ .../fr/design/mainframe/DesignerFrame.java | 26 ++++--- .../mainframe/EastRegionContainerPane.java | 2 + .../actions/server/StyleListAction.java | 77 ++++++++++--------- .../com/fr/design/present/StyleArrayPane.java | 16 ++-- 5 files changed, 72 insertions(+), 54 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index e4bd1db952..b41e15e80c 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -2,6 +2,7 @@ package com.fr.design.file; import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.design.DesignerEnvManager; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.data.DesignTableDataManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; @@ -59,6 +60,10 @@ public class HistoryTemplateListCache implements CallbackEvent { public void closeSelectedReport(JTemplate selected) { DesignModuleFactory.clearChartPropertyPane(); DesignTableDataManager.closeTemplate(selected); + //直接关闭模板的时候退出权限编辑 + if (DesignModeContext.isAuthorityEditing()) { + DesignerContext.getDesignerFrame().closeAuthorityEditing(); + } if (contains(selected) == -1) { return; } 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 5c262da9de..d7c40e6bdd 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 @@ -10,6 +10,7 @@ import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.core.ActionFactory; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; @@ -17,6 +18,7 @@ import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.NewTemplatePane; @@ -224,16 +226,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } public void mouseReleased(MouseEvent e) { - if (DesignerMode.isAuthorityEditing()) { - DesignerMode.setMode(DesignerMode.NORMAL); - WestRegionContainerPane.getInstance().replaceDownPane( - TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); - DesignerContext.getDesignerFrame().resetToolkitByPlus( - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus()); - needToAddAuhtorityPaint(); - refreshDottedLine(); - fireAuthorityStateToNomal(); + if (DesignModeContext.isAuthorityEditing()) { + closeAuthorityEditing(); } } @@ -332,6 +326,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.progressDialog = new ProgressDialog(this); } + public void closeAuthorityEditing(){ + DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); + WestRegionContainerPane.getInstance().replaceDownPane( + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); + DesignerContext.getDesignerFrame().resetToolkitByPlus( + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus()); + needToAddAuhtorityPaint(); + refreshDottedLine(); + fireAuthorityStateToNomal(); + } + /** * 注册app. * 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 a49d66791f..97ce22814d 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 @@ -412,6 +412,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { if (propertyItem.isVisible() && propertyItem.isEnabled() && !propertyItem.isPoppedOut()) { propertyCard.show(rightPane, tabName); propertyItem.setTabButtonSelected(); + //从单元格菜单过来也要关闭弹出窗 + hideCurrentPopupPane(); } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java b/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java index 61276163d5..4f57bdc2ac 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java @@ -10,8 +10,11 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; import com.fr.general.IOUtils; +import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; +import com.fr.transaction.WorkerCallBack; +import com.fr.transaction.WorkerFacade; import javax.swing.*; import java.awt.event.ActionEvent; @@ -21,16 +24,17 @@ import java.awt.event.ActionEvent; * StyleList Action */ public class StyleListAction extends UpdateAction { - public StyleListAction() { + public StyleListAction() { this.setMenuKeySet(PREDEFINED_STYLES); - this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/style.png")); - this.generateAndSetSearchText(StyleManagerPane.class.getName()); - } + this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/style.png")); + this.generateAndSetSearchText(StyleManagerPane.class.getName()); + } /** * 动作 + * * @param evt 事件 */ public void actionPerformed(ActionEvent evt) { @@ -40,45 +44,44 @@ public class StyleListAction extends UpdateAction { styleListDialog.addDialogActionListener(new DialogActionAdapter() { @Override public void doOk() { - Configurations.update(new Worker() { + Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) { @Override public void run() { styleListPane.update(ServerPreferenceConfig.getInstance()); } + }.addCallBack(new CallBackAdaptor(){ + @Override + public void afterCommit() { + DesignerContext.getDesignerBean("predefinedStyle").refreshBeanElement(); + } + })); - @Override - public Class[] targets() { - return new Class[]{ServerPreferenceConfig.class}; - } - }); - - } + } }); - ServerPreferenceConfig mirror = ServerPreferenceConfig.getInstance().mirror(); - styleListPane.populate(mirror); - styleListDialog.setVisible(true); - - } - - @Override - public void update() { - this.setEnabled(true); - } + ServerPreferenceConfig mirror = ServerPreferenceConfig.getInstance().mirror(); + styleListPane.populate(mirror); + styleListDialog.setVisible(true); + } + + @Override + public void update() { + this.setEnabled(true); + } - public static final MenuKeySet PREDEFINED_STYLES = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'K'; - } + public static final MenuKeySet PREDEFINED_STYLES = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'K'; + } - @Override - public String getMenuName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ServerM_Predefined_Styles"); - } + @Override + public String getMenuName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ServerM_Predefined_Styles"); + } - @Override - public KeyStroke getKeyStroke() { - return null; - } - }; + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; } diff --git a/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java b/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java index bd7602ee79..76c1e72617 100644 --- a/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java +++ b/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java @@ -2,6 +2,7 @@ package com.fr.design.present; import com.fr.base.Style; import com.fr.config.ServerPreferenceConfig; +import com.fr.config.StyleMap; import com.fr.design.gui.controlpane.AbstractNameableCreator; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameableCreator; @@ -13,6 +14,8 @@ import com.fr.design.style.StylePane; import com.fr.general.NameObject; import com.fr.stable.Nameable; +import com.fr.transaction.Configurations; +import com.fr.transaction.WorkerAdaptor; import java.util.ArrayList; import java.util.Iterator; @@ -90,17 +93,16 @@ public class StyleArrayPane extends JListControlPane { /** * Update. */ - public void update(ServerPreferenceConfig configManager) { - configManager.clearAllStyle(); + public void update(final ServerPreferenceConfig configManager) { + //configManager.clearAllStyle(); // Nameable[]居然不能强转成Parameter[],一定要这么写... Nameable[] nameables = this.update(); - + final StyleMap styleMap = new StyleMap(); for (int i = 0; i < nameables.length; i++) { - configManager.putStyle(((NameObject)nameables[i]).getName(), (Style)((NameObject)nameables[i]).getObject()); + styleMap.put(((NameObject)nameables[i]).getName(), (Style)((NameObject)nameables[i]).getObject()); } - DesignerContext.getDesignerBean("predefinedStyle").refreshBeanElement(); - } - + configManager.setStyleMap(styleMap); + } } From 3ed78faa5143aacd59c59cd984c1a7492fddf72b Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Thu, 20 Dec 2018 19:11:33 +0800 Subject: [PATCH 58/93] =?UTF-8?q?CHART-3169=20=E6=96=B0=E7=89=B9=E6=80=A7?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=20=E6=A0=B7=E5=BC=8F=E7=B3=BB=E5=88=97?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E9=A3=8E=E6=A0=BC=20=E6=94=B9=E4=B8=BA'?= =?UTF-8?q?=E6=B8=90=E5=8F=98'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../van/chart/designer/component/VanChartBeautyPane.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java index 44c0e1a551..f6642bd710 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java @@ -4,6 +4,7 @@ import com.fr.chart.base.ChartConstants; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -28,7 +29,7 @@ public class VanChartBeautyPane extends BasicBeanPane { double[] columnSize = {f, e}; double[] rowSize = {p}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style")), styleBox}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style")), styleBox}, } ; JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); this.setLayout(new BorderLayout()); @@ -36,8 +37,8 @@ public class VanChartBeautyPane extends BasicBeanPane { } protected String[] getNameArray(){ - return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Default_Name"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Top_Down_Shade") + return new String[]{Toolkit.i18nText("Fine-Design_Chart_Default_Name"), + Toolkit.i18nText("Fine-Design_Chart_Style_TopDownShade") }; } @Override From 67ab9101f53ef4b1ae9091623dcdd2c0c39bf3c4 Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Thu, 20 Dec 2018 19:15:31 +0800 Subject: [PATCH 59/93] =?UTF-8?q?CHART-3573=20=E4=BD=BF=E7=94=A8=E6=96=B0?= =?UTF-8?q?=E7=9A=84key=E6=9D=A5=E5=8C=BA=E5=88=AB=E5=BC=80'=E7=A9=BA?= =?UTF-8?q?=E5=80=BC=E6=96=AD=E5=BC=80'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/style/series/CustomDefaultSeriesPane.java | 2 +- .../chart/gui/style/series/CustomTypeConditionSeriesPane.java | 2 +- .../design/mainframe/chart/gui/style/series/LineSeriesPane.java | 2 +- .../mainframe/chart/gui/style/series/RadarSeriesPane.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java index d31aad3b38..d0507acc02 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java @@ -240,7 +240,7 @@ public class CustomDefaultSeriesPane extends BasicPane{ isCurve = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Curve_Smooth")); lineStyle = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); markerPane = new MarkerComboBox(MarkerFactory.getMarkerArray()); - String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; + String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; Boolean[] valueArray = {true, false}; isNullValueBreak = new UIButtonGroup(nameArray, valueArray); double p = TableLayout.PREFERRED; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java index 7b6bb36571..3c2f52349f 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java @@ -449,7 +449,7 @@ public class CustomTypeConditionSeriesPane extends BasicBeanPane{ lineStyle.setPreferredSize(new Dimension(150,20)); markerPane.setPreferredSize(new Dimension(150,20)); - String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; + String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; Boolean[] valueArray = {true, false}; isNullValueBreak = new UIButtonGroup(nameArray, valueArray); double p = TableLayout.PREFERRED; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java index 9fbbb11970..612e89b481 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java @@ -49,7 +49,7 @@ public class LineSeriesPane extends AbstractPlotSeriesPane{ isCurve = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Curve_Smooth")); lineStyle = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); markerPane = new MarkerComboBox(MarkerFactory.getMarkerArray()); - String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; + String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; Boolean[] valueArray = {true, false}; isNullValueBreak = new UIButtonGroup(nameArray, valueArray); double p = TableLayout.PREFERRED; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java index 8943473270..a5a3fb4d61 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java @@ -45,7 +45,7 @@ public class RadarSeriesPane extends AbstractPlotSeriesPane{ isCurve = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fill")); lineStyle = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); markerPane = new MarkerComboBox(MarkerFactory.getMarkerArray()); - String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; + String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; Boolean[] valueArray = {true, false}; isNullValueBreak = new UIButtonGroup(nameArray, valueArray); From 2dcaaef7ed49bffdd039ffbd5c4daea63aaab0fe Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Thu, 20 Dec 2018 20:11:23 +0800 Subject: [PATCH 60/93] =?UTF-8?q?CHART-3575=20=E4=BF=AE=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E7=9A=84'=E5=88=86=E7=B1=BB=E5=90=8D'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/style/ChartDatapointLabelPane.java | 2 +- .../component/format/CategoryNameFormatPaneWithCheckBox.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java index 48585ae5b1..8e198ea6c5 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java @@ -96,7 +96,7 @@ public class ChartDatapointLabelPane extends BasicPane{ boolean isGuidline = plot.isSupportLeadLine(); if(plot.isSupportCategoryFilter()) { - isCategory = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name")); + isCategory = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name")); } isSeries = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name")); isValue = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Value")); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java index 2e0d55a41f..575143a625 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java @@ -1,6 +1,7 @@ package com.fr.van.chart.designer.component.format; +import com.fr.design.i18n.Toolkit; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -18,6 +19,7 @@ public class CategoryNameFormatPaneWithCheckBox extends VanChartFormatPaneWithCh @Override protected String getCheckBoxText() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name"); + //"分类名" 图表(新特性)标签、提示时有用到 + return Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"); } } From f2d684e167b360eeb42abded516b511611d5eef5 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Fri, 21 Dec 2018 10:37:25 +0800 Subject: [PATCH 61/93] MOBILE-18801 --- .../fr/design/actions/FormMobileAttrAction.java | 16 ++++++++++++++++ .../designer/layout/FRFitLayoutDefinePane.java | 11 +++-------- 2 files changed, 19 insertions(+), 8 deletions(-) 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 033ba5ea57..d77078fad6 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 @@ -3,11 +3,15 @@ package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.base.iofile.attr.MobileOnlyTemplateAttrMark; import com.fr.design.actions.JTemplateAction; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteBodyLayout; +import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.form.mobile.FormMobileAttrPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.FormArea; +import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.menu.MenuKeySet; @@ -73,6 +77,9 @@ public class FormMobileAttrAction extends JTemplateAction { formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后 ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); jf.getFormDesign().getSelectionModel().setSelectedCreator(jf.getFormDesign().getRootComponent()); + //改变布局为自适应布局,只在移动端属性设置保存后改变一次 + doChangeBodyLayout(); + WidgetPropertyPane.getInstance().refreshDockingView(); jf.fireTargetModified(); } @@ -80,6 +87,15 @@ public class FormMobileAttrAction extends JTemplateAction { dialog.setVisible(true); } + private void doChangeBodyLayout(){ + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + XLayoutContainer rootLayout = formDesigner.getRootComponent(); + if (rootLayout.getComponentCount() == 1 && rootLayout.getXCreator(0).acceptType(XWAbsoluteBodyLayout.class)) { + rootLayout = (XWAbsoluteBodyLayout) rootLayout.getXCreator(0); + } + ((XWFitLayout)formDesigner.getRootComponent()).switch2FitBodyLayout(rootLayout); + } + @Focus(id = "com.fr.mobile.mobile_template_frm", text = "Fine-Design_Function_Mobile_Template_Frm", source = Original.EMBED) private void recordFunction() { // do nothing diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java index 0f3e0aba0a..dd19d7c812 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java @@ -137,14 +137,9 @@ public class FRFitLayoutDefinePane extends AbstractDataModify { XLayoutContainer rootLayout = selectedBodyLayout(formDesigner); if (rootLayout != formDesigner.getRootComponent() && formDesigner.getSelectionModel().getSelection().getSelectedCreator() == formDesigner.getRootComponent()) { - //原单例面板populate根据当前样式populate属性面板,现加入移动端逻辑:可能需要根据面板属性改变样式 - Form form = formDesigner.getTarget(); - if (form.getFormMobileAttr().isMobileOnly() && form.getFormMobileAttr().isAdaptivePropertyAutoMatch()) { - ((XWFitLayout)formDesigner.getRootComponent()).switch2FitBodyLayout(rootLayout); - } else { - formDesigner.getSelectionModel().setSelectedCreators( - FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{selectedBodyLayout(formDesigner).toData()})); - } + formDesigner.getSelectionModel().setSelectedCreators( + FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{selectedBodyLayout(formDesigner).toData()})); + } paddingBound.populate(ob); layoutComboBox.setSelectedIndex(ob.getBodyLayoutType().getTypeValue()); From ba5b8fe1674e6edb30affd980001ab9254972092 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 10:43:05 +0800 Subject: [PATCH 62/93] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=BA=8F=E5=88=97=E5=8C=96=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=20SerilizationException=20,=20WorkspaceNoteHitException=202.?= =?UTF-8?q?=20=E5=8A=A0=E5=85=A5=E5=88=87=E6=8D=A2=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E7=9A=84=E6=A3=80=E6=B5=8B=EF=BC=8C=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E6=B5=8B=E8=AF=95=E8=BF=9C=E7=A8=8B=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E9=86=92=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 46 ++++++++++++++++ .../main/java/com/fr/env/RemoteEnvPane.java | 37 ++++++++----- .../java/com/fr/env/TestConnectionResult.java | 55 +++++++++++++++++++ 3 files changed, 125 insertions(+), 13 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/env/TestConnectionResult.java 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 76ae528949..725272a153 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -5,6 +5,7 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; +import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.TemplateTreePane; import com.fr.design.i18n.Toolkit; @@ -15,19 +16,25 @@ import com.fr.env.EnvListPane; import com.fr.general.GeneralContext; import com.fr.license.exception.RegistEditionException; import com.fr.log.FineLoggerFactory; +import com.fr.stable.AssistUtils; import com.fr.stable.EnvChangedListener; import com.fr.start.server.ServerTray; import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; import com.fr.workspace.Workspace; import com.fr.workspace.connect.AuthException; +import com.fr.workspace.connect.WorkspaceConnectionInfo; +import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.UIManager; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import static javax.swing.JOptionPane.ERROR_MESSAGE; +import static javax.swing.JOptionPane.QUESTION_MESSAGE; public class EnvChangeEntrance { @@ -90,6 +97,11 @@ public class EnvChangeEntrance { }); return false; } + + if (versionCheck(selectedEnv)) { + return false; + } + WorkContext.switchTo(workspace, new WorkContextCallback() { @Override public void done() { @@ -138,6 +150,40 @@ public class EnvChangeEntrance { return true; } + /** + * 切换环境之前,进行版本检测,当版本不一致的时候,提示。 + * 当选择 ok 时,才继续。 + * + * @param selectedEnv 选择的环境 + * @return 是否一致 + * @throws Exception 异常 + */ + private boolean versionCheck(DesignerWorkspaceInfo selectedEnv) throws Exception { + + if (selectedEnv.getType() == DesignerWorkspaceType.Remote) { + + WorkspaceConnectionInfo info = selectedEnv.getConnection(); + String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); + + if (!AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + + final List result = new ArrayList<>(1); + PopTipStrategy.NOW.showTip(new PopTip() { + @Override + public void show() { + String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; + int choice = JOptionPane.showOptionDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency"), + UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, UIManager.getIcon("OptionPane.warningIcon"), option, 1); + result.add(choice); + } + }); + + return result.size() != 0 && result.get(0) == 1; + } + } + return false; + } + /** * 编辑items * 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 769c843cc5..21b5d2b2ca 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -511,14 +511,14 @@ public class RemoteEnvPane extends BasicBeanPane { } private void tryConnectRemoteEnv() { + final RemoteDesignerWorkspaceInfo remoteEnv = updateBean(); + final WorkspaceConnectionInfo connection = remoteEnv.getConnection(); + final SwingWorker worker = new SwingWorker() { @Override protected Boolean doInBackground() throws Exception { - final RemoteDesignerWorkspaceInfo remoteEnv = updateBean(); - - WorkspaceConnectionInfo connection = remoteEnv.getConnection(); DesignerEnvManager.getEnvManager().setCertificatePath(connection.getCertPath()); DesignerEnvManager.getEnvManager().setCertificatePass(connection.getCertSecretKey()); try { @@ -532,23 +532,33 @@ public class RemoteEnvPane extends BasicBeanPane { protected void done() { okButton.setEnabled(true); try { - Boolean result = get(); - if (result == null) { + + TestConnectionResult result = TestConnectionResult.parse(get(), connection); + if (result == TestConnectionResult.Fully_Success) { + message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Successful")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); + } + + if (result == TestConnectionResult.Partly_Sucess) { + message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); + } + + if (result == TestConnectionResult.Fully_Failed) { + message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); + } + + if (result == TestConnectionResult.Auth_Failed) { message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed")); uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); - } else { - if (result) { - message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Successful")); - uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); - } else { - message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); - uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); - } } } catch (InterruptedException | ExecutionException e) { FineLoggerFactory.getLogger().error(e, e.getMessage()); message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage()); } dialogDownPane.remove(cancelButton); dialogDownPane.revalidate(); @@ -596,6 +606,7 @@ public class RemoteEnvPane extends BasicBeanPane { dialogDownPane = new JPanel(); uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon")); upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); + //upPane.setLayout(new BorderLayout()); upPane.add(uiLabel); upPane.add(message); dialogDownPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0)); diff --git a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java new file mode 100644 index 0000000000..3aaf594ecb --- /dev/null +++ b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java @@ -0,0 +1,55 @@ +package com.fr.env; + +import com.fr.stable.AssistUtils; +import com.fr.workspace.WorkContext; +import com.fr.workspace.connect.WorkspaceConnectionInfo; +import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; + +/** + * created by Harrison on 2018/12/20 + **/ +public enum TestConnectionResult { + /** + * 完全成功, 版本匹配,测试连接成功。 + */ + Fully_Success(0), + + /** + * 不完全成功,版本不匹配,但测试连接成功。 + */ + Partly_Sucess(1), + + /** + * 完全失败,直接没连上 + */ + Fully_Failed(2), + + /** + * 验证 Token 失败 + */ + Auth_Failed(3); + + private int sign; + + TestConnectionResult(int i) { + this.sign = i; + } + + public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) throws Exception { + if (value == null) { + return Auth_Failed; + } + + if (!value) { + return Fully_Failed; + } + + String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); + + if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + return Fully_Success; + } + + return Partly_Sucess; + } +} From 1380b31b6467f8f0c400e4af279227416df9de12 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 10:58:13 +0800 Subject: [PATCH 63/93] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E4=B8=80=E4=BA=9B=E6=B3=A8=E9=87=8A=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/env/RemoteEnvPane.java | 4 +- .../java/com/fr/env/TestConnectionResult.java | 37 +++++++++++-------- 2 files changed, 23 insertions(+), 18 deletions(-) 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 21b5d2b2ca..742b6cc16b 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -541,7 +541,7 @@ public class RemoteEnvPane extends BasicBeanPane { if (result == TestConnectionResult.Partly_Sucess) { message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency")); - uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.warningIcon")); } if (result == TestConnectionResult.Fully_Failed) { @@ -557,8 +557,6 @@ public class RemoteEnvPane extends BasicBeanPane { FineLoggerFactory.getLogger().error(e, e.getMessage()); message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); } dialogDownPane.remove(cancelButton); dialogDownPane.revalidate(); diff --git a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java index 3aaf594ecb..357d4f38cb 100644 --- a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java +++ b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java @@ -1,41 +1,40 @@ package com.fr.env; +import com.fr.log.FineLoggerFactory; import com.fr.stable.AssistUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; /** + * 测试连接的结果。 + * 不改变原有逻辑的情况下,加入一层转化。 + * 根据这里的转化结果,判断需要提示哪些内容。 + * * created by Harrison on 2018/12/20 **/ public enum TestConnectionResult { /** * 完全成功, 版本匹配,测试连接成功。 */ - Fully_Success(0), + Fully_Success, /** * 不完全成功,版本不匹配,但测试连接成功。 */ - Partly_Sucess(1), + Partly_Sucess, /** * 完全失败,直接没连上 */ - Fully_Failed(2), + Fully_Failed, /** * 验证 Token 失败 */ - Auth_Failed(3); + Auth_Failed; - private int sign; - - TestConnectionResult(int i) { - this.sign = i; - } - - public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) throws Exception { + public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) { if (value == null) { return Auth_Failed; } @@ -43,13 +42,21 @@ public enum TestConnectionResult { if (!value) { return Fully_Failed; } + try { - String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); + String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); + if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + return Fully_Success; + } - if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { - return Fully_Success; + return Partly_Sucess; + } catch (Exception e) { + + // 发生异常,说明没连接上。返回完全失败。 + FineLoggerFactory.getLogger().error(e.getMessage()); + return Fully_Failed; } - return Partly_Sucess; + } } From fcdb68c2fcedd59e37749bef190d8341f640497e Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 11:24:24 +0800 Subject: [PATCH 64/93] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=B8=8B=E9=80=BB=E8=BE=91=E3=80=82?= =?UTF-8?q?=20=E6=9B=B4=E6=96=B9=E4=BE=BF=E7=90=86=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 47 ++++++++++++------- 1 file changed, 29 insertions(+), 18 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 725272a153..58f22d1b64 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -98,7 +98,8 @@ public class EnvChangeEntrance { return false; } - if (versionCheck(selectedEnv)) { + // 如果版本不一致,且确认 不继续 连接,这里返回 false. + if (!versionCheckAndConfirm(selectedEnv)) { return false; } @@ -151,37 +152,47 @@ public class EnvChangeEntrance { } /** - * 切换环境之前,进行版本检测,当版本不一致的时候,提示。 - * 当选择 ok 时,才继续。 + * 切换远程环境之前,进行版本检测,当版本不一致的时候,提示。 + * 当用户确认选择 ok 时,才继续。 * * @param selectedEnv 选择的环境 * @return 是否一致 + * 1. 非远程环境 , 返回 true + * 2. 远程环境 + * 2.1 不匹配, + * 2.1.1 当选择 ok , 返回 true + * 2.1.2 当选择 no, 返回 false + * 2.2 匹配, 返回 true * @throws Exception 异常 */ - private boolean versionCheck(DesignerWorkspaceInfo selectedEnv) throws Exception { + private boolean versionCheckAndConfirm(DesignerWorkspaceInfo selectedEnv) throws Exception { if (selectedEnv.getType() == DesignerWorkspaceType.Remote) { WorkspaceConnectionInfo info = selectedEnv.getConnection(); String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); - if (!AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + return true; + } - final List result = new ArrayList<>(1); - PopTipStrategy.NOW.showTip(new PopTip() { - @Override - public void show() { - String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; - int choice = JOptionPane.showOptionDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency"), - UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, UIManager.getIcon("OptionPane.warningIcon"), option, 1); - result.add(choice); - } - }); + final List result = new ArrayList<>(1); + PopTipStrategy.NOW.showTip(new PopTip() { + @Override + public void show() { + String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; + int choice = JOptionPane.showOptionDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency"), + UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, UIManager.getIcon("OptionPane.warningIcon"), option, 1); + result.add(choice); + } + }); - return result.size() != 0 && result.get(0) == 1; - } + // 只有选择 yes , 这里的值才为 0, 返回 true + // 否着返回 false, 将不进行下面的连接操作。 + return result.size() != 0 && result.get(0) == 0; } - return false; + + return true; } /** From 02dd1b00793e08c381d26f541d47f7ce2e94aac8 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 11:43:14 +0800 Subject: [PATCH 65/93] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E5=BF=98=E4=BA=86=E6=B3=A8=E9=87=8A=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/env/RemoteEnvPane.java | 1 - 1 file changed, 1 deletion(-) 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 742b6cc16b..dc764153ca 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -604,7 +604,6 @@ public class RemoteEnvPane extends BasicBeanPane { dialogDownPane = new JPanel(); uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon")); upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); - //upPane.setLayout(new BorderLayout()); upPane.add(uiLabel); upPane.add(message); dialogDownPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0)); From b912d85688410664c67e612bb6ca13762dbc5d39 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Fri, 21 Dec 2018 14:02:44 +0800 Subject: [PATCH 66/93] =?UTF-8?q?REPORT-13431=20=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=82=B9=E8=AE=B0=E5=BD=95,=20=E9=9C=80=E8=A6=81=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E9=80=81=201.=E5=8F=91=E9=80=81=E5=89=8D?= =?UTF-8?q?=E5=8E=BB=E9=87=8D=202.SEND=5FDELAY=E5=8E=9F=E5=85=88=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=9C=89=E8=AF=AF=EF=BC=8C=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 157 +++++++++++++----- 1 file changed, 118 insertions(+), 39 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 0398189d9c..61b583c615 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -5,11 +5,6 @@ package com.fr.design.mainframe; import com.fr.base.FRContext; import com.fr.config.MarketConfig; -import com.fr.data.core.db.DBUtils; -import com.fr.data.core.db.dialect.DialectFactory; -import com.fr.data.core.db.dml.Delete; -import com.fr.data.core.db.dml.Select; -import com.fr.data.core.db.dml.Table; import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.errorinfo.ErrorInfoUploader; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; @@ -19,18 +14,13 @@ import com.fr.general.DateUtils; import com.fr.general.DesUtils; import com.fr.general.GeneralUtils; import com.fr.general.IOUtils; -import com.fr.general.http.HttpClient; import com.fr.general.http.HttpToolbox; import com.fr.intelli.record.FocusPoint; -import com.fr.intelli.record.MetricException; import com.fr.intelli.record.MetricRegistry; import com.fr.json.JSONArray; import com.fr.json.JSONException; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; -import com.fr.log.message.ParameterMessage; -import com.fr.record.DBRecordXManager; -import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; @@ -58,17 +48,15 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.text.DateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.TreeSet; /** * @author neil @@ -79,7 +67,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { // 24小时上传一次 private static final long DELTA = 24 * 3600 * 1000L; - private static final long SEND_DELAY = 30 * 1000L; + private static final long SEND_DELAY = 300 * 1000L; private static final String FILE_NAME = "fr.info"; private static final String XML_START_STOP_LIST = "StartStopList"; private static final String XML_START_STOP = "StartStop"; @@ -226,12 +214,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { if (currentTime - lastTime <= DELTA) { return; } - JSONArray content = null; - try { - content = getFunctionsContent(currentTime, lastTime); - } catch (JSONException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + JSONArray content = getFunctionsContent(currentTime, lastTime); boolean success = false; FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); @@ -443,7 +426,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { }); } - public static JSONArray getFunctionsContent(long current, long last) throws JSONException{ + public JSONArray getFunctionsContent(long current, long last) { //记录当前条数,达到200条合并成一个请求 int count = 0; JSONArray functionArray = new JSONArray(); @@ -452,21 +435,20 @@ public class InformationCollector implements XMLReadable, XMLWriter { .addRestriction(RestrictionFactory.gte(COLUMN_TIME, last)); try { DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); - JSONArray temp = new JSONArray(); + TreeSet focusPointsList = new TreeSet<>(); if(!focusPoints.isEmpty()){ for(int i=0;i< focusPoints.getList().size();i++){ FocusPoint focusPoint = focusPoints.getList().get(i); if(focusPoint != null){ if((++count <= MAX_EACH_REQUEST_RECORD_COUNT)){ - temp.put(getOneRecord(focusPoint)); + focusPointsList.add(getOneRecord(focusPoint)); } else { count = 0; - functionArray.put(temp); - temp = new JSONArray(); - temp.put(getOneRecord(focusPoint)); + functionArray.put(setToJSONArray(focusPointsList)); + focusPointsList.add(getOneRecord(focusPoint)); } if(i == (focusPoints.getList().size() -1)){ - functionArray.put(temp); + functionArray.put(setToJSONArray(focusPointsList)); } } } @@ -478,16 +460,33 @@ public class InformationCollector implements XMLReadable, XMLWriter { return functionArray; } - private static JSONObject getOneRecord(FocusPoint focusPoint) throws JSONException{ - com.fr.json.JSONObject record = new com.fr.json.JSONObject(); - record.put(ATTR_ID, focusPoint.getId()); - record.put(ATTR_TEXT, focusPoint.getText()); - record.put(ATTR_SOURCE, focusPoint.getSource()); - record.put(ATTR_TIME, focusPoint.getTime().getTime()); - record.put(ATTR_TITLE, focusPoint.getTitle()); - record.put(ATTR_USER_NAME, MarketConfig.getInstance().getBbsUsername()); - record.put(ATTR_UUID, DesignerEnvManager.getEnvManager().getUUID()); - return record; + private FunctionRecord getOneRecord(FocusPoint focusPoint) { + FunctionRecord functionRecord = new FunctionRecord(); + functionRecord.setId(focusPoint.getId() == null?StringUtils.EMPTY : focusPoint.getId()); + functionRecord.setText(focusPoint.getText() == null?StringUtils.EMPTY : focusPoint.getText()); + functionRecord.setSource(focusPoint.getSource()); + functionRecord.setTime(focusPoint.getTime().getTime()); + functionRecord.setTitle(focusPoint.getTitle() == null?StringUtils.EMPTY : focusPoint.getTitle()); + functionRecord.setUsername(MarketConfig.getInstance().getBbsUsername() == null?StringUtils.EMPTY : MarketConfig.getInstance().getBbsUsername()); + functionRecord.setUuid(DesignerEnvManager.getEnvManager().getUUID() == null?StringUtils.EMPTY : DesignerEnvManager.getEnvManager().getUUID()); + return functionRecord; + } + + private JSONArray setToJSONArray(Set set) throws JSONException { + JSONArray jsonArray = new JSONArray(); + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + FunctionRecord functionRecord = (FunctionRecord)iter.next(); + com.fr.json.JSONObject record = new com.fr.json.JSONObject(); + record.put(ATTR_ID, functionRecord.getId()); + record.put(ATTR_TEXT, functionRecord.getText()); + record.put(ATTR_SOURCE, functionRecord.getSource()); + record.put(ATTR_TIME, functionRecord.getTime()); + record.put(ATTR_TITLE, functionRecord.getTitle()); + record.put(ATTR_USER_NAME, functionRecord.getUsername()); + record.put(ATTR_UUID, functionRecord.getUuid()); + jsonArray.put(record); + } + return jsonArray; } private class StartStopTime implements XMLReadable, XMLWriter { @@ -529,4 +528,84 @@ public class InformationCollector implements XMLReadable, XMLWriter { } + private class FunctionRecord implements Comparable{ + private String id; + private String text; + private int source; + private long time; + private String title; + private String username; + private String uuid; + + public FunctionRecord(){ + + } + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public int getSource() { + return source; + } + + public void setSource(int source) { + this.source = source; + } + + public long getTime() { + return time; + } + + public void setTime(long time) { + this.time = time; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + @Override + public int compareTo(Object o) { + FunctionRecord functionRecord = (FunctionRecord) o; + if(this.getId().equals((functionRecord.getId())) && this.getText().equals(functionRecord.getText()) + && this.getSource() == functionRecord.getSource() && this.getTime() == functionRecord.getTime() + && this.getTitle().equals(functionRecord.getTitle()) && this.getUsername().equals(functionRecord.getUsername()) + && this.getUuid().equals(functionRecord.getUuid())){ + return 0; + } + return 1; + } + } } \ No newline at end of file From bf8d6fbe99769688bcb3e20b5ee1b07241027e32 Mon Sep 17 00:00:00 2001 From: abel Date: Fri, 21 Dec 2018 15:57:11 +0800 Subject: [PATCH 67/93] =?UTF-8?q?REPORT-13573=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E9=A2=84=E8=A7=88=E5=A4=A7=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E9=9B=86=E5=8D=A1=E9=A1=BF=EF=BC=88?= =?UTF-8?q?=E5=B0=86=E4=BC=A0=E8=BE=93=E5=85=A8=E9=83=A8=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=94=B9=E6=88=90=E5=8F=AA=E4=BC=A0=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=EF=BC=89&&=20=E5=8F=AA=E5=90=AB=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=BA=8F=E5=88=97=E5=8C=96=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/DesignTableDataManager.java | 15 +- .../design/AbstractTableDatasourceTest.java | 166 ++++++++++++++++++ 2 files changed, 180 insertions(+), 1 deletion(-) create mode 100644 designer-base/src/test/java/com/fr/design/AbstractTableDatasourceTest.java diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index ec1f69d98b..ee7df60151 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -3,6 +3,7 @@ package com.fr.design.data; import com.fr.base.FRContext; import com.fr.base.StoreProcedureParameter; import com.fr.base.TableData; +import com.fr.data.AbstractTableDataSource; import com.fr.data.TableDataSource; import com.fr.data.core.DataCoreXmlUtils; import com.fr.data.impl.EmbeddedTableData; @@ -444,7 +445,19 @@ public abstract class DesignTableDataManager { parameter.setValue(parameterMap.get(parameter.getName())); } } - return DataOperator.getInstance().previewTableData(tableDataSource, tabledata, parameterMap, rowCount); + //这边数据集预览不需要把整个模板都发送过去,只需要把模板中的数据集挑出来,传过去就行了。模板一大,预览数据集很变得很慢。 + TableDataSource wrapper = null; + if (tableDataSource != null) { + wrapper = new AbstractTableDataSource(){}; + for (Iterator it = tableDataSource.getTableDataNameIterator(); it != null && it.hasNext(); ) { + String name = it.next(); + TableData tableData = tableDataSource.getTableData(name); + if (tableData != null) { + wrapper.putTableData(name, tableData); + } + } + } + return DataOperator.getInstance().previewTableData(wrapper, tabledata, parameterMap, rowCount); } catch (Exception e) { throw new TableDataException(e.getMessage(), e); } finally { diff --git a/designer-base/src/test/java/com/fr/design/AbstractTableDatasourceTest.java b/designer-base/src/test/java/com/fr/design/AbstractTableDatasourceTest.java new file mode 100644 index 0000000000..e75ec4eb19 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/AbstractTableDatasourceTest.java @@ -0,0 +1,166 @@ +package com.fr.design; + +import com.fr.base.AbstractTableData; +import com.fr.base.TableData; +import com.fr.cert.token.lang.Assert; +import com.fr.data.AbstractTableDataSource; +import com.fr.data.TableDataSource; +import com.fr.general.data.TableDataException; +import com.fr.script.Calculator; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLableReader; +import com.fr.third.javax.xml.stream.XMLStreamException; +import junit.framework.TestCase; + +import java.io.ByteArrayOutputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; + +public class AbstractTableDatasourceTest extends TestCase { + + public void testAbstractTableDataSourceReadAndWrite() throws XMLStreamException, TableDataException, UnsupportedEncodingException { + String xml = "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "7.nI9\\uimQ~\n" + + "]]>\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "9UT+>AM9kpGY!\\4\\SXO$EO1[i^/XKmIMmdu\n" + + "!\"Q5sC\"9Ji(qlAa_kVTnCC/+p:XVF.KGR?GMsmI)2\">1s>(/T71G7cFsfA\"UpjYr4R)A14-*\n" + + "qc6ri_1*%/XSsf!PM]ARc+ojE:eo:_gma!ut7eZ6BoFc2b5hu4@TUtuOT);aq6l4Vj\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "YfS3J$NPo=IB3AP?eiop.bk9Qu\n" + + "P:F\\.L&t$31~\n" + + "]]>\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "5++,D>0thk;G<`mPXn.b)QZb5j^mQri%8Ji5q\\\n" + + "\n" + + "\n"; + + AbstractTableDataSource source = new AbstractTableDataSource() { + }; + XMLableReader.createXMLableReader(xml).readXMLObject(source); + TableData tableData = source.getTableData("热销产品"); + Assert.notNull(tableData); + Assert.isTrue(tableData.createDataModel(Calculator.createCalculator()).getRowCount() == 4); + Assert.isTrue(tableData.createDataModel(Calculator.createCalculator()).getColumnCount() == 2); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + XMLPrintWriter writer = XMLPrintWriter.create(new OutputStreamWriter(out,"UTF-8")); + source.writeXML(writer); + writer.close(); + TableDataSource another = new AbstractTableDataSource(){}; + XMLableReader.createXMLableReader(new String(out.toByteArray(),"UTF-8")).readXMLObject(another); + tableData = another.getTableData("热销产品"); + Assert.notNull(tableData); + Assert.isTrue(tableData.createDataModel(Calculator.createCalculator()).getRowCount() == 4); + Assert.isTrue(tableData.createDataModel(Calculator.createCalculator()).getColumnCount() == 2); + } +} From 1f1c2cb4c0df44984d67d18bf6cf0963f5659e03 Mon Sep 17 00:00:00 2001 From: abel Date: Fri, 21 Dec 2018 16:01:17 +0800 Subject: [PATCH 68/93] =?UTF-8?q?=E5=A4=A7=E6=A8=A1=E6=9D=BF=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E9=A2=84=E8=A7=88=E6=80=A7=E8=83=BD=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...stractTableDatasourceTest.java => TableDatasourceTest.java} | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) rename designer-base/src/test/java/com/fr/design/{AbstractTableDatasourceTest.java => TableDatasourceTest.java} (99%) diff --git a/designer-base/src/test/java/com/fr/design/AbstractTableDatasourceTest.java b/designer-base/src/test/java/com/fr/design/TableDatasourceTest.java similarity index 99% rename from designer-base/src/test/java/com/fr/design/AbstractTableDatasourceTest.java rename to designer-base/src/test/java/com/fr/design/TableDatasourceTest.java index e75ec4eb19..ed6aa3657a 100644 --- a/designer-base/src/test/java/com/fr/design/AbstractTableDatasourceTest.java +++ b/designer-base/src/test/java/com/fr/design/TableDatasourceTest.java @@ -13,11 +13,10 @@ import com.fr.third.javax.xml.stream.XMLStreamException; import junit.framework.TestCase; import java.io.ByteArrayOutputStream; -import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; -public class AbstractTableDatasourceTest extends TestCase { +public class TableDatasourceTest extends TestCase { public void testAbstractTableDataSourceReadAndWrite() throws XMLStreamException, TableDataException, UnsupportedEncodingException { String xml = "\n" + From 2d73ecd9fbcc431c5b8f6d508711e305fc07670b Mon Sep 17 00:00:00 2001 From: zheng Date: Fri, 21 Dec 2018 16:13:49 +0800 Subject: [PATCH 69/93] =?UTF-8?q?CHART-3086=20geojson=E8=AF=BB=E5=86=99?= =?UTF-8?q?=E7=A7=BB=E5=88=B0core=E3=80=82service=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=94=B9=E5=8A=A8=E8=BE=83=E5=A4=A7=20=E4=B8=8B=E4=B8=80?= =?UTF-8?q?=E6=B3=A2=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../drillmap/designer/data/comp/MapDataTree.java | 11 ++++++----- .../designer/type/VanChartMapSourceChoosePane.java | 10 +++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java index 16f6af6b2b..642630f149 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java @@ -4,8 +4,9 @@ import com.fr.design.constants.UIConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper; +import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; -import com.fr.plugin.chart.map.server.GEOJSONHelper; +import com.fr.geojson.helper.GEOJSONHelper; import com.fr.stable.StringUtils; import javax.swing.JTree; @@ -78,7 +79,7 @@ public class MapDataTree extends JTree { DefaultMutableTreeNode currentSel = (DefaultMutableTreeNode)this.getLastSelectedPathComponent(); - return GEOJSONHelper.getInstance().getJsonUrlByPath(currentSel.getUserObject().toString()); + return CompatibleGEOJSONHelper.getJsonUrlByPathIncludeParam(currentSel.getUserObject().toString()); } //根据路径精确查找 @@ -96,7 +97,7 @@ public class MapDataTree extends JTree { return null; } String dirPath = el.getUserObject().toString(); - String url = GEOJSONHelper.getInstance().getJsonUrlByPath(dirPath); + String url = CompatibleGEOJSONHelper.getJsonUrlByPathIncludeParam(dirPath); if (GEOJSONHelper.getInstance().isValidDirPath(dirPath) && ComparatorUtils.equals(jsonUrl, url)){ selectTreeNode(el, m_model); return el; @@ -133,7 +134,7 @@ public class MapDataTree extends JTree { if(treeNode == null || treeNode.getUserObject() == null){ return StringUtils.EMPTY; } - return GEOJSONHelper.getPresentNameWithPath(treeNode.getUserObject().toString()); + return ChartGEOJSONHelper.getPresentNameWithPath(treeNode.getUserObject().toString()); } //模糊搜索 深度优先. @@ -149,7 +150,7 @@ public class MapDataTree extends JTree { DefaultMutableTreeNode el = els.nextElement(); String path = el.getUserObject().toString(); - String fileName = GEOJSONHelper.getPresentNameWithPath(path); + String fileName = ChartGEOJSONHelper.getPresentNameWithPath(path); if (GEOJSONHelper.getInstance().isValidDirPath(path) && StringUtils.contains(fileName, text)) { selectTreeNode(el, m_model); return; diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java index 43fcb5df0d..5fa180ffe6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java @@ -18,15 +18,15 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.JTemplate; import com.fr.general.ComparatorUtils; - import com.fr.general.http.HttpClient; import com.fr.plugin.chart.base.GisLayer; import com.fr.plugin.chart.base.ViewCenter; import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper; import com.fr.plugin.chart.map.layer.WMSLayer; +import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; -import com.fr.plugin.chart.map.server.GEOJSONHelper; +import com.fr.geojson.helper.GEOJSONHelper; import com.fr.plugin.chart.map.server.MapLayerConfigManager; import com.fr.plugin.chart.service.WMSFactory; import com.fr.plugin.chart.type.GISLayerType; @@ -201,7 +201,7 @@ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver { } else if(o instanceof String){//list里面没有 selectTreePath = null; this.tree.setSelectionPath(null); - this.getModel().setSelectedItem(GEOJSONHelper.getPresentNameWithPath((String) o)); + this.getModel().setSelectedItem(ChartGEOJSONHelper.getPresentNameWithPath((String) o)); } } @@ -209,7 +209,7 @@ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver { protected String pathToString(TreePath path) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); //不显示后缀 - return GEOJSONHelper.getPresentNameWithPath(node.toString()); + return ChartGEOJSONHelper.getPresentNameWithPath(node.toString()); } @Override @@ -533,7 +533,7 @@ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver { GEOJSONTreeHelper.getInstance().updateParamRootNode(VanChartMapSourceChoosePane.this.getParams()); if(selectTreePath != null){ - mapDataTree.setSelectNodePath(GEOJSONHelper.completeJSONName(selectTreePath.getLastPathComponent().toString())); + mapDataTree.setSelectNodePath(CompatibleGEOJSONHelper.completeJSONName(selectTreePath.getLastPathComponent().toString())); selectTreePath = mapDataTree.getSelectionPath(); } From 0fcdd85bdb2801154a85c4f1c6452df57663bedb Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 16:26:57 +0800 Subject: [PATCH 70/93] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E5=B0=86=E5=B0=9D=E8=AF=95=E8=BF=9E=E6=8E=A5=E5=92=8C=E6=AD=A3?= =?UTF-8?q?=E5=BC=8F=E8=BF=9E=E6=8E=A5=E6=8F=90=E7=A4=BA=E5=88=86=E5=BC=80?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/env/RemoteEnvPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 dc764153ca..d2953eeb6a 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -540,7 +540,7 @@ public class RemoteEnvPane extends BasicBeanPane { } if (result == TestConnectionResult.Partly_Sucess) { - message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency")); + message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistence_Test")); uiLabel.setIcon(UIManager.getIcon("OptionPane.warningIcon")); } From 914121c191831fee8decfc43b863e9c2271d0eb7 Mon Sep 17 00:00:00 2001 From: kerry Date: Sat, 22 Dec 2018 20:21:27 +0800 Subject: [PATCH 71/93] =?UTF-8?q?REPORT-13626=20=20=E5=85=88=E6=94=B9?= =?UTF-8?q?=E5=9B=9E=E5=8E=BB=EF=BC=8C=E4=B8=8D=E5=9C=A8=E5=9B=9E=E5=BD=92?= =?UTF-8?q?=E9=87=8C=E9=9D=A2=E5=A4=84=E7=90=86=EF=BC=8C=E4=B8=80=E7=9B=B4?= =?UTF-8?q?=E9=83=BD=E6=98=AF=E8=BF=99=E6=A0=B7=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/itextfield/UIAutoCompletionField.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java index 5672a8502d..967aeddbb9 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java @@ -2,6 +2,8 @@ package com.fr.design.gui.itextfield; import com.fr.design.gui.imenu.UIListPopup; import com.fr.general.ComparatorUtils; +import com.fr.stable.OperatingSystem; + import javax.swing.JList; import javax.swing.UIManager; import javax.swing.event.DocumentEvent; @@ -82,6 +84,9 @@ public class UIAutoCompletionField extends UITextField implements DocumentListen } private void textChanged() { + if (OperatingSystem.isMacOS()) { + return; + } if (!popup.isVisible()) { showPopup(); requestFocus(); From 9475d65d278a7397d00cbc1cee67deee5882180c Mon Sep 17 00:00:00 2001 From: Hades Date: Mon, 24 Dec 2018 14:08:43 +0800 Subject: [PATCH 72/93] =?UTF-8?q?REPORT-13303=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=A6=82=E6=9E=9C=E6=A0=B9=E7=9B=AE=E5=BD=95=E6=9C=89?= =?UTF-8?q?=E5=BE=88=E5=A4=9A=E9=9D=A2=E6=9D=BF,=20=E4=BC=9A=E5=8D=A1?= =?UTF-8?q?=E5=9C=A8=E7=99=BD=E5=B1=8F=E5=BE=88=E4=B9=85,=20=E4=B8=8D?= =?UTF-8?q?=E5=90=88=E7=90=86.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 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 5c262da9de..a2c21ccabd 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 @@ -100,6 +100,8 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener { @@ -247,6 +249,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta private ProgressDialog progressDialog; + private ExecutorService fixedThreadPool = Executors.newFixedThreadPool(1); + + public DesignerFrame(ToolBarMenuDock ad) { setName(DESIGNER_FRAME_NAME); @@ -809,18 +814,21 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 报表运行环境改变时,需要刷新某些面板 */ public void refreshEnv() { - this.setTitle(); - DesignerFrameFileDealerPane.getInstance().refreshDockingView(); - TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); - TemplateTreePane.getInstance().refreshDockingView(); - DesignTableDataManager.clearGlobalDs(); - EastRegionContainerPane.getInstance().refreshDownPane(); - - JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (template != null) { - template.refreshToolArea(); - } + fixedThreadPool.execute(new Runnable() { + @Override + public void run() { + DesignerFrameFileDealerPane.getInstance().refreshDockingView(); + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); + TemplateTreePane.getInstance().refreshDockingView(); + DesignTableDataManager.clearGlobalDs(); + EastRegionContainerPane.getInstance().refreshDownPane(); + JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if (template != null) { + template.refreshToolArea(); + } + } + }); } /** From b5c1870902b772c4ef0e3838b01007e186006d57 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 24 Dec 2018 15:13:24 +0800 Subject: [PATCH 73/93] REPORT-13810 --- .../src/main/java/com/fr/design/EnvChangeEntrance.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 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 76ae528949..6b56649700 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -90,15 +90,16 @@ public class EnvChangeEntrance { }); return false; } + //REPORT-13810如果只是添加了工作目录,没有切换,这里ToolArea也是要显示新建的工作目录 + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (template != null) { + template.refreshToolArea(); + } WorkContext.switchTo(workspace, new WorkContextCallback() { @Override public void done() { DesignerEnvManager.getEnvManager().setCurEnvName(envName); DesignUtils.refreshDesignerFrame(); - JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (template != null) { - template.refreshToolArea(); - } DesignTableDataManager.fireDSChanged(new HashMap()); if (WorkContext.getCurrent().isLocal()) { //初始化一下serverTray From 3927974c66a4bdb7e0abf057d6b878a3fe52d96f Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 24 Dec 2018 17:27:38 +0800 Subject: [PATCH 74/93] REPORT-13802 --- .../com/fr/design/insert/formula/variable/cn/servletURL.txt | 2 +- .../com/fr/design/insert/formula/variable/en/servletURL.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/servletURL.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/servletURL.txt index 2a1e5dfd49..5ba157a706 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/servletURL.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/servletURL.txt @@ -1 +1 @@ -假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,servletURL指的是:/WebReport/ReportServer \ No newline at end of file +假如访问的是http://localhost:8076/webroot/decision/view/report?viewlet=workbook1.cpt,servletURL指的是:/webroot/decision/view/report \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/servletURL.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/servletURL.txt index b9149deff3..fd14304ce7 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/servletURL.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/servletURL.txt @@ -1 +1 @@ -http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,servletURL is /WebReport/ReportServer \ No newline at end of file +http://localhost:8076/webroot/decision/view/report?viewlet=workbook1.cpt,servletURL is /webroot/decision/view/report \ No newline at end of file From c9d222765ddd72ac379d1742e046e6d5a8127167 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 24 Dec 2018 17:44:20 +0800 Subject: [PATCH 75/93] REPORT-13802 --- .../com/fr/design/insert/formula/variable/cn/servletURL.txt | 2 +- .../com/fr/design/insert/formula/variable/en/servletURL.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/servletURL.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/servletURL.txt index 5ba157a706..81dc88965f 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/servletURL.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/cn/servletURL.txt @@ -1 +1 @@ -假如访问的是http://localhost:8076/webroot/decision/view/report?viewlet=workbook1.cpt,servletURL指的是:/webroot/decision/view/report \ No newline at end of file +假如访问的是http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,servletURL指的是:/webroot/decision/view/report \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/servletURL.txt b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/servletURL.txt index fd14304ce7..d8704ba82a 100644 --- a/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/servletURL.txt +++ b/designer-base/src/main/resources/com/fr/design/insert/formula/variable/en/servletURL.txt @@ -1 +1 @@ -http://localhost:8076/webroot/decision/view/report?viewlet=workbook1.cpt,servletURL is /webroot/decision/view/report \ No newline at end of file +http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,servletURL is /webroot/decision/view/report \ No newline at end of file From b6f567dab66065b2a89db0ffcfb0d1427147fb6b Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 25 Dec 2018 10:10:16 +0800 Subject: [PATCH 76/93] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E5=8E=BB=E6=8E=89httpclient=E7=9A=84=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../errorinfo/ErrorInfoUploader.java | 82 ++++++++----------- 1 file changed, 36 insertions(+), 46 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java b/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java index 4d59644262..42298b8123 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java @@ -3,15 +3,16 @@ package com.fr.design.mainframe.errorinfo; import com.fr.base.FRContext; import com.fr.design.mainframe.SiteCenterToken; import com.fr.general.CloudCenter; -import com.fr.general.ComparatorUtils; +import com.fr.general.CommonIOUtils; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; -import com.fr.general.http.HttpClient; -import com.fr.json.JSONException; +import com.fr.general.http.HttpResponseType; +import com.fr.general.http.HttpToolbox; import com.fr.json.JSONObject; import com.fr.license.function.VT4FR; import com.fr.log.FineLoggerFactory; import com.fr.log.LogHandler; +import com.fr.stable.ArrayUtils; import com.fr.stable.EnvChangedListener; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; @@ -93,9 +94,7 @@ public class ErrorInfoUploader { try { String downloadURL = CloudCenter.getInstance().acquireUrlByKind("solution.download", "http://cloud.fanruan.com/api/solution"); downloadURL = String.format("%s?token=%s", downloadURL, SiteCenterToken.generateToken()); - HttpClient hc = new HttpClient(downloadURL); - hc.asGet(); - InputStream in = hc.getResponseStream(); + InputStream in = HttpToolbox.post(downloadURL, new HashMap(), HttpResponseType.STREAM); StableUtils.makesureFileExist(localCacheZip); FileOutputStream out = new FileOutputStream(localCacheZip); IOUtils.copyBinaryTo(in, out); @@ -114,15 +113,11 @@ public class ErrorInfoUploader { // 判断本地文件大小. String checkURL = CloudCenter.getInstance().acquireUrlByKind("solution.check", "http://cloud.fanruan.com/api/solution/cache/check"); checkURL = String.format("%s?token=%s", checkURL, SiteCenterToken.generateToken()); - HttpClient client = new HttpClient(checkURL); - client.asGet(); - if (client.isServerAlive()) { - try { - JSONObject res = new JSONObject(client.getResponseText()); - // 简单粗暴, 直接判断文件大小. - return res.optLong("version") != localCacheZip.length(); - } catch (JSONException ignore) { - } + try { + JSONObject res = new JSONObject(HttpToolbox.get(checkURL)); + // 简单粗暴, 直接判断文件大小. + return res.optLong("version") != localCacheZip.length(); + } catch (Exception ignore) { } return false; } @@ -140,27 +135,29 @@ public class ErrorInfoUploader { } File[] files = folder.listFiles(); - if (files.length > MAX_ERROR_SIZE) { - StableUtils.deleteFile(folder); + if (ArrayUtils.getLength(files) > MAX_ERROR_SIZE) { + CommonIOUtils.deleteFile(folder); return; } try { - for (File file : files) { - String filePath = file.getPath(); - String suffix = filePath.substring(filePath.lastIndexOf(".")); - - if (suffix.endsWith(SUFFIX)) { - Thread.sleep(1000L); - String content = IOUtils.inputStream2String(new FileInputStream(file)); - if (content.length() > MAX_ERROR_SIZE) { - file.delete(); - continue; - } - - String url = CloudCenter.getInstance().acquireUrlByKind("design.error"); - if (sendErroInfo(url, content)) { - file.delete(); + if (ArrayUtils.isNotEmpty(files)) { + for (File file : files) { + String filePath = file.getPath(); + String suffix = filePath.substring(filePath.lastIndexOf(".")); + + if (suffix.endsWith(SUFFIX)) { + Thread.sleep(1000L); + String content = IOUtils.inputStream2String(new FileInputStream(file)); + if (content.length() > MAX_ERROR_SIZE) { + CommonIOUtils.deleteFile(file); + continue; + } + + String url = CloudCenter.getInstance().acquireUrlByKind("design.error"); + if (sendErrorInfo(url, content)) { + CommonIOUtils.deleteFile(file); + } } } } @@ -169,25 +166,18 @@ public class ErrorInfoUploader { } } - private boolean sendErroInfo(String url, String content) { - HashMap para = new HashMap<>(); + private boolean sendErrorInfo(String url, String content) { + HashMap para = new HashMap<>(); para.put("token", SiteCenterToken.generateToken()); para.put("content", content); - HttpClient httpClient = new HttpClient(url, para, true); - httpClient.asGet(); - - if (!httpClient.isServerAlive()) { - return false; - } - String res = httpClient.getResponseText(); - boolean success; try { - success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); - } catch (Exception ex) { - success = true; + String responseText = HttpToolbox.post(url, para); + return "success".equals(new JSONObject(responseText).get("status")); + } catch (Exception ignore) { + } - return success; + return false; } From 8055a97d3206fb3afce09ccf82ce958fb3616e9f Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Wed, 26 Dec 2018 06:22:14 +0800 Subject: [PATCH 77/93] =?UTF-8?q?REPORT-12718=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=BC=8F=E4=BC=A0=E4=BA=86.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/designer/creator/ErrorCreator.java | 4 ++-- .../java/com/fr/design/designer/creator/XCreatorUtils.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/ErrorCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/ErrorCreator.java index 54a679fe14..b9a29c041d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/ErrorCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/ErrorCreator.java @@ -1,7 +1,7 @@ package com.fr.design.designer.creator; -import com.fr.form.ui.ErrorMarker; import com.fr.form.ui.Widget; +import com.fr.form.ui.WidgetErrorMarker; import com.fr.stable.StringUtils; import java.awt.*; @@ -18,7 +18,7 @@ public class ErrorCreator extends NullCreator { @Override protected String showText() { - ErrorMarker marker = (ErrorMarker)toData(); + WidgetErrorMarker marker = (WidgetErrorMarker)toData(); String text = marker.getWidgetValue().getDisplayValue(); if (StringUtils.isEmpty(text)) { return super.showText(); 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 774010136c..f51f6710bc 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 @@ -26,7 +26,6 @@ import com.fr.form.ui.ComboCheckBox; import com.fr.form.ui.DateEditor; import com.fr.form.ui.EditorHolder; import com.fr.form.ui.ElementCaseEditor; -import com.fr.form.ui.ErrorMarker; import com.fr.form.ui.FileEditor; import com.fr.form.ui.FreeButton; import com.fr.form.ui.IframeEditor; @@ -42,6 +41,7 @@ import com.fr.form.ui.TextEditor; import com.fr.form.ui.TreeComboBoxEditor; import com.fr.form.ui.TreeEditor; import com.fr.form.ui.Widget; +import com.fr.form.ui.WidgetErrorMarker; import com.fr.form.ui.container.WAbsoluteBodyLayout; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBorderLayout; @@ -160,7 +160,7 @@ public class XCreatorUtils { objectMap.put(NameWidget.class, XNameWidget.class); objectMap.put(CardSwitchButton.class, XCardSwitchButton.class); objectMap.put(CardAddButton.class, XCardAddButton.class); - objectMap.put(ErrorMarker.class, ErrorCreator.class); + objectMap.put(WidgetErrorMarker.class, ErrorCreator.class); } private static void reInitExtra() { From 2eb4fa09378bcda62cb5a6d4904065ecf8931372 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 26 Dec 2018 10:38:56 +0800 Subject: [PATCH 78/93] =?UTF-8?q?REPORT-13202=20=E5=8C=85=E5=90=AB?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=8E=A7=E4=BB=B6=E7=9A=84=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E7=8E=AF=E5=A2=83=E5=90=8E=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/file/HistoryTemplateListCache.java | 75 +++++++++++++++++++ .../com/fr/design/mainframe/JTemplate.java | 13 ---- .../com/fr/start/module/DesignerStartup.java | 60 ++++++++++----- 3 files changed, 115 insertions(+), 33 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index df83cb1a4b..91af4c8303 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -1,6 +1,8 @@ package com.fr.design.file; import com.fr.base.chart.chartdata.CallbackEvent; +import com.fr.base.io.BaseBook; +import com.fr.base.io.IOFile; import com.fr.design.DesignerEnvManager; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.data.DesignTableDataManager; @@ -18,10 +20,14 @@ import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; import com.fr.third.org.apache.commons.io.FilenameUtils; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.ListIterator; +import java.util.Map; /** * 历史模板缓存 @@ -305,4 +311,73 @@ public class HistoryTemplateListCache implements CallbackEvent { } return true; } + + /** + * 切换环境时暂存打开的模板内容,key 是在历史中的index,value 是模板xml 内容byte[] + */ + private Map bytesMap; + + /** + * 切换环境前将正在编辑的模板暂存起来,并且在新环境中重新读取一遍,暂存的不是模板文件的内容而是模板对象的内容 + *

+ * 防止新环境加载到的同名 Class 和模板对象中的 Class 不一致,在新环境存储失败 + * + * @see HistoryTemplateListCache#load() + */ + public void stash() { + FineLoggerFactory.getLogger().info("Env Change Template Stashing..."); + if (bytesMap == null) { + bytesMap = new HashMap(); + } else { + bytesMap.clear(); + } + int size = historyList.size(); + for (int i = 0; i < size; i++) { + JTemplate template = historyList.get(i); + try { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + BaseBook target = template.getTarget(); + if (target != null) { + target.export(outputStream); + bytesMap.put(i, outputStream.toByteArray()); + } + // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + FineLoggerFactory.getLogger().info("Env Change Template Stashed."); + } + + /** + * 切换环境前将正在编辑的模板暂存起来后,在新环境重新读取一遍 + *

+ * 防止新环境加载到的同名 Class 和模板对象中的 Class 不一致,在新环境存储失败 + * + * @see HistoryTemplateListCache#stash() + */ + public void load() { + FineLoggerFactory.getLogger().info("Env Change Template Loading..."); + if (bytesMap != null && bytesMap.size() != 0) { + int size = historyList.size(); + for (int i = 0; i < size; i++) { + try { + byte[] bytes = bytesMap.get(i); + // 可能有模板 stash 失败的情况,在 load 的时候不更新它 + if (bytes == null) { + continue; + } + ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes); + // todo readStream 这个行为应该上升到 BaseBook 上 + ((IOFile) historyList.get(i).getTarget()).readStream(inputStream); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + bytesMap.clear(); + MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList); + MutilTempalteTabPane.getInstance().repaint(); + } + FineLoggerFactory.getLogger().info("Env Change Template Loaded."); + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 7f5cab7448..3e7b952869 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -522,19 +522,6 @@ public abstract class JTemplate> if (editingFILE == null) { return false; } -// //检查一下连接是否成功 -// try { -// if (FRContext.getCommonOperator() != null && !FRContext.getCommonOperator().testServerConnectionWithOutShowMessagePane()) { -// //连接不成功,提示 -// JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), -// com.fr.design.i18n.Toolkit.i18nText(new String[]{"server_disconnected", "template_unsaved"}, new String[]{",", "!"}) -// , com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Error"), JOptionPane.ERROR_MESSAGE); -// return false; -// } -// } catch (Exception e) { -// FineLoggerFactory.getLogger().error(e.getMessage(), e); -// } - // 检查一下editingFILE是不是已存在的文件,如果不存在则用saveAs if (!editingFILE.exists()) { diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java index 701a6936c1..4ec5189403 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java @@ -1,6 +1,7 @@ package com.fr.start.module; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.mainframe.DesignerContext; import com.fr.event.Event; import com.fr.event.Listener; @@ -28,13 +29,13 @@ public class DesignerStartup extends Activator { @Override @Metrics public void start() { - + startSub(PreStartActivator.class); //启动基础部分 startSub(BasicActivator.class); final String[] args = getModule().upFindSingleton(StartupArgs.class).get(); final Designer designer = new Designer(args); - + startSub(DesignerWorkspaceProvider.class); registerEnvListener(); //启动env @@ -49,7 +50,7 @@ public class DesignerStartup extends Activator { } }); service.submit(new Runnable() { - + @Override public void run() { try { @@ -63,46 +64,65 @@ public class DesignerStartup extends Activator { DesignerContext.getDesignerFrame().setVisible(true); //启动画面结束 SplashContext.getInstance().hide(); - + DesignerContext.getDesignerFrame().getProgressDialog().setVisible(true); startSub(StartFinishActivator.class); FineRuntime.startFinish(); } - + private void browserDemo() { - + if (getModule().leftFindSingleton(StartupArgs.class) != null && getModule().leftFindSingleton(StartupArgs.class).isDemo()) { ServerStarter.browserDemoURL(); } } - + /** - * 切换环境时,重新启动所有相关模块 + * 注册切换环境前后事件监听 */ private void registerEnvListener() { + + /*切换环境前,关闭所有相关模块*/ listenEvent(WorkspaceEvent.BeforeSwitch, new Listener() { @Override - public void on(Event event, Workspace param) { - + public void on(Event event, Workspace current) { getSub(EnvBasedModule.class).stop(); } }); + /*切换环境后,重新启动所有相关模块*/ listenEvent(WorkspaceEvent.AfterSwitch, new Listener(Integer.MAX_VALUE) { @Override - public void on(Event event, Workspace param) { - + public void on(Event event, Workspace current) { getSub(EnvBasedModule.class).start(); - ExecutorService service = Executors.newSingleThreadExecutor(); - service.submit(new Runnable() { - @Override - public void run() { - FineEmbedServer.start(); - } - }); - service.shutdown(); + // 切换后的环境是本地环境才启动内置服务器 + if (current.isLocal()) { + ExecutorService service = Executors.newSingleThreadExecutor(); + service.submit(new Runnable() { + @Override + public void run() { + FineEmbedServer.start(); + } + }); + service.shutdown(); + } + } + }); + /*切换环境前,存储一下打开的所有文件对象,优先级高于默认优先级,要先于 关闭相关模块部分 被触发*/ + listenEvent(WorkspaceEvent.BeforeSwitch, new Listener(1) { + @Override + public void on(Event event, Workspace workspace) { + HistoryTemplateListCache.getInstance().stash(); + } + }); + + /*切换环境后,装载一下打开的所有文件对象,优先级低于默认优先级,要后于 启动相关模块部分 被触发*/ + listenEvent(WorkspaceEvent.AfterSwitch, new Listener(-1) { + @Override + public void on(Event event, Workspace workspace) { + HistoryTemplateListCache.getInstance().load(); } }); } From 382549ac3bc824b35da504690e4b3f5c98701c39 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 26 Dec 2018 11:27:42 +0800 Subject: [PATCH 79/93] =?UTF-8?q?load=20=E5=9C=BA=E6=99=AF=E4=B8=8B=20?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=86=85=E5=AD=98=E4=BC=98=E5=8C=96=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/file/HistoryTemplateListCache.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 91af4c8303..a84442c588 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -368,8 +368,12 @@ public class HistoryTemplateListCache implements CallbackEvent { continue; } ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes); - // todo readStream 这个行为应该上升到 BaseBook 上 - ((IOFile) historyList.get(i).getTarget()).readStream(inputStream); + BaseBook target = historyList.get(i).getTarget(); + if (target != null) { + // todo readStream 这个行为应该上升到 BaseBook 上 + ((IOFile) target).readStream(inputStream); + } + // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } From b23f8e74c6429479e0e94020877f2bb81bba2341 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 26 Dec 2018 12:00:37 +0800 Subject: [PATCH 80/93] =?UTF-8?q?=E5=88=87=E6=8D=A2=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E7=9B=91=E5=90=AC=E4=BC=98=E5=85=88=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/start/module/DesignerStartup.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java index 4ec5189403..98e1f8f18f 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java @@ -111,7 +111,7 @@ public class DesignerStartup extends Activator { } }); /*切换环境前,存储一下打开的所有文件对象,优先级高于默认优先级,要先于 关闭相关模块部分 被触发*/ - listenEvent(WorkspaceEvent.BeforeSwitch, new Listener(1) { + listenEvent(WorkspaceEvent.BeforeSwitch, new Listener(Integer.MAX_VALUE) { @Override public void on(Event event, Workspace workspace) { HistoryTemplateListCache.getInstance().stash(); @@ -119,7 +119,7 @@ public class DesignerStartup extends Activator { }); /*切换环境后,装载一下打开的所有文件对象,优先级低于默认优先级,要后于 启动相关模块部分 被触发*/ - listenEvent(WorkspaceEvent.AfterSwitch, new Listener(-1) { + listenEvent(WorkspaceEvent.AfterSwitch, new Listener(Integer.MIN_VALUE) { @Override public void on(Event event, Workspace workspace) { HistoryTemplateListCache.getInstance().load(); From 10e88ac516e292fdaaf5465dd8d53b4744d04e38 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Thu, 27 Dec 2018 09:40:12 +0800 Subject: [PATCH 81/93] =?UTF-8?q?REPORT-13902=20=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84test=E4=BE=9D=E8=B5=96,=20=E5=85=88=E7=A7=BB=E5=87=BA?= =?UTF-8?q?=E6=9D=A5.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/form/ui/WidgetNameCopyTest.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 designer-form/src/test/java/com/fr/form/ui/WidgetNameCopyTest.java diff --git a/designer-form/src/test/java/com/fr/form/ui/WidgetNameCopyTest.java b/designer-form/src/test/java/com/fr/form/ui/WidgetNameCopyTest.java new file mode 100644 index 0000000000..8a2f498ded --- /dev/null +++ b/designer-form/src/test/java/com/fr/form/ui/WidgetNameCopyTest.java @@ -0,0 +1,29 @@ +package com.fr.form.ui; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.mainframe.FormSelectionUtils; +import com.fr.form.main.Form; +import com.fr.general.ComparatorUtils; +import junit.framework.TestCase; + +import java.awt.Dimension; + +/** + * @author kerry + * @date 2018/7/27 + */ +public class WidgetNameCopyTest extends TestCase { + + public void testWidgetNameCopy() throws Exception { + Widget button = new FreeButton(); + Form form = new Form(); + button.setWidgetName("button0"); + XCreator xCreator = XCreatorUtils.createXCreator(button, new Dimension(100, 100)); + XCreator copyXcreator1 = FormSelectionUtils.copyXcreator(form, xCreator); + XCreator copyXcreator2 = FormSelectionUtils.copyXcreator(form, xCreator); + copyXcreator1.toData().setWidgetName("button_test"); + assertTrue(!ComparatorUtils.equals(copyXcreator2.toData().getWidgetName(), copyXcreator1.toData().getWidgetName())); + } + +} From b35dfc96e3b8e341a297a5e16424430544b04fed Mon Sep 17 00:00:00 2001 From: Hades Date: Thu, 27 Dec 2018 09:56:56 +0800 Subject: [PATCH 82/93] =?UTF-8?q?REPORT-13895=20release=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=90=AF=E5=8A=A8=E6=97=B6=E5=BC=82=E6=AD=A5=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=A8=A1=E6=9D=BF=E5=90=8E=EF=BC=8C=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E4=B8=8D=E6=96=AD=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 48 +++++++++++-------- .../DesignerFrameFileDealerPane.java | 30 +++++++++++- 2 files changed, 56 insertions(+), 22 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 e68d00434e..714c561e7c 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 @@ -38,7 +38,6 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.menu.MenuManager; import com.fr.design.menu.ShortCut; -import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.exception.DecryptTemplateException; import com.fr.file.FILE; @@ -69,6 +68,7 @@ import javax.swing.JLayeredPane; import javax.swing.JMenuBar; import javax.swing.JOptionPane; import javax.swing.JPanel; +import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.WindowConstants; import javax.swing.border.MatteBorder; @@ -102,8 +102,6 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener { @@ -243,9 +241,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta private ProgressDialog progressDialog; - private ExecutorService fixedThreadPool = Executors.newFixedThreadPool(1); - - public DesignerFrame(ToolBarMenuDock ad) { setName(DESIGNER_FRAME_NAME); @@ -418,7 +413,16 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta public void on(PluginEvent event) { refreshNorthEastPane(northEastPane, ad); - DesignUtils.refreshDesignerFrame(); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + if (DesignerContext.getDesignerFrame() == null) { + return; + } + DesignerContext.getDesignerFrame().refresh(); + DesignerContext.getDesignerFrame().repaint(); + } + }); } }, new PluginFilter() { @@ -820,21 +824,23 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 报表运行环境改变时,需要刷新某些面板 */ public void refreshEnv() { + refresh(); + DesignerFrameFileDealerPane.getInstance().refreshDockingView(); + TemplateTreePane.getInstance().refreshDockingView(); + } + + /** + * 安装设计器相关插件时的刷新 + */ + public void refresh() { this.setTitle(); - fixedThreadPool.execute(new Runnable() { - @Override - public void run() { - DesignerFrameFileDealerPane.getInstance().refreshDockingView(); - TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); - TemplateTreePane.getInstance().refreshDockingView(); - DesignTableDataManager.clearGlobalDs(); - EastRegionContainerPane.getInstance().refreshDownPane(); - JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (template != null) { - template.refreshToolArea(); - } - } - }); + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); + DesignTableDataManager.clearGlobalDs(); + EastRegionContainerPane.getInstance().refreshDownPane(); + JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if (template != null) { + template.refreshToolArea(); + } } /** diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 7127c9763e..4f43e998b9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -30,11 +30,18 @@ import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; +import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralContext; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.context.PluginContext; +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.stable.CoreConstants; import com.fr.stable.StringUtils; import com.fr.third.org.apache.commons.io.FilenameUtils; @@ -68,6 +75,22 @@ import static javax.swing.JOptionPane.WARNING_MESSAGE; public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange { + static { + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + + @Override + public void on(PluginEvent event) { + DesignUtils.refreshDesignerFrame(); + } + }, new PluginFilter() { + + @Override + public boolean accept(PluginContext context) { + return context.contain(PluginModule.ExtraDesign, ShortCut.TEMPLATE_TREE); + } + }); + } + private static final String FILE = "file"; private static volatile DesignerFrameFileDealerPane THIS; @@ -163,7 +186,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt * 刷新菜单 */ public void refreshDockingView() { - + long start = System.currentTimeMillis(); ToolBarDef toolbarDef = new ToolBarDef(); toolbarDef.addShortCut(newFolderAction, refreshTreeAction); if (WorkContext.getCurrent().isLocal()) { @@ -176,7 +199,12 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } toolbarDef.updateToolBar(toolBar); resetActionStatus(); + long end = System.currentTimeMillis(); + System.out.println("----------------------->refreshDockingView 菜单: " + (end - start)); + long start1 = System.currentTimeMillis(); refresh(); + long end1 = System.currentTimeMillis(); + System.out.println("-------------------------->菜单 refresh: " + (end1 - start1)); } From dbd31a94ed0192eafa5c99613b3f84928a632e5f Mon Sep 17 00:00:00 2001 From: Hades Date: Thu, 27 Dec 2018 10:33:43 +0800 Subject: [PATCH 83/93] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrameFileDealerPane.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 4f43e998b9..d607352574 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -186,7 +186,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt * 刷新菜单 */ public void refreshDockingView() { - long start = System.currentTimeMillis(); ToolBarDef toolbarDef = new ToolBarDef(); toolbarDef.addShortCut(newFolderAction, refreshTreeAction); if (WorkContext.getCurrent().isLocal()) { @@ -199,12 +198,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } toolbarDef.updateToolBar(toolBar); resetActionStatus(); - long end = System.currentTimeMillis(); - System.out.println("----------------------->refreshDockingView 菜单: " + (end - start)); - long start1 = System.currentTimeMillis(); refresh(); - long end1 = System.currentTimeMillis(); - System.out.println("-------------------------->菜单 refresh: " + (end1 - start1)); } From bd65d47a210a6f8b5ce022ea79fe52f8feb70a39 Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 27 Dec 2018 11:27:44 +0800 Subject: [PATCH 84/93] =?UTF-8?q?REPORT-10829=20=20=E8=A3=85=E4=BA=86?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=8F=92=E4=BB=B6=E5=90=8E=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=97=A0=E6=B3=95=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/loghandler/LogMessageBar.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java index bf815e1d74..3b05937087 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java @@ -69,8 +69,11 @@ public class LogMessageBar extends JPanel { return new Dimension(width, 24); } + /** + * 销毁内置的日志面板,外部插件会用到 + */ public void disposeLogDialog() { - if (dlg != null) { + if (dlg != null && dlg.isShowing()) { dlg.dispose(); } THIS = null; From 80e049a6275959345f94cf584e278d56d8603b80 Mon Sep 17 00:00:00 2001 From: abel Date: Thu, 27 Dec 2018 14:34:12 +0800 Subject: [PATCH 85/93] =?UTF-8?q?REPORT-13573=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E6=8A=A5=E8=A1=A8=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=EF=BC=8C=E4=BC=9A=E6=8A=8A=E6=8A=A5=E8=A1=A8=E4=BC=A0=E5=88=B0?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=AB=AF=EF=BC=8C=E6=8A=A5=E8=A1=A8=E6=AF=94?= =?UTF-8?q?=E8=BE=83=E5=A4=A7=EF=BC=8C=E4=BC=9A=E6=9C=89=E6=80=A7=E8=83=BD?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E8=A3=81=E5=89=AA=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=EF=BC=8C=E5=8F=AA=E6=8A=8A=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E7=9A=84=E9=83=A8=E5=88=86=E5=8F=91=E8=BF=87=E5=8E=BB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/DesignTableDataManager.java | 16 +- .../com/fr/design/TableDatasourceTest.java | 165 ------------------ 2 files changed, 2 insertions(+), 179 deletions(-) delete mode 100644 designer-base/src/test/java/com/fr/design/TableDatasourceTest.java diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index ee7df60151..fc5e8b54fc 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -3,8 +3,8 @@ package com.fr.design.data; import com.fr.base.FRContext; import com.fr.base.StoreProcedureParameter; import com.fr.base.TableData; -import com.fr.data.AbstractTableDataSource; import com.fr.data.TableDataSource; +import com.fr.data.TableDataSourceTailor; import com.fr.data.core.DataCoreXmlUtils; import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.storeproc.ProcedureDataModel; @@ -445,19 +445,7 @@ public abstract class DesignTableDataManager { parameter.setValue(parameterMap.get(parameter.getName())); } } - //这边数据集预览不需要把整个模板都发送过去,只需要把模板中的数据集挑出来,传过去就行了。模板一大,预览数据集很变得很慢。 - TableDataSource wrapper = null; - if (tableDataSource != null) { - wrapper = new AbstractTableDataSource(){}; - for (Iterator it = tableDataSource.getTableDataNameIterator(); it != null && it.hasNext(); ) { - String name = it.next(); - TableData tableData = tableDataSource.getTableData(name); - if (tableData != null) { - wrapper.putTableData(name, tableData); - } - } - } - return DataOperator.getInstance().previewTableData(wrapper, tabledata, parameterMap, rowCount); + return DataOperator.getInstance().previewTableData(TableDataSourceTailor.extractTableData(tableDataSource), tabledata, parameterMap, rowCount); } catch (Exception e) { throw new TableDataException(e.getMessage(), e); } finally { diff --git a/designer-base/src/test/java/com/fr/design/TableDatasourceTest.java b/designer-base/src/test/java/com/fr/design/TableDatasourceTest.java deleted file mode 100644 index ed6aa3657a..0000000000 --- a/designer-base/src/test/java/com/fr/design/TableDatasourceTest.java +++ /dev/null @@ -1,165 +0,0 @@ -package com.fr.design; - -import com.fr.base.AbstractTableData; -import com.fr.base.TableData; -import com.fr.cert.token.lang.Assert; -import com.fr.data.AbstractTableDataSource; -import com.fr.data.TableDataSource; -import com.fr.general.data.TableDataException; -import com.fr.script.Calculator; -import com.fr.stable.xml.XMLPrintWriter; -import com.fr.stable.xml.XMLableReader; -import com.fr.third.javax.xml.stream.XMLStreamException; -import junit.framework.TestCase; - -import java.io.ByteArrayOutputStream; -import java.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; - -public class TableDatasourceTest extends TestCase { - - public void testAbstractTableDataSourceReadAndWrite() throws XMLStreamException, TableDataException, UnsupportedEncodingException { - String xml = "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "7.nI9\\uimQ~\n" + - "]]>\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "9UT+>AM9kpGY!\\4\\SXO$EO1[i^/XKmIMmdu\n" + - "!\"Q5sC\"9Ji(qlAa_kVTnCC/+p:XVF.KGR?GMsmI)2\">1s>(/T71G7cFsfA\"UpjYr4R)A14-*\n" + - "qc6ri_1*%/XSsf!PM]ARc+ojE:eo:_gma!ut7eZ6BoFc2b5hu4@TUtuOT);aq6l4Vj\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "YfS3J$NPo=IB3AP?eiop.bk9Qu\n" + - "P:F\\.L&t$31~\n" + - "]]>\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "5++,D>0thk;G<`mPXn.b)QZb5j^mQri%8Ji5q\\\n" + - "\n" + - "\n"; - - AbstractTableDataSource source = new AbstractTableDataSource() { - }; - XMLableReader.createXMLableReader(xml).readXMLObject(source); - TableData tableData = source.getTableData("热销产品"); - Assert.notNull(tableData); - Assert.isTrue(tableData.createDataModel(Calculator.createCalculator()).getRowCount() == 4); - Assert.isTrue(tableData.createDataModel(Calculator.createCalculator()).getColumnCount() == 2); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - XMLPrintWriter writer = XMLPrintWriter.create(new OutputStreamWriter(out,"UTF-8")); - source.writeXML(writer); - writer.close(); - TableDataSource another = new AbstractTableDataSource(){}; - XMLableReader.createXMLableReader(new String(out.toByteArray(),"UTF-8")).readXMLObject(another); - tableData = another.getTableData("热销产品"); - Assert.notNull(tableData); - Assert.isTrue(tableData.createDataModel(Calculator.createCalculator()).getRowCount() == 4); - Assert.isTrue(tableData.createDataModel(Calculator.createCalculator()).getColumnCount() == 2); - } -} From bec9d231d82e7f8b233e59f9a3490a08b18ffcdd Mon Sep 17 00:00:00 2001 From: Harrison Date: Thu, 27 Dec 2018 14:54:11 +0800 Subject: [PATCH 86/93] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=B9=E7=AA=97=E5=A4=A7=E5=B0=8F=EF=BC=8C?= =?UTF-8?q?=E4=BB=A5=E9=80=82=E9=85=8D=E6=96=87=E5=AD=97=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/env/RemoteEnvPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d2953eeb6a..b0f3e9dd48 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -597,7 +597,7 @@ public class RemoteEnvPane extends BasicBeanPane { dialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(RemoteEnvPane.this), UIManager.getString("OptionPane.messageDialogTitle"), true); - dialog.setSize(new Dimension(268, 118)); + dialog.setSize(new Dimension(308, 132)); okButton.setEnabled(false); JPanel jp = new JPanel(); JPanel upPane = new JPanel(); From 1ec6b56501b6075a7b2969255946bfb1864167b2 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Sat, 29 Dec 2018 14:08:51 +0800 Subject: [PATCH 87/93] =?UTF-8?q?REPORT-13999=20=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E7=BC=96=E8=BE=91=E6=8F=92=E4=BB=B6=E5=85=BC?= =?UTF-8?q?=E5=AE=B9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/formula/FunctionConstants.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index eee75a2220..6e47237d83 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -12,7 +12,6 @@ import com.fr.function.RANGE; import com.fr.function.SUM; import com.fr.function.TIME; import com.fr.general.ComparatorUtils; - import com.fr.general.GeneralUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.ExtraClassManager; @@ -25,23 +24,28 @@ import com.fr.stable.fun.mark.Mutable; import com.fr.stable.script.Function; import com.fr.stable.script.FunctionDef; +import javax.swing.DefaultListModel; import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLDecoder; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.Enumeration; +import java.util.List; +import java.util.Set; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; -import javax.swing.DefaultListModel; - public final class FunctionConstants { public static FunctionGroup PLUGIN = getPluginFunctionGroup(); public static FunctionGroup CUSTOM = getCustomFunctionGroup(); - static NameAndFunctionList COMMON = getCommonFunctionList(); - static NameAndTypeAndFunctionList[] EMBFUNCTIONS = getEmbededFunctionListArray(); + public static NameAndFunctionList COMMON = getCommonFunctionList(); + public static NameAndTypeAndFunctionList[] EMBFUNCTIONS = getEmbededFunctionListArray(); public static FunctionGroup ALL = getAllFunctionGroup(); static { @@ -117,7 +121,7 @@ public final class FunctionConstants { * 将函数分组插件中的函数添加到对应的列表中 * @param listModel */ - static void addFunctionGroupFromPlugins(DefaultListModel listModel){ + public static void addFunctionGroupFromPlugins(DefaultListModel listModel){ //hugh:自定义函数分组 Set containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); if(!containers.isEmpty()){ From cdcf8aedc2c02439cd53c76318bfe953a233fc00 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Wed, 2 Jan 2019 16:35:42 +0800 Subject: [PATCH 88/93] =?UTF-8?q?=E5=90=88=E5=B9=B6=E5=8F=91=E9=80=81?= =?UTF-8?q?=EF=BC=8C=E5=8E=BB=E9=87=8D=EF=BC=9B=20=E6=AF=8F=E6=AC=A1query?= =?UTF-8?q?=20200=E6=9D=A1=EF=BC=8C=E6=94=BE=E5=85=A5=E5=86=85=E5=AD=98?= =?UTF-8?q?=EF=BC=8C=E5=8F=91=E9=80=81=E6=88=90=E5=8A=9F=E5=86=8D=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E6=96=B0=E7=9A=84=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 187 ++++++++++-------- 1 file changed, 106 insertions(+), 81 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 61b583c615..e6ef66e005 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -89,11 +89,15 @@ public class InformationCollector implements XMLReadable, XMLWriter { private static final String ATTR_TEXT = "text"; private static final String ATTR_SOURCE = "source"; private static final String ATTR_TIME = "time"; + private static final String ATTR_TIMES = "times"; private static final String ATTR_TITLE = "title"; private static final String ATTR_USER_NAME = "username"; private static final String ATTR_UUID = "uuid"; + private static final String ATTR_ITEMS = "items"; private static final String ATTR_FUNCTION_ARRAY = "functionArray"; private static final int MAX_EACH_REQUEST_RECORD_COUNT = 200; + private static final int PAGE_SIZE = 200; + private long totalCount = -1; private static InformationCollector collector; @@ -214,24 +218,17 @@ public class InformationCollector implements XMLReadable, XMLWriter { if (currentTime - lastTime <= DELTA) { return; } - JSONArray content = getFunctionsContent(currentTime, lastTime); - boolean success = false; + boolean success; FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); - String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); - try { - for(int i=0;i 0){ - success = sendFunctionRecord(url, functionArray); - } - } - //服务器返回true, 说明已经获取成功, 更新最后一次发送时间 - if (success) { - this.lastTime = dateToString(); - FineLoggerFactory.getLogger().info("Function records successfully sent to the cloud center."); - } - }catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + success = queryAndSendOnePageFunctionContent(currentTime, lastTime, 0); + long page = (totalCount/PAGE_SIZE) + 1; + for(int i=1; i focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); + //第一次查询获取总记录数 + if(page == 0){ + totalCount = focusPoints.getTotalCount(); + } + return sendThisPageFunctionContent(focusPoints); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return false; + } + + private boolean sendThisPageFunctionContent(DataList focusPoints) { + String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); + try { + JSONObject jsonObject = dealWithSendFunctionContent(focusPoints); + return sendFunctionRecord(url, jsonObject); + } catch (JSONException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return false; + } + + private JSONObject dealWithSendFunctionContent(DataList focusPoints) throws JSONException { + JSONObject jsonObject = new JSONObject(); + Map map = new HashMap<>(); + if(!focusPoints.isEmpty()){ + DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); + String bbsUserName = MarketConfig.getInstance().getBbsUsername(); + String uuid = envManager.getUUID(); + jsonObject.put(ATTR_UUID, uuid); + jsonObject.put(ATTR_USER_NAME, bbsUserName); + for(FocusPoint focusPoint : focusPoints.getList()) { + FunctionRecord functionRecord = getOneRecord(focusPoint); + if (map.containsKey(focusPoint.getId())) { + functionRecord.setTimes(functionRecord.getTimes() + 1); + map.put(focusPoint.getId(), functionRecord); + } else { + map.put(focusPoint.getId(), functionRecord); + } + } + jsonObject.put(ATTR_ITEMS, mapToJSONArray(map)); + } + return jsonObject; + } + + private JSONArray mapToJSONArray(Map map) throws JSONException { + JSONArray jsonArray = new JSONArray(); + for(String keys : map.keySet()){ + FunctionRecord functionRecord = (FunctionRecord)map.get(keys); + JSONObject jo = new JSONObject(); + jo.put(ATTR_ID, functionRecord.getId()); + jo.put(ATTR_TEXT, functionRecord.getText()); + jo.put(ATTR_SOURCE, functionRecord.getSource()); + jo.put(ATTR_TIME, functionRecord.getTime()); + jo.put(ATTR_TITLE, functionRecord.getTitle()); + jo.put(ATTR_TIMES, functionRecord.getTimes()); + jsonArray.put(jo); + } + return jsonArray; + } + + private boolean sendFunctionRecord(String url, JSONObject record) { boolean success = false; try { HashMap para = new HashMap<>(); @@ -266,6 +333,18 @@ public class InformationCollector implements XMLReadable, XMLWriter { return success; } + private FunctionRecord getOneRecord(FocusPoint focusPoint) { + FunctionRecord functionRecord = new FunctionRecord(); + functionRecord.setId(focusPoint.getId() == null?StringUtils.EMPTY : focusPoint.getId()); + functionRecord.setText(focusPoint.getText() == null?StringUtils.EMPTY : focusPoint.getText()); + functionRecord.setSource(focusPoint.getSource()); + functionRecord.setTime(focusPoint.getTime().getTime()); + functionRecord.setTitle(focusPoint.getTitle() == null?StringUtils.EMPTY : focusPoint.getTitle()); + functionRecord.setUsername(MarketConfig.getInstance().getBbsUsername() == null?StringUtils.EMPTY : MarketConfig.getInstance().getBbsUsername()); + functionRecord.setUuid(DesignerEnvManager.getEnvManager().getUUID() == null?StringUtils.EMPTY : DesignerEnvManager.getEnvManager().getUUID()); + return functionRecord; + } + /** * 收集开始使用时间,发送信息 */ @@ -426,69 +505,6 @@ public class InformationCollector implements XMLReadable, XMLWriter { }); } - public JSONArray getFunctionsContent(long current, long last) { - //记录当前条数,达到200条合并成一个请求 - int count = 0; - JSONArray functionArray = new JSONArray(); - QueryCondition condition = QueryFactory.create() - .addRestriction(RestrictionFactory.lte(COLUMN_TIME, current)) - .addRestriction(RestrictionFactory.gte(COLUMN_TIME, last)); - try { - DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); - TreeSet focusPointsList = new TreeSet<>(); - if(!focusPoints.isEmpty()){ - for(int i=0;i< focusPoints.getList().size();i++){ - FocusPoint focusPoint = focusPoints.getList().get(i); - if(focusPoint != null){ - if((++count <= MAX_EACH_REQUEST_RECORD_COUNT)){ - focusPointsList.add(getOneRecord(focusPoint)); - } else { - count = 0; - functionArray.put(setToJSONArray(focusPointsList)); - focusPointsList.add(getOneRecord(focusPoint)); - } - if(i == (focusPoints.getList().size() -1)){ - functionArray.put(setToJSONArray(focusPointsList)); - } - } - } - } - - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - return functionArray; - } - - private FunctionRecord getOneRecord(FocusPoint focusPoint) { - FunctionRecord functionRecord = new FunctionRecord(); - functionRecord.setId(focusPoint.getId() == null?StringUtils.EMPTY : focusPoint.getId()); - functionRecord.setText(focusPoint.getText() == null?StringUtils.EMPTY : focusPoint.getText()); - functionRecord.setSource(focusPoint.getSource()); - functionRecord.setTime(focusPoint.getTime().getTime()); - functionRecord.setTitle(focusPoint.getTitle() == null?StringUtils.EMPTY : focusPoint.getTitle()); - functionRecord.setUsername(MarketConfig.getInstance().getBbsUsername() == null?StringUtils.EMPTY : MarketConfig.getInstance().getBbsUsername()); - functionRecord.setUuid(DesignerEnvManager.getEnvManager().getUUID() == null?StringUtils.EMPTY : DesignerEnvManager.getEnvManager().getUUID()); - return functionRecord; - } - - private JSONArray setToJSONArray(Set set) throws JSONException { - JSONArray jsonArray = new JSONArray(); - for(Iterator iter = set.iterator(); iter.hasNext(); ) { - FunctionRecord functionRecord = (FunctionRecord)iter.next(); - com.fr.json.JSONObject record = new com.fr.json.JSONObject(); - record.put(ATTR_ID, functionRecord.getId()); - record.put(ATTR_TEXT, functionRecord.getText()); - record.put(ATTR_SOURCE, functionRecord.getSource()); - record.put(ATTR_TIME, functionRecord.getTime()); - record.put(ATTR_TITLE, functionRecord.getTitle()); - record.put(ATTR_USER_NAME, functionRecord.getUsername()); - record.put(ATTR_UUID, functionRecord.getUuid()); - jsonArray.put(record); - } - return jsonArray; - } - private class StartStopTime implements XMLReadable, XMLWriter { private String startDate; @@ -533,6 +549,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { private String text; private int source; private long time; + private int times = 1; private String title; private String username; private String uuid; @@ -548,6 +565,14 @@ public class InformationCollector implements XMLReadable, XMLWriter { this.id = id; } + public int getTimes() { + return times; + } + + public void setTimes(int times) { + this.times = times; + } + public String getText() { return text; } From 53750e77c5aa2af106de0bf2532b0febd08f4645 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Wed, 2 Jan 2019 17:00:09 +0800 Subject: [PATCH 89/93] =?UTF-8?q?=E6=AF=8F=E9=A1=B5=E5=8F=91=E9=80=81?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E5=90=8E=E6=9B=B4=E6=96=B0=E4=B8=8B=E6=9C=80?= =?UTF-8?q?=E5=90=8E=E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index e6ef66e005..49ad7d6a37 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -218,19 +218,14 @@ public class InformationCollector implements XMLReadable, XMLWriter { if (currentTime - lastTime <= DELTA) { return; } - boolean success; FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); - success = queryAndSendOnePageFunctionContent(currentTime, lastTime, 0); + queryAndSendOnePageFunctionContent(currentTime, lastTime, 0); long page = (totalCount/PAGE_SIZE) + 1; for(int i=1; i focusPoints) { + private void sendThisPageFunctionContent(DataList focusPoints) { String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); try { JSONObject jsonObject = dealWithSendFunctionContent(focusPoints); - return sendFunctionRecord(url, jsonObject); + sendFunctionRecord(url, jsonObject); } catch (JSONException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } - return false; } private JSONObject dealWithSendFunctionContent(DataList focusPoints) throws JSONException { @@ -319,7 +312,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { return jsonArray; } - private boolean sendFunctionRecord(String url, JSONObject record) { + private void sendFunctionRecord(String url, JSONObject record) { boolean success = false; try { HashMap para = new HashMap<>(); @@ -327,10 +320,14 @@ public class InformationCollector implements XMLReadable, XMLWriter { para.put("content", record); String res = HttpToolbox.post(url, para); success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); + if (success) { + this.lastTime = dateToString(); + } else { + FineLoggerFactory.getLogger().error("Error occured when sent function records to the cloud center."); + } } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } - return success; } private FunctionRecord getOneRecord(FocusPoint focusPoint) { From 2c7094d2986e65302e0e66dde92df666cb2d6989 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Wed, 2 Jan 2019 18:33:56 +0800 Subject: [PATCH 90/93] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=AC=A1=E6=95=B0bugfi?= =?UTF-8?q?x?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/InformationCollector.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 49ad7d6a37..b71144774d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -285,7 +285,8 @@ public class InformationCollector implements XMLReadable, XMLWriter { for(FocusPoint focusPoint : focusPoints.getList()) { FunctionRecord functionRecord = getOneRecord(focusPoint); if (map.containsKey(focusPoint.getId())) { - functionRecord.setTimes(functionRecord.getTimes() + 1); + int times = ((FunctionRecord)map.get(focusPoint.getId())).getTimes() + 1; + functionRecord.setTimes(times); map.put(focusPoint.getId(), functionRecord); } else { map.put(focusPoint.getId(), functionRecord); From afd800e1bba05accb36f05ce71ec70049a3ca5e0 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 2 Jan 2019 19:00:12 +0800 Subject: [PATCH 91/93] =?UTF-8?q?REPORT-14020=20=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=89=93=E5=BC=80=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=20=E8=B0=83=E8=AF=95=E7=9A=84=E4=BB=A3=E7=A0=81=E4=B8=8A?= =?UTF-8?q?=E6=AC=A1=E8=AF=AF=E4=BC=A0=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/utils/DesignUtils.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index 77173cebb5..240176eef7 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -65,12 +65,12 @@ public class DesignUtils { * @return 启动了返回true */ public static boolean isStarted() { -// try { -// new Socket("localhost", port); -// return true; -// } catch (Exception exp) { -// -// } + try { + new Socket("localhost", port); + return true; + } catch (Exception exp) { + + } return false; } From b6544331ed31b0484ed1dddc7c514b653c17d64d Mon Sep 17 00:00:00 2001 From: Hades Date: Thu, 3 Jan 2019 19:16:01 +0800 Subject: [PATCH 92/93] =?UTF-8?q?REPORT-12555=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E9=87=8D=E5=91=BD=E5=90=8DBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/DesignerFrameFileDealerPane.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index d607352574..cef5c86a08 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -428,8 +428,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt String oldName = fnf.getName(); String suffix = fnf.isDirectory() ? StringUtils.EMPTY : oldName.substring(oldName.lastIndexOf(CoreConstants.DOT), oldName.length()); - oldName = oldName.replaceAll(suffix, StringUtils.EMPTY); - + oldName = oldName.replace(suffix, StringUtils.EMPTY); this.setLayout(new BorderLayout()); this.setModal(true); From fb9d2f9644026bec56d3fc89259c79873f530aa6 Mon Sep 17 00:00:00 2001 From: richie Date: Thu, 3 Jan 2019 21:34:45 +0800 Subject: [PATCH 93/93] =?UTF-8?q?KERNEL-216=20JSON=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E6=94=B9=E4=B8=BAjackson=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/extra/PluginWebBridge.java | 4 +-- .../design/extra/PluginsReaderFromStore.java | 2 +- .../designer/mobile/ParaMobileDefinePane.java | 2 +- .../mainframe/InformationCollector.java | 26 ++++++++----------- .../alphafine/cell/model/ActionModel.java | 10 +++---- .../alphafine/cell/model/DocumentModel.java | 10 +++---- .../alphafine/cell/model/FileModel.java | 10 +++---- .../alphafine/cell/model/PluginModel.java | 11 +++----- .../alphafine/cell/model/RobotModel.java | 12 +++------ .../alphafine/component/AlphaFineDialog.java | 6 +---- .../manager/impl/DocumentSearchManager.java | 4 +-- .../manager/impl/PluginSearchManager.java | 8 ++---- .../design/mainframe/errorinfo/ErrorInfo.java | 18 +++++-------- 13 files changed, 42 insertions(+), 81 deletions(-) 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 903418ec93..02a51ad3f2 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 @@ -104,7 +104,7 @@ public class PluginWebBridge { for (String key : keySet) { jsonObject.put(key, config.get(key).toString()); } - } catch (JSONException e) { + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } return jsonObject.toString(); @@ -349,7 +349,7 @@ public class PluginWebBridge { try { Task task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(new JSONObject(info))); threadPoolExecutor.submit(task); - } catch (JSONException e) { + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginsReaderFromStore.java b/designer-base/src/main/java/com/fr/design/extra/PluginsReaderFromStore.java index 8895e83e45..66341be1a2 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginsReaderFromStore.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginsReaderFromStore.java @@ -74,7 +74,7 @@ public class PluginsReaderFromStore { plugins.add(pluginView); } } - } catch (JSONException e) { + } catch (Exception e) { throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Read_Plugin_List_Error")); } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java index 7e0f3b940a..b0473f8fac 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java @@ -218,7 +218,7 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { break; } } - } catch (JSONException e) { + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } paramLocationComboBox.setSelectedIndex(index); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index b71144774d..37f86172ea 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -168,21 +168,17 @@ public class InformationCollector implements XMLReadable, XMLWriter { JSONArray startStopArray = new JSONArray(); for (int i = 0; i < startStop.size(); i++) { JSONObject jo = new JSONObject(); - try { - jo.put(ATTR_START, startStop.get(i).getStartDate()); - jo.put(ATTR_STOP, startStop.get(i).getStopDate()); - startStopArray.put(jo); - DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); - content.put(XML_START_STOP, startStopArray); - content.put(XML_UUID, envManager.getUUID()); - content.put(XML_JAR, GeneralUtils.readBuildNO()); - content.put(XML_VERSION, ProductConstants.RELEASE_VERSION); - content.put(XML_USERNAME, MarketConfig.getInstance().getBbsUsername()); - content.put(XML_KEY, envManager.getActivationKey()); - content.put(XML_OS, System.getProperty("os.name")); - } catch (JSONException e) { - FRContext.getLogger().error(e.getMessage(), e); - } + jo.put(ATTR_START, startStop.get(i).getStartDate()); + jo.put(ATTR_STOP, startStop.get(i).getStopDate()); + startStopArray.put(jo); + DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); + content.put(XML_START_STOP, startStopArray); + content.put(XML_UUID, envManager.getUUID()); + content.put(XML_JAR, GeneralUtils.readBuildNO()); + content.put(XML_VERSION, ProductConstants.RELEASE_VERSION); + content.put(XML_USERNAME, MarketConfig.getInstance().getBbsUsername()); + content.put(XML_KEY, envManager.getActivationKey()); + content.put(XML_OS, System.getProperty("os.name")); } return content; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java index cd878af5a4..832575febe 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java @@ -53,13 +53,9 @@ public class ActionModel extends AlphaCellModel { @Override public JSONObject modelToJson() { JSONObject object = JSONObject.create(); - try { - JSONObject modelObject = JSONObject.create(); - modelObject.put("className", getAction().getClass().getName()).put("searchCount", getSearchCount()); - object.put("result", modelObject).put("cellType", getType().getTypeValue()); - } catch (JSONException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + JSONObject modelObject = JSONObject.create(); + modelObject.put("className", getAction().getClass().getName()).put("searchCount", getSearchCount()); + object.put("result", modelObject).put("cellType", getType().getTypeValue()); return object; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java index e149229796..2c608537c0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java @@ -42,13 +42,9 @@ public class DocumentModel extends AlphaCellModel { @Override public JSONObject modelToJson() { JSONObject object = JSONObject.create(); - try { - JSONObject modelObject = JSONObject.create(); - modelObject.put("title", getName()).put("summary", getContent()).put("did", getDocumentId()).put("searchCount", getSearchCount()); - object.put("result", modelObject).put("cellType", getType().getTypeValue()); - } catch (JSONException e) { - FineLoggerFactory.getLogger().error("DocumentModel: " + e.getMessage()); - } + JSONObject modelObject = JSONObject.create(); + modelObject.put("title", getName()).put("summary", getContent()).put("did", getDocumentId()).put("searchCount", getSearchCount()); + object.put("result", modelObject).put("cellType", getType().getTypeValue()); return object; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/FileModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/FileModel.java index 28c60bb5e4..7541526ba1 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/FileModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/FileModel.java @@ -37,13 +37,9 @@ public class FileModel extends AlphaCellModel { @Override public JSONObject modelToJson() { JSONObject object = JSONObject.create(); - try { - JSONObject modelObject = JSONObject.create(); - modelObject.put("filePath", getFilePath()).put("searchCount", getSearchCount()); - object.put("result", modelObject).put("cellType", getType().getTypeValue()); - } catch (JSONException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + JSONObject modelObject = JSONObject.create(); + modelObject.put("filePath", getFilePath()).put("searchCount", getSearchCount()); + object.put("result", modelObject).put("cellType", getType().getTypeValue()); return object; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java index 119d2991bd..84ea70c05c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java @@ -87,14 +87,9 @@ public class PluginModel extends AlphaCellModel { @Override public JSONObject modelToJson() { JSONObject object = JSONObject.create(); - try { - JSONObject modelObject = JSONObject.create(); - modelObject.put("name", getName()).put("description", getContent()).put("pic", getImageUrl()).put("version", getVersion()).put("jartime", getJartime()).put("id", getId()).put("pluginid", getPluginId()).put("type", getType().getTypeValue()).put("price", getPrice()).put("link", getLink()).put("searchCount", getSearchCount()); - object.put("result", modelObject).put("cellType", getType().getTypeValue()); - } catch (JSONException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - + JSONObject modelObject = JSONObject.create(); + modelObject.put("name", getName()).put("description", getContent()).put("pic", getImageUrl()).put("version", getVersion()).put("jartime", getJartime()).put("id", getId()).put("pluginid", getPluginId()).put("type", getType().getTypeValue()).put("price", getPrice()).put("link", getLink()).put("searchCount", getSearchCount()); + object.put("result", modelObject).put("cellType", getType().getTypeValue()); return object; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java index cb159745fb..d44a9402f6 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java @@ -55,7 +55,7 @@ public class RobotModel extends AlphaCellModel { } JSONObject jsonObject = new JSONObject(result); return jsonObject.optString("msg"); - } catch (JSONException | IOException e) { + } catch (Exception e) { FineLoggerFactory.getLogger().error("get robotmodel content error: " + e.getMessage()); } return null; @@ -69,13 +69,9 @@ public class RobotModel extends AlphaCellModel { @Override public JSONObject modelToJson() throws JSONException { JSONObject object = JSONObject.create(); - try { - JSONObject modelObject = JSONObject.create(); - modelObject.put("title", getTitle()).put("content", getContent()).put("searchCount", getSearchCount()); - object.put("result", modelObject).put("cellType", getType().getTypeValue()); - } catch (JSONException e) { - FineLoggerFactory.getLogger().error("RobotModel: " + e.getMessage()); - } + JSONObject modelObject = JSONObject.create(); + modelObject.put("title", getTitle()).put("content", getContent()).put("searchCount", getSearchCount()); + object.put("result", modelObject).put("cellType", getType().getTypeValue()); return object; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 6310a22331..49f8570147 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -976,11 +976,7 @@ public class AlphaFineDialog extends UIDialog { int resultKind = cellModel.getType().getTypeValue(); String resultValue = CellModelHelper.getResultValueFromModel(cellModel); JSONObject object = JSONObject.create(); - try { - object.put("uuid", uuid).put("activityKey", activityKey).put("username", username).put("createTime", createTime).put("key", key).put("resultKind", resultKind).put("resultValue", resultValue); - } catch (JSONException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + object.put("uuid", uuid).put("activityKey", activityKey).put("username", username).put("createTime", createTime).put("key", key).put("resultKind", resultKind).put("resultValue", resultValue); final HashMap para = new HashMap<>(); String date = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime()); para.put("token", CodeUtils.md5Encode(date, StringUtils.EMPTY, "MD5")); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java index b5b517c1c1..216c7e9db7 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java @@ -81,10 +81,8 @@ public class DocumentSearchManager implements AlphaFineSearchProvider { } } } - } catch (JSONException e) { + } catch (Exception e) { FineLoggerFactory.getLogger().error("document search error: " + e.getMessage()); - } catch (IOException e) { - FineLoggerFactory.getLogger().error("document search get result error: " + e.getMessage()); } } lessModelList.clear(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java index 826aa7db22..ddd3bc0fcb 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java @@ -126,12 +126,8 @@ public class PluginSearchManager implements AlphaFineSearchProvider { } } } - } catch (JSONException e) { - FineLoggerFactory.getLogger().error("plugin search json error :" + e.getMessage()); - } catch (UnsupportedEncodingException e) { - FineLoggerFactory.getLogger().error("plugin search encode error :" + e.getMessage()); - } catch (IOException e) { - FineLoggerFactory.getLogger().error("plugin search get result error :" + e.getMessage()); + } catch (Exception e) { + FineLoggerFactory.getLogger().error("plugin search error :" + e.getMessage()); } } if (searchResult.isEmpty()) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java b/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java index c101706496..052aaef9fe 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java @@ -100,17 +100,13 @@ public class ErrorInfo { */ public void saveAsJSON(){ JSONObject jo = JSONObject.create(); - try { - jo.put("username", username); - jo.put("uuid", uuid); - jo.put("activekey", activekey); - jo.put("templateid", templateid); - jo.put("uploadtime", uploadtime); - jo.put("logid", logid); - jo.put("log", log); - } catch (JSONException ignore) { - } - + jo.put("username", username); + jo.put("uuid", uuid); + jo.put("activekey", activekey); + jo.put("templateid", templateid); + jo.put("uploadtime", uploadtime); + jo.put("logid", logid); + jo.put("log", log); saveFileToCache(jo); }