From 901dcbc37a95b946dd8c22dd63e25a9e995b6f26 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 7 Jul 2017 10:41:50 +0800 Subject: [PATCH] =?UTF-8?q?PFC-607=20=E6=8F=92=E4=BB=B6=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=9B=B4=E6=96=B0=E4=B8=8D=E9=87=8D=E5=90=AF?= =?UTF-8?q?=E6=94=AF=E6=8C=81=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 4 +- .../com/fr/design/mainframe/FormParaPane.java | 24 +++++++++++ .../design/mainframe/FormParaWidgetPane.java | 40 ++++++++++++++++--- 3 files changed, 61 insertions(+), 7 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java index 737fdcab27..61113b593b 100644 --- a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java +++ b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java @@ -182,8 +182,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta //hugh: private修改为protected方便oem的时候修改右上的组件构成 //顶部日志+登陆按钮 final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - - GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + //优先级为-1,保证最后全面刷新一次 + GeneralContext.listenPluginRunningChanged(new PluginEventListener(-1) { @Override public void on(PluginEvent event) { diff --git a/designer_form/src/com/fr/design/mainframe/FormParaPane.java b/designer_form/src/com/fr/design/mainframe/FormParaPane.java index 755deec3b0..d3f0fa0cbb 100644 --- a/designer_form/src/com/fr/design/mainframe/FormParaPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormParaPane.java @@ -9,7 +9,13 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.*; +import com.fr.general.GeneralContext; import com.fr.general.Inter; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.injectable.PluginModule; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.ArrayUtils; import javax.swing.*; @@ -43,6 +49,24 @@ public class FormParaPane extends JPanel { private FormDesigner designer; + static { + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + + @Override + public void on(PluginEvent event) { + + THIS = null; + } + }, new PluginFilter() { + + @Override + public boolean accept(PluginContext context) { + + return context.contain(PluginModule.ExtraDesign); + } + }); + } + public static final FormParaPane getInstance(FormDesigner designer) { if(THIS == null) { THIS = new FormParaPane(); diff --git a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java index 4ae8e01bd5..a5b39ae886 100644 --- a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java @@ -5,6 +5,7 @@ import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.gui.core.FormWidgetOption; import com.fr.design.gui.core.UserDefinedWidgetOption; import com.fr.design.gui.core.WidgetOption; @@ -16,12 +17,21 @@ import com.fr.design.module.DesignModuleFactory; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.*; import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralContext; import com.fr.general.Inter; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.injectable.PluginModule; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.ArrayUtils; import javax.swing.*; import java.awt.*; -import java.awt.event.*; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -58,6 +68,26 @@ public class FormParaWidgetPane extends JPanel { private FormDesigner designer; + static { + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + + @Override + public void on(PluginEvent event) { + + synchronized (FormParaWidgetPane.class) { + THIS = null; + } + } + }, new PluginFilter() { + + @Override + public boolean accept(PluginContext context) { + + return context.contain(PluginModule.ExtraDesign, FormWidgetOptionProvider.XML_TAG); + } + }); + } + public static synchronized final FormParaWidgetPane getInstance(FormDesigner designer) { if (THIS == null) { THIS = new FormParaWidgetPane(); @@ -254,8 +284,8 @@ public class FormParaWidgetPane extends JPanel { public void mouseClicked(MouseEvent e) { initChartTypePopUp(); chartTypePopupMenu.show(FormParaWidgetPane.this, - (int) jSeparatorLayout.getLocation().getX() + BORDER, - (int) jSeparatorLayout.getLocation().getY()); + (int) jSeparatorChart.getLocation().getX() + BORDER, + (int) jSeparatorChart.getLocation().getY()); } }); labelPane.add(chartPopUpButton, BorderLayout.EAST); @@ -274,8 +304,8 @@ public class FormParaWidgetPane extends JPanel { public void mouseClicked(MouseEvent e) { initWidgetTypePopUp(); widgetTypePopupMenu.show(FormParaWidgetPane.this, - (int) jSeparatorChart.getLocation().getX() + BORDER, - (int) jSeparatorChart.getLocation().getY()); + (int) jSeparatorLayout.getLocation().getX() + BORDER, + (int) jSeparatorLayout.getLocation().getY()); } });