From db6239a952e0521c90d5d4f11047307a06b4805f Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Fri, 14 Sep 2018 09:40:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-11315=20=E5=85=B3=E9=97=AD=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E6=A8=A1=E6=9D=BF=E6=97=B6=E9=87=8A=E6=94=BE=E9=94=81?= =?UTF-8?q?;=E6=89=93=E5=BC=80=E6=A8=A1=E6=9D=BF=E8=BF=87=E5=A4=9A?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=85=B3=E9=97=AD=E5=85=B6=E4=B8=AD=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=A8=A1=E6=9D=BF=E9=94=81=E4=B8=8D=E9=87=8A=E6=94=BE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/file/MutilTempalteTabPane.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index fc71d031b9..79d4dbf456 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -203,10 +203,14 @@ public class MutilTempalteTabPane extends JComponent { } for (int i = 0; i < panes.length; i++) { if (i != selectedIndex) { + JTemplate jTemplate = panes[i]; //判断关闭的模板是不是格式刷的被参照的模板 - openedTemplate.remove(panes[i]); - closeFormat(panes[i]); - HistoryTemplateListCache.getInstance().closeSelectedReport(panes[i]); + openedTemplate.remove(jTemplate); + closeFormat(jTemplate); + HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate); + // release lock + String path = jTemplate.getEditingFILE().getPath(); + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(path); } } JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); @@ -215,8 +219,6 @@ public class MutilTempalteTabPane extends JComponent { THIS.repaint(); } //如果取消保存了,则不关闭其他模板 - - } }); if (openedTemplate.size() == 1) { @@ -693,7 +695,8 @@ public class MutilTempalteTabPane extends JComponent { specifiedTemplate.saveTemplate(); HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate); // release lock - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(specifiedTemplate.getPath()); + String path = specifiedTemplate.getEditingFILE().getPath(); + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(path); activeTemplate(filename); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName())); From 82f844565441c944b3e6a08c058bfe06a456ca1f Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Fri, 14 Sep 2018 10:14:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-11315=20=E5=85=B3=E9=97=AD=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E6=A8=A1=E6=9D=BF=E6=97=B6=E9=87=8A=E6=94=BE=E9=94=81?= =?UTF-8?q?;=E6=89=93=E5=BC=80=E6=A8=A1=E6=9D=BF=E8=BF=87=E5=A4=9A?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=85=B3=E9=97=AD=E5=85=B6=E4=B8=AD=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=A8=A1=E6=9D=BF=E9=94=81=E4=B8=8D=E9=87=8A=E6=94=BE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/file/HistoryTemplateListCache.java | 4 ++- .../fr/design/file/MutilTempalteTabPane.java | 6 ++-- .../fr/design/mainframe/DesignerFrame.java | 3 +- .../com/fr/design/mainframe/JTemplate.java | 29 +++++-------------- .../fr/design/mainframe/JVirtualTemplate.java | 22 ++------------ 5 files changed, 17 insertions(+), 47 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 70fbde3f1a..7aaff7be8f 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -6,6 +6,7 @@ import com.fr.design.data.DesignTableDataManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.JVirtualTemplate; import com.fr.design.module.DesignModuleFactory; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; @@ -221,7 +222,8 @@ public class HistoryTemplateListCache implements CallbackEvent { JTemplate overTemplate = historyList.get(i); if (overTemplate.getEditingFILE().exists() && overTemplate.isALLSaved() && overTemplate != editingTemplate) { - historyList.get(i).closeOverLineTemplate(i); + closeVirtualSelectedReport(overTemplate); + historyList.set(i, new JVirtualTemplate(overTemplate.getEditingFILE())); } } MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList); diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index 79d4dbf456..e4d592c771 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -209,8 +209,7 @@ public class MutilTempalteTabPane extends JComponent { closeFormat(jTemplate); HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate); // release lock - String path = jTemplate.getEditingFILE().getPath(); - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(path); + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(jTemplate.getPath()); } } JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); @@ -695,8 +694,7 @@ public class MutilTempalteTabPane extends JComponent { specifiedTemplate.saveTemplate(); HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate); // release lock - String path = specifiedTemplate.getEditingFILE().getPath(); - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(path); + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(specifiedTemplate.getPath()); activeTemplate(filename); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName())); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index ba41d2e9fa..a8802553ce 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -42,7 +42,6 @@ import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; - import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; @@ -1153,6 +1152,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta return progressDialog; } + public void showProgressDialog() { progressDialog.setVisible(true); @@ -1169,6 +1169,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta /** * 更新进度框进度 + * * @param progress */ public void updateProgress(int progress) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 44737b3d66..0098a2a4de 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -17,7 +17,6 @@ import com.fr.design.actions.edit.UndoAction; import com.fr.design.actions.file.SaveAsTemplateAction; import com.fr.design.actions.file.SaveTemplateAction; import com.fr.design.actions.file.WebPreviewUtils; -import com.fr.design.constants.UIConstants; import com.fr.design.designer.TargetComponent; import com.fr.design.dialog.InformationWarnPane; import com.fr.design.file.HistoryTemplateListPane; @@ -47,7 +46,6 @@ import com.fr.file.MemFILE; import com.fr.form.ui.NoneWidget; import com.fr.form.ui.Widget; import com.fr.general.ComparatorUtils; - import com.fr.log.FineLoggerFactory; import com.fr.report.cell.Elem; import com.fr.report.cell.cellattr.CellImage; @@ -56,10 +54,13 @@ import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.core.UUID; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JOptionPane; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.undo.UndoManager; -import java.awt.*; +import java.awt.BorderLayout; import java.util.ArrayList; import java.util.Arrays; import java.util.Set; @@ -180,7 +181,6 @@ public abstract class JTemplate> * 有条件取消格式刷 */ public void doConditionCancelFormat() { - return; } @Override @@ -193,7 +193,6 @@ public abstract class JTemplate> */ @Override public void cancelFormat() { - return; } //因为报表的tab从0开始,所以表单默认为-1吧 @@ -462,8 +461,6 @@ public abstract class JTemplate> // 子类实现 } - ; - /** * 是否保存 * @@ -565,8 +562,9 @@ public abstract class JTemplate> /** * 保存 + * * @param isShowLoc 是否显示“报表运行环境”外的路径(C盘D盘等) - * @param fileName 保存文件名 + * @param fileName 保存文件名 * @return */ public boolean saveAsTemplate(boolean isShowLoc, String fileName) { @@ -726,7 +724,7 @@ public abstract class JTemplate> tplMenu.addShortCut(shortcut4TemplateMenu()); } if (!DesignerMode.isVcsMode()) { - tplMenu.addShortCut(shortCuts4Authority()); + tplMenu.addShortCut(shortCuts4Authority()); } return new MenuDef[]{tplMenu}; @@ -941,17 +939,6 @@ public abstract class JTemplate> DesignerContext.getDesignerFrame().addAndActivateJTemplate(this); } - /** - * 后台关闭template - */ - public void closeOverLineTemplate(int index) { - JTemplate overTemplate = HistoryTemplateListPane.getInstance().getHistoryList().get(index); - HistoryTemplateListPane.getInstance().closeVirtualSelectedReport(overTemplate); - HistoryTemplateListPane.getInstance().getHistoryList().set(index, new JVirtualTemplate(overTemplate.getEditingFILE())); - } - - ; - /** * 返回当前支持的超链界面pane diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java index d472cc062f..cea1088920 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java @@ -11,15 +11,11 @@ import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.file.FILE; -import com.fr.file.FileNodeFILE; -import com.fr.stable.OperatingSystem; import com.fr.stable.StringUtils; -import com.fr.stable.project.ProjectConstants; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JPanel; -import java.io.File; import java.util.List; /** @@ -30,20 +26,10 @@ import java.util.List; */ public class JVirtualTemplate extends JTemplate { - private FILE editingFILE = null; + private FILE editingFILE; public JVirtualTemplate(FILE editingFILE) { - setEditingFILE(editingFILE); - } - - @Override - public String getPath() { - String editingFileName = getEditingFILE().getPath(); - if (editingFileName.startsWith(ProjectConstants.REPORTLETS_NAME)) { - editingFileName = ((FileNodeFILE) getEditingFILE()).getEnvPath() + File.separator + editingFileName; - } - editingFileName = OperatingSystem.isWindows() ? editingFileName.replaceAll("/", "\\\\") : editingFileName.replaceAll("\\\\", "/"); - return editingFileName; + this.editingFILE = editingFILE; } /** @@ -237,10 +223,6 @@ public class JVirtualTemplate extends JTemplate { DesignerContext.getDesignerFrame().openTemplate(this.getEditingFILE()); } - @Override - public void closeOverLineTemplate(int index) { - } - @Override public HyperlinkGroupPane getHyperLinkPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) { return null;