Browse Source

Merging in latest from upstream (DESIGN/design:refs/heads/feature/10.0)

* commit '1515bcf55cfb1517f7eea649a1405ce7bcbffc76': (64 commits)
  无jira任务 继承替换
  REPORT-19945 设计器启动优化和启动速度监控
  冲突
  .
  ct
  REPORT-21408 sumprecise 函数问题 公式需要变蓝, 改第三方库
  CHART-10233 对新接口做了适配和兼容
  sonar问题修复,无jira任务
  CHART-10358 箱型图 晶圆图 check
  换一个扩展性更好的方式
  rt
  REPORT-19557 ToolbarItemProvider接口需要支持表单报表块
  CHART-10233 部分接口实现改动
  CHART-10358 兼容位图地图
  无jira任务 打包
  取消屏蔽
  REPORT-20327 sonar问题修复
  屏蔽回传代码
  补充日志
  fix 调试输出
  ...
research/11.0
Bryant 5 years ago
parent
commit
926e58e131
  1. 2
      designer-base/src/main/java/com/fr/design/DesignState.java
  2. 39
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  3. 35
      designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java
  4. 65
      designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java
  5. 192
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  6. 2
      designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java
  7. 15
      designer-base/src/main/java/com/fr/design/border/UIRoundedBorder.java
  8. 9
      designer-base/src/main/java/com/fr/design/constants/DesignerLaunchStatus.java
  9. 7
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  10. 26
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  11. 7
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java
  12. 36
      designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java
  13. 2
      designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java
  14. 8
      designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java
  15. 12
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  16. 5
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  17. 12
      designer-base/src/main/java/com/fr/design/fun/ToolbarItemProvider.java
  18. 12
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractToolbarItem.java
  19. 12
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  20. 3657
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/FormulaTokenMaker.java
  21. 104
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  22. 14
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  23. 2
      designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java
  24. 39
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  25. 66
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/UpdateActionManager.java
  26. 19
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/UpdateActionModel.java
  27. 49
      designer-base/src/main/java/com/fr/design/ui/util/EdtInvocationManager.java
  28. 77
      designer-base/src/main/java/com/fr/design/ui/util/GraphicsConfig.java
  29. 55
      designer-base/src/main/java/com/fr/design/ui/util/UIUtil.java
  30. 1
      designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java
  31. 64
      designer-base/src/main/java/com/fr/start/BaseDesigner.java
  32. 4
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java
  33. 55
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java
  34. 13
      designer-base/src/main/java/com/fr/start/server/ServerManageFrame.java
  35. 8
      designer-base/src/main/resources/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/FormulaTokenMaker.flex
  36. 70
      designer-base/src/test/java/com/fr/design/ExtraDesignClassManagerTest.java
  37. 82
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  38. 3
      designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java
  39. 5
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  40. 4
      designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java
  41. 2
      designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java
  42. 25
      designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java
  43. 7
      designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractDataSetFieldsPane.java
  44. 17
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractCellDataFieldsWithSeriesValuePane.java
  45. 19
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractDataSetFieldsWithSeriesValuePane.java
  46. 3
      designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractDataPane.java
  47. 2
      designer-chart/src/main/java/com/fr/design/mainframe/MiddleChartPropertyPane.java
  48. 15
      designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java
  49. 1
      designer-form/src/main/java/com/fr/design/designer/properties/FormWidgetAuthorityEditPane.java
  50. 2
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  51. 11
      designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java
  52. 20
      designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java
  53. 10
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java
  54. 22
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java
  55. 4
      designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java
  56. 3
      designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java
  57. 9
      designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java
  58. 95
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/StartupMessageCollector.java
  59. 18
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollectConstants.java
  60. 97
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java
  61. 8
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  62. 2
      designer-realize/src/main/java/com/fr/design/webattr/FToolBar.java
  63. 11
      designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java
  64. 2
      designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java
  65. 2
      designer-realize/src/main/java/com/fr/design/webattr/WebSettingPane.java
  66. 22
      designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java
  67. 5
      designer-realize/src/main/java/com/fr/poly/creator/ECBlockEditor.java
  68. 2
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java
  69. 20
      designer-realize/src/main/java/com/fr/start/Designer.java
  70. 55
      designer-realize/src/main/java/com/fr/start/DesignerInitial.java
  71. 22
      designer-realize/src/main/java/com/fr/start/SplashContext.java
  72. 66
      designer-realize/src/main/java/com/fr/start/common/SplashCommon.java
  73. 120
      designer-realize/src/main/java/com/fr/start/common/SplashPane.java
  74. 70
      designer-realize/src/main/java/com/fr/start/common/SplashWindow.java
  75. 14
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java
  76. 21
      designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java
  77. 12
      designer-realize/src/main/java/com/fr/start/module/DesignerShowActivator.java
  78. 130
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java
  79. 11
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java
  80. 19
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java
  81. 88
      designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java
  82. 19
      designer-realize/src/main/java/com/fr/start/module/StartFinishActivator.java
  83. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_10.png
  84. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_10@2x.png

2
designer-base/src/main/java/com/fr/design/DesignState.java

@ -1,9 +1,7 @@
package com.fr.design; package com.fr.design;
import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.workspace.WorkContext;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.

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

@ -24,6 +24,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogFormatter; import com.fr.general.FRLogFormatter;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.SupportLocale;
import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark; import com.fr.general.locale.LocaleMark;
import com.fr.general.xml.GeneralXMLTools; import com.fr.general.xml.GeneralXMLTools;
@ -116,7 +117,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private Color paginationLineColor = Color.black; // line color of paper private Color paginationLineColor = Color.black; // line color of paper
private boolean supportCellEditorDef = false; private boolean supportCellEditorDef = false;
private boolean isDragPermited = false; private boolean isDragPermited = false;
private Locale language = Locale.getDefault(); private Locale language = checkLocale(Locale.getDefault());
//2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容 //2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容
private boolean useOracleSystemSpace = true; private boolean useOracleSystemSpace = true;
private int cachingTemplateLimit = CACHINGTEMPLATE_LIMIT; private int cachingTemplateLimit = CACHINGTEMPLATE_LIMIT;
@ -144,6 +145,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
//记录当前激活码的在线激活状态. //记录当前激活码的在线激活状态.
private int activeKeyStatus = -1; private int activeKeyStatus = -1;
private boolean joinProductImprove = true; private boolean joinProductImprove = true;
private boolean embedServerLazyStartup = false;
//最近使用的颜色 //最近使用的颜色
private ColorSelectConfigManager configManager = new ColorSelectConfigManager(); private ColorSelectConfigManager configManager = new ColorSelectConfigManager();
/** /**
@ -717,6 +720,24 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
designerPushUpdateConfigManager.setAutoPushUpdateEnabled(autoPushUpdateEnabled); designerPushUpdateConfigManager.setAutoPushUpdateEnabled(autoPushUpdateEnabled);
} }
/**
* 内置服务器是否使用时启动
*
* @return 结果
*/
public boolean isEmbedServerLazyStartup() {
return embedServerLazyStartup;
}
/**
* 设置内置服务器使用时启动
*
* @param embedServerLazyStartup 使用时启动
*/
public void setEmbedServerLazyStartup(boolean embedServerLazyStartup) {
this.embedServerLazyStartup = embedServerLazyStartup;
}
/** /**
* 是否磁盘空间参数 * 是否磁盘空间参数
* *
@ -1323,7 +1344,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
String tmpVal; String tmpVal;
if ((tmpVal = reader.getElementValue()) != null) { if ((tmpVal = reader.getElementValue()) != null) {
if (!CommonUtils.isNumber(tmpVal)) { if (!CommonUtils.isNumber(tmpVal)) {
setLanguage(CommonUtils.stringToLocale(tmpVal)); setLanguage(checkLocale(CommonUtils.stringToLocale(tmpVal)));
} else { } else {
// 用于兼容10.0之前的版本 // 用于兼容10.0之前的版本
int value = Integer.parseInt(tmpVal); int value = Integer.parseInt(tmpVal);
@ -1372,6 +1393,16 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
} }
} }
/**
* 对国际化进行校验
* 非简繁英日韩的默认环境 设计器全部默认为英文版本
* @param locale
* @return
*/
private Locale checkLocale(Locale locale) {
return SupportLocale.getInstance().isSupport(locale) ? locale : Locale.US;
}
private void readReportLengthUnit(XMLableReader reader) { private void readReportLengthUnit(XMLableReader reader) {
String tmpVal; String tmpVal;
if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) { if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) {
@ -1604,6 +1635,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if ((tmpVal = reader.getAttrAsString("recentSelectedConnection", null)) != null) { if ((tmpVal = reader.getAttrAsString("recentSelectedConnection", null)) != null) {
this.setRecentSelectedConnection(tmpVal); this.setRecentSelectedConnection(tmpVal);
} }
this.setEmbedServerLazyStartup(reader.getAttrAsBoolean("embedServerLazyStartup", false));
} }
private void readReportPaneAttributions(XMLableReader reader) { private void readReportPaneAttributions(XMLableReader reader) {
@ -1848,6 +1880,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (this.isTemplateTreePaneExpanded()) { if (this.isTemplateTreePaneExpanded()) {
writer.attr("templateTreePaneExpanded", this.isTemplateTreePaneExpanded()); writer.attr("templateTreePaneExpanded", this.isTemplateTreePaneExpanded());
} }
if (this.isEmbedServerLazyStartup()) {
writer.attr("embedServerLazyStartup", this.isEmbedServerLazyStartup());
}
writer.end(); writer.end();
} }

35
designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java

@ -20,6 +20,7 @@ import com.fr.plugin.AbstractExtraClassManager;
import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.injectable.PluginSingleInjection; import com.fr.plugin.injectable.PluginSingleInjection;
import com.fr.plugin.solution.closeable.CloseableContainedSet; import com.fr.plugin.solution.closeable.CloseableContainedSet;
import com.fr.stable.Filter;
import com.fr.stable.plugin.ExtraDesignClassManagerProvider; import com.fr.stable.plugin.ExtraDesignClassManagerProvider;
import java.util.ArrayList; import java.util.ArrayList;
@ -41,7 +42,7 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
private static ExtraDesignClassManager classManager = new ExtraDesignClassManager(); private static ExtraDesignClassManager classManager = new ExtraDesignClassManager();
private Set<ShortCut> shortCuts = new CloseableContainedSet<>(HashSet.class); private Set<ShortCut> shortCuts = new CloseableContainedSet<>(HashSet.class);
public static ExtraDesignClassManager getInstance() { public static ExtraDesignClassManager getInstance() {
return classManager; return classManager;
} }
@ -111,26 +112,39 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
return result.toArray(new WidgetOption[result.size()]); return result.toArray(new WidgetOption[result.size()]);
} }
public WidgetOption[] getWebWidgetOptions() { public WidgetOption[] getWebWidgetOptions() {
return getWebWidgetOptions(new Filter<ToolbarItemProvider>() {
@Override
public boolean accept(ToolbarItemProvider toolbarItemProvider) {
return true;
}
});
}
public WidgetOption[] getWebWidgetOptions(Filter<ToolbarItemProvider> filter) {
Set<ToolbarItemProvider> set = getArray(ToolbarItemProvider.XML_TAG); Set<ToolbarItemProvider> set = getArray(ToolbarItemProvider.XML_TAG);
if (set.isEmpty()) { return getWebWidgetOptions(set, filter);
}
public WidgetOption[] getWebWidgetOptions(Set<ToolbarItemProvider> set, Filter<ToolbarItemProvider> filter) {
if (set == null || set.isEmpty()) {
return new WidgetOption[0]; return new WidgetOption[0];
} }
List<WidgetOption> list = new ArrayList<>(); List<WidgetOption> list = new ArrayList<>();
for (ToolbarItemProvider provider : set) { for (ToolbarItemProvider provider : set) {
WidgetOption option = WidgetOptionFactory.createByWidgetClass( if (filter != null && filter.accept(provider)) {
provider.nameForWidget(), WidgetOption option = WidgetOptionFactory.createByWidgetClass(
IOUtils.readIcon(provider.iconPathForWidget()), provider.nameForWidget(),
provider.classForWidget() IOUtils.readIcon(provider.iconPathForWidget()),
); provider.classForWidget()
list.add(option); );
list.add(option);
}
} }
return list.toArray(new WidgetOption[list.size()]); return list.toArray(new WidgetOption[list.size()]);
} }
public Map<Class<? extends Widget>, Class<?>> getFormWidgetOptionsMap() { public Map<Class<? extends Widget>, Class<?>> getFormWidgetOptionsMap() {
Set<FormWidgetOptionProvider> set = getArray(FormWidgetOptionProvider.XML_TAG); Set<FormWidgetOptionProvider> set = getArray(FormWidgetOptionProvider.XML_TAG);
Map<Class<? extends Widget>, Class<?>> map = new HashMap<>(); Map<Class<? extends Widget>, Class<?>> map = new HashMap<>();
@ -168,7 +182,6 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
} }
public WidgetOption[] getCellWidgetOptions() { public WidgetOption[] getCellWidgetOptions() {
Set<CellWidgetOptionProvider> set = getArray(CellWidgetOptionProvider.XML_TAG); Set<CellWidgetOptionProvider> set = getArray(CellWidgetOptionProvider.XML_TAG);
if (set.isEmpty()) { if (set.isEmpty()) {

65
designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java

@ -10,38 +10,37 @@ import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
public class QuestionAction extends UpdateAction public class QuestionAction extends UpdateAction {
{
public QuestionAction() {
public QuestionAction() this.setMenuKeySet(QUESTIONS);
{ this.setMenuKeySet(QUESTIONS); this.setName(getMenuKeySet().getMenuName());
this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/question.png"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/question.png"));
}
}
@Override
@Override public void actionPerformed(ActionEvent arg0) {
public void actionPerformed(ActionEvent arg0) String url = CloudCenter.getInstance().acquireUrlByKind("bbs.questions");
{ BrowseUtils.browser(url);
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.questions"); }
BrowseUtils.browser(url);
} public static final MenuKeySet QUESTIONS = new MenuKeySet() {
public static final MenuKeySet QUESTIONS = new MenuKeySet() { @Override
@Override public char getMnemonic() {
public char getMnemonic() { return 'Q';
return 'Q'; }
}
@Override
@Override public String getMenuName() {
public String getMenuName() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_Questions");
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_Questions"); }
}
@Override
@Override public KeyStroke getKeyStroke() {
public KeyStroke getKeyStroke() { return null;
return null; }
} };
};
} }

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

@ -21,7 +21,6 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iprogressbar.UIProgressBarUI; import com.fr.design.gui.iprogressbar.UIProgressBarUI;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
@ -40,7 +39,6 @@ import com.fr.general.log.Log4jConfig;
import com.fr.locale.InterProviderFactory; import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import com.fr.third.apache.log4j.Level; import com.fr.third.apache.log4j.Level;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.Worker;
@ -48,46 +46,18 @@ import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.git.config.GcConfig; import com.fr.workspace.server.vcs.git.config.GcConfig;
import javax.swing.BorderFactory; import javax.swing.*;
import javax.swing.JFileChooser; import javax.swing.event.*;
import javax.swing.JOptionPane; import java.awt.*;
import javax.swing.BoxLayout; import java.awt.event.*;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JDialog;
import javax.swing.Timer;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FlowLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowEvent;
import java.awt.event.WindowAdapter;
import java.io.File; import java.io.File;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import static com.fr.design.i18n.Toolkit.i18nText;
/** /**
* 选项对话框 * 选项对话框
* *
@ -168,6 +138,7 @@ public class PreferencePane extends BasicPane {
private UICheckBox useUniverseDBMCheckbox; private UICheckBox useUniverseDBMCheckbox;
private UICheckBox joinProductImproveCheckBox; private UICheckBox joinProductImproveCheckBox;
private UICheckBox autoPushUpdateCheckBox; private UICheckBox autoPushUpdateCheckBox;
private UICheckBox embedServerLazyStartupCheckBox;
private UICheckBox vcsEnableCheckBox; private UICheckBox vcsEnableCheckBox;
private UICheckBox saveCommitCheckBox; private UICheckBox saveCommitCheckBox;
@ -183,7 +154,7 @@ public class PreferencePane extends BasicPane {
private JPanel gcProgressBarPanel = new JPanel(); private JPanel gcProgressBarPanel = new JPanel();
private JProgressBar gcProgressBar; private JProgressBar gcProgressBar;
private Timer gcProgressTimer; private Timer gcProgressTimer;
private UIButton gcOkButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); private UIButton gcOkButton = new UIButton(i18nText("Fine-Design_Report_OK"));
public PreferencePane() { public PreferencePane() {
this.initComponents(); this.initComponents();
@ -196,9 +167,9 @@ public class PreferencePane extends BasicPane {
UITabbedPane jtabPane = new UITabbedPane(); UITabbedPane jtabPane = new UITabbedPane();
JPanel generalPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel generalPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
jtabPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_General"), generalPane); jtabPane.addTab(i18nText("Fine-Design_Basic_General"), generalPane);
JPanel advancePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel advancePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
jtabPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Advanced"), advancePane); jtabPane.addTab(i18nText("Fine-Design_Basic_Advanced"), advancePane);
contentPane.add(jtabPane, BorderLayout.NORTH); contentPane.add(jtabPane, BorderLayout.NORTH);
createFunctionPane(generalPane); createFunctionPane(generalPane);
@ -219,31 +190,31 @@ public class PreferencePane extends BasicPane {
createServerPane(advancePane); createServerPane(advancePane);
JPanel oraclePane = FRGUIPaneFactory.createTitledBorderPane("Oracle" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Oracle_All_Tables")); JPanel oraclePane = FRGUIPaneFactory.createTitledBorderPane("Oracle" + i18nText("Fine-Design_Basic_Oracle_All_Tables"));
oracleSpace = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_All_Oracle_Tables")); oracleSpace = new UICheckBox(i18nText("Fine-Design_Basic_Show_All_Oracle_Tables"));
oraclePane.add(oracleSpace); oraclePane.add(oracleSpace);
JPanel debuggerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_Develop_Tools")); JPanel debuggerPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Develop_Tools"));
openDebugComboBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Open_Debug_Window")); openDebugComboBox = new UICheckBox(i18nText("Fine-Design_Basic_Open_Debug_Window"));
debuggerPane.add(openDebugComboBox, BorderLayout.CENTER); debuggerPane.add(openDebugComboBox, BorderLayout.CENTER);
advancePane.add(debuggerPane); advancePane.add(debuggerPane);
JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager")); JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Update_Plugin_Manager"));
useOptimizedUPMCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager")); useOptimizedUPMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager"));
upmSelectorPane.add(useOptimizedUPMCheckbox); upmSelectorPane.add(useOptimizedUPMCheckbox);
advancePane.add(upmSelectorPane); advancePane.add(upmSelectorPane);
JPanel dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Manager")); JPanel dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Database_Manager"));
useUniverseDBMCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Use_Universe_Database_Manager")); useUniverseDBMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_Universe_Database_Manager"));
dbmSelectorPane.add(useUniverseDBMCheckbox); dbmSelectorPane.add(useUniverseDBMCheckbox);
advancePane.add(dbmSelectorPane); advancePane.add(dbmSelectorPane);
JPanel improvePane = FRGUIPaneFactory.createVerticalTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Product_Improve")); JPanel improvePane = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Basic_Product_Improve"));
joinProductImproveCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Join_Product_Improve")); joinProductImproveCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Join_Product_Improve"));
improvePane.add(joinProductImproveCheckBox); improvePane.add(joinProductImproveCheckBox);
if (DesignerPushUpdateManager.getInstance().isAutoPushUpdateSupported()) { if (DesignerPushUpdateManager.getInstance().isAutoPushUpdateSupported()) {
autoPushUpdateCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Automatic_Push_Update")); autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update"));
improvePane.add(autoPushUpdateCheckBox); improvePane.add(autoPushUpdateCheckBox);
} }
@ -252,15 +223,21 @@ public class PreferencePane extends BasicPane {
spaceUpPane.add(createMemoryPane(), BorderLayout.CENTER); spaceUpPane.add(createMemoryPane(), BorderLayout.CENTER);
spaceUpPane.add(improvePane, BorderLayout.SOUTH); spaceUpPane.add(improvePane, BorderLayout.SOUTH);
advancePane.add(spaceUpPane); advancePane.add(spaceUpPane);
JPanel embedServerPanel = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Embed_Server"));
embedServerLazyStartupCheckBox = new UICheckBox(i18nText("Fine-Design_Startup_When_Needed"));
embedServerPanel.add(embedServerLazyStartupCheckBox);
advancePane.add(embedServerPanel);
} }
private void createVcsSettingPane(JPanel generalPane) { private void createVcsSettingPane(JPanel generalPane) {
JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(Toolkit.i18nText("Fine-Design_Vcs_Title")); JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Vcs_Title"));
generalPane.add(vcsPane); generalPane.add(vcsPane);
remindVcsLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Remind")); remindVcsLabel = new UILabel(i18nText("Fine-Design_Vcs_Remind"));
remindVcsLabel.setVisible(!VcsHelper.getInstance().needInit()); remindVcsLabel.setVisible(!VcsHelper.getInstance().needInit());
vcsEnableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_SaveAuto")); vcsEnableCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_SaveAuto"));
saveCommitCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_No_Delete")); saveCommitCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_No_Delete"));
saveIntervalEditor = new IntegerEditor(60); saveIntervalEditor = new IntegerEditor(60);
useIntervalCheckBox = new UICheckBox(); useIntervalCheckBox = new UICheckBox();
@ -271,8 +248,8 @@ public class PreferencePane extends BasicPane {
enableVcsPanel.add(vcsEnableCheckBox); enableVcsPanel.add(vcsEnableCheckBox);
enableVcsPanel.add(remindVcsLabel); enableVcsPanel.add(remindVcsLabel);
JPanel intervalPanel = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); JPanel intervalPanel = new JPanel(FRGUIPaneFactory.createLeftZeroLayout());
final UILabel everyLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Every")); final UILabel everyLabel = new UILabel(i18nText("Fine-Design_Vcs_Every"));
final UILabel delayLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Delay")); final UILabel delayLabel = new UILabel(i18nText("Fine-Design_Vcs_Delay"));
intervalPanel.add(useIntervalCheckBox); intervalPanel.add(useIntervalCheckBox);
intervalPanel.add(everyLabel); intervalPanel.add(everyLabel);
intervalPanel.add(saveIntervalEditor); intervalPanel.add(saveIntervalEditor);
@ -311,7 +288,7 @@ public class PreferencePane extends BasicPane {
//gc面板 //gc面板
JPanel gcControlPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); JPanel gcControlPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
JPanel gcButtonPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 40, 0)); JPanel gcButtonPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 40, 0));
gcEnableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_Storage_Optimization")); gcEnableCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_Storage_Optimization"));
gcButton = initGcButton(); gcButton = initGcButton();
gcButtonPane.add(gcButton); gcButtonPane.add(gcButton);
gcControlPane.add(gcEnableCheckBox); gcControlPane.add(gcEnableCheckBox);
@ -338,21 +315,22 @@ public class PreferencePane extends BasicPane {
} }
private void createFunctionPane(JPanel generalPane) { private void createFunctionPane(JPanel generalPane) {
JPanel functionPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Function")); JPanel functionPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Function"));
generalPane.add(functionPane); generalPane.add(functionPane);
//添加supportUndo选择项 //添加supportUndo选择项
supportUndoCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Support_Undo")); supportUndoCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Preference_Support_Undo"));
functionPane.add(supportUndoCheckBox); functionPane.add(supportUndoCheckBox);
//添加maxUndoLimit //添加maxUndoLimit
//String[] undoTimes = {"最大撤销次数","5次","10次","15次","20次","50次"}; //String[] undoTimes = {"最大撤销次数","5次","10次","15次","20次","50次"};
String[] undoTimes = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Max_Undo_Limit"), MAX_UNDO_LIMIT_5 + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_10 + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Time(s)") 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 + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_20 + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_50 + com.fr.design.i18n.Toolkit.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); maxUndoLimit = new UIComboBox(undoTimes);
functionPane.add(maxUndoLimit); functionPane.add(maxUndoLimit);
//不支持撤销则不能选择撤销可缓存,也不能设置最大撤销次数 //不支持撤销则不能选择撤销可缓存,也不能设置最大撤销次数
supportUndoCheckBox.addActionListener(new ActionListener() { supportUndoCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
maxUndoLimit.setEnabled(supportUndoCheckBox.isSelected()); maxUndoLimit.setEnabled(supportUndoCheckBox.isSelected());
} }
@ -361,31 +339,32 @@ public class PreferencePane extends BasicPane {
//添加supportDefaultParentCalculate选择项 //添加supportDefaultParentCalculate选择项
supportDefaultParentCalculateCheckBox = new UICheckBox( supportDefaultParentCalculateCheckBox = new UICheckBox(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Support_Default_Parent_Calculate")); i18nText("Fine-Design_Basic_Preference_Support_Default_Parent_Calculate"));
functionPane.add(supportDefaultParentCalculateCheckBox); functionPane.add(supportDefaultParentCalculateCheckBox);
} }
private void createEditPane(JPanel generalPane) { private void createEditPane(JPanel generalPane) {
//samuel:编辑器设置 //samuel:编辑器设置
JPanel editPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Editor_Preference")); JPanel editPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Editor_Preference"));
generalPane.add(editPane); generalPane.add(editPane);
//设置是否支持将字符串编辑为公式 //设置是否支持将字符串编辑为公式
supportStringToFormulaBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Support_String_To_Formula")); supportStringToFormulaBox = new UICheckBox(i18nText("Fine-Design_Report_Support_String_To_Formula"));
editPane.add(supportStringToFormulaBox); editPane.add(supportStringToFormulaBox);
//是否默认转化 //是否默认转化
defaultStringToFormulaBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Always")); defaultStringToFormulaBox = new UICheckBox(i18nText("Fine-Design_Basic_Always"));
editPane.add(defaultStringToFormulaBox); editPane.add(defaultStringToFormulaBox);
//不支持转化则不能默认执行 //不支持转化则不能默认执行
supportStringToFormulaBox.addActionListener(new ActionListener() { supportStringToFormulaBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
defaultStringToFormulaBox.setEnabled(supportStringToFormulaBox.isSelected()); defaultStringToFormulaBox.setEnabled(supportStringToFormulaBox.isSelected());
} }
}); });
JPanel keyStrokePane = new JPanel(new BorderLayout()); JPanel keyStrokePane = new JPanel(new BorderLayout());
keyStrokePane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Support_Auto_Complete_Shortcut") + ":"), BorderLayout.WEST); keyStrokePane.add(new UILabel(i18nText("Fine-Design_Basic_Support_Auto_Complete_Shortcut") + ":"), BorderLayout.WEST);
shortCutLabel = new UILabel(); shortCutLabel = new UILabel();
keyStrokePane.add(shortCutLabel, BorderLayout.CENTER); keyStrokePane.add(shortCutLabel, BorderLayout.CENTER);
editPane.add(keyStrokePane); editPane.add(keyStrokePane);
@ -415,7 +394,7 @@ public class PreferencePane extends BasicPane {
requestFocusInWindow(); requestFocusInWindow();
label = new UILabel(text); label = new UILabel(text);
add(GUICoreUtils.createBorderLayoutPane( add(GUICoreUtils.createBorderLayoutPane(
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Support_Current_Auto_Complete_Shortcut") + ":"), new UILabel(i18nText("Fine-Design_Basic_Support_Current_Auto_Complete_Shortcut") + ":"),
BorderLayout.WEST, BorderLayout.WEST,
label, label,
BorderLayout.CENTER), BorderLayout.CENTER),
@ -449,24 +428,24 @@ public class PreferencePane extends BasicPane {
private void createGuiOfGridPane(JPanel generalPane) { private void createGuiOfGridPane(JPanel generalPane) {
// GridPane // GridPane
JPanel guiOfGridPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Setting_Grid")); JPanel guiOfGridPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Setting_Grid"));
generalPane.add(guiOfGridPane); generalPane.add(guiOfGridPane);
supportCellEditorDefCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Support_Cell_Editor_Definition")); supportCellEditorDefCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Preference_Support_Cell_Editor_Definition"));
guiOfGridPane.add(supportCellEditorDefCheckBox); guiOfGridPane.add(supportCellEditorDefCheckBox);
isDragPermitedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Is_Drag_Permited")); isDragPermitedCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Preference_Is_Drag_Permited"));
guiOfGridPane.add(isDragPermitedCheckBox); guiOfGridPane.add(isDragPermitedCheckBox);
} }
private void createColorSettingPane(JPanel generalPane) { private void createColorSettingPane(JPanel generalPane) {
// Color Setting Pane // Color Setting Pane
JPanel colorSettingPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Setting_Colors")); JPanel colorSettingPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Setting_Colors"));
generalPane.add(colorSettingPane); generalPane.add(colorSettingPane);
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Grid_Line_Color")); new UILabel(i18nText("Fine-Design_Basic_Preference_Grid_Line_Color"));
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Pagination_Line_Color")); new UILabel(i18nText("Fine-Design_Basic_Preference_Pagination_Line_Color"));
gridLineColorTBButton = new UIColorButton(IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); gridLineColorTBButton = new UIColorButton(IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"));
gridLineColorTBButton.setEnabled(this.isEnabled()); gridLineColorTBButton.setEnabled(this.isEnabled());
@ -475,10 +454,10 @@ public class PreferencePane extends BasicPane {
paginationLineColorTBButton.setEnabled(this.isEnabled()); paginationLineColorTBButton.setEnabled(this.isEnabled());
JPanel leftPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel leftPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
leftPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Grid_Line_Color") + ":")); leftPane.add(new UILabel(i18nText("Fine-Design_Basic_Preference_Grid_Line_Color") + ":"));
leftPane.add(gridLineColorTBButton); leftPane.add(gridLineColorTBButton);
JPanel rightPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel rightPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
rightPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Pagination_Line_Color") + ":")); rightPane.add(new UILabel(i18nText("Fine-Design_Basic_Preference_Pagination_Line_Color") + ":"));
rightPane.add(paginationLineColorTBButton); rightPane.add(paginationLineColorTBButton);
colorSettingPane.add(leftPane); colorSettingPane.add(leftPane);
colorSettingPane.add(rightPane); colorSettingPane.add(rightPane);
@ -488,9 +467,9 @@ public class PreferencePane extends BasicPane {
//richer:选择导出log文件的目录. //richer:选择导出log文件的目录.
JPanel logPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); JPanel logPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane();
advancePane.add(logPane); advancePane.add(logPane);
JPanel logExportPane = FRGUIPaneFactory.createTitledBorderPane("log" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Export_Setting")); JPanel logExportPane = FRGUIPaneFactory.createTitledBorderPane("log" + i18nText("Fine-Design_Basic_Export_Setting"));
logPane.add(logExportPane); logPane.add(logExportPane);
UILabel logLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select_Export_Log_Directory") + ":"); UILabel logLabel = new UILabel(i18nText("Fine-Design_Basic_Select_Export_Log_Directory") + ":");
logExportPane.add(logLabel, BorderLayout.WEST); logExportPane.add(logLabel, BorderLayout.WEST);
logExportDirectoryField = new UITextField(24); logExportDirectoryField = new UITextField(24);
logExportPane.add(logExportDirectoryField, BorderLayout.CENTER); logExportPane.add(logExportDirectoryField, BorderLayout.CENTER);
@ -498,6 +477,7 @@ public class PreferencePane extends BasicPane {
logExportPane.add(chooseDirBtn, BorderLayout.EAST); logExportPane.add(chooseDirBtn, BorderLayout.EAST);
chooseDirBtn.setPreferredSize(new Dimension(25, 25)); chooseDirBtn.setPreferredSize(new Dimension(25, 25));
chooseDirBtn.addActionListener(new ActionListener() { chooseDirBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
JFileChooser fileChooser = new JFileChooser(); JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
@ -509,11 +489,12 @@ public class PreferencePane extends BasicPane {
} }
}); });
JPanel logLevelPane = FRGUIPaneFactory.createTitledBorderPane("log" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Level_Setting")); JPanel logLevelPane = FRGUIPaneFactory.createTitledBorderPane("log" + i18nText("Fine-Design_Basic_Level_Setting"));
logPane.add(logLevelPane); logPane.add(logLevelPane);
logLevelComboBox = new UIComboBox(LOG); logLevelComboBox = new UIComboBox(LOG);
logLevelPane.add(logLevelComboBox); logLevelPane.add(logLevelComboBox);
logLevelComboBox.addActionListener(new ActionListener() { logLevelComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
Configurations.update(new Worker() { Configurations.update(new Worker() {
@Override @Override
@ -533,13 +514,13 @@ public class PreferencePane extends BasicPane {
private void createLanPane(JPanel generalPane) { private void createLanPane(JPanel generalPane) {
// ben:选择版本语言; // ben:选择版本语言;
JPanel languageAndDashBoard_pane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); JPanel languageAndDashBoard_pane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane();
JPanel LanguagePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Choose_Language")); JPanel LanguagePane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Choose_Language"));
generalPane.add(languageAndDashBoard_pane); generalPane.add(languageAndDashBoard_pane);
languageAndDashBoard_pane.add(LanguagePane); languageAndDashBoard_pane.add(LanguagePane);
languageComboBox = createLanguageComboBox(); languageComboBox = createLanguageComboBox();
ActionLabel languageLabel = new ActionLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Designer_Language")); ActionLabel languageLabel = new ActionLabel(i18nText("Fine-Design_Basic_Designer_Language"));
languageLabel.addActionListener(new ActionListener() { languageLabel.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -553,7 +534,7 @@ public class PreferencePane extends BasicPane {
dlg.setVisible(true); dlg.setVisible(true);
} }
}); });
UILabel noticeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Work_After_Restart_Designer"));//sail:提示重启后生效 UILabel noticeLabel = new UILabel(i18nText("Fine-Design_Basic_Work_After_Restart_Designer"));//sail:提示重启后生效
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double rowSize[] = {p}; double rowSize[] = {p};
double columnSize[] = {p, p, p}; double columnSize[] = {p, p, p};
@ -599,16 +580,16 @@ public class PreferencePane extends BasicPane {
double rowSize[] = {p}; double rowSize[] = {p};
// 长度单位选择 // 长度单位选择
JPanel lengthPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Setting_Ruler_Units")); JPanel lengthPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Setting_Ruler_Units"));
advancePane.add(lengthPane); advancePane.add(lengthPane);
pageLengthComboBox = new UIComboBox(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Page_Setup_MM"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_CM"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH")}); pageLengthComboBox = new UIComboBox(new String[]{i18nText("Fine-Design_Basic_Page_Setup_MM"), i18nText("Fine-Design_Report_Unit_CM"), i18nText("Fine-Design_Report_Unit_INCH")});
pageLengthComboBox.setPreferredSize(new Dimension(80, 20)); pageLengthComboBox.setPreferredSize(new Dimension(80, 20));
pageLengthComboBox.setMinimumSize(new Dimension(80, 20)); pageLengthComboBox.setMinimumSize(new Dimension(80, 20));
reportLengthComboBox = new UIComboBox(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Page_Setup_MM"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_CM"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_PT_Duplicate")}); reportLengthComboBox = new UIComboBox(new String[]{i18nText("Fine-Design_Basic_Page_Setup_MM"), i18nText("Fine-Design_Report_Unit_CM"), i18nText("Fine-Design_Report_Unit_INCH"), i18nText("Fine-Design_Report_Unit_PT_Duplicate")});
reportLengthComboBox.setPreferredSize(new Dimension(80, 20)); reportLengthComboBox.setPreferredSize(new Dimension(80, 20));
reportLengthComboBox.setMinimumSize(new Dimension(80, 20)); reportLengthComboBox.setMinimumSize(new Dimension(80, 20));
UILabel pagelengthLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Page_Setup_Scale_Units") + ":"); UILabel pagelengthLabel = new UILabel(i18nText("Fine-Design_Basic_Page_Setup_Scale_Units") + ":");
UILabel reportLengthLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Report_Design_Ruler_Units") + ":"); UILabel reportLengthLabel = new UILabel(i18nText("Fine-Design_Basic_Report_Design_Ruler_Units") + ":");
Component[][] lengthComponents = { Component[][] lengthComponents = {
{pagelengthLabel, pageLengthComboBox, reportLengthLabel, reportLengthComboBox}, {pagelengthLabel, pageLengthComboBox, reportLengthLabel, reportLengthComboBox},
}; };
@ -621,13 +602,13 @@ public class PreferencePane extends BasicPane {
double rowSize[] = {p}; double rowSize[] = {p};
double columnSize[] = {p, p, p}; double columnSize[] = {p, p, p};
JPanel serverPortPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Port_Setting")); JPanel serverPortPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Web_Preview_Port_Setting"));
advancePane.add(serverPortPane); advancePane.add(serverPortPane);
portEditor = new IntegerEditor(); portEditor = new IntegerEditor();
portEditor.setPreferredSize(new Dimension(80, 20)); portEditor.setPreferredSize(new Dimension(80, 20));
portEditor.setMinimumSize(new Dimension(80, 20)); portEditor.setMinimumSize(new Dimension(80, 20));
UILabel notiJlabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Work_After_Restart_Designer")); UILabel notiJlabel = new UILabel(i18nText("Fine-Design_Basic_Work_After_Restart_Designer"));
UILabel serverPortLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Port") + ":"); UILabel serverPortLabel = new UILabel(i18nText("Fine-Design_Basic_Web_Preview_Port") + ":");
Component[][] portComponents = { Component[][] portComponents = {
{serverPortLabel, portEditor, notiJlabel}, {serverPortLabel, portEditor, notiJlabel},
}; };
@ -636,10 +617,10 @@ public class PreferencePane extends BasicPane {
} }
private JPanel createMemoryPane() { private JPanel createMemoryPane() {
JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template")); JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Caching_Template"));
UILabel memoryLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Max_Caching_Template")); UILabel memoryLabel = new UILabel(i18nText("Fine-Design_Basic_Preference_Max_Caching_Template"));
UILabel memoryTipLabel = FRWidgetFactory.createLineWrapLabel( UILabel memoryTipLabel = FRWidgetFactory.createLineWrapLabel(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template_Tip"), MEMORY_TIP_LABEL_MAX_WIDTH); i18nText("Fine-Design_Basic_Preference_Caching_Template_Tip"), MEMORY_TIP_LABEL_MAX_WIDTH);
memoryTipLabel.setBorder(BorderFactory.createEmptyBorder(0, CACHING_GAP, 0, 0)); memoryTipLabel.setBorder(BorderFactory.createEmptyBorder(0, CACHING_GAP, 0, 0));
cachingTemplateSpinner = new UISpinner(0, CACHING_MAX, 1, CACHING_DEFAULT); cachingTemplateSpinner = new UISpinner(0, CACHING_MAX, 1, CACHING_DEFAULT);
JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout());
@ -652,7 +633,7 @@ public class PreferencePane extends BasicPane {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_M_Window_Preference"); return i18nText("Fine-Design_Basic_M_Window_Preference");
} }
/** /**
@ -734,6 +715,8 @@ public class PreferencePane extends BasicPane {
if (this.autoPushUpdateCheckBox != null) { if (this.autoPushUpdateCheckBox != null) {
this.autoPushUpdateCheckBox.setSelected(designerEnvManager.isAutoPushUpdateEnabled()); this.autoPushUpdateCheckBox.setSelected(designerEnvManager.isAutoPushUpdateEnabled());
} }
this.embedServerLazyStartupCheckBox.setSelected(designerEnvManager.isEmbedServerLazyStartup());
} }
private int chooseCase(int sign) { private int chooseCase(int sign) {
@ -795,6 +778,7 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected()); designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected());
designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue()); designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue());
designerEnvManager.setJoinProductImprove(this.joinProductImproveCheckBox.isSelected()); designerEnvManager.setJoinProductImprove(this.joinProductImproveCheckBox.isSelected());
designerEnvManager.setEmbedServerLazyStartup(this.embedServerLazyStartupCheckBox.isSelected());
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager(); VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager();
vcsConfigManager.setSaveInterval(this.saveIntervalEditor.getValue()); vcsConfigManager.setSaveInterval(this.saveIntervalEditor.getValue());
vcsConfigManager.setVcsEnable(this.vcsEnableCheckBox.isSelected()); vcsConfigManager.setVcsEnable(this.vcsEnableCheckBox.isSelected());
@ -842,7 +826,7 @@ public class PreferencePane extends BasicPane {
@Override @Override
public Class<? extends Configuration>[] targets() { public Class<? extends Configuration>[] targets() {
return new Class[] {ServerPreferenceConfig.class}; return new Class[]{ServerPreferenceConfig.class};
} }
}); });
@ -855,12 +839,12 @@ public class PreferencePane extends BasicPane {
} }
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
null, null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Language_Change_Successful"), i18nText("Fine-Design_Basic_Language_Change_Successful"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), i18nText("Fine-Design_Basic_Plugin_Warning"),
JOptionPane.YES_NO_OPTION, JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE,
null, null,
new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Restart_Designer"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Restart_Designer_Later")}, new String[]{i18nText("Fine-Design_Basic_Restart_Designer"), i18nText("Fine-Design_Basic_Restart_Designer_Later")},
null null
); );
if (rv == JOptionPane.OK_OPTION) { if (rv == JOptionPane.OK_OPTION) {
@ -885,7 +869,7 @@ public class PreferencePane extends BasicPane {
private void tryGc() { private void tryGc() {
final SwingWorker<Boolean, Void> worker = new SwingWorker<Boolean, Void>() { final SwingWorker<Boolean, Void> worker = new SwingWorker<Boolean, Void>() {
private long size = 0; private long size = 0;
@Override @Override
protected Boolean doInBackground() { protected Boolean doInBackground() {
@ -898,12 +882,12 @@ public class PreferencePane extends BasicPane {
try { try {
get(); get();
} catch (ExecutionException e) { } catch (ExecutionException e) {
updateGcDialogPanelInfo(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Need_Update_Remote_Server_Jar")); updateGcDialogPanelInfo(i18nText("Fine-Design_Vcs_Need_Update_Remote_Server_Jar"));
return; return;
} catch (InterruptedException e) { } catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e, e.getMessage()); FineLoggerFactory.getLogger().error(e, e.getMessage());
} }
updateGcDialogPanelInfo(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Reduce_File_Size") + fileSizeConvert(size)); updateGcDialogPanelInfo(i18nText("Fine-Design_Vcs_Reduce_File_Size") + fileSizeConvert(size));
gcDialogDownPane.revalidate(); gcDialogDownPane.revalidate();
gcDialogDownPane.repaint(); gcDialogDownPane.repaint();
gcDialogDownPane.add(gcOkButton); gcDialogDownPane.add(gcOkButton);
@ -940,7 +924,7 @@ public class PreferencePane extends BasicPane {
gcProgressBarPanel.remove(gcProgressBar); gcProgressBarPanel.remove(gcProgressBar);
} }
if (null != gcDialog) { if (null != gcDialog) {
gcDialog.setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News")); gcDialog.setTitle(i18nText("Fine-Design_Form_Joption_News"));
} }
} }
@ -948,7 +932,7 @@ public class PreferencePane extends BasicPane {
* 初始化 gc 对话框 * 初始化 gc 对话框
*/ */
private void initGcDialog() { private void initGcDialog() {
gcDialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(PreferencePane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Clean_Progress") + "...", true); gcDialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(PreferencePane.this), i18nText("Fine-Design_Vcs_Clean_Progress") + "...", true);
gcDialog.setSize(new Dimension(340, 140)); gcDialog.setSize(new Dimension(340, 140));
JPanel jp = new JPanel(); JPanel jp = new JPanel();
@ -983,7 +967,7 @@ public class PreferencePane extends BasicPane {
jp.setLayout(layout); jp.setLayout(layout);
//提示 //提示
gcMessage = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Vcs_Cleaning")); gcMessage = new UILabel(i18nText("Fine-Design_Vcs_Cleaning"));
// 创建一个进度条 // 创建一个进度条
gcProgressBar = createGcProgressBar(0, 30, 240, 15, Color.GREEN); gcProgressBar = createGcProgressBar(0, 30, 240, 15, Color.GREEN);
gcProgressTimer = createGcProgressTimer(500, gcProgressBar); gcProgressTimer = createGcProgressTimer(500, gcProgressBar);
@ -1075,7 +1059,7 @@ public class PreferencePane extends BasicPane {
* @return * @return
*/ */
private UIButton initGcButton() { private UIButton initGcButton() {
UIButton gcButton = new UIButton(Toolkit.i18nText("Fine-Design_Vcs_Clean")); UIButton gcButton = new UIButton(i18nText("Fine-Design_Vcs_Clean"));
gcButton.setPreferredSize(new Dimension(100, 15)); gcButton.setPreferredSize(new Dimension(100, 15));
gcButton.setRoundBorder(true, Constants.LEFT); gcButton.setRoundBorder(true, Constants.LEFT);
return gcButton; return gcButton;

2
designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java

@ -21,7 +21,7 @@ public class SwitchExistEnv extends MenuDef {
initMenuDef(); initMenuDef();
} }
private void initMenuDef() { private void initMenuDef() {
Iterator<String> nameIt = DesignerEnvManager.getEnvManager().getEnvNameIterator(); Iterator<String> nameIt = DesignerEnvManager.getEnvManager().getEnvNameIterator();
while (nameIt.hasNext()) { while (nameIt.hasNext()) {
String name = nameIt.next(); String name = nameIt.next();

15
designer-base/src/main/java/com/fr/design/border/UIRoundedBorder.java

@ -13,23 +13,23 @@ import java.awt.geom.RoundRectangle2D;
public class UIRoundedBorder extends LineBorder { public class UIRoundedBorder extends LineBorder {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private int roundedCorner; private int roundedCorner;
private int lineStyle; private int lineStyle;
public UIRoundedBorder(Color color) { public UIRoundedBorder(Color color) {
super(color); super(color);
} }
public UIRoundedBorder(Color color, int thickness){ public UIRoundedBorder(Color color, int thickness){
super(color, thickness); super(color, thickness);
} }
public UIRoundedBorder(Color color, int thickness, int roundedCorners){ public UIRoundedBorder(Color color, int thickness, int roundedCorners){
super(color, thickness, true); super(color, thickness, true);
this.roundedCorner = roundedCorners; this.roundedCorner = roundedCorners;
} }
public UIRoundedBorder(int lineStyle, Color color, int roundedCorners){ public UIRoundedBorder(int lineStyle, Color color, int roundedCorners){
super(color, GraphHelper.getLineStyleSize(lineStyle), true); super(color, GraphHelper.getLineStyleSize(lineStyle), true);
this.lineStyle = lineStyle; this.lineStyle = lineStyle;
@ -44,14 +44,15 @@ public class UIRoundedBorder extends LineBorder {
return lineStyle; return lineStyle;
} }
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height){ public void paintBorder(Component c, Graphics g, int x, int y, int width, int height){
Color oldColor = g.getColor(); Color oldColor = g.getColor();
Graphics2D g2d = (Graphics2D)g; Graphics2D g2d = (Graphics2D)g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(lineColor); g2d.setColor(lineColor);
GraphHelper.draw(g2d, new RoundRectangle2D.Double(x, y, width - 1, height-1, roundedCorner, roundedCorner),lineStyle); GraphHelper.draw(g2d, new RoundRectangle2D.Double(x, y, width - 1.0D, height - 1.0D, roundedCorner, roundedCorner), lineStyle);
g2d.setColor(oldColor); g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
} }
} }

9
designer-base/src/main/java/com/fr/design/constants/DesignerLaunchStatus.java

@ -21,10 +21,15 @@ public enum DesignerLaunchStatus implements Event<Null> {
*/ */
DESIGNER_INIT_COMPLETE, DESIGNER_INIT_COMPLETE,
/**
* 打开模板完成
*/
OPEN_LAST_FILE_COMPLETE,
/** /**
* 启动完成 * 启动完成
*/ */
OPEN_LAST_FILE_COMPLETE; STARTUP_COMPLETE;
private static DesignerLaunchStatus status; private static DesignerLaunchStatus status;
@ -34,6 +39,6 @@ public enum DesignerLaunchStatus implements Event<Null> {
public static void setStatus(DesignerLaunchStatus state) { public static void setStatus(DesignerLaunchStatus state) {
status = state; status = state;
EventDispatcher.asyncFire(DesignerLaunchStatus.getStatus()); EventDispatcher.fire(DesignerLaunchStatus.getStatus());
} }
} }

7
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java

@ -35,7 +35,7 @@ public class ConnectionTableProcedurePane extends BasicPane {
private ConnectionComboBoxPanel connectionComboBox; private ConnectionComboBoxPanel connectionComboBox;
private UICheckBox tableCheckBox; private UICheckBox tableCheckBox;
private UICheckBox viewCheckBox; private UICheckBox viewCheckBox;
private UITextField searchField; protected UITextField searchField;
private TableViewList tableViewList; private TableViewList tableViewList;
private java.util.List<DoubleClickSelectedNodeOnTreeListener> listeners = new java.util.ArrayList<DoubleClickSelectedNodeOnTreeListener>(); private java.util.List<DoubleClickSelectedNodeOnTreeListener> listeners = new java.util.ArrayList<DoubleClickSelectedNodeOnTreeListener>();
@ -90,12 +90,17 @@ public class ConnectionTableProcedurePane extends BasicPane {
this.add(tableViewListPane, BorderLayout.CENTER); this.add(tableViewListPane, BorderLayout.CENTER);
this.add(filterPane, BorderLayout.SOUTH); this.add(filterPane, BorderLayout.SOUTH);
this.setPreferredSize(new Dimension(WIDTH, getPreferredSize().height)); this.setPreferredSize(new Dimension(WIDTH, getPreferredSize().height));
addKeyMonitor();
} }
protected void filter(Connection connection, String conName, List<String> nameList) { protected void filter(Connection connection, String conName, List<String> nameList) {
connection.addConnection(nameList, conName, new Class[]{AbstractDatabaseConnection.class}); connection.addConnection(nameList, conName, new Class[]{AbstractDatabaseConnection.class});
} }
protected void addKeyMonitor() {
}
protected JPanel createCheckBoxgroupPane() { protected JPanel createCheckBoxgroupPane() {
JPanel checkBoxgroupPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); JPanel checkBoxgroupPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2);
JPanel first = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel first = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();

26
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -57,6 +57,8 @@ import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.FocusListener; import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -95,6 +97,30 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
connection.addConnection(nameList, conName, new Class[]{JDBCDatabaseConnection.class, JNDIDatabaseConnection.class}); connection.addConnection(nameList, conName, new Class[]{JDBCDatabaseConnection.class, JNDIDatabaseConnection.class});
} }
@Override
protected void addKeyMonitor() {
searchField.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
e.setKeyCode(KeyEvent.VK_UP);
DBTableDataPane.this.connectionTableProcedurePane.requestFocus();
}
}
@Override
public void keyReleased(KeyEvent e) {
}
});
}
}; };
connectionTableProcedurePane.addDoubleClickListener(new DoubleClickSelectedNodeOnTreeListener() { connectionTableProcedurePane.addDoubleClickListener(new DoubleClickSelectedNodeOnTreeListener() {

7
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java

@ -40,7 +40,8 @@ public class MaxMemRowCountPanel extends UIToolbar {
} }
} }
}; };
@Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize(); Dimension dim = super.getPreferredSize();
dim.width = 340; dim.width = 340;
@ -81,7 +82,7 @@ public class MaxMemRowCountPanel extends UIToolbar {
public void setValue(int value) { public void setValue(int value) {
if (value >= 0) { if (value >= 0) {
showMaxPanel(); showMaxPanel();
numberSpinner.setValue(Integer.valueOf(value)); numberSpinner.setValue(value);
} else { } else {
showAllPanel(); showAllPanel();
} }
@ -94,4 +95,4 @@ public class MaxMemRowCountPanel extends UIToolbar {
return ((Number) numberSpinner.getValue()).intValue(); return ((Number) numberSpinner.getValue()).intValue();
} }
} }
} }

36
designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java

@ -48,7 +48,7 @@ public class JWizardPanel extends BasicPane {
// Set the layout for the content area // Set the layout for the content area
contentPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); contentPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
contentPane.setBorder(BorderFactory.createEmptyBorder(2, 2, 4, 4)); contentPane.setBorder(BorderFactory.createEmptyBorder(2, 2, 4, 4));
// Step title // Step title
@ -60,16 +60,16 @@ public class JWizardPanel extends BasicPane {
add(titlePanel, BorderLayout.NORTH); add(titlePanel, BorderLayout.NORTH);
add(contentPane, BorderLayout.CENTER); add(contentPane, BorderLayout.CENTER);
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "wizard"; return "wizard";
} }
/** /**
* Set the title to use for this step. Normally this title would be unique * Set the title to use for this step. Normally this title would be unique
* for each wizards step. * for each wizards step.
* *
* @param stepTitle The title to use for this step. * @param stepTitle The title to use for this step.
*/ */
public void setStepTitle(String stepTitle) { public void setStepTitle(String stepTitle) {
@ -82,7 +82,7 @@ public class JWizardPanel extends BasicPane {
/** /**
* Get the step title to use for this step. * Get the step title to use for this step.
* *
* @return The step title to use for this step. * @return The step title to use for this step.
*/ */
public String getStepTitle() { public String getStepTitle() {
@ -93,7 +93,7 @@ public class JWizardPanel extends BasicPane {
* Get a JPanel to use for adding your own components to this WizardPanel. * Get a JPanel to use for adding your own components to this WizardPanel.
* Do not add components directly to the JWizardPanel. The JPanel uses the * Do not add components directly to the JWizardPanel. The JPanel uses the
* layout given in the JWizardPanel constructor. * layout given in the JWizardPanel constructor.
* *
* @return The JPanel to use for adding components for this wizard step. * @return The JPanel to use for adding components for this wizard step.
*/ */
public JPanel getContentPane() { public JPanel getContentPane() {
@ -102,7 +102,7 @@ public class JWizardPanel extends BasicPane {
/** /**
* Get the wizard step to go to when the Back button is pressed. * Get the wizard step to go to when the Back button is pressed.
* *
* @return The wizard step to go to when the Back button is pressed. * @return The wizard step to go to when the Back button is pressed.
*/ */
@ -114,7 +114,7 @@ public class JWizardPanel extends BasicPane {
* Set the wizard step to go to when the Back button is pressed. This should * Set the wizard step to go to when the Back button is pressed. This should
* be set in the constructor of the JWizardPanel subclass since it * be set in the constructor of the JWizardPanel subclass since it
* determines whether the Back button is enabled or not. * determines whether the Back button is enabled or not.
* *
* @param backStep * @param backStep
* The wizard step to go to when the Back button is pressed. * The wizard step to go to when the Back button is pressed.
*/ */
@ -129,7 +129,7 @@ public class JWizardPanel extends BasicPane {
/** /**
* Get the wizard step to go to when the Next button is pressed. * Get the wizard step to go to when the Next button is pressed.
* *
* @return The wizard step to go to when the Next button is pressed. * @return The wizard step to go to when the Next button is pressed.
*/ */
public int getNextStep() { public int getNextStep() {
@ -140,7 +140,7 @@ public class JWizardPanel extends BasicPane {
* Set the wizard step to go to when the Next button is pressed. This should * Set the wizard step to go to when the Next button is pressed. This should
* be set in the constructor of the JWizardPanel subclass since it * be set in the constructor of the JWizardPanel subclass since it
* determines whether the Next and Finish buttons are enabled or not. * determines whether the Next and Finish buttons are enabled or not.
* *
* @param nextStep The wizard step to go to when the Next button is pressed. * @param nextStep The wizard step to go to when the Next button is pressed.
*/ */
public void setNextStep(int nextStep) { public void setNextStep(int nextStep) {
@ -154,7 +154,7 @@ public class JWizardPanel extends BasicPane {
/** /**
* Returns the JWizardDialog in which this JWizardPanel resides. This is * Returns the JWizardDialog in which this JWizardPanel resides. This is
* valid only after the panel has been added to the dialog. * valid only after the panel has been added to the dialog.
* *
* @return The JWizardDialog in which this JWizardPanel resides. * @return The JWizardDialog in which this JWizardPanel resides.
*/ */
@ -168,7 +168,7 @@ public class JWizardPanel extends BasicPane {
public void addNotify() { public void addNotify() {
if (firstNotify) { if (firstNotify) {
Font font = stepTitleLabel.getFont(); Font font = stepTitleLabel.getFont();
font = font.deriveFont(Font.BOLD, font.getSize() * 14 / 10); font = font.deriveFont(Font.BOLD, font.getSize() * 14 / 10.0F);
stepTitleLabel.setFont(font); stepTitleLabel.setFont(font);
firstNotify = false; firstNotify = false;
} }
@ -177,7 +177,7 @@ public class JWizardPanel extends BasicPane {
/** /**
* Set the JWizardDialog parent for this JWizardPanel. * Set the JWizardDialog parent for this JWizardPanel.
* *
* @param dialogParent * @param dialogParent
* The JWizardPanel parent for this JWizardPanel. * The JWizardPanel parent for this JWizardPanel.
*/ */
@ -188,7 +188,7 @@ public class JWizardPanel extends BasicPane {
/** /**
* Calls back(). This allows the JWizardDialog to call the protected method * Calls back(). This allows the JWizardDialog to call the protected method
* back(). * back().
* *
* @see #back() * @see #back()
*/ */
@ -199,7 +199,7 @@ public class JWizardPanel extends BasicPane {
/** /**
* Calls next(). This allows the JWizardDialog to call the protected method * Calls next(). This allows the JWizardDialog to call the protected method
* next(). * next().
* *
* @see #next() * @see #next()
*/ */
void doNext() { void doNext() {
@ -209,7 +209,7 @@ public class JWizardPanel extends BasicPane {
/** /**
* Called when the Back button is pressed. By default this displays the * Called when the Back button is pressed. By default this displays the
* wizard step set by setBackStep(). * wizard step set by setBackStep().
* *
* @see #setBackStep(int) * @see #setBackStep(int)
*/ */
protected void back() { protected void back() {
@ -219,11 +219,11 @@ public class JWizardPanel extends BasicPane {
/** /**
* Called when the Next button is pressed. By default this displays the * Called when the Next button is pressed. By default this displays the
* wizard step set by setNextStep(). * wizard step set by setNextStep().
* *
* @see #setNextStep(int) * @see #setNextStep(int)
*/ */
protected void next() { protected void next() {
dialogParent.goTo(getNextStep()); dialogParent.goTo(getNextStep());
} }
} }

2
designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java

@ -163,7 +163,7 @@ public class QQLoginWebPane extends JFXPanel {
final BooleanProperty confirmationResult = new SimpleBooleanProperty(); final BooleanProperty confirmationResult = new SimpleBooleanProperty();
// initialize the confirmation dialog // initialize the confirmation dialog
final Stage dialog = new Stage(StageStyle.UTILITY); final Stage dialog = new Stage(StageStyle.UTILITY);
dialog.setX(Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 2 - DEFAULT_CONFIRM_WIDTH / 2 + DEFAULT_OFFEST); dialog.setX(Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 2 - DEFAULT_CONFIRM_WIDTH / 2.0D + DEFAULT_OFFEST);
dialog.setY(Toolkit.getDefaultToolkit().getScreenSize().getHeight() / 2 + DEFAULT_OFFEST); dialog.setY(Toolkit.getDefaultToolkit().getScreenSize().getHeight() / 2 + DEFAULT_OFFEST);
dialog.setHeight(DEFAULT_CONFIRM_HEIGHT); dialog.setHeight(DEFAULT_CONFIRM_HEIGHT);
dialog.setWidth(DEFAULT_CONFIRM_WIDTH); dialog.setWidth(DEFAULT_CONFIRM_WIDTH);

8
designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java

@ -11,6 +11,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.PluginStoreConstants; import com.fr.plugin.PluginStoreConstants;
@ -293,10 +294,9 @@ public class WebViewDlgHelper {
new SwingWorker<Void, Void>() { new SwingWorker<Void, Void>() {
@Override @Override
protected Void doInBackground() throws Exception { protected Void doInBackground() throws Exception {
HttpClient httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("shop.plugin.update") + "?" + PluginUtils.FR_VERSION + "=" + ProductConstants.VERSION + "&version=" + PluginStoreConstants.getInstance().getProps("VERSION")); String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.update");
httpClient.asGet(); if (url != null) {
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { String text = HttpToolbox.get(url + "?" + PluginUtils.FR_VERSION + "=" + ProductConstants.VERSION + "&version=" + PluginStoreConstants.getInstance().getProps("VERSION"));
String text = httpClient.getResponseText();
JSONObject resultJSONObject = new JSONObject(text); JSONObject resultJSONObject = new JSONObject(text);
String isLatest = resultJSONObject.optString("result"); String isLatest = resultJSONObject.optString("result");
if (!ComparatorUtils.equals(isLatest, LATEST)) { if (!ComparatorUtils.equals(isLatest, LATEST)) {

12
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -264,11 +264,6 @@ public class HistoryTemplateListCache implements CallbackEvent {
if (size == index + 1 && index > 0) { if (size == index + 1 && index > 0) {
//如果删除的是后一个Tab,则定位到前一个 //如果删除的是后一个Tab,则定位到前一个
MutilTempalteTabPane.getInstance().setSelectedIndex(index - 1); MutilTempalteTabPane.getInstance().setSelectedIndex(index - 1);
JTemplate selectedFile = MutilTempalteTabPane.getInstance().getSelectedFile();
if (!isCurrentEditingFile(selectedFile.getPath())) {
//如果此时面板上的实时刷新的selectedIndex得到的和历史的不一样
DesignerContext.getDesignerFrame().activateJTemplate(selectedFile);
}
} }
} }
} }
@ -277,6 +272,13 @@ public class HistoryTemplateListCache implements CallbackEvent {
if (openFileCount == 0) { if (openFileCount == 0) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(); DesignerContext.getDesignerFrame().addAndActivateJTemplate();
} }
JTemplate selectedFile = MutilTempalteTabPane.getInstance().getSelectedFile();
if (!isCurrentEditingFile(selectedFile.getPath())) {
//如果此时面板上的实时刷新的selectedIndex得到的和历史的不一样
DesignerContext.getDesignerFrame().activateJTemplate(selectedFile);
}
MutilTempalteTabPane.getInstance().repaint(); MutilTempalteTabPane.getInstance().repaint();
} }

5
designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

@ -156,6 +156,9 @@ public class MutilTempalteTabPane extends JComponent {
} }
public JTemplate getSelectedFile() { public JTemplate getSelectedFile() {
if (openedTemplate.size() == selectedIndex) {
selectedIndex = Math.max(--selectedIndex, 0);
}
return openedTemplate.get(selectedIndex); return openedTemplate.get(selectedIndex);
} }
@ -322,7 +325,7 @@ public class MutilTempalteTabPane extends JComponent {
@Override @Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
double maxWidth = getWidth() - LIST_BUTTON_WIDTH; //最大宽度 double maxWidth = getWidth() - LIST_BUTTON_WIDTH * 1.0D; //最大宽度
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
paintBackgroundAndLine(g2d, maxWidth); paintBackgroundAndLine(g2d, maxWidth);
} }

12
designer-base/src/main/java/com/fr/design/fun/ToolbarItemProvider.java

@ -1,6 +1,8 @@
package com.fr.design.fun; package com.fr.design.fun;
import com.fr.design.mainframe.JTemplate;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.stable.Filter;
import com.fr.stable.fun.mark.Mutable; import com.fr.stable.fun.mark.Mutable;
/** /**
@ -8,7 +10,7 @@ import com.fr.stable.fun.mark.Mutable;
* @since : 8.0 * @since : 8.0
* 自定义web工具栏菜单 * 自定义web工具栏菜单
*/ */
public interface ToolbarItemProvider extends Mutable { public interface ToolbarItemProvider extends Mutable, Filter<JTemplate> {
String XML_TAG = "ToolbarItemProvider"; String XML_TAG = "ToolbarItemProvider";
@ -36,4 +38,12 @@ public interface ToolbarItemProvider extends Mutable {
*/ */
String nameForWidget(); String nameForWidget();
/**
* 模板决策报表 or cpt是否支持此工具栏按钮
* JTemplate 模板
* @return 支持返回true, 否则false
*/
@Override
boolean accept(JTemplate template);
} }

12
designer-base/src/main/java/com/fr/design/fun/impl/AbstractToolbarItem.java

@ -1,6 +1,9 @@
package com.fr.design.fun.impl; package com.fr.design.fun.impl;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.ToolbarItemProvider; import com.fr.design.fun.ToolbarItemProvider;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.stable.fun.impl.AbstractProvider; import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API; import com.fr.stable.fun.mark.API;
@ -10,6 +13,7 @@ import com.fr.stable.fun.mark.API;
@API(level = ToolbarItemProvider.CURRENT_LEVEL) @API(level = ToolbarItemProvider.CURRENT_LEVEL)
public abstract class AbstractToolbarItem extends AbstractProvider implements ToolbarItemProvider { public abstract class AbstractToolbarItem extends AbstractProvider implements ToolbarItemProvider {
@Override
public int currentAPILevel() { public int currentAPILevel() {
return CURRENT_LEVEL; return CURRENT_LEVEL;
} }
@ -18,4 +22,12 @@ public abstract class AbstractToolbarItem extends AbstractProvider implements To
public String mark4Provider() { public String mark4Provider() {
return getClass().getName(); return getClass().getName();
} }
@Override
public boolean accept(JTemplate jTemplate) {
if (jTemplate == null) {
jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
}
return jTemplate == null || jTemplate.isJWorkBook() || jTemplate instanceof JVirtualTemplate;
}
} }

12
designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java

@ -6,7 +6,6 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -47,6 +46,7 @@ public class ProgressDialog extends UIDialog {
progressBar.setBorderPainted(false); progressBar.setBorderPainted(false);
progressBar.setOpaque(false); progressBar.setOpaque(false);
progressBar.setBorder(null); progressBar.setBorder(null);
progressBar.setMaximum(1000);
panel.add(progressBar, BorderLayout.CENTER); panel.add(progressBar, BorderLayout.CENTER);
text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Project"), JLabel.CENTER); text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Project"), JLabel.CENTER);
FRFont font = FRFont.getInstance().applySize(14).applyForeground(new ColorUIResource(333334)); FRFont font = FRFont.getInstance().applySize(14).applyForeground(new ColorUIResource(333334));
@ -54,7 +54,6 @@ public class ProgressDialog extends UIDialog {
panel.add(text, BorderLayout.SOUTH); panel.add(text, BorderLayout.SOUTH);
panel.setVisible(true); panel.setVisible(true);
centerDialog.getContentPane().add(panel); centerDialog.getContentPane().add(panel);
} }
@Override @Override
@ -72,11 +71,20 @@ public class ProgressDialog extends UIDialog {
progressBar.setValue(value); progressBar.setValue(value);
} }
public void setProgressMaximum(int value) {
progressBar.setMaximum(value);
}
public int getProgressMaximum() {
return progressBar.getMaximum();
}
@Override @Override
public void dispose() { public void dispose() {
centerDialog.dispose(); centerDialog.dispose();
super.dispose(); super.dispose();
} }
public void updateLoadingText(String text) { public void updateLoadingText(String text) {
this.text.setText(text); this.text.setText(text);
} }

3657
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/FormulaTokenMaker.java

File diff suppressed because it is too large Load Diff

104
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -63,6 +63,7 @@ import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import org.jetbrains.annotations.Nullable;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -169,6 +170,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private WindowAdapter windowAdapter = new WindowAdapter() { private WindowAdapter windowAdapter = new WindowAdapter() {
@Override
public void windowOpened(WindowEvent e) { public void windowOpened(WindowEvent e) {
} }
@ -194,6 +196,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private JComponent closeButton = new JComponent() { private JComponent closeButton = new JComponent() {
@Override
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
g.setColor(UIConstants.NORMAL_BACKGROUND); g.setColor(UIConstants.NORMAL_BACKGROUND);
@ -205,6 +208,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private MouseListener closeMouseListener = new MouseAdapter() { private MouseListener closeMouseListener = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
closeMode = UIConstants.CLOSE_PRESS_AUTHORITY; closeMode = UIConstants.CLOSE_PRESS_AUTHORITY;
@ -212,6 +216,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
closeButton.repaint(); closeButton.repaint();
} }
@Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
closeMode = UIConstants.CLOSE_OF_AUTHORITY; closeMode = UIConstants.CLOSE_OF_AUTHORITY;
@ -219,6 +224,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
closeButton.repaint(); closeButton.repaint();
} }
@Override
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
closeMode = UIConstants.CLOSE_OVER_AUTHORITY; closeMode = UIConstants.CLOSE_OVER_AUTHORITY;
@ -226,12 +232,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
closeButton.repaint(); closeButton.repaint();
} }
@Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
if (DesignModeContext.isAuthorityEditing()) { if (DesignModeContext.isAuthorityEditing()) {
closeAuthorityEditing(); closeAuthorityEditing();
} }
} }
@Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
closeMode = UIConstants.CLOSE_OVER_AUTHORITY; closeMode = UIConstants.CLOSE_OVER_AUTHORITY;
@ -255,6 +263,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
basePane.setLayout(new BorderLayout()); basePane.setLayout(new BorderLayout());
toolbarPane = new JPanel() { toolbarPane = new JPanel() {
@Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize(); Dimension dim = super.getPreferredSize();
@ -266,7 +275,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
JPanel eastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel eastPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
eastPane.add(ad.createLargeToolbar(), BorderLayout.WEST); eastPane.add(ad.createLargeToolbar(), BorderLayout.WEST);
eastCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); eastCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
eastCenterPane.add(combineUp = combineUpTooBar(null), BorderLayout.NORTH); combineUpTooBar();
eastCenterPane.add(combineUp, BorderLayout.NORTH);
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.add(newWorkBookPane = ad.getNewTemplatePane(), BorderLayout.WEST); panel.add(newWorkBookPane = ad.getNewTemplatePane(), BorderLayout.WEST);
panel.add(MutilTempalteTabPane.getInstance(), BorderLayout.CENTER); panel.add(MutilTempalteTabPane.getInstance(), BorderLayout.CENTER);
@ -300,6 +310,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
this.addComponentListener(new ComponentAdapter() { this.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) { public void componentResized(ComponentEvent e) {
reCalculateFrameSize(); reCalculateFrameSize();
@ -316,14 +327,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
initMenuPane(); initMenuPane();
this.progressDialog = new ProgressDialog(this); this.progressDialog = new ProgressDialog(this);
} }
public void resizeFrame() { public void resizeFrame() {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite();
reCalculateFrameSize(); reCalculateFrameSize();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().doResize(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().doResize();
} }
public void closeAuthorityEditing() { public void closeAuthorityEditing() {
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL);
WestRegionContainerPane.getInstance().replaceDownPane( WestRegionContainerPane.getInstance().replaceDownPane(
@ -333,7 +344,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus()); HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus());
needToAddAuhtorityPaint(); needToAddAuhtorityPaint();
refreshDottedLine(); refreshDottedLine();
fireAuthorityStateToNomal(); fireAuthorityStateToNormal();
EventDispatcher.fire(DesignAuthorityEventType.StopEdit, DesignerFrame.this); EventDispatcher.fire(DesignAuthorityEventType.StopEdit, DesignerFrame.this);
} }
@ -603,13 +614,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/** /**
* 退出权限编辑时将所有的做过权限编辑的状态作为一个状态赋给报报表主体 * 退出权限编辑时将所有的做过权限编辑的状态作为一个状态赋给报报表主体
*/ */
private void fireAuthorityStateToNomal() { private void fireAuthorityStateToNormal() {
java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList();
for (int i = 0; i < opendedTemplate.size(); i++) { for (JTemplate<?, ?> jTemplate : opendedTemplate) {
// 如果在权限编辑时做过操作,则将做过的操作作为一个整体状态赋给正在报表 // 如果在权限编辑时做过操作,则将做过的操作作为一个整体状态赋给正在报表
if (opendedTemplate.get(i).isDoSomethingInAuthority()) { if (jTemplate.isDoSomethingInAuthority()) {
opendedTemplate.get(i).fireAuthorityStateToNomal(); jTemplate.fireAuthorityStateToNomal();
} }
} }
} }
@ -619,31 +630,47 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
this.closeMode = closeMode; this.closeMode = closeMode;
} }
private UIToolbar combineUpTooBar(JComponent[] toolbar4Form) { /**
* 创建上工具栏
*/
private void combineUpTooBar() {
combineUp = new UIToolbar(FlowLayout.LEFT); combineUp = new UIToolbar(FlowLayout.LEFT);
combineUp.setBorder(new MatteBorder(new Insets(0, LEFT_ALIGN_GAP, 1, 0), UIConstants.LINE_COLOR)); combineUp.setBorder(new MatteBorder(new Insets(0, LEFT_ALIGN_GAP, 1, 0), UIConstants.LINE_COLOR));
combineUp.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 2)); combineUp.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 2));
setUpUpToolBar(null);
}
/**
* 重置上工具栏
*/
private void resetCombineUpTooBar(JComponent[] toolbar4Form) {
combineUp.removeAll();
setUpUpToolBar(toolbar4Form);
}
/**
* 填充上工具栏的中的工具
*
* @param toolbar4Form 目标组件
*/
private void setUpUpToolBar(@Nullable JComponent[] toolbar4Form) {
UIButton[] fixButtons = ad.createUp(); UIButton[] fixButtons = ad.createUp();
for (int i = 0; i < fixButtons.length; i++) { for (UIButton fixButton : fixButtons) {
combineUp.add(fixButtons[i]); combineUp.add(fixButton);
} }
if (!DesignerMode.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
combineUp.addSeparator(new Dimension(2, 16)); combineUp.addSeparator(new Dimension(2, 16));
if (toolbar4Form != null) { if (toolbar4Form != null) {
for (int i = 0; i < toolbar4Form.length; i++) { for (JComponent jComponent : toolbar4Form) {
combineUp.add(toolbar4Form[i]); combineUp.add(jComponent);
} }
} }
} }
//添加分享按钮 //添加分享按钮
addShareButton(); addShareButton();
//添加插件中的按钮 //添加插件中的按钮
addExtraButtons(); addExtraButtons();
return combineUp;
} }
private void addExtraButtons() { private void addExtraButtons() {
@ -655,8 +682,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
UIButton[] extraButtons = jt.createExtraButtons(); UIButton[] extraButtons = jt.createExtraButtons();
for (int i = 0; i < extraButtons.length; i++) { for (UIButton extraButton : extraButtons) {
combineUp.add(extraButtons[i]); combineUp.add(extraButton);
} }
if (extraButtons.length > 0) { if (extraButtons.length > 0) {
combineUp.addSeparator(new Dimension(2, 16)); combineUp.addSeparator(new Dimension(2, 16));
@ -672,8 +699,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
combineUp.addSeparator(new Dimension(2, 16)); combineUp.addSeparator(new Dimension(2, 16));
UIButton[] shareButtons = jt.createShareButton(); UIButton[] shareButtons = jt.createShareButton();
for (int i = 0; i < shareButtons.length; i++) { for (UIButton shareButton : shareButtons) {
combineUp.add(shareButtons[i]); combineUp.add(shareButton);
} }
} }
@ -710,25 +737,20 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
DesignState designState = new DesignState(plus); DesignState designState = new DesignState(plus);
MenuManager.getInstance().setMenus4Designer(designState); MenuManager.getInstance().setMenus4Designer(designState);
if (menuBar != null) { if (menuBar == null) {
menuPane.remove(menuBar); menuPane.add(menuBar = ad.createJMenuBar(plus), BorderLayout.CENTER);
} } else {
menuPane.add(menuBar = ad.createJMenuBar(plus), BorderLayout.CENTER); ad.resetJMenuBar(menuBar, plus);
if (combineUp != null) {
eastCenterPane.remove(combineUp);
combineUp = null;
} }
// 保存撤销那些按钮的面板 resetCombineUpTooBar(ad.resetUpToolBar(plus));
eastCenterPane.add(combineUp = combineUpTooBar(ad.resetUpToolBar(plus)), BorderLayout.NORTH);
if (toolbarComponent != null) {
toolbarPane.remove(toolbarComponent);
}
// 颜色,字体那些按钮的工具栏 // 颜色,字体那些按钮的工具栏
toolbarPane.add(toolbarComponent = ad.resetToolBar(toolbarComponent, plus), BorderLayout.CENTER); if (toolbarComponent == null) {
toolbarPane.add(toolbarComponent = ad.resetToolBar(null, plus), BorderLayout.CENTER);
} else {
ad.resetToolBar(toolbarComponent, plus);
}
this.checkToolbarMenuEnable(); this.checkToolbarMenuEnable();
this.validate(); this.validate();
@ -751,7 +773,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
Set<ShortCut> extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts(); Set<ShortCut> extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts();
for (ShortCut shortCut : extraShortCuts) { for (ShortCut shortCut : extraShortCuts) {
if (shortCut instanceof AbstractTemplateTreeShortCutProvider) { if (shortCut instanceof AbstractTemplateTreeShortCutProvider) {
((AbstractTemplateTreeShortCutProvider) shortCut).notifyFromAuhtorityChange(DesignerMode.isAuthorityEditing()); shortCut.notifyFromAuhtorityChange(DesignerMode.isAuthorityEditing());
} }
} }
} }
@ -949,6 +971,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* *
* @param e 事件 * @param e 事件
*/ */
@Override
public void targetModified(TargetModifiedEvent e) { public void targetModified(TargetModifiedEvent e) {
this.checkToolbarMenuEnable(); this.checkToolbarMenuEnable();
@ -959,6 +982,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* *
* @param jt 模板 * @param jt 模板
*/ */
@Override
public void templateClosed(JTemplate<?, ?> jt) { public void templateClosed(JTemplate<?, ?> jt) {
} }
@ -968,6 +992,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* *
* @param jt 模板 * @param jt 模板
*/ */
@Override
public void templateOpened(JTemplate<?, ?> jt) { public void templateOpened(JTemplate<?, ?> jt) {
} }
@ -977,6 +1002,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* *
* @param jt 模板 * @param jt 模板
*/ */
@Override
public void templateSaved(JTemplate<?, ?> jt) { public void templateSaved(JTemplate<?, ?> jt) {
this.checkToolbarMenuEnable(); this.checkToolbarMenuEnable();

14
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -210,15 +210,17 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
/** /**
* 添加VcsAction * 添加VcsAction
*
* @param toolbarDef * @param toolbarDef
*/ */
private void addVcsAction(ToolBarDef toolbarDef) { private void addVcsAction(ToolBarDef toolbarDef) {
if (VcsHelper.getInstance().needInit()) { if (VcsHelper.getInstance().needInit()) {
vcsAction = new VcsAction(); vcsAction = new VcsAction();
if (FineClusterConfig.getInstance().isCluster()) {
vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_NotSupportRemote")); if (WorkContext.getCurrent().isLocal()) {
} else {
vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_Title")); vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_Title"));
} else {
vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_NotSupportRemote"));
} }
toolbarDef.addShortCut(vcsAction); toolbarDef.addShortCut(vcsAction);
@ -367,8 +369,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
} }
if (WorkContext.getCurrent() != null) { if (WorkContext.getCurrent() != null) {
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
//当前环境为远程环境时 //当前环境为远程环境时
@ -532,7 +532,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
String oldName = fnf.getName(); String oldName = fnf.getName();
String suffix = fnf.isDirectory() ? StringUtils.EMPTY : oldName.substring(oldName.lastIndexOf(CoreConstants.DOT), oldName.length()); String suffix = fnf.isDirectory() ? StringUtils.EMPTY : oldName.substring(oldName.lastIndexOf(CoreConstants.DOT), oldName.length());
oldName = oldName.replace(suffix, StringUtils.EMPTY); oldName = StringUtils.replaceLast(oldName, suffix, StringUtils.EMPTY);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setModal(true); this.setModal(true);
@ -651,7 +651,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
String oldName = fnf.getName(); String oldName = fnf.getName();
String suffix = fnf.isDirectory() ? StringUtils.EMPTY : oldName.substring(oldName.lastIndexOf(CoreConstants.DOT), oldName.length()); String suffix = fnf.isDirectory() ? StringUtils.EMPTY : oldName.substring(oldName.lastIndexOf(CoreConstants.DOT), oldName.length());
oldName = oldName.replaceAll(suffix, StringUtils.EMPTY); oldName = StringUtils.replaceLast(oldName, suffix, StringUtils.EMPTY);
// 输入为空或者没有修改 // 输入为空或者没有修改
if (ComparatorUtils.equals(userInput, oldName)) { if (ComparatorUtils.equals(userInput, oldName)) {

2
designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java

@ -60,4 +60,4 @@ public final class JTemplateFactory {
ALL_APP.remove(app); ALL_APP.remove(app);
} }
} }
} }

39
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -47,20 +47,20 @@ import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.gui.imenu.UIMenuBar; import com.fr.design.gui.imenu.UIMenuBar;
import com.fr.design.gui.itoolbar.UILargeToolbar; import com.fr.design.gui.itoolbar.UILargeToolbar;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.locale.impl.SupportLocaleImpl;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.ToolBarNewTemplatePane; import com.fr.design.mainframe.ToolBarNewTemplatePane;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
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.design.update.actions.SoftwareUpdateAction;
import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.remote.action.RemoteDesignAuthManagerAction;
import com.fr.design.update.actions.SoftwareUpdateAction;
import com.fr.design.utils.ThemeUtils; import com.fr.design.utils.ThemeUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleAction; import com.fr.general.locale.LocaleAction;
import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleCenter;
import com.fr.design.locale.impl.SupportLocaleImpl;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime; import com.fr.plugin.context.PluginRuntime;
@ -72,6 +72,7 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.start.OemHandler; import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.Nullable;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JMenuBar; import javax.swing.JMenuBar;
@ -197,14 +198,30 @@ public abstract class ToolBarMenuDock {
*/ */
public final JMenuBar createJMenuBar(ToolBarMenuDockPlus plus) { public final JMenuBar createJMenuBar(ToolBarMenuDockPlus plus) {
UIMenuBar jMenuBar = new UIMenuBar() { UIMenuBar jMenuBar = new UIMenuBar() {
private Dimension dim;
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize(); if (dim == null) {
dim.height = MENUBAR_HEIGHT; dim = super.getPreferredSize();
dim.height = MENUBAR_HEIGHT;
}
return dim; return dim;
} }
}; };
resetJMenuBar(jMenuBar, plus);
return jMenuBar;
}
/**
* 重置菜单栏
*
* @param jMenuBar 当前菜单栏
* @param plus 对象
*/
public final void resetJMenuBar(JMenuBar jMenuBar, ToolBarMenuDockPlus plus) {
jMenuBar.removeAll();
this.menus = menus(plus); this.menus = menus(plus);
try { try {
OemProcessor oemProcessor = OemHandler.findOem(); OemProcessor oemProcessor = OemHandler.findOem();
@ -218,13 +235,12 @@ public abstract class ToolBarMenuDock {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
this.menus = menus(plus); this.menus = menus(plus);
} }
for (int i = 0; i < menus.length; i++) { for (MenuDef menu : menus) {
menus[i].setHasRecMenu(true); menu.setHasRecMenu(true);
UIMenu subMenu = menus[i].createJMenu(); UIMenu subMenu = menu.createJMenu();
jMenuBar.add(subMenu); jMenuBar.add(subMenu);
menus[i].updateMenu(); menu.updateMenu();
} }
return jMenuBar;
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -585,7 +601,7 @@ public abstract class ToolBarMenuDock {
* @param plus 对象 * @param plus 对象
* @return 工具栏 * @return 工具栏
*/ */
public JComponent resetToolBar(JComponent toolbarComponent, ToolBarMenuDockPlus plus) { public JComponent resetToolBar(@Nullable JComponent toolbarComponent, ToolBarMenuDockPlus plus) {
ToolBarDef[] plusToolBarDefs = plus.toolbars4Target(); ToolBarDef[] plusToolBarDefs = plus.toolbars4Target();
UIToolbar toolBar; UIToolbar toolBar;
if (toolbarComponent instanceof UIToolbar) { if (toolbarComponent instanceof UIToolbar) {
@ -599,8 +615,7 @@ public abstract class ToolBarMenuDock {
toolBarDef = new ToolBarDef(); toolBarDef = new ToolBarDef();
if (plusToolBarDefs != null) { if (plusToolBarDefs != null) {
for (int i = 0; i < plusToolBarDefs.length; i++) { for (ToolBarDef def : plusToolBarDefs) {
ToolBarDef def = plusToolBarDefs[i];
for (int di = 0, dlen = def.getShortCutCount(); di < dlen; di++) { for (int di = 0, dlen = def.getShortCutCount(); di < dlen; di++) {
toolBarDef.addShortCut(def.getShortCut(di)); toolBarDef.addShortCut(def.getShortCut(di));
} }

66
designer-base/src/main/java/com/fr/design/mainframe/toolbar/UpdateActionManager.java

@ -13,6 +13,8 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.value.NotNullLazyValue;
import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.*;
import java.util.HashMap; import java.util.HashMap;
@ -36,6 +38,22 @@ public class UpdateActionManager {
private static boolean isRegisterIndexSearchTextTask = false; private static boolean isRegisterIndexSearchTextTask = false;
private boolean afterStartup = false;
private NotNullLazyValue<Boolean> isCacheValid = new NotNullLazyValue<Boolean>() {
@NotNull
@Override
protected Boolean compute() {
// 缓存是否有效。
// 注意:开发工程版本为不是安装版本,
// 索引只会出现在首次启动。
return ComparatorUtils.equals(GeneralUtils.readBuildNO(), AlphaFineConfigManager.getInstance().getCacheBuildNO());
}
};
private ExecutorService searchPool = Executors
.newSingleThreadExecutor(new NamedThreadFactory("IndexAlphaFineSearchText", true));
/** /**
* 限制初始化 * 限制初始化
*/ */
@ -78,35 +96,27 @@ public class UpdateActionManager {
* 1.首次索引或缓存失效的时候更新版本会使缓存失效会将索引缓存存到env.xml * 1.首次索引或缓存失效的时候更新版本会使缓存失效会将索引缓存存到env.xml
* 下次直接加载 * 下次直接加载
* 2.需要重新索引则等待设计器初始化完毕之后单线程运行索引任务 * 2.需要重新索引则等待设计器初始化完毕之后单线程运行索引任务
* 3.集中索引结束之后每次添加为增量索引
* *
* @param paneClass 面板类名 * @param paneClass 面板类名
* @param updateAction 待处理的updateAction * @param updateAction 待处理的updateAction
*/ */
public void dealWithSearchText(String paneClass, UpdateAction updateAction) { public void dealWithSearchText(String paneClass, UpdateAction updateAction) {
Map<String, String> actionSearchTextCache = AlphaFineConfigManager.getInstance().getActionSearchTextCache(); Map<String, String> actionSearchTextCache = AlphaFineConfigManager.getInstance().getActionSearchTextCache();
if (!cacheValid() if (isCacheValid.getValue() && actionSearchTextCache.containsKey(paneClass)) {
|| actionSearchTextCache.isEmpty()
|| !actionSearchTextCache.containsKey(paneClass)) {
if (!updateActionsIndexCache.containsKey(paneClass)) {
updateActionsIndexCache.put(paneClass, updateAction);
}
registerIndexSearchTextTask();
} else {
updateAction.setSearchText(actionSearchTextCache.get(paneClass)); updateAction.setSearchText(actionSearchTextCache.get(paneClass));
} else {
if (afterStartup) {
incrementIndexSearchTextTask(paneClass, updateAction);
} else {
if (!updateActionsIndexCache.containsKey(paneClass)) {
updateActionsIndexCache.put(paneClass, updateAction);
}
registerIndexSearchTextTask();
}
} }
} }
/**
* 缓存是否有效
* 注意开发工程版本为不是安装版本
* 索引只会出现在首次启动
*
* @return true有效false失效
*/
private boolean cacheValid() {
return ComparatorUtils.equals(GeneralUtils.readBuildNO(), AlphaFineConfigManager.getInstance().getCacheBuildNO());
}
/** /**
* 由于是UI线程不考虑并发问题 * 由于是UI线程不考虑并发问题
*/ */
@ -116,26 +126,30 @@ public class UpdateActionManager {
} }
isRegisterIndexSearchTextTask = true; isRegisterIndexSearchTextTask = true;
// 没有缓存或者缓存失效的时候,等待设计器启动之后开始索引任务 // 没有缓存或者缓存失效的时候,等待设计器启动之后开始索引任务
EventDispatcher.listen(DesignerLaunchStatus.OPEN_LAST_FILE_COMPLETE, new Listener<Null>() { EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener<Null>() {
@Override @Override
public void on(Event event, Null param) { public void on(Event event, Null param) {
// 使用单线程索引 afterStartup = true;
ExecutorService es = Executors.newSingleThreadExecutor(new NamedThreadFactory("IndexAlphaFineSearchText"));
for (Map.Entry<String, UpdateAction> cache : updateActionsIndexCache.entrySet()) { for (Map.Entry<String, UpdateAction> cache : updateActionsIndexCache.entrySet()) {
es.execute(new IndexTask(cache.getKey(), cache.getValue())); searchPool.execute(new IndexTask(cache.getKey(), cache.getValue()));
} }
updateActionsIndexCache = null; updateActionsIndexCache.clear();
es.shutdown();
// 标记一下缓存版本 // 标记一下缓存版本
AlphaFineConfigManager.getInstance().setCacheBuildNO(GeneralUtils.readBuildNO()); AlphaFineConfigManager.getInstance().setCacheBuildNO(GeneralUtils.readBuildNO());
} }
}); });
} }
private void incrementIndexSearchTextTask(String key, UpdateAction action) {
searchPool.execute(new IndexTask(key, action));
// 标记一下缓存版本
AlphaFineConfigManager.getInstance().setCacheBuildNO(GeneralUtils.readBuildNO());
}
/** /**
* 索引任务 * 索引任务
*/ */
class IndexTask implements Runnable { static class IndexTask implements Runnable {
private String className; private String className;
private UpdateAction updateAction; private UpdateAction updateAction;

19
designer-base/src/main/java/com/fr/design/mainframe/toolbar/UpdateActionModel.java

@ -32,15 +32,22 @@ public class UpdateActionModel {
* @param action * @param action
*/ */
private void setSearchKey(String parentName, UpdateAction action) { private void setSearchKey(String parentName, UpdateAction action) {
StringBuffer buffer = new StringBuffer();
if (actionName == null) { if (actionName == null) {
return; return;
} }
buffer.append(parentName).append(SEPARATOR).append(PinyinHelper.convertToPinyinString(parentName, "", PinyinFormat.WITHOUT_TONE)) String buffer = parentName +
.append(SEPARATOR).append(PinyinHelper.getShortPinyin(parentName)).append(SEPARATOR) SEPARATOR +
.append(actionName).append(SEPARATOR).append(PinyinHelper.convertToPinyinString(actionName, "", PinyinFormat.WITHOUT_TONE)) PinyinHelper.convertToPinyinString(parentName, "", PinyinFormat.WITHOUT_TONE) +
.append(SEPARATOR).append(PinyinHelper.getShortPinyin(actionName)).append(action.getSearchText()); SEPARATOR +
this.searchKey = buffer.toString().toLowerCase(); PinyinHelper.getShortPinyin(parentName) +
SEPARATOR +
actionName +
SEPARATOR +
PinyinHelper.convertToPinyinString(actionName, "", PinyinFormat.WITHOUT_TONE) +
SEPARATOR +
PinyinHelper.getShortPinyin(actionName) +
action.getSearchText();
this.searchKey = buffer.toLowerCase();
} }
/** /**

49
designer-base/src/main/java/com/fr/design/ui/util/EdtInvocationManager.java

@ -0,0 +1,49 @@
package com.fr.design.ui.util;
import org.jetbrains.annotations.NotNull;
import javax.swing.SwingUtilities;
import java.lang.reflect.InvocationTargetException;
/**
* 事件分发线程管理器用于管理用户线程
*
* @author vito
* @version 10.0
* Created by vito on 2019/9/16
*/
public abstract class EdtInvocationManager {
@NotNull
private static EdtInvocationManager ourInstance = new SwingEdtInvocationManager();
public abstract boolean isEventDispatchThread();
public abstract void invokeLater(@NotNull Runnable task);
public abstract void invokeAndWait(@NotNull Runnable task) throws InvocationTargetException, InterruptedException;
@NotNull
public static EdtInvocationManager getInstance() {
return ourInstance;
}
/**
* The default {@link EdtInvocationManager} implementation which works with the EDT via SwingUtilities.
*/
private static class SwingEdtInvocationManager extends EdtInvocationManager {
@Override
public boolean isEventDispatchThread() {
return SwingUtilities.isEventDispatchThread();
}
@Override
public void invokeLater(@NotNull Runnable task) {
SwingUtilities.invokeLater(task);
}
@Override
public void invokeAndWait(@NotNull Runnable task) throws InvocationTargetException, InterruptedException {
SwingUtilities.invokeAndWait(task);
}
}
}

77
designer-base/src/main/java/com/fr/design/ui/util/GraphicsConfig.java

@ -0,0 +1,77 @@
package com.fr.design.ui.util;
import org.jetbrains.annotations.NotNull;
import java.awt.*;
import java.util.Map;
/**
* 图形渲染配置
*
* @author vito
* @version 10.0
* Created by vito on 2019/9/18
*/
public class GraphicsConfig {
private final Graphics2D myG;
private final Map myHints;
private final Composite myComposite;
private final Stroke myStroke;
public GraphicsConfig(@NotNull Graphics g) {
myG = (Graphics2D) g;
myHints = (Map) myG.getRenderingHints().clone();
myComposite = myG.getComposite();
myStroke = myG.getStroke();
}
public GraphicsConfig setAntialiasing(boolean on) {
myG.setRenderingHint(RenderingHints.KEY_ANTIALIASING, on ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF);
return this;
}
public GraphicsConfig setAlpha(float alpha) {
myG.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
return this;
}
public GraphicsConfig setRenderingHint(RenderingHints.Key hintKey, Object hintValue) {
myG.setRenderingHint(hintKey, hintValue);
return this;
}
public Graphics2D getG() {
return myG;
}
public GraphicsConfig setComposite(Composite composite) {
myG.setComposite(composite);
return this;
}
public GraphicsConfig setStroke(Stroke stroke) {
myG.setStroke(stroke);
return this;
}
public GraphicsConfig setupAAPainting() {
return setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
}
public GraphicsConfig disableAAPainting() {
return setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF)
.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_DEFAULT);
}
public GraphicsConfig paintWithAlpha(float alpha) {
assert 0.0f <= alpha && alpha <= 1.0f : "alpha should be in range 0.0f .. 1.0f";
return setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
}
public void restore() {
myG.setRenderingHints(myHints);
myG.setComposite(myComposite);
myG.setStroke(myStroke);
}
}

55
designer-base/src/main/java/com/fr/design/ui/util/UIUtil.java

@ -0,0 +1,55 @@
package com.fr.design.ui.util;
import com.fr.log.FineLoggerFactory;
import org.jetbrains.annotations.NotNull;
import javax.swing.SwingUtilities;
/**
* 一些常用的 GUI 工具
* <p>
* 为什么提供 invokeLaterIfNeeded invokeAndWaitIfNeeded这样的方法
* 因为 swing 渲染 UI 是单线程的如果直接使用
* {@link SwingUtilities#invokeLater(Runnable)} invokeLater 方法
* 嵌套的时候Runnable 会被放到事件循环队列的末尾从而变成异步而非立即执行
* 这是一处坑点invokeLaterIfNeeded 的行为当处于事件分发线程EDT
* 则直接运行当处于其他线程则使用 EDT 来执行
* <p>
* 方法{@link SwingUtilities#invokeAndWait(Runnable)}也有一个注意点
* 不允许在事件分发线程EDT中调用否则抛错所以也有必要加上判断 EDT 的逻辑
*
* @author vito
* @version 10.0
* Created by vito on 2019/9/16
*/
public class UIUtil {
/**
* AWT 线程上立即调用runnable否则使用 {@link SwingUtilities#invokeLater(Runnable)} 代替
*
* @param runnable 等待调用的 runnable
*/
public static void invokeLaterIfNeeded(@NotNull Runnable runnable) {
if (EdtInvocationManager.getInstance().isEventDispatchThread()) {
runnable.run();
} else {
EdtInvocationManager.getInstance().invokeLater(runnable);
}
}
/**
* AWT 线程上立即调用runnable否则使用 {@link SwingUtilities#invokeAndWait(Runnable)} 代替
*
* @param runnable 等待调用的 runnable
*/
public static void invokeAndWaitIfNeeded(@NotNull Runnable runnable) {
if (EdtInvocationManager.getInstance().isEventDispatchThread()) {
runnable.run();
} else {
try {
EdtInvocationManager.getInstance().invokeAndWait(runnable);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
}

1
designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java

@ -12,6 +12,7 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JDialog; import javax.swing.JDialog;

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

@ -5,25 +5,28 @@ package com.fr.start;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerStartOpenFileProcessor; import com.fr.design.fun.DesignerStartOpenFileProcessor;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FILEFactory; import com.fr.file.FILEFactory;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.module.ModuleEvent;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import java.awt.Window; import java.awt.*;
import java.io.File; import java.io.File;
import java.lang.reflect.Method; import java.lang.reflect.Method;
@ -31,17 +34,17 @@ import java.lang.reflect.Method;
* The main class of Report Designer. * The main class of Report Designer.
*/ */
public abstract class BaseDesigner extends ToolBarMenuDock { public abstract class BaseDesigner extends ToolBarMenuDock {
private static final int LOAD_TREE_MAXNUM = 10; private static final int LOAD_TREE_MAXNUM = 10;
private final String[] args; private final String[] args;
public BaseDesigner(String[] args) { public BaseDesigner(String[] args) {
this.args = args; this.args = args;
init(); init();
} }
private void init() { private void init() {
// 初始化look and feel.这个在预加载之前执行是因为lookAndFeel里的东西,预加载时也要用到 // 初始化look and feel.这个在预加载之前执行是因为lookAndFeel里的东西,预加载时也要用到
DesignUtils.initLookAndFeel(); DesignUtils.initLookAndFeel();
@ -49,27 +52,49 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
DesignerEnvManager.loadLogSetting(); DesignerEnvManager.loadLogSetting();
createDesignerFrame(); createDesignerFrame();
} }
public void show() { public void show() {
collectUserInformation(); UIUtil.invokeLaterIfNeeded(new Runnable() {
showDesignerFrame(false); @Override
public void run() {
refreshTemplateTree();
}
});
EventDispatcher.listen(DesignerLaunchStatus.DESIGNER_INIT_COMPLETE, new Listener<Null>() {
@Override
public void on(Event event, Null param) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
// 打开上次的文件
showDesignerFrame(false);
DesignerLaunchStatus.setStatus(DesignerLaunchStatus.OPEN_LAST_FILE_COMPLETE);
}
});
}
});
EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener<Null>() {
@Override
public void on(Event event, Null param) {
collectUserInformation();
}
});
}
private void refreshTemplateTree() {
//TODO: 2019-06-14 这里有啥作用? //TODO: 2019-06-14 这里有啥作用?
DesignerContext.getDesignerFrame().refreshEnv(); DesignerContext.getDesignerFrame().refreshEnv();
for (int i = 0; !TemplateTreePane.getInstance().getTemplateFileTree().isTemplateShowing() && i < LOAD_TREE_MAXNUM; i++) { for (int i = 0; !TemplateTreePane.getInstance().getTemplateFileTree().isTemplateShowing() && i < LOAD_TREE_MAXNUM; i++) {
TemplateTreePane.getInstance().getTemplateFileTree().refresh(); TemplateTreePane.getInstance().getTemplateFileTree().refresh();
} }
DesignerContext.getDesignerFrame().setVisible(true);
DesignerContext.getDesignerFrame().resizeFrame();
} }
private void createDesignerFrame() { private void createDesignerFrame() {
new DesignerFrame(this); new DesignerFrame(this);
} }
private void showDesignerFrame(boolean isException) { private void showDesignerFrame(boolean isException) {
try { try {
FILE file = null; FILE file = null;
@ -94,8 +119,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
} }
} }
} else { } else {
file = FILEFactory.createFILE(FILEFactory.ENV_PREFIX file = FILEFactory.createFILE(FILEFactory.ENV_PREFIX + DesignerEnvManager.getEnvManager().getLastOpenFile());
+ DesignerEnvManager.getEnvManager().getLastOpenFile());
} }
DesignerFrame df = DesignerContext.getDesignerFrame(); DesignerFrame df = DesignerContext.getDesignerFrame();
isException = openFile(df, isException, file); isException = openFile(df, isException, file);
@ -134,7 +158,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
df.getSelectedJTemplate().requestGridFocus(); df.getSelectedJTemplate().requestGridFocus();
return isException; return isException;
} }
private void enableFullScreenMode(Window window) { private void enableFullScreenMode(Window window) {
String className = "com.apple.eawt.FullScreenUtilities"; String className = "com.apple.eawt.FullScreenUtilities";
String methodName = "setWindowCanFullScreen"; String methodName = "setWindowCanFullScreen";

4
designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java

@ -38,7 +38,7 @@ public class FineEmbedServerActivator extends Activator {
} catch (LifecycleException e) { } catch (LifecycleException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
}finally { } finally {
FineEmbedServerMonitor.getInstance().setComplete(); FineEmbedServerMonitor.getInstance().setComplete();
} }
} }
@ -86,7 +86,7 @@ public class FineEmbedServerActivator extends Activator {
private void stopSpring() { private void stopSpring() {
AnnotationConfigWebApplicationContext context = ModuleRole.ServerRoot.getSingleton(AnnotationConfigWebApplicationContext.class); AnnotationConfigWebApplicationContext context = ModuleRole.ServerRoot.findSingleton(AnnotationConfigWebApplicationContext.class);
if (context != null) { if (context != null) {
context.stop(); context.stop();
context.destroy(); context.destroy();

55
designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java

@ -1,25 +1,32 @@
package com.fr.start.server; package com.fr.start.server;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.gui.iprogressbar.ProgressDialog;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.event.Null; import com.fr.event.Null;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/** /**
* 内置服务器启动监视器 * 内置服务器启动监视器
* Created by zack on 2018/8/21. *
* @author zack
* @date 2018/8/21
*/ */
public class FineEmbedServerMonitor { public class FineEmbedServerMonitor {
private int progress; private int progress;
private static final int COMPLETE = 100;//启动完成 private static final int STEP = 1;
private static final int STEP = 5;//随便设置一个假的进度条 /**
private static final int STEP_HEARTBEAT = 2000;//2秒更新进度 * 40ms更新进度
*/
private static final int STEP_HEARTBEAT = 40;
private static volatile FineEmbedServerMonitor monitor; private static volatile FineEmbedServerMonitor monitor;
private static ProgressDialog progressBar = DesignerContext.getDesignerFrame().getProgressDialog();
private FineEmbedServerMonitor() { private FineEmbedServerMonitor() {
} }
@ -46,7 +53,7 @@ public class FineEmbedServerMonitor {
} }
public int getProgress() { public int getProgress() {
if (progress == COMPLETE) { if (progress == progressBar.getProgressMaximum()) {
return progress; return progress;
} else { } else {
progress += STEP; progress += STEP;
@ -55,7 +62,7 @@ public class FineEmbedServerMonitor {
} }
public void setComplete() { public void setComplete() {
this.progress = COMPLETE; this.progress = progressBar.getProgressMaximum();
} }
public void reset() { public void reset() {
@ -63,30 +70,28 @@ public class FineEmbedServerMonitor {
} }
public boolean isComplete() { public boolean isComplete() {
return this.progress == COMPLETE; return this.progress >= progressBar.getProgressMaximum();
} }
public void monitor() { public void monitor() {
ExecutorService service = Executors.newSingleThreadExecutor(new NamedThreadFactory("FineEmbedServerMonitor")); final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1,
service.submit(new Runnable() { new NamedThreadFactory("FineEmbedServerMonitor"));
scheduler.scheduleAtFixedRate(new Runnable() {
@Override @Override
public void run() { public void run() {
while (!isComplete()) { if (isComplete()) {
if (!DesignerContext.getDesignerFrame().getProgressDialog().isVisible()) { scheduler.shutdown();
DesignerContext.getDesignerFrame().showProgressDialog(); DesignerContext.getDesignerFrame().hideProgressDialog();
DesignerContext.getDesignerFrame().getProgressDialog().updateLoadingText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server")); return;
}
DesignerContext.getDesignerFrame().updateProgress(getProgress());
try {
Thread.sleep(STEP_HEARTBEAT);
} catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
} }
DesignerContext.getDesignerFrame().hideProgressDialog(); if (!DesignerContext.getDesignerFrame().getProgressDialog().isVisible()) {
DesignerContext.getDesignerFrame().showProgressDialog();
DesignerContext.getDesignerFrame().getProgressDialog()
.updateLoadingText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server"));
}
DesignerContext.getDesignerFrame().updateProgress(getProgress());
} }
}); }, 0, STEP_HEARTBEAT, TimeUnit.MILLISECONDS);
service.shutdown();
} }
} }

13
designer-base/src/main/java/com/fr/start/server/ServerManageFrame.java

@ -5,18 +5,12 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import javax.swing.BorderFactory; import javax.swing.*;
import javax.swing.JFrame; import java.awt.*;
import javax.swing.JPanel; import java.awt.event.*;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** /**
* 内置Tomcat服务器管理界面 * 内置Tomcat服务器管理界面
@ -46,7 +40,6 @@ public class ServerManageFrame extends JFrame {
private ServerManageFrame() { private ServerManageFrame() {
DesignUtils.initLookAndFeel();
this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/trayStarted.png")); this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/trayStarted.png"));
JPanel contentPane = (JPanel) this.getContentPane(); JPanel contentPane = (JPanel) this.getContentPane();

8
designer-base/src/main/resources/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/FormulaTokenMaker.flex

@ -578,7 +578,13 @@ FunctionNames = "ABS"|
"YEAR"| "YEAR"|
"year"| "year"|
"YEARDELTA"| "YEARDELTA"|
"yeardelta" "yeardelta"|
"SUMPRECISE"|
"sumprecise"|
"QUERY"|
"query"|
"WEBIMAGE"|
"webimage"
%state MLC %state MLC

70
designer-base/src/test/java/com/fr/design/ExtraDesignClassManagerTest.java

@ -0,0 +1,70 @@
package com.fr.design;
import com.fr.config.dao.DaoContext;
import com.fr.config.dao.impl.LocalClassHelperDao;
import com.fr.config.dao.impl.LocalEntityDao;
import com.fr.config.dao.impl.LocalXmlEntityDao;
import com.fr.design.fun.ToolbarItemProvider;
import com.fr.design.gui.core.WidgetOption;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.general.ModuleContext;
import com.fr.log.FineLoggerFactory;
import com.fr.report.restriction.CellCountRestriction;
import com.fr.report.restriction.ReportRestrictionScene;
import com.fr.restriction.Restrictions;
import com.fr.stable.Filter;
import com.fr.stable.module.Module;
import junit.framework.TestCase;
import org.easymock.EasyMock;
import org.junit.Assert;
import java.util.HashSet;
import java.util.Set;
/**
* @author zack
* @version 10.0
* Created by zack on 2019/9/17
*/
public class ExtraDesignClassManagerTest extends TestCase {
@Override
protected void setUp() throws Exception {
DaoContext.setEntityDao(new LocalEntityDao());
DaoContext.setClassHelperDao(new LocalClassHelperDao());
DaoContext.setXmlEntityDao(new LocalXmlEntityDao());
ModuleContext.startModule(Module.PAGE_MODULE);
Restrictions.register(ReportRestrictionScene.CELL_COUNT, new CellCountRestriction());
}
public void testGetWebOption() {
try {
final JTemplate jTemplate = new JVirtualTemplate(null);
ToolbarItemProvider item = EasyMock.mock(ToolbarItemProvider.class);
ToolbarItemProvider item1 = EasyMock.mock(ToolbarItemProvider.class);
EasyMock.expect(item.accept(jTemplate)).andReturn(false).anyTimes();
EasyMock.expect(item.classForWidget()).andReturn(null).anyTimes();
EasyMock.expect(item.iconPathForWidget()).andReturn("").anyTimes();
EasyMock.expect(item.nameForWidget()).andReturn("1").anyTimes();
EasyMock.expect(item1.accept(jTemplate)).andReturn(true).anyTimes();
EasyMock.expect(item1.classForWidget()).andReturn(null).anyTimes();
EasyMock.expect(item1.iconPathForWidget()).andReturn("").anyTimes();
EasyMock.expect(item1.nameForWidget()).andReturn("2").anyTimes();
EasyMock.replay(item);
EasyMock.replay(item1);
Set<ToolbarItemProvider> set = new HashSet<>();
set.add(item);
set.add(item1);
WidgetOption[] widgetOptions = ExtraDesignClassManager.getInstance().getWebWidgetOptions(set, new Filter<ToolbarItemProvider>() {
@Override
public boolean accept(ToolbarItemProvider toolbarItemProvider) {
return toolbarItemProvider.accept(jTemplate);
}
});
Assert.assertEquals(1, widgetOptions.length);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}

82
designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java

@ -125,7 +125,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
public static final String TYPE_PANE_DEFAULT_TITLE = "DEFAULT_NAME"; public static final String TYPE_PANE_DEFAULT_TITLE = "DEFAULT_NAME";
public synchronized static ChartTypeInterfaceManager getInstance() { public synchronized static ChartTypeInterfaceManager getInstance() {
return classManager; return classManager;
} }
@ -158,7 +158,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
} }
}); });
} }
public static WidgetOption[] initWidgetOption() { public static WidgetOption[] initWidgetOption() {
String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDs(); String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDs();
@ -201,8 +201,8 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartGanttPlot.VAN_CHART_GANTT_PLOT_ID, new GanttIndependentVanChartInterface()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartGanttPlot.VAN_CHART_GANTT_PLOT_ID, new GanttIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartStructurePlot.STRUCTURE_PLOT_ID, new StructureIndependentVanChartInterface()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartStructurePlot.STRUCTURE_PLOT_ID, new StructureIndependentVanChartInterface());
} }
private static void readDefault() { private static void readDefault() {
addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface());
@ -225,7 +225,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
} }
private static void addChartTypeInterface(String priority, String plotID, ChartTypeUIProvider provider) { private static void addChartTypeInterface(String priority, String plotID, ChartTypeUIProvider provider) {
if (chartTypeInterfaces != null) { if (chartTypeInterfaces != null) {
if (!chartTypeInterfaces.containsKey(priority)) { if (!chartTypeInterfaces.containsKey(priority)) {
//新建一个具体图表列表 //新建一个具体图表列表
@ -252,14 +252,14 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
} }
return null; return null;
} }
/** /**
* 把所有的pane加到list里 * 把所有的pane加到list里
* *
* @param paneList pane容器 * @param paneList pane容器
*/ */
public void addPlotTypePaneList(List<FurtherBasicBeanPane<? extends ChartProvider>> paneList, Map<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane) { public void addPlotTypePaneList(List<FurtherBasicBeanPane<? extends ChartProvider>> paneList, Map<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane) {
List<Integer> priorityList = getPriorityInOrder(); List<Integer> priorityList = getPriorityInOrder();
for (Integer aPriorityList : priorityList) { for (Integer aPriorityList : priorityList) {
String priority = String.valueOf(aPriorityList); String priority = String.valueOf(aPriorityList);
@ -302,9 +302,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
public String getTitle4PopupWindow(String plotID) { public String getTitle4PopupWindow(String plotID) {
return getName(plotID); return getName(plotID);
} }
private List<Integer> getPriorityInOrder() { private List<Integer> getPriorityInOrder() {
List<Integer> priorityList = new ArrayList<Integer>(); List<Integer> priorityList = new ArrayList<Integer>();
if (chartTypeInterfaces != null) { if (chartTypeInterfaces != null) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator(); Iterator iterator = chartTypeInterfaces.entrySet().iterator();
@ -374,11 +374,15 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
} }
result[i] = Reflect.on(chart).call("demoImagePath").get(); result[i] = Reflect.on(chart).call("demoImagePath").get();
} }
if (ArrayUtils.isNotEmpty(result)) {
return result;
}
} catch (Exception e) { } catch (Exception e) {
//do nothing //do nothing
} }
return new String[0]; return new String[]{getIconPath(chartID)};
} }
public String[] getSubName(String chartID) { public String[] getSubName(String chartID) {
@ -464,7 +468,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return provider.getPlotTypePane().title4PopupWindow(); return provider.getPlotTypePane().title4PopupWindow();
} }
public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) {
ChartTypeUIProvider provider = getChartTypeInterface(plotID); ChartTypeUIProvider provider = getChartTypeInterface(plotID);
if (provider != null) { if (provider != null) {
@ -473,7 +477,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return new ChartDataPane(listener); return new ChartDataPane(listener);
} }
public AbstractChartAttrPane[] getAttrPaneArray(String plotID, AttributeChangeListener listener) { public AbstractChartAttrPane[] getAttrPaneArray(String plotID, AttributeChangeListener listener) {
ChartTypeUIProvider provider = getChartTypeInterface(plotID); ChartTypeUIProvider provider = getChartTypeInterface(plotID);
if (provider != null) { if (provider != null) {
@ -481,9 +485,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
} }
return new AbstractChartAttrPane[0]; return new AbstractChartAttrPane[0];
} }
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) {
ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID()); ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID());
@ -493,7 +497,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return null; return null;
} }
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) {
ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID()); ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID());
@ -503,7 +507,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return null; return null;
} }
public ConditionAttributesPane getPlotConditionPane(Plot plot) { public ConditionAttributesPane getPlotConditionPane(Plot plot) {
ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID()); ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID());
@ -513,7 +517,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return null; return null;
} }
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot) { public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot) {
ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID()); ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID());
@ -523,7 +527,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return null; return null;
} }
/** /**
* 是否使用默认的界面为了避免界面来回切换 * 是否使用默认的界面为了避免界面来回切换
* *
@ -536,7 +540,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
if (provider != null) { if (provider != null) {
return provider.isUseDefaultPane(); return provider.isUseDefaultPane();
} }
return true; return true;
} }
@ -551,31 +555,37 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return true; return true;
} }
@Override @Override
public void mount(PluginSingleInjection injection) { public void mount(PluginSingleInjection injection) {
if (isIndependentChartUIProvider(injection)) { if (isChartTypeUIProvider(injection)) {
String id = injection.getAttribute("chartID");
if (StringUtils.isEmpty(id)) {
id = injection.getAttribute("plotID");
}
String priority = injection.getAttribute("priority", DEFAULT_PRIORITY); String priority = injection.getAttribute("priority", DEFAULT_PRIORITY);
String plotID = injection.getAttribute("plotID");
ChartTypeUIProvider instance = (ChartTypeUIProvider) injection.getObject(); ChartTypeUIProvider instance = (ChartTypeUIProvider) injection.getObject();
addChartTypeInterface(priority, plotID, instance); addChartTypeInterface(priority, id, instance);
} }
} }
@Override @Override
public void demount(PluginSingleInjection injection) { public void demount(PluginSingleInjection injection) {
if (isIndependentChartUIProvider(injection)) { if (isChartTypeUIProvider(injection)) {
String priority = injection.getAttribute("priority", DEFAULT_PRIORITY); String priority = injection.getAttribute("priority", DEFAULT_PRIORITY);
String plotID = injection.getAttribute("plotID"); String id = injection.getAttribute("chartID");
removeChartTypeInterface(priority, plotID); if (StringUtils.isEmpty(id)) {
id = injection.getAttribute("plotID");
}
removeChartTypeInterface(priority, id);
} }
} }
private void removeChartTypeInterface(String priority, String plotID) { private void removeChartTypeInterface(String priority, String plotID) {
if (chartTypeInterfaces != null) { if (chartTypeInterfaces != null) {
if (chartTypeInterfaces.containsKey(priority)) { if (chartTypeInterfaces.containsKey(priority)) {
Map<String, ChartTypeUIProvider> chartUIList = chartTypeInterfaces.get(priority); Map<String, ChartTypeUIProvider> chartUIList = chartTypeInterfaces.get(priority);
@ -583,11 +593,11 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
} }
} }
} }
private boolean isIndependentChartUIProvider(PluginSingleInjection injection) {
return !(injection == null || injection.getObject() == null) && ChartTypeUIProvider.XML_TAG.equals(injection.getName()) && injection.getObject() instanceof ChartTypeUIProvider;
private boolean isChartTypeUIProvider(PluginSingleInjection injection) {
return !(injection == null || injection.getObject() == null) && (ChartTypeUIProvider.XML_TAG.equals(injection.getName()) || ChartTypeUIProvider.OLD_TAG.equals(injection.getName())) && injection.getObject() instanceof ChartTypeUIProvider;
} }

3
designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java

@ -4,7 +4,6 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.chart.gui.ChartComponent; import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.ChartPropertyPane; import com.fr.design.mainframe.ChartPropertyPane;
import com.fr.design.module.ChartEmptyDataStyleAction; import com.fr.design.module.ChartEmptyDataStyleAction;
@ -54,8 +53,6 @@ public class ChartDesignerActivator extends Activator implements Prepare {
DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance()); DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance());
DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper());
DesignerLaunchStatus.setStatus(DesignerLaunchStatus.DESIGNER_INIT_COMPLETE);
ChartTypeInterfaceManager.addPluginChangedListener(); ChartTypeInterfaceManager.addPluginChangedListener();
} }

5
designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

@ -11,6 +11,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListCellRenderer;
@ -98,8 +99,8 @@ public class ChartTypePane extends ChartCommonWizardPane {
String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(id); String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(id);
ChartTypePane.this.iconListModel.clear(); ChartTypePane.this.iconListModel.clear();
for (int i = 0, len = demoImagePath.length; i < len; i++) { for (int i = 0, len = subName.length; i < len; i++) {
String ImagePath = demoImagePath[i]; String ImagePath = demoImagePath.length > i ? demoImagePath[i] : StringUtils.EMPTY;
String chartName = subName[i]; String chartName = subName[i];
ChartTypePane.this.iconListModel.addElement(new ChartIcon(ImagePath, chartName)); ChartTypePane.this.iconListModel.addElement(new ChartIcon(ImagePath, chartName));
} }

4
designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java

@ -23,7 +23,9 @@ import com.fr.stable.fun.Level;
*/ */
public interface ChartTypeUIProvider extends Level { public interface ChartTypeUIProvider extends Level {
String XML_TAG = SpecialLevel.IndependentChartUIProvider.getTagName(); String XML_TAG = "ChartTypeUIProvider";
String OLD_TAG = SpecialLevel.IndependentChartUIProvider.getTagName();
int CURRENT_API_LEVEL = 3; int CURRENT_API_LEVEL = 3;

2
designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java

@ -16,10 +16,12 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.stable.fun.impl.AbstractProvider; import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/** /**
* Created by shine on 2019/09/03. * Created by shine on 2019/09/03.
*/ */
@API(level = ChartTypeUIProvider.CURRENT_API_LEVEL)
public abstract class AbstractChartTypeUI extends AbstractProvider implements ChartTypeUIProvider { public abstract class AbstractChartTypeUI extends AbstractProvider implements ChartTypeUIProvider {
@Override @Override

25
designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java

@ -13,9 +13,9 @@ import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.util.Arrays;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.util.Arrays;
/** /**
* Created by shine on 2019/5/16. * Created by shine on 2019/5/16.
@ -31,9 +31,21 @@ public abstract class AbstractCellDataFieldsPane<T extends AbstractColumnFieldCo
this.setLayout(new BorderLayout(0, 6)); this.setLayout(new BorderLayout(0, 6));
this.add(createNorthPane(), BorderLayout.NORTH); JPanel north = createNorthPane(),
this.add(createCenterPane(), BorderLayout.CENTER); center = createCenterPane(),
this.add(createSouthPane(), BorderLayout.SOUTH); south = createSouthPane();
if (north != null) {
this.add(north, BorderLayout.NORTH);
}
if (center != null) {
this.add(center, BorderLayout.CENTER);
}
if (south != null) {
this.add(south, BorderLayout.SOUTH);
}
this.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 8)); this.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 8));
} }
@ -53,7 +65,6 @@ public abstract class AbstractCellDataFieldsPane<T extends AbstractColumnFieldCo
components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), formulaPanes[i]}; components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), formulaPanes[i]};
} }
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] columnSize = {ChartDataPane.LABEL_WIDTH, 124}; double[] columnSize = {ChartDataPane.LABEL_WIDTH, 124};
double[] rowSize = new double[len]; double[] rowSize = new double[len];
@ -64,11 +75,11 @@ public abstract class AbstractCellDataFieldsPane<T extends AbstractColumnFieldCo
protected JPanel createNorthPane() { protected JPanel createNorthPane() {
return new JPanel(); return null;
} }
protected JPanel createSouthPane() { protected JPanel createSouthPane() {
return new JPanel(); return null;
} }
protected Component[] fieldComponents() { protected Component[] fieldComponents() {

7
designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractDataSetFieldsPane.java

@ -17,10 +17,10 @@ import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.awt.BorderLayout;
import java.awt.Component;
import static com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper.refreshBoxItems; import static com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper.refreshBoxItems;
@ -36,7 +36,7 @@ public abstract class AbstractDataSetFieldsPane<T extends AbstractColumnFieldCol
protected void initComponents() { protected void initComponents() {
this.setLayout(new BorderLayout(0, 4)); this.setLayout(new BorderLayout(0, 6));
this.setBorder(BorderFactory.createEmptyBorder(2, 24, 0, 15)); this.setBorder(BorderFactory.createEmptyBorder(2, 24, 0, 15));
JPanel north = createNorthPane(), JPanel north = createNorthPane(),
@ -74,7 +74,6 @@ public abstract class AbstractDataSetFieldsPane<T extends AbstractColumnFieldCol
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), fieldComponents[i]}; components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), fieldComponents[i]};
} }
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] columnSize = {ChartDataPane.LABEL_WIDTH, 122}; double[] columnSize = {ChartDataPane.LABEL_WIDTH, 122};
double[] rowSize = new double[len]; double[] rowSize = new double[len];

17
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractCellDataFieldsWithSeriesValuePane.java

@ -21,15 +21,26 @@ public abstract class AbstractCellDataFieldsWithSeriesValuePane<T extends Abstra
seriesValueFieldsPane = new CellDataSeriesValueCorrelationPane(); seriesValueFieldsPane = new CellDataSeriesValueCorrelationPane();
if (normalCenter != null) { if (normalCenter != null) {
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout(0,6));
panel.add(normalCenter, BorderLayout.CENTER); panel.add(normalCenter, BorderLayout.NORTH);
panel.add(seriesValueFieldsPane, BorderLayout.SOUTH); panel.add(seriesValueFieldsPane, BorderLayout.CENTER);
return panel; return panel;
} else { } else {
return seriesValueFieldsPane; return seriesValueFieldsPane;
} }
} }
public CellDataSeriesValueCorrelationPane getSeriesValueFieldsPane() {
if (seriesValueFieldsPane == null) {
seriesValueFieldsPane = new CellDataSeriesValueCorrelationPane();
}
return seriesValueFieldsPane;
}
public void setSeriesValueFieldsPane(CellDataSeriesValueCorrelationPane seriesValueFieldsPane) {
this.seriesValueFieldsPane = seriesValueFieldsPane;
}
protected void populateSeriesValuePane(AbstractColumnFieldCollectionWithSeriesValue fieldCollectionWithSeriesValue) { protected void populateSeriesValuePane(AbstractColumnFieldCollectionWithSeriesValue fieldCollectionWithSeriesValue) {
seriesValueFieldsPane.populateBean(fieldCollectionWithSeriesValue.getSeriesValueCorrelationDefinition()); seriesValueFieldsPane.populateBean(fieldCollectionWithSeriesValue.getSeriesValueCorrelationDefinition());
} }

19
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractDataSetFieldsWithSeriesValuePane.java

@ -5,8 +5,8 @@ import com.fr.design.chartx.component.SeriesValueFieldComboBoxPane;
import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.util.List; import java.util.List;
import java.awt.BorderLayout;
/** /**
* Created by shine on 2019/5/16. * Created by shine on 2019/5/16.
@ -23,15 +23,26 @@ public abstract class AbstractDataSetFieldsWithSeriesValuePane<T extends Abstrac
seriesValueFieldComboBoxPane = new SeriesValueFieldComboBoxPane(); seriesValueFieldComboBoxPane = new SeriesValueFieldComboBoxPane();
if (normalCenter != null) { if (normalCenter != null) {
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout(0,6));
panel.add(normalCenter, BorderLayout.CENTER); panel.add(normalCenter, BorderLayout.NORTH);
panel.add(seriesValueFieldComboBoxPane, BorderLayout.SOUTH); panel.add(seriesValueFieldComboBoxPane, BorderLayout.CENTER);
return panel; return panel;
} else { } else {
return seriesValueFieldComboBoxPane; return seriesValueFieldComboBoxPane;
} }
} }
public SeriesValueFieldComboBoxPane getSeriesValueFieldComboBoxPane() {
if (seriesValueFieldComboBoxPane == null) {
seriesValueFieldComboBoxPane = new SeriesValueFieldComboBoxPane();
}
return seriesValueFieldComboBoxPane;
}
public void setSeriesValueFieldComboBoxPane(SeriesValueFieldComboBoxPane seriesValueFieldComboBoxPane) {
this.seriesValueFieldComboBoxPane = seriesValueFieldComboBoxPane;
}
@Override @Override
public void checkBoxUse(boolean hasUse) { public void checkBoxUse(boolean hasUse) {
super.checkBoxUse(hasUse); super.checkBoxUse(hasUse);

3
designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractDataPane.java

@ -7,7 +7,6 @@ import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.design.chartx.single.SingleDataPane; import com.fr.design.chartx.single.SingleDataPane;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -58,7 +57,7 @@ public abstract class AbstractDataPane extends ChartDataPane {
if (collection == null) { if (collection == null) {
return; return;
} }
VanChart chart = collection.getSelectedChart(VanChart.class); AbstractChartWithData chart = collection.getSelectedChart(AbstractChartWithData.class);
if (chart == null) { if (chart == null) {
return; return;
} }

2
designer-chart/src/main/java/com/fr/design/mainframe/MiddleChartPropertyPane.java

@ -91,7 +91,7 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{
* @param ePane 面板 * @param ePane 面板
*/ */
public void populateChartPropertyPane(ChartCollection collection, TargetComponent<?> ePane) { public void populateChartPropertyPane(ChartCollection collection, TargetComponent<?> ePane) {
addChartEditPane(collection.getSelectedChart().getPlot().getPlotID()); addChartEditPane(collection.getSelectedChartProvider().getID());
setSupportCellData(true); setSupportCellData(true);
this.container.setEPane(ePane); this.container.setEPane(ePane);
chartEditPane.populate(collection); chartEditPane.populate(collection);

15
designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.chart; package com.fr.design.mainframe.chart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider; import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.ChartTypeInterfaceManager;
@ -130,6 +131,10 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
} }
}; };
@Deprecated
public void reLayout(Chart currentChart) {
}
/** /**
* 重新构造面板 * 重新构造面板
* @param currentChart 图表 * @param currentChart 图表
@ -225,8 +230,14 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
return; return;
} }
if (checkNeedsReLayout(collection.getSelectedChartProvider())) { ChartProvider chartProvider = collection.getSelectedChartProvider();
reLayout(collection.getSelectedChartProvider()); if (checkNeedsReLayout(chartProvider)) {
String chartID = chartProvider.getID();
if ("WaferChipChart".equals(chartID) || "BoxPlotChart".equals(chartID)) {
reLayout((Chart)chartProvider);
} else {
reLayout(chartProvider);
}
} }
this.collection = collection; this.collection = collection;

1
designer-form/src/main/java/com/fr/design/designer/properties/FormWidgetAuthorityEditPane.java

@ -56,6 +56,7 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
for (String selectedRole : selectedArray) { for (String selectedRole : selectedArray) {
for (Widget widget : widgets) { for (Widget widget : widgets) {
widget.changeVisibleAuthorityState(selectedRole, widgetVisible.isSelected()); widget.changeVisibleAuthorityState(selectedRole, widgetVisible.isSelected());
widgetAvailable.setEnabled(widgetVisible.isSelected());
} }
} }
doAfterAuthority(); doAfterAuthority();

2
designer-form/src/main/java/com/fr/design/mainframe/FormArea.java

@ -189,7 +189,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
value = value > SHOWVALMAX ? SHOWVALMAX : value; value = value > SHOWVALMAX ? SHOWVALMAX : value;
value = value < SHOWVALMIN ? SHOWVALMIN : value; value = value < SHOWVALMIN ? SHOWVALMIN : value;
JForm jf = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JForm jf = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jf.resolution = (int) value; jf.setResolution((int) value);
jf.getFormDesign().setResolution((int) value); jf.getFormDesign().setResolution((int) value);
jf.getFormDesign().getArea().resolution = (int) value; jf.getFormDesign().getArea().resolution = (int) value;
reCalculateRoot(value, true); reCalculateRoot(value, true);

11
designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java

@ -1,13 +1,17 @@
package com.fr.design.mainframe.widget.accessibles; package com.fr.design.mainframe.widget.accessibles;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.ToolbarItemProvider;
import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOption;
import com.fr.design.mainframe.FormWebWidgetConstants; import com.fr.design.mainframe.FormWebWidgetConstants;
import com.fr.design.mainframe.widget.editors.ElementCaseToolBarPane; import com.fr.design.mainframe.widget.editors.ElementCaseToolBarPane;
import com.fr.design.mainframe.widget.wrappers.ElementCaseToolBarWrapper; import com.fr.design.mainframe.widget.wrappers.ElementCaseToolBarWrapper;
import com.fr.form.web.FormToolBarManager; import com.fr.form.web.FormToolBarManager;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Filter;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.util.ArrayList; import java.util.ArrayList;
@ -52,6 +56,13 @@ public class AccessibleElementCaseToolBarEditor extends UneditableAccessibleEdit
List<WidgetOption> defaultOptions = Arrays.asList(FormWebWidgetConstants.getFormElementCaseToolBarInstance()); List<WidgetOption> defaultOptions = Arrays.asList(FormWebWidgetConstants.getFormElementCaseToolBarInstance());
List<WidgetOption> options = new ArrayList<WidgetOption>(); List<WidgetOption> options = new ArrayList<WidgetOption>();
options.addAll(defaultOptions); options.addAll(defaultOptions);
WidgetOption[] widgetOptions = ExtraDesignClassManager.getInstance().getWebWidgetOptions(new Filter<ToolbarItemProvider>() {
@Override
public boolean accept(ToolbarItemProvider toolbarItemProvider) {
return toolbarItemProvider.accept(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate());
}
});
options.addAll(Arrays.asList(widgetOptions));
return options.toArray(new WidgetOption[options.size()]); return options.toArray(new WidgetOption[options.size()]);
} }

20
designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java

@ -24,6 +24,7 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.widget.accessibles.AccessibleBackgroundEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleBackgroundEditor;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.ui.designer.AbstractDataModify; import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.UIBoundSpinner;
import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WParameterLayout;
import com.fr.general.Background; import com.fr.general.Background;
@ -61,7 +62,7 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
public void initComponent() { public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
designerWidth = new UISpinner(1, Integer.MAX_VALUE, 1); designerWidth = new UIBoundSpinner(1, Integer.MAX_VALUE, 1);
JPanel advancePane = createAdvancePane(); JPanel advancePane = createAdvancePane();
UIExpandablePane advanceExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, advancePane); UIExpandablePane advanceExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, advancePane);
this.add(advanceExpandablePane, BorderLayout.NORTH); this.add(advanceExpandablePane, BorderLayout.NORTH);
@ -162,16 +163,29 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
public WParameterLayout updateBean() { public WParameterLayout updateBean() {
WParameterLayout wParameterLayout = (WParameterLayout) creator.toData(); WParameterLayout wParameterLayout = (WParameterLayout) creator.toData();
wParameterLayout.setLabelName(labelNameTextField.getText()); wParameterLayout.setLabelName(labelNameTextField.getText());
wParameterLayout.setDesignWidth((int) designerWidth.getValue()); if (isCompsOutOfDesignerWidth((int) designerWidth.getValue())) {
designerWidth.setValue(wParameterLayout.getDesignWidth());
} else {
wParameterLayout.setDesignWidth((int) designerWidth.getValue());
}
wParameterLayout.setDelayDisplayContent(displayReport.isSelected()); wParameterLayout.setDelayDisplayContent(displayReport.isSelected());
wParameterLayout.setUseParamsTemplate(useParamsTemplate.isSelected()); wParameterLayout.setUseParamsTemplate(useParamsTemplate.isSelected());
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected()); jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected());
wParameterLayout.setBackground((Background) background.getValue()); wParameterLayout.setBackground((Background) background.getValue());
wParameterLayout.setPosition((int)hAlignmentPane.getSelectedItem()); wParameterLayout.setPosition((int) hAlignmentPane.getSelectedItem());
return wParameterLayout; return wParameterLayout;
} }
private boolean isCompsOutOfDesignerWidth(int designerWidth){
for(int i=0; i<root.getComponentCount(); i++){
Component comp = root.getComponent(i);
if(comp.getX() + comp.getWidth() > designerWidth){
return true;
}
}
return false;
}
@Override @Override
public DataCreatorUI dataUI() { public DataCreatorUI dataUI() {
return null; return null;

10
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java

@ -19,6 +19,7 @@ import com.fr.design.mainframe.MobileWidgetListPane;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WParameterLayout;
import com.fr.form.ui.container.WSortLayout; import com.fr.form.ui.container.WSortLayout;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -87,9 +88,7 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane {
double[] rowSize = {p, p}; double[] rowSize = {p, p};
double[] columnSize = {p, f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}};
if (ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING).size() != 0) { if (ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING).isEmpty()) {
tipLabel = null;
} else {
((WParameterLayout) (paraCreator.toData())).setProvider((MobileParamStyleProvider) ((Item) paramLocationComboBox.getItemAt(0)).getValue()); ((WParameterLayout) (paraCreator.toData())).setProvider((MobileParamStyleProvider) ((Item) paramLocationComboBox.getItemAt(0)).getValue());
} }
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
@ -127,10 +126,9 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
try { try {
//todo 添加对应插件下载地址 Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("plugin.mobile.style")));
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("plugin.download")));
} catch (Exception exp) { } catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} }
} }
@Override @Override

22
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java

@ -117,6 +117,7 @@ import javax.swing.JPanel;
import javax.swing.JPopupMenu; import javax.swing.JPopupMenu;
import javax.swing.JScrollBar; import javax.swing.JScrollBar;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import java.awt.AWTEvent; import java.awt.AWTEvent;
import java.awt.Adjustable; import java.awt.Adjustable;
import java.awt.Dimension; import java.awt.Dimension;
@ -527,7 +528,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
try { try {
//旧选中内容编辑器释放模板对象 //旧选中内容编辑器释放模板对象
QuickEditor editor = this.getCurrentEditor(); QuickEditor editor = this.getCurrentEditor();
if(editor != null){ if (editor != null) {
editor.release(); editor.release();
} }
} catch (UnsupportedOperationException e) { } catch (UnsupportedOperationException e) {
@ -853,15 +854,20 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
*/ */
public void fireSelectionChangeListener() { public void fireSelectionChangeListener() {
// Guaranteed to return a non-null array // Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList(); final Object[] listeners = listenerList.getListenerList();
// Process the listeners last to first, notifying SwingUtilities.invokeLater(new Runnable() {
// those that are interested in this event @Override
for (int i = listeners.length - 2; i >= 0; i -= 2) { public void run() {
if (listeners[i] == SelectionListener.class) { // Process the listeners last to first, notifying
((SelectionListener) listeners[i + 1]).selectionChanged(new SelectionEvent(this)); // those that are interested in this event
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == SelectionListener.class) {
((SelectionListener) listeners[i + 1]).selectionChanged(new SelectionEvent(this));
}
}
} }
} });
} }
/** /**

4
designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java

@ -15,7 +15,7 @@ public class DesignerAppActivator extends Activator implements Prepare {
@Override @Override
public void start() { public void start() {
List<App> appList = rightCollectMutable(App.KEY); List<App> appList = findMutable(App.KEY);
for (App app : appList) { for (App app : appList) {
JTemplateFactory.register(app); JTemplateFactory.register(app);
} }
@ -24,7 +24,7 @@ public class DesignerAppActivator extends Activator implements Prepare {
@Override @Override
public void stop() { public void stop() {
List<App> appList = rightCollectMutable(App.KEY); List<App> appList = findMutable(App.KEY);
for (App app : appList) { for (App app : appList) {
JTemplateFactory.remove(app); JTemplateFactory.remove(app);
} }

3
designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java

@ -62,8 +62,7 @@ public class CellElementEditPane extends BasicPane {
@Override @Override
public void tabChanged(int index) { public void tabChanged(int index) {
card.show(center, paneList.get(index).title4PopupWindow()); card.show(center, paneList.get(index).title4PopupWindow());
paneList.get(index).populateBean(cellelement, ePane);// 设置面板变了,也要populate populate(ePane);
paneList.get(index).addAttributeChangeListener(listener);
if (titleChangeListener != null) { if (titleChangeListener != null) {
titleChangeListener.fireTitleChange(getSelectedTabName()); titleChangeListener.fireTitleChange(getSelectedTabName());
} }

9
designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.errorinfo; package com.fr.design.mainframe.errorinfo;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.mainframe.SiteCenterToken; import com.fr.design.mainframe.SiteCenterToken;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.CommonIOUtils; import com.fr.general.CommonIOUtils;
@ -24,6 +25,8 @@ import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* Created by Administrator on 2017/7/24 0024. * Created by Administrator on 2017/7/24 0024.
@ -81,8 +84,8 @@ public class ErrorInfoUploader {
return; return;
} }
ExecutorService es = Executors.newSingleThreadExecutor(new NamedThreadFactory("ErrorInfoUploader"));
Thread updateThread = new Thread(new Runnable() { es.submit(new Runnable() {
@Override @Override
public void run() { public void run() {
String localCacheFilePath = StableUtils.pathJoin(ProductConstants.getEnvHome(), "solution", "solution.zip"); String localCacheFilePath = StableUtils.pathJoin(ProductConstants.getEnvHome(), "solution", "solution.zip");
@ -92,7 +95,7 @@ public class ErrorInfoUploader {
} }
} }
}); });
updateThread.start(); es.shutdown();
} }
private void downloadSolution(File localCacheZip) { private void downloadSolution(File localCacheZip) {

95
designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/StartupMessageCollector.java

@ -0,0 +1,95 @@
package com.fr.design.mainframe.messagecollect;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.SiteCenterToken;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.module.ModuleContext;
import com.fr.module.engine.FineModule;
import com.fr.runtime.FineRuntime;
import com.fr.stable.StringUtils;
import java.util.HashMap;
import java.util.concurrent.ExecutorService;
/**
* 启动信息收集
*
* @author vito
* @version 10.0
* Created by vito on 2019/9/4
*/
public class StartupMessageCollector {
private static final String XML_STARTUP_TIME = "t";
private static final String XML_STARTUP_LOG = "startupLog";
private static final String XML_STARTUP_Memory = "designerMemory";
private static final String XML_STARTUP_COST = "cost";
private static final String XML_UUID = "UUID";
private static final String STARTUP_URL_KEY = "user.info.v10.startup";
private static final String LOG_TYPE = "single";
private static final int BYTE_TO_MB = 1024 * 1024;
public static final StartupMessageCollector INSTANCE = new StartupMessageCollector();
private StartupMessageCollector() {
}
public static StartupMessageCollector getInstance() {
return INSTANCE;
}
public void recordStartupLog() {
EventDispatcher.listen(FineRuntime.ApplicationEvent.AFTER_START, new Listener<Long>() {
@Override
public void on(Event event, Long param) {
final String url = CloudCenter.getInstance().acquireUrlByKind(STARTUP_URL_KEY);
if (StringUtils.isEmpty(url)) {
return;
}
ExecutorService es = ModuleContext.getExecutor()
.newSingleThreadExecutor(new NamedThreadFactory("StartupMessageCollector"));
es.submit(new Runnable() {
@Override
public void run() {
FineModule root = (FineModule) ModuleContext.getRoot().getRoot();
JSONObject profile = root.profile();
if (profile.isEmpty()) {
return;
}
JSONObject json = JSONObject.create()
.put(XML_UUID, DesignerEnvManager.getEnvManager().getUUID())
.put(XML_STARTUP_TIME, FineRuntime.getAppStartTime() + FineRuntime.getStartingTime())
.put(XML_STARTUP_COST, FineRuntime.getStartingTime())
.put(XML_STARTUP_LOG, profile)
.put(XML_STARTUP_Memory, Runtime.getRuntime().totalMemory() / BYTE_TO_MB);
sendInfo(json, url + LOG_TYPE);
}
});
es.shutdown();
}
});
}
private boolean sendInfo(JSONObject content, String url) {
boolean success = false;
try {
HashMap<String, Object> para = new HashMap<>();
para.put("token", SiteCenterToken.generateToken());
para.put("content", content);
String res = HttpToolbox.post(url, para);
success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success");
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return success;
}
}

18
designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollectConstants.java

@ -0,0 +1,18 @@
package com.fr.design.mainframe.messagecollect.solid;
/**
* Created by alex sung on 2019/9/5.
*/
public class SolidCollectConstants {
private SolidCollectConstants(){}
/**
* 客户端请求subject
*/
public static final String REQUEST_SUBJECT = "solid";
/**
* 客户端请求超时鉴权时间默认1h失效
*/
public static final long TIME_OUT = 60 * 60 * 1000;
}

97
designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java

@ -0,0 +1,97 @@
package com.fr.design.mainframe.messagecollect.solid;
import com.fr.general.CloudCenter;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSON;
import com.fr.json.JSONFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.security.JwtUtils;
import com.fr.stable.CommonUtils;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import static com.fr.design.mainframe.messagecollect.solid.SolidCollectConstants.REQUEST_SUBJECT;
import static com.fr.design.mainframe.messagecollect.solid.SolidCollectConstants.TIME_OUT;
/**
* 设计器固化信息回传类
* Created by alex sung on 2019/8/22.
*/
public class SolidCollector {
private static final String CONTENT_URL = "/v10/collect/solid";
private static final String DELETE_URL = "/v10/collect/solid/delete";
private static final String UNLOCK_URL = "/v10/collect/solid/unlock";
private static final String ATTR_CIPHER_TEXT = "cipherText";
private static final String ATTR_SIGNATURE = "signature";
private static final String SOLID_UPLOAD_URL = CloudCenter.getInstance().acquireUrlByKind("design.solid");
private static volatile SolidCollector instance;
public static SolidCollector getInstance() {
if (instance == null) {
synchronized (SolidCollector.class) {
if (instance == null) {
instance = new SolidCollector();
}
}
}
return instance;
}
/**
* 回传文件给云中心并删除服务端本地文件
*/
public void sendToCloudCenterAndDeleteFile() {
if (WorkContext.getCurrent().isLocal()) {
return;
}
FineLoggerFactory.getLogger().info("start to get solid content from server...");
try {
String content = requestContent();
if (StringUtils.isNotEmpty(content)) {
String cipherText = JSONFactory.createJSON(JSON.OBJECT, content).optString("data");
if(StringUtils.isNotEmpty(cipherText)){
Map<String, Object> params = new HashMap<>();
params.put(ATTR_CIPHER_TEXT, cipherText);
params.put(ATTR_SIGNATURE, String.valueOf(CommonUtils.signature()));
HttpToolbox.post(SOLID_UPLOAD_URL, params);
String deleteUrl = WorkContext.getCurrent().getPath() + DELETE_URL;
HttpToolbox.post(deleteUrl, getParams());
}
}
FineLoggerFactory.getLogger().info("send solid content to cloud center success.");
} catch (Exception e) {
FineLoggerFactory.getLogger().info(e.getMessage(), e);
} finally {
String unlockUrl = WorkContext.getCurrent().getPath() + UNLOCK_URL;
try {
HttpToolbox.post(unlockUrl, getParams());
} catch (IOException e) {
FineLoggerFactory.getLogger().warn(e.getMessage(), e);
}
}
}
/**
* 获取服务端固化文件内容
* @return 回传内容
*/
public String requestContent() throws Exception {
Map<String, String> params = new HashMap<String, String>();
params.put("token", JwtUtils.createDefaultJWT(REQUEST_SUBJECT, TIME_OUT));
return HttpToolbox.get(WorkContext.getCurrent().getPath() + CONTENT_URL, params);
}
private Map<String, Object> getParams() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("token", JwtUtils.createDefaultJWT(REQUEST_SUBJECT, TIME_OUT));
return params;
}
}

8
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -6,6 +6,7 @@ import com.fr.design.EnvChangeEntrance;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.loghandler.DesignerLogger; import com.fr.design.mainframe.loghandler.DesignerLogger;
import com.fr.design.ui.util.UIUtil;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.RemoteDesignConstants; import com.fr.report.RemoteDesignConstants;
@ -22,9 +23,7 @@ import io.socket.client.IO;
import io.socket.client.Socket; import io.socket.client.Socket;
import io.socket.emitter.Emitter; import io.socket.emitter.Emitter;
import javax.swing.JOptionPane; import javax.swing.*;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URL; import java.net.URL;
@ -88,7 +87,8 @@ public class DesignerSocketIO {
*/ */
if (status != Status.Disconnecting) { if (status != Status.Disconnecting) {
try { try {
SwingUtilities.invokeAndWait(new Runnable() { UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() { public void run() {
JOptionPane.showMessageDialog( JOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),

2
designer-realize/src/main/java/com/fr/design/webattr/FToolBar.java

@ -17,7 +17,7 @@ public class FToolBar {
} }
public void setButtonlist(List<ToolBarButton> buttonlist) { public void setButtonlist(List<ToolBarButton> buttonlist) {
if (buttonlist == null || buttonlist.size() < 0) { if (buttonlist == null ) {
this.buttonlist = new ArrayList<ToolBarButton>(); this.buttonlist = new ArrayList<ToolBarButton>();
} else { } else {
this.buttonlist = buttonlist; this.buttonlist = buttonlist;

11
designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java

@ -35,6 +35,7 @@ import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.image.ImageObserver; import java.awt.image.ImageObserver;
import java.util.List;
/** /**
* 新的拖拽ToolBar button以实现自定义工具栏 报表web设置那儿的.应该不叫ToolBarDragPane因为实际没有提供drag功能 * 新的拖拽ToolBar button以实现自定义工具栏 报表web设置那儿的.应该不叫ToolBarDragPane因为实际没有提供drag功能
@ -225,6 +226,16 @@ public class ToolBarDragPane extends WidgetToolBarPane {
public void setAllEnabled(boolean b) { public void setAllEnabled(boolean b) {
GUICoreUtils.setEnabled(this, b); GUICoreUtils.setEnabled(this, b);
isEnabled = b; isEnabled = b;
removeAllListener(northToolBar.getToolBarButtons());
}
private void removeAllListener(List<ToolBarButton> toolBarButtons) {
for (ToolBarButton button : toolBarButtons) {
button.setEnabled(isEnabled);
if (!isEnabled) {
button.removeMouseListener(button);
}
}
} }
/** /**

2
designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java

@ -124,7 +124,7 @@ public class ToolBarPane extends BasicBeanPane<ToolBar> {
} }
private void setToolBar(List<ToolBarButton> list) { private void setToolBar(List<ToolBarButton> list) {
if (list == null || list.size() < 0) { if (list == null ) {
return; return;
} }
this.removeAll(); this.removeAll();

2
designer-realize/src/main/java/com/fr/design/webattr/WebSettingPane.java

@ -122,8 +122,8 @@ public abstract class WebSettingPane<T extends WebContent> extends BasicBeanPane
choseComboBox.removeItemListener(itemListener); choseComboBox.removeItemListener(itemListener);
choseComboBox.setSelectedIndex(SERVER_SET); choseComboBox.setSelectedIndex(SERVER_SET);
choseComboBox.addItemListener(itemListener); choseComboBox.addItemListener(itemListener);
checkEnabled(false);
populateServerSettings(); populateServerSettings();
checkEnabled(false);
return; return;
} }
// 模板设置 // 模板设置

22
designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java

@ -27,6 +27,7 @@ import com.fr.design.selection.SelectionListener;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.report.cell.TemplateCellElement;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import com.fr.stable.ColumnRowGroup; import com.fr.stable.ColumnRowGroup;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -427,7 +428,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
dealSelectColRow(add, cellselection); dealSelectColRow(add, cellselection);
} else { } else {
ColumnRow columnRow = ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow()); ColumnRow columnRow = ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow());
String allColumnRow = columnRow.toString(); String allColumnRow = newValue.toString();
if (!allColumnRow.contains(columnRow.toString())) { if (!allColumnRow.contains(columnRow.toString())) {
add.addColumnRow(columnRow); add.addColumnRow(columnRow);
} }
@ -454,11 +455,22 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
newAdd.clear(); newAdd.clear();
for (int i = 0; i < cs; i++) { for (int i = 0; i < cs; i++) {
for (int j = 0; j < rs; j++) { for (int j = 0; j < rs; j++) {
ColumnRow columnRow = ColumnRow.valueOf(c + i, r + j); TemplateCellElement cellElement = ePane.getEditingElementCase().getTemplateCellElement(c + i, r + j );
if (!allColumnRow.contains(columnRow.toString())) { if (cellElement != null && ((i + c) != 0 || (r + j) != 0)) {
add.addColumnRow(columnRow); String value = cellElement.toString();
if (!newAdd.contains(value) && !allColumnRow.contains(value)) {
add.addColumnRow(ColumnRow.valueOf(value));
}
newAdd.add(value);
}
if (cellElement == null) {
ColumnRow columnRow = ColumnRow.valueOf(c + i, r + j);
if (!allColumnRow.contains(columnRow.toString())) {
add.addColumnRow(columnRow);
}
newAdd.add(columnRow.toString());
} }
newAdd.add(columnRow.toString());
} }
} }
int oldSize = oldAdd.size(); int oldSize = oldAdd.size();

5
designer-realize/src/main/java/com/fr/poly/creator/ECBlockEditor.java

@ -136,6 +136,7 @@ public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
* @date 2014-11-24-下午3:48:19 * @date 2014-11-24-下午3:48:19
*/ */
public void resetSelectionAndChooseState() { public void resetSelectionAndChooseState() {
boolean chooseBlock = designer.isChooseBlock();
designer.setChooseType(SelectionType.INNER); designer.setChooseType(SelectionType.INNER);
if (DesignerMode.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
@ -167,7 +168,9 @@ public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
conditionAttributesGroupPane.populate(editComponent); conditionAttributesGroupPane.populate(editComponent);
EastRegionContainerPane.getInstance().updateCellElementState(isSelectedOneCell()); EastRegionContainerPane.getInstance().updateCellElementState(isSelectedOneCell());
if (chooseBlock) {
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_CELL_ATTR);
}
} }
// 超级链接 // 超级链接

2
designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java

@ -103,7 +103,7 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
formulaButton.addActionListener(new ActionListener() { formulaButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
String text = formulaTextField.getText(); String text = formulaTextField.getText();
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula();
formulaPane.populate(BaseFormula.createFormulaBuilder().build(text)); formulaPane.populate(BaseFormula.createFormulaBuilder().build(text));
formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override

20
designer-realize/src/main/java/com/fr/start/Designer.java

@ -82,6 +82,7 @@ public class Designer extends BaseDesigner {
private UIButton saveButton; private UIButton saveButton;
private UIButton undo; private UIButton undo;
private UIButton redo; private UIButton redo;
private UIButton[] upToolBar;
private UIPreviewButton run; private UIPreviewButton run;
public Designer(String[] args) { public Designer(String[] args) {
@ -94,7 +95,7 @@ public class Designer extends BaseDesigner {
* @param args 参数 * @param args 参数
*/ */
public static void main(String[] args) { public static void main(String[] args) {
StopWatch watch = new StopWatch(); StopWatch watch = new StopWatch();
watch.start(); watch.start();
//启动运行时 //启动运行时
@ -210,11 +211,17 @@ public class Designer extends BaseDesigner {
*/ */
@Override @Override
public UIButton[] createUp() { public UIButton[] createUp() {
return new UIButton[]{createSaveButton(), createUndoButton(), createRedoButton()}; if (upToolBar == null) {
createSaveButton();
createUndoButton();
createRedoButton();
return upToolBar = new UIButton[]{saveButton, undo, redo};
}
return upToolBar;
} }
private UIButton createSaveButton() { private void createSaveButton() {
saveButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/save.png")); saveButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/save.png"));
saveButton.setToolTipText(KeySetUtils.SAVE_TEMPLATE.getMenuKeySetName()); saveButton.setToolTipText(KeySetUtils.SAVE_TEMPLATE.getMenuKeySetName());
saveButton.set4ToolbarButton(); saveButton.set4ToolbarButton();
@ -227,11 +234,10 @@ public class Designer extends BaseDesigner {
jt.requestFocus(); jt.requestFocus();
} }
}); });
return saveButton;
} }
private UIButton createUndoButton() { private void createUndoButton() {
undo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/undo.png")); undo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/undo.png"));
undo.setToolTipText(KeySetUtils.UNDO.getMenuKeySetName()); undo.setToolTipText(KeySetUtils.UNDO.getMenuKeySetName());
undo.set4ToolbarButton(); undo.set4ToolbarButton();
@ -244,10 +250,9 @@ public class Designer extends BaseDesigner {
} }
} }
}); });
return undo;
} }
private UIButton createRedoButton() { private void createRedoButton() {
redo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/redo.png")); redo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/redo.png"));
redo.setToolTipText(KeySetUtils.REDO.getMenuKeySetName()); redo.setToolTipText(KeySetUtils.REDO.getMenuKeySetName());
redo.set4ToolbarButton(); redo.set4ToolbarButton();
@ -260,7 +265,6 @@ public class Designer extends BaseDesigner {
} }
} }
}); });
return redo;
} }
private void createRunButton(UILargeToolbar largeToolbar) { private void createRunButton(UILargeToolbar largeToolbar) {

55
designer-realize/src/main/java/com/fr/start/DesignerInitial.java

@ -1,24 +1,53 @@
package com.fr.start; package com.fr.start;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.ui.util.UIUtil;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
/** /**
* Created by juhaoyu on 2019-06-14. * Created by juhaoyu on 2019-06-14.
* 设计器上下文 * 设计器上下文
*/ */
public class DesignerInitial { public class DesignerInitial {
private static volatile Designer designer; private static volatile Designer designer;
public synchronized static void init(String... args) { public static void init(final String... args) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
designer = new Designer(args); @Override
public void run() {
designer = new Designer(args);
}
});
} }
public synchronized static void show() { public static void prepare() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
if (designer != null) { @Override
designer.show(); public void run() {
} if (designer != null) {
//启动画面结束 designer.show();
SplashContext.getInstance().hide(); }
}
});
EventDispatcher.listen(DesignerLaunchStatus.OPEN_LAST_FILE_COMPLETE, new Listener<Null>() {
@Override
public void on(Event event, Null param) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
DesignerContext.getDesignerFrame().setVisible(true);
DesignerContext.getDesignerFrame().resizeFrame();
//启动画面结束
SplashContext.getInstance().hide();
}
});
DesignerLaunchStatus.setStatus(DesignerLaunchStatus.STARTUP_COMPLETE);
}
});
} }
} }

22
designer-realize/src/main/java/com/fr/start/SplashContext.java

@ -36,18 +36,19 @@ public class SplashContext {
private SplashStrategy splashStrategy; private SplashStrategy splashStrategy;
private String moduleID = ""; private String moduleId = "";
private int loadingIndex = 0; private int loadingIndex = 0;
private String[] loading = new String[]{"..", "....", "......"}; private String[] loading = new String[]{"..", "....", "......"};
private int fetchOnlineTimes = 0; private int fetchOnlineTimes = 0;
private String guest = StringUtils.EMPTY; private String guest = StringUtils.EMPTY;
private boolean hasShowThanks = false;
private ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1, new NamedThreadFactory("SplashContext")); private ScheduledExecutorService scheduler = Executors
.newScheduledThreadPool(1, new NamedThreadFactory("SplashContext"));
private Listener<String> listener; private Listener<String> listener;
public static SplashContext getInstance() { public static SplashContext getInstance() {
return SPLASH_CONTEXT; return SPLASH_CONTEXT;
} }
@ -76,11 +77,11 @@ public class SplashContext {
* 隐藏启动动画 * 隐藏启动动画
*/ */
public void hide() { public void hide() {
splashStrategy.hide();
//取消监听
EventDispatcher.stopListen(listener);
// 窗口关闭后取消定时获取模块信息的timer // 窗口关闭后取消定时获取模块信息的timer
scheduler.shutdown(); scheduler.shutdown();
//取消监听
EventDispatcher.stopListen(listener);
splashStrategy.hide();
// 一次性 // 一次性
splashStrategy = null; splashStrategy = null;
} }
@ -91,7 +92,7 @@ public class SplashContext {
public void run() { public void run() {
showThanks(); showThanks();
loadingIndex++; loadingIndex++;
updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); updateModuleLog(moduleId.isEmpty() ? StringUtils.EMPTY : moduleId + loading[loadingIndex % 3]);
} }
}, 0, 300, TimeUnit.MILLISECONDS); }, 0, 300, TimeUnit.MILLISECONDS);
@ -99,9 +100,9 @@ public class SplashContext {
@Override @Override
public void on(Event event, String i18n) { public void on(Event event, String i18n) {
moduleID = i18n; moduleId = i18n;
loadingIndex++; loadingIndex++;
updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); updateModuleLog(moduleId.isEmpty() ? StringUtils.EMPTY : moduleId + loading[loadingIndex % 3]);
} }
}; };
EventDispatcher.listen(ModuleEvent.MajorModuleStarting, listener); EventDispatcher.listen(ModuleEvent.MajorModuleStarting, listener);
@ -149,10 +150,11 @@ public class SplashContext {
* 获取10次在线资源最大时间3秒 * 获取10次在线资源最大时间3秒
*/ */
private void showThanks() { private void showThanks() {
if (shouldShowThanks()) { if (shouldShowThanks() && !hasShowThanks) {
tryFetchOnline(); tryFetchOnline();
if (StringUtils.isNotEmpty(guest)) { if (StringUtils.isNotEmpty(guest)) {
updateThanksLog(THANKS + guest); updateThanksLog(THANKS + guest);
hasShowThanks = true;
} }
} }
} }

66
designer-realize/src/main/java/com/fr/start/common/SplashCommon.java

@ -0,0 +1,66 @@
package com.fr.start.common;
import com.fr.design.ui.util.UIUtil;
import com.fr.start.SplashStrategy;
/**
* 静态启动画面
*
* @author vito
* @version 10.0
* Created by vito on 2019年9月16日
*/
public class SplashCommon implements SplashStrategy {
private SplashWindow splashWindow;
@Override
public void show() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
splashWindow = new SplashWindow();
splashWindow.setVisible(true);
}
});
}
@Override
public void hide() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
if (splashWindow != null) {
splashWindow.setVisible(false);
splashWindow.dispose();
}
}
});
}
@Override
public void updateModuleLog(final String text) {
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
if (splashWindow != null) {
splashWindow.updateModuleLog(text);
}
}
});
}
@Override
public void updateThanksLog(final String text) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
if (splashWindow != null) {
splashWindow.updateThanksLog(text);
}
}
});
}
}

120
designer-realize/src/main/java/com/fr/start/common/SplashPane.java

@ -0,0 +1,120 @@
package com.fr.start.common;
import com.bulenkov.iconloader.IconLoader;
import com.bulenkov.iconloader.util.JBUI;
import com.fr.base.GraphHelper;
import com.fr.design.ui.util.GraphicsConfig;
import com.fr.stable.GraphDrawHelper;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.value.NotNullLazyValue;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.*;
import java.util.Locale;
/**
* 启动画面面板
*
* @author vito
* @version 10.0
* Created by vito on 2019/09/12
*/
public class SplashPane extends JPanel {
private static String OEM_PATH = "/com/fr/design/images/splash_10.png";
private static float JBUI_INIT_SCALE = JBUI.scale(1f);
private static final Color MODULE_COLOR = new Color(255, 255, 255);
private static final int MODULE_INFO_X = uiScale(36);
private static final int MODULE_INFO_Y = uiScale(339);
private static final Color THANK_COLOR = new Color(255, 255, 255, (int) (0.6 * 255 + 0.5));
private static final int THANK_INFO_X = uiScale(470);
private static final int FONT_SIZE = uiScale(12);
private static final int MODULE_INFO_WIDTH = uiScale(150);
private static final int MODULE_INFO_HEIGHT = uiScale(20);
private static final String ARIAL_FONT_NAME = "Arial";
private static final String YAHEI_FONT_NAME = "Microsoft YaHei";
private String thanksLog = StringUtils.EMPTY;
private String moduleText = StringUtils.EMPTY;
private static int uiScale(int i) {
return (int) (i * JBUI_INIT_SCALE);
}
private NotNullLazyValue<Font> fontValue = new NotNullLazyValue<Font>() {
@NotNull
@Override
protected Font compute() {
Font font = null;
if (OperatingSystem.isWindows()) {
font = createFont(YAHEI_FONT_NAME);
}
if (font == null || isDialogFont(font)) {
font = createFont(ARIAL_FONT_NAME);
}
return font;
}
};
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Icon icon = IconLoader.getIcon(OEM_PATH);
icon.paintIcon(null, g, 0, 0);
paintShowText((Graphics2D) g);
g.dispose();
}
protected void paintShowText(Graphics2D g) {
GraphicsConfig config = new GraphicsConfig(g).setupAAPainting();
g.setPaint(MODULE_COLOR);
g.setFont(fontValue.getValue());
//加载模块信息
GraphDrawHelper.drawString(g, moduleText, MODULE_INFO_X, MODULE_INFO_Y);
//感谢用户信息
if (StringUtils.isNotEmpty(thanksLog)) {
g.setPaint(THANK_COLOR);
GraphHelper.drawString(g, thanksLog, THANK_INFO_X, MODULE_INFO_Y);
}
config.restore();
}
Dimension getSplashDimension() {
Icon icon = IconLoader.getIcon(OEM_PATH);
return new Dimension(icon.getIconWidth(), icon.getIconHeight());
}
private boolean isDialogFont(Font font) {
return Font.DIALOG.equals(font.getFamily(Locale.US));
}
private Font createFont(String fontName) {
return new Font(fontName, Font.PLAIN, FONT_SIZE);
}
/**
* 设置在启动过程中, 动态改变的文本, 当前启动的模块信息
*
* @param text 指定的文本
*/
void updateModuleLog(String text) {
moduleText = text;
repaint(MODULE_INFO_X, MODULE_INFO_Y - FONT_SIZE, MODULE_INFO_WIDTH, MODULE_INFO_HEIGHT);
}
void updateThanksLog(String text) {
thanksLog = text;
repaint(THANK_INFO_X, MODULE_INFO_Y - FONT_SIZE, MODULE_INFO_WIDTH, MODULE_INFO_HEIGHT);
}
}

70
designer-realize/src/main/java/com/fr/start/common/SplashWindow.java

@ -0,0 +1,70 @@
package com.fr.start.common;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.os.OperatingSystem;
import com.sun.awt.AWTUtilities;
import javax.swing.*;
import java.awt.*;
/**
* 启动画面窗口
*
* @author vito
* @version 10.0
* Created by vito on 2019/10/16
*/
public class SplashWindow extends JFrame {
private SplashPane splash;
public SplashWindow() {
// alex:必须设置这个属性为true,才可以用透明背景
System.setProperty("sun.java2d.noddraw", "true");
//slash pane
this.splash = new SplashPane();
splash.setBackground(null);
this.setContentPane(splash);
this.setSize(splash.getSplashDimension());
this.setAlwaysOnTop(false);
this.setUndecorated(true);
AWTUtilities.setWindowOpaque(this, false);
//使窗体背景透明
if (OperatingSystem.isWindows()) {
this.setBackground(new Color(0, 0, 0, 0));
}
GUICoreUtils.centerWindow(this);
}
/**
* 注销窗口
*/
@Override
public void dispose() {
super.dispose();
}
/**
* 设置在启动过程中, 动态改变的文本, 当前启动的模块信息
*
* @param text 指定的文本
*/
void updateModuleLog(String text) {
splash.updateModuleLog(text);
}
void updateThanksLog(String text) {
splash.updateThanksLog(text);
}
public static void main(String[] args) {
SplashWindow splashWindow = new SplashWindow();
splashWindow.setVisible(true);
}
}

14
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -25,6 +25,7 @@ import com.fr.design.actions.insert.flot.FormulaFloatAction;
import com.fr.design.actions.insert.flot.ImageFloatAction; import com.fr.design.actions.insert.flot.ImageFloatAction;
import com.fr.design.actions.insert.flot.TextBoxFloatAction; import com.fr.design.actions.insert.flot.TextBoxFloatAction;
import com.fr.design.bridge.DesignToolbarProvider; import com.fr.design.bridge.DesignToolbarProvider;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.form.parameter.FormParaDesigner; import com.fr.design.form.parameter.FormParaDesigner;
import com.fr.design.fun.ElementUIProvider; import com.fr.design.fun.ElementUIProvider;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
@ -98,8 +99,8 @@ import com.fr.stable.xml.ObjectXMLWriterFinder;
import com.fr.start.BBSGuestPaneProvider; import com.fr.start.BBSGuestPaneProvider;
import com.fr.xml.ReportXMLUtils; import com.fr.xml.ReportXMLUtils;
import java.awt.Image; import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -115,7 +116,7 @@ public class DesignerActivator extends Activator {
@Override @Override
public void start() { public void start() {
List<LocaleMarker> markers = rightCollectMutable(InterMutableKey.Path); List<LocaleMarker> markers = findMutable(InterMutableKey.Path);
for (LocaleMarker marker : markers) { for (LocaleMarker marker : markers) {
if (marker.match(LocaleScope.DESIGN)) { if (marker.match(LocaleScope.DESIGN)) {
DesignI18nImpl.getInstance().addResource(marker.getPath()); DesignI18nImpl.getInstance().addResource(marker.getPath());
@ -128,7 +129,12 @@ public class DesignerActivator extends Activator {
storePassport(); storePassport();
AlphaFineHelper.switchConfig4Locale(); AlphaFineHelper.switchConfig4Locale();
} }
@Override
public void afterAllStart() {
DesignerLaunchStatus.setStatus(DesignerLaunchStatus.DESIGNER_INIT_COMPLETE);
}
private void loadLogAppender() { private void loadLogAppender() {
logHandler = new LogHandler<DesignerLogAppender>() { logHandler = new LogHandler<DesignerLogAppender>() {
final DesignerLogAppender logAppender = new DesignerLogAppender(); final DesignerLogAppender logAppender = new DesignerLogAppender();

21
designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java

@ -1,21 +0,0 @@
package com.fr.start.module;
import com.fr.module.Activator;
import com.fr.start.DesignerInitial;
/**
* Created by juhaoyu on 2019-06-14.
*/
public class DesignerInitActivator extends Activator {
@Override
public void start() {
DesignerInitial.init(upFindSingleton(StartupArgs.class).get());
}
@Override
public void stop() {
}
}

12
designer-realize/src/main/java/com/fr/start/module/DesignerShowActivator.java

@ -10,16 +10,16 @@ import com.fr.start.DesignerInitial;
* Created by juhaoyu on 2019-06-14. * Created by juhaoyu on 2019-06-14.
*/ */
public class DesignerShowActivator extends Activator { public class DesignerShowActivator extends Activator {
@Override @Override
public void start() { public void start() {
DesignerInitial.init(findSingleton(StartupArgs.class).get());
EventDispatcher.fire(ModuleEvent.MajorModuleStarting, Toolkit.i18nText("Fine-Design_Module_Name_Designer")); EventDispatcher.asyncFire(ModuleEvent.MajorModuleStarting, Toolkit.i18nText("Fine-Design_Module_Name_Designer"));
DesignerInitial.show(); DesignerInitial.prepare();
} }
@Override @Override
public void stop() { public void stop() {
// void
} }
} }

130
designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

@ -1,11 +1,33 @@
package com.fr.start.module; package com.fr.start.module;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.design.fun.OemProcessor;
import com.fr.design.fun.impl.GlobalListenerProviderManager;
import com.fr.design.mainframe.messagecollect.StartupMessageCollector;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.DesignerPort;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.record.analyzer.EnableMetrics; import com.fr.record.analyzer.EnableMetrics;
import com.fr.record.analyzer.Metrics; import com.fr.record.analyzer.Metrics;
import com.fr.runtime.FineRuntime; import com.fr.stable.BuildContext;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.start.OemHandler;
import com.fr.start.ServerStarter; import com.fr.start.ServerStarter;
import com.fr.start.SplashContext;
import com.fr.start.SplashStrategy;
import com.fr.start.common.SplashCommon;
import com.fr.start.server.FineEmbedServer;
import com.fr.value.NotNullLazyValue;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.concurrent.ExecutorService;
/** /**
* Created by juhaoyu on 2018/1/8. * Created by juhaoyu on 2018/1/8.
@ -13,29 +35,117 @@ import com.fr.start.ServerStarter;
@EnableMetrics @EnableMetrics
public class DesignerStartup extends Activator { public class DesignerStartup extends Activator {
private NotNullLazyValue<StartupArgs> startupArgsValue = new NotNullLazyValue<StartupArgs>() {
@NotNull
@Override
protected StartupArgs compute() {
return findSingleton(StartupArgs.class);
}
};
@Override
public void beforeAllStart() {
BuildContext.setBuildFilePath("/com/fr/stable/build.properties");
// 检查是否是-Ddebug = true 启动 并切换对应的端口以及环境配置文件
checkDebugStart();
if (DesignUtils.isStarted()) {
// 如果端口被占用了 说明程序已经运行了一次,也就是说,已经建立一个监听服务器,现在只要给服务器发送命令就好了
final String[] args = startupArgsValue.getValue().get();
DesignUtils.clientSend(args);
FineLoggerFactory.getLogger().info("The Designer Has Been Started");
System.exit(0);
return;
}
// 快快显示启动画面
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
SplashContext.getInstance().registerSplash(createSplash());
SplashContext.getInstance().show();
}
});
}
@Override @Override
@Metrics @Metrics
public void start() { public void start() {
startSub(PreStartActivator.class); startSub(PreStartActivator.class);
getSub("parallel").start(); startSub(DesignerWorkspaceActivator.class);
//designer模块启动好后,查看demo //designer模块启动好后,查看demo
browserDemo(); browserDemoIfNeeded();
startSub(DesignerShowActivator.class); startupEmbedServerIfNeeded();
startSub(StartFinishActivator.class); }
FineRuntime.startFinish();
private void startupEmbedServerIfNeeded() {
if (DesignerEnvManager.getEnvManager().isEmbedServerLazyStartup()
|| FineEmbedServer.isRunning()) {
return;
}
ExecutorService service = newSingleThreadExecutor(new NamedThreadFactory("FineEmbedServerStart"));
service.submit(new Runnable() {
@Override
public void run() {
FineEmbedServer.start();
}
});
service.shutdown();
} }
private void browserDemo() { @Override
public void afterAllStart() {
GlobalListenerProviderManager.getInstance().init();
// 启动日志收集
StartupMessageCollector.getInstance().recordStartupLog();
}
if (getModule().leftFindSingleton(StartupArgs.class) != null && getModule().leftFindSingleton(StartupArgs.class).isDemo()) { private SplashStrategy createSplash() {
OemProcessor oemProcessor = OemHandler.findOem();
if (oemProcessor != null) {
SplashStrategy splashStrategy = null;
try {
splashStrategy = oemProcessor.createSplashStrategy();
} catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (splashStrategy != null) {
return splashStrategy;
}
}
return new SplashCommon();
}
private void browserDemoIfNeeded() {
if (startupArgsValue.getValue().isDemo()) {
ServerStarter.browserDemoURL(); ServerStarter.browserDemoURL();
} }
} }
/**
* 在VM options里加入-Ddebug=true激活
*/
private void checkDebugStart() {
if (ComparatorUtils.equals("true", System.getProperty("debug"))) {
setDebugEnv();
}
}
/**
* 端口改一下环境配置文件改一下便于启动两个设计器进行对比调试
*/
private void setDebugEnv() {
DesignUtils.setPort(DesignerPort.DEBUG_MESSAGE_PORT);
DesignerEnvManager.setEnvFile(new File(StableUtils.pathJoin(
ProductConstants.getEnvHome(),
ProductConstants.APP_NAME + "Env_debug.xml"
)));
}
@Override @Override
public void stop() { public void stop() {
// void
} }
} }

11
designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java

@ -6,12 +6,10 @@ import com.fr.event.Event;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.start.server.FineEmbedServer; import com.fr.start.server.FineEmbedServer;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.WorkspaceEvent;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* Created by juhaoyu on 2019-06-14. * Created by juhaoyu on 2019-06-14.
@ -22,7 +20,6 @@ public class DesignerWorkspaceActivator extends Activator {
public void start() { public void start() {
registerEnvListener(); registerEnvListener();
startServer(WorkContext.getCurrent());
} }
/** /**
@ -36,7 +33,7 @@ public class DesignerWorkspaceActivator extends Activator {
@Override @Override
public void on(Event event, Workspace current) { public void on(Event event, Workspace current) {
getSub(EnvBasedModule.class).stop(); stopSub(EnvBasedModule.class);
} }
}); });
/*切换环境后,重新启动所有相关模块,最先执行*/ /*切换环境后,重新启动所有相关模块,最先执行*/
@ -45,8 +42,7 @@ public class DesignerWorkspaceActivator extends Activator {
@Override @Override
public void on(Event event, Workspace current) { public void on(Event event, Workspace current) {
getSub(EnvBasedModule.class).start(); startSub(EnvBasedModule.class);
startServer(current);
} }
}); });
/*切换环境前,存储一下打开的所有文件对象,要先于 关闭相关模块部分 被触发*/ /*切换环境前,存储一下打开的所有文件对象,要先于 关闭相关模块部分 被触发*/
@ -74,7 +70,8 @@ public class DesignerWorkspaceActivator extends Activator {
// 切换后的环境是本地环境才启动内置服务器 // 切换后的环境是本地环境才启动内置服务器
if (current.isLocal()) { if (current.isLocal()) {
ExecutorService service = Executors.newSingleThreadExecutor(new NamedThreadFactory("DesignerWorkspaceActivator")); ExecutorService service = newSingleThreadExecutor(
new NamedThreadFactory("DesignerWorkspaceActivator"));
service.submit(new Runnable() { service.submit(new Runnable() {
@Override @Override

19
designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

@ -7,8 +7,10 @@ import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.value.NotNullLazyValue;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import org.jetbrains.annotations.NotNull;
/** /**
@ -17,12 +19,20 @@ import com.fr.workspace.Workspace;
*/ */
public class DesignerWorkspaceProvider extends Activator { public class DesignerWorkspaceProvider extends Activator {
private NotNullLazyValue<StartupArgs> startupArgs = new NotNullLazyValue<StartupArgs>() {
@NotNull
@Override
protected StartupArgs compute() {
return findSingleton(StartupArgs.class);
}
};
@Override @Override
public void start() { public void start() {
//检查环境 //检查环境
DesignerEnvManager.checkNameEnvMap(); DesignerEnvManager.checkNameEnvMap();
if (getModule().leftFindSingleton(StartupArgs.class) != null && getModule().leftFindSingleton(StartupArgs.class).isDemo()) { if (startupArgs.getValue().isDemo()) {
DesignerEnvManager.getEnvManager().setCurrentEnv2Default(); DesignerEnvManager.getEnvManager().setCurrentEnv2Default();
} else { } else {
try { try {
@ -40,12 +50,15 @@ public class DesignerWorkspaceProvider extends Activator {
EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner(); EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner();
} }
} }
DesignerLaunchStatus.setStatus(DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE);
} }
@Override @Override
public void stop() { public void stop() {
// void
} }
@Override
public void afterAllStart() {
DesignerLaunchStatus.setStatus(DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE);
}
} }

88
designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java

@ -2,28 +2,13 @@ package com.fr.start.module;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.fun.OemProcessor;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.DesignerPort;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.module.ModuleEvent; import com.fr.module.ModuleEvent;
import com.fr.stable.BuildContext;
import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.start.OemHandler;
import com.fr.start.SplashContext;
import com.fr.start.SplashStrategy;
import com.fr.start.fx.SplashFx;
import com.fr.start.jni.SplashMac;
import java.io.File;
/** /**
* Created by juhaoyu on 2018/1/8. * Created by juhaoyu on 2018/1/8.
@ -32,24 +17,7 @@ public class PreStartActivator extends Activator {
@Override @Override
public void start() { public void start() {
BuildContext.setBuildFilePath("/com/fr/stable/build.properties");
// 如果端口被占用了 说明程序已经运行了一次,也就是说,已经建立一个监听服务器,现在只要给服务器发送命令就好了
final String[] args = getModule().upFindSingleton(StartupArgs.class).get();
// 检查是否是-Ddebug = true 启动 并切换对应的端口以及环境配置文件
checkDebugStart();
if (DesignUtils.isStarted()) {
DesignUtils.clientSend(args);
FineLoggerFactory.getLogger().info("The Designer Has Been Started");
System.exit(0);
return;
}
RestartHelper.deleteRecordFilesWhenStart(); RestartHelper.deleteRecordFilesWhenStart();
SplashContext.getInstance().registerSplash(createSplash());
SplashContext.getInstance().show();
//初始化 //初始化
EventDispatcher.fire(ModuleEvent.MajorModuleStarting, Toolkit.i18nText("Fine-Design_Basic_Initializing")); EventDispatcher.fire(ModuleEvent.MajorModuleStarting, Toolkit.i18nText("Fine-Design_Basic_Initializing"));
// 完成初始化 // 完成初始化
@ -64,38 +32,7 @@ public class PreStartActivator extends Activator {
@Override @Override
public void stop() { public void stop() {
// void
}
private void checkDebugStart() {
if (isDebug()) {
setDebugEnv();
}
}
/**
* 在VM options里加入-Ddebug=true激活
*
* @return isDebug
*/
private boolean isDebug() {
return ComparatorUtils.equals("true", System.getProperty("debug"));
}
//端口改一下,环境配置文件改一下。便于启动两个设计器,进行对比调试
private void setDebugEnv() {
DesignUtils.setPort(DesignerPort.DEBUG_MESSAGE_PORT);
String debugXMlFilePath = StableUtils.pathJoin(
ProductConstants.getEnvHome(),
ProductConstants.APP_NAME + "Env_debug.xml"
);
DesignerEnvManager.setEnvFile(
new File(debugXMlFilePath));
} }
private void initLanguage() { private void initLanguage() {
@ -107,27 +44,4 @@ public class PreStartActivator extends Activator {
return new String[]{".cpt", ".xls", ".xlsx", ".frm", ".form", ".cht", ".chart"}; return new String[]{".cpt", ".xls", ".xlsx", ".frm", ".form", ".cht", ".chart"};
} }
private SplashStrategy createSplash() {
OemProcessor oemProcessor = OemHandler.findOem();
if (oemProcessor != null) {
SplashStrategy splashStrategy = null;
try {
splashStrategy = oemProcessor.createSplashStrategy();
} catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (splashStrategy != null) {
return splashStrategy;
}
}
// 这里可以开接口加载自定义启动画面
if (OperatingSystem.isWindows()) {
return new SplashFx();
} else if (OperatingSystem.isMacOS()) {
return new SplashMac();
}
return new SplashFx();
}
} }

19
designer-realize/src/main/java/com/fr/start/module/StartFinishActivator.java

@ -1,19 +0,0 @@
package com.fr.start.module;
import com.fr.design.fun.impl.GlobalListenerProviderManager;
import com.fr.module.Activator;
/**
* Created by juhaoyu on 2018/1/8.
*/
public class StartFinishActivator extends Activator {
@Override
public void start() {
GlobalListenerProviderManager.getInstance().init();
}
@Override
public void stop() {
}
}

BIN
designer-realize/src/main/resources/com/fr/design/images/splash_10.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash_10@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 KiB

Loading…
Cancel
Save