Browse Source

fix

research/10.0
yaoh.wu 6 years ago
parent
commit
a4b73b80ae
  1. 6
      designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java
  2. 39
      designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java
  3. 33
      designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java
  4. 3
      designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java

6
designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java

@ -127,7 +127,7 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction<JForm>
@Override
protected ChooseFileFilter getChooseFileFilter() {
return new ChooseFileFilter(new String[]{"frm"}, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_EmbeddedTD"));
return new ChooseFileFilter(new String[]{"frm"}, Toolkit.i18nText("Fine-Design_Form_EmbeddedTD"));
}
private SwingWorker createExportWork(FILE source, final FILE target, final Map<String, Object> parameterMap) {
@ -138,9 +138,7 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction<JForm>
@Override
protected Void doInBackground() throws Exception {
Thread.sleep(100);
try {
final OutputStream fileOutputStream = target.asOutputStream();
try (OutputStream fileOutputStream = target.asOutputStream()) {
this.setProgress(10);
dealExporter(fileOutputStream, path, parameterMap);
this.setProgress(80);

39
designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java

@ -4,39 +4,38 @@
package com.fr.design.actions.file.export;
import com.fr.base.ExcelUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JWorkBook;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.main.TemplateWorkBook;
import com.fr.report.core.ReportUtils;
/**
* Export excel.
*/
public abstract class AbstractExcelExportAction extends AbstractJWorkBookExportAction {
/**
* Constructor
*/
protected AbstractExcelExportAction(JWorkBook jwb) {
super(jwb);
protected AbstractExcelExportAction(JWorkBook jwb) {
super(jwb);
}
@Override
protected ChooseFileFilter getChooseFileFilter() {
TemplateWorkBook tpl = this.getTemplateWorkBook();
if (hasLayerReport(tpl)) {
return new ChooseFileFilter(new String[]{"zip"}, "ZIP");
} else {
return new ChooseFileFilter(new String[]{"xls", "xlsx"}, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Excel"));
}
protected ChooseFileFilter getChooseFileFilter() {
TemplateWorkBook tpl = this.getTemplateWorkBook();
if (ReportUtils.hasLayerReport4Template(tpl)) {
return new ChooseFileFilter(new String[]{"zip"}, "ZIP");
} else {
return new ChooseFileFilter(new String[]{"xls", "xlsx"}, Toolkit.i18nText("Fine-Design_Report_Export_Excel"));
}
}
@Override
protected String getDefaultExtension() {
TemplateWorkBook tpl = this.getTemplateWorkBook();
if (hasLayerReport(tpl)) {
return "zip";
} else {
return ExcelUtils.checkThirdJarSupportPOI() ? "xlsx" : "xls";
}
protected String getDefaultExtension() {
TemplateWorkBook tpl = this.getTemplateWorkBook();
if (ReportUtils.hasLayerReport4Template(tpl)) {
return "zip";
} else {
return ExcelUtils.checkThirdJarSupportPOI() ? "xlsx" : "xls";
}
}
}

33
designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java

@ -15,8 +15,6 @@ import com.fr.file.FILEChooserPane;
import com.fr.log.FineLoggerFactory;
import com.fr.main.TemplateWorkBook;
import com.fr.main.impl.WorkBook;
import com.fr.report.report.Report;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.exporter.TemplateExportOperator;
@ -40,6 +38,7 @@ public abstract class AbstractJWorkBookExportAction extends AbstractExportAction
super(jwb);
}
protected WorkBook getTemplateWorkBook() {
return this.getEditingComponent().getTarget();
}
@ -50,7 +49,7 @@ public abstract class AbstractJWorkBookExportAction extends AbstractExportAction
@Override
public void actionPerformed(ActionEvent e) {
// todo 弹出提醒保存,如果没保存
// todo 弹出提醒保存,如果没保存。。。
JWorkBook jwb = this.getEditingComponent();
@ -113,9 +112,7 @@ public abstract class AbstractJWorkBookExportAction extends AbstractExportAction
protected Void doInBackground() throws Exception {
//bug 10516
Thread.sleep(100);
OutputStream outputStream = null;
try {
outputStream = target.asOutputStream();
try (OutputStream outputStream = target.asOutputStream()) {
this.setProgress(10);
dealExporter(outputStream, path, parameterMap);
this.setProgress(80);
@ -138,10 +135,6 @@ public abstract class AbstractJWorkBookExportAction extends AbstractExportAction
JOptionPane.ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon")
);
} finally {
if (outputStream != null) {
outputStream.close();
}
}
return null;
}
@ -169,26 +162,6 @@ public abstract class AbstractJWorkBookExportAction extends AbstractExportAction
}
}
/*
* 这边判断是否有层式报表有层式需要使用大数据量导出
*/
protected boolean hasLayerReport(TemplateWorkBook tpl) {
if (tpl == null) {
return false;
}
for (int i = 0; i < tpl.getReportCount(); i++) {
Report r = tpl.getReport(i);
if (r instanceof WorkSheet) {
if (((WorkSheet) r).getLayerReportAttr() != null) {
return true;
}
}
}
return false;
}
protected abstract String getDefaultExtension();
public String exportScopeName() {

3
designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java

@ -11,6 +11,7 @@ import com.fr.design.menu.KeySetUtils;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.io.exporter.DesignExportType;
import com.fr.main.TemplateWorkBook;
import com.fr.report.core.ReportUtils;
/**
* Export CSV.
@ -35,7 +36,7 @@ public class CSVExportAction extends AbstractJWorkBookExportAction {
@Override
protected String getDefaultExtension() {
TemplateWorkBook tpl = this.getTemplateWorkBook();
if (hasLayerReport(tpl)) {
if (ReportUtils.hasLayerReport4Template(tpl)) {
return FileExtension.ZIP.getExtension();
} else {
return FileExtension.CSV.getExtension();

Loading…
Cancel
Save