MoMeak 7 years ago
parent
commit
5594cd8a11
  1. 21
      designer/src/com/fr/design/mainframe/JWorkBook.java
  2. 13
      designer_base/src/com/fr/design/file/HistoryTemplateListPane.java
  3. 19
      designer_base/src/com/fr/design/file/MutilTempalteTabPane.java
  4. 7
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  5. 24
      designer_base/src/com/fr/design/mainframe/JTemplate.java
  6. 24
      designer_base/src/com/fr/design/mainframe/JVirtualTemplate.java
  7. 22
      designer_form/src/com/fr/design/mainframe/JForm.java

21
designer/src/com/fr/design/mainframe/JWorkBook.java

@ -850,8 +850,25 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
}
@Override
public boolean isJVirtualTemplate() {
return false;
public void activeJTemplate(int index, JTemplate jt) {
DesignerContext.getDesignerFrame().activateJTemplate(this);
}
@Override
public void activeOldJTemplate() {
DesignerContext.getDesignerFrame().activateJTemplate(this);
}
@Override
public void activeNewJTemplate() {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(this);
}
@Override
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()));
}
@Override

13
designer_base/src/com/fr/design/file/HistoryTemplateListPane.java

@ -147,6 +147,13 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations {
}
}
/**
* 关闭选择的文件
*/
public void selectedReportToVirtual(int i) {
closeOverLineTemplate();
}
public JTemplate<?, ?> getCurrentEditingTemplate() {
return this.editingTemplate;
}
@ -320,9 +327,9 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations {
}
for (int i = 0; i < vCount; i++) {
JTemplate overTemplate = historyList.get(i);
if (!overTemplate.isJVirtualTemplate() && overTemplate.getEditingFILE().exists() && overTemplate.isALLSaved() && overTemplate != editingTemplate) {
closeVirtualSelectedReport(overTemplate);
historyList.set(i, new JVirtualTemplate(overTemplate.getEditingFILE()));
if (overTemplate.getEditingFILE().exists() && overTemplate.isALLSaved() && overTemplate != editingTemplate) {
historyList.get(i).closeOverLineTemplate(i);
}
}
MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList);

19
designer_base/src/com/fr/design/file/MutilTempalteTabPane.java

@ -8,6 +8,7 @@ import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIScrollPopUpMenu;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.file.FILE;
@ -219,11 +220,7 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
templates[i].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
selectedIndex = index;
if (!tem.isJVirtualTemplate()) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(tem);
} else {
DesignerContext.getDesignerFrame().openTemplate(tem.getEditingFILE());
}
tem.activeNewJTemplate();
}
});
}
@ -675,11 +672,7 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
return;
}
JTemplate evtXTemplate = openedTemplate.get(getTemplateIndex(evtX));
if (!evtXTemplate.isJVirtualTemplate()) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(getTemplateIndex(evtX)));
} else {
DesignerContext.getDesignerFrame().openTemplate(evtXTemplate.getEditingFILE());
}
evtXTemplate.activeNewJTemplate();
}
isShowList = false;
}
@ -787,11 +780,7 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
selectedIndex = HistoryTemplateListPane.getInstance().contains(fileName);
}
//如果是已后台关闭的模板,则重新打开文件
if (!openedTemplate.get(selectedIndex).isJVirtualTemplate()) {
DesignerContext.getDesignerFrame().activateJTemplate(openedTemplate.get(selectedIndex));
} else {
DesignerContext.getDesignerFrame().openTemplate(openedTemplate.get(selectedIndex).getEditingFILE());
}
openedTemplate.get(selectedIndex).activeOldJTemplate();
}
}

7
designer_base/src/com/fr/design/mainframe/DesignerFrame.java

@ -935,12 +935,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
int index = HistoryTemplateListPane.getInstance().contains(fullName);
List<JTemplate<?, ?>> historyList = HistoryTemplateListPane.getInstance().getHistoryList();
if (index != -1) {
if (!historyList.get(index).isJVirtualTemplate()) {
this.activateJTemplate(historyList.get(index));
} else {
historyList.set(index, jt);
this.addAndActivateJTemplate(historyList.get(index));
}
historyList.get(index).activeJTemplate(index, jt);
} else {
this.addAndActivateJTemplate(jt);
}

24
designer_base/src/com/fr/design/mainframe/JTemplate.java

@ -887,11 +887,29 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
public abstract boolean isJWorkBook();
/**
* 是否是虚拟工作薄用于释放该template内存
* 激活指定的template
*
*/
public abstract void activeJTemplate(int index, JTemplate jt);
/**
* 激活已存在的模板
*
*/
public abstract void activeOldJTemplate();
/**
* 激活新的模板
*
* @return 是则返回true
*/
public abstract boolean isJVirtualTemplate();
public abstract void activeNewJTemplate();
/**
* 后台关闭template
*
*/
public abstract void closeOverLineTemplate(int index);
/**
* 返回当前支持的超链界面pane

24
designer_base/src/com/fr/design/mainframe/JVirtualTemplate.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.design.DesignModelAdapter;
import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.gui.imenu.UIMenuItem;
@ -11,11 +12,14 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.file.FILE;
import com.fr.file.FileFILE;
import com.fr.file.FileNodeFILE;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import java.io.File;
import java.util.List;
/**
* Author : MoMeak
@ -218,8 +222,24 @@ public class JVirtualTemplate extends JTemplate {
}
@Override
public boolean isJVirtualTemplate() {
return true;
public void activeJTemplate(int index, JTemplate jt) {
List<JTemplate<?, ?>> historyList = HistoryTemplateListPane.getInstance().getHistoryList();
historyList.set(index, jt);
DesignerContext.getDesignerFrame().addAndActivateJTemplate(jt);
}
@Override
public void activeOldJTemplate() {
DesignerContext.getDesignerFrame().openTemplate(this.getEditingFILE());
}
@Override
public void activeNewJTemplate() {
DesignerContext.getDesignerFrame().openTemplate(this.getEditingFILE());
}
@Override
public void closeOverLineTemplate(int index) {
}
@Override

22
designer_form/src/com/fr/design/mainframe/JForm.java

@ -17,6 +17,7 @@ import com.fr.design.designer.creator.*;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.gui.ilable.UILabel;
@ -143,8 +144,25 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
}
@Override
public boolean isJVirtualTemplate() {
return false;
public void activeJTemplate(int index, JTemplate jt) {
DesignerContext.getDesignerFrame().activateJTemplate(this);
}
@Override
public void activeOldJTemplate() {
DesignerContext.getDesignerFrame().activateJTemplate(this);
}
@Override
public void activeNewJTemplate() {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(this);
}
@Override
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()));
}
/**

Loading…
Cancel
Save