Browse Source

Pull request #6168: REPORT-60528 决策报表,给一个高度较小的tab内拖入报表块,会触发弹窗提示“超出或者小于tablayout边界,不能调整大小”;客户模板的弹窗不断触发导致设计器无法操作使用

Merge in DESIGN/design from ~FANGLEI/design10.0:release/10.0 to release/10.0

* commit 'f62372fd9be56a77c0db6288847e85dd1c4e795f':
  REPORT-60528 决策报表,给一个高度较小的tab内拖入报表块,会触发弹窗提示“超出或者小于tablayout边界,不能调整大小”;客户模板的弹窗不断触发导致设计器无法操作使用
zheng-1641779399395
fanglei 3 years ago
parent
commit
791f79a7e9
  1. 49
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java

49
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java

@ -4,11 +4,12 @@ import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.form.layout.FRBorderLayout;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.ui.util.UIUtil;
import com.fr.general.ComparatorUtils;
import javax.swing.JOptionPane;
import java.awt.BorderLayout;
import java.awt.Rectangle;
@ -46,18 +47,42 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter {
Rectangle rectangle = creator.getBounds();
//不能超出控件边界
if (ComparatorUtils.equals(constraints, BorderLayout.NORTH) || ComparatorUtils.equals(constraints, BorderLayout.SOUTH)) {
int containerHeight = container.getHeight();
if (rectangle.height > containerHeight) {
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds"));
return true;
}
return isBeyondMinConstraint(rectangle.height, container.getHeight());
} else if (ComparatorUtils.equals(constraints, BorderLayout.EAST) || ComparatorUtils.equals(constraints, BorderLayout.WEST)) {
int containerWidth = container.getWidth();
if (rectangle.width > containerWidth) {
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds"));
return true;
}
return isBeyondMinConstraint(rectangle.width, container.getWidth());
}
return false;
}
/**
* 是否超出最小限制
*
* @param minConstraint 最小限制
* @param value 数值
* @return 是否超出最小限制
*/
private boolean isBeyondMinConstraint(int minConstraint, int value) {
if (minConstraint > value) {
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds"));
if (container.getBackupBound() != null) {
// 手动拖动导致变矮的场景
container.setSize(container.getBackupBound().getSize());
} else {
// 自适应布局平分高度导致变矮的场景
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jt != null) {
jt.undo();
}
}
});
}
return true;
} else {
return false;
}
}
}

Loading…
Cancel
Save