From e88de2094c5be0ce672e9b70ba23121fcd2d17ba Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Sat, 14 Aug 2021 12:33:46 +0800 Subject: [PATCH 1/8] =?UTF-8?q?REPORT-55481=20=E6=A8=A1=E6=9D=BFWeb?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E7=9A=84=E9=A1=B6=E9=83=A8=E5=92=8C=E5=BA=95?= =?UTF-8?q?=E9=83=A8=E5=B7=A5=E5=85=B7=E6=A0=8F=E5=9C=A8=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=97=B6=EF=BC=8C=E9=A1=B6=E9=83=A8=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=A0=8F=E8=A2=AB=E5=BA=95=E9=83=A8=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=A0=8F=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/AuthorityToolBarPane.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java index 1fc891c8b3..428a18a1ac 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java @@ -185,7 +185,7 @@ public class AuthorityToolBarPane extends BasicBeanPane toolBarButtons = toolBarPane.getToolBarButtons(); - boolean isnotEnable = ComparatorUtils.equals(title.getText(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Server_Toolbar_Choose_Role"))&& !WorkContext.getCurrent().isRoot(); + boolean isnotEnable = ComparatorUtils.equals(title.getText(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Server_Toolbar_Choose_Role")) && !WorkContext.getCurrent().isRoot(); for (ToolBarButton button : toolBarButtons) { button.setEnabled(!isnotEnable); } @@ -296,9 +296,15 @@ public class AuthorityToolBarPane extends BasicBeanPane Date: Mon, 16 Aug 2021 10:26:38 +0800 Subject: [PATCH 2/8] =?UTF-8?q?REPORT-56128=E3=80=90=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E8=80=85=E9=A2=84=E8=A7=88=E6=94=AF=E6=8C=81=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=B8=83=E5=B1=80=E3=80=91=E6=96=B0=E8=87=AA?= =?UTF-8?q?=E9=80=82=E5=BA=94-=E8=AE=BE=E8=AE=A1=E7=94=BB=E5=B8=83?= =?UTF-8?q?=E9=87=8C=E6=8B=96=E6=8B=BD=E8=B0=83=E6=95=B4=E7=BB=84=E4=BB=B6?= =?UTF-8?q?A=E5=A4=A7=E5=B0=8F=EF=BC=8C=E6=8C=A4=E5=8E=8B=E7=BB=9D?= =?UTF-8?q?=E5=AF=B9=E7=94=BB=E5=B8=83=E5=9D=97=EF=BC=8C=E7=BB=9D=E5=AF=B9?= =?UTF-8?q?=E7=94=BB=E5=B8=83=E5=9D=97=E5=86=85=E7=BB=84=E4=BB=B6=E4=BC=9A?= =?UTF-8?q?=E4=BF=9D=E6=8C=81=E5=B0=BA=E5=AF=B8=E4=B8=8D=E5=8F=98=E4=B8=94?= =?UTF-8?q?=E8=B6=85=E5=87=BA=E7=BB=9D=E5=AF=B9=E7=94=BB=E5=B8=83=E5=9D=97?= =?UTF-8?q?=EF=BC=9B=E4=BD=86=E5=BC=80=E5=8F=91=E8=80=85=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E4=B8=8B=EF=BC=8C=E6=AD=A4=E5=9C=BA=E6=99=AF=EF=BC=8C=E7=BB=9D?= =?UTF-8?q?=E5=AF=B9=E7=94=BB=E5=B8=83=E5=9D=97=E5=86=85=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=B0=BA=E5=AF=B8=E9=80=82=E5=BA=94=E5=8C=BA=E5=9F=9F=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E3=80=82=E8=BF=99=E9=87=8C=E8=A6=81=E4=B8=8D=E8=A6=81?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E4=B8=80=E4=B8=8B=E6=95=88=E6=9E=9C=E5=95=8A?= =?UTF-8?q?@kerry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/fit/common/AdaptiveSwitchUtil.java | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/fit/common/AdaptiveSwitchUtil.java b/designer-form/src/main/java/com/fr/design/fit/common/AdaptiveSwitchUtil.java index 7b6984dadf..8c55e8ab0a 100644 --- a/designer-form/src/main/java/com/fr/design/fit/common/AdaptiveSwitchUtil.java +++ b/designer-form/src/main/java/com/fr/design/fit/common/AdaptiveSwitchUtil.java @@ -1,7 +1,5 @@ package com.fr.design.fit.common; -import com.fr.decision.ExtraDecisionClassManager; -import com.fr.decision.fun.EmailSendProvider; import com.fr.design.data.DesignTableDataManager; import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.fit.NewJForm; @@ -13,7 +11,6 @@ import com.fr.design.fit.attrpane.RootDesignExtendDefinePane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JTemplate; -import com.fr.design.mainframe.JTemplateFactory; import com.fr.design.parameter.RootDesignDefinePane; import com.fr.design.preview.FormAdaptivePreview; import com.fr.design.preview.FormPreview; @@ -25,8 +22,8 @@ import com.fr.design.widget.ui.designer.layout.FRAbsoluteLayoutDefinePane; import com.fr.design.widget.ui.designer.layout.FRFitLayoutDefinePane; import com.fr.file.FILE; import com.fr.file.MemFILE; -import com.fr.form.fit.NewFormMarkAttr; import com.fr.form.main.Form; +import com.fr.form.main.WidgetGather; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteBodyLayout; @@ -152,11 +149,34 @@ public class AdaptiveSwitchUtil { if (DesignerUIModeConfig.getInstance().newUIMode() && jForm.getTarget().getReportFitAttr() != null && isSwitchJFromIng()) { jForm.getTarget().setReportFitAttr(shiftReportFitAttr(old, jForm.getTarget().getReportFitAttr().isFitFont())); } + processAbsoluteLayoutCompatible(jForm.getTarget()); TemplateTool.saveForm(jForm); } return template; } + + private static void processAbsoluteLayoutCompatible(Form form){ + Form.traversalWidget(form.getContainer(), new WidgetGather() { + @Override + public void dealWith(Widget widget) { + if (widget.acceptType(WAbsoluteBodyLayout.class)) { + return; + } + WAbsoluteLayout absoluteLayout = (WAbsoluteLayout) widget; + //切换到新模板后,内部的绝对画布块都要设置成适应缩放的逻辑 + absoluteLayout.setCompState(0); + } + + @Override + public boolean dealWithAllCards() { + return true; + } + }, WAbsoluteLayout.class); + } + + + /** * @Description: 创建模板核心方法 * @param old 以前的方法 From 6fa53eda15eb07c0f150f60c6f2bd6428c24defb Mon Sep 17 00:00:00 2001 From: rinoux Date: Mon, 16 Aug 2021 11:05:29 +0800 Subject: [PATCH 3/8] =?UTF-8?q?REPORT-51472=20=E5=B9=B3=E5=8F=B0=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E7=9A=84=E6=A8=A1=E7=89=88=E8=AF=BB=E4=B8=8D=E5=88=B0?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/DesignerStrategyConfigUtils.java | 3 +- .../strategy/StrategyConfigHandler.java | 37 ++++++ .../tabledatapane/DBTableDataPane.java | 114 +++++++++++++++++- .../db/ServerStrategyConfigHandler.java | 70 ----------- .../db/StrategyConfigHandler.java | 16 --- .../db/TemplateStrategyConfigHandler.java | 50 -------- .../fr/start/module/DesignerESDActivator.java | 4 + 7 files changed, 154 insertions(+), 140 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/data/tabledata/strategy/StrategyConfigHandler.java delete mode 100644 designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/db/ServerStrategyConfigHandler.java delete mode 100644 designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/db/StrategyConfigHandler.java delete mode 100644 designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/db/TemplateStrategyConfigHandler.java diff --git a/designer-base/src/main/java/com/fr/design/data/DesignerStrategyConfigUtils.java b/designer-base/src/main/java/com/fr/design/data/DesignerStrategyConfigUtils.java index 8bc5f36444..c15b3f3cee 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignerStrategyConfigUtils.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignerStrategyConfigUtils.java @@ -5,6 +5,7 @@ import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.mainframe.JTemplate; import com.fr.esd.core.strategy.config.StrategyConfig; import com.fr.esd.core.strategy.config.StrategyConfigHelper; +import com.fr.esd.core.strategy.config.service.StrategyConfigService; import com.fr.esd.core.strategy.persistence.StrategyConfigsAttr; import com.fr.esd.event.DSMapping; import com.fr.esd.event.DsNameTarget; @@ -67,7 +68,7 @@ public class DesignerStrategyConfigUtils { FILE file = jTemplate.getEditingFILE(); if (file != null) { String path = file.getPath(); - return StrategyConfigHelper.recommended(path); + return StrategyConfigService.isTemplateEnabled(path); } } return false; diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/strategy/StrategyConfigHandler.java b/designer-base/src/main/java/com/fr/design/data/tabledata/strategy/StrategyConfigHandler.java new file mode 100644 index 0000000000..5b6a744d0d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/strategy/StrategyConfigHandler.java @@ -0,0 +1,37 @@ +package com.fr.design.data.tabledata.strategy; + +import com.fr.esd.core.strategy.config.StrategyConfig; +import com.fr.esd.query.StrategicTableData; + +/** + * @author rinoux + * @version 10.0 + * Created by rinoux on 2021/3/19 + */ +public abstract class StrategyConfigHandler { + + private final T tableData; + + public StrategyConfigHandler(T tableData) { + this.tableData = tableData; + } + + protected T getTableData() { + return tableData; + } + + /** + * 查找配置 + * + * @return 缓存配置 + */ + public abstract StrategyConfig find(); + + + /** + * 保存配置 + * + * @param config 缓存配置 + */ + public abstract void save(T saved, StrategyConfig config); +} diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index ec3276b92b..8f17a2a10f 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -18,13 +18,13 @@ import com.fr.design.data.datapane.connect.ConnectionTableProcedurePane; import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.data.datapane.preview.sql.PreviewPerformedSqlPane; import com.fr.design.data.datapane.sqlpane.SQLEditPane; -import com.fr.design.data.tabledata.tabledatapane.db.ServerStrategyConfigHandler; +import com.fr.design.data.tabledata.strategy.StrategyConfigHandler; +import com.fr.design.data.tabledata.tabledatapane.db.DBTableDataSavedHook; import com.fr.design.data.tabledata.tabledatapane.db.StrategyConfigFrom; -import com.fr.design.data.tabledata.tabledatapane.db.StrategyConfigHandler; -import com.fr.design.data.tabledata.tabledatapane.db.TemplateStrategyConfigHandler; 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.DBTableDataMenuHandler; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; @@ -43,7 +43,11 @@ import com.fr.design.menu.ToolBarDef; import com.fr.design.utils.ParameterUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.esd.core.strategy.config.StrategyConfig; +import com.fr.esd.core.strategy.config.StrategyConfigHelper; import com.fr.esd.core.strategy.config.service.StrategyConfigService; +import com.fr.esd.event.DSMapping; +import com.fr.esd.event.DsNameTarget; +import com.fr.esd.event.StrategyEventsNotifier; import com.fr.esd.query.StrategicTableData; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; @@ -53,6 +57,7 @@ import com.fr.script.Calculator; import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; +import com.fr.workspace.WorkContext; import javax.swing.BorderFactory; import javax.swing.Box; @@ -619,4 +624,107 @@ public class DBTableDataPane extends AbstractTableDataPane { return this.title; } } + + /** + * 服务器数据集配置处理器 + */ + private static class ServerStrategyConfigHandler extends StrategyConfigHandler { + private final String origName; + + private final String origConnection; + + private final String origQuery; + + public ServerStrategyConfigHandler(DBTableData tableData) { + super(tableData); + this.origName = tableData.getDsName(); + this.origConnection = tableData.getDatabase().toString(); + this.origQuery = tableData.getQuery(); + } + + @Override + public StrategyConfig find() { + StrategyConfig strategyConfig = null; + if (getTableData() != null) { + try { + strategyConfig = getTableData().getStrategyConfig() == null ? null : getTableData().getStrategyConfig().clone(); + } catch (CloneNotSupportedException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + + return strategyConfig; + } + + @Override + public void save(DBTableData saved, StrategyConfig strategyConfig) { + String conn = saved.getDatabase().toString(); + String query = saved.getQuery(); + + + //检查数据链接和sql是否修改,如果修改需要触发缓存监听事件 + if (!conn.equals(origConnection) || !query.equals(origQuery)) { + if (StringUtils.isNotEmpty(origName)) { + //新建数据集的origName为null,不用触发 + StrategyEventsNotifier.modifyDataSet(DSMapping.ofServerDS(new DsNameTarget(origName))); + } + } + + + //配置变动事件 + try { + final StrategyConfig orig = getTableData().getStrategyConfig(); + saved.setStrategyConfig(strategyConfig.clone()); + StrategyEventsNotifier.compareAndFireConfigEvents(orig, strategyConfig, DSMapping.ofServerDS(new DsNameTarget(saved.getDsName()))); + } catch (CloneNotSupportedException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } + + + /** + * 模版数据集配置处理器 + */ + private static class TemplateStrategyConfigHandler extends StrategyConfigHandler { + public TemplateStrategyConfigHandler(DBTableData tableData) { + super(tableData); + } + + @Override + public StrategyConfig find() { + StrategyConfig strategyConfig = null; + String tplPath = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath(); + if (getTableData() != null && StringUtils.isNotEmpty(tplPath)) { + //设置保存数据集的事件检查钩子 + //新建模版此时不存在,不需要注册钩子 + if (getTableData().getXmlSavedHook() == null && WorkContext.getWorkResource().exist(tplPath)) { + getTableData().setXmlSavedHook(new DBTableDataSavedHook(tplPath, getTableData())); + } + + //获取当前的缓存配置,没有就创建一份 + String dsName = getTableData().getDsName(); + + //这里为了之前兼容插件创建的配置,缓存配置不在DBTableData,而是从模版attr读取 + strategyConfig = DesignerStrategyConfigUtils.getStrategyConfig(dsName); + + if (strategyConfig == null || strategyConfig.isUseGlobal()) { + //模版里面没有配置,检查模版是否被开启 + boolean tplEnabled = StrategyConfigService.isTemplateEnabled(tplPath); + if (tplEnabled) { + //使用全局配置 + strategyConfig = StrategyConfigHelper.createStrategyConfig(true); + } + } + } + + return strategyConfig; + } + + @Override + public void save(DBTableData saved, StrategyConfig config) { + + //DBTableDataSavedHook处理了 + } + } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/db/ServerStrategyConfigHandler.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/db/ServerStrategyConfigHandler.java deleted file mode 100644 index 467c294822..0000000000 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/db/ServerStrategyConfigHandler.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.fr.design.data.tabledata.tabledatapane.db; - -import com.fr.data.impl.DBTableData; -import com.fr.esd.core.strategy.config.StrategyConfig; -import com.fr.esd.event.DSMapping; -import com.fr.esd.event.DsNameTarget; -import com.fr.esd.event.StrategyEventsNotifier; -import com.fr.log.FineLoggerFactory; -import com.fr.stable.StringUtils; - -/** - * @author rinoux - * @version 10.0 - * Created by rinoux on 2021/3/19 - */ -public class ServerStrategyConfigHandler implements StrategyConfigHandler { - private final DBTableData tableData; - - private final String origName; - - private final String origConnection; - - private final String origQuery; - - public ServerStrategyConfigHandler(DBTableData tableData) { - this.tableData = tableData; - this.origName = tableData.getDsName(); - this.origConnection = tableData.getDatabase().toString(); - this.origQuery = tableData.getQuery(); - } - - @Override - public StrategyConfig find() { - StrategyConfig strategyConfig = null; - if (tableData != null) { - try { - strategyConfig = tableData.getStrategyConfig() == null ? null : tableData.getStrategyConfig().clone(); - } catch (CloneNotSupportedException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - - return strategyConfig; - } - - @Override - public void save(DBTableData saved, StrategyConfig strategyConfig) { - String conn = saved.getDatabase().toString(); - String query = saved.getQuery(); - - - //检查数据链接和sql是否修改,如果修改需要触发缓存监听事件 - if (!conn.equals(origConnection) || !query.equals(origQuery)) { - if (StringUtils.isNotEmpty(origName)) { - //新建数据集的origName为null,不用触发 - StrategyEventsNotifier.modifyDataSet(DSMapping.ofServerDS(new DsNameTarget(origName))); - } - } - - - //配置变动事件 - try { - final StrategyConfig orig = tableData.getStrategyConfig(); - saved.setStrategyConfig(strategyConfig.clone()); - StrategyEventsNotifier.compareAndFireConfigEvents(orig, strategyConfig, DSMapping.ofServerDS(new DsNameTarget(saved.getDsName()))); - } catch (CloneNotSupportedException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } -} diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/db/StrategyConfigHandler.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/db/StrategyConfigHandler.java deleted file mode 100644 index 346410e0e5..0000000000 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/db/StrategyConfigHandler.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.fr.design.data.tabledata.tabledatapane.db; - -import com.fr.data.impl.DBTableData; -import com.fr.esd.core.strategy.config.StrategyConfig; - -/** - * @author rinoux - * @version 10.0 - * Created by rinoux on 2021/3/19 - */ -public interface StrategyConfigHandler { - - StrategyConfig find(); - - void save(DBTableData saved, StrategyConfig config); -} diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/db/TemplateStrategyConfigHandler.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/db/TemplateStrategyConfigHandler.java deleted file mode 100644 index 4b0c98add2..0000000000 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/db/TemplateStrategyConfigHandler.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.fr.design.data.tabledata.tabledatapane.db; - -import com.fr.base.TableData; -import com.fr.data.impl.DBTableData; -import com.fr.design.data.DesignerStrategyConfigUtils; -import com.fr.design.file.HistoryTemplateListCache; -import com.fr.esd.core.strategy.config.StrategyConfig; -import com.fr.esd.query.StrategicTableData; -import com.fr.workspace.WorkContext; - -/** - * @author rinoux - * @version 10.0 - * Created by rinoux on 2021/3/19 - */ -public class TemplateStrategyConfigHandler implements StrategyConfigHandler { - - DBTableData tableData; - - public TemplateStrategyConfigHandler(DBTableData tableData) { - this.tableData = tableData; - } - - @Override - public StrategyConfig find() { - StrategyConfig strategyConfig = null; - if (tableData != null) { - //设置保存数据集的事件检查钩子 - String tplPath = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath(); - - //新建模版此时不存在,不需要注册钩子 - if (tableData.getXmlSavedHook() == null && WorkContext.getWorkResource().exist(tplPath)) { - tableData.setXmlSavedHook(new DBTableDataSavedHook(tplPath, tableData)); - } - - //获取当前的缓存配置,没有就创建一份 - String dsName = tableData.getDsName(); - - //这里为了之前兼容插件创建的配置,缓存配置不在DBTableData,而是从模版attr读取 - strategyConfig = DesignerStrategyConfigUtils.getStrategyConfig(dsName); - } - - return strategyConfig; - } - - @Override - public void save(DBTableData saved, StrategyConfig config) { - - } -} diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerESDActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerESDActivator.java index ebfaf34702..827e916484 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerESDActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerESDActivator.java @@ -1,6 +1,9 @@ package com.fr.start.module; +import com.fr.esd.cache.manager.RecommendManager; import com.fr.esd.core.strategy.config.service.StrategyConfigService; +import com.fr.esd.core.strategy.recomend.EnabledTemplateService; +import com.fr.esd.core.strategy.recomend.EnabledTemplateServiceProvider; import com.fr.esd.impl.strategy.config.service.DefaultStrategyConfigServiceProvider; import com.fr.module.Activator; @@ -13,6 +16,7 @@ public class DesignerESDActivator extends Activator { @Override public void start() { StrategyConfigService.setService(new DefaultStrategyConfigServiceProvider()); + EnabledTemplateService.getInstance().registerService(path -> RecommendManager.getInstance().findByPath(path) != null); } @Override From 2562ca8a15efe3f77b77784c75df8d373deb29f4 Mon Sep 17 00:00:00 2001 From: rinoux Date: Mon, 16 Aug 2021 16:42:04 +0800 Subject: [PATCH 4/8] =?UTF-8?q?REPORT-57209=20=E5=85=B1=E4=BA=AB=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E6=98=BE=E7=A4=BA=E9=85=8D=E7=BD=AE=E5=85=BC?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tils.java => StrategyConfigAttrUtils.java} | 21 +---------- .../data/datapane/TableDataTreePane.java | 16 ++++----- .../tabledatapane/DBTableDataPane.java | 35 ++++++++++++------- 3 files changed, 32 insertions(+), 40 deletions(-) rename designer-base/src/main/java/com/fr/design/data/{DesignerStrategyConfigUtils.java => StrategyConfigAttrUtils.java} (88%) diff --git a/designer-base/src/main/java/com/fr/design/data/DesignerStrategyConfigUtils.java b/designer-base/src/main/java/com/fr/design/data/StrategyConfigAttrUtils.java similarity index 88% rename from designer-base/src/main/java/com/fr/design/data/DesignerStrategyConfigUtils.java rename to designer-base/src/main/java/com/fr/design/data/StrategyConfigAttrUtils.java index c15b3f3cee..e2a75fc11b 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignerStrategyConfigUtils.java +++ b/designer-base/src/main/java/com/fr/design/data/StrategyConfigAttrUtils.java @@ -26,7 +26,7 @@ import java.util.Set; * @version 10.0 * Created by rinoux on 2020/10/28 */ -public class DesignerStrategyConfigUtils { +public class StrategyConfigAttrUtils { /** * 获取当前编辑模版的数据集缓存配置属性 @@ -56,25 +56,6 @@ public class DesignerStrategyConfigUtils { } - /** - * 当前编辑的模版是否被批量开启 - * - * @return - */ - public static boolean isEditingTemplateRecommended() { - JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - - if (jTemplate != null) { - FILE file = jTemplate.getEditingFILE(); - if (file != null) { - String path = file.getPath(); - return StrategyConfigService.isTemplateEnabled(path); - } - } - return false; - } - - /** * 获取模版数据集配置 * 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 b95c03ac6b..493d40d796 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 @@ -11,7 +11,7 @@ import com.fr.design.constants.UIConstants; import com.fr.design.data.BasicTableDataTreePane; import com.fr.design.data.BasicTableDataUtils; import com.fr.design.data.DesignTableDataManager; -import com.fr.design.data.DesignerStrategyConfigUtils; +import com.fr.design.data.StrategyConfigAttrUtils; import com.fr.design.data.tabledata.StoreProcedureWorkerListener; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; import com.fr.design.data.tabledata.tabledatapane.DBTableDataPane; @@ -291,10 +291,10 @@ public class TableDataTreePane extends BasicTableDataTreePane { editingConfig.setDsName(tdName); if (!ComparatorUtils.equals(oldName, tdName)) { //重命名 - DesignerStrategyConfigUtils.removeStrategyConfig(oldName); + StrategyConfigAttrUtils.removeStrategyConfig(oldName); } - DesignerStrategyConfigUtils.addStrategyConfig(editingConfig); + StrategyConfigAttrUtils.addStrategyConfig(editingConfig); } ((DBTableData) td).setDsName(tdName); } @@ -588,7 +588,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { if (wrapper.getTableData() instanceof DBTableData) { DBTableData td = (DBTableData) wrapper.getTableData(); - StrategyConfig config = DesignerStrategyConfigUtils.getStrategyConfig(wrapper.getTableDataName()); + StrategyConfig config = StrategyConfigAttrUtils.getStrategyConfig(wrapper.getTableDataName()); if (config == null) { result.put(td, td.isShare() ? ESDStatus.SINGLE_ON : ESDStatus.SINGLE_OFF); } else { @@ -632,14 +632,14 @@ public class TableDataTreePane extends BasicTableDataTreePane { StrategyConfig strategyConfig = getOrCreateStrategyConfig(dsName); strategyConfig.setEnable(true); strategyConfig.setUseGlobal(false); - DesignerStrategyConfigUtils.addStrategyConfig(strategyConfig); + StrategyConfigAttrUtils.addStrategyConfig(strategyConfig); DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); } } } private @NotNull StrategyConfig getOrCreateStrategyConfig(String dsName) { - StrategyConfig config = DesignerStrategyConfigUtils.getStrategyConfig(dsName); + StrategyConfig config = StrategyConfigAttrUtils.getStrategyConfig(dsName); if (config == null) { config = StrategyConfigHelper.createStrategyConfig(true); @@ -680,7 +680,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { StrategyConfig strategyConfig = getOrCreateStrategyConfig(dsName); strategyConfig.setEnable(false); strategyConfig.setUseGlobal(false); - DesignerStrategyConfigUtils.addStrategyConfig(strategyConfig); + StrategyConfigAttrUtils.addStrategyConfig(strategyConfig); DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); } } @@ -814,7 +814,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { checkButtonEnabled(); //删掉缓存配置 - DesignerStrategyConfigUtils.removeStrategyConfig(selectedNO.getName()); + StrategyConfigAttrUtils.removeStrategyConfig(selectedNO.getName()); // 如果一个模版是平台开启,这个数据集的配置不会存xml,预览模版时直接从全局配置copy,这样 // 导致删除的时候StrategyConfigsAttrSavedHook没有通过前后配置比较感知数据集被删除,因此不会发出事件让其失效 diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index 8f17a2a10f..8b8099ab46 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -12,7 +12,7 @@ import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; -import com.fr.design.data.DesignerStrategyConfigUtils; +import com.fr.design.data.StrategyConfigAttrUtils; import com.fr.design.data.datapane.ESDStrategyConfigPane; import com.fr.design.data.datapane.connect.ConnectionTableProcedurePane; import com.fr.design.data.datapane.preview.PreviewTablePane; @@ -106,7 +106,7 @@ public class DBTableDataPane extends AbstractTableDataPane { //配置 private StrategyConfig strategyConfig; - private StrategyConfigHandler configHandler; + private StrategyConfigHandler configHandler; public DBTableDataPane() { @@ -353,7 +353,8 @@ public class DBTableDataPane extends AbstractTableDataPane { //判断是不是模版数据集 switch (this.dbTableData.getScope()) { case TEMPLATE: - setEsdEnableStatus(DesignerStrategyConfigUtils.isEditingTemplateRecommended(), false); + String tplPath = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath(); + setEsdEnableStatus(StrategyConfigService.isTemplateEnabled(tplPath), false); break; case SERVER: //不会走到这里 @@ -706,21 +707,31 @@ public class DBTableDataPane extends AbstractTableDataPane { String dsName = getTableData().getDsName(); //这里为了之前兼容插件创建的配置,缓存配置不在DBTableData,而是从模版attr读取 - strategyConfig = DesignerStrategyConfigUtils.getStrategyConfig(dsName); - - if (strategyConfig == null || strategyConfig.isUseGlobal()) { - //模版里面没有配置,检查模版是否被开启 - boolean tplEnabled = StrategyConfigService.isTemplateEnabled(tplPath); - if (tplEnabled) { - //使用全局配置 - strategyConfig = StrategyConfigHelper.createStrategyConfig(true); - } + strategyConfig = StrategyConfigAttrUtils.getStrategyConfig(dsName); + + + if (useGlobal(getTableData(), strategyConfig, tplPath)) { + //使用全局配置 + strategyConfig = StrategyConfigHelper.createStrategyConfig(true); + } else if (getTableData().isShare()) { + //使用共享数据集兼容配置 + strategyConfig = StrategyConfigHelper.createStrategyConfig(true, false, true); } } return strategyConfig; } + private boolean useGlobal(DBTableData dbTableData, StrategyConfig strategyConfig, String tplPath) { + //非共享且配置为空或者指定使用全局配置时,检查是否全局开启 + if (!dbTableData.isShare() && (strategyConfig == null || strategyConfig.isUseGlobal())) { + //模版里面没有配置,检查模版是否被开启 + return StrategyConfigService.isTemplateEnabled(tplPath); + } + + return false; + } + @Override public void save(DBTableData saved, StrategyConfig config) { From e7400764b2e30e535d21e361accf10a950631285 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Mon, 16 Aug 2021 19:39:35 +0800 Subject: [PATCH 5/8] =?UTF-8?q?REPORT-57147=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=A8=A1=E7=89=88=E9=BB=98=E8=AE=A4=E9=A2=84=E8=A7=88=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/fit/common/TemplateTool.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java b/designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java index eca7af50bc..0d8696ba31 100644 --- a/designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java +++ b/designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java @@ -38,6 +38,9 @@ public class TemplateTool { private static Listener switchListener = new Listener() { @Override public void on(Event event, JTemplate jTemplate) { + if (!(jTemplate instanceof JForm)) { + return; + } JFormType currentType = JFormType.OLD_TYPE; if (AdaptiveSwitchUtil.isSwitchJFromIng()) { currentType = DesignerUIModeConfig.getInstance().newUIMode() ? JFormType.NEW_TYPE : JFormType.OLD_TYPE; From 1415f85b9f7218793db645f7890748fe148f81fa Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Mon, 16 Aug 2021 19:40:42 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E6=92=A4=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/AuthorityToolBarPane.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java index 428a18a1ac..1fc891c8b3 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java @@ -185,7 +185,7 @@ public class AuthorityToolBarPane extends BasicBeanPane toolBarButtons = toolBarPane.getToolBarButtons(); - boolean isnotEnable = ComparatorUtils.equals(title.getText(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Server_Toolbar_Choose_Role")) && !WorkContext.getCurrent().isRoot(); + boolean isnotEnable = ComparatorUtils.equals(title.getText(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Server_Toolbar_Choose_Role"))&& !WorkContext.getCurrent().isRoot(); for (ToolBarButton button : toolBarButtons) { button.setEnabled(!isnotEnable); } @@ -296,15 +296,9 @@ public class AuthorityToolBarPane extends BasicBeanPane Date: Tue, 17 Aug 2021 15:07:54 +0800 Subject: [PATCH 7/8] =?UTF-8?q?REPORT-56686=20=E8=BF=9C=E7=A8=8B=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E6=9D=83=E9=99=90=E7=AE=A1=E7=90=86=E7=9C=8B=E4=B8=8D?= =?UTF-8?q?=E5=88=B0cptx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/remote/ui/AuthorityEditorPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityEditorPane.java b/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityEditorPane.java index 26fc0c28a2..a3e3d02518 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityEditorPane.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityEditorPane.java @@ -38,7 +38,7 @@ public class AuthorityEditorPane extends BasicBeanPane { ) ) ); - IOFileNodeFilter filter = new IOFileNodeFilter(new String[]{".cpt", ".class", ".frm", ".form"}); + IOFileNodeFilter filter = new IOFileNodeFilter(new String[]{"cptx", ".cpt", ".class", ".frm", ".form"}); tree.setDigIn(true); tree.setFileNodeFilter(filter); UIScrollPane scrollPane = new UIScrollPane(tree); From 807cf2d202e62e5db12bfa859d1f4d2ce8ef6746 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 17 Aug 2021 16:25:33 +0800 Subject: [PATCH 8/8] =?UTF-8?q?REPORT-56686=20=E8=BF=9C=E7=A8=8B=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E6=9D=83=E9=99=90=E7=AE=A1=E7=90=86=E7=9C=8B=E4=B8=8D?= =?UTF-8?q?=E5=88=B0cptx=20=E5=8A=A0=E4=B8=8A.=E5=90=8E=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/remote/ui/AuthorityEditorPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityEditorPane.java b/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityEditorPane.java index a3e3d02518..da5817b853 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityEditorPane.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityEditorPane.java @@ -38,7 +38,7 @@ public class AuthorityEditorPane extends BasicBeanPane { ) ) ); - IOFileNodeFilter filter = new IOFileNodeFilter(new String[]{"cptx", ".cpt", ".class", ".frm", ".form"}); + IOFileNodeFilter filter = new IOFileNodeFilter(new String[]{".cptx", ".cpt", ".class", ".frm", ".form"}); tree.setDigIn(true); tree.setFileNodeFilter(filter); UIScrollPane scrollPane = new UIScrollPane(tree);