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. 21
      designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java
  4. 17
      designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java
  5. 190
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  6. 3
      designer-base/src/main/java/com/fr/design/border/UIRoundedBorder.java
  7. 9
      designer-base/src/main/java/com/fr/design/constants/DesignerLaunchStatus.java
  8. 7
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  9. 26
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  10. 3
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java
  11. 2
      designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java
  12. 2
      designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java
  13. 8
      designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java
  14. 12
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  15. 5
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  16. 12
      designer-base/src/main/java/com/fr/design/fun/ToolbarItemProvider.java
  17. 12
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractToolbarItem.java
  18. 12
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  19. 3657
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/FormulaTokenMaker.java
  20. 96
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  21. 14
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  22. 37
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  23. 58
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/UpdateActionManager.java
  24. 19
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/UpdateActionModel.java
  25. 49
      designer-base/src/main/java/com/fr/design/ui/util/EdtInvocationManager.java
  26. 77
      designer-base/src/main/java/com/fr/design/ui/util/GraphicsConfig.java
  27. 55
      designer-base/src/main/java/com/fr/design/ui/util/UIUtil.java
  28. 1
      designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java
  29. 46
      designer-base/src/main/java/com/fr/start/BaseDesigner.java
  30. 4
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java
  31. 49
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java
  32. 13
      designer-base/src/main/java/com/fr/start/server/ServerManageFrame.java
  33. 8
      designer-base/src/main/resources/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/FormulaTokenMaker.flex
  34. 70
      designer-base/src/test/java/com/fr/design/ExtraDesignClassManagerTest.java
  35. 28
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  36. 3
      designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java
  37. 5
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  38. 4
      designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java
  39. 2
      designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java
  40. 25
      designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java
  41. 7
      designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractDataSetFieldsPane.java
  42. 17
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractCellDataFieldsWithSeriesValuePane.java
  43. 19
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractDataSetFieldsWithSeriesValuePane.java
  44. 3
      designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractDataPane.java
  45. 2
      designer-chart/src/main/java/com/fr/design/mainframe/MiddleChartPropertyPane.java
  46. 15
      designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java
  47. 1
      designer-form/src/main/java/com/fr/design/designer/properties/FormWidgetAuthorityEditPane.java
  48. 2
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  49. 11
      designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java
  50. 18
      designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java
  51. 10
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java
  52. 10
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java
  53. 4
      designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java
  54. 3
      designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java
  55. 9
      designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java
  56. 95
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/StartupMessageCollector.java
  57. 18
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollectConstants.java
  58. 97
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java
  59. 8
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  60. 2
      designer-realize/src/main/java/com/fr/design/webattr/FToolBar.java
  61. 11
      designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java
  62. 2
      designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java
  63. 2
      designer-realize/src/main/java/com/fr/design/webattr/WebSettingPane.java
  64. 14
      designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java
  65. 5
      designer-realize/src/main/java/com/fr/poly/creator/ECBlockEditor.java
  66. 2
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java
  67. 18
      designer-realize/src/main/java/com/fr/start/Designer.java
  68. 37
      designer-realize/src/main/java/com/fr/start/DesignerInitial.java
  69. 22
      designer-realize/src/main/java/com/fr/start/SplashContext.java
  70. 66
      designer-realize/src/main/java/com/fr/start/common/SplashCommon.java
  71. 120
      designer-realize/src/main/java/com/fr/start/common/SplashPane.java
  72. 70
      designer-realize/src/main/java/com/fr/start/common/SplashWindow.java
  73. 12
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java
  74. 21
      designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java
  75. 8
      designer-realize/src/main/java/com/fr/start/module/DesignerShowActivator.java
  76. 130
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java
  77. 11
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java
  78. 19
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java
  79. 88
      designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java
  80. 19
      designer-realize/src/main/java/com/fr/start/module/StartFinishActivator.java
  81. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_10.png
  82. 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;
import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.workspace.WorkContext;
/**
* 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.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.SupportLocale;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
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 boolean supportCellEditorDef = false;
private boolean isDragPermited = false;
private Locale language = Locale.getDefault();
private Locale language = checkLocale(Locale.getDefault());
//2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容
private boolean useOracleSystemSpace = true;
private int cachingTemplateLimit = CACHINGTEMPLATE_LIMIT;
@ -144,6 +145,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
//记录当前激活码的在线激活状态.
private int activeKeyStatus = -1;
private boolean joinProductImprove = true;
private boolean embedServerLazyStartup = false;
//最近使用的颜色
private ColorSelectConfigManager configManager = new ColorSelectConfigManager();
/**
@ -717,6 +720,24 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
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;
if ((tmpVal = reader.getElementValue()) != null) {
if (!CommonUtils.isNumber(tmpVal)) {
setLanguage(CommonUtils.stringToLocale(tmpVal));
setLanguage(checkLocale(CommonUtils.stringToLocale(tmpVal)));
} else {
// 用于兼容10.0之前的版本
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) {
String tmpVal;
if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) {
@ -1604,6 +1635,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if ((tmpVal = reader.getAttrAsString("recentSelectedConnection", null)) != null) {
this.setRecentSelectedConnection(tmpVal);
}
this.setEmbedServerLazyStartup(reader.getAttrAsBoolean("embedServerLazyStartup", false));
}
private void readReportPaneAttributions(XMLableReader reader) {
@ -1848,6 +1880,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (this.isTemplateTreePaneExpanded()) {
writer.attr("templateTreePaneExpanded", this.isTemplateTreePaneExpanded());
}
if (this.isEmbedServerLazyStartup()) {
writer.attr("embedServerLazyStartup", this.isEmbedServerLazyStartup());
}
writer.end();
}

21
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.PluginSingleInjection;
import com.fr.plugin.solution.closeable.CloseableContainedSet;
import com.fr.stable.Filter;
import com.fr.stable.plugin.ExtraDesignClassManagerProvider;
import java.util.ArrayList;
@ -111,14 +112,27 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
return result.toArray(new WidgetOption[result.size()]);
}
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);
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];
}
List<WidgetOption> list = new ArrayList<>();
for (ToolbarItemProvider provider : set) {
if (filter != null && filter.accept(provider)) {
WidgetOption option = WidgetOptionFactory.createByWidgetClass(
provider.nameForWidget(),
IOUtils.readIcon(provider.iconPathForWidget()),
@ -126,11 +140,11 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
);
list.add(option);
}
}
return list.toArray(new WidgetOption[list.size()]);
}
public Map<Class<? extends Widget>, Class<?>> getFormWidgetOptionsMap() {
Set<FormWidgetOptionProvider> set = getArray(FormWidgetOptionProvider.XML_TAG);
Map<Class<? extends Widget>, Class<?>> map = new HashMap<>();
@ -168,7 +182,6 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
}
public WidgetOption[] getCellWidgetOptions() {
Set<CellWidgetOptionProvider> set = getArray(CellWidgetOptionProvider.XML_TAG);
if (set.isEmpty()) {

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

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

190
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.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -40,7 +39,6 @@ import com.fr.general.log.Log4jConfig;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import com.fr.third.apache.log4j.Level;
import com.fr.transaction.Configurations;
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.git.config.GcConfig;
import javax.swing.BorderFactory;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.BoxLayout;
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 javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.text.DecimalFormat;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
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 joinProductImproveCheckBox;
private UICheckBox autoPushUpdateCheckBox;
private UICheckBox embedServerLazyStartupCheckBox;
private UICheckBox vcsEnableCheckBox;
private UICheckBox saveCommitCheckBox;
@ -183,7 +154,7 @@ public class PreferencePane extends BasicPane {
private JPanel gcProgressBarPanel = new JPanel();
private JProgressBar gcProgressBar;
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() {
this.initComponents();
@ -196,9 +167,9 @@ public class PreferencePane extends BasicPane {
UITabbedPane jtabPane = new UITabbedPane();
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();
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);
createFunctionPane(generalPane);
@ -219,31 +190,31 @@ public class PreferencePane extends BasicPane {
createServerPane(advancePane);
JPanel oraclePane = FRGUIPaneFactory.createTitledBorderPane("Oracle" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Oracle_All_Tables"));
oracleSpace = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_All_Oracle_Tables"));
JPanel oraclePane = FRGUIPaneFactory.createTitledBorderPane("Oracle" + i18nText("Fine-Design_Basic_Oracle_All_Tables"));
oracleSpace = new UICheckBox(i18nText("Fine-Design_Basic_Show_All_Oracle_Tables"));
oraclePane.add(oracleSpace);
JPanel debuggerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_Develop_Tools"));
openDebugComboBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Open_Debug_Window"));
JPanel debuggerPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Develop_Tools"));
openDebugComboBox = new UICheckBox(i18nText("Fine-Design_Basic_Open_Debug_Window"));
debuggerPane.add(openDebugComboBox, BorderLayout.CENTER);
advancePane.add(debuggerPane);
JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager"));
useOptimizedUPMCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager"));
JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Update_Plugin_Manager"));
useOptimizedUPMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager"));
upmSelectorPane.add(useOptimizedUPMCheckbox);
advancePane.add(upmSelectorPane);
JPanel dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Manager"));
useUniverseDBMCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Use_Universe_Database_Manager"));
JPanel dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Database_Manager"));
useUniverseDBMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_Universe_Database_Manager"));
dbmSelectorPane.add(useUniverseDBMCheckbox);
advancePane.add(dbmSelectorPane);
JPanel improvePane = FRGUIPaneFactory.createVerticalTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Product_Improve"));
joinProductImproveCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Join_Product_Improve"));
JPanel improvePane = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Basic_Product_Improve"));
joinProductImproveCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Join_Product_Improve"));
improvePane.add(joinProductImproveCheckBox);
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);
}
@ -252,15 +223,21 @@ public class PreferencePane extends BasicPane {
spaceUpPane.add(createMemoryPane(), BorderLayout.CENTER);
spaceUpPane.add(improvePane, BorderLayout.SOUTH);
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) {
JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(Toolkit.i18nText("Fine-Design_Vcs_Title"));
JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Vcs_Title"));
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());
vcsEnableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_SaveAuto"));
saveCommitCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Vcs_No_Delete"));
vcsEnableCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_SaveAuto"));
saveCommitCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_No_Delete"));
saveIntervalEditor = new IntegerEditor(60);
useIntervalCheckBox = new UICheckBox();
@ -271,8 +248,8 @@ public class PreferencePane extends BasicPane {
enableVcsPanel.add(vcsEnableCheckBox);
enableVcsPanel.add(remindVcsLabel);
JPanel intervalPanel = new JPanel(FRGUIPaneFactory.createLeftZeroLayout());
final UILabel everyLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Every"));
final UILabel delayLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Delay"));
final UILabel everyLabel = new UILabel(i18nText("Fine-Design_Vcs_Every"));
final UILabel delayLabel = new UILabel(i18nText("Fine-Design_Vcs_Delay"));
intervalPanel.add(useIntervalCheckBox);
intervalPanel.add(everyLabel);
intervalPanel.add(saveIntervalEditor);
@ -311,7 +288,7 @@ public class PreferencePane extends BasicPane {
//gc面板
JPanel gcControlPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 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();
gcButtonPane.add(gcButton);
gcControlPane.add(gcEnableCheckBox);
@ -338,21 +315,22 @@ public class PreferencePane extends BasicPane {
}
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);
//添加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);
//添加maxUndoLimit
//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)")
, 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)")};
String[] undoTimes = {i18nText("Fine-Design_Basic_Max_Undo_Limit"), MAX_UNDO_LIMIT_5 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_10 + i18nText("Fine-Design_Basic_Time(s)")
, MAX_UNDO_LIMIT_15 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_20 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_50 + i18nText("Fine-Design_Basic_Time(s)")};
maxUndoLimit = new UIComboBox(undoTimes);
functionPane.add(maxUndoLimit);
//不支持撤销则不能选择撤销可缓存,也不能设置最大撤销次数
supportUndoCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
maxUndoLimit.setEnabled(supportUndoCheckBox.isSelected());
}
@ -361,31 +339,32 @@ public class PreferencePane extends BasicPane {
//添加supportDefaultParentCalculate选择项
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);
}
private void createEditPane(JPanel generalPane) {
//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);
//设置是否支持将字符串编辑为公式
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);
//是否默认转化
defaultStringToFormulaBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Always"));
defaultStringToFormulaBox = new UICheckBox(i18nText("Fine-Design_Basic_Always"));
editPane.add(defaultStringToFormulaBox);
//不支持转化则不能默认执行
supportStringToFormulaBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
defaultStringToFormulaBox.setEnabled(supportStringToFormulaBox.isSelected());
}
});
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();
keyStrokePane.add(shortCutLabel, BorderLayout.CENTER);
editPane.add(keyStrokePane);
@ -415,7 +394,7 @@ public class PreferencePane extends BasicPane {
requestFocusInWindow();
label = new UILabel(text);
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,
label,
BorderLayout.CENTER),
@ -449,24 +428,24 @@ public class PreferencePane extends BasicPane {
private void createGuiOfGridPane(JPanel generalPane) {
// 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);
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);
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);
}
private void createColorSettingPane(JPanel generalPane) {
// 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);
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.setEnabled(this.isEnabled());
@ -475,10 +454,10 @@ public class PreferencePane extends BasicPane {
paginationLineColorTBButton.setEnabled(this.isEnabled());
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);
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);
colorSettingPane.add(leftPane);
colorSettingPane.add(rightPane);
@ -488,9 +467,9 @@ public class PreferencePane extends BasicPane {
//richer:选择导出log文件的目录.
JPanel logPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane();
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);
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);
logExportDirectoryField = new UITextField(24);
logExportPane.add(logExportDirectoryField, BorderLayout.CENTER);
@ -498,6 +477,7 @@ public class PreferencePane extends BasicPane {
logExportPane.add(chooseDirBtn, BorderLayout.EAST);
chooseDirBtn.setPreferredSize(new Dimension(25, 25));
chooseDirBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
JFileChooser fileChooser = new JFileChooser();
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);
logLevelComboBox = new UIComboBox(LOG);
logLevelPane.add(logLevelComboBox);
logLevelComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Configurations.update(new Worker() {
@Override
@ -533,13 +514,13 @@ public class PreferencePane extends BasicPane {
private void createLanPane(JPanel generalPane) {
// ben:选择版本语言;
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);
languageAndDashBoard_pane.add(LanguagePane);
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() {
@Override
public void actionPerformed(ActionEvent e) {
@ -553,7 +534,7 @@ public class PreferencePane extends BasicPane {
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 rowSize[] = {p};
double columnSize[] = {p, p, p};
@ -599,16 +580,16 @@ public class PreferencePane extends BasicPane {
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);
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.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.setMinimumSize(new Dimension(80, 20));
UILabel pagelengthLabel = new UILabel(com.fr.design.i18n.Toolkit.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 pagelengthLabel = new UILabel(i18nText("Fine-Design_Basic_Page_Setup_Scale_Units") + ":");
UILabel reportLengthLabel = new UILabel(i18nText("Fine-Design_Basic_Report_Design_Ruler_Units") + ":");
Component[][] lengthComponents = {
{pagelengthLabel, pageLengthComboBox, reportLengthLabel, reportLengthComboBox},
};
@ -621,13 +602,13 @@ public class PreferencePane extends BasicPane {
double rowSize[] = {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);
portEditor = new IntegerEditor();
portEditor.setPreferredSize(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 serverPortLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Port") + ":");
UILabel notiJlabel = new UILabel(i18nText("Fine-Design_Basic_Work_After_Restart_Designer"));
UILabel serverPortLabel = new UILabel(i18nText("Fine-Design_Basic_Web_Preview_Port") + ":");
Component[][] portComponents = {
{serverPortLabel, portEditor, notiJlabel},
};
@ -636,10 +617,10 @@ public class PreferencePane extends BasicPane {
}
private JPanel createMemoryPane() {
JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template"));
UILabel memoryLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Max_Caching_Template"));
JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Caching_Template"));
UILabel memoryLabel = new UILabel(i18nText("Fine-Design_Basic_Preference_Max_Caching_Template"));
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));
cachingTemplateSpinner = new UISpinner(0, CACHING_MAX, 1, CACHING_DEFAULT);
JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout());
@ -652,7 +633,7 @@ public class PreferencePane extends BasicPane {
@Override
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) {
this.autoPushUpdateCheckBox.setSelected(designerEnvManager.isAutoPushUpdateEnabled());
}
this.embedServerLazyStartupCheckBox.setSelected(designerEnvManager.isEmbedServerLazyStartup());
}
private int chooseCase(int sign) {
@ -795,6 +778,7 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected());
designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue());
designerEnvManager.setJoinProductImprove(this.joinProductImproveCheckBox.isSelected());
designerEnvManager.setEmbedServerLazyStartup(this.embedServerLazyStartupCheckBox.isSelected());
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager();
vcsConfigManager.setSaveInterval(this.saveIntervalEditor.getValue());
vcsConfigManager.setVcsEnable(this.vcsEnableCheckBox.isSelected());
@ -842,7 +826,7 @@ public class PreferencePane extends BasicPane {
@Override
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(
null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Language_Change_Successful"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
i18nText("Fine-Design_Basic_Language_Change_Successful"),
i18nText("Fine-Design_Basic_Plugin_Warning"),
JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE,
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
);
if (rv == JOptionPane.OK_OPTION) {
@ -898,12 +882,12 @@ public class PreferencePane extends BasicPane {
try {
get();
} 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;
} catch (InterruptedException e) {
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.repaint();
gcDialogDownPane.add(gcOkButton);
@ -940,7 +924,7 @@ public class PreferencePane extends BasicPane {
gcProgressBarPanel.remove(gcProgressBar);
}
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 对话框
*/
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));
JPanel jp = new JPanel();
@ -983,7 +967,7 @@ public class PreferencePane extends BasicPane {
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);
gcProgressTimer = createGcProgressTimer(500, gcProgressBar);
@ -1075,7 +1059,7 @@ public class PreferencePane extends BasicPane {
* @return
*/
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.setRoundBorder(true, Constants.LEFT);
return gcButton;

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

@ -44,13 +44,14 @@ public class UIRoundedBorder extends LineBorder {
return lineStyle;
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height){
Color oldColor = g.getColor();
Graphics2D g2d = (Graphics2D)g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
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.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,
/**
* 打开模板完成
*/
OPEN_LAST_FILE_COMPLETE,
/**
* 启动完成
*/
OPEN_LAST_FILE_COMPLETE;
STARTUP_COMPLETE;
private static DesignerLaunchStatus status;
@ -34,6 +39,6 @@ public enum DesignerLaunchStatus implements Event<Null> {
public static void setStatus(DesignerLaunchStatus 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 UICheckBox tableCheckBox;
private UICheckBox viewCheckBox;
private UITextField searchField;
protected UITextField searchField;
private TableViewList tableViewList;
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(filterPane, BorderLayout.SOUTH);
this.setPreferredSize(new Dimension(WIDTH, getPreferredSize().height));
addKeyMonitor();
}
protected void filter(Connection connection, String conName, List<String> nameList) {
connection.addConnection(nameList, conName, new Class[]{AbstractDatabaseConnection.class});
}
protected void addKeyMonitor() {
}
protected JPanel createCheckBoxgroupPane() {
JPanel checkBoxgroupPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2);
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.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.ArrayList;
import java.util.List;
@ -95,6 +97,30 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
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() {

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

@ -41,6 +41,7 @@ public class MaxMemRowCountPanel extends UIToolbar {
}
};
@Override
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
dim.width = 340;
@ -81,7 +82,7 @@ public class MaxMemRowCountPanel extends UIToolbar {
public void setValue(int value) {
if (value >= 0) {
showMaxPanel();
numberSpinner.setValue(Integer.valueOf(value));
numberSpinner.setValue(value);
} else {
showAllPanel();
}

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

@ -168,7 +168,7 @@ public class JWizardPanel extends BasicPane {
public void addNotify() {
if (firstNotify) {
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);
firstNotify = false;
}

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();
// initialize the confirmation dialog
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.setHeight(DEFAULT_CONFIRM_HEIGHT);
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.IOUtils;
import com.fr.general.http.HttpClient;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.PluginStoreConstants;
@ -293,10 +294,9 @@ public class WebViewDlgHelper {
new SwingWorker<Void, Void>() {
@Override
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"));
httpClient.asGet();
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
String text = httpClient.getResponseText();
String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.update");
if (url != null) {
String text = HttpToolbox.get(url + "?" + PluginUtils.FR_VERSION + "=" + ProductConstants.VERSION + "&version=" + PluginStoreConstants.getInstance().getProps("VERSION"));
JSONObject resultJSONObject = new JSONObject(text);
String isLatest = resultJSONObject.optString("result");
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) {
//如果删除的是后一个Tab,则定位到前一个
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) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate();
}
JTemplate selectedFile = MutilTempalteTabPane.getInstance().getSelectedFile();
if (!isCurrentEditingFile(selectedFile.getPath())) {
//如果此时面板上的实时刷新的selectedIndex得到的和历史的不一样
DesignerContext.getDesignerFrame().activateJTemplate(selectedFile);
}
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() {
if (openedTemplate.size() == selectedIndex) {
selectedIndex = Math.max(--selectedIndex, 0);
}
return openedTemplate.get(selectedIndex);
}
@ -322,7 +325,7 @@ public class MutilTempalteTabPane extends JComponent {
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
double maxWidth = getWidth() - LIST_BUTTON_WIDTH; //最大宽度
double maxWidth = getWidth() - LIST_BUTTON_WIDTH * 1.0D; //最大宽度
Graphics2D g2d = (Graphics2D) g;
paintBackgroundAndLine(g2d, maxWidth);
}

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

@ -1,6 +1,8 @@
package com.fr.design.fun;
import com.fr.design.mainframe.JTemplate;
import com.fr.form.ui.Widget;
import com.fr.stable.Filter;
import com.fr.stable.fun.mark.Mutable;
/**
@ -8,7 +10,7 @@ import com.fr.stable.fun.mark.Mutable;
* @since : 8.0
* 自定义web工具栏菜单
*/
public interface ToolbarItemProvider extends Mutable {
public interface ToolbarItemProvider extends Mutable, Filter<JTemplate> {
String XML_TAG = "ToolbarItemProvider";
@ -36,4 +38,12 @@ public interface ToolbarItemProvider extends Mutable {
*/
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;
import com.fr.design.file.HistoryTemplateListCache;
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.mark.API;
@ -10,6 +13,7 @@ import com.fr.stable.fun.mark.API;
@API(level = ToolbarItemProvider.CURRENT_LEVEL)
public abstract class AbstractToolbarItem extends AbstractProvider implements ToolbarItemProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@ -18,4 +22,12 @@ public abstract class AbstractToolbarItem extends AbstractProvider implements To
public String mark4Provider() {
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.general.FRFont;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
@ -47,6 +46,7 @@ public class ProgressDialog extends UIDialog {
progressBar.setBorderPainted(false);
progressBar.setOpaque(false);
progressBar.setBorder(null);
progressBar.setMaximum(1000);
panel.add(progressBar, BorderLayout.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));
@ -54,7 +54,6 @@ public class ProgressDialog extends UIDialog {
panel.add(text, BorderLayout.SOUTH);
panel.setVisible(true);
centerDialog.getContentPane().add(panel);
}
@Override
@ -72,11 +71,20 @@ public class ProgressDialog extends UIDialog {
progressBar.setValue(value);
}
public void setProgressMaximum(int value) {
progressBar.setMaximum(value);
}
public int getProgressMaximum() {
return progressBar.getMaximum();
}
@Override
public void dispose() {
centerDialog.dispose();
super.dispose();
}
public void updateLoadingText(String 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

96
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.Workspace;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import org.jetbrains.annotations.Nullable;
import javax.swing.Icon;
import javax.swing.JComponent;
@ -169,6 +170,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private WindowAdapter windowAdapter = new WindowAdapter() {
@Override
public void windowOpened(WindowEvent e) {
}
@ -194,6 +196,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private JComponent closeButton = new JComponent() {
@Override
protected void paintComponent(Graphics g) {
g.setColor(UIConstants.NORMAL_BACKGROUND);
@ -205,6 +208,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private MouseListener closeMouseListener = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
closeMode = UIConstants.CLOSE_PRESS_AUTHORITY;
@ -212,6 +216,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
closeButton.repaint();
}
@Override
public void mouseExited(MouseEvent e) {
closeMode = UIConstants.CLOSE_OF_AUTHORITY;
@ -219,6 +224,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
closeButton.repaint();
}
@Override
public void mouseMoved(MouseEvent e) {
closeMode = UIConstants.CLOSE_OVER_AUTHORITY;
@ -226,12 +232,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
closeButton.repaint();
}
@Override
public void mouseReleased(MouseEvent e) {
if (DesignModeContext.isAuthorityEditing()) {
closeAuthorityEditing();
}
}
@Override
public void mouseEntered(MouseEvent e) {
closeMode = UIConstants.CLOSE_OVER_AUTHORITY;
@ -255,6 +263,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
basePane.setLayout(new BorderLayout());
toolbarPane = new JPanel() {
@Override
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
@ -266,7 +275,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
JPanel eastPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
eastPane.add(ad.createLargeToolbar(), BorderLayout.WEST);
eastCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
eastCenterPane.add(combineUp = combineUpTooBar(null), BorderLayout.NORTH);
combineUpTooBar();
eastCenterPane.add(combineUp, BorderLayout.NORTH);
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.add(newWorkBookPane = ad.getNewTemplatePane(), BorderLayout.WEST);
panel.add(MutilTempalteTabPane.getInstance(), BorderLayout.CENTER);
@ -300,6 +310,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
this.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
reCalculateFrameSize();
@ -333,7 +344,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus());
needToAddAuhtorityPaint();
refreshDottedLine();
fireAuthorityStateToNomal();
fireAuthorityStateToNormal();
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();
for (int i = 0; i < opendedTemplate.size(); i++) {
for (JTemplate<?, ?> jTemplate : opendedTemplate) {
// 如果在权限编辑时做过操作,则将做过的操作作为一个整体状态赋给正在报表
if (opendedTemplate.get(i).isDoSomethingInAuthority()) {
opendedTemplate.get(i).fireAuthorityStateToNomal();
if (jTemplate.isDoSomethingInAuthority()) {
jTemplate.fireAuthorityStateToNomal();
}
}
}
@ -619,31 +630,47 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
this.closeMode = closeMode;
}
private UIToolbar combineUpTooBar(JComponent[] toolbar4Form) {
/**
* 创建上工具栏
*/
private void combineUpTooBar() {
combineUp = new UIToolbar(FlowLayout.LEFT);
combineUp.setBorder(new MatteBorder(new Insets(0, LEFT_ALIGN_GAP, 1, 0), UIConstants.LINE_COLOR));
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();
for (int i = 0; i < fixButtons.length; i++) {
combineUp.add(fixButtons[i]);
for (UIButton fixButton : fixButtons) {
combineUp.add(fixButton);
}
if (!DesignerMode.isAuthorityEditing()) {
combineUp.addSeparator(new Dimension(2, 16));
if (toolbar4Form != null) {
for (int i = 0; i < toolbar4Form.length; i++) {
combineUp.add(toolbar4Form[i]);
for (JComponent jComponent : toolbar4Form) {
combineUp.add(jComponent);
}
}
}
//添加分享按钮
addShareButton();
//添加插件中的按钮
addExtraButtons();
return combineUp;
}
private void addExtraButtons() {
@ -655,8 +682,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
UIButton[] extraButtons = jt.createExtraButtons();
for (int i = 0; i < extraButtons.length; i++) {
combineUp.add(extraButtons[i]);
for (UIButton extraButton : extraButtons) {
combineUp.add(extraButton);
}
if (extraButtons.length > 0) {
combineUp.addSeparator(new Dimension(2, 16));
@ -672,8 +699,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
combineUp.addSeparator(new Dimension(2, 16));
UIButton[] shareButtons = jt.createShareButton();
for (int i = 0; i < shareButtons.length; i++) {
combineUp.add(shareButtons[i]);
for (UIButton shareButton : shareButtons) {
combineUp.add(shareButton);
}
}
@ -710,25 +737,20 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
DesignState designState = new DesignState(plus);
MenuManager.getInstance().setMenus4Designer(designState);
if (menuBar != null) {
menuPane.remove(menuBar);
}
if (menuBar == null) {
menuPane.add(menuBar = ad.createJMenuBar(plus), BorderLayout.CENTER);
if (combineUp != null) {
eastCenterPane.remove(combineUp);
combineUp = null;
} else {
ad.resetJMenuBar(menuBar, plus);
}
// 保存撤销那些按钮的面板
eastCenterPane.add(combineUp = combineUpTooBar(ad.resetUpToolBar(plus)), BorderLayout.NORTH);
if (toolbarComponent != null) {
toolbarPane.remove(toolbarComponent);
}
resetCombineUpTooBar(ad.resetUpToolBar(plus));
// 颜色,字体那些按钮的工具栏
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.validate();
@ -751,7 +773,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
Set<ShortCut> extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts();
for (ShortCut shortCut : extraShortCuts) {
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 事件
*/
@Override
public void targetModified(TargetModifiedEvent e) {
this.checkToolbarMenuEnable();
@ -959,6 +982,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*
* @param jt 模板
*/
@Override
public void templateClosed(JTemplate<?, ?> jt) {
}
@ -968,6 +992,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*
* @param jt 模板
*/
@Override
public void templateOpened(JTemplate<?, ?> jt) {
}
@ -977,6 +1002,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*
* @param jt 模板
*/
@Override
public void templateSaved(JTemplate<?, ?> jt) {
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
*
* @param toolbarDef
*/
private void addVcsAction(ToolBarDef toolbarDef) {
if (VcsHelper.getInstance().needInit()) {
vcsAction = new VcsAction();
if (FineClusterConfig.getInstance().isCluster()) {
vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_NotSupportRemote"));
} else {
if (WorkContext.getCurrent().isLocal()) {
vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_Title"));
} else {
vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_NotSupportRemote"));
}
toolbarDef.addShortCut(vcsAction);
@ -367,8 +369,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
}
if (WorkContext.getCurrent() != null) {
if (!WorkContext.getCurrent().isLocal()) {
//当前环境为远程环境时
@ -532,7 +532,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
String oldName = fnf.getName();
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.setModal(true);
@ -651,7 +651,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
String oldName = fnf.getName();
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)) {

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

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

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

@ -32,15 +32,22 @@ public class UpdateActionModel {
* @param action
*/
private void setSearchKey(String parentName, UpdateAction action) {
StringBuffer buffer = new StringBuffer();
if (actionName == null) {
return;
}
buffer.append(parentName).append(SEPARATOR).append(PinyinHelper.convertToPinyinString(parentName, "", PinyinFormat.WITHOUT_TONE))
.append(SEPARATOR).append(PinyinHelper.getShortPinyin(parentName)).append(SEPARATOR)
.append(actionName).append(SEPARATOR).append(PinyinHelper.convertToPinyinString(actionName, "", PinyinFormat.WITHOUT_TONE))
.append(SEPARATOR).append(PinyinHelper.getShortPinyin(actionName)).append(action.getSearchText());
this.searchKey = buffer.toString().toLowerCase();
String buffer = parentName +
SEPARATOR +
PinyinHelper.convertToPinyinString(parentName, "", PinyinFormat.WITHOUT_TONE) +
SEPARATOR +
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.project.ProjectConstants;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.JDialog;

46
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.ExtraDesignClassManager;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerStartOpenFileProcessor;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.file.FILE;
import com.fr.file.FILEFactory;
import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.module.ModuleEvent;
import com.fr.stable.OperatingSystem;
import java.awt.Window;
import java.awt.*;
import java.io.File;
import java.lang.reflect.Method;
@ -51,25 +54,47 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
}
public void show() {
collectUserInformation();
UIUtil.invokeLaterIfNeeded(new Runnable() {
@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 这里有啥作用?
DesignerContext.getDesignerFrame().refreshEnv();
for (int i = 0; !TemplateTreePane.getInstance().getTemplateFileTree().isTemplateShowing() && i < LOAD_TREE_MAXNUM; i++) {
TemplateTreePane.getInstance().getTemplateFileTree().refresh();
}
DesignerContext.getDesignerFrame().setVisible(true);
DesignerContext.getDesignerFrame().resizeFrame();
}
private void createDesignerFrame() {
new DesignerFrame(this);
}
private void showDesignerFrame(boolean isException) {
try {
FILE file = null;
@ -94,8 +119,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
}
}
} else {
file = FILEFactory.createFILE(FILEFactory.ENV_PREFIX
+ DesignerEnvManager.getEnvManager().getLastOpenFile());
file = FILEFactory.createFILE(FILEFactory.ENV_PREFIX + DesignerEnvManager.getEnvManager().getLastOpenFile());
}
DesignerFrame df = DesignerContext.getDesignerFrame();
isException = openFile(df, isException, file);

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

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

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

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

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.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
* 内置Tomcat服务器管理界面
@ -46,7 +40,6 @@ public class ServerManageFrame extends JFrame {
private ServerManageFrame() {
DesignUtils.initLookAndFeel();
this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/trayStarted.png"));
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"|
"YEARDELTA"|
"yeardelta"
"yeardelta"|
"SUMPRECISE"|
"sumprecise"|
"QUERY"|
"query"|
"WEBIMAGE"|
"webimage"
%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);
}
}
}

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

@ -374,11 +374,15 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
}
result[i] = Reflect.on(chart).call("demoImagePath").get();
}
if (ArrayUtils.isNotEmpty(result)) {
return result;
}
} catch (Exception e) {
//do nothing
}
return new String[0];
return new String[]{getIconPath(chartID)};
}
public String[] getSubName(String chartID) {
@ -555,11 +559,14 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
@Override
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 plotID = injection.getAttribute("plotID");
ChartTypeUIProvider instance = (ChartTypeUIProvider) injection.getObject();
addChartTypeInterface(priority, plotID, instance);
addChartTypeInterface(priority, id, instance);
}
}
@ -567,10 +574,13 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
@Override
public void demount(PluginSingleInjection injection) {
if (isIndependentChartUIProvider(injection)) {
if (isChartTypeUIProvider(injection)) {
String priority = injection.getAttribute("priority", DEFAULT_PRIORITY);
String plotID = injection.getAttribute("plotID");
removeChartTypeInterface(priority, plotID);
String id = injection.getAttribute("chartID");
if (StringUtils.isEmpty(id)) {
id = injection.getAttribute("plotID");
}
removeChartTypeInterface(priority, id);
}
}
@ -585,9 +595,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
}
private boolean isIndependentChartUIProvider(PluginSingleInjection injection) {
private boolean isChartTypeUIProvider(PluginSingleInjection injection) {
return !(injection == null || injection.getObject() == null) && ChartTypeUIProvider.XML_TAG.equals(injection.getName()) && injection.getObject() instanceof ChartTypeUIProvider;
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.actions.core.ActionFactory;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.ChartPropertyPane;
import com.fr.design.module.ChartEmptyDataStyleAction;
@ -54,8 +53,6 @@ public class ChartDesignerActivator extends Activator implements Prepare {
DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance());
DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper());
DesignerLaunchStatus.setStatus(DesignerLaunchStatus.DESIGNER_INIT_COMPLETE);
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.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
@ -98,8 +99,8 @@ public class ChartTypePane extends ChartCommonWizardPane {
String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(id);
ChartTypePane.this.iconListModel.clear();
for (int i = 0, len = demoImagePath.length; i < len; i++) {
String ImagePath = demoImagePath[i];
for (int i = 0, len = subName.length; i < len; i++) {
String ImagePath = demoImagePath.length > i ? demoImagePath[i] : StringUtils.EMPTY;
String chartName = subName[i];
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 {
String XML_TAG = SpecialLevel.IndependentChartUIProvider.getTagName();
String XML_TAG = "ChartTypeUIProvider";
String OLD_TAG = SpecialLevel.IndependentChartUIProvider.getTagName();
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.type.AbstractChartTypePane;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* Created by shine on 2019/09/03.
*/
@API(level = ChartTypeUIProvider.CURRENT_API_LEVEL)
public abstract class AbstractChartTypeUI extends AbstractProvider implements ChartTypeUIProvider {
@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.JPanel;
import javax.swing.SwingConstants;
import java.util.Arrays;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.Arrays;
/**
* 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.add(createNorthPane(), BorderLayout.NORTH);
this.add(createCenterPane(), BorderLayout.CENTER);
this.add(createSouthPane(), BorderLayout.SOUTH);
JPanel north = createNorthPane(),
center = createCenterPane(),
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));
}
@ -53,7 +65,6 @@ public abstract class AbstractCellDataFieldsPane<T extends AbstractColumnFieldCo
components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), formulaPanes[i]};
}
double p = TableLayout.PREFERRED;
double[] columnSize = {ChartDataPane.LABEL_WIDTH, 124};
double[] rowSize = new double[len];
@ -64,11 +75,11 @@ public abstract class AbstractCellDataFieldsPane<T extends AbstractColumnFieldCo
protected JPanel createNorthPane() {
return new JPanel();
return null;
}
protected JPanel createSouthPane() {
return new JPanel();
return null;
}
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.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.Arrays;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Component;
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() {
this.setLayout(new BorderLayout(0, 4));
this.setLayout(new BorderLayout(0, 6));
this.setBorder(BorderFactory.createEmptyBorder(2, 24, 0, 15));
JPanel north = createNorthPane(),
@ -74,7 +74,6 @@ public abstract class AbstractDataSetFieldsPane<T extends AbstractColumnFieldCol
for (int i = 0; i < len; i++) {
components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), fieldComponents[i]};
}
double p = TableLayout.PREFERRED;
double[] columnSize = {ChartDataPane.LABEL_WIDTH, 122};
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();
if (normalCenter != null) {
JPanel panel = new JPanel(new BorderLayout());
panel.add(normalCenter, BorderLayout.CENTER);
panel.add(seriesValueFieldsPane, BorderLayout.SOUTH);
JPanel panel = new JPanel(new BorderLayout(0,6));
panel.add(normalCenter, BorderLayout.NORTH);
panel.add(seriesValueFieldsPane, BorderLayout.CENTER);
return panel;
} else {
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) {
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 javax.swing.JPanel;
import java.awt.BorderLayout;
import java.util.List;
import java.awt.BorderLayout;
/**
* Created by shine on 2019/5/16.
@ -23,15 +23,26 @@ public abstract class AbstractDataSetFieldsWithSeriesValuePane<T extends Abstrac
seriesValueFieldComboBoxPane = new SeriesValueFieldComboBoxPane();
if (normalCenter != null) {
JPanel panel = new JPanel(new BorderLayout());
panel.add(normalCenter, BorderLayout.CENTER);
panel.add(seriesValueFieldComboBoxPane, BorderLayout.SOUTH);
JPanel panel = new JPanel(new BorderLayout(0,6));
panel.add(normalCenter, BorderLayout.NORTH);
panel.add(seriesValueFieldComboBoxPane, BorderLayout.CENTER);
return panel;
} else {
return seriesValueFieldComboBoxPane;
}
}
public SeriesValueFieldComboBoxPane getSeriesValueFieldComboBoxPane() {
if (seriesValueFieldComboBoxPane == null) {
seriesValueFieldComboBoxPane = new SeriesValueFieldComboBoxPane();
}
return seriesValueFieldComboBoxPane;
}
public void setSeriesValueFieldComboBoxPane(SeriesValueFieldComboBoxPane seriesValueFieldComboBoxPane) {
this.seriesValueFieldComboBoxPane = seriesValueFieldComboBoxPane;
}
@Override
public void checkBoxUse(boolean 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.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.JPanel;
import java.awt.BorderLayout;
@ -58,7 +57,7 @@ public abstract class AbstractDataPane extends ChartDataPane {
if (collection == null) {
return;
}
VanChart chart = collection.getSelectedChart(VanChart.class);
AbstractChartWithData chart = collection.getSelectedChart(AbstractChartWithData.class);
if (chart == null) {
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 面板
*/
public void populateChartPropertyPane(ChartCollection collection, TargetComponent<?> ePane) {
addChartEditPane(collection.getSelectedChart().getPlot().getPlotID());
addChartEditPane(collection.getSelectedChartProvider().getID());
setSupportCellData(true);
this.container.setEPane(ePane);
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;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider;
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 图表
@ -225,8 +230,14 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
return;
}
if (checkNeedsReLayout(collection.getSelectedChartProvider())) {
reLayout(collection.getSelectedChartProvider());
ChartProvider chartProvider = 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;

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 (Widget widget : widgets) {
widget.changeVisibleAuthorityState(selectedRole, widgetVisible.isSelected());
widgetAvailable.setEnabled(widgetVisible.isSelected());
}
}
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 < SHOWVALMIN ? SHOWVALMIN : value;
JForm jf = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jf.resolution = (int) value;
jf.setResolution((int) value);
jf.getFormDesign().setResolution((int) value);
jf.getFormDesign().getArea().resolution = (int) value;
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;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.dialog.BasicDialog;
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.mainframe.FormWebWidgetConstants;
import com.fr.design.mainframe.widget.editors.ElementCaseToolBarPane;
import com.fr.design.mainframe.widget.wrappers.ElementCaseToolBarWrapper;
import com.fr.form.web.FormToolBarManager;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Filter;
import javax.swing.SwingUtilities;
import java.util.ArrayList;
@ -52,6 +56,13 @@ public class AccessibleElementCaseToolBarEditor extends UneditableAccessibleEdit
List<WidgetOption> defaultOptions = Arrays.asList(FormWebWidgetConstants.getFormElementCaseToolBarInstance());
List<WidgetOption> options = new ArrayList<WidgetOption>();
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()]);
}

18
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.utils.gui.UIComponentUtils;
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.general.Background;
@ -61,7 +62,7 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
designerWidth = new UISpinner(1, Integer.MAX_VALUE, 1);
designerWidth = new UIBoundSpinner(1, Integer.MAX_VALUE, 1);
JPanel advancePane = createAdvancePane();
UIExpandablePane advanceExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, advancePane);
this.add(advanceExpandablePane, BorderLayout.NORTH);
@ -162,16 +163,29 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
public WParameterLayout updateBean() {
WParameterLayout wParameterLayout = (WParameterLayout) creator.toData();
wParameterLayout.setLabelName(labelNameTextField.getText());
if (isCompsOutOfDesignerWidth((int) designerWidth.getValue())) {
designerWidth.setValue(wParameterLayout.getDesignWidth());
} else {
wParameterLayout.setDesignWidth((int) designerWidth.getValue());
}
wParameterLayout.setDelayDisplayContent(displayReport.isSelected());
wParameterLayout.setUseParamsTemplate(useParamsTemplate.isSelected());
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected());
wParameterLayout.setBackground((Background) background.getValue());
wParameterLayout.setPosition((int)hAlignmentPane.getSelectedItem());
wParameterLayout.setPosition((int) hAlignmentPane.getSelectedItem());
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
public DataCreatorUI dataUI() {
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.form.ui.container.WParameterLayout;
import com.fr.form.ui.container.WSortLayout;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
@ -87,9 +88,7 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane {
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}};
if (ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING).size() != 0) {
tipLabel = null;
} else {
if (ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING).isEmpty()) {
((WParameterLayout) (paraCreator.toData())).setProvider((MobileParamStyleProvider) ((Item) paramLocationComboBox.getItemAt(0)).getValue());
}
Component[][] components = new Component[][]{
@ -127,10 +126,9 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane {
@Override
public void mouseClicked(MouseEvent e) {
try {
//todo 添加对应插件下载地址
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("plugin.download")));
Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("plugin.mobile.style")));
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
}
}
@Override

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

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
public void start() {
List<App> appList = rightCollectMutable(App.KEY);
List<App> appList = findMutable(App.KEY);
for (App app : appList) {
JTemplateFactory.register(app);
}
@ -24,7 +24,7 @@ public class DesignerAppActivator extends Activator implements Prepare {
@Override
public void stop() {
List<App> appList = rightCollectMutable(App.KEY);
List<App> appList = findMutable(App.KEY);
for (App app : appList) {
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
public void tabChanged(int index) {
card.show(center, paneList.get(index).title4PopupWindow());
paneList.get(index).populateBean(cellelement, ePane);// 设置面板变了,也要populate
paneList.get(index).addAttributeChangeListener(listener);
populate(ePane);
if (titleChangeListener != null) {
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;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.mainframe.SiteCenterToken;
import com.fr.general.CloudCenter;
import com.fr.general.CommonIOUtils;
@ -24,6 +25,8 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created by Administrator on 2017/7/24 0024.
@ -81,8 +84,8 @@ public class ErrorInfoUploader {
return;
}
Thread updateThread = new Thread(new Runnable() {
ExecutorService es = Executors.newSingleThreadExecutor(new NamedThreadFactory("ErrorInfoUploader"));
es.submit(new Runnable() {
@Override
public void run() {
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) {

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.mainframe.DesignerContext;
import com.fr.design.mainframe.loghandler.DesignerLogger;
import com.fr.design.ui.util.UIUtil;
import com.fr.event.EventDispatcher;
import com.fr.log.FineLoggerFactory;
import com.fr.report.RemoteDesignConstants;
@ -22,9 +23,7 @@ import io.socket.client.IO;
import io.socket.client.Socket;
import io.socket.emitter.Emitter;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.*;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
@ -88,7 +87,8 @@ public class DesignerSocketIO {
*/
if (status != Status.Disconnecting) {
try {
SwingUtilities.invokeAndWait(new Runnable() {
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
JOptionPane.showMessageDialog(
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) {
if (buttonlist == null || buttonlist.size() < 0) {
if (buttonlist == null ) {
this.buttonlist = new ArrayList<ToolBarButton>();
} else {
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.MouseEvent;
import java.awt.image.ImageObserver;
import java.util.List;
/**
* 新的拖拽ToolBar button以实现自定义工具栏 报表web设置那儿的.应该不叫ToolBarDragPane因为实际没有提供drag功能
@ -225,6 +226,16 @@ public class ToolBarDragPane extends WidgetToolBarPane {
public void setAllEnabled(boolean b) {
GUICoreUtils.setEnabled(this, 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) {
if (list == null || list.size() < 0) {
if (list == null ) {
return;
}
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.setSelectedIndex(SERVER_SET);
choseComboBox.addItemListener(itemListener);
checkEnabled(false);
populateServerSettings();
checkEnabled(false);
return;
}
// 模板设置

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

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
*/
public void resetSelectionAndChooseState() {
boolean chooseBlock = designer.isChooseBlock();
designer.setChooseType(SelectionType.INNER);
if (DesignerMode.isAuthorityEditing()) {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
@ -167,7 +168,9 @@ public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
conditionAttributesGroupPane.populate(editComponent);
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() {
public void actionPerformed(ActionEvent evt) {
String text = formulaTextField.getText();
final UIFormula formulaPane = FormulaFactory.createFormulaPane();
final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula();
formulaPane.populate(BaseFormula.createFormulaBuilder().build(text));
formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override

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

@ -82,6 +82,7 @@ public class Designer extends BaseDesigner {
private UIButton saveButton;
private UIButton undo;
private UIButton redo;
private UIButton[] upToolBar;
private UIPreviewButton run;
public Designer(String[] args) {
@ -210,11 +211,17 @@ public class Designer extends BaseDesigner {
*/
@Override
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.setToolTipText(KeySetUtils.SAVE_TEMPLATE.getMenuKeySetName());
saveButton.set4ToolbarButton();
@ -227,11 +234,10 @@ public class Designer extends BaseDesigner {
jt.requestFocus();
}
});
return saveButton;
}
private UIButton createUndoButton() {
private void createUndoButton() {
undo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/undo.png"));
undo.setToolTipText(KeySetUtils.UNDO.getMenuKeySetName());
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.setToolTipText(KeySetUtils.REDO.getMenuKeySetName());
redo.set4ToolbarButton();
@ -260,7 +265,6 @@ public class Designer extends BaseDesigner {
}
}
});
return redo;
}
private void createRunButton(UILargeToolbar largeToolbar) {

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

@ -1,5 +1,13 @@
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.
* 设计器上下文
@ -8,17 +16,38 @@ public class DesignerInitial {
private static volatile Designer designer;
public synchronized static void init(String... args) {
public static void init(final String... args) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
designer = new Designer(args);
}
});
}
public synchronized static void show() {
public static void prepare() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
if (designer != null) {
designer.show();
}
}
});
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 String moduleID = "";
private String moduleId = "";
private int loadingIndex = 0;
private String[] loading = new String[]{"..", "....", "......"};
private int fetchOnlineTimes = 0;
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;
public static SplashContext getInstance() {
return SPLASH_CONTEXT;
}
@ -76,11 +77,11 @@ public class SplashContext {
* 隐藏启动动画
*/
public void hide() {
splashStrategy.hide();
//取消监听
EventDispatcher.stopListen(listener);
// 窗口关闭后取消定时获取模块信息的timer
scheduler.shutdown();
//取消监听
EventDispatcher.stopListen(listener);
splashStrategy.hide();
// 一次性
splashStrategy = null;
}
@ -91,7 +92,7 @@ public class SplashContext {
public void run() {
showThanks();
loadingIndex++;
updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]);
updateModuleLog(moduleId.isEmpty() ? StringUtils.EMPTY : moduleId + loading[loadingIndex % 3]);
}
}, 0, 300, TimeUnit.MILLISECONDS);
@ -99,9 +100,9 @@ public class SplashContext {
@Override
public void on(Event event, String i18n) {
moduleID = i18n;
moduleId = i18n;
loadingIndex++;
updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]);
updateModuleLog(moduleId.isEmpty() ? StringUtils.EMPTY : moduleId + loading[loadingIndex % 3]);
}
};
EventDispatcher.listen(ModuleEvent.MajorModuleStarting, listener);
@ -149,10 +150,11 @@ public class SplashContext {
* 获取10次在线资源最大时间3秒
*/
private void showThanks() {
if (shouldShowThanks()) {
if (shouldShowThanks() && !hasShowThanks) {
tryFetchOnline();
if (StringUtils.isNotEmpty(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);
}
}

12
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.TextBoxFloatAction;
import com.fr.design.bridge.DesignToolbarProvider;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.form.parameter.FormParaDesigner;
import com.fr.design.fun.ElementUIProvider;
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.xml.ReportXMLUtils;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.awt.*;
import java.awt.image.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@ -115,7 +116,7 @@ public class DesignerActivator extends Activator {
@Override
public void start() {
List<LocaleMarker> markers = rightCollectMutable(InterMutableKey.Path);
List<LocaleMarker> markers = findMutable(InterMutableKey.Path);
for (LocaleMarker marker : markers) {
if (marker.match(LocaleScope.DESIGN)) {
DesignI18nImpl.getInstance().addResource(marker.getPath());
@ -129,6 +130,11 @@ public class DesignerActivator extends Activator {
AlphaFineHelper.switchConfig4Locale();
}
@Override
public void afterAllStart() {
DesignerLaunchStatus.setStatus(DesignerLaunchStatus.DESIGNER_INIT_COMPLETE);
}
private void loadLogAppender() {
logHandler = new LogHandler<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() {
}
}

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

@ -13,13 +13,13 @@ public class DesignerShowActivator extends Activator {
@Override
public void start() {
EventDispatcher.fire(ModuleEvent.MajorModuleStarting, Toolkit.i18nText("Fine-Design_Module_Name_Designer"));
DesignerInitial.show();
DesignerInitial.init(findSingleton(StartupArgs.class).get());
EventDispatcher.asyncFire(ModuleEvent.MajorModuleStarting, Toolkit.i18nText("Fine-Design_Module_Name_Designer"));
DesignerInitial.prepare();
}
@Override
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;
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.record.analyzer.EnableMetrics;
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.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.
@ -13,29 +35,117 @@ import com.fr.start.ServerStarter;
@EnableMetrics
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
@Metrics
public void start() {
startSub(PreStartActivator.class);
getSub("parallel").start();
startSub(DesignerWorkspaceActivator.class);
//designer模块启动好后,查看demo
browserDemo();
startSub(DesignerShowActivator.class);
startSub(StartFinishActivator.class);
FineRuntime.startFinish();
browserDemoIfNeeded();
startupEmbedServerIfNeeded();
}
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();
}
@Override
public void afterAllStart() {
GlobalListenerProviderManager.getInstance().init();
// 启动日志收集
StartupMessageCollector.getInstance().recordStartupLog();
}
private void browserDemo() {
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 (getModule().leftFindSingleton(StartupArgs.class) != null && getModule().leftFindSingleton(StartupArgs.class).isDemo()) {
return new SplashCommon();
}
private void browserDemoIfNeeded() {
if (startupArgsValue.getValue().isDemo()) {
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
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.module.Activator;
import com.fr.start.server.FineEmbedServer;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created by juhaoyu on 2019-06-14.
@ -22,7 +20,6 @@ public class DesignerWorkspaceActivator extends Activator {
public void start() {
registerEnvListener();
startServer(WorkContext.getCurrent());
}
/**
@ -36,7 +33,7 @@ public class DesignerWorkspaceActivator extends Activator {
@Override
public void on(Event event, Workspace current) {
getSub(EnvBasedModule.class).stop();
stopSub(EnvBasedModule.class);
}
});
/*切换环境后,重新启动所有相关模块,最先执行*/
@ -45,8 +42,7 @@ public class DesignerWorkspaceActivator extends Activator {
@Override
public void on(Event event, Workspace current) {
getSub(EnvBasedModule.class).start();
startServer(current);
startSub(EnvBasedModule.class);
}
});
/*切换环境前,存储一下打开的所有文件对象,要先于 关闭相关模块部分 被触发*/
@ -74,7 +70,8 @@ public class DesignerWorkspaceActivator extends Activator {
// 切换后的环境是本地环境才启动内置服务器
if (current.isLocal()) {
ExecutorService service = Executors.newSingleThreadExecutor(new NamedThreadFactory("DesignerWorkspaceActivator"));
ExecutorService service = newSingleThreadExecutor(
new NamedThreadFactory("DesignerWorkspaceActivator"));
service.submit(new Runnable() {
@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.log.FineLoggerFactory;
import com.fr.module.Activator;
import com.fr.value.NotNullLazyValue;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import org.jetbrains.annotations.NotNull;
/**
@ -17,12 +19,20 @@ import com.fr.workspace.Workspace;
*/
public class DesignerWorkspaceProvider extends Activator {
private NotNullLazyValue<StartupArgs> startupArgs = new NotNullLazyValue<StartupArgs>() {
@NotNull
@Override
protected StartupArgs compute() {
return findSingleton(StartupArgs.class);
}
};
@Override
public void start() {
//检查环境
DesignerEnvManager.checkNameEnvMap();
if (getModule().leftFindSingleton(StartupArgs.class) != null && getModule().leftFindSingleton(StartupArgs.class).isDemo()) {
if (startupArgs.getValue().isDemo()) {
DesignerEnvManager.getEnvManager().setCurrentEnv2Default();
} else {
try {
@ -40,12 +50,15 @@ public class DesignerWorkspaceProvider extends Activator {
EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner();
}
}
DesignerLaunchStatus.setStatus(DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE);
}
@Override
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.RestartHelper;
import com.fr.design.fun.OemProcessor;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.DesignerPort;
import com.fr.event.EventDispatcher;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
import com.fr.module.Activator;
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.
@ -32,24 +17,7 @@ public class PreStartActivator extends Activator {
@Override
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();
SplashContext.getInstance().registerSplash(createSplash());
SplashContext.getInstance().show();
//初始化
EventDispatcher.fire(ModuleEvent.MajorModuleStarting, Toolkit.i18nText("Fine-Design_Basic_Initializing"));
// 完成初始化
@ -64,38 +32,7 @@ public class PreStartActivator extends Activator {
@Override
public void stop() {
}
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));
// void
}
private void initLanguage() {
@ -107,27 +44,4 @@ public class PreStartActivator extends Activator {
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