Browse Source

REPORT-6110 设计器模板内存智能优化

优化了一下模板激活时间,去掉激活时刷新右侧面板调用
MoMeak 8 years ago
parent
commit
2d9cd78a50
  1. 23
      designer_base/src/com/fr/design/DesignerEnvManager.java
  2. 23
      designer_base/src/com/fr/design/actions/file/PreferencePane.java
  3. 2
      designer_base/src/com/fr/design/file/HistoryTemplateListPane.java
  4. 5
      designer_base/src/com/fr/design/file/MutilTempalteTabPane.java
  5. 3
      designer_base/src/com/fr/design/locale/designer.properties
  6. 3
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  7. 5
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  8. 5
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  9. 5
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  10. 3
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  11. 2
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  12. 6
      designer_base/src/com/fr/design/mainframe/JVirtualTemplate.java

23
designer_base/src/com/fr/design/DesignerEnvManager.java

@ -99,6 +99,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private int language;
//2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容
private boolean useOracleSystemSpace = true;
private int cachingTemplateLimit = 5;
private boolean autoBackUp = true;
private int undoLimit = 5;
private short pageLengthUnit = Constants.UNIT_MM;
@ -244,7 +245,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
// 写文件的LogLocation
String logLocation = DesignerEnvManager.getEnvManager().getLogLocation();
if (logLocation != null) {
//Mac下8.0,9.0 选项-日志设置为空时在根目录下检测文件存在会抛无权限,这里应该设个默认值比较好吧
if (StringUtils.isNotEmpty(logLocation)) {
try {
Calendar calender = GregorianCalendar.getInstance();
calender.setTimeInMillis(System.currentTimeMillis());
@ -631,6 +633,21 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.useOracleSystemSpace = displayOracleSystem;
}
/**
* 配置最大缓存模板个数
*/
public void setCachingTemplateLimit(int cachingTemplateLimit) {
this.cachingTemplateLimit = cachingTemplateLimit;
}
/**
* 获取最大缓存模板个数
*/
public int getCachingTemplateLimit() {
return this.cachingTemplateLimit;
}
/**
* 是否加入产品改良
*
@ -1394,6 +1411,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.setMaxNumberOrPreviewRow(reader.getAttrAsInt("maxNumberOrPreviewRow", 200));
this.setOracleSystemSpace(reader.getAttrAsBoolean("useOracleSystemSpace", true));
this.setCachingTemplateLimit(reader.getAttrAsInt("cachingTemplateLimit", 5));
this.setJoinProductImprove(reader.getAttrAsBoolean("joinProductImprove", true));
this.setAutoBackUp(reader.getAttrAsBoolean("autoBackUp", true));
this.setTemplateTreePaneExpanded(reader.getAttrAsBoolean("templateTreePaneExpanded", false));
@ -1614,6 +1632,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (!this.isOracleSystemSpace()) {
writer.attr("useOracleSystemSpace", this.isOracleSystemSpace());
}
if (this.getCachingTemplateLimit() >= 0) {
writer.attr("cachingTemplateLimit", this.getCachingTemplateLimit());
}
if (!this.isJoinProductImprove()) {
writer.attr("joinProductImprove", this.isJoinProductImprove());
}

23
designer_base/src/com/fr/design/actions/file/PreferencePane.java

@ -16,6 +16,7 @@ import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
@ -32,6 +33,7 @@ import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.BorderFactory;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
@ -64,6 +66,9 @@ public class PreferencePane extends BasicPane {
private static final int MAX_UNDO_LIMIT_50 = 50;
private static final int SELECTED_INDEX_4 = 4;
private static final int SELECTED_INDEX_5 = 5;
private static final int CACHING_MAX = 10;
private static final int CACHING_DEFAULT = 5;
private static final int CACHING_GAP = 5;
private static final String TYPE = "pressed";
private static final String DISPLAY_TYPE = "+";
@ -122,6 +127,7 @@ public class PreferencePane extends BasicPane {
private IntegerEditor portEditor;
private UITextField jdkHomeTextField;
private UICheckBox oracleSpace;
private UISpinner cachingTemplateSpinner;
private UICheckBox joinProductImprove;
public PreferencePane() {
@ -182,6 +188,7 @@ public class PreferencePane extends BasicPane {
JPanel spaceUpPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
spaceUpPane.add(oraclePane, BorderLayout.NORTH);
spaceUpPane.add(createMemoryPane(), BorderLayout.CENTER);
spaceUpPane.add(improvePane, BorderLayout.SOUTH);
advancePane.add(spaceUpPane);
}
@ -505,6 +512,20 @@ public class PreferencePane extends BasicPane {
serverPortPane.add(choosePortPane, BorderLayout.CENTER);
}
private JPanel createMemoryPane() {
JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Preference_CachingTemplate"));
UILabel memoryLabel = new UILabel(Inter.getLocText("FR-Designer_Preference_MaxCachingTemplate"));
UILabel memoryTipLabel = new UILabel(Inter.getLocText("FR-Designer_Preference_CachingTemplateTip"));
memoryTipLabel.setBorder(BorderFactory.createEmptyBorder( 0, CACHING_GAP, 0, 0));
cachingTemplateSpinner = new UISpinner(0, CACHING_MAX, 1, CACHING_DEFAULT);
JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout());
memorySpace.add(memoryLabel);
memorySpace.add(cachingTemplateSpinner);
memorySpace.add(memoryTipLabel);
memoryPane.add(memorySpace);
return memoryPane;
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("M_Window-Preference");
@ -563,6 +584,7 @@ public class PreferencePane extends BasicPane {
this.jdkHomeTextField.setText(designerEnvManager.getJdkHome());
this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace());
this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit());
this.joinProductImprove.setSelected(designerEnvManager.isJoinProductImprove());
}
@ -623,6 +645,7 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setJdkHome(jdkHomeTextField.getText());
designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected());
designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue());
designerEnvManager.setJoinProductImprove(this.joinProductImprove.isSelected());
// designerEnvManager.setAutoBackUp(this.autoBackUp.isSelected());

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

@ -38,7 +38,7 @@ import com.fr.design.utils.gui.GUIPaintUtils;
public class HistoryTemplateListPane extends JPanel implements FileOperations, CallbackEvent {
//最大保存内存中面板数,为0时关闭优化内存
private static final int DEAD_LINE = 5;
private static final int DEAD_LINE = DesignerEnvManager.getEnvManager().getCachingTemplateLimit();
private static final int LIST_BORDER = 4;
private List<JTemplate<?, ?>> historyList;
private JTemplate<?, ?> editingTemplate;

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

@ -8,7 +8,6 @@ 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;
@ -17,6 +16,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.stable.Constants;
import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants;
import com.fr.stable.project.ProjectConstants;
@ -701,8 +701,7 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
if (filename.startsWith(ProjectConstants.REPORTLETS_NAME)) {
filename = ((FileNodeFILE) openedTemplate.get(selectedIndex).getEditingFILE()).getEnvPath() + File.separator + filename;
}
filename = filename.replaceAll("/", "\\\\");
filename = OperatingSystem.isWindows() ? filename.replaceAll("/", "\\\\") : filename.replaceAll("\\\\", "/");
if (!specifiedTemplate.isALLSaved()) {
specifiedTemplate.stopEditing();

3
designer_base/src/com/fr/design/locale/designer.properties

@ -2153,3 +2153,6 @@ FR-Designer_Move_Up=Move up
FR-Designer_Move_Down=Move down
FR-Designer_Move_To_Top=Move to top
FR-Designer_Move_To_Bottom=Move to bottom
FR-Designer_Preference_CachingTemplate=Template memory optimization
FR-Designer_Preference_MaxCachingTemplate=The designer maximum cache template number:
FR-Designer_Preference_CachingTemplateTip=Set to 0 to close the function; restart the designer and take effect

3
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -2152,3 +2152,6 @@ FR-Designer_Move_Up=Move up
FR-Designer_Move_Down=Move down
FR-Designer_Move_To_Top=Move to top
FR-Designer_Move_To_Bottom=Move to bottom
FR-Designer_Preference_CachingTemplate=Template memory optimization
FR-Designer_Preference_MaxCachingTemplate=The designer maximum cache template number:
FR-Designer_Preference_CachingTemplateTip=Set to 0 to close the function; restart the designer and take effect

5
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -2152,4 +2152,7 @@ FR-Designer_Format_JavaScript=Format Code
FR-Designer_Move_Up=
FR-Designer_Move_Down=
FR-Designer_Move_To_Top=
FR-Designer_Move_To_Bottom=
FR-Designer_Move_To_Bottom=
FR-Designer_Preference_CachingTemplate=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30E1\u30E2\u30EA\u6700\u9069\u5316
FR-Designer_Preference_MaxCachingTemplate=\u8BBE\u8BA1\u5668\u6700\u5927\u30AD\u30E3\u30C3\u30B7\u30E5\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u6570\uFF1A
FR-Designer_Preference_CachingTemplateTip=\u8A2D\u7F6E\u30920\u8868\u793A\u6A5F\u80FD\u8BBE\u8BA1\u5668\u9589\u9396;\u518D\u958B\u5F8C\u767A\u52B9\u3059\u308B

5
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -2152,4 +2152,7 @@ FR-Designer_Format_JavaScript=Format Code
FR-Designer_Move_Up=
FR-Designer_Move_Down=
FR-Designer_Move_To_Top=
FR-Designer_Move_To_Bottom=
FR-Designer_Move_To_Bottom=
FR-Designer_Preference_CachingTemplate=\uD15C\uD50C\uB9BF \uBA54\uBAA8\uB9AC \uCD5C\uC801\uD654
FR-Designer_Preference_MaxCachingTemplate=\uB514\uC790\uC774\uB108 \uCD5C\uB300 \uCE90\uC2DC \uD15C\uD50C\uB9BF \uAC1C\uC218:
FR-Designer_Preference_CachingTemplateTip=\uC124\uC815 \uC744 0 \uD45C\uC2DC \uB2EB\uAE30 \uC774 \uAE30\uB2A5; \uB2E4\uC2DC \uB514\uC790\uC774\uB108 \uD6C4 \uBC1C\uD6A8\uB41C\uB2E4

5
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -2152,4 +2152,7 @@ FR-Designer_Format_JavaScript=\u683C\u5F0F\u5316\u4EE3\u7801
FR-Designer_Move_Up=\u4E0A\u79FB\u4E00\u5C42
FR-Designer_Move_Down=\u4E0B\u79FB\u4E00\u5C42
FR-Designer_Move_To_Top=\u7F6E\u4E8E\u9876\u5C42
FR-Designer_Move_To_Bottom=\u7F6E\u4E8E\u5E95\u5C42
FR-Designer_Move_To_Bottom=\u7F6E\u4E8E\u5E95\u5C42
FR-Designer_Preference_CachingTemplate=\u6A21\u677F\u5185\u5B58\u4F18\u5316
FR-Designer_Preference_MaxCachingTemplate=\u8BBE\u8BA1\u5668\u6700\u5927\u7F13\u5B58\u6A21\u677F\u4E2A\u6570\uFF1A
FR-Designer_Preference_CachingTemplateTip=\u8BBE\u7F6E\u4E3A0\u8868\u793A\u5173\u95ED\u8BE5\u529F\u80FD\uFF1B\u91CD\u542F\u8BBE\u8BA1\u5668\u540E\u751F\u6548

3
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -2152,3 +2152,6 @@ FR-Designer_Move_Up=\u4E0A\u79FB\u4E00\u5C64
FR-Designer_Move_Down=\u4E0B\u79FB\u4E00\u5C64
FR-Designer_Move_To_Top=\u7F6E\u65BC\u9802\u5C64
FR-Designer_Move_To_Bottom=\u7F6E\u65BC\u5E95\u5C64
FR-Designer_Preference_CachingTemplate=\u7BC4\u672C\u8A18\u61B6\u9AD4\u512A\u5316
FR-Designer_Preference_MaxCachingTemplate=\u8A2D\u8A08\u5668\u6700\u5927\u7DE9\u5B58\u7BC4\u672C\u500B\u6578\uFF1A
FR-Designer_Preference_CachingTemplateTip=\u8A2D\u5B9A\u70BA0\u8868\u793A\u95DC\u9589\u8A72\u529F\u80FD\uFF1B\u91CD\u5553\u8A2D\u8A08\u5668\u5F8C\u751F\u6548

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

@ -911,8 +911,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} else {
this.addAndActivateJTemplate(jt);
}
//REPORT-5084:激活后刷新一下右側面板
jt.refreshEastPropertiesPane();
}
/**

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

@ -12,9 +12,8 @@ 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.OperatingSystem;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
@ -40,7 +39,8 @@ public class JVirtualTemplate extends JTemplate {
if (editingFileName.startsWith(ProjectConstants.REPORTLETS_NAME)) {
editingFileName = ((FileNodeFILE) getEditingFILE()).getEnvPath() + File.separator + editingFileName;
}
return editingFileName.replaceAll("/", "\\\\");
editingFileName = OperatingSystem.isWindows() ? editingFileName.replaceAll("/", "\\\\") : editingFileName.replaceAll("\\\\", "/");
return editingFileName;
}
/**

Loading…
Cancel
Save