Browse Source

Merge pull request #484 in DESIGN/design from ~YAOH.WU/design:feature/10.0 to feature/10.0

* commit '82f844565441c944b3e6a08c058bfe06a456ca1f':
  REPORT-11315 关闭其他模板时释放锁;打开模板过多时,关闭其中部分模板锁不释放问题
  REPORT-11315 关闭其他模板时释放锁;打开模板过多时,关闭其中部分模板锁不释放问题
research/10.0
yaoh.wu 6 years ago
parent
commit
fd0ee19de2
  1. 4
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  2. 11
      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. 29
      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);

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

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

29
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,8 +562,9 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
/**
* 保存
*
* @param isShowLoc 是否显示报表运行环境外的路径(C盘D盘等)
* @param fileName 保存文件名
* @param fileName 保存文件名
* @return
*/
public boolean saveAsTemplate(boolean isShowLoc, String fileName) {
@ -726,7 +724,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
tplMenu.addShortCut(shortcut4TemplateMenu());
}
if (!DesignerMode.isVcsMode()) {
tplMenu.addShortCut(shortCuts4Authority());
tplMenu.addShortCut(shortCuts4Authority());
}
return new MenuDef[]{tplMenu};
@ -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