From 9ed353d15eae73778329633a9db1f377dd165802 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 14 Sep 2022 14:44:56 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-75998=20=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E3=80=81=E8=8F=9C=E5=8D=95=E6=8F=92=E5=85=A5=E3=80=81=E5=BF=AB?= =?UTF-8?q?=E6=8D=B7=E9=94=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/toolbar/ToolBarMenuDock.java | 8 +++++++ .../fr/design/module/DesignModuleFactory.java | 7 ++++++ .../com/fr/design/actions/NewFormAction.java | 2 +- .../designer/beans/models/SelectionModel.java | 23 +++++++++++++++++++ .../main/java/com/fr/design/fit/NewJForm.java | 4 ++-- 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 6aabb9ff53..6a83a159b8 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -60,6 +60,7 @@ import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; +import com.fr.design.module.DesignModuleFactory; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.update.actions.SoftwareUpdateAction; @@ -579,6 +580,13 @@ public abstract class ToolBarMenuDock { } shortCuts.add(new AboutAction()); + try { + if (DesignModuleFactory.getITReplaceAction() != null) { + shortCuts.add((ShortCut) DesignModuleFactory.getITReplaceAction().newInstance()); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } return shortCuts.toArray(new ShortCut[0]); } diff --git a/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java index 5ff882f642..ab751296d3 100644 --- a/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java +++ b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java @@ -47,6 +47,7 @@ public class DesignModuleFactory { private Class autoChartDialogClass; private Class chartPropertyPaneClass; private Class newFormAction; + private Class ITReplaceAction; private Class formParaDesigner; private Class paraPropertyPane; private Class formHierarchyPaneCls; @@ -116,6 +117,12 @@ public class DesignModuleFactory { public static Class getNewFormAction() { return instance.newFormAction; } + public static void registerReplaceActionClass(Class r){ + instance.ITReplaceAction = r; + } + public static Class getITReplaceAction(){ + return instance.ITReplaceAction; + } public static void registerParaPropertyPaneClass(Class p) { instance.paraPropertyPane = p; diff --git a/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java b/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java index 5ce51b673c..aa50c13f69 100644 --- a/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java @@ -43,7 +43,7 @@ public class NewFormAction extends UpdateAction { @Override public KeyStroke getKeyStroke() { - return KeyStroke.getKeyStroke(KeyEvent.VK_F, DEFAULT_MODIFIER); + return null; } }; } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java index 997af89c70..f75e08d723 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java @@ -131,6 +131,29 @@ public class SelectionModel { } } + /** + * 用于强制定位所需组件,不对布局组件的顶层布局进行编辑判定,即使上层未展开或者未处于编辑状态依然可以强制跳转到对应的子组件 + * @param comp 设计组件 + */ + public void selectACreator4ITLocation(XCreator comp) { + // 如果父层是scale和title两个专属容器,返回其父层,组件本身是不让被选中的 + if (comp != designer.getRootComponent() && comp != designer.getParaComponent()) { + dealParentContainer(comp); + } + if (selection.removeSelectedCreator(comp) || selection.addSelectedCreator(comp)) { + designer.getEditListenerTable().fireCreatorModified(comp, DesignerEvent.CREATOR_SELECTED); + designer.repaint(); + } + } + + private void dealParentContainer(XCreator comp) { + XCreator parentContainer = (XCreator) comp.getParent(); + if (parentContainer != null) { + comp = parentContainer.isDedicateContainer() || comp instanceof XCardSwitchButton ? parentContainer : comp; + } + + } + /** * 将所选组件剪切到剪切板上 */ diff --git a/designer-form/src/main/java/com/fr/design/fit/NewJForm.java b/designer-form/src/main/java/com/fr/design/fit/NewJForm.java index 314097bcf1..62c38ca22d 100644 --- a/designer-form/src/main/java/com/fr/design/fit/NewJForm.java +++ b/designer-form/src/main/java/com/fr/design/fit/NewJForm.java @@ -243,7 +243,7 @@ public class NewJForm extends JForm { return; } if (xCreator instanceof XElementCase) { - getFormDesign().getSelectionModel().selectACreator(xCreator); + getFormDesign().getSelectionModel().selectACreator4ITLocation(xCreator); xCreator.startEditing(); if (getElementCaseDesign() != null) { getElementCaseDesign().navigate(trl); @@ -251,7 +251,7 @@ public class NewJForm extends JForm { } else { tabChanged(FORM_TAB); getFormDesign().getSelectionModel().reset(); - getFormDesign().getSelectionModel().selectACreator(xCreator); + getFormDesign().getSelectionModel().selectACreator4ITLocation(xCreator); } }, XCreator.class); }