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..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 @@ -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() { 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/gui/ifilechooser/JavaFxNativeFileChooser.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java index 8be4678106..452deb5c8d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java @@ -67,6 +67,9 @@ public class JavaFxNativeFileChooser implements FileChooserProvider { fileChooserParent = DesignerContext.getDesignerFrame(); } Stage stage = showCoverStage(fileChooserParent); + if (stage != null) { + stage.setAlwaysOnTop(true); + } try { if (fileSelectionMode == FileSelectionMode.FILE || fileSelectionMode == FileSelectionMode.MULTIPLE_FILE) { FileChooser fileChooser = new FileChooser(); 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..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 @@ -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. * @@ -796,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(); @@ -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 diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index e825285585..87a1926cbb 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -787,7 +787,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo int formDesignerWidth = designer.getWidth(); int formDesignerHeight = designer.getHeight(); // 不超过可绘制区域 - int extraX = Math.min(creatorRightX, formDesignerWidth); + int extraX = creatorRightX < 0 ? 0 : Math.min(creatorRightX, formDesignerWidth); int extraY = creatorRightY < 0 ? 0 : Math.min(creatorRightY, formDesignerHeight); if (designer.isFormParaDesigner() && extraY + this.getHeight() >= formDesignerHeight) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java index f28e2c9840..286890303e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java @@ -21,6 +21,8 @@ import com.fr.form.main.Form; import com.fr.form.ui.container.WBorderLayout; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; +import com.fr.report.util.ReadXmlType; +import com.fr.report.util.ReadXmlTypeLocalManager; import com.fr.stable.Constants; import com.fr.stable.bridge.StableFactory; import org.jetbrains.annotations.Nullable; @@ -90,13 +92,16 @@ class FormApp extends AbstractAppProvider { @Nullable private Form getForm(FILE tplFile) { + ReadXmlTypeLocalManager.setReadXmlType(ReadXmlType.DESIGN); Form form = asIOFile(tplFile); + ReadXmlTypeLocalManager.remove(); if (form != null) { DesignerAppUtils.dealWithTemplateIOError(tplFile.getPath()); } return form; } + @Override public Form asIOFile(FILE file) {