From a2d95f38eafdd39f606faba0dd31a371730f3ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 7 Jan 2022 11:44:13 +0800 Subject: [PATCH] REPORT-64149 --- .../adapters/layout/FRFitLayoutAdapter.java | 4 +- .../designer/beans/models/AddingModel.java | 39 +--- .../mainframe/DesignerTransferHandler.java | 4 +- .../mainframe/FormCreatorDropTarget.java | 30 ++- .../com/fr/design/mainframe/FormDesigner.java | 31 ++- .../beans/models/AddingModelTest.java | 210 ------------------ .../guide/creator/GuideCreateUtils.java | 13 +- .../layout/ChangeLayoutComponentGuide.java | 4 +- .../layout/UseLayoutAndComponentGuide.java | 2 +- 9 files changed, 40 insertions(+), 297 deletions(-) delete mode 100644 designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index e0d97ff1ce..3814dc6006 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -8,7 +8,6 @@ import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.LayoutAdapter; -import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.DraggingModel; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; @@ -1262,10 +1261,9 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { if (dragEvent.getPoint().distance(lastPressEvent.getPoint()) > 5) { if (creator.isSupportDrag()) { - designer.setAddingModel(new AddingModel(creator, dragEvent.getX(), dragEvent.getY())); designer.bindTransferHandler(lastPressEvent); designer.fireParentLayoutDragStart(creator); - designer.setDropTarget(new FormCreatorDropTarget(designer)); + designer.setDropTarget(new FormCreatorDropTarget(designer, creator)); // 触发状态添加模式事件 designer.repaint(); } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java index 7a6a1cf0c8..cb16cf66d6 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java @@ -1,12 +1,8 @@ package com.fr.design.designer.beans.models; -import com.fr.design.designer.beans.AdapterBus; -import com.fr.design.designer.beans.ComponentAdapter; -import com.fr.design.designer.beans.adapters.component.CompositeComponentAdapter; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.mainframe.FormDesigner; import com.fr.design.utils.ComponentUtils; import com.fr.general.ComparatorUtils; @@ -23,41 +19,8 @@ public class AddingModel { private boolean added; private boolean addedIllegal = false; // 有时候是添加完成了,但是添加会造成某些控件size不合法,例如tab - public AddingModel(FormDesigner designer, XCreator xCreator) { + public AddingModel(XCreator xCreator) { this.creator = xCreator; - instantiateCreator(designer); - } - - /** - * 待说明 - * - * @param designer 设计器 - */ - public void instantiateCreator(FormDesigner designer) { - - ModelUtil.renameWidgetName(designer.getTarget(), creator); - ComponentAdapter adapter = new CompositeComponentAdapter(designer, creator); - adapter.initialize(); - creator.addNotify(); - creator.putClientProperty(AdapterBus.CLIENT_PROPERTIES, adapter); - } - - public AddingModel(XCreator xCreator, int x, int y) { - this.creator = xCreator; - this.creator.backupCurrentSize(); - this.creator.backupParent(); - } - - public String getXCreatorName(FormDesigner designer, XCreator x) { - String def = x.createDefaultName(); - if (x.acceptType(XWParameterLayout.class)) { - return def; - } - int i = 0; - while (designer.getTarget().isNameExist(def + i)) { - i++; - } - return def + i; } public XCreator getXCreator() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java b/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java index e5b11dd9a4..71360a9064 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/DesignerTransferHandler.java @@ -10,16 +10,14 @@ import java.awt.datatransfer.Transferable; public class DesignerTransferHandler extends TransferHandler { private FormDesigner designer; - private AddingModel addingModel; public DesignerTransferHandler(FormDesigner designer, AddingModel addingModel) { super("rootComponent"); this.designer = designer; - this.addingModel = addingModel; } protected void exportDone(JComponent source, Transferable data, int action) { - if (!addingModel.isCreatorAdded()) { + if (designer.getAddingModel() != null && !designer.getAddingModel().isCreatorAdded()) { undoWhenAddingFailed(); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index d48cfe9dd8..c8e6bdd675 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -5,7 +5,6 @@ import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.Painter; import com.fr.design.designer.beans.events.AddingWidgetListener; -import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; @@ -43,20 +42,16 @@ public class FormCreatorDropTarget extends DropTarget { * 当前鼠标的设计组件 */ private Component current; - /** - * 当前添加模式对应的model - */ - private AddingModel addingModel; private static final int GAP = 30; private TabDragInner tabDragInner; - + private XCreator creator; private JWindow promptWindow = new JWindow(); private UIButton promptButton = new UIButton("", BaseUtils.readIcon(IconPathConstants.FORBID_ICON_PATH)); - public FormCreatorDropTarget(FormDesigner designer) { + public FormCreatorDropTarget(FormDesigner designer, XCreator creator) { this.designer = designer; - this.addingModel = designer.getAddingModel(); + this.creator = creator; this.promptWindow.add(promptButton); this.tabDragInner = new TabDragInner(designer); initAddingListener(); @@ -71,7 +66,9 @@ public class FormCreatorDropTarget extends DropTarget { @Override public void afterAdded(boolean addResult) { - tabDragInner.reset(); + if (addResult) { + tabDragInner.reset(); + } } }); } @@ -145,15 +142,15 @@ public class FormCreatorDropTarget extends DropTarget { rect.y -= designer.getArea().getVerticalValue(); painter.setRenderingBounds(rect); painter.setHotspot(new Point(x, y)); - painter.setCreator(addingModel.getXCreator()); + painter.setCreator(creator); } } private void promptUser(int x, int y, XLayoutContainer container) { - if (!addingModel.getXCreator().canEnterIntoParaPane() && container.acceptType(XWParameterLayout.class)) { + if (!creator.canEnterIntoParaPane() && container.acceptType(XWParameterLayout.class)) { promptButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Forbid_Drag_Into_Para_Pane")); promptWidgetForbidEnter(x, y, container); - } else if (!addingModel.getXCreator().canEnterIntoAdaptPane() && container.acceptType(XWFitLayout.class)) { + } else if (!creator.canEnterIntoAdaptPane() && container.acceptType(XWFitLayout.class)) { promptButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Forbid_Drag_Into_Adapt_Pane")); promptWidgetForbidEnter(x, y, container); } else { @@ -201,10 +198,9 @@ public class FormCreatorDropTarget extends DropTarget { hovering(x, y); tabDragInner.setTabDragInAble(designer.getComponentAt(x, y), x, y); - XCreator xCreator = designer.getAddingModel().getXCreator(); - XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(xCreator); + XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(creator); if (parent!= null && parent.getLayoutAdapter()!=null){ - parent.getLayoutAdapter().dragOver(xCreator, designer.getSelectionModel(), x, y); + parent.getLayoutAdapter().dragOver(creator, designer.getSelectionModel(), x, y); } // 触发状态添加模式事件 @@ -243,7 +239,7 @@ public class FormCreatorDropTarget extends DropTarget { dropXCreator(dtde); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - if (addingModel.getXCreator().isShared()) { + if (creator.isShared()) { FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Drag_Component_Error_Info"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), @@ -258,7 +254,7 @@ public class FormCreatorDropTarget extends DropTarget { private void dropXCreator(DropTargetDropEvent dtde) { cancelPromptWidgetForbidEnter(); Point loc = dtde.getLocation(); - designer.addWidgetToForm(designer.getRelativeX(loc.x), designer.getRelativeY(loc.y)); + designer.addWidgetToForm(creator, designer.getRelativeX(loc.x), designer.getRelativeY(loc.y)); // 放到事件末尾执行 SwingUtilities.invokeLater(new Runnable() { @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index a4ec9ff191..4f2762d80a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -14,6 +14,7 @@ import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.designer.TargetComponent; import com.fr.design.designer.beans.AdapterBus; +import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.Painter; import com.fr.design.designer.beans.actions.CopyAction; @@ -24,6 +25,7 @@ import com.fr.design.designer.beans.actions.MoveToBottomAction; import com.fr.design.designer.beans.actions.MoveToTopAction; import com.fr.design.designer.beans.actions.MoveUpAction; import com.fr.design.designer.beans.actions.PasteAction; +import com.fr.design.designer.beans.adapters.component.CompositeComponentAdapter; import com.fr.design.designer.beans.adapters.layout.DefaultDesignerBaseOperate; import com.fr.design.designer.beans.adapters.layout.DesignerBaseOperate; import com.fr.design.designer.beans.adapters.layout.FRParameterLayoutAdapter; @@ -36,6 +38,7 @@ import com.fr.design.designer.beans.location.Location; import com.fr.design.designer.beans.location.RootResizeDirection; import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.DraggingModel; +import com.fr.design.designer.beans.models.ModelUtil; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.StateModel; import com.fr.design.designer.creator.XChartEditor; @@ -1163,18 +1166,10 @@ public class FormDesigner extends TargetComponent
implements TreeSelection return addingModel; } - public void setAddingModel(AddingModel addingModel) { - this.addingModel = addingModel; - } - public DraggingModel getDraggingModel() { return draggingModel; } - public void setDraggingModel(DraggingModel draggingModel) { - this.draggingModel = draggingModel; - } - public XCreator getComponentAt(MouseEvent e) { return getComponentAt(e.getX(), e.getY()); } @@ -1257,11 +1252,20 @@ public class FormDesigner extends TargetComponent implements TreeSelection .creator(xCreator) .startDragEvent(startDragEvent) .currentDragEvent(currentDragEvent); - addingModel = new AddingModel(this, xCreator); - this.setDropTarget(new FormCreatorDropTarget(this)); + instantiateCreator(xCreator); + addingModel = new AddingModel(xCreator); + this.setDropTarget(new FormCreatorDropTarget(this, xCreator)); repaint(); } + public void instantiateCreator(XCreator creator) { + ModelUtil.renameWidgetName(this.getTarget(), creator); + ComponentAdapter adapter = new CompositeComponentAdapter(this, creator); + adapter.initialize(); + creator.addNotify(); + creator.putClientProperty(AdapterBus.CLIENT_PROPERTIES, adapter); + } + /** * 拖拽表单上的组件 * @@ -1275,6 +1279,8 @@ public class FormDesigner extends TargetComponent implements TreeSelection .creator(xCreator) .startDragEvent(startDragEvent) .currentDragEvent(currentDragEvent); + xCreator.backupCurrentSize(); + xCreator.backupParent(); XLayoutContainer container = this.getDraggingHotspotLayout(); LayoutAdapter adapter = container.getLayoutAdapter(); adapter.dragging(this.getDraggingModel()); @@ -1981,11 +1987,12 @@ public class FormDesigner extends TargetComponent implements TreeSelection return spacingLineDrawer; } - public void addWidgetToForm(int x, int y) { - if(addingModel == null) { + public void addWidgetToForm(XCreator creator, int x, int y) { + if(creator == null) { return; } + addingModel = new AddingModel(creator); // 当前鼠标所在的组件 XCreator hoveredComponent = this.getComponentAt(x, y); // 获取该组件所在的焦点容器 diff --git a/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java b/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java deleted file mode 100644 index f7a75b029d..0000000000 --- a/designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java +++ /dev/null @@ -1,210 +0,0 @@ -package com.fr.design.designer.beans.models; - -import com.fr.base.chart.BaseChartCollection; -import com.fr.config.dao.DaoContext; -import com.fr.config.dao.impl.LocalClassHelperDao; -import com.fr.config.dao.impl.LocalEntityDao; -import com.fr.config.dao.impl.LocalXmlEntityDao; -import com.fr.design.designer.creator.CRPropertyDescriptor; -import com.fr.design.designer.creator.XChartEditor; -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWTitleLayout; -import com.fr.design.designer.creator.cardlayout.XWCardLayout; -import com.fr.design.gui.chart.MiddleChartComponent; -import com.fr.design.mainframe.FormDesigner; -import com.fr.design.module.DesignModuleFactory; -import com.fr.form.main.Form; -import com.fr.form.ui.ChartEditor; -import com.fr.form.ui.Widget; -import com.fr.form.ui.container.WAbsoluteLayout; -import com.fr.form.ui.container.WCardLayout; -import com.fr.form.ui.container.WTitleLayout; -import com.fr.stable.core.PropertyChangeListener; -import org.easymock.EasyMock; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.easymock.PowerMock; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -import javax.swing.JComponent; -import java.awt.Dimension; -import java.awt.Rectangle; -import java.beans.IntrospectionException; - -@PrepareForTest({DesignModuleFactory.class}) -@PowerMockIgnore({"com.sun.*", "javax.*", "com.fr.jvm.assist.*"}) -@RunWith(PowerMockRunner.class) -public class AddingModelTest { - - @Before - public void setUp() { - DaoContext.setXmlEntityDao(new LocalXmlEntityDao()); - DaoContext.setClassHelperDao(new LocalClassHelperDao()); - DaoContext.setEntityDao(new LocalEntityDao()); - } - - @After - public void tearDown() { - DaoContext.setXmlEntityDao(null); - DaoContext.setClassHelperDao(null); - DaoContext.setEntityDao(null); - } - - /** - * 默认名字 + i - */ - @Test - public void testInstantiateCreator() throws Exception { - - Dimension dimension = new Dimension(20, 20); - - ChartEditor chartEditor1 = new ChartEditor(); - XCreator xCreator1 = new DemoCreator(chartEditor1, dimension, "test"); - - ChartEditor chartEditor2 = new ChartEditor(); - chartEditor2.setWidgetName("test02"); - XCreator xCreator2 = new DemoCreator(chartEditor2, dimension, "test02"); - xCreator1.add(xCreator2); - - ChartEditor chartEditor3 = new ChartEditor(); - chartEditor3.setWidgetName("test03"); - WAbsoluteLayout.BoundsWidget boundsWidget = new WAbsoluteLayout.BoundsWidget(chartEditor3, new Rectangle(dimension)); - WTitleLayout wTitleLayout03 = new WTitleLayout(); - wTitleLayout03.addWidget(boundsWidget); - //需要和内部的 widget 一样 - wTitleLayout03.setWidgetName("test03"); - XWTitleLayout xCreator3 = new XWTitleLayout(wTitleLayout03, dimension); - xCreator1.add(xCreator3); - - AddingModel addingModel = new AddingModel(xCreator1, 20, 20); - - Form form = EasyMock.mock(Form.class); - EasyMock.expect(form.isNameExist("test0")).andReturn(true).once(); - EasyMock.expect(form.isNameExist("test03")).andReturn(true).once(); - EasyMock.expect(form.isNameExist(EasyMock.anyString())).andReturn(false).anyTimes(); - EasyMock.replay(form); - - FormDesigner mock = EasyMock.mock(FormDesigner.class); - EasyMock.expect(mock.getTarget()).andReturn(form).anyTimes(); - EasyMock.replay(mock); - - addingModel.instantiateCreator(mock); - //没有默认参数, 但已经存在 test - Assert.assertEquals("test1", xCreator1.toData().getWidgetName()); - //直接返回 - Assert.assertEquals("test020", xCreator2.toData().getWidgetName()); - //已经存在,后接0 - Assert.assertEquals("test030", xCreator3.toData().getWidgetName()); - } - - @Test - public void testInstantiateCreator_cardLayout() throws Exception { - - Form form = EasyMock.mock(Form.class); - EasyMock.expect(form.isNameExist("cardlayout0")).andReturn(true).once(); - EasyMock.expect(form.isNameExist("cardlayout1")).andReturn(true).once(); - EasyMock.expect(form.isNameExist(EasyMock.anyString())).andReturn(false).anyTimes(); - EasyMock.replay(form); - - FormDesigner mock = EasyMock.mock(FormDesigner.class); - EasyMock.expect(mock.getTarget()).andReturn(form).anyTimes(); - EasyMock.replay(mock); - - WCardLayout wCardLayout = new WCardLayout(20, 20); - XWCardLayout xwCardLayout = new XWCardLayout(wCardLayout, new Dimension(40, 40)); - AddingModel addingModel = new AddingModel(mock, xwCardLayout); - Assert.assertEquals("cardlayout2", xwCardLayout.toData().getWidgetName()); - - //依赖于 cardlayout 创建 container - XLayoutContainer parentLayOut = xwCardLayout.initCreatorWrapper(80); - //组件默认名 tablelayout2 - AddingModel parentModel = new AddingModel(mock, parentLayOut); - //经过处理 tablayout20 - Assert.assertEquals("tablayout20", parentLayOut.toData().getWidgetName()); - Assert.assertEquals("tabpane20", ((XCreator) (parentLayOut.getComponent(0))).getXCreator().toData().getWidgetName()); - Assert.assertEquals("cardlayout20", xwCardLayout.toData().getWidgetName()); - - } - - @Test - public void testInstantiateCreator_containsNotXCreator() throws Exception { - - Form form = EasyMock.mock(Form.class); - EasyMock.expect(form.isNameExist(EasyMock.anyString())).andReturn(false).anyTimes(); - EasyMock.replay(form); - - FormDesigner mock = EasyMock.mock(FormDesigner.class); - EasyMock.expect(mock.getTarget()).andReturn(form).anyTimes(); - EasyMock.replay(mock); - - PowerMock.mockStaticPartial(DesignModuleFactory.class, "getChartComponent"); - EasyMock.expect(DesignModuleFactory.getChartComponent(EasyMock.anyObject(BaseChartCollection.class))).andReturn(new MiddleChartComponent() { - @Override - public void populate(BaseChartCollection cc) { - - } - - @Override - public BaseChartCollection update() { - return null; - } - - @Override - public void reset() { - - } - - @Override - public void addStopEditingListener(PropertyChangeListener list) { - - } - }).anyTimes(); - PowerMock.replayAll(); - - Dimension dimension = new Dimension(20, 20); - - ChartEditor chartEditor1 = new ChartEditor(); - XCreator xCreator1 = new XChartEditor(chartEditor1, dimension); - - - AddingModel chartModel = new AddingModel(mock, xCreator1); - Assert.assertEquals("chart0", xCreator1.toData().getWidgetName()); - } - - private static class DemoCreator extends XCreator { - - private String widgetName; - - public DemoCreator(Widget ob, Dimension initSize, String defaultName) { - super(ob, initSize); - this.widgetName = defaultName; - } - - @Override - public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return new CRPropertyDescriptor[0]; - } - - @Override - protected JComponent initEditor() { - return null; - } - - @Override - protected void initXCreatorProperties() { - - } - - @Override - public String createDefaultName() { - return this.widgetName; - } - } - -} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java index f776f1b9d9..dac6175cad 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java @@ -1,6 +1,5 @@ package com.fr.design.mainframe.guide.creator; -import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.dialog.FineJOptionPane; @@ -126,22 +125,14 @@ public class GuideCreateUtils { return null; } - public static void addXCreatorToXLayoutContainer(XCreator xCreator, XLayoutContainer xLayoutContainer, boolean isDragComponent) { + public static void addXCreatorToXLayoutContainer(XCreator xCreator, XLayoutContainer xLayoutContainer) { if (xCreator == null) { return; } FormDesigner designer = GuideCreateUtils.getFormDesigner(); designer.getSelectionModel().selectACreator(xLayoutContainer); - if (isDragComponent) { - designer.setAddingModel(new AddingModel(xCreator, 0,0)); - - } else { - designer.setAddingModel(new AddingModel(designer, xCreator)); - } - - designer.repaint(); - designer.addWidgetToForm(xLayoutContainer.getX(), xLayoutContainer.getY()); + designer.addWidgetToForm(xCreator, xLayoutContainer.getX(), xLayoutContainer.getY()); designer.getSelectionModel().selectACreator(xCreator); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java index ae7fb81387..acb6ccb72f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java @@ -136,8 +136,8 @@ public class ChangeLayoutComponentGuide { formDesigner.getSelectionModel().removeCreator(from, from.getWidth(), from.getHeight()); formDesigner.getSelectionModel().removeCreator(to, to.getWidth(),to.getHeight()); - GuideCreateUtils.addXCreatorToXLayoutContainer(from, (XLayoutContainer) GuideCreateUtils.getXCreatorFormDesigner("box1"), true); - GuideCreateUtils.addXCreatorToXLayoutContainer(to, (XLayoutContainer) GuideCreateUtils.getXCreatorFormDesigner("box0"), true); + GuideCreateUtils.addXCreatorToXLayoutContainer(from, (XLayoutContainer) GuideCreateUtils.getXCreatorFormDesigner("box1")); + GuideCreateUtils.addXCreatorToXLayoutContainer(to, (XLayoutContainer) GuideCreateUtils.getXCreatorFormDesigner("box0")); return true; } }); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java index b4f5647c66..dc0c9d0c1e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java @@ -246,7 +246,7 @@ public class UseLayoutAndComponentGuide { LocalWidgetBlock block = getLocalWidgetBlock(shareID); XCreator xCreator = block.transformXCreator(block); XOccupiedLayout xOccupiedLayout = getXOccupiedLayout(name); - GuideCreateUtils.addXCreatorToXLayoutContainer(xCreator, xOccupiedLayout, false); + GuideCreateUtils.addXCreatorToXLayoutContainer(xCreator, xOccupiedLayout); return true; } });