From c74810869de027b39e32860ff13fc00ca4831bda Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 22 Jun 2018 18:14:06 +0800 Subject: [PATCH 1/7] =?UTF-8?q?REPORT-9019=20=E7=BB=9D=E5=AF=B9=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E9=80=82=E5=BA=94=E5=8C=BA=E5=9F=9F=EF=BC=8C=E5=87=8F?= =?UTF-8?q?=E5=B0=91=E4=B8=8D=E5=90=8C=E5=88=86=E8=BE=A8=E7=8E=87=E4=B8=8B?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=9D=90=E6=A0=87=E7=9A=84=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E8=AF=AF=E5=B7=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/designer/creator/XWAbsoluteLayout.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java index 0122fc971..b66add8e6 100644 --- a/designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -248,10 +248,10 @@ public class XWAbsoluteLayout extends XLayoutContainer { for (int i = 0; i < this.getComponentCount(); i++) { XCreator creator = getXCreator(i); Rectangle rec = new Rectangle(creator.getBounds()); - rec.x = (int) (rec.x / prevContainerPercent * containerPercent); - rec.y = (int) (rec.y / prevContainerPercent * containerPercent); - rec.height = (int) (rec.height / prevContainerPercent * containerPercent); - rec.width = (int) (rec.width / prevContainerPercent * containerPercent); + rec.x = (int)Math.round (rec.x / prevContainerPercent * containerPercent); + rec.y = (int)Math.round (rec.y / prevContainerPercent * containerPercent); + rec.height = (int)Math.round (rec.height / prevContainerPercent * containerPercent); + rec.width = (int)Math.round (rec.width / prevContainerPercent * containerPercent); BoundsWidget wgt = (BoundsWidget) toData().getBoundsWidget(creator.toData()); wgt.setBounds(rec); creator.setBounds(rec); From c8d7760c4e05aff02acf173cbfdf77859425a173 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 25 Jun 2018 13:45:56 +0800 Subject: [PATCH 2/7] =?UTF-8?q?REPORT-8608=20-=20=E5=AE=89=E5=85=A8?= =?UTF-8?q?=E6=80=A7=E4=B9=8B=E6=B0=B4=E5=8D=B0=E4=BA=A4=E4=BA=92=E9=AA=8C?= =?UTF-8?q?=E6=94=B6=E9=97=AE=E9=A2=98=3D>=E8=81=9A=E5=90=88=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/poly/PolyDesignUI.java | 45 ++++++++++++++----- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/designer-realize/src/com/fr/poly/PolyDesignUI.java b/designer-realize/src/com/fr/poly/PolyDesignUI.java index f63252fd4..7b98269ea 100644 --- a/designer-realize/src/com/fr/poly/PolyDesignUI.java +++ b/designer-realize/src/com/fr/poly/PolyDesignUI.java @@ -3,30 +3,23 @@ */ package com.fr.poly; -import java.awt.*; -import java.awt.geom.Rectangle2D; -import java.awt.image.BufferedImage; -import java.text.DecimalFormat; -import java.util.ArrayList; - -import javax.swing.JComponent; -import javax.swing.JScrollBar; -import javax.swing.plaf.ComponentUI; - import com.fr.base.GraphHelper; import com.fr.base.Margin; import com.fr.base.PaperSize; import com.fr.base.ScreenResolution; +import com.fr.base.iofile.attr.WatermarkAttr; import com.fr.design.utils.ComponentUtils; import com.fr.general.Background; +import com.fr.general.ComparatorUtils; import com.fr.general.Inter; +import com.fr.main.FineBook; import com.fr.page.PaperSettingProvider; import com.fr.page.ReportSettingsProvider; +import com.fr.page.WatermarkPainter; import com.fr.poly.creator.BlockCreator; -import com.fr.poly.creator.ECBlockCreator; -import com.fr.poly.creator.ECBlockEditor; import com.fr.poly.model.AddedData; import com.fr.poly.model.AddingData; +import com.fr.report.core.ReportUtils; import com.fr.report.report.Report; import com.fr.report.report.TemplateReport; import com.fr.report.stable.ReportConstants; @@ -34,6 +27,21 @@ import com.fr.stable.Constants; import com.fr.stable.CoreGraphHelper; import com.fr.stable.unit.UNIT; +import javax.swing.JComponent; +import javax.swing.JScrollBar; +import javax.swing.plaf.ComponentUI; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; +import java.text.DecimalFormat; +import java.util.ArrayList; + /** * @author richer * @since 6.5.3 聚合报表设计块的ui类 @@ -48,6 +56,7 @@ public class PolyDesignUI extends ComponentUI { private PolyDesigner designer; private int resolution; private float time; + private WatermarkPainter watermarkPainter; public PolyDesignUI(int resolution) { if (resolution == 0){ @@ -97,6 +106,18 @@ public class PolyDesignUI extends ComponentUI { paintAddingData(g2d, addData); } paintPaginateLine(g2d); + paintWatermark(g2d, designer.getTarget().getBook(), c.getWidth(), c.getHeight()); + } + + // 绘制水印 + private void paintWatermark(Graphics2D g2d, FineBook book, int width, int height) { + WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(book); + + // 不要每次都 new 一个 WatermarkPainter + if (watermarkPainter == null || !ComparatorUtils.equals(watermarkPainter.getWatermark(), watermark)) { + watermarkPainter = new WatermarkPainter(watermark); + } + watermarkPainter.paint(g2d, width, height); } private void paintAddedData(Graphics g) { From f43bb44b748a11f48e97c7ba4def26baf23202c5 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 25 Jun 2018 09:03:07 +0800 Subject: [PATCH 3/7] =?UTF-8?q?REPORT-8960=20url=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E4=BC=A0=E9=80=92=E4=B8=AD=E6=96=87=E4=B9=B1=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/start/server/FineEmbedServerActivator.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-base/src/com/fr/start/server/FineEmbedServerActivator.java b/designer-base/src/com/fr/start/server/FineEmbedServerActivator.java index 61fd249cb..1d76fd3fe 100644 --- a/designer-base/src/com/fr/start/server/FineEmbedServerActivator.java +++ b/designer-base/src/com/fr/start/server/FineEmbedServerActivator.java @@ -5,6 +5,7 @@ import com.fr.design.DesignerEnvManager; import com.fr.log.FineLoggerFactory; import com.fr.module.Activator; import com.fr.module.ModuleRole; +import com.fr.stable.EncodeConstants; import com.fr.startup.FineWebApplicationInitializer; import com.fr.third.springframework.web.SpringServletContainerInitializer; import com.fr.third.springframework.web.context.support.AnnotationConfigWebApplicationContext; @@ -12,6 +13,7 @@ import com.fr.workspace.WorkContext; import org.apache.catalina.Context; import org.apache.catalina.LifecycleException; import org.apache.catalina.Wrapper; +import org.apache.catalina.connector.Connector; import org.apache.catalina.loader.VirtualWebappLoader; import org.apache.catalina.startup.Tomcat; @@ -55,6 +57,8 @@ public class FineEmbedServerActivator extends Activator { tomcat = new Tomcat(); tomcat.setPort(DesignerEnvManager.getEnvManager().getEmbedServerPort()); + // 设置解码uri使用的字符编码 + tomcat.getConnector().setURIEncoding(EncodeConstants.ENCODING_UTF_8); String docBase = new File(WorkContext.getCurrent().getPath()).getParent(); String appName = "/" + FRContext.getCommonOperator().getAppName(); Context context = tomcat.addContext(appName, docBase); From 4cb8c67b3a10faaab6718776bff19741cc2bb0d5 Mon Sep 17 00:00:00 2001 From: vito Date: Mon, 25 Jun 2018 16:17:10 +0800 Subject: [PATCH 4/7] =?UTF-8?q?REPORT-9037=E3=80=90=E9=98=BB=E5=A1=9E?= =?UTF-8?q?=E3=80=91=E3=80=9010.0=E4=B8=80=E8=BD=AE=E5=9B=9E=E5=BD=92?= =?UTF-8?q?=E3=80=91jdk1.7=E7=9A=84=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=B5=B7?= =?UTF-8?q?=E4=B8=8D=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-realize/src/com/fr/start/fx/FastGifImage.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/designer-realize/src/com/fr/start/fx/FastGifImage.java b/designer-realize/src/com/fr/start/fx/FastGifImage.java index 9049850c3..69d74c8a4 100644 --- a/designer-realize/src/com/fr/start/fx/FastGifImage.java +++ b/designer-realize/src/com/fr/start/fx/FastGifImage.java @@ -97,17 +97,7 @@ public class FastGifImage extends WritableImage { } } - - private void finishImage(Exception e) { - e.printStackTrace(); - } - private void finishImage(ImageLoader loader) { - final Exception loadingException = loader.getException(); - if (loadingException != null) { - finishImage(loadingException); - return; - } initializeAnimatedImage(loader); } From 0ff49aa15b2fe535f2fed37528b61890154e4a69 Mon Sep 17 00:00:00 2001 From: ju Date: Mon, 25 Jun 2018 17:21:05 +0800 Subject: [PATCH 5/7] =?UTF-8?q?REPORT-9087=20=E5=90=AF=E5=8A=A8=E5=86=85?= =?UTF-8?q?=E7=BD=AE=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=90=8E=E5=86=8D=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E7=8E=AF=E5=A2=83=EF=BC=8C=E6=89=93=E4=B8=8D=E5=BC=80?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=20=E5=BC=80=E4=B8=80=E4=B8=8Bchart=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E7=9A=84=E7=88=B6activator=EF=BC=8C=E5=90=8E=E7=BB=AD?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=20=E5=8F=96=E6=B6=88=E5=87=A0=E4=B8=AAchart?= =?UTF-8?q?=E7=9A=84=E7=8E=AF=E5=A2=83=E7=9B=91=E5=90=AC=E5=92=8Cservlet?= =?UTF-8?q?=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-realize/src/com/fr/start/module/EnvBasedModule.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-realize/src/com/fr/start/module/EnvBasedModule.java b/designer-realize/src/com/fr/start/module/EnvBasedModule.java index 286fbe663..25ca8faae 100644 --- a/designer-realize/src/com/fr/start/module/EnvBasedModule.java +++ b/designer-realize/src/com/fr/start/module/EnvBasedModule.java @@ -1,5 +1,6 @@ package com.fr.start.module; +import com.fr.chart.activator.ChartBaseActivator; import com.fr.module.Activator; import com.fr.stable.CoreActivator; import com.fr.start.server.FineEmbedServer; @@ -14,6 +15,7 @@ public class EnvBasedModule extends Activator { public void start() { //core和设计器启动 startSub(CoreActivator.class); + startSub(ChartBaseActivator.class); getSub("designer").start(); //这里不启动tomcat,由客户手动触发 } @@ -24,6 +26,7 @@ public class EnvBasedModule extends Activator { FineEmbedServer.stop(); //倒叙关闭其他模块 getSub("designer").stop(); + stopSub(ChartBaseActivator.class); stopSub(CoreActivator.class); } } From ef1fcda833aca2fcc1b2a75e7c9fce313b6efb70 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 25 Jun 2018 19:34:57 +0800 Subject: [PATCH 6/7] REPORT-8968 REPORT-8950 REPORT-899999 --- .../com/fr/design/actions/file/WebPreviewUtils.java | 2 +- .../data/datapane/connect/DatabaseConnectionPane.java | 11 ++++++++++- .../data/datapane/preview/PreviewTablePane.java | 3 ++- .../tabledata/tabledatapane/FileTableDataPane.java | 3 ++- .../com/fr/design/hyperlink/WebHyperNorthPane.java | 4 ++-- .../src/com/fr/design/mainframe/TemplatePane.java | 6 ++++-- designer-base/src/com/fr/env/RemoteEnvPane.java | 8 ++++++-- .../actions/file/export/AbstractExportAction.java | 4 +++- designer-realize/src/com/fr/start/Designer.java | 7 +++++++ .../src/com/fr/start/module/PreStartActivator.java | 6 +----- 10 files changed, 38 insertions(+), 16 deletions(-) diff --git a/designer-base/src/com/fr/design/actions/file/WebPreviewUtils.java b/designer-base/src/com/fr/design/actions/file/WebPreviewUtils.java index 4dd6e412d..947fc67f6 100644 --- a/designer-base/src/com/fr/design/actions/file/WebPreviewUtils.java +++ b/designer-base/src/com/fr/design/actions/file/WebPreviewUtils.java @@ -20,7 +20,7 @@ import java.util.Map; public final class WebPreviewUtils { public static void preview(JTemplate jt) { - preview(jt, null); + preview(jt, jt.getPreviewType()); } @SuppressWarnings("unchecked") diff --git a/designer-base/src/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index c5666b81f..e7e3ef820 100644 --- a/designer-base/src/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -36,6 +36,7 @@ public abstract class DatabaseConnectionPane { FRContext.getLogger().error(e.getMessage(), e); } if (in == null) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Datasource-Connection_failed")); + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Datasource-Connection_failed"), + null, 0, UIManager.getIcon("OptionPane.errorIcon")); } else { JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Datasource-Connection_successfully")); try { diff --git a/designer-base/src/com/fr/design/hyperlink/WebHyperNorthPane.java b/designer-base/src/com/fr/design/hyperlink/WebHyperNorthPane.java index 925be16ef..91608d1ce 100644 --- a/designer-base/src/com/fr/design/hyperlink/WebHyperNorthPane.java +++ b/designer-base/src/com/fr/design/hyperlink/WebHyperNorthPane.java @@ -24,7 +24,7 @@ import java.awt.BorderLayout; public class WebHyperNorthPane extends AbstractHyperNorthPane { private UITextField itemNameTextField; private boolean needRenamePane = false; - private UITextArea urlTextField; + private UITextField urlTextField; public WebHyperNorthPane(boolean needRenamePane) { this.needRenamePane = needRenamePane; @@ -48,7 +48,7 @@ public class WebHyperNorthPane extends AbstractHyperNorthPane { protected JPanel setHeaderPanel() { JPanel headerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - urlTextField = new UITextArea(1,headerPane.getWidth()); + urlTextField = new UITextField(headerPane.getWidth()); urlTextField.setText(ProductConstants.WEBSITE_URL); JPanel urlWithHelp = GUICoreUtils.createNamedPane(urlTextField, "URL:"); diff --git a/designer-base/src/com/fr/design/mainframe/TemplatePane.java b/designer-base/src/com/fr/design/mainframe/TemplatePane.java index fc165928b..4107a0538 100644 --- a/designer-base/src/com/fr/design/mainframe/TemplatePane.java +++ b/designer-base/src/com/fr/design/mainframe/TemplatePane.java @@ -137,7 +137,8 @@ public class TemplatePane extends JPanel implements MouseListener { @Override public void fail() { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"})); + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}), + null, 0, UIManager.getIcon("OptionPane.errorIcon")); } @Override @@ -152,7 +153,8 @@ public class TemplatePane extends JPanel implements MouseListener { } setJLabel(selectedName); } catch (Exception e) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"})); + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}), + null, 0, UIManager.getIcon("OptionPane.errorIcon")); return false; } TemplateTreePane.getInstance().refreshDockingView(); diff --git a/designer-base/src/com/fr/env/RemoteEnvPane.java b/designer-base/src/com/fr/env/RemoteEnvPane.java index 137db5ff6..a07e9996c 100644 --- a/designer-base/src/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/com/fr/env/RemoteEnvPane.java @@ -64,7 +64,7 @@ public class RemoteEnvPane extends BasicBeanPane { private UILabel message = new UILabel(); private UIButton okButton = new UIButton(Inter.getLocText("OK")); private UIButton cancelButton = new UIButton(Inter.getLocText("Cancel")); - ; + private UILabel uiLabel = new UILabel(); /** * 是否启用 https 勾选框 @@ -477,6 +477,7 @@ public class RemoteEnvPane extends BasicBeanPane { protected Boolean doInBackground() throws Exception { final RemoteDesignerWorkspaceInfo remoteEnv = updateBean(); + return WorkContext.getConnector().testConnection(remoteEnv.getConnection()); } @@ -486,11 +487,14 @@ public class RemoteEnvPane extends BasicBeanPane { try { if (get()) { message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Successful")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); } else { message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Failed")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); } } catch (InterruptedException | ExecutionException e) { message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Failed")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); } } }; @@ -530,7 +534,7 @@ public class RemoteEnvPane extends BasicBeanPane { JPanel jp = new JPanel(); JPanel upPane = new JPanel(); JPanel downPane = new JPanel(); - UILabel uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon")); + uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon")); upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); upPane.add(uiLabel); upPane.add(message); diff --git a/designer-realize/src/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-realize/src/com/fr/design/actions/file/export/AbstractExportAction.java index 526a80152..22059c35c 100644 --- a/designer-realize/src/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-realize/src/com/fr/design/actions/file/export/AbstractExportAction.java @@ -3,6 +3,7 @@ */ package com.fr.design.actions.file.export; +import com.fr.Message.ErrorMessage_; import com.fr.base.FRContext; import com.fr.base.Parameter; import com.fr.design.actions.JWorkBookAction; @@ -133,7 +134,8 @@ public abstract class AbstractExportAction extends JWorkBookAction { } catch (Exception exp) { this.setProgress(100); FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Export_failed") + "\n" + filePath); + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Export_failed") + "\n" + filePath, + null, 0, UIManager.getIcon("OptionPane.errorIcon")); } return null; } diff --git a/designer-realize/src/com/fr/start/Designer.java b/designer-realize/src/com/fr/start/Designer.java index a2ef7df4f..c674e6486 100644 --- a/designer-realize/src/com/fr/start/Designer.java +++ b/designer-realize/src/com/fr/start/Designer.java @@ -38,6 +38,7 @@ import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ShortCut; import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignerModule; +import com.fr.design.utils.DesignUtils; import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.ui.WidgetInfoConfig; @@ -101,6 +102,12 @@ public class Designer extends BaseDesigner { BuildContext.setBuildFilePath("/com/fr/stable/build.properties"); preloadResource(); SplashContext.getInstance().registerSplash(createSplash()); + + // 如果端口被占用了 说明程序已经运行了一次,也就是说,已经建立一个监听服务器,现在只要给服务器发送命令就好了 + if (DesignUtils.isStarted()) { + DesignUtils.clientSend(args); + return; + } SplashContext.getInstance().show(); Module designerRoot = ModuleContext.parseRoot("designer-startup.xml"); //传递启动参数 diff --git a/designer-realize/src/com/fr/start/module/PreStartActivator.java b/designer-realize/src/com/fr/start/module/PreStartActivator.java index 85a9ff2ee..36a993bff 100644 --- a/designer-realize/src/com/fr/start/module/PreStartActivator.java +++ b/designer-realize/src/com/fr/start/module/PreStartActivator.java @@ -38,11 +38,7 @@ public class PreStartActivator extends Activator { } else { DesignUtils.setPort(getStartPort()); } - // 如果端口被占用了 说明程序已经运行了一次,也就是说,已经建立一个监听服务器,现在只要给服务器发送命令就好了 - if (DesignUtils.isStarted()) { - DesignUtils.clientSend(getModule().upFindSingleton(StartupArgs.class).get()); - return true; - } + return false; } From 93fa504d7529cbbac28f85ee60e4cf6b1cb24985 Mon Sep 17 00:00:00 2001 From: ju Date: Mon, 25 Jun 2018 20:08:55 +0800 Subject: [PATCH 7/7] =?UTF-8?q?REPORT-9080=20frm=E6=89=93=E4=B8=8D?= =?UTF-8?q?=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../start/module/DesignerModuleActivator.java | 65 +++++++++++++++++-- 1 file changed, 59 insertions(+), 6 deletions(-) diff --git a/designer-realize/src/com/fr/start/module/DesignerModuleActivator.java b/designer-realize/src/com/fr/start/module/DesignerModuleActivator.java index a6dc7b6fb..e544fb0ce 100644 --- a/designer-realize/src/com/fr/start/module/DesignerModuleActivator.java +++ b/designer-realize/src/com/fr/start/module/DesignerModuleActivator.java @@ -48,6 +48,7 @@ import com.fr.design.javascript.EmailPane; import com.fr.design.javascript.JavaScriptImplPane; import com.fr.design.javascript.ParameterJavaScriptPane; import com.fr.design.javascript.ProcessTransitionAdapter; +import com.fr.design.mainframe.AbstractAppProvider; import com.fr.design.mainframe.App; import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.ChartPropertyPane; @@ -77,6 +78,7 @@ import com.fr.design.parameter.WorkBookParameterReader; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane; import com.fr.file.FILE; +import com.fr.form.main.Form; import com.fr.form.stable.ElementCaseThumbnailProcessor; import com.fr.form.ui.ChartEditor; import com.fr.general.ComparatorUtils; @@ -117,6 +119,7 @@ import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.painter.BiasTextPainter; import com.fr.report.cell.painter.CellImagePainter; import com.fr.stable.ArrayUtils; +import com.fr.stable.Constants; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; import com.fr.stable.bridge.StableFactory; @@ -134,16 +137,14 @@ import com.fr.van.chart.DownloadOnlineSourcesHelper; import com.fr.van.chart.map.server.ChartMapEditorAction; import com.fr.xml.ReportXMLUtils; -import javax.swing.JDialog; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import java.awt.BorderLayout; -import java.awt.Image; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.InputStream; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Set; @@ -348,7 +349,8 @@ public class DesignerModuleActivator extends Activator implements Prepare { * @return 可以打开的模板类型的数组 */ private static App[] apps4TemplateOpener() { - return new App[]{getCptxApp(), getCptApp(), getXlsApp(), getXlsxApp()}; + + return new App[]{getCptxApp(), getCptApp(), getXlsApp(), getXlsxApp(), getFrmApp()}; } private static AbstractWorkBookApp getXlsxApp() { @@ -370,6 +372,57 @@ public class DesignerModuleActivator extends Activator implements Prepare { } }; } + + + private static AbstractAppProvider getFrmApp() { + + return new AbstractAppProvider
() { + + @Override + public String[] defaultExtensions() { + + return new String[]{"frm", "form"}; + } + + @Override + public JTemplate openTemplate(FILE tplFile) { + + HashMap classType = new HashMap(); + classType.put(Constants.ARG_0, Form.class); + classType.put(Constants.ARG_1, FILE.class); + + return (JTemplate) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, + new Object[]{asIOFile(tplFile), tplFile}, classType, BaseJForm.class); + } + + @Override + public Form asIOFile(FILE file) { + + if (XMLEncryptUtils.isCptEncoded() && + !XMLEncryptUtils.checkVaild(DesignerEnvManager.getEnvManager().getEncryptionKey())) { + if (!new DecodeDialog(file).isPwdRight()) { + FRContext.getLogger().error(Inter.getLocText("FR-Engine_ECP_error_pwd")); + return new Form(); + } + } + + + // peter:打开新报表. + Form tpl = new Form(); + // richer:打开报表通知 +// FRContext.getLogger().info(Inter.getLocText("LOG-Is_Being_Openned") + "\"" + file.getName() + "\"" + "," + Inter.getLocText("LOG-Please_Wait") + "..."); + FRContext.getLogger().info(Inter.getLocText(new String[]{"LOG-Is_Being_Openned", "LOG-Please_Wait"}, + new String[]{"\"" + file.getName() + "\"" + ",", "..."})); + try { + tpl.readStream(file.asInputStream()); + } catch (Exception exp) { + FRContext.getLogger().error("Failed to generate frm from " + file, exp); + return null; + } + return tpl; + } + }; + } private static AbstractWorkBookApp getXlsApp() { return new AbstractWorkBookApp() {