Browse Source

Merge branch 'release/10.0' of https://code.fineres.com/scm/~henry.wang/design into release/10.0

zheng-1641779399395
Henry.Wang 3 years ago
parent
commit
5adf17a737
  1. 3
      designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java
  2. 5
      designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java
  3. 3
      designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java
  4. 6
      designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java
  5. 16
      designer-form/src/main/java/com/fr/design/designer/beans/actions/behavior/CopyableEnable.java
  6. 16
      designer-form/src/main/java/com/fr/design/designer/beans/actions/behavior/CutableEnable.java
  7. 16
      designer-form/src/main/java/com/fr/design/designer/beans/actions/behavior/DeletableEnable.java
  8. 8
      designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java
  9. 17
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

3
designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java vendored

@ -3,6 +3,7 @@ package com.fr.design.env;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.locale.InterProviderFactory; import com.fr.locale.InterProviderFactory;
import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
@ -107,7 +108,7 @@ public class LocalDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
File engineLib = new File(StableUtils.pathJoin(this.path, ProjectConstants.LIB_NAME, REPORT_ENGINE_JAR)); File engineLib = new File(StableUtils.pathJoin(this.path, ProjectConstants.LIB_NAME, REPORT_ENGINE_JAR));
// 非安装版本允许自由切换 // 非安装版本允许自由切换
boolean notExistLib = !ComparatorUtils.equals(GeneralUtils.readFullBuildNO(), InterProviderFactory.getProvider().getLocText("Fine-Core_Basic_About_No_Build")) boolean notExistLib = !CoreConstants.DOT.equals(StableUtils.getInstallHome())
&& !engineLib.exists(); && !engineLib.exists();
if (notExistLib) { if (notExistLib) {
throw new MainVersionNotMatchException(); throw new MainVersionNotMatchException();

5
designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java

@ -1,8 +1,7 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.designer.beans.actions.behavior.ComponentEnable; import com.fr.design.designer.beans.actions.behavior.CopyableEnable;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
@ -18,7 +17,7 @@ public class CopyAction extends FormWidgetEditAction {
this.setMnemonic('C'); this.setMnemonic('C');
this.setSmallIcon("/com/fr/design/images/m_edit/copy"); this.setSmallIcon("/com/fr/design/images/m_edit/copy");
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER));
setUpdateBehavior(new ComponentEnable()); setUpdateBehavior(new CopyableEnable());
this.setEnabled(!DesignModeContext.isBanCopyAndCut()); this.setEnabled(!DesignModeContext.isBanCopyAndCut());
} }

3
designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java

@ -3,6 +3,7 @@ package com.fr.design.designer.beans.actions;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.designer.beans.actions.behavior.ComponentEnable; import com.fr.design.designer.beans.actions.behavior.ComponentEnable;
import com.fr.design.designer.beans.actions.behavior.CutableEnable;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
@ -18,7 +19,7 @@ public class CutAction extends FormWidgetEditAction {
this.setMnemonic('T'); this.setMnemonic('T');
this.setSmallIcon("/com/fr/design/images/m_edit/cut"); this.setSmallIcon("/com/fr/design/images/m_edit/cut");
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER));
this.setUpdateBehavior(new ComponentEnable()); this.setUpdateBehavior(new CutableEnable());
this.setEnabled(!DesignModeContext.isBanCopyAndCut()); this.setEnabled(!DesignModeContext.isBanCopyAndCut());
} }

6
designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java

@ -7,9 +7,7 @@ import java.awt.event.KeyEvent;
import javax.swing.*; import javax.swing.*;
import com.fr.design.designer.beans.actions.behavior.DeletableEnable;
import com.fr.design.designer.beans.actions.behavior.ComponentEnable;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
/** /**
@ -26,7 +24,7 @@ public class FormDeleteAction extends FormWidgetEditAction {
// Richie:删除菜单图标 // Richie:删除菜单图标
this.setSmallIcon("/com/fr/design/images/m_report/delete"); this.setSmallIcon("/com/fr/design/images/m_report/delete");
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0));
this.setUpdateBehavior(new ComponentEnable()); this.setUpdateBehavior(new DeletableEnable());
} }
@Override @Override

16
designer-form/src/main/java/com/fr/design/designer/beans/actions/behavior/CopyableEnable.java

@ -0,0 +1,16 @@
package com.fr.design.designer.beans.actions.behavior;
import com.fr.design.designer.beans.actions.FormWidgetEditAction;
import com.fr.design.mainframe.FormDesigner;
public class CopyableEnable implements UpdateBehavior<FormWidgetEditAction> {
@Override
public void doUpdate(FormWidgetEditAction action) {
FormDesigner designer = action.getEditingComponent();
if (designer == null) {
action.setEnabled(false);
return;
}
action.setEnabled(designer.isCurrentComponentCopyable());
}
}

16
designer-form/src/main/java/com/fr/design/designer/beans/actions/behavior/CutableEnable.java

@ -0,0 +1,16 @@
package com.fr.design.designer.beans.actions.behavior;
import com.fr.design.designer.beans.actions.FormWidgetEditAction;
import com.fr.design.mainframe.FormDesigner;
public class CutableEnable implements UpdateBehavior<FormWidgetEditAction> {
@Override
public void doUpdate(FormWidgetEditAction action) {
FormDesigner designer = action.getEditingComponent();
if (designer == null) {
action.setEnabled(false);
return;
}
action.setEnabled(designer.isCurrentComponentCutable());
}
}

16
designer-form/src/main/java/com/fr/design/designer/beans/actions/behavior/DeletableEnable.java

@ -0,0 +1,16 @@
package com.fr.design.designer.beans.actions.behavior;
import com.fr.design.designer.beans.actions.FormWidgetEditAction;
import com.fr.design.mainframe.FormDesigner;
public class DeletableEnable implements UpdateBehavior<FormWidgetEditAction> {
@Override
public void doUpdate(FormWidgetEditAction action) {
FormDesigner designer = action.getEditingComponent();
if (designer == null) {
action.setEnabled(false);
return;
}
action.setEnabled(designer.isCurrentComponentDeletable());
}
}

8
designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java

@ -745,5 +745,13 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
return false; return false;
} }
@Override
public boolean isCurrentComponentCutable() {
return !isRootSelected();
}
@Override
public boolean isCurrentComponentCopyable() {
return !isRootSelected();
}
} }

17
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -1266,6 +1266,11 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
return isForm || isRoot(getSelectionModel().getSelection().getSelectedCreator()); return isForm || isRoot(getSelectionModel().getSelection().getSelectedCreator());
} }
public boolean isParameterSelected() {
XCreator xCreator = getSelectionModel().getSelection().getSelectedCreator();
return xCreator != null && xCreator.acceptType(XWParameterLayout.class);
}
/** /**
* 显示权限编辑界面 * 显示权限编辑界面
*/ */
@ -1384,6 +1389,18 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
} }
public boolean isCurrentComponentCutable() {
return !(isRootSelected() || isParameterSelected());
}
public boolean isCurrentComponentCopyable() {
return !(isRootSelected() || isParameterSelected());
}
public boolean isCurrentComponentDeletable() {
return !isRootSelected();
}
// 当前选中控件可以上移一层吗? // 当前选中控件可以上移一层吗?
public boolean isCurrentComponentMovableUp() { public boolean isCurrentComponentMovableUp() {
XCreator creator = getSelectionModel().getSelection().getSelectedCreator(); XCreator creator = getSelectionModel().getSelection().getSelectedCreator();

Loading…
Cancel
Save