|
|
@ -3,12 +3,6 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package com.fr.design.designer.beans.adapters.layout; |
|
|
|
package com.fr.design.designer.beans.adapters.layout; |
|
|
|
|
|
|
|
|
|
|
|
import java.awt.Component; |
|
|
|
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
|
|
|
import java.awt.Rectangle; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.design.beans.GroupModel; |
|
|
|
import com.fr.design.beans.GroupModel; |
|
|
|
import com.fr.design.designer.beans.ConstraintsGroupModel; |
|
|
|
import com.fr.design.designer.beans.ConstraintsGroupModel; |
|
|
|
import com.fr.design.designer.beans.HoverPainter; |
|
|
|
import com.fr.design.designer.beans.HoverPainter; |
|
|
@ -22,14 +16,16 @@ import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; |
|
|
|
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; |
|
|
|
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; |
|
|
|
import com.fr.design.designer.properties.FRFitLayoutConstraints; |
|
|
|
import com.fr.design.designer.properties.FRFitLayoutConstraints; |
|
|
|
import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel; |
|
|
|
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.design.utils.ComponentUtils; |
|
|
|
import com.fr.form.ui.LayoutBorderStyle; |
|
|
|
import com.fr.form.ui.LayoutBorderStyle; |
|
|
|
|
|
|
|
import com.fr.form.ui.container.WAbsoluteLayout; |
|
|
|
import com.fr.form.ui.container.WLayout; |
|
|
|
import com.fr.form.ui.container.WLayout; |
|
|
|
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; |
|
|
|
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; |
|
|
|
|
|
|
|
|
|
|
|
import java.awt.*; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 自适应布局的容器适配器 |
|
|
|
* 自适应布局的容器适配器 |
|
|
@ -52,6 +48,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { |
|
|
|
public void setEdit(boolean edit) { |
|
|
|
public void setEdit(boolean edit) { |
|
|
|
isEdit = edit; |
|
|
|
isEdit = edit; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 构造函数 |
|
|
|
* 构造函数 |
|
|
|
* |
|
|
|
* |
|
|
@ -134,7 +131,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { |
|
|
|
isFindRelatedComps = false; |
|
|
|
isFindRelatedComps = false; |
|
|
|
//拖入组件判断时,先判断是否为交叉点区域,其次三等分区域,再次平分区域
|
|
|
|
//拖入组件判断时,先判断是否为交叉点区域,其次三等分区域,再次平分区域
|
|
|
|
Component comp = container.getComponentAt(x, y); |
|
|
|
Component comp = container.getComponentAt(x, y); |
|
|
|
if (checkInterval(comp)) { |
|
|
|
if (comp == null || checkInterval(comp)) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
//如果当前处于边缘地带, 那么就把他贴到父容器上
|
|
|
|
//如果当前处于边缘地带, 那么就把他贴到父容器上
|
|
|
@ -269,25 +266,14 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { |
|
|
|
return super.isCrossPointArea(currentComp, x, y); |
|
|
|
return super.isCrossPointArea(currentComp, x, y); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void initCompsList() { |
|
|
|
|
|
|
|
super.initCompsList(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void clearCompsList() { |
|
|
|
|
|
|
|
super.clearCompsList(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected Rectangle getLayoutBound(XWCardMainBorderLayout mainLayout) { |
|
|
|
protected Rectangle getLayoutBound(XWCardMainBorderLayout mainLayout) { |
|
|
|
return mainLayout.getBounds(); |
|
|
|
return mainLayout.getBounds(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Rectangle adjustBackupBound(Rectangle backupBound, XWCardMainBorderLayout mainLayout) { |
|
|
|
private Rectangle adjustBackupBound(Rectangle backupBound, XWCardMainBorderLayout mainLayout) { |
|
|
|
// 参数界面高度对纵坐标产生的影响
|
|
|
|
// zhouping: REPORT-2334 表单tab布局中图表放大缩小会明显
|
|
|
|
JForm jform = (JForm) (HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); |
|
|
|
// 这边不需要单独处理参数面板高度了,下面的方法中获取的是XWCardMainBorderLayout相对坐标
|
|
|
|
if (jform.getFormDesign().getParaComponent() != null) { |
|
|
|
|
|
|
|
backupBound.y -= jform.getFormDesign().getParaHeight(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rectangle rec = getLayoutBound(mainLayout); |
|
|
|
Rectangle rec = getLayoutBound(mainLayout); |
|
|
|
// XWTabLayout里面的横纵坐标收到外层XWCardMainBorderLayout的横纵坐标影响
|
|
|
|
// XWTabLayout里面的横纵坐标收到外层XWCardMainBorderLayout的横纵坐标影响
|
|
|
|
// 减掉之后可以按照它原来的逻辑执行
|
|
|
|
// 减掉之后可以按照它原来的逻辑执行
|
|
|
@ -558,8 +544,8 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { |
|
|
|
difference = Math.max(difference, minWidth - getMinWidth(leftComps)); |
|
|
|
difference = Math.max(difference, minWidth - getMinWidth(leftComps)); |
|
|
|
} |
|
|
|
} |
|
|
|
//重新计算左右两侧组件size、point
|
|
|
|
//重新计算左右两侧组件size、point
|
|
|
|
if (CalculateLefttRelatComponent(difference)) { |
|
|
|
if (calculateLefttRelatComponent(difference)) { |
|
|
|
CalculateRightRelatComponent(objx + difference, -difference); |
|
|
|
calculateRightRelatComponent(objx + difference, -difference); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -674,10 +660,9 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { |
|
|
|
difference = Math.max(difference, minHeight - getMinHeight(upComps)); |
|
|
|
difference = Math.max(difference, minHeight - getMinHeight(upComps)); |
|
|
|
} |
|
|
|
} |
|
|
|
//重新计算上下两侧组件size、point
|
|
|
|
//重新计算上下两侧组件size、point
|
|
|
|
if (CalculateUpRelatComponent(difference)) { |
|
|
|
if (calculateUpRelatComponent(difference)) { |
|
|
|
CalculateDownRelatComponent(objY + difference, -difference); |
|
|
|
calculateDownRelatComponent(objY + difference, -difference); |
|
|
|
} |
|
|
|
} |
|
|
|
; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -757,13 +742,13 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { |
|
|
|
int height = creatorHeight; |
|
|
|
int height = creatorHeight; |
|
|
|
calculateRelatedComponent(x, y, width, height); |
|
|
|
calculateRelatedComponent(x, y, width, height); |
|
|
|
if (!rightComps.isEmpty() && getAllHeight(rightComps) == height) { |
|
|
|
if (!rightComps.isEmpty() && getAllHeight(rightComps) == height) { |
|
|
|
CalculateRightRelatComponent(x, width + actualVal); |
|
|
|
calculateRightRelatComponent(x, width + actualVal); |
|
|
|
} else if (!leftComps.isEmpty() && getAllHeight(leftComps) == height) { |
|
|
|
} else if (!leftComps.isEmpty() && getAllHeight(leftComps) == height) { |
|
|
|
CalculateLefttRelatComponent(width + actualVal); |
|
|
|
calculateLefttRelatComponent(width + actualVal); |
|
|
|
} else if (!downComps.isEmpty() && getAllWidth(downComps) == width) { |
|
|
|
} else if (!downComps.isEmpty() && getAllWidth(downComps) == width) { |
|
|
|
CalculateDownRelatComponent(y, height + actualVal); |
|
|
|
calculateDownRelatComponent(y, height + actualVal); |
|
|
|
} else if (!upComps.isEmpty() && getAllWidth(upComps) == width) { |
|
|
|
} else if (!upComps.isEmpty() && getAllWidth(upComps) == width) { |
|
|
|
CalculateUpRelatComponent(height + actualVal); |
|
|
|
calculateUpRelatComponent(height + actualVal); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// 由于布局三等分的存在,可能会出现删除组件时,找不到关联的组件填充,此时特殊处理
|
|
|
|
// 由于布局三等分的存在,可能会出现删除组件时,找不到关联的组件填充,此时特殊处理
|
|
|
|
calculateNoRelatedComponent(x, y, width, height); |
|
|
|
calculateNoRelatedComponent(x, y, width, height); |
|
|
@ -1026,7 +1011,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { |
|
|
|
setAdjustedSize(tabLayout, offset, isHor); |
|
|
|
setAdjustedSize(tabLayout, offset, isHor); |
|
|
|
for (int m = 0; m < tabLayout.getComponentCount(); m++) { |
|
|
|
for (int m = 0; m < tabLayout.getComponentCount(); m++) { |
|
|
|
XCreator childCreator = tabLayout.getXCreator(m); |
|
|
|
XCreator childCreator = tabLayout.getXCreator(m); |
|
|
|
BoundsWidget wgt = (BoundsWidget) tabLayout.toData().getBoundsWidget(childCreator.toData()); |
|
|
|
WAbsoluteLayout.BoundsWidget wgt = (WAbsoluteLayout.BoundsWidget) tabLayout.toData().getBoundsWidget(childCreator.toData()); |
|
|
|
wgt.setBounds(tabLayout.getComponent(m).getBounds()); |
|
|
|
wgt.setBounds(tabLayout.getComponent(m).getBounds()); |
|
|
|
} |
|
|
|
} |
|
|
|
adjustCreatorsSize(percent, tabLayout, isHor); |
|
|
|
adjustCreatorsSize(percent, tabLayout, isHor); |
|
|
@ -1069,7 +1054,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { |
|
|
|
* @param objX 调整后的坐标x |
|
|
|
* @param objX 调整后的坐标x |
|
|
|
* @param objWidth 调整后的宽度 |
|
|
|
* @param objWidth 调整后的宽度 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected void CalculateRightRelatComponent(int objX, int objWidth) { |
|
|
|
protected void calculateRightRelatComponent(int objX, int objWidth) { |
|
|
|
int count = rightComps.size(); |
|
|
|
int count = rightComps.size(); |
|
|
|
for (int i = 0; i < count; i++) { |
|
|
|
for (int i = 0; i < count; i++) { |
|
|
|
XCreator creator = (XCreator) rightComps.get(i); |
|
|
|
XCreator creator = (XCreator) rightComps.get(i); |
|
|
@ -1109,7 +1094,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 删除或拉伸控件左边框时 调整左侧的组件位置大小; |
|
|
|
* 删除或拉伸控件左边框时 调整左侧的组件位置大小; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected boolean CalculateLefttRelatComponent(int objWidth) { |
|
|
|
protected boolean calculateLefttRelatComponent(int objWidth) { |
|
|
|
if (isBeyondAdjustWidthScope(objWidth)) { |
|
|
|
if (isBeyondAdjustWidthScope(objWidth)) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
@ -1127,7 +1112,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 删除或拉伸下边框 调整下方的组件位置大小 |
|
|
|
* 删除或拉伸下边框 调整下方的组件位置大小 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected void CalculateDownRelatComponent(int objY, int objHeight) { |
|
|
|
protected void calculateDownRelatComponent(int objY, int objHeight) { |
|
|
|
int count = downComps.size(); |
|
|
|
int count = downComps.size(); |
|
|
|
for (int i = 0; i < count; i++) { |
|
|
|
for (int i = 0; i < count; i++) { |
|
|
|
XCreator creator = (XCreator) downComps.get(i); |
|
|
|
XCreator creator = (XCreator) downComps.get(i); |
|
|
@ -1167,7 +1152,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 删除或拉伸上边框 调整上方的组件位置大小 |
|
|
|
* 删除或拉伸上边框 调整上方的组件位置大小 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected boolean CalculateUpRelatComponent(int objHeight) { |
|
|
|
protected boolean calculateUpRelatComponent(int objHeight) { |
|
|
|
if (isBeyondAdjustHeightScope(objHeight)) { |
|
|
|
if (isBeyondAdjustHeightScope(objHeight)) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|