From 98b7590a589432807c0cc426b0eb1d51afeef7ea Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 11 Jan 2021 17:20:23 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=9A=84=E6=96=B9=E6=B3=95=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/designer/beans/LayoutAdapter.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java index fded86cbe..e2aa7f152 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java @@ -43,18 +43,6 @@ public interface LayoutAdapter { boolean addBean(XCreator creator, int x, int y); - /** - * 组件的ComponentAdapter在添加组件时,如果发现布局管理器不为空,会继而调用该布局管理器的 - * addComp方法来完成组件的具体添加。在该方法内,布局管理器可以提供额外的功能。 - * - * @param creator 被添加的新组件 - * @param x 添加的位置x,该位置是相对于container的 - * @param y 添加的位置y,该位置是相对于container的 - * @param accept 是否添加新组件 - * @return 是否添加成功,成功返回true,否则false - */ - boolean addBean(XCreator creator, int x, int y, boolean accept); - /** * 组件的ComponentAdapter在添加组件时,如果发现布局管理器不为空,会继而调用该布局管理器的 * addComp方法来完成组件的具体添加。在该方法内,布局管理器可以提供额外的功能。 From 22a581c1089ce1ac5ae785033f417ebaaf19a5fd Mon Sep 17 00:00:00 2001 From: lucian Date: Mon, 11 Jan 2021 17:28:17 +0800 Subject: [PATCH 02/12] REPORT-46574 & REPORT-46813 & REPORT-46550 --- .../java/com/fr/design/EnvChangeEntrance.java | 7 ++- .../com/fr/env/PluginErrorRemindDialog.java | 44 +++++++++------ .../warnings/icon_WarningIcon_normal.png | Bin 0 -> 1365 bytes .../warnings/icon_WarningIcon_normal@2x.png | Bin 0 -> 2762 bytes .../com/fr/design/EnvChangeEntranceTest.java | 26 +++++---- .../module/DesignerWorkspaceProvider.java | 11 +++- .../module/DesignerWorkspaceProviderTest.java | 50 ++++++++++++++++++ 7 files changed, 107 insertions(+), 31 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal@2x.png create mode 100644 designer-realize/src/test/java/com/fr/start/module/DesignerWorkspaceProviderTest.java diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index ed67299f6..3e2b30fee 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -146,7 +146,7 @@ public class EnvChangeEntrance { template.refreshToolArea(); } showServiceDialog(selectedEnv); - pluginErrorRemind(selectedEnv); + pluginErrorRemind(); } catch (WorkspaceAuthException | RegistEditionException e) { // String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed"); // String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote"); @@ -302,10 +302,9 @@ public class EnvChangeEntrance { /** * 插件启动错误信息提示 - * @param selectedEnv 选择的工作环境 */ - public void pluginErrorRemind(DesignerWorkspaceInfo selectedEnv) { - if (selectedEnv.getType() == DesignerWorkspaceType.Remote) { + public void pluginErrorRemind() { + if (!WorkContext.getCurrent().isLocal()) { return; } diff --git a/designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java b/designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java index 3654cca2d..42dae0fa1 100644 --- a/designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java +++ b/designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java @@ -6,7 +6,6 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; -import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import javax.swing.BorderFactory; @@ -14,52 +13,65 @@ import javax.swing.Icon; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; -import javax.swing.JTextArea; +import javax.swing.JTextPane; +import javax.swing.text.SimpleAttributeSet; +import javax.swing.text.StyleConstants; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Frame; +import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.Locale; /** * 插件启动失败提示窗 */ public class PluginErrorRemindDialog extends JDialog implements ActionListener { - public PluginErrorRemindDialog(Frame parent, String areaText) { + private static final String SIM_HEI = "SimHei"; + + public PluginErrorRemindDialog(Frame parent, String text) { super(parent, true); //上面的标签面板 JPanel topPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel imagePanel = new JPanel(); - Icon icon = IOUtils.readIcon("com/fr/design/images/warnings/warning5.png"); + Icon icon = IOUtils.readIcon("com/fr/design/images/warnings/icon_WarningIcon_normal.png"); JLabel imageLabel = new JLabel(); imageLabel.setIcon(icon); imagePanel.add(imageLabel); - imagePanel.setPreferredSize(new Dimension(130, 100)); + imagePanel.setPreferredSize(new Dimension(48, 48)); JPanel verticalPanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); JLabel label = new JLabel(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Title")); - label.setFont(FRFont.getInstance().applySize(18).applyStyle(1)); - label.setPreferredSize(new Dimension(650, 100)); + label.setFont(FRFont.getInstance().applySize(16).applyName(SIM_HEI)); + label.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); verticalPanel.add(label); topPanel.add(imagePanel, BorderLayout.WEST); topPanel.add(verticalPanel, BorderLayout.CENTER); - topPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); + topPanel.setPreferredSize(new Dimension(600, 73)); + topPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 20)); //中间的文本域面板 JPanel centerPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); - centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); - centerPanel.setPreferredSize(new Dimension(480, 320)); + centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); + centerPanel.setPreferredSize(new Dimension(580, 269)); + + JTextPane textPane = new JTextPane(); + + SimpleAttributeSet attributeSet = new SimpleAttributeSet(); + StyleConstants.setFontFamily(attributeSet, SIM_HEI); + StyleConstants.setLineSpacing(attributeSet, 0.5f); + textPane.setParagraphAttributes(attributeSet, true); - JTextArea checkArea = new JTextArea(areaText); - checkArea.setEnabled(false); - centerPanel.add(checkArea, BorderLayout.CENTER); + textPane.setEditable(false); + textPane.setMargin(new Insets(10, 10, 10, 10)); + textPane.setText(text); + centerPanel.add(textPane, BorderLayout.CENTER); UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Not_Deal_With")); UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Deal_With")); @@ -69,7 +81,7 @@ public class PluginErrorRemindDialog extends JDialog implements ActionListener { // 按钮 JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); + buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); buttonPanel.add(cancelButton); buttonPanel.add(okButton); @@ -80,7 +92,7 @@ public class PluginErrorRemindDialog extends JDialog implements ActionListener { this.add(topPanel, BorderLayout.NORTH); this.add(centerPanel, BorderLayout.CENTER); this.add(buttonPanel, BorderLayout.SOUTH); - this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US) ? 750 : 600, 500)); + this.setSize(new Dimension(600, 400)); GUICoreUtils.centerWindow(this); } diff --git a/designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal.png b/designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal.png new file mode 100644 index 0000000000000000000000000000000000000000..37dbe939b60d2020ad64d33cd9a51f7fbc02f24e GIT binary patch literal 1365 zcmV-b1*-aqP)I+S@$l@eSymtOPF{d8RwYxL3J5vhItA*e5e4p=U zp5M;znIT-^7hU20aTVbI?qDn(Um_0rSI{A;Jcs84JVY z6pF1FfV1jU%Rwi?Ka!axBoj@>?n)pk0yux-rgj57rA!lDLNgjFIiV{8urjGf82o;j z=KIo!c%jfbH;TfK4K8JQO>CnN?G8&{68KDc`*g zR5Q*C&~pIxH;YU8V>pGrf2;AjTUzBa#9_YLb;nJ}6(m=xkJe+MKfLq5*%m?^=?buA#6UtjH)1_(#Qpn#xC&!{J0j*kzfZd5qf2k$5Ki%+7sXDygI?W=K|6{SJ(Yfh)UztfBRg8&-P( zb}a*+>Ix&{#_koGQAbq#v04(q&ZZuB99|c;Dh(M2d73xP?pO>yeITq9B#9QwO}Tf9 zB^CwX&2`t?iK@d43=LiNy4xV8dp}NCJLdy`g&uX>eS1pI_l~0G?mr9pC<i?g@P_E+n)mY2(?z0KK0~8z~EGKR^R!;(+y~1jPOAUVyEQ zfRhg>Fffeswk5__J#VUq4@%snbZt`zpAKOY{_)5 zlFse8RNm78-u$3!C4SipV0@(>gyx-!Ej^M?qWeYumPyq7vE6^>Tx!(Lq@HlVZ&hmE z&5sEH66i@eoqPLV0K6?V#J1RdY~FA=0}$|sENB$X%AIz7_HQ9mPreSOr=u_*X9xQH z5x=2mozL_Gu&$1_9Q*)+5*0wKIt)`txQjI7P+teEjJlqIM`JA-u{Z(miL~)pAAq?< zJq5yz5!Z-Uj`6!P+ZcMj1G?J7j3Mz>j8>fpr-f$JT--uy7^^Kza8qx~zWy Xj(fI1j%-%800000NkvXXu0mjfh&Or{ literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal@2x.png b/designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..756a456566ea000a34429a55d8931c952dfa3298 GIT binary patch literal 2762 zcmV;*3N`hKP)VL1iRhg{8i0uZ6c<%g;9d}pX^0*A+x1yk+vmW%!{S6JJiQV8&Xp3JB@;s#8( zBn+Tb^$dyBPDFaZdRTNsbcE2Z!n(E>S%eTlC1HS*iti+VlMe#a_zL>-Pd^%)8TW7M!M9FYWQQPTyz5*E53#Ze&aQFePtuS z=m|X9xf9^*Nbs;dP^f81J&`Wzk+`S^(4mG=vh%eL0(igI?uaFi1CG6nMWfTNfNZ&z zh3yGKgqOt?ldG_5>v_*)pM;_sAXD+Lx&YttldGuN3^;xUi%KUuK(_gNf7ejEO_=GT z9gT}-09i}kCE;u*5nRmbVjqy0zX@>SM_5!kz8~c8{f&ST;SEtSrV>}|I?f6f5L7e+ z9Lso=h}QbeSIqqe;FKjSIvs5RdEhP=}p98J(I+ldn zxdq&g2U*xbL5TZeroAYbNMUy91~`rJPml}0DxAvD2(9vZ&}Q7kl5sm80=M%q7Ir8Q zg4UoX)4vWZG=xB?2GHI`74lT}MFN-_vmKA9?ko#_6fc0ZQJ~lFVKJPh#Q?7Q`)P>UHM*JpB`XOgNT~tz zyN0*P`MCNHOXE0n~19D3=9IN_i0GbyxnL>QdOd#kipimCo&m->F z6Y2Rumx2T~z)2Z55YW%qi3b33W&%NH0bbHW4R6pB_Ak6}`eFkaKs%R@k!Q~wCW6U9 zlHhVVGXW*D0A@mna8y)`nT{)Voncb?!2%hOZ8Yu%m+tf%+$)bW6Hqk^VCRN-cg(cE z&c^ov`Zj>JFTPwl=l{fAA>%i}o;=P>K-DaOn{R$Kjy~!GxO$JTn@_$Ca4h2qB5L3! zsshKE38AK{%Y5fXZ2bmt1uXsxgtVy>N0^ z&jt`}(45BIe*mI6UV{b2b7lgnX94`2@fqD*IuCJ!%jftoz_E6Vbap(9}U0Gl5WM0n7>z@$UjAOhdErKTL|Zm!NFQ z*a$$kbH$b87&C#eW&!M4G~5_V*mrR8?Dqg_Hr^*CbP&;KuJ}mAA>uh9U6(V?M8e)Yl)#V% z&{Ipt$v1O9s-R1KXQ7xloDAS>Y#h>ntYzE_ME-tiqPX#0a>L1he9nlQVx~Rlw~7Zf zAipqM$`=S=R7kz_B|F>qsE4~Z}N@}~{uzd;YN*rN%%*;I1_bTXTKz?C%03l8at zNwfMc67Oe#iiO!>dN6Da002$Hn?=I@QP2MLGJu+m@zSB(3Ykm7Y~o1OMu69aj+H$( zHuf?gYZ;q>=$4V%prX{>XOVcf0T=dmzCuJ}ijv3(4T6Yg#ON`X;mV!)A24(q5M+!pAmx&iX7j*9?>b?RT%QzAC+Te2g|JMOTJgJ*@ ze)-Y=4M@dbCjjO~q;e~RbRf6CT2E&3C(UjHvX=2&`JR7}wtC() { + @Override + public void on(Event event, Null aNull) { + EnvChangeEntrance.getInstance().pluginErrorRemind(); + } + }); } @Override diff --git a/designer-realize/src/test/java/com/fr/start/module/DesignerWorkspaceProviderTest.java b/designer-realize/src/test/java/com/fr/start/module/DesignerWorkspaceProviderTest.java new file mode 100644 index 000000000..d058ee8de --- /dev/null +++ b/designer-realize/src/test/java/com/fr/start/module/DesignerWorkspaceProviderTest.java @@ -0,0 +1,50 @@ +package com.fr.start.module; + +import com.fr.design.constants.DesignerLaunchStatus; +import com.fr.event.EventDispatcher; +import com.fr.invoke.Reflect; +import com.fr.workspace.WorkContext; +import com.fr.workspace.Workspace; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +/** + * @author Lucian.Chen + * @version 10.0 + * Created by Lucian.Chen on 2021/1/7 + */ +@RunWith(PowerMockRunner.class) +@PrepareForTest({WorkContext.class}) +public class DesignerWorkspaceProviderTest { + + @Test + public void testPluginErrorRemind() { + + try { + Workspace workspace = EasyMock.mock(Workspace.class); + EasyMock.expect(workspace.isLocal()).andReturn(false).once(); + PowerMock.mockStatic(WorkContext.class); + EasyMock.expect(WorkContext.getCurrent()).andReturn(workspace).anyTimes(); + + EasyMock.replay(workspace); + PowerMock.replayAll(); + + DesignerWorkspaceProvider provider = new DesignerWorkspaceProvider(); + Reflect.on(provider).call("pluginErrorRemind"); + EventDispatcher.fire(DesignerLaunchStatus.STARTUP_COMPLETE); + + EasyMock.verify(workspace); + PowerMock.verifyAll(); + + } catch (Exception e) { + Assert.fail(e.getMessage()); + } + + + } +} From bd2e2eec65a75bfdde2f9c571412075b2d86a65b Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 11 Jan 2021 20:42:46 +0800 Subject: [PATCH 03/12] =?UTF-8?q?CHART-17822=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=86=85=E7=9A=84=E5=9B=BE=E5=BD=A2=E4=B8=8D?= =?UTF-8?q?=E5=B0=8F=E5=BF=83=E5=88=87=E6=8D=A2=E5=88=B0=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E5=9B=BE=E5=BD=A2=E4=B8=94=E4=B8=8D=E4=BF=9D=E5=AD=98=EF=BC=8C?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=92=A4=E9=94=80=E9=94=AE=E6=B2=A1=E6=B3=95?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=88=B0=E5=88=87=E6=8D=A2=E5=89=8D=E7=9A=84?= =?UTF-8?q?=E5=9B=BE=E5=BD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/JForm.java | 6 ++++++ 1 file changed, 6 insertions(+) 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 b39dc9188..844649d40 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 @@ -97,6 +97,7 @@ import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import javax.swing.tree.TreePath; public class JForm extends JTemplate implements BaseJForm
{ private static final String FORM_CARD = "FORM"; @@ -623,6 +624,11 @@ public class JForm extends JTemplate implements BaseJForm Date: Tue, 12 Jan 2021 09:52:20 +0800 Subject: [PATCH 04/12] =?UTF-8?q?REPORT-45689=20=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E5=88=A4=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/JForm.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 844649d40..d39de1d44 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 @@ -626,8 +626,12 @@ public class JForm extends JTemplate implements BaseJForm Date: Tue, 12 Jan 2021 10:17:12 +0800 Subject: [PATCH 05/12] =?UTF-8?q?REPORT-46285=20jdk11-=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=EF=BC=8C=E6=9C=89=E4=B8=80=E7=82=B9=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E7=9A=84=E7=BA=A2=E8=89=B2=E6=98=BE=E7=A4=BA=20?= =?UTF-8?q?=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91=E8=BF=99?= =?UTF-8?q?=E4=B8=AA=E9=97=AE=E9=A2=98=E6=98=AF=E7=94=B1jdk=E5=B7=AE?= =?UTF-8?q?=E5=BC=82=E9=80=A0=E6=88=90=E7=9A=84=EF=BC=8C=E5=89=8D=E6=99=AF?= =?UTF-8?q?=E8=89=B2=E5=92=8C=E8=83=8C=E6=99=AF=E8=89=B2=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E9=83=BD=E6=98=AF=E7=94=B1=E4=B8=8A=E9=9D=A2=E7=9A=84=E5=9B=BE?= =?UTF-8?q?=E6=A0=87+=E4=B8=8B=E9=9D=A2=E7=9A=84=E5=8F=96=E8=89=B2?= =?UTF-8?q?=E7=9F=A9=E5=BD=A2=E7=BB=84=E6=88=90=EF=BC=8C=E4=B8=8B=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E5=8F=96=E8=89=B2=E7=9F=A9=E5=BD=A2=E7=9A=84=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E7=94=B1=E6=95=B4=E4=B8=AA=E5=9B=BE=E6=A0=87=E7=9A=84?= =?UTF-8?q?=E5=AE=BD=E9=AB=98=E5=86=B3=E5=AE=9A=EF=BC=8C=E8=80=8C=E5=9C=A8?= =?UTF-8?q?jdk11=E4=B8=8B=EF=BC=8C=E6=8B=BF=E5=88=B0=E7=9A=84=E5=AE=BD?= =?UTF-8?q?=E9=AB=98=E4=B8=8Ejdk8=E4=B8=80=E6=A0=B7=EF=BC=8C=E4=BD=86?= =?UTF-8?q?=E6=98=AF=E6=9C=80=E7=BB=88=E7=BB=98=E5=88=B6=E5=87=BA=E6=9D=A5?= =?UTF-8?q?=E7=9A=84=E5=8F=96=E8=89=B2=E7=9F=A9=E5=BD=A2=E4=BC=9A=E5=BE=80?= =?UTF-8?q?=E5=B7=A6=E8=BE=B9=E5=81=8F=E7=A7=BB=E4=B8=80=E7=82=B9=EF=BC=8C?= =?UTF-8?q?=E5=A4=A7=E6=A6=82=E6=98=AF1px=EF=BC=8C=E8=80=8C=E8=83=8C?= =?UTF-8?q?=E6=99=AF=E8=89=B2=E5=9B=BE=E6=A0=87=E4=B9=8B=E5=89=8D=E4=B8=8B?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E5=8F=96=E8=89=B2=E7=9F=A9=E5=BD=A2=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E4=B8=BA=E7=BA=A2=E8=89=B2=EF=BC=8C=E5=9C=A8=E5=81=8F?= =?UTF-8?q?=E7=A7=BB=E4=BA=86=E4=B9=8B=E5=90=8E=EF=BC=8C=E7=BB=98=E5=88=B6?= =?UTF-8?q?=E5=BA=95=E4=B8=8B=E5=8F=96=E8=89=B2=E7=9F=A9=E5=BD=A2=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E5=AE=8C=E5=85=A8=E8=A6=86=E7=9B=96=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E7=BA=A2=E8=89=B2=EF=BC=8C=E6=89=80=E4=BB=A5=E6=BC=8F=E4=BA=86?= =?UTF-8?q?=E4=B8=80=E7=82=B9=E5=87=BA=E6=9D=A5=EF=BC=8C=E8=A1=A8=E7=8E=B0?= =?UTF-8?q?=E4=B8=BA=E5=BC=82=E5=B8=B8=E7=9A=84=E7=BA=A2=E8=89=B2=E3=80=82?= =?UTF-8?q?=20=E3=80=90=E6=94=B9=E5=8A=A8=E6=80=9D=E8=B7=AF=E3=80=91?= =?UTF-8?q?=E4=B8=8E=E4=BA=A7=E5=93=81=E7=A1=AE=E8=AE=A4=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E5=86=B3=E5=AE=9A=E5=85=88=E6=8A=8A=E8=83=8C=E6=99=AF=E8=89=B2?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E5=8F=96=E8=89=B2=E7=9F=A9=E5=BD=A2=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=B8=BA=E9=80=8F=E6=98=8E=E8=89=B2=EF=BC=8C=E8=BF=99?= =?UTF-8?q?=E6=A0=B7=E5=B0=B1=E4=B8=8D=E4=BC=9A=E6=BC=8F=E5=87=BA=E4=B8=80?= =?UTF-8?q?=E7=82=B9=E7=BA=A2=E8=89=B2=EF=BC=8C=E8=80=8C=E5=8F=96=E8=89=B2?= =?UTF-8?q?=E7=9F=A9=E5=BD=A2=E7=BB=98=E5=88=B6=E6=9C=89=E7=82=B9=E5=81=8F?= =?UTF-8?q?=E7=A7=BB=E7=9A=84=E9=97=AE=E9=A2=98=E9=9C=80=E8=A6=81=E5=8E=BB?= =?UTF-8?q?=E6=94=B9=E4=B8=80=E4=B8=8BUIColorButton=E7=9A=84UI=EF=BC=8C?= =?UTF-8?q?=E8=BF=99=E4=B8=AA=E5=9C=A8=E6=8D=A2=E5=AE=8C=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E5=90=8E=E5=86=8D=E7=BB=9F=E4=B8=80=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=AF=94=E8=BE=83=E5=A5=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/images/gui/color/background_normal.svg | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer-base/src/main/resources/com/fr/design/images/gui/color/background_normal.svg b/designer-base/src/main/resources/com/fr/design/images/gui/color/background_normal.svg index c4714560c..577e8bd8a 100644 --- a/designer-base/src/main/resources/com/fr/design/images/gui/color/background_normal.svg +++ b/designer-base/src/main/resources/com/fr/design/images/gui/color/background_normal.svg @@ -3,6 +3,5 @@ icon_文本背景色_normal - - + \ No newline at end of file From efa70cac0a51765ce8b98cd16105ce974168dacc Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 12 Jan 2021 11:14:58 +0800 Subject: [PATCH 06/12] =?UTF-8?q?REPORT-46585=20=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=9B=AE=E5=BD=95=E6=97=B6=20=E5=85=88?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=90=8E=E6=B7=BB=E5=8A=A0=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/PluginClassRefreshManager.java | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java b/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java index 711dd2975..3fa0266ed 100644 --- a/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java +++ b/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java @@ -39,6 +39,23 @@ public class PluginClassRefreshManager { } }; + private final PluginEventListener beforeAllPluginActive = new PluginEventListener() { + @Override + public void on(PluginEvent event) { + removePluginListener(); + } + }; + + private final PluginEventListener afterAllPluginsActive = new PluginEventListener() { + @Override + public void on(PluginEvent event) { + addPluginListener(); + if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) { + HistoryTemplateListCache.getInstance().reloadAllEditingTemplate(); + } + } + }; + public static PluginClassRefreshManager getInstance() { return INSTANCE; @@ -50,29 +67,20 @@ public class PluginClassRefreshManager { } private PluginClassRefreshManager() { - PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, new PluginEventListener() { - @Override - public void on(PluginEvent event) { - removePluginListener(); - } - }); - PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, new PluginEventListener() { - @Override - public void on(PluginEvent event) { - addPluginListener(); - if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) { - HistoryTemplateListCache.getInstance().reloadAllEditingTemplate(); - } - } - }); + PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, beforeAllPluginActive); + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, afterAllPluginsActive); } public void removePluginListener() { PluginListenerRegistration.getInstance().stopListen(this.pluginAfterRunEventListener); + PluginListenerRegistration.getInstance().stopListen(this.beforeAllPluginActive); + PluginListenerRegistration.getInstance().stopListen(this.afterAllPluginsActive); } public void addPluginListener() { PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginAfterRunEventListener); + PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, beforeAllPluginActive); + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, afterAllPluginsActive); } } From fc501390c274dc90f2ce0d21fe8972e2b49e1a99 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 12 Jan 2021 11:28:05 +0800 Subject: [PATCH 07/12] =?UTF-8?q?REPORT-46585=20fix=20=E5=8D=95=E4=B8=AA?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=9B=91=E5=90=AC=E9=80=BB=E8=BE=91=E4=BF=9D?= =?UTF-8?q?=E6=8C=81=E4=B8=8E=E4=B9=8B=E5=89=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/PluginClassRefreshManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java b/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java index 3fa0266ed..4ff6beda2 100644 --- a/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java +++ b/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java @@ -42,14 +42,14 @@ public class PluginClassRefreshManager { private final PluginEventListener beforeAllPluginActive = new PluginEventListener() { @Override public void on(PluginEvent event) { - removePluginListener(); + PluginListenerRegistration.getInstance().stopListen(pluginAfterRunEventListener); } }; private final PluginEventListener afterAllPluginsActive = new PluginEventListener() { @Override public void on(PluginEvent event) { - addPluginListener(); + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, pluginAfterRunEventListener); if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) { HistoryTemplateListCache.getInstance().reloadAllEditingTemplate(); } From d0f99ed99010e0607d4def470c2db44a6d4c20f3 Mon Sep 17 00:00:00 2001 From: lucian Date: Tue, 12 Jan 2021 12:25:56 +0800 Subject: [PATCH 08/12] =?UTF-8?q?REPORT-46892=20=E3=80=90=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91=E5=88=87=E6=8D=A2=E5=88=B0=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E6=9C=89=E6=8F=92=E4=BB=B6=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=B8=8D=E5=8C=B9=E9=85=8D=E6=97=B6=EF=BC=8C=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=A1=B5=E9=9D=A2=E4=BC=9A=E6=B6=88=E5=A4=B1?= =?UTF-8?q?=E7=9A=84=E6=AF=94=E8=BE=83=E6=85=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 6 ++++-- .../java/com/fr/design/EnvChangeEntranceTest.java | 15 +++------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 3e2b30fee..6de15517a 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -310,8 +310,10 @@ public class EnvChangeEntrance { String content = PluginErrorRemindHandler.pluginErrorContent(); if (StringUtils.isNotEmpty(content)) { - PluginErrorRemindDialog dialog = new PluginErrorRemindDialog(DesignerContext.getDesignerFrame(), content); - dialog.setVisible(true); + SwingUtilities.invokeLater(() -> { + PluginErrorRemindDialog dialog = new PluginErrorRemindDialog(DesignerContext.getDesignerFrame(), content); + dialog.setVisible(true); + }); } } diff --git a/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java b/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java index 6a78fe0c6..07a1d54f8 100644 --- a/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java +++ b/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java @@ -116,31 +116,22 @@ public class EnvChangeEntranceTest { Workspace workspace = EasyMock.mock(Workspace.class); EasyMock.expect(workspace.isLocal()).andReturn(false).once(); - EasyMock.expect(workspace.isLocal()).andReturn(true).times(2); + EasyMock.expect(workspace.isLocal()).andReturn(true).once(); PowerMock.mockStatic(WorkContext.class); EasyMock.expect(WorkContext.getCurrent()).andReturn(workspace).anyTimes(); PowerMock.mockStatic(PluginErrorRemindHandler.class); EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("").once(); - EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("111").once(); - PluginErrorRemindDialog dialog = EasyMock.mock(PluginErrorRemindDialog.class); - PowerMock.expectNew(PluginErrorRemindDialog.class, EasyMock.anyObject(Frame.class), EasyMock.anyString()).andReturn(dialog).once(); - - dialog.setVisible(true); - EasyMock.expectLastCall(); - - EasyMock.replay(workspace, dialog); + EasyMock.replay(workspace); PowerMock.replayAll(); EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); entrance.pluginErrorRemind(); entrance.pluginErrorRemind(); - entrance.pluginErrorRemind(); - - EasyMock.verify(workspace, dialog); + EasyMock.verify(workspace); PowerMock.verifyAll(); } catch (Exception e) { Assert.fail(); From e323ac4dc0d78be90eeedda5fe9e7def6fcdbf26 Mon Sep 17 00:00:00 2001 From: lucian Date: Tue, 12 Jan 2021 14:36:28 +0800 Subject: [PATCH 09/12] =?UTF-8?q?REPORT-46584=20=E3=80=9010.0.13=E5=86=92?= =?UTF-8?q?=E7=83=9F=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=8D=A1=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/JTemplate.java | 39 +++++++++++++------ 1 file changed, 28 insertions(+), 11 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 4007be8a3..a47a6095d 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 @@ -47,7 +47,6 @@ import com.fr.design.menu.MenuDef; import com.fr.design.menu.NameSeparator; import com.fr.design.menu.ShortCut; import com.fr.design.preview.PagePreview; -import com.fr.design.ui.util.UIUtil; import com.fr.design.write.submit.DBManipulationInWidgetEventPane; import com.fr.design.write.submit.DBManipulationPane; import com.fr.event.EventDispatcher; @@ -80,6 +79,7 @@ import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JOptionPane; +import javax.swing.SwingWorker; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.undo.UndoManager; import java.util.ArrayList; @@ -340,17 +340,34 @@ public abstract class JTemplate> public void refreshResource(FILE file) { - try { - this.template = JTemplateFactory.asIOFile(file, this.suffix()); - setTarget(this.template); - // 先移除旧的。 - removeCenterPane(); - // 加入新的 - addCenterPane(); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + new SwingWorker() { + + @Override + protected Void doInBackground() throws Exception { + setTargetByFile(file); + return null; + } + + @Override + public void done() { + try { + get(); + // 先移除旧的。 + removeCenterPane(); + // 加入新的 + addCenterPane(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + }.execute(); + + } + + private void setTargetByFile(FILE file) { + this.template = JTemplateFactory.asIOFile(file, this.suffix()); + setTarget(this.template); } private void addCenterPane() { From 380cf6ab675a00ca975ac90de0cd8e39cf525d9a Mon Sep 17 00:00:00 2001 From: lucian Date: Tue, 12 Jan 2021 15:25:39 +0800 Subject: [PATCH 10/12] =?UTF-8?q?REPORT-46892=20=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E6=9C=89=E6=8F=92=E4=BB=B6=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=B8=8D=E5=8C=B9=E9=85=8D=E7=9B=AE=E5=BD=95=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/EnvChangeEntrance.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 6de15517a..2b36bd45f 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -310,9 +310,14 @@ public class EnvChangeEntrance { String content = PluginErrorRemindHandler.pluginErrorContent(); if (StringUtils.isNotEmpty(content)) { - SwingUtilities.invokeLater(() -> { - PluginErrorRemindDialog dialog = new PluginErrorRemindDialog(DesignerContext.getDesignerFrame(), content); - dialog.setVisible(true); + // 该操作需要在当前awt操作之后执行,使用SwingUtilities.invokeLater将其置于awt操作对列末尾 + // 若使用UIUtil.invokeLaterIfNeeded,会立即执行,影响其他UI操作 + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + PluginErrorRemindDialog dialog = new PluginErrorRemindDialog(DesignerContext.getDesignerFrame(), content); + dialog.setVisible(true); + } }); } } From e2dd63a1026c7558b8420df151c07b12419f74f5 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 13 Jan 2021 10:56:26 +0800 Subject: [PATCH 11/12] =?UTF-8?q?REPORT-46971=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF-=E6=99=AE=E9=80=9A=E6=8A=A5=E8=A1=A8&?= =?UTF-8?q?=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8-=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF-=E6=8F=92=E4=BB=B6=E7=B1=BB=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E5=8F=B3=E4=BE=A7=E7=AC=AC=E5=9B=9B=E4=B8=AAtab?= =?UTF-8?q?=E9=A1=B5=E6=82=AC=E6=B5=AE=E6=97=B6=E5=92=8C=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=B8=8A=E6=96=B9=E5=9D=87=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E2=80=9C=E7=BB=84=E4=BB=B6=E8=AE=BE=E7=BD=AE=E2=80=9D=EF=BC=8C?= =?UTF-8?q?=E5=BA=94=E2=80=9C=E6=8E=A7=E4=BB=B6=E8=AE=BE=E7=BD=AE=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/widget/ui/FormWidgetCardPane.java | 14 ++++++++++++++ .../ui/WidgetBasicPropertyPaneFactory.java | 16 ---------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index 8267c53b8..4ab3fdb74 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -14,13 +14,16 @@ import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.dialog.AttrScrollPane; import com.fr.design.dialog.BasicScrollPane; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.JForm; import com.fr.design.widget.DataModify; import com.fr.design.widget.FormWidgetDefinePaneFactoryBase; import com.fr.design.widget.Operator; @@ -147,6 +150,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { } }; + freshPropertyMode(innerCreator); if (isExtraWidget) { return; } @@ -159,6 +163,16 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { } + private static void freshPropertyMode(XCreator xCreator) { + if (!(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() instanceof JForm)) { + if (xCreator instanceof XWParameterLayout) { + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA); + } else { + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA_WIDGET); + } + } + } + private void initDefinePane() { currentEditorDefinePane = null; XCreator creator = getXCreatorDedicated(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java index a3a34a061..081ca1476 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java @@ -1,10 +1,6 @@ package com.fr.design.mainframe.widget.ui; import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XWParameterLayout; -import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.mainframe.EastRegionContainerPane; -import com.fr.design.mainframe.JForm; /** * Created by kerry on 2017/9/30. @@ -12,7 +8,6 @@ import com.fr.design.mainframe.JForm; public class WidgetBasicPropertyPaneFactory { public static FormBasicPropertyPane createBasicPropertyPane(XCreator xCreator) { - freshPropertyMode(xCreator); if (xCreator.supportSetVisible() && xCreator.supportSetEnable()) { return new FormBasicWidgetPropertyPane(); } @@ -23,15 +18,4 @@ public class WidgetBasicPropertyPaneFactory { } } - - private static void freshPropertyMode(XCreator xCreator) { - if (!(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() instanceof JForm)) { - if (xCreator instanceof XWParameterLayout) { - EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA); - } else { - EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA_WIDGET); - } - } - } - } From 41ec46537ce98f80f38f5103cb63004532306eb6 Mon Sep 17 00:00:00 2001 From: lucian Date: Wed, 13 Jan 2021 14:32:40 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95=E8=AF=AF=E5=B1=8F=E8=94=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/extra/PluginOperateUtilsTest.java | 310 +++++++++--------- 1 file changed, 155 insertions(+), 155 deletions(-) diff --git a/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java b/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java index edcde5d11..bc81cb2c3 100644 --- a/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java +++ b/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java @@ -1,155 +1,155 @@ -//package com.fr.design.extra; -// -//import com.fr.invoke.Reflect; -//import com.fr.json.JSONObject; -//import com.fr.plugin.context.PluginContext; -//import com.fr.plugin.context.PluginMarker; -//import com.fr.plugin.context.PluginMarkerAdapter; -//import com.fr.plugin.error.PluginErrorCode; -//import com.fr.plugin.manage.PluginManager; -//import com.fr.plugin.manage.control.PluginTask; -//import com.fr.plugin.manage.control.PluginTaskResult; -//import org.easymock.EasyMock; -//import org.junit.Assert; -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.api.easymock.PowerMock; -//import org.powermock.core.classloader.annotations.PrepareForTest; -//import org.powermock.modules.junit4.PowerMockRunner; -// -//import java.util.ArrayList; -//import java.util.List; -// -///** -// * @author Lucian.Chen -// * @version 10.0 -// * Created by Lucian.Chen on 2020/12/17 -// */ -//@RunWith(PowerMockRunner.class) -//@PrepareForTest({PluginManager.class, PluginUtils.class}) -//public class PluginOperateUtilsTest { -// -// @Test -// public void testGetSuccessInfo() { -// PluginTaskResult pluginTaskResult = EasyMock.mock(PluginTaskResult.class); -// PluginTaskResult pluginTaskResult1 = EasyMock.mock(PluginTaskResult.class); -// PluginTaskResult pluginTaskResult2 = EasyMock.mock(PluginTaskResult.class); -// -// List pluginTaskResults1 = new ArrayList<>(); -// pluginTaskResults1.add(pluginTaskResult1); -// List pluginTaskResults2 = new ArrayList<>(); -// pluginTaskResults2.add(pluginTaskResult1); -// pluginTaskResults2.add(pluginTaskResult2); -// -// PluginMarker pluginMarker1 = PluginMarker.create("plugin-1", "1.0"); -// PluginMarker pluginMarker2 = PluginMarkerAdapter.create("plugin-2", "2.0", "name-2"); -// PluginTask pluginTask1 = PluginTask.installTask(pluginMarker1); -// PluginTask pluginTask2 = PluginTask.installTask(pluginMarker2); -// -// EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults1).times(2); -// EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults2).times(2); -// EasyMock.expect(pluginTaskResult1.getCurrentTask()).andReturn(pluginTask1).anyTimes(); -// EasyMock.expect(pluginTaskResult2.getCurrentTask()).andReturn(pluginTask2).anyTimes(); -// -// EasyMock.expect(pluginTaskResult1.errorCode()).andReturn(PluginErrorCode.BelowSystem).anyTimes(); -// EasyMock.expect(pluginTaskResult2.errorCode()).andReturn(PluginErrorCode.BeyondSystem).anyTimes(); -// -// PluginContext plugin1 = EasyMock.mock(PluginContext.class); -// PluginContext plugin2 = EasyMock.mock(PluginContext.class); -// EasyMock.expect(plugin1.getName()).andReturn("context-1").anyTimes(); -// EasyMock.expect(plugin2.getName()).andReturn("context-2").anyTimes(); -// PowerMock.mockStatic(PluginManager.class); -// EasyMock.expect(PluginManager.getContext(pluginMarker1.getPluginID())) -// .andReturn(plugin1).once().andReturn(null).once().andReturn(plugin1).once().andReturn(null).once(); -// EasyMock.expect(PluginManager.getContext(pluginMarker2.getPluginID())) -// .andReturn(plugin2).once().andReturn(null).once(); -// -// EasyMock.replay(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2); -// PowerMock.replayAll(); -// -// // 1个 -// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem"); -// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem"); -// -// -// // 2个 -// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem\ncontext-2Fine-Core_Plugin_Error_BeyondSystem"); -// Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem\nname-2Fine-Core_Plugin_Error_BeyondSystem"); -// -// EasyMock.verify(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2); -// PowerMock.verifyAll(); -// -// } -// -// -// @Test -// public void testGetPluginName() { -// PluginContext pluginContext = EasyMock.mock(PluginContext.class); -// EasyMock.expect(pluginContext.getName()).andReturn("pluginContext").once(); -// -// PluginMarker pluginMarker1 = PluginMarker.create("id-1", "1"); -// PluginMarker pluginMarker2 = PluginMarkerAdapter.create("id-2", "2", "name-2"); -// -// EasyMock.replay(pluginContext); -// -// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, null).get(), ""); -// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", pluginContext, pluginMarker1).get(), "pluginContext"); -// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker1).get(), "id-1"); -// Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker2).get(), "name-2"); -// -// EasyMock.verify(pluginContext); -// } -// -// @Test -// public void testUpdateMarker2Online() { -// -// try { -// PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0"); -// String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}"; -// JSONObject object = new JSONObject(pluginJson); -// -// PowerMock.mockStatic(PluginUtils.class); -// EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once(); -// EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andThrow(new NullPointerException()).once(); -// -// PowerMock.replayAll(); -// -// PluginMarker marker1 = PluginOperateUtils.updateMarker2Online(pluginMarker); -// PluginMarker marker2 = PluginOperateUtils.updateMarker2Online(pluginMarker); -// -// Assert.assertTrue(marker1 instanceof PluginMarkerAdapter); -// Assert.assertEquals(marker1.getPluginID(), "plugin-1"); -// Assert.assertEquals(marker1.getVersion(), "1.0"); -// Assert.assertEquals(((PluginMarkerAdapter) marker1).getPluginName(), "图表(新特性)"); -// Assert.assertEquals(marker2, pluginMarker); -// -// PowerMock.verifyAll(); -// } catch (Exception e) { -// Assert.fail(); -// } -// -// } -// -// -// @Test -// public void testUpdatePluginOnline() { -// try { -// PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0"); -// String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}"; -// JSONObject object = new JSONObject(pluginJson); -// -// PowerMock.mockStatic(PluginUtils.class); -// EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once(); -// EasyMock.expect(PluginUtils.getInstalledPluginMarkerByID("plugin-1")).andReturn(pluginMarker).once(); -// -// PowerMock.replayAll(); -// -// PluginOperateUtils.updatePluginOnline(pluginMarker, null); -// -// PowerMock.verifyAll(); -// } catch (Exception e) { -// Assert.fail(); -// } -// } -// -//} +package com.fr.design.extra; + +import com.fr.invoke.Reflect; +import com.fr.json.JSONObject; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.context.PluginMarker; +import com.fr.plugin.context.PluginMarkerAdapter; +import com.fr.plugin.error.PluginErrorCode; +import com.fr.plugin.manage.PluginManager; +import com.fr.plugin.manage.control.PluginTask; +import com.fr.plugin.manage.control.PluginTaskResult; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Lucian.Chen + * @version 10.0 + * Created by Lucian.Chen on 2020/12/17 + */ +@RunWith(PowerMockRunner.class) +@PrepareForTest({PluginManager.class, PluginUtils.class}) +public class PluginOperateUtilsTest { + + @Test + public void testGetSuccessInfo() { + PluginTaskResult pluginTaskResult = EasyMock.mock(PluginTaskResult.class); + PluginTaskResult pluginTaskResult1 = EasyMock.mock(PluginTaskResult.class); + PluginTaskResult pluginTaskResult2 = EasyMock.mock(PluginTaskResult.class); + + List pluginTaskResults1 = new ArrayList<>(); + pluginTaskResults1.add(pluginTaskResult1); + List pluginTaskResults2 = new ArrayList<>(); + pluginTaskResults2.add(pluginTaskResult1); + pluginTaskResults2.add(pluginTaskResult2); + + PluginMarker pluginMarker1 = PluginMarker.create("plugin-1", "1.0"); + PluginMarker pluginMarker2 = PluginMarkerAdapter.create("plugin-2", "2.0", "name-2"); + PluginTask pluginTask1 = PluginTask.installTask(pluginMarker1); + PluginTask pluginTask2 = PluginTask.installTask(pluginMarker2); + + EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults1).times(2); + EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults2).times(2); + EasyMock.expect(pluginTaskResult1.getCurrentTask()).andReturn(pluginTask1).anyTimes(); + EasyMock.expect(pluginTaskResult2.getCurrentTask()).andReturn(pluginTask2).anyTimes(); + + EasyMock.expect(pluginTaskResult1.errorCode()).andReturn(PluginErrorCode.BelowSystem).anyTimes(); + EasyMock.expect(pluginTaskResult2.errorCode()).andReturn(PluginErrorCode.BeyondSystem).anyTimes(); + + PluginContext plugin1 = EasyMock.mock(PluginContext.class); + PluginContext plugin2 = EasyMock.mock(PluginContext.class); + EasyMock.expect(plugin1.getName()).andReturn("context-1").anyTimes(); + EasyMock.expect(plugin2.getName()).andReturn("context-2").anyTimes(); + PowerMock.mockStatic(PluginManager.class); + EasyMock.expect(PluginManager.getContext(pluginMarker1.getPluginID())) + .andReturn(plugin1).once().andReturn(null).once().andReturn(plugin1).once().andReturn(null).once(); + EasyMock.expect(PluginManager.getContext(pluginMarker2.getPluginID())) + .andReturn(plugin2).once().andReturn(null).once(); + + EasyMock.replay(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2); + PowerMock.replayAll(); + + // 1个 + Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem"); + Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem"); + + + // 2个 + Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem\ncontext-2Fine-Core_Plugin_Error_BeyondSystem"); + Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem\nname-2Fine-Core_Plugin_Error_BeyondSystem"); + + EasyMock.verify(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2); + PowerMock.verifyAll(); + + } + + + @Test + public void testGetPluginName() { + PluginContext pluginContext = EasyMock.mock(PluginContext.class); + EasyMock.expect(pluginContext.getName()).andReturn("pluginContext").once(); + + PluginMarker pluginMarker1 = PluginMarker.create("id-1", "1"); + PluginMarker pluginMarker2 = PluginMarkerAdapter.create("id-2", "2", "name-2"); + + EasyMock.replay(pluginContext); + + Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, null).get(), ""); + Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", pluginContext, pluginMarker1).get(), "pluginContext"); + Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker1).get(), "id-1"); + Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker2).get(), "name-2"); + + EasyMock.verify(pluginContext); + } + + @Test + public void testUpdateMarker2Online() { + + try { + PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0"); + String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}"; + JSONObject object = new JSONObject(pluginJson); + + PowerMock.mockStatic(PluginUtils.class); + EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once(); + EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andThrow(new NullPointerException()).once(); + + PowerMock.replayAll(); + + PluginMarker marker1 = PluginOperateUtils.updateMarker2Online(pluginMarker); + PluginMarker marker2 = PluginOperateUtils.updateMarker2Online(pluginMarker); + + Assert.assertTrue(marker1 instanceof PluginMarkerAdapter); + Assert.assertEquals(marker1.getPluginID(), "plugin-1"); + Assert.assertEquals(marker1.getVersion(), "1.0"); + Assert.assertEquals(((PluginMarkerAdapter) marker1).getPluginName(), "图表(新特性)"); + Assert.assertEquals(marker2, pluginMarker); + + PowerMock.verifyAll(); + } catch (Exception e) { + Assert.fail(); + } + + } + + + @Test + public void testUpdatePluginOnline() { + try { + PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0"); + String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}"; + JSONObject object = new JSONObject(pluginJson); + + PowerMock.mockStatic(PluginUtils.class); + EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once(); + EasyMock.expect(PluginUtils.getInstalledPluginMarkerByID("plugin-1")).andReturn(pluginMarker).once(); + + PowerMock.replayAll(); + + PluginOperateUtils.updatePluginOnline(pluginMarker, null); + + PowerMock.verifyAll(); + } catch (Exception e) { + Assert.fail(); + } + } + +}