Browse Source

Merge branch 'feature/10.0' of ssh://code.fineres.com:7999/~tommy/design into feature/10.0

feature/10.0
kuangshuai 4 years ago
parent
commit
98ec52e68b
  1. 29
      build.gradle
  2. 3
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  3. 2
      designer-base/src/main/java/com/fr/design/actions/community/BBSAction.java
  4. 2
      designer-base/src/main/java/com/fr/design/actions/community/BugAction.java
  5. 2
      designer-base/src/main/java/com/fr/design/actions/community/CenterAction.java
  6. 2
      designer-base/src/main/java/com/fr/design/actions/community/CusDemandAction.java
  7. 2
      designer-base/src/main/java/com/fr/design/actions/community/FacebookFansAction.java
  8. 2
      designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java
  9. 2
      designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java
  10. 2
      designer-base/src/main/java/com/fr/design/actions/community/SignAction.java
  11. 2
      designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java
  12. 2
      designer-base/src/main/java/com/fr/design/actions/community/TemplateStoreAction.java
  13. 2
      designer-base/src/main/java/com/fr/design/actions/community/UpAction.java
  14. 2
      designer-base/src/main/java/com/fr/design/actions/community/WorkOrderCenterAction.java
  15. 6
      designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java
  16. 87
      designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java
  17. 176
      designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java
  18. 5
      designer-base/src/main/java/com/fr/design/dialog/NotificationDialogAction.java
  19. 29
      designer-base/src/main/java/com/fr/design/dialog/UIExpandDialog.java
  20. 2
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  21. 3
      designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java
  22. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java
  23. 10
      designer-base/src/main/java/com/fr/design/locale/impl/BbsRegisterMark.java
  24. 10
      designer-base/src/main/java/com/fr/design/locale/impl/BbsResetMark.java
  25. 10
      designer-base/src/main/java/com/fr/design/locale/impl/BbsSpaceMark.java
  26. 2
      designer-base/src/main/java/com/fr/design/locale/impl/BugNeedMark.java
  27. 4
      designer-base/src/main/java/com/fr/design/locale/impl/TechSupportMark.java
  28. 10
      designer-base/src/main/java/com/fr/design/locale/impl/UserInfoMark.java
  29. 6
      designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java
  30. 5
      designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java
  31. 8
      designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java
  32. 3
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  33. 16
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  34. 6
      designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java
  35. 2
      designer-base/src/main/java/com/fr/design/mainframe/reuse/ReuseGuideDialog.java
  36. 32
      designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java
  37. 7
      designer-base/src/main/java/com/fr/design/mod/ContentReplaceUtil.java
  38. 5
      designer-base/src/main/java/com/fr/design/mod/ContentReplacer.java
  39. 21
      designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java
  40. 4
      designer-base/src/main/java/com/fr/design/mod/impl/repalce/JavaScriptContentReplacer.java
  41. 5
      designer-base/src/main/java/com/fr/design/mod/impl/repalce/VanChartHtmlLabelContentReplacer.java
  42. 29
      designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java
  43. 32
      designer-base/src/main/java/com/fr/design/update/actions/SyncFileProcess.java
  44. 34
      designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java
  45. 120
      designer-base/src/main/java/com/fr/env/CheckServiceDialog.java
  46. 49
      designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java
  47. 2
      designer-base/src/main/java/com/fr/env/VersionCheckMessageDialog.java
  48. BIN
      designer-base/src/main/resources/com/fr/design/images/dashboard/guide.png
  49. BIN
      designer-base/src/main/resources/com/fr/design/images/lookandfeel/circularErrorIcon.png
  50. BIN
      designer-base/src/main/resources/com/fr/design/images/lookandfeel/circularWarningIcon.png
  51. BIN
      designer-base/src/main/resources/com/fr/design/images/lookandfeel/newMessageIcon.png
  52. 2
      designer-base/src/main/resources/com/fr/design/login/login.js
  53. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java
  54. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java
  55. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java
  56. 17
      designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java
  57. 14
      designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java
  58. 14
      designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java
  59. 1
      designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java
  60. 26
      designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java
  61. 13
      designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java
  62. 5
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java
  63. 2
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

29
build.gradle

@ -28,17 +28,6 @@ dependencies {
api project(':designer-realize') api project(':designer-realize')
} }
configurations.all {
resolutionStrategy {
force 'com.fr.third:jxbrowser:6.23'
force 'com.fr.third:jxbrowser-mac:6.23'
force 'com.fr.third:jxbrowser-win64:6.23'
force 'com.fr.third:jxbrowser:7.5'
force 'com.fr.third:jxbrowser-mac:7.5'
force 'com.fr.third:jxbrowser-win64:7.5'
}
}
allprojects { allprojects {
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'java-library' apply plugin: 'java-library'
@ -68,18 +57,12 @@ allprojects {
} }
dependencies { dependencies {
implementation ('com.fr.third:jxbrowser:6.23') { implementation 'com.fr.third:jxbrowser:6.23'
force = true implementation 'com.fr.third:jxbrowser-mac:6.23'
} implementation 'com.fr.third:jxbrowser-win64:6.23'
implementation ('com.fr.third:jxbrowser-mac:6.23') { implementation 'com.fr.third:jxbrowser-v7:7.5'
force = true implementation 'com.fr.third:jxbrowser-mac-v7:7.5'
} implementation 'com.fr.third:jxbrowser-win64-v7:7.5'
implementation ('com.fr.third:jxbrowser-win64:6.23') {
force = true
}
implementation 'com.fr.third:jxbrowser:7.5'
implementation 'com.fr.third:jxbrowser-mac:7.5'
implementation 'com.fr.third:jxbrowser-win64:7.5'
implementation 'com.fr.third:jxbrowser-swing:7.5' implementation 'com.fr.third:jxbrowser-swing:7.5'
implementation 'com.fr.third.server:servlet-api:3.0' implementation 'com.fr.third.server:servlet-api:3.0'
implementation 'org.swingexplorer:swexpl:2.0.1' implementation 'org.swingexplorer:swexpl:2.0.1'

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

@ -18,11 +18,10 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.env.CheckServiceDialog; import com.fr.design.versioncheck.VersionCheckUtils;
import com.fr.env.EnvListPane; import com.fr.env.EnvListPane;
import com.fr.env.RemoteWorkspaceURL; import com.fr.env.RemoteWorkspaceURL;
import com.fr.env.TestConnectionResult; import com.fr.env.TestConnectionResult;
import com.fr.env.VersionCheckMessageDialog;
import com.fr.exit.DesignerExiter; import com.fr.exit.DesignerExiter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;

2
designer-base/src/main/java/com/fr/design/actions/community/BBSAction.java

@ -20,7 +20,7 @@ public class BBSAction extends AbstractDesignerSSO {
@Override @Override
public String getJumpUrl() { public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs"); return CloudCenter.getInstance().acquireUrlByKind("bbs", "http://bbs.fanruan.com/");
} }
public static final MenuKeySet BBS = new MenuKeySet() { public static final MenuKeySet BBS = new MenuKeySet() {

2
designer-base/src/main/java/com/fr/design/actions/community/BugAction.java

@ -17,7 +17,7 @@ public class BugAction extends AbstractDesignerSSO {
@Override @Override
public String getJumpUrl() { public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.bugs"); return CloudCenter.getInstance().acquireUrlByKind("bbs.bugs", "http://bbs.fanruan.com/forum-156-1.html");
} }
public static final MenuKeySet BUG = new MenuKeySet() { public static final MenuKeySet BUG = new MenuKeySet() {

2
designer-base/src/main/java/com/fr/design/actions/community/CenterAction.java

@ -18,7 +18,7 @@ public class CenterAction extends UpAction {
@Override @Override
public String getJumpUrl() { public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.center"); return CloudCenter.getInstance().acquireUrlByKind("bbs.center", "http://bbs.fanruan.com/events/");
} }
public static final MenuKeySet CENTER = new MenuKeySet() { public static final MenuKeySet CENTER = new MenuKeySet() {

2
designer-base/src/main/java/com/fr/design/actions/community/CusDemandAction.java

@ -25,7 +25,7 @@ public class CusDemandAction extends UpAction{
@Override @Override
public void actionPerformed(ActionEvent arg0) public void actionPerformed(ActionEvent arg0)
{ {
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.demand"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs.demand", "https://market.fanruan.com/demand");
BrowseUtils.browser(url); BrowseUtils.browser(url);
} }

2
designer-base/src/main/java/com/fr/design/actions/community/FacebookFansAction.java

@ -18,7 +18,7 @@ public class FacebookFansAction extends UpAction {
@Override @Override
public void actionPerformed(ActionEvent arg0) { public void actionPerformed(ActionEvent arg0) {
BrowseUtils.browser(CloudCenter.getInstance().acquireUrlByKind("facebook.fans.tw")); BrowseUtils.browser(CloudCenter.getInstance().acquireUrlByKind("facebook.fans.tw", "https://www.facebook.com/twfinereport"));
} }
public static final MenuKeySet FACEBOOKFANS = new MenuKeySet() { public static final MenuKeySet FACEBOOKFANS = new MenuKeySet() {

2
designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java

@ -18,7 +18,7 @@ public class NeedAction extends AbstractDesignerSSO {
@Override @Override
public String getJumpUrl() { public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.needs"); return CloudCenter.getInstance().acquireUrlByKind("bbs.needs", "http://bbs.fanruan.com/forum-56-1.html");
} }
public static final MenuKeySet NEED = new MenuKeySet() { public static final MenuKeySet NEED = new MenuKeySet() {

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

@ -18,7 +18,7 @@ public class QuestionAction extends AbstractDesignerSSO {
@Override @Override
public String getJumpUrl() { public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.questions"); return CloudCenter.getInstance().acquireUrlByKind("bbs.questions", "http://bbs.fanruan.com/wenda");
} }
public static final MenuKeySet QUESTIONS = new MenuKeySet() { public static final MenuKeySet QUESTIONS = new MenuKeySet() {

2
designer-base/src/main/java/com/fr/design/actions/community/SignAction.java

@ -18,7 +18,7 @@ public class SignAction extends AbstractDesignerSSO {
@Override @Override
public String getJumpUrl() { public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.aut"); return CloudCenter.getInstance().acquireUrlByKind("bbs.aut", "https://bbs.fanruan.com/certification/");
} }
public static final MenuKeySet SIGN = new MenuKeySet() { public static final MenuKeySet SIGN = new MenuKeySet() {

2
designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java

@ -20,7 +20,7 @@ public class TechSolutionAction extends AbstractDesignerSSO {
@Override @Override
public String getJumpUrl() { public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.solution"); return CloudCenter.getInstance().acquireUrlByKind("bbs.solution", "http://bbs.fanruan.com/forum-113-1.html");
} }
public static final MenuKeySet TSO = new MenuKeySet() { public static final MenuKeySet TSO = new MenuKeySet() {

2
designer-base/src/main/java/com/fr/design/actions/community/TemplateStoreAction.java

@ -46,7 +46,7 @@ public class TemplateStoreAction extends UpdateAction {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
ComponentCollector.getInstance().collectTepMenuEnterClick(); ComponentCollector.getInstance().collectTepMenuEnterClick();
String url = CloudCenter.getInstance().acquireUrlByKind("design.market.template"); String url = CloudCenter.getInstance().acquireUrlByKind("design.market.template", "https://market.fanruan.com/template");
BrowseUtils.browser(url); BrowseUtils.browser(url);
} }
} }

2
designer-base/src/main/java/com/fr/design/actions/community/UpAction.java

@ -18,7 +18,7 @@ public class UpAction extends AbstractDesignerSSO {
@Override @Override
public String getJumpUrl() { public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.update"); return CloudCenter.getInstance().acquireUrlByKind("bbs.update", "http://bbs.fanruan.com/forum.php?mod=collection&action=view&ctid=10");
} }
public static final MenuKeySet UPDATE = new MenuKeySet() { public static final MenuKeySet UPDATE = new MenuKeySet() {

2
designer-base/src/main/java/com/fr/design/actions/community/WorkOrderCenterAction.java

@ -16,6 +16,6 @@ public class WorkOrderCenterAction extends UpAction {
@Override @Override
public String getJumpUrl() { public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.work.order.center"); return CloudCenter.getInstance().acquireUrlByKind("bbs.work.order.center", "https://service.fanruan.com/ticket");
} }
} }

6
designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java

@ -76,7 +76,7 @@ public final class WebPreviewUtils {
browserTemplate(jt, baseRoute, map, actionType); browserTemplate(jt, baseRoute, map, actionType);
} }
}); });
worker.start(jt.getTarget().getTemplateID()); worker.start(jt.getRuntimeId());
return; return;
} }
browserTemplate(jt, baseRoute, map, actionType); browserTemplate(jt, baseRoute, map, actionType);
@ -97,7 +97,7 @@ public final class WebPreviewUtils {
); );
if (OK_OPTION == selVal) { if (OK_OPTION == selVal) {
CallbackSaveWorker worker = jt.saveAs(); CallbackSaveWorker worker = jt.saveAs();
worker.start(jt.getTarget().getTemplateID()); worker.start(jt.getRuntimeId());
worker.addSuccessCallback(new Runnable() { worker.addSuccessCallback(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -125,7 +125,7 @@ public final class WebPreviewUtils {
browseUrl(jt.getEditingFILE(), baseRoute, map, actionType, jt); browseUrl(jt.getEditingFILE(), baseRoute, map, actionType, jt);
} }
}); });
worker.start(jt.getTarget().getTemplateID()); worker.start(jt.getRuntimeId());
} }
} }
} }

87
designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java

@ -46,6 +46,8 @@ import java.awt.Frame;
import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -107,11 +109,11 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener {
topPanel.add(imagePanel, BorderLayout.WEST); topPanel.add(imagePanel, BorderLayout.WEST);
topPanel.add(messagePanel, BorderLayout.CENTER); topPanel.add(messagePanel, BorderLayout.CENTER);
topPanel.setBorder(BorderFactory.createEmptyBorder(10,10,0,10)); topPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
//中间的SQL面板 //中间的SQL面板
centerPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); centerPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
centerPanel.setBorder(BorderFactory.createEmptyBorder(0,10,10,10)); centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
JScrollPane scrollPane = new JScrollPane(); JScrollPane scrollPane = new JScrollPane();
JTextArea checkArea = new JTextArea(sql); JTextArea checkArea = new JTextArea(sql);
checkArea.setEditable(false); checkArea.setEditable(false);
@ -135,7 +137,7 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener {
UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK"));
okButton.addActionListener(this); okButton.addActionListener(this);
bottomPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); bottomPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
bottomPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); bottomPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
bottomPanel.add(okButton, BorderLayout.EAST); bottomPanel.add(okButton, BorderLayout.EAST);
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Preview_Performed_Sql")); this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Preview_Performed_Sql"));
@ -144,6 +146,12 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener {
this.add(centerPanel, BorderLayout.CENTER); this.add(centerPanel, BorderLayout.CENTER);
this.add(bottomPanel, BorderLayout.SOUTH); this.add(bottomPanel, BorderLayout.SOUTH);
this.setSize(600, 400); this.setSize(600, 400);
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
close();
}
});
GUICoreUtils.centerWindow(this); GUICoreUtils.centerWindow(this);
} }
@ -167,56 +175,65 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener {
parameterMap.put(parameter.getName(), parameter.getValue()); parameterMap.put(parameter.getName(), parameter.getValue());
} }
} }
boolean showOriginSql = true;
for (ParameterProvider parameter : DataOperator.getInstance().getTableDataParameters(tableData)) { for (ParameterProvider parameter : DataOperator.getInstance().getTableDataParameters(tableData)) {
if (parameterMap.containsKey(parameter.getName())) { if (parameterMap.containsKey(parameter.getName())) {
Object value = parameterMap.get(parameter.getName()); parameter.setValue(parameterMap.get(parameter.getName()));
if (value != null && !StringUtils.EMPTY.equals(value)) {
showOriginSql = false;
}
parameter.setValue(value);
} }
} }
String sql; String sql;
// 计算高亮文本位置 // 计算高亮文本位置
List<int[]> specialCharParamIndex = null; List<int[]> specialCharParamIndex = null;
boolean highlight = true; boolean highlight = true;
if (showOriginSql) { NameSpace ns = ParameterMapNameSpace.create(parameterMap);
sql = tableData.getQuery(); calculator.pushNameSpace(ns);
} else { Parameter[] paras = processParameters(tableData, calculator);
NameSpace ns = ParameterMapNameSpace.create(parameterMap); // 所有被转义参数的集合
calculator.pushNameSpace(ns); refreshEscapeSqlHelper();
Parameter[] paras = processParameters(tableData, calculator); Set<String> specialCharParam = EscapeSqlHelper.getInstance().getSpecialCharParam(paras);
// 所有被转义参数的集合 // 将参数转义等
Set<String> specialCharParam = EscapeSqlHelper.getInstance().getSpecialCharParam(paras); Set<TableDataProvider> tableDataProviders = getTableDataProviders();
// 将参数转义等 for (TableDataProvider provider : tableDataProviders) {
Set<TableDataProvider> tableDataProviders = getTableDataProviders(); provider.processParametersBeforeAnalyzeSQL(paras, calculator);
for (TableDataProvider provider : tableDataProviders) { }
provider.processParametersBeforeAnalyzeSQL(paras, calculator);
}
if (!specialCharParam.isEmpty()) { if (!specialCharParam.isEmpty()) {
specialCharParamIndex = ParameterHelper.analyzeCurrentContextTableData4Template(tableData.getQuery(), paras, specialCharParam); specialCharParamIndex = ParameterHelper.analyzeCurrentContextTableData4Template(tableData.getQuery(), paras, specialCharParam);
} }
String oldSql = ParameterHelper.analyzeCurrentContextTableData4Templatee(tableData.getQuery(), paras); String oldSql = ParameterHelper.analyzeCurrentContextTableData4Templatee(tableData.getQuery(), paras);
sql = processExtraSQL(paras, oldSql, calculator, tableDataProviders); sql = processExtraSQL(paras, oldSql, calculator, tableDataProviders);
if (!StringUtils.equals(oldSql, sql)) { if (!StringUtils.equals(oldSql, sql)) {
highlight = false; highlight = false;
}
} }
// sql内容复制到剪切板 // sql内容复制到剪切板
StringSelection selection = new StringSelection(sql); StringSelection selection = new StringSelection(sql);
java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection); java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection);
// 弹窗 // 弹窗
PreviewPerformedSqlPane pane;
if (isShowSpecialCharSqlPane(specialCharParamIndex)) { if (isShowSpecialCharSqlPane(specialCharParamIndex)) {
pane = new PreviewPerformedSqlPane(DesignerContext.getDesignerFrame(), sql, specialCharParamIndex, ConfigService.getInstance().getPSIConfig().getSelectedSpecialChar(), highlight); showSpecialCharSqlPane(sql, specialCharParamIndex, highlight);
} else { } else {
pane = new PreviewPerformedSqlPane(DesignerContext.getDesignerFrame(), sql); showNormalPreviewPane(sql);
} }
}
// 埋点方法
private static void showNormalPreviewPane(String sql) {
PreviewPerformedSqlPane pane = new PreviewPerformedSqlPane(DesignerContext.getDesignerFrame(), sql);
pane.setVisible(true);
}
// 埋点方法
private static void showSpecialCharSqlPane(String sql, List<int[]> specialCharParamIndex, boolean highlight) {
PreviewPerformedSqlPane pane = new PreviewPerformedSqlPane(DesignerContext.getDesignerFrame(), sql, specialCharParamIndex, ConfigService.getInstance().getPSIConfig().getSelectedSpecialChar(), highlight);
pane.setVisible(true); pane.setVisible(true);
} }
private static void refreshEscapeSqlHelper() {
EscapeSqlHelper.getInstance().setUseForbidWord(ConfigService.getInstance().getPSIConfig().isUseForbidWord());
EscapeSqlHelper.getInstance().setSelectedForbidWord(ConfigService.getInstance().getPSIConfig().getSelectedForbidWord());
EscapeSqlHelper.getInstance().setUseEscapeSpecialChar(ConfigService.getInstance().getPSIConfig().isUseEscapeSpecialChar());
EscapeSqlHelper.getInstance().setSelectedSpecialChar(ConfigService.getInstance().getPSIConfig().getSelectedSpecialChar());
}
private static boolean isShowSpecialCharSqlPane(List<int[]> specialCharParamIndex) { private static boolean isShowSpecialCharSqlPane(List<int[]> specialCharParamIndex) {
return specialCharParamIndex != null && !specialCharParamIndex.isEmpty(); return specialCharParamIndex != null && !specialCharParamIndex.isEmpty();
} }
@ -274,4 +291,8 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
this.dispose(); this.dispose();
} }
private void close() {
this.dispose();
}
} }

176
designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java

@ -0,0 +1,176 @@
package com.fr.design.dialog;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.UIManager;
/**
* 带查看详情的简要通知框
*
*/
public class NotificationDialog extends JDialog {
public static final int ERROR_MESSAGE = 0;
public static final int NEW_MESSAGE = 1;
public static final int WARNING_MESSAGE = 2;
public static final String HTML_TAG_1 = "<html>";
public static final String HTML_TAG_2 = "</html>";
private UILabel messageText;
private NotificationDialogAction notificationDialogAction;
public NotificationDialog(Frame owner, String title, boolean isModal, int messageType, String message,NotificationDialogAction action) {
super(owner);
setTitle(title);
initComponents(messageType, message, isModal,action);
}
public NotificationDialog(Builder builder) {
super(builder.owner);
setTitle(builder.title);
initComponents(builder.messageType, builder.message, builder.modal, builder.action);
}
public void initComponents(int messageType, String message, boolean isModal,NotificationDialogAction action) {
notificationDialogAction = action;
setModal(isModal);
setResizable(false);
//消息内容
UILabel icon = new UILabel(getIconForType(messageType));
JPanel iconPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
iconPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 8));
iconPanel.add(icon);
add(iconPanel, BorderLayout.WEST);
messageText = new UILabel(HTML_TAG_1 + message + HTML_TAG_2);
messageText.setForeground(new Color(51, 51, 52));
JPanel centerPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
centerPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 10));
JScrollPane jScrollPane = new JScrollPane(messageText, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane.setBorder(BorderFactory.createEmptyBorder());
centerPanel.add(jScrollPane, BorderLayout.CENTER);
add(centerPanel, BorderLayout.CENTER);
//查看详情
UILabel detailLabel = new UILabel();
detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail"));
detailLabel.setForeground(Color.BLUE);
JPanel detailPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
detailPanel.add(detailLabel, BorderLayout.EAST);
add(detailPanel, BorderLayout.SOUTH);
setPreferredSize(new Dimension(262, 135));
detailLabel.addMouseListener(detailClickListener);
messageText.addMouseListener(detailClickListener);
pack();
if (getOwner() != null) {
GUICoreUtils.setWindowCenter(getOwner(), this);
}
}
private MouseListener detailClickListener = new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if(notificationDialogAction != null){
hideDialog();
notificationDialogAction.doClick();
}
}
};
/**
* 设置通知消息
*/
public void setMessage(String message){
messageText.setText(HTML_TAG_1 + message + HTML_TAG_2);
}
private void hideDialog(){
this.dispose();
}
protected Icon getIconForType(int messageType) {
String propertyName;
switch (messageType) {
case 0:
propertyName = "OptionPane.circularErrorIcon";
break;
case 1:
propertyName = "OptionPane.newMessageIcon";
break;
case 2:
propertyName = "OptionPane.warningIcon";
break;
default:
return null;
}
return UIManager.getIcon(propertyName);
}
public static Builder Builder() {
return new NotificationDialog.Builder();
}
public static final class Builder {
public int messageType = WARNING_MESSAGE;
public String message;
public boolean modal = true;
public Frame owner = null;
public String title;
public NotificationDialogAction action;
private Builder() {
}
public NotificationDialog build() {
return new NotificationDialog(this);
}
public Builder owner(Frame owner) {
this.owner = owner;
return this;
}
public Builder messageType(int messageType) {
this.messageType = messageType;
return this;
}
public Builder message(String message) {
this.message = message;
return this;
}
public Builder modal(boolean modal) {
this.modal = modal;
return this;
}
public Builder title(String title) {
this.title = title;
return this;
}
public Builder notificationDialogAction(NotificationDialogAction action) {
this.action = action;
return this;
}
}
}

5
designer-base/src/main/java/com/fr/design/dialog/NotificationDialogAction.java

@ -0,0 +1,5 @@
package com.fr.design.dialog;
public interface NotificationDialogAction {
void doClick();
}

29
designer-base/src/main/java/com/fr/design/dialog/UIExpandDialog.java

@ -6,6 +6,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
@ -64,7 +65,7 @@ public class UIExpandDialog extends UIDialog {
private final UILabel narrow = new UILabel(); private final UILabel narrow = new UILabel();
private final UILabel narrowHit = new UILabel(); private final UILabel narrowHit = new UILabel();
private final UIButton buttonOK; private final UIButton buttonOK;
private final UIButton buttonCancel; private UIButton buttonCancel = null;
private JLabel msg; private JLabel msg;
private final UITextArea textArea = new UITextArea(); private final UITextArea textArea = new UITextArea();
@ -73,7 +74,9 @@ public class UIExpandDialog extends UIDialog {
String okText, String cancelText, boolean isExpand) { String okText, String cancelText, boolean isExpand) {
super(owner); super(owner);
buttonOK = new UIButton(okText); buttonOK = new UIButton(okText);
buttonCancel = new UIButton(cancelText); if (!StringUtils.isEmpty(cancelText)) {
buttonCancel = new UIButton(cancelText);
}
setTitle(title); setTitle(title);
setModal(isModal); setModal(isModal);
initComponents(messageType, message, detail, isModal, isExpand, null); initComponents(messageType, message, detail, isModal, isExpand, null);
@ -82,7 +85,9 @@ public class UIExpandDialog extends UIDialog {
public UIExpandDialog(Builder builder) { public UIExpandDialog(Builder builder) {
super(builder.owner); super(builder.owner);
buttonOK = new UIButton(builder.okText); buttonOK = new UIButton(builder.okText);
buttonCancel = new UIButton(builder.cancelText); if (!StringUtils.isEmpty(builder.cancelText)) {
buttonCancel = new UIButton(builder.cancelText);
}
setTitle(builder.title); setTitle(builder.title);
setModal(builder.modal); setModal(builder.modal);
initComponents(builder.messageType, builder.message, builder.detail, initComponents(builder.messageType, builder.message, builder.detail,
@ -91,7 +96,7 @@ public class UIExpandDialog extends UIDialog {
public void initComponents(int messageType, String message, String detail, public void initComponents(int messageType, String message, String detail,
boolean isModal, boolean isExpand, DialogActionListener l) { boolean isModal, boolean isExpand, DialogActionListener l) {
applyClosingAction();
setLayout(new BorderLayout(GAP, GAP)); setLayout(new BorderLayout(GAP, GAP));
setResizable(false); setResizable(false);
setModal(isModal); setModal(isModal);
@ -133,7 +138,9 @@ public class UIExpandDialog extends UIDialog {
// 操作面板 // 操作面板
JPanel actionPanel = new JPanel(); JPanel actionPanel = new JPanel();
actionPanel.setLayout(new FlowLayout(FlowLayout.CENTER, MARGIN, MARGIN)); actionPanel.setLayout(new FlowLayout(FlowLayout.CENTER, MARGIN, MARGIN));
actionPanel.add(buttonCancel); if (buttonCancel != null) {
actionPanel.add(buttonCancel);
}
actionPanel.add(buttonOK); actionPanel.add(buttonOK);
add(actionPanel, BorderLayout.SOUTH); add(actionPanel, BorderLayout.SOUTH);
@ -185,11 +192,13 @@ public class UIExpandDialog extends UIDialog {
} }
}); });
buttonCancel.addActionListener(new ActionListener() { if (buttonCancel != null) {
public void actionPerformed(ActionEvent e) { buttonCancel.addActionListener(new ActionListener() {
doCancel(); public void actionPerformed(ActionEvent e) {
} doCancel();
}); }
});
}
} }
protected Icon getIconForType(int messageType) { protected Icon getIconForType(int messageType) {

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

@ -706,7 +706,7 @@ public class MutilTempalteTabPane extends JComponent {
closeTpl(specifiedTemplate); closeTpl(specifiedTemplate);
} }
}); });
worker.start(specifiedTemplate.getTarget().getTemplateID()); worker.start(specifiedTemplate.getRuntimeId());
} else if (returnVal == JOptionPane.NO_OPTION) { } else if (returnVal == JOptionPane.NO_OPTION) {
closeTpl(specifiedTemplate); closeTpl(specifiedTemplate);
} }

3
designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java

@ -176,6 +176,9 @@ public class UILookAndFeel extends MetalLookAndFeel {
table.put("OptionPane.narrow.right", loadIcon("Icon_Narrow_Right_16x16.png", this)); table.put("OptionPane.narrow.right", loadIcon("Icon_Narrow_Right_16x16.png", this));
table.put("OptionPane.narrow.down", loadIcon("Icon_Narrow_Down_16x16.png", this)); table.put("OptionPane.narrow.down", loadIcon("Icon_Narrow_Down_16x16.png", this));
table.put("OptionPane.warningIcon", loadIcon("WarningIcon.png", this)); table.put("OptionPane.warningIcon", loadIcon("WarningIcon.png", this));
table.put("OptionPane.circularWarningIcon", loadIcon("circularWarningIcon.png", this));
table.put("OptionPane.newMessageIcon", loadIcon("newMessageIcon.png", this));
table.put("OptionPane.circularErrorIcon", loadIcon("circularErrorIcon.png", this));
table.put("OptionPane.questionIcon", loadIcon("QuestionIcon.png", this)); table.put("OptionPane.questionIcon", loadIcon("QuestionIcon.png", this));
table.put("OptionPane.tipIcon", loadIcon("TipIcon.png", this)); table.put("OptionPane.tipIcon", loadIcon("TipIcon.png", this));
table.put("ScrollPane.border", new UIScrollPaneBorder()); table.put("ScrollPane.border", new UIScrollPaneBorder());

4
designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java

@ -482,7 +482,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements L
UILabel label = new UILabel(labelText + getWrapperLabelText()) { UILabel label = new UILabel(labelText + getWrapperLabelText()) {
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
((Graphics2D) g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f)); ((Graphics2D) g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f));
super.paint(g); super.paint(g);
} }
}; };
@ -490,7 +490,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements L
label.setOpaque(true); label.setOpaque(true);
label.setBackground(Color.WHITE); label.setBackground(Color.WHITE);
label.setForeground(Color.decode("#333334")); label.setForeground(Color.decode("#333334"));
label.setFont(label.getFont().deriveFont(10F)); label.setFont(label.getFont().deriveFont(11F));
label.setPreferredSize(new Dimension(224, 26)); label.setPreferredSize(new Dimension(224, 26));
this.nameEdList = nameEdList; this.nameEdList = nameEdList;
this.add(label, BorderLayout.NORTH); this.add(label, BorderLayout.NORTH);

10
designer-base/src/main/java/com/fr/design/locale/impl/BbsRegisterMark.java

@ -16,11 +16,11 @@ import java.util.Map;
public class BbsRegisterMark implements LocaleMark<String> { public class BbsRegisterMark implements LocaleMark<String> {
private final Map<Locale, String> map = new HashMap<>(); private final Map<Locale, String> map = new HashMap<>();
private static final String BBS_REGISTER_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.register"); private static final String BBS_REGISTER_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.register", "http://id.fanruan.com/register/register.php?clueSource=activityfr");
private static final String BBS_REGISTER_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.register"); private static final String BBS_REGISTER_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.register", "http://id.fanruan.com/register/register.php?clueSource=activityfr");
private static final String BBS_REGISTER_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US"); private static final String BBS_REGISTER_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US", "https://id.fanruan.com/en/register/register.php");
private static final String BBS_REGISTER_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US"); private static final String BBS_REGISTER_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US", "https://id.fanruan.com/en/register/register.php");
private static final String BBS_REGISTER_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US"); private static final String BBS_REGISTER_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US", "https://id.fanruan.com/en/register/register.php");
public BbsRegisterMark() { public BbsRegisterMark() {
map.put(Locale.CHINA, BBS_REGISTER_CN); map.put(Locale.CHINA, BBS_REGISTER_CN);

10
designer-base/src/main/java/com/fr/design/locale/impl/BbsResetMark.java

@ -16,11 +16,11 @@ import java.util.Map;
public class BbsResetMark implements LocaleMark<String> { public class BbsResetMark implements LocaleMark<String> {
private final Map<Locale, String> map = new HashMap<>(); private final Map<Locale, String> map = new HashMap<>();
private static final String BBS_RESET_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.reset"); private static final String BBS_RESET_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.reset", "http://id.fanruan.com/forget/forget.php?clue=activityfr");
private static final String BBS_RESET_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.reset"); private static final String BBS_RESET_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.reset", "http://id.fanruan.com/forget/forget.php?clue=activityfr");
private static final String BBS_RESET_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US"); private static final String BBS_RESET_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US", "https://id.fanruan.com/en/forget/forget.php");
private static final String BBS_RESET_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US"); private static final String BBS_RESET_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US", "https://id.fanruan.com/en/forget/forget.php");
private static final String BBS_RESET_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US"); private static final String BBS_RESET_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US", "https://id.fanruan.com/en/forget/forget.php");
public BbsResetMark() { public BbsResetMark() {
map.put(Locale.CHINA, BBS_RESET_CN); map.put(Locale.CHINA, BBS_RESET_CN);

10
designer-base/src/main/java/com/fr/design/locale/impl/BbsSpaceMark.java

@ -16,11 +16,11 @@ import java.util.Map;
public class BbsSpaceMark implements LocaleMark<String> { public class BbsSpaceMark implements LocaleMark<String> {
private final Map<Locale, String> map = new HashMap<>(); private final Map<Locale, String> map = new HashMap<>();
private static final String BBS_SPACE_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.default"); private static final String BBS_SPACE_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.default", "http://bbs.fanruan.com/home.php?mod=space&do=pm");
private static final String BBS_SPACE_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.default"); private static final String BBS_SPACE_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.default", "http://bbs.fanruan.com/home.php?mod=space&do=pm");
private static final String BBS_SPACE_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.default.en_US"); private static final String BBS_SPACE_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.default.en_US", "https://community.finereport.com/home.php?mod=space&do=pm");
private static final String BBS_SPACE_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.default.en_US"); private static final String BBS_SPACE_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.default.en_US", "https://community.finereport.com/home.php?mod=space&do=pm");
private static final String BBS_SPACE_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.default.en_US"); private static final String BBS_SPACE_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.default.en_US", "https://community.finereport.com/home.php?mod=space&do=pm");
public BbsSpaceMark() { public BbsSpaceMark() {
map.put(Locale.CHINA, BBS_SPACE_CN); map.put(Locale.CHINA, BBS_SPACE_CN);

2
designer-base/src/main/java/com/fr/design/locale/impl/BugNeedMark.java

@ -14,7 +14,7 @@ import java.util.Map;
*/ */
public class BugNeedMark implements LocaleMark<String> { public class BugNeedMark implements LocaleMark<String> {
private Map<Locale, String> map = new HashMap<>(); private Map<Locale, String> map = new HashMap<>();
private static final String TW_BUG_AND_NEEDS = CloudCenter.getInstance().acquireUrlByKind("bbs.bug.needs.zh_TW"); private static final String TW_BUG_AND_NEEDS = CloudCenter.getInstance().acquireUrlByKind("bbs.bug.needs.zh_TW", "https://fanruanhelp.zendesk.com/hc/zh-tw/requests/new");
public BugNeedMark() { public BugNeedMark() {
map.put(Locale.TAIWAN, TW_BUG_AND_NEEDS); map.put(Locale.TAIWAN, TW_BUG_AND_NEEDS);

4
designer-base/src/main/java/com/fr/design/locale/impl/TechSupportMark.java

@ -14,8 +14,8 @@ import java.util.Map;
*/ */
public class TechSupportMark implements LocaleMark<String> { public class TechSupportMark implements LocaleMark<String> {
private Map<Locale, String> map = new HashMap<>(); private Map<Locale, String> map = new HashMap<>();
private static final String EN_TECH_SUPPORT = CloudCenter.getInstance().acquireUrlByKind("bbs.tech.support.en_US"); private static final String EN_TECH_SUPPORT = CloudCenter.getInstance().acquireUrlByKind("bbs.tech.support.en_US", "https://fanruanhelp.zendesk.com/hc/en-us");
private static final String TW_TECH_SUPPORT = CloudCenter.getInstance().acquireUrlByKind("bbs.tech.support.zh_TW"); private static final String TW_TECH_SUPPORT = CloudCenter.getInstance().acquireUrlByKind("bbs.tech.support.zh_TW", "https://fanruanhelp.zendesk.com/hc/zh-tw");
public TechSupportMark() { public TechSupportMark() {
map.put(Locale.US, EN_TECH_SUPPORT); map.put(Locale.US, EN_TECH_SUPPORT);

10
designer-base/src/main/java/com/fr/design/locale/impl/UserInfoMark.java

@ -15,11 +15,11 @@ import java.util.Map;
public class UserInfoMark implements LocaleMark<String> { public class UserInfoMark implements LocaleMark<String> {
private Map<Locale, String> map = new HashMap<>(); private Map<Locale, String> map = new HashMap<>();
private static final String CN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.cn"); private static final String CN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.cn", "http://www.finereport.com/product/active?utm_source=direct&utm_medium=exe");
private static final String EN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.en"); private static final String EN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.en", "http://www.finereport.com/en/activation");
private static final String TW_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.tw"); private static final String TW_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.tw", "http://www.finereport.com/tw/products/frlogin");
private static final String JP_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.jp"); private static final String JP_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.jp", "http://www.finereport.com/jp/trial/");
private static final String KR_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.kr"); private static final String KR_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.kr", "http://www.finereport.com/kr/activation/");
public UserInfoMark() { public UserInfoMark() {
map.put(Locale.CHINA, CN_LOGIN_HTML); map.put(Locale.CHINA, CN_LOGIN_HTML);

6
designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java

@ -15,9 +15,9 @@ import java.util.Map;
public class VideoMark implements LocaleMark<String> { public class VideoMark implements LocaleMark<String> {
private Map<Locale, String> map = new HashMap<>(); private Map<Locale, String> map = new HashMap<>();
private static final String VIDEO_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en_US"); private static final String VIDEO_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en_US", "http://www.finereport.com/en/Learning-path");
private static final String VIDEO_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.zh_CN"); private static final String VIDEO_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.zh_CN", "https://edu.fanruan.com/video?class1=16&class2=0");
private static final String VIDEO_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.video.zh_TW"); private static final String VIDEO_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.video.zh_TW", "http://www.finereport.com/tw/video");
public VideoMark() { public VideoMark() {
map.put(Locale.CHINA, VIDEO_CN); map.put(Locale.CHINA, VIDEO_CN);

5
designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java

@ -68,12 +68,9 @@ public class DesignerLoginHelper {
if (dialog == null) { if (dialog == null) {
if (window instanceof Dialog) { if (window instanceof Dialog) {
dialog = new DesignerLoginShowDialog((Dialog) window, designerLoginPane); dialog = new DesignerLoginShowDialog((Dialog) window, designerLoginPane);
} else if (window instanceof Frame) {
dialog = new DesignerLoginShowDialog((Frame) window, designerLoginPane);
} else { } else {
return; dialog = new DesignerLoginShowDialog((Frame) window, designerLoginPane);
} }
} }
dialog.setVisible(true); dialog.setVisible(true);
} }

8
designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java

@ -5,6 +5,7 @@ import com.fr.design.dialog.UIDialog;
import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.os.impl.SupportOSImpl;
import com.fr.stable.StringUtils;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
/** /**
@ -54,7 +55,12 @@ public class DesignerGuideHelper {
* 激活满一周 * 激活满一周
*/ */
private static boolean isActivatedForOneWeek() { private static boolean isActivatedForOneWeek() {
return (System.currentTimeMillis() - DesignerEnvManager.getEnvManager().getDesignerActivatedTime()) > ONE_WEEK; DesignerEnvManager manager = DesignerEnvManager.getEnvManager();
String key = manager.getActivationKey();
if (StringUtils.isEmpty(key)) {
return false;
}
return (System.currentTimeMillis() - manager.getDesignerActivatedTime()) > ONE_WEEK;
} }
/** /**

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

@ -72,6 +72,7 @@ import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import java.util.concurrent.CopyOnWriteArrayList;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.Icon; import javax.swing.Icon;
@ -133,7 +134,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private static final Integer TOP_LAYER = 200; private static final Integer TOP_LAYER = 200;
private List<DesignerOpenedListener> designerOpenedListenerList = new ArrayList<>(); private List<DesignerOpenedListener> designerOpenedListenerList = new CopyOnWriteArrayList<>();
private ToolBarMenuDock ad; private ToolBarMenuDock ad;

16
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -129,6 +129,11 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
private volatile boolean opening = false; private volatile boolean opening = false;
private volatile boolean openFailed = false; private volatile boolean openFailed = false;
/**
* UI界面模板运行时唯一的id 不存储在模板中 仅在运行时使用 模板界面上关闭就不关注了
*/
private final String runtimeId = UUID.randomUUID().toString();
private PluginEventListener pluginListener; private PluginEventListener pluginListener;
public JTemplate() { public JTemplate() {
@ -1492,10 +1497,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
editingFILE = fileChooser.getSelectedFILE(); editingFILE = fileChooser.getSelectedFILE();
} }
//收集和生成templateID 因为是另存为操作 无论怎么样都需要重新生成templateID
// TODO Hades https://work.fineres.com/browse/REPORT-52936
// initForCollect();
FILE finalEditingFILE = editingFILE; FILE finalEditingFILE = editingFILE;
CallbackSaveWorker worker = new CallbackSaveWorker(new Callable<Boolean>() { CallbackSaveWorker worker = new CallbackSaveWorker(new Callable<Boolean>() {
@Override @Override
@ -1587,13 +1588,13 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
@Override @Override
public void saveDirectly() { public void saveDirectly() {
CallbackSaveWorker worker = save(); CallbackSaveWorker worker = save();
worker.start(this.template.getTemplateID()); worker.start(getRuntimeId());
} }
@Override @Override
public void saveAsDirectly() { public void saveAsDirectly() {
CallbackSaveWorker worker = saveAs(); CallbackSaveWorker worker = saveAs();
worker.start(this.template.getTemplateID()); worker.start(getRuntimeId());
} }
@Override @Override
@ -1634,4 +1635,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return !isSaving() && !isOpening() && !isOpenFailed(); return !isSaving() && !isOpening() && !isOpenFailed();
} }
public String getRuntimeId() {
return runtimeId;
}
} }

6
designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java

@ -116,7 +116,7 @@ public class CheckButton extends UIButton {
startCheck(checkThread); startCheck(checkThread);
} }
}); });
worker.start(jtemplate.getTarget().getTemplateID()); worker.start(jtemplate.getRuntimeId());
} }
} else { } else {
if (!jtemplate.isSaved()) { if (!jtemplate.isSaved()) {
@ -127,7 +127,7 @@ public class CheckButton extends UIButton {
startCheck(checkThread); startCheck(checkThread);
} }
}); });
worker.start(jtemplate.getTarget().getTemplateID()); worker.start(jtemplate.getRuntimeId());
} else { } else {
startCheck(checkThread); startCheck(checkThread);
} }
@ -148,7 +148,7 @@ public class CheckButton extends UIButton {
startCheck(checkThread); startCheck(checkThread);
} }
}); });
worker.start(jtemplate.getTarget().getTemplateID()); worker.start(jtemplate.getRuntimeId());
} }
} }
} }

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

@ -108,7 +108,7 @@ public class ReuseGuideDialog extends UIDialog implements PromptWindow {
JPanel centerPanel = new JPanel(new BorderLayout()); JPanel centerPanel = new JPanel(new BorderLayout());
UILabel titleLabel = new UILabel(Toolkit.i18nText("Fine-Design_Share_Drag_And_Make_Component")); UILabel titleLabel = new UILabel(Toolkit.i18nText("Fine-Design_Share_Drag_And_Make_Component"));
UILabel imageLabel = new UILabel(new ImageIcon(IOUtils.readImage("com/fr/base/images/share/guide.png").getScaledInstance(DEFAULT.width, DEFAULT.height, Image.SCALE_SMOOTH))); UILabel imageLabel = new UILabel(new ImageIcon(IOUtils.readImage("com/fr/design/images/dashboard/guide.png").getScaledInstance(DEFAULT.width, DEFAULT.height, Image.SCALE_SMOOTH)));
titleLabel.setFont(new Font(titleLabel.getFont().getName(), Font.BOLD, TITLE_FONT_SIZE)); titleLabel.setFont(new Font(titleLabel.getFont().getName(), Font.BOLD, TITLE_FONT_SIZE));
titleLabel.setBorder(BorderFactory.createEmptyBorder()); titleLabel.setBorder(BorderFactory.createEmptyBorder());

32
designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java

@ -9,6 +9,8 @@ import com.fr.data.SimpleDSColumn;
import com.fr.data.condition.FormulaCondition; import com.fr.data.condition.FormulaCondition;
import com.fr.data.impl.FormulaDictionary; import com.fr.data.impl.FormulaDictionary;
import com.fr.data.impl.NameTableData; import com.fr.data.impl.NameTableData;
import com.fr.design.mod.impl.repalce.JavaScriptContentReplacer;
import com.fr.design.mod.impl.repalce.VanChartHtmlLabelContentReplacer;
import com.fr.form.main.FormHyperlink; import com.fr.form.main.FormHyperlink;
import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.WidgetTitle; import com.fr.form.ui.WidgetTitle;
@ -22,6 +24,8 @@ import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.cellattr.core.group.FunctionGrouper; import com.fr.report.cell.cellattr.core.group.FunctionGrouper;
import com.fr.report.cell.cellattr.core.group.SelectCount; import com.fr.report.cell.cellattr.core.group.SelectCount;
import com.fr.stable.Filter; import com.fr.stable.Filter;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -45,10 +49,12 @@ public class ContentObjectManager {
/** /**
* 放置所有需要替换内容的对象 * 放置所有需要替换内容的对象
*/ */
private Map<String, Set<Object>> objectMap; private Map<String, Collection<Object>> objectMap;
private final Set<String> set = new HashSet<>(); private final Set<String> set = new HashSet<>();
private final Map<String, ContentReplacer> map = new HashMap<>();
private ContentObjectManager() { private ContentObjectManager() {
set.add(Formula.class.getName()); set.add(Formula.class.getName());
set.add(JavaScriptImpl.class.getName()); set.add(JavaScriptImpl.class.getName());
@ -70,6 +76,8 @@ public class ContentObjectManager {
set.add(SelectCount.class.getName()); set.add(SelectCount.class.getName());
set.add(WidgetTitle.class.getName()); set.add(WidgetTitle.class.getName());
set.add(FunctionGrouper.class.getName()); set.add(FunctionGrouper.class.getName());
map.put(JavaScriptImpl.class.getName(), new JavaScriptContentReplacer());
map.put(VanChartHtmlLabel.class.getName(), new VanChartHtmlLabelContentReplacer());
} }
public void searchObject(Object ob) { public void searchObject(Object ob) {
@ -84,12 +92,32 @@ public class ContentObjectManager {
objectMap = ClassHelper.searchObject(ob, set, filter); objectMap = ClassHelper.searchObject(ob, set, filter);
} }
public void clearObject() { public void clearObject() {
if (objectMap != null) {
objectMap.clear();
}
objectMap = null; objectMap = null;
} }
@Nullable @Nullable
public Map<String, Set<Object>> getObjectMap() { public Map<String, Collection<Object>> getObjectMap() {
return objectMap; return objectMap;
} }
public boolean needContentTip(Object ob, Set<String> nameSet) {
objectMap = ClassHelper.searchObject(ob, set, ModClassFilter.getInstance());
for (Map.Entry<String, Collection<Object>> entry : objectMap.entrySet()) {
for (Object o : entry.getValue()) {
for (String name : nameSet) {
ContentReplacer contentReplacer = map.get(entry.getKey());
if (contentReplacer!= null && contentReplacer.contain(o, name)) {
clearObject();
return true;
}
}
}
}
clearObject();
return false;
}
} }

7
designer-base/src/main/java/com/fr/design/mod/ContentReplaceUtil.java

@ -168,5 +168,12 @@ public class ContentReplaceUtil {
return content; return content;
} }
public static boolean containsName(String content, String name) {
if (StringUtils.isNotEmpty(content)) {
return content.contains(name);
}
return false;
}
} }

5
designer-base/src/main/java/com/fr/design/mod/ContentReplacer.java

@ -10,4 +10,9 @@ public interface ContentReplacer<T> {
void replace(T t, String oldName, String newName); void replace(T t, String oldName, String newName);
default boolean contain(T t, String name) {
return false;
}
} }

21
designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java

@ -29,9 +29,10 @@ import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* 默认联动内容替换器实现 * 默认联动内容替换器实现
@ -51,7 +52,7 @@ public class ContentReplacerCenter {
} }
private List<ContentChange> contentChangeList = new ArrayList<>(); private List<ContentChange> contentChangeList = new ArrayList<>();
private List<ContentChangeItem> items = new ArrayList<>(); private Map<ChangeItem, ContentChangeItem> itemsMap = new HashMap<>();
private ContentReplacerCenter() { private ContentReplacerCenter() {
@ -61,21 +62,21 @@ public class ContentReplacerCenter {
if (param.getChangeMap().isEmpty()) { if (param.getChangeMap().isEmpty()) {
return; return;
} }
items.add(param); itemsMap.put(param.getChangeItem(), param);
} }
}); });
EventDispatcher.listen(TableDataModifyEvent.INSTANCE, new Listener<ContentChangeItem>() { EventDispatcher.listen(TableDataModifyEvent.INSTANCE, new Listener<ContentChangeItem>() {
@Override @Override
public void on(Event event, ContentChangeItem param) { public void on(Event event, ContentChangeItem param) {
items.add(param); itemsMap.put(param.getChangeItem(), param);
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
ContentObjectManager.getInstance().searchObject(param.getObject()); ContentObjectManager.getInstance().searchObject(param.getObject());
FineLoggerFactory.getLogger().debug("search object spend {} ms", (System.currentTimeMillis() - start)); FineLoggerFactory.getLogger().debug("search object spend {} ms", (System.currentTimeMillis() - start));
FineLoggerFactory.getLogger().debug("search result: {}", ContentObjectManager.getInstance().getObjectMap() == null FineLoggerFactory.getLogger().debug("search result: {}", ContentObjectManager.getInstance().getObjectMap() == null
? null : ContentObjectManager.getInstance().getObjectMap().keySet()); ? null : ContentObjectManager.getInstance().getObjectMap().keySet());
List<ContentChangeItem> itemsCopy = new ArrayList<>(items); List<ContentChangeItem> itemsCopy = new ArrayList<>(itemsMap.values());
items.clear(); itemsMap.clear();
onRename(itemsCopy, contentChangeList); onRename(itemsCopy, contentChangeList);
} }
}); });
@ -106,14 +107,14 @@ public class ContentReplacerCenter {
} }
private void onRename(List<ContentChangeItem> contentChangeItemList, List<ContentChange> contentChangeList) { private void onRename(List<ContentChangeItem> contentChangeItemList, List<ContentChange> contentChangeList) {
Map<String, Set<Object>> objectMap = ContentObjectManager.getInstance().getObjectMap(); Map<String, Collection<Object>> objectMap = ContentObjectManager.getInstance().getObjectMap();
if (objectMap != null) { if (objectMap != null) {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
for (ContentChange contentChange : contentChangeList) { for (ContentChange contentChange : contentChangeList) {
Set<Object> set = objectMap.get(contentChange.type()); Collection<Object> objects = objectMap.get(contentChange.type());
// 所有需要处理的js等对象 // 所有需要处理的js等对象
if (set != null) { if (objects != null) {
for (Object ob : set) { for (Object ob : objects) {
fireChange(ob, contentChange, contentChangeItemList); fireChange(ob, contentChange, contentChangeItemList);
} }
} }

4
designer-base/src/main/java/com/fr/design/mod/impl/repalce/JavaScriptContentReplacer.java

@ -19,4 +19,8 @@ public class JavaScriptContentReplacer implements ContentReplacer<JavaScriptImpl
} }
} }
@Override
public boolean contain(JavaScriptImpl javaScript, String name) {
return ContentReplaceUtil.containsName(javaScript.getContent(), name);
}
} }

5
designer-base/src/main/java/com/fr/design/mod/impl/repalce/VanChartHtmlLabelContentReplacer.java

@ -19,4 +19,9 @@ public class VanChartHtmlLabelContentReplacer implements ContentReplacer<VanChar
ContentReplaceUtil.replaceContent(vanChartHtmlLabel.getCustomText(), oldName, newName)); ContentReplaceUtil.replaceContent(vanChartHtmlLabel.getCustomText(), oldName, newName));
} }
} }
@Override
public boolean contain(VanChartHtmlLabel vanChartHtmlLabel, String name) {
return ContentReplaceUtil.containsName(vanChartHtmlLabel.getCustomText(), name);
}
} }

29
designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java

@ -8,6 +8,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.web.struct.AssembleComponent; import com.fr.web.struct.AssembleComponent;
import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.BrowserType;
import com.teamdev.jxbrowser.chromium.JSValue; import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.LoadListener; import com.teamdev.jxbrowser.chromium.events.LoadListener;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
@ -18,11 +19,11 @@ import com.teamdev.jxbrowser.chromium.swing.BrowserView;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
import java.util.Map;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.Map;
/** /**
* @author richie * @author richie
@ -37,11 +38,11 @@ public class ModernUIPane<T> extends BasicPane {
private String variable = "data"; private String variable = "data";
private String expression = "update()"; private String expression = "update()";
private ModernUIPane() { private ModernUIPane(BrowserType browserType) {
initialize(); initialize(browserType);
} }
private void initialize() { private void initialize(BrowserType browserType) {
if (browser == null) { if (browser == null) {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
Assistant.addChromiumSwitches("--disable-google-traffic"); Assistant.addChromiumSwitches("--disable-google-traffic");
@ -76,10 +77,10 @@ public class ModernUIPane<T> extends BasicPane {
} }
}); });
Assistant.addChromiumSwitches("--remote-debugging-port=9222"); Assistant.addChromiumSwitches("--remote-debugging-port=9222");
initializeBrowser(); initializeBrowser(browserType);
add(new BrowserView(browser), BorderLayout.CENTER); add(new BrowserView(browser), BorderLayout.CENTER);
} else { } else {
initializeBrowser(); initializeBrowser(browserType);
add(new BrowserView(browser), BorderLayout.CENTER); add(new BrowserView(browser), BorderLayout.CENTER);
} }
} }
@ -97,8 +98,8 @@ public class ModernUIPane<T> extends BasicPane {
debugger.loadURL(browser.getRemoteDebuggingURL()); debugger.loadURL(browser.getRemoteDebuggingURL());
} }
private void initializeBrowser() { private void initializeBrowser(BrowserType browserType) {
browser = new Browser(); browser = new Browser(browserType);
// 初始化的时候,就把命名空间对象初始化好,确保window.a.b.c("a.b.c"为命名空间)对象都是初始化过的 // 初始化的时候,就把命名空间对象初始化好,确保window.a.b.c("a.b.c"为命名空间)对象都是初始化过的
browser.addScriptContextListener(new ScriptContextAdapter() { browser.addScriptContextListener(new ScriptContextAdapter() {
@Override @Override
@ -145,14 +146,22 @@ public class ModernUIPane<T> extends BasicPane {
public T update() { public T update() {
JSValue jsValue = browser.executeJavaScriptAndReturnValue("window." + namespace + "." + expression); JSValue jsValue = browser.executeJavaScriptAndReturnValue("window." + namespace + "." + expression);
if (jsValue.isObject()) { if (jsValue.isObject()) {
return (T)jsValue.asJavaObject(); return (T) jsValue.asJavaObject();
} }
return null; return null;
} }
public static class Builder<T> { public static class Builder<T> {
private ModernUIPane<T> pane = new ModernUIPane<>(); private ModernUIPane<T> pane;
public Builder() {
this(BrowserType.HEAVYWEIGHT);
}
public Builder(BrowserType browserType) {
this.pane = new ModernUIPane<>(browserType);
}
public Builder<T> prepare(ScriptContextListener contextListener) { public Builder<T> prepare(ScriptContextListener contextListener) {
pane.browser.addScriptContextListener(contextListener); pane.browser.addScriptContextListener(contextListener);

32
designer-base/src/main/java/com/fr/design/update/actions/SyncFileProcess.java

@ -2,22 +2,45 @@ package com.fr.design.update.actions;
import com.fr.decision.update.SyncExecutor; import com.fr.decision.update.SyncExecutor;
import com.fr.decision.update.info.UpdateCallBack; import com.fr.decision.update.info.UpdateCallBack;
import com.fr.decision.update.info.UpdateProgressCallBack;
import com.fr.design.i18n.Toolkit;
import com.fr.design.versioncheck.VersionCheckUtils;
import com.fr.env.SyncFailedPluginsDialog;
import com.fr.json.JSONArray;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import javax.swing.JProgressBar;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
public abstract class SyncFileProcess extends SwingWorker<Boolean, Void> { public abstract class SyncFileProcess extends SwingWorker<Boolean, Void> {
private UpdateCallBack callBack;
private String buildNo; private String buildNo;
private JProgressBar bar;
private SyncFailedPluginsDialog syncFailedPluginsDialog;
public SyncFileProcess(UpdateCallBack callBack,String buildNo) { public SyncFileProcess(JProgressBar bar, String buildNo, SyncFailedPluginsDialog syncFailedPluginsDialog) {
this.callBack = callBack; this.bar = bar;
this.buildNo = buildNo; this.buildNo = buildNo;
this.syncFailedPluginsDialog = syncFailedPluginsDialog;
} }
@Override @Override
protected Boolean doInBackground() throws Exception { protected Boolean doInBackground() throws Exception {
return SyncExecutor.getInstance().execute(callBack,buildNo); UpdateCallBack callBack = new UpdateProgressCallBack(bar);
bar.setValue(0);
bar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins"));
JSONArray syncFailedPlugins = VersionCheckUtils.syncPlugins(VersionCheckUtils.checkLocalAndRemotePlugin());
if (syncFailedPlugins.size() > 0) {
syncFailedPluginsDialog.showSyncFailedPluginsInfo(syncFailedPlugins);
}
RecoverForDesigner recoverForDesigner = new RecoverForDesigner();
if (!recoverForDesigner.backup()) {
return false;
}
boolean result = SyncExecutor.getInstance().execute(callBack, buildNo);
if (!result) {
recoverForDesigner.recover();
}
return result;
} }
@Override @Override
@ -38,6 +61,7 @@ public abstract class SyncFileProcess extends SwingWorker<Boolean, Void> {
} }
} }
/** /**
* 下载成功 * 下载成功
*/ */

34
designer-base/src/main/java/com/fr/design/VersionCheckUtils.java → designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java

@ -1,6 +1,7 @@
package com.fr.design; package com.fr.design.versioncheck;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.RemoteWorkspace; import com.fr.design.env.RemoteWorkspace;
@ -21,6 +22,7 @@ import com.fr.plugin.manage.control.PluginControllerHelper;
import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskCallback;
import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.PluginTaskResult;
import com.fr.plugin.manage.control.ProgressCallback; import com.fr.plugin.manage.control.ProgressCallback;
import com.fr.report.ReportHelper;
import com.fr.rpc.Result; import com.fr.rpc.Result;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -200,10 +202,7 @@ public class VersionCheckUtils {
} }
private static boolean needCheckBranch(DesignerWorkspaceInfo selectedEnv) { private static boolean needCheckBranch(DesignerWorkspaceInfo selectedEnv) {
if (selectedEnv.getType() == DesignerWorkspaceType.Remote) { return selectedEnv.getType() == DesignerWorkspaceType.Remote;
return true;
}
return false;
} }
public static JSONArray checkLocalAndRemotePlugin() { public static JSONArray checkLocalAndRemotePlugin() {
@ -215,21 +214,27 @@ public class VersionCheckUtils {
localPluginsMap.put(pluginContext.getID(), pluginContext); localPluginsMap.put(pluginContext.getID(), pluginContext);
} }
JSONObject remotePlugin; JSONObject remotePlugin;
Map<String, String> pluginsNameMap = ReportHelper.getPluginNameMap();
for (int i = 0; i < remotePlugins.size(); i++) { for (int i = 0; i < remotePlugins.size(); i++) {
remotePlugin = remotePlugins.getJSONObject(i); remotePlugin = remotePlugins.getJSONObject(i);
if (localPluginsMap.containsKey(remotePlugin.getString(ID))) { if (ComparatorUtils.equals(remotePlugin.getString("running"), "false")) {
if (ComparatorUtils.equals(localPluginsMap.get(remotePlugin.getString(ID)).getVersion(), remotePlugin.getString(VERSION))) { continue;
}
String remotePluginID = remotePlugin.getString(ID);
if (localPluginsMap.containsKey(remotePluginID)) {
if (ComparatorUtils.equals(localPluginsMap.get(remotePluginID).getVersion(), remotePlugin.getString(VERSION))) {
continue; continue;
} else { } else {
if (remotePlugin.getString(NAME) == null) { if (remotePlugin.getString(NAME) == null) {
remotePlugin.put(NAME, localPluginsMap.get(remotePlugin.getString(ID)).getName()); remotePlugin.put(NAME, localPluginsMap.get(remotePluginID).getName());
} }
remotePlugin.put("type", INCONSISTENCY); remotePlugin.put("type", INCONSISTENCY);
} }
} } else {
remotePlugin.put("type", MISSING); remotePlugin.put("type", MISSING);
if (remotePlugin.getString(NAME) == null) { if (remotePlugin.getString(NAME) == null) {
remotePlugin.put(NAME, remotePlugin.getString("id")); remotePlugin.put(NAME, pluginsNameMap.getOrDefault(remotePluginID, remotePluginID));
}
} }
differentPlugins.put(remotePlugin); differentPlugins.put(remotePlugin);
} }
@ -296,7 +301,7 @@ public class VersionCheckUtils {
return uninstallFailedID; return uninstallFailedID;
} }
private static JSONArray getPluginsSyncFailed(JSONArray differentPlugins){ private static JSONArray getPluginsSyncFailed(JSONArray differentPlugins) {
JSONArray pluginsNeedSync = JSONArray.create(); JSONArray pluginsNeedSync = JSONArray.create();
List<PluginContext> localPlugins = PluginManager.getContexts(); List<PluginContext> localPlugins = PluginManager.getContexts();
Map<String, String> localPluginsInfo = new HashMap<>(); Map<String, String> localPluginsInfo = new HashMap<>();
@ -326,6 +331,9 @@ public class VersionCheckUtils {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
latch.countDown(); latch.countDown();
if(result.isSuccess()) {
FineLoggerFactory.getLogger().info("installPlugin: " + result.getCurrentTask().getMarker().getPluginID());
}
} }
}); });
} }

120
designer-base/src/main/java/com/fr/env/CheckServiceDialog.java vendored

@ -1,10 +1,7 @@
package com.fr.env; package com.fr.env;
import com.fr.decision.update.data.UpdateConstants; import com.fr.decision.update.data.UpdateConstants;
import com.fr.decision.update.info.UpdateCallBack;
import com.fr.decision.update.info.UpdateProgressCallBack;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.VersionCheckUtils;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -15,6 +12,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.update.actions.SyncFileProcess; import com.fr.design.update.actions.SyncFileProcess;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.versioncheck.VersionCheckUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.CloudCenterConfig; import com.fr.general.CloudCenterConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -40,7 +38,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutionException;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JDialog; import javax.swing.JDialog;
@ -155,7 +152,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
detailsComponents = new Component[][]{{jarCheckTitleLabel}, {jarCheckResultLabel}, {affectedFunctionsLabel}, {affectedFunctionsDetailsPane}, {pluginCheckTitleLabel}, {pluginsCheckResultPanel}}; detailsComponents = new Component[][]{{jarCheckTitleLabel}, {jarCheckResultLabel}, {affectedFunctionsLabel}, {affectedFunctionsDetailsPane}, {pluginCheckTitleLabel}, {pluginsCheckResultPanel}};
hideAffectedFunctionsComponents = new Component[][]{{jarCheckTitleLabel}, {jarCheckResultLabel}, {affectedFunctionsLabel}, {pluginCheckTitleLabel}, {pluginsCheckResultPanel}}; hideAffectedFunctionsComponents = new Component[][]{{jarCheckTitleLabel}, {jarCheckResultLabel}, {affectedFunctionsLabel}, {pluginCheckTitleLabel}, {pluginsCheckResultPanel}};
if (noExistServiceDescription.size() > 0 && !ComparatorUtils.equals(remoteBranch, localBranch)) { if (noExistServiceDescription.size() > 0 && !ComparatorUtils.equals(remoteBranch, localBranch)) {
detailsRowSize = new double[]{p, p, p, p,p,p}; detailsRowSize = new double[]{p, p, p, p, p, p};
detailsInnerPane = TableLayoutHelper.createTableLayoutPane(detailsComponents, detailsRowSize, detailsColumnSize); detailsInnerPane = TableLayoutHelper.createTableLayoutPane(detailsComponents, detailsRowSize, detailsColumnSize);
} else { } else {
detailsRowSize = new double[]{p, p, 0, 0, p, p}; detailsRowSize = new double[]{p, p, 0, 0, p, p};
@ -311,51 +308,30 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
private MouseListener syncButtonClickListener = new MouseAdapter() { private MouseListener syncButtonClickListener = new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
ignoreButton.setEnabled(false);
String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")};
int a = FineJOptionPane.showOptionDialog(getParent(), Toolkit.i18nText("Fine-Design_Basic_Sync_Info_Information"), if (!jarConsistency) {
Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, IOUtils.readIcon("com/fr/design/icon/versioncheck/question.png"), option, 1); int a = FineJOptionPane.showOptionDialog(getParent(), Toolkit.i18nText("Fine-Design_Basic_Sync_Info_Information"),
if (0 == a) { Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, IOUtils.readIcon("com/fr/design/icon/versioncheck/question.png"), option, 1);
//jar包一致的话只更新插件 if (0 == a) {
UpdateCallBack callBack = new UpdateProgressCallBack(progressBar); progressBar.setVisible(true);
progressBar.setVisible(true); progressBar.setString(Toolkit.i18nText("Fine-Design_Update_Info_Wait_Message"));
progressBar.setString(Toolkit.i18nText("Fine-Design_Update_Info_Wait_Message")); syncButton.setEnabled(false);
syncButton.setEnabled(false);
if (!jarConsistency) {
deletePreviousPropertyFile(); deletePreviousPropertyFile();
final String installLib = StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LOGS_NAME, UpdateConstants.INSTALL_LIB); final String installLib = StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LOGS_NAME, UpdateConstants.INSTALL_LIB);
final JFrame frame = DesignerContext.getDesignerFrame(); final JFrame frame = DesignerContext.getDesignerFrame();
final RestartHelper helper = new RestartHelper(); final RestartHelper helper = new RestartHelper();
FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY);
new SyncFileProcess(callBack, remoteBuildNo) { SyncFailedPluginsDialog syncFailedPluginsDialog = new SyncFailedPluginsDialog(frame, JSONArray.create());
new SyncFileProcess(progressBar, remoteBuildNo, syncFailedPluginsDialog) {
@Override @Override
public void onDownloadSuccess() { public void onDownloadSuccess() {
deleteForDesignerUpdate(installLib); deleteForDesignerUpdate(installLib);
//主jar下载成功之后再卸载安装插件 progressBar.setVisible(false);
progressBar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins")); syncFailedPluginsDialog.showDialog();
progressBar.setValue(0); if (!syncFailedPluginsDialog.restartClicked()) {
new SwingWorker<JSONArray, Void>() { helper.restartForUpdate(frame);
}
@Override
protected JSONArray doInBackground() {
return VersionCheckUtils.syncPlugins(differentPlugins);
}
@Override
protected void done() {
progressBar.setVisible(false);
JSONArray syncFailedPlugins = null;
try {
syncFailedPlugins = get();
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
if (syncFailedPlugins != null && syncFailedPlugins.size() > 0) {
SyncFailedPluginsDialog syncFailedPluginsDialog = new SyncFailedPluginsDialog(DesignerContext.getDesignerFrame(), syncFailedPlugins);
syncFailedPluginsDialog.setVisible(true);
}
helper.restartForUpdate(frame);
}
}.execute();
} }
@Override @Override
@ -367,39 +343,39 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
helper.restartForUpdate(frame); helper.restartForUpdate(frame);
} }
}.execute(); }.execute();
} else { }
//到这边说明主jar是一致的,就只尝试同步插件 } else {
progressBar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins")); //到这边说明主jar是一致的,就只尝试同步插件
progressBar.setValue(0); new SwingWorker<JSONArray, Void>() {
new SwingWorker<JSONArray, Void>() {
@Override
@Override protected JSONArray doInBackground() {
protected JSONArray doInBackground() { progressBar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins"));
return VersionCheckUtils.syncPlugins(differentPlugins); progressBar.setValue(0);
return VersionCheckUtils.syncPlugins(differentPlugins);
}
@Override
protected void done() {
progressBar.setVisible(false);
JSONArray syncFailedPlugins = null;
try {
syncFailedPlugins = get();
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
} }
if (syncFailedPlugins != null && syncFailedPlugins.size() > 0) {
@Override SyncFailedPluginsDialog syncFailedPluginsDialog = new SyncFailedPluginsDialog(DesignerContext.getDesignerFrame(), syncFailedPlugins);
protected void done() { syncFailedPluginsDialog.setVisible(true);
progressBar.setVisible(false); } else {
JSONArray syncFailedPlugins = null; FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
try { Toolkit.i18nText("Fine-Design_Basic_Sync_Success"),
syncFailedPlugins = get(); Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
} catch (Exception ex) { FineJOptionPane.INFORMATION_MESSAGE);
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
if (syncFailedPlugins != null && syncFailedPlugins.size() > 0) {
SyncFailedPluginsDialog syncFailedPluginsDialog = new SyncFailedPluginsDialog(DesignerContext.getDesignerFrame(), syncFailedPlugins);
syncFailedPluginsDialog.setVisible(true);
} else {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Sync_Success"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
FineJOptionPane.INFORMATION_MESSAGE);
}
close();
} }
}.execute(); close();
} }
}.execute();
} }
} }
}; };

49
designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java vendored

@ -10,6 +10,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
@ -25,6 +26,7 @@ import java.util.Locale;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
@ -38,7 +40,12 @@ import javax.swing.UIManager;
public class SyncFailedPluginsDialog extends JDialog { public class SyncFailedPluginsDialog extends JDialog {
private UILabel detailsLabel; private UILabel detailsLabel;
private JScrollPane scrollPane; private JScrollPane scrollPane;
public SyncFailedPluginsDialog(Frame parent, JSONArray syncFailedPlugins) { private UITextArea detailsTextArea;
private JFrame frame = DesignerContext.getDesignerFrame();
private RestartHelper restartHelper = new RestartHelper();
private UIButton restartButton;
private boolean show;
public SyncFailedPluginsDialog(JFrame parent, JSONArray syncFailedPlugins) {
super(parent, true); super(parent, true);
JPanel body = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel body = FRGUIPaneFactory.createBorderLayout_L_Pane();
@ -70,19 +77,15 @@ public class SyncFailedPluginsDialog extends JDialog {
detailsTitlePanel.add(detailsLabel); detailsTitlePanel.add(detailsLabel);
detailsTitlePanel.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); detailsTitlePanel.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
UITextArea detailsTextArea = new UITextArea(); detailsTextArea = new UITextArea();
StringBuilder detailsText = new StringBuilder(StringUtils.EMPTY); detailsTextArea.setEditable(false);
for (int i = 0; i < syncFailedPlugins.size(); i++) { showSyncFailedPluginsInfo(syncFailedPlugins);
JSONObject plugin = syncFailedPlugins.getJSONObject(i);
detailsText.append(plugin.getString("name")).append(",").append(Toolkit.i18nText("Fine-Design_Basic_Sync_Server_Version")).append(plugin.getString("version")).append("\n");
}
detailsTextArea.setText(detailsText.toString());
scrollPane = new JScrollPane(detailsTextArea); scrollPane = new JScrollPane(detailsTextArea);
centerPanel.add(detailsTitlePanel,BorderLayout.NORTH); centerPanel.add(detailsTitlePanel,BorderLayout.NORTH);
centerPanel.add(scrollPane,BorderLayout.CENTER); centerPanel.add(scrollPane,BorderLayout.CENTER);
JPanel southPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); JPanel southPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
UIButton restartButton = new UIButton(Toolkit.i18nText("Fine-Design_Updater_Restart_Designer")); restartButton = new UIButton(Toolkit.i18nText("Fine-Design_Updater_Restart_Designer"));
restartButton.addMouseListener(restartButtonClickListener); restartButton.addMouseListener(restartButtonClickListener);
southPane.add(restartButton); southPane.add(restartButton);
@ -97,6 +100,27 @@ public class SyncFailedPluginsDialog extends JDialog {
GUICoreUtils.centerWindow(this); GUICoreUtils.centerWindow(this);
} }
public void showSyncFailedPluginsInfo(JSONArray syncFailedPlugins){
if(null == syncFailedPlugins){
return;
}
StringBuilder detailsText = new StringBuilder(StringUtils.EMPTY);
for (int i = 0; i < syncFailedPlugins.size(); i++) {
JSONObject plugin = syncFailedPlugins.getJSONObject(i);
detailsText.append(plugin.getString("name")).append(",").append(Toolkit.i18nText("Fine-Design_Basic_Sync_Server_Version")).append(plugin.getString("version")).append("\n");
}
detailsTextArea.setText(detailsText.toString());
if(!ComparatorUtils.equals(detailsLabel.getText(),StringUtils.EMPTY)){
show = true;
}
}
public void showDialog(){
if(show){
this.setVisible(true);
}
}
private MouseListener detailsLabelClickListener = new MouseAdapter() { private MouseListener detailsLabelClickListener = new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
@ -110,10 +134,15 @@ public class SyncFailedPluginsDialog extends JDialog {
} }
}; };
public boolean restartClicked(){
return !restartButton.isEnabled();
}
private MouseListener restartButtonClickListener = new MouseAdapter() { private MouseListener restartButtonClickListener = new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
RestartHelper.restartForUpdate(DesignerContext.getDesignerFrame()); restartButton.setEnabled(false);
restartHelper.restartForUpdate(frame);
} }
}; };
} }

2
designer-base/src/main/java/com/fr/env/VersionCheckMessageDialog.java vendored

@ -1,6 +1,6 @@
package com.fr.env; package com.fr.env;
import com.fr.design.VersionCheckUtils; import com.fr.design.versioncheck.VersionCheckUtils;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;

BIN
designer-base/src/main/resources/com/fr/design/images/dashboard/guide.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 704 B

After

Width:  |  Height:  |  Size: 308 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/lookandfeel/circularErrorIcon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

BIN
designer-base/src/main/resources/com/fr/design/images/lookandfeel/circularWarningIcon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

BIN
designer-base/src/main/resources/com/fr/design/images/lookandfeel/newMessageIcon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

2
designer-base/src/main/resources/com/fr/design/login/login.js

File diff suppressed because one or more lines are too long

5
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java

@ -20,8 +20,10 @@ import com.fr.plugin.chart.custom.CustomDefinition;
import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.plugin.chart.type.TextAlign; import com.fr.plugin.chart.type.TextAlign;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.org.apache.commons.lang3.SystemUtils;
import com.fr.van.chart.designer.PlotFactory; import com.fr.van.chart.designer.PlotFactory;
import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.BrowserType;
import com.teamdev.jxbrowser.chromium.JSValue; import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
@ -152,7 +154,8 @@ public class VanChartRichEditorPane {
} }
public static ModernUIPane<VanChartRichEditorModel> initPane(VanChartRichEditorModel model) { public static ModernUIPane<VanChartRichEditorModel> initPane(VanChartRichEditorModel model) {
return new ModernUIPane.Builder<VanChartRichEditorModel>() BrowserType type = SystemUtils.IS_OS_WINDOWS_10 ? BrowserType.LIGHTWEIGHT : BrowserType.HEAVYWEIGHT;
return new ModernUIPane.Builder<VanChartRichEditorModel>(type)
.prepare(new ScriptContextAdapter() { .prepare(new ScriptContextAdapter() {
public void onScriptContextCreated(ScriptContextEvent event) { public void onScriptContextCreated(ScriptContextEvent event) {
browser = event.getBrowser(); browser = event.getBrowser();

2
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextDialog.java

@ -10,7 +10,7 @@ import java.awt.Frame;
public class VanChartRichTextDialog extends BasicDialog { public class VanChartRichTextDialog extends BasicDialog {
public static final Dimension DEFAULT = new Dimension(960, 800); public static final Dimension DEFAULT = new Dimension(960, 700);
public VanChartRichTextDialog(Frame parent, BasicPane pane) { public VanChartRichTextDialog(Frame parent, BasicPane pane) {
super(parent, pane); super(parent, pane);

2
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichTextPane.java

@ -20,7 +20,7 @@ public class VanChartRichTextPane extends BasicBeanPane<AttrTooltipContent> {
private static final int FIELD_PANE_H = 270; private static final int FIELD_PANE_H = 270;
private static final int RICH_EDITOR_W = 940; private static final int RICH_EDITOR_W = 940;
private static final int RICH_EDITOR_H = 460; private static final int RICH_EDITOR_H = 400;
private VanChartFieldListPane fieldListPane; private VanChartFieldListPane fieldListPane;
private VanChartFieldAttrPane fieldAttrPane; private VanChartFieldAttrPane fieldAttrPane;

17
designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java

@ -112,6 +112,21 @@ public class XWTitleLayout extends DedicateLayoutContainer {
return null; return null;
} }
/**
* 返回body组件
* @return body组件
*/
public XCreator getBodyCreator() {
for (int i=0; i < getXCreatorCount(); i++) {
XCreator creator = getXCreator(i);
if (creator.hasTitleStyle()) {
return creator;
}
}
return null;
}
/** /**
* 编辑状态的时候需要重新绘制下边框 * 编辑状态的时候需要重新绘制下边框
* *
@ -196,4 +211,4 @@ public class XWTitleLayout extends DedicateLayoutContainer {
super.setShareId(shareId); super.setShareId(shareId);
this.getEditingChildCreator().setShareId(shareId); this.getEditingChildCreator().setShareId(shareId);
} }
} }

14
designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java

@ -1,13 +1,11 @@
package com.fr.design.designer.treeview; package com.fr.design.designer.treeview;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.iofile.attr.ExtendSharableAttrMark;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.form.ui.AbstractBorderStyleWidget; import com.fr.design.mainframe.share.util.ShareComponentUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
@ -38,7 +36,7 @@ public class ComponentTreeCellRenderer extends DefaultTreeCellRenderer {
} }
if (icon != null) { if (icon != null) {
setIcon(icon); setIcon(icon);
this.needAddShareIcon = isShareWidget((XCreator) value); this.needAddShareIcon = ShareComponentUtils.isShareWidgetWithChild((XCreator) value);
} }
} }
@ -47,14 +45,6 @@ public class ComponentTreeCellRenderer extends DefaultTreeCellRenderer {
return this; return this;
} }
private boolean isShareWidget(XCreator xCreator) {
if (!xCreator.toData().acceptType(AbstractBorderStyleWidget.class)) {
return false;
}
ExtendSharableAttrMark attrMark = ((AbstractBorderStyleWidget) xCreator.toData()).getWidgetAttrMark(ExtendSharableAttrMark.XML_TAG);
return attrMark != null && StringUtils.isNotEmpty(attrMark.getShareId());
}
public void paint(Graphics g) { public void paint(Graphics g) {
super.paint(g); super.paint(g);

14
designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java

@ -5,6 +5,7 @@ import com.fr.base.iofile.attr.ExtendSharableAttrMark;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.FormSelection; import com.fr.design.mainframe.FormSelection;
@ -91,6 +92,19 @@ public class ShareComponentUtils {
return false; return false;
} }
public static boolean isShareWidgetWithChild(XCreator xCreator) {
boolean result = isShareWidget(xCreator);
if (result) {
return true;
}
//做下兼容处理,老的组件结构的共享信息存储在子组件上
if (xCreator instanceof XWTitleLayout) {
XCreator child = ((XWTitleLayout) xCreator).getBodyCreator();
return isShareWidget(child);
}
return false;
}
public static List<XCreator> getHelpConfigXCreatorList(XCreator root) { public static List<XCreator> getHelpConfigXCreatorList(XCreator root) {
List<XCreator> helpConfigXCreatorList = new ArrayList<>(); List<XCreator> helpConfigXCreatorList = new ArrayList<>();

1
designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java

@ -178,6 +178,7 @@ public class DesignerAppUtils {
} else { } else {
UIExpandDialog.Builder().owner(DesignerContext.getDesignerFrame()) UIExpandDialog.Builder().owner(DesignerContext.getDesignerFrame())
.title(Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")) .title(Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"))
.cancelText(StringUtils.EMPTY)
.message(Toolkit.i18nText("Fine-Design_Template_Plugin_Error_Message_Remote")) .message(Toolkit.i18nText("Fine-Design_Template_Plugin_Error_Message_Remote"))
.detail(detail) .detail(detail)
.build() .build()

26
designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java

@ -1,5 +1,6 @@
package com.fr.design.share.ui.generate; package com.fr.design.share.ui.generate;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -11,11 +12,14 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.share.Bean.ComponentGenerateInfo; import com.fr.design.mainframe.share.Bean.ComponentGenerateInfo;
import com.fr.design.mainframe.share.action.ShareUIAspect; import com.fr.design.mainframe.share.action.ShareUIAspect;
import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.exception.LackOfValueException; import com.fr.design.mainframe.share.exception.LackOfValueException;
import com.fr.design.mainframe.share.generate.ComponentGeneratorCenter; import com.fr.design.mainframe.share.generate.ComponentGeneratorCenter;
import com.fr.design.mainframe.share.select.ComponentTransformerFactory;
import com.fr.design.mod.ContentObjectManager;
import com.fr.form.share.exception.NetWorkFailedException; import com.fr.form.share.exception.NetWorkFailedException;
import com.fr.form.share.group.DefaultShareGroup; import com.fr.form.share.group.DefaultShareGroup;
import com.fr.design.mainframe.share.util.ShareUIUtils; import com.fr.design.mainframe.share.util.ShareUIUtils;
@ -31,6 +35,8 @@ import com.fr.form.ui.Widget;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.util.HashSet;
import java.util.Set;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
@ -100,8 +106,9 @@ public class ShareGeneratePane extends BasicPane {
JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.mainPane = FRGUIPaneFactory.createCardLayout_S_Pane(); this.mainPane = FRGUIPaneFactory.createCardLayout_S_Pane();
this.simplePane = new ShareMainPane(shareCover, rec, false, effectItemGroups); boolean needContentTip = needContentTip();
this.uploadPane = new ShareMainPane(shareCover, rec, true, effectItemGroups); this.simplePane = new ShareMainPane(shareCover, rec, false, effectItemGroups, needContentTip);
this.uploadPane = new ShareMainPane(shareCover, rec, true, effectItemGroups, needContentTip);
//暂时换一下,目前不用上传 //暂时换一下,目前不用上传
this.mainPane.add(simplePane, ShareUIUtils.convertStateChange(ItemEvent.DESELECTED)); this.mainPane.add(simplePane, ShareUIUtils.convertStateChange(ItemEvent.DESELECTED));
this.mainPane.add(uploadPane, ShareUIUtils.convertStateChange(ItemEvent.SELECTED)); this.mainPane.add(uploadPane, ShareUIUtils.convertStateChange(ItemEvent.SELECTED));
@ -161,6 +168,21 @@ public class ShareGeneratePane extends BasicPane {
} }
} }
private boolean needContentTip() {
long start = System.currentTimeMillis();
XCreator xCreator = ComponentTransformerFactory.getInstance().transform(WidgetPropertyPane.getInstance().getEditingFormDesigner().getSelectionModel().getSelection()).getMiddle();
Set<XCreator> xCreators = new HashSet<>();
xCreator.traversalNameRelatedXCreators(xCreators);
Set<String> nameSet = new HashSet<>();
for (XCreator creator : xCreators) {
nameSet.add(creator.toData().getWidgetName());
}
boolean result = ContentObjectManager.getInstance().needContentTip(shareWidget, nameSet);
FineLoggerFactory.getLogger().debug("needContentTip spend {} ms", (System.currentTimeMillis() - start));
return result;
}
private JPanel createUploadCheckBox() { private JPanel createUploadCheckBox() {
JPanel panel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); JPanel panel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();

13
designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java

@ -131,13 +131,15 @@ public class ShareMainPane extends JPanel {
private boolean upload; private boolean upload;
private List<EffectItemGroup> effectItemGroups; private List<EffectItemGroup> effectItemGroups;
private final boolean needContentTip;
public ShareMainPane(Image shareCover, Rectangle rec, boolean upload, List<EffectItemGroup> effectItemGroups) { public ShareMainPane(Image shareCover, Rectangle rec, boolean upload, List<EffectItemGroup> effectItemGroups, boolean needContentTip) {
this.shareCover = shareCover; this.shareCover = shareCover;
this.rec = rec; this.rec = rec;
this.upload = upload; this.upload = upload;
this.effectItemGroups = effectItemGroups; this.effectItemGroups = effectItemGroups;
this.needContentTip = needContentTip;
initCover(shareCover); initCover(shareCover);
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -174,7 +176,14 @@ public class ShareMainPane extends JPanel {
private JPanel createOverviewPane(boolean upload) { private JPanel createOverviewPane(boolean upload) {
JPanel componentPane = createComponentOverviewPane(upload); JPanel componentPane = createComponentOverviewPane(upload);
String title = Toolkit.i18nText("Fine-Design_Share_Overview"); String title = Toolkit.i18nText("Fine-Design_Share_Overview");
JPanel overviewPane = FRGUIPaneFactory.createTitledBorderPane(title); JPanel overviewPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(title);
if (needContentTip) {
UILabel tipsLabel = ShareUIUtils.createTipsLabel(Toolkit.i18nText("Fine-Design_Share_Generate_Content_Tip"));
tipsLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
JPanel panel = new JPanel(FRGUIPaneFactory.createBorderLayout());
panel.add(tipsLabel);
overviewPane.add(panel, BorderLayout.NORTH);
}
overviewPane.add(componentPane, BorderLayout.CENTER); overviewPane.add(componentPane, BorderLayout.CENTER);
return overviewPane; return overviewPane;

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

@ -165,7 +165,6 @@ public class DesignerActivator extends Activator implements Prepare {
storePassport(); storePassport();
AlphaFineHelper.switchConfig4Locale(); AlphaFineHelper.switchConfig4Locale();
RecoverManager.register(new RecoverForDesigner()); RecoverManager.register(new RecoverForDesigner());
ContentReplacerCenter.getInstance().register();
pushUpdateTask.run(); pushUpdateTask.run();
} }
@ -437,9 +436,10 @@ public class DesignerActivator extends Activator implements Prepare {
manager.setDesignerLoginUsername(MarketConfig.getInstance().getBbsUsername()); manager.setDesignerLoginUsername(MarketConfig.getInstance().getBbsUsername());
manager.setDesignerLoginAppId(MarketConfig.getInstance().getBbsAppId()); manager.setDesignerLoginAppId(MarketConfig.getInstance().getBbsAppId());
manager.setDesignerLoginRefreshToken(MarketConfig.getInstance().getBbsRefreshToken()); manager.setDesignerLoginRefreshToken(MarketConfig.getInstance().getBbsRefreshToken());
manager.setCurrentVersionFirstLaunch(false); manager.setDesignerLastLoginTime(System.currentTimeMillis());
manager.setLastLoginType(DesignerLoginType.NORMAL_LOGIN); manager.setLastLoginType(DesignerLoginType.NORMAL_LOGIN);
manager.setLastLoginAccount(MarketConfig.getInstance().getBbsUsername()); manager.setLastLoginAccount(MarketConfig.getInstance().getBbsUsername());
manager.setCurrentVersionFirstLaunch(false);
DesignerEnvManager.getEnvManager().saveXMLFile(); DesignerEnvManager.getEnvManager().saveXMLFile();
} }
} }
@ -454,5 +454,6 @@ public class DesignerActivator extends Activator implements Prepare {
@Override @Override
public void prepare() { public void prepare() {
LoginAuthServer.getInstance().start(); LoginAuthServer.getInstance().start();
ContentReplacerCenter.getInstance().register();
} }
} }

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

@ -2,7 +2,6 @@ package com.fr.start.module;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.EnvChangeEntrance; import com.fr.design.EnvChangeEntrance;
import com.fr.design.VersionCheckUtils;
import com.fr.design.constants.DesignerLaunchStatus; import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.editlock.ConnectionLockChangeChecker; import com.fr.design.editlock.ConnectionLockChangeChecker;
import com.fr.design.editlock.ServerTableDataLockChangeChecker; import com.fr.design.editlock.ServerTableDataLockChangeChecker;
@ -10,6 +9,7 @@ import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.LocalDesignerWorkspaceInfo; import com.fr.design.env.LocalDesignerWorkspaceInfo;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.versioncheck.VersionCheckUtils;
import com.fr.env.TestConnectionResult; import com.fr.env.TestConnectionResult;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;

Loading…
Cancel
Save