From de754516cce1e598dbe0ccb1e75000102e9d0cd7 Mon Sep 17 00:00:00 2001 From: zhouping Date: Mon, 29 Aug 2016 00:18:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80=E6=B5=8B?= =?UTF-8?q?=E8=AF=95bug=E4=BF=AE=E6=94=B92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hanlder/BottomCornerMouseHanlder.java | 10 ++++++ .../fr/design/beans/location/MoveUtils.java | 22 ++++++++++-- .../layout/FRAbsoluteLayoutAdapter.java | 34 ++++++++++++++++++- .../beans/location/AccessDirection.java | 4 +-- .../design/designer/beans/location/Inner.java | 10 ++++++ .../designer/beans/models/AddingModel.java | 7 ++++ .../fr/design/designer/creator/XCreator.java | 8 +++++ .../designer/creator/XWAbsoluteLayout.java | 20 ++++++++++- .../designer/creator/XWParameterLayout.java | 5 +++ .../fr/design/form/parameter/XFormSubmit.java | 2 +- .../fr/design/gui/core/FormWidgetOption.java | 2 +- .../mainframe/FormCreatorDropTarget.java | 18 ++++++---- 12 files changed, 126 insertions(+), 16 deletions(-) diff --git a/designer/src/com/fr/poly/hanlder/BottomCornerMouseHanlder.java b/designer/src/com/fr/poly/hanlder/BottomCornerMouseHanlder.java index 7668411c8..729562740 100644 --- a/designer/src/com/fr/poly/hanlder/BottomCornerMouseHanlder.java +++ b/designer/src/com/fr/poly/hanlder/BottomCornerMouseHanlder.java @@ -183,6 +183,16 @@ public class BottomCornerMouseHanlder extends MouseInputAdapter { public Point getDesignerLocationOnScreen() { return null; } + + @Override + public int getDesignerScrollVerticalValue() { + return 0; + } + + @Override + public int getDesignerScrollHorizontalValue() { + return 0; + } }; private RectangleIterator getRectangleIt(){ diff --git a/designer_base/src/com/fr/design/beans/location/MoveUtils.java b/designer_base/src/com/fr/design/beans/location/MoveUtils.java index 50179e312..f796768a6 100644 --- a/designer_base/src/com/fr/design/beans/location/MoveUtils.java +++ b/designer_base/src/com/fr/design/beans/location/MoveUtils.java @@ -3,8 +3,6 @@ */ package com.fr.design.beans.location; -import com.fr.stable.ArrayUtils; - import javax.swing.*; import java.awt.*; import java.util.ArrayList; @@ -98,6 +96,18 @@ public class MoveUtils { * @param line 吸附线 */ void setEquidistantLine(Absorptionline line); + + /** + * 获取设计器垂直滚动条的值 + * @return 滚动条的值 + */ + int getDesignerScrollVerticalValue(); + + /** + * 获取设计器水平滚动条的值 + * @return 滚动条的值 + */ + int getDesignerScrollHorizontalValue(); } public interface RectangleIterator { @@ -457,7 +467,13 @@ public class MoveUtils { right = equidistantLines.get(i).getReference(); } } - line = Absorptionline.createEquidistantAbsorptionline(operatingRectangle, top, left, bottom, right); + operatingRectangle.x -= designer.getDesignerScrollHorizontalValue(); + operatingRectangle.y -= designer.getDesignerScrollVerticalValue(); + line = Absorptionline.createEquidistantAbsorptionline(operatingRectangle, + top - designer.getDesignerScrollVerticalValue(), + left - designer.getDesignerScrollHorizontalValue(), + bottom - designer.getDesignerScrollVerticalValue(), + right - designer.getDesignerScrollHorizontalValue()); } designer.setEquidistantLine(line); } diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java index 28516a4b2..3c0f1155c 100644 --- a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java +++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java @@ -46,6 +46,10 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter { * @param y 坐标y * @return 能则返回true */ + //这个地方的逻辑非常复杂, + // 1.当前绝对布局是不可编辑且是最外层,那么其他控件添加在它周围, + // 2.当前绝对布局是不可编辑且不是最外层,那么控件不可添加,(嵌套) + // 3.当前绝对布局可编辑,那么控件添加 @Override public boolean accept(XCreator creator, int x, int y) { Component comp = container.getComponentAt(x, y); @@ -55,11 +59,29 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter { if (comp == null){ return false; } + //判断下组件能不能拖入绝对布局 + if (!creator.canEnterIntoAbsolutePane()){ + return false; + } XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator)comp).getTopLayout(); if(topLayout != null){ if (topLayout.isEditable()){ //判断有没有和当前控件重叠 - Rectangle curRec = new Rectangle(x, y, creator.getWidth(), creator.getHeight()); + //先计算当前控件的位置 + int creatorX, creatorY; + if (XCreatorUtils.getParentXLayoutContainer(creator) != null) { + + Rectangle creatorRectangle = ComponentUtils.getRelativeBounds(creator); + creatorX = creatorRectangle.x; + creatorY = creatorRectangle.y; + } else { + int w = creator.getWidth() / 2; + int h = creator.getHeight() / 2; + creatorX = x - w; + creatorY = y - h; + } + //再判断和布局中其他控件重叠 + Rectangle curRec = new Rectangle(creatorX, creatorY, creator.getWidth(), creator.getHeight()); WAbsoluteLayout wAbsoluteLayout = (WAbsoluteLayout)topLayout.toData(); for (int i = 0, count = wAbsoluteLayout.getWidgetCount(); i < count; i++) { WAbsoluteLayout.BoundsWidget temp = (WAbsoluteLayout.BoundsWidget) wAbsoluteLayout.getWidget(i); @@ -68,9 +90,19 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter { return false; } } + if (creatorX < 0 + || creatorX + creator.getWidth() > container.getWidth() + || creatorY < 0 + || creatorY + creator.getHeight() > container.getHeight()) { + return false; + } return x >= 0 && y >= 0 && creator.getHeight() <= container.getHeight() && creator.getWidth() <= container.getWidth(); } + //绝对布局嵌套,处于内层,不可编辑,不添加,topLayout只能获取到最外层可编辑的布局 + else if (((XLayoutContainer)topLayout.getParent()).acceptType(XWAbsoluteLayout.class)) { + return false; + } else { return acceptWidget(creator, x, y); } diff --git a/designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java b/designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java index b44145c0c..dde93b4ef 100644 --- a/designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java +++ b/designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java @@ -53,9 +53,9 @@ public abstract class AccessDirection implements Direction { //参数面板可以无下限拉长 if (y < 0) { y = 0; - } else if (y > designer.getRootComponent().getHeight() && designer.getSelectionModel().hasSelectionComponent() + } else if (y > designer.getRootComponent().getHeight() + designer.getParaHeight() && designer.getSelectionModel().hasSelectionComponent() && !designer.getSelectionModel().getSelection().getSelectedCreator().acceptType(XWParameterLayout.class)) { - y = designer.getRootComponent().getHeight(); + y = designer.getRootComponent().getHeight() + designer.getParaHeight(); } return new Point(x, y); } diff --git a/designer_form/src/com/fr/design/designer/beans/location/Inner.java b/designer_form/src/com/fr/design/designer/beans/location/Inner.java index c97e3248a..c54796a0a 100644 --- a/designer_form/src/com/fr/design/designer/beans/location/Inner.java +++ b/designer_form/src/com/fr/design/designer/beans/location/Inner.java @@ -119,6 +119,16 @@ public class Inner extends AccessDirection { public void setEquidistantLine(Absorptionline line) { designer.getStateModel().setEquidistantLine(line); } + + @Override + public int getDesignerScrollHorizontalValue() { + return designer.getArea().getHorizontalValue(); + } + + @Override + public int getDesignerScrollVerticalValue() { + return designer.getArea().getVerticalValue(); + } }; //判断当前操作的是不是参数面板,要特殊处理 boolean isParameterLayout = ((XCreator)(designer.getSelectionModel().getSelection().getSelectedCreator().getParent())).acceptType(XWParameterLayout.class); diff --git a/designer_form/src/com/fr/design/designer/beans/models/AddingModel.java b/designer_form/src/com/fr/design/designer/beans/models/AddingModel.java index 21c68f605..ee02afa65 100644 --- a/designer_form/src/com/fr/design/designer/beans/models/AddingModel.java +++ b/designer_form/src/com/fr/design/designer/beans/models/AddingModel.java @@ -2,6 +2,7 @@ package com.fr.design.designer.beans.models; import java.awt.Rectangle; +import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.mainframe.FormDesigner; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; @@ -115,6 +116,12 @@ public class AddingModel { * @return 成功返回true */ public boolean add2Container(FormDesigner designer, XLayoutContainer container, int x, int y) { + //考虑不同布局嵌套的情况,获取顶层容器 + XLayoutContainer xLayoutContainer = container.getTopLayout(); + if(xLayoutContainer != null && xLayoutContainer.acceptType(XWAbsoluteLayout.class)){ + container = xLayoutContainer; + } + Rectangle rect = ComponentUtils.getRelativeBounds(container); if(!ComparatorUtils.equals(container.getOuterLayout(), container.getBackupParent())){ return added = container.getLayoutAdapter().addBean(creator,x,y); diff --git a/designer_form/src/com/fr/design/designer/creator/XCreator.java b/designer_form/src/com/fr/design/designer/creator/XCreator.java index c9b05f9b6..62cfe0b25 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCreator.java +++ b/designer_form/src/com/fr/design/designer/creator/XCreator.java @@ -316,6 +316,14 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo return true; } + /** + * 该组件是否可以拖入绝对布局 + * @return 是则返回true + */ + public boolean canEnterIntoAbsolutePane() { + return true; + } + /** * 该组件是否可以拖拽(表单中参数面板和自适应布局不可以拖拽) * @return 是则返回true diff --git a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java index 34a2a156d..a1fc32c40 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -78,6 +78,16 @@ public class XWAbsoluteLayout extends XLayoutContainer { initPercent(); } + /** + * 初始化时默认的组件大小 + * + * @return 默认Dimension + */ + @Override + public Dimension initEditorSize() { + return new Dimension(500, 300); + } + //根据屏幕大小来确定显示的百分比, 1440*900默认100%, 1366*768缩放90% private void initPercent(){ Toolkit toolkit = Toolkit.getDefaultToolkit(); @@ -155,6 +165,9 @@ public class XWAbsoluteLayout extends XLayoutContainer { if (xCreator.hasTitleStyle()) { xCreator = (XLayoutContainer)xCreator.getParent(); } + if (xCreator.acceptType(XWAbsoluteLayout.class)){ + ((XWAbsoluteLayout) xCreator).updateBoundsWidget(); + } BoundsWidget boundsWidget = layout.getBoundsWidget(xCreator.toData()); Rectangle rectangle = dealWidgetBound(xCreator.getBounds()); } @@ -186,6 +199,11 @@ public class XWAbsoluteLayout extends XLayoutContainer { Rectangle rec = calculateBound(wgtBound, percentW, percentH); wgt.setBounds(rec); creator.setBounds(rec); + //绝对布局嵌套,要更新内部的绝对布局 + if (creator.acceptType(XWAbsoluteLayout.class)){ + creator.setBackupBound(wgtBound); + ((XWAbsoluteLayout) creator).updateBoundsWidget(); + } } } } @@ -223,7 +241,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { @Override protected String getIconName() { - return "layout_absolute.png"; + return "layout_absolute_new.png"; } /** 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 d847245e1..d85c610ac 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java @@ -190,4 +190,9 @@ public class XWParameterLayout extends XWAbsoluteLayout { @Override public void updateBoundsWidget() { } + + @Override + protected String getIconName() { + return "layout_absolute.png"; + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/form/parameter/XFormSubmit.java b/designer_form/src/com/fr/design/form/parameter/XFormSubmit.java index 094fdeb7a..3d8f3d914 100644 --- a/designer_form/src/com/fr/design/form/parameter/XFormSubmit.java +++ b/designer_form/src/com/fr/design/form/parameter/XFormSubmit.java @@ -1 +1 @@ -package com.fr.design.form.parameter; import com.fr.design.designer.creator.XButton; import com.fr.design.designer.creator.XCreator; import com.fr.form.parameter.FormSubmitButton; import java.awt.*; /** * 提交按钮 * @editor zhou * @since 2012-3-23下午3:36:00 */ public class XFormSubmit extends XButton { public XFormSubmit(FormSubmitButton widget, Dimension initSize) { super(widget, initSize); } /** * 是否有查询按钮 * @param xCreator 控件或容器 * @return 有无查询按钮 */ public boolean SearchQueryCreators(XCreator xCreator) { return true; } /** * 该组件是否可以拖入表单主体 * @return 是则返回true */ public boolean canEnterIntoAdaptPane(){ return false; } @Override protected String getIconName() { return "preview_16.png"; } } \ No newline at end of file +package com.fr.design.form.parameter; import com.fr.design.designer.creator.XButton; import com.fr.design.designer.creator.XCreator; import com.fr.form.parameter.FormSubmitButton; import java.awt.*; /** * 提交按钮 * @editor zhou * @since 2012-3-23下午3:36:00 */ public class XFormSubmit extends XButton { public XFormSubmit(FormSubmitButton widget, Dimension initSize) { super(widget, initSize); } /** * 是否有查询按钮 * @param xCreator 控件或容器 * @return 有无查询按钮 */ public boolean SearchQueryCreators(XCreator xCreator) { return true; } /** * 该组件是否可以拖入表单主体 * @return 是则返回true */ public boolean canEnterIntoAdaptPane(){ return false; } /** * 该组件是否可以拖入绝对布局 * * @return 是则返回true */ @Override public boolean canEnterIntoAbsolutePane() { return false; } @Override protected String getIconName() { return "preview_16.png"; } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java b/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java index 76287c30f..214d2cd67 100644 --- a/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java +++ b/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java @@ -1 +1 @@ -package com.fr.design.gui.core; import javax.swing.Icon; import com.fr.base.BaseUtils; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WHorizontalBoxLayout; import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WVerticalBoxLayout; import com.fr.general.Inter; /** * Author : Shockway * Date: 13-6-17 * Time: 上午10:40 */ public class FormWidgetOption extends WidgetOption { /** * 返回名字 * @return 名字 */ @Override public String optionName() { return null; } /** * 返回图标 * @return 图标 */ @Override public Icon optionIcon() { return null; } /** * 组件类 * @return 类 */ @Override public Class widgetClass() { return null; } /** * 返回组件 * @return 控件 */ @Override public Widget createWidget() { return null; } /* * 表单容器 */ public static WidgetOption[] getFormContainerInstance() { return new WidgetOption[] { ABSOLUTELAYOUTCONTAINER, BORDERLAYOUTCONTAINER, HORIZONTALBOXLAYOUTCONTAINER, VERTICALBOXLAYOUTCONTAINER, CARDLAYOUTCONTAINER, FITLAYOUTCONTAINER }; } /** * 表单工具栏上的布局 * @return 控件 */ public static WidgetOption[] getFormLayoutInstance() { return new WidgetOption[] {CARDLAYOUTCONTAINER, ABSOLUTELAYOUTCONTAINER}; } public static final WidgetOption ABSOLUTELAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_AbsoluteLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_absolute.png"), WAbsoluteLayout.class); public static final WidgetOption BORDERLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_BorderLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_border.png"), WBorderLayout.class); public static final WidgetOption CARDLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_CardLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/card_layout_16.png"), WCardLayout.class); public static final WidgetOption HORIZONTALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout-HBox"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_h_16.png"), WHorizontalBoxLayout.class); public static final WidgetOption VERTICALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_VerticalBoxLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WVerticalBoxLayout.class); public static final WidgetOption FITLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WFitLayout.class); public static final WidgetOption PARAMETERCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Para-Body"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter.png"), WParameterLayout.class); public static final WidgetOption ELEMENTCASE = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Form-Report"), BaseUtils.readIcon("/com/fr/web/images/form/resources/report_16.png"), ElementCaseEditor.class); } \ No newline at end of file +package com.fr.design.gui.core; import javax.swing.Icon; import com.fr.base.BaseUtils; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WHorizontalBoxLayout; import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WVerticalBoxLayout; import com.fr.general.Inter; /** * Author : Shockway * Date: 13-6-17 * Time: 上午10:40 */ public class FormWidgetOption extends WidgetOption { /** * 返回名字 * @return 名字 */ @Override public String optionName() { return null; } /** * 返回图标 * @return 图标 */ @Override public Icon optionIcon() { return null; } /** * 组件类 * @return 类 */ @Override public Class widgetClass() { return null; } /** * 返回组件 * @return 控件 */ @Override public Widget createWidget() { return null; } /* * 表单容器 */ public static WidgetOption[] getFormContainerInstance() { return new WidgetOption[] { ABSOLUTELAYOUTCONTAINER, BORDERLAYOUTCONTAINER, HORIZONTALBOXLAYOUTCONTAINER, VERTICALBOXLAYOUTCONTAINER, CARDLAYOUTCONTAINER, FITLAYOUTCONTAINER }; } /** * 表单工具栏上的布局 * @return 控件 */ public static WidgetOption[] getFormLayoutInstance() { return new WidgetOption[] {CARDLAYOUTCONTAINER, ABSOLUTELAYOUTCONTAINER}; } public static final WidgetOption ABSOLUTELAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_AbsoluteLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_absolute_new.png"), WAbsoluteLayout.class); public static final WidgetOption BORDERLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_BorderLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_border.png"), WBorderLayout.class); public static final WidgetOption CARDLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_CardLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/card_layout_16.png"), WCardLayout.class); public static final WidgetOption HORIZONTALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout-HBox"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_h_16.png"), WHorizontalBoxLayout.class); public static final WidgetOption VERTICALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_VerticalBoxLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WVerticalBoxLayout.class); public static final WidgetOption FITLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WFitLayout.class); public static final WidgetOption PARAMETERCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Para-Body"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter.png"), WParameterLayout.class); public static final WidgetOption ELEMENTCASE = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Form-Report"), BaseUtils.readIcon("/com/fr/web/images/form/resources/report_16.png"), ElementCaseEditor.class); } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java index ed4cf4190..1172a4b64 100644 --- a/designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -20,11 +20,7 @@ import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.Painter; import com.fr.design.designer.beans.events.DesignerEvent; 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; -import com.fr.design.designer.creator.XWFitLayout; -import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.design.designer.creator.*; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.icon.IconPathConstants; @@ -135,8 +131,16 @@ public class FormCreatorDropTarget extends DropTarget { // 取消前一个焦点容器的提示渲染器 designer.setPainter(null); } - - painter = AdapterBus.getContainerPainter(designer, container); + //获取painter的时候要考虑布局之间嵌套的问题 + XLayoutContainer xLayoutContainer = container.getTopLayout(); + if (xLayoutContainer != null && xLayoutContainer.getParent() != null + && ((XLayoutContainer)xLayoutContainer.getParent()).acceptType(XWAbsoluteLayout.class)){ + if(!xLayoutContainer.isEditable()){ + xLayoutContainer = (XLayoutContainer)xLayoutContainer.getParent(); + } + } + painter = AdapterBus.getContainerPainter(designer, + xLayoutContainer != null && xLayoutContainer.acceptType(XWAbsoluteLayout.class) ? xLayoutContainer : container); // 为界面设计器设置提示渲染提示器 designer.setPainter(painter);