|
|
|
@ -24,6 +24,7 @@ import com.fr.design.designer.properties.FRFitLayoutConstraints;
|
|
|
|
|
import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel; |
|
|
|
|
import com.fr.design.file.HistoryTemplateListPane; |
|
|
|
|
import com.fr.design.mainframe.JForm; |
|
|
|
|
import com.fr.design.utils.ComponentUtils; |
|
|
|
|
import com.fr.form.ui.LayoutBorderStyle; |
|
|
|
|
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; |
|
|
|
|
import com.fr.form.ui.container.WLayout; |
|
|
|
@ -44,6 +45,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 构造函数 |
|
|
|
|
* |
|
|
|
|
* @param container XWFitLayout容器 |
|
|
|
|
*/ |
|
|
|
|
public FRFitLayoutAdapter(XLayoutContainer container) { |
|
|
|
@ -104,7 +106,6 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void addParentCreator(XCreator child) { |
|
|
|
|
XLayoutContainer parentPanel = child.initCreatorWrapper(minHeight); |
|
|
|
|
container.add(parentPanel, child.toData().getWidgetName()); |
|
|
|
@ -112,6 +113,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 能否对应位置放置当前组件 |
|
|
|
|
* |
|
|
|
|
* @param creator 组件 |
|
|
|
|
* @param x 添加的位置x,该位置是相对于container的 |
|
|
|
|
* @param y 添加的位置y,该位置是相对于container的 |
|
|
|
@ -162,6 +164,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 是否在组件边缘 |
|
|
|
|
* |
|
|
|
|
* @param x 横坐标 |
|
|
|
|
* @param y 纵坐标 |
|
|
|
|
* @return 是否在组件边缘 |
|
|
|
@ -178,6 +181,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 是否在组件边缘 |
|
|
|
|
* |
|
|
|
|
* @param x 横坐标 |
|
|
|
|
* @param y 纵坐标 |
|
|
|
|
* @param container 参照组件 |
|
|
|
@ -234,6 +238,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 判断是否鼠标在组件的三等分区域,如果组件在布局管理器中间,上下左右都可能会三等分 |
|
|
|
|
* |
|
|
|
|
* @param parentComp 鼠标所在区域的组件 |
|
|
|
|
* @param x 坐标x |
|
|
|
|
* @param y 坐标y |
|
|
|
@ -245,6 +250,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 是否为组件交叉点区域 或者是相邻三组建中间点 |
|
|
|
|
* |
|
|
|
|
* @param currentComp 当前组件 |
|
|
|
|
* @param x 坐标x |
|
|
|
|
* @param y 坐标y |
|
|
|
@ -261,6 +267,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
protected void clearCompsList() { |
|
|
|
|
super.clearCompsList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Rectangle adjustBackupBound(Rectangle backupBound, XWCardMainBorderLayout mainLayout) { |
|
|
|
|
// 参数界面高度对纵坐标产生的影响
|
|
|
|
|
JForm jform = (JForm) (HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); |
|
|
|
@ -284,6 +291,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 拖拽控件边框后,根据控件的大小尺寸,进行相关组件的调整 |
|
|
|
|
* |
|
|
|
|
* @param creator 组件 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
@ -328,6 +336,43 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
updateCreatorBackBound(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 拖拽控件边框后,根据控件的大小尺寸,进行相关组件的调整 |
|
|
|
|
* |
|
|
|
|
* @param backupBound 边界备份 |
|
|
|
|
* @param bounds 组件边界 |
|
|
|
|
* @param xCreator 组件 |
|
|
|
|
* @param row 选中的行 |
|
|
|
|
* @param difference 偏移量 |
|
|
|
|
*/ |
|
|
|
|
public void calculateBounds(Rectangle backupBound, Rectangle bounds, XCreator xCreator, int row, int difference) { |
|
|
|
|
Rectangle rc = new Rectangle(0,0,0,0); |
|
|
|
|
XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(xCreator); |
|
|
|
|
if (parent != null) { |
|
|
|
|
Rectangle rec = ComponentUtils.getRelativeBounds(parent); |
|
|
|
|
rc.x = rec.x; |
|
|
|
|
rc.y = rec.y; |
|
|
|
|
} |
|
|
|
|
int x = backupBound.x - rc.x, y = backupBound.y - rc.y; |
|
|
|
|
//处理左右延伸
|
|
|
|
|
switch (row) { |
|
|
|
|
case 0: |
|
|
|
|
if (backupBound.width + backupBound.x == container.getWidth() - margin.getRight() +rc.x) { |
|
|
|
|
x += difference; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 1: |
|
|
|
|
if(backupBound.y + backupBound.height == container.getHeight() - margin.getBottom() +rc.y){ |
|
|
|
|
y += difference; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
bounds.setLocation(x,y); |
|
|
|
|
xCreator.setBackupBound(backupBound); |
|
|
|
|
xCreator.setBounds(bounds); |
|
|
|
|
this.fix(xCreator); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void dealLeft(Rectangle backupBound, int x, int[] posXs, int difference, XCreator creator) { |
|
|
|
|
if (backupBound.x == margin.getLeft()) { |
|
|
|
|
return; |
|
|
|
@ -614,11 +659,13 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
//重新计算上下两侧组件size、point
|
|
|
|
|
if (CalculateUpRelatComponent(difference)) { |
|
|
|
|
CalculateDownRelatComponent(objY + difference, -difference); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 新拖入组件时,计算调整其他关联组件位置大小 |
|
|
|
|
* |
|
|
|
|
* @param child 新拖入的组件 |
|
|
|
|
* @param x 鼠标所在x坐标 |
|
|
|
|
* @param y 鼠标所在y坐标 |
|
|
|
@ -659,6 +706,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 三等分区域时,调整相关联的组件 |
|
|
|
|
* |
|
|
|
|
* @param currentComp 鼠标所在组件 |
|
|
|
|
* @param child 待插入组件 |
|
|
|
|
*/ |
|
|
|
@ -677,6 +725,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 重新计算内部组件大小 |
|
|
|
|
* |
|
|
|
|
* @param x 坐标x |
|
|
|
|
* @param y 坐标y |
|
|
|
|
* @param creatorWidth 删除的组件之前所在布局的宽度 |
|
|
|
@ -888,9 +937,9 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 拖拽组件时遍历某一侧组件得到该侧组件能够缩放的最小宽度,tab布局最小宽度 = 内部组件数 * 单个组件最小宽度 |
|
|
|
|
* |
|
|
|
|
* @param list 某一侧组件的集合 如:leftComps<Component> |
|
|
|
|
* @return int 最小宽度 |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
private int getCompsMinWidth(List<?> list) { |
|
|
|
|
return getMaxCompsNum(list, true) * WLayout.MIN_WIDTH; |
|
|
|
@ -898,9 +947,9 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 拖拽组件遍历某一侧得到该侧组件能够缩放的最小高度,tab布局最小高度 = 内部组件数 * 单个组件最小高度 + 标题高度 |
|
|
|
|
* |
|
|
|
|
* @param list 某一侧组件集合 |
|
|
|
|
* @return int 最小高度 |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
private int getCompsMinHeight(List<?> list) { |
|
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
@ -915,10 +964,10 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据子组件的横(纵)坐标获取某一侧组件的最大内部组件数 |
|
|
|
|
* |
|
|
|
|
* @param list 某一侧组件集合 |
|
|
|
|
* @param isHor 是否以横坐标为准 |
|
|
|
|
* @return int 最大内部组件数 |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
private int getMaxCompsNum(List<?> list, boolean isHor) { |
|
|
|
|
int maxCompNums = 1; |
|
|
|
@ -940,6 +989,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据偏移量缩放内部组件大小,(tab布局用到) |
|
|
|
|
* |
|
|
|
|
* @param creator tab布局 |
|
|
|
|
* @param offset 偏移量 |
|
|
|
|
* @param isHor 是否为横向拖拽 |
|
|
|
@ -998,6 +1048,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 删除或拉伸控件右边框 调整右侧组件位置大小 |
|
|
|
|
* |
|
|
|
|
* @param objX 调整后的坐标x |
|
|
|
|
* @param objWidth 调整后的宽度 |
|
|
|
|
*/ |
|
|
|
@ -1016,9 +1067,9 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 实际拖拽偏移量是否超出了可调整的宽度范围 |
|
|
|
|
* |
|
|
|
|
* @param offset 实际偏移量 |
|
|
|
|
* @return boolean 是否超出调整范围 |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
private boolean isBeyondAdjustWidthScope(int offset) { |
|
|
|
|
boolean isBeyondScope = false; |
|
|
|
@ -1074,9 +1125,9 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 实际拖拽偏移量是否超出了可调整的高度范围 |
|
|
|
|
* |
|
|
|
|
* @param offset 实际偏移量 |
|
|
|
|
* @return boolean 是否超出调整范围 |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
private boolean isBeyondAdjustHeightScope(int offset) { |
|
|
|
|
boolean isBeyondScope = false; |
|
|
|
@ -1095,6 +1146,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 删除或拉伸上边框 调整上方的组件位置大小 |
|
|
|
|
*/ |
|
|
|
@ -1115,6 +1167,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 不调整,只计算位置 |
|
|
|
|
* |
|
|
|
|
* @return child的位置 |
|
|
|
|
*/ |
|
|
|
|
public int[] getChildPosition(Component currentComp, XCreator child, int x, int y) { |
|
|
|
|