Browse Source

Merge pull request #1130 in BA/design from ~NEIL/design:release/8.0 to master

* commit '96269140176b56a0401819f547254c4260f96356': (50 commits)
  1
  1
  1
  Sonar
  sonarCube2
  sonarCube
  PFC-982 修复工具栏权限颗粒度设置时卡死的问题
  bugfix
  pmd
  pmd
  pmd
  pmd
  PFC-607 插件安装删除更新不重启支持 移植9.0的加密方式
  pmd
  pmd
  添加Env版本区间判断
  fix
  pmd
  插件EnvVersion检测
  插件EnvVersion检测
  ...
master
neil 7 years ago
parent
commit
c9be85de41
  1. 1
      build.performance.gradle
  2. 53
      designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java
  3. 15
      designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java
  4. 8
      designer/src/com/fr/design/mainframe/templateinfo/JWorkBookProcessInfo.java
  5. 2
      designer/src/com/fr/design/report/ReportBackgroundPane.java
  6. 2
      designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java
  7. 33
      designer_base/src/com/fr/design/extra/PluginHelper.java
  8. 3
      designer_base/src/com/fr/start/BaseDesigner.java
  9. 22
      designer_base/src/com/fr/start/StartServer.java
  10. 45
      designer_chart/src/com/fr/design/chart/series/PlotSeries/MapImageEditPane.java
  11. 7
      designer_form/src/com/fr/design/mainframe/JForm.java

1
build.performance.gradle

@ -15,6 +15,7 @@ task appletJar<<{
fileset(dir:"${basicDir}/chart/build/classes/main")
fileset(dir:"${basicDir}/report/build/classes/main")
fileset(dir:"${basicDir}/platform/build/classes/main")
fileset(dir:"${basicDir}/performance/build/classes/main")
}
unjar(src:"${libDir}/3rd.jar",dest:"./tmp")
unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp")

53
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;
@ -14,12 +15,14 @@ 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;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/**
@ -35,8 +38,12 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane {
private AuthorityToolBarPane authorityToolBarPane;
private String[] selectedPathArray;
public AuthorityEditToolBarPane(List<ToolBarButton> buttonlists) {
public AuthorityEditToolBarPane(List<ToolBarButton> buttonList) {
super(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
this.init(buttonList);
}
private void init(List<ToolBarButton> buttonList) {
this.setLayout(new BorderLayout());
this.setBorder(null);
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.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);
}
@ -92,27 +99,25 @@ 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;
}
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++) {
if (buttonlists.get(i).isSelected()) {
buttonlists.get(i).changeAuthorityState(selectedPathArray[t], buttonVisible.isSelected());
authorityToolBarPane.repaint();
selectedButton = buttonlists.get(i);
}
}
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified();
RolesAlreadyEditedPane.getInstance().refreshDockingView();
UICheckBox checkbox = (UICheckBox) e.getSource();
List<ToolBarButton> 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();//已配置角色视图刷新
}
}
};
@ -209,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;

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

8
designer/src/com/fr/design/mainframe/templateinfo/JWorkBookProcessInfo.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.templateinfo;
import com.fr.base.parameter.ParameterUI;
import com.fr.main.impl.WorkBook;
import com.fr.main.parameter.ReportParameterAttr;
import com.fr.report.cellcase.CellCase;
import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.worksheet.WorkSheet;
@ -68,7 +69,12 @@ public class JWorkBookProcessInfo extends TemplateProcessInfo<WorkBook> {
}
// 获取模板控件数
public int getWidgetCount() {
ParameterUI pui = template.getReportParameterAttr().getParameterUI();
ReportParameterAttr attr = template.getReportParameterAttr();
if (attr == null) {
return 0;
}
ParameterUI pui = attr.getParameterUI();
return pui == null ? 0 : (pui.getAllWidgets().length - 1);
}
}

2
designer/src/com/fr/design/report/ReportBackgroundPane.java

@ -28,8 +28,6 @@ public class ReportBackgroundPane extends BasicPane {
sourth.add(isExportBackgroundCheckBox);
sourth.add(isPrintBackgroundCheckBox);
this.add(sourth, BorderLayout.SOUTH);
this.add(isPrintBackgroundCheckBox, BorderLayout.SOUTH);
}
@Override

2
designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java

@ -1,7 +1,7 @@
package com.fr.design.editor.editor;
import com.fr.data.SimpleDSColumn;
import com.fr.design.data.DesignTableDataManager;
import com.fr.data.SimpleDSColumn;
import com.fr.design.data.datapane.TableDataComboBox;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.gui.icombobox.UIComboBox;

33
designer_base/src/com/fr/design/extra/PluginHelper.java

@ -4,16 +4,23 @@ import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.extra.plugindependence.DownLoadDependenceUI;
import com.fr.general.*;
import com.fr.general.FRLogger;
import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.plugin.Plugin;
import com.fr.plugin.PluginConfigManager;
import com.fr.plugin.PluginLoader;
import com.fr.plugin.PluginManagerHelper;
import com.fr.plugin.basic.version.Version;
import com.fr.plugin.basic.version.VersionIntervalFactory;
import com.fr.plugin.dependence.PluginDependence;
import com.fr.plugin.dependence.PluginDependenceException;
import com.fr.plugin.dependence.PluginDependenceUnit;
import com.fr.stable.ArrayUtils;
import com.fr.stable.AssistUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
@ -79,7 +86,7 @@ public class PluginHelper {
}
}
private static boolean invalidUser(String id, String username, String password) {
private static boolean isInvalidUser(String id, String username, String password) {
if (StringUtils.isEmpty(id)) {
return false;
} else if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)){
@ -127,7 +134,7 @@ public class PluginHelper {
File[] pluginFiles = pluginFileDir.listFiles();
if (ArrayUtils.isNotEmpty(pluginFiles)) {
for (File f : pluginFiles) {
if (f.getName().equals("plugin.xml")) {
if (AssistUtils.equals(f.getName(), "plugin.xml")) {
plugin = new Plugin();
InputStream inputStream = plugin.readEncryptXml(new FileInputStream(f));
XMLTools.readInputStreamXML(plugin, inputStream);
@ -268,15 +275,25 @@ public class PluginHelper {
FRLogger.getLogger().error(jarExpiredInfo);
throw new com.fr.plugin.PluginVerifyException(jarExpiredInfo);
}
if (!isSupportCurrentEnv(plugin.getEnvVersion())) {
String envVersionNotSupport = Inter.getLocText(new String[]{"FR-Designer-Plugin_Env_Expired", ",", "FR-Designer-Plugin_Install_Failed"});
FRLogger.getLogger().error(envVersionNotSupport);
throw new com.fr.plugin.PluginVerifyException(envVersionNotSupport);
}
File fileToCheck = getTempPluginFileDirectory();
File oldfile = new File(StableUtils.pathJoin(FRContext.getCurrentEnv().getPath(), ProjectConstants.PLUGINS_NAME, "plugin-" + plugin.getId()));
if (!PluginManagerHelper.checkLic(plugin, fileToCheck)) {
if (!PluginManagerHelper.checkLic(plugin, oldfile)) {//安装时,在安装目录下和压缩包里都没有才弹框
if (!PluginManagerHelper.checkLic(plugin, fileToCheck) && !PluginManagerHelper.checkLic(plugin, oldfile)) {
//安装时,在安装目录下和压缩包里都没有才弹框
String checkLicFail = Inter.getLocText("FR-Designer-PluginLicense_Check_Failed");
FRLogger.getLogger().error(checkLicFail);
throw new com.fr.plugin.PluginVerifyException(checkLicFail);
}
}
private static boolean isSupportCurrentEnv(String envVersion) {
//包含8.0
return VersionIntervalFactory.create(envVersion).contain(Version.currentEnvVersion());
}
/**
@ -290,7 +307,7 @@ public class PluginHelper {
File[] files = file.listFiles();
if (ArrayUtils.isNotEmpty(files)) {
for (File f : files) {
if (foundConfigFile(f)) {
if (hasFoundConfigFile(f)) {
return f;
}
}
@ -299,14 +316,14 @@ public class PluginHelper {
return null;
}
private static boolean foundConfigFile(File dir) {
private static boolean hasFoundConfigFile(File dir) {
if (!dir.isDirectory()) {
return false;
}
File[] files = dir.listFiles();
if (ArrayUtils.isNotEmpty(files)) {
for (File f : files) {
if ("plugin.xml".equals(f.getName())) {
if (AssistUtils.equals("plugin.xml",f.getName())) {
return true;
}
}

3
designer_base/src/com/fr/start/BaseDesigner.java

@ -24,6 +24,7 @@ import com.fr.file.FILEFactory;
import com.fr.file.FileFILE;
import com.fr.general.*;
import com.fr.plugin.PluginCollector;
import com.fr.plugin.manage.PluginManager;
import com.fr.stable.*;
import javax.swing.*;
@ -83,6 +84,8 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
DesignUtils.initLookAndFeel();
DesignUtils.creatListeningServer(getStartPort(), startFileSuffix());
//初始化插件引擎
PluginManager.init();
// 初始化Log Handler
DesignerEnvManager.loadLogSetting();
DesignerFrame df = createDesignerFrame();

22
designer_base/src/com/fr/start/StartServer.java

@ -14,10 +14,7 @@ import com.fr.env.SignIn;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.*;
import com.fr.stable.project.ProjectConstants;
import com.fr.start.server.JettyHost;
@ -154,8 +151,7 @@ public class StartServer {
Desktop.getDesktop().browse(new URI(uri));
} catch (IOException e) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e);
startBrowserFromCommand(uri, e);
} catch (URISyntaxException e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e);
} catch (Exception e) {
@ -164,6 +160,20 @@ public class StartServer {
}
}
private static void startBrowserFromCommand(String uri, IOException e) {
if (OperatingSystem.isWindows()) {
try {
// win10 内存用到到80%左右的时候, Desktop.browser经常提示"存储空间不足, 无法处理改命令", 用rundll32可以打开.
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + uri);
} catch (IOException ee) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e);
}
} else {
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e);
}
}
private static class InformationPane extends BasicPane {
private static final long serialVersionUID = 1L;

45
designer_chart/src/com/fr/design/chart/series/PlotSeries/MapImageEditPane.java

@ -1,34 +1,13 @@
package com.fr.design.chart.series.PlotSeries;
import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.GeneralPath;
import java.util.*;
import javax.swing.BoxLayout;
import javax.swing.DefaultListModel;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import com.fr.base.*;
import com.fr.base.BaseUtils;
import com.fr.base.Utils;
import com.fr.chart.base.MapSvgAttr;
import com.fr.chart.base.MapSvgXMLHelper;
import com.fr.chart.chartglyph.MapShapeValue;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.UIDialog;
import com.fr.design.event.ChangeEvent;
import com.fr.design.event.ChangeListener;
import com.fr.design.gui.icontainer.UIScrollPane;
@ -37,13 +16,23 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itable.UISelectTable;
import com.fr.design.gui.itable.UITableNoOptionUI;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StringUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.GeneralPath;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
/**
* 地图 图片编辑界面 选中图片 编辑. 支持鼠标选中等事件

7
designer_form/src/com/fr/design/mainframe/JForm.java

@ -468,18 +468,21 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@Override
protected void applyUndoState(FormUndoState u) {
try {
if (this.index == FORM_TAB) {
//JForm的target重置
this.setTarget((Form) u.getForm().clone());
if (this.index == FORM_TAB) {
JForm.this.refreshRoot();
this.formDesign.getArea().setAreaSize(u.getAreaSize(), u.getHorizontalValue(), u.getVerticalValue(), u.getWidthValue(), u.getHeightValue(), u.getSlideValue());
//撤销的时候要重新选择的body布局
this.formDesign.getSelectionModel().setSelectedCreators(FormSelectionUtils.rebuildSelection(formDesign.getRootComponent(),
formDesign.getRootComponent() == selectedBodyLayout() ? u.getSelectWidgets() : new Widget[]{selectedBodyLayout().toData()}));
} else {
// 只在报表块里撤销是不需要修改外部form对象的, 因为编辑的是当前报表块.
// 修改了JForm的Target需要同步修改formDesign的Target.
Form undoForm = (Form) u.getForm().clone();
String widgetName = this.formDesign.getElementCaseContainerName();
//这儿太坑了,u.getForm() 与 getTarget内容不一样
FormElementCaseProvider dataTable = getTarget().getElementCaseByName(widgetName);
FormElementCaseProvider dataTable = undoForm.getElementCaseByName(widgetName);
this.reportComposite.setSelectedWidget(dataTable);
//下面这句话是防止撤销之后直接退出编辑再编辑撤销的东西会回来,因为撤销不会保存EC
formDesign.setElementCase(dataTable);

Loading…
Cancel
Save