Browse Source

REPORT-4634 组件叠加体验优化=>3=>处理操作置灰的情况

master
plough 7 years ago
parent
commit
15496270fe
  1. 9
      designer_form/src/com/fr/design/designer/beans/actions/MoveDownAction.java
  2. 10
      designer_form/src/com/fr/design/designer/beans/actions/MoveToBottomAction.java
  3. 10
      designer_form/src/com/fr/design/designer/beans/actions/MoveToTopAction.java
  4. 10
      designer_form/src/com/fr/design/designer/beans/actions/MoveUpAction.java
  5. 28
      designer_form/src/com/fr/design/designer/creator/XCreator.java
  6. 4
      designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java
  7. 6
      designer_form/src/com/fr/design/designer/creator/XWFitLayout.java
  8. 5
      designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java
  9. 5
      designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java
  10. 25
      designer_form/src/com/fr/design/mainframe/FormDesigner.java

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

@ -47,4 +47,13 @@ public class MoveDownAction extends FormEditAction {
return true;
}
@Override
public void update() {
FormDesigner designer = getEditingComponent();
if (designer == null) {
this.setEnabled(false);
return;
}
this.setEnabled(designer.isCurrentComponentMovableDown());
}
}

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

@ -47,4 +47,14 @@ public class MoveToBottomAction extends FormEditAction {
return true;
}
@Override
public void update() {
FormDesigner designer = getEditingComponent();
if (designer == null) {
this.setEnabled(false);
return;
}
this.setEnabled(designer.isCurrentComponentMovableDown());
}
}

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

@ -46,4 +46,14 @@ public class MoveToTopAction extends FormEditAction {
return true;
}
@Override
public void update() {
FormDesigner designer = getEditingComponent();
if (designer == null) {
this.setEnabled(false);
return;
}
this.setEnabled(designer.isCurrentComponentMovableUp());
}
}

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

@ -46,4 +46,14 @@ public class MoveUpAction extends FormEditAction {
return true;
}
@Override
public void update() {
FormDesigner designer = getEditingComponent();
if (designer == null) {
this.setEnabled(false);
return;
}
this.setEnabled(designer.isCurrentComponentMovableUp());
}
}

28
designer_form/src/com/fr/design/designer/creator/XCreator.java

@ -4,6 +4,7 @@
package com.fr.design.designer.creator;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.actions.*;
@ -48,8 +49,9 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
private Rectangle backupBound;
private String shareId = StringUtils.EMPTY;//如果组件是共享的会有这个属性
private boolean isHelpBtnOnFocus = false;//焦点是否在帮助按钮上
private static final int SHORTS_SEPARATOR_POS = 4; // 弹出菜单分割的位置
public XCreator(Widget ob, Dimension initSize) {
public XCreator(Widget ob, Dimension initSize) {
this.data = ob;
this.initEditor();
@ -670,17 +672,23 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
*
*/
public JPopupMenu createPopupMenu(FormDesigner formDesigner) {
UpdateAction[] actions = formDesigner.getActions();
JPopupMenu popup = new JPopupMenu();
popup.add(new CutAction(formDesigner).createMenuItem());
popup.add(new CopyAction(formDesigner).createMenuItem());
popup.add(new PasteAction(formDesigner).createMenuItem());
popup.add(new FormDeleteAction(formDesigner).createMenuItem());
popup.addSeparator();
popup.add(new MoveToTopAction(formDesigner).createMenuItem());
popup.add(new MoveToBottomAction(formDesigner).createMenuItem());
popup.add(new MoveUpAction(formDesigner).createMenuItem());
popup.add(new MoveDownAction(formDesigner).createMenuItem());
for (int i = 0; i < actions.length; i++) {
if (i == SHORTS_SEPARATOR_POS) {
popup.addSeparator();
}
popup.add(actions[i].createMenuItem());
}
return popup;
}
/**
* 是否支持上移一层下移一层等操作
*
*/
public boolean isMovable() {
return true;
}
}

4
designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java

@ -107,5 +107,9 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout {
initStyle();
}
@Override
public boolean isMovable() {
return false;
}
}

6
designer_form/src/com/fr/design/designer/creator/XWFitLayout.java

@ -1180,5 +1180,9 @@ public class XWFitLayout extends XLayoutContainer {
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[]{ new BodyMobilePropertyUI(this)};
}
@Override
public boolean isMovable() {
return false;
}
}

5
designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java

@ -227,4 +227,9 @@ public class XWParameterLayout extends XWAbsoluteLayout {
}
@Override
public boolean isMovable() {
return false;
}
}

5
designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java

@ -22,6 +22,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.Parameter;
import com.fr.base.parameter.ParameterUI;
import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction;
import com.fr.design.designer.beans.actions.CopyAction;
import com.fr.design.designer.beans.actions.CutAction;
import com.fr.design.designer.beans.actions.FormDeleteAction;
@ -322,9 +323,9 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
*
* @return 同上
*/
public Action[] getActions() {
public UpdateAction[] getActions() {
if (designerActions == null) {
designerActions = new Action[]{new CutAction(this), new CopyAction(this), new PasteAction(this),
designerActions = new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this),
new FormDeleteAction(this)};
}
return designerActions;

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

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.Parameter;
import com.fr.base.ScreenResolution;
import com.fr.design.DesignState;
import com.fr.design.actions.UpdateAction;
import com.fr.design.designer.TargetComponent;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.Painter;
@ -105,7 +106,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
private int resolution = ScreenResolution.getScreenResolution();
// 编辑状态的事件表
private CreatorEventListenerTable edit;
protected Action[] designerActions;
protected UpdateAction[] designerActions;
private FormDesignerModeForSpecial<?> desigerMode;
private Action switchAction;
private FormElementCaseContainerProvider elementCaseContainer;
@ -668,6 +669,10 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
setParameterArray(getNoRepeatParas(getTarget().getParameters()));
refreshParameter();
}
} else {
for( UpdateAction action : getActions()) {
action.update();
}
}
}
@ -1122,15 +1127,29 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
*
* @return 同上
*/
public Action[] getActions() {
public UpdateAction[] getActions() {
if (designerActions == null) {
designerActions = new Action[]{new CutAction(this), new CopyAction(this), new PasteAction(this),
designerActions = new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this),
new FormDeleteAction(this), new MoveToTopAction(this), new MoveToBottomAction(this),
new MoveUpAction(this), new MoveDownAction(this)};
}
return designerActions;
}
// 当前选中控件可以上移一层吗?
public boolean isCurrentComponentMovableUp() {
XCreator creator = getSelectionModel().getSelection().getSelectedCreator();
Container container = creator.getParent();
return creator.isMovable() && container.getComponentZOrder(creator) > 0;
}
// 当前选中控件可以下移一层吗?
public boolean isCurrentComponentMovableDown() {
XCreator creator = getSelectionModel().getSelection().getSelectedCreator();
Container container = creator.getParent();
return creator.isMovable() && container.getComponentZOrder(creator) < container.getComponentCount() - 1;
}
protected Border getOuterBorder() {
return XCreatorConstants.AREA_BORDER;
}

Loading…
Cancel
Save