From f12138626871ed9f050a8015806fda664b01960e Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 25 Dec 2020 09:21:53 +0800 Subject: [PATCH 01/17] =?UTF-8?q?KERNEL-6380=20=E5=9C=A8=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=88=87=E6=8D=A2=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=EF=BC=8C=E9=9C=80=E8=A6=81=E6=9C=89=E4=B8=80=E4=B8=AA=E9=9B=86?= =?UTF-8?q?=E4=B8=AD=E5=88=B7=E6=96=B0=E7=BC=93=E5=AD=98=E7=9A=84=E5=9C=B0?= =?UTF-8?q?=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/PluginRefreshManager.java | 73 +++++++++++++++++++ .../data/datapane/TableDataTreePane.java | 34 --------- .../design/file/HistoryTemplateListCache.java | 27 +++++++ .../design/gui/frpane/HyperlinkGroupPane.java | 1 - .../com/fr/design/mainframe/JTemplate.java | 18 +++-- .../start/module/DesignerInitActivator.java | 2 + .../module/DesignerWorkspaceActivator.java | 4 +- 7 files changed, 118 insertions(+), 41 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/PluginRefreshManager.java diff --git a/designer-base/src/main/java/com/fr/design/PluginRefreshManager.java b/designer-base/src/main/java/com/fr/design/PluginRefreshManager.java new file mode 100644 index 0000000000..67442bb06a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/PluginRefreshManager.java @@ -0,0 +1,73 @@ +package com.fr.design; + +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.fun.HyperlinkProvider; +import com.fr.design.fun.TableDataDefineProvider; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; +import com.fr.plugin.observer.PluginEventType; +import com.fr.plugin.observer.PluginListenerRegistration; +import com.fr.stable.fun.IOFileAttrMark; +import java.util.HashSet; +import java.util.Set; + +/** + * + * @author hades + * @version 10.0 + * Created by hades on 2020/12/17 + */ +public class PluginRefreshManager { + + + private static final PluginRefreshManager INSTANCE = new PluginRefreshManager(); + + private final Set context = new HashSet<>(); + + private final PluginEventListener pluginAfterRunEventListener = new PluginEventListener() { + @Override + public void on(PluginEvent event) { + // 重新载入模板xml内容 到 Workbook/Form对象中 + HistoryTemplateListCache.getInstance().reloadAllEditingTemplate(); + } + }; + + private final PluginFilter pluginFilter = pluginContext -> { + for (String xmlTag : context) { + if (pluginContext.contain(xmlTag)) { + return true; + } + } + return false; + }; + + + public static PluginRefreshManager getInstance() { + return INSTANCE; + } + + public void load() { + context.add(IOFileAttrMark.MARK_STRING); + context.add(TableDataDefineProvider.XML_TAG); + context.add(HyperlinkProvider.XML_TAG); + } + + private PluginRefreshManager() { + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginAfterRunEventListener, this.pluginFilter); + } + + public void registerItem(String xmlTag) { + context.add(xmlTag); + } + + public void removePluginListener() { + PluginListenerRegistration.getInstance().stopListen(this.pluginAfterRunEventListener); + + } + + public void addPluginListener() { + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginAfterRunEventListener, this.pluginFilter); + } + +} 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 a2cc5b7d28..f1a3cf336c 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 @@ -18,8 +18,6 @@ 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.fun.TableDataPaneProcessor; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; @@ -28,7 +26,6 @@ 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; @@ -98,9 +95,6 @@ public class TableDataTreePane extends BasicTableDataTreePane { createAddMenuDef(); - // 创建插件监听 - createPluginListener(); - editAction = new EditAction(); removeAction = new RemoveAction(); previewTableDataAction = new PreviewTableDataAction(dataTree); @@ -160,34 +154,6 @@ public class TableDataTreePane extends BasicTableDataTreePane { 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(); - if (accept(jt)) { - 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/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 7b13c94a07..05b2a24f67 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -420,6 +420,7 @@ public class HistoryTemplateListCache implements CallbackEvent { /** * 重新载入当前模板,刷新数据/对象 */ + @Deprecated public void reloadCurrentTemplate() { JTemplate jt = getCurrentEditingTemplate(); boolean access = jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists(); @@ -440,4 +441,30 @@ public class HistoryTemplateListCache implements CallbackEvent { }); } + /** + * 插件安装后/启用 重新加载模板资源 + */ + public void reloadAllEditingTemplate() { + FineLoggerFactory.getLogger().info("Plugin env Change reload all template started"); + int size = historyList.size(); + for (int i = 0; i < size; i++) { + JTemplate template = historyList.get(i); + FILE file = template.getEditingFILE(); + try { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + BaseBook target = template.getTarget(); + if (target != null) { + FineLoggerFactory.getLogger().info("{} is being reloaded", template.getName()); + target.export(outputStream); + FILE stashedFile = new StashedFILE(file, outputStream.toByteArray()); + template.refreshResource(stashedFile); + } + // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + FineLoggerFactory.getLogger().info("Plugin env Change reload all template ended"); + } + } diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java index 8405ce09ea..0a8e4769a9 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java @@ -46,7 +46,6 @@ public abstract class HyperlinkGroupPane extends UIListControlPane { @Override public void on(PluginEvent event) { refreshNameableCreator(createNameableCreators()); - HistoryTemplateListCache.getInstance().reloadCurrentTemplate(); } }, new PluginFilter() { 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 5cfd7a13d4..87bcd23f5e 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,6 +47,7 @@ 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; @@ -332,16 +333,23 @@ public abstract class JTemplate> * CenterPane 负责监听改动。 * 所以需要同步处理 */ + @Deprecated public void refreshResource() { + refreshResource(this.editingFILE); + } + + public void refreshResource(FILE file) { try { - this.template = JTemplateFactory.asIOFile(this.editingFILE); + this.template = JTemplateFactory.asIOFile(file); setTarget(this.template); - // 先移除旧的。 - removeCenterPane(); - // 加入新的 - addCenterPane(); + UIUtil.invokeLaterIfNeeded(() -> { + // 先移除旧的。 + removeCenterPane(); + // 加入新的 + addCenterPane(); + }); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java index 1eeb5a6a3a..5ca7efdd6b 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java @@ -1,5 +1,6 @@ package com.fr.start.module; +import com.fr.design.PluginRefreshManager; import com.fr.module.Activator; import com.fr.start.DesignerInitial; @@ -15,6 +16,7 @@ public class DesignerInitActivator extends Activator { @Override public void start() { + PluginRefreshManager.getInstance().load(); DesignerInitial.init(findSingleton(StartupArgs.class).get()); } diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java index f5231eafeb..1842ea7622 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java @@ -1,6 +1,7 @@ package com.fr.start.module; import com.fr.concurrent.NamedThreadFactory; +import com.fr.design.PluginRefreshManager; import com.fr.design.file.HistoryTemplateListCache; import com.fr.event.Event; import com.fr.event.Listener; @@ -50,7 +51,7 @@ public class DesignerWorkspaceActivator extends Activator { @Override public void on(Event event, Workspace workspace) { - + PluginRefreshManager.getInstance().removePluginListener(); HistoryTemplateListCache.getInstance().stash(); } }); @@ -62,6 +63,7 @@ public class DesignerWorkspaceActivator extends Activator { public void on(Event event, Workspace workspace) { HistoryTemplateListCache.getInstance().load(); + PluginRefreshManager.getInstance().addPluginListener(); } }); } From 6246ac593d6632dcf2ab5ed243f225ad62482bff Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Mon, 28 Dec 2020 10:40:38 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E7=82=B9=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/designer/style/series/VanChartMapAnchorMarkerPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java index d4c1f477bd..745c3a79a8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java @@ -22,7 +22,7 @@ public class VanChartMapAnchorMarkerPane extends BasicBeanPane Date: Mon, 28 Dec 2020 15:15:21 +0800 Subject: [PATCH 03/17] CHART-17573 && CHART-17567 && CHART-17434 bugfix --- .../com/fr/design/chart/ChartSwingUtils.java | 2 +- .../van/chart/map/VanChartMapSeriesPane.java | 18 ++++++++++---- .../style/label/VanChartMapLabelPane.java | 24 ++++++++----------- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartSwingUtils.java b/designer-chart/src/main/java/com/fr/design/chart/ChartSwingUtils.java index b5b0576913..41e1753f7b 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartSwingUtils.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartSwingUtils.java @@ -31,7 +31,7 @@ public class ChartSwingUtils { }); textField.addKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { - if(box.isSelected()) { + if(box.isSelected() && !e.isControlDown()) { e.consume(); showFormulaPane(textField, null); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java index 29111b4b58..8f5a3d1783 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java @@ -17,6 +17,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralUtils; import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.base.AttrBorderWithAlpha; import com.fr.plugin.chart.base.AttrEffect; @@ -30,6 +31,7 @@ import com.fr.plugin.chart.map.line.condition.AttrCurve; import com.fr.plugin.chart.map.line.condition.AttrLineEffect; import com.fr.plugin.chart.type.MapMarkerType; import com.fr.plugin.chart.type.MapType; +import com.fr.stable.StringUtils; import com.fr.van.chart.bubble.component.VanChartBubblePane; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.border.VanChartBorderWithAlphaPane; @@ -173,22 +175,29 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { } private void checkPointCompsEnabledWithLarge(Plot plot) { - boolean largeModel = largeModel(plot); - if (pointEffectPane != null) { - GUICoreUtils.setEnabled(pointEffectPane, !largeModel); - } + checkPointEffectPane(plot); if (markerTypeCom == null) { return; } VanChartMapPlot mapPlot = (VanChartMapPlot) plot; + boolean largeModel = largeModel(plot); refreshMarkerComboboxModel(mapPlot); if (largeModel) { checkLargeModelPlotSelectedItem(mapPlot); } } + private void checkPointEffectPane(Plot plot) { + if (pointEffectPane != null) { + boolean largeModel = largeModel(plot); + boolean imageMark = markerTypeCom == null ? false : + StringUtils.equals(MapMarkerType.IMAGE.toLocalString(), GeneralUtils.objectToString(markerTypeCom.getSelectedItem())); + GUICoreUtils.setEnabled(pointEffectPane, !largeModel && !imageMark); + } + } + private void checkLineCompsEnabledWithLarge(Plot plot) { if (lineMapEffectPane != null) { //大数据模式 恢复用注释。下面1行删除。 @@ -483,6 +492,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { @Override public void itemStateChanged(ItemEvent e) { markerTypeLayout.show(markerContentPane, (String) markerTypeCom.getSelectedItem()); + checkPointEffectPane(plot); } }); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelPane.java index 6d22d97001..80dc9ef0b1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelPane.java @@ -39,18 +39,14 @@ public class VanChartMapLabelPane extends AbstractVanChartScrollPane { if (mapPlot == null) { return contentPane; } - switch (mapPlot.getAllLayersMapType()){ + switch (mapPlot.getAllLayersMapType()) { case POINT: pointLabelPane = new VanChartPlotLabelPane(mapPlot, parent); contentPane.add(pointLabelPane, BorderLayout.NORTH); break; case CUSTOM: - areaLabelPane = createAreaMapPlotLabelPane(); - pointLabelPane = new VanChartPlotLabelPane(mapPlot, parent); - contentPane.add(new VanMapAreaAndPointGroupPane(areaLabelPane, pointLabelPane), BorderLayout.NORTH); - break; case DRILL_CUSTOM: - areaLabelPane = new VanChartPlotLabelPane(mapPlot, parent); + areaLabelPane = createAreaMapPlotLabelPane(); pointLabelPane = new VanChartPlotLabelPane(mapPlot, parent); contentPane.add(new VanMapAreaAndPointGroupPane(areaLabelPane, pointLabelPane), BorderLayout.NORTH); break; @@ -64,7 +60,7 @@ public class VanChartMapLabelPane extends AbstractVanChartScrollPane { } private VanChartPlotLabelPane createAreaMapPlotLabelPane() { - return new VanChartPlotLabelPane(mapPlot, parent){ + return new VanChartPlotLabelPane(mapPlot, parent) { @Override protected boolean checkEnabled4Large() { return false; @@ -75,7 +71,7 @@ public class VanChartMapLabelPane extends AbstractVanChartScrollPane { @Override public void populateBean(Chart chart) { Plot plot = chart.getPlot(); - if(plot instanceof VanChartMapPlot){ + if (plot instanceof VanChartMapPlot) { mapPlot = (VanChartMapPlot) plot; } @@ -85,11 +81,11 @@ public class VanChartMapLabelPane extends AbstractVanChartScrollPane { parent.initAllListeners(); } - AttrMapLabel attrMapLabel = (AttrMapLabel)plot.getConditionCollection().getDefaultAttr().getExisted(AttrMapLabel.class); - if(attrMapLabel == null){ + AttrMapLabel attrMapLabel = (AttrMapLabel) plot.getConditionCollection().getDefaultAttr().getExisted(AttrMapLabel.class); + if (attrMapLabel == null) { attrMapLabel = new AttrMapLabel(); } - if(pointLabelPane != null){ + if (pointLabelPane != null) { pointLabelPane.populate(attrMapLabel.getPointLabel()); } if (areaLabelPane != null) { @@ -103,17 +99,17 @@ public class VanChartMapLabelPane extends AbstractVanChartScrollPane { return; } ConditionAttr defaultAttr = chart.getPlot().getConditionCollection().getDefaultAttr(); - AttrMapLabel attrMapLabel = (AttrMapLabel)defaultAttr.getExisted(AttrMapLabel.class); + AttrMapLabel attrMapLabel = (AttrMapLabel) defaultAttr.getExisted(AttrMapLabel.class); if (attrMapLabel != null) { defaultAttr.remove(attrMapLabel); } else { attrMapLabel = new AttrMapLabel(); } - if(areaLabelPane != null){ + if (areaLabelPane != null) { attrMapLabel.setAreaLabel(areaLabelPane.update()); } - if(pointLabelPane != null){ + if (pointLabelPane != null) { attrMapLabel.setPointLabel(pointLabelPane.update()); } From 1bfb44b088ef206f140a2cfcc053cceabc156dad Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 29 Dec 2020 09:25:37 +0800 Subject: [PATCH 04/17] =?UTF-8?q?KERNEL-6380=20=E5=9C=A8=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=88=87=E6=8D=A2=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=EF=BC=8C=E9=9C=80=E8=A6=81=E6=9C=89=E4=B8=80=E4=B8=AA=E9=9B=86?= =?UTF-8?q?=E4=B8=AD=E5=88=B7=E6=96=B0=E7=BC=93=E5=AD=98=E7=9A=84=E5=9C=B0?= =?UTF-8?q?=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/base/ClassHelper.java | 174 ++++++++++++++++++ .../com/fr/design/PluginRefreshManager.java | 51 +++-- .../data/datapane/TableDataTreePane.java | 2 + .../design/file/HistoryTemplateListCache.java | 97 +++++----- .../com/fr/design/mainframe/JTemplate.java | 2 - .../java/com/fr/base/ClassHelperTest.java | 28 +++ 6 files changed, 300 insertions(+), 54 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/base/ClassHelper.java create mode 100644 designer-base/src/test/java/com/fr/base/ClassHelperTest.java diff --git a/designer-base/src/main/java/com/fr/base/ClassHelper.java b/designer-base/src/main/java/com/fr/base/ClassHelper.java new file mode 100644 index 0000000000..00ff7f9eb4 --- /dev/null +++ b/designer-base/src/main/java/com/fr/base/ClassHelper.java @@ -0,0 +1,174 @@ +package com.fr.base; + +import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; +import java.lang.reflect.Array; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import org.jetbrains.annotations.Nullable; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/12/28 + */ +public class ClassHelper { + + private static final Set primClasses = new HashSet<>(); + + private static final Set classLoaders = new HashSet<>(); + + private static final Map map = new HashMap<>(); + + private static final Set data = new HashSet<>(); + + private static final String PLUGIN_CLASS_CLASSLOADER= "com.fr.plugin.engine.core.PluginClassLoader"; + + static { + primClasses.add("boolean"); + primClasses.add("byte"); + primClasses.add("char"); + primClasses.add("short"); + primClasses.add("int"); + primClasses.add("long"); + primClasses.add("float"); + primClasses.add("double"); + primClasses.add("void"); + primClasses.add("java.lang.Boolean"); + primClasses.add("java.lang.Byte"); + primClasses.add("java.lang.Character"); + primClasses.add("java.lang.Short"); + primClasses.add("java.lang.Integer"); + primClasses.add("java.lang.Long"); + primClasses.add("java.lang.FLOAT"); + primClasses.add("java.lang.DOUBLE"); + primClasses.add("java.lang.Void"); + primClasses.add("java.lang.String"); + primClasses.add("java.awt.image.BufferedImage"); + } + + + /** + * 获取当前对象字段中由插件加载出类的classloader + * + * @param o + * @return + */ + @Nullable + public static Set getPluginClassLoaders(Object o) { + try { + collectClassloader(o); + Set result = new HashSet<>(classLoaders); + data.clear(); + classLoaders.clear(); + map.clear(); + return result; + } catch (Throwable e) { + FineLoggerFactory.getLogger().warn(e.getMessage(), e); + data.clear(); + classLoaders.clear(); + map.clear(); + return null; + } + } + + private static void collectClassloader(Object o) { + if (o == null) { + return; + } + Field[] fields; + Class aclass = o.getClass(); + + String className = aclass.getName(); + + if (map.containsKey(className)) { + fields = map.get(className); + } else { + fields = fields(aclass, o); + map.put(className, fields); + } + + if (aclass.isArray()) { + for (int i = 0, len = Array.getLength(o); i < len; i++) { + Object arrayOb = Array.get(o, i); + if (arrayOb != null) { + Class arrayObClass = arrayOb.getClass(); + String name = arrayObClass.getName(); + if (primClasses.contains(name)) { + return; + } + data.add(arrayOb); + ClassLoader loader = arrayObClass.getClassLoader(); + if (loader != null && ComparatorUtils.equals(loader.getClass().getName(), PLUGIN_CLASS_CLASSLOADER)) { + classLoaders.add(loader); + } + } else { + continue; + } + collectClassloader(arrayOb); + } + } + + if (fields.length == 0) { + return; + } + + for (Field field : fields) { + if (!field.isAccessible()) { + field.setAccessible(true); + } + Object ob = null; + try { + ob = field.get(o); + + if (ob == null) { + continue; + } + Class clazz = ob.getClass(); + String name = clazz.getName(); + + if (primClasses.contains(name)) { + continue; + } + + if (!data.contains(ob)) { + data.add(ob); + ClassLoader loader = clazz.getClassLoader(); + if (loader != null && ComparatorUtils.equals(loader.getClass().getName(), PLUGIN_CLASS_CLASSLOADER)) { + classLoaders.add(loader); + } + collectClassloader(ob); + } + + } catch (Throwable e) { + FineLoggerFactory.getLogger().warn(e.getMessage(), e); + } + } + } + + + + private static Field[] fields(Class clazz, Object o) { + + Class t = clazz; + Set result = new HashSet<>(); + + do { + for (Field field : t.getDeclaredFields()) { + if (clazz != o ^ Modifier.isStatic(field.getModifiers())) { + result.add(field); + } + } + + t = t.getSuperclass(); + } + while (t != null); + + return result.toArray(new Field[0]); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/PluginRefreshManager.java b/designer-base/src/main/java/com/fr/design/PluginRefreshManager.java index 67442bb06a..6ccf1f1906 100644 --- a/designer-base/src/main/java/com/fr/design/PluginRefreshManager.java +++ b/designer-base/src/main/java/com/fr/design/PluginRefreshManager.java @@ -1,14 +1,13 @@ package com.fr.design; +import com.fr.design.constants.DesignerLaunchStatus; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.HyperlinkProvider; import com.fr.design.fun.TableDataDefineProvider; -import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventType; import com.fr.plugin.observer.PluginListenerRegistration; -import com.fr.stable.fun.IOFileAttrMark; import java.util.HashSet; import java.util.Set; @@ -28,18 +27,33 @@ public class PluginRefreshManager { private final PluginEventListener pluginAfterRunEventListener = new PluginEventListener() { @Override public void on(PluginEvent event) { + boolean mustReload = false; + // 兼容之前版本特性 + for (String tag : context) { + if (event.getContext().contain(tag)) { + mustReload = true; + break; + } + } // 重新载入模板xml内容 到 Workbook/Form对象中 - HistoryTemplateListCache.getInstance().reloadAllEditingTemplate(); + HistoryTemplateListCache.getInstance().reloadAllEditingTemplate(mustReload); } }; - private final PluginFilter pluginFilter = pluginContext -> { - for (String xmlTag : context) { - if (pluginContext.contain(xmlTag)) { - return true; + private final PluginEventListener pluginBeforeStopEventListener = new PluginEventListener() { + @Override + public void on(PluginEvent event) { + boolean canCal = true; + for (String tag : context) { + if (event.getContext().contain(tag)) { + canCal = false; + break; + } + } + if (canCal) { + HistoryTemplateListCache.getInstance().calNeedReloadTemplate(event.getContext()); } } - return false; }; @@ -48,13 +62,26 @@ public class PluginRefreshManager { } public void load() { - context.add(IOFileAttrMark.MARK_STRING); context.add(TableDataDefineProvider.XML_TAG); context.add(HyperlinkProvider.XML_TAG); } private PluginRefreshManager() { - PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginAfterRunEventListener, this.pluginFilter); + 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(true); + } + } + }); } public void registerItem(String xmlTag) { @@ -63,11 +90,13 @@ public class PluginRefreshManager { public void removePluginListener() { PluginListenerRegistration.getInstance().stopListen(this.pluginAfterRunEventListener); + PluginListenerRegistration.getInstance().stopListen(this.pluginBeforeStopEventListener); } public void addPluginListener() { - PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginAfterRunEventListener, this.pluginFilter); + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginAfterRunEventListener); + PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeStop, this.pluginBeforeStopEventListener); } } 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 f1a3cf336c..ca587c3dab 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 @@ -94,6 +94,8 @@ public class TableDataTreePane extends BasicTableDataTreePane { addMenuDef.setIconPath(IconPathConstants.ADD_POPMENU_ICON_PATH); createAddMenuDef(); + // 创建插件监听 + createPluginListener(); editAction = new EditAction(); removeAction = new RemoveAction(); diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 05b2a24f67..242d1d5c1f 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -1,5 +1,6 @@ package com.fr.design.file; +import com.fr.base.ClassHelper; import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.base.io.BaseBook; import com.fr.design.DesignerEnvManager; @@ -18,6 +19,8 @@ import com.fr.file.FileNodeFILE; import com.fr.file.StashedFILE; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.manage.PluginManager; import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; import com.fr.third.org.apache.commons.io.FilenameUtils; @@ -29,6 +32,7 @@ import java.util.HashMap; import java.util.List; import java.util.ListIterator; import java.util.Map; +import java.util.Set; /** * 历史模板缓存 @@ -42,6 +46,8 @@ public class HistoryTemplateListCache implements CallbackEvent { private List> historyList; private JTemplate editingTemplate; + private Map templateNeedReloadMap = new HashMap<>(); + public static HistoryTemplateListCache getInstance() { return Holder.INSTANCE; } @@ -72,6 +78,9 @@ public class HistoryTemplateListCache implements CallbackEvent { selected.fireJTemplateClosed(); selected.stopEditing(); try { + if (!templateNeedReloadMap.isEmpty()) { + templateNeedReloadMap.remove(selected.getEditingFILE().getName()); + } historyList.remove(contains(selected)); selected.getEditingFILE().closeTemplate(); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Closed_Warn_Text", selected.getEditingFILE().getName())); @@ -370,7 +379,6 @@ public class HistoryTemplateListCache implements CallbackEvent { */ public void load() { FineLoggerFactory.getLogger().info("Env Change Template Loading..."); - JTemplate currentTemplate = null; if (stashFILEMap != null && stashFILEMap.size() != 0) { int size = historyList.size(); for (int i = 0; i < size; i++) { @@ -381,32 +389,14 @@ public class HistoryTemplateListCache implements CallbackEvent { if (stashedFile == null) { continue; } - JTemplate template = JTemplateFactory.createJTemplate(stashedFile); - if (template != null) { - historyList.set(i, template); - // 替换当前正在编辑的模板,使用添加并激活的方式,以便使用统一的入口来处理监听事件 - if (isCurrentEditingFile(template.getPath())) { - currentTemplate = template; - } - } else { - // 当模板为空时 说明是一个新建的未保存模板 但是内存中保存了该模板 可以从中获取 - JTemplate jt = historyList.get(i); - // 另外如果该模板是正在编辑的模板,需要要激活 - if (jt != null && isCurrentEditingFile(jt.getPath())) { - currentTemplate = jt; - } - } + FineLoggerFactory.getLogger().info("{} is being reloaded", stashedFile.getName()); + JTemplate template = historyList.get(i); + template.refreshResource(stashedFile); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } - // 最后加载当前正在编辑的模板 以保证数据集刷新正常 - if (currentTemplate != null) { - loadCurrentTemplate(currentTemplate); - } stashFILEMap.clear(); - MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList); - MutilTempalteTabPane.getInstance().repaint(); } FineLoggerFactory.getLogger().info("Env Change Template Loaded."); } @@ -422,11 +412,7 @@ public class HistoryTemplateListCache implements CallbackEvent { */ @Deprecated public void reloadCurrentTemplate() { - JTemplate jt = getCurrentEditingTemplate(); - boolean access = jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists(); - if (access) { - jt.refreshResource(); - } + reloadAllEditingTemplate(true); } /** @@ -444,27 +430,56 @@ public class HistoryTemplateListCache implements CallbackEvent { /** * 插件安装后/启用 重新加载模板资源 */ - public void reloadAllEditingTemplate() { - FineLoggerFactory.getLogger().info("Plugin env Change reload all template started"); + public void reloadAllEditingTemplate(boolean mustReload) { + FineLoggerFactory.getLogger().info("Plugin env change reload all template started"); + long start = System.currentTimeMillis(); int size = historyList.size(); for (int i = 0; i < size; i++) { JTemplate template = historyList.get(i); FILE file = template.getEditingFILE(); - try { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - BaseBook target = template.getTarget(); - if (target != null) { - FineLoggerFactory.getLogger().info("{} is being reloaded", template.getName()); - target.export(outputStream); - FILE stashedFile = new StashedFILE(file, outputStream.toByteArray()); - template.refreshResource(stashedFile); + Boolean value = templateNeedReloadMap.get(file.getName()); + boolean needReload = mustReload || (value != null && value); + if (needReload) { + try { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + BaseBook target = template.getTarget(); + if (target != null) { + FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName()); + target.export(outputStream); + FILE stashedFile = new StashedFILE(file, outputStream.toByteArray()); + template.refreshResource(stashedFile); + } + // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } - // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); } } - FineLoggerFactory.getLogger().info("Plugin env Change reload all template ended"); + templateNeedReloadMap.clear(); + FineLoggerFactory.getLogger().info("Plugin env change reload all template ended"); + FineLoggerFactory.getLogger().debug("Reload all template spend: {} ms", (System.currentTimeMillis() - start)); + } + + public void calNeedReloadTemplate(PluginContext context) { + for (JTemplate template : historyList) { + BaseBook baseBook = template.getTarget(); + if (baseBook != null) { + String name = template.getEditingFILE().getName(); + long start = System.currentTimeMillis(); + Set set = ClassHelper.getPluginClassLoaders(baseBook); + FineLoggerFactory.getLogger().info("{} find plugin classloader spend: {} ms", name, (System.currentTimeMillis() - start)); + if (set != null) { + for (ClassLoader classLoader : set) { + PluginContext pluginContext = PluginManager.getContext(classLoader); + if (pluginContext != null && ComparatorUtils.equals(context.getName(), pluginContext.getName())) { + templateNeedReloadMap.put(name, true); + } + } + } else { + templateNeedReloadMap.put(name, true); + } + } + } } } 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 87bcd23f5e..d80d9f07ad 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 @@ -344,12 +344,10 @@ public abstract class JTemplate> this.template = JTemplateFactory.asIOFile(file); setTarget(this.template); - UIUtil.invokeLaterIfNeeded(() -> { // 先移除旧的。 removeCenterPane(); // 加入新的 addCenterPane(); - }); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } diff --git a/designer-base/src/test/java/com/fr/base/ClassHelperTest.java b/designer-base/src/test/java/com/fr/base/ClassHelperTest.java new file mode 100644 index 0000000000..ae0facfcf9 --- /dev/null +++ b/designer-base/src/test/java/com/fr/base/ClassHelperTest.java @@ -0,0 +1,28 @@ +package com.fr.base; + +import com.fr.form.main.Form; +import com.fr.main.impl.WorkBook; +import java.util.Set; +import junit.framework.TestCase; +import org.junit.Assert; + + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/12/28 + */ +public class ClassHelperTest extends TestCase { + + + public void testGetPluginClassLoaders() { + WorkBook workBook = new WorkBook(); + Set set = ClassHelper.getPluginClassLoaders(workBook); + Assert.assertEquals(0, set.size()); + Form form = new Form(); + Set set1 = ClassHelper.getPluginClassLoaders(form); + Assert.assertEquals(0, set1.size()); + + } + +} \ No newline at end of file From 6871224633f0ae45ea61d3878969e08fb38beade Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 29 Dec 2020 09:29:50 +0800 Subject: [PATCH 05/17] =?UTF-8?q?KERNEL-6380=20=E6=A0=BC=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/JTemplate.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 d80d9f07ad..f540cdbc64 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 @@ -344,10 +344,10 @@ public abstract class JTemplate> this.template = JTemplateFactory.asIOFile(file); setTarget(this.template); - // 先移除旧的。 - removeCenterPane(); - // 加入新的 - addCenterPane(); + // 先移除旧的。 + removeCenterPane(); + // 加入新的 + addCenterPane(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } From 9a157b8281b115fffb87cc41a067a8b54382ee8a Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 29 Dec 2020 13:04:45 +0800 Subject: [PATCH 06/17] =?UTF-8?q?KERNEL-6380=20=E5=9C=A8=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=88=87=E6=8D=A2=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=EF=BC=8C=E9=9C=80=E8=A6=81=E6=9C=89=E4=B8=80=E4=B8=AA=E9=9B=86?= =?UTF-8?q?=E4=B8=AD=E5=88=B7=E6=96=B0=E7=BC=93=E5=AD=98=E7=9A=84=E5=9C=B0?= =?UTF-8?q?=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/base/ClassHelper.java | 174 ------------------ .../design/file/HistoryTemplateListCache.java | 6 +- .../java/com/fr/base/ClassHelperTest.java | 11 +- 3 files changed, 9 insertions(+), 182 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/base/ClassHelper.java diff --git a/designer-base/src/main/java/com/fr/base/ClassHelper.java b/designer-base/src/main/java/com/fr/base/ClassHelper.java deleted file mode 100644 index 00ff7f9eb4..0000000000 --- a/designer-base/src/main/java/com/fr/base/ClassHelper.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.fr.base; - -import com.fr.general.ComparatorUtils; -import com.fr.log.FineLoggerFactory; -import java.lang.reflect.Array; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import org.jetbrains.annotations.Nullable; - -/** - * @author hades - * @version 10.0 - * Created by hades on 2020/12/28 - */ -public class ClassHelper { - - private static final Set primClasses = new HashSet<>(); - - private static final Set classLoaders = new HashSet<>(); - - private static final Map map = new HashMap<>(); - - private static final Set data = new HashSet<>(); - - private static final String PLUGIN_CLASS_CLASSLOADER= "com.fr.plugin.engine.core.PluginClassLoader"; - - static { - primClasses.add("boolean"); - primClasses.add("byte"); - primClasses.add("char"); - primClasses.add("short"); - primClasses.add("int"); - primClasses.add("long"); - primClasses.add("float"); - primClasses.add("double"); - primClasses.add("void"); - primClasses.add("java.lang.Boolean"); - primClasses.add("java.lang.Byte"); - primClasses.add("java.lang.Character"); - primClasses.add("java.lang.Short"); - primClasses.add("java.lang.Integer"); - primClasses.add("java.lang.Long"); - primClasses.add("java.lang.FLOAT"); - primClasses.add("java.lang.DOUBLE"); - primClasses.add("java.lang.Void"); - primClasses.add("java.lang.String"); - primClasses.add("java.awt.image.BufferedImage"); - } - - - /** - * 获取当前对象字段中由插件加载出类的classloader - * - * @param o - * @return - */ - @Nullable - public static Set getPluginClassLoaders(Object o) { - try { - collectClassloader(o); - Set result = new HashSet<>(classLoaders); - data.clear(); - classLoaders.clear(); - map.clear(); - return result; - } catch (Throwable e) { - FineLoggerFactory.getLogger().warn(e.getMessage(), e); - data.clear(); - classLoaders.clear(); - map.clear(); - return null; - } - } - - private static void collectClassloader(Object o) { - if (o == null) { - return; - } - Field[] fields; - Class aclass = o.getClass(); - - String className = aclass.getName(); - - if (map.containsKey(className)) { - fields = map.get(className); - } else { - fields = fields(aclass, o); - map.put(className, fields); - } - - if (aclass.isArray()) { - for (int i = 0, len = Array.getLength(o); i < len; i++) { - Object arrayOb = Array.get(o, i); - if (arrayOb != null) { - Class arrayObClass = arrayOb.getClass(); - String name = arrayObClass.getName(); - if (primClasses.contains(name)) { - return; - } - data.add(arrayOb); - ClassLoader loader = arrayObClass.getClassLoader(); - if (loader != null && ComparatorUtils.equals(loader.getClass().getName(), PLUGIN_CLASS_CLASSLOADER)) { - classLoaders.add(loader); - } - } else { - continue; - } - collectClassloader(arrayOb); - } - } - - if (fields.length == 0) { - return; - } - - for (Field field : fields) { - if (!field.isAccessible()) { - field.setAccessible(true); - } - Object ob = null; - try { - ob = field.get(o); - - if (ob == null) { - continue; - } - Class clazz = ob.getClass(); - String name = clazz.getName(); - - if (primClasses.contains(name)) { - continue; - } - - if (!data.contains(ob)) { - data.add(ob); - ClassLoader loader = clazz.getClassLoader(); - if (loader != null && ComparatorUtils.equals(loader.getClass().getName(), PLUGIN_CLASS_CLASSLOADER)) { - classLoaders.add(loader); - } - collectClassloader(ob); - } - - } catch (Throwable e) { - FineLoggerFactory.getLogger().warn(e.getMessage(), e); - } - } - } - - - - private static Field[] fields(Class clazz, Object o) { - - Class t = clazz; - Set result = new HashSet<>(); - - do { - for (Field field : t.getDeclaredFields()) { - if (clazz != o ^ Modifier.isStatic(field.getModifiers())) { - result.add(field); - } - } - - t = t.getSuperclass(); - } - while (t != null); - - return result.toArray(new Field[0]); - } - -} diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 242d1d5c1f..88f64a4d5d 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -1,6 +1,5 @@ package com.fr.design.file; -import com.fr.base.ClassHelper; import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.base.io.BaseBook; import com.fr.design.DesignerEnvManager; @@ -18,6 +17,7 @@ import com.fr.file.FILE; import com.fr.file.FileNodeFILE; import com.fr.file.StashedFILE; import com.fr.general.ComparatorUtils; +import com.fr.invoke.ClassHelper; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.manage.PluginManager; @@ -457,7 +457,7 @@ public class HistoryTemplateListCache implements CallbackEvent { } templateNeedReloadMap.clear(); FineLoggerFactory.getLogger().info("Plugin env change reload all template ended"); - FineLoggerFactory.getLogger().debug("Reload all template spend: {} ms", (System.currentTimeMillis() - start)); + FineLoggerFactory.getLogger().info("Reload all template spend: {} ms", (System.currentTimeMillis() - start)); } public void calNeedReloadTemplate(PluginContext context) { @@ -466,7 +466,7 @@ public class HistoryTemplateListCache implements CallbackEvent { if (baseBook != null) { String name = template.getEditingFILE().getName(); long start = System.currentTimeMillis(); - Set set = ClassHelper.getPluginClassLoaders(baseBook); + Set set = ClassHelper.getClassLoaders(baseBook); FineLoggerFactory.getLogger().info("{} find plugin classloader spend: {} ms", name, (System.currentTimeMillis() - start)); if (set != null) { for (ClassLoader classLoader : set) { diff --git a/designer-base/src/test/java/com/fr/base/ClassHelperTest.java b/designer-base/src/test/java/com/fr/base/ClassHelperTest.java index ae0facfcf9..c77bb7b67c 100644 --- a/designer-base/src/test/java/com/fr/base/ClassHelperTest.java +++ b/designer-base/src/test/java/com/fr/base/ClassHelperTest.java @@ -1,6 +1,7 @@ package com.fr.base; import com.fr.form.main.Form; +import com.fr.invoke.ClassHelper; import com.fr.main.impl.WorkBook; import java.util.Set; import junit.framework.TestCase; @@ -15,13 +16,13 @@ import org.junit.Assert; public class ClassHelperTest extends TestCase { - public void testGetPluginClassLoaders() { + public void testGetClassLoaders() { WorkBook workBook = new WorkBook(); - Set set = ClassHelper.getPluginClassLoaders(workBook); - Assert.assertEquals(0, set.size()); + Set set = ClassHelper.getClassLoaders(workBook); + Assert.assertFalse(set.isEmpty()); Form form = new Form(); - Set set1 = ClassHelper.getPluginClassLoaders(form); - Assert.assertEquals(0, set1.size()); + Set set1 = ClassHelper.getClassLoaders(form); + Assert.assertFalse(set1.isEmpty()); } From 2f68f0db7c323a482b3a79a56dcb4780fa4f5b5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 29 Dec 2020 13:54:48 +0800 Subject: [PATCH 07/17] =?UTF-8?q?CHART-17661=20=E5=A4=9A=E5=B1=82=E9=A5=BC?= =?UTF-8?q?=E5=9B=BE=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/van/chart/designer/PlotFactory.java | 19 +++++++++++++++---- .../label/VanChartGaugePlotLabelPane.java | 4 ++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java b/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java index ab46f55262..0f9db09fab 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java @@ -166,6 +166,12 @@ public class PlotFactory { tooltipContentMap.put(VanChartStructurePlot.class, VanChartStructureTooltipContentPane.class); } + private static Map, Class> labelMap = new HashMap<>(); + + static { + labelMap.put(PiePlot4VanChart.class, VanChartPiePlotLabelPane.class); + labelMap.put(VanChartGaugePlot.class, VanChartGaugePlotLabelPane.class); + } /** * 监控刷新 自动数据点提示Map @@ -208,10 +214,15 @@ public class PlotFactory { } public static VanChartPlotLabelPane createPlotLabelPane(Plot plot, VanChartStylePane stylePane, boolean inCondition) { - if (plot instanceof VanChartGaugePlot) { - return new VanChartGaugePlotLabelPane(plot, stylePane); - } else if (plot instanceof PiePlot4VanChart) { - return new VanChartPiePlotLabelPane(plot, stylePane, inCondition); + Class key = plot.getClass(); + if (labelMap.containsKey(key)) { + try { + Class cl = labelMap.get(key); + Constructor constructor = cl.getConstructor(Plot.class, VanChartStylePane.class, boolean.class); + return constructor.newInstance(plot, stylePane, inCondition); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } } return new VanChartPlotLabelPane(plot, stylePane, inCondition); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java index 9bc21a0446..5861bb0c22 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java @@ -25,8 +25,8 @@ public class VanChartGaugePlotLabelPane extends VanChartPlotLabelPane { private VanChartPlotLabelDetailPane gaugeValueLabelPane; - public VanChartGaugePlotLabelPane(Plot plot, VanChartStylePane parent) { - super(plot, parent); + public VanChartGaugePlotLabelPane(Plot plot, VanChartStylePane parent, boolean inCondition) { + super(plot, parent, inCondition); } protected void createLabelPane() { From 2cc7b374fb39998a9da303f6f87670181fc1fe20 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 29 Dec 2020 16:18:46 +0800 Subject: [PATCH 08/17] =?UTF-8?q?REPORT-42240=20=E3=80=9010.0.13=E3=80=91?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=87=8C=E5=8A=9F=E8=83=BD=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0=EF=BC=88=E8=A1=A8=E5=8D=95=E3=80=81=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=EF=BC=89=E4=BC=98=E5=8C=96=20=20feature->release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 36 +++++++++++-- .../mainframe/widget/BasicPropertyPane.java | 9 +++- .../com/fr/design/preview/FormPreview.java | 3 +- .../fit/menupane/ReportFitAttrAction.java | 5 +- .../widget/WidgetBoundsPaneFactory.java | 54 ++++++++++++++----- .../ui/FormBasicWidgetPropertyPane.java | 11 +++- .../component/WidgetAbsoluteBoundPane.java | 2 +- .../ui/BasicWidgetPropertySettingPane.java | 15 +++--- 8 files changed, 105 insertions(+), 30 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 0703216eba..4c908940a1 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 @@ -18,6 +18,7 @@ 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; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; import com.fr.plugin.injectable.PluginModule; @@ -100,14 +101,29 @@ public class EastRegionContainerPane extends UIEastResizableContainer { REPORT, // 报表 REPORT_PARA, // 报表参数面板 REPORT_FLOAT, // 报表悬浮元素 - FORM, // 表单 + FORM(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 表单 FORM_REPORT, // 表单报表块 POLY, // 聚合报表 POLY_REPORT, // 聚合报表-报表块 - POLY_CHART, // 聚合报表-图表块 + POLY_CHART(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 聚合报表-图表块 AUTHORITY_EDITION, // 权限编辑 - AUTHORITY_EDITION_DISABLED // 权限编辑 + AUTHORITY_EDITION_DISABLED; // 权限编辑 + + private String title; + + PropertyMode() { + this.title = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Settings"); + } + + PropertyMode(String title) { + this.title = title; + } + + public String getTitle() { + return this.title; + } } + private PropertyMode currentMode; // 当前模式(根据不同模式,显示不同的可用面板) @@ -400,6 +416,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private void updatePropertyItemMap() { for (PropertyItem item : propertyItemMap.values()) { item.updateStatus(); + item.updateTitle(); } } @@ -734,6 +751,19 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } } + public void updateTitle() { + try { + if (StringUtils.equals(KEY_WIDGET_SETTINGS, name)) { + title = currentMode.getTitle(); + button.setToolTipText(title); + UILabel uiLabel = (UILabel) ((BorderLayout) popupToolPane.contentPane.getLayout()).getLayoutComponent(BorderLayout.WEST); + uiLabel.setText(title); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + } + } + public void reAddContentArea() { propertyPanel.add(contentArea, BorderLayout.CENTER); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java index 099684a81a..23cc188edb 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java @@ -4,6 +4,7 @@ import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.BasicPane; 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; @@ -56,20 +57,24 @@ public class BasicPropertyPane extends BasicPane { } } }; - widgetName.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic")); + widgetName.setGlobalName(Toolkit.i18nText("Fine-Design_Report_Basic")); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p}; double[] columnSize = {p, f}; int[][] rowCount = {{1, 1}}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Name")), widgetName}, + new Component[]{new UILabel(obtainBasicName()), widgetName}, }; JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); this.add(panel, BorderLayout.NORTH); } + public String obtainBasicName(){ + return Toolkit.i18nText("Fine-Design_Basic_Component_Name"); + } + public UITextField getWidgetNameField() { return widgetName; } diff --git a/designer-base/src/main/java/com/fr/design/preview/FormPreview.java b/designer-base/src/main/java/com/fr/design/preview/FormPreview.java index 8522d67734..178779f518 100644 --- a/designer-base/src/main/java/com/fr/design/preview/FormPreview.java +++ b/designer-base/src/main/java/com/fr/design/preview/FormPreview.java @@ -1,6 +1,7 @@ package com.fr.design.preview; import com.fr.design.fun.impl.AbstractPreviewProvider; +import com.fr.design.i18n.Toolkit; /** @@ -12,7 +13,7 @@ public class FormPreview extends AbstractPreviewProvider { @Override public String nameForPopupItem() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Form_Preview"); + return Toolkit.i18nText("Fine-Design_Form_M_PC_Preview"); } @Override diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java index c24125059c..06770c1b4b 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java @@ -4,6 +4,7 @@ import com.fr.design.actions.JTemplateAction; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.UIDialog; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.MenuKeySet; @@ -26,7 +27,7 @@ public class ReportFitAttrAction extends JTemplateAction { @Override public String getMenuName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Template"); + return Toolkit.i18nText("Fine-Designer_PC_Fit_Attr"); } @Override @@ -42,7 +43,7 @@ public class ReportFitAttrAction extends JTemplateAction { @Override public String getMenuName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Elementcase"); + return Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr"); } @Override diff --git a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java index c4c840227c..9b6e7b5c83 100644 --- a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java @@ -4,6 +4,7 @@ import com.fr.design.designer.IntervalConstants; import com.fr.design.foldablepane.UIExpandablePane; 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.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -18,6 +19,30 @@ import java.awt.Component; * Created by plough on 2017/8/7. */ public class WidgetBoundsPaneFactory { + + public enum NameAttribute { + //默认的名称 + DEFAULT(Toolkit.i18nText("Fine-Design_Basic_Component_Position"), Toolkit.i18nText("Fine-Design_Basic_Component_Size")), + //控件对应的名称 + WIDGET(Toolkit.i18nText("Fine-Design_Basic_Widget_Position"), Toolkit.i18nText("Fine-Design_Basic_Widget_Size")); + + private String positionName; + private String sizeName; + + NameAttribute(String positionName, String sizeName) { + this.positionName = positionName; + this.sizeName = sizeName; + } + + public String getPositionName() { + return positionName; + } + + public String getSizeName() { + return sizeName; + } + } + private static final int RIGHT_PANE_WIDTH = 145; public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) { @@ -25,8 +50,8 @@ public class WidgetBoundsPaneFactory { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Size")), createRightPane(width, height)}, - new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, + new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Component_Size")), createRightPane(width, height)}, + new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, }; double[] rowSize = {p, p}; double[] columnSize = {f, RIGHT_PANE_WIDTH}; @@ -34,9 +59,10 @@ public class WidgetBoundsPaneFactory { final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); boundsPane.add(panel); - return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); + return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); } - public static JPanel createRightPane(Component com1, Component com2){ + + public static JPanel createRightPane(Component com1, Component com2) { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p}; @@ -48,17 +74,17 @@ public class WidgetBoundsPaneFactory { return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L1); } - public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height) { + public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height, NameAttribute nameAttribute) { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] northComponents = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Position")), createRightPane(x, y)}, - new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_X_Coordinate"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Y_Coordinate"), SwingConstants.CENTER))}, + new Component[]{FRWidgetFactory.createLineWrapLabel(nameAttribute.getPositionName()), createRightPane(x, y)}, + new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_X_Coordinate"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Y_Coordinate"), SwingConstants.CENTER))}, }; Component[][] centerComponents = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Size")), createRightPane(width, height)}, - new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, + new Component[]{FRWidgetFactory.createLineWrapLabel(nameAttribute.getSizeName()), createRightPane(width, height)}, + new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, }; double[] rowSize = {p, p}; double[] columnSize = {f, RIGHT_PANE_WIDTH}; @@ -70,7 +96,11 @@ public class WidgetBoundsPaneFactory { centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); boundsPane.add(northPanel, BorderLayout.NORTH); boundsPane.add(centerPanel, BorderLayout.CENTER); - return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 230, 24, boundsPane); + return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 230, 24, boundsPane); + } + + public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height) { + return createAbsoluteBoundsPane(x, y, width, height, NameAttribute.DEFAULT); } @@ -79,7 +109,7 @@ public class WidgetBoundsPaneFactory { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Size")), width}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Component_Size")), width}, }; double[] rowSize = {p}; double[] columnSize = {p, f}; @@ -87,6 +117,6 @@ public class WidgetBoundsPaneFactory { final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L6); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); boundsPane.add(panel); - return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); + return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java index 138434d306..27d55ac28c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java @@ -1,9 +1,12 @@ package com.fr.design.mainframe.widget.ui; import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.form.ui.Widget; import javax.swing.BorderFactory; +import java.awt.Component; /** * Created by ibm on 2017/7/26. @@ -16,13 +19,17 @@ public class FormBasicWidgetPropertyPane extends BasicSetVisiblePropertyPane { } public UICheckBox createOtherConfig() { - enableCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Enabled"), true); - enableCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic")); + enableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Enabled"), true); + enableCheckBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_Basic")); enableCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); return enableCheckBox; } + public String obtainBasicName(){ + return Toolkit.i18nText("Fine-Design_Basic_Widget_Name"); + } + @Override public String title4PopupWindow() { return "basicProperty"; 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 7ddff022f9..5604ef4be7 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 @@ -34,7 +34,7 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane { 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")); height.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); - this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height)); + this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height, WidgetBoundsPaneFactory.NameAttribute.WIDGET)); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java index 8b520f3183..5bd91d038d 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java @@ -4,6 +4,7 @@ import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.dialog.BasicPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.NoneWidget; @@ -22,19 +23,19 @@ public class BasicWidgetPropertySettingPane extends BasicPane { private UICheckBox enableCheckBox; private UICheckBox visibleCheckBox; private Widget widget; - + public BasicWidgetPropertySettingPane() { this.setLayout(new BorderLayout()); - enableCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Enabled"), true); + enableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Enabled"), true); enableCheckBox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); - visibleCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Visible"), true); + visibleCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Form_Widget_Visible"), true); visibleCheckBox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); widgetNameComboBox = new ParameterTreeComboBox(); widgetNameComboBox.refreshTree(); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form-Widget_Name")), widgetNameComboBox}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Widget_Name")), widgetNameComboBox}, new Component[]{enableCheckBox, null}, new Component[]{visibleCheckBox, null}, }; @@ -47,12 +48,12 @@ public class BasicWidgetPropertySettingPane extends BasicPane { this.add(pane, BorderLayout.CENTER); } - + @Override protected String title4PopupWindow() { return "property"; } - + public void populate(Widget widget){ //:jackie if(widget instanceof NoneWidget){ @@ -67,7 +68,7 @@ public class BasicWidgetPropertySettingPane extends BasicPane { visibleCheckBox.setSelected(this.widget.isVisible()); } } - + public void update(Widget widget){ if(this.widget == null) return ; From 4c3e72d82d32bbd68b3aeb129776040cab3ac683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 29 Dec 2020 17:06:51 +0800 Subject: [PATCH 09/17] =?UTF-8?q?CHART-17357=20=E7=BB=84=E5=90=88=E5=9B=BE?= =?UTF-8?q?=E5=8F=AA=E6=9C=89=E4=B8=80=E4=B8=AA=E5=9B=BE=E5=BD=A2=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E7=95=99=E7=99=BD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../van/chart/custom/VanChartCustomDataPane.java | 7 +++++++ .../VanChartCustomPlotDataContentsTabPane.java | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java index ec15e4cf98..47e6488fd6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java @@ -6,6 +6,7 @@ import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.plugin.chart.custom.VanChartCustomPlot; +import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -19,6 +20,12 @@ public class VanChartCustomDataPane extends ChartDataPane { super(listener); } + protected void initContentPane() { + leftContentPane = createContentPane(); + leftContentPane.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, original)); + this.add(leftContentPane, BorderLayout.CENTER); + } + @Override protected JPanel createContentPane() { JPanel content = new JPanel(new BorderLayout()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java index 6d7d24bf96..30d23c1873 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java @@ -12,11 +12,13 @@ import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.van.chart.custom.component.VanChartCustomPlotTabPane; import com.fr.van.chart.custom.component.VanChartDataPane; +import javax.swing.BorderFactory; import javax.swing.JPanel; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.awt.BorderLayout; /** * Created by Fangjie on 2016/4/29. @@ -37,6 +39,20 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab this.supportCellData = supportCellData; } + @Override + protected void initLayout() { + JPanel tabPanel = new JPanel(new BorderLayout()); + if (NameArray.length > 1) { + tabPanel.setBorder(BorderFactory.createMatteBorder(10, 0, 0, 0, getBackground())); + } else { + tabPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, getBackground())); + } + tabPanel.add(tabPane, BorderLayout.CENTER); + this.setLayout(new BorderLayout(0, 0)); + this.add(tabPanel, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.CENTER); + } + @Override protected void initTabTitle() { From 7d64006f2db9e1416848f524b7d5233e0ca947e5 Mon Sep 17 00:00:00 2001 From: Lanlan Date: Fri, 4 Dec 2020 12:11:46 +0800 Subject: [PATCH 10/17] =?UTF-8?q?KERNEL-6154=20GeneralXMLTools=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/start/module/DesignerActivator.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 3f1aa26636..495252e38f 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -99,6 +99,7 @@ import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.painter.BiasTextPainter; import com.fr.report.cell.painter.CellImagePainter; import com.fr.stable.ArrayUtils; +import com.fr.stable.EssentialUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.bridge.StableFactory; import com.fr.stable.os.support.OSBasedAction; @@ -191,8 +192,8 @@ public class DesignerActivator extends Activator { justStartModules4Designer(); CalculatorProviderContext.setValueConverter(valueConverter()); - GeneralXMLTools.Object_Tokenizer = startXMLReadObjectTokenizer(); - GeneralXMLTools.Object_XML_Writer_Finder = startObjectXMLWriterFinder(); + EssentialUtils.Object_Tokenizer = startXMLReadObjectTokenizer(); + EssentialUtils.Object_XML_Writer_Finder = startObjectXMLWriterFinder(); addAdapterForPlate(); designerRegister(); From 6442a43639cadc24dde7d7d1828fdf8472dae83e Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 30 Dec 2020 15:44:29 +0800 Subject: [PATCH 11/17] =?UTF-8?q?KERNEL-6380=20=E8=A7=A3=E8=80=A6=20?= =?UTF-8?q?=E4=BB=85=E5=A4=84=E7=90=86=E6=8F=92=E4=BB=B6afterRun=E7=94=9F?= =?UTF-8?q?=E5=91=BD=E5=91=A8=E6=9C=9F=20+=20=E9=87=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...er.java => PluginClassRefreshManager.java} | 38 +++---------- .../design/file/HistoryTemplateListCache.java | 57 ++++++++++--------- .../start/module/DesignerInitActivator.java | 4 +- 3 files changed, 38 insertions(+), 61 deletions(-) rename designer-base/src/main/java/com/fr/design/{PluginRefreshManager.java => PluginClassRefreshManager.java} (65%) diff --git a/designer-base/src/main/java/com/fr/design/PluginRefreshManager.java b/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java similarity index 65% rename from designer-base/src/main/java/com/fr/design/PluginRefreshManager.java rename to designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java index 6ccf1f1906..22f791f4fd 100644 --- a/designer-base/src/main/java/com/fr/design/PluginRefreshManager.java +++ b/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java @@ -17,47 +17,30 @@ import java.util.Set; * @version 10.0 * Created by hades on 2020/12/17 */ -public class PluginRefreshManager { +public class PluginClassRefreshManager { - private static final PluginRefreshManager INSTANCE = new PluginRefreshManager(); + private static final PluginClassRefreshManager INSTANCE = new PluginClassRefreshManager(); private final Set context = new HashSet<>(); private final PluginEventListener pluginAfterRunEventListener = new PluginEventListener() { @Override public void on(PluginEvent event) { - boolean mustReload = false; // 兼容之前版本特性 for (String tag : context) { if (event.getContext().contain(tag)) { - mustReload = true; + HistoryTemplateListCache.getInstance().reloadAllEditingTemplate(); break; } } // 重新载入模板xml内容 到 Workbook/Form对象中 - HistoryTemplateListCache.getInstance().reloadAllEditingTemplate(mustReload); - } - }; - - private final PluginEventListener pluginBeforeStopEventListener = new PluginEventListener() { - @Override - public void on(PluginEvent event) { - boolean canCal = true; - for (String tag : context) { - if (event.getContext().contain(tag)) { - canCal = false; - break; - } - } - if (canCal) { - HistoryTemplateListCache.getInstance().calNeedReloadTemplate(event.getContext()); - } + HistoryTemplateListCache.getInstance().reloadAllEditingTemplateByPlugin(event.getContext()); } }; - public static PluginRefreshManager getInstance() { + public static PluginClassRefreshManager getInstance() { return INSTANCE; } @@ -66,7 +49,7 @@ public class PluginRefreshManager { context.add(HyperlinkProvider.XML_TAG); } - private PluginRefreshManager() { + private PluginClassRefreshManager() { PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, new PluginEventListener() { @Override public void on(PluginEvent event) { @@ -78,25 +61,18 @@ public class PluginRefreshManager { public void on(PluginEvent event) { addPluginListener(); if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) { - HistoryTemplateListCache.getInstance().reloadAllEditingTemplate(true); + HistoryTemplateListCache.getInstance().reloadAllEditingTemplate(); } } }); } - public void registerItem(String xmlTag) { - context.add(xmlTag); - } - public void removePluginListener() { PluginListenerRegistration.getInstance().stopListen(this.pluginAfterRunEventListener); - PluginListenerRegistration.getInstance().stopListen(this.pluginBeforeStopEventListener); - } public void addPluginListener() { PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginAfterRunEventListener); - PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeStop, this.pluginBeforeStopEventListener); } } diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 88f64a4d5d..5184c7d0d5 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -46,8 +46,6 @@ public class HistoryTemplateListCache implements CallbackEvent { private List> historyList; private JTemplate editingTemplate; - private Map templateNeedReloadMap = new HashMap<>(); - public static HistoryTemplateListCache getInstance() { return Holder.INSTANCE; } @@ -78,9 +76,6 @@ public class HistoryTemplateListCache implements CallbackEvent { selected.fireJTemplateClosed(); selected.stopEditing(); try { - if (!templateNeedReloadMap.isEmpty()) { - templateNeedReloadMap.remove(selected.getEditingFILE().getName()); - } historyList.remove(contains(selected)); selected.getEditingFILE().closeTemplate(); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Closed_Warn_Text", selected.getEditingFILE().getName())); @@ -412,7 +407,7 @@ public class HistoryTemplateListCache implements CallbackEvent { */ @Deprecated public void reloadCurrentTemplate() { - reloadAllEditingTemplate(true); + reloadAllEditingTemplate(); } /** @@ -430,15 +425,14 @@ public class HistoryTemplateListCache implements CallbackEvent { /** * 插件安装后/启用 重新加载模板资源 */ - public void reloadAllEditingTemplate(boolean mustReload) { + private void _reloadAllEditingTemplate(PluginContext context) { FineLoggerFactory.getLogger().info("Plugin env change reload all template started"); long start = System.currentTimeMillis(); int size = historyList.size(); for (int i = 0; i < size; i++) { JTemplate template = historyList.get(i); FILE file = template.getEditingFILE(); - Boolean value = templateNeedReloadMap.get(file.getName()); - boolean needReload = mustReload || (value != null && value); + boolean needReload = context == null || needReloadTemplate(context, template); if (needReload) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); @@ -455,31 +449,38 @@ public class HistoryTemplateListCache implements CallbackEvent { } } } - templateNeedReloadMap.clear(); FineLoggerFactory.getLogger().info("Plugin env change reload all template ended"); FineLoggerFactory.getLogger().info("Reload all template spend: {} ms", (System.currentTimeMillis() - start)); } - public void calNeedReloadTemplate(PluginContext context) { - for (JTemplate template : historyList) { - BaseBook baseBook = template.getTarget(); - if (baseBook != null) { - String name = template.getEditingFILE().getName(); - long start = System.currentTimeMillis(); - Set set = ClassHelper.getClassLoaders(baseBook); - FineLoggerFactory.getLogger().info("{} find plugin classloader spend: {} ms", name, (System.currentTimeMillis() - start)); - if (set != null) { - for (ClassLoader classLoader : set) { - PluginContext pluginContext = PluginManager.getContext(classLoader); - if (pluginContext != null && ComparatorUtils.equals(context.getName(), pluginContext.getName())) { - templateNeedReloadMap.put(name, true); - } - } - } else { - templateNeedReloadMap.put(name, true); - } + + public void reloadAllEditingTemplateByPlugin(PluginContext context) { + _reloadAllEditingTemplate(context); + } + + public void reloadAllEditingTemplate() { + _reloadAllEditingTemplate(null); + } + + private boolean needReloadTemplate(PluginContext context, JTemplate template) { + BaseBook baseBook = template.getTarget(); + if (baseBook != null) { + String name = template.getEditingFILE().getName(); + String pluginId = context.getID(); + long start = System.currentTimeMillis(); + Set set = ClassHelper.getClassLoaders(baseBook); + FineLoggerFactory.getLogger().info("{} find plugin classloader spend: {} ms", name, (System.currentTimeMillis() - start)); + if (set != null) { + for (ClassLoader classLoader : set) { + if (PluginManager.isBeforeLoadBy(classLoader, pluginId)) { + return true; + } + } + } else { + return true; } } + return false; } } diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java index 5ca7efdd6b..ebea410bba 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java @@ -1,6 +1,6 @@ package com.fr.start.module; -import com.fr.design.PluginRefreshManager; +import com.fr.design.PluginClassRefreshManager; import com.fr.module.Activator; import com.fr.start.DesignerInitial; @@ -16,7 +16,7 @@ public class DesignerInitActivator extends Activator { @Override public void start() { - PluginRefreshManager.getInstance().load(); + PluginClassRefreshManager.getInstance().load(); DesignerInitial.init(findSingleton(StartupArgs.class).get()); } From 11046865fc26ec0b7c0ed3b490dc3965e997fb88 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 30 Dec 2020 16:15:03 +0800 Subject: [PATCH 12/17] =?UTF-8?q?KERNEL-6380=20=E8=B0=83=E6=95=B4=E4=B8=8B?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/file/HistoryTemplateListCache.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 5184c7d0d5..afb056ba1c 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -472,7 +472,7 @@ public class HistoryTemplateListCache implements CallbackEvent { FineLoggerFactory.getLogger().info("{} find plugin classloader spend: {} ms", name, (System.currentTimeMillis() - start)); if (set != null) { for (ClassLoader classLoader : set) { - if (PluginManager.isBeforeLoadBy(classLoader, pluginId)) { + if (ComparatorUtils.equals(pluginId, PluginManager.findPluginId(classLoader))) { return true; } } From 26e54fb4bf79070c457c28c81ba072bfa785e548 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 30 Dec 2020 16:42:15 +0800 Subject: [PATCH 13/17] =?UTF-8?q?KERNEL-6380=20=E4=BF=AE=E6=94=B9=E5=90=8D?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/file/HistoryTemplateListCache.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index afb056ba1c..1a14144175 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -472,7 +472,7 @@ public class HistoryTemplateListCache implements CallbackEvent { FineLoggerFactory.getLogger().info("{} find plugin classloader spend: {} ms", name, (System.currentTimeMillis() - start)); if (set != null) { for (ClassLoader classLoader : set) { - if (ComparatorUtils.equals(pluginId, PluginManager.findPluginId(classLoader))) { + if (ComparatorUtils.equals(pluginId, PluginManager.detectLeakingPlugin(classLoader))) { return true; } } From c634b2fe1d1234ed3f778127f8571994e6c0c2ff Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 30 Dec 2020 17:00:16 +0800 Subject: [PATCH 14/17] =?UTF-8?q?KERNEL-6380=20=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/file/HistoryTemplateListCache.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 1a14144175..06bfd3cf74 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -453,11 +453,17 @@ public class HistoryTemplateListCache implements CallbackEvent { FineLoggerFactory.getLogger().info("Reload all template spend: {} ms", (System.currentTimeMillis() - start)); } - + /** + * 根据具体插件来刷新模板 + * @param context + */ public void reloadAllEditingTemplateByPlugin(PluginContext context) { _reloadAllEditingTemplate(context); } + /** + * 直接刷新所以模板 + */ public void reloadAllEditingTemplate() { _reloadAllEditingTemplate(null); } @@ -477,6 +483,7 @@ public class HistoryTemplateListCache implements CallbackEvent { } } } else { + // set为null说明 检测classloader 这里返回true直接刷新 兜底行为 return true; } } From ea708f0f74e6d127379b405ebc4abaa3ce8057a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 30 Dec 2020 18:00:54 +0800 Subject: [PATCH 15/17] =?UTF-8?q?CHART-17633=20=E5=9C=B0=E5=9B=BEgis?= =?UTF-8?q?=E5=9F=8B=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/van/chart/map/designer/type/VanChartMapPlotPane.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java index a5e26427b3..9b5636e402 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java @@ -2,9 +2,11 @@ package com.fr.van.chart.map.designer.type; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.config.info.constant.ConfigType; import com.fr.chartx.data.ChartDataDefinitionProvider; import com.fr.chartx.data.MapChartDataDefinition; import com.fr.design.mainframe.chart.gui.type.ChartImagePane; +import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.plot.VanChartPlot; @@ -100,6 +102,7 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane { if (!isSamePlot() || (typeChanged && isSamePlot())) { resetAttr(plot); } + ChartInfoCollector.getInstance().updateChartConfig(chart, ConfigType.MAP, chart.getBuryingPointMapConfig()); } } /** From 8e34fc7c12c1d4220e89794d62d6047913339281 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 31 Dec 2020 09:34:10 +0800 Subject: [PATCH 16/17] =?UTF-8?q?KERNEL-6380=20=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=B8=8B=E8=BF=94=E5=9B=9E=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/PluginClassRefreshManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 22f791f4fd..711dd29759 100644 --- a/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java +++ b/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java @@ -31,7 +31,7 @@ public class PluginClassRefreshManager { for (String tag : context) { if (event.getContext().contain(tag)) { HistoryTemplateListCache.getInstance().reloadAllEditingTemplate(); - break; + return; } } // 重新载入模板xml内容 到 Workbook/Form对象中 From 01f5e64443a53f50465830abda0233b1438ef341 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 4 Jan 2021 10:36:30 +0800 Subject: [PATCH 17/17] =?UTF-8?q?KERNEL-6380=20=E6=BC=8F=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/start/module/DesignerWorkspaceActivator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java index 1842ea7622..7154de982f 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java @@ -1,7 +1,7 @@ package com.fr.start.module; import com.fr.concurrent.NamedThreadFactory; -import com.fr.design.PluginRefreshManager; +import com.fr.design.PluginClassRefreshManager; import com.fr.design.file.HistoryTemplateListCache; import com.fr.event.Event; import com.fr.event.Listener; @@ -51,7 +51,7 @@ public class DesignerWorkspaceActivator extends Activator { @Override public void on(Event event, Workspace workspace) { - PluginRefreshManager.getInstance().removePluginListener(); + PluginClassRefreshManager.getInstance().removePluginListener(); HistoryTemplateListCache.getInstance().stash(); } }); @@ -63,7 +63,7 @@ public class DesignerWorkspaceActivator extends Activator { public void on(Event event, Workspace workspace) { HistoryTemplateListCache.getInstance().load(); - PluginRefreshManager.getInstance().addPluginListener(); + PluginClassRefreshManager.getInstance().addPluginListener(); } }); }