Browse Source

REPORT-4634 组件叠加体验优化=>3=>上移、下移、置顶、置底

master
plough 7 years ago
parent
commit
721c4eb897
  1. 19
      designer_form/src/com/fr/design/designer/beans/actions/MoveDownAction.java
  2. 19
      designer_form/src/com/fr/design/designer/beans/actions/MoveToBottomAction.java
  3. 18
      designer_form/src/com/fr/design/designer/beans/actions/MoveToTopAction.java
  4. 19
      designer_form/src/com/fr/design/designer/beans/actions/MoveUpAction.java
  5. 2
      designer_form/src/com/fr/design/designer/beans/events/DesignerEvent.java
  6. 1
      designer_form/src/com/fr/design/mainframe/FormDesigner.java
  7. 2
      designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java

19
designer_form/src/com/fr/design/designer/beans/actions/MoveDownAction.java

@ -1,10 +1,14 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils; 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.FormDesigner;
import com.fr.design.mainframe.FormSelection;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
import java.awt.event.InputEvent; import java.awt.event.InputEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
@ -27,11 +31,20 @@ public class MoveDownAction extends FormEditAction {
@Override @Override
public boolean executeActionReturnUndoRecordNeeded() { public boolean executeActionReturnUndoRecordNeeded() {
FormDesigner editPane = getEditingComponent(); FormDesigner designer = getEditingComponent();
if (editPane == null) { if (designer == null) {
return false; 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;
} }
} }

19
designer_form/src/com/fr/design/designer/beans/actions/MoveToBottomAction.java

@ -1,10 +1,14 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils; 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.FormDesigner;
import com.fr.design.mainframe.FormSelection;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
import java.awt.event.InputEvent; import java.awt.event.InputEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
@ -27,11 +31,20 @@ public class MoveToBottomAction extends FormEditAction {
@Override @Override
public boolean executeActionReturnUndoRecordNeeded() { public boolean executeActionReturnUndoRecordNeeded() {
FormDesigner editPane = getEditingComponent(); FormDesigner designer = getEditingComponent();
if (editPane == null) { if (designer == null) {
return false; 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;
} }
} }

18
designer_form/src/com/fr/design/designer/beans/actions/MoveToTopAction.java

@ -1,10 +1,14 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils; 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.FormDesigner;
import com.fr.design.mainframe.FormSelection;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
import java.awt.event.InputEvent; import java.awt.event.InputEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
@ -27,11 +31,19 @@ public class MoveToTopAction extends FormEditAction {
@Override @Override
public boolean executeActionReturnUndoRecordNeeded() { public boolean executeActionReturnUndoRecordNeeded() {
FormDesigner editPane = getEditingComponent(); FormDesigner designer = getEditingComponent();
if (editPane == null) { if (designer == null) {
return false; 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;
} }
} }

19
designer_form/src/com/fr/design/designer/beans/actions/MoveUpAction.java

@ -1,10 +1,14 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils; 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.FormDesigner;
import com.fr.design.mainframe.FormSelection;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
@ -26,11 +30,20 @@ public class MoveUpAction extends FormEditAction {
@Override @Override
public boolean executeActionReturnUndoRecordNeeded() { public boolean executeActionReturnUndoRecordNeeded() {
FormDesigner editPane = getEditingComponent(); FormDesigner designer = getEditingComponent();
if (editPane == null) { if (designer == null) {
return false; 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;
} }
} }

2
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_RENAMED = 8;
public static final int CREATOR_ORDER_CHANGED = 9;
private int eventID; private int eventID;
private XComponent affectedXCreator; private XComponent affectedXCreator;

1
designer_form/src/com/fr/design/mainframe/FormDesigner.java

@ -213,7 +213,6 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
} }
/** /**
* 是否有查询按钮 * 是否有查询按钮
* *

2
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) { public void fireCreatorModified(DesignerEvent evt) {
int[] validEventIds = {DesignerEvent.CREATOR_RESIZED, DesignerEvent.CREATOR_EDITED, 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; boolean isValid = false;
for (int validEventId : validEventIds) { for (int validEventId : validEventIds) {
if (evt.getCreatorEventID() == validEventId) { if (evt.getCreatorEventID() == validEventId) {

Loading…
Cancel
Save