Browse Source

REPORT-55468 内置启动时打开空文件

persist/11.0
xiqiu 3 years ago
parent
commit
621aa0b143
  1. 24
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 24
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 28
      designer-base/src/main/java/com/fr/design/fun/impl/DesignerStartWithEmptyFile.java
  4. 12
      designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java
  5. 5
      designer-base/src/main/java/com/fr/start/BaseDesigner.java

24
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -17,9 +17,9 @@ import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.locale.impl.ProductImproveMark;
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo;
import com.fr.design.login.DesignerLoginType;
import com.fr.design.login.config.DesignerLoginConfigManager;
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo;
import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.notification.SnapChatConfig;
import com.fr.design.port.DesignerPortContext;
@ -157,7 +157,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
//记录当前激活码的在线激活状态.
private int activeKeyStatus = -1;
private boolean joinProductImprove = true;
private boolean startWithEmptyFile = false;
private boolean embedServerLazyStartup = false;
//最近使用的颜色
private ColorSelectConfigManager configManager = new ColorSelectConfigManager();
@ -1351,6 +1351,24 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.maxNumberOrPreviewRow = maxNumberOrPreviewRow;
}
/**
* 启动时是否打开空报表
*
* @return 是否打开空报表
*/
public boolean isStartWithEmptyFile() {
return startWithEmptyFile;
}
/**
* 设置启动时是否打开空报表
*
* @param startWithEmptyFile 是否打开空报表
*/
public void setStartWithEmptyFile(boolean startWithEmptyFile) {
this.startWithEmptyFile = startWithEmptyFile;
}
/**
* 是否展示工程界面
*
@ -1828,6 +1846,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.setSupportCellEditorDef(reader.getAttrAsBoolean("supportCellEditorDef", false));
this.setDragPermited(reader.getAttrAsBoolean("isDragPermited", false));
this.setUndoLimit(reader.getAttrAsInt("undoLimit", 5));
this.setStartWithEmptyFile(reader.getAttrAsBoolean("startWithEmptyFile", false));
this.setDefaultStringToFormula(reader.getAttrAsBoolean("defaultStringToFormula", false));
if ((tmpVal = reader.getAttrAsString("gridLineColor", null)) != null) {
this.setGridLineColor(new Color(Integer.parseInt(tmpVal)));
@ -2202,6 +2221,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
.attr("gridLineColor", this.getGridLineColor().getRGB())
.attr("paginationLineColor", this.getPaginationLineColor().getRGB())
.attr("undoLimit", this.getUndoLimit())
.attr("startWithEmptyFile", this.isStartWithEmptyFile())
.end();
}

24
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -173,7 +173,7 @@ public class PreferencePane extends BasicPane {
private UICheckBox gcEnableCheckBox;
private UIButton gcButton;
private UILabel remindVcsLabel;
private UICheckBox startWithEmptyFile;
private JDialog gcDialog;
private UILabel gcMessage = new UILabel();
private JPanel gcDialogDownPane = new JPanel();
@ -336,18 +336,23 @@ public class PreferencePane extends BasicPane {
}
private void createFunctionPane(JPanel generalPane) {
JPanel functionPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Function"));
generalPane.add(functionPane);
JPanel topVerticalTitledBorderPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Function"));
JPanel upper = new JPanel(FRGUIPaneFactory.createLeftZeroVgapNormalHgapLayout());
JPanel lower = new JPanel(FRGUIPaneFactory.createLeftZeroVgapNormalHgapLayout());
topVerticalTitledBorderPane.add(upper);
topVerticalTitledBorderPane.add(lower);
generalPane.add(topVerticalTitledBorderPane);
//添加supportUndo选择项
supportUndoCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Preference_Support_Undo"));
functionPane.add(supportUndoCheckBox);
upper.add(supportUndoCheckBox);
//添加maxUndoLimit
//String[] undoTimes = {"最大撤销次数","5次","10次","15次","20次","50次"};
String[] undoTimes = {i18nText("Fine-Design_Basic_Max_Undo_Limit"), MAX_UNDO_LIMIT_5 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_10 + i18nText("Fine-Design_Basic_Time(s)")
, MAX_UNDO_LIMIT_15 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_20 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_50 + i18nText("Fine-Design_Basic_Time(s)")};
maxUndoLimit = new UIComboBox(undoTimes);
functionPane.add(maxUndoLimit);
upper.add(maxUndoLimit);
//不支持撤销则不能选择撤销可缓存,也不能设置最大撤销次数
supportUndoCheckBox.addActionListener(new ActionListener() {
@ -361,12 +366,14 @@ public class PreferencePane extends BasicPane {
//添加supportDefaultParentCalculate选择项
supportDefaultParentCalculateCheckBox = new UICheckBox(
i18nText("Fine-Design_Basic_Preference_Support_Default_Parent_Calculate"));
functionPane.add(supportDefaultParentCalculateCheckBox);
upper.add(supportDefaultParentCalculateCheckBox);
//添加是否展示打开模板提示缺少插件选择项
showTemplateMissingPlugin = new UICheckBox(
i18nText("Fine-Design_Basic_Preference_Show-Template-Missing-Plugin"));
functionPane.add(showTemplateMissingPlugin);
upper.add(showTemplateMissingPlugin);
startWithEmptyFile = new UICheckBox(i18nText("Fine-Design_Basic_Preference_Start_Empty_File"));
lower.add(startWithEmptyFile);
}
private void createEditPane(JPanel generalPane) {
@ -717,6 +724,7 @@ public class PreferencePane extends BasicPane {
}
this.embedServerLazyStartupCheckBox.setSelected(designerEnvManager.isEmbedServerLazyStartup());
this.startWithEmptyFile.setSelected(designerEnvManager.isStartWithEmptyFile());
}
private int chooseCase(int sign) {
@ -800,7 +808,7 @@ public class PreferencePane extends BasicPane {
if (maxUndoLimit.getSelectedIndex() == SELECTED_INDEX_5) {
designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50);
}
designerEnvManager.setStartWithEmptyFile(startWithEmptyFile.isSelected());
if (WorkContext.getCurrent().isLocal()) {
Configurations.update(new Worker() {
@Override

28
designer-base/src/main/java/com/fr/design/fun/impl/DesignerStartWithEmptyFile.java

@ -0,0 +1,28 @@
package com.fr.design.fun.impl;
import com.fr.file.FILE;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.record.analyzer.EnableMetrics;
/**
* Created by rinoux on 2016/12/16.
*/
@EnableMetrics
public class DesignerStartWithEmptyFile extends AbstractDesignerStartOpenFileProcessor {
private static final DesignerStartWithEmptyFile INSTANCE = new DesignerStartWithEmptyFile();
private DesignerStartWithEmptyFile() {
}
public static DesignerStartWithEmptyFile getInstance() {
return INSTANCE;
}
@Override
@Focus(id = "com.fr.dzstartemptyfile", text = "Fine_Design_Start_Empty_File", source = Original.REPORT)
public FILE fileToShow() {
return null;
}
}

12
designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java

@ -2,8 +2,8 @@ package com.fr.design.layout;
import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.ilable.UILabel;
import com.fr.stable.AssistUtils;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.Icon;
@ -46,6 +46,16 @@ public class FRGUIPaneFactory {
return new FlowLayout(FlowLayout.LEFT, 0, 0);
}
/**
* 创建一个靠左的布局上下间隔为0左右间隔为常量
*
* @return FlowLayout对象
*/
public static LayoutManager createLeftZeroVgapNormalHgapLayout() {
return new FlowLayout(FlowLayout.LEFT, 5, 0);
}
/**
* 创建一个靠右的布局
*

5
designer-base/src/main/java/com/fr/start/BaseDesigner.java

@ -11,6 +11,7 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerStartOpenFileProcessor;
import com.fr.design.fun.impl.DesignerStartWithEmptyFile;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
@ -147,6 +148,10 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
//启动时打开指定文件的接口
DesignerStartOpenFileProcessor processor = ExtraDesignClassManager.getInstance().getSingle(DesignerStartOpenFileProcessor.XML_TAG);
// 如果插件没有,且又开启了启动时打开空文件,则使用启动时打开空文件
if (processor == null && DesignerEnvManager.getEnvManager().isStartWithEmptyFile()) {
processor = DesignerStartWithEmptyFile.getInstance();
}
if (processor != null) {
FILE f = processor.fileToShow();
if (f != null) {

Loading…
Cancel
Save