Browse Source

REPORT-5409 【难还原】表单组件在拖动过程中body的自适应布局失效

REPORT-4225 打开高版本cpt,弹出的报错框异常
master
MoMeak 7 years ago
parent
commit
b525011966
  1. 1
      designer_base/src/com/fr/design/dialog/InformationWarnPane.java
  2. 35
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

1
designer_base/src/com/fr/design/dialog/InformationWarnPane.java

@ -143,7 +143,6 @@ public class InformationWarnPane extends JPanel{
contentPane.add(InformationWarnPane.this);
contentPane.add(this.createControlButtonPane());
this.setModal(true);
this.pack();
GUICoreUtils.centerWindow(this);
}

35
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -722,7 +722,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
protected void delete(XCreator creator, int creatorWidth, int creatorHeight) {
int x = creator.getX();
int y = creator.getY();
recalculateChildrenSize(x, y, creatorWidth, creatorHeight);
recalculateChildrenSize(x, y, creatorWidth, creatorHeight, true);
}
/**
@ -734,6 +734,19 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
* @param creatorHeight 删除的组件之前所在布局的高度
*/
public void recalculateChildrenSize(int x, int y, int creatorWidth, int creatorHeight) {
recalculateChildrenSize(x, y, creatorWidth, creatorHeight, false);
}
/**
* 重新计算内部组件大小
*
* @param x 坐标x
* @param y 坐标y
* @param creatorWidth 删除的组件之前所在布局的宽度
* @param creatorHeight 删除的组件之前所在布局的高度
* @param isDel 删除操作
*/
public void recalculateChildrenSize(int x, int y, int creatorWidth, int creatorHeight, boolean isDel) {
if (container.getComponentCount() == 0) {
return;
} else {
@ -744,11 +757,11 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
if (!rightComps.isEmpty() && getAllHeight(rightComps) == height) {
calculateRightRelatComponent(x, width + actualVal);
} else if (!leftComps.isEmpty() && getAllHeight(leftComps) == height) {
calculateLefttRelatComponent(width + actualVal);
calculateLefttRelatComponent(width + actualVal, isDel);
} else if (!downComps.isEmpty() && getAllWidth(downComps) == width) {
calculateDownRelatComponent(y, height + actualVal);
} else if (!upComps.isEmpty() && getAllWidth(upComps) == width) {
calculateUpRelatComponent(height + actualVal);
calculateUpRelatComponent(height + actualVal, isDel);
} else {
// 由于布局三等分的存在,可能会出现删除组件时,找不到关联的组件填充,此时特殊处理
calculateNoRelatedComponent(x, y, width, height);
@ -823,7 +836,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
return;
}
}
recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height);
recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height, true);
}
private void calculateNoRelatedWhileRightBott(Rectangle bound, Component rcomp) {
@ -858,7 +871,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
return;
}
}
recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height);
recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height, true);
}
private int getMinWidth(List<Component> comps) {
@ -1095,7 +1108,11 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
* 删除或拉伸控件左边框时 调整左侧的组件位置大小
*/
protected boolean calculateLefttRelatComponent(int objWidth) {
if (isBeyondAdjustWidthScope(objWidth)) {
return calculateLefttRelatComponent(objWidth, false);
}
protected boolean calculateLefttRelatComponent(int objWidth, boolean isDel) {
if (!isDel && isBeyondAdjustWidthScope(objWidth)) {
return false;
}
int count = leftComps.size();
@ -1153,7 +1170,11 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
* 删除或拉伸上边框 调整上方的组件位置大小
*/
protected boolean calculateUpRelatComponent(int objHeight) {
if (isBeyondAdjustHeightScope(objHeight)) {
return calculateUpRelatComponent(objHeight, false);
}
protected boolean calculateUpRelatComponent(int objHeight, boolean isDel) {
if (!isDel && isBeyondAdjustHeightScope(objHeight)) {
return false;
}
int count = upComps.size();

Loading…
Cancel
Save