From b93c4902292765fa9ce9e4ecfb0980919f1c5230 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 21 Jun 2022 12:00:20 +0800 Subject: [PATCH] =?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) {