Browse Source

Pull request #1662: REPORT-31412 【模板制作优化】@kerry,决策报表制作绝对布局下,删除组件没有记录

Merge in DESIGN/design from ~KERRY/design_10.0:release/10.0 to release/10.0

* commit 'a0b4769dbf122a32cfbe3065da09aacff2cd0ef5':
  REPORT-31412 【模板制作优化】@kerry,决策报表制作绝对布局下,删除组件没有记录
feature/big-screen
kerry 5 years ago
parent
commit
685421dd8c
  1. 2
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  2. 7
      designer-form/src/main/java/com/fr/design/mainframe/template/info/ComponentOperate.java
  3. 17
      designer-form/src/test/java/com/fr/design/mainframe/template/info/ComponentCreateOperateTest.java

2
designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java

@ -258,11 +258,11 @@ public class SelectionModel {
designer.removeParaComponent(); designer.removeParaComponent();
} }
removeCreatorFromContainer(creator, creator.getWidth(), creator.getHeight()); removeCreatorFromContainer(creator, creator.getWidth(), creator.getHeight());
FormDesignerUtils.removeWidgetProcessInfo(creator.toData());
creator.deleteRelatedComponent(creator, designer); creator.deleteRelatedComponent(creator, designer);
creator.removeAll(); creator.removeAll();
// 清除被选中的组件 // 清除被选中的组件
selection.reset(); selection.reset();
FormDesignerUtils.removeWidgetProcessInfo(creator.toData());
} }

7
designer-form/src/main/java/com/fr/design/mainframe/template/info/ComponentOperate.java

@ -7,6 +7,7 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteBodyLayout; import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WCardLayout;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
@ -23,7 +24,11 @@ public abstract class ComponentOperate implements TemplateOperate {
private Widget widget; private Widget widget;
public ComponentOperate(Widget widget) { public ComponentOperate(Widget widget) {
this.widget = widget; if (widget.acceptType(WTitleLayout.class)) {
this.widget = ((WTitleLayout) widget).getBodyBoundsWidget().getWidget();
}else {
this.widget = widget;
}
} }
@Override @Override

17
designer-form/src/test/java/com/fr/design/mainframe/template/info/ComponentCreateOperateTest.java

@ -9,14 +9,31 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteBodyLayout; import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WCardLayout;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.general.ComparatorUtils;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import java.awt.Rectangle;
/** /**
* Created by kerry on 2020-05-08 * Created by kerry on 2020-05-08
*/ */
public class ComponentCreateOperateTest { public class ComponentCreateOperateTest {
@Test
public void testConstructor(){
ElementCaseEditor caseEditor = new ElementCaseEditor();
caseEditor.setWidgetName("report0");
caseEditor.setWidgetID("xxxx0");
WTitleLayout wTitleLayout = new WTitleLayout();
wTitleLayout.addBody(caseEditor, new Rectangle());
ComponentOperate componentOperate0 = new ComponentCreateOperate(caseEditor);
ComponentOperate componentOperate1 = new ComponentCreateOperate(wTitleLayout);
ComparatorUtils.equals(componentOperate0.toJSONObject(), componentOperate1.toJSONObject());
}
@Test @Test
public void testToJSONObject() { public void testToJSONObject() {
Widget button = new FreeButton(); Widget button = new FreeButton();

Loading…
Cancel
Save