Browse Source

Pull request #5788: REPORT-57898 【权限编辑】进入权限编辑时打开frm/大屏模板/版本管理,再回到原模板,无法退出权限编辑状态

Merge in DESIGN/design from ~HENRY.WANG/design:release/10.0 to release/10.0

* commit 'eb2ea8eccf54c9979f0fa01270bcd7b8b55a9849':
  REPORT-57898 【权限编辑】进入权限编辑时打开frm/大屏模板/版本管理,再回到原模板,无法退出权限编辑状态
  REPORT-57898 【权限编辑】进入权限编辑时打开frm/大屏模板/版本管理,再回到原模板,无法退出权限编辑状态
  REPORT-57898 【权限编辑】进入权限编辑时打开frm/大屏模板/版本管理,再回到原模板,无法退出权限编辑状态
zheng-1641779399395
Henry.Wang 3 years ago
parent
commit
f5c607ac95
  1. 10
      designer-base/src/main/java/com/fr/design/base/mode/DesignModeContext.java
  2. 20
      designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java
  3. 3
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  4. 11
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  5. 3
      designer-base/src/main/java/com/fr/design/roleAuthority/RolesEditedSourceOP.java

10
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; private static DesignerMode mode = DesignerMode.NORMAL;
public static void switchTo(DesignerMode mode) { 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() { public static DesignerMode getMode() {

20
designer-base/src/main/java/com/fr/design/base/mode/DesignerMode.java

@ -1,9 +1,25 @@
package com.fr.design.base.mode; package com.fr.design.base.mode;
import com.fr.design.mainframe.DesignerContext;
public enum DesignerMode { public enum DesignerMode {
NORMAL, NORMAL,
BAN_COPY_AND_CUT, BAN_COPY_AND_CUT,
VCS, VCS,
AUTHORITY, AUTHORITY {
DUCHAMP @Override
public void closeMode() {
DesignerContext.getDesignerFrame().closeAuthorityMode();
}
},
DUCHAMP;
public void openMode() {
}
public void closeMode() {
}
} }

3
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.base.io.BaseBook;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.base.mode.DesignerMode;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.file.filter.ClassFilter; import com.fr.design.file.filter.ClassFilter;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -69,7 +70,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
DesignTableDataManager.closeTemplate(selected); DesignTableDataManager.closeTemplate(selected);
//直接关闭模板的时候(当且仅当设计器tab上只剩一个模板)退出权限编辑 //直接关闭模板的时候(当且仅当设计器tab上只剩一个模板)退出权限编辑
if (DesignModeContext.isAuthorityEditing() && historyList.size() <= 1) { if (DesignModeContext.isAuthorityEditing() && historyList.size() <= 1) {
DesignerContext.getDesignerFrame().closeAuthorityEditing(); DesignModeContext.switchTo(DesignerMode.NORMAL);
} }
if (contains(selected) == -1) { if (contains(selected) == -1) {
return; return;

11
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.ExtraDesignClassManager;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.base.mode.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
@ -219,7 +220,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
@Override @Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
if (DesignModeContext.isAuthorityEditing()) { if (DesignModeContext.isAuthorityEditing()) {
closeAuthorityEditing(); DesignModeContext.switchTo(DesignerMode.NORMAL);
} }
} }
@ -299,8 +300,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().doResize(); HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().doResize();
} }
@Deprecated
public void closeAuthorityEditing() { public void closeAuthorityEditing() {
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); DesignModeContext.switchTo(DesignerMode.NORMAL);
}
public void closeAuthorityMode() {
WestRegionContainerPane.getInstance().replaceDownPane( WestRegionContainerPane.getInstance().replaceDownPane(
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
@ -312,6 +317,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
EventDispatcher.fire(DesignAuthorityEventType.StopEdit, DesignerFrame.this); EventDispatcher.fire(DesignAuthorityEventType.StopEdit, DesignerFrame.this);
} }
/** /**
* 注册app. * 注册app.
* *
@ -796,6 +802,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 添加的模板. * @param jt 添加的模板.
*/ */
public void addAndActivateJTemplate(JTemplate<?, ?> jt) { public void addAndActivateJTemplate(JTemplate<?, ?> jt) {
DesignModeContext.switchTo(DesignerMode.NORMAL);
JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (currentEditingTemplate != null) { if (currentEditingTemplate != null) {
currentEditingTemplate.stopEditing(); currentEditingTemplate.stopEditing();

3
designer-base/src/main/java/com/fr/design/roleAuthority/RolesEditedSourceOP.java

@ -26,13 +26,14 @@ public class RolesEditedSourceOP extends RoleSourceOP {
RoleDataWrapper t = entry.getValue(); RoleDataWrapper t = entry.getValue();
JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt.getTarget() instanceof PrivilegeEditedRoleProvider) {
PrivilegeEditedRoleProvider pe = (PrivilegeEditedRoleProvider) jt.getTarget(); PrivilegeEditedRoleProvider pe = (PrivilegeEditedRoleProvider) jt.getTarget();
ExpandMutableTreeNode[] expand = t.load(Arrays.asList(pe.getAllEditedRoleSet())); ExpandMutableTreeNode[] expand = t.load(Arrays.asList(pe.getAllEditedRoleSet()));
for (ExpandMutableTreeNode expandMutableTreeNode : expand) { for (ExpandMutableTreeNode expandMutableTreeNode : expand) {
roleList.add(expandMutableTreeNode); roleList.add(expandMutableTreeNode);
} }
} }
}
return roleList.toArray(new ExpandMutableTreeNode[roleList.size()]); return roleList.toArray(new ExpandMutableTreeNode[roleList.size()]);
} }
} }
Loading…
Cancel
Save