From 721c4eb89784771a1bc4e4fc972c9face0c3fb3d Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 4 Dec 2017 18:26:33 +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>3=3D>=E4=B8=8A?= =?UTF-8?q?=E7=A7=BB=E3=80=81=E4=B8=8B=E7=A7=BB=E3=80=81=E7=BD=AE=E9=A1=B6?= =?UTF-8?q?=E3=80=81=E7=BD=AE=E5=BA=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beans/actions/MoveDownAction.java | 19 ++++++++++++++++--- .../beans/actions/MoveToBottomAction.java | 19 ++++++++++++++++--- .../beans/actions/MoveToTopAction.java | 18 +++++++++++++++--- .../designer/beans/actions/MoveUpAction.java | 19 ++++++++++++++++--- .../designer/beans/events/DesignerEvent.java | 2 ++ .../com/fr/design/mainframe/FormDesigner.java | 1 - .../design/mainframe/WidgetPropertyPane.java | 2 +- 7 files changed, 66 insertions(+), 14 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/beans/actions/MoveDownAction.java b/designer_form/src/com/fr/design/designer/beans/actions/MoveDownAction.java index a9c22e5816..7310016620 100644 --- a/designer_form/src/com/fr/design/designer/beans/actions/MoveDownAction.java +++ b/designer_form/src/com/fr/design/designer/beans/actions/MoveDownAction.java @@ -1,10 +1,14 @@ package com.fr.design.designer.beans.actions; import com.fr.base.BaseUtils; +import com.fr.design.designer.beans.events.DesignerEvent; +import com.fr.design.designer.creator.XCreator; import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.FormSelection; import com.fr.general.Inter; import javax.swing.*; +import java.awt.*; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; @@ -27,11 +31,20 @@ public class MoveDownAction extends FormEditAction { @Override public boolean executeActionReturnUndoRecordNeeded() { - FormDesigner editPane = getEditingComponent(); - if (editPane == null) { + FormDesigner designer = getEditingComponent(); + if (designer == null) { return false; } - return editPane.cut(); + FormSelection selection = designer.getSelectionModel().getSelection(); + XCreator creator = selection.getSelectedCreator(); + Container container = creator.getParent(); + int targetIndex = container.getComponentZOrder(creator) + 1; + if (targetIndex >= container.getComponentCount()) { + return false; + } + container.setComponentZOrder(creator, targetIndex); + designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_DELETED); + return true; } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/beans/actions/MoveToBottomAction.java b/designer_form/src/com/fr/design/designer/beans/actions/MoveToBottomAction.java index 68b6e021ca..ac1ab74b5a 100644 --- a/designer_form/src/com/fr/design/designer/beans/actions/MoveToBottomAction.java +++ b/designer_form/src/com/fr/design/designer/beans/actions/MoveToBottomAction.java @@ -1,10 +1,14 @@ package com.fr.design.designer.beans.actions; import com.fr.base.BaseUtils; +import com.fr.design.designer.beans.events.DesignerEvent; +import com.fr.design.designer.creator.XCreator; import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.FormSelection; import com.fr.general.Inter; import javax.swing.*; +import java.awt.*; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; @@ -27,11 +31,20 @@ public class MoveToBottomAction extends FormEditAction { @Override public boolean executeActionReturnUndoRecordNeeded() { - FormDesigner editPane = getEditingComponent(); - if (editPane == null) { + FormDesigner designer = getEditingComponent(); + if (designer == null) { return false; } - return editPane.cut(); + FormSelection selection = designer.getSelectionModel().getSelection(); + XCreator creator = selection.getSelectedCreator(); + Container container = creator.getParent(); + int targetIndex = container.getComponentCount() - 1; + if (container.getComponentZOrder(creator) >= targetIndex) { + return false; + } + container.setComponentZOrder(creator, targetIndex); + designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_DELETED); + return true; } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/beans/actions/MoveToTopAction.java b/designer_form/src/com/fr/design/designer/beans/actions/MoveToTopAction.java index 8d588bc44c..8a37926936 100644 --- a/designer_form/src/com/fr/design/designer/beans/actions/MoveToTopAction.java +++ b/designer_form/src/com/fr/design/designer/beans/actions/MoveToTopAction.java @@ -1,10 +1,14 @@ package com.fr.design.designer.beans.actions; import com.fr.base.BaseUtils; +import com.fr.design.designer.beans.events.DesignerEvent; +import com.fr.design.designer.creator.XCreator; import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.FormSelection; import com.fr.general.Inter; import javax.swing.*; +import java.awt.*; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; @@ -27,11 +31,19 @@ public class MoveToTopAction extends FormEditAction { @Override public boolean executeActionReturnUndoRecordNeeded() { - FormDesigner editPane = getEditingComponent(); - if (editPane == null) { + FormDesigner designer = getEditingComponent(); + if (designer == null) { return false; } - return editPane.cut(); + FormSelection selection = designer.getSelectionModel().getSelection(); + XCreator creator = selection.getSelectedCreator(); + Container container = creator.getParent(); + if (container.getComponentZOrder(creator) == 0) { + return false; + } + container.setComponentZOrder(creator, 0); + designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_DELETED); + return true; } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/beans/actions/MoveUpAction.java b/designer_form/src/com/fr/design/designer/beans/actions/MoveUpAction.java index 1fd2194ce5..b86e9807a9 100644 --- a/designer_form/src/com/fr/design/designer/beans/actions/MoveUpAction.java +++ b/designer_form/src/com/fr/design/designer/beans/actions/MoveUpAction.java @@ -1,10 +1,14 @@ package com.fr.design.designer.beans.actions; import com.fr.base.BaseUtils; +import com.fr.design.designer.beans.events.DesignerEvent; +import com.fr.design.designer.creator.XCreator; import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.FormSelection; import com.fr.general.Inter; import javax.swing.*; +import java.awt.*; import java.awt.event.KeyEvent; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; @@ -26,11 +30,20 @@ public class MoveUpAction extends FormEditAction { @Override public boolean executeActionReturnUndoRecordNeeded() { - FormDesigner editPane = getEditingComponent(); - if (editPane == null) { + FormDesigner designer = getEditingComponent(); + if (designer == null) { return false; } - return editPane.cut(); + FormSelection selection = designer.getSelectionModel().getSelection(); + XCreator creator = selection.getSelectedCreator(); + Container container = creator.getParent(); + int targetIndex = container.getComponentZOrder(creator) - 1; + if (targetIndex < 0) { + return false; + } + container.setComponentZOrder(creator, targetIndex); + designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_DELETED); + return true; } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/beans/events/DesignerEvent.java b/designer_form/src/com/fr/design/designer/beans/events/DesignerEvent.java index 715f6e3e7b..d9b32b360c 100644 --- a/designer_form/src/com/fr/design/designer/beans/events/DesignerEvent.java +++ b/designer_form/src/com/fr/design/designer/beans/events/DesignerEvent.java @@ -23,6 +23,8 @@ public class DesignerEvent { public static final int CREATOR_RENAMED = 8; + public static final int CREATOR_ORDER_CHANGED = 9; + private int eventID; private XComponent affectedXCreator; diff --git a/designer_form/src/com/fr/design/mainframe/FormDesigner.java b/designer_form/src/com/fr/design/mainframe/FormDesigner.java index 9d6e81e4c3..b24da9268c 100644 --- a/designer_form/src/com/fr/design/mainframe/FormDesigner.java +++ b/designer_form/src/com/fr/design/mainframe/FormDesigner.java @@ -213,7 +213,6 @@ public class FormDesigner extends TargetComponent
implements TreeSelection } } - /** * 是否有查询按钮 * diff --git a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java index e76c041414..75a1bed357 100644 --- a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java @@ -395,7 +395,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope */ public void fireCreatorModified(DesignerEvent evt) { int[] validEventIds = {DesignerEvent.CREATOR_RESIZED, DesignerEvent.CREATOR_EDITED, - DesignerEvent.CREATOR_SELECTED, DesignerEvent.CREATOR_ADDED}; + DesignerEvent.CREATOR_SELECTED, DesignerEvent.CREATOR_ADDED, DesignerEvent.CREATOR_ORDER_CHANGED}; boolean isValid = false; for (int validEventId : validEventIds) { if (evt.getCreatorEventID() == validEventId) {