From eed4bb0b508e777fde72a0bc45a059b07bcf3c4e Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 9 Jan 2020 09:40:39 +0800 Subject: [PATCH 01/30] =?UTF-8?q?MOBILE-24962=20=E9=9D=9E=E6=89=8B?= =?UTF-8?q?=E6=9C=BA=E9=87=8D=E5=B8=83=E5=B1=80=E4=B8=8B=20=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/designer/mobile/BodyMobileDefinePane.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java index 3b8367b15..8327fc1ab 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java @@ -115,8 +115,9 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane { boolean flag = !shouldHidePadding(designer); advancePane.setVisible(flag); layoutPane.setVisible(flag); - frozenPane.setVisible(appRelayoutCheck.isSelected()); - bookMarkSettingPane.setVisible(appRelayoutCheck.isSelected()); + boolean appRelayout = FormDesignerUtils.isAppRelayout(designer); + frozenPane.setVisible(appRelayout); + bookMarkSettingPane.setVisible(appRelayout); return holder; } @@ -172,6 +173,7 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane { advancePane.setVisible(appPaddingVisible); layoutPane.setVisible(appPaddingVisible); frozenPane.setVisible(appRelayout); + bookMarkSettingPane.setVisible(appRelayout); mobileWidgetListPane.updateToDesigner(); designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); From 1b188a0485d5074dcfb09d13f2eaed50fed656b2 Mon Sep 17 00:00:00 2001 From: lucian Date: Thu, 9 Jan 2020 11:32:28 +0800 Subject: [PATCH 02/30] =?UTF-8?q?REPORT-26199=20=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E9=9B=86=E6=88=90-=E8=BF=9C=E7=A8=8B-=E5=90=AF=E7=94=A8https?= 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 | 3 +++ 1 file changed, 3 insertions(+) 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 20f698a3f..56a805dde 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -220,6 +220,9 @@ public class RemoteEnvPane extends BasicBeanPane { updateHttpsConfigPanel(); remoteWorkspaceURL.setHttps(isHttps); + // reset下url,将勾选状态是否htpps加到url里 + remoteWorkspaceURL.resetUrl(); + fillRemoteEnvURLField(); fillIndividualField(); } From 9d3100c36c059aaaaee8085f26b4b037d3d65bc8 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 9 Jan 2020 11:48:59 +0800 Subject: [PATCH 03/30] =?UTF-8?q?MOBILE-24940=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E5=B1=9E=E6=80=A7=E5=8B=BE=E9=80=89=E5=8F=8C=E6=8C=87?= =?UTF-8?q?=E7=BC=A9=E6=94=BE=E5=90=8E=20=20=E5=B8=83=E5=B1=80=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E8=87=AA=E5=8A=A8=E6=94=B9=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/actions/FormMobileAttrAction.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 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 d77078fad..b59879c97 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 @@ -77,8 +77,10 @@ public class FormMobileAttrAction extends JTemplateAction { formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后 ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); jf.getFormDesign().getSelectionModel().setSelectedCreator(jf.getFormDesign().getRootComponent()); - //改变布局为自适应布局,只在移动端属性设置保存后改变一次 - doChangeBodyLayout(); + //当自适应属性自动匹配处于勾选状态 进行切换 + if (formMobileAttr.isAdaptivePropertyAutoMatch()) { + doChangeBodyLayout(); + } WidgetPropertyPane.getInstance().refreshDockingView(); jf.fireTargetModified(); From 293d1e96755afcd5066acc63ba852dda1cad442e Mon Sep 17 00:00:00 2001 From: rinoux Date: Thu, 9 Jan 2020 17:12:11 +0800 Subject: [PATCH 04/30] =?UTF-8?q?REPORT-25986=20=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=B8=80=E4=B8=8B=E8=B5=84=E6=BA=90=E6=A0=B9=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=EF=BC=8C=E5=90=A6=E5=88=99=E6=97=A0=E6=B3=95=E9=80=9A=E8=BF=87?= =?UTF-8?q?ServletContext.getResource=E8=AF=BB=E5=88=B0=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/start/server/FineEmbedServerActivator.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java index 12aebd231..a67b7e55a 100644 --- a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java +++ b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java @@ -1,6 +1,5 @@ package com.fr.start.server; -import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.log.FineLoggerFactory; import com.fr.module.Activator; @@ -15,6 +14,7 @@ import org.apache.catalina.Context; import org.apache.catalina.LifecycleException; import org.apache.catalina.loader.WebappLoader; import org.apache.catalina.startup.Tomcat; +import org.apache.catalina.webresources.StandardRoot; import java.io.File; import java.util.HashSet; @@ -63,10 +63,11 @@ public class FineEmbedServerActivator extends Activator { // 设置解码uri使用的字符编码 tomcat.getConnector().setURIEncoding(EncodeConstants.ENCODING_UTF_8); String docBase = new File(WorkContext.getCurrent().getPath()).getParent(); - //内置的上下文是自己定的,这里把WEB_APP_NAME一并设置了,否则下面appName是/null - ProductConstants.setWebAppName(ProductConstants.getAppFolderName()); - String appName = "/" + FRContext.getCommonOperator().getAppName(); - Context context = tomcat.addContext(appName, docBase); + + //内置的上下文使用工程目录比如webroot + String contextPath = "/" + ProductConstants.getAppFolderName(); + final Context context = tomcat.addContext(contextPath, docBase); + context.setResources(new StandardRoot(context)); Tomcat.initWebappDefaults(context); //覆盖tomcat的WebAppClassLoader context.setLoader(new FRTomcatLoader()); From 41b3c1ef126112de0138f0932e16b38c68c918fd Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 10 Jan 2020 11:22:04 +0800 Subject: [PATCH 05/30] =?UTF-8?q?MOBILE-25000=20=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E9=81=97=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/actions/FormMobileAttrAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java index b59879c97..c6f64c498 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 @@ -78,7 +78,7 @@ public class FormMobileAttrAction extends JTemplateAction { ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); jf.getFormDesign().getSelectionModel().setSelectedCreator(jf.getFormDesign().getRootComponent()); //当自适应属性自动匹配处于勾选状态 进行切换 - if (formMobileAttr.isAdaptivePropertyAutoMatch()) { + if (formMobileAttr.isMobileOnly() && formMobileAttr.isAdaptivePropertyAutoMatch()) { doChangeBodyLayout(); } From 268d569545c12dcf6612045e1148105ad1993f34 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 13 Jan 2020 13:45:46 +0800 Subject: [PATCH 06/30] =?UTF-8?q?REPORT-26085=20=E5=9C=A8=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E9=9D=A2=E6=9D=BF=E6=B7=BB=E5=8A=A0=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=9A=84=E5=85=A8=E5=B1=80=E5=8F=82=E6=95=B0=EF=BC=8C=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E5=8F=82=E6=95=B0=E6=8E=A7=E4=BB=B6=E4=BC=9A=E9=87=8D?= =?UTF-8?q?=E5=8F=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/parameter/ParameterDefinitePane.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java b/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java index 168f65ece..ea78f568f 100644 --- a/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java +++ b/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java @@ -4,6 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.base.Parameter; import com.fr.base.parameter.ParameterUI; import com.fr.base.vcs.DesignerMode; +import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.actions.AllowAuthorityEditAction; import com.fr.design.actions.ExitAuthorityEditAction; @@ -326,7 +327,8 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus } private boolean isWithoutParaXCreator() { - return paraDesignEditor.isWithoutParaXCreator(allParameters); + // allParameters只包含全部的模板参数 + return paraDesignEditor.isWithoutParaXCreator(DesignModelAdapter.getCurrentModelAdapter().getParameters()); } /** From 5433e90036069c4d51d2e6fd2098edfaac5d27e7 Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 13 Jan 2020 14:20:58 +0800 Subject: [PATCH 07/30] =?UTF-8?q?REPORT-26263=20=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E7=9B=AE=E5=BD=95=E5=88=B0tomcat=EF=BC=8C?= =?UTF-8?q?=E6=94=BE=E7=BD=AE=E4=B8=80=E6=AE=B5=E6=97=B6=E9=97=B4=E5=88=87?= =?UTF-8?q?=E5=9B=9E=E6=9C=AC=E5=9C=B0=EF=BC=8C=E5=87=BA=E7=8E=B0=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=A4=B1=E8=B4=A5=E7=9A=84=E5=BC=B9=E7=AA=97=EF=BC=8C?= =?UTF-8?q?=E5=AE=9E=E9=99=85=E5=88=87=E6=8D=A2=E6=88=90=E5=8A=9F=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20npe=20=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/JForm.java | 8 ++++++-- .../com/fr/design/mainframe/JFormTest.java | 20 +++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 designer-form/src/test/java/com/fr/design/mainframe/JFormTest.java 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 a5b76e1fc..ab19002c1 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 @@ -543,8 +543,12 @@ public class JForm extends JTemplate implements BaseJForm Date: Tue, 14 Jan 2020 12:24:50 +0800 Subject: [PATCH 08/30] =?UTF-8?q?REPORT-26432=2010.0.4=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=B8=AD=E6=B2=A1=E6=9C=89sheet=E5=8F=AF=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/ElementCasePane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 27f336821..85dbd4eb3 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 @@ -80,6 +80,7 @@ import com.fr.design.selection.QuickEditor; import com.fr.design.selection.Selectedable; import com.fr.design.selection.SelectionEvent; import com.fr.design.selection.SelectionListener; +import com.fr.design.ui.util.UIUtil; import com.fr.general.ComparatorUtils; import com.fr.grid.Grid; import com.fr.grid.GridColumn; @@ -117,7 +118,6 @@ import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollBar; import javax.swing.KeyStroke; -import javax.swing.SwingUtilities; import java.awt.AWTEvent; import java.awt.Adjustable; import java.awt.Dimension; @@ -857,7 +857,7 @@ public abstract class ElementCasePane extends Tar // Guaranteed to return a non-null array final Object[] listeners = listenerList.getListenerList(); - SwingUtilities.invokeLater(new Runnable() { + UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { // Process the listeners last to first, notifying From 42d5374cf057c5ad2a572527622ff401e7531642 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 14 Jan 2020 15:05:02 +0800 Subject: [PATCH 09/30] =?UTF-8?q?MOBILE-24587=20=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E4=B8=8D=E5=BF=85=E8=A6=81=E7=9A=84=E6=8F=90=E7=A4=BA=20&&=20?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=8B=BE=E9=80=89=E6=97=B6=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/mobile/MobileAdvanceDefinePane.java | 3 +++ .../component/MobileComponentFrozenPane.java | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java index c74e7c7d0..9533e552c 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java @@ -139,6 +139,9 @@ public class MobileAdvanceDefinePane extends MobileWidgetDefinePane { MobileBookMark bookMark = xCreator.toData().getMobileBookMark(); bookMark.setUseBookMark(this.useBookMarkCheck.isSelected()); String newBookMarkName = this.bookMarkNameField.getText(); + if (ComparatorUtils.equals(newBookMarkName, bookMark.getBookMarkName())) { + return; + } if (!isExist(newBookMarkName)) { bookMark.setBookMarkName(newBookMarkName); } else { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java index da6c617c1..249265097 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java @@ -64,18 +64,26 @@ public class MobileComponentFrozenPane extends BasicPane { public void update(XCreator xCreator) { List selected = new ArrayList<>(); WSortLayout wSortLayout = ((WSortLayout) xCreator.toData()); + List all = wSortLayout.getNonContainerWidgetList(); + for (String widgetName : all) { + updateMobileBookMark(wSortLayout, widgetName, false); + } Object[] values = uiComboCheckBox.getSelectedValues(); for (Object value : values) { String widgetName = (String) value; selected.add(widgetName); - Widget widget = FormWidgetHelper.findWidgetWithBound(wSortLayout, widgetName); - if (widget != null) { - widget.getMobileBookMark().setFrozen(true); - } + updateMobileBookMark(wSortLayout, widgetName, true); } wSortLayout.updateFrozenWidgets(selected); } + private void updateMobileBookMark(WSortLayout wSortLayout, String widgetName, boolean frozen) { + Widget widget = FormWidgetHelper.findWidgetWithBound(wSortLayout, widgetName); + if (widget != null) { + widget.getMobileBookMark().setFrozen(frozen); + } + } + public void populate(XCreator xCreator) { WSortLayout wSortLayout = ((WSortLayout) xCreator.toData()); List all = wSortLayout.getNonContainerWidgetList(); From 96630f3992f63734f363b81e87a62b9aca39b2c3 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 15 Jan 2020 11:00:07 +0800 Subject: [PATCH 10/30] =?UTF-8?q?REPORT-26492=20=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E7=A0=81=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/present/BarCodePane.java | 68 ++++++++++--------- 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/present/BarCodePane.java b/designer-realize/src/main/java/com/fr/design/present/BarCodePane.java index 029f7e9c8..b0df938db 100644 --- a/designer-realize/src/main/java/com/fr/design/present/BarCodePane.java +++ b/designer-realize/src/main/java/com/fr/design/present/BarCodePane.java @@ -48,17 +48,17 @@ public class BarCodePane extends FurtherBasicBeanPane { private UIComboBox typeComboBox; private UISpinner barWidthSpinner; private UISpinner barHeightSpinner; - private UISpinner RCodesizespinner; + private UISpinner sizeSpinner; private UICheckBox drawingTextCheckBox; - private UIComboBox RCodeVersionComboBox; - private UIComboBox RCodeErrorCorrectComboBox; + private UIComboBox versionComboBox; + private UIComboBox errorCorrectComboBox; private UILabel typeSetLabel; private String testText = "12345"; public BarCodePane() { this.initComponents(); - addlistener(); + addListener(); } private void initComponents() { @@ -73,9 +73,9 @@ public class BarCodePane extends FurtherBasicBeanPane { borderPane.add(barCodePreviewPane, BorderLayout.CENTER); setTypeComboBox(); setSome(); - RCodesizespinner = new UISpinner(1,6,1,2); - RCodeVersionComboBox = new UIComboBox(); - RCodeErrorCorrectComboBox = new UIComboBox(); + sizeSpinner = new UISpinner(1,6,1,2); + versionComboBox = new UIComboBox(); + errorCorrectComboBox = new UIComboBox(); typeSetLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Type_Set"), UILabel.LEFT); initVersionComboBox(); initErrorCorrectComboBox(); @@ -169,31 +169,34 @@ public class BarCodePane extends FurtherBasicBeanPane { int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCode_Version"), UILabel.LEFT); uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); - RCodeVersionComboBox.setPreferredSize(new Dimension(155,20)); - RCodeErrorCorrectComboBox.setPreferredSize(new Dimension(155,20)); - RCodesizespinner.setPreferredSize(new Dimension(155,20)); + versionComboBox.setPreferredSize(new Dimension(155,20)); + errorCorrectComboBox.setPreferredSize(new Dimension(155,20)); + sizeSpinner.setPreferredSize(new Dimension(155,20)); Component[][] components_special = new Component[][]{ - new Component[]{uiLabel, RCodeVersionComboBox}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCode_Error_Correct"), UILabel.LEFT), RCodeErrorCorrectComboBox}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCodeDrawPix"), UILabel.LEFT), RCodesizespinner} + new Component[]{uiLabel, versionComboBox}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCode_Error_Correct"), UILabel.LEFT), errorCorrectComboBox}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCodeDrawPix"), UILabel.LEFT), sizeSpinner} }; JPanel specialPane = TableLayoutHelper.createGapTableLayoutPane(components_special, rowSize, columnSize, rowCount, LayoutConstants.VGAP_HUGER, LayoutConstants.VGAP_LARGE); return specialPane; } - private void addlistener() { - RCodesizespinner.addChangeListener(new ChangeListener() { + private void addListener() { + sizeSpinner.addChangeListener(new ChangeListener() { + @Override public void stateChanged(ChangeEvent e) { repaintPreviewBarCode(); } }); - RCodeVersionComboBox.addItemListener(new ItemListener() { + versionComboBox.addItemListener(new ItemListener() { + @Override public void itemStateChanged(ItemEvent e) { repaintPreviewBarCode(); } }); - RCodeErrorCorrectComboBox.addItemListener(new ItemListener() { + errorCorrectComboBox.addItemListener(new ItemListener() { + @Override public void itemStateChanged(ItemEvent e) { repaintPreviewBarCode(); } @@ -204,6 +207,7 @@ public class BarCodePane extends FurtherBasicBeanPane { } }); this.barHeightSpinner.addChangeListener(new ChangeListener() { + @Override public void stateChanged(ChangeEvent e) { repaintPreviewBarCode(); } @@ -217,24 +221,21 @@ public class BarCodePane extends FurtherBasicBeanPane { } @Override - /** - * - */ public String title4PopupWindow() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Highlight_Barcode"); } private void initVersionComboBox() { String[] array = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Auto_Choose"), "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"}; - initcombobox(this.RCodeVersionComboBox, array, 0); + initCombobox(this.versionComboBox, array, 0); } private void initErrorCorrectComboBox() { String[] array = {"L" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Level") + "7%", "M" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Level") + "15%", "Q" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Level") + "25%", "H" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Level") + "30%"}; - initcombobox(this.RCodeErrorCorrectComboBox, array, 1); + initCombobox(this.errorCorrectComboBox, array, 1); } - private void initcombobox(UIComboBox combobox, String[] array, int index) { + private void initCombobox(UIComboBox combobox, String[] array, int index) { combobox.removeAllItems(); for (int i = 0; i < array.length; i++) { combobox.addItem(array[i]); @@ -257,6 +258,7 @@ public class BarCodePane extends FurtherBasicBeanPane { /** * */ + @Override public void reset() { populateBean(new BarcodePresent()); } @@ -269,10 +271,14 @@ public class BarCodePane extends FurtherBasicBeanPane { } this.setTestText(BarCodeUtils.getTestTextByBarCode(barcodeAttr.getType())); this.typeComboBox.setSelectedIndex(barcodeAttr.getType()); - this.barWidthSpinner.setValue(new Double(barcodeAttr.getBarWidth()) * 10); - this.barHeightSpinner.setValue(new Integer(barcodeAttr.getBarHeight())); + if (barcodeAttr.getType() == NUM16) { + this.versionComboBox.setSelectedIndex(barcodeAttr.getRCodeVersion()); + this.errorCorrectComboBox.setSelectedIndex(barcodeAttr.getRCodeErrorCorrect()); + this.sizeSpinner.setValue(barcodeAttr.getRcodeDrawPix()); + } + this.barWidthSpinner.setValue(barcodeAttr.getBarWidth() * 10); + this.barHeightSpinner.setValue(barcodeAttr.getBarHeight()); this.drawingTextCheckBox.setSelected(barcodeAttr.isDrawingText()); - this.RCodesizespinner.setValue(new Integer(barcodeAttr.getRcodeDrawPix())); this.repaintPreviewBarCode(); } @@ -280,12 +286,12 @@ public class BarCodePane extends FurtherBasicBeanPane { public BarcodePresent updateBean() { BarcodeAttr barcodeAttr = new BarcodeAttr(); if ((typeComboBox.getSelectedIndex() == NUM16)) { - barcodeAttr.setRCodeVersion(this.RCodeVersionComboBox.getSelectedIndex()); - barcodeAttr.setRCodeErrorCorrect(this.RCodeErrorCorrectComboBox.getSelectedIndex()); - barcodeAttr.setRcodeDrawPix((int) this.RCodesizespinner.getValue()); + barcodeAttr.setRCodeVersion(this.versionComboBox.getSelectedIndex()); + barcodeAttr.setRCodeErrorCorrect(this.errorCorrectComboBox.getSelectedIndex()); + barcodeAttr.setRcodeDrawPix((int) this.sizeSpinner.getValue()); } barcodeAttr.setType(this.typeComboBox.getSelectedIndex()); - barcodeAttr.setBarWidth(((Double) this.barWidthSpinner.getValue()).doubleValue() / 10); + barcodeAttr.setBarWidth(this.barWidthSpinner.getValue() / 10); barcodeAttr.setBarHeight((int) this.barHeightSpinner.getValue()); barcodeAttr.setDrawingText(this.drawingTextCheckBox.isSelected()); return new BarcodePresent(barcodeAttr); @@ -303,7 +309,7 @@ public class BarCodePane extends FurtherBasicBeanPane { private Object obj; public BarCodePreviewPane() { -// setBackground(Color.WHITE); + } /** From 504de4f64d79c96920a430a8015691467c943661 Mon Sep 17 00:00:00 2001 From: Harrison Date: Wed, 15 Jan 2020 12:56:19 +0800 Subject: [PATCH 11/30] =?UTF-8?q?REPORT-25778=20json=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=EF=BC=8C=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=87=8D=E5=90=AF?= =?UTF-8?q?=E4=B9=8B=E5=90=8E=E6=B6=88=E5=A4=B1=20=E6=8D=A2=E4=B8=80?= =?UTF-8?q?=E7=A7=8D=E5=A4=84=E7=90=86=E6=96=B9=E5=BC=8F=EF=BC=8C=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E9=9D=A2=E6=9D=BF=E4=BC=9A=E5=AF=BC=E8=87=B4=E5=90=84?= =?UTF-8?q?=E7=A7=8D=E8=AF=A1=E5=BC=82=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/TableDataTreePane.java | 13 +++++------ .../com/fr/design/mainframe/JTemplate.java | 13 +++++++++++ .../fr/design/mainframe/JTemplateFactory.java | 23 +++++++++++++++++++ 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 7c8b1f46b..531e12848 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -16,9 +16,9 @@ import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.TableDataDefineProvider; -import com.fr.design.dialog.FineJOptionPane; import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; @@ -168,23 +168,22 @@ public class TableDataTreePane extends BasicTableDataTreePane { //如果数据集插件禁用或启用。需要清空当前模板中的缓存 reloadCurrTemplate(); } - + private void reloadCurrTemplate() { JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); if (accept(jt)) { - HistoryTemplateListCache.getInstance().closeSelectedReport(jt); - DesignerContext.getDesignerFrame().openTemplate(jt.getEditingFILE()); + jt.refreshResource(); } } - + private boolean accept(JTemplate jt) { - + return jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists(); } }, new PluginFilter() { @Override public boolean accept(PluginContext pluginContext) { - + return pluginContext.contain(TableDataDefineProvider.XML_TAG); } }); 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 c6da049bd..97df45c4a 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 @@ -243,6 +243,19 @@ public abstract class JTemplate> public void judgeSheetAuthority(String roles) { } + + /** + * 刷新内部资源 + */ + public void refreshResource() { + + try { + this.template = JTemplateFactory.asIOFile(this.editingFILE); + setTarget(this.template); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } /** * 刷新容器 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java index c6a6f4a0d..8019cc178 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe; +import com.fr.base.io.BaseBook; import com.fr.file.FILE; import com.fr.stable.CoreConstants; import com.fr.third.javax.annotation.Nonnull; @@ -42,6 +43,28 @@ public final class JTemplateFactory { } return null; } + + public static T asIOFile(@Nonnull FILE file) { + + String fileName = file.getName(); + int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT); + if (indexOfLastDot < 0) { + return null; + } + String fileExtension = fileName.substring(indexOfLastDot + 1); + for (App app : ALL_APP) { + String[] defaultAppExtensions = app.defaultExtensions(); + for (String defaultAppExtension : defaultAppExtensions) { + if (defaultAppExtension.equalsIgnoreCase(fileExtension)) { + BaseBook bb = app.asIOFile(file); + if (bb != null) { + return (T) bb; + } + } + } + } + return null; + } /** From f63aca162419cd0e6c4819d827b5f06879ebb0cb Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 16 Jan 2020 09:45:07 +0800 Subject: [PATCH 12/30] =?UTF-8?q?CHART-12406=20=E5=BC=B9=E5=87=BA=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9=E6=A1=86=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=9D=A1=E4=BB=B6=E5=B1=9E=E6=80=A7=E5=BC=B9=E6=A1=86?= =?UTF-8?q?=E4=B8=8D=E5=BA=94=E8=AF=A5=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/controlpane/UIControlPane.java | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java index 28df89b80..b41e4283f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java @@ -11,9 +11,18 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.ShortCut; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.widget.FRWidgetFactory; +import com.fr.invoke.Reflect; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; import com.fr.stable.os.OperatingSystem; + +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import javax.swing.SwingUtilities; +import javax.swing.border.EmptyBorder; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Cursor; @@ -27,14 +36,6 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.Window; -import javax.swing.BorderFactory; -import javax.swing.JComponent; -import javax.swing.JDialog; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JSplitPane; -import javax.swing.border.EmptyBorder; - import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; @@ -244,6 +245,20 @@ abstract class UIControlPane extends JControlPane { return; } } + + try { + //没有指定owner的弹出框用的是SwingUtilities.getSharedOwnerFrame() + Window sharedWindow = Reflect.on(SwingUtilities.class).call("getSharedOwnerFrame").get(); + for (Window window : sharedWindow.getOwnedWindows()) { + if (window instanceof JDialog && window.isVisible() && ((JDialog) window).isModal()) { + // 如果有可见模态对话框,则不隐藏 + return; + } + } + } catch (Exception ignore) { + //do nothing + } + // 要隐藏 先检查有没有非法输入 // 非法输入检查放在最后,因为可能出现面板弹出新弹框而失去焦点的情况,比如 输入公式时,弹出公式编辑对话框 try { From f9e58113c1001e09ca11966949a8653ccbeb42f7 Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 16 Jan 2020 09:51:35 +0800 Subject: [PATCH 13/30] update --- .../java/com/fr/design/gui/controlpane/UIControlPane.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java index b41e4283f..747dbe32f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java @@ -29,6 +29,7 @@ import java.awt.Cursor; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; +import java.awt.Frame; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GraphicsEnvironment; @@ -248,8 +249,8 @@ abstract class UIControlPane extends JControlPane { try { //没有指定owner的弹出框用的是SwingUtilities.getSharedOwnerFrame() - Window sharedWindow = Reflect.on(SwingUtilities.class).call("getSharedOwnerFrame").get(); - for (Window window : sharedWindow.getOwnedWindows()) { + Frame sharedOwnerFrame = Reflect.on(SwingUtilities.class).call("getSharedOwnerFrame").get(); + for (Window window : sharedOwnerFrame.getOwnedWindows()) { if (window instanceof JDialog && window.isVisible() && ((JDialog) window).isModal()) { // 如果有可见模态对话框,则不隐藏 return; From b69b0bcad8c7a8bf2039fce97b4ec8f84264a5aa Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 16 Jan 2020 11:32:58 +0800 Subject: [PATCH 14/30] =?UTF-8?q?REPORT-24174=E3=80=90=E6=96=B0=E5=BC=95?= =?UTF-8?q?=E6=93=8E=E3=80=91=E6=89=B9=E9=87=8F=E8=BD=AC=E6=8D=A2=E5=8F=8A?= =?UTF-8?q?=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/file/MutilTempalteTabPane.java | 2 +- .../main/java/com/fr/design/mainframe/DesignerFrame.java | 2 +- .../src/main/java/com/fr/design/mainframe/JTemplate.java | 9 +++++++-- 3 files changed, 9 insertions(+), 4 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 d9aa2f5be..f132cec34 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 @@ -258,7 +258,7 @@ public class MutilTempalteTabPane extends JComponent { private String tempalteShowName(JTemplate template) { - String name = template.getEditingFILE().getName(); + String name = template.getTemplateName(); if (!template.isSaved() && !name.endsWith(" *")) { name += " *"; } 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 f7b309eae..b7fbae773 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 @@ -830,7 +830,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } defaultTitleSB.append(username).append("@").append(envName).append("[").append(workspace.getDescription()).append("]"); if (editingTemplate != null) { - String path = editingTemplate.getEditingFILE().getPath(); + String path = editingTemplate.getPath(); if (!editingTemplate.getEditingFILE().exists()) { path = FILEFactory.MEM_PREFIX + path; } else if (path.startsWith(ProjectConstants.REPORTLETS_NAME)) { 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 97df45c4a..305edac11 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 @@ -243,12 +243,12 @@ public abstract class JTemplate> public void judgeSheetAuthority(String roles) { } - + /** * 刷新内部资源 */ public void refreshResource() { - + try { this.template = JTemplateFactory.asIOFile(this.editingFILE); setTarget(this.template); @@ -1232,4 +1232,9 @@ public abstract class JTemplate> } public abstract String route(); + + public String getTemplateName(){ + return getEditingFILE().getName(); + } + } From 531c7ba2847298773e04a4a33c936e7fcb04ad8b Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 16 Jan 2020 15:23:32 +0800 Subject: [PATCH 15/30] REPORT-25003 && REPORT-24491 --- .../com/fr/design/os/impl/SupportOSImpl.java | 17 ++++++++-- .../fr/design/os/impl/SupportOSImplTest.java | 24 +++++++++++++ .../ElementCasePaneAuthorityEditPane.java | 34 ++----------------- 3 files changed, 41 insertions(+), 34 deletions(-) create mode 100644 designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java diff --git a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java index 31aac9aa1..602e1d110 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java @@ -1,12 +1,17 @@ package com.fr.design.os.impl; import com.fr.base.FRContext; +import com.fr.general.CloudCenter; import com.fr.general.GeneralContext; +import com.fr.json.JSONObject; +import com.fr.stable.StringUtils; import com.fr.stable.os.Arch; import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.support.SupportOS; import com.fr.workspace.WorkContext; +import java.util.Locale; + /** * @author pengda * @date 2019/10/9 @@ -44,10 +49,18 @@ public enum SupportOSImpl implements SupportOS { @Override public boolean support() { boolean isLocalEnv = WorkContext.getCurrent().isLocal(); - boolean isChineseEnv = GeneralContext.isChineseEnv(); boolean isLinux = OperatingSystem.isLinux(); // 远程设计和非中文环境以及Linux环境,都不生效 - return isLocalEnv && isChineseEnv && !isLinux; + return isLocalEnv && !isLinux && isPushByConf(); + } + + private boolean isPushByConf() { + String resp = CloudCenter.getInstance().acquireUrlByKind("update.push.conf"); + if (StringUtils.isEmpty(resp)) { + return Locale.CHINA.equals(GeneralContext.getLocale()); + } + JSONObject jo = new JSONObject(resp); + return jo.optBoolean(GeneralContext.getLocale().toString()); } }, /** diff --git a/designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java b/designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java new file mode 100644 index 000000000..188753797 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java @@ -0,0 +1,24 @@ +package com.fr.design.os.impl; + +import com.fr.general.GeneralContext; +import junit.framework.TestCase; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Locale; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/1/16 + */ +public class SupportOSImplTest extends TestCase { + + @Test + public void testAutoPush() { + Assert.assertTrue(SupportOSImpl.AUTOPUSHUPDATE.support()); + GeneralContext.setLocale(Locale.TAIWAN); + Assert.assertFalse(SupportOSImpl.AUTOPUSHUPDATE.support()); + } + +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneAuthorityEditPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneAuthorityEditPane.java index f2dea0e7e..58b778065 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneAuthorityEditPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneAuthorityEditPane.java @@ -645,26 +645,10 @@ public class ElementCasePaneAuthorityEditPane extends AuthorityEditPane { return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_SMALL); } -// private JPanel populateWidgetCheckPane() { -// double f = TableLayout.FILL; -// double p = TableLayout.PREFERRED; -// Component[][] components = new Component[][]{ -// new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Cell"), SwingConstants.LEFT), cellElementVisibleCheckBoxes}, -// new Component[]{null, newValue}, -// new Component[]{null, valueEditor}, -// new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Widget"), SwingConstants.LEFT), widgetVisible}, -// new Component[]{null, widgetAvailable} -// }; -// double[] rowSize = {p, p, p, p, p}; -// double[] columnSize = {p, f}; -// int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; -// return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); -// } - private JPanel populateWidgetCheckPane() { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; - UILabel cv = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Value") + " "); + UILabel cv = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Value") + " "); cv.setBorder(BorderFactory.createEmptyBorder(0, LEFT_CHECKPANE, 0, 0)); Component[][] components = new Component[][]{ new Component[]{cellElementVisibleCheckBoxes, null}, @@ -705,27 +689,13 @@ public class ElementCasePaneAuthorityEditPane extends AuthorityEditPane { return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); } -// private JPanel populatCellCheckPane() { -// double f = TableLayout.FILL; -// double p = TableLayout.PREFERRED; -// Component[][] components = new Component[][]{ -// new Component[]{cellElementVisibleCheckBoxes}, -// new Component[]{newValue}, -// new Component[]{valueEditor} -// }; -// double[] rowSize = {p, p, p}; -// double[] columnSize = {f}; -// int[][] rowCount = {{1}, {1}, {1}}; -// return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); -// } - private JPanel populatCellCheckPane() { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p, p, p}; double[] columnSize = {p, f}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; - UILabel cv = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Value") + " "); + UILabel cv = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Value") + " "); cv.setBorder(BorderFactory.createEmptyBorder(0, LEFT_CHECKPANE, 0, 0)); Component[][] components = new Component[][]{ new Component[]{cellElementVisibleCheckBoxes,null}, From 1ee4bfc3bf63eb857dcf00efc69fe8476c58b136 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 17 Jan 2020 10:10:41 +0800 Subject: [PATCH 16/30] fix --- .../src/main/java/com/fr/design/os/impl/SupportOSImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java index 602e1d110..9bc29b829 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java @@ -3,6 +3,8 @@ package com.fr.design.os.impl; import com.fr.base.FRContext; import com.fr.general.CloudCenter; import com.fr.general.GeneralContext; +import com.fr.json.JSON; +import com.fr.json.JSONFactory; import com.fr.json.JSONObject; import com.fr.stable.StringUtils; import com.fr.stable.os.Arch; @@ -59,8 +61,8 @@ public enum SupportOSImpl implements SupportOS { if (StringUtils.isEmpty(resp)) { return Locale.CHINA.equals(GeneralContext.getLocale()); } - JSONObject jo = new JSONObject(resp); - return jo.optBoolean(GeneralContext.getLocale().toString()); + JSONObject jo = JSONFactory.createJSON(JSON.OBJECT, resp); + return jo.getBoolean(GeneralContext.getLocale().toString()); } }, /** From 1bb3fb7c073f5b3dd54d8ff58d26ad2d9599aabb Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 4 Feb 2020 16:49:12 +0800 Subject: [PATCH 17/30] =?UTF-8?q?CHART-12645=20=E9=BB=98=E8=AE=A4=E5=80=BC?= =?UTF-8?q?=E8=A2=AB=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/designer/component/UIBoundSpinner.java | 6 ------ .../ui/designer/component/WidgetAbsoluteBoundPane.java | 8 ++++---- .../widget/ui/designer/component/WidgetBoundPane.java | 4 ++-- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/UIBoundSpinner.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/UIBoundSpinner.java index fbfd547aa..426d27f1a 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/UIBoundSpinner.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/UIBoundSpinner.java @@ -14,16 +14,10 @@ public class UIBoundSpinner extends UISpinner{ public UIBoundSpinner(double minValue, double maxValue, double dierta) { super(minValue, maxValue, dierta); - initComponents(); } public UIBoundSpinner(double minValue, double maxValue, double dierta, double defaultValue) { super(minValue, maxValue, dierta, defaultValue); - initComponents(); - } - - private void initComponents() { - setTextField(value); } @Override diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java index 51811d763..7ddff022f 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java @@ -26,10 +26,10 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane { @Override public void initBoundPane() { - x = new UIBoundSpinner(0, Integer.MAX_VALUE, 1); - y = new UIBoundSpinner(0, Integer.MAX_VALUE, 1); - width = new UIBoundSpinner(0, Integer.MAX_VALUE, 1); - height = new UIBoundSpinner(0, Integer.MAX_VALUE, 1); + x = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0d); + y = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0d); + width = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0d); + height = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0d); x.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); y.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); width.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index 26861e7ec..c9928759b 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -56,8 +56,8 @@ public class WidgetBoundPane extends BasicPane { } public void initBoundPane() { - width = new UIBoundSpinner(0, Integer.MAX_VALUE, 1); - height = new UIBoundSpinner(0, Integer.MAX_VALUE, 1); + width = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0d); + height = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0d); width.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); height.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); if (creator.acceptType(XWCardLayout.class)) { From e362e333feeef23fcb87f97e92a730e0a16fef49 Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 12 Feb 2020 16:18:27 +0800 Subject: [PATCH 18/30] =?UTF-8?q?MOBILE-25111=20=E9=BB=98=E8=AE=A4UI?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/icheckbox/UICheckBox.java | 20 +++-- .../designer/creator/XWAbsoluteLayout.java | 12 +++ .../cardlayout/XWCardMainBorderLayout.java | 11 +++ .../mobile/MobileBooKMarkUsePropertyUI.java | 36 ++++++++ .../mobile/MobileAdvanceDefinePane.java | 14 ++- .../mobile/MobileBookMarkDefinePane.java | 62 +++++++++++++ .../component/MobileBookMarkSettingPane.java | 25 +----- .../component/MobileBookMarkUsePane.java | 86 +++++++++++++++++++ 8 files changed, 235 insertions(+), 31 deletions(-) create mode 100644 designer-form/src/main/java/com/fr/design/designer/properties/mobile/MobileBooKMarkUsePropertyUI.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileBookMarkDefinePane.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkUsePane.java diff --git a/designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java b/designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java index 10ea06a8c..379274b90 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java @@ -59,24 +59,28 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser initListener(); } - private void initListener() { + protected void initListener() { if (shouldResponseChangeListener()) { this.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { - if (uiObserverListener == null) { - return; - } - if (globalNameListener != null && shouldResponseNameListener()) { - globalNameListener.setGlobalName(checkboxName); - } - uiObserverListener.doChange(); + attributeChange(); } }); } } + protected void attributeChange() { + if (uiObserverListener == null) { + return; + } + if (globalNameListener != null && shouldResponseNameListener()) { + globalNameListener.setGlobalName(checkboxName); + } + uiObserverListener.doChange(); + } + /** * 给组件登记一个观察者监听事件 * diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java index 56fcf6486..22d702dfd 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -13,8 +13,11 @@ import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter; import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; +import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI; import com.fr.design.form.layout.FRAbsoluteLayout; +import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.form.util.XCreatorConstants; +import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.icon.IconPathConstants; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EditingMouseListener; @@ -590,4 +593,13 @@ public class XWAbsoluteLayout extends XLayoutContainer { public boolean isSupportShared() { return true; } + + @Override + public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { + if (FormDesignerUtils.isAppRelayout(WidgetPropertyPane.getInstance().getEditingFormDesigner())) { + return new WidgetPropertyUIProvider[] {new MobileBooKMarkUsePropertyUI(this)}; + } else { + return super.getWidgetPropertyUIProviders(); + } + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java index edbabeadf..c51fe491e 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java @@ -16,7 +16,10 @@ import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWBorderLayout; import com.fr.design.designer.creator.XWidgetCreator; +import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI; +import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.form.util.XCreatorConstants; +import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.icon.IconPathConstants; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EditingMouseListener; @@ -512,4 +515,12 @@ public class XWCardMainBorderLayout extends XWBorderLayout { return true; } + @Override + public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { + if (FormDesignerUtils.isAppRelayout(WidgetPropertyPane.getInstance().getEditingFormDesigner())) { + return new WidgetPropertyUIProvider[] {new MobileBooKMarkUsePropertyUI(this)}; + } else { + return super.getWidgetPropertyUIProviders(); + } + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/MobileBooKMarkUsePropertyUI.java b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/MobileBooKMarkUsePropertyUI.java new file mode 100644 index 000000000..6b6a773e9 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/MobileBooKMarkUsePropertyUI.java @@ -0,0 +1,36 @@ +package com.fr.design.designer.properties.mobile; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.dialog.BasicPane; +import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; +import com.fr.design.gui.itable.AbstractPropertyTable; +import com.fr.design.widget.ui.designer.mobile.MobileBookMarkDefinePane; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/2/12 + */ +public class MobileBooKMarkUsePropertyUI extends AbstractWidgetPropertyUIProvider { + + private XCreator xCreator; + + public MobileBooKMarkUsePropertyUI(XCreator xCreator) { + this.xCreator = xCreator; + } + + @Override + public AbstractPropertyTable createWidgetAttrTable() { + return null; + } + + @Override + public BasicPane createWidgetAttrPane() { + return new MobileBookMarkDefinePane(xCreator); + } + + @Override + public String tableTitle() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr"); + } +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java index 9533e552c..2bed8c117 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java @@ -53,7 +53,7 @@ public class MobileAdvanceDefinePane extends MobileWidgetDefinePane { public void initPropertyGroups(Object source) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.useBookMarkCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Use_BookMark")); + this.useBookMarkCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Use_BookMark"), false); this.bookMarkNameField = new UITextField() { @Override protected void initListener() { @@ -85,9 +85,18 @@ public class MobileAdvanceDefinePane extends MobileWidgetDefinePane { this.useBookMarkCheck.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { - bookMarkNamePane.setVisible(MobileAdvanceDefinePane.this.useBookMarkCheck.isSelected()); + boolean selected = MobileAdvanceDefinePane.this.useBookMarkCheck.isSelected(); + Widget widget = MobileAdvanceDefinePane.this.xCreator.toData(); + MobileBookMark bookMark = widget.getMobileBookMark(); + bookMarkNamePane.setVisible(selected); + if (selected && StringUtils.isEmpty(bookMark.getBookMarkName())) { + String name = widget.getWidgetName(); + MobileAdvanceDefinePane.this.bookMarkNameField.setText(name); + bookMark.setBookMarkName(name); + } } }); + bookMarkNamePane.setVisible(xCreator.toData().getMobileBookMark().isUseBookMark()); contentPane.add(useBookMarkPane, BorderLayout.NORTH); contentPane.add(bookMarkNamePane, BorderLayout.CENTER); UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark"), 280, 20, contentPane); @@ -144,6 +153,7 @@ public class MobileAdvanceDefinePane extends MobileWidgetDefinePane { } if (!isExist(newBookMarkName)) { bookMark.setBookMarkName(newBookMarkName); + DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); } else { FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Rename_Failure"), diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileBookMarkDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileBookMarkDefinePane.java new file mode 100644 index 000000000..4a53d2971 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileBookMarkDefinePane.java @@ -0,0 +1,62 @@ +package com.fr.design.widget.ui.designer.mobile; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.widget.ui.designer.mobile.component.MobileBookMarkUsePane; + +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/2/12 + */ +public class MobileBookMarkDefinePane extends MobileWidgetDefinePane { + + private XCreator xCreator; + private MobileBookMarkUsePane mobileBookMarkUsePane; + + public MobileBookMarkDefinePane(XCreator xCreator) { + this.xCreator = xCreator; + } + + @Override + public void initPropertyGroups(Object source) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.mobileBookMarkUsePane = new MobileBookMarkUsePane(); + UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, mobileBookMarkUsePane); + panel.add(uiExpandablePane); + this.add(panel, BorderLayout.NORTH); + } + + private void bindListeners2Widgets() { + reInitAllListeners(); + AttributeChangeListener changeListener = new AttributeChangeListener() { + @Override + public void attributeChange() { + update(); + } + }; + this.addAttributeChangeListener(changeListener); + } + + private void reInitAllListeners() { + initListener(this); + } + + @Override + public void populate(FormDesigner designer) { + this.mobileBookMarkUsePane.populate(xCreator); + this.bindListeners2Widgets(); + } + + @Override + public void update() { + this.mobileBookMarkUsePane.update(xCreator); + } +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkSettingPane.java index 6acd9638d..5f3f3663e 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkSettingPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkSettingPane.java @@ -29,7 +29,7 @@ import java.awt.*; public class MobileBookMarkSettingPane extends BasicPane { private AccessibleMobileBookMarkStyleEditor mobileBookMarkStyleEditor; - private UICheckBox showHierarchicalBookmarksCheck; + private MobileBookMarkUsePane showBookMarkPane; public MobileBookMarkSettingPane() { initComponent(); @@ -38,30 +38,13 @@ public class MobileBookMarkSettingPane extends BasicPane { private void initComponent() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.mobileBookMarkStyleEditor = new AccessibleMobileBookMarkStyleEditor(new MobileBookMarkStylePane()); - this.showHierarchicalBookmarksCheck = new UICheckBox( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Show_BookMark"), true); JPanel booKMarkPane = TableLayoutHelper.createGapTableLayoutPane( new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText( "Fine-Design_Mobile_BookMark_Style")), this.mobileBookMarkStyleEditor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.HGAP_LARGE ); - UILabel hintLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Show_BookMark_Hint")); - hintLabel.setForeground(Color.GRAY); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p}; - double[] columnSize = {f}; - int[][] rowCount = {{1}, {1}}; - Component[][] components = new Component[][]{ - new Component[]{this.showHierarchicalBookmarksCheck}, - new Component[]{hintLabel} - }; + this.showBookMarkPane = new MobileBookMarkUsePane(); JPanel wrapPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - JPanel showBookMarkPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, - IntervalConstants.INTERVAL_L1, - IntervalConstants.INTERVAL_L1); - showBookMarkPane.setBorder( - BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); wrapPane.add(booKMarkPane, BorderLayout.NORTH); wrapPane.add(showBookMarkPane, BorderLayout.CENTER); this.add(wrapPane, BorderLayout.CENTER); @@ -75,13 +58,13 @@ public class MobileBookMarkSettingPane extends BasicPane { public void populate(XCreator xCreator) { WSortLayout wSortLayout = ((WSortLayout) xCreator.toData()); this.mobileBookMarkStyleEditor.setValue(wSortLayout.getMobileBookMarkStyle()); - this.showHierarchicalBookmarksCheck.setSelected(wSortLayout.isShowBookmarks()); + this.showBookMarkPane.populate(xCreator); } public void update(XCreator xCreator) { WSortLayout wSortLayout = ((WSortLayout) xCreator.toData()); wSortLayout.setMobileBookMarkStyle((MobileBookMarkStyle) mobileBookMarkStyleEditor.getValue()); - wSortLayout.setShowBookmarks(showHierarchicalBookmarksCheck.isSelected()); + this.showBookMarkPane.update(xCreator); } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkUsePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkUsePane.java new file mode 100644 index 000000000..fb4148629 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkUsePane.java @@ -0,0 +1,86 @@ +package com.fr.design.widget.ui.designer.mobile.component; + +import com.fr.design.designer.IntervalConstants; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.form.ui.container.WLayout; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/2/12 + */ +public class MobileBookMarkUsePane extends BasicPane { + + private UICheckBox showHierarchicalBookmarksCheck; + + public MobileBookMarkUsePane() { + initComponent(); + } + + + private void initComponent() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.showHierarchicalBookmarksCheck = new UICheckBox( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Show_BookMark"), true) { + @Override + protected void initListener() { + this.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + attributeChange(); + } + }); + } + }; + UILabel hintLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Show_BookMark_Hint")); + hintLabel.setForeground(Color.GRAY); + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p}; + double[] columnSize = {f}; + int[][] rowCount = {{1}, {1}}; + Component[][] components = new Component[][]{ + new Component[]{this.showHierarchicalBookmarksCheck}, + new Component[]{hintLabel} + }; + JPanel wrapPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + JPanel showBookMarkPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, + IntervalConstants.INTERVAL_L1, + IntervalConstants.INTERVAL_L1); + showBookMarkPane.setBorder( + BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); + wrapPane.add(showBookMarkPane, BorderLayout.CENTER); + this.add(showBookMarkPane, BorderLayout.CENTER); + } + + public void populate(XCreator xCreator) { + WLayout wLayout = ((WLayout) xCreator.toData()); + this.showHierarchicalBookmarksCheck.setSelected(wLayout.isShowBookmarks()); + } + + public void update(XCreator xCreator) { + WLayout wLayout = ((WLayout) xCreator.toData()); + wLayout.setShowBookmarks(showHierarchicalBookmarksCheck.isSelected()); + } + + @Override + protected String title4PopupWindow() { + return "MobileBookMarkUsePane"; + } +} From 415097149f45d8d01a5de0bc56b95d2e28eb73d2 Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 12 Feb 2020 18:24:29 +0800 Subject: [PATCH 19/30] fix --- .../widget/ui/designer/mobile/MobileAdvanceDefinePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java index 2bed8c117..045c2702f 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java @@ -148,12 +148,12 @@ public class MobileAdvanceDefinePane extends MobileWidgetDefinePane { MobileBookMark bookMark = xCreator.toData().getMobileBookMark(); bookMark.setUseBookMark(this.useBookMarkCheck.isSelected()); String newBookMarkName = this.bookMarkNameField.getText(); + DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); if (ComparatorUtils.equals(newBookMarkName, bookMark.getBookMarkName())) { return; } if (!isExist(newBookMarkName)) { bookMark.setBookMarkName(newBookMarkName); - DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); } else { FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Rename_Failure"), From 790e2b4dbb42d00b7a194c10f3e319d85fa3b177 Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 12 Feb 2020 19:04:38 +0800 Subject: [PATCH 20/30] =?UTF-8?q?fix=20=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/designer/mobile/MobileAdvanceDefinePane.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java index 045c2702f..587ea5395 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java @@ -103,6 +103,19 @@ public class MobileAdvanceDefinePane extends MobileWidgetDefinePane { JPanel wrapPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); wrapPane.add(uiExpandablePane, BorderLayout.NORTH); this.add(wrapPane, BorderLayout.NORTH); + initData(); + } + + private void initData() { + MobileBookMark bookMark = xCreator.toData().getMobileBookMark(); + String bookMarkName = bookMark.getBookMarkName(); + if (StringUtils.isEmpty(bookMarkName)) { + String widgetName = xCreator.toData().getWidgetName(); + this.bookMarkNameField.setText(widgetName); + bookMark.setBookMarkName(widgetName); + } else { + this.bookMarkNameField.setText(bookMarkName); + } } private void bindListeners2Widgets() { From 6d96de4b77bef567d3dba2115ebe1f8ada1fe9c7 Mon Sep 17 00:00:00 2001 From: Hades Date: Mon, 17 Feb 2020 17:39:52 +0800 Subject: [PATCH 21/30] =?UTF-8?q?MOBILE-25397=20=E6=8A=98=E5=8F=A0?= =?UTF-8?q?=E5=B1=95=E5=BC=80=E6=A0=B7=E5=BC=8F=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/MobileCollapsedStyleExpandPane.java | 62 +++++++++ .../mobile/ui/MobileCollapsedStylePane.java | 125 ++++++++++++++++++ .../mobile/ui/MobileComboBoxDialogEditor.java | 100 ++++++++++++++ .../mobile/ChartEditorDefinePane.java | 23 +++- .../mobile/ElementCaseDefinePane.java | 21 ++- 5 files changed, 327 insertions(+), 4 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java new file mode 100644 index 000000000..ec0527447 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java @@ -0,0 +1,62 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.widget.UITitleSplitLine; +import com.fr.form.ui.mobile.MobileCollapsedStyle; +import com.fr.form.ui.mobile.MobileFormCollapsedStyle; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Dimension; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/2/13 + */ +public class MobileCollapsedStyleExpandPane extends MobileCollapsedStylePane { + + private UISpinner rowSpinner; + + public MobileCollapsedStyleExpandPane() { + } + + + @Override + protected JPanel createLinePane() { + UITitleSplitLine splitLine = new UITitleSplitLine(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Line_Number"), 520); + splitLine.setPreferredSize(new Dimension(520, 20)); + this.rowSpinner = new UISpinner(1, Integer.MAX_VALUE, 1, 1); + JPanel panel = new JPanel(); + panel.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); + panel.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Start_From"))); + panel.add(rowSpinner); + panel.add(new UILabel("Fine-Design_Mobile_Collapse_Row_To_Fold")); + JPanel linePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + linePane.add(splitLine, BorderLayout.NORTH); + linePane.add(panel, BorderLayout.CENTER); + return linePane; + } + + @Override + public void populateBean(MobileCollapsedStyle ob) { + super.populateBean(ob); + rowSpinner.setValue(((MobileFormCollapsedStyle) ob).getLineAttr().getNumber()); + } + + @Override + public MobileCollapsedStyle updateBean() { + MobileCollapsedStyle style = super.updateBean(); + ((MobileFormCollapsedStyle) style).getLineAttr().setNumber((int) rowSpinner.getValue()); + return style; + } + + @Override + protected MobileCollapsedStyle updateDiffBean() { + return new MobileFormCollapsedStyle(); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java new file mode 100644 index 000000000..5459b8f2a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java @@ -0,0 +1,125 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.gui.ibutton.ModeButtonGroup; +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.layout.VerticalFlowLayout; +import com.fr.design.mainframe.widget.UITitleSplitLine; +import com.fr.design.style.color.NewColorSelectBox; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.form.ui.mobile.CollapseState; +import com.fr.form.ui.mobile.MobileChartCollapsedStyle; +import com.fr.form.ui.mobile.MobileCollapsedStyle; + +import javax.swing.JPanel; +import javax.swing.border.TitledBorder; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/2/13 + */ +public class MobileCollapsedStylePane extends BasicBeanPane { + + private UICheckBox showButtonCheck; + private NewColorSelectBox buttonColorBox; + private UITextField foldedTextFiled; + private UITextField unfoldedTextFiled; + private ModeButtonGroup buttonGroup; + + + public MobileCollapsedStylePane() { + TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"), null); + VerticalFlowLayout layout = new VerticalFlowLayout(FlowLayout.LEADING, 0, 10); + layout.setAlignLeft(true); + this.setBorder(titledBorder); + this.setLayout(layout); + this.add(createLinePane()); + this.add(createSettingPane()); + } + + private JPanel createSettingPane() { + JPanel settingPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + UITitleSplitLine splitLine = new UITitleSplitLine(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Button"), 520); + splitLine.setPreferredSize(new Dimension(520, 20)); + UILabel showButtonLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button")); + showButtonCheck = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button_On_Right")); + UILabel buttonColorLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Button_Color")); + buttonColorBox = new NewColorSelectBox(137); + UILabel foldedLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Folded_Hint")); + foldedTextFiled = new UITextField(); + UILabel unfoldedLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_UnFolded_Hint")); + unfoldedTextFiled = new UITextField(); + UILabel defaultStateLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Default_State")); + buttonGroup = new ModeButtonGroup<>(); + UIRadioButton foldedButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Fold")); + foldedButton.setSelected(true); + UIRadioButton unfoldedButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Unfold")); + buttonGroup.put(CollapseState.FOLDED, foldedButton); + buttonGroup.put(CollapseState.UNFOLDED, unfoldedButton); + JPanel flowLeftPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); + flowLeftPane.add(foldedButton); + flowLeftPane.add(unfoldedButton); + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p, p, p, p}; + double[] colSize = {p, f}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; + Component[][] components = new Component[][] { + new Component[] {showButtonLabel, showButtonCheck}, + new Component[] {buttonColorLabel, buttonColorBox}, + new Component[] {foldedLabel, foldedTextFiled}, + new Component[] {unfoldedLabel, unfoldedTextFiled}, + new Component[] {defaultStateLabel, flowLeftPane}, + }; + JPanel buttonPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, colSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); + settingPane.add(splitLine, BorderLayout.NORTH); + settingPane.add(buttonPane, BorderLayout.CENTER); + return settingPane; + } + + protected JPanel createLinePane() { + return FRGUIPaneFactory.createBorderLayout_S_Pane(); + } + + @Override + public void populateBean(MobileCollapsedStyle ob) { + showButtonCheck.setSelected(ob.getCollapseButton().isShowButton()); + buttonColorBox.setSelectObject(ob.getCollapseButton().getButtonColor()); + foldedTextFiled.setText(ob.getCollapseButton().getFoldedHint()); + unfoldedTextFiled.setText(ob.getCollapseButton().getUnfoldedHint()); + buttonGroup.setSelectButton(ob.getCollapseButton().getDefaultState()); + } + + @Override + public MobileCollapsedStyle updateBean() { + MobileCollapsedStyle style = updateDiffBean(); + style.getCollapseButton().setShowButton(showButtonCheck.isSelected()); + style.getCollapseButton().setButtonColor(buttonColorBox.getSelectObject()); + style.getCollapseButton().setFoldedHint(foldedTextFiled.getText()); + style.getCollapseButton().setUnfoldedHint(unfoldedTextFiled.getText()); + style.getCollapseButton().setDefaultState(buttonGroup.getCurrentSelected()); + return style; + } + + protected MobileCollapsedStyle updateDiffBean() { + return new MobileChartCollapsedStyle(); + } + + @Override + protected String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Mobile_Collapse_Expand"); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java new file mode 100644 index 000000000..def333abf --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java @@ -0,0 +1,100 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.i18n.Toolkit; +import com.fr.form.ui.mobile.MobileCollapsedStyle; +import com.fr.general.ComparatorUtils; + +import javax.swing.SwingUtilities; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/2/13 + */ +public class MobileComboBoxDialogEditor extends BasicPane { + + private static final Dimension DEFAULT_DIMENSION = new Dimension(600, 400); + private static final Dimension COMBOX_DIMENSION = new Dimension(135,20); + private static final String NONE = Toolkit.i18nText("无"); + private static final String CUSTOM = Toolkit.i18nText("自定义"); + + + private MobileCollapsedStyle style; + private MobileCollapsedStylePane stylePane; + private UIComboBox comboBox; + private ActionListener listener; + + public MobileComboBoxDialogEditor(MobileCollapsedStylePane stylePane) { + this.stylePane = stylePane; + this.comboBox = new UIComboBox(new Object[] {NONE, CUSTOM}); + this.comboBox.setPreferredSize(COMBOX_DIMENSION); + this.comboBox.setSelectedItem(NONE); + listener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (ComparatorUtils.equals(MobileComboBoxDialogEditor.this.comboBox.getSelectedItem(), CUSTOM)) { + showEditorPane(); + } + } + }; + this.comboBox.addActionListener(listener); + this.add(comboBox); + + } + + public boolean isSelectedCustom() { + return ComparatorUtils.equals(CUSTOM, this.comboBox.getSelectedItem()); + } + + public void setSelected(boolean selectedCustom) { + this.comboBox.removeActionListener(listener); + this.comboBox.setSelectedItem(selectedCustom ? CUSTOM : NONE); + this.comboBox.addActionListener(listener); + } + + private void showEditorPane() { + stylePane.setPreferredSize(DEFAULT_DIMENSION); + BasicDialog dialog = stylePane.showWindow(SwingUtilities.getWindowAncestor(this)); + dialog.addDialogActionListener(new DialogActionAdapter() { + @Override + public void doOk() { + MobileCollapsedStyle style = stylePane.updateBean(); + style.setCollapsedWork(true); + setStyle(style); + MobileComboBoxDialogEditor.this.firePropertyChanged(); + } + }); + stylePane.populateBean(getStyle()); + dialog.setVisible(true); + } + + + protected void firePropertyChanged() { + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(); + } + + public MobileCollapsedStyle getStyle() { + return style; + } + + public void setStyle(MobileCollapsedStyle style) { + this.style = style; + } + + @Override + protected String title4PopupWindow() { + return null; + } + + + + +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java index 7b63397d2..dd3aba563 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java @@ -20,7 +20,11 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.mainframe.mobile.ui.MobileCollapsedStylePane; +import com.fr.design.mainframe.mobile.ui.MobileComboBoxDialogEditor; import com.fr.form.ui.BaseChartEditor; +import com.fr.form.ui.ChartEditor; +import com.fr.form.ui.mobile.MobileCollapsedStyle; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -49,6 +53,7 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane { private UILabel tipLabel; private UICheckBox allowFullCheckBox;//允许全屏 private UICheckBox functionalWhenUnactivatedCheckBox;//组件未激活时可使用组件内功能 + private MobileComboBoxDialogEditor mobileCollapsedStyleEditor; public ChartEditorDefinePane(XCreator xCreator) { this.xCreator = xCreator; @@ -102,10 +107,17 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane { updateTipLabel(); allowFullCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Full_Screen")); functionalWhenUnactivatedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Functional_When_Unactivated"), true); + mobileCollapsedStyleEditor = new MobileComboBoxDialogEditor(new MobileCollapsedStylePane()) { + @Override + protected void firePropertyChanged() { + ChartEditorDefinePane.this.update(); + } + }; Component[][] components = new Component[][]{ new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Zoom_In_Logic"), SwingConstants.LEFT), new UILabel(ChartMobileFitAttrState.PROPORTION.description())}, new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Zoom_Out_Logic"), SwingConstants.LEFT), zoomOutComboBox}, + new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Collapse_Expand")), mobileCollapsedStyleEditor}, new Component[] {tipLabel, null}, new Component[] {allowFullCheckBox, null}, new Component[] {functionalWhenUnactivatedCheckBox, null} @@ -113,9 +125,9 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p, p}; + double[] rowSize = {p, p, p, p, p, p}; double[] columnSize = {p,f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 30, LayoutConstants.VGAP_LARGE); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); @@ -186,6 +198,10 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane { } } }); + + MobileCollapsedStyle style = ((ChartEditor) xCreator.toData()).getMobileCollapsedStyle(); + this.mobileCollapsedStyleEditor.setStyle(style); + this.mobileCollapsedStyleEditor.setSelected(style.isCollapsedWork()); } @Override @@ -200,6 +216,9 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane { mobileAttr.setAllowFullScreen(allowFullCheckBox.isSelected()); mobileAttr.setFunctionalWhenUnactivated(!functionalWhenUnactivatedCheckBox.isSelected()); } + MobileCollapsedStyle style = this.mobileCollapsedStyleEditor.getStyle(); + ((ChartEditor) xCreator.toData()).setMobileCollapsedStyle(style); + style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom()); DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来 } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java index 33201be32..847ddff65 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java @@ -16,8 +16,11 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.mainframe.mobile.ui.MobileCollapsedStyleExpandPane; +import com.fr.design.mainframe.mobile.ui.MobileComboBoxDialogEditor; import com.fr.form.ui.ElementCaseEditor; +import com.fr.form.ui.mobile.MobileCollapsedStyle; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; @@ -51,6 +54,7 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane { private AttributeChangeListener changeListener; private UICheckBox allowFullCheckBox; private UICheckBox functionalWhenUnactivatedCheckBox; + private MobileComboBoxDialogEditor mobileCollapsedStyleEditor; public ElementCaseDefinePane(XCreator xCreator) { this.xCreator = xCreator; @@ -90,9 +94,17 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane { functionalWhenUnactivatedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Functional_When_Unactivated"), true); + mobileCollapsedStyleEditor = new MobileComboBoxDialogEditor(new MobileCollapsedStyleExpandPane()) { + @Override + protected void firePropertyChanged() { + ElementCaseDefinePane.this.update(); + } + }; + Component[][] components = new Component[][]{ new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Horizontal"), SwingConstants.LEFT), hComboBox}, new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Vertical"), SwingConstants.LEFT), vComboBox}, + new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("展开收起")), mobileCollapsedStyleEditor}, new Component[] {heightRestrictCheckBox, null}, new Component[] {allowFullCheckBox, null}, new Component[] {functionalWhenUnactivatedCheckBox, null}, @@ -100,9 +112,9 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane { }; double f = TableLayout.FILL; double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p, p, p}; + double[] rowSize = {p, p, p, p, p, p, p}; double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 30, LayoutConstants.VGAP_LARGE); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); @@ -144,6 +156,8 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane { this.maxHeightSpinner.setValue(elementCaseEditor.getHeightPercent()); this.allowFullCheckBox.setSelected(elementCaseEditor.isAllowFullScreen()); this.functionalWhenUnactivatedCheckBox.setSelected(!elementCaseEditor.isFunctionalWhenUnactivated()); + this.mobileCollapsedStyleEditor.setStyle(elementCaseEditor.getMobileCollapsedStyle()); + this.mobileCollapsedStyleEditor.setSelected(elementCaseEditor.getMobileCollapsedStyle().isCollapsedWork()); } @Override @@ -172,6 +186,9 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane { case "functionalWhenUnactivatedCheckBox": ((ElementCaseEditor) xCreator.toData()).setFunctionalWhenUnactivated(!functionalWhenUnactivatedCheckBox.isSelected()); } + MobileCollapsedStyle style = this.mobileCollapsedStyleEditor.getStyle(); + style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom()); + ((ElementCaseEditor) xCreator.toData()).setMobileCollapsedStyle(style); } private void setGlobalNames() { From b24d3a2fdd9f3bda262a0f63038d2c60242ce036 Mon Sep 17 00:00:00 2001 From: Hades Date: Mon, 17 Feb 2020 19:21:04 +0800 Subject: [PATCH 22/30] =?UTF-8?q?fix=20=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java | 2 +- .../mainframe/mobile/ui/MobileComboBoxDialogEditor.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java index ec0527447..d1b603561 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java @@ -34,7 +34,7 @@ public class MobileCollapsedStyleExpandPane extends MobileCollapsedStylePane { panel.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); panel.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Start_From"))); panel.add(rowSpinner); - panel.add(new UILabel("Fine-Design_Mobile_Collapse_Row_To_Fold")); + panel.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Row_To_Fold"))); JPanel linePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); linePane.add(splitLine, BorderLayout.NORTH); linePane.add(panel, BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java index def333abf..6e9b74a1d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java @@ -23,8 +23,8 @@ public class MobileComboBoxDialogEditor extends BasicPane { private static final Dimension DEFAULT_DIMENSION = new Dimension(600, 400); private static final Dimension COMBOX_DIMENSION = new Dimension(135,20); - private static final String NONE = Toolkit.i18nText("无"); - private static final String CUSTOM = Toolkit.i18nText("自定义"); + private static final String NONE = Toolkit.i18nText("Fine-Design_Mobile_Collapse_None"); + private static final String CUSTOM = Toolkit.i18nText("Fine-Design_Mobile_Collapse_Custom"); private MobileCollapsedStyle style; From f79198c2d714d26dc527c4b41efa02047427cd96 Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Tue, 18 Feb 2020 15:15:38 +0800 Subject: [PATCH 23/30] =?UTF-8?q?REPORT-26672=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=92=8C=E6=9C=8D=E5=8A=A1=E5=99=A8=E9=83=BD=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E7=9A=84lic=E9=83=BD=E6=B2=A1=E6=9C=89=E5=8B=BE?= =?UTF-8?q?=E9=80=89=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=82=B9=EF=BC=8C=E8=BF=98=E6=98=AF=E5=8F=AF=E4=BB=A5=E8=BF=9C?= =?UTF-8?q?=E7=A8=8B=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/env/RemoteDesignerWorkspaceInfo.java | 11 +++++++++-- .../src/main/java/com/fr/env/RemoteEnvPane.java | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java b/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java index ffc80cb08..0ac5ea139 100644 --- a/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java +++ b/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java @@ -1,11 +1,13 @@ package com.fr.design.env; +import com.fr.log.FineLoggerFactory; import com.fr.security.SecurityToolbox; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLableReader; import com.fr.workspace.connect.WorkspaceConnectionInfo; +import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo { @@ -89,8 +91,13 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo { @Override - public boolean checkValid(){ - + public boolean checkValid() { + try { + new FunctionalHttpRequest(this.connection).validateVT(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return false; + } return true; } } 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 56a805dde..4871bb769 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -17,6 +17,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.scrollruler.ModLineBorder; +import com.fr.license.exception.RegistEditionException; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.third.guava.base.Strings; @@ -564,6 +565,9 @@ public class RemoteEnvPane extends BasicBeanPane { return TestConnectionResult.parse(WorkContext.getConnector().testConnection(connection), connection); } catch (WorkspaceAuthException ignored) { return AUTH_FAILED; + } catch (RegistEditionException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + throw e; } } From 806392a3cddb4dd59f15c3e9ad2a12d05c61d227 Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Tue, 18 Feb 2020 18:00:59 +0800 Subject: [PATCH 24/30] =?UTF-8?q?REPORT-26672=20review=20=E6=94=B9?= =?UTF-8?q?=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/env/RemoteDesignerWorkspaceInfo.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java b/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java index 0ac5ea139..cf7f3f940 100644 --- a/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java +++ b/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java @@ -6,8 +6,8 @@ import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLableReader; +import com.fr.workspace.WorkContext; import com.fr.workspace.connect.WorkspaceConnectionInfo; -import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo { @@ -92,12 +92,13 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo { @Override public boolean checkValid() { + boolean result = false; try { - new FunctionalHttpRequest(this.connection).validateVT(); + result = WorkContext.getConnector().testConnection(connection); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - return false; + return result; } - return true; + return result; } } From defb4f37df53eb15262673fb0377633e4e99c5f8 Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 18 Feb 2020 19:37:40 +0800 Subject: [PATCH 25/30] MOBILE-25475 && MOBILE-25477 --- .../mobile/ui/MobileCollapsedStyleExpandPane.java | 14 +++++++++++++- .../ui/designer/mobile/ChartEditorDefinePane.java | 6 ++++-- .../ui/designer/mobile/ElementCaseDefinePane.java | 6 ++++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java index d1b603561..ff7e830de 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java @@ -1,7 +1,10 @@ package com.fr.design.mainframe.mobile.ui; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.ColumnRowSpinner; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.itextfield.UIIntNumberField; +import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.widget.UITitleSplitLine; @@ -9,6 +12,7 @@ import com.fr.form.ui.mobile.MobileCollapsedStyle; import com.fr.form.ui.mobile.MobileFormCollapsedStyle; import javax.swing.JPanel; +import javax.swing.SpinnerListModel; import java.awt.BorderLayout; import java.awt.Dimension; @@ -19,6 +23,8 @@ import java.awt.Dimension; */ public class MobileCollapsedStyleExpandPane extends MobileCollapsedStylePane { + private static final Dimension DEFAULT_SPINNER_SIZE = new Dimension(60, 24); + private UISpinner rowSpinner; public MobileCollapsedStyleExpandPane() { @@ -29,7 +35,13 @@ public class MobileCollapsedStyleExpandPane extends MobileCollapsedStylePane { protected JPanel createLinePane() { UITitleSplitLine splitLine = new UITitleSplitLine(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Line_Number"), 520); splitLine.setPreferredSize(new Dimension(520, 20)); - this.rowSpinner = new UISpinner(1, Integer.MAX_VALUE, 1, 1); + this.rowSpinner = new UISpinner(1, Integer.MAX_VALUE, 1, 1) { + @Override + protected UINumberField initNumberField(){ + return new UIIntNumberField(); + } + }; + rowSpinner.setPreferredSize(DEFAULT_SPINNER_SIZE); JPanel panel = new JPanel(); panel.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); panel.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Start_From"))); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java index dd3aba563..7427a0281 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java @@ -217,8 +217,10 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane { mobileAttr.setFunctionalWhenUnactivated(!functionalWhenUnactivatedCheckBox.isSelected()); } MobileCollapsedStyle style = this.mobileCollapsedStyleEditor.getStyle(); - ((ChartEditor) xCreator.toData()).setMobileCollapsedStyle(style); - style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom()); + if (style != null) { + ((ChartEditor) xCreator.toData()).setMobileCollapsedStyle(style); + style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom()); + } DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来 } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java index 847ddff65..5ff9c783c 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java @@ -187,8 +187,10 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane { ((ElementCaseEditor) xCreator.toData()).setFunctionalWhenUnactivated(!functionalWhenUnactivatedCheckBox.isSelected()); } MobileCollapsedStyle style = this.mobileCollapsedStyleEditor.getStyle(); - style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom()); - ((ElementCaseEditor) xCreator.toData()).setMobileCollapsedStyle(style); + if (style != null) { + style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom()); + ((ElementCaseEditor) xCreator.toData()).setMobileCollapsedStyle(style); + } } private void setGlobalNames() { From 37ce54d077bfee7346dbcd33cedbd88ed89083fd Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 18 Feb 2020 19:45:35 +0800 Subject: [PATCH 26/30] fix import --- .../mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java index ff7e830de..766f06d51 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java @@ -1,7 +1,6 @@ package com.fr.design.mainframe.mobile.ui; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.ColumnRowSpinner; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UIIntNumberField; import com.fr.design.gui.itextfield.UINumberField; @@ -12,7 +11,6 @@ import com.fr.form.ui.mobile.MobileCollapsedStyle; import com.fr.form.ui.mobile.MobileFormCollapsedStyle; import javax.swing.JPanel; -import javax.swing.SpinnerListModel; import java.awt.BorderLayout; import java.awt.Dimension; From 95c13712d7a3f3ef0268d3cee4f88152b841bfea Mon Sep 17 00:00:00 2001 From: ju Date: Fri, 21 Feb 2020 22:24:03 +0800 Subject: [PATCH 27/30] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20merge?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/JTemplate.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) 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 cadc71833..d9b8ab891 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 @@ -256,20 +256,7 @@ public abstract class JTemplate> FineLoggerFactory.getLogger().error(e.getMessage(), e); } } - - /** - * 刷新内部资源 - */ - public void refreshResource() { - - try { - this.template = JTemplateFactory.asIOFile(this.editingFILE); - setTarget(this.template); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - + /** * 刷新容器 */ From a0995d1ddc84c15fe69e7db427800a4dcfdeb4a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 25 Feb 2020 18:57:40 +0800 Subject: [PATCH 28/30] =?UTF-8?q?CHART-12746=20=E5=9F=8B=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/JTemplate.java | 12 +- .../burying/point/AbstractPointCollector.java | 130 +++++++++ .../burying/point/AbstractPointInfo.java | 55 ++++ .../burying/point/BasePointCollector.java | 23 ++ .../burying/point/BasePointInfo.java | 35 +++ .../mainframe/chart/info/ChartInfo.java | 250 ++++++++++++++++++ .../chart/info/ChartInfoCollector.java | 248 +++++++++++++++++ .../mainframe/template/info/SendHelper.java | 29 +- .../mainframe/template/info/TemplateInfo.java | 65 ++--- .../template/info/TemplateInfoCollector.java | 158 ++--------- .../template/info/SendHelperTest.java | 9 +- .../info/TemplateInfoCollectorTest.java | 23 +- .../template/info/TemplateInfoTest.java | 22 +- .../java/com/fr/design/chart/ChartDialog.java | 23 +- .../com/fr/design/chart/ChartTypePane.java | 7 + .../design/mainframe/chart/ChartEditPane.java | 41 +-- .../chart/gui/ChartTypeButtonPane.java | 8 +- .../type/AbstractVanChartTypePane.java | 3 + .../mainframe/FormCreatorDropTarget.java | 32 ++- .../actions/insert/flot/ChartFloatAction.java | 69 +++-- .../mainframe/InformationCollector.java | 4 +- .../poly/hanlder/PolyDesignerDropTarget.java | 65 +++-- 22 files changed, 1003 insertions(+), 308 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointInfo.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/burying/point/BasePointCollector.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/burying/point/BasePointInfo.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java 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 d9b8ab891..482b0d337 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 @@ -36,6 +36,7 @@ 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.chart.info.ChartInfoCollector; import com.fr.design.mainframe.template.info.TemplateInfoCollector; import com.fr.design.mainframe.template.info.TemplateProcessInfo; import com.fr.design.mainframe.template.info.TimeConsumeTimer; @@ -70,11 +71,11 @@ import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.undo.UndoManager; -import java.awt.BorderLayout; import java.util.ArrayList; import java.util.Arrays; import java.util.Set; import java.util.regex.Pattern; +import java.awt.BorderLayout; /** * 报表设计和表单设计的编辑区域(设计器编辑的IO文件) @@ -164,6 +165,7 @@ public abstract class JTemplate> } private void collectInfo(String originID) { // 执行收集操作 + ChartInfoCollector.getInstance().collectInfo(template.getTemplateID(), originID, getProcessInfo(), 0); if (!consumeTimer.isEnabled()) { return; } @@ -243,12 +245,12 @@ public abstract class JTemplate> public void judgeSheetAuthority(String roles) { } - + /** * 刷新内部资源 */ public void refreshResource() { - + try { this.template = JTemplateFactory.asIOFile(this.editingFILE); setTarget(this.template); @@ -256,7 +258,7 @@ public abstract class JTemplate> FineLoggerFactory.getLogger().error(e.getMessage(), e); } } - + /** * 刷新容器 */ @@ -1233,7 +1235,7 @@ public abstract class JTemplate> public abstract String route(); - public String getTemplateName(){ + public String getTemplateName() { return getEditingFILE().getName(); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java new file mode 100644 index 000000000..a3665b77b --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java @@ -0,0 +1,130 @@ +package com.fr.design.mainframe.burying.point; + +import com.fr.base.FRContext; +import com.fr.base.io.XMLReadHelper; +import com.fr.design.DesignerEnvManager; +import com.fr.design.mainframe.template.info.SendHelper; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLTools; +import com.fr.stable.xml.XMLableReader; +import com.fr.third.javax.xml.stream.XMLStreamException; +import com.fr.third.org.apache.commons.io.FileUtils; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-02-21 + */ +public abstract class AbstractPointCollector implements BasePointCollector { + + protected Map pointInfoMap; + + private static final int MAX_SIZE = 512 * 1024 * 1024; + + public AbstractPointCollector() { + pointInfoMap = new ConcurrentHashMap<>(); + loadFromFile(); + } + + /** + * 获取是否满足触发埋点的要求 + */ + protected boolean shouldCollectInfo() { + return FileUtils.sizeOf(getInfoFile()) <= MAX_SIZE && DesignerEnvManager.getEnvManager().isJoinProductImprove() && FRContext.isChineseEnv(); + } + + @Override + public void sendPointInfo() { + + addIdleDayCount(); + + List removeList = new ArrayList<>(); + List sendList = new ArrayList<>(); + + for (String key : pointInfoMap.keySet()) { + AbstractPointInfo pointInfo = pointInfoMap.get(key); + pointInfo.selectPoint(removeList, sendList); + } + + // 发送记录 + for (String key : sendList) { + if(SendHelper.sendPointInfo(pointInfoMap.get(key))){ + removeList.add(key); + } + } + + // 清空记录 + for (String key : removeList) { + pointInfoMap.remove(key); + } + + saveInfo(); + } + + /** + * 从文件中读取埋点信息 + */ + protected void loadFromFile() { + if (!getInfoFile().exists()) { + return; + } + + XMLableReader reader = null; + try (InputStream in = new FileInputStream(getInfoFile())) { + // XMLableReader 还是应该考虑实现 Closable 接口的,这样就能使用 try-with 语句了 + reader = XMLReadHelper.createXMLableReader(in, XMLPrintWriter.XML_ENCODER); + if (reader == null) { + return; + } + reader.readXMLObject(this); + } catch (FileNotFoundException e) { + // do nothing + } catch (XMLStreamException | IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } finally { + try { + if (reader != null) { + reader.close(); + } + } catch (XMLStreamException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } + + /** + * 保存埋点信息到文件中 + */ + protected void saveInfo() { + try { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + XMLTools.writeOutputStreamXML(this, out); + out.flush(); + out.close(); + String fileContent = new String(out.toByteArray(), StandardCharsets.UTF_8); + FileUtils.writeStringToFile(getInfoFile(), fileContent, StandardCharsets.UTF_8); + } catch (Exception ex) { + FineLoggerFactory.getLogger().error(ex.getMessage()); + } + } + + /** + * 获取缓存文件存放路径 + */ + protected abstract File getInfoFile(); + + protected abstract void addIdleDayCount(); +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointInfo.java b/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointInfo.java new file mode 100644 index 000000000..6646bfd09 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointInfo.java @@ -0,0 +1,55 @@ +package com.fr.design.mainframe.burying.point; + +import java.util.List; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-02-21 + */ +public abstract class AbstractPointInfo implements BasePointInfo { + + protected int idleDayCount; // 到现在为止,埋点闲置的天数 + + @Override + public void resetIdleDayCount() { + this.idleDayCount = 0; + } + + @Override + public void addIdleDayCountByOne() { + this.idleDayCount += 1; + } + + /** + * 上传前判断该埋点,是否需要被上传,或者删除,或者什么都不做。 + */ + @Override + public void selectPoint(List removeList, List sendList) { + //埋点还未完成,直接返回 + if (!isComplete()) { + return; + } + //属于测试模板,直接删除,否则发送信息 + if (isTestTemplate()) { + removeList.add(key()); + } else { + sendList.add(key()); + } + } + + /** + * 是否为测试模板 + */ + protected abstract boolean isTestTemplate(); + + /** + * 是否已经制作完成 + */ + protected abstract boolean isComplete(); + + /** + * 埋点记录的主键 + */ + protected abstract String key(); +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/burying/point/BasePointCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/burying/point/BasePointCollector.java new file mode 100644 index 000000000..f10f1682e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/burying/point/BasePointCollector.java @@ -0,0 +1,23 @@ +package com.fr.design.mainframe.burying.point; + +import com.fr.design.mainframe.template.info.TemplateProcessInfo; +import com.fr.stable.xml.XMLReadable; +import com.fr.stable.xml.XMLWriter; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-02-21 + */ +public interface BasePointCollector extends XMLReadable, XMLWriter { + + /** + * 发送埋点信息到服务器 + */ + public void sendPointInfo(); + + /** + * 保存埋点的信息到本地 + */ + public void collectInfo(String templateID, String originID, TemplateProcessInfo processInfo, int timeConsume); +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/burying/point/BasePointInfo.java b/designer-base/src/main/java/com/fr/design/mainframe/burying/point/BasePointInfo.java new file mode 100644 index 000000000..b45f1cb6a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/burying/point/BasePointInfo.java @@ -0,0 +1,35 @@ +package com.fr.design.mainframe.burying.point; + +import com.fr.stable.xml.XMLReadable; +import com.fr.stable.xml.XMLWriter; + +import java.util.List; +import java.util.Map; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-02-21 + */ +public interface BasePointInfo extends XMLReadable, XMLWriter { + + /** + * 重置埋点的未编辑天数 + */ + void resetIdleDayCount(); + + /** + * 增加一天埋点的未编辑天数 + */ + void addIdleDayCountByOne(); + + /** + * 上传前判断该埋点,是否需要被上传,或者删除,或者什么都不做。 + */ + void selectPoint(List removeList, List sendList); + + /** + * 获取要上传的内容,key→上传路径,value→上传内容 + */ + Map getSendInfo(); +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java b/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java new file mode 100644 index 000000000..9d305ef1d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java @@ -0,0 +1,250 @@ +package com.fr.design.mainframe.chart.info; + +import com.fr.base.io.BaseBook; +import com.fr.config.MarketConfig; +import com.fr.design.DesignModelAdapter; +import com.fr.design.DesignerEnvManager; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.mainframe.burying.point.AbstractPointInfo; +import com.fr.general.CloudCenter; +import com.fr.general.GeneralUtils; +import com.fr.json.JSONObject; +import com.fr.stable.ProductConstants; +import com.fr.stable.StringUtils; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLableReader; +import com.fr.third.joda.time.DateTime; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-02-17 + */ +public class ChartInfo extends AbstractPointInfo { + public static final String XML_TAG = "ChartInfo"; + private static final String CHART_CONSUMING_URL = CloudCenter.getInstance().acquireUrlByKind("chartinfo.consuming") + "/single"; + + + private static final String XML_CHART_CONSUMING_MAP = "chartConsumingMap"; + private static final String ATTR_TEST_TEMPLATE = "testTemplate"; + private static final String ATTR_DAY_COUNT = "day_count"; + private static final String ATTR_USERNAME = "username"; + private static final String ATTR_UUID = "uuid"; + private static final String ATTR_ACTIVITYKEY = "activityKey"; + private static final String ATTR_TEMPLATE_ID = "templateID"; + private static final String ATTR_REPORT_TYPE = "type"; + private static final String ATTR_CHART_ID = "chartId"; + private static final String ATTR_CHART_TYPE = "chartType"; + private static final String ATTR_CHART_CREATE_TIME = "chartCreateTime"; + private static final String ATTR_CHART_TYPE_TIME = "chartTypeTime"; + private static final String ATTR_CHART_PROPERTY_FIRST_TIME = "chartPropertyFirstTime"; + private static final String ATTR_CHART_PROPERTY_END_TIME = "chartPropertyEndTime"; + private static final String ATTR_JAR_TIME = "jarTime"; + private static final String ATTR_VERSION = "version"; + + private static final int COMPLETE_DAY_COUNT = 3; // 判断图表是否可以上传的天数 + + private String chartId = StringUtils.EMPTY; + + private String templateId = StringUtils.EMPTY; + + private Map chartConsumingMap = new HashMap<>(); + + private BaseBook book; + + private boolean testTemplate; + + private ChartInfo() { + } + + private ChartInfo(String chartId, String templateId, BaseBook book) { + this.chartId = chartId; + this.templateId = templateId; + this.book = book; + } + + public String getChartId() { + return chartId; + } + + @Override + protected String key() { + return chartId; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + this.chartConsumingMap.put(ATTR_TEMPLATE_ID, templateId); + } + + + public BaseBook getBook() { + return book; + } + + @Override + public boolean isTestTemplate() { + return testTemplate; + } + + public void setTestTemplate(boolean testTemplate) { + this.testTemplate = testTemplate; + } + + static ChartInfo newInstanceByRead(XMLableReader reader) { + ChartInfo chartInfo = new ChartInfo(); + reader.readXMLObject(chartInfo); + return chartInfo; + } + + public static ChartInfo newInstance(String chartId, String chartType) { + return newInstance(chartId, chartType, null); + } + + public static ChartInfo newInstance(String chartId, String chartType, String createTime) { + HashMap chartConsumingMap = new HashMap<>(); + + String username = MarketConfig.getInstance().getBbsUsername(); + String uuid = DesignerEnvManager.getEnvManager().getUUID(); + String activityKey = DesignerEnvManager.getEnvManager().getActivationKey(); + + BaseBook book = DesignModelAdapter.getCurrentModelAdapter().getBook(); + String templateId = book.getTemplateID(); + int reportType = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getProcessInfo().getReportType(); + + String typeTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss"); + + createTime = createTime == null ? typeTime : createTime; + + String jarTime = GeneralUtils.readBuildNO(); + String version = ProductConstants.VERSION; + chartConsumingMap.put(ATTR_USERNAME, username); + chartConsumingMap.put(ATTR_UUID, uuid); + chartConsumingMap.put(ATTR_ACTIVITYKEY, activityKey); + chartConsumingMap.put(ATTR_TEMPLATE_ID, templateId); + chartConsumingMap.put(ATTR_REPORT_TYPE, String.valueOf(reportType)); + chartConsumingMap.put(ATTR_CHART_ID, chartId); + chartConsumingMap.put(ATTR_CHART_TYPE, chartType); + chartConsumingMap.put(ATTR_CHART_CREATE_TIME, createTime); + chartConsumingMap.put(ATTR_CHART_TYPE_TIME, typeTime); + chartConsumingMap.put(ATTR_CHART_PROPERTY_FIRST_TIME, ""); + chartConsumingMap.put(ATTR_CHART_PROPERTY_END_TIME, ""); + chartConsumingMap.put(ATTR_JAR_TIME, jarTime); + chartConsumingMap.put(ATTR_VERSION, version); + + ChartInfo chartInfo = new ChartInfo(chartId, templateId, book); + chartInfo.chartConsumingMap = chartConsumingMap; + + return chartInfo; + } + + @Override + public void writeXML(XMLPrintWriter writer) { + writer.startTAG(XML_TAG); + if (StringUtils.isNotEmpty(chartId)) { + writer.attr(ATTR_CHART_ID, this.chartId); + } + if (StringUtils.isNotEmpty(templateId)) { + writer.attr(ATTR_TEMPLATE_ID, this.templateId); + } + if (idleDayCount >= 0) { + writer.attr(ATTR_DAY_COUNT, this.idleDayCount); + } + writer.attr(ATTR_TEST_TEMPLATE, this.testTemplate); + writer.startTAG(XML_CHART_CONSUMING_MAP); + writer.attr(ATTR_USERNAME, chartConsumingMap.get(ATTR_USERNAME)); + writer.attr(ATTR_UUID, chartConsumingMap.get(ATTR_UUID)); + writer.attr(ATTR_ACTIVITYKEY, chartConsumingMap.get(ATTR_ACTIVITYKEY)); + writer.attr(ATTR_REPORT_TYPE, chartConsumingMap.get(ATTR_REPORT_TYPE)); + writer.attr(ATTR_CHART_TYPE, chartConsumingMap.get(ATTR_CHART_TYPE)); + writer.attr(ATTR_CHART_CREATE_TIME, chartConsumingMap.get(ATTR_CHART_CREATE_TIME)); + writer.attr(ATTR_CHART_TYPE_TIME, chartConsumingMap.get(ATTR_CHART_TYPE_TIME)); + writer.attr(ATTR_CHART_PROPERTY_FIRST_TIME, chartConsumingMap.get(ATTR_CHART_PROPERTY_FIRST_TIME)); + writer.attr(ATTR_CHART_PROPERTY_END_TIME, chartConsumingMap.get(ATTR_CHART_PROPERTY_END_TIME)); + writer.attr(ATTR_JAR_TIME, chartConsumingMap.get(ATTR_JAR_TIME)); + writer.attr(ATTR_VERSION, chartConsumingMap.get(ATTR_VERSION)); + writer.end(); + writer.end(); + } + + @Override + public void readXML(XMLableReader reader) { + + if (!reader.isChildNode()) { + idleDayCount = reader.getAttrAsInt(ATTR_DAY_COUNT, 0); + chartId = reader.getAttrAsString(ATTR_CHART_ID, StringUtils.EMPTY); + templateId = reader.getAttrAsString(ATTR_TEMPLATE_ID, StringUtils.EMPTY); + testTemplate = reader.getAttrAsBoolean(ATTR_TEST_TEMPLATE, true); + } else { + String name = reader.getTagName(); + if (XML_CHART_CONSUMING_MAP.equals(name)) { + chartConsumingMap.put(ATTR_USERNAME, reader.getAttrAsString(ATTR_USERNAME, StringUtils.EMPTY)); + chartConsumingMap.put(ATTR_UUID, reader.getAttrAsString(ATTR_UUID, StringUtils.EMPTY)); + chartConsumingMap.put(ATTR_ACTIVITYKEY, reader.getAttrAsString(ATTR_ACTIVITYKEY, StringUtils.EMPTY)); + chartConsumingMap.put(ATTR_TEMPLATE_ID, templateId); + chartConsumingMap.put(ATTR_REPORT_TYPE, reader.getAttrAsString(ATTR_REPORT_TYPE, "0")); + chartConsumingMap.put(ATTR_CHART_ID, chartId); + chartConsumingMap.put(ATTR_CHART_TYPE, reader.getAttrAsString(ATTR_CHART_TYPE, StringUtils.EMPTY)); + chartConsumingMap.put(ATTR_CHART_CREATE_TIME, reader.getAttrAsString(ATTR_CHART_CREATE_TIME, StringUtils.EMPTY)); + chartConsumingMap.put(ATTR_CHART_TYPE_TIME, reader.getAttrAsString(ATTR_CHART_TYPE_TIME, StringUtils.EMPTY)); + chartConsumingMap.put(ATTR_CHART_PROPERTY_FIRST_TIME, reader.getAttrAsString(ATTR_CHART_PROPERTY_FIRST_TIME, StringUtils.EMPTY)); + chartConsumingMap.put(ATTR_CHART_PROPERTY_END_TIME, reader.getAttrAsString(ATTR_CHART_PROPERTY_END_TIME, StringUtils.EMPTY)); + chartConsumingMap.put(ATTR_JAR_TIME, reader.getAttrAsString(ATTR_JAR_TIME, StringUtils.EMPTY)); + chartConsumingMap.put(ATTR_VERSION, reader.getAttrAsString(ATTR_VERSION, "8.0")); + } + } + } + + @Override + public boolean isComplete() { + // 连续3天打开了设计器但是没有编辑 + return idleDayCount > COMPLETE_DAY_COUNT; + } + + @Override + public Map getSendInfo() { + Map sendMap = new HashMap<>(); + sendMap.put(CHART_CONSUMING_URL, new JSONObject(chartConsumingMap).toString()); + return sendMap; + } + + public void updatePropertyTime() { + String propertyTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss"); + + if (StringUtils.isEmpty(chartConsumingMap.get(ATTR_CHART_PROPERTY_FIRST_TIME))) { + chartConsumingMap.put(ATTR_CHART_PROPERTY_FIRST_TIME, propertyTime); + } + chartConsumingMap.put(ATTR_CHART_PROPERTY_END_TIME, propertyTime); + } + + public void updateChartType(String chartType) { + String typeTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss"); + + chartConsumingMap.put(ATTR_CHART_TYPE_TIME, typeTime); + chartConsumingMap.put(ATTR_CHART_TYPE, chartType); + chartConsumingMap.put(ATTR_CHART_PROPERTY_FIRST_TIME, ""); + chartConsumingMap.put(ATTR_CHART_PROPERTY_END_TIME, ""); + } + + @Override + public ChartInfo clone() { + ChartInfo chartInfo = new ChartInfo(); + chartInfo.chartId = this.chartId; + chartInfo.idleDayCount = this.idleDayCount; + chartInfo.templateId = this.templateId; + chartInfo.testTemplate = this.testTemplate; + Map chartConsumingMap = new HashMap<>(); + for (Map.Entry entry : this.chartConsumingMap.entrySet()) { + chartConsumingMap.put(entry.getKey(), entry.getValue()); + } + chartInfo.chartConsumingMap = chartConsumingMap; + return chartInfo; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java new file mode 100644 index 000000000..d622c688a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java @@ -0,0 +1,248 @@ +package com.fr.design.mainframe.chart.info; + +import com.fr.base.io.BaseBook; +import com.fr.chartx.attr.ChartProvider; +import com.fr.design.mainframe.burying.point.AbstractPointCollector; +import com.fr.design.mainframe.template.info.TemplateInfo; +import com.fr.design.mainframe.template.info.TemplateProcessInfo; +import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.vanchart.VanChart; +import com.fr.stable.ProductConstants; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLableReader; +import com.fr.third.joda.time.DateTime; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-02-18 + */ +public class ChartInfoCollector extends AbstractPointCollector { + private static final String XML_TAG = "ChartInfoCollector"; + private static final String XML_LAST_EDIT_DAY = "lastEditDay"; + + private static final String XML_CHART_INFO_LIST = "ChartInfoList"; + private static final String XML_FILE_NAME = "chart.info"; + + private static ChartInfoCollector instance; + + private Map chartInfoCacheMap; + + private String lastEditDay; + + private ChartInfoCollector() { + init(); + } + + private void init() { + chartInfoCacheMap = new HashMap<>(); + } + + public static ChartInfoCollector getInstance() { + if (instance == null) { + instance = new ChartInfoCollector(); + } + return instance; + } + + public void collection(ChartProvider chartProvider, String createTime) { + if (chartProvider instanceof VanChart) { + VanChart vanChart = (VanChart) chartProvider; + collection(vanChart.getUuid(), vanChart.getID(), createTime); + } + } + + /** + * 新建图表,保存状态 + */ + public void collection(String chartId, String chartType, String createTime) { + if (!shouldCollectInfo()) { + return; + } + + ChartInfo chartInfo = ChartInfo.newInstance(chartId, chartType, createTime); + chartInfoCacheMap.put(chartId, chartInfo); + } + + public void updateChartPropertyTime(ChartProvider chartProvider) { + if (chartProvider instanceof VanChart) { + VanChart vanChart = (VanChart) chartProvider; + updateChartPropertyTime(vanChart.getUuid(), vanChart.getID()); + } + } + + /** + * 图表编辑,更新编辑时间 + */ + public void updateChartPropertyTime(String chartId, String chartType) { + if (!shouldCollectInfo()) { + return; + } + ChartInfo chartInfo = getOrCreateChartInfo(chartId, chartType); + + //更新编辑时间 + chartInfo.updatePropertyTime(); + + //重置计数 + chartInfo.resetIdleDayCount(); + } + + public void updateChartTypeTime(ChartProvider chartProvider) { + if (chartProvider instanceof VanChart) { + VanChart vanChart = (VanChart) chartProvider; + updateChartTypeTime(vanChart.getUuid(), vanChart.getID()); + } + } + + /** + * 图表类型变化,更新类型和类型确认时间 + */ + public void updateChartTypeTime(String chartId, String chartType) { + if (!shouldCollectInfo()) { + return; + } + + ChartInfo chartInfo = getOrCreateChartInfo(chartId, chartType); + + //更新类型确认时间和类型 + chartInfo.updateChartType(chartType); + + //重置计数 + chartInfo.resetIdleDayCount(); + } + + private ChartInfo getOrCreateChartInfo(String chartId, String chartType) { + //缓存中有从缓存中拿 + if (chartInfoCacheMap.containsKey(chartId)) { + return chartInfoCacheMap.get(chartId); + } + //缓存中没有从文件中读取的信息中拷贝到缓存 + if (pointInfoMap.containsKey(chartId)) { + ChartInfo chartInfo = pointInfoMap.get(chartId).clone(); + chartInfoCacheMap.put(chartId, chartInfo); + return chartInfo; + } + //都有的话创建一个并加入到缓存中 + ChartInfo chartInfo = ChartInfo.newInstance(chartId, chartType); + chartInfoCacheMap.put(chartId, chartInfo); + return chartInfo; + } + + /** + * 保存模板的时候将该模板中的图表埋点信息保存 + */ + @Override + public void collectInfo(String templateId, String originID, TemplateProcessInfo processInfo, int timeConsume) { + if (!shouldCollectInfo()) { + return; + } + if (StringUtils.isEmpty(originID)) { + originID = templateId; + } + boolean testTemplate = isTestTemplate(processInfo); + + for (ChartInfo chartInfo : pointInfoMap.values()) { + if (originID.equals(chartInfo.getTemplateId())) { + chartInfo.setTemplateId(templateId); + chartInfo.setTestTemplate(testTemplate); + } + } + + for (ChartInfo chartInfo : chartInfoCacheMap.values()) { + BaseBook book = chartInfo.getBook(); + if ((book != null && templateId.equals(book.getTemplateID())) || + originID.equals(chartInfo.getTemplateId())) { + chartInfo.setTemplateId(templateId); + chartInfo.setTestTemplate(testTemplate); + pointInfoMap.put(chartInfo.getChartId(), chartInfo); + } + } + + // 每次更新之后,都同步到暂存文件中 + saveInfo(); + } + + private boolean isTestTemplate(TemplateProcessInfo processInfo) { + int reportType = processInfo.getReportType(); + int cellCount = processInfo.getCellCount(); + int floatCount = processInfo.getFloatCount(); + int blockCount = processInfo.getBlockCount(); + int widgetCount = processInfo.getWidgetCount(); + + return TemplateInfo.isTestTemplate(reportType, cellCount, floatCount, blockCount, widgetCount); + } + + /** + * 更新 day_count:打开设计器却未编辑图表的连续日子 + */ + @Override + protected void addIdleDayCount() { + // 判断今天是否第一次打开设计器,为了防止同一天内,多次 addIdleDayCount + String today = DateTime.now().toString("yyyy-MM-dd"); + if (ComparatorUtils.equals(today, lastEditDay)) { + return; + } + for (ChartInfo chartInfo : pointInfoMap.values()) { + chartInfo.addIdleDayCountByOne(); + } + lastEditDay = today; + } + + + /** + * 获取缓存文件存放路径 + */ + @Override + protected File getInfoFile() { + File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), XML_FILE_NAME)); + try { + if (!file.exists()) { + file.createNewFile(); + } + } catch (Exception ex) { + FineLoggerFactory.getLogger().error(ex.getMessage(), ex); + } + return file; + } + + @Override + public void readXML(XMLableReader reader) { + if (reader.isChildNode()) { + try { + String name = reader.getTagName(); + if (ChartInfo.XML_TAG.equals(name)) { + ChartInfo chartInfo = ChartInfo.newInstanceByRead(reader); + pointInfoMap.put(chartInfo.getChartId(), chartInfo); + } else if (XML_LAST_EDIT_DAY.equals(name)) { + lastEditDay = reader.getElementValue(); + } + } catch (Exception ex) { + // 什么也不做,使用默认值 + } + } + } + + @Override + public void writeXML(XMLPrintWriter writer) { + writer.startTAG(XML_TAG); + + writer.startTAG(XML_LAST_EDIT_DAY); + writer.textNode(lastEditDay); + writer.end(); + + writer.startTAG(XML_CHART_INFO_LIST); + for (ChartInfo chartInfo : pointInfoMap.values()) { + chartInfo.writeXML(writer); + } + writer.end(); + + writer.end(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/template/info/SendHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/template/info/SendHelper.java index db489fb3c..694389f30 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/template/info/SendHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/template/info/SendHelper.java @@ -1,7 +1,7 @@ package com.fr.design.mainframe.template.info; import com.fr.design.mainframe.SiteCenterToken; -import com.fr.general.CloudCenter; +import com.fr.design.mainframe.burying.point.BasePointInfo; import com.fr.general.ComparatorUtils; import com.fr.general.http.HttpToolbox; import com.fr.json.JSONObject; @@ -14,23 +14,20 @@ import java.util.Map; * 负责向服务器发送信息 * Created by plough on 2019/4/18. */ -class SendHelper { - private static final String CONSUMING_URL = CloudCenter.getInstance().acquireUrlByKind("tempinfo.consuming") + "/single"; - private static final String PROCESS_URL = CloudCenter.getInstance().acquireUrlByKind("tempinfo.process") + "/single"; - - private static boolean sendConsumingInfo(String content) { - return sendSingleTemplateInfo(CONSUMING_URL, content); - } - - private static boolean sendProcessInfo(String content) { - return sendSingleTemplateInfo(PROCESS_URL, content); - } - - static boolean sendTemplateInfo(TemplateInfo templateInfo) { - return SendHelper.sendConsumingInfo(templateInfo.getConsumingMapJsonString()) && SendHelper.sendProcessInfo(templateInfo.getProcessMapJsonString()); +public class SendHelper { + + public static boolean sendPointInfo(BasePointInfo pointInfo) { + boolean success = true; + Map sendInfo = pointInfo.getSendInfo(); + for (Map.Entry entry : sendInfo.entrySet()) { + if (!sendSinglePointInfo(entry.getKey(), entry.getValue())) { + success = false; + } + } + return success; } - private static boolean sendSingleTemplateInfo(String url, String content) { + private static boolean sendSinglePointInfo(String url, String content) { Map para = new HashMap<>(); para.put("token", SiteCenterToken.generateToken()); para.put("content", content); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfo.java b/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfo.java index 900210bd0..e233bc6e5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfo.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfo.java @@ -2,13 +2,13 @@ package com.fr.design.mainframe.template.info; import com.fr.config.MarketConfig; import com.fr.design.DesignerEnvManager; +import com.fr.design.mainframe.burying.point.AbstractPointInfo; +import com.fr.general.CloudCenter; import com.fr.general.GeneralUtils; import com.fr.json.JSONObject; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.xml.XMLPrintWriter; -import com.fr.stable.xml.XMLReadable; -import com.fr.stable.xml.XMLWriter; import com.fr.stable.xml.XMLableReader; import java.text.SimpleDateFormat; @@ -20,9 +20,12 @@ import java.util.Map; * 对应一张模版的记录 * Created by plough on 2019/4/18. */ -class TemplateInfo implements XMLReadable, XMLWriter { +public class TemplateInfo extends AbstractPointInfo { static final String XML_TAG = "TemplateInfo"; + private static final String CONSUMING_URL = CloudCenter.getInstance().acquireUrlByKind("tempinfo.consuming") + "/single"; + private static final String PROCESS_URL = CloudCenter.getInstance().acquireUrlByKind("tempinfo.process") + "/single"; + private static final String XML_PROCESS_MAP = "processMap"; private static final String XML_CONSUMING_MAP = "consumingMap"; private static final String ATTR_DAY_COUNT = "day_count"; @@ -47,7 +50,6 @@ class TemplateInfo implements XMLReadable, XMLWriter { private static final int VALID_WIDGET_COUNT = 5; // 有效报表模板的控件数 private static final int COMPLETE_DAY_COUNT = 15; // 判断模板是否完成的天数 - private int idleDayCount; // 到现在为止,模版闲置(上次保存后没有再编辑过)的天数 private String templateID = StringUtils.EMPTY; private String originID = StringUtils.EMPTY; // todo: processMap 和 consumingMap 还可以再拆解为小类,以后继续重构 @@ -62,17 +64,22 @@ class TemplateInfo implements XMLReadable, XMLWriter { this.originID = originID; } - static TemplateInfo newInstanceByRead(XMLableReader reader) { + @Override + protected String key() { + return templateID; + } + + public static TemplateInfo newInstanceByRead(XMLableReader reader) { TemplateInfo templateInfo = new TemplateInfo(); reader.readXMLObject(templateInfo); return templateInfo; } - static TemplateInfo newInstance(String templateID) { + public static TemplateInfo newInstance(String templateID) { return newInstance(templateID, StringUtils.EMPTY, 0); } - static TemplateInfo newInstance(String templateID, String originID, int originTime) { + public static TemplateInfo newInstance(String templateID, String originID, int originTime) { HashMap consumingMap = new HashMap<>(); String username = MarketConfig.getInstance().getBbsUsername(); @@ -107,9 +114,10 @@ class TemplateInfo implements XMLReadable, XMLWriter { } int getTimeConsume() { - return (int)consumingMap.get(ATTR_TIME_CONSUME); + return (int) consumingMap.get(ATTR_TIME_CONSUME); } + @Override public void writeXML(XMLPrintWriter writer) { writer.startTAG(XML_TAG); if (StringUtils.isNotEmpty(templateID)) { @@ -144,13 +152,14 @@ class TemplateInfo implements XMLReadable, XMLWriter { writer.attr(ATTR_JAR_TIME, (String) consumingMap.get(ATTR_JAR_TIME)); writer.attr(ATTR_CREATE_TIME, (String) consumingMap.get(ATTR_CREATE_TIME)); writer.attr(ATTR_UUID, (String) consumingMap.get(ATTR_UUID)); - writer.attr(ATTR_TIME_CONSUME, (int)consumingMap.get(ATTR_TIME_CONSUME)); - writer.attr(ATTR_ORIGIN_TIME, (int)consumingMap.get(ATTR_ORIGIN_TIME)); + writer.attr(ATTR_TIME_CONSUME, (int) consumingMap.get(ATTR_TIME_CONSUME)); + writer.attr(ATTR_ORIGIN_TIME, (int) consumingMap.get(ATTR_ORIGIN_TIME)); writer.attr(ATTR_VERSION, (String) consumingMap.get(ATTR_VERSION)); writer.attr(ATTR_USERNAME, (String) consumingMap.get(ATTR_USERNAME)); writer.end(); } + @Override public void readXML(XMLableReader reader) { if (!reader.isChildNode()) { idleDayCount = reader.getAttrAsInt(ATTR_DAY_COUNT, 0); @@ -185,7 +194,8 @@ class TemplateInfo implements XMLReadable, XMLWriter { } } - boolean isTestTemplate() { + @Override + protected boolean isTestTemplate() { if (!isComplete()) { return false; } @@ -195,6 +205,10 @@ class TemplateInfo implements XMLReadable, XMLWriter { int floatCount = (int) processMap.get(ATTR_FLOAT_COUNT); int blockCount = (int) processMap.get(ATTR_BLOCK_COUNT); int widgetCount = (int) processMap.get(ATTR_WIDGET_COUNT); + return isTestTemplate(reportType, cellCount, floatCount, blockCount, widgetCount); + } + + public static boolean isTestTemplate(int reportType, int cellCount, int floatCount, int blockCount, int widgetCount) { boolean isTestTemplate; if (reportType == 0) { // 普通报表 isTestTemplate = cellCount <= VALID_CELL_COUNT && floatCount <= 1 && widgetCount <= VALID_WIDGET_COUNT; @@ -206,7 +220,8 @@ class TemplateInfo implements XMLReadable, XMLWriter { return isTestTemplate; } - boolean isComplete() { + @Override + protected boolean isComplete() { // 条件 1. 超过15天未编辑 // 条件 2. 设计器在这段未编辑的时间内启动超过 X 次(目前定的 X = 3)。即"设计器最近 X 次启动的时间跨度" < "未编辑时间"; @@ -214,20 +229,16 @@ class TemplateInfo implements XMLReadable, XMLWriter { && DesignerOpenHistory.getInstance().isOpenEnoughTimesInPeriod(idleDayCount); } - String getConsumingMapJsonString() { - return new JSONObject(consumingMap).toString(); - } - - String getProcessMapJsonString() { - return new JSONObject(processMap).toString(); - } - - boolean isReadyForSend() { - return isComplete() && !isTestTemplate(); + @Override + public Map getSendInfo() { + Map sendMap = new HashMap<>(); + sendMap.put(CONSUMING_URL, new JSONObject(consumingMap).toString()); + sendMap.put(PROCESS_URL, new JSONObject(processMap).toString()); + return sendMap; } void addTimeConsume(int timeConsume) { - timeConsume += (int)consumingMap.get(ATTR_TIME_CONSUME); // 加上之前的累计编辑时间 + timeConsume += (int) consumingMap.get(ATTR_TIME_CONSUME); // 加上之前的累计编辑时间 consumingMap.put(ATTR_TIME_CONSUME, timeConsume); } @@ -246,14 +257,6 @@ class TemplateInfo implements XMLReadable, XMLWriter { this.processMap = processMap; } - void resetIdleDayCount() { - this.idleDayCount = 0; - } - - void addIdleDayCountByOne() { - this.idleDayCount += 1; - } - int getIdleDayCount() { return this.idleDayCount; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java index 9a13ed9d7..8c4e7f18d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/template/info/TemplateInfoCollector.java @@ -1,54 +1,26 @@ package com.fr.design.mainframe.template.info; -import com.fr.base.FRContext; -import com.fr.base.io.XMLReadHelper; -import com.fr.design.DesignerEnvManager; -import com.fr.log.FineLoggerFactory; +import com.fr.design.mainframe.burying.point.AbstractPointCollector; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.xml.XMLPrintWriter; -import com.fr.stable.xml.XMLReadable; -import com.fr.stable.xml.XMLTools; -import com.fr.stable.xml.XMLWriter; import com.fr.stable.xml.XMLableReader; -import com.fr.third.javax.xml.stream.XMLStreamException; -import com.fr.third.org.apache.commons.io.FileUtils; -import java.io.ByteArrayOutputStream; import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; /** * 做模板的过程和耗时收集,辅助类 * Created by plough on 2017/2/21. */ -public class TemplateInfoCollector implements XMLReadable, XMLWriter { +public class TemplateInfoCollector extends AbstractPointCollector { private static final String XML_TAG = "TplInfo"; private static final String XML_TEMPLATE_INFO_LIST = "TemplateInfoList"; private static final String XML_FILE_NAME = "tpl.info"; private static TemplateInfoCollector instance; - private static final int MAX_SIZE = 512 * 1024 * 1024; - private Map templateInfoMap; private DesignerOpenHistory designerOpenHistory; private TemplateInfoCollector() { - init(); - } - - private void init() { - templateInfoMap = new HashMap<>(); - designerOpenHistory = DesignerOpenHistory.getInstance(); - - loadFromFile(); } public static TemplateInfoCollector getInstance() { @@ -62,17 +34,19 @@ public class TemplateInfoCollector implements XMLReadable, XMLWriter { * 根据模板ID是否在收集列表中,判断是否需要收集当前模板的信息 */ public boolean contains(String templateID) { - return StringUtils.isNotEmpty(templateID) && templateInfoMap.containsKey(templateID); + return StringUtils.isNotEmpty(templateID) && pointInfoMap.containsKey(templateID); } /** * 收集模板信息。如果之前没有记录,则新增;如果已有记录,则更新。 * 同时将最新数据保存到文件中。 - * @param templateID 模版id - * @param originID 模版的原始id,仅对另存为的模版有效,对于非另存为的模版,值总是为空 + * + * @param templateID 模版id + * @param originID 模版的原始id,仅对另存为的模版有效,对于非另存为的模版,值总是为空 * @param processInfo 包含模版的一些基本信息(如模版类型、包含控件数量等) * @param timeConsume 本次制作耗时,单位为 s */ + @Override public void collectInfo(String templateID, String originID, TemplateProcessInfo processInfo, int timeConsume) { if (!shouldCollectInfo()) { return; @@ -80,11 +54,11 @@ public class TemplateInfoCollector implements XMLReadable, XMLWriter { TemplateInfo templateInfo; if (this.contains(templateID)) { - templateInfo = templateInfoMap.get(templateID); + templateInfo = pointInfoMap.get(templateID); } else { - int originTime = this.contains(originID) ? templateInfoMap.get(originID).getTimeConsume() : 0; + int originTime = this.contains(originID) ? pointInfoMap.get(originID).getTimeConsume() : 0; templateInfo = TemplateInfo.newInstance(templateID, originID, originTime); - templateInfoMap.put(templateID, templateInfo); + pointInfoMap.put(templateID, templateInfo); } // 收集制作耗时 @@ -98,137 +72,51 @@ public class TemplateInfoCollector implements XMLReadable, XMLWriter { saveInfo(); } - /** - * 发送本地模板信息到服务器,并清空已发送模版的本地记录 - */ - public void sendTemplateInfo() { - // 每次启动设计器后,都会执行这个函数(被 InformationCollector 的 collectStartTime 调用) - addIdleDayCount(); - - removeTestTemplates(); - - List removeLaterList = new ArrayList<>(); - - for (String key : templateInfoMap.keySet()) { - TemplateInfo templateInfo = templateInfoMap.get(key); - if (templateInfo.isReadyForSend()) { - if (SendHelper.sendTemplateInfo(templateInfo)) { - removeLaterList.add(key); - } - } - } - - // 清空记录 - for (String key : removeLaterList) { - removeFromTemplateInfoList(key); - } - - saveInfo(); - } - /** * 获取缓存文件存放路径 */ - private static File getInfoFile() { + @Override + protected File getInfoFile() { return new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), XML_FILE_NAME)); } - void loadFromFile() { - if (!getInfoFile().exists()) { - return; - } - - XMLableReader reader = null; - try (InputStream in = new FileInputStream(getInfoFile())) { - // XMLableReader 还是应该考虑实现 Closable 接口的,这样就能使用 try-with 语句了 - reader = XMLReadHelper.createXMLableReader(in, XMLPrintWriter.XML_ENCODER); - reader.readXMLObject(this); - } catch (FileNotFoundException e) { - // do nothing - } catch (XMLStreamException | IOException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } finally { - try { - if (reader != null) { - reader.close(); - } - } catch (XMLStreamException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - } - TemplateInfo getOrCreateTemplateInfoByID(String templateID) { - if (templateInfoMap.containsKey(templateID)) { - return templateInfoMap.get(templateID); + if (pointInfoMap.containsKey(templateID)) { + return pointInfoMap.get(templateID); } TemplateInfo templateInfo = TemplateInfo.newInstance(templateID); - templateInfoMap.put(templateID, templateInfo); + pointInfoMap.put(templateID, templateInfo); return templateInfo; } - private boolean shouldCollectInfo() { - return FileUtils.sizeOf(getInfoFile()) <= MAX_SIZE && DesignerEnvManager.getEnvManager().isJoinProductImprove() && FRContext.isChineseEnv(); - } - - /** - * 将包含所有信息的对象保存到文件 - */ - private void saveInfo() { - try { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - XMLTools.writeOutputStreamXML(this, out); - out.flush(); - out.close(); - String fileContent = new String(out.toByteArray(), StandardCharsets.UTF_8); - FileUtils.writeStringToFile(getInfoFile(), fileContent, StandardCharsets.UTF_8); - } catch (Exception ex) { - FineLoggerFactory.getLogger().error(ex.getMessage()); - } - } - /** * 更新 day_count:打开设计器却未编辑模板的连续日子 */ - private void addIdleDayCount() { + @Override + protected void addIdleDayCount() { // 判断今天是否第一次打开设计器,为了防止同一天内,多次 addIdleDayCount if (designerOpenHistory.hasOpenedToday()) { return; } - for (TemplateInfo templateInfo : templateInfoMap.values()) { + for (TemplateInfo templateInfo : pointInfoMap.values()) { templateInfo.addIdleDayCountByOne(); } designerOpenHistory.update(); } - // 删除所有已完成的测试模版 - private void removeTestTemplates() { - ArrayList testTemplateKeys = new ArrayList<>(); // 保存测试模板的key - for (String key : templateInfoMap.keySet()) { - if (templateInfoMap.get(key).isTestTemplate()) { - testTemplateKeys.add(key); - } - } - // 删除测试模板 - for (String key : testTemplateKeys) { - removeFromTemplateInfoList(key); - } - } - - private void removeFromTemplateInfoList(String key) { - templateInfoMap.remove(key); - } - @Override public void readXML(XMLableReader reader) { if (reader.isChildNode()) { try { String name = reader.getTagName(); if (DesignerOpenHistory.XML_TAG.equals(name)) { + if (designerOpenHistory == null) { + designerOpenHistory = DesignerOpenHistory.getInstance(); + } reader.readXMLObject(designerOpenHistory); } else if (TemplateInfo.XML_TAG.equals(name)) { TemplateInfo templateInfo = TemplateInfo.newInstanceByRead(reader); - templateInfoMap.put(templateInfo.getTemplateID(), templateInfo); + pointInfoMap.put(templateInfo.getTemplateID(), templateInfo); } } catch (Exception ex) { // 什么也不做,使用默认值 @@ -243,7 +131,7 @@ public class TemplateInfoCollector implements XMLReadable, XMLWriter { designerOpenHistory.writeXML(writer); writer.startTAG(XML_TEMPLATE_INFO_LIST); - for (TemplateInfo templateInfo : templateInfoMap.values()) { + for (TemplateInfo templateInfo : pointInfoMap.values()) { templateInfo.writeXML(writer); } writer.end(); diff --git a/designer-base/src/test/java/com/fr/design/mainframe/template/info/SendHelperTest.java b/designer-base/src/test/java/com/fr/design/mainframe/template/info/SendHelperTest.java index fb89143d8..8da46557c 100644 --- a/designer-base/src/test/java/com/fr/design/mainframe/template/info/SendHelperTest.java +++ b/designer-base/src/test/java/com/fr/design/mainframe/template/info/SendHelperTest.java @@ -1,10 +1,12 @@ package com.fr.design.mainframe.template.info; import com.fr.invoke.Reflect; +import com.fr.json.JSONObject; import com.fr.stable.xml.XMLableReader; import com.fr.third.javax.xml.stream.XMLStreamException; import java.io.StringReader; +import java.util.Map; import static org.junit.Assert.assertTrue; @@ -25,11 +27,12 @@ public class SendHelperTest { StringReader sr = new StringReader(NORMAL_INFO); XMLableReader xmlReader = XMLableReader.createXMLableReader(sr); TemplateInfo templateInfo = TemplateInfo.newInstanceByRead(xmlReader); - - boolean res = Reflect.on(SendHelper.class).call("sendSingleTemplateInfo", CONSUMING_URL, templateInfo.getConsumingMapJsonString()).get(); + Map consumingMap = Reflect.on(templateInfo).field("consumingMap").get(); + Map processMap = Reflect.on(templateInfo).field("processMap").get(); + boolean res = Reflect.on(SendHelper.class).call("sendSinglePointInfo", CONSUMING_URL, new JSONObject(consumingMap).toString()).get(); assertTrue(res); - boolean res2 = Reflect.on(SendHelper.class).call("sendSingleTemplateInfo", PROCESS_URL, templateInfo.getProcessMapJsonString()).get(); + boolean res2 = Reflect.on(SendHelper.class).call("sendSinglePointInfo", PROCESS_URL, new JSONObject(processMap).toString()).get(); assertTrue(res2); } } diff --git a/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoCollectorTest.java b/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoCollectorTest.java index d93a7476a..3235473c6 100644 --- a/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoCollectorTest.java +++ b/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoCollectorTest.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.template.info; import com.fr.config.MarketConfig; import com.fr.general.GeneralUtils; import com.fr.invoke.Reflect; +import com.fr.json.JSONObject; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.third.org.apache.commons.io.FileUtils; @@ -71,7 +72,7 @@ public class TemplateInfoCollectorTest { assertEquals(",,", DesignerOpenHistory.getInstance().toString()); TemplateInfoCollector collector = TemplateInfoCollector.getInstance(); - assertEquals(7, ((Map) Reflect.on(collector).field("templateInfoMap").get()).size()); + assertEquals(7, ((Map) Reflect.on(collector).field("pointInfoMap").get()).size()); assertEquals("2019-04-08,2019-04-03,2019-03-29", DesignerOpenHistory.getInstance().toString()); } @@ -86,18 +87,21 @@ public class TemplateInfoCollectorTest { collector.collectInfo(templateID, StringUtils.EMPTY, mockProcessInfo, timeConsume); // 检查是否写入成功 - collector.loadFromFile(); + Reflect.on(collector).call("loadFromFile"); TemplateInfo templateInfo = collector.getOrCreateTemplateInfoByID(templateID); + Map consumingMap = Reflect.on(templateInfo).field("consumingMap").get(); + Map processMap = Reflect.on(templateInfo).field("processMap").get(); + assertJsonStringEquals("{\"process\":\"\",\"float_count\":1,\"widget_count\":0," + "\"cell_count\":13,\"block_count\":3,\"report_type\":0," + - "\"templateID\":\"16a988ce-8529-42f5-b17c-2ee849355071\"}", templateInfo.getProcessMapJsonString()); + "\"templateID\":\"16a988ce-8529-42f5-b17c-2ee849355071\"}", new JSONObject(processMap).toString()); assertJsonStringEquals("{\"activitykey\":\"2e0ea413-fa9c241e0-9723-4354fce51e81\"," + "\"jar_time\":\"不是安装版本\",\"create_time\":\"2019-03-26 16:13\"," + "\"templateID\":\"16a988ce-8529-42f5-b17c-2ee849355071\",\"originID\":\"\"," + "\"uuid\":\"476ca2cc-f789-4c5d-8e89-ef146580775c\",\"time_consume\":329,\"originTime\":0," + - "\"version\":\"10.0\",\"username\":\"plough\"}", templateInfo.getConsumingMapJsonString()); + "\"version\":\"10.0\",\"username\":\"plough\"}", new JSONObject(consumingMap).toString()); } @Test @@ -112,15 +116,17 @@ public class TemplateInfoCollectorTest { collector.collectInfo(templateID, StringUtils.EMPTY, mockProcessInfo, timeConsume); // 检查是否写入成功 - collector.loadFromFile(); + Reflect.on(collector).call("loadFromFile"); assertTrue(collector.contains(templateID)); TemplateInfo templateInfo = collector.getOrCreateTemplateInfoByID(templateID); + Map processMap = Reflect.on(templateInfo).field("processMap").get(); + assertEquals(templateID, templateInfo.getTemplateID()); assertJsonStringEquals("{\"process\":\"\",\"float_count\":1,\"widget_count\":0," + "\"cell_count\":13,\"block_count\":3,\"report_type\":0," + - "\"templateID\":\"73a97777-8jnk-47cd-b57c-2ee89991279796\"}", templateInfo.getProcessMapJsonString()); + "\"templateID\":\"73a97777-8jnk-47cd-b57c-2ee89991279796\"}", new JSONObject(processMap).toString()); Map consumingMap = Reflect.on(templateInfo).field("consumingMap").get(); assertEquals(templateID, consumingMap.get("templateID")); @@ -142,12 +148,13 @@ public class TemplateInfoCollectorTest { collector.collectInfo(templateID, originID, mockProcessInfo, timeConsume); // 检查是否写入成功 - collector.loadFromFile(); + Reflect.on(collector).call("loadFromFile"); TemplateInfo templateInfo = collector.getOrCreateTemplateInfoByID(templateID); + Map processMap = Reflect.on(templateInfo).field("processMap").get(); assertJsonStringEquals("{\"process\":\"\",\"float_count\":1,\"widget_count\":0," + "\"cell_count\":13,\"block_count\":3,\"report_type\":0," + - "\"templateID\":\"423238d4-5223-22vj-vlsj-42jc49245iw3\"}", templateInfo.getProcessMapJsonString()); + "\"templateID\":\"423238d4-5223-22vj-vlsj-42jc49245iw3\"}", new JSONObject(processMap).toString()); Map consumingMap = Reflect.on(templateInfo).field("consumingMap").get(); assertEquals(templateID, consumingMap.get("templateID")); diff --git a/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoTest.java b/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoTest.java index 426dba3b1..7f0ddd0bc 100644 --- a/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoTest.java +++ b/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoTest.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.template.info; import com.fr.config.MarketConfig; import com.fr.general.GeneralUtils; import com.fr.invoke.Reflect; +import com.fr.json.JSONObject; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.xml.XMLableReader; @@ -55,7 +56,6 @@ public class TemplateInfoTest { assertEquals(templateID, templateInfo.getTemplateID()); assertEquals(StringUtils.EMPTY, Reflect.on(templateInfo).field("originID").get()); assertEquals(0, (int) Reflect.on(templateInfo).field("idleDayCount").get()); - assertEquals("{}", templateInfo.getProcessMapJsonString()); Map consumingMap = Reflect.on(templateInfo).field("consumingMap").get(); assertEquals(templateID, consumingMap.get("templateID")); @@ -78,7 +78,6 @@ public class TemplateInfoTest { assertEquals(templateID, templateInfo.getTemplateID()); assertEquals(originID, Reflect.on(templateInfo).field("originID").get()); assertEquals(0, (int) Reflect.on(templateInfo).field("idleDayCount").get()); - assertEquals("{}", templateInfo.getProcessMapJsonString()); Map consumingMap = Reflect.on(templateInfo).field("consumingMap").get(); assertEquals(templateID, consumingMap.get("templateID")); @@ -97,24 +96,25 @@ public class TemplateInfoTest { } @Test - public void testGetConsumingMapJsonString() { + public void testGetSendInfo() { + + Map consumingMap = Reflect.on(templateInfo).field("consumingMap").get(); + Map processMap = Reflect.on(templateInfo).field("processMap").get(); + Map consumingMap1 = Reflect.on(templateInfoSaveAs).field("consumingMap").get(); + Map processMap1 = Reflect.on(templateInfoSaveAs).field("processMap").get(); assertJsonStringEquals("{\"activitykey\":\"2e0ea413-fa9c241e0-9723-4354fce51e81\",\"jar_time\":\"不是安装版本\"," + "\"create_time\":\"2019-03-26 16:13\",\"templateID\":\"16a988ce-8529-42f5-b17c-2ee849355071\",\"originID\":\"\"," + "\"uuid\":\"476ca2cc-f789-4c5d-8e89-ef146580775c\",\"time_consume\":129,\"originTime\":0,\"version\":\"10.0\"," + - "\"username\":\"plough\"}", templateInfo.getConsumingMapJsonString()); + "\"username\":\"plough\"}", new JSONObject(consumingMap).toString()); assertJsonStringEquals("{\"activitykey\":\"2e0ea413-fa9c241e0-9723-4354fce51e81\",\"jar_time\":\"不是安装版本\"," + "\"create_time\":\"2019-03-26 16:13\",\"templateID\":\"49avd2c4-1104-92j2-wx24-3dd0k2136080\",\"originID\":\"16a988ce-8529-42f5-b17c-2ee849355071\"," + "\"uuid\":\"476ca2cc-f789-4c5d-8e89-ef146580775c\",\"time_consume\":429,\"originTime\":129,\"version\":\"10.0\"," + - "\"username\":\"plough\"}", templateInfoSaveAs.getConsumingMapJsonString()); - } - - @Test - public void testGetProcessMapJsonString() { + "\"username\":\"plough\"}", new JSONObject(consumingMap1).toString()); assertJsonStringEquals("{\"process\":\"\",\"float_count\":0,\"widget_count\":0,\"cell_count\":1," + - "\"block_count\":0,\"report_type\":0,\"templateID\":\"16a988ce-8529-42f5-b17c-2ee849355071\"}", templateInfo.getProcessMapJsonString()); + "\"block_count\":0,\"report_type\":0,\"templateID\":\"16a988ce-8529-42f5-b17c-2ee849355071\"}", new JSONObject(processMap).toString()); assertJsonStringEquals("{\"process\":\"\",\"float_count\":0,\"widget_count\":0,\"cell_count\":1," + - "\"block_count\":0,\"report_type\":0,\"templateID\":\"49avd2c4-1104-92j2-wx24-3dd0k2136080\"}", templateInfoSaveAs.getProcessMapJsonString()); + "\"block_count\":0,\"report_type\":0,\"templateID\":\"49avd2c4-1104-92j2-wx24-3dd0k2136080\"}", new JSONObject(processMap1).toString()); } private TemplateInfo createTemplateInfo(String xmlContent) throws XMLStreamException { diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java b/designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java index a7dd9f564..623271873 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java @@ -1,5 +1,14 @@ package com.fr.design.chart; +import com.fr.base.chart.BaseChartCollection; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.gui.chart.MiddleChartDialog; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.third.joda.time.DateTime; + +import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Dialog; import java.awt.FlowLayout; @@ -7,16 +16,6 @@ import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.JPanel; - -import com.fr.base.chart.BaseChartCollection; -import com.fr.chart.chartattr.ChartCollection; -import com.fr.design.gui.chart.MiddleChartDialog; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.dialog.BasicDialog; - -import com.fr.design.utils.gui.GUICoreUtils; - /** * 封装一层 图表新建的对话框, 配合属性表确定: 先单独只要一种图表类型的对话框. * @author kunsnat E-mail:kunsnat@gmail.com @@ -40,6 +39,8 @@ public class ChartDialog extends MiddleChartDialog { } private void initComponent() { + final String createTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss"); + this.setModal(true); this.setLayout(new BorderLayout()); final ChartTypePane chartTypePane = new ChartTypePane(); @@ -63,7 +64,7 @@ public class ChartDialog extends MiddleChartDialog { ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - chartTypePane.update((ChartCollection)cc); + chartTypePane.update((ChartCollection)cc, createTime); doOK(); } }); diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index 19c613785..2bb9a99f2 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java @@ -9,6 +9,7 @@ import com.fr.chartx.attr.ChartProvider; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; @@ -119,6 +120,10 @@ public class ChartTypePane extends ChartCommonWizardPane { } public void update(ChartCollection cc) { + update(cc, null); + } + + public void update(ChartCollection cc, String createTime) { if (cc == null) { return; } @@ -130,6 +135,8 @@ public class ChartTypePane extends ChartCommonWizardPane { try { chart4Update = (ChartProvider) chart.clone(); cc.addChart(chart4Update); + //记录埋点 + ChartInfoCollector.getInstance().collection(chart4Update, createTime); } catch (CloneNotSupportedException ex) { FineLoggerFactory.getLogger().error(ex.getMessage(), ex); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java index a2d824f51..ecdb1212e 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java @@ -19,6 +19,7 @@ import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartOtherPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartTypePane; +import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.vanchart.VanChart; @@ -26,13 +27,13 @@ import com.fr.plugin.chart.vanchart.VanChart; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.BorderLayout; -import java.awt.CardLayout; import java.util.ArrayList; import java.util.Calendar; import java.util.List; +import java.awt.BorderLayout; +import java.awt.CardLayout; -public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4DataSourceChange, ChartEditPaneProvider { +public class ChartEditPane extends BasicPane implements AttributeChange, Prepare4DataSourceChange, ChartEditPaneProvider { private final static int CHANGE_MIN_TIME = 80; @@ -107,6 +108,9 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 return; } AbstractChartAttrPane selectedPane = paneList.get(tabsHeaderIconPane.getSelectedIndex()); + //图表配置变化,埋点记录 + ChartInfoCollector.getInstance().updateChartPropertyTime(collection.getSelectedChartProvider(ChartProvider.class)); + selectedPane.update(collection); if (!ComparatorUtils.equals(collection, lastCollection)) { @@ -122,7 +126,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error("error in clone ChartEditPane"); } - if(ComparatorUtils.equals(selectedPane.title4PopupWindow(),PaneTitleConstants.CHART_STYLE_TITLE)){ + if (ComparatorUtils.equals(selectedPane.title4PopupWindow(), PaneTitleConstants.CHART_STYLE_TITLE)) { dealWithStyleChange(); } @@ -138,10 +142,11 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 /** * 重新构造面板 + * * @param currentChart 图表 */ public void reLayout(ChartProvider currentChart) { - if(currentChart != null){ + if (currentChart != null) { int chartIndex = getSelectedChartIndex(currentChart); this.removeAll(); this.setLayout(new BorderLayout()); @@ -151,18 +156,18 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 String chartID = currentChart.getID(); boolean isDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID); - if(isDefault){ + if (isDefault) { paneList.add(dataPane4SupportCell); paneList.add(stylePane); paneList.add(otherPane); this.isDefaultPane = true; - }else{ + } else { ChartDataPane chartDataPane = createChartDataPane(chartID); if (chartDataPane != null) { paneList.add(chartDataPane); } AbstractChartAttrPane[] otherPaneList = ChartTypeInterfaceManager.getInstance().getAttrPaneArray(chartID, listener); - for(int i = 0; i < otherPaneList.length; i++){ + for (int i = 0; i < otherPaneList.length; i++) { otherPaneList[i].addAttributeChangeListener(listener); paneList.add(otherPaneList[i]); } @@ -235,7 +240,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 if (checkNeedsReLayout(chartProvider)) { String chartID = chartProvider.getID(); if ("WaferChipChart".equals(chartID) || "BoxPlotChart".equals(chartID)) { - reLayout((Chart)chartProvider); + reLayout((Chart) chartProvider); } else { reLayout(chartProvider); } @@ -266,10 +271,10 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 public int getSelectedChartIndex(ChartProvider chart) { int index = 0; - if(typePane != null){ + if (typePane != null) { FurtherBasicBeanPane[] paneList = typePane.getPaneList(); - for(; index < paneList.length; index++){ - if(paneList[index].accept(chart)){ + for (; index < paneList.length; index++) { + if (paneList[index].accept(chart)) { return index; } } @@ -279,7 +284,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 //populate的时候看看要不要重构面板 private boolean checkNeedsReLayout(ChartProvider chart) { - if(chart != null){ + if (chart != null) { int lastIndex = typePane.getSelectedIndex(); int currentIndex = getSelectedChartIndex(chart); String chartID = chart.getID(); @@ -292,9 +297,10 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 /** * 当前界面是否是默认的界面 + * * @return 是否是默认的界面 */ - public boolean isDefaultPane(){ + public boolean isDefaultPane() { return this.isDefaultPane; } @@ -326,15 +332,16 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 } } - protected void dealWithStyleChange(){ + protected void dealWithStyleChange() { } /** - *主要用于图表设计器,判断样式改变是否来自工具栏的全局样式按钮 + * 主要用于图表设计器,判断样式改变是否来自工具栏的全局样式按钮 + * * @param isFromToolBar 是否来自工具栏 */ - public void styleChange(boolean isFromToolBar){ + public void styleChange(boolean isFromToolBar) { } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 8877ed9da..766b13397 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -6,6 +6,7 @@ import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chartx.attr.ChartProvider; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.UIDialog; import com.fr.design.event.UIObserver; @@ -25,6 +26,9 @@ import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JPanel; import javax.swing.SwingUtilities; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; @@ -41,9 +45,6 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Set; /** * 图表 类型 增删 控制按钮界面. @@ -151,6 +152,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen try { ChartProvider newChart = (ChartProvider) chart.clone(); editingCollection.addNamedChart(name, newChart); + ChartInfoCollector.getInstance().collection(newChart, null); } catch (CloneNotSupportedException e1) { FineLoggerFactory.getLogger().error("Error in Clone"); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java index b8550e0d4..1a0953266 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java @@ -12,6 +12,7 @@ import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.MultilineLabel; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.gui.type.ChartImagePane; +import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.general.Background; import com.fr.js.NameJavaScriptGroup; import com.fr.log.FineLoggerFactory; @@ -105,6 +106,8 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane 0 ? (grid.getWidth() - floatWdith) : 0; - int topDifference = (grid.getHeight() - floatHeight) > 0 ? (grid.getHeight() - floatHeight) : 0; - FU evtX_fu = FU.valueOfPix((leftDifference) / 2, resolution); - FU evtY_fu = FU.valueOfPix((topDifference) / 2, resolution); - - FU leftDistance = FU.getInstance(evtX_fu.toFU() + columnWidthList.getRangeValue(0, horizentalScrollValue).toFU()); - FU topDistance = FU.getInstance(evtY_fu.toFU() + rowHeightList.getRangeValue(0, verticalScrollValue).toFU()); - - newFloatElement.setLeftDistance(leftDistance); - newFloatElement.setTopDistance(topDistance); - - Style style = newFloatElement.getStyle(); - if (style != null) { - newFloatElement.setStyle(style.deriveBorder(Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black)); - } - reportPane.getEditingElementCase().addFloatElement(newFloatElement); - reportPane.setSelection(new FloatSelection(newFloatElement.getName())); - reportPane.fireSelectionChangeListener(); - } catch (CloneNotSupportedException e) { - FineLoggerFactory.getLogger().error("Error in Float"); + newFloatElement = new FloatElement(chartDialog.getChartCollection()); + newFloatElement.setWidth(new OLDPIX(BaseChartCollection.CHART_DEFAULT_WIDTH)); + newFloatElement.setHeight(new OLDPIX(BaseChartCollection.CHART_DEFAULT_HEIGHT)); + + Grid grid = reportPane.getGrid(); + TemplateElementCase report = reportPane.getEditingElementCase(); + DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report); + DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report); + int horizentalScrollValue = grid.getHorizontalValue(); + int verticalScrollValue = grid.getVerticalValue(); + + int resolution = grid.getResolution(); + int floatWdith = newFloatElement.getWidth().toPixI(resolution); + int floatHeight = newFloatElement.getWidth().toPixI(resolution); + + int leftDifference = (grid.getWidth() - floatWdith) > 0 ? (grid.getWidth() - floatWdith) : 0; + int topDifference = (grid.getHeight() - floatHeight) > 0 ? (grid.getHeight() - floatHeight) : 0; + FU evtX_fu = FU.valueOfPix((leftDifference) / 2, resolution); + FU evtY_fu = FU.valueOfPix((topDifference) / 2, resolution); + + FU leftDistance = FU.getInstance(evtX_fu.toFU() + columnWidthList.getRangeValue(0, horizentalScrollValue).toFU()); + FU topDistance = FU.getInstance(evtY_fu.toFU() + rowHeightList.getRangeValue(0, verticalScrollValue).toFU()); + + newFloatElement.setLeftDistance(leftDistance); + newFloatElement.setTopDistance(topDistance); + + Style style = newFloatElement.getStyle(); + if (style != null) { + newFloatElement.setStyle(style.deriveBorder(Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black)); } + reportPane.getEditingElementCase().addFloatElement(newFloatElement); + reportPane.setSelection(new FloatSelection(newFloatElement.getName())); + reportPane.fireSelectionChangeListener(); } }); 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 62d1d4a3e..b4b43cafd 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 @@ -7,6 +7,7 @@ import com.fr.base.FRContext; import com.fr.concurrent.NamedThreadFactory; import com.fr.config.MarketConfig; import com.fr.design.DesignerEnvManager; +import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mainframe.errorinfo.ErrorInfoUploader; import com.fr.design.mainframe.messagecollect.impl.FocusPointMessageUploader; import com.fr.design.mainframe.messagecollect.solid.SolidCollector; @@ -234,7 +235,8 @@ public class InformationCollector implements XMLReadable, XMLWriter { SolidCollector.getInstance().sendToCloudCenterAndDeleteFile(); sendUserInfo(); FocusPointMessageUploader.getInstance().sendToCloudCenter(); - TemplateInfoCollector.getInstance().sendTemplateInfo(); + TemplateInfoCollector.getInstance().sendPointInfo(); + ChartInfoCollector.getInstance().sendPointInfo(); ErrorInfoUploader.getInstance().sendErrorInfo(); } }, SEND_DELAY, TimeUnit.MILLISECONDS); diff --git a/designer-realize/src/main/java/com/fr/poly/hanlder/PolyDesignerDropTarget.java b/designer-realize/src/main/java/com/fr/poly/hanlder/PolyDesignerDropTarget.java index c92142960..c87523720 100644 --- a/designer-realize/src/main/java/com/fr/poly/hanlder/PolyDesignerDropTarget.java +++ b/designer-realize/src/main/java/com/fr/poly/hanlder/PolyDesignerDropTarget.java @@ -6,13 +6,18 @@ package com.fr.poly.hanlder; import com.fr.base.ScreenResolution; import com.fr.base.chart.BaseChartCollection; import com.fr.base.vcs.DesignerMode; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chartx.attr.ChartProvider; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.grid.Grid; import com.fr.log.FineLoggerFactory; import com.fr.poly.PolyDesigner; import com.fr.poly.PolyUtils; import com.fr.poly.creator.BlockCreator; +import com.fr.poly.creator.ChartBlockCreator; import com.fr.poly.model.AddingData; +import com.fr.report.poly.PolyChartBlock; import com.fr.stable.unit.UnitRectangle; import javax.swing.JScrollBar; @@ -31,10 +36,10 @@ import java.awt.dnd.DropTargetEvent; * @since 6.5.4 创建于2011-4-1 */ public class PolyDesignerDropTarget extends DropTargetAdapter { - + private static final double SCROLL_POINT = 100; private static final int SCROLL_DISTANCE = 15; - + private PolyDesigner designer; private AddingData addingData; private int resolution = ScreenResolution.getScreenResolution(); @@ -48,9 +53,9 @@ public class PolyDesignerDropTarget extends DropTargetAdapter { /** * 拖拽进入事件 - * + * * @param dtde 鼠标事件 - * + * */ public void dragEnter(DropTargetDragEvent dtde) { @@ -93,9 +98,9 @@ public class PolyDesignerDropTarget extends DropTargetAdapter { /** * 拖拽悬浮事件 - * + * * @param dtde 鼠标事件 - * + * */ public void dragOver(DropTargetDragEvent dtde) { if (addingData != null) { @@ -105,14 +110,14 @@ public class PolyDesignerDropTarget extends DropTargetAdapter { setForbiddenWindowVisibility(loc); //检测是否到达角落 scrollWhileDropCorner(dtde); - + designer.repaint(); } } - + private void scrollWhileDropCorner(final DropTargetDragEvent dtde){ Thread tt = new Thread(new Runnable() { - + @Override public void run() { Point location = dtde.getLocation(); @@ -121,23 +126,23 @@ public class PolyDesignerDropTarget extends DropTargetAdapter { JScrollBar horizonBar = designer.getHorizontalScrollBar(); horizonBar.setValue(horizonBar.getValue() + SCROLL_DISTANCE); } - + if(location.y> designer.getHeight() - SCROLL_POINT){ JScrollBar verticalBar = designer.getVerticalScrollBar(); verticalBar.setValue(verticalBar.getValue() + SCROLL_DISTANCE); } - + } }); tt.start(); } - + //设置是否显示 禁止组件重叠 窗口 private void setForbiddenWindowVisibility(Point loc){ BlockCreator creator = addingData.getCreator(); Rectangle pixRec = getCreatorPixRectangle(creator, loc); UnitRectangle rec = new UnitRectangle(pixRec, resolution); - + if(designer.intersectsAllBlock(rec, creator.getValue().getBlockName())){ int x = (int) (designer.getAreaLocationX() + pixRec.getCenterX() - designer.getHorizontalValue()); int y = (int) (designer.getAreaLocationY() + pixRec.getCenterY() - designer.getVerticalValue()); @@ -149,9 +154,9 @@ public class PolyDesignerDropTarget extends DropTargetAdapter { /** * 放下事件 - * + * * @param dtde 鼠标事件 - * + * */ public void drop(DropTargetDropEvent dtde) { if (addingData != null) { @@ -162,8 +167,10 @@ public class PolyDesignerDropTarget extends DropTargetAdapter { if(!intersectLocation(pixRec, creator)){ return; } - + designer.addBlockCreator(creator); + //图表埋点 + dealChartBuryingPoint(creator); designer.stopEditing(); designer.setSelection(creator); //在重新设置了选择之后,要对菜单和工具进行target的重新设置 @@ -174,7 +181,7 @@ public class PolyDesignerDropTarget extends DropTargetAdapter { addingData = null; } } - + //聚焦选中块 private void focusOnSelection(){ if (designer.getSelection().getEditingElementCasePane() == null) { @@ -185,7 +192,7 @@ public class PolyDesignerDropTarget extends DropTargetAdapter { grid.requestFocus(); } } - + //检测新加入的creator位置是否与老的重叠, 重叠返回false private boolean intersectLocation(Rectangle pixRec, BlockCreator creator){ if (pixRec.getX() < 0 || pixRec.getY() < 0) { @@ -200,12 +207,12 @@ public class PolyDesignerDropTarget extends DropTargetAdapter { designer.repaint(); return false; } - + creator.getValue().setBounds(rec); - + return true; } - + private Rectangle getCreatorPixRectangle(BlockCreator creator, Point location){ int width = creator.getWidth(); int height = creator.getHeight(); @@ -216,17 +223,25 @@ public class PolyDesignerDropTarget extends DropTargetAdapter { /** * 拖拽移出去事件 - * + * * @param dte 拖拽事件 - * + * */ public void dragExit(DropTargetEvent dte) { if (addingData != null) { addingData.reset(); designer.repaint(); } - + forbiddenWindow.hideWindow(); } - + + private void dealChartBuryingPoint(BlockCreator creator) { + if (creator instanceof ChartBlockCreator) { + PolyChartBlock value = ((ChartBlockCreator) creator).getValue(); + ChartCollection chartCollection = (ChartCollection) value.getChartCollection(); + ChartInfoCollector.getInstance().collection(chartCollection.getSelectedChartProvider(ChartProvider.class), null); + } + } + } \ No newline at end of file From 1f4660a2b9b46328f84c29e40a10890f65eb38d8 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 27 Feb 2020 13:33:29 +0800 Subject: [PATCH 29/30] =?UTF-8?q?MOBILE-25493=20=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=88=B0final?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobile/ui/MobileCollapsedStylePane.java | 38 ++++++++++++++----- .../mobile/ElementCaseDefinePane.java | 25 ++++++++++-- 2 files changed, 51 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java index 5459b8f2a..74538e77c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.mobile.ui; import com.fr.design.beans.BasicBeanPane; import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.ibutton.ModeButtonGroup; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; @@ -19,8 +20,10 @@ import com.fr.form.ui.mobile.CollapseState; import com.fr.form.ui.mobile.MobileChartCollapsedStyle; import com.fr.form.ui.mobile.MobileCollapsedStyle; -import javax.swing.JPanel; +import javax.swing.*; import javax.swing.border.TitledBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; @@ -51,11 +54,12 @@ public class MobileCollapsedStylePane extends BasicBeanPane Date: Thu, 27 Feb 2020 13:42:23 +0800 Subject: [PATCH 30/30] =?UTF-8?q?MOBILE-25615=20=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=88=B0final?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/FormMobileAttrAction.java | 14 ++++++++++---- .../mobile/FormMobileTemplateSettingsPane.java | 4 +--- 2 files changed, 11 insertions(+), 7 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 c6f64c498..b387cbc70 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 @@ -56,6 +56,9 @@ public class FormMobileAttrAction extends JTemplateAction { final FormMobileAttrPane mobileAttrPane = new FormMobileAttrPane(); mobileAttrPane.populateBean(mobileAttr); + + final boolean oldMobileOnly = mobileAttr.isMobileOnly(); + final boolean oldAdaptive = mobileAttr.isAdaptivePropertyAutoMatch(); BasicDialog dialog = mobileAttrPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override public void doOk() { @@ -75,13 +78,16 @@ public class FormMobileAttrAction extends JTemplateAction { recordFunction(); // 设置移动端属性并刷新界面 formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后 - ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); + boolean changeSize = (!oldMobileOnly && formMobileAttr.isMobileOnly()) || (oldMobileOnly && !formMobileAttr.isMobileOnly()); + if (changeSize) { + ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); + } jf.getFormDesign().getSelectionModel().setSelectedCreator(jf.getFormDesign().getRootComponent()); - //当自适应属性自动匹配处于勾选状态 进行切换 - if (formMobileAttr.isMobileOnly() && formMobileAttr.isAdaptivePropertyAutoMatch()) { + //改变布局为自适应布局,只在移动端属性设置保存后改变一次 + boolean changeLayout = !oldAdaptive && formMobileAttr.isAdaptivePropertyAutoMatch(); + if (changeLayout) { doChangeBodyLayout(); } - WidgetPropertyPane.getInstance().refreshDockingView(); jf.fireTargetModified(); } diff --git a/designer-form/src/main/java/com/fr/design/form/mobile/FormMobileTemplateSettingsPane.java b/designer-form/src/main/java/com/fr/design/form/mobile/FormMobileTemplateSettingsPane.java index 21f6d3b09..2eac9c586 100644 --- a/designer-form/src/main/java/com/fr/design/form/mobile/FormMobileTemplateSettingsPane.java +++ b/designer-form/src/main/java/com/fr/design/form/mobile/FormMobileTemplateSettingsPane.java @@ -47,9 +47,7 @@ public class FormMobileTemplateSettingsPane extends BasicBeanPane