From 1f031e4b7247431044d4e9110e9e4ecf6b175a94 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Fri, 10 Sep 2021 14:22:03 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-57898=20=E3=80=90=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E3=80=91=E8=BF=9B=E5=85=A5=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=97=B6=E6=89=93=E5=BC=80frm/=E5=A4=A7?= =?UTF-8?q?=E5=B1=8F=E6=A8=A1=E6=9D=BF/=E7=89=88=E6=9C=AC=E7=AE=A1?= =?UTF-8?q?=E7=90=86=EF=BC=8C=E5=86=8D=E5=9B=9E=E5=88=B0=E5=8E=9F=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=EF=BC=8C=E6=97=A0=E6=B3=95=E9=80=80=E5=87=BA=E6=9D=83?= =?UTF-8?q?=E9=99=90=E7=BC=96=E8=BE=91=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/base/mode/DesignModeContext.java | 11 +++++- .../com/fr/design/base/mode/DesignerMode.java | 20 +++++++++-- .../design/file/HistoryTemplateListCache.java | 7 ++-- .../fr/design/mainframe/DesignerFrame.java | 13 +++++-- .../roleAuthority/RolesEditedSourceOP.java | 35 ++++++++++--------- 5 files changed, 60 insertions(+), 26 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java b/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java index 1352833e6c..8bb5862716 100644 --- a/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java +++ b/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java @@ -10,7 +10,15 @@ public class DesignModeContext { private static DesignerMode mode = DesignerMode.NORMAL; public static void switchTo(DesignerMode mode) { - DesignModeContext.mode = mode; + changeMode(DesignModeContext.mode, mode); + } + + private static void changeMode(DesignerMode oldMode, DesignerMode newMode) { + if (oldMode != newMode) { + DesignModeContext.mode = newMode; + oldMode.closeMode(); + newMode.openMode(); + } } public static DesignerMode getMode() { @@ -40,6 +48,7 @@ public class DesignModeContext { * @return 是否为权限编辑 */ public static boolean isAuthorityEditing() { + //System.out.println("isAuthorityEditing:"+(mode == AUTHORITY)); return mode == AUTHORITY; } diff --git a/designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java b/designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java index d3dc1e5f4a..3ca798f2fb 100644 --- a/designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java +++ b/designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java @@ -1,9 +1,25 @@ package com.fr.design.base.mode; + +import com.fr.design.mainframe.DesignerContext; + public enum DesignerMode { NORMAL, BAN_COPY_AND_CUT, VCS, - AUTHORITY, - DUCHAMP + AUTHORITY { + @Override + public void closeMode() { + DesignerContext.getDesignerFrame().closeAuthorityMode(); + } + }, + DUCHAMP; + + public void openMode() { + + } + + public void closeMode() { + } + } 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 f7d4d1f571..52fb1bcfa2 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 @@ -4,6 +4,7 @@ import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.base.io.BaseBook; import com.fr.design.DesignerEnvManager; import com.fr.design.base.mode.DesignModeContext; +import com.fr.design.base.mode.DesignerMode; import com.fr.design.data.DesignTableDataManager; import com.fr.design.file.filter.ClassFilter; import com.fr.design.i18n.Toolkit; @@ -69,7 +70,7 @@ public class HistoryTemplateListCache implements CallbackEvent { DesignTableDataManager.closeTemplate(selected); //直接关闭模板的时候(当且仅当设计器tab上只剩一个模板)退出权限编辑 if (DesignModeContext.isAuthorityEditing() && historyList.size() <= 1) { - DesignerContext.getDesignerFrame().closeAuthorityEditing(); + DesignModeContext.switchTo(DesignerMode.NORMAL); } if (contains(selected) == -1) { return; @@ -430,13 +431,13 @@ public class HistoryTemplateListCache implements CallbackEvent { */ @Deprecated public void reloadCurrentTemplate() { - reloadAllEditingTemplate(); + reloadAllEditingTemplate(); } /** * 重绘当前模板 */ - public void repaintCurrentEditingTemplate(){ + public void repaintCurrentEditingTemplate() { UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index bacf1d5b32..8c9c3afdfb 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -9,6 +9,7 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.base.mode.DesignModeContext; +import com.fr.design.base.mode.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; @@ -219,7 +220,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta @Override public void mouseReleased(MouseEvent e) { if (DesignModeContext.isAuthorityEditing()) { - closeAuthorityEditing(); + DesignModeContext.switchTo(DesignerMode.NORMAL); } } @@ -299,8 +300,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().doResize(); } + @Deprecated public void closeAuthorityEditing() { - DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); + DesignModeContext.switchTo(DesignerMode.NORMAL); + } + + public void closeAuthorityMode() { WestRegionContainerPane.getInstance().replaceDownPane( TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); @@ -312,6 +317,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta EventDispatcher.fire(DesignAuthorityEventType.StopEdit, DesignerFrame.this); } + /** * 注册app. * @@ -982,6 +988,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @date 2014-10-14-下午6:31:05 */ private void openFile(FILE tplFile) { + DesignModeContext.switchTo(DesignerMode.NORMAL); //切换文件后清空FixedPopupPane面板 EastRegionContainerPane.getInstance().clearCurrentPopupPane(); if (tplFile != null) { @@ -1038,7 +1045,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (jt != null) { + if (jt != null) { DesignerEnvManager.getEnvManager().setLastOpenFile(jt.getEditingFILE().getPath()); } diff --git a/designer-base/src/main/java/com/fr/design/roleAuthority/RolesEditedSourceOP.java b/designer-base/src/main/java/com/fr/design/roleAuthority/RolesEditedSourceOP.java index a21cd20e74..60025e0325 100644 --- a/designer-base/src/main/java/com/fr/design/roleAuthority/RolesEditedSourceOP.java +++ b/designer-base/src/main/java/com/fr/design/roleAuthority/RolesEditedSourceOP.java @@ -18,21 +18,22 @@ import java.util.Map; */ public class RolesEditedSourceOP extends RoleSourceOP { - protected ExpandMutableTreeNode[] getNodeArrayFromMap(Map map) { - List roleList = new ArrayList(); - Iterator> entryIt = map.entrySet().iterator(); - while (entryIt.hasNext()) { - Map.Entry entry = entryIt.next(); - RoleDataWrapper t = entry.getValue(); - - JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - PrivilegeEditedRoleProvider pe = (PrivilegeEditedRoleProvider) jt.getTarget(); - - ExpandMutableTreeNode[] expand = t.load(Arrays.asList(pe.getAllEditedRoleSet())); - for (ExpandMutableTreeNode expandMutableTreeNode : expand) { - roleList.add(expandMutableTreeNode); - } - } - return roleList.toArray(new ExpandMutableTreeNode[roleList.size()]); - } + protected ExpandMutableTreeNode[] getNodeArrayFromMap(Map map) { + List roleList = new ArrayList(); + Iterator> entryIt = map.entrySet().iterator(); + while (entryIt.hasNext()) { + Map.Entry entry = entryIt.next(); + RoleDataWrapper t = entry.getValue(); + + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (jt.getTarget() instanceof PrivilegeEditedRoleProvider) { + PrivilegeEditedRoleProvider pe = (PrivilegeEditedRoleProvider) jt.getTarget(); + ExpandMutableTreeNode[] expand = t.load(Arrays.asList(pe.getAllEditedRoleSet())); + for (ExpandMutableTreeNode expandMutableTreeNode : expand) { + roleList.add(expandMutableTreeNode); + } + } + } + return roleList.toArray(new ExpandMutableTreeNode[roleList.size()]); + } } \ No newline at end of file From c7991b85406af1f28374b77d497e5e1709e32ccc Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Fri, 10 Sep 2021 14:41:20 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-57898=20=E3=80=90=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E3=80=91=E8=BF=9B=E5=85=A5=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=97=B6=E6=89=93=E5=BC=80frm/=E5=A4=A7?= =?UTF-8?q?=E5=B1=8F=E6=A8=A1=E6=9D=BF/=E7=89=88=E6=9C=AC=E7=AE=A1?= =?UTF-8?q?=E7=90=86=EF=BC=8C=E5=86=8D=E5=9B=9E=E5=88=B0=E5=8E=9F=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=EF=BC=8C=E6=97=A0=E6=B3=95=E9=80=80=E5=87=BA=E6=9D=83?= =?UTF-8?q?=E9=99=90=E7=BC=96=E8=BE=91=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/DesignerFrame.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 8c9c3afdfb..798441c536 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -802,6 +802,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param jt 添加的模板. */ public void addAndActivateJTemplate(JTemplate jt) { + DesignModeContext.switchTo(DesignerMode.NORMAL); JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); if (currentEditingTemplate != null) { currentEditingTemplate.stopEditing(); @@ -988,7 +989,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @date 2014-10-14-下午6:31:05 */ private void openFile(FILE tplFile) { - DesignModeContext.switchTo(DesignerMode.NORMAL); //切换文件后清空FixedPopupPane面板 EastRegionContainerPane.getInstance().clearCurrentPopupPane(); if (tplFile != null) { From eb2ea8eccf54c9979f0fa01270bcd7b8b55a9849 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Fri, 10 Sep 2021 16:50:21 +0800 Subject: [PATCH 3/3] =?UTF-8?q?REPORT-57898=20=E3=80=90=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E3=80=91=E8=BF=9B=E5=85=A5=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=97=B6=E6=89=93=E5=BC=80frm/=E5=A4=A7?= =?UTF-8?q?=E5=B1=8F=E6=A8=A1=E6=9D=BF/=E7=89=88=E6=9C=AC=E7=AE=A1?= =?UTF-8?q?=E7=90=86=EF=BC=8C=E5=86=8D=E5=9B=9E=E5=88=B0=E5=8E=9F=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=EF=BC=8C=E6=97=A0=E6=B3=95=E9=80=80=E5=87=BA=E6=9D=83?= =?UTF-8?q?=E9=99=90=E7=BC=96=E8=BE=91=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/base/mode/DesignModeContext.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java b/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java index 8bb5862716..8cf38d00ff 100644 --- a/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java +++ b/designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java @@ -48,7 +48,6 @@ public class DesignModeContext { * @return 是否为权限编辑 */ public static boolean isAuthorityEditing() { - //System.out.println("isAuthorityEditing:"+(mode == AUTHORITY)); return mode == AUTHORITY; }