From 3c40011366f54e8e4844cab5e3f409fc90abc43a Mon Sep 17 00:00:00 2001 From: richie Date: Fri, 16 Nov 2018 16:37:19 +0800 Subject: [PATCH 01/44] =?UTF-8?q?=20=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=80=A6=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/fun/ConnectionProvider.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/ConnectionProvider.java b/designer-base/src/main/java/com/fr/design/fun/ConnectionProvider.java index 766f7d4147..8e5aed5b87 100644 --- a/designer-base/src/main/java/com/fr/design/fun/ConnectionProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/ConnectionProvider.java @@ -10,32 +10,36 @@ import com.fr.stable.fun.mark.Mutable; */ public interface ConnectionProvider extends Mutable { - public static final String XML_TAG = "ConnectionProvider"; + String XML_TAG = "ConnectionProvider"; // 2016-12-14 1 -> 2 , 增加connection.feature方法导致不兼容. int CURRENT_LEVEL = 2; /** * 数据连接弹出菜单的名字 + * * @return 名字 */ - public String nameForConnection(); + String nameForConnection(); /** * 数据连接弹出菜单的图标 + * * @return 图标路径 */ - public String iconPathForConnection(); + String iconPathForConnection(); /** * 数据连接的类型 + * * @return 连接类型 */ - public Class classForConnection(); + Class classForConnection(); /** * 数据连接的设计界面 + * * @return 设计界面 */ - public Class> appearanceForConnection(); + Class> appearanceForConnection(); } \ No newline at end of file From a57c7c4b8113ed816fb0fbcbad9caed0e2523d01 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Fri, 16 Nov 2018 17:30:46 +0800 Subject: [PATCH 02/44] =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../file/export/AbstractExportAction.java | 20 ++ .../src/main/java/com/fr/file/FILE.java | 1 + .../src/main/java/com/fr/file/MemFILE.java | 12 ++ .../actions/FormMobileAttrAction.java | 2 +- .../actions/NewFormAction.java | 2 +- .../actions/TemplateParameterAction.java | 2 +- .../EmbeddedFormExportExportAction.java | 185 ++++++++++++++++ .../java/com/fr/design/mainframe/JForm.java | 10 +- .../EmbeddedFormExportExportAction.java | 155 -------------- .../export/AbstractExcelExportAction.java | 2 +- .../file/export/AbstractExportAction.java | 196 ----------------- .../export/AbstractJWorkBookExportAction.java | 197 ++++++++++++++++++ .../actions/file/export/CSVExportAction.java | 35 ++-- .../export/EmbeddedExportExportAction.java | 18 +- .../file/export/ExcelExportAction.java | 21 +- .../actions/file/export/PDFExportAction.java | 27 ++- .../file/export/PageExcelExportAction.java | 21 +- .../export/PageToSheetExcelExportAction.java | 19 +- .../actions/file/export/SVGExportAction.java | 19 +- .../actions/file/export/TextExportAction.java | 17 +- .../actions/file/export/WordExportAction.java | 13 +- .../com/fr/design/mainframe/JWorkBook.java | 4 +- .../com/fr/design/mainframe/app/CptApp.java | 4 +- .../com/fr/design/mainframe/app/CptxApp.java | 4 +- .../com/fr/design/mainframe/app/FormApp.java | 4 +- .../com/fr/design/mainframe/app/XlsApp.java | 4 +- .../com/fr/design/mainframe/app/XlsxApp.java | 4 +- .../fr/start/module/DesignerActivator.java | 2 +- 28 files changed, 514 insertions(+), 486 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java rename designer-form/src/main/java/com/fr/design/{mainframe => }/actions/FormMobileAttrAction.java (98%) rename designer-form/src/main/java/com/fr/design/{mainframe => }/actions/NewFormAction.java (97%) rename designer-form/src/main/java/com/fr/design/{mainframe => }/actions/TemplateParameterAction.java (98%) create mode 100644 designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java delete mode 100644 designer-form/src/main/java/com/fr/design/mainframe/actions/EmbeddedFormExportExportAction.java delete mode 100644 designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java new file mode 100644 index 0000000000..3423536c5a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -0,0 +1,20 @@ +package com.fr.design.actions.file.export; + +import com.fr.design.actions.JTemplateAction; +import com.fr.design.mainframe.JTemplate; +import com.fr.file.filter.ChooseFileFilter; +import com.fr.io.exporter.DesignExportType; + +public abstract class AbstractExportAction> extends JTemplateAction { + + public AbstractExportAction(E t) { + super(t); + } + + public abstract String exportScopeName(); + + public abstract DesignExportType exportType(); + + protected abstract ChooseFileFilter getChooseFileFilter(); + +} diff --git a/designer-base/src/main/java/com/fr/file/FILE.java b/designer-base/src/main/java/com/fr/file/FILE.java index 8c1f734cf9..8907a646f6 100644 --- a/designer-base/src/main/java/com/fr/file/FILE.java +++ b/designer-base/src/main/java/com/fr/file/FILE.java @@ -55,6 +55,7 @@ public interface FILE { * @return 是否新建成功 * @throws Exception 异常 */ + @SuppressWarnings({"UnusedReturnValue"}) boolean mkfile() throws Exception; /** diff --git a/designer-base/src/main/java/com/fr/file/MemFILE.java b/designer-base/src/main/java/com/fr/file/MemFILE.java index f35151eb93..102c6b9e78 100644 --- a/designer-base/src/main/java/com/fr/file/MemFILE.java +++ b/designer-base/src/main/java/com/fr/file/MemFILE.java @@ -18,6 +18,7 @@ public class MemFILE implements FILE { * @param name 名字 * @return 新建目录 */ + @Override public boolean createFolder(String name) { return false; } @@ -27,6 +28,7 @@ public class MemFILE implements FILE { * * @return 是否存在 */ + @Override public boolean exists() { return false; } @@ -37,6 +39,7 @@ public class MemFILE implements FILE { * @return 是否新建成功 * @throws Exception 异常 */ + @Override public boolean mkfile() throws Exception { return false; } @@ -56,6 +59,7 @@ public class MemFILE implements FILE { return name; } + @Override public String getEnvFullName() { return name; } @@ -65,6 +69,7 @@ public class MemFILE implements FILE { * * @return 是则返回true */ + @Override public boolean isMemFile() { return true; } @@ -74,6 +79,7 @@ public class MemFILE implements FILE { * * @return 是则返回true */ + @Override public boolean isEnvFile() { return false; } @@ -88,6 +94,7 @@ public class MemFILE implements FILE { * * @return 是则返回true */ + @Override public boolean isDirectory() { return false; } @@ -97,6 +104,7 @@ public class MemFILE implements FILE { * * @return 文件 */ + @Override public FILE[] listFiles() { return new FILE[0]; } @@ -106,6 +114,7 @@ public class MemFILE implements FILE { * * @return 前缀 */ + @Override public String prefix() { return FILEFactory.MEM_PREFIX; } @@ -129,6 +138,7 @@ public class MemFILE implements FILE { * * @throws Exception 异常 */ + @Override public void closeTemplate() throws Exception { } @@ -138,6 +148,7 @@ public class MemFILE implements FILE { * @return 输入流 * @throws Exception 异常 */ + @Override public InputStream asInputStream() throws Exception { return null; } @@ -148,6 +159,7 @@ public class MemFILE implements FILE { * @return 输出流 * @throws Exception 异常 */ + @Override public OutputStream asOutputStream() throws Exception { return null; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/actions/FormMobileAttrAction.java b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java similarity index 98% rename from designer-form/src/main/java/com/fr/design/mainframe/actions/FormMobileAttrAction.java rename to designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java index 2707e8f9b8..033ba5ea57 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/actions/FormMobileAttrAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.actions; +package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.base.iofile.attr.MobileOnlyTemplateAttrMark; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/actions/NewFormAction.java b/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java similarity index 97% rename from designer-form/src/main/java/com/fr/design/mainframe/actions/NewFormAction.java rename to designer-form/src/main/java/com/fr/design/actions/NewFormAction.java index 9c9f7fec49..8004b739f2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/actions/NewFormAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.actions; +package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/actions/TemplateParameterAction.java b/designer-form/src/main/java/com/fr/design/actions/TemplateParameterAction.java similarity index 98% rename from designer-form/src/main/java/com/fr/design/mainframe/actions/TemplateParameterAction.java rename to designer-form/src/main/java/com/fr/design/actions/TemplateParameterAction.java index 59e08ae03b..bd747444e3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/actions/TemplateParameterAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/TemplateParameterAction.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.actions; +package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.base.Parameter; diff --git a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java new file mode 100644 index 0000000000..758baeab6b --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java @@ -0,0 +1,185 @@ +package com.fr.design.actions.file.export; + +import com.fr.base.BaseUtils; +import com.fr.base.Parameter; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.gui.iprogressbar.FRProgressBar; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrame; +import com.fr.design.mainframe.JForm; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.menu.KeySetUtils; +import com.fr.design.parameter.ParameterInputPane; +import com.fr.file.FILE; +import com.fr.file.FILEChooserPane; +import com.fr.file.filter.ChooseFileFilter; +import com.fr.form.main.Form; +import com.fr.io.exporter.DesignExportType; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.project.ProjectConstants; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.exporter.TemplateExportOperator; + +import javax.swing.JOptionPane; +import javax.swing.SwingWorker; +import java.awt.event.ActionEvent; +import java.io.OutputStream; +import java.util.HashMap; +import java.util.Map; + +/** + * Export Embedded. + */ +public class EmbeddedFormExportExportAction extends AbstractExportAction { + + private FRProgressBar progressbar; + + public EmbeddedFormExportExportAction(JForm jwb) { + super(jwb); + this.setMenuKeySet(KeySetUtils.EMBEDDED_EXPORT); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/oem/logo.png")); + } + + @Override + public String exportScopeName() { + return "FINE_FORM"; + } + + @Override + public DesignExportType exportType() { + return DesignExportType.EMBEDDED_FORM; + } + + /** + * Action触发事件 + * + * @param e 触发事件 + */ + @Override + public void actionPerformed(ActionEvent e) { + + // todo 提示保存 + JTemplate jwb = this.getEditingComponent(); + FILE source = jwb.getEditingFILE(); + + // 输入参数 + final Map parameterMap = new HashMap(); + final Form tpl = this.getEditingComponent().getTarget(); + inputParameter(parameterMap, tpl, DesignerContext.getDesignerFrame()); + + FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(false, true); + fileChooserPane.setFILEFilter(this.getChooseFileFilter()); + + String fileName = source.getName(); + fileChooserPane.setFileNameTextField(fileName, ProjectConstants.FRM_SUFFIX); + int saveValue = fileChooserPane.showSaveDialog(DesignerContext.getDesignerFrame(), ProjectConstants.FRM_SUFFIX); + + if (isOk(saveValue)) { + startExport(source, parameterMap, fileChooserPane); + } + } + + private void startExport(FILE source, Map parameterMap, + FILEChooserPane fileChooserPane) { + FILE target = fileChooserPane.getSelectedFILE(); + try { + target.mkfile(); + } catch (Exception e1) { + FineLoggerFactory.getLogger().error("Error In Make New File"); + } + FineLoggerFactory.getLogger().info("\"" + target.getName() + "\"" + Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); + + (progressbar = + new FRProgressBar( + createExportWork(source, target, parameterMap), + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Report_Exporting"), + StringUtils.EMPTY, + 0, + 100) + ).start(); + } + + private boolean isOk(int saveValue) { + return saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION; + } + + + private void inputParameter(final Map parameterMap, final Form tpl, DesignerFrame designerFrame) { + Parameter[] parameters = tpl.getParameters(); + // 检查Parameter. + if (ArrayUtils.isNotEmpty(parameters)) { + final ParameterInputPane pPane = new ParameterInputPane(parameters); + pPane.showSmallWindow(designerFrame, new DialogActionAdapter() { + + @Override + public void doOk() { + parameterMap.putAll(pPane.update()); + } + }).setVisible(true); + } + } + + @Override + protected ChooseFileFilter getChooseFileFilter() { + return new ChooseFileFilter(new String[]{"frm"}, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_EmbeddedTD")); + } + + private SwingWorker createExportWork(FILE source, final FILE target, final Map parameterMap) { + final String path = source.getPath(); + final String name = target.getName(); + + return new SwingWorker() { + @Override + protected Void doInBackground() throws Exception { + Thread.sleep(100); + try { + final OutputStream fileOutputStream = target.asOutputStream(); + + this.setProgress(10); + dealExporter(fileOutputStream, path, parameterMap); + this.setProgress(80); + fileOutputStream.flush(); + fileOutputStream.close(); + this.setProgress(100); + + FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name); + } catch (Exception exp) { + this.setProgress(100); + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + path); + } + return null; + } + + @Override + public void done() { + progressbar.close(); + } + }; + } + + private void dealExporter(OutputStream outputStream, String path, final Map para) throws Exception { + + // 没有办法处理这个 isLocal 判断,因为一个是修改参数传递结果,一个是返回值做结果 + // todo 后续想想办法 + if (WorkContext.getCurrent().isLocal()) { + WorkContext.getCurrent().get(TemplateExportOperator.class) + .export(exportScopeName(), exportType(), outputStream, path, para); + } else { + byte[] contents = + WorkContext.getCurrent().get(TemplateExportOperator.class) + .export(exportScopeName(), exportType(), null, path, para); + + outputStream.write(contents); + } + } + +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index f6dfdba524..bb6483b32a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -5,6 +5,8 @@ import com.fr.base.PaperSize; import com.fr.base.Parameter; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; +import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; +import com.fr.design.actions.TemplateParameterAction; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.cell.FloatElementsProvider; import com.fr.design.designer.TargetComponent; @@ -31,11 +33,8 @@ import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.xpane.FormHyperlinkGroupPane; import com.fr.design.gui.xpane.FormHyperlinkGroupPaneNoPop; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.actions.EmbeddedFormExportExportAction; -import com.fr.design.mainframe.actions.TemplateParameterAction; import com.fr.design.mainframe.form.FormECCompositeProvider; import com.fr.design.mainframe.form.FormECDesignerProvider; -import com.fr.design.report.fit.menupane.ReportFitAttrAction; import com.fr.design.mainframe.templateinfo.JFormProcessInfo; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; @@ -47,6 +46,7 @@ import com.fr.design.menu.ToolBarDef; import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.preview.FormPreview; import com.fr.design.preview.MobilePreview; +import com.fr.design.report.fit.menupane.ReportFitAttrAction; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.utils.gui.LayoutUtils; import com.fr.file.FILE; @@ -469,6 +469,7 @@ public class JForm extends JTemplate implements BaseJForm { public void setPictureElem(Elem elem, CellImage cellImage) { elem.setValue(cellImage.getImage()); } + /** * 目标菜单 * @@ -503,7 +504,7 @@ public class JForm extends JTemplate implements BaseJForm { @Override public ShortCut[] shortcut4TemplateMenu() { if (this.index == FORM_TAB) { - return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); + return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); } else { return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); } @@ -932,6 +933,7 @@ public class JForm extends JTemplate implements BaseJForm { /** * 支持的预览模式 + * * @return 预览模式 */ @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/actions/EmbeddedFormExportExportAction.java b/designer-form/src/main/java/com/fr/design/mainframe/actions/EmbeddedFormExportExportAction.java deleted file mode 100644 index 7ddb8ae8d5..0000000000 --- a/designer-form/src/main/java/com/fr/design/mainframe/actions/EmbeddedFormExportExportAction.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.fr.design.mainframe.actions; - -import com.fr.base.BaseUtils; -import com.fr.base.FRContext; -import com.fr.base.Parameter; -import com.fr.design.actions.JTemplateAction; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.gui.iprogressbar.FRProgressBar; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.DesignerFrame; -import com.fr.design.mainframe.JForm; -import com.fr.design.mainframe.JTemplate; -import com.fr.design.menu.KeySetUtils; -import com.fr.design.parameter.ParameterInputPane; -import com.fr.file.FILE; -import com.fr.file.FILEChooserPane; -import com.fr.file.filter.ChooseFileFilter; -import com.fr.form.main.Form; -import com.fr.form.main.FormEmbeddedTableDataExporter; -import com.fr.log.FineLoggerFactory; - -import com.fr.stable.ArrayUtils; -import com.fr.stable.project.ProjectConstants; - -import javax.swing.*; -import java.awt.event.ActionEvent; -import java.io.FileOutputStream; -import java.util.HashMap; -import java.util.Map; - -/** - * Export Embedded. - */ -public class EmbeddedFormExportExportAction extends JTemplateAction{ - - private FRProgressBar progressbar; - /** - * Constructor - */ - public EmbeddedFormExportExportAction(JForm jwb) { - super(jwb); - this.setMenuKeySet(KeySetUtils.EMBEDDED_EXPORT); - this.setName(getMenuKeySet().getMenuKeySetName() + "..."); - this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/oem/logo.png")); - } - - /** - * Action触发事件 - * - * @param e 触发事件 - * - */ - public void actionPerformed(ActionEvent e) { - JTemplate jwb = this.getEditingComponent(); - FILE editingFILE = jwb.getEditingFILE(); - DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - - final Map parameterMap = new HashMap(); - final Form tpl = this.getEditingComponent().getTarget(); - inputParameter(parameterMap, tpl, designerFrame); - - FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(false, true); - fileChooserPane.setFILEFilter(this.getChooseFileFilter()); - - String filenName = editingFILE.getName(); - fileChooserPane.setFileNameTextField(filenName, ProjectConstants.FRM_SUFFIX); - int saveValue = fileChooserPane.showSaveDialog(designerFrame, ProjectConstants.FRM_SUFFIX); - if (isCancel(saveValue)) { - fileChooserPane = null; - return; - } - - if (isOk(saveValue)) { - startExport(parameterMap, tpl, designerFrame, fileChooserPane); - } - } - - private void startExport(Map parameterMap, Form tpl, DesignerFrame designerFrame, - FILEChooserPane fileChooserPane){ - FILE file = fileChooserPane.getSelectedFILE(); - try { - file.mkfile(); - } catch (Exception e1) { - FineLoggerFactory.getLogger().error("Error In Make New File"); - } - fileChooserPane = null; - FRContext.getLogger().info("\"" + file.getName() + "\"" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); - - (progressbar = new FRProgressBar(createExportWork(file, tpl, parameterMap), designerFrame, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Exporting"), "", 0, 100)).start(); - } - - private boolean isOk(int saveValue){ - return saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION; - } - - private boolean isCancel(int saveValue){ - return saveValue == FILEChooserPane.CANCEL_OPTION || saveValue == FILEChooserPane.JOPTIONPANE_CANCEL_OPTION; - } - - private void inputParameter(final Map parameterMap, final Form tpl, DesignerFrame designerFrame){ - Parameter[] parameters = tpl.getParameters(); - if (ArrayUtils.isNotEmpty(parameters)) {// 检查Parameter. - final ParameterInputPane pPane = new ParameterInputPane(parameters); - pPane.showSmallWindow(designerFrame, new DialogActionAdapter() { - - @Override - public void doOk() { - parameterMap.putAll(pPane.update()); - } - }).setVisible(true); - } - } - - protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(new String[]{"frm"}, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_EmbeddedTD")); - } - - private SwingWorker createExportWork(FILE file, final Form tpl, final Map parameterMap) { - final String filePath = file.getPath(); - final String fileGetName = file.getName(); - - SwingWorker exportWorker = new SwingWorker() { - protected Void doInBackground() throws Exception { - Thread.sleep(100); - try { - final FileOutputStream fileOutputStream = new FileOutputStream(filePath); - - this.setProgress(10); - FormEmbeddedTableDataExporter exporter = new FormEmbeddedTableDataExporter(); - exporter.export(fileOutputStream, tpl, parameterMap); - this.setProgress(80); - fileOutputStream.close(); - this.setProgress(100); - - FRContext.getLogger().info("\"" + fileGetName + "\"" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + fileGetName); - } catch (Exception exp) { - this.setProgress(100); - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + filePath); - } - return null; - } - - public void done() { - progressbar.close(); - } - }; - return exportWorker; - } - -} diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java index 37ab34d76b..c4718c06f8 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java @@ -12,7 +12,7 @@ import com.fr.main.TemplateWorkBook; /** * Export excel. */ -public abstract class AbstractExcelExportAction extends AbstractExportAction { +public abstract class AbstractExcelExportAction extends AbstractJWorkBookExportAction { /** * Constructor */ diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java deleted file mode 100644 index 3cbabd5b5d..0000000000 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. - */ -package com.fr.design.actions.file.export; - -import com.fr.base.FRContext; -import com.fr.base.Parameter; -import com.fr.design.actions.JWorkBookAction; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.gui.iprogressbar.FRProgressBar; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.DesignerFrame; -import com.fr.design.mainframe.JWorkBook; -import com.fr.design.parameter.ParameterInputPane; -import com.fr.file.FILE; -import com.fr.file.FILEChooserPane; -import com.fr.file.filter.ChooseFileFilter; -import com.fr.log.FineLoggerFactory; - -import com.fr.io.exporter.AppExporter; -import com.fr.io.exporter.CSVExporter; -import com.fr.io.exporter.EmbeddedTableDataExporter; -import com.fr.io.exporter.ExcelExporter; -import com.fr.io.exporter.Exporter; -import com.fr.io.exporter.PDFExporterProcessor; -import com.fr.io.exporter.WordExporter; -import com.fr.main.TemplateWorkBook; -import com.fr.main.impl.WorkBook; -import com.fr.page.PageSetProvider; -import com.fr.report.ReportHelper; -import com.fr.report.core.ReportUtils; -import com.fr.report.report.Report; -import com.fr.report.worksheet.WorkSheet; -import com.fr.stable.ActorConstants; -import com.fr.stable.ActorFactory; - -import javax.swing.*; -import java.awt.event.ActionEvent; -import java.io.OutputStream; -import java.util.Map; - -/** - * Abstract export action. - */ -public abstract class AbstractExportAction extends JWorkBookAction { - protected AbstractExportAction(JWorkBook jwb) { - super(jwb); - } - - private FRProgressBar progressbar; - - protected WorkBook getTemplateWorkBook() { - return this.getEditingComponent().getTarget(); - } - - /** - * 执行方法 - */ - @Override - public void actionPerformed(ActionEvent e) { - JWorkBook jwb = this.getEditingComponent(); - FILE editingFILE = jwb.getEditingFILE(); - DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - - // 弹出参数 - final java.util.Map parameterMap = new java.util.HashMap(); - final TemplateWorkBook tpl = getTemplateWorkBook(); - Parameter[] parameters = tpl.getParameters(); - if (parameters != null && parameters.length > 0) {// 检查Parameter. - final ParameterInputPane pPane = new ParameterInputPane( - parameters); - pPane.showSmallWindow(designerFrame, new DialogActionAdapter() { - - @Override - public void doOk() { - parameterMap.putAll(pPane.update()); - } - }).setVisible(true); - } - - // Choose a file name.... - FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true); - fileChooserPane.addChooseFILEFilter(this.getChooseFileFilter()); - - // 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc - String filenName = editingFILE.getName(); - if (filenName.indexOf('.') != -1) { - filenName = filenName.substring(0, editingFILE.getName().lastIndexOf('.')); - } - fileChooserPane.setFileNameTextField(filenName, "." + this.getDefaultExtension()); - int saveValue = fileChooserPane.showSaveDialog(designerFrame, "." + this.getDefaultExtension()); - if (saveValue == FILEChooserPane.CANCEL_OPTION || saveValue == FILEChooserPane.JOPTIONPANE_CANCEL_OPTION) { - fileChooserPane = null; - return; - } else if (saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION) { - FILE file = fileChooserPane.getSelectedFILE(); - try { - file.mkfile(); - } catch (Exception e1) { - FineLoggerFactory.getLogger().error("Error In Make New File"); - } - fileChooserPane = null; - FRContext.getLogger().info("\"" + file.getName() + "\"" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); - - (progressbar = new FRProgressBar(createExportWork(file, tpl, parameterMap), designerFrame, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Exporting"), "", 0, 100)).start(); - } - } - - private SwingWorker createExportWork(final FILE file, final TemplateWorkBook tpl, final Map parameterMap) { - final String filePath = file.getPath(); - final String fileGetName = file.getName(); - - SwingWorker exportWorker = new SwingWorker() { - - @Override - protected Void doInBackground() throws Exception { - Thread.sleep(100); //bug 10516 - try { - OutputStream outputStream = file.asOutputStream(); - - this.setProgress(10); - dealExporter(outputStream, tpl, parameterMap); - this.setProgress(80); - outputStream.flush(); - outputStream.close(); - this.setProgress(100); - - FRContext.getLogger().info("\"" + fileGetName + "\"" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + fileGetName); - } catch (Exception exp) { - this.setProgress(100); - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + filePath, - null, 0, UIManager.getIcon("OptionPane.errorIcon")); - } - return null; - } - - @Override - public void done() { - progressbar.close(); - } - }; - return exportWorker; - } - - private void dealExporter(OutputStream outputStream, final TemplateWorkBook tpl, final Map parameterMap) throws Exception { - final Exporter exporter = AbstractExportAction.this.getExporter(); - if (exporter instanceof AppExporter) { - AppExporter appExporter = (AppExporter) exporter; - if (exporter instanceof ExcelExporter || exporter instanceof CSVExporter - || exporter instanceof PDFExporterProcessor || exporter instanceof WordExporter) { - ReportHelper.clearFormulaResult(tpl);// 清空rpt中的公式计算结果 - - appExporter.export(outputStream, tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE) - )); - } else { - ReportHelper.clearFormulaResult(tpl);// 清空currentReport中的公式计算结果 - - PageSetProvider pageSet = tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE)).generateReportPageSet( - ReportUtils.getPaperSettingListFromWorkBook(tpl)).traverse4Export(); - appExporter.export(outputStream, pageSet); - pageSet.release(); - } - } else if (exporter instanceof EmbeddedTableDataExporter) { - ((EmbeddedTableDataExporter) exporter).export(outputStream, (WorkBook) tpl, parameterMap); - } - } - - /* - * 这边判断是否有层式报表,有层式需要使用大数据量导出 - */ - 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 ChooseFileFilter getChooseFileFilter(); - - protected abstract String getDefaultExtension(); - - protected abstract Exporter getExporter(); -} diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java new file mode 100644 index 0000000000..e051edb4c8 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java @@ -0,0 +1,197 @@ +/* + * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. + */ +package com.fr.design.actions.file.export; + +import com.fr.base.Parameter; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.gui.iprogressbar.FRProgressBar; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JWorkBook; +import com.fr.design.parameter.ParameterInputPane; +import com.fr.file.FILE; +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; + +import javax.swing.JOptionPane; +import javax.swing.SwingWorker; +import javax.swing.UIManager; +import java.awt.event.ActionEvent; +import java.io.OutputStream; +import java.util.HashMap; +import java.util.Map; + +/** + * Abstract export action. + */ +public abstract class AbstractJWorkBookExportAction extends AbstractExportAction { + + private FRProgressBar progressbar; + + protected AbstractJWorkBookExportAction(JWorkBook jwb) { + super(jwb); + } + + protected WorkBook getTemplateWorkBook() { + return this.getEditingComponent().getTarget(); + } + + /** + * 执行方法 + */ + @Override + public void actionPerformed(ActionEvent e) { + + // todo 弹出提醒保存,如果没保存 + + + JWorkBook jwb = this.getEditingComponent(); + FILE source = jwb.getEditingFILE(); + + // 弹出参数 + final Map parameterMap = new HashMap<>(); + final TemplateWorkBook tpl = getTemplateWorkBook(); + Parameter[] parameters = tpl.getParameters(); + if (parameters != null && parameters.length > 0) {// 检查Parameter. + final ParameterInputPane pPane = new ParameterInputPane( + parameters); + pPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + + @Override + public void doOk() { + parameterMap.putAll(pPane.update()); + } + }).setVisible(true); + } + + // file choose + FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true); + fileChooserPane.addChooseFILEFilter(this.getChooseFileFilter()); + + // 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc + String fileName = source.getName(); + if (fileName.indexOf('.') != -1) { + fileName = fileName.substring(0, fileName.lastIndexOf('.')); + } + fileChooserPane.setFileNameTextField(fileName, "." + this.getDefaultExtension()); + int saveValue = fileChooserPane.showSaveDialog(DesignerContext.getDesignerFrame(), "." + this.getDefaultExtension()); + if (saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION) { + FILE target = fileChooserPane.getSelectedFILE(); + try { + target.mkfile(); + } catch (Exception exp) { + FineLoggerFactory.getLogger().error("Error In Make New File", exp); + } + FineLoggerFactory.getLogger().info("\"" + target.getName() + "\"" + Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); + + (progressbar = new FRProgressBar( + createExportWork(source, target, parameterMap), + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Report_Exporting"), + StringUtils.EMPTY, + 0, + 100) + ).start(); + } + } + + private SwingWorker createExportWork(final FILE source, final FILE target, final Map parameterMap) { + final String path = source.getPath(); + final String name = target.getName(); + + return new SwingWorker() { + + @Override + protected Void doInBackground() throws Exception { + //bug 10516 + Thread.sleep(100); + OutputStream outputStream = null; + try { + outputStream = target.asOutputStream(); + this.setProgress(10); + dealExporter(outputStream, path, parameterMap); + this.setProgress(80); + outputStream.flush(); + outputStream.close(); + this.setProgress(100); + + FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name); + } catch (Exception exp) { + this.setProgress(100); + target.closeTemplate(); + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + path, + null, + JOptionPane.ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon") + ); + } finally { + if (outputStream != null) { + outputStream.close(); + } + } + return null; + } + + @Override + public void done() { + progressbar.close(); + } + }; + } + + private void dealExporter(OutputStream outputStream, String path, final Map para) throws Exception { + + // 没有办法处理这个 isLocal 判断,因为一个是修改参数传递结果,一个是返回值做结果 + // todo 后续想想办法 + if (WorkContext.getCurrent().isLocal()) { + WorkContext.getCurrent().get(TemplateExportOperator.class) + .export(exportScopeName(), exportType(), outputStream, path, para); + } else { + byte[] contents = + WorkContext.getCurrent().get(TemplateExportOperator.class) + .export(exportScopeName(), exportType(), null, path, para); + + outputStream.write(contents); + } + } + + /* + * 这边判断是否有层式报表,有层式需要使用大数据量导出 + */ + 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() { + return "FINE_BOOK"; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java index 54f8ef3570..0792e3a3e8 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java @@ -5,47 +5,35 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.file.filter.ChooseFileFilter; - -import com.fr.io.exporter.CSVExporter; -import com.fr.io.exporter.Exporter; -import com.fr.io.exporter.LargeDataPageCSVExporter; +import com.fr.io.exporter.DesignExportType; import com.fr.main.TemplateWorkBook; /** * Export CSV. */ -public class CSVExportAction extends AbstractExportAction { +public class CSVExportAction extends AbstractJWorkBookExportAction { /** * Constructor */ - public CSVExportAction(JWorkBook jwb) { - super(jwb); + public CSVExportAction(JWorkBook jwb) { + super(jwb); this.setMenuKeySet(KeySetUtils.CSV_EXPORT); - this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/csv.png")); } - - @Override - protected Exporter getExporter() { - TemplateWorkBook tpl = this.getTemplateWorkBook(); - if (hasLayerReport(tpl)) { - return new LargeDataPageCSVExporter(); - } else { - return new CSVExporter(); - } - } @Override - protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(FileExtension.CSV, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_CSV")); + protected ChooseFileFilter getChooseFileFilter() { + return new ChooseFileFilter(FileExtension.CSV, Toolkit.i18nText("Fine-Design_Report_Export_CSV")); } @Override - protected String getDefaultExtension() { + protected String getDefaultExtension() { TemplateWorkBook tpl = this.getTemplateWorkBook(); if (hasLayerReport(tpl)) { return FileExtension.ZIP.getExtension(); @@ -53,4 +41,9 @@ public class CSVExportAction extends AbstractExportAction { return FileExtension.CSV.getExtension(); } } + + @Override + public DesignExportType exportType() { + return DesignExportType.CSV; + } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java index b11024bf8e..a5b97b9e63 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java @@ -2,19 +2,18 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.file.filter.ChooseFileFilter; - -import com.fr.io.exporter.EmbeddedTableDataExporter; -import com.fr.io.exporter.Exporter; +import com.fr.io.exporter.DesignExportType; import java.util.EnumSet; /** * Export Embedded. */ -public class EmbeddedExportExportAction extends AbstractExportAction { +public class EmbeddedExportExportAction extends AbstractJWorkBookExportAction { /** * Constructor */ @@ -26,15 +25,10 @@ public class EmbeddedExportExportAction extends AbstractExportAction { this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/oem/logo.png")); } - @Override - protected Exporter getExporter() { - return new EmbeddedTableDataExporter(); - } - @Override protected ChooseFileFilter getChooseFileFilter() { return new ChooseFileFilter(EnumSet.of(FileExtension.CPTX, FileExtension.CPT), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Template(Embedded_Data)")); + Toolkit.i18nText("Fine-Design_Report_Export_Template(Embedded_Data)")); } @Override @@ -42,4 +36,8 @@ public class EmbeddedExportExportAction extends AbstractExportAction { return getEditingComponent().suffix().substring(1); } + @Override + public DesignExportType exportType() { + return DesignExportType.EMBEDDED_WORKBOOK; + } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/ExcelExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/ExcelExportAction.java index 42684c11ce..171a68ce8d 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/ExcelExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/ExcelExportAction.java @@ -3,31 +3,22 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; -import com.fr.io.exporter.ExcelExporter; -import com.fr.io.exporter.Exporter; -import com.fr.io.exporter.LargeDataPageExcelExporter; -import com.fr.main.TemplateWorkBook; -import com.fr.report.core.ReportUtils; +import com.fr.io.exporter.DesignExportType; public class ExcelExportAction extends AbstractExcelExportAction { /** * Constructor */ - public ExcelExportAction(JWorkBook jwb) { - super(jwb); + public ExcelExportAction(JWorkBook jwb) { + super(jwb); this.setMenuKeySet(KeySetUtils.SIMPLE_EXCEL_EXPORT); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png")); } - + @Override - protected Exporter getExporter() { - TemplateWorkBook tpl = this.getTemplateWorkBook(); - if (hasLayerReport(tpl)) { - return new LargeDataPageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl), false); - } else { - return new ExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl)); - } + public DesignExportType exportType() { + return DesignExportType.EXCEL; } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/PDFExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/PDFExportAction.java index 6255d1af62..e98e383d23 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/PDFExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/PDFExportAction.java @@ -5,42 +5,39 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.file.filter.ChooseFileFilter; - -import com.fr.io.exporter.Exporter; -import com.fr.web.core.reserve.PDFExporterFactory; +import com.fr.io.exporter.DesignExportType; /** * Export pdf */ -public class PDFExportAction extends AbstractExportAction { +public class PDFExportAction extends AbstractJWorkBookExportAction { /** * Constructor */ - public PDFExportAction(JWorkBook jwb) { - super(jwb); + public PDFExportAction(JWorkBook jwb) { + super(jwb); this.setMenuKeySet(KeySetUtils.PDF_EXPORT); - this.setName(getMenuKeySet().getMenuKeySetName()+"..."); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/pdf.png")); } @Override - protected Exporter getExporter() { - - return PDFExporterFactory.getPDFExporter(); + protected ChooseFileFilter getChooseFileFilter() { + return new ChooseFileFilter(FileExtension.PDF, Toolkit.i18nText("Fine-Design_Report_Export_PDF")); } @Override - protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(FileExtension.PDF, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_PDF")); + protected String getDefaultExtension() { + return FileExtension.PDF.getExtension(); } @Override - protected String getDefaultExtension() { - return FileExtension.PDF.getExtension(); + public DesignExportType exportType() { + return DesignExportType.PDF; } - } diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/PageExcelExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/PageExcelExportAction.java index ae5d814d87..3f69e3ecc0 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/PageExcelExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/PageExcelExportAction.java @@ -3,29 +3,20 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; -import com.fr.io.exporter.Exporter; -import com.fr.io.exporter.LargeDataPageExcelExporter; -import com.fr.io.exporter.PageExcelExporter; -import com.fr.main.TemplateWorkBook; -import com.fr.report.core.ReportUtils; +import com.fr.io.exporter.DesignExportType; public class PageExcelExportAction extends AbstractExcelExportAction { - public PageExcelExportAction(JWorkBook jwb) { - super(jwb); + public PageExcelExportAction(JWorkBook jwb) { + super(jwb); this.setMenuKeySet(KeySetUtils.PAGE_EXCEL_EXPORT); - this.setName(getMenuKeySet().getMenuKeySetName()+"..."); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png")); } @Override - protected Exporter getExporter() { - TemplateWorkBook tpl = this.getTemplateWorkBook(); - if (hasLayerReport(tpl)) { - return new LargeDataPageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl), true); - } else { - return new PageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl)); - } + public DesignExportType exportType() { + return DesignExportType.PAGE_EXCEL; } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/PageToSheetExcelExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/PageToSheetExcelExportAction.java index 934c39bb7b..087093004b 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/PageToSheetExcelExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/PageToSheetExcelExportAction.java @@ -2,14 +2,11 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.file.filter.ChooseFileFilter; - -import com.fr.io.exporter.Exporter; -import com.fr.io.exporter.PageToSheetExcelExporter; -import com.fr.main.TemplateWorkBook; -import com.fr.report.core.ReportUtils; +import com.fr.io.exporter.DesignExportType; public class PageToSheetExcelExportAction extends AbstractExcelExportAction { @@ -22,19 +19,19 @@ public class PageToSheetExcelExportAction extends AbstractExcelExportAction { this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png")); } - @Override - protected Exporter getExporter() { - TemplateWorkBook tpl = this.getTemplateWorkBook(); - return new PageToSheetExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl)); - } @Override protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(FileExtension.XLS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Excel")); + return new ChooseFileFilter(FileExtension.XLS, Toolkit.i18nText("Fine-Design_Report_Export_Excel")); } @Override protected String getDefaultExtension() { return FileExtension.XLS.getExtension(); } + + @Override + public DesignExportType exportType() { + return DesignExportType.PAGE_TO_SHEET_EXCEL; + } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/SVGExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/SVGExportAction.java index 027158bd09..198b9cb4ec 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/SVGExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/SVGExportAction.java @@ -5,17 +5,16 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.file.filter.ChooseFileFilter; - -import com.fr.io.exporter.Exporter; -import com.fr.io.exporter.SVGExporter; +import com.fr.io.exporter.DesignExportType; /** * Export SVG */ -public class SVGExportAction extends AbstractExportAction { +public class SVGExportAction extends AbstractJWorkBookExportAction { /** * Constructor */ @@ -28,18 +27,18 @@ public class SVGExportAction extends AbstractExportAction { this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/svg.png")); } - @Override - protected Exporter getExporter() { - return new SVGExporter(); - } - @Override protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(FileExtension.SVG, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_SVG")); + return new ChooseFileFilter(FileExtension.SVG, Toolkit.i18nText("Fine-Design_Report_Export_SVG")); } @Override protected String getDefaultExtension() { return FileExtension.SVG.getExtension(); } + + @Override + public DesignExportType exportType() { + return DesignExportType.SVG; + } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/TextExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/TextExportAction.java index 1028d55d9b..454435f273 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/TextExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/TextExportAction.java @@ -5,20 +5,17 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.file.filter.ChooseFileFilter; - -import com.fr.io.exporter.Exporter; -import com.fr.io.exporter.TextExporter; +import com.fr.io.exporter.DesignExportType; /** * Export Text. */ -public class TextExportAction extends AbstractExportAction { - /** - * Constructor - */ +public class TextExportAction extends AbstractJWorkBookExportAction { + public TextExportAction(JWorkBook jwb) { super(jwb); this.setMenuKeySet(KeySetUtils.TEXT_EXPORT); @@ -28,13 +25,13 @@ public class TextExportAction extends AbstractExportAction { } @Override - protected Exporter getExporter() { - return new TextExporter(); + public DesignExportType exportType() { + return DesignExportType.TEXT; } @Override protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(FileExtension.TXT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Text")); + return new ChooseFileFilter(FileExtension.TXT, Toolkit.i18nText("Fine-Design_Report_Export_Text")); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/WordExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/WordExportAction.java index 803a680c52..cc042b9e41 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/WordExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/WordExportAction.java @@ -5,17 +5,16 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.file.filter.ChooseFileFilter; - -import com.fr.io.exporter.Exporter; -import com.fr.io.exporter.WordExporter; +import com.fr.io.exporter.DesignExportType; /** * Export excel. */ -public class WordExportAction extends AbstractExportAction { +public class WordExportAction extends AbstractJWorkBookExportAction { /** * Constructor */ @@ -28,13 +27,13 @@ public class WordExportAction extends AbstractExportAction { } @Override - protected Exporter getExporter() { - return new WordExporter(); + public DesignExportType exportType() { + return DesignExportType.WORD; } @Override protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(FileExtension.DOC, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Export_Word")); + return new ChooseFileFilter(FileExtension.DOC, Toolkit.i18nText("Fine-Design_Report_Export_Word")); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index e8f5bc5f72..88b88282bc 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -635,8 +635,8 @@ public class JWorkBook extends JTemplate { @Override public ShortCut[] shortcut4FileMenu() { boolean showWorkBookExportMenu = DesignerMode.isVcsMode() - || DesignerMode.isAuthorityEditing() - || !WorkContext.getCurrent().isLocal(); + || DesignerMode.isAuthorityEditing(); +// || !WorkContext.getCurrent().isLocal(); return (ShortCut[]) ArrayUtils.addAll(super.shortcut4FileMenu(), showWorkBookExportMenu ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()} ); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java index 72fa9aba6f..81a02fbafe 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java @@ -14,7 +14,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DecodeDialog; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.exception.PermissionDeniedException; +import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.exception.TplLockedException; import com.fr.file.FILE; import com.fr.log.FineLoggerFactory; @@ -58,7 +58,7 @@ class CptApp extends AbstractWorkBookApp { namestyle.clear(); try { tpl.readStream(file.asInputStream()); - } catch (PermissionDeniedException exp) { + } catch (RemoteDesignPermissionDeniedException 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); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptxApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/CptxApp.java index 9350100498..7e879f4034 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptxApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/CptxApp.java @@ -4,7 +4,7 @@ import com.fr.base.extension.FileExtension; import com.fr.base.frpx.exception.FRPackageRunTimeException; import com.fr.base.frpx.exception.InvalidWorkBookException; import com.fr.design.i18n.Toolkit; -import com.fr.exception.PermissionDeniedException; +import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.exception.TplLockedException; import com.fr.file.FILE; import com.fr.log.FineLoggerFactory; @@ -38,7 +38,7 @@ class CptxApp extends AbstractWorkBookApp { FineLoggerFactory.getLogger().error("cost: " + (System.currentTimeMillis() - time) + " ms"); - } catch (PermissionDeniedException exp) { + } catch (RemoteDesignPermissionDeniedException 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); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java index f0b93cdf2c..6dd704488d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java @@ -7,7 +7,7 @@ import com.fr.design.mainframe.AbstractAppProvider; import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.DecodeDialog; import com.fr.design.mainframe.JTemplate; -import com.fr.exception.PermissionDeniedException; +import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.exception.TplLockedException; import com.fr.file.FILE; import com.fr.form.main.Form; @@ -57,7 +57,7 @@ class FormApp extends AbstractAppProvider { FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("file.getName()", file.getName()) + "..."); try { tpl.readStream(file.asInputStream()); - } catch (PermissionDeniedException exp) { + } catch (RemoteDesignPermissionDeniedException 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); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java index 0118a8dac0..3741f8b35d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java @@ -2,7 +2,7 @@ package com.fr.design.mainframe.app; import com.fr.base.extension.FileExtension; import com.fr.design.i18n.Toolkit; -import com.fr.exception.PermissionDeniedException; +import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.exception.TplLockedException; import com.fr.file.FILE; import com.fr.io.importer.ExcelReportImporter; @@ -26,7 +26,7 @@ class XlsApp extends AbstractWorkBookApp { WorkBook workbook = null; try { workbook = new ExcelReportImporter().generateWorkBookByStream(tplFile.asInputStream()); - } catch (PermissionDeniedException exp) { + } catch (RemoteDesignPermissionDeniedException 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); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java index fe3f11e508..9d66cffb8f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java @@ -2,7 +2,7 @@ package com.fr.design.mainframe.app; import com.fr.base.extension.FileExtension; import com.fr.design.i18n.Toolkit; -import com.fr.exception.PermissionDeniedException; +import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.exception.TplLockedException; import com.fr.file.FILE; import com.fr.io.importer.Excel2007ReportImporter; @@ -27,7 +27,7 @@ class XlsxApp extends AbstractWorkBookApp { try { workbook = new Excel2007ReportImporter().generateWorkBookByStream(tplFile.asInputStream()); - } catch (PermissionDeniedException exp) { + } catch (RemoteDesignPermissionDeniedException 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); diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 80edec701d..a674e1d50b 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -42,7 +42,7 @@ import com.fr.design.mainframe.InformationCollector; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetToolBarPane; -import com.fr.design.mainframe.actions.NewFormAction; +import com.fr.design.actions.NewFormAction; import com.fr.design.mainframe.bbs.BBSGuestPane; import com.fr.design.mainframe.bbs.UserInfoPane; import com.fr.design.mainframe.form.FormECCompositeProvider; From a4b73b80aeb47b248977f23dc8812aff22bc0678 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Fri, 16 Nov 2018 20:32:31 +0800 Subject: [PATCH 03/44] fix --- .../EmbeddedFormExportExportAction.java | 6 +-- .../export/AbstractExcelExportAction.java | 39 +++++++++---------- .../export/AbstractJWorkBookExportAction.java | 33 ++-------------- .../actions/file/export/CSVExportAction.java | 3 +- 4 files changed, 26 insertions(+), 55 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java index 758baeab6b..ba0d3e2107 100644 --- a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java @@ -127,7 +127,7 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction @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 parameterMap) { @@ -138,9 +138,7 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction @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); diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java index c4718c06f8..38afcb545d 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java +++ b/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"; + } } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java index e051edb4c8..ae4acc9cea 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java +++ b/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() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java index 0792e3a3e8..8ecced355c 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java +++ b/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(); From f38df1c8b616588887ff9d29d1f288a2addde015 Mon Sep 17 00:00:00 2001 From: qinghuiliu Date: Sun, 18 Nov 2018 12:55:25 +0800 Subject: [PATCH 04/44] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=89=80=E6=9C=89?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=9A=84=E5=9D=90=E6=A0=87=E8=BD=B4=E5=88=BB?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/style/axis/ChartValuePane.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java index 32e6564799..82b5dd3266 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.chart.gui.style.axis; import com.fr.base.BaseFormula; import com.fr.base.Utils; +import com.fr.chart.base.AxisUnitType; import com.fr.chart.base.ChartBaseUtils; import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Axis; @@ -257,10 +258,10 @@ public class ChartValuePane extends ChartAxisUsePane{ axisLineStylePane.update(axis); axis.setAxisReversed(this.axisReversed.isSelected()); String unitValue = Utils.objectToString(unitCombox.getSelectedItem()); - if(ComparatorUtils.equals(unitValue, ChartConstants.UNIT_I18N_VALUES[0])) { + if(ComparatorUtils.equals(unitValue, AxisUnitType.UNIT_NONE.toLocaleString())) { unitValue = null; } - numberAxis.setShowUnit(ChartConstants.getUnitValueFromKey(unitValue)); + numberAxis.setShowUnit(AxisUnitType.parse(unitValue)); if(numberAxis.isSurpportAxisTitle()) { updateAxisTitle(numberAxis); } @@ -378,11 +379,13 @@ public class ChartValuePane extends ChartAxisUsePane{ axisLineStylePane.populate(axis); axisReversed.setSelected(axis.hasAxisReversed()); - String unitKey = numberAxis.getShowUnit(); - if(StringUtils.isBlank(unitKey)) { - unitKey = ChartConstants.UNIT_I18N_KEYS[0]; + String unitKey; + if(numberAxis.getShowUnit() != null) { + unitKey = numberAxis.getShowUnit().getStringType(); + }else{ + unitKey = AxisUnitType.UNIT_NONE.getStringType(); } - unitCombox.setSelectedItem(ChartConstants.getUnitKey2Value(unitKey)); + unitCombox.setSelectedItem(AxisUnitType.parse(unitKey).toLocaleString()); if(numberAxis.isSurpportAxisTitle()) { populateAxisTitle(axis); From 081d76d68dbc676c180858426c0b71a3d602e0d3 Mon Sep 17 00:00:00 2001 From: qinghuiliu Date: Sun, 18 Nov 2018 13:30:30 +0800 Subject: [PATCH 05/44] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/chart/gui/style/axis/ChartValuePane.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java index 82b5dd3266..02080857d0 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java @@ -4,7 +4,6 @@ import com.fr.base.BaseFormula; import com.fr.base.Utils; import com.fr.chart.base.AxisUnitType; import com.fr.chart.base.ChartBaseUtils; -import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.NumberAxis; @@ -79,7 +78,7 @@ public class ChartValuePane extends ChartAxisUsePane{ axisLineStylePane = new ChartAxisLineStylePane(); zeroPane = aliagnZero4Second(); axisReversed = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_AxisReversed")); - unitCombox = new UIComboBox(ChartConstants.UNIT_I18N_VALUES); + unitCombox = new UIComboBox(AxisUnitType.UNIT_I18N_VALUES); formatPane = new FormatPaneWithOutFont(); axisLabelPane = new ChartAxisLabelPane(); dataPane = createDataDefinePane(); From d6670650e54cbee6e6b2b3f523d20340b506037f Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Sun, 18 Nov 2018 20:02:21 +0800 Subject: [PATCH 06/44] CHART-3206 & CHART-3374 9to10 --- .../java/com/fr/design/style/color/ColorSelectDetailPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java b/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java index 73dfe5ca92..758c673fa6 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java @@ -95,7 +95,7 @@ public class ColorSelectDetailPane extends BasicPane { public void stateChanged(ChangeEvent e) { ColorSelectionModel model = (ColorSelectionModel) e.getSource(); colorChooserPreview.setMyColor(model.getSelectedColor()); - colorChooserPreview.paint(colorChooserPreview.getGraphics()); + colorChooserPreview.repaint(); } }); previewPanel.add(colorChooserPreview); From 8058d1142a429f593a8fd803b02c3ecc4983db7f Mon Sep 17 00:00:00 2001 From: qinghuiliu Date: Mon, 19 Nov 2018 09:52:20 +0800 Subject: [PATCH 07/44] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E6=95=B0=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/chart/gui/style/axis/ChartValuePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java index 02080857d0..8f55156df7 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java @@ -78,7 +78,7 @@ public class ChartValuePane extends ChartAxisUsePane{ axisLineStylePane = new ChartAxisLineStylePane(); zeroPane = aliagnZero4Second(); axisReversed = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_AxisReversed")); - unitCombox = new UIComboBox(AxisUnitType.UNIT_I18N_VALUES); + unitCombox = new UIComboBox(AxisUnitType.getUNIT_I18N_VALUES()); formatPane = new FormatPaneWithOutFont(); axisLabelPane = new ChartAxisLabelPane(); dataPane = createDataDefinePane(); From 2dba45028720e3ad57fc42b9e4900370134cd45a Mon Sep 17 00:00:00 2001 From: qinghuiliu Date: Mon, 19 Nov 2018 10:12:51 +0800 Subject: [PATCH 08/44] =?UTF-8?q?=E6=94=B9=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/chart/gui/style/axis/ChartValuePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java index 8f55156df7..35b57d09d7 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java @@ -78,7 +78,7 @@ public class ChartValuePane extends ChartAxisUsePane{ axisLineStylePane = new ChartAxisLineStylePane(); zeroPane = aliagnZero4Second(); axisReversed = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_AxisReversed")); - unitCombox = new UIComboBox(AxisUnitType.getUNIT_I18N_VALUES()); + unitCombox = new UIComboBox(AxisUnitType.getI18NValues()); formatPane = new FormatPaneWithOutFont(); axisLabelPane = new ChartAxisLabelPane(); dataPane = createDataDefinePane(); From 89f1c7b2f9157b273e64aba82b5f0c7872ec84b4 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 19 Nov 2018 10:37:45 +0800 Subject: [PATCH 09/44] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=92=8C=E4=BF=9D=E5=AD=98=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 | 192 ++++++++++++++++++ .../EmbeddedFormExportExportAction.java | 128 +----------- .../export/AbstractJWorkBookExportAction.java | 131 +----------- 3 files changed, 210 insertions(+), 241 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java index 3423536c5a..f47818687c 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -1,20 +1,212 @@ package com.fr.design.actions.file.export; +import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.JTemplateAction; +import com.fr.design.gui.iprogressbar.FRProgressBar; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; +import com.fr.file.FILE; +import com.fr.file.FILEChooserPane; import com.fr.file.filter.ChooseFileFilter; import com.fr.io.exporter.DesignExportType; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.ProductConstants; +import com.fr.stable.StringUtils; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.exporter.TemplateExportOperator; + +import javax.swing.JOptionPane; +import javax.swing.SwingWorker; +import javax.swing.UIManager; +import java.awt.event.ActionEvent; +import java.io.OutputStream; +import java.util.Map; public abstract class AbstractExportAction> extends JTemplateAction { + private FRProgressBar progressbar; + public AbstractExportAction(E t) { super(t); } + /** + * 导出接口名 + * + * @return String scopeName + */ public abstract String exportScopeName(); + /** + * 导出类型 + * + * @return DesignExportType tyoe + */ public abstract DesignExportType exportType(); + /** + * 目标文件过滤器 + * + * @return ChooseFileFilter filter + */ protected abstract ChooseFileFilter getChooseFileFilter(); + /** + * 目标文件扩展名 + * + * @return String extensionName + */ + protected abstract String getDefaultExtension(); + + /** + * 处理参数 + * + * @return Map para + */ + protected abstract Map processParameter(); + + + /** + * 执行方法 + */ + @Override + public void actionPerformed(ActionEvent e) { + + if (!processNotSaved()) { + return; + } + + Map para = processParameter(); + + // 选择输入的文件 + FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true); + fileChooserPane.addChooseFILEFilter(this.getChooseFileFilter()); + + + String fileName = getTargetFileName(); + fileChooserPane.setFileNameTextField(fileName, "." + this.getDefaultExtension()); + int saveValue = fileChooserPane.showSaveDialog(DesignerContext.getDesignerFrame(), "." + this.getDefaultExtension()); + if (saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION) { + FILE target = fileChooserPane.getSelectedFILE(); + try { + target.mkfile(); + } catch (Exception exp) { + FineLoggerFactory.getLogger().error("Error In Make New File", exp); + } + FineLoggerFactory.getLogger().info("\"" + target.getName() + "\"" + Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); + + + progressbar = new FRProgressBar( + createExportWork(getSource(), target, para), + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Report_Exporting"), + StringUtils.EMPTY, + 0, + 100); + + progressbar.start(); + } + } + + private FILE getSource() { + return this.getEditingComponent().getEditingFILE(); + } + + private String getTargetFileName() { + FILE source = getSource(); + // 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc + String fileName = source.getName(); + if (fileName.indexOf('.') != -1) { + fileName = fileName.substring(0, fileName.lastIndexOf('.')); + } + return fileName; + } + + private boolean processNotSaved() { + //当前编辑的模板 + E e = getEditingComponent(); + if (!e.isALLSaved() && !DesignerMode.isVcsMode()) { + e.stopEditing(); + int returnVal = JOptionPane.showConfirmDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + e.getEditingFILE() + "\" ?", + ProductConstants.PRODUCT_NAME, + JOptionPane.YES_NO_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE + ); + if (returnVal == JOptionPane.YES_OPTION) { + e.saveTemplate(); + FineLoggerFactory.getLogger().info( + Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", e.getEditingFILE().getName()) + ); + return true; + } else { + return false; + } + } else { + return true; + } + } + + private SwingWorker createExportWork(final FILE source, final FILE target, final Map parameterMap) { + final String path = source.getPath(); + final String name = target.getName(); + + return new SwingWorker() { + + @Override + protected Void doInBackground() throws Exception { + //bug 10516 + Thread.sleep(100); + try (OutputStream outputStream = target.asOutputStream()) { + this.setProgress(10); + dealExporter(outputStream, path, parameterMap); + this.setProgress(80); + outputStream.flush(); + outputStream.close(); + this.setProgress(100); + + FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name); + } catch (Exception exp) { + this.setProgress(100); + target.closeTemplate(); + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + path, + null, + JOptionPane.ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon") + ); + } + return null; + } + + @Override + public void done() { + progressbar.close(); + } + }; + } + + private void dealExporter(OutputStream outputStream, String path, final Map para) throws Exception { + + // 没有办法处理这个 isLocal 判断,因为一个是修改参数传递结果,一个是返回值做结果 + // todo 后续想想办法 + if (WorkContext.getCurrent().isLocal()) { + WorkContext.getCurrent().get(TemplateExportOperator.class) + .export(exportScopeName(), exportType(), outputStream, path, para); + } else { + byte[] contents = + WorkContext.getCurrent().get(TemplateExportOperator.class) + .export(exportScopeName(), exportType(), null, path, para); + + outputStream.write(contents); + } + } + } diff --git a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java index ba0d3e2107..bce7491a79 100644 --- a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java @@ -3,30 +3,17 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.Parameter; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.gui.iprogressbar.FRProgressBar; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.JForm; -import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.KeySetUtils; import com.fr.design.parameter.ParameterInputPane; -import com.fr.file.FILE; -import com.fr.file.FILEChooserPane; import com.fr.file.filter.ChooseFileFilter; import com.fr.form.main.Form; import com.fr.io.exporter.DesignExportType; -import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; -import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.exporter.TemplateExportOperator; -import javax.swing.JOptionPane; -import javax.swing.SwingWorker; -import java.awt.event.ActionEvent; -import java.io.OutputStream; import java.util.HashMap; import java.util.Map; @@ -35,7 +22,6 @@ import java.util.Map; */ public class EmbeddedFormExportExportAction extends AbstractExportAction { - private FRProgressBar progressbar; public EmbeddedFormExportExportAction(JForm jwb) { super(jwb); @@ -50,72 +36,27 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction return "FINE_FORM"; } + @Override + protected String getDefaultExtension() { + return ProjectConstants.FRM_SUFFIX; + } + @Override public DesignExportType exportType() { return DesignExportType.EMBEDDED_FORM; } - /** - * Action触发事件 - * - * @param e 触发事件 - */ @Override - public void actionPerformed(ActionEvent e) { - - // todo 提示保存 - JTemplate jwb = this.getEditingComponent(); - FILE source = jwb.getEditingFILE(); - + protected Map processParameter() { // 输入参数 final Map parameterMap = new HashMap(); - final Form tpl = this.getEditingComponent().getTarget(); - inputParameter(parameterMap, tpl, DesignerContext.getDesignerFrame()); - - FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(false, true); - fileChooserPane.setFILEFilter(this.getChooseFileFilter()); - - String fileName = source.getName(); - fileChooserPane.setFileNameTextField(fileName, ProjectConstants.FRM_SUFFIX); - int saveValue = fileChooserPane.showSaveDialog(DesignerContext.getDesignerFrame(), ProjectConstants.FRM_SUFFIX); - - if (isOk(saveValue)) { - startExport(source, parameterMap, fileChooserPane); - } - } - - private void startExport(FILE source, Map parameterMap, - FILEChooserPane fileChooserPane) { - FILE target = fileChooserPane.getSelectedFILE(); - try { - target.mkfile(); - } catch (Exception e1) { - FineLoggerFactory.getLogger().error("Error In Make New File"); - } - FineLoggerFactory.getLogger().info("\"" + target.getName() + "\"" + Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); - - (progressbar = - new FRProgressBar( - createExportWork(source, target, parameterMap), - DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Report_Exporting"), - StringUtils.EMPTY, - 0, - 100) - ).start(); - } - - private boolean isOk(int saveValue) { - return saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION; - } - + Form tpl = this.getEditingComponent().getTarget(); - private void inputParameter(final Map parameterMap, final Form tpl, DesignerFrame designerFrame) { Parameter[] parameters = tpl.getParameters(); // 检查Parameter. if (ArrayUtils.isNotEmpty(parameters)) { final ParameterInputPane pPane = new ParameterInputPane(parameters); - pPane.showSmallWindow(designerFrame, new DialogActionAdapter() { + pPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override public void doOk() { @@ -123,61 +64,12 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction } }).setVisible(true); } + return parameterMap; } + @Override protected ChooseFileFilter getChooseFileFilter() { return new ChooseFileFilter(new String[]{"frm"}, Toolkit.i18nText("Fine-Design_Form_EmbeddedTD")); } - - private SwingWorker createExportWork(FILE source, final FILE target, final Map parameterMap) { - final String path = source.getPath(); - final String name = target.getName(); - - return new SwingWorker() { - @Override - protected Void doInBackground() throws Exception { - Thread.sleep(100); - try (OutputStream fileOutputStream = target.asOutputStream()) { - this.setProgress(10); - dealExporter(fileOutputStream, path, parameterMap); - this.setProgress(80); - fileOutputStream.flush(); - fileOutputStream.close(); - this.setProgress(100); - - FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name); - } catch (Exception exp) { - this.setProgress(100); - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + path); - } - return null; - } - - @Override - public void done() { - progressbar.close(); - } - }; - } - - private void dealExporter(OutputStream outputStream, String path, final Map para) throws Exception { - - // 没有办法处理这个 isLocal 判断,因为一个是修改参数传递结果,一个是返回值做结果 - // todo 后续想想办法 - if (WorkContext.getCurrent().isLocal()) { - WorkContext.getCurrent().get(TemplateExportOperator.class) - .export(exportScopeName(), exportType(), outputStream, path, para); - } else { - byte[] contents = - WorkContext.getCurrent().get(TemplateExportOperator.class) - .export(exportScopeName(), exportType(), null, path, para); - - outputStream.write(contents); - } - } - } diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java index ae4acc9cea..907b378a75 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java @@ -5,25 +5,12 @@ package com.fr.design.actions.file.export; import com.fr.base.Parameter; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.gui.iprogressbar.FRProgressBar; -import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JWorkBook; import com.fr.design.parameter.ParameterInputPane; -import com.fr.file.FILE; -import com.fr.file.FILEChooserPane; -import com.fr.log.FineLoggerFactory; import com.fr.main.TemplateWorkBook; import com.fr.main.impl.WorkBook; -import com.fr.stable.StringUtils; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.exporter.TemplateExportOperator; -import javax.swing.JOptionPane; -import javax.swing.SwingWorker; -import javax.swing.UIManager; -import java.awt.event.ActionEvent; -import java.io.OutputStream; import java.util.HashMap; import java.util.Map; @@ -32,7 +19,6 @@ import java.util.Map; */ public abstract class AbstractJWorkBookExportAction extends AbstractExportAction { - private FRProgressBar progressbar; protected AbstractJWorkBookExportAction(JWorkBook jwb) { super(jwb); @@ -43,128 +29,27 @@ public abstract class AbstractJWorkBookExportAction extends AbstractExportAction return this.getEditingComponent().getTarget(); } - /** - * 执行方法 - */ - @Override - public void actionPerformed(ActionEvent e) { - - // todo 弹出提醒保存,如果没保存。。。 - - - JWorkBook jwb = this.getEditingComponent(); - FILE source = jwb.getEditingFILE(); + public String exportScopeName() { + return "FINE_BOOK"; + } + @Override + protected Map processParameter() { // 弹出参数 final Map parameterMap = new HashMap<>(); final TemplateWorkBook tpl = getTemplateWorkBook(); Parameter[] parameters = tpl.getParameters(); - if (parameters != null && parameters.length > 0) {// 检查Parameter. + // 检查Parameter + if (parameters != null && parameters.length > 0) { final ParameterInputPane pPane = new ParameterInputPane( parameters); pPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { - @Override public void doOk() { parameterMap.putAll(pPane.update()); } }).setVisible(true); } - - // file choose - FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true); - fileChooserPane.addChooseFILEFilter(this.getChooseFileFilter()); - - // 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc - String fileName = source.getName(); - if (fileName.indexOf('.') != -1) { - fileName = fileName.substring(0, fileName.lastIndexOf('.')); - } - fileChooserPane.setFileNameTextField(fileName, "." + this.getDefaultExtension()); - int saveValue = fileChooserPane.showSaveDialog(DesignerContext.getDesignerFrame(), "." + this.getDefaultExtension()); - if (saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION) { - FILE target = fileChooserPane.getSelectedFILE(); - try { - target.mkfile(); - } catch (Exception exp) { - FineLoggerFactory.getLogger().error("Error In Make New File", exp); - } - FineLoggerFactory.getLogger().info("\"" + target.getName() + "\"" + Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); - - (progressbar = new FRProgressBar( - createExportWork(source, target, parameterMap), - DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Report_Exporting"), - StringUtils.EMPTY, - 0, - 100) - ).start(); - } - } - - private SwingWorker createExportWork(final FILE source, final FILE target, final Map parameterMap) { - final String path = source.getPath(); - final String name = target.getName(); - - return new SwingWorker() { - - @Override - protected Void doInBackground() throws Exception { - //bug 10516 - Thread.sleep(100); - try (OutputStream outputStream = target.asOutputStream()) { - this.setProgress(10); - dealExporter(outputStream, path, parameterMap); - this.setProgress(80); - outputStream.flush(); - outputStream.close(); - this.setProgress(100); - - FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); - JOptionPane.showMessageDialog( - DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name); - } catch (Exception exp) { - this.setProgress(100); - target.closeTemplate(); - FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - JOptionPane.showMessageDialog( - DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + path, - null, - JOptionPane.ERROR_MESSAGE, - UIManager.getIcon("OptionPane.errorIcon") - ); - } - return null; - } - - @Override - public void done() { - progressbar.close(); - } - }; - } - - private void dealExporter(OutputStream outputStream, String path, final Map para) throws Exception { - - // 没有办法处理这个 isLocal 判断,因为一个是修改参数传递结果,一个是返回值做结果 - // todo 后续想想办法 - if (WorkContext.getCurrent().isLocal()) { - WorkContext.getCurrent().get(TemplateExportOperator.class) - .export(exportScopeName(), exportType(), outputStream, path, para); - } else { - byte[] contents = - WorkContext.getCurrent().get(TemplateExportOperator.class) - .export(exportScopeName(), exportType(), null, path, para); - - outputStream.write(contents); - } - } - - protected abstract String getDefaultExtension(); - - public String exportScopeName() { - return "FINE_BOOK"; + return parameterMap; } } From 9b7a4882a9816d613d529dc434b1cf82ac6fdbc1 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 19 Nov 2018 10:39:40 +0800 Subject: [PATCH 10/44] f --- .../actions/file/export/EmbeddedFormExportExportAction.java | 4 +++- .../actions/file/export/AbstractJWorkBookExportAction.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java index bce7491a79..0056710e4c 100644 --- a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java @@ -17,6 +17,8 @@ import com.fr.stable.project.ProjectConstants; import java.util.HashMap; import java.util.Map; +import static com.fr.io.exporter.DesignExportScope.FINE_FORM; + /** * Export Embedded. */ @@ -33,7 +35,7 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction @Override public String exportScopeName() { - return "FINE_FORM"; + return FINE_FORM.toString(); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java index 907b378a75..63362e5d41 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java @@ -14,6 +14,8 @@ import com.fr.main.impl.WorkBook; import java.util.HashMap; import java.util.Map; +import static com.fr.io.exporter.DesignExportScope.FINE_BOOK; + /** * Abstract export action. */ @@ -30,7 +32,7 @@ public abstract class AbstractJWorkBookExportAction extends AbstractExportAction } public String exportScopeName() { - return "FINE_BOOK"; + return FINE_BOOK.toString(); } @Override From c396d3469f57b0bd217847c7cd25ee0050b3e604 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 19 Nov 2018 15:02:39 +0800 Subject: [PATCH 11/44] =?UTF-8?q?REPORT-10535=09=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E9=80=82=E9=85=8D=E5=8A=9F=E8=83=BD=E2=80=94=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AFTAB=E7=BB=84=E4=BB=B6=E5=A4=9A=E6=A0=B7?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/layout/FRGUIPaneFactory.java | 11 + .../ui/DefaultMobileStyleDefinePane.java | 97 ++++++++ .../mobile/ui/DownMenuStyleDefinePane.java | 174 ++++++++++++++ .../design/mainframe/mobile/ui/LinePane.java | 108 +++++++++ .../ui/MobileTemplateStyleDefinePane.java | 219 ++++++++++++++++++ .../mobile/ui/SliderStyleDefinePane.java | 150 ++++++++++++ .../ui/StyleDefinePaneWithSelectConf.java | 113 +++++++++ .../mobile/ui/TabIconConfigPane.java | 172 ++++++++++++++ .../ui/TemplateStyleDefinePaneFactory.java | 55 +++++ .../mobile/ui/UpMenuStyleDefinePane.java | 211 +++++++++++++++++ .../widget/MobileTabFontConfPane.java | 143 ++++++++++++ .../mainframe/widget/UITitleSplitLine.java | 69 ++++++ .../AbstractTemplateStylePane.java | 10 + .../AccessibleTemplateStyleEditor.java | 13 +- .../accessibles/MobileTemplateStylePane.java | 113 +++++++++ .../widget/accessibles/TemplateStylePane.java | 5 +- .../accessibles/TemplateStylePreviewPane.java | 14 +- .../preview/MobileTemplatePreviewPane.java | 53 +++++ .../creator/cardlayout/XWCardTagLayout.java | 6 + .../mobile/TabMobilePropertyUI.java | 30 +++ .../layout/WCardTagLayoutDefinePane.java | 3 +- .../mobile/TabMobileWidgetDefinePane.java | 69 ++++++ 22 files changed, 1818 insertions(+), 20 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/LinePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/widget/MobileTabFontConfPane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/widget/UITitleSplitLine.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java create mode 100644 designer-form/src/main/java/com/fr/design/designer/properties/mobile/TabMobilePropertyUI.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java diff --git a/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java b/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java index db48cf9950..09eaad466b 100644 --- a/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java @@ -251,6 +251,17 @@ public class FRGUIPaneFactory { return jp; } + + /** + * 创建一个靠左流式布局,流式内嵌 + * + * @return JPanel对象 + */ + public static JPanel createBoxFlowInnerContainerPane(int hgap, int vgap) { + JPanel jp = new JPanel(); + jp.setLayout(new FlowLayout(FlowLayout.LEFT, hgap, vgap)); + return jp; + } /** * 创建一个靠左流式布局,流式内嵌,首元素距离左边0 * diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java new file mode 100644 index 0000000000..b42f1a6cee --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -0,0 +1,97 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.base.GraphHelper; +import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane; +import com.fr.form.ui.CardSwitchButton; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.FRFont; +import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; + +import java.awt.BasicStroke; +import java.awt.Dimension; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; + +public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane { + + public DefaultMobileStyleDefinePane(WCardTagLayout tagLayout) { + super(tagLayout); + } + + @Override + public void populateBean(MobileTemplateStyle ob) { + updatePreviewPane(); + } + + protected void createConfigPane() { + + } + + @Override + protected void initDefaultConfig() { + + } + + @Override + public MobileTemplateStyle updateSubStyle() { + return null; + } + + @Override + public MobileTemplateStyle updateBean() { + return new DefaultMobileTemplateStyle(); + } + + @Override + protected MobileTemplateStyle getDefaultTemplateStyle() { + return new DefaultMobileTemplateStyle(); + } + + @Override + protected String title4PopupWindow() { + return null; + } + + protected MobileTemplatePreviewPane createPreviewPane() { + return new DefaultStylePreviewPane(); + } + + public class DefaultStylePreviewPane extends MobileTemplatePreviewPane { + + public DefaultStylePreviewPane() { + this.setBackground(DefaultMobileTemplateStyle.DEFAULT_INITIAL_COLOR); + } + + public void repaint() { + super.repaint(); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + Dimension dimension = this.getSize(); + int panelWidth = dimension.width; + int panelHeight = dimension.height; + Graphics2D g2d = (Graphics2D) g.create(); + FRFont frFont = DefaultMobileTemplateStyle.DEFAULT_TAB_FONT.getFont(); + FontMetrics fm = GraphHelper.getFontMetrics(frFont); + WCardTagLayout cardTagLayout = DefaultMobileStyleDefinePane.this.getTagLayout(); + int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); + g2d.setFont(frFont); + for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { + CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); + String widgetName = cardSwitchButton.getText(); + int width = fm.stringWidth(widgetName); + g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight) / 2); + if (i == 0) { + g2d.setStroke(new BasicStroke(2.0f)); + g2d.drawLine(0, panelHeight - 1, eachWidth, panelHeight - 1); + } + g2d.translate(eachWidth, 0); + } + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java new file mode 100644 index 0000000000..b8f267e98c --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java @@ -0,0 +1,174 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.base.GraphHelper; +import com.fr.base.IconManager; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.widget.UITitleSplitLine; +import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane; +import com.fr.form.ui.CardSwitchButton; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.FRFont; +import com.fr.general.cardtag.mobile.DownMenuStyle; +import com.fr.general.cardtag.mobile.LineDescription; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; + +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.util.ArrayList; + +public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { + private LinePane splitLinePane; + private TabIconConfigPane initIconConfigPane; + private TabIconConfigPane selectIconConfigPane; + + public DownMenuStyleDefinePane(WCardTagLayout tagLayout) { + super(tagLayout); + } + + protected void createExtraConfPane(JPanel centerPane) { + UITitleSplitLine iconSplitLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon"), 520); + iconSplitLine.setPreferredSize(new Dimension(520, 20)); + centerPane.add(iconSplitLine); + + initIconConfigPane = new TabIconConfigPane(getTagLayout().getWidgetCount()); + selectIconConfigPane = new TabIconConfigPane(getTagLayout().getWidgetCount()); + + UILabel initIconLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Initial_Icon")); + UILabel selectIconLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Select_Icon")); + initIconLabel.setPreferredSize(new Dimension(55, 20)); + selectIconLabel.setPreferredSize(new Dimension(55, 20)); + JPanel initIconContainPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initIconLabel, initIconConfigPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + JPanel selectIconContainePane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectIconLabel, selectIconConfigPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + initIconContainPane.setPreferredSize(new Dimension(240, 50)); + selectIconContainePane.setPreferredSize(new Dimension(240, 50)); + centerPane.add(initIconContainPane); + centerPane.add(selectIconContainePane); + UITitleSplitLine splitLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Spit_Line"), 520); + splitLine.setPreferredSize(new Dimension(520, 20)); + splitLinePane = new LinePane(); + splitLinePane.addLineChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + centerPane.add(splitLine); + centerPane.add(splitLinePane); + } + + @Override + protected void initDefaultConfig() { + this.initialColorBox.setSelectObject(DownMenuStyle.DEFAULT_INITIAL_COLOR); + this.fontConfPane.populate(DownMenuStyle.DEFAULT_TAB_FONT.getFont()); + this.selectColorBox.setSelectObject(DownMenuStyle.DEFAULT_SELECT_COLOR); + this.selectFontColor.setColor(DownMenuStyle.DEFAULT_SELECT_FONT_COLOR); + this.splitLinePane.populate(DownMenuStyle.DEFAULT_SPLIT_LINE); + } + + @Override + protected MobileTemplatePreviewPane createPreviewPane() { + return new DownMenuStylePreviewPane(); + } + + + @Override + public void populateBean(MobileTemplateStyle ob) { + super.populateBean(ob); + DownMenuStyle downMenuStyle = (DownMenuStyle) ob; + splitLinePane.populate(downMenuStyle.getSplitLine()); + ArrayList initialIconNames = new ArrayList(); + ArrayList selectIconNames = new ArrayList(); + for (int i = 0; i < getTagLayout().getWidgetCount(); i++) { + CardSwitchButton cardSwitchButton = (CardSwitchButton) getTagLayout().getWidget(i); + initialIconNames.add(cardSwitchButton.getInitIconName()); + selectIconNames.add(cardSwitchButton.getSelectIconName()); + } + initIconConfigPane.populate(initialIconNames); + selectIconConfigPane.populate(selectIconNames); + } + + @Override + protected MobileTemplateStyle getDefaultTemplateStyle() { + return new DownMenuStyle(); + } + + @Override + public MobileTemplateStyle updateStyleWithSelectConf() { + DownMenuStyle downMenuStyle = new DownMenuStyle(); + downMenuStyle.setSplitLine(splitLinePane.update()); + ArrayList initialIconNames = initIconConfigPane.update(); + ArrayList selectIconNames = selectIconConfigPane.update(); + for (int i = 0; i < getTagLayout().getWidgetCount(); i++) { + CardSwitchButton cardSwitchButton = (CardSwitchButton) getTagLayout().getWidget(i); + cardSwitchButton.setInitIconName(initialIconNames.get(i)); + cardSwitchButton.setSelectIconName(selectIconNames.get(i)); + } + return downMenuStyle; + } + + @Override + protected String title4PopupWindow() { + return null; + } + + public class DownMenuStylePreviewPane extends MobileTemplatePreviewPane { + private LineDescription splitLine; + private static final String PAINT_ICON = "fund_white"; + + public DownMenuStylePreviewPane() { + this.setBackground(Color.decode("#3888EE")); + } + + public void repaint() { + super.repaint(); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + Color selectFontColor = this.getTabFontConfig().getSelectColor(); + Dimension dimension = this.getSize(); + int panelWidth = dimension.width; + int panelHeight = dimension.height; + Graphics2D g2d = (Graphics2D) g.create(); + FRFont frFont = this.getTabFontConfig().getFont(); + FontMetrics fm = GraphHelper.getFontMetrics(frFont); + WCardTagLayout cardTagLayout = DownMenuStyleDefinePane.this.getTagLayout(); + int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); + for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { + g2d.setFont(frFont); + g2d.setColor(i == 0 ? selectFontColor : frFont.getForeground()); + CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); + String widgetName = cardSwitchButton.getText(); + int width = fm.stringWidth(widgetName); + String iconName = PAINT_ICON; + g2d.drawImage(IconManager.getIconManager().getIconImage(iconName), (eachWidth - 18) / 2, 6, null); + g2d.drawString(widgetName, (eachWidth - width) / 2, panelHeight / 2 + 9); + if (splitLine.getLineStyle() != 0) { + g2d.setColor(splitLine.getColor()); + + g2d.drawLine(eachWidth, 0, eachWidth, panelHeight); + } + + g2d.translate(eachWidth, 0); + + } + + } + + public void populateConfig(MobileTemplateStyle templateStyle) { + super.populateConfig(templateStyle); + this.splitLine = ((DownMenuStyle) templateStyle).getSplitLine(); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/LinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/LinePane.java new file mode 100644 index 0000000000..fabc7ca5bf --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/LinePane.java @@ -0,0 +1,108 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.gui.icombobox.LineComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.layout.VerticalFlowLayout; +import com.fr.design.style.color.NewColorSelectBox; +import com.fr.general.cardtag.mobile.LineDescription; +import com.fr.stable.CoreConstants; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.EventListenerList; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +public class LinePane extends JPanel { + private LineComboBox lineStyle; + private NewColorSelectBox lineColor; + private EventListenerList lineChangeListener = new EventListenerList(); + + public LinePane() { + init(); + } + + private void init() { + this.setLayout(new VerticalFlowLayout(FlowLayout.CENTER, 0, 10)); + this.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20)); + UILabel lineLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Line_Style")); + UILabel colorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Colors")); + lineLabel.setPreferredSize(new Dimension(55, 20)); + colorLabel.setPreferredSize(new Dimension(55, 20)); + + lineStyle = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); + lineStyle.setPreferredSize(new Dimension(152, 20)); + lineColor = new NewColorSelectBox(137); + lineStyle.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + fireLineStateChanged(); + } + }); + lineColor.addSelectChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + fireLineStateChanged(); + } + }); + this.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{lineLabel, lineStyle}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM)); + this.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{colorLabel, lineColor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM)); + } + + public LineDescription update() { + LineDescription lineDescription = new LineDescription(); + lineDescription.setColor(lineColor.getSelectObject()); + lineDescription.setLineStyle(lineStyle.getSelectedLineStyle()); + return lineDescription; + } + + public void populate(LineDescription lineDescription) { + lineStyle.setSelectedLineStyle(lineDescription.getLineStyle()); + lineColor.setSelectObject(lineDescription.getColor()); + } + + + /** + * 添加监听 + * + * @param changeListener 监听列表 + */ + public void addLineChangeListener(ChangeListener changeListener) { + lineChangeListener.add(ChangeListener.class, changeListener); + } + + /** + * 移除监听 + * Removes an old ColorChangeListener. + * + * @param changeListener 监听列表 + */ + public void removeLineChangeListener(ChangeListener changeListener) { + lineChangeListener.remove(ChangeListener.class, changeListener); + } + + /** + * 颜色状态改变 + */ + public void fireLineStateChanged() { + Object[] listeners = lineChangeListener.getListenerList(); + ChangeEvent e = null; + + for (int i = listeners.length - 2; i >= 0; i -= 2) { + if (listeners[i] == ChangeListener.class) { + if (e == null) { + e = new ChangeEvent(this); + } + ((ChangeListener) listeners[i + 1]).stateChanged(e); + } + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java new file mode 100644 index 0000000000..a1d487ab7f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java @@ -0,0 +1,219 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.dialog.AttrScrollPane; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.widget.MobileTabFontConfPane; +import com.fr.design.mainframe.widget.UITitleSplitLine; +import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane; +import com.fr.design.style.color.NewColorSelectBox; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.FRFont; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.general.cardtag.mobile.TabFontConfig; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.border.TitledBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane { + private UIComboBox custom; + protected NewColorSelectBox initialColorBox; + protected MobileTabFontConfPane fontConfPane; + private JPanel centerPane; + protected MobileTemplatePreviewPane previewPane; + private static final String[] TAB_STYLES = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom")}; + private WCardTagLayout tagLayout; + + + public MobileTemplatePreviewPane getPreviewPane() { + return previewPane; + } + + public MobileTemplateStyleDefinePane(WCardTagLayout tagLayout) { + this.tagLayout = tagLayout; + init(); + } + + + public WCardTagLayout getTagLayout() { + return tagLayout; + } + + protected void init() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + previewPane = createPreviewPane(); + previewPane.setPreferredSize(new Dimension(500, 60)); + JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"), null); + titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 9, Color.BLUE)); + northPane.setBorder(titledBorder); + northPane.setPreferredSize(new Dimension(500, 83)); + northPane.add(previewPane, BorderLayout.CENTER); + this.add(northPane, BorderLayout.NORTH); + createConfigPane(); + + } + + protected void createConfigPane() { + JPanel configPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"), null); + titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 9, Color.BLUE)); + configPane.setBorder(titledBorder); + centerPane = createCenterPane(); + custom = new UIComboBox(TAB_STYLES); + custom.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + boolean isCustom = custom.getSelectedIndex() == 1; + centerPane.setVisible(isCustom); + updatePreviewPane(); + } + }); + centerPane.setVisible(false); + custom.setPreferredSize(new Dimension(157, 20)); + final JPanel scrollPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + BasicScrollPane basicScrollPane = new AttrScrollPane() { + @Override + protected JPanel createContentPane() { + return scrollPanel; + } + }; + configPane.add(basicScrollPane, BorderLayout.CENTER); + this.add(configPane, BorderLayout.CENTER); + + JPanel outPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); + outPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 5, 20)); + UILabel tabStyleLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Style")); + tabStyleLabel.setPreferredSize(new Dimension(55, 20)); + JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{tabStyleLabel, custom}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + jPanel.setPreferredSize(new Dimension(200, 20)); + outPanel.add(jPanel); + scrollPanel.add(outPanel, BorderLayout.NORTH); + + UITitleSplitLine backgroundSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), 520); + backgroundSplit.setPreferredSize(new Dimension(520, 20)); + centerPane.add(backgroundSplit); + + centerPane.add(createBackgroundConfPane()); + + UITitleSplitLine fontSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Char"), 520); + fontSplit.setPreferredSize(new Dimension(520, 20)); + centerPane.add(fontSplit); + + centerPane.add(createFontConfPane()); + + createExtraConfPane(centerPane); + + scrollPanel.add(centerPane, BorderLayout.CENTER); + initDefaultConfig(); + } + + protected JPanel createCenterPane() { + JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); + return panel; + } + + protected JPanel createBackgroundConfPane() { + initialColorBox = new NewColorSelectBox(137); + initialColorBox.addSelectChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + UILabel fillLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fill")); + fillLabel.setPreferredSize(new Dimension(55, 20)); + JPanel boxFlowPane = FRGUIPaneFactory.createBoxFlowInnerContainerPane(10, 0); + boxFlowPane.add(fillLabel); + boxFlowPane.add(initialColorBox); + initialColorBox.setPreferredSize(new Dimension(157, 20)); + boxFlowPane.setPreferredSize(new Dimension(500, 20)); + boxFlowPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); + return boxFlowPane; + } + + protected JPanel createFontConfPane() { + fontConfPane = new MobileTabFontConfPane(); + fontConfPane.addFontChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + UILabel initCharLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Init_Char")); + initCharLabel.setPreferredSize(new Dimension(55, 20)); + JPanel jPanel3 = FRGUIPaneFactory.createBoxFlowInnerContainerPane(5, 0); + jPanel3.add(initCharLabel); + jPanel3.add(fontConfPane); + jPanel3.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); + return jPanel3; + } + + + protected void createExtraConfPane(JPanel centerPane) { + + } + + protected abstract void initDefaultConfig(); + + protected abstract MobileTemplatePreviewPane createPreviewPane(); + + @Override + public void populateBean(MobileTemplateStyle ob) { + centerPane.setVisible(ob.isCustom()); + custom.setSelectedItem(ob.isCustom() ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default") : + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom")); + initialColorBox.setSelectObject(ob.getInitialColor()); + fontConfPane.populate(ob.getTabFontConfig().getFont()); + updatePreviewPane(); + } + + + @Override + public MobileTemplateStyle updateBean() { + if (custom.getSelectedIndex() == 0) { + return getDefaultTemplateStyle(); + } + MobileTemplateStyle ob = updateSubStyle(); + ob.setCustom(custom.getSelectedIndex() == 1); + ob.setInitialColor(initialColorBox.getSelectObject()); + TabFontConfig config = ob.getTabFontConfig(); + config.setFont(fontConfPane.update()); + return ob; + } + + protected abstract MobileTemplateStyle getDefaultTemplateStyle(); + + public void updatePreviewPane() { + previewPane.populateConfig(updateBean()); + previewPane.setBackground(previewPane.getInitialColor()); + previewPane.repaint(); + } + + public abstract MobileTemplateStyle updateSubStyle(); + + + @Override + protected String title4PopupWindow() { + return null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java new file mode 100644 index 0000000000..4765edc52f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java @@ -0,0 +1,150 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.widget.UITitleSplitLine; +import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane; +import com.fr.design.style.color.NewColorSelectBox; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.FRFont; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.general.cardtag.mobile.SliderStyle; + +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; + +public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane { + private NewColorSelectBox initDotColor; + private NewColorSelectBox selectDotColor; + + + public SliderStyleDefinePane(WCardTagLayout tagLayout) { + super(tagLayout); + } + + @Override + public void populateBean(MobileTemplateStyle ob) { + super.populateBean(ob); + SliderStyle sliderStyle = (SliderStyle) ob; + initDotColor.setSelectObject(sliderStyle.getInitDotColor()); + selectDotColor.setSelectObject(sliderStyle.getSelectDotColor()); + } + + @Override + protected MobileTemplateStyle getDefaultTemplateStyle() { + return new SliderStyle(); + } + + @Override + public MobileTemplateStyle updateSubStyle() { + SliderStyle sliderStyle = new SliderStyle(); + sliderStyle.setInitDotColor(initDotColor.getSelectObject()); + sliderStyle.setSelectDotColor(selectDotColor.getSelectObject()); + return sliderStyle; + } + + + protected void createExtraConfPane(JPanel centerPane) { + UITitleSplitLine dotIndicator = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Slider_Dot_Indicator"), 520); + dotIndicator.setPreferredSize(new Dimension(520, 20)); + centerPane.add(dotIndicator); + initDotColor = new NewColorSelectBox(137); + initDotColor.addSelectChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + selectDotColor = new NewColorSelectBox(137); + selectDotColor.addSelectChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + UILabel initColor = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Init_Fill")); + + UILabel selectColor = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Select_Fill")); + initColor.setPreferredSize(new Dimension(55, 20)); + selectColor.setPreferredSize(new Dimension(55, 20)); + JPanel initDotColorPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initColor, initDotColor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + JPanel selectDotColorPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectColor, selectDotColor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + initDotColorPane.setPreferredSize(new Dimension(240, 20)); + selectDotColorPane.setPreferredSize(new Dimension(240, 20)); + centerPane.add(initDotColorPane); + centerPane.add(selectDotColorPane); + + } + + @Override + protected void initDefaultConfig() { + this.initialColorBox.setSelectObject(SliderStyle.DEFAULT_INITIAL_COLOR); + this.fontConfPane.populate(SliderStyle.DEFAULT_TAB_FONT.getFont()); + initDotColor.setSelectObject(SliderStyle.DEFAULT_INITIAL_DOT_COLOR); + selectDotColor.setSelectObject(SliderStyle.DEFAULT_SELECT_DOT_COLOR); + } + + @Override + protected MobileTemplatePreviewPane createPreviewPane() { + return new SliderStylePreviewPane(); + } + + + @Override + protected String title4PopupWindow() { + return null; + } + + + public class SliderStylePreviewPane extends MobileTemplatePreviewPane { + private Color initDotColor; + private Color selectDotColor; + + public SliderStylePreviewPane() { + + } + + public void repaint() { + super.repaint(); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + Graphics2D g2d = (Graphics2D) g.create(); + FRFont frFont = this.getTabFontConfig().getFont(); + g2d.setFont(frFont); + g2d.setColor(frFont.getForeground()); + g2d.drawString(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Slider_Title"), 10, 18); + WCardTagLayout cardTagLayout = SliderStyleDefinePane.this.getTagLayout(); + g2d.translate(10, 25); + for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { + if (i == 0) { + g2d.setColor(selectDotColor); + g2d.fillOval(0, 0, 6, 6); + g2d.translate(9, 0); + continue; + } + g2d.setColor(initDotColor); + g2d.fillOval(0, 0, 6, 6); + g2d.translate(9, 0); + } + + } + + public void populateConfig(MobileTemplateStyle templateStyle) { + super.populateConfig(templateStyle); + this.initDotColor = ((SliderStyle) templateStyle).getInitDotColor(); + this.selectDotColor = ((SliderStyle) templateStyle).getSelectDotColor(); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java new file mode 100644 index 0000000000..9096fc9571 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java @@ -0,0 +1,113 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.gui.ibutton.UIColorButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.widget.MobileTabFontConfPane; +import com.fr.design.style.color.NewColorSelectBox; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; + +public abstract class StyleDefinePaneWithSelectConf extends MobileTemplateStyleDefinePane { + + protected NewColorSelectBox selectColorBox; + protected UIColorButton selectFontColor; + + public StyleDefinePaneWithSelectConf(WCardTagLayout tagLayout) { + super(tagLayout); + } + + protected JPanel createBackgroundConfPane() { + JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); + panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20)); + initialColorBox = new NewColorSelectBox(137); + initialColorBox.addSelectChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + + selectColorBox = new NewColorSelectBox(137); + selectColorBox.addSelectChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + UILabel initFillLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Init_Fill")); + UILabel selectFillLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Select_Fill")); + initFillLabel.setPreferredSize(new Dimension(55, 20)); + selectFillLabel.setPreferredSize(new Dimension(55, 20)); + JPanel jPanel2 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initFillLabel, initialColorBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + JPanel jPanel3 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectFillLabel, selectColorBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + jPanel2.setPreferredSize(new Dimension(240, 20)); + jPanel3.setPreferredSize(new Dimension(240, 20)); + panel.add(jPanel2); + panel.add(jPanel3); + return panel; + } + + protected JPanel createFontConfPane() { + JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); + panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20)); + fontConfPane = new MobileTabFontConfPane(); + fontConfPane.addFontChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + selectFontColor = new UIColorButton(); + selectFontColor.addColorChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + + updatePreviewPane(); + } + }); + UILabel initCharLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Init_Char")); + initCharLabel.setPreferredSize(new Dimension(55, 20)); + JPanel jPanel3 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initCharLabel, fontConfPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + jPanel3.setPreferredSize(new Dimension(500, 20)); + + UILabel selectCharLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Select_Char")); + selectCharLabel.setPreferredSize(new Dimension(55, 20)); + selectFontColor.setPreferredSize(new Dimension(20, 20)); + JPanel jPanel4 = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectCharLabel, selectFontColor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + JPanel jPanel5 = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + jPanel5.setPreferredSize(new Dimension(500, 20)); + jPanel5.add(jPanel4); + panel.add(jPanel3); + panel.add(jPanel5); + return panel; + } + + @Override + public MobileTemplateStyle updateSubStyle() { + MobileTemplateStyle mobileTemplateStyle = updateStyleWithSelectConf(); + mobileTemplateStyle.setSelectColor(selectColorBox.getSelectObject()); + mobileTemplateStyle.getTabFontConfig().setSelectColor(selectFontColor.getColor()); + return mobileTemplateStyle; + } + + protected abstract MobileTemplateStyle updateStyleWithSelectConf(); + + @Override + public void populateBean(MobileTemplateStyle mobileTemplateStyle) { + super.populateBean(mobileTemplateStyle); + selectColorBox.setSelectObject(mobileTemplateStyle.getSelectColor()); + selectFontColor.setColor(mobileTemplateStyle.getTabFontConfig().getSelectColor()); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java new file mode 100644 index 0000000000..6f424e19e0 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java @@ -0,0 +1,172 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.base.GraphHelper; +import com.fr.base.IconManager; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.web.CustomIconPane; +import com.fr.form.ui.WidgetInfoConfig; +import com.fr.general.ComparatorUtils; +import com.fr.stable.Constants; + +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JToggleButton; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.plaf.basic.BasicButtonUI; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.geom.Rectangle2D; +import java.util.ArrayList; + +public class TabIconConfigPane extends JPanel { + private UIButton editIconButton; + private String curIconName; + private IconButton selectIconButton; + private ArrayList iconButtons = new ArrayList(); + + public TabIconConfigPane(int count) { + initComp(count); + } + + public void initComp(int count) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); + editIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); + editIconButton.setPreferredSize(new Dimension(62, 20)); + panel.add(editIconButton); + editIconButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + final CustomIconPane cip = new CustomIconPane(); + BasicDialog editDialog = cip.showWindow(DesignerContext.getDesignerFrame()); + editDialog.addDialogActionListener(new DialogActionAdapter() { + @Override + public void doOk() { + curIconName = cip.update(); + setShowIconImage(); + TabIconConfigPane.this.repaint(); + } + }); + editDialog.setVisible(true); + } + }); + editIconButton.setEnabled(false); + this.add(panel, BorderLayout.CENTER); + + JPanel northPane = new JPanel(); + northPane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); + for (int i = 0; i < count; i++) { + IconButton iconButton = new IconButton(""); + northPane.add(iconButton); + iconButtons.add(iconButton); + } + this.add(northPane, BorderLayout.NORTH); + } + + public void setShowIconImage() { + selectIconButton.setIconName(curIconName); + } + + public void populate(ArrayList iconArr) { + for (int i = 0; i < iconButtons.size(); i++) { + iconButtons.get(i).setIconName(iconArr.get(i)); + } + } + + public ArrayList update() { + ArrayList iconNames = new ArrayList(); + for (int i = 0; i < iconButtons.size(); i++) { + iconNames.add(iconButtons.get(i).getIconName()); + } + return iconNames; + } + + + private class IconButton extends JToggleButton implements ActionListener { + private String iconName; + private Image iconImage = null; + private static final int ICON_BUTTON_SIZE = 20; + private static final int ICON_X = 2; + private static final int ICON_Y = 2; + + public IconButton(String name) { + this.iconName = name; + this.addActionListener(this); + this.setBackground(Color.WHITE); + this.setCursor(new Cursor(Cursor.HAND_CURSOR)); + this.iconImage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(name); + } + + @Override + public void updateUI() { + setUI(new BasicButtonUI() { + public void paint(Graphics g, JComponent c) { + super.paint(g, c); + } + }); + } + + public String getIconName() { + return iconName; + } + + public void setIconName(String iconName) { + this.iconName = iconName; + this.iconImage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(iconName); + } + + @Override + public void paintComponent(Graphics g) { + super.paintComponent(g); + Graphics2D g2d = (Graphics2D) g; + // carl:这里缩放显示 16 × 16 + if (iconImage != null) { + g2d.drawImage(iconImage, ICON_X, ICON_Y, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null); + } + if (this.iconName != null && ComparatorUtils.equals(this, selectIconButton)) { + g2d.setPaint(Color.decode("#419BF9")); + } else { + g2d.setPaint(Color.decode("#D9DADD")); + } + GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, 20, 20), Constants.LINE_MEDIUM); + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(ICON_BUTTON_SIZE, ICON_BUTTON_SIZE); + } + + public void actionPerformed(ActionEvent evt) { + selectIconButton = this; + editIconButton.setEnabled(true); + TabIconConfigPane.this.repaint();// repaint + } + + @Override + public void addChangeListener(ChangeListener changeListener) { + this.changeListener = changeListener; + } + + private void fireChagneListener() { + if (this.changeListener != null) { + ChangeEvent evt = new ChangeEvent(this); + this.changeListener.stateChanged(evt); + } + } + + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java new file mode 100644 index 0000000000..3f923707d8 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java @@ -0,0 +1,55 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle; +import com.fr.general.cardtag.mobile.DownMenuStyle; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.general.cardtag.mobile.SliderStyle; +import com.fr.general.cardtag.mobile.UpMenuStyle; +import com.fr.invoke.Reflect; +import com.fr.log.FineLoggerFactory; + +import java.util.HashMap; +import java.util.Map; + +public class TemplateStyleDefinePaneFactory { + private static Map defineMap = new HashMap(); + + static { + defineMap.put(DefaultMobileTemplateStyle.STYLE_NAME, new StyleDefinePaneUI(DefaultMobileStyleDefinePane.class)); + defineMap.put(UpMenuStyle.STYLE_NAME, new StyleDefinePaneUI(UpMenuStyleDefinePane.class)); + defineMap.put(DownMenuStyle.STYLE_NAME, new StyleDefinePaneUI(DownMenuStyleDefinePane.class)); + defineMap.put(SliderStyle.STYLE_NAME, new StyleDefinePaneUI(SliderStyleDefinePane.class)); + } + + public static BasicBeanPane createDefinePane(String style, WCardTagLayout tagLayout) { + StyleDefinePaneUI styleDefinePaneUI = defineMap.get(style); + Class> clazz = styleDefinePaneUI.getaClass(); + if (clazz == null) { + } + BasicBeanPane quickPane = null; + try { + quickPane = Reflect.on(clazz).create(tagLayout).get(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return quickPane; + } + + private static class StyleDefinePaneUI { + private Class> aClass; + + public StyleDefinePaneUI(Class> aClass) { + this.aClass = aClass; + } + + public Class> getaClass() { + return aClass; + } + + public void setaClass(Class> aClass) { + this.aClass = aClass; + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java new file mode 100644 index 0000000000..41265faefe --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java @@ -0,0 +1,211 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.base.GraphHelper; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.widget.UITitleSplitLine; +import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane; +import com.fr.form.ui.CardSwitchButton; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.FRFont; +import com.fr.general.cardtag.mobile.LineDescription; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.general.cardtag.mobile.UpMenuStyle; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.BasicStroke; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; + +public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { + private UIRadioButton gapFix; + private UIRadioButton titleWidthFix; + private LinePane bottomBorderPane; + private LinePane underLinePane; + + public UpMenuStyleDefinePane(WCardTagLayout tagLayout) { + super(tagLayout); + } + + protected JPanel createCenterPane() { + JPanel panel = super.createCenterPane(); + UILabel displayGap = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Display_Gap")); + displayGap.setPreferredSize(new Dimension(55, 20)); + gapFix = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Gap_Fix")); + titleWidthFix = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Title_Width_Fix")); + ButtonGroup buttonGroup = new ButtonGroup(); + titleWidthFix.setSelected(true); + buttonGroup.add(gapFix); + gapFix.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + titleWidthFix.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + buttonGroup.add(titleWidthFix); + gapFix.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + titleWidthFix.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + + + JPanel flowLeft = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); + flowLeft.add(gapFix); + flowLeft.add(titleWidthFix); + JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{displayGap, flowLeft}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + centerPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 15, 20)); + centerPane.setPreferredSize(new Dimension(500, 20)); + JPanel outerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + outerPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 15, 0)); + outerPane.add(centerPane, BorderLayout.CENTER); + panel.add(outerPane); + return panel; + } + + protected void createExtraConfPane(JPanel centerPane) { + bottomBorderPane = new LinePane(); + underLinePane = new LinePane(); + bottomBorderPane.addLineChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + underLinePane.addLineChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + updatePreviewPane(); + } + }); + UITitleSplitLine titleSplitLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Spit_Line"), 520); + titleSplitLine.setPreferredSize(new Dimension(520, 20)); + centerPane.add(titleSplitLine); + centerPane.add(bottomBorderPane); + UITitleSplitLine titleUnderLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Under_Line"), 520); + titleUnderLine.setPreferredSize(new Dimension(520, 20)); + centerPane.add(titleUnderLine); + centerPane.add(underLinePane); + } + + @Override + protected void initDefaultConfig() { + this.initialColorBox.setSelectObject(UpMenuStyle.DEFAULT_INITIAL_COLOR); + this.fontConfPane.populate(UpMenuStyle.DEFAULT_TAB_FONT.getFont()); + this.selectColorBox.setSelectObject(UpMenuStyle.DEFAULT_SELECT_COLOR); + this.selectFontColor.setColor(UpMenuStyle.DEFAULT_SELECT_FONT_COLOR); + this.bottomBorderPane.populate(UpMenuStyle.DEFAULT_BOTTOM_BORDER); + this.underLinePane.populate(UpMenuStyle.DEFAULT_UNDER_LINE); + } + + @Override + protected MobileTemplatePreviewPane createPreviewPane() { + return new UpMenuStylePreviewPane(); + } + + @Override + public void populateBean(MobileTemplateStyle ob) { + super.populateBean(ob); + UpMenuStyle style = (UpMenuStyle) ob; + gapFix.setSelected(style.isGapFix()); + titleWidthFix.setSelected(style.isTitleWidthFix()); + bottomBorderPane.populate(style.getBottomBorder()); + underLinePane.populate(style.getUnderline()); + } + + @Override + protected MobileTemplateStyle getDefaultTemplateStyle() { + return new UpMenuStyle(); + } + + + @Override + public MobileTemplateStyle updateStyleWithSelectConf() { + UpMenuStyle style = new UpMenuStyle(); + style.setGapFix(gapFix.isSelected()); + style.setTitleWidthFix(titleWidthFix.isSelected()); + style.setBottomBorder(bottomBorderPane.update()); + style.setUnderline(underLinePane.update()); + return style; + } + + @Override + protected String title4PopupWindow() { + return null; + } + + + public class UpMenuStylePreviewPane extends MobileTemplatePreviewPane { + private LineDescription bottomBorder; + private LineDescription underLine; + private boolean isGapFix; + + public UpMenuStylePreviewPane() { + this.setBackground(Color.WHITE); + } + + public void repaint() { + super.repaint(); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + Color selectFontColor = this.getTabFontConfig().getSelectColor(); + Dimension dimension = this.getSize(); + int panelWidth = dimension.width; + int panelHeight = dimension.height; + Graphics2D g2d = (Graphics2D) g.create(); + FRFont frFont = UpMenuStyleDefinePane.this.fontConfPane.update(); + FontMetrics fm = GraphHelper.getFontMetrics(frFont); + WCardTagLayout cardTagLayout = UpMenuStyleDefinePane.this.getTagLayout(); + int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); + g2d.setFont(frFont); + for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { + g2d.setColor(i == 0 ? selectFontColor : frFont.getForeground()); + CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); + String widgetName = cardSwitchButton.getText(); + int width = fm.stringWidth(widgetName); + g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight) / 2); + if (i == 0) { + g2d.setColor(this.underLine.getColor()); + g2d.setStroke(new BasicStroke(2.0f)); + int underLineX = this.isGapFix ? (eachWidth - width) / 2 : 0; + int underLineWidth = this.isGapFix ? width : eachWidth; + g2d.drawLine(underLineX, panelHeight - 1, underLineX + underLineWidth, panelHeight - 1); + } + if (bottomBorder.getLineStyle() != 0) { + g2d.setColor(bottomBorder.getColor()); + g2d.drawLine(eachWidth, 0, eachWidth, panelHeight); + } + g2d.translate(eachWidth, 0); + } + + + } + + public void populateConfig(MobileTemplateStyle templateStyle) { + super.populateConfig(templateStyle); + this.bottomBorder = ((UpMenuStyle) templateStyle).getBottomBorder(); + this.underLine = ((UpMenuStyle) templateStyle).getUnderline(); + this.isGapFix = ((UpMenuStyle) templateStyle).isGapFix(); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/MobileTabFontConfPane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/MobileTabFontConfPane.java new file mode 100644 index 0000000000..3c17d3b9be --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/MobileTabFontConfPane.java @@ -0,0 +1,143 @@ +package com.fr.design.mainframe.widget; + +import com.fr.base.BaseUtils; +import com.fr.base.Utils; +import com.fr.design.gui.ibutton.UIColorButton; +import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.general.FRFont; + +import javax.swing.Icon; +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.EventListenerList; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.Vector; + +public class MobileTabFontConfPane extends JPanel { + private EventListenerList fontChangeListener = new EventListenerList(); + private UIComboBox fontFamily; + private UIComboBox fontSize; + private UIToggleButton bold; + private UIColorButton color; + private UIToggleButton italic; + private final static Icon[] ITALIC_ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic_white.png")}; + private final static Icon[] BOLD_ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold_white.png")}; + + + public MobileTabFontConfPane() { + super(); + init(); + } + + private void init() { + this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); + fontFamily = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); + Vector integerList = new Vector(); + for (int i = 1; i < 100; i++) { + integerList.add(i); + } + fontFamily.setPreferredSize(new Dimension(152, 20)); + fontSize = new UIComboBox(integerList); + color = new UIColorButton(); + bold = new UIToggleButton(BOLD_ICONS, true); + italic = new UIToggleButton(ITALIC_ICONS, true); + fontFamily.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + fireFontStateChanged(); + } + }); + fontSize.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + fireFontStateChanged(); + } + }); + bold.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + fireFontStateChanged(); + } + }); + italic.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + fireFontStateChanged(); + } + }); + color.addColorChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + fireFontStateChanged(); + } + }); + this.add(fontFamily); + this.add(fontSize); + this.add(color); + this.add(bold); + this.add(italic); + + } + + public FRFont update() { + String family = (String) fontFamily.getSelectedItem(); + int size = (int) fontSize.getSelectedItem(); + int style = Font.PLAIN; + style += this.bold.isSelected() ? Font.BOLD : Font.PLAIN; + style += this.italic.isSelected() ? Font.ITALIC : Font.PLAIN; + FRFont frFont = FRFont.getInstance(family, style, size, color.getColor()); + return frFont; + } + + public void populate(FRFont frFont) { + fontFamily.setSelectedItem(frFont.getFamily()); + fontSize.setSelectedItem(frFont.getSize()); + color.setColor(frFont.getForeground()); + bold.setSelected(frFont.isBold()); + italic.setSelected(frFont.isItalic()); + + } + + + /** + * 添加监听 + * + * @param changeListener 监听列表 + */ + public void addFontChangeListener(ChangeListener changeListener) { + fontChangeListener.add(ChangeListener.class, changeListener); + } + + /** + * 移除监听 + * Removes an old ColorChangeListener. + * + * @param changeListener 监听列表 + */ + public void removeFontChangeListener(ChangeListener changeListener) { + fontChangeListener.remove(ChangeListener.class, changeListener); + } + + /** + * 颜色状态改变 + */ + public void fireFontStateChanged() { + Object[] listeners = fontChangeListener.getListenerList(); + ChangeEvent e = null; + + for (int i = listeners.length - 2; i >= 0; i -= 2) { + if (listeners[i] == ChangeListener.class) { + if (e == null) { + e = new ChangeEvent(this); + } + ((ChangeListener) listeners[i + 1]).stateChanged(e); + } + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/UITitleSplitLine.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/UITitleSplitLine.java new file mode 100644 index 0000000000..afd1a2c961 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/UITitleSplitLine.java @@ -0,0 +1,69 @@ +package com.fr.design.mainframe.widget; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.FRFont; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; + +public class UITitleSplitLine extends JPanel { + private static final Color LINE_COLOR = Color.decode("#E0E0E1"); + private static final Color TITLE_COLOR = Color.decode("#333334"); + private static final FRFont TITLE_FONT = FRFont.getInstance("PingFangSC-Regular", 0, 12.0F); + + private Color color; + private UILabel label; + private int width; + private static final int OFFSETX = 10; + private static final int OFFSET = 3; + + + public UITitleSplitLine(String title, int width) { + this(title, LINE_COLOR, width); + } + + public UITitleSplitLine(String title, Color color, int width) { + super(); + this.color = color; + this.width = width; + this.label = new UILabel(title); + } + + public void paint(Graphics g) { + super.paint(g); + Dimension size = label.getPreferredSize(); + int labelH = size.height; + g.setColor(color); + g.drawLine(0, labelH / 2, OFFSETX, labelH / 2); + g.drawLine(OFFSETX + size.width + OFFSET * 2, labelH / 2, width, labelH / 2); + g.translate(OFFSETX + OFFSET, 0); + label.setFont(TITLE_FONT); + label.setForeground(TITLE_COLOR); + label.setSize(size.width, size.height); + label.paint(g); + g.translate(-OFFSETX - OFFSET, 0); + } + + + public static void main(String[] args) { +// JFrame jf = new JFrame("test"); +// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); +// JPanel content = (JPanel) jf.getContentPane(); +// content.setLayout(new BorderLayout()); +// JPanel myPanel = new JPanel(); +// myPanel.setLayout(new BorderLayout()); +// JPanel Panel = new JPanel(); +// Panel.setBackground(Color.blue); +// myPanel.add(new UITitleSplitLine("基本", 223), BorderLayout.CENTER); +// content.add(myPanel, BorderLayout.CENTER); +// GUICoreUtils.centerWindow(jf); +// jf.setSize(439, 400); +// jf.setVisible(true); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java new file mode 100644 index 0000000000..482b2cebcd --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java @@ -0,0 +1,10 @@ +package com.fr.design.mainframe.widget.accessibles; + +import com.fr.design.dialog.BasicPane; + +public abstract class AbstractTemplateStylePane extends BasicPane { + + public abstract void populate(T ob); + + public abstract T update(); +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java index 9e32a4d46a..195a92e8a9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java @@ -2,7 +2,6 @@ package com.fr.design.mainframe.widget.accessibles; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.general.cardtag.TemplateStyle; import com.fr.design.mainframe.widget.wrappers.TemplateStyleWrapper; import javax.swing.SwingUtilities; @@ -15,18 +14,16 @@ public class AccessibleTemplateStyleEditor extends UneditableAccessibleEditor { private static final Dimension DEFAULT_DIMENSION = new Dimension(600, 400); - private TemplateStylePane stylePane; + private AbstractTemplateStylePane stylePane; - public AccessibleTemplateStyleEditor() { + public AccessibleTemplateStyleEditor(AbstractTemplateStylePane stylePane) { super(new TemplateStyleWrapper()); + this.stylePane = stylePane; } @Override protected void showEditorPane() { - if (stylePane == null) { - stylePane = new TemplateStylePane(); - stylePane.setPreferredSize(DEFAULT_DIMENSION); - } + stylePane.setPreferredSize(DEFAULT_DIMENSION); BasicDialog dlg = stylePane.showWindow(SwingUtilities.getWindowAncestor(this)); dlg.addDialogActionListener(new DialogActionAdapter() { @@ -36,7 +33,7 @@ public class AccessibleTemplateStyleEditor extends UneditableAccessibleEditor { fireStateChanged(); } }); - stylePane.populate((TemplateStyle) getValue()); + stylePane.populate(getValue()); dlg.setVisible(true); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java new file mode 100644 index 0000000000..f88221a42b --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java @@ -0,0 +1,113 @@ +package com.fr.design.mainframe.widget.accessibles; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.mobile.ui.TemplateStyleDefinePaneFactory; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle; +import com.fr.general.cardtag.mobile.DownMenuStyle; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.general.cardtag.mobile.SliderStyle; +import com.fr.general.cardtag.mobile.UpMenuStyle; +import javax.swing.DefaultListCellRenderer; +import javax.swing.DefaultListModel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ListCellRenderer; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MobileTemplateStylePane extends AbstractTemplateStylePane { + private static final List STYLE_LIST = new ArrayList(); + static { + STYLE_LIST.add(DefaultMobileTemplateStyle.STYLE_NAME); + STYLE_LIST.add(UpMenuStyle.STYLE_NAME); + STYLE_LIST.add(DownMenuStyle.STYLE_NAME); + STYLE_LIST.add(SliderStyle.STYLE_NAME); + } + + private DefaultListModel listModel; + private JList styleList; + private Map> map = new HashMap<>(); + private JPanel right; + private CardLayout card; + public MobileTemplateStylePane(WCardTagLayout tagLayout){ + init(tagLayout); + } + + public void init(WCardTagLayout tagLayout){ + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + listModel = new DefaultListModel(); + card = new CardLayout(); + right = FRGUIPaneFactory.createCardLayout_S_Pane(); + right.setLayout(card); + for(String style : STYLE_LIST){ + listModel.addElement(style); + BasicBeanPane styleBasicBeanPane = TemplateStyleDefinePaneFactory.createDefinePane(style, tagLayout); + map.put(style, styleBasicBeanPane); + right.add(style, styleBasicBeanPane); + } + styleList = new JList(listModel); + styleList.setCellRenderer(render); + + JPanel westPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + westPane.add(styleList, BorderLayout.CENTER); + westPane.setPreferredSize(new Dimension(100, 500)); + + + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + JPanel attrConfPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + centerPane.setPreferredSize(new Dimension(500, 500)); + attrConfPane.add(right, BorderLayout.CENTER); + centerPane.add(attrConfPane, BorderLayout.CENTER); + styleList.addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent e) { + String selectedValue = (String)styleList.getSelectedValue(); + card.show(right, selectedValue); + } + }); + this.add(westPane, BorderLayout.WEST); + this.add(centerPane, BorderLayout.CENTER); + } + public static ListCellRenderer render = new DefaultListCellRenderer() { + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + + if (value instanceof MobileTemplateStyle) { + MobileTemplateStyle l = (MobileTemplateStyle) value; + this.setText(l.toString()); + } + return this; + } + }; + + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Tab_Style_Template"); + } + + public void populate(MobileTemplateStyle templateStyle) { + for(int i = 0; i< listModel.getSize(); i++){ + if((listModel.getElementAt(i)).equals(templateStyle.getStyle())){ + styleList.setSelectedIndex(i); + map.get(templateStyle.getStyle()).populateBean(templateStyle); + card.show(right, templateStyle.getStyle()); + return; + } + } + styleList.setSelectedIndex(0); + } + + public MobileTemplateStyle update() { + return map.get(styleList.getSelectedValue()).updateBean(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePane.java index fdd6cbb32c..6374a19c54 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePane.java @@ -21,16 +21,17 @@ import javax.swing.ListCellRenderer; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; +import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; /** * Created by kerry on 2017/11/23. */ -public class TemplateStylePane extends BasicPane { +public class TemplateStylePane extends AbstractTemplateStylePane { private DefaultListModel listModel; private JList styleList; - private TemplateStylePreviewPane previewPane = new TemplateStylePreviewPane(new DefaultTemplateStyle()); + private TemplateStylePreviewPane previewPane = new TemplateStylePreviewPane(new DefaultTemplateStyle(), new Rectangle(0, 50, 540, 400)); public TemplateStylePane(){ init(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePreviewPane.java index 0f684006ae..1e47d30890 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePreviewPane.java @@ -1,26 +1,23 @@ package com.fr.design.mainframe.widget.accessibles; -import com.fr.base.BaseUtils; import com.fr.general.cardtag.TemplateStyle; import javax.swing.JPanel; import java.awt.Graphics; import java.awt.Graphics2D; -import java.awt.Image; +import java.awt.Rectangle; /** * Created by kerry on 2017/12/11. */ public class TemplateStylePreviewPane extends JPanel { - private static final int WIDTH = 540; - private static final int HEIGHT = 400; - private static final int OFFSETY = 50; - + private Rectangle rectangle; private TemplateStyle templateStyle; - public TemplateStylePreviewPane(TemplateStyle templateStyle){ + public TemplateStylePreviewPane(TemplateStyle templateStyle, Rectangle rectangle){ this.templateStyle = templateStyle; + this.rectangle = rectangle; } public void repaint (TemplateStyle templateStyle){ @@ -32,7 +29,6 @@ public class TemplateStylePreviewPane extends JPanel { public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g.create(); - Image image = BaseUtils.readImage(templateStyle.getPreview()); - g2d.drawImage(image, 0, OFFSETY, WIDTH, HEIGHT, null); + templateStyle.paintPreview(g2d, rectangle); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java new file mode 100644 index 0000000000..d5ddbb6b9f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java @@ -0,0 +1,53 @@ +package com.fr.design.mainframe.widget.preview; + +import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.general.cardtag.mobile.TabFontConfig; + +import javax.swing.JPanel; +import java.awt.Color; + +public abstract class MobileTemplatePreviewPane extends JPanel { + private Color initialColor; + private Color selectColor; + private TabFontConfig tabFontConfig = new TabFontConfig(); + + public Color getInitialColor() { + return initialColor; + } + + public void setInitialColor(Color initialColor) { + this.initialColor = initialColor; + } + + public Color getSelectColor() { + return selectColor; + } + + public void setSelectColor(Color selectColor) { + this.selectColor = selectColor; + } + + public TabFontConfig getTabFontConfig() { + return tabFontConfig; + } + + public void setTabFontConfig(TabFontConfig tabFontConfig) { + this.tabFontConfig = tabFontConfig; + } + + public MobileTemplatePreviewPane(){ + + } + + public void populateConfig(MobileTemplateStyle templateStyle){ + this.setInitialColor(templateStyle.getInitialColor()); + this.setBackground(templateStyle.getInitialColor()); + this.setSelectColor(templateStyle.getSelectColor()); + this.setTabFontConfig(templateStyle.getTabFontConfig()); + } + + public void repaint (){ + super.repaint(); + } + +} diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java index f0d155f7af..1b9d2690e6 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java @@ -16,9 +16,11 @@ import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWHorizontalBoxLayout; import com.fr.design.designer.creator.XWidgetCreator; +import com.fr.design.designer.properties.mobile.TabMobilePropertyUI; import com.fr.design.form.layout.FRFlowLayout; import com.fr.design.form.layout.FRHorizontalLayout; import com.fr.design.form.layout.FRVerticalLayout; +import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.EditingMouseListener; @@ -328,6 +330,10 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout { return ComparatorUtils.equals(displayPosition, WTabDisplayPosition.TOP_POSITION) || ComparatorUtils.equals(displayPosition, WTabDisplayPosition.BOTTOM_POSITION); } + @Override + public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { + return new WidgetPropertyUIProvider[]{ new TabMobilePropertyUI(this)}; + } /** * data属性改变触发其他操作 diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/TabMobilePropertyUI.java b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/TabMobilePropertyUI.java new file mode 100644 index 0000000000..8ebdbd7694 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/TabMobilePropertyUI.java @@ -0,0 +1,30 @@ +package com.fr.design.designer.properties.mobile; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.dialog.BasicPane; +import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; +import com.fr.design.gui.itable.AbstractPropertyTable; +import com.fr.design.widget.ui.designer.mobile.TabMobileWidgetDefinePane; + +public class TabMobilePropertyUI extends AbstractWidgetPropertyUIProvider { + private XCreator xCreator; + + public TabMobilePropertyUI(XCreator xCreator){ + this.xCreator = xCreator; + } + + @Override + public AbstractPropertyTable createWidgetAttrTable() { + return null; + } + + @Override + public BasicPane createWidgetAttrPane() { + return new TabMobileWidgetDefinePane(xCreator); + } + + @Override + public String tableTitle() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr"); + } +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java index ee021d2604..d1e68baf39 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java @@ -15,6 +15,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.widget.accessibles.AccessibleTabPaneBackgroundEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor; +import com.fr.design.mainframe.widget.accessibles.TemplateStylePane; import com.fr.design.widget.ui.designer.AbstractDataModify; import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.container.WTabDisplayPosition; @@ -51,7 +52,7 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify this.setLayout(FRGUIPaneFactory.createBorderLayout()); backgroundEditor = new AccessibleTabPaneBackgroundEditor(); - templateStyleEditor = new AccessibleTemplateStyleEditor(); + templateStyleEditor = new AccessibleTemplateStyleEditor(new TemplateStylePane()); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p, p, p, p, p}; diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java new file mode 100644 index 0000000000..f6d94da06c --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java @@ -0,0 +1,69 @@ +package com.fr.design.widget.ui.designer.mobile; + +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor; +import com.fr.design.mainframe.widget.accessibles.MobileTemplateStylePane; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.general.cardtag.mobile.MobileTemplateStyle; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; + +public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { + private XCreator xCreator; + private AccessibleTemplateStyleEditor templateStyleEditor; + private AttributeChangeListener changeListener; + + public TabMobileWidgetDefinePane(XCreator xCreator) { + this.xCreator = xCreator; + } + + private void bindListeners2Widgets() { + reInitAllListeners(); + this.changeListener = new AttributeChangeListener() { + @Override + public void attributeChange() { + update(); + } + }; + } + /** + * 后台初始化所有事件. + */ + private void reInitAllListeners() { + initListener(this); + } + + @Override + public void initPropertyGroups(Object source) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Tab_Style_Template")); + templateStyleEditor = new AccessibleTemplateStyleEditor(new MobileTemplateStylePane((WCardTagLayout) xCreator.toData())); + JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{label, templateStyleEditor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); + this.add(jPanel, BorderLayout.CENTER); + } + + @Override + public void populate(FormDesigner designer) { + templateStyleEditor.setValue(((WCardTagLayout)xCreator.toData()).getMobileTemplateStyle()); + // 数据 populate 完成后,再设置监听 + this.bindListeners2Widgets(); + this.addAttributeChangeListener(changeListener); + } + + @Override + public void update() { + ((WCardTagLayout)xCreator.toData()).setMobileTemplateStyle((MobileTemplateStyle) templateStyleEditor.getValue()); + DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来 + + } +} From 99242e5060002378775df3f2078084b284475ae3 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 19 Nov 2018 15:07:44 +0800 Subject: [PATCH 12/44] =?UTF-8?q?file=20choose=20pane=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E6=9C=AC=E5=9C=B0=E7=8E=AF=E5=A2=83=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../file/export/AbstractExportAction.java | 3 +- .../java/com/fr/file/FILEChooserPane.java | 306 +++++++++++++----- 2 files changed, 219 insertions(+), 90 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java index f47818687c..933ff02e32 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -80,7 +80,7 @@ public abstract class AbstractExportAction> extends JT Map para = processParameter(); // 选择输入的文件 - FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true); + FILEChooserPane fileChooserPane = FILEChooserPane.getMultiEnvInstance(true, false); fileChooserPane.addChooseFILEFilter(this.getChooseFileFilter()); @@ -96,7 +96,6 @@ public abstract class AbstractExportAction> extends JT } FineLoggerFactory.getLogger().info("\"" + target.getName() + "\"" + Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); - progressbar = new FRProgressBar( createExportWork(getSource(), target, para), DesignerContext.getDesignerFrame(), diff --git a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java index f3f9c7d285..fc4a5dfea0 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -7,6 +7,8 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.UIDialog; +import com.fr.design.env.DesignerWorkspaceInfo; +import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonUI; @@ -15,6 +17,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.DefaultCompletionFilter; import com.fr.design.gui.itextfield.UIAutoCompletionField; import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.gui.itree.filetree.FileTreeIcon; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; @@ -85,6 +88,7 @@ import java.awt.event.WindowEvent; import java.io.File; import java.util.ArrayList; import java.util.EnumSet; +import java.util.Iterator; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -176,6 +180,28 @@ public class FILEChooserPane extends BasicPane { return INSTANCE; } + public static FILEChooserPane getMultiEnvInstance(boolean showLoc, boolean showWebReport, FILEFilter filter) { + INSTANCE.showEnv = true; + INSTANCE.showLoc = showLoc; + INSTANCE.showWebReport = showWebReport; + // 替换掉 PlaceListModel + INSTANCE.setMultiPlaceListModel(); + INSTANCE.removeAllFilter(); + INSTANCE.addChooseFILEFilter(filter, 0); + return INSTANCE; + } + + public static FILEChooserPane getMultiEnvInstance(boolean showLoc, boolean showWebReport) { + INSTANCE.showEnv = true; + INSTANCE.showLoc = showLoc; + INSTANCE.showWebReport = showWebReport; + // 替换掉 PlaceListModel + INSTANCE.setMultiPlaceListModel(); + INSTANCE.removeAllFilter(); + return INSTANCE; + } + + /** * @param showEnv * @param filter @@ -912,96 +938,10 @@ public class FILEChooserPane extends BasicPane { return dialogName(); } - private class PlaceListModel extends AbstractListModel { - private FileNodeFILE envFILE; - private FileNodeFILE webReportFILE; - private List filesOfSystem = new ArrayList(); - - PlaceListModel() { - if (FILEChooserPane.this.showEnv) { - envFILE = new FileNodeFILE(new FileNode(ProjectConstants.REPORTLETS_NAME, true)) { - @Override - public String getName() { - return getEnvProjectName(); - } - }; - } - if (FILEChooserPane.this.showWebReport) { - webReportFILE = new FileNodeFILE(FRContext.getCommonOperator().getWebRootPath()); - } - if (FILEChooserPane.this.showLoc) { - - - if (WindowsDetector.detect(true)) { - // windows下展示桌面 - File[] desktop = FileSystemView.getFileSystemView().getRoots(); - if (desktop != null) { - for (int i = 0; i < desktop.length; i++) { - if (desktop[i].exists()) { - filesOfSystem.add(new FileFILE(desktop[i])); - } - } - } - } else { - // *nix下展示家目录 - filesOfSystem.add(new FileFILE(FileSystemView.getFileSystemView().getDefaultDirectory())); - } - - // C, D, E等盘符 - File[] roots = File.listRoots(); - if (roots != null) { - for (int i = 0; i < roots.length; i++) { - if (roots[i].exists()) { - filesOfSystem.add(new FileFILE(roots[i])); - } - } - } - } - } - - @Override - public FILE getElementAt(int index) { - int n = FILEChooserPane.this.showEnv ? 1 : 0; - int n2 = FILEChooserPane.this.showWebReport ? 1 : 0; - - if (index < n) { - return envFILE; - } else if (index < n + n2) { - return webReportFILE; - } else if (index < n + n2 + filesOfSystem.size()) { - return filesOfSystem.get(index - n - n2); - } - throw new IndexOutOfBoundsException(); - } - - @Override - public int getSize() { - if (FILEChooserPane.this.showEnv && FILEChooserPane.this.showWebReport) { - return 2 + filesOfSystem.size(); - } else if (FILEChooserPane.this.showEnv || FILEChooserPane.this.showWebReport) { - return 1 + filesOfSystem.size(); - } else { - return filesOfSystem.size(); - } - } - - private void setCD(final FILE lastDirectory) { - for (int i = 0; i < this.getSize(); i++) { - FILE file = this.getElementAt(i); - if (ComparatorUtils.equals(lastDirectory.prefix(), file.prefix())) { - setCurrentDirectory(lastDirectory); - return; - } - } - setCurrentDirectory(this.getElementAt(0)); - } - } - - private void setPlaceListModel() { + private void setPlaceListModel(AbstractPlaceListModel model) { if (placesList == null) { return; } - PlaceListModel model = new PlaceListModel(); placesList.setModel(model); String lastDirectoryPath = DesignerEnvManager.getEnvManager().getDialogCurrentDirectory(); String prefix = DesignerEnvManager.getEnvManager().getCurrentDirectoryPrefix(); @@ -1023,6 +963,20 @@ public class FILEChooserPane extends BasicPane { } } + private void setPlaceListModel() { + if (placesList == null) { + return; + } + setPlaceListModel(new PlaceListModel()); + } + + private void setMultiPlaceListModel() { + if (placesList == null) { + return; + } + setPlaceListModel(new MultiLocalEnvPlaceListModel()); + } + /* * 选中文件 */ @@ -1052,7 +1006,7 @@ public class FILEChooserPane extends BasicPane { if (ComparatorUtils.equals(dir.prefix(), FILEFactory.ENV_PREFIX) || dir.prefix().endsWith(FILEFactory.WEBREPORT_PREFIX)) { placesList.setSelectedIndex(0); } else if (ComparatorUtils.equals(dir.prefix(), FILEFactory.FILE_PREFIX)) { - PlaceListModel defaultListModel = (PlaceListModel) placesList.getModel(); + AbstractPlaceListModel defaultListModel = (AbstractPlaceListModel) placesList.getModel(); for (int i = 0; i < defaultListModel.getSize(); i++) { if (defaultListModel.getElementAt(i) instanceof FileFILE) { FileFILE popDir = (FileFILE) defaultListModel.getElementAt(i); @@ -1108,6 +1062,182 @@ public class FILEChooserPane extends BasicPane { } } + private abstract class AbstractPlaceListModel extends AbstractListModel { + + protected List filesOfSystem = new ArrayList(); + + protected void processSystemFile() { + if (WindowsDetector.detect(true)) { + // windows下展示桌面 + File[] desktop = FileSystemView.getFileSystemView().getRoots(); + if (desktop != null) { + for (int i = 0; i < desktop.length; i++) { + if (desktop[i].exists()) { + filesOfSystem.add(new FileFILE(desktop[i])); + } + } + } + } else { + // *nix下展示家目录 + filesOfSystem.add(new FileFILE(FileSystemView.getFileSystemView().getDefaultDirectory())); + } + + // C, D, E等盘符 + File[] roots = File.listRoots(); + if (roots != null) { + for (int i = 0; i < roots.length; i++) { + if (roots[i].exists()) { + filesOfSystem.add(new FileFILE(roots[i])); + } + } + } + } + + protected void setCD(final FILE lastDirectory) { + for (int i = 0; i < this.getSize(); i++) { + FILE file = this.getElementAt(i); + if (ComparatorUtils.equals(lastDirectory.prefix(), file.prefix())) { + setCurrentDirectory(lastDirectory); + return; + } + } + setCurrentDirectory(this.getElementAt(0)); + } + } + + private class PlaceListModel extends AbstractPlaceListModel { + private FileNodeFILE envFILE; + private FileNodeFILE webReportFILE; + + PlaceListModel() { + if (FILEChooserPane.this.showEnv) { + envFILE = new FileNodeFILE(new FileNode(ProjectConstants.REPORTLETS_NAME, true)) { + @Override + public String getName() { + return getEnvProjectName(); + } + }; + } + if (FILEChooserPane.this.showWebReport) { + webReportFILE = new FileNodeFILE(FRContext.getCommonOperator().getWebRootPath()); + } + if (FILEChooserPane.this.showLoc) { + processSystemFile(); + } + } + + @Override + public FILE getElementAt(int index) { + int n = FILEChooserPane.this.showEnv ? 1 : 0; + int n2 = FILEChooserPane.this.showWebReport ? 1 : 0; + + if (index < n) { + return envFILE; + } else if (index < n + n2) { + return webReportFILE; + } else if (index < n + n2 + filesOfSystem.size()) { + return filesOfSystem.get(index - n - n2); + } + throw new IndexOutOfBoundsException(); + } + + @Override + public int getSize() { + if (FILEChooserPane.this.showEnv && FILEChooserPane.this.showWebReport) { + return 2 + filesOfSystem.size(); + } else if (FILEChooserPane.this.showEnv || FILEChooserPane.this.showWebReport) { + return 1 + filesOfSystem.size(); + } else { + return filesOfSystem.size(); + } + } + + } + + private class MultiLocalEnvPlaceListModel extends AbstractPlaceListModel { + + private List envFiles = new ArrayList(); + private FileNodeFILE webReportFILE; + + MultiLocalEnvPlaceListModel() { + Iterator iterator = DesignerEnvManager.getEnvManager().getEnvNameIterator(); + + while (iterator.hasNext()) { + final String envName = iterator.next(); + DesignerWorkspaceInfo info = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName); + if (info.getType() == DesignerWorkspaceType.Local) { + FileFILE fileFILE = + new FileFILE(new File(info.getPath() + CoreConstants.SEPARATOR + ProjectConstants.REPORTLETS_NAME)) { + @Override + public String getName() { + return envName; + } + }; + if (fileFILE.exists() && fileFILE.isDirectory()) { + envFiles.add(fileFILE); + } + } + } + + if (FILEChooserPane.this.showWebReport) { + webReportFILE = new FileNodeFILE(FRContext.getCommonOperator().getWebRootPath()); + } + if (FILEChooserPane.this.showLoc) { + processSystemFile(); + } + } + + @Override + public FILE getElementAt(int index) { + int envCount = envFiles.size(); + int webReportCount = FILEChooserPane.this.showWebReport ? 1 : 0; + + if (index < envCount) { + return envFiles.get(index); + } else if (index < envCount + webReportCount) { + return webReportFILE; + } else if (index < envCount + webReportCount + filesOfSystem.size()) { + return filesOfSystem.get(index - envCount - webReportCount); + } + throw new IndexOutOfBoundsException(); + } + + @Override + public int getSize() { + int webReportCount = FILEChooserPane.this.showWebReport ? 1 : 0; + return envFiles.size() + filesOfSystem.size() + webReportCount; + } + + private class FileFILE extends com.fr.file.FileFILE { + + public FileFILE(File file) { + super(file); + } + + @Override + public Icon getIcon() { + if (ComparatorUtils.equals(getTotalName(), ProjectConstants.REPORTLETS_NAME)) { + return BaseUtils.readIcon("/com/fr/base/images/oem/logo.png"); + } else { + return FileTreeIcon.getIcon(new File(this.getPath()), false); + } + } + + @Override + public FILE[] listFiles() { + FILE[] fileFILES = super.listFiles(); + + List results = new ArrayList<>(); + + for (FILE fileFILE : fileFILES) { + results.add(new FileFILE(new File(fileFILE.getPath()))); + } + + return results.toArray(new FILE[results.size()]); + } + } + } + /* * 上面的LocationButtonPane */ From 76b881ea2f020a0098cd81352b95be308347e9ce Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 19 Nov 2018 15:35:37 +0800 Subject: [PATCH 13/44] =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/file/export/AbstractExportAction.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java index 933ff02e32..cbe3a1aea0 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -6,6 +6,7 @@ import com.fr.design.gui.iprogressbar.FRProgressBar; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; +import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.file.FILE; import com.fr.file.FILEChooserPane; import com.fr.file.filter.ChooseFileFilter; @@ -170,6 +171,19 @@ public abstract class AbstractExportAction> extends JT JOptionPane.showMessageDialog( DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name); + + + } catch (RemoteDesignPermissionDeniedException exp) { + this.setProgress(100); + target.closeTemplate(); + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Engine_Remote_Design_Permission_Denied"), + null, + JOptionPane.ERROR_MESSAGE, + UIManager.getIcon("OptionPane.errorIcon") + ); } catch (Exception exp) { this.setProgress(100); target.closeTemplate(); From dad20400fa3f6acba5de1cd0e85f8d94a8b6d6f8 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 19 Nov 2018 15:42:25 +0800 Subject: [PATCH 14/44] =?UTF-8?q?=E6=94=B9=E4=B8=80=E4=B8=8B=E5=91=BD?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/export/AbstractExcelExportAction.java | 2 +- ...ookExportAction.java => AbstractWorkBookExportAction.java} | 4 ++-- .../com/fr/design/actions/file/export/CSVExportAction.java | 2 +- .../actions/file/export/EmbeddedExportExportAction.java | 2 +- .../com/fr/design/actions/file/export/PDFExportAction.java | 2 +- .../com/fr/design/actions/file/export/SVGExportAction.java | 2 +- .../com/fr/design/actions/file/export/TextExportAction.java | 2 +- .../com/fr/design/actions/file/export/WordExportAction.java | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) rename designer-realize/src/main/java/com/fr/design/actions/file/export/{AbstractJWorkBookExportAction.java => AbstractWorkBookExportAction.java} (90%) diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java index 38afcb545d..44c32637bb 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java @@ -13,7 +13,7 @@ import com.fr.report.core.ReportUtils; /** * Export excel. */ -public abstract class AbstractExcelExportAction extends AbstractJWorkBookExportAction { +public abstract class AbstractExcelExportAction extends AbstractWorkBookExportAction { protected AbstractExcelExportAction(JWorkBook jwb) { super(jwb); diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractWorkBookExportAction.java similarity index 90% rename from designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java rename to designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractWorkBookExportAction.java index 63362e5d41..bfec887440 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractJWorkBookExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractWorkBookExportAction.java @@ -19,10 +19,10 @@ import static com.fr.io.exporter.DesignExportScope.FINE_BOOK; /** * Abstract export action. */ -public abstract class AbstractJWorkBookExportAction extends AbstractExportAction { +public abstract class AbstractWorkBookExportAction extends AbstractExportAction { - protected AbstractJWorkBookExportAction(JWorkBook jwb) { + protected AbstractWorkBookExportAction(JWorkBook jwb) { super(jwb); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java index 8ecced355c..cc6bdaf392 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/CSVExportAction.java @@ -16,7 +16,7 @@ import com.fr.report.core.ReportUtils; /** * Export CSV. */ -public class CSVExportAction extends AbstractJWorkBookExportAction { +public class CSVExportAction extends AbstractWorkBookExportAction { /** * Constructor */ diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java index a5b97b9e63..9944142b72 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java @@ -13,7 +13,7 @@ import java.util.EnumSet; /** * Export Embedded. */ -public class EmbeddedExportExportAction extends AbstractJWorkBookExportAction { +public class EmbeddedExportExportAction extends AbstractWorkBookExportAction { /** * Constructor */ diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/PDFExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/PDFExportAction.java index e98e383d23..e6fc6b5406 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/PDFExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/PDFExportAction.java @@ -14,7 +14,7 @@ import com.fr.io.exporter.DesignExportType; /** * Export pdf */ -public class PDFExportAction extends AbstractJWorkBookExportAction { +public class PDFExportAction extends AbstractWorkBookExportAction { /** * Constructor */ diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/SVGExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/SVGExportAction.java index 198b9cb4ec..4a7862e9d4 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/SVGExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/SVGExportAction.java @@ -14,7 +14,7 @@ import com.fr.io.exporter.DesignExportType; /** * Export SVG */ -public class SVGExportAction extends AbstractJWorkBookExportAction { +public class SVGExportAction extends AbstractWorkBookExportAction { /** * Constructor */ diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/TextExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/TextExportAction.java index 454435f273..ff3debb49a 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/TextExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/TextExportAction.java @@ -14,7 +14,7 @@ import com.fr.io.exporter.DesignExportType; /** * Export Text. */ -public class TextExportAction extends AbstractJWorkBookExportAction { +public class TextExportAction extends AbstractWorkBookExportAction { public TextExportAction(JWorkBook jwb) { super(jwb); diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/WordExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/WordExportAction.java index cc042b9e41..9e1a919848 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/WordExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/WordExportAction.java @@ -14,7 +14,7 @@ import com.fr.io.exporter.DesignExportType; /** * Export excel. */ -public class WordExportAction extends AbstractJWorkBookExportAction { +public class WordExportAction extends AbstractWorkBookExportAction { /** * Constructor */ From 197a34a26cae1fe7c4a1100eca8896d3264a73ce Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 19 Nov 2018 15:47:52 +0800 Subject: [PATCH 15/44] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/JForm.java | 21 +++++----------- .../com/fr/design/mainframe/JWorkBook.java | 24 +++++++++---------- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index bb6483b32a..381472d38f 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -5,9 +5,9 @@ import com.fr.base.PaperSize; import com.fr.base.Parameter; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; -import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; import com.fr.design.actions.TemplateParameterAction; import com.fr.design.actions.core.WorkBookSupportable; +import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; import com.fr.design.cell.FloatElementsProvider; import com.fr.design.designer.TargetComponent; import com.fr.design.designer.beans.actions.CopyAction; @@ -118,7 +118,6 @@ public class JForm extends JTemplate implements BaseJForm { @Override public void refreshEastPropertiesPane() { // 暂时用不到,遇到的时候再加刷新右侧tab面板的代码 - return; } @Override @@ -152,7 +151,6 @@ public class JForm extends JTemplate implements BaseJForm { @Override public void setJTemplateResolution(int resolution) { - return; } @Override @@ -195,7 +193,6 @@ public class JForm extends JTemplate implements BaseJForm { } public void setAuthorityMode(boolean isUpMode) { - return; } public int getToolBarHeight() { @@ -208,7 +205,7 @@ public class JForm extends JTemplate implements BaseJForm { * @return 菜单数组 */ public ShortCut[] shortcut4FileMenu() { - return (ShortCut[]) ArrayUtils.addAll( + return ArrayUtils.addAll( super.shortcut4FileMenu(), DesignerMode.isVcsMode() ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()} ); @@ -226,7 +223,6 @@ public class JForm extends JTemplate implements BaseJForm { * 取消格式 */ public void cancelFormat() { - return; } /** @@ -292,30 +288,25 @@ public class JForm extends JTemplate implements BaseJForm { * 去除选择 */ public void removeTemplateSelection() { - return; } public void setSheetCovered(boolean isCovered) { - return; } /** * 刷新容器 */ public void refreshContainer() { - return; } /** * 去除参数面板选择 */ public void removeParameterPaneSelection() { - return; } @Override public void setScale(int resolution) { - return; } @Override @@ -478,8 +469,8 @@ public class JForm extends JTemplate implements BaseJForm { @Override public MenuDef[] menus4Target() { return this.index == FORM_TAB ? - (MenuDef[]) ArrayUtils.addAll(super.menus4Target(), this.formDesign.menus4Target()) : - (MenuDef[]) ArrayUtils.addAll(super.menus4Target(), this.elementCaseDesign.menus4Target()); + ArrayUtils.addAll(super.menus4Target(), this.formDesign.menus4Target()) : + ArrayUtils.addAll(super.menus4Target(), this.elementCaseDesign.menus4Target()); } @@ -504,9 +495,9 @@ public class JForm extends JTemplate implements BaseJForm { @Override public ShortCut[] shortcut4TemplateMenu() { if (this.index == FORM_TAB) { - return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); + return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); } else { - return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); + return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index 88b88282bc..f77af4c439 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -41,7 +41,6 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIModeControlContainer; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.mainframe.cell.QuickEditorRegion; -import com.fr.design.report.fit.menupane.ReportFitAttrAction; import com.fr.design.mainframe.templateinfo.JWorkBookProcessInfo; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; @@ -58,6 +57,7 @@ import com.fr.design.preview.PagePreview; import com.fr.design.preview.ViewPreview; import com.fr.design.preview.WriteEnhancePreview; import com.fr.design.preview.WritePreview; +import com.fr.design.report.fit.menupane.ReportFitAttrAction; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.selection.QuickEditor; @@ -68,7 +68,6 @@ import com.fr.file.FILE; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; - import com.fr.general.ModuleContext; import com.fr.grid.Grid; import com.fr.grid.GridUtils; @@ -96,7 +95,9 @@ import com.fr.stable.project.ProjectConstants; import com.fr.web.controller.ViewRequestConstants; import com.fr.workspace.WorkContext; -import javax.swing.*; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JPanel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.FileOutputStream; @@ -351,7 +352,7 @@ public class JWorkBook extends JTemplate { return parameterPane.getParaDesigner().getEastUpPane(); } if (delegate4ToolbarMenuAdapter() instanceof PolyDesigner) { - return ((PolyDesigner) delegate4ToolbarMenuAdapter()).getEastUpPane(); + return delegate4ToolbarMenuAdapter().getEastUpPane(); } else { ElementCasePane casePane = ((ReportComponent) delegate4ToolbarMenuAdapter()).elementCasePane; if (casePane != null) { @@ -370,7 +371,7 @@ public class JWorkBook extends JTemplate { if (((PolyDesigner) delegate4ToolbarMenuAdapter()).getSelectionType() == PolyDesigner.SelectionType.NONE) { return new JPanel(); } else { - return ((PolyDesigner) delegate4ToolbarMenuAdapter()).getEastDownPane(); + return delegate4ToolbarMenuAdapter().getEastDownPane(); } } else { ElementCasePane casePane = ((ReportComponent) delegate4ToolbarMenuAdapter()).elementCasePane; @@ -634,11 +635,10 @@ public class JWorkBook extends JTemplate { */ @Override public ShortCut[] shortcut4FileMenu() { - boolean showWorkBookExportMenu = DesignerMode.isVcsMode() + boolean hideWorkBookExportMenu = DesignerMode.isVcsMode() || DesignerMode.isAuthorityEditing(); -// || !WorkContext.getCurrent().isLocal(); - return (ShortCut[]) ArrayUtils.addAll(super.shortcut4FileMenu(), - showWorkBookExportMenu ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()} + return ArrayUtils.addAll(super.shortcut4FileMenu(), + hideWorkBookExportMenu ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()} ); } @@ -649,7 +649,7 @@ public class JWorkBook extends JTemplate { */ @Override public MenuDef[] menus4Target() { - return (MenuDef[]) ArrayUtils.addAll( + return ArrayUtils.addAll( super.menus4Target(), this.delegate4ToolbarMenuAdapter().menus4Target() ); } @@ -695,7 +695,7 @@ public class JWorkBook extends JTemplate { */ @Override public ShortCut[] shortcut4TemplateMenu() { - return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{ + return ArrayUtils.addAll(new ShortCut[]{ new ReportWebAttrAction(this), new ReportExportAttrAction(this), new ReportParameterAction(this), @@ -925,7 +925,7 @@ public class JWorkBook extends JTemplate { */ @Override public void previewMenuActionPerformed(PreviewProvider provider) { - super.previewMenuActionPerformed(provider); + super.previewMenuActionPerformed(provider); } /** From 7acfea2e3c85414186204ae604747e56a1b6df91 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 19 Nov 2018 15:58:34 +0800 Subject: [PATCH 16/44] =?UTF-8?q?=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E5=90=8E=E7=BC=80=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/file/export/EmbeddedFormExportExportAction.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java index 0056710e4c..6f57422768 100644 --- a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java @@ -12,7 +12,6 @@ import com.fr.file.filter.ChooseFileFilter; import com.fr.form.main.Form; import com.fr.io.exporter.DesignExportType; import com.fr.stable.ArrayUtils; -import com.fr.stable.project.ProjectConstants; import java.util.HashMap; import java.util.Map; @@ -40,7 +39,7 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction @Override protected String getDefaultExtension() { - return ProjectConstants.FRM_SUFFIX; + return getEditingComponent().suffix().substring(1); } @Override From 8a78af67907265a383f928ea13402e89998a6c85 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 19 Nov 2018 16:10:56 +0800 Subject: [PATCH 17/44] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/export/AbstractExportAction.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java index cbe3a1aea0..0105d7f958 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -14,6 +14,7 @@ import com.fr.io.exporter.DesignExportType; import com.fr.log.FineLoggerFactory; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; +import com.fr.third.jodd.io.FileNameUtil; import com.fr.workspace.WorkContext; import com.fr.workspace.server.exporter.TemplateExportOperator; @@ -115,12 +116,8 @@ public abstract class AbstractExportAction> extends JT private String getTargetFileName() { FILE source = getSource(); - // 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc String fileName = source.getName(); - if (fileName.indexOf('.') != -1) { - fileName = fileName.substring(0, fileName.lastIndexOf('.')); - } - return fileName; + return FileNameUtil.removeExtension(fileName); } private boolean processNotSaved() { From 8722af6cbf9995a779b5a84c5ff06e5785fc5340 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 19 Nov 2018 16:34:22 +0800 Subject: [PATCH 18/44] =?UTF-8?q?REPORT-12391=20=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E7=AB=AF=E5=8F=A3=E5=8F=B7=E5=8F=AF=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=3D>=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GlobalNativePrintSettingPane.java | 49 ++++++++++++++----- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java index 82a4ff3f2d..4b30458e65 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java @@ -3,35 +3,39 @@ package com.fr.design.webattr.printsettings; import com.fr.base.print.NativePrintAttr; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UIIntNumberField; +import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; +import com.sun.jna.Native; import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.Component; +import java.awt.FlowLayout; /** * 本地打印设置面板——全局 * Created by plough on 2018/10/31. */ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane { + private static final int PRINT_PORT_FIELD_COLUMNS = 8; + // 服务器配置面板特有的组件 private UICheckBox defaultDownloadUrlCheck; // 采用默认的软件下载地址 private UITextField customUrlFieldWin; private UITextField customUrlFieldMac; + private UINumberField printPortField; // 打印软件端口号 @Override JPanel createHeaderPane(Component... comps) { - - Component[] newComps = { - getDownloadUrlSettingPane() - }; - Component[] allComps = new Component[comps.length + newComps.length]; + Component[] allComps = new Component[comps.length + 1]; System.arraycopy(comps, 0, allComps, 0, comps.length); - System.arraycopy(newComps, 0, allComps, comps.length, newComps.length); + allComps[comps.length] = getExtraSettingPane(); JPanel headerPane = GUICoreUtils.createHeaderLayoutPane(allComps); headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 5, 0)); @@ -48,6 +52,7 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane nativePrintAttr.setCustomDownloadUrlMac(customUrlFieldMac.getText()); nativePrintAttr.setCustomDownloadUrlWin(customUrlFieldWin.getText()); } + nativePrintAttr.setPrintPort((int) printPortField.getValue()); } @Override @@ -55,21 +60,43 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane defaultDownloadUrlCheck.setSelected(nativePrintAttr.isUseDefaultDownloadUrl()); customUrlFieldMac.setText(nativePrintAttr.getCustomDownloadUrlMac()); customUrlFieldWin.setText(nativePrintAttr.getCustomDownloadUrlWin()); + printPortField.setValue(nativePrintAttr.getPrintPort()); } - private JPanel getDownloadUrlSettingPane() { + // 服务器配置中,特有的设置面板 + private JPanel getExtraSettingPane() { + // 软件下载地址 defaultDownloadUrlCheck = GUICoreUtils.createNoBorderCheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); JPanel downloadUrlSettingCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(defaultDownloadUrlCheck, getCustomUrlSettingPane(), true); downloadUrlSettingCheckPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + JPanel downloadTipPane = getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Software_Download_Url") + ": "); + downloadTipPane.setBorder(BorderFactory.createEmptyBorder(0, 0, -6, 0)); + + // 打印软件端口号 + UILabel printPortTip = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Native_Print_Port") + ": "); + JPanel printPortFiledPane = getPrintPortFieldPane(); // TableLayout double p = TableLayout.PREFERRED; - double[] rowSize = {p}; + double[] rowSize = {p, p}; double[] columnSize = {p, p}; Component[][] components = { - {getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Software_Download_Url") + ": "), downloadUrlSettingCheckPane} + { + downloadTipPane, downloadUrlSettingCheckPane + }, { + printPortTip, printPortFiledPane + } }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 15); + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); + } + + private JPanel getPrintPortFieldPane() { + printPortField = new UIIntNumberField(); + printPortField.setMaxValue(NativePrintAttr.MAX_PRINT_PORT_VALUE); + printPortField.setColumns(PRINT_PORT_FIELD_COLUMNS); + JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + panel.add(printPortField); + return panel; } private JPanel getCustomUrlSettingPane() { @@ -85,7 +112,7 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane {new UILabel("macOS: "), customUrlFieldMac} }; JPanel urlSettingPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10); - urlSettingPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); + urlSettingPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); return urlSettingPane; } } From 9306bb26b13add61188c936e18630c6340fba444 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 19 Nov 2018 16:35:53 +0800 Subject: [PATCH 19/44] =?UTF-8?q?REPORT-12391=20=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E7=AB=AF=E5=8F=A3=E5=8F=B7=E5=8F=AF=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=3D>=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webattr/printsettings/GlobalNativePrintSettingPane.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java index 4b30458e65..7b3643899a 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java @@ -10,12 +10,10 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; -import com.sun.jna.Native; import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.Component; -import java.awt.FlowLayout; /** * 本地打印设置面板——全局 From 1516847f4958eab30cecedc30f77c6c3fd46d613 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 19 Nov 2018 16:41:29 +0800 Subject: [PATCH 20/44] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/layout/FRGUIPaneFactory.java | 11 -------- .../ui/MobileTemplateStyleDefinePane.java | 8 +++--- .../widget/MobileTabFontConfPane.java | 5 ++-- .../mainframe/widget/UITitleSplitLine.java | 25 +++---------------- .../com/fr/design/utils/gui/GUICoreUtils.java | 12 +++++++++ 5 files changed, 22 insertions(+), 39 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java b/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java index 09eaad466b..db48cf9950 100644 --- a/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java @@ -251,17 +251,6 @@ public class FRGUIPaneFactory { return jp; } - - /** - * 创建一个靠左流式布局,流式内嵌 - * - * @return JPanel对象 - */ - public static JPanel createBoxFlowInnerContainerPane(int hgap, int vgap) { - JPanel jp = new JPanel(); - jp.setLayout(new FlowLayout(FlowLayout.LEFT, hgap, vgap)); - return jp; - } /** * 创建一个靠左流式布局,流式内嵌,首元素距离左边0 * diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java index a1d487ab7f..ae55b79719 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java @@ -34,13 +34,13 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane { + private static final String[] TAB_STYLES = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom")}; private UIComboBox custom; protected NewColorSelectBox initialColorBox; protected MobileTabFontConfPane fontConfPane; private JPanel centerPane; protected MobileTemplatePreviewPane previewPane; - private static final String[] TAB_STYLES = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom")}; private WCardTagLayout tagLayout; @@ -142,7 +142,7 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane Date: Mon, 19 Nov 2018 19:46:04 +0800 Subject: [PATCH 21/44] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/DefaultMobileStyleDefinePane.java | 4 ++- .../mobile/ui/DownMenuStyleDefinePane.java | 35 ++++++++++++++----- .../ui/MobileTemplateStyleDefinePane.java | 13 ++++--- .../mobile/ui/SliderStyleDefinePane.java | 33 ++++++++++++----- .../mobile/ui/UpMenuStyleDefinePane.java | 17 +++++++-- 5 files changed, 74 insertions(+), 28 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java index b42f1a6cee..d397c8d529 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -80,11 +80,13 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane WCardTagLayout cardTagLayout = DefaultMobileStyleDefinePane.this.getTagLayout(); int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); g2d.setFont(frFont); + int fontHeight = fm.getHeight(); + int ascentHeight = fm.getAscent(); for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); String widgetName = cardSwitchButton.getText(); int width = fm.stringWidth(widgetName); - g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight) / 2); + g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); if (i == 0) { g2d.setStroke(new BasicStroke(2.0f)); g2d.drawLine(0, panelHeight - 1, eachWidth, panelHeight - 1); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java index b8f267e98c..a0184c9a84 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java @@ -5,6 +5,7 @@ import com.fr.base.IconManager; import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.widget.UITitleSplitLine; import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane; @@ -15,15 +16,18 @@ import com.fr.general.cardtag.mobile.DownMenuStyle; import com.fr.general.cardtag.mobile.LineDescription; import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.Stroke; import java.util.ArrayList; public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { @@ -36,6 +40,8 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { } protected void createExtraConfPane(JPanel centerPane) { + JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 0); + panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20)); UITitleSplitLine iconSplitLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon"), 520); iconSplitLine.setPreferredSize(new Dimension(520, 20)); centerPane.add(iconSplitLine); @@ -51,8 +57,8 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { JPanel selectIconContainePane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectIconLabel, selectIconConfigPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); initIconContainPane.setPreferredSize(new Dimension(240, 50)); selectIconContainePane.setPreferredSize(new Dimension(240, 50)); - centerPane.add(initIconContainPane); - centerPane.add(selectIconContainePane); + panel.add(initIconContainPane); + panel.add(selectIconContainePane); UITitleSplitLine splitLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Spit_Line"), 520); splitLine.setPreferredSize(new Dimension(520, 20)); splitLinePane = new LinePane(); @@ -62,6 +68,7 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { updatePreviewPane(); } }); + centerPane.add(panel); centerPane.add(splitLine); centerPane.add(splitLinePane); } @@ -122,8 +129,10 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { } public class DownMenuStylePreviewPane extends MobileTemplatePreviewPane { - private LineDescription splitLine; + private static final int ICON_OFFSET = 16; + private static final int GAP = 6; private static final String PAINT_ICON = "fund_white"; + private LineDescription splitLine; public DownMenuStylePreviewPane() { this.setBackground(Color.decode("#3888EE")); @@ -145,21 +154,31 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = DownMenuStyleDefinePane.this.getTagLayout(); int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); + g2d.setFont(frFont); + int fontHeight = fm.getHeight(); + int ascent = fm.getAscent(); for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { - g2d.setFont(frFont); + g2d.setColor(i == 0 ? selectFontColor : frFont.getForeground()); CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); String widgetName = cardSwitchButton.getText(); int width = fm.stringWidth(widgetName); + if(i == 0){ + Color oldColor = g2d.getColor(); + g2d.setColor(this.getSelectColor()); + g2d.fillRect(0, 0 ,eachWidth, panelHeight); + g2d.setColor(oldColor); + } String iconName = PAINT_ICON; - g2d.drawImage(IconManager.getIconManager().getIconImage(iconName), (eachWidth - 18) / 2, 6, null); - g2d.drawString(widgetName, (eachWidth - width) / 2, panelHeight / 2 + 9); + g2d.drawImage(IconManager.getIconManager().getIconImage(iconName), (eachWidth - ICON_OFFSET) / 2, (panelHeight - ICON_OFFSET - GAP - fontHeight) / 2, null); + g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight + ICON_OFFSET + GAP - fontHeight) / 2 + ascent); + Stroke oldStroke = g2d.getStroke(); if (splitLine.getLineStyle() != 0) { g2d.setColor(splitLine.getColor()); - + g2d.setStroke(GraphHelper.getStroke(splitLine.getLineStyle())); g2d.drawLine(eachWidth, 0, eachWidth, panelHeight); } - + g2d.setStroke(oldStroke); g2d.translate(eachWidth, 0); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java index ae55b79719..9f5809f927 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java @@ -142,13 +142,12 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane Date: Mon, 19 Nov 2018 20:07:29 +0800 Subject: [PATCH 22/44] =?UTF-8?q?REPORT-12593=2010.0=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E5=86=85=E5=AE=B9=E5=A4=8D=E9=80=89?= =?UTF-8?q?=E6=A1=86=E5=A4=B1=E6=95=88=20=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E9=9D=A2=E6=9D=BF=E7=9A=84=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E9=82=A3=E4=B8=AAcheckbox=E7=9A=84?= =?UTF-8?q?=E5=80=BC=E6=B2=A1=E6=9C=89=E6=AD=A3=E7=A1=AE=E7=9A=84=E8=A2=AB?= =?UTF-8?q?set=E5=88=B0CellGUIAttr=EF=BC=8C=E5=AF=BC=E8=87=B4=E5=80=BC?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=A2=ABwrite=E5=88=B0=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/cell/settingpane/CellOtherSetPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java index 814a4ebeca..4ac2aab9b0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java @@ -427,7 +427,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { } } - if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preview"))) { + if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))) { cellGUIAttr.setPreviewContent(previewCellContent.isSelected()); } From 795c9d1e0a04a574ab8eb7ec809f44ae236afccb Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Mon, 19 Nov 2018 20:11:58 +0800 Subject: [PATCH 23/44] =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=9D=A2=E6=9D=BF=E7=9A=84=E9=A2=84=E8=A7=88=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=A0=BC=E9=82=A3=E4=B8=AAcheckbox=E7=9A=84=E5=80=BC?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=AD=A3=E7=A1=AE=E7=9A=84=E8=A2=ABset?= =?UTF-8?q?=E5=88=B0CellGUIAttr=EF=BC=8C=E5=AF=BC=E8=87=B4=E5=80=BC?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=A2=ABwrite=E5=88=B0=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/cell/settingpane/CellOtherSetPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java index 814a4ebeca..4ac2aab9b0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java @@ -427,7 +427,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { } } - if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preview"))) { + if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))) { cellGUIAttr.setPreviewContent(previewCellContent.isSelected()); } From 84dd9246f0fec0aa879ce00a7edc5c1cb48c96c9 Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 20 Nov 2018 10:06:12 +0800 Subject: [PATCH 24/44] =?UTF-8?q?REPORT-10535=20=E7=95=8C=E9=9D=A2ui?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../accessibles/MobileTemplateStylePane.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java index f88221a42b..98309819d1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java @@ -26,12 +26,12 @@ import java.util.List; import java.util.Map; public class MobileTemplateStylePane extends AbstractTemplateStylePane { - private static final List STYLE_LIST = new ArrayList(); + private static final List STYLE_LIST = new ArrayList(); static { - STYLE_LIST.add(DefaultMobileTemplateStyle.STYLE_NAME); - STYLE_LIST.add(UpMenuStyle.STYLE_NAME); - STYLE_LIST.add(DownMenuStyle.STYLE_NAME); - STYLE_LIST.add(SliderStyle.STYLE_NAME); + STYLE_LIST.add(new DefaultMobileTemplateStyle()); + STYLE_LIST.add(new UpMenuStyle()); + STYLE_LIST.add(new DownMenuStyle()); + STYLE_LIST.add(new SliderStyle()); } private DefaultListModel listModel; @@ -49,11 +49,11 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane styleBasicBeanPane = TemplateStyleDefinePaneFactory.createDefinePane(style, tagLayout); - map.put(style, styleBasicBeanPane); - right.add(style, styleBasicBeanPane); + for(MobileTemplateStyle style : STYLE_LIST){ + listModel.addElement(style.toString()); + BasicBeanPane styleBasicBeanPane = TemplateStyleDefinePaneFactory.createDefinePane(style.getStyle(), tagLayout); + map.put(style.toString(), styleBasicBeanPane); + right.add(style.toString(), styleBasicBeanPane); } styleList = new JList(listModel); styleList.setCellRenderer(render); @@ -97,10 +97,10 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane Date: Tue, 20 Nov 2018 10:15:42 +0800 Subject: [PATCH 25/44] =?UTF-8?q?REPORT-12788=20=E7=BD=91=E7=BB=9C?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=AF=B9=E8=AF=9D=E6=A1=86=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=92=8C=E5=85=AC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hyperlink/ReportletHyperNorthPane.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java index 5d67800b76..c1ebb62322 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java @@ -23,6 +23,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.IOUtils; import com.fr.js.ReportletHyperlink; import com.fr.js.ReportletHyperlinkDialogAttr; +import com.fr.stable.CommonUtils; import com.fr.stable.FormulaProvider; import com.fr.stable.StringUtils; @@ -191,8 +192,13 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane Date: Tue, 20 Nov 2018 10:44:50 +0800 Subject: [PATCH 26/44] =?UTF-8?q?=E9=99=90=E5=88=B6=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E8=B4=9F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/hyperlink/ReportletHyperNorthPane.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java index c1ebb62322..d6a50a84c9 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java @@ -370,6 +370,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane Date: Tue, 20 Nov 2018 11:31:36 +0800 Subject: [PATCH 27/44] =?UTF-8?q?REPORT-12622=20=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=94=AF=E6=8C=81=E6=89=AB=E7=A0=81=20ui?= =?UTF-8?q?=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/WidgetMobilePaneFactory.java | 3 + .../widget/ui/mobile/ScanCodeMobilePane.java | 64 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java diff --git a/designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java b/designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java index 8b9afc3f22..5d995ddad2 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java +++ b/designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java @@ -4,7 +4,9 @@ import com.fr.base.FRContext; import com.fr.design.ExtraDesignClassManager; import com.fr.design.widget.mobile.WidgetMobilePane; import com.fr.design.widget.ui.mobile.MultiFileEditorMobilePane; +import com.fr.design.widget.ui.mobile.ScanCodeMobilePane; import com.fr.form.ui.MultiFileEditor; +import com.fr.form.ui.TextEditor; import com.fr.form.ui.Widget; import java.util.HashMap; @@ -18,6 +20,7 @@ public class WidgetMobilePaneFactory { static { mobilePaneMap.put(MultiFileEditor.class, MultiFileEditorMobilePane.class); + mobilePaneMap.put(TextEditor.class, ScanCodeMobilePane.class); mobilePaneMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetMobileOptionsMap()); } diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java new file mode 100644 index 0000000000..8fd0fc88cc --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java @@ -0,0 +1,64 @@ +package com.fr.design.widget.ui.mobile; + +import com.fr.base.mobile.MobileScanCodeAttr; +import com.fr.base.mobile.ScanCodeState; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.widget.mobile.WidgetMobilePane; +import com.fr.form.ui.TextEditor; +import com.fr.form.ui.Widget; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; + +public class ScanCodeMobilePane extends WidgetMobilePane { + + private UICheckBox appScanCodeCheck; + + protected void init() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.add(getMobileSettingPane(), BorderLayout.NORTH); + } + + private UIExpandablePane getMobileSettingPane() { + JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + appScanCodeCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Support_Scan_Code"), true); + appScanCodeCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); + panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + panel.add(appScanCodeCheck); + final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); + panelWrapper.add(panel, BorderLayout.NORTH); + return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, panelWrapper); + } + + @Override + public void populate(Widget widget) { + MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr(); + ScanCodeState scanCodeState = mobileScanCodeAttr.getScanCodeState(); + appScanCodeCheck.setSelected(scanCodeState2boolean(scanCodeState)); + } + + @Override + public void update(Widget widget) { + MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr(); + mobileScanCodeAttr.setScanCodeState(boolean2ScanCodeState(appScanCodeCheck.isSelected())); + } + + private ScanCodeState boolean2ScanCodeState(boolean scanCodeCheck) { + if (scanCodeCheck) { + return ScanCodeState.SUPPORT_SCAN_CODE; + } else { + return ScanCodeState.NOT_SUPPORT_SCAN_CODE; + } + } + + private boolean scanCodeState2boolean(ScanCodeState scanCodeState) { + if (scanCodeState == ScanCodeState.SUPPORT_SCAN_CODE) { + return true; + } else { + return false; + } + } +} From 90fbfa525daa762e063a4332da9b5b8ce782e1e0 Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 20 Nov 2018 12:34:58 +0800 Subject: [PATCH 28/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=B8=AASB?= =?UTF-8?q?=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java index 8fd0fc88cc..586501e7bc 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java @@ -55,10 +55,6 @@ public class ScanCodeMobilePane extends WidgetMobilePane { } private boolean scanCodeState2boolean(ScanCodeState scanCodeState) { - if (scanCodeState == ScanCodeState.SUPPORT_SCAN_CODE) { - return true; - } else { - return false; - } + return scanCodeState == ScanCodeState.SUPPORT_SCAN_CODE; } } From 695aea46b367e73e9c355e61d86fc5ee7a61602d Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 20 Nov 2018 13:55:00 +0800 Subject: [PATCH 29/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9enum=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/mobile/ScanCodeMobilePane.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java index 586501e7bc..e9c798ec95 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java @@ -37,24 +37,14 @@ public class ScanCodeMobilePane extends WidgetMobilePane { public void populate(Widget widget) { MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr(); ScanCodeState scanCodeState = mobileScanCodeAttr.getScanCodeState(); - appScanCodeCheck.setSelected(scanCodeState2boolean(scanCodeState)); + appScanCodeCheck.setSelected(scanCodeState.getState()); } @Override public void update(Widget widget) { MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr(); - mobileScanCodeAttr.setScanCodeState(boolean2ScanCodeState(appScanCodeCheck.isSelected())); + mobileScanCodeAttr.setScanCodeState(ScanCodeState.parse(appScanCodeCheck.isSelected())); } - private ScanCodeState boolean2ScanCodeState(boolean scanCodeCheck) { - if (scanCodeCheck) { - return ScanCodeState.SUPPORT_SCAN_CODE; - } else { - return ScanCodeState.NOT_SUPPORT_SCAN_CODE; - } - } - private boolean scanCodeState2boolean(ScanCodeState scanCodeState) { - return scanCodeState == ScanCodeState.SUPPORT_SCAN_CODE; - } } From bf21ec926a5cb098fcc9ec6601ffd840684be608 Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 20 Nov 2018 17:55:34 +0800 Subject: [PATCH 30/44] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../accessibles/MobileTemplateStylePane.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java index 98309819d1..73a8935dca 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java @@ -4,11 +4,8 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.mobile.ui.TemplateStyleDefinePaneFactory; import com.fr.form.ui.container.cardlayout.WCardTagLayout; -import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle; -import com.fr.general.cardtag.mobile.DownMenuStyle; import com.fr.general.cardtag.mobile.MobileTemplateStyle; -import com.fr.general.cardtag.mobile.SliderStyle; -import com.fr.general.cardtag.mobile.UpMenuStyle; +import com.fr.general.cardtag.mobile.MobileTemplateStyleType; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; import javax.swing.JList; @@ -26,12 +23,12 @@ import java.util.List; import java.util.Map; public class MobileTemplateStylePane extends AbstractTemplateStylePane { - private static final List STYLE_LIST = new ArrayList(); + private static final List STYLE_LIST = new ArrayList(); static { - STYLE_LIST.add(new DefaultMobileTemplateStyle()); - STYLE_LIST.add(new UpMenuStyle()); - STYLE_LIST.add(new DownMenuStyle()); - STYLE_LIST.add(new SliderStyle()); + STYLE_LIST.add(MobileTemplateStyleType.DEFAULT_STYLE); + STYLE_LIST.add(MobileTemplateStyleType.UP_MENU_STYLE); + STYLE_LIST.add(MobileTemplateStyleType.DOWN_MENU_STYLE); + STYLE_LIST.add(MobileTemplateStyleType.SLIDER_STYLE); } private DefaultListModel listModel; @@ -49,11 +46,11 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane styleBasicBeanPane = TemplateStyleDefinePaneFactory.createDefinePane(style.getStyle(), tagLayout); - map.put(style.toString(), styleBasicBeanPane); - right.add(style.toString(), styleBasicBeanPane); + map.put(style.getDisplayName(), styleBasicBeanPane); + right.add(style.getDisplayName(), styleBasicBeanPane); } styleList = new JList(listModel); styleList.setCellRenderer(render); @@ -97,7 +94,9 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane Date: Tue, 20 Nov 2018 19:08:47 +0800 Subject: [PATCH 31/44] =?UTF-8?q?module=E4=BB=A3=E7=A0=81=E8=B4=A8?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/start/module/DesignerActivator.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index a674e1d50b..18b1eeab16 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -6,6 +6,7 @@ import com.fr.base.MultiFieldParameter; import com.fr.base.process.ProcessOperator; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.actions.NewFormAction; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.BiasCellAction; import com.fr.design.actions.insert.cell.ChartCellAction; @@ -42,7 +43,6 @@ import com.fr.design.mainframe.InformationCollector; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetToolBarPane; -import com.fr.design.actions.NewFormAction; import com.fr.design.mainframe.bbs.BBSGuestPane; import com.fr.design.mainframe.bbs.UserInfoPane; import com.fr.design.mainframe.form.FormECCompositeProvider; @@ -57,9 +57,9 @@ import com.fr.design.parameter.FormParameterReader; import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.parameter.WorkBookParameterReader; import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane; +import com.fr.form.module.FormBaseActivator; import com.fr.form.stable.ElementCaseThumbnailProcessor; import com.fr.form.ui.WidgetInfoConfig; -import com.fr.general.ModuleContext; import com.fr.general.xml.GeneralXMLTools; import com.fr.js.EmailJavaScript; import com.fr.js.JavaScriptImpl; @@ -89,6 +89,7 @@ import com.fr.report.cell.cellattr.core.SubReport; 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.report.module.ReportBaseActivator; import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.bridge.StableFactory; @@ -100,7 +101,7 @@ import com.fr.stable.xml.ObjectXMLWriterFinder; import com.fr.start.BBSGuestPaneProvider; import com.fr.xml.ReportXMLUtils; -import java.awt.*; +import java.awt.Image; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.List; @@ -108,8 +109,6 @@ import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import static com.fr.stable.module.Module.ENGINE_MODULE; - /** * Created by juhaoyu on 2018/1/31. * 触发原来的DesignerModule的启动 @@ -152,7 +151,7 @@ public class DesignerActivator extends Activator { } } - private static void designerModuleStart() { + private void designerModuleStart() { StableFactory.registerMarkedClass(ExtraDesignClassManagerProvider.XML_TAG, ExtraDesignClassManager.class); ActionFactory.registerCellInsertActionClass(actionsForInsertCellElement()); @@ -264,8 +263,9 @@ public class DesignerActivator extends Activator { * kunsnat: 一些模块信息 必须跟随设计器启动, * 比如 读取CC.XML, 设计器启动之后, 马上会读取XML, 需要Chart_Module中的注册信息 */ - private static void justStartModules4Engine() { - ModuleContext.startModule(ENGINE_MODULE); + private void justStartModules4Engine() { + startSub(ReportBaseActivator.class); + startSub(FormBaseActivator.class); } private static void justStartModules4Designer() { From 04011dbce2d4292f4df313936fae6aa14fbc9849 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Tue, 20 Nov 2018 20:33:53 +0800 Subject: [PATCH 32/44] =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/start/module/DesignerActivator.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 18b1eeab16..010435fbf2 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -57,7 +57,6 @@ import com.fr.design.parameter.FormParameterReader; import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.parameter.WorkBookParameterReader; import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane; -import com.fr.form.module.FormBaseActivator; import com.fr.form.stable.ElementCaseThumbnailProcessor; import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.xml.GeneralXMLTools; @@ -89,7 +88,6 @@ import com.fr.report.cell.cellattr.core.SubReport; 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.report.module.ReportBaseActivator; import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.bridge.StableFactory; @@ -158,7 +156,6 @@ public class DesignerActivator extends Activator { ActionFactory.registerFloatInsertActionClass(actionsForInsertFloatElement()); DesignModuleFactory.registerCreators4Hyperlink(hyperlinkTypes()); - justStartModules4Engine(); justStartModules4Designer(); CalculatorProviderContext.setValueConverter(valueConverter()); @@ -259,14 +256,6 @@ public class DesignerActivator extends Activator { }; } - /** - * kunsnat: 一些模块信息 必须跟随设计器启动, - * 比如 读取CC.XML, 设计器启动之后, 马上会读取XML, 需要Chart_Module中的注册信息 - */ - private void justStartModules4Engine() { - startSub(ReportBaseActivator.class); - startSub(FormBaseActivator.class); - } private static void justStartModules4Designer() { formDesignerRegister(); From 9a602342961e0d15f50f7244ef39670396a7375e Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 21 Nov 2018 10:33:35 +0800 Subject: [PATCH 33/44] =?UTF-8?q?=E9=80=82=E9=85=8D=E5=A4=9A=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/export/AbstractExportAction.java | 7 ++++--- .../file/export/EmbeddedFormExportExportAction.java | 8 ++++---- .../actions/file/export/AbstractWorkBookExportAction.java | 8 ++++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java index 0105d7f958..4d9c976ce9 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -9,6 +9,7 @@ import com.fr.design.mainframe.JTemplate; import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.file.FILE; import com.fr.file.FILEChooserPane; +import com.fr.io.exporter.ExporterKey; import com.fr.file.filter.ChooseFileFilter; import com.fr.io.exporter.DesignExportType; import com.fr.log.FineLoggerFactory; @@ -38,7 +39,7 @@ public abstract class AbstractExportAction> extends JT * * @return String scopeName */ - public abstract String exportScopeName(); + public abstract ExporterKey exportKey(); /** * 导出类型 @@ -209,11 +210,11 @@ public abstract class AbstractExportAction> extends JT // todo 后续想想办法 if (WorkContext.getCurrent().isLocal()) { WorkContext.getCurrent().get(TemplateExportOperator.class) - .export(exportScopeName(), exportType(), outputStream, path, para); + .export(exportKey(), exportType(), outputStream, path, para); } else { byte[] contents = WorkContext.getCurrent().get(TemplateExportOperator.class) - .export(exportScopeName(), exportType(), null, path, para); + .export(exportKey(), exportType(), null, path, para); outputStream.write(contents); } diff --git a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java index 6f57422768..cd5c29ced4 100644 --- a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java @@ -8,16 +8,16 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JForm; import com.fr.design.menu.KeySetUtils; import com.fr.design.parameter.ParameterInputPane; +import com.fr.io.exporter.ExporterKey; import com.fr.file.filter.ChooseFileFilter; import com.fr.form.main.Form; +import com.fr.io.exporter.DesignExportScope; import com.fr.io.exporter.DesignExportType; import com.fr.stable.ArrayUtils; import java.util.HashMap; import java.util.Map; -import static com.fr.io.exporter.DesignExportScope.FINE_FORM; - /** * Export Embedded. */ @@ -33,8 +33,8 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction } @Override - public String exportScopeName() { - return FINE_FORM.toString(); + public ExporterKey exportKey() { + return DesignExportScope.FINE_FORM; } @Override diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractWorkBookExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractWorkBookExportAction.java index bfec887440..22a4118208 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractWorkBookExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractWorkBookExportAction.java @@ -8,14 +8,14 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JWorkBook; import com.fr.design.parameter.ParameterInputPane; +import com.fr.io.exporter.ExporterKey; +import com.fr.io.exporter.DesignExportScope; import com.fr.main.TemplateWorkBook; import com.fr.main.impl.WorkBook; import java.util.HashMap; import java.util.Map; -import static com.fr.io.exporter.DesignExportScope.FINE_BOOK; - /** * Abstract export action. */ @@ -31,8 +31,8 @@ public abstract class AbstractWorkBookExportAction extends AbstractExportAction< return this.getEditingComponent().getTarget(); } - public String exportScopeName() { - return FINE_BOOK.toString(); + public ExporterKey exportKey() { + return DesignExportScope.FINE_BOOK; } @Override From 5442e99400376bf94c2718f43c39553527241229 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 21 Nov 2018 11:36:42 +0800 Subject: [PATCH 34/44] file extension --- .../file/export/EmbeddedFormExportExportAction.java | 5 +++-- .../actions/file/export/AbstractExcelExportAction.java | 10 ++++++---- .../file/export/EmbeddedExportExportAction.java | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java index cd5c29ced4..6d0fe9aa52 100644 --- a/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/file/export/EmbeddedFormExportExportAction.java @@ -2,17 +2,18 @@ package com.fr.design.actions.file.export; import com.fr.base.BaseUtils; import com.fr.base.Parameter; +import com.fr.base.extension.FileExtension; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JForm; import com.fr.design.menu.KeySetUtils; import com.fr.design.parameter.ParameterInputPane; -import com.fr.io.exporter.ExporterKey; import com.fr.file.filter.ChooseFileFilter; import com.fr.form.main.Form; import com.fr.io.exporter.DesignExportScope; import com.fr.io.exporter.DesignExportType; +import com.fr.io.exporter.ExporterKey; import com.fr.stable.ArrayUtils; import java.util.HashMap; @@ -71,6 +72,6 @@ public class EmbeddedFormExportExportAction extends AbstractExportAction @Override protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(new String[]{"frm"}, Toolkit.i18nText("Fine-Design_Form_EmbeddedTD")); + return new ChooseFileFilter(FileExtension.FRM.getExtensions(), Toolkit.i18nText("Fine-Design_Form_EmbeddedTD")); } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java index 44c32637bb..f51feb6b6a 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/AbstractExcelExportAction.java @@ -4,6 +4,7 @@ package com.fr.design.actions.file.export; import com.fr.base.ExcelUtils; +import com.fr.base.extension.FileExtension; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JWorkBook; import com.fr.file.filter.ChooseFileFilter; @@ -23,9 +24,10 @@ public abstract class AbstractExcelExportAction extends AbstractWorkBookExportAc protected ChooseFileFilter getChooseFileFilter() { TemplateWorkBook tpl = this.getTemplateWorkBook(); if (ReportUtils.hasLayerReport4Template(tpl)) { - return new ChooseFileFilter(new String[]{"zip"}, "ZIP"); + return new ChooseFileFilter(FileExtension.ZIP, "ZIP"); } else { - return new ChooseFileFilter(new String[]{"xls", "xlsx"}, Toolkit.i18nText("Fine-Design_Report_Export_Excel")); + return new ChooseFileFilter(new String[]{FileExtension.XLSX.getExtension(), FileExtension.XLS.getExtension()}, + Toolkit.i18nText("Fine-Design_Report_Export_Excel")); } } @@ -33,9 +35,9 @@ public abstract class AbstractExcelExportAction extends AbstractWorkBookExportAc protected String getDefaultExtension() { TemplateWorkBook tpl = this.getTemplateWorkBook(); if (ReportUtils.hasLayerReport4Template(tpl)) { - return "zip"; + return FileExtension.ZIP.getExtension(); } else { - return ExcelUtils.checkThirdJarSupportPOI() ? "xlsx" : "xls"; + return ExcelUtils.checkThirdJarSupportPOI() ? FileExtension.XLSX.getExtension() : FileExtension.XLS.getExtension(); } } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java index 9944142b72..25a6da3ad2 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/EmbeddedExportExportAction.java @@ -33,7 +33,7 @@ public class EmbeddedExportExportAction extends AbstractWorkBookExportAction { @Override protected String getDefaultExtension() { - return getEditingComponent().suffix().substring(1); + return FileExtension.CPT.getExtension(); } @Override From 1c2a3684b1c4ceb391a42f09712ea485f5bbce14 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 21 Nov 2018 18:42:49 +0800 Subject: [PATCH 35/44] TinyFormulaPane --- .../hyperlink/ReportletHyperNorthPane.java | 90 ++----------------- 1 file changed, 8 insertions(+), 82 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java index d6a50a84c9..c1e454f1b0 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java @@ -4,10 +4,7 @@ import com.fr.base.BaseFormula; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.event.UIObserverListener; -import com.fr.design.formula.FormulaFactory; -import com.fr.design.formula.UIFormula; -import com.fr.design.formula.VariableResolver; +import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; @@ -20,7 +17,6 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.IOUtils; import com.fr.js.ReportletHyperlink; import com.fr.js.ReportletHyperlinkDialogAttr; import com.fr.stable.CommonUtils; @@ -77,7 +73,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane dialogComponents) { // 对话框标题 - titleFiled = new JFormulaField(15); + titleFiled = new TinyFormulaPane(); + titleFiled.getUITextField().setColumns(15); final JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); titlePanel.add(titleFiled); Component[] titleComponents = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Title") + ":"), titlePanel}; @@ -450,75 +447,4 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane Date: Thu, 22 Nov 2018 15:23:42 +0800 Subject: [PATCH 36/44] =?UTF-8?q?REPORT-12885=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E9=B8=A3=E8=B0=A2=E5=90=8D=E5=8D=95SiteCenter?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/bbs/BBSConstants.java | 34 ++++++++++++--- .../main/java/com/fr/start/SplashContext.java | 41 +++++++++++++++---- 2 files changed, 60 insertions(+), 15 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java index bb600b1cef..5e12f224f9 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java @@ -26,29 +26,51 @@ public class BBSConstants { private static Properties PROP = null; + /** + * 获取所有的感谢对象,无法获取在线使用默认 + * @return 感谢对象的数组 + */ public static String[] getAllGuest() { return loadAllGuestsInfoOnline(GUEST_KEY_ONLINE, loadAllGuestsInfo(GUEST_KEY)); } + /** + * 获取所有的链接,无法获取在线使用默认 + * @return 链接的数组 + */ public static String[] getAllLink() { return loadAllGuestsInfoOnline(LINK_KEY_ONLINE, loadAllGuestsInfo(LINK_KEY)); } - //加载所有用户的信息, 用户名, 论坛连接 + /** + * 获取所有的感谢对象,手动选择策略 + * @return 感谢对象的数组 + */ + public static String[] getAllGuestManual(boolean isOnline) { + String guest; + if (isOnline) { + guest = CloudCenter.getInstance().acquireUrlByKind(GUEST_KEY_ONLINE, StringUtils.EMPTY); + } else { + guest = loadAllGuestsInfo(GUEST_KEY); + } + if (StringUtils.isNotEmpty(guest)) { + return guest.split("\\|"); + } + return new String[0]; + } + private static String loadAllGuestsInfo(String key) { return loadAttribute(key, StringUtils.EMPTY); } - //加载所有用户的信息, 用户名, 论坛连接 private static String[] loadAllGuestsInfoOnline(String key, String defaultValue) { - String[] allGuests = new String[0]; String guest = CloudCenter.getInstance().acquireUrlByKind(key, defaultValue); if (StringUtils.isNotEmpty(guest)) { - allGuests = guest.split("\\|"); + return guest.split("\\|"); } - return allGuests; + return new String[0]; } - + //如果要定制, 直接改bbs.properties就行了 private static String loadAttribute(String key, String defaultValue) { if (PROP == null) { diff --git a/designer-realize/src/main/java/com/fr/start/SplashContext.java b/designer-realize/src/main/java/com/fr/start/SplashContext.java index 3eb3ac1059..2e5467557c 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -24,6 +24,7 @@ public class SplashContext { public static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif"; public static final String SPLASH_CACHE_NAME = "splash_10.gif"; + private static final int FETCH_ONLINE_MAX_TIMES = 10; private static final SplashContext SPLASH_CONTEXT = new SplashContext(); @@ -33,7 +34,8 @@ public class SplashContext { private int loadingIndex = 0; private String[] loading = new String[]{"..", "....", "......"}; - private static final String GUEST = getRandomUser(); + private int fetchOnlineTimes = 0; + private String guest = StringUtils.EMPTY; private ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); @@ -81,6 +83,7 @@ public class SplashContext { scheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { + showThanks(); loadingIndex++; updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); } @@ -90,7 +93,6 @@ public class SplashContext { @Override public void on(Event event, String i18n) { - showThanks(); moduleID = i18n; loadingIndex++; updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); @@ -110,21 +112,42 @@ public class SplashContext { /** * 获取随机感谢人员 */ - private static String getRandomUser() { - String[] allGuest = BBSConstants.getAllGuest(); - if (allGuest.length == 0) { - return StringUtils.EMPTY; - } + private String getRandomUser(String[] allGuest) { int num = new Random().nextInt(allGuest.length); return StringUtils.BLANK + allGuest[num]; } /** - * 展示感谢信息 + * 尝试获取在线资源,达到尝试上限之后使用默认值 + */ + private void tryFetchOnline() { + if (StringUtils.isNotEmpty(guest)) { + return; + } + String[] allGuest; + if (fetchOnlineTimes < FETCH_ONLINE_MAX_TIMES) { + allGuest = BBSConstants.getAllGuestManual(true); + if (allGuest.length == 0) { + fetchOnlineTimes++; + return; + } + } else { + allGuest = BBSConstants.getAllGuestManual(false); + } + guest = getRandomUser(allGuest); + } + + /** + * 展示感谢信息。这里场景是优先使用在线名单, + * 甚至可以因此可以延迟几秒显示。目前是尝试 + * 获取10次在线资源,最大时间3秒 */ private void showThanks() { if (shouldShowThanks()) { - updateThanksLog(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Thanks_To") + GUEST); + tryFetchOnline(); + if (StringUtils.isNotEmpty(guest)) { + updateThanksLog(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Thanks_To") + guest); + } } } From 95c13ac159231d83db13415f9a2d148d3ac7b714 Mon Sep 17 00:00:00 2001 From: Hades Date: Thu, 22 Nov 2018 15:52:08 +0800 Subject: [PATCH 37/44] REPORT-11842 on/ExportTypeNotFoundException.java --- .../designer/mobile/ParaMobileDefinePane.java | 159 +++++++++++++++++- 1 file changed, 158 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java index c7b2ed5981..8b0aec95f5 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java @@ -1,22 +1,46 @@ package com.fr.design.widget.ui.designer.mobile; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.properties.PropertyTab; +import com.fr.design.designer.properties.items.Item; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.fun.ParameterExpandablePaneUIProvider; import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.MobileWidgetListPane; import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WSortLayout; +import com.fr.general.ComparatorUtils; +import com.fr.general.SiteCenter; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; +import com.fr.report.ExtraReportClassManager; +import com.fr.report.fun.LocationAttrProvider; +import com.fr.report.fun.impl.AbstractLocationAttrProvider; + import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Desktop; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.net.URI; import java.util.Set; /** @@ -25,6 +49,8 @@ import java.util.Set; public class ParaMobileDefinePane extends MobileWidgetDefinePane { private XCreator paraCreator; private FormDesigner designer; + private Item[] items; + private UIComboBox paramLocationComboBox; private AttributeChangeListener changeListener; private MobileWidgetListPane mobileWidgetListPane; @@ -36,6 +62,7 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { public void initPropertyGroups(Object source) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + this.add(getMobilePropertyPane(), BorderLayout.NORTH); this.add(getMobileWidgetListPane(), BorderLayout.CENTER); this.addExtraUIExpandablePaneFromPlugin(); this.repaint(); @@ -54,6 +81,121 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { this.add(panel, BorderLayout.SOUTH); } + // 手机属性 + private UIExpandablePane getMobilePropertyPane() { + paramLocationComboBox = getParamLocationComboBox(); + UILabel tipLabel = getTipLabel(); + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1}, {1, 1}}; + if (ExtraReportClassManager.getInstance().getArray(LocationAttrProvider.MARK_STRING).size() != 0) { + tipLabel = null; + } else { + ((WParameterLayout) (paraCreator.toData())).setProvider((LocationAttrProvider) ((Item) paramLocationComboBox.getItemAt(0)).getValue()); + } + Component[][] components = new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Parameter_Panel")), paramLocationComboBox}, + new Component[]{tipLabel, null}, + }; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + jPanel.add(panel); + return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Properties_Mobile"), 280, 20, jPanel); + } + + private Item[] getItems() { + Set pluginCreators = ExtraReportClassManager.getInstance().getArray(LocationAttrProvider.MARK_STRING); + Item[] items = new Item[pluginCreators.size() + 1]; + LocationAttrProvider provider = getDefaultLocationAttr(); + items[0] = new Item(provider.descriptor(), provider); + for (int i = 0; i < pluginCreators.size(); i++) { + provider = pluginCreators.iterator().next(); + items[i + 1] = new Item(provider.descriptor(), provider); + } + return items; + } + + private UILabel getTipLabel() { + UILabel tipLabel = new UILabel(); + String[] strings = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Properties_Mobile_Tip").split("\\|"); + StringBuilder text = new StringBuilder(); + text.append("").append(strings[0]) + .append("").append(strings[1]) + .append("").append(strings[2]) + .append(""); + tipLabel.setText(text.toString()); + tipLabel.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + try { + //todo 添加对应插件下载地址 + Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("plugin.download"))); + } catch (Exception exp) { + + } + } + @Override + public void mouseEntered(MouseEvent e) { + Object source = e.getSource(); + if (source instanceof UILabel) { + ((UILabel) source).setCursor(new Cursor(Cursor.HAND_CURSOR)); + } + } + @Override + public void mouseExited(MouseEvent e) { + Object source = e.getSource(); + if (source instanceof UILabel) { + ((UILabel) source).setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); + } + } + @Override + public void mouseMoved(MouseEvent e) { + Object source = e.getSource(); + if (source instanceof UILabel) { + ((UILabel) source).setCursor(new Cursor(Cursor.HAND_CURSOR)); + } + } + }); + return tipLabel; + } + + private UIComboBox getParamLocationComboBox() { + items = getItems(); + UIComboBox paramLocationComoBox = new UIComboBox(items); + paramLocationComoBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + ((WParameterLayout) (paraCreator.toData())).setProvider((LocationAttrProvider) ((Item) e.getItem()).getValue()); + } + } + }); + return paramLocationComoBox; + } + + private LocationAttrProvider getDefaultLocationAttr() { + return new AbstractLocationAttrProvider() { + @Override + public String descriptor() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"); + } + + @Override + public JSONObject createJSON() { + JSONObject jo = JSONObject.create(); + try { + jo.put("queryType", "default"); + } catch (JSONException e) { + + } + return jo; + } + }; + } + // 控件顺序 private UIExpandablePane getMobileWidgetListPane() { mobileWidgetListPane = new MobileWidgetListPane(designer, (WSortLayout) paraCreator.toData()); @@ -85,10 +227,25 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { @Override public void populate(FormDesigner designer) { this.designer = designer; - // 设置监听 this.bindListeners2Widgets(); this.addAttributeChangeListener(changeListener); + int index = 0; + try { + LocationAttrProvider provider = ((WParameterLayout) paraCreator.toData()).getProvider(); + String currentQueryType = provider.createJSON().getString("queryType"); + for (int i = 0; i < items.length; i++) { + String existedQueryType = ((LocationAttrProvider) items[i].getValue()).createJSON().getString("queryType"); + if (ComparatorUtils.equals(existedQueryType, currentQueryType)) { + index = i; + break; + } + } + } catch (JSONException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + paramLocationComboBox.setSelectedIndex(index); + } @Override From 719ca5ac3ab2cb2f581bf8c9e2e9bcb75c719c8d Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 23 Nov 2018 12:44:41 +0800 Subject: [PATCH 38/44] =?UTF-8?q?ui=E9=83=A8=E5=88=86=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/mobile/ParaMobileDefinePane.java | 47 +++++-------------- 1 file changed, 12 insertions(+), 35 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java index 8b0aec95f5..7e0f3b940a 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java @@ -22,12 +22,10 @@ import com.fr.form.ui.container.WSortLayout; import com.fr.general.ComparatorUtils; import com.fr.general.SiteCenter; import com.fr.json.JSONException; -import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.report.ExtraReportClassManager; -import com.fr.report.fun.LocationAttrProvider; -import com.fr.report.fun.impl.AbstractLocationAttrProvider; - +import com.fr.report.fun.MobileParamStyleProvider; +import com.fr.report.mobile.DefaultMobileParamStyle; import javax.swing.BorderFactory; @@ -90,10 +88,10 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { double[] rowSize = {p, p}; double[] columnSize = {p, f}; int[][] rowCount = {{1, 1}, {1, 1}}; - if (ExtraReportClassManager.getInstance().getArray(LocationAttrProvider.MARK_STRING).size() != 0) { + if (ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING).size() != 0) { tipLabel = null; } else { - ((WParameterLayout) (paraCreator.toData())).setProvider((LocationAttrProvider) ((Item) paramLocationComboBox.getItemAt(0)).getValue()); + ((WParameterLayout) (paraCreator.toData())).setProvider((MobileParamStyleProvider) ((Item) paramLocationComboBox.getItemAt(0)).getValue()); } Component[][] components = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Parameter_Panel")), paramLocationComboBox}, @@ -107,9 +105,9 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { } private Item[] getItems() { - Set pluginCreators = ExtraReportClassManager.getInstance().getArray(LocationAttrProvider.MARK_STRING); + Set pluginCreators = ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING); Item[] items = new Item[pluginCreators.size() + 1]; - LocationAttrProvider provider = getDefaultLocationAttr(); + MobileParamStyleProvider provider = new DefaultMobileParamStyle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); items[0] = new Item(provider.descriptor(), provider); for (int i = 0; i < pluginCreators.size(); i++) { provider = pluginCreators.iterator().next(); @@ -120,11 +118,10 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { private UILabel getTipLabel() { UILabel tipLabel = new UILabel(); - String[] strings = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Properties_Mobile_Tip").split("\\|"); StringBuilder text = new StringBuilder(); - text.append("").append(strings[0]) - .append("").append(strings[1]) - .append("").append(strings[2]) + text.append("").append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Properties_Mobile_Tip")) + .append("").append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Properties_Mobile_Install_Parameter_Pane_Plugin")) + .append("").append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Properties_Mobile_To_Get_More_Style")) .append(""); tipLabel.setText(text.toString()); tipLabel.addMouseListener(new MouseAdapter() { @@ -169,33 +166,13 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { - ((WParameterLayout) (paraCreator.toData())).setProvider((LocationAttrProvider) ((Item) e.getItem()).getValue()); + ((WParameterLayout) (paraCreator.toData())).setProvider((MobileParamStyleProvider) ((Item) e.getItem()).getValue()); } } }); return paramLocationComoBox; } - private LocationAttrProvider getDefaultLocationAttr() { - return new AbstractLocationAttrProvider() { - @Override - public String descriptor() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"); - } - - @Override - public JSONObject createJSON() { - JSONObject jo = JSONObject.create(); - try { - jo.put("queryType", "default"); - } catch (JSONException e) { - - } - return jo; - } - }; - } - // 控件顺序 private UIExpandablePane getMobileWidgetListPane() { mobileWidgetListPane = new MobileWidgetListPane(designer, (WSortLayout) paraCreator.toData()); @@ -232,10 +209,10 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { this.addAttributeChangeListener(changeListener); int index = 0; try { - LocationAttrProvider provider = ((WParameterLayout) paraCreator.toData()).getProvider(); + MobileParamStyleProvider provider = ((WParameterLayout) paraCreator.toData()).getProvider(); String currentQueryType = provider.createJSON().getString("queryType"); for (int i = 0; i < items.length; i++) { - String existedQueryType = ((LocationAttrProvider) items[i].getValue()).createJSON().getString("queryType"); + String existedQueryType = ((MobileParamStyleProvider) items[i].getValue()).createJSON().getString("queryType"); if (ComparatorUtils.equals(existedQueryType, currentQueryType)) { index = i; break; From 0e099b607b3ca0b0d6de89c1788b3b101f025299 Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 23 Nov 2018 15:59:17 +0800 Subject: [PATCH 39/44] =?UTF-8?q?REPORT-12771=20@plough:=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=9A=84=E6=89=93=E5=8D=B0=E6=9C=BA=E4=B8=8E?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E9=A2=84=E8=A7=88=E7=AA=97=E5=8F=A3=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E6=9C=BA=E4=B8=8D=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webattr/printsettings/AbstractNativePrintSettingPane.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java index 9ba0180997..f32e0c1153 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java @@ -461,6 +461,7 @@ public abstract class AbstractNativePrintSettingPane extends JPanel { extraUpdate(nativePrintAttr); nativePrintAttr.setShowDialog(showDialogCheck.isSelected()); nativePrintAttr.setNeedSelectSheet(needSelectSheetCheck.isSelected()); + nativePrintAttr.setPrinterName((String)printerComboBox.getSelectedItem()); nativePrintAttr.setCopy((int)copySpinner.getValue()); // 页码 From c86ab83bba7795403311fba27cefe8dc7b40036a Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 23 Nov 2018 15:59:27 +0800 Subject: [PATCH 40/44] =?UTF-8?q?REPORT-12877=20=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E6=A8=A1=E6=9D=BF=EF=BC=8C=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E5=88=A0=E9=99=A4=EF=BC=8C=E6=8F=90=E7=A4=BA=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/file/TemplateTreePane.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 7f2fcd2cfe..88f4ee2623 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -20,9 +20,14 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; +import com.fr.stable.script.CalculatorProvider; +import com.fr.stable.web.BrowserProvider; +import com.fr.stable.web.Device; +import com.fr.stable.web.Repository; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; +import javax.servlet.http.HttpServletRequest; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.ToolTipManager; @@ -43,6 +48,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Enumeration; +import java.util.Map; import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.YES_NO_OPTION; @@ -377,7 +383,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { TreePath[] selectedTreePaths = reportletsTree.getSelectionPaths(); - if (selectedTreePaths == null || selectedTreePaths.length != 1) { + if (selectedTreePaths == null || selectedTreePaths.length == 0) { return false; } // 选中的是文件夹 From 9a240682a50545c17a19cfed21e54d6baf77d59d Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 23 Nov 2018 16:02:03 +0800 Subject: [PATCH 41/44] =?UTF-8?q?REPORT-12877=20=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E6=A8=A1=E6=9D=BF=EF=BC=8C=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E5=88=A0=E9=99=A4=EF=BC=8C=E6=8F=90=E7=A4=BA=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/file/TemplateTreePane.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 88f4ee2623..fe23ac416d 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -20,14 +20,9 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; -import com.fr.stable.script.CalculatorProvider; -import com.fr.stable.web.BrowserProvider; -import com.fr.stable.web.Device; -import com.fr.stable.web.Repository; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; -import javax.servlet.http.HttpServletRequest; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.ToolTipManager; @@ -48,7 +43,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Enumeration; -import java.util.Map; import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.YES_NO_OPTION; From 79b8564360ff0788cd0f1b731ccd511b2783838e Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 23 Nov 2018 16:06:42 +0800 Subject: [PATCH 42/44] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/file/TemplateTreePane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index fe23ac416d..11f0daf63a 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -17,6 +17,7 @@ import com.fr.file.filetree.IOFileNodeFilter; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; +import com.fr.stable.ArrayUtils; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; @@ -377,7 +378,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { TreePath[] selectedTreePaths = reportletsTree.getSelectionPaths(); - if (selectedTreePaths == null || selectedTreePaths.length == 0) { + if (selectedTreePaths == null || ArrayUtils.isEmpty(selectedTreePaths)) { return false; } // 选中的是文件夹 From 2dbbe0cdc1d1a108c9fad0e0544c7111a462717c Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 23 Nov 2018 16:17:56 +0800 Subject: [PATCH 43/44] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/file/TemplateTreePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 11f0daf63a..ed63b06cef 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -378,7 +378,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { TreePath[] selectedTreePaths = reportletsTree.getSelectionPaths(); - if (selectedTreePaths == null || ArrayUtils.isEmpty(selectedTreePaths)) { + if (ArrayUtils.isEmpty(selectedTreePaths)) { return false; } // 选中的是文件夹 From 7a7c43e5af799b1cc1c23af55f3197257804998c Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Fri, 23 Nov 2018 17:54:54 +0800 Subject: [PATCH 44/44] =?UTF-8?q?REPORT-11832=20-=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../connect/DatabaseConnectionPane.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index aed07afb03..666778610c 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -34,8 +34,9 @@ public abstract class DatabaseConnectionPane