From 6e3d656b8c2fbc456f04dbbc40c96f768df08dd6 Mon Sep 17 00:00:00 2001 From: Maksim Date: Wed, 11 Sep 2019 10:47:16 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-20323=20sonar=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/cell/style/AlignmentAction.java | 6 ++++-- .../fr/design/actions/cell/style/ReportFontSizeAction.java | 3 ++- .../java/com/fr/design/dscolumn/DSColumnAdvancedPane.java | 6 +----- .../com/fr/design/dscolumn/SelectedDataColumnPane.java | 2 +- .../java/com/fr/design/javascript/ListenerEditPane.java | 5 +++-- .../com/fr/design/mainframe/AuthorityEditToolBarPane.java | 7 ++++--- .../java/com/fr/design/mainframe/FormatBrushAction.java | 2 +- .../src/main/java/com/fr/design/mainframe/JWorkBook.java | 5 +++-- .../com/fr/design/mainframe/SheetAuthorityEditPane.java | 3 ++- 9 files changed, 21 insertions(+), 18 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java index df56afc581..8dab29a0d2 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java @@ -110,8 +110,10 @@ public class AlignmentAction extends ButtonGroupAction implements StyleActionInt group.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Right")}); } for (int i = 0; i < 3; i++) { - group.getButton(i).setRoundBorder(true, UIConstants.ARC); - group.getButton(i).setBorderPainted(true); + if (group != null) { + group.getButton(i).setRoundBorder(true, UIConstants.ARC); + group.getButton(i).setBorderPainted(true); + } } return group; } diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontSizeAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontSizeAction.java index 7a3563be46..5a19a507bd 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontSizeAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontSizeAction.java @@ -15,6 +15,7 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.mainframe.ElementCasePane; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; +import com.fr.stable.AssistUtils; /** @@ -51,7 +52,7 @@ public class ReportFontSizeAction extends AbstractStyleAction { if (style.getFRFont().getSize() == defStyle.getFRFont().getSize()) { style = StyleUtils.setReportFontSize(style, defStyle.getFRFont().getSize()); } - if (selectedFontSize == style.getFRFont().getSize()) { + if (AssistUtils.equals(selectedFontSize, style.getFRFont().getSize())){ return style; } style = StyleUtils.setReportFontSize(style, selectedFontSize); diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java index 7f86dd2eea..0941b4b220 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java @@ -247,11 +247,7 @@ public class DSColumnAdvancedPane extends BasicPane { this.sortOrderComboBox.setSortOrder(new SortOrder(sort)); String sortFormula = dSColumn.getSortFormula(); - if (sortFormula != null && sortFormula.length() >= 1) { - sortFormulaTextField.setText(sortFormula); - } else { - sortFormulaTextField.setText(sortFormula); - } + sortFormulaTextField.setText(sortFormula); } public void update(CellElement cellElement) { diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java index 2707685b52..ad670abf33 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -263,7 +263,7 @@ public class SelectedDataColumnPane extends BasicPane { SimpleDSColumn simpleDSColumn = updateColumnPane(); dsColumn.setDSName(Objects.requireNonNull(simpleDSColumn).getDsName()); - dsColumn.setColumn(simpleDSColumn.getColumn()); + dsColumn.setColumn(Objects.requireNonNull(simpleDSColumn).getColumn()); dsColumn.setParameters((ps != null && ps.length > 0) ? ps : null); } diff --git a/designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java b/designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java index 91ccd38028..5f1f941faa 100644 --- a/designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java +++ b/designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java @@ -140,10 +140,11 @@ public class ListenerEditPane extends BasicBeanPane { @Override public void populateBean(Listener listener) { - this.listener = listener; - if (this.listener == null) { + if (listener == null){ this.listener = new Listener(); + return; } + this.listener = listener; this.nameText.setText(listener.getEventName()); JavaScript js = listener.getAction(); for (int i = 0; i < this.cards.size(); i++) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityEditToolBarPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityEditToolBarPane.java index f6f2b7a10b..6224bcfebe 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityEditToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/AuthorityEditToolBarPane.java @@ -13,6 +13,7 @@ import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.webattr.ToolBarButton; import com.fr.general.ComparatorUtils; +import com.fr.stable.StringUtils; import javax.swing.*; @@ -204,7 +205,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane { public void populateType() { - if (name.getText() == "") { + if (StringUtils.isEmpty(name.getText())) { type.setText(""); } else { type.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Toolbar_Button")); @@ -218,7 +219,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane { names += "," + buttonlists.get(i).getNameOption().optionName(); } } - if (names != "") { + if (StringUtils.isNotEmpty(names)) { names = names.substring(1); } name.setText(names); @@ -226,7 +227,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane { public void populateCheckPane() { checkPane.removeAll(); - if (name.getText() == "") { + if (StringUtils.isEmpty(name.getText())) { return; } double f = TableLayout.FILL; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java b/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java index 56d4d33ece..76298161f0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java @@ -157,7 +157,7 @@ public class FormatBrushAction extends ElementCaseAction { } Style style = cellElement.getStyle(); if (style == null) { - style = style.DEFAULT_STYLE; + style = Style.DEFAULT_STYLE; } referencedStyle[i][j] = style; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index e5cb04b0fa..f7e9ed7659 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -89,6 +89,7 @@ import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.poly.PolyWorkSheet; import com.fr.report.worksheet.WorkSheet; import com.fr.stable.ArrayUtils; +import com.fr.stable.AssistUtils; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.module.Module; @@ -469,7 +470,7 @@ public class JWorkBook extends JTemplate { double creatorWidth = blockCreator.getEditorBounds().width; double areaHeight = polyDezi.polyArea.getHeight(); double areaWidth = polyDezi.polyArea.getWidth(); - if (creatorWidth == 0 || creatorHeight == 0) { + if(AssistUtils.equals(creatorWidth,0) || AssistUtils.equals(creatorHeight,0)){ return resolution; } double time = (areaHeight / creatorHeight) < (areaWidth / creatorWidth) ? (areaHeight / creatorHeight) : (areaWidth / creatorWidth); @@ -486,7 +487,7 @@ public class JWorkBook extends JTemplate { int row = reportPane.getSelection().getSelectedRows()[0]; double rowLength = reportPane.getSelection().getSelectedRows().length; double rowExtent = reportPane.getGrid().getVerticalExtent(); - if (columnLength == 0 || rowLength == 0) { + if(AssistUtils.equals(columnLength,0) || AssistUtils.equals(rowLength,0)){ return resolution; } double time = (columnExtent / columnLength) < (rowExtent / rowLength) ? (columnExtent / columnLength) : (rowExtent / rowLength); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/SheetAuthorityEditPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/SheetAuthorityEditPane.java index e3a9ff86db..f559c828fc 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/SheetAuthorityEditPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/SheetAuthorityEditPane.java @@ -13,6 +13,7 @@ import com.fr.general.ComparatorUtils; import com.fr.main.impl.WorkBook; import com.fr.privilege.finegrain.WorkSheetPrivilegeControl; import com.fr.report.worksheet.WorkSheet; +import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; @@ -115,7 +116,7 @@ public class SheetAuthorityEditPane extends AuthorityEditPane { populateName(); populateType(); checkPane.removeAll(); - if (name.getText() == "") { + if (StringUtils.isEmpty(name.getText())){ return; } checkPane.add(populateCheckPane(), BorderLayout.CENTER);