From 4c2586a6c2a9cce58512c321ae07f4e131d99a06 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Thu, 15 Nov 2018 20:17:55 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-12721=20HistoryTemplateListPane=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/file/HistoryTemplateListPane.java | 143 +++++++++++++++++- 1 file changed, 140 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java index 073c4fd1d..73d305333 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java @@ -1,16 +1,153 @@ package com.fr.design.file; +import com.fr.base.chart.chartdata.CallbackEvent; +import com.fr.design.mainframe.JTemplate; +import com.fr.file.FILE; +import com.fr.file.FileNodeFILE; + +import java.util.List; + /** * 历史模板缓存 - * + *

* 为可能存在的插件做兼容处理 * * @see HistoryTemplateListCache * @deprecated use HistoryTemplateListCache instead */ @Deprecated -public class HistoryTemplateListPane { - public static HistoryTemplateListCache getInstance() { +public class HistoryTemplateListPane implements CallbackEvent { + + + private static volatile HistoryTemplateListPane THIS; + + public static HistoryTemplateListPane getInstance() { + if (THIS == null) { + synchronized (HistoryTemplateListPane.class) { + if (THIS == null) { + THIS = new HistoryTemplateListPane(); + } + } + } + return THIS; + } + + private static HistoryTemplateListCache instead() { return HistoryTemplateListCache.getInstance(); } + + + /** + * 关闭选择的文件 + * + * @param selected 选择的 + */ + public void closeSelectedReport(JTemplate selected) { + instead().closeSelectedReport(selected); + } + + /** + * 临时关闭选择的文件 + * + * @param selected 选择的 + */ + public void closeVirtualSelectedReport(JTemplate selected) { + instead().closeVirtualSelectedReport(selected); + } + + + public JTemplate getCurrentEditingTemplate() { + return instead().getCurrentEditingTemplate(); + } + + public void setCurrentEditingTemplate(JTemplate jt) { + instead().setCurrentEditingTemplate(jt); + + } + + /** + * 添加历史记录 + */ + public void addHistory() { + instead().addHistory(); + } + + + public List> getHistoryList() { + return instead().getHistoryList(); + } + + + /** + * 清空历史记录 + */ + public void removeAllHistory() { + instead().removeAllHistory(); + } + + public int getHistoryCount() { + return instead().getHistoryCount(); + } + + + public JTemplate get(int index) { + return instead().get(index); + } + + + public JTemplate getTemplate(int index) { + return instead().getTemplate(index); + } + + /** + * 获取模板的index + * + * @param jt 模板 + * @return 位置 + */ + public int contains(JTemplate jt) { + return instead().contains(jt); + } + + + /** + * 判断是否打开过该模板 + * + * @param filename 文件名 + * @return 文件位置 + */ + public int contains(String filename) { + return instead().contains(filename); + } + + /** + * 是否是当前编辑的文件 + * + * @param filename 文件名 + * @return 是则返回TRUE + */ + public boolean isCurrentEditingFile(String filename) { + return instead().isCurrentEditingFile(filename); + } + + + public void callback() { + getCurrentEditingTemplate().repaint(); + } + + /** + * 打开new模板的同时关闭old模板,优先关已保存的、先打开的 + */ + public void closeOverLineTemplate() { + instead().closeOverLineTemplate(); + } + + + public void deleteFile(FileNodeFILE file) { + instead().deleteFile(file); + } + + public boolean rename(FILE tplFile, String from, String to) { + return instead().rename(tplFile, from, to); + } }