Browse Source

Merge pull request #494 in DESIGN/design from ~YAOH.WU/design:release/10.0 to release/10.0

* commit 'dff7316bc97f1afc7b19ab63db0ef1b03401485c':
  REPORT-11352 远程设计去除socketio的适配,部分代码质量
final/10.0
yaoh.wu 6 years ago
parent
commit
2bddfc1fee
  1. 23
      designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java
  2. 12
      designer-realize/src/main/java/com/fr/design/mainframe/app/CptxApp.java
  3. 9
      designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java
  4. 7
      designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java
  5. 8
      designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java

23
designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java

@ -6,7 +6,6 @@ import com.fr.base.Style;
import com.fr.base.TempNameStyle; import com.fr.base.TempNameStyle;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.base.io.XMLEncryptUtils; import com.fr.base.io.XMLEncryptUtils;
import com.fr.base.remote.RemoteDeziConstants;
import com.fr.config.ServerPreferenceConfig; import com.fr.config.ServerPreferenceConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.server.StyleListAction; import com.fr.design.actions.server.StyleListAction;
@ -15,16 +14,16 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DecodeDialog; import com.fr.design.mainframe.DecodeDialog;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.exception.PermissionDeniedException;
import com.fr.exception.TplLockedException;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.general.ComparatorUtils;
import com.fr.io.utils.ResourceIOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JDialog;
import java.awt.*; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
@ -57,14 +56,14 @@ class CptApp extends AbstractWorkBookApp {
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", file.getName()) + "..."); FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", file.getName()) + "...");
TempNameStyle namestyle = TempNameStyle.getInstance(); TempNameStyle namestyle = TempNameStyle.getInstance();
namestyle.clear(); namestyle.clear();
String checkStr = StringUtils.EMPTY;
try { try {
checkStr = ResourceIOUtils.inputStream2String(file.asInputStream());
tpl.readStream(file.asInputStream()); tpl.readStream(file.asInputStream());
} catch (PermissionDeniedException exp) {
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + file, exp);
} catch (TplLockedException exp) {
FineLoggerFactory.getLogger().error(file + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp);
} catch (Exception exp) { } catch (Exception exp) {
String errorMessage = ComparatorUtils.equals(RemoteDeziConstants.INVALID_USER, checkStr) ? Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Report_NS_Exception_ReadError") + file, exp);
: com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_NS_Exception_ReadError");
FineLoggerFactory.getLogger().error(errorMessage + file, exp);
} }
checkNameStyle(namestyle); checkNameStyle(namestyle);
return tpl; return tpl;

12
designer-realize/src/main/java/com/fr/design/mainframe/app/CptxApp.java

@ -3,8 +3,10 @@ package com.fr.design.mainframe.app;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.base.frpx.exception.FRPackageRunTimeException; import com.fr.base.frpx.exception.FRPackageRunTimeException;
import com.fr.base.frpx.exception.InvalidWorkBookException; import com.fr.base.frpx.exception.InvalidWorkBookException;
import com.fr.design.i18n.Toolkit;
import com.fr.exception.PermissionDeniedException;
import com.fr.exception.TplLockedException;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.main.impl.WorkBookAdapter; import com.fr.main.impl.WorkBookAdapter;
@ -27,13 +29,19 @@ class CptxApp extends AbstractWorkBookApp {
public WorkBook asIOFile(FILE file) { public WorkBook asIOFile(FILE file) {
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", file.getName()) + "..."); FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Opening_And_Waiting", file.getName()) + "...");
WorkBookX tpl; WorkBookX tpl = new WorkBookX();
InputStream inputStream; InputStream inputStream;
try { try {
inputStream = file.asInputStream(); inputStream = file.asInputStream();
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
tpl = new WorkBookX(inputStream); tpl = new WorkBookX(inputStream);
FineLoggerFactory.getLogger().error("cost: " + (System.currentTimeMillis() - time) + " ms"); FineLoggerFactory.getLogger().error("cost: " + (System.currentTimeMillis() - time) + " ms");
} catch (PermissionDeniedException exp) {
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + file, exp);
} catch (TplLockedException exp) {
FineLoggerFactory.getLogger().error(file + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp);
} catch (Exception exp) { } catch (Exception exp) {
if (exp instanceof FRPackageRunTimeException) { if (exp instanceof FRPackageRunTimeException) {
throw (FRPackageRunTimeException) exp; throw (FRPackageRunTimeException) exp;

9
designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java

@ -2,13 +2,15 @@ package com.fr.design.mainframe.app;
import com.fr.base.io.XMLEncryptUtils; import com.fr.base.io.XMLEncryptUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.AbstractAppProvider; import com.fr.design.mainframe.AbstractAppProvider;
import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.DecodeDialog; import com.fr.design.mainframe.DecodeDialog;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.exception.PermissionDeniedException;
import com.fr.exception.TplLockedException;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
@ -49,13 +51,16 @@ class FormApp extends AbstractAppProvider {
} }
} }
// peter:打开新报表. // peter:打开新报表.
Form tpl = new Form(); Form tpl = new Form();
// richer:打开报表通知 // richer:打开报表通知
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("file.getName()", file.getName()) + "..."); FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("file.getName()", file.getName()) + "...");
try { try {
tpl.readStream(file.asInputStream()); tpl.readStream(file.asInputStream());
} catch (PermissionDeniedException exp) {
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + file, exp);
} catch (TplLockedException exp) {
FineLoggerFactory.getLogger().error(file + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp);
} catch (Exception exp) { } catch (Exception exp) {
FineLoggerFactory.getLogger().error("Failed to generate frm from " + file, exp); FineLoggerFactory.getLogger().error("Failed to generate frm from " + file, exp);
return null; return null;

7
designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java

@ -1,6 +1,9 @@
package com.fr.design.mainframe.app; package com.fr.design.mainframe.app;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.design.i18n.Toolkit;
import com.fr.exception.PermissionDeniedException;
import com.fr.exception.TplLockedException;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.io.importer.ExcelReportImporter; import com.fr.io.importer.ExcelReportImporter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -23,6 +26,10 @@ class XlsApp extends AbstractWorkBookApp {
WorkBook workbook = null; WorkBook workbook = null;
try { try {
workbook = new ExcelReportImporter().generateWorkBookByStream(tplFile.asInputStream()); workbook = new ExcelReportImporter().generateWorkBookByStream(tplFile.asInputStream());
} catch (PermissionDeniedException exp) {
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + tplFile, exp);
} catch (TplLockedException exp) {
FineLoggerFactory.getLogger().error(tplFile + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp);
} catch (Exception exp) { } catch (Exception exp) {
FineLoggerFactory.getLogger().error("Failed to generate xls from " + tplFile, exp); FineLoggerFactory.getLogger().error("Failed to generate xls from " + tplFile, exp);
} }

8
designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java

@ -1,6 +1,9 @@
package com.fr.design.mainframe.app; package com.fr.design.mainframe.app;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.design.i18n.Toolkit;
import com.fr.exception.PermissionDeniedException;
import com.fr.exception.TplLockedException;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.io.importer.Excel2007ReportImporter; import com.fr.io.importer.Excel2007ReportImporter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -23,6 +26,11 @@ class XlsxApp extends AbstractWorkBookApp {
WorkBook workbook = null; WorkBook workbook = null;
try { try {
workbook = new Excel2007ReportImporter().generateWorkBookByStream(tplFile.asInputStream()); workbook = new Excel2007ReportImporter().generateWorkBookByStream(tplFile.asInputStream());
} catch (PermissionDeniedException exp) {
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + tplFile, exp);
} catch (TplLockedException exp) {
FineLoggerFactory.getLogger().error(tplFile + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), exp);
} catch (Exception exp) { } catch (Exception exp) {
FineLoggerFactory.getLogger().error("Failed to generate xlsx from " + tplFile, exp); FineLoggerFactory.getLogger().error("Failed to generate xlsx from " + tplFile, exp);
} }

Loading…
Cancel
Save