diff --git a/designer/src/com/fr/design/condition/PresentHighlightPane.java b/designer/src/com/fr/design/condition/PresentHighlightPane.java index f306ec0f7..2269ceca1 100644 --- a/designer/src/com/fr/design/condition/PresentHighlightPane.java +++ b/designer/src/com/fr/design/condition/PresentHighlightPane.java @@ -97,20 +97,20 @@ public class PresentHighlightPane extends ConditionAttrSingleConditionPane= 0 && y >= 0 && creator.getHeight() <= container.getHeight() + && creator.getWidth() <= container.getWidth(); + } + + @Override + protected void addComp(XCreator creator, int x, int y) { + if (XCreatorUtils.getParentXLayoutContainer(creator) != null) { + Rectangle r = ComponentUtils.getRelativeBounds(container); + Rectangle creatorRectangle = ComponentUtils.getRelativeBounds(creator); + x = creatorRectangle.x - r.x; + y = creatorRectangle.y - r.y; + } else { + int w = creator.getWidth() / 2; + int h = creator.getHeight() / 2; + x = x - w; + y = y - h; + } + + fix(creator, x, y); + container.add(creator); + LayoutUtils.layoutRootContainer(container); + } + + /** + * 调整组件大小到合适尺寸位置 + * + * @param creator 组件 + * @param x 坐标x + * @param y 坐标y + */ + @Override + public void fix(XCreator creator, int x, int y) { + if (x < 0) { + x = 0; + } else if (x + creator.getWidth() > container.getWidth()) { + x = container.getWidth() - creator.getWidth(); + } + + if (y < 0) { + y = 0; + } else if (y + creator.getHeight() > container.getHeight()) { + y = container.getHeight() - creator.getHeight(); + } + + creator.setLocation(x, y); + } + + @Override + public ConstraintsGroupModel getLayoutConstraints(XCreator creator) { + return super.getLayoutConstraints(creator); + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java b/designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java index 890612ccc..e1ab80b7c 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java @@ -174,4 +174,13 @@ public class XWParameterLayout extends XWAbsoluteLayout { public XLayoutContainer getTopLayout() { return this; } + + /** + * 新增删除拉伸后更新每个组件的BoundsWidget + * + * @param xCreator + */ + @Override + public void updateBoundsWidget(XCreator xCreator) { + } } \ No newline at end of file