Browse Source

Merge pull request #1113 in BA/design from ~RINOUX/design_ba:release/8.0 to release/8.0

* commit '13ec375751cbb52608067b0b85279c1df59f0129':
  Sonar
  sonarCube2
  sonarCube
  PFC-982 修复工具栏权限颗粒度设置时卡死的问题
master
superman 7 years ago
parent
commit
2b68fba750
  1. 53
      designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java
  2. 15
      designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java

53
designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.FRContext;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
@ -14,12 +15,14 @@ import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.webattr.ToolBarButton; import com.fr.design.webattr.ToolBarButton;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.*; import java.awt.*;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -35,8 +38,12 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane {
private AuthorityToolBarPane authorityToolBarPane; private AuthorityToolBarPane authorityToolBarPane;
private String[] selectedPathArray; private String[] selectedPathArray;
public AuthorityEditToolBarPane(List<ToolBarButton> buttonlists) { public AuthorityEditToolBarPane(List<ToolBarButton> buttonList) {
super(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); super(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
this.init(buttonList);
}
private void init(List<ToolBarButton> buttonList) {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setBorder(null); this.setBorder(null);
UILabel authorityTitle = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Permissions", UILabel authorityTitle = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Permissions",
@ -52,7 +59,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane {
northPane.add(authorityTitle, BorderLayout.CENTER); northPane.add(authorityTitle, BorderLayout.CENTER);
northPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.LINE_COLOR)); northPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.LINE_COLOR));
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
authorityEditPane = new AuthorityEditPane(buttonlists); authorityEditPane = new AuthorityEditPane(buttonList);
this.add(authorityEditPane, BorderLayout.CENTER); this.add(authorityEditPane, BorderLayout.CENTER);
} }
@ -92,27 +99,25 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane {
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
String selectedRole = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName(); String selectedRole = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName();
initSelectedPathArray(); initSelectedPathArray();
if (ComparatorUtils.equals(selectedRole, Inter.getLocText("FR-Designer_Role")) || selectedRole == if (ComparatorUtils.equals(selectedRole, Inter.getLocText("FR-Designer_Role")) || selectedRole == null || selectedPathArray == null) {
null || selectedPathArray == null) {
return; return;
} }
for (int t = 0; t < selectedPathArray.length; t++) { ToolBarButton selectedButton = null;
//是否可见的checkbox
UICheckBox checkbox = (UICheckBox) e.getSource();
for (int i = 0; i < buttonlists.size(); i++) { for (int i = 0; i < buttonlists.size(); i++) {
if (buttonlists.get(i).isSelected()) { if (buttonlists.get(i).isSelected()) {
buttonlists.get(i).changeAuthorityState(selectedPathArray[t], buttonVisible.isSelected()); selectedButton = buttonlists.get(i);
authorityToolBarPane.repaint();
} }
} }
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified(); if (selectedButton != null) {
RolesAlreadyEditedPane.getInstance().refreshDockingView(); for (int t = 0; t < selectedPathArray.length; t++) {
UICheckBox checkbox = (UICheckBox) e.getSource(); selectedButton.changeAuthorityState(selectedPathArray[t], buttonVisible.isSelected());
List<ToolBarButton> btns = AuthorityEditPane.this.buttonlists; authorityToolBarPane.repaint();
for (int j = 0; j < btns.size(); j++) { authorityToolBarPane.setAuthorityWebAttr(selectedButton.getWidget(), checkbox.isSelected(), selectedPathArray[t]);
if (btns.get(j).isSelected()) {
//由引擎实现保存进模板报表
authorityToolBarPane.setAuthorityWebAttr(btns.get(j).getWidget(), checkbox.isSelected(), selectedPathArray[t]);
}
} }
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified();//模版更新
RolesAlreadyEditedPane.getInstance().refreshDockingView();//已配置角色视图刷新
} }
} }
}; };
@ -209,29 +214,29 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane {
public void populateType() { public void populateType() {
if (name.getText() == "") { if (StringUtils.EMPTY.equals(name.getText())) {
type.setText(""); type.setText(StringUtils.EMPTY);
} else { } else {
type.setText(Inter.getLocText(new String[]{"ReportServerP-Toolbar", "FR-Designer_Form_Button"})); type.setText(Inter.getLocText(new String[]{"ReportServerP-Toolbar", "FR-Designer_Form_Button"}));
} }
} }
public void populateName() { public void populateName() {
String names = ""; StringBuilder names = new StringBuilder();
for (int i = 0; i < buttonlists.size(); i++) { for (int i = 0; i < buttonlists.size(); i++) {
if (buttonlists.get(i).isSelected()) { if (buttonlists.get(i).isSelected()) {
names += "," + buttonlists.get(i).getNameOption().optionName(); names.append(",").append(buttonlists.get(i).getNameOption().optionName());
} }
} }
if (names != "") { if (names.length() > 0) {
names = names.substring(1); names.deleteCharAt(0);
} }
name.setText(names); name.setText(names.toString());
} }
public void populateCheckPane() { public void populateCheckPane() {
checkPane.removeAll(); checkPane.removeAll();
if (name.getText() == "") { if (StringUtils.EMPTY.equals(name.getText())) {
return; return;
} }
double f = TableLayout.FILL; double f = TableLayout.FILL;

15
designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java

@ -215,29 +215,25 @@ public class AuthorityToolBarPane<T extends WebContent> extends BasicBeanPane<Re
ReportWebAttr rw = wbTpl.getReportWebAttr(); ReportWebAttr rw = wbTpl.getReportWebAttr();
ConfigManagerProvider cm = ConfigManager.getProviderInstance(); ConfigManagerProvider cm = ConfigManager.getProviderInstance();
ReportWebAttr webAttr = ((ReportWebAttr) cm.getGlobalAttribute(ReportWebAttr.class)); ReportWebAttr webAttr = ((ReportWebAttr) cm.getGlobalAttribute(ReportWebAttr.class));
if (webAttr == null || rw == null || rw.getWebPage() == null) {
return;
}
//wbTpl.clear先清空 //wbTpl.clear先清空
//再将所有的保存进去 //再将所有的保存进去
//看是存在服务器还存在模板里面 //看是存在服务器还存在模板里面
if (choseComboBox.getSelectedIndex() == 0) { if (choseComboBox.getSelectedIndex() == 0) {
//分页 //分页
if (rw == null || rw.getWebPage() == null) {
dealWithWebContent(webAttr.getWebPage(), widget, isSelected, selectedRole); dealWithWebContent(webAttr.getWebPage(), widget, isSelected, selectedRole);
}
} else if (choseComboBox.getSelectedIndex() == 1) { } else if (choseComboBox.getSelectedIndex() == 1) {
//填报 //填报
if (rw == null || rw.getWebPage() == null) {
dealWithWebContent(webAttr.getWebWrite(), widget, isSelected, selectedRole); dealWithWebContent(webAttr.getWebWrite(), widget, isSelected, selectedRole);
}
} else { } else {
//view //view
if (rw == null || rw.getWebPage() == null) {
dealWithWebContent(webAttr.getWebView(), widget, isSelected, selectedRole); dealWithWebContent(webAttr.getWebView(), widget, isSelected, selectedRole);
} }
} }
}
private void dealWithWebContent(WebContent wc, Widget widget, boolean isSelected, String selectedRole) { private void dealWithWebContent(WebContent wc, Widget widget, boolean isSelected, String selectedRole) {
ToolBarManager[] managers = wc.getToolBarManagers(); ToolBarManager[] managers = wc.getToolBarManagers();
if (managers == null) { if (managers == null) {
@ -246,9 +242,7 @@ public class AuthorityToolBarPane<T extends WebContent> extends BasicBeanPane<Re
for (int i = 0; i < managers.length; i++) { for (int i = 0; i < managers.length; i++) {
ToolBar tb = managers[i].getToolBar(); ToolBar tb = managers[i].getToolBar();
for (int j = 0; j < tb.getWidgetSize(); j++) { for (int j = 0; j < tb.getWidgetSize(); j++) {
if (widget instanceof Button && tb.getWidget(j) instanceof Button) { if (widget instanceof Button && tb.getWidget(j) instanceof Button && ComparatorUtils.equals(((Button) widget).getIconName(), ((Button) tb.getWidget(j)).getIconName())) {
if (ComparatorUtils.equals(((Button) widget).getIconName(),
((Button) tb.getWidget(j)).getIconName())) {
if (!isSelected) { if (!isSelected) {
tb.getWidget(j).getWidgetPrivilegeControl().addInvisibleRole(selectedRole); tb.getWidget(j).getWidgetPrivilegeControl().addInvisibleRole(selectedRole);
} else { } else {
@ -257,7 +251,6 @@ public class AuthorityToolBarPane<T extends WebContent> extends BasicBeanPane<Re
} }
} }
} }
}
wc.setToolBarManagers(managers); wc.setToolBarManagers(managers);
} }

Loading…
Cancel
Save