|
|
|
@ -60,6 +60,13 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
if (comp == null){ |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
//参数面板内的组件不允许拖往绝对布局中
|
|
|
|
|
if (creator.getParent() != null && ((XCreator)creator.getParent()).acceptType(XWParameterLayout.class)){ |
|
|
|
|
Rectangle rec = creator.getBounds(); |
|
|
|
|
rec.y = creator.getParent().getHeight() - rec.height; |
|
|
|
|
creator.setBounds(rec); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
//判断下组件能不能拖入绝对布局
|
|
|
|
|
if (!creator.canEnterIntoAbsolutePane()){ |
|
|
|
|
return false; |
|
|
|
@ -67,6 +74,25 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator)comp).getTopLayout(); |
|
|
|
|
if(topLayout != null){ |
|
|
|
|
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; |
|
|
|
@ -91,28 +117,14 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (creatorX < 0 |
|
|
|
|
|| creatorX + creator.getWidth() > container.getWidth() |
|
|
|
|
|| creatorY < 0 |
|
|
|
|
|| creatorY + creator.getHeight() > container.getHeight()) { |
|
|
|
|
if (creatorX < 0 || creatorX + creator.getWidth() > container.getWidth()) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
return x >= 0 && y >= 0 && creator.getHeight() <= container.getHeight() |
|
|
|
|
&& creator.getWidth() <= container.getWidth(); |
|
|
|
|
} |
|
|
|
|
//绝对布局嵌套,处于内层,不可编辑,不添加,topLayout只能获取到最外层可编辑的布局
|
|
|
|
|
else if (((XLayoutContainer)topLayout.getParent()).acceptType(XWAbsoluteLayout.class)) { |
|
|
|
|
if (creatorY < 0 || creatorY + creator.getHeight() > container.getHeight()){ |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
return acceptWidget(creator, x, y); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
FRLogger.getLogger().error("top layout is null!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
return x >= 0 && y >= 0 && creator.getHeight() <= container.getHeight() |
|
|
|
|
&& creator.getWidth() <= container.getWidth(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -156,6 +168,7 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
return !ComparatorUtils.equals(trisectAreaDirect, 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//当前绝对布局不可编辑,就当成一个控件,组件添加在周围
|
|
|
|
|
private boolean acceptWidget(XCreator creator, int x, int y){ |
|
|
|
|
isFindRelatedComps = false; |
|
|
|
|
//拖入组件判断时,先判断是否为交叉点区域,其次三等分区域,再次平分区域
|
|
|
|
@ -235,6 +248,7 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
} |
|
|
|
|
XWAbsoluteLayout layout = (XWAbsoluteLayout) container; |
|
|
|
|
layout.updateBoundsWidget(creator); |
|
|
|
|
updateCreatorBackBound(); |
|
|
|
|
LayoutUtils.layoutRootContainer(container); |
|
|
|
|
}else{ |
|
|
|
|
fixAbsolute(creator, x, y); |
|
|
|
|