From 236dece1d88d2e6ea1e1e3da704864438b95574a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 12 May 2022 21:12:27 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-69532=2010.0=E5=88=9B=E5=BB=BA=E5=A4=8D?= =?UTF-8?q?=E7=94=A8=E7=BB=84=E4=BB=B6=E8=B6=85=E5=87=BA960*540=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E7=BB=99=E5=87=BA=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/action/CreateComponentAction.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java b/designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java index 8d2adceb8..1b0f83c12 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java @@ -85,6 +85,8 @@ import static javax.swing.JOptionPane.ERROR_MESSAGE; * 创建组件事件 */ public class CreateComponentAction extends UpdateAction { + private static final double MAX_WIDTH = 960.0; + private static final double MAX_HEIGHT = 540.0; ShareUIAspect aspect; /** * 等待时间 500 ms. @@ -123,6 +125,11 @@ public class CreateComponentAction extends UpdateAction { return; } + if (isBeyondMaxSize(sharedTriple.getRight())) { + showErrMsgDialog(Toolkit.i18nText("Fine-Design_Share_Widget_Size_Error_Tip")); + return; + } + Widget widget = sharedTriple.getLeft(); try { @@ -410,4 +417,20 @@ public class CreateComponentAction extends UpdateAction { } return paras; } + + private boolean isBeyondMaxSize(Rectangle rec) { + double width = rec.getWidth(); + double height = rec.getHeight(); + return width > 0 && height > 0 && (width > MAX_WIDTH || height > MAX_HEIGHT); + } + + private void showErrMsgDialog(String err) { + FineJOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + err, + Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + ERROR_MESSAGE, + IOUtils.readIcon("/com/fr/base/images/share/Information_Icon_warning_normal_32x32.png") + ); + } }