From ba5c403f7ac586d8e8393f7557d559c66dd36d99 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 21 May 2020 15:48:31 +0800 Subject: [PATCH 1/6] =?UTF-8?q?REPORT-32068=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E9=BB=91=E5=B1=8F=EF=BC=8C=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=EF=BC=8C=E9=87=8D=E5=90=AF=E5=90=8E=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index a1f88d77c..622e9a59c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -11,6 +11,7 @@ import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.VerticalFlowLayout; +import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.general.FRFont; @@ -150,12 +151,18 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void on(PluginEvent event) { PluginContext context = event.getContext(); PluginRuntime runtime = context.getRuntime(); - Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); - for (PropertyItemPaneProvider provider : providers) { - addPropertyItem(provider); - } - updateAllPropertyPane(); - } + final Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); + // UI相关的逻辑 用UI线程执行 不走FinePluginController线程 走FinePluginController线程有几率出问题 + // 容易导致FinePluginController持有Swing内部的java.awt.Component$AWTTreeLock 这个锁不能被UI线程之外的线程持有 否则容易造成UI线程被Blocked住 + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + for (PropertyItemPaneProvider provider : providers) { + addPropertyItem(provider); + } + updateAllPropertyPane(); + } + }); } }, filter); PluginListenerRegistration.getInstance().listen( PluginEventType.BeforeStop, @@ -164,12 +171,16 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void on(PluginEvent event) { PluginContext context = event.getContext(); PluginRuntime runtime = context.getRuntime(); - Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); - for (PropertyItemPaneProvider provider : providers) { - removePropertyItem(provider); - - } - updateAllPropertyPane(); + final Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + for (PropertyItemPaneProvider provider : providers) { + removePropertyItem(provider); + } + updateAllPropertyPane(); + } + }); } }, filter); } From ae745082ebcd19b4e0a597e9ba1cd19b1f13e915 Mon Sep 17 00:00:00 2001 From: Harrison Date: Thu, 21 May 2020 16:33:33 +0800 Subject: [PATCH 2/6] =?UTF-8?q?REPORT-32088=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8A=A0=E5=AF=86=E3=80=91@harrison=E9=9B=86=E7=BE=A4=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=87=BA=E7=8E=B0=E5=88=9D=E5=A7=8B=E5=8C=96=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=20=E6=8F=92=E4=BB=B6=E6=8E=A5=E5=8F=A3=E7=9A=84?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E6=9C=89=E7=82=B9=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=20=E4=B8=8D=E8=83=BD=E6=94=BE=E5=88=B0=20form=20=E4=B8=8B?= =?UTF-8?q?=EF=BC=8C=20=E8=A6=81=E6=94=BE=E5=88=B0=20design=20=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/events/CreatorEventListenerTable.java | 4 ++-- .../design/designer/beans/models/SelectionModelTest.java | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/events/CreatorEventListenerTable.java b/designer-form/src/main/java/com/fr/design/designer/beans/events/CreatorEventListenerTable.java index aa0ea1c9a..d7f1a199c 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/events/CreatorEventListenerTable.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/events/CreatorEventListenerTable.java @@ -1,8 +1,8 @@ package com.fr.design.designer.beans.events; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.creator.XComponent; import com.fr.design.fun.DesignerEditListenerProvider; -import com.fr.form.main.ExtraFormClassManager; import com.fr.general.ComparatorUtils; import com.fr.plugin.injectable.PluginModule; @@ -44,7 +44,7 @@ public class CreatorEventListenerTable { } //触发插件的事件 - ExtraFormClassManager manager = PluginModule.getAgent(PluginModule.ExtraForm); + ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); Set providers = manager.getArray(DesignerEditListenerProvider.XML_TAG); for (DesignerEditListenerProvider provider : providers) { provider.fireCreatorModified(evt); diff --git a/designer-form/src/test/java/com/fr/design/designer/beans/models/SelectionModelTest.java b/designer-form/src/test/java/com/fr/design/designer/beans/models/SelectionModelTest.java index 06f1be65c..6ab4dd308 100644 --- a/designer-form/src/test/java/com/fr/design/designer/beans/models/SelectionModelTest.java +++ b/designer-form/src/test/java/com/fr/design/designer/beans/models/SelectionModelTest.java @@ -6,7 +6,6 @@ import com.fr.design.designer.creator.XCreator; import com.fr.design.fun.ClipboardHandlerProvider; import com.fr.design.fun.impl.AbstractClipboardHandlerProvider; import com.fr.design.mainframe.FormDesigner; -import com.fr.form.main.ExtraFormClassManager; import com.fr.plugin.injectable.PluginModule; import com.fr.stable.fun.mark.Mutable; import org.easymock.EasyMock; @@ -59,18 +58,15 @@ public class SelectionModelTest { EasyMock.expect(designManager.getArray(ClipboardHandlerProvider.XML_TAG)) .andReturn(providers) .anyTimes(); - ExtraFormClassManager formManager = EasyMock.mock(ExtraFormClassManager.class); - EasyMock.expect(formManager.getArray("DesignerEditListenerProvider")) + EasyMock.expect(designManager.getArray("DesignerEditListenerProvider")) .andReturn(new HashSet()) .anyTimes(); - EasyMock.replay(designManager, formManager); + EasyMock.replay(designManager); PowerMock.mockStatic(PluginModule.class); EasyMock.expect(PluginModule.getAgent(PluginModule.ExtraDesign)) .andReturn(designManager) .anyTimes(); - EasyMock.expect(PluginModule.getAgent(PluginModule.ExtraForm)) - .andReturn(formManager).anyTimes(); PowerMock.replayAll(); } From 9e55fcdc503485805ee952e2a5ce2181baf5d2cf Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 21 May 2020 17:07:30 +0800 Subject: [PATCH 3/6] =?UTF-8?q?REPORT-32073=E3=80=90=E5=86=92=E7=83=9F?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E3=80=91=E6=A8=A1=E6=9D=BFweb=E5=B1=9E?= =?UTF-8?q?=E6=80=A7-=E5=B7=A5=E5=85=B7=E6=A0=8F=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E4=B9=8B=E5=90=8E=EF=BC=8C=E7=82=B9=E7=A1=AE=E5=AE=9A=EF=BC=8C?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E6=97=A0=E6=B3=95=E7=BC=A9=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/webattr/EditToolBar.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java b/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java index 9bb14d106..044c395e4 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java @@ -31,6 +31,7 @@ import com.fr.form.ui.Widget; import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.Background; +import com.fr.log.FineLoggerFactory; import com.fr.report.web.button.Email; import com.fr.report.web.button.Export; import com.fr.report.web.button.write.AppendColumnRow; @@ -224,7 +225,11 @@ public class EditToolBar extends BasicPane { String iconname = ((Button) widget).getIconName(); if (StringUtils.isNotBlank(iconname)) { Image iimage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(iconname); - toolBarButton.setIcon(new ImageIcon(iimage)); + if (iimage != null) { + toolBarButton.setIcon(new ImageIcon(iimage)); + } else { + FineLoggerFactory.getLogger().warn(iconname + " can not find in finedb!"); + } } } } From 9870bc907fdcbca3ee9706dadd5664e1a0c7bce3 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 21 May 2020 17:30:55 +0800 Subject: [PATCH 4/6] =?UTF-8?q?REPORT-32073=20fix=20=E6=8D=A2=E4=B8=AA?= =?UTF-8?q?=E5=A5=BD=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/webattr/EditToolBar.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java b/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java index 044c395e4..f1cd05a90 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java @@ -224,9 +224,9 @@ public class EditToolBar extends BasicPane { if (widget instanceof Button) { String iconname = ((Button) widget).getIconName(); if (StringUtils.isNotBlank(iconname)) { - Image iimage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(iconname); - if (iimage != null) { - toolBarButton.setIcon(new ImageIcon(iimage)); + Image iconImage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(iconname); + if (iconImage != null) { + toolBarButton.setIcon(new ImageIcon(iconImage)); } else { FineLoggerFactory.getLogger().warn(iconname + " can not find in finedb!"); } From 6a6469cb357c61865ae0df11e0e5c2d97bfbb6b1 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 21 May 2020 20:30:15 +0800 Subject: [PATCH 5/6] =?UTF-8?q?REPORT-32105=20=E8=A1=A8=E5=8D=95=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E5=90=8E=20JForm=E5=AF=B9=E8=B1=A1=E6=9C=AA=E9=87=8A?= =?UTF-8?q?=E6=94=BE=20=E5=AF=BC=E8=87=B4=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=9C=80=E7=BB=88=E5=8F=91=E7=94=9Foom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/JForm.java | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 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 ff59a52d4..e2112f4f3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -128,6 +128,8 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm providers = runtime.get(PropertyItemPaneProvider.XML_TAG); - for (PropertyItemPaneProvider provider : providers) { - addPane(provider); - } - } - }, filter); + this.pluginListener = new PluginEventListener(PropertyItemPaneProvider.LAST) { + @Override + public void on(PluginEvent event) { + PluginContext context = event.getContext(); + PluginRuntime runtime = context.getRuntime(); + Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); + for (PropertyItemPaneProvider provider : providers) { + addPane(provider); + } + } + }; + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginListener, filter); } private void initPluginPane() { @@ -1038,4 +1040,10 @@ public class JForm extends JTemplate implements BaseJForm Date: Fri, 22 May 2020 10:22:06 +0800 Subject: [PATCH 6/6] =?UTF-8?q?REPORT-32043=2010.0=E5=86=92=E7=83=9F?= =?UTF-8?q?=EF=BC=9A=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8=E7=BB=8F?= =?UTF-8?q?=E5=B8=B8=E7=99=BD=E5=B1=8F=EF=BC=8C=E5=8D=A1=E4=BD=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/loghandler/LogHandlerBar.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java index f86cb22ef..433d601c0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java @@ -15,6 +15,11 @@ import static com.fr.design.i18n.Toolkit.i18nText; public class LogHandlerBar extends JPanel implements ItemSelectable { + // 可以作为常量 提前初始化 不用每次都去实时频繁的读取 + private static final String NORMAL_MARK = i18nText("Fine-Design_Basic_NNormal"); + private static final String ALERT_MARK = i18nText("Fine-Design_Basic_Alert"); + private static final String SERIOUSLY_MARK = i18nText("Fine-Design_Basic_Seriously"); + private static final long serialVersionUID = 1L; private ItemListener listeners; private UIButton clear; @@ -75,9 +80,13 @@ public class LogHandlerBar extends JPanel implements ItemSelectable { UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { - normalLabel.setText(i18nText("Fine-Design_Basic_NNormal") + '(' + getInfo() + ')'); - alertLabel.setText(i18nText("Fine-Design_Basic_Alert") + '(' + getError() + ')'); - seriouslyLabel.setText(i18nText("Fine-Design_Basic_Seriously") + '(' + getServer() + ')'); + // 这块逻辑执行地很频繁 + // 容易造成 AWT 与 FinePluginController 发生死锁 + // in18Text每次读取 资源的时候 都会走下插件引擎逻辑去读取下插件的资源 + // 应该避免每次都去读取 可以作为常量提前初始化好 避免与FinePluginController的竞争 + normalLabel.setText(NORMAL_MARK + '(' + getInfo() + ')'); + alertLabel.setText(ALERT_MARK + '(' + getError() + ')'); + seriouslyLabel.setText(SERIOUSLY_MARK + '(' + getServer() + ')'); } }); }