From e28b7a8892fd7ae4b0a4eef3343cc8b0da41e04b Mon Sep 17 00:00:00 2001 From: vito Date: Fri, 25 Aug 2017 15:53:19 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-4097=20[9.0=E4=B8=80=E8=BD=AE=E5=9B=9E?= =?UTF-8?q?=E5=BD=92]Mac=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=97=B6=EF=BC=8C=E8=B7=AF=E5=BE=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../file/export/AbstractExportAction.java | 4 +- .../src/com/fr/file/FILEChooserPane.java | 148 ++++++++---------- 2 files changed, 64 insertions(+), 88 deletions(-) diff --git a/designer/src/com/fr/design/actions/file/export/AbstractExportAction.java b/designer/src/com/fr/design/actions/file/export/AbstractExportAction.java index e80e75fb9..74e8fbdf3 100644 --- a/designer/src/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer/src/com/fr/design/actions/file/export/AbstractExportAction.java @@ -72,7 +72,7 @@ public abstract class AbstractExportAction extends JWorkBookAction { } // Choose a file name.... - FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(false, true); + FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true); fileChooserPane.setFILEFilter(this.getChooseFileFilter()); // 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc @@ -139,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 PDFExporterProcessor || exporter instanceof WordExporter) { + || exporter instanceof PDFExporterProcessor || exporter instanceof WordExporter) { ReportHelper.clearFormulaResult(tpl);// 清空rpt中的公式计算结果 appExporter.export(fileOutputStream, tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE) diff --git a/designer_base/src/com/fr/file/FILEChooserPane.java b/designer_base/src/com/fr/file/FILEChooserPane.java index 29d018398..cdc0c2c0f 100644 --- a/designer_base/src/com/fr/file/FILEChooserPane.java +++ b/designer_base/src/com/fr/file/FILEChooserPane.java @@ -1,51 +1,5 @@ package com.fr.file; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.swing.AbstractAction; -import javax.swing.AbstractListModel; -import javax.swing.ActionMap; -import javax.swing.BorderFactory; -import javax.swing.DefaultComboBoxModel; -import javax.swing.DefaultListCellRenderer; -import javax.swing.DefaultListModel; -import javax.swing.Icon; -import javax.swing.InputMap; -import javax.swing.JComponent; -import javax.swing.JFileChooser; -import javax.swing.JList; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.KeyStroke; -import javax.swing.ListCellRenderer; -import javax.swing.ListModel; -import javax.swing.ListSelectionModel; -import javax.swing.SwingConstants; -import javax.swing.SwingUtilities; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.filechooser.FileSystemView; -import javax.swing.plaf.basic.BasicArrowButton; -import javax.swing.plaf.basic.BasicButtonUI; - import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.dav.LocalEnv; @@ -70,12 +24,23 @@ import com.fr.file.filter.FILEFilter; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; import com.fr.general.Inter; -import com.fr.stable.CoreConstants; -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 javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.filechooser.FileSystemView; +import javax.swing.plaf.basic.BasicArrowButton; +import javax.swing.plaf.basic.BasicButtonUI; +import java.awt.*; +import java.awt.event.*; +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + /* * FileChooserPane要高亮显示某Button,以显示当前路径 * 边距要调整 @@ -300,15 +265,15 @@ public class FILEChooserPane extends BasicPane { if (ss instanceof FILEFilter) { setFILEFilter((FILEFilter) ss); } else { - setFILEFilter(null); - } + setFILEFilter(null); + } } }); } - - private void doCancel(){ - this.locationBtnPane.setPopDir(null); - dialogExit(); + + private void doCancel() { + this.locationBtnPane.setPopDir(null); + dialogExit(); } /** @@ -343,7 +308,7 @@ public class FILEChooserPane extends BasicPane { } } - protected String getEnvProjectName(){ + protected String getEnvProjectName() { return Inter.getLocText("Utils-Report-Env_Directory"); } @@ -361,7 +326,7 @@ public class FILEChooserPane extends BasicPane { * 在指定index增加过滤器 * * @param filter 过滤器 - * @param index 序号 + * @param index 序号 */ public void addChooseFILEFilter(FILEFilter filter, int index) { if (filterList.contains(filter)) { @@ -377,7 +342,7 @@ public class FILEChooserPane extends BasicPane { * 若是已经存在,则将之删去之后,在指定的位置增加 * * @param filter 过滤 - * @param index 序号 + * @param index 序号 */ public void addChooseFILEFilterToFist(FILEFilter filter, int index) { if (filterList.contains(filter)) { @@ -421,7 +386,7 @@ public class FILEChooserPane extends BasicPane { /** * richer:默认的话就使用.cpt作为后缀名 * - * @param text 文本 + * @param text 文本 * @param suffix 后缀 */ public void setFileNameTextField(String text, String suffix) { @@ -457,6 +422,7 @@ public class FILEChooserPane extends BasicPane { /** * 打开对话框 + * * @param parent 父类 * @return 类型 */ @@ -466,6 +432,7 @@ public class FILEChooserPane extends BasicPane { /** * 打开对话框 + * * @param parent 父类 * @param suffix 后缀 * @return 类型 @@ -476,6 +443,7 @@ public class FILEChooserPane extends BasicPane { /** * 打开对话框 + * * @param parent 父类 * @return 类型 */ @@ -485,6 +453,7 @@ public class FILEChooserPane extends BasicPane { /** * 打开对话框 + * * @param parent 父类 * @param suffix 后缀 * @return 类型 @@ -497,7 +466,7 @@ public class FILEChooserPane extends BasicPane { * august:控件的事件都在这里面添加的 那么我每次showDialog,不都要重复添加一次事件吗?无语了 * * @param parent 父类 - * @param type 类型 + * @param type 类型 * @param suffix 后缀 * @return 类型 */ @@ -506,7 +475,7 @@ public class FILEChooserPane extends BasicPane { this.suffix = suffix; - dialog = showWindow((Window)parent, false); + dialog = showWindow((Window) parent, false); JPanel contentPane = (JPanel) dialog.getContentPane(); contentPane.setLayout(FRGUIPaneFactory.createM_BorderLayout()); contentPane.add(this, BorderLayout.CENTER); @@ -545,11 +514,11 @@ public class FILEChooserPane extends BasicPane { protected void fileType() { String appName = ProductConstants.APP_NAME; JTemplate editing = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if(ComparatorUtils.equals(suffix,".crt")){ + if (ComparatorUtils.equals(suffix, ".crt")) { this.addChooseFILEFilter(new ChooseFileFilter("crt", appName + Inter.getLocText(new String[]{"Utils-The-Chart", "FR-App-All_File"}))); return; } - if(editing == null || !editing.isChartBook()){ + if (editing == null || !editing.isChartBook()) { String[] fileSuffix_local = LocalEnv.FILE_TYPE; String[] fileSuffix = {"cpt", "frm", "form", "cht", "chart"}; if (type == JFileChooser.OPEN_DIALOG) { @@ -566,10 +535,10 @@ public class FILEChooserPane extends BasicPane { // richer:form文件 daniel 改成三个字 this.addChooseFILEFilter(new ChooseFileFilter("frm", appName + Inter.getLocText(new String[]{"FR-App-Template_Form", "FR-App-All_File"}))); this.addChooseFILEFilter(new ChooseFileFilter("form", appName + Inter.getLocText(new String[]{"FR-App-Template_Form", "FR-App-All_File"}))); - }else{ - String[] fileSuffix_local = {"xls","xlsx"}; + } else { + String[] fileSuffix_local = {"xls", "xlsx"}; if (type == JFileChooser.OPEN_DIALOG) { - this.addChooseFILEFilter(new ChooseFileFilter(fileSuffix_local,Inter.getLocText("Import-Excel_Source"))); + this.addChooseFILEFilter(new ChooseFileFilter(fileSuffix_local, Inter.getLocText("Import-Excel_Source"))); } } @@ -578,8 +547,8 @@ public class FILEChooserPane extends BasicPane { this.addChooseFILEFilter(new ChooseFileFilter("xls", Inter.getLocText("Import-Excel_Source"))); this.addChooseFILEFilter(new ChooseFileFilter("xlsx", Inter.getLocText("Import-Excel2007_Source"))); } - if(ComparatorUtils.equals(suffix,".png")){ - this.addChooseFILEFilter(new ChooseFileFilter("png",Inter.getLocText("FR-App-Export_png"))); + if (ComparatorUtils.equals(suffix, ".png")) { + this.addChooseFILEFilter(new ChooseFileFilter("png", Inter.getLocText("FR-App-Export_png"))); } if (type == JFileChooser.SAVE_DIALOG) { this.addChooseFILEFilter(new ChooseFileFilter("pdf", Inter.getLocText("FR-Import-Export_PDF"))); @@ -627,7 +596,7 @@ public class FILEChooserPane extends BasicPane { postfixComboBox.setSelectedIndex(suffixIndex("doc")); } else if (ComparatorUtils.equals(suffix, ".txt")) { postfixComboBox.setSelectedIndex(suffixIndex("txt")); - }else if(ComparatorUtils.equals(suffix,".png")){ + } else if (ComparatorUtils.equals(suffix, ".png")) { postfixComboBox.setSelectedIndex(suffixIndex("png")); } //jerry 26216 只保留.cpt .frm有用的格式,并且不可编辑 @@ -643,10 +612,10 @@ public class FILEChooserPane extends BasicPane { } } - private int suffixIndex(String extension){ - for(int i=0 ;i