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 fc71d031b9..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 @@ -203,10 +203,13 @@ 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 + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(jTemplate.getPath()); } } JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); @@ -215,8 +218,6 @@ public class MutilTempalteTabPane extends JComponent { THIS.repaint(); } //如果取消保存了,则不关闭其他模板 - - } }); if (openedTemplate.size() == 1) { 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;