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 @Override
public boolean isJVirtualTemplate() { public void activeJTemplate(int index, JTemplate jt) {
return false; 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 @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() { public JTemplate<?, ?> getCurrentEditingTemplate() {
return this.editingTemplate; return this.editingTemplate;
} }
@ -320,9 +327,9 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations {
} }
for (int i = 0; i < vCount; i++) { for (int i = 0; i < vCount; i++) {
JTemplate overTemplate = historyList.get(i); JTemplate overTemplate = historyList.get(i);
if (!overTemplate.isJVirtualTemplate() && overTemplate.getEditingFILE().exists() && overTemplate.isALLSaved() && overTemplate != editingTemplate) {
closeVirtualSelectedReport(overTemplate); if (overTemplate.getEditingFILE().exists() && overTemplate.isALLSaved() && overTemplate != editingTemplate) {
historyList.set(i, new JVirtualTemplate(overTemplate.getEditingFILE())); historyList.get(i).closeOverLineTemplate(i);
} }
} }
MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList); 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.gui.imenu.UIScrollPopUpMenu;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; 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.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.file.FILE; import com.fr.file.FILE;
@ -219,11 +220,7 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
templates[i].addActionListener(new ActionListener() { templates[i].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
selectedIndex = index; selectedIndex = index;
if (!tem.isJVirtualTemplate()) { tem.activeNewJTemplate();
DesignerContext.getDesignerFrame().addAndActivateJTemplate(tem);
} else {
DesignerContext.getDesignerFrame().openTemplate(tem.getEditingFILE());
}
} }
}); });
} }
@ -675,11 +672,7 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
return; return;
} }
JTemplate evtXTemplate = openedTemplate.get(getTemplateIndex(evtX)); JTemplate evtXTemplate = openedTemplate.get(getTemplateIndex(evtX));
if (!evtXTemplate.isJVirtualTemplate()) { evtXTemplate.activeNewJTemplate();
DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(getTemplateIndex(evtX)));
} else {
DesignerContext.getDesignerFrame().openTemplate(evtXTemplate.getEditingFILE());
}
} }
isShowList = false; isShowList = false;
} }
@ -787,11 +780,7 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
selectedIndex = HistoryTemplateListPane.getInstance().contains(fileName); selectedIndex = HistoryTemplateListPane.getInstance().contains(fileName);
} }
//如果是已后台关闭的模板,则重新打开文件 //如果是已后台关闭的模板,则重新打开文件
if (!openedTemplate.get(selectedIndex).isJVirtualTemplate()) { openedTemplate.get(selectedIndex).activeOldJTemplate();
DesignerContext.getDesignerFrame().activateJTemplate(openedTemplate.get(selectedIndex));
} else {
DesignerContext.getDesignerFrame().openTemplate(openedTemplate.get(selectedIndex).getEditingFILE());
}
} }
} }

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); int index = HistoryTemplateListPane.getInstance().contains(fullName);
List<JTemplate<?, ?>> historyList = HistoryTemplateListPane.getInstance().getHistoryList(); List<JTemplate<?, ?>> historyList = HistoryTemplateListPane.getInstance().getHistoryList();
if (index != -1) { if (index != -1) {
if (!historyList.get(index).isJVirtualTemplate()) { historyList.get(index).activeJTemplate(index, jt);
this.activateJTemplate(historyList.get(index));
} else {
historyList.set(index, jt);
this.addAndActivateJTemplate(historyList.get(index));
}
} else { } else {
this.addAndActivateJTemplate(jt); 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(); 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 * 返回当前支持的超链界面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.base.BaseUtils;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.designer.TargetComponent; 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.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.gui.imenu.UIMenuItem; 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.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FileFILE;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import javax.swing.*; import javax.swing.*;
import java.io.File; import java.io.File;
import java.util.List;
/** /**
* Author : MoMeak * Author : MoMeak
@ -218,8 +222,24 @@ public class JVirtualTemplate extends JTemplate {
} }
@Override @Override
public boolean isJVirtualTemplate() { public void activeJTemplate(int index, JTemplate jt) {
return true; 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 @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.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; 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.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -143,8 +144,25 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
} }
@Override @Override
public boolean isJVirtualTemplate() { public void activeJTemplate(int index, JTemplate jt) {
return false; 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