From dfb4108c7e8ebf6f765aba5cc3fac0806b70f785 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Mon, 20 Jun 2022 15:35:35 +0800 Subject: [PATCH 1/5] =?UTF-8?q?KERNEL-11531=20=E6=95=B0=E6=8D=AE=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E8=B6=8A=E6=9D=83=E6=BC=8F=E6=B4=9E=E8=B0=83=E7=94=A8?= =?UTF-8?q?com.fr.invoke.ClassHelper=E4=B8=AD=E9=81=8D=E5=8E=86=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=AF=B9=E8=B1=A1=E5=AD=98=E5=9C=A8=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=95=88=E7=8E=87=E9=97=AE=E9=A2=98=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=AE=95=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AuthorityTargetObjectCollector.java | 21 +++++ .../authority/JTemplateAuthorityChecker.java | 80 +++++++------------ 2 files changed, 49 insertions(+), 52 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java new file mode 100644 index 0000000000..8fb5911db9 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java @@ -0,0 +1,21 @@ +package com.fr.design.mainframe.authority; + +import com.fr.base.CloneCollector; + + +import java.util.ArrayList; +import java.util.List; + +public class AuthorityTargetObjectCollector extends CloneCollector { + List targetObject = new ArrayList<>(); + + @Override + public void collect(Object object) { + targetObject.add(object); + } + + public List getTargetObject() { + return targetObject; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java index d76031f654..59257c6c96 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java @@ -1,24 +1,23 @@ package com.fr.design.mainframe.authority; +import com.fr.base.CloneCollector; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; -import com.fr.design.mod.ModClassFilter; import com.fr.file.ConnectionConfig; import com.fr.file.TableDataConfig; -import com.fr.invoke.ClassHelper; import com.fr.log.FineLoggerFactory; -import com.fr.stable.Filter; import com.fr.workspace.WorkContext; import com.fr.workspace.server.authority.user.UserAuthority; -import java.util.Collection; + import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; @@ -77,24 +76,21 @@ public class JTemplateAuthorityChecker { public boolean isAuthority() { long s = System.currentTimeMillis(); - //遍历模板对象,根据checkerMap.keySet()把感兴趣的对象找出来 - Map> targetObjects = ClassHelper.searchObject(jTemplate.getTarget(), checkerMap.keySet(), ClassFilter.getInstance()); - + List targetObjects = getTargetObjects(); //找到对应的checker,对对象进行检查 - for (String name : targetObjects.keySet()) { + for (Object targetObject : targetObjects) { + String name = targetObject.getClass().getName(); ElementAuthorityChecker checker = checkerMap.get(name); - for (Object object : targetObjects.get(name)) { - if (authConnectionNames != null) { - Set noAuthName = checker.getNoAuthConnectionNames(object, authConnectionNames); - if (noAuthName != null) { - authFailConnectionNames.addAll(noAuthName); - } + if (authConnectionNames != null) { + Set noAuthName = checker.getNoAuthConnectionNames(targetObject, authConnectionNames); + if (noAuthName != null) { + authFailConnectionNames.addAll(noAuthName); } - if (authDatasetNames != null) { - Set noAuthName = checker.getNoAuthDatasetNames(object, authDatasetNames); - if (noAuthName != null) { - authFailDatasetNames.addAll(noAuthName); - } + } + if (authDatasetNames != null) { + Set noAuthName = checker.getNoAuthDatasetNames(targetObject, authDatasetNames); + if (noAuthName != null) { + authFailDatasetNames.addAll(noAuthName); } } } @@ -104,6 +100,19 @@ public class JTemplateAuthorityChecker { return authFailConnectionNames.size() == 0 && authFailDatasetNames.size() == 0; } + private List getTargetObjects() { + AuthorityTargetObjectCollector authorityTargetObjectCollector = new AuthorityTargetObjectCollector(); + CloneCollector.setCollector(authorityTargetObjectCollector); + try { + jTemplate.getTarget().clone(); + } catch (Exception ignore) { + + } + List targetObjects = authorityTargetObjectCollector.getTargetObject(); + CloneCollector.clearCollector(); + return targetObjects; + } + public void showAuthorityFailPromptDialog() { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(Toolkit.i18nText("Fine-Design-Basic_Save_Failure")); @@ -151,38 +160,5 @@ public class JTemplateAuthorityChecker { return stringBuffer.toString(); } - static class ClassFilter implements Filter { - - private static final Set FILTER_SET = new HashSet<>(); - private static final Set START_WITH_SET = new HashSet<>(); - private static final Filter INSTANCE = new ModClassFilter(); - - public static Filter getInstance() { - return INSTANCE; - } - - static { - FILTER_SET.add("java.awt.image.BufferedImage"); - FILTER_SET.add("sun.awt.AppContext"); - FILTER_SET.add("com.fr.poly.creator.ECBlockCreator"); - FILTER_SET.add("io.netty.channel.nio.SelectedSelectionKeySet"); - FILTER_SET.add("com.fr.form.ui.ElementCaseImage"); - FILTER_SET.add("this$0"); - START_WITH_SET.add("com.fr.design"); - } - - @Override - public boolean accept(String s) { - if (FILTER_SET.contains(s)) { - return true; - } - for (String start : START_WITH_SET) { - if (s.startsWith(start)) { - return true; - } - } - return false; - } - } } From 3d43b762187584ad75dc642ec460226d57fbf65f Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 21 Jun 2022 11:51:03 +0800 Subject: [PATCH 2/5] =?UTF-8?q?KERNEL-11531=20=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=8B=E8=AE=BE=E8=AE=A1=EF=BC=8CColoneCollector=E4=B8=AD?= =?UTF-8?q?=E8=A7=A6=E5=8F=91clone()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AuthorityTargetObjectCollector.java | 22 ++++++++++++++++--- .../authority/JTemplateAuthorityChecker.java | 14 ++++++------ 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java index 8fb5911db9..9972c7be37 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java @@ -1,6 +1,11 @@ package com.fr.design.mainframe.authority; import com.fr.base.CloneCollector; +import com.fr.base.Formula; +import com.fr.data.impl.NameDatabaseConnection; +import com.fr.data.impl.NameTableData; +import com.fr.report.cell.cellattr.core.group.DSColumn; +import com.fr.stable.FCloneable; import java.util.ArrayList; @@ -9,13 +14,24 @@ import java.util.List; public class AuthorityTargetObjectCollector extends CloneCollector { List targetObject = new ArrayList<>(); + public AuthorityTargetObjectCollector(FCloneable rootObject) { + super(rootObject); + } + @Override public void collect(Object object) { - targetObject.add(object); + if (object instanceof DSColumn || object instanceof Formula + || object instanceof NameDatabaseConnection || object instanceof NameTableData) { + targetObject.add(object); + } } - public List getTargetObject() { + public List collectTargetObject() { + CloneCollector.setCollector(this); + this.targetObject = new ArrayList<>(); + this.collect(); + CloneCollector.clearCollector(); return targetObject; } - + } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java index 59257c6c96..b33f0665c9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java @@ -15,6 +15,7 @@ import com.fr.workspace.WorkContext; import com.fr.workspace.server.authority.user.UserAuthority; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -101,15 +102,14 @@ public class JTemplateAuthorityChecker { } private List getTargetObjects() { - AuthorityTargetObjectCollector authorityTargetObjectCollector = new AuthorityTargetObjectCollector(); - CloneCollector.setCollector(authorityTargetObjectCollector); + List targetObjects = new ArrayList<>(); try { - jTemplate.getTarget().clone(); - } catch (Exception ignore) { - + AuthorityTargetObjectCollector authorityTargetObjectCollector + = new AuthorityTargetObjectCollector(jTemplate.getTarget()); + targetObjects = authorityTargetObjectCollector.collectTargetObject(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e, e.getMessage()); } - List targetObjects = authorityTargetObjectCollector.getTargetObject(); - CloneCollector.clearCollector(); return targetObjects; } From b93c4902292765fa9ce9e4ecfb0980919f1c5230 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 21 Jun 2022 12:00:20 +0800 Subject: [PATCH 3/5] =?UTF-8?q?REPORT-73996-=E6=96=B0=E5=BB=BAfrm=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E7=A9=BA=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1. 重复创建新Form、WorkBook对象,导致显示和保存用的对象是不同的 2. 代码合并问题导致JTemplate中checkAndResetTheme未能删除 3. 修复undo没有同步主题色的问题 【改动思路】 同上 --- .../src/main/java/com/fr/design/mainframe/JTemplate.java | 6 +----- .../main/java/com/fr/design/mainframe/JTemplateFactory.java | 6 +----- .../src/main/java/com/fr/design/mainframe/JForm.java | 1 + .../src/main/java/com/fr/design/mainframe/JWorkBook.java | 1 + 4 files changed, 4 insertions(+), 10 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 7d1461bf37..a76d92913c 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 @@ -201,7 +201,7 @@ public abstract class JTemplate> } else if (!DesignModeContext.isVcsMode() && !DesignModeContext.isAuthorityEditing() && !DesignModeContext.isDuchampMode()) { DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); } - this.template = t; + this.template = getTarget(); this.previewType = parserPreviewProvider(t.getPreviewType()); this.editingFILE = file; this.setLayout(FRGUIPaneFactory.createBorderLayout()); @@ -213,10 +213,6 @@ public abstract class JTemplate> } addCenterPane(); isNewCreateTpl = isNewFile; - if (isNewCreateTpl) { - // REPORT-58486: 必须在初始的UndoState创建前设置主题,使得初始的UndoState就包含了主题效果 - setUpTheme4NewTemplate(); - } this.undoState = createUndoState(); initAndStartPlugin(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java index 310a051a4e..15895c06a8 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java @@ -39,11 +39,7 @@ public final class JTemplateFactory { String[] defaultAppExtensions = app.defaultExtensions(); for (String defaultAppExtension : defaultAppExtensions) { if (defaultAppExtension.equalsIgnoreCase(fileExtension)) { - JTemplate jt = app.openTemplate(file); - if (jt != null) { - jt.checkAndResetTheme(); - return jt; - } + return app.openTemplate(file); } } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 0f5b903078..831d245d1a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -664,6 +664,7 @@ public class JForm extends JTemplate implements BaseJForm { try { WorkBook undoWorkBook = (WorkBook) u.getWorkBook().clone(); undoWorkBook.checkAndResetTheme(); + undoWorkBook = (WorkBook) FineColorSynchronizer.flush(undoWorkBook, undoWorkBook.getTemplateTheme()); this.setTarget(undoWorkBook); if (!DesignerMode.isAuthorityEditing()) { if (u.getAuthorityType() != BaseUndoState.NORMAL_STATE) { From 8a19532679cba8f3a4e64d4939018ae64cbf366a Mon Sep 17 00:00:00 2001 From: "Link.Zhao" Date: Tue, 21 Jun 2022 16:13:09 +0800 Subject: [PATCH 4/5] =?UTF-8?q?REPORT-73970=20=E6=89=8B=E5=8A=A8=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF=E5=AE=BD=E5=BA=A6?= =?UTF-8?q?=E6=9C=AA=E7=94=9F=E6=95=88=201=E3=80=81REPORT-66771=E6=94=B9?= =?UTF-8?q?=E5=8A=A8=E5=AF=BC=E8=87=B4=EF=BC=8C=E5=9C=A8dolayout=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E4=BF=AE=E6=94=B9=E4=BA=86=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=AE=BD=E5=BA=A6=202=E3=80=81=E6=94=B9=E4=B8=BA=EF=BC=8C?= =?UTF-8?q?=E5=9C=A8form=E5=AE=BD=E5=BA=A6=E4=BF=AE=E6=94=B9=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E4=BF=AE=E6=94=B9=E7=BB=84=E4=BB=B6=E5=AE=BD?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/designer/creator/XWParameterLayout.java | 8 +++----- .../src/main/java/com/fr/design/mainframe/FormArea.java | 7 +++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java index aacdf6d04b..d925df070f 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java @@ -272,13 +272,11 @@ public class XWParameterLayout extends XWAbsoluteLayout { } /** - * 修改form布局的宽度时,需要同时修改表单参数界面的布局的宽度。 + * 修改参数面板宽度 * */ - @Override - public void doLayout() { - layout(); + public void setParaWidth(int width) { if (data != null && data instanceof WParameterLayout) { - ((WParameterLayout) data).setDesignWidth(getWidth()); + ((WParameterLayout) data).setDesignWidth(width); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java index 759c0b6f75..e515dd1f35 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java @@ -12,6 +12,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIPopupMenu; +import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; @@ -402,6 +403,12 @@ public class FormArea extends JComponent implements ScrollRulerComponent { } doReCalculateRoot(width, rec.height, layout); } + + // REPORT-66771, 调整参数面板宽度 + XLayoutContainer para = FormArea.this.designer.getParaComponent(); + if (para != null && para instanceof XWParameterLayout) { + ((XWParameterLayout) para).setParaWidth(width); + } } private void reCalculateHeight(int height) { From 6cc530b728b62c063d3e6375f2311efc52536e55 Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 21 Jun 2022 17:20:31 +0800 Subject: [PATCH 5/5] =?UTF-8?q?REPORT-74100=E3=80=90=E5=86=92=E7=83=9F?= =?UTF-8?q?=E3=80=91=E8=BF=9C=E7=A8=8BBI=E7=8E=AF=E5=A2=83=EF=BC=8C13?= =?UTF-8?q?=E4=B8=AAjar=E5=85=A8=E9=83=A8=E6=8F=90=E7=A4=BA=E7=BC=BA?= =?UTF-8?q?=E5=A4=B1=20BI=20=E9=9B=86=E6=88=90=E7=9A=84=20JAR=20=E6=88=96?= =?UTF-8?q?=E8=80=85=E4=B9=8B=E5=89=8D=E7=9A=84=E7=8E=AF=E5=A2=83=EF=BC=8C?= =?UTF-8?q?=20=E8=BF=99=E9=87=8C=E9=9C=80=E8=A6=81=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E9=9C=80=E8=A6=81=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E6=A3=80=E6=9F=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/env/detect/impl/JarLackDetector.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java b/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java index 322c15d501..8e28116e51 100644 --- a/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java +++ b/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java @@ -54,6 +54,11 @@ public class JarLackDetector extends AbstractExceptionDetector { // 本地情况 List localInfos = BuildInfoManager.getInstance().getInfos(); + // 说明远程环境并不存在对应的 info.json, 直接忽略 + if (Collections.isEmpty(remoteInfos)) { + return DetectorResult.normal(type()); + } + Set remoteSet = remoteInfos.stream() .filter(this::isExistInfo) .map(BuildInfo::getJar)