Browse Source

REPORT-11315 关闭其他模板时释放锁;打开模板过多时,关闭其中部分模板锁不释放问题

research/10.0
yaoh.wu 6 years ago
parent
commit
82f8445654
  1. 4
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  2. 6
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  3. 3
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  4. 25
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  5. 22
      designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java

4
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);

6
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()));

3
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) {

25
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<T extends BaseBook, U extends BaseUndoState<?>>
* 有条件取消格式刷
*/
public void doConditionCancelFormat() {
return;
}
@Override
@ -193,7 +193,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
*/
@Override
public void cancelFormat() {
return;
}
//因为报表的tab从0开始,所以表单默认为-1吧
@ -462,8 +461,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
// 子类实现
}
;
/**
* 是否保存
*
@ -565,6 +562,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
/**
* 保存
*
* @param isShowLoc 是否显示报表运行环境外的路径(C盘D盘等)
* @param fileName 保存文件名
* @return
@ -941,17 +939,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
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

22
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;

Loading…
Cancel
Save