From 3167f4339aa8ed5223af6234de8c742d93b3fdb1 Mon Sep 17 00:00:00 2001 From: author Date: Wed, 9 Oct 2019 11:38:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1,sonar?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/designer/creator/cardlayout/XCardAddButton.java | 3 +++ .../main/java/com/fr/design/form/layout/FRTitleLayout.java | 4 ++-- .../java/com/fr/design/mainframe/EditingMouseListener.java | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardAddButton.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardAddButton.java index a25ca05046..7f43c57dfa 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardAddButton.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardAddButton.java @@ -92,6 +92,9 @@ public class XCardAddButton extends XButton { if(cardLayout == null && tagLayout ==null ){ initRelateLayout(); } + if (cardLayout == null) { + throw new IllegalArgumentException("cardLayout can not be null"); + } int index = cardLayout.toData().getWidgetCount(); //添加新的tab,并将原来的设为未选中状态 diff --git a/designer-form/src/main/java/com/fr/design/form/layout/FRTitleLayout.java b/designer-form/src/main/java/com/fr/design/form/layout/FRTitleLayout.java index 413cbf2421..65f037b04c 100644 --- a/designer-form/src/main/java/com/fr/design/form/layout/FRTitleLayout.java +++ b/designer-form/src/main/java/com/fr/design/form/layout/FRTitleLayout.java @@ -126,9 +126,9 @@ public class FRTitleLayout implements FRLayoutManager, LayoutManager{ int titleH = title==null ? 0 : WTitleLayout.TITLE_HEIGHT; for (int i=0; i< target.getComponentCount(); i++) { Component comp = target.getComponent(i); - if (comp == title) { + if (comp != null && comp == title) { comp.setBounds(0, 0, width, WTitleLayout.TITLE_HEIGHT); - } else if (comp == body) { + } else if (comp != null && comp == body) { int y = titleH+gap; comp.setBounds(0, y, width, height-y); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java index 3c03ba38d7..07cb7f93a3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java @@ -573,8 +573,8 @@ public class EditingMouseListener extends MouseInputAdapter { GUICoreUtils.showPopupMenu(cellPopupMenu, designer, e.getX(), e.getY()); } } + creator.doLayout(); } - creator.doLayout(); LayoutUtils.layoutRootContainer(designer.getRootComponent()); } From 733a6f28257c86e696699057c6c1bedd12fcd0d0 Mon Sep 17 00:00:00 2001 From: author Date: Wed, 9 Oct 2019 12:29:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1,sonar?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/form/layout/FRTitleLayout.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/form/layout/FRTitleLayout.java b/designer-form/src/main/java/com/fr/design/form/layout/FRTitleLayout.java index 65f037b04c..0ba996258a 100644 --- a/designer-form/src/main/java/com/fr/design/form/layout/FRTitleLayout.java +++ b/designer-form/src/main/java/com/fr/design/form/layout/FRTitleLayout.java @@ -126,11 +126,13 @@ public class FRTitleLayout implements FRLayoutManager, LayoutManager{ int titleH = title==null ? 0 : WTitleLayout.TITLE_HEIGHT; for (int i=0; i< target.getComponentCount(); i++) { Component comp = target.getComponent(i); - if (comp != null && comp == title) { - comp.setBounds(0, 0, width, WTitleLayout.TITLE_HEIGHT); - } else if (comp != null && comp == body) { - int y = titleH+gap; - comp.setBounds(0, y, width, height-y); + if (comp != null) { + if (comp == title) { + comp.setBounds(0, 0, width, WTitleLayout.TITLE_HEIGHT); + } else if (comp == body) { + int y = titleH + gap; + comp.setBounds(0, y, width, height-y); + } } } }