From 01fcdf0740a4df44667977dd1dedecdb7a391a80 Mon Sep 17 00:00:00 2001 From: rinoux Date: Thu, 24 Aug 2017 11:31:46 +0800 Subject: [PATCH 1/4] =?UTF-8?q?PFC-982=20=E4=BF=AE=E5=A4=8D=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=A0=8F=E6=9D=83=E9=99=90=E9=A2=97=E7=B2=92=E5=BA=A6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=97=B6=E5=8D=A1=E6=AD=BB=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/AuthorityEditToolBarPane.java | 31 ++++++++++--------- .../mainframe/AuthorityToolBarPane.java | 31 ++++++++++--------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java b/designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java index a760e0043..d26b2d6eb 100644 --- a/designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java +++ b/designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe; +import com.fr.base.FRContext; import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.file.HistoryTemplateListPane; @@ -20,6 +21,7 @@ import javax.swing.tree.TreePath; import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.util.ArrayList; import java.util.List; /** @@ -96,23 +98,22 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane { null || selectedPathArray == null) { return; } - for (int t = 0; t < selectedPathArray.length; t++) { - for (int i = 0; i < buttonlists.size(); i++) { - if (buttonlists.get(i).isSelected()) { - buttonlists.get(i).changeAuthorityState(selectedPathArray[t], buttonVisible.isSelected()); - authorityToolBarPane.repaint(); - } + ToolBarButton selectedButton = null; + //是否可见的checkbox + UICheckBox checkbox = (UICheckBox) e.getSource(); + for (int i = 0; i < buttonlists.size(); i++) { + if (buttonlists.get(i).isSelected()) { + selectedButton = buttonlists.get(i); } - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified(); - RolesAlreadyEditedPane.getInstance().refreshDockingView(); - UICheckBox checkbox = (UICheckBox) e.getSource(); - List btns = AuthorityEditPane.this.buttonlists; - for (int j = 0; j < btns.size(); j++) { - if (btns.get(j).isSelected()) { - //由引擎实现保存进模板报表 - authorityToolBarPane.setAuthorityWebAttr(btns.get(j).getWidget(), checkbox.isSelected(), selectedPathArray[t]); - } + } + if (selectedButton != null) { + for (int t = 0; t < selectedPathArray.length; t++) { + selectedButton.changeAuthorityState(selectedPathArray[t], buttonVisible.isSelected()); + authorityToolBarPane.repaint(); + authorityToolBarPane.setAuthorityWebAttr(selectedButton.getWidget(), checkbox.isSelected(), selectedPathArray[t]); } + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified();//模版更新 + RolesAlreadyEditedPane.getInstance().refreshDockingView();//已配置角色视图刷新 } } }; diff --git a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java index da856173a..53c8893ec 100644 --- a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java +++ b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java @@ -219,23 +219,24 @@ public class AuthorityToolBarPane extends BasicBeanPane Date: Thu, 24 Aug 2017 14:51:24 +0800 Subject: [PATCH 2/4] sonarCube --- .../mainframe/AuthorityEditToolBarPane.java | 28 +++++++++------- .../mainframe/AuthorityToolBarPane.java | 33 ++++++++++--------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java b/designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java index d26b2d6eb..0b016c57e 100644 --- a/designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java +++ b/designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java @@ -15,6 +15,7 @@ import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.webattr.ToolBarButton; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; +import com.fr.stable.StringUtils; import javax.swing.*; import javax.swing.tree.TreePath; @@ -37,8 +38,12 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane { private AuthorityToolBarPane authorityToolBarPane; private String[] selectedPathArray; - public AuthorityEditToolBarPane(List buttonlists) { + public AuthorityEditToolBarPane(List buttonList) { super(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); + this.init(buttonList); + } + + private void init(List buttonList) { this.setLayout(new BorderLayout()); this.setBorder(null); UILabel authorityTitle = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Permissions", @@ -54,7 +59,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane { northPane.add(authorityTitle, BorderLayout.CENTER); northPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.LINE_COLOR)); this.add(northPane, BorderLayout.NORTH); - authorityEditPane = new AuthorityEditPane(buttonlists); + authorityEditPane = new AuthorityEditPane(buttonList); this.add(authorityEditPane, BorderLayout.CENTER); } @@ -94,8 +99,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane { public void itemStateChanged(ItemEvent e) { String selectedRole = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName(); initSelectedPathArray(); - if (ComparatorUtils.equals(selectedRole, Inter.getLocText("FR-Designer_Role")) || selectedRole == - null || selectedPathArray == null) { + if (ComparatorUtils.equals(selectedRole, Inter.getLocText("FR-Designer_Role")) || selectedRole == null || selectedPathArray == null) { return; } ToolBarButton selectedButton = null; @@ -210,29 +214,29 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane { public void populateType() { - if (name.getText() == "") { - type.setText(""); + if (StringUtils.EMPTY.equals(name.getText())) { + type.setText(StringUtils.EMPTY); } else { type.setText(Inter.getLocText(new String[]{"ReportServerP-Toolbar", "FR-Designer_Form_Button"})); } } public void populateName() { - String names = ""; + StringBuilder names = new StringBuilder(); for (int i = 0; i < buttonlists.size(); i++) { if (buttonlists.get(i).isSelected()) { - names += "," + buttonlists.get(i).getNameOption().optionName(); + names.append(",").append(buttonlists.get(i).getNameOption().optionName()); } } - if (names != "") { - names = names.substring(1); + if (names.length() > 0) { + names.deleteCharAt(0); } - name.setText(names); + name.setText(names.toString()); } public void populateCheckPane() { checkPane.removeAll(); - if (name.getText() == "") { + if (StringUtils.EMPTY.equals(name.getText())) { return; } double f = TableLayout.FILL; diff --git a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java index 53c8893ec..44125ce1b 100644 --- a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java +++ b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java @@ -215,26 +215,27 @@ public class AuthorityToolBarPane extends BasicBeanPane Date: Thu, 24 Aug 2017 14:55:24 +0800 Subject: [PATCH 3/4] sonarCube2 --- .../fr/design/mainframe/AuthorityToolBarPane.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java index 44125ce1b..682ddc308 100644 --- a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java +++ b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java @@ -215,7 +215,7 @@ public class AuthorityToolBarPane extends BasicBeanPane extends BasicBeanPane Date: Thu, 24 Aug 2017 15:06:46 +0800 Subject: [PATCH 4/4] Sonar --- .../fr/design/mainframe/AuthorityToolBarPane.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java index 682ddc308..7cd193086 100644 --- a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java +++ b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java @@ -242,14 +242,11 @@ public class AuthorityToolBarPane extends BasicBeanPane