diff --git a/designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java b/designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java index e805ced3c..e0236800e 100644 --- a/designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java @@ -68,7 +68,10 @@ public class SelectionModel { } // 获取e所在的组件 XCreator comp = designer.getComponentAt(e); + selectACreator(comp); + } + public void selectACreator(XCreator comp) { //布局组件的顶层布局如不可编辑,要获取其顶层布局 XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(comp).getTopLayout(); if (topLayout != null && !topLayout.isEditable()) { diff --git a/designer_form/src/com/fr/design/designer/creator/XChartEditor.java b/designer_form/src/com/fr/design/designer/creator/XChartEditor.java index 8e108ec94..750e2ae38 100644 --- a/designer_form/src/com/fr/design/designer/creator/XChartEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XChartEditor.java @@ -76,6 +76,11 @@ public class XChartEditor extends XBorderStyleWidgetCreator { return true; } + @Override + public void stopEditing() { + isEditing = false; + } + /** * 得到属性名 * @return 属性名 diff --git a/designer_form/src/com/fr/design/designer/creator/XCreator.java b/designer_form/src/com/fr/design/designer/creator/XCreator.java index b46d9d233..99f3267d0 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCreator.java +++ b/designer_form/src/com/fr/design/designer/creator/XCreator.java @@ -653,7 +653,15 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo * */ public void firePropertyChange(){ - + // do nothing } + /** + * 有的控件是有编辑状态的,给一个退出编辑的接口 + * + */ + public void stopEditing() { + // do nothing + } + } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java index 86da3586b..7d606b66c 100644 --- a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java @@ -489,6 +489,14 @@ public class EditingMouseListener extends MouseInputAdapter { return false; } + // 点击控件树,会触发此方法。如果在设计器中选中组件,则直接走 processTopLayoutMouseClick + public void stopEditTopLayout(XCreator creator) { + if (clickTopLayout != null && clickTopLayout.equals(creator)) { + clickTopLayout.setEditable(false); + } + processTopLayoutMouseClick(creator); + } + public XCreator processTopLayoutMouseClick(XCreator creator) { XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(creator).getTopLayout(); if (topLayout != null) { @@ -589,6 +597,7 @@ public class EditingMouseListener extends MouseInputAdapter { } designer.invalidate(); designer.repaint(); + currentXCreator.stopEditing(); currentXCreator = null; currentEditor = null; return true; diff --git a/designer_form/src/com/fr/design/mainframe/FormDesigner.java b/designer_form/src/com/fr/design/mainframe/FormDesigner.java index 5b9fea9ac..e65131061 100644 --- a/designer_form/src/com/fr/design/mainframe/FormDesigner.java +++ b/designer_form/src/com/fr/design/mainframe/FormDesigner.java @@ -1240,8 +1240,12 @@ public class FormDesigner extends TargetComponent