Browse Source

无JIRA任务 修复绝对布局嵌套的问题

master
zhouping 8 years ago
parent
commit
e6b1142de7
  1. 43
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java

43
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java

@ -67,6 +67,25 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator)comp).getTopLayout(); XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator)comp).getTopLayout();
if(topLayout != null){ if(topLayout != null){
if (topLayout.isEditable()){ if (topLayout.isEditable()){
return topLayoutAccept(creator, x, y, topLayout);
}
//绝对布局嵌套,处于内层,不可编辑,不添加,topLayout只能获取到最外层可编辑的布局
else if (((XLayoutContainer)topLayout.getParent()).acceptType(XWAbsoluteLayout.class)) {
return false;
}
else {
return acceptWidget(creator, x, y);
}
}
else{
FRLogger.getLogger().error("top layout is null!");
}
return false;
}
//toplayout假如可以编辑的话就往里面添加组件
private boolean topLayoutAccept(XCreator creator, int x, int y, XLayoutContainer topLayout) {
//判断有没有和当前控件重叠 //判断有没有和当前控件重叠
//先计算当前控件的位置 //先计算当前控件的位置
int creatorX, creatorY; int creatorX, creatorY;
@ -91,28 +110,14 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
return false; return false;
} }
} }
if (creatorX < 0 if (creatorX < 0 || creatorX + creator.getWidth() > container.getWidth()) {
|| creatorX + creator.getWidth() > container.getWidth()
|| creatorY < 0
|| creatorY + creator.getHeight() > container.getHeight()) {
return false; return false;
} }
return x >= 0 && y >= 0 && creator.getHeight() <= container.getHeight() if (creatorY < 0 || creatorY + creator.getHeight() > container.getHeight()){
&& creator.getWidth() <= container.getWidth();
}
//绝对布局嵌套,处于内层,不可编辑,不添加,topLayout只能获取到最外层可编辑的布局
else if (((XLayoutContainer)topLayout.getParent()).acceptType(XWAbsoluteLayout.class)) {
return false; return false;
} }
else { return x >= 0 && y >= 0 && creator.getHeight() <= container.getHeight()
return acceptWidget(creator, x, y); && creator.getWidth() <= container.getWidth();
}
}
else{
FRLogger.getLogger().error("top layout is null!");
}
return false;
} }
/** /**
@ -156,6 +161,7 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
return !ComparatorUtils.equals(trisectAreaDirect, 0); return !ComparatorUtils.equals(trisectAreaDirect, 0);
} }
//当前绝对布局不可编辑,就当成一个控件,组件添加在周围
private boolean acceptWidget(XCreator creator, int x, int y){ private boolean acceptWidget(XCreator creator, int x, int y){
isFindRelatedComps = false; isFindRelatedComps = false;
//拖入组件判断时,先判断是否为交叉点区域,其次三等分区域,再次平分区域 //拖入组件判断时,先判断是否为交叉点区域,其次三等分区域,再次平分区域
@ -235,6 +241,7 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
} }
XWAbsoluteLayout layout = (XWAbsoluteLayout) container; XWAbsoluteLayout layout = (XWAbsoluteLayout) container;
layout.updateBoundsWidget(creator); layout.updateBoundsWidget(creator);
updateCreatorBackBound();
LayoutUtils.layoutRootContainer(container); LayoutUtils.layoutRootContainer(container);
}else{ }else{
fixAbsolute(creator, x, y); fixAbsolute(creator, x, y);

Loading…
Cancel
Save