Browse Source

Merge pull request #2 in PF/design from ~JU/2016-11-design:dev to dev

* commit '15e063aa96f9247c0be2832076d74e133eb724f4':
  PDM
  PMD
  整合pdfstram导出到性能插件中
  修改Env获取插件plugin.xml路径的方法。 修改Plugin读取依赖的方式,使其可以读取多个依赖 给性能插件的管理器添加环境切换监听,使当环境切换时可以同步的去更新性能插件包含的功能
  PMD
  添加了两种监听: 1、插件变动的监听 2、StableFactory生产者和消费者的监听,并在模块启动时添加了生产者监听 目前还需: 1、添加FSPlate作为生产者 2、JavaScript缓存作为消费者 3、FSPlate比较特殊,它同时是插件变动的监听和StableFactory的生产者,需要再考虑如何设计
  添加以下功能 : 1、所有插件的Level实例都被代理,添加了isClosed方法。在取出时会进行判断,如果关闭则不再取出 2、可以从插件jar包中寻找依赖的插件配置文件,加载插件 问题: 1、插件关闭的逻辑,现在只是不能再从manager里面取出关闭的实例,但是之前取出并插入到系统中的地方仍然存在,需要添加很多监听才行,继续想办法解决。 2、如果用户升级了性能插件,其中涉及到原有功能接口的变动的话,由于插件默认先从环境中读取plugin.xml,这时就会出现错误。需要在检查插件依赖的时候添加对依赖的插件版本的检查。
master
superman 8 years ago
parent
commit
965b8f7016
  1. 13
      designer/src/com/fr/design/actions/file/export/AbstractExportAction.java
  2. 8
      designer/src/com/fr/design/actions/file/export/PDFExportAction.java
  3. 15
      designer_base/src/com/fr/design/extra/PluginConstants.java
  4. 1
      designer_base/src/com/fr/design/extra/PluginHelper.java
  5. 24
      designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java
  6. 11
      designer_base/src/com/fr/env/RemoteEnv.java
  7. 10
      designer_form/src/com/fr/design/mainframe/actions/EmbeddedFormExportExportAction.java

13
designer/src/com/fr/design/actions/file/export/AbstractExportAction.java

@ -5,7 +5,6 @@ package com.fr.design.actions.file.export;
import com.fr.base.FRContext;
import com.fr.base.Parameter;
import com.fr.io.exporter.pdfstream.PDFStreamExporter;
import com.fr.page.PageSetProvider;
import com.fr.design.actions.JWorkBookAction;
import com.fr.design.gui.iprogressbar.FRProgressBar;
@ -94,10 +93,10 @@ public abstract class AbstractExportAction extends JWorkBookAction {
FRLogger.getLogger().error("Error In Make New File");
}
fileChooserPane = null;
FRContext.getLogger().info("\"" + file.getName() + "\"" + Inter.getLocText("Prepare_Export") + "!");
FRContext.getLogger().info("\"" + file.getName() + "\"" + Inter.getLocText("FR-Designer_Prepare_Export") + "!");
(progressbar = new FRProgressBar(createExportWork(file, tpl, parameterMap), designerFrame,
Inter.getLocText("Exporting"), "", 0, 100)).start();
Inter.getLocText("FR-Designer_Exporting"), "", 0, 100)).start();
}
}
@ -117,13 +116,13 @@ public abstract class AbstractExportAction extends JWorkBookAction {
fileOutputStream.close();
this.setProgress(100);
FRContext.getLogger().info("\"" + fileGetName + "\"" + Inter.getLocText("Finish_Export") + "!");
FRContext.getLogger().info("\"" + fileGetName + "\"" + Inter.getLocText("FR-Designer_Finish_Export") + "!");
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Inter.getLocText("Exported_successfully") + "\n" + filePath);
Inter.getLocText("FR-Designer_Exported_successfully") + "\n" + filePath);
} catch (Exception exp) {
this.setProgress(100);
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Export_failed") + "\n" + filePath);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Export_failed") + "\n" + filePath);
}
return null;
}
@ -140,7 +139,7 @@ public abstract class AbstractExportAction extends JWorkBookAction {
if (exporter instanceof AppExporter) {
AppExporter appExporter = (AppExporter) exporter;
if (exporter instanceof ExcelExporter || exporter instanceof CSVExporter
|| exporter instanceof PDFExporter || exporter instanceof PDFStreamExporter || exporter instanceof WordExporter) {
|| exporter instanceof PDFExporterProcessor || exporter instanceof WordExporter) {
ReportHelper.clearFormulaResult(tpl);// 清空rpt中的公式计算结果
appExporter.export(fileOutputStream, tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE)

8
designer/src/com/fr/design/actions/file/export/PDFExportAction.java

@ -9,8 +9,7 @@ import com.fr.design.menu.KeySetUtils;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.general.Inter;
import com.fr.io.exporter.Exporter;
import com.fr.io.exporter.PDFExporter;
import com.fr.io.exporter.pdfstream.PDFStreamExporter;
import com.fr.web.core.reserve.PDFExporterFactory;
/**
* Export pdf
@ -29,12 +28,13 @@ public class PDFExportAction extends AbstractExportAction {
@Override
protected Exporter getExporter() {
return new PDFStreamExporter();
return PDFExporterFactory.getPDFExporter();
}
@Override
protected ChooseFileFilter getChooseFileFilter() {
return new ChooseFileFilter(new String[]{"pdf"}, Inter.getLocText("Export-PDF"));
return new ChooseFileFilter(new String[]{"pdf"}, Inter.getLocText("FR-Designer_Export-PDF"));
}
@Override

15
designer_base/src/com/fr/design/extra/PluginConstants.java

@ -1,15 +0,0 @@
package com.fr.design.extra;
/**
* @author richie
* @date 2015-03-11
* @since 8.0
*/
public class PluginConstants {
public static final int BYTES_NUM = 1024;
}

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

@ -7,6 +7,7 @@ import com.fr.design.extra.plugindependence.DownLoadDependenceUI;
import com.fr.general.*;
import com.fr.general.http.HttpClient;
import com.fr.plugin.Plugin;
import com.fr.stable.plugin.PluginConstants;
import com.fr.plugin.PluginLoader;
import com.fr.plugin.PluginManagerHelper;
import com.fr.plugin.dependence.PluginDependence;

24
designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java

@ -1,8 +1,8 @@
package com.fr.design.extra.plugindependence;
import com.fr.base.FRContext;
import com.fr.design.extra.PluginConstants;
import com.fr.design.extra.PluginHelper;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
@ -12,6 +12,7 @@ import com.fr.plugin.dependence.PluginDependenceException;
import com.fr.plugin.dependence.PluginDependenceUnit;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.plugin.PluginConstants;
import javax.swing.*;
import java.awt.*;
@ -20,7 +21,9 @@ import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.util.List;
@ -40,8 +43,12 @@ public class DownLoadDependenceUI implements ActionListener {
private boolean flag = true;
// 定义加载窗口大小
private final int LOAD_WIDTH = 455;
private final int LOAD_HEIGHT = 295;
private static final int LOAD_WIDTH = 455;
private static final int INCIDENT_WIDTH = 15;
private static final int LOAD_HEIGHT = 295;
//安装环境相关信息
private String currentID;
@ -68,8 +75,8 @@ public class DownLoadDependenceUI implements ActionListener {
// 创建标签,并在标签上放置一张图片
BufferedImage image = IOUtils.readImage("/com/fr/design/extra/plugindependence/image/background.png");
ImageIcon imageIcon = new ImageIcon(image);
label = new JLabel(imageIcon);
label.setBounds(0, 0, LOAD_WIDTH, LOAD_HEIGHT - 15);
label = new UILabel(imageIcon);
label.setBounds(0, 0, LOAD_WIDTH, LOAD_HEIGHT - INCIDENT_WIDTH);
progressbar = new JProgressBar();
// 显示当前进度值信息
@ -80,7 +87,7 @@ public class DownLoadDependenceUI implements ActionListener {
progressbar.setForeground(new Color(0x38aef5));
// 设置进度条的背景色
progressbar.setBackground(new Color(188, 190, 194));
progressbar.setBounds(0, LOAD_HEIGHT - 15, LOAD_WIDTH, 15);
progressbar.setBounds(0, LOAD_HEIGHT - INCIDENT_WIDTH, LOAD_WIDTH, INCIDENT_WIDTH);
progressbar.setMinimum(0);
progressbar.setMaximum(totalSize);
progressbar.setValue(0);
@ -249,7 +256,8 @@ public class DownLoadDependenceUI implements ActionListener {
}
public void installOnline()throws PluginDependenceException {
int choose = JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Designer-Plugin_Plugin") + Inter.getLocText("FR-Designer-Need") + Inter.getLocText("FR-Designer-Dependence") + Inter.getLocText("FR-Designer-Support") + "," + Inter.getLocText("FR-Designer-Dependence_Need_Install") + "(" + showFileLength() + " m)?", "install tooltip", JOptionPane.YES_NO_OPTION);
int choose = JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Designer-Plugin_DownLoadMessage", showFileLength()), "install tooltip", JOptionPane.YES_NO_OPTION);
if (choose == 0) {//下载安装
if (!connectToServer()) {
throw new PluginDependenceException(Inter.getLocText("FR-Designer-Dependence_Connect_Server_Error"));

11
designer_base/src/com/fr/env/RemoteEnv.java vendored

@ -2063,6 +2063,17 @@ public class RemoteEnv implements Env {
}
/**
* 获取插件的配置目录
*
* @param plugin
*/
public String getPluginFilePath(Plugin plugin) {
return StringUtils.EMPTY;
}
public void readPluginLicenses() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
HashMap<String, String> para = new HashMap<String, String>();

10
designer_form/src/com/fr/design/mainframe/actions/EmbeddedFormExportExportAction.java

@ -87,10 +87,10 @@ public class EmbeddedFormExportExportAction extends JTemplateAction<JForm>{
FRLogger.getLogger().error("Error In Make New File");
}
fileChooserPane = null;
FRContext.getLogger().info("\"" + file.getName() + "\"" + Inter.getLocText("Prepare_Export") + "!");
FRContext.getLogger().info("\"" + file.getName() + "\"" + Inter.getLocText("FR-Designer_Prepare_Export") + "!");
(progressbar = new FRProgressBar(createExportWork(file, tpl, parameterMap), designerFrame,
Inter.getLocText("Exporting"), "", 0, 100)).start();
Inter.getLocText("FR-Designer_Exporting"), "", 0, 100)).start();
}
private boolean isOk(int saveValue){
@ -136,13 +136,13 @@ public class EmbeddedFormExportExportAction extends JTemplateAction<JForm>{
fileOutputStream.close();
this.setProgress(100);
FRContext.getLogger().info("\"" + fileGetName + "\"" + Inter.getLocText("Finish_Export") + "!");
FRContext.getLogger().info("\"" + fileGetName + "\"" + Inter.getLocText("FR-Designer_Finish_Export") + "!");
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Inter.getLocText("Exported_successfully") + "\n" + filePath);
Inter.getLocText("FR-Designer_Exported_successfully") + "\n" + filePath);
} catch (Exception exp) {
this.setProgress(100);
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Export_failed") + "\n" + filePath);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Export_failed") + "\n" + filePath);
}
return null;
}

Loading…
Cancel
Save