From dc75b01e11c44ccfa103802f6ea6178d3e305c35 Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 1 Dec 2017 14:24:46 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-4634=20=E7=BB=84=E4=BB=B6=E5=8F=A0?= =?UTF-8?q?=E5=8A=A0=E4=BD=93=E9=AA=8C=E4=BC=98=E5=8C=96=3D>1=3D>=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E6=A0=91=E4=B8=AD=E7=82=B9=E5=87=BB=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E5=9D=97=E8=87=AA=E8=BA=AB=E3=80=81=E7=BB=9D=E5=AF=B9=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E8=87=AA=E8=BA=AB=EF=BC=8C=E5=8F=AF=E9=80=80=E5=87=BA?= =?UTF-8?q?=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/designer/beans/models/SelectionModel.java | 3 +++ .../com/fr/design/designer/creator/XChartEditor.java | 5 +++++ .../src/com/fr/design/designer/creator/XCreator.java | 10 +++++++++- .../com/fr/design/mainframe/EditingMouseListener.java | 9 +++++++++ .../src/com/fr/design/mainframe/FormDesigner.java | 6 +++++- 5 files changed, 31 insertions(+), 2 deletions(-) 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 e805ced3ca..e0236800eb 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 8e108ec945..750e2ae38f 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 b46d9d2335..99f3267d04 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 86da3586b1..7d606b66c8 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 5b9fea9acb..e651310610 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
implements TreeSelection public void stopEditing(TreePath path) { // do nothing + XCreator comp = (XCreator) path.getLastPathComponent(); editingMouseListener.stopEditing(); - editingMouseListener.processTopLayoutMouseClick((XCreator) path.getLastPathComponent()); + editingMouseListener.stopEditTopLayout(comp); + + editingMouseListener.getSelectionModel().reset(); + editingMouseListener.getSelectionModel().selectACreator(comp); } /**