From 9c07d30293d87182451cd482a91db4a48e7f5a2f Mon Sep 17 00:00:00 2001 From: Harrison Date: Thu, 26 Dec 2019 09:41:40 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-25577=20=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=A6=81=E7=94=A8=E5=90=AF=E7=94=A8=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=E5=8E=9F=E6=9C=AC=E8=AE=BE=E7=BD=AE=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E9=85=8D=E7=BD=AE=E5=86=8D=E6=AC=A1=E6=89=93?= =?UTF-8?q?=E5=BC=80=E5=8F=98=E6=88=90=E7=A9=BA=E7=99=BD=20=E4=BF=9D?= =?UTF-8?q?=E6=8C=81=E6=89=93=E5=BC=80=E5=BD=93=E5=89=8D=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E6=95=B0=E6=8D=AE=E9=9B=86=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E6=AE=8B=E7=95=99=E3=80=82=20=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E6=89=93=E5=BC=80=E5=BD=93=E5=89=8D=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=EF=BC=8C=E6=89=8D=E8=83=BD=E5=88=B7=E6=96=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/TableDataTreePane.java | 78 ++++++++++++++----- 1 file changed, 57 insertions(+), 21 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 56f81e9a5b..b46fbbfb9d 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,6 +16,8 @@ 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.file.HistoryTemplateListCache; +import com.fr.design.fun.TableDataDefineProvider; import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; @@ -24,12 +26,12 @@ import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.icon.IconPathConstants; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ToolBarDef; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; - import com.fr.general.NameObject; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; @@ -38,8 +40,13 @@ import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.core.PropertyChangeAdapter; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import javax.swing.ToolTipManager; +import java.awt.BorderLayout; +import java.awt.GridLayout; import java.awt.dnd.DnDConstants; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; @@ -89,23 +96,9 @@ public class TableDataTreePane extends BasicTableDataTreePane { createAddMenuDef(); - GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) { - - @Override - public void on(PluginEvent event) { - - addMenuDef.clearShortCuts(); - createAddMenuDef(); - } - }, new PluginFilter() { - - @Override - public boolean accept(PluginContext context) { + // 创建插件监听 + createPluginListener(); - return context.contain(PluginModule.ExtraDesign); - } - }); - editAction = new EditAction(); removeAction = new RemoveAction(); previewTableDataAction = new PreviewTableDataAction(dataTree); @@ -145,8 +138,51 @@ public class TableDataTreePane extends BasicTableDataTreePane { new TableDataTreeDragSource(dataTree, DnDConstants.ACTION_COPY); checkButtonEnabled(); } - - + + private void createPluginListener() { + + //菜单栏监听 + GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) { + + @Override + public void on(PluginEvent event) { + + addMenuDef.clearShortCuts(); + createAddMenuDef(); + } + }, new PluginFilter() { + + @Override + public boolean accept(PluginContext context) { + + return context.contain(PluginModule.ExtraDesign); + } + }); + + //监听数据集插件 + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + @Override + public void on(PluginEvent event) { + //REPORT-25577 + //如果数据集插件禁用或启用。需要清空当前模板中的缓存 + reloadCurrTemplate(); + } + + private void reloadCurrTemplate() { + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + HistoryTemplateListCache.getInstance().closeSelectedReport(jt); + DesignerContext.getDesignerFrame().openTemplate(jt.getEditingFILE()); + } + }, new PluginFilter() { + @Override + public boolean accept(PluginContext pluginContext) { + + return pluginContext.contain(TableDataDefineProvider.XML_TAG); + } + }); + } + + protected void checkButtonEnabled() { super.checkButtonEnabled(editAction, previewTableDataAction, removeAction, op, dataTree); }