hzzz 7 years ago
parent
commit
c3ac7c01bb
  1. 1
      designer-base/pom.xml
  2. 4
      designer-base/src/com/fr/design/actions/community/BBSAction.java
  3. 4
      designer-base/src/com/fr/design/actions/community/BugAction.java
  4. 4
      designer-base/src/com/fr/design/actions/community/NeedAction.java
  5. 4
      designer-base/src/com/fr/design/actions/community/QuestionAction.java
  6. 4
      designer-base/src/com/fr/design/actions/community/SignAction.java
  7. 4
      designer-base/src/com/fr/design/actions/community/UpAction.java
  8. 6
      designer-base/src/com/fr/design/actions/community/VideoAction.java
  9. 25
      designer-base/src/com/fr/design/actions/core/ActionFactory.java
  10. 2
      designer-base/src/com/fr/design/actions/file/WebPreviewUtils.java
  11. 16
      designer-base/src/com/fr/design/actions/help/AboutPane.java
  12. 4
      designer-base/src/com/fr/design/actions/help/ForumAction.java
  13. 7
      designer-base/src/com/fr/design/actions/help/TutorialAction.java
  14. 15
      designer-base/src/com/fr/design/border/UIRoundedBorder.java
  15. 11
      designer-base/src/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  16. 3
      designer-base/src/com/fr/design/data/datapane/preview/PreviewTablePane.java
  17. 15
      designer-base/src/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  18. 10
      designer-base/src/com/fr/design/extra/LoginWebBridge.java
  19. 4
      designer-base/src/com/fr/design/extra/PluginOperateUtils.java
  20. 8
      designer-base/src/com/fr/design/extra/PluginUtils.java
  21. 10
      designer-base/src/com/fr/design/extra/PluginWebBridge.java
  22. 6
      designer-base/src/com/fr/design/extra/PluginsReaderFromStore.java
  23. 2
      designer-base/src/com/fr/design/extra/QQLoginWebPane.java
  24. 4
      designer-base/src/com/fr/design/extra/WebViewDlgHelper.java
  25. 4
      designer-base/src/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java
  26. 4
      designer-base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java
  27. 4
      designer-base/src/com/fr/design/extra/exe/GetPluginPrefixExecutor.java
  28. 4
      designer-base/src/com/fr/design/extra/exe/SearchOnlineExecutor.java
  29. 6
      designer-base/src/com/fr/design/extra/ucenter/Client.java
  30. 8
      designer-base/src/com/fr/design/file/HistoryTemplateListPane.java
  31. 3
      designer-base/src/com/fr/design/gui/UIDefaultTheme.java
  32. 83
      designer-base/src/com/fr/design/gui/iprogressbar/ModernUIProgressBarUI.java
  33. 80
      designer-base/src/com/fr/design/gui/iprogressbar/ProgressDialog.java
  34. 4
      designer-base/src/com/fr/design/gui/iprogressbar/UIProgressBarUI.java
  35. 96
      designer-base/src/com/fr/design/gui/iprogressbar/UIProgressBorder.java
  36. 5
      designer-base/src/com/fr/design/hyperlink/WebHyperNorthPane.java
  37. 6
      designer-base/src/com/fr/design/mainframe/DesignerFrame.java
  38. 6
      designer-base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  39. 8
      designer-base/src/com/fr/design/mainframe/EastRegionContainerPane.java
  40. 6
      designer-base/src/com/fr/design/mainframe/TemplatePane.java
  41. 20
      designer-base/src/com/fr/design/mainframe/loghandler/LogMessageBar.java
  42. 92
      designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java
  43. 6
      designer-base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java
  44. 3
      designer-base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  45. 8
      designer-base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java
  46. 102
      designer-base/src/com/fr/design/module/DesignModule.java
  47. 2
      designer-base/src/com/fr/design/utils/DesignUtils.java
  48. 8
      designer-base/src/com/fr/env/RemoteEnvPane.java
  49. 31
      designer-base/src/com/fr/start/BaseDesigner.java
  50. 4
      designer-base/src/com/fr/start/server/FineEmbedServerActivator.java
  51. 50
      designer-chart/src/com/fr/design/ChartTypeInterfaceManager.java
  52. 30
      designer-chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  53. 14
      designer-chart/src/com/fr/design/mainframe/chart/gui/style/ChartFillStylePane.java
  54. 90
      designer-chart/src/com/fr/design/module/ChartDesignerModule.java
  55. 22
      designer-chart/src/com/fr/design/module/ChartPreStyleManagerPane.java
  56. 6
      designer-chart/src/com/fr/van/chart/DownloadOnlineSourcesHelper.java
  57. 4
      designer-chart/src/com/fr/van/chart/gantt/designer/style/axis/GanttTimeAxisPane.java
  58. 12
      designer-form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java
  59. 6
      designer-form/src/com/fr/design/designer/creator/XCreator.java
  60. 8
      designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
  61. 3
      designer-form/src/com/fr/design/designer/creator/XWFitLayout.java
  62. 56
      designer-form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  63. 4
      designer-form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java
  64. 4
      designer-form/src/com/fr/design/mainframe/FormWidgetDetailPane.java
  65. 1
      designer-form/src/com/fr/design/mainframe/JForm.java
  66. 105
      designer-form/src/com/fr/design/module/FormDesignerModule.java
  67. 4
      designer-form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  68. 36
      designer-form/src/com/fr/start/Designer4Form.java
  69. 7
      designer-realize/pom.xml
  70. 4
      designer-realize/src/com/fr/design/actions/file/export/AbstractExportAction.java
  71. 4
      designer-realize/src/com/fr/design/mainframe/ActiveKeyGenerator.java
  72. 6
      designer-realize/src/com/fr/design/mainframe/CellElementPropertyPane.java
  73. 6
      designer-realize/src/com/fr/design/mainframe/InformationCollector.java
  74. 20
      designer-realize/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java
  75. 4
      designer-realize/src/com/fr/design/mainframe/bbs/BBSConstants.java
  76. 4
      designer-realize/src/com/fr/design/mainframe/bbs/BBSDialog.java
  77. 12
      designer-realize/src/com/fr/design/mainframe/bbs/BBSLoginDialog.java
  78. 8
      designer-realize/src/com/fr/design/mainframe/bbs/UserInfoLabel.java
  79. 8
      designer-realize/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java
  80. 501
      designer-realize/src/com/fr/design/module/DesignerModule.java
  81. 4
      designer-realize/src/com/fr/design/report/share/ShareButton.java
  82. 45
      designer-realize/src/com/fr/poly/PolyDesignUI.java
  83. 10
      designer-realize/src/com/fr/start/CollectUserInformationDialog.java
  84. 30
      designer-realize/src/com/fr/start/Designer.java
  85. 10
      designer-realize/src/com/fr/start/fx/FastGifImage.java
  86. 720
      designer-realize/src/com/fr/start/module/DesignerModuleActivator.java
  87. 20
      designer-realize/src/com/fr/start/module/DesignerStartup.java
  88. 3
      designer-realize/src/com/fr/start/module/DesignerWorkspaceProvider.java
  89. 3
      designer-realize/src/com/fr/start/module/EnvBasedModule.java
  90. 11
      designer-realize/src/com/fr/start/module/PreStartActivator.java
  91. 1
      pom.xml

1
designer-base/pom.xml

@ -15,7 +15,6 @@
<version>0.7.0</version> <version>0.7.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
<groupId>com.fr.report</groupId>
<artifactId>designer-base</artifactId> <artifactId>designer-base</artifactId>
<version>10.0-RELEASE-SNAPSHOT</version> <version>10.0-RELEASE-SNAPSHOT</version>
</project> </project>

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

@ -5,7 +5,7 @@ import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -36,7 +36,7 @@ public class BBSAction extends UpdateAction
@Override @Override
public void actionPerformed(ActionEvent arg0) public void actionPerformed(ActionEvent arg0)
{ {
String url = SiteCenter.getInstance().acquireUrlByKind("bbs"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs");
if (StringUtils.isEmpty(url)) { if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!"); FRContext.getLogger().info("The URL is empty!");
return; return;

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

@ -4,8 +4,8 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -30,7 +30,7 @@ public class BugAction extends UpdateAction
@Override @Override
public void actionPerformed(ActionEvent arg0) public void actionPerformed(ActionEvent arg0)
{ {
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.bugs"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs.bugs");
if (StringUtils.isEmpty(url)) { if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!"); FRContext.getLogger().info("The URL is empty!");
return; return;

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

@ -4,8 +4,8 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -31,7 +31,7 @@ public class NeedAction extends UpdateAction
@Override @Override
public void actionPerformed(ActionEvent arg0) public void actionPerformed(ActionEvent arg0)
{ {
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.needs"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs.needs");
if (StringUtils.isEmpty(url)) { if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!"); FRContext.getLogger().info("The URL is empty!");
return; return;

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

@ -4,8 +4,8 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -30,7 +30,7 @@ public class QuestionAction extends UpdateAction
@Override @Override
public void actionPerformed(ActionEvent arg0) public void actionPerformed(ActionEvent arg0)
{ {
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.questions"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs.questions");
if (StringUtils.isEmpty(url)) { if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!"); FRContext.getLogger().info("The URL is empty!");
return; return;

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

@ -5,7 +5,7 @@ import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -31,7 +31,7 @@ public class SignAction extends UpdateAction
@Override @Override
public void actionPerformed(ActionEvent arg0) public void actionPerformed(ActionEvent arg0)
{ {
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.aut"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs.aut");
if (StringUtils.isEmpty(url)) { if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!"); FRContext.getLogger().info("The URL is empty!");
return; return;

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

@ -5,7 +5,7 @@ import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -31,7 +31,7 @@ public class UpAction extends UpdateAction
@Override @Override
public void actionPerformed(ActionEvent arg0) public void actionPerformed(ActionEvent arg0)
{ {
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.update"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs.update");
if (StringUtils.isEmpty(url)) { if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!"); FRContext.getLogger().info("The URL is empty!");
return; return;

6
designer-base/src/com/fr/design/actions/community/VideoAction.java

@ -5,7 +5,7 @@ import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -34,9 +34,9 @@ public class VideoAction extends UpdateAction
{ {
String url; String url;
if (FRContext.getLocale().equals(Locale.US)) { if (FRContext.getLocale().equals(Locale.US)) {
url = SiteCenter.getInstance().acquireUrlByKind("bbs.video.en"); url = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en");
} else { } else {
url = SiteCenter.getInstance().acquireUrlByKind("bbs.video"); url = CloudCenter.getInstance().acquireUrlByKind("bbs.video");
} }
if (StringUtils.isEmpty(url)) { if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!"); FRContext.getLogger().info("The URL is empty!");

25
designer-base/src/com/fr/design/actions/core/ActionFactory.java

@ -9,7 +9,8 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.design.selection.QuickEditor; import com.fr.design.selection.QuickEditor;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import javax.swing.*; import javax.swing.Action;
import javax.swing.KeyStroke;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.ArrayList; import java.util.ArrayList;
@ -139,28 +140,6 @@ public class ActionFactory {
chartPreStyleAction = action; chartPreStyleAction = action;
} }
/**
* kunsnat: 图表注册 悬浮元素编辑器 , 因为ChartCollection和ChartQuickEditor一个在Chart,一个在Designer, 所以分开注册.
*
* @param editorClass 悬浮元素图表编辑器类
*/
public static void registerChartFloatEditorInEditor(Class<? extends QuickEditor> editorClass) {
if (chartCollectionClass != null) {
registerFloatEditorClass(chartCollectionClass, editorClass);
}
}
/**
* kunsnat: 图表注册 单元格元素编辑器 , 因为ChartCollecion和ChartQuickEditor一个在Chart,一个在Designer, 所以分开注册.
*
* @param editorClass 单元格元素图表编辑器类
*/
public static void registerChartCellEditorInEditor(Class<? extends QuickEditor> editorClass) {
if (chartCollectionClass != null) {
registerCellEditorClass(chartCollectionClass, editorClass);
}
}
/** /**
* 图表预定义样式Action * 图表预定义样式Action
* *

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

@ -20,7 +20,7 @@ import java.util.Map;
public final class WebPreviewUtils { public final class WebPreviewUtils {
public static void preview(JTemplate<?, ?> jt) { public static void preview(JTemplate<?, ?> jt) {
preview(jt, null); preview(jt, jt.getPreviewType());
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

16
designer-base/src/com/fr/design/actions/help/AboutPane.java

@ -9,9 +9,9 @@ import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
@ -33,7 +33,7 @@ public class AboutPane extends JPanel {
private static final int DEFAULT_GAP = 12; private static final int DEFAULT_GAP = 12;
private static final String COPYRIGHT_LABEL = "\u00A9 "; private static final String COPYRIGHT_LABEL = "\u00A9 ";
private static final String BUILD_PREFIX = " "; private static final String BUILD_PREFIX = " ";
private static final String COMPANY_TELEPHONE = SiteCenter.getInstance().acquireUrlByKind("company_telephone"); private static final String COMPANY_TELEPHONE = CloudCenter.getInstance().acquireUrlByKind("company_telephone");
public AboutPane() { public AboutPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -71,11 +71,11 @@ public class AboutPane extends JPanel {
addPhoneAndQQPane(contentPane); addPhoneAndQQPane(contentPane);
// 官网 // 官网
JPanel urlActionPane = getURLActionPane(Inter.getLocText("FR-Designer_Official_Website"), SiteCenter.getInstance().acquireUrlByKind("website." + FRContext.getLocale(), ProductConstants.WEBSITE_URL)); JPanel urlActionPane = getURLActionPane(Inter.getLocText("FR-Designer_Official_Website"), CloudCenter.getInstance().acquireUrlByKind("website." + FRContext.getLocale(), ProductConstants.WEBSITE_URL));
// 支持邮箱 // 支持邮箱
String defaultEmail = SiteCenter.getInstance().acquireUrlByKind("support.email", ProductConstants.SUPPORT_EMAIL); String defaultEmail = CloudCenter.getInstance().acquireUrlByKind("support.email", ProductConstants.SUPPORT_EMAIL);
JPanel emailPane = getEmailActionPane(Inter.getLocText("FR-Designer_Support_Email"),SiteCenter.getInstance().acquireUrlByKind("support.email." + FRContext.getLocale(), defaultEmail)); JPanel emailPane = getEmailActionPane(Inter.getLocText("FR-Designer_Support_Email"), CloudCenter.getInstance().acquireUrlByKind("support.email." + FRContext.getLocale(), defaultEmail));
contentPane.add(urlActionPane); contentPane.add(urlActionPane);
contentPane.add(emailPane); contentPane.add(emailPane);
@ -90,13 +90,13 @@ public class AboutPane extends JPanel {
if (FRContext.getLocale().equals(Locale.US)) { if (FRContext.getLocale().equals(Locale.US)) {
return; return;
} }
boxCenterAlignmentPane = new BoxCenterAligmentPane(Inter.getLocText("FR-Designer_Service_Phone") + SiteCenter.getInstance().acquireUrlByKind("service.phone." + FRContext.getLocale(), COMPANY_TELEPHONE)); boxCenterAlignmentPane = new BoxCenterAligmentPane(Inter.getLocText("FR-Designer_Service_Phone") + CloudCenter.getInstance().acquireUrlByKind("service.phone." + FRContext.getLocale(), COMPANY_TELEPHONE));
contentPane.add(boxCenterAlignmentPane); contentPane.add(boxCenterAlignmentPane);
// 繁体版不显示QQ // 繁体版不显示QQ
if (FRContext.getLocale().equals(Locale.TAIWAN)) { if (FRContext.getLocale().equals(Locale.TAIWAN)) {
return; return;
} }
boxCenterAlignmentPane = new BoxCenterAligmentPane("QQ: " + SiteCenter.getInstance().acquireUrlByKind("help.qq")); boxCenterAlignmentPane = new BoxCenterAligmentPane("QQ: " + CloudCenter.getInstance().acquireUrlByKind("help.qq"));
contentPane.add(boxCenterAlignmentPane); contentPane.add(boxCenterAlignmentPane);
} }
@ -133,7 +133,7 @@ public class AboutPane extends JPanel {
private String getCopyRight() { private String getCopyRight() {
return append(Inter.getLocText("FR-Designer_About_CopyRight"), COPYRIGHT_LABEL, return append(Inter.getLocText("FR-Designer_About_CopyRight"), COPYRIGHT_LABEL,
ProductConstants.HISTORY, StringUtils.BLANK, SiteCenter.getInstance().acquireUrlByKind("company.name", ProductConstants.COMPANY_NAME)); ProductConstants.HISTORY, StringUtils.BLANK, CloudCenter.getInstance().acquireUrlByKind("company.name", ProductConstants.COMPANY_NAME));
} }
private String getBuildTitle() { private String getBuildTitle() {

4
designer-base/src/com/fr/design/actions/help/ForumAction.java

@ -9,7 +9,7 @@ import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -40,7 +40,7 @@ public class ForumAction extends UpdateAction {
* @param e 事件 * @param e 事件
*/ */
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
String url = SiteCenter.getInstance().acquireUrlByKind("bbs"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs");
if (StringUtils.isEmpty(url)) { if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!"); FRContext.getLogger().info("The URL is empty!");
return; return;

7
designer-base/src/com/fr/design/actions/help/TutorialAction.java

@ -6,7 +6,6 @@ import java.awt.event.KeyEvent;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.Locale;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
@ -15,12 +14,10 @@ import com.fr.base.FRContext;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.ComparatorUtils; import com.fr.general.CloudCenter;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
public class TutorialAction extends UpdateAction { public class TutorialAction extends UpdateAction {
@ -59,7 +56,7 @@ public class TutorialAction extends UpdateAction {
* @param evt 事件 * @param evt 事件
*/ */
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
String helpURL = SiteCenter.getInstance().acquireUrlByKind("help." + FRContext.getLocale()); String helpURL = CloudCenter.getInstance().acquireUrlByKind("help." + FRContext.getLocale());
if (helpURL != null) { if (helpURL != null) {
HttpClient client = new HttpClient(helpURL); HttpClient client = new HttpClient(helpURL);

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

@ -1,5 +1,8 @@
package com.fr.design.border; package com.fr.design.border;
import com.fr.base.GraphHelper;
import javax.swing.border.LineBorder;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Graphics; import java.awt.Graphics;
@ -7,10 +10,6 @@ import java.awt.Graphics2D;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
import javax.swing.border.LineBorder;
import com.fr.base.GraphHelper;
public class UIRoundedBorder extends LineBorder { public class UIRoundedBorder extends LineBorder {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -37,6 +36,14 @@ public class UIRoundedBorder extends LineBorder {
this.roundedCorner = roundedCorners; this.roundedCorner = roundedCorners;
} }
public int getRoundedCorner() {
return roundedCorner;
}
public int getLineStyle() {
return lineStyle;
}
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height){ public void paintBorder(Component c, Graphics g, int x, int y, int width, int height){
Color oldColor = g.getColor(); Color oldColor = g.getColor();

11
designer-base/src/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java

@ -36,6 +36,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
private UIButton okButton; private UIButton okButton;
private UIButton cancelButton; private UIButton cancelButton;
private JDialog dialog; private JDialog dialog;
private UILabel uiLabel;
// Database pane // Database pane
public DatabaseConnectionPane() { public DatabaseConnectionPane() {
@ -46,6 +47,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
originalCharSetComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY); originalCharSetComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY);
newCharSetComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY); newCharSetComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY);
message = new UILabel(); message = new UILabel();
uiLabel = new UILabel();
okButton = new UIButton(Inter.getLocText("OK")); okButton = new UIButton(Inter.getLocText("OK"));
cancelButton = new UIButton(Inter.getLocText("Cancel")); cancelButton = new UIButton(Inter.getLocText("Cancel"));
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -113,6 +115,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
ActionListener testConnectionActionListener = new ActionListener() { ActionListener testConnectionActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
// Try the java connection. // Try the java connection.
final SwingWorker connectionThread = new SwingWorker() { final SwingWorker connectionThread = new SwingWorker() {
protected Object doInBackground() throws Exception { protected Object doInBackground() throws Exception {
@ -121,6 +124,11 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
boolean connect = DataOperator.getInstance().testConnection(database); boolean connect = DataOperator.getInstance().testConnection(database);
okButton.setEnabled(true); okButton.setEnabled(true);
message.setText(database.connectMessage(connect)); message.setText(database.connectMessage(connect));
if (connect) {
uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon"));
}else{
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
}
} catch (Exception exp) { } catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} }
@ -165,7 +173,8 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
JPanel jp = new JPanel(); JPanel jp = new JPanel();
JPanel upPane = new JPanel(); JPanel upPane = new JPanel();
JPanel downPane = new JPanel(); JPanel downPane = new JPanel();
UILabel uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon")); uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon"));
upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
upPane.add(uiLabel); upPane.add(uiLabel);
upPane.add(message); upPane.add(message);

3
designer-base/src/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -390,7 +390,8 @@ public class PreviewTablePane extends BasicPane {
} catch (Exception e) { } catch (Exception e) {
if (!(e instanceof CancellationException)) { if (!(e instanceof CancellationException)) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage()); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(),
null, 0, UIManager.getIcon("OptionPane.errorIcon"));
} }
dialog.setVisible(false); dialog.setVisible(false);
} finally { } finally {

15
designer-base/src/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java

@ -61,6 +61,8 @@ import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -205,7 +207,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
private ActionListener testConnectionListener = new ActionListener() { private ActionListener testConnectionListener = new ActionListener() {
public void actionPerformed(ActionEvent arg0) { public void actionPerformed(ActionEvent arg0) {
String uri = urlText.getText(); String uri = ParameterHelper.analyze4Templatee( urlText.getText(), params);
if (!checkURL(uri)) { if (!checkURL(uri)) {
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(FileTableDataPane.this), Inter.getLocText("FR-Designer_Add_JS_warning")); JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(FileTableDataPane.this), Inter.getLocText("FR-Designer_Add_JS_warning"));
return; return;
@ -219,7 +221,8 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
} }
if (in == null) { if (in == null) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Datasource-Connection_failed")); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Datasource-Connection_failed"),
null, 0, UIManager.getIcon("OptionPane.errorIcon"));
} else { } else {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Datasource-Connection_successfully")); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Datasource-Connection_successfully"));
try { try {
@ -318,7 +321,13 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
} }
private boolean checkURL(String uri){ private boolean checkURL(String uri){
return (uri.matches("https*://.+|\\$\\{.+\\}.*")); try {
new URL(uri);
return true;
} catch (MalformedURLException e) {
return false;
}
// return (uri.matches("https*://.+|\\$\\{.+\\}.*"));
} }
private JPanel textSetPanel(int width,int height) { private JPanel textSetPanel(int width,int height) {

10
designer-base/src/com/fr/design/extra/LoginWebBridge.java

@ -8,8 +8,8 @@ import com.fr.design.extra.exe.PluginLoginExecutor;
import com.fr.design.extra.ucenter.Client; import com.fr.design.extra.ucenter.Client;
import com.fr.design.extra.ucenter.XMLHelper; import com.fr.design.extra.ucenter.XMLHelper;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
@ -134,7 +134,7 @@ public class LoginWebBridge {
* @return * @return
*/ */
private boolean testConnection() { private boolean testConnection() {
HttpClient client = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("bbs.test")); HttpClient client = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("bbs.test"));
return client.isServerAlive(); return client.isServerAlive();
} }
@ -159,7 +159,7 @@ public class LoginWebBridge {
*/ */
public void registerHref() { public void registerHref() {
try { try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.register"))); Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.register")));
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().info(e.getMessage()); FRContext.getLogger().info(e.getMessage());
} }
@ -170,7 +170,7 @@ public class LoginWebBridge {
*/ */
public void forgetHref() { public void forgetHref() {
try { try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.reset"))); Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.reset")));
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().info(e.getMessage()); FRContext.getLogger().info(e.getMessage());
} }
@ -300,7 +300,7 @@ public class LoginWebBridge {
//账号没有QQ授权 //账号没有QQ授权
closeQQWindow(); closeQQWindow();
try { try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("QQ_binding"))); Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("QQ_binding")));
} catch (Exception ignored) { } catch (Exception ignored) {
// ignored // ignored
} }

4
designer-base/src/com/fr/design/extra/PluginOperateUtils.java

@ -11,7 +11,7 @@ import com.fr.design.extra.exe.callback.UpdateFromDiskCallback;
import com.fr.design.extra.exe.callback.UpdateOnlineCallback; import com.fr.design.extra.exe.callback.UpdateOnlineCallback;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
@ -108,7 +108,7 @@ public class PluginOperateUtils {
} }
public static String getRecommendPlugins() { public static String getRecommendPlugins() {
String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.feature"); String plistUrl = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.feature");
JSONArray resultArray = JSONArray.create(); JSONArray resultArray = JSONArray.create();
try { try {
HttpClient httpClient = new HttpClient(plistUrl); HttpClient httpClient = new HttpClient(plistUrl);

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

@ -1,8 +1,8 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.TemplateUtils; import com.fr.base.TemplateUtils;
import com.fr.general.CloudCenter;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
@ -15,6 +15,7 @@ import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.io.File; import java.io.File;
@ -35,6 +36,7 @@ import java.util.Map;
public class PluginUtils { public class PluginUtils {
private static final String ERROR_CODE_I18N_PREFIX = "FR-Plugin_Error_"; private static final String ERROR_CODE_I18N_PREFIX = "FR-Plugin_Error_";
public static final String FR_VERSION = "fr_version";
public static PluginMarker createPluginMarker(String pluginInfo) { public static PluginMarker createPluginMarker(String pluginInfo) {
@ -46,7 +48,7 @@ public class PluginUtils {
public static JSONObject getLatestPluginInfo(String pluginID) throws Exception { public static JSONObject getLatestPluginInfo(String pluginID) throws Exception {
String result = ""; String result = "";
String plistUrl = SiteCenter.getInstance().acquireUrlByKind("plugin.searchAPI"); String plistUrl = CloudCenter.getInstance().acquireUrlByKind("plugin.searchAPI");
if (StringUtils.isNotEmpty(plistUrl)) { if (StringUtils.isNotEmpty(plistUrl)) {
StringBuilder url = new StringBuilder(plistUrl); StringBuilder url = new StringBuilder(plistUrl);
if (StringUtils.isNotBlank(pluginID)) { if (StringUtils.isNotBlank(pluginID)) {
@ -109,7 +111,7 @@ public class PluginUtils {
private static String getDownloadPath(String id) throws Exception { private static String getDownloadPath(String id) throws Exception {
HashMap<String, String> map = new HashMap<String, String>(); HashMap<String, String> map = new HashMap<String, String>();
map.put("id", id); map.put("id", id);
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("shop.plugin.scripts_10")); HttpClient httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("shop.script.download")+ "?" + FR_VERSION + "=" + ProductConstants.VERSION);
httpClient.asGet(); httpClient.asGet();
String resText = httpClient.getResponseText(); String resText = httpClient.getResponseText();
JSONObject resultJSONObject = new JSONObject(resText); JSONObject resultJSONObject = new JSONObject(resText);

10
designer-base/src/com/fr/design/extra/PluginWebBridge.java

@ -15,7 +15,7 @@ import com.fr.design.extra.exe.callback.JSCallback;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -437,7 +437,7 @@ public class PluginWebBridge {
*/ */
public void getPriviteMessage() { public void getPriviteMessage() {
try { try {
String loginUrl = SiteCenter.getInstance().acquireUrlByKind("bbs.default"); String loginUrl = CloudCenter.getInstance().acquireUrlByKind("bbs.default");
Desktop.getDesktop().browse(new URI(loginUrl)); Desktop.getDesktop().browse(new URI(loginUrl));
} catch (Exception exp) { } catch (Exception exp) {
FineLoggerFactory.getLogger().info(exp.getMessage()); FineLoggerFactory.getLogger().info(exp.getMessage());
@ -500,7 +500,7 @@ public class PluginWebBridge {
*/ */
public void registerHref() { public void registerHref() {
try { try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.register"))); Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.register")));
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().info(e.getMessage()); FineLoggerFactory.getLogger().info(e.getMessage());
} }
@ -514,7 +514,7 @@ public class PluginWebBridge {
*/ */
public void forgetHref() { public void forgetHref() {
try { try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.reset"))); Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.reset")));
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().info(e.getMessage()); FineLoggerFactory.getLogger().info(e.getMessage());
} }
@ -559,7 +559,7 @@ public class PluginWebBridge {
uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn")); uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn"));
} }
public void updatePluginStore(final JSObject callback){ public void getPackInfo(final JSObject callback){
JSCallback jsCallback = new JSCallback(webEngine, callback); JSCallback jsCallback = new JSCallback(webEngine, callback);
jsCallback.execute(StringUtils.EMPTY); jsCallback.execute(StringUtils.EMPTY);
} }

6
designer-base/src/com/fr/design/extra/PluginsReaderFromStore.java

@ -1,8 +1,8 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONException; import com.fr.json.JSONException;
@ -32,7 +32,7 @@ public class PluginsReaderFromStore {
public static List<PluginView> readPlugins() throws Exception { public static List<PluginView> readPlugins() throws Exception {
String resText; String resText;
try { try {
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.store")); HttpClient httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("plugin.store"));
resText = httpClient.getResponseText(); resText = httpClient.getResponseText();
String charSet = EncodeConstants.ENCODING_UTF_8; String charSet = EncodeConstants.ENCODING_UTF_8;
resText = URLDecoder.decode(URLDecoder.decode(resText, charSet), charSet); resText = URLDecoder.decode(URLDecoder.decode(resText, charSet), charSet);
@ -49,7 +49,7 @@ public class PluginsReaderFromStore {
*/ */
public static List<PluginView> readPluginsForUpdate() throws Exception { public static List<PluginView> readPluginsForUpdate() throws Exception {
String resText = null; String resText = null;
String url = SiteCenter.getInstance().acquireUrlByKind("plugin.update"); String url = CloudCenter.getInstance().acquireUrlByKind("plugin.update");
if (StringUtils.isNotEmpty(url)) { if (StringUtils.isNotEmpty(url)) {
HashMap<String, String> para = new HashMap<String, String>(); HashMap<String, String> para = new HashMap<String, String>();
para.put("plugins", PluginUtils.transPluginsToString(PluginManager.getContexts())); para.put("plugins", PluginUtils.transPluginsToString(PluginManager.getContexts()));

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

@ -102,7 +102,7 @@ public class QQLoginWebPane extends JFXPanel {
public void changed(ObservableValue<? extends String> observable, final String oldValue, String newValue) { public void changed(ObservableValue<? extends String> observable, final String oldValue, String newValue) {
disableLink(webEngine); disableLink(webEngine);
// webView好像默认以手机版显示网页,浏览器里过滤掉这个跳转 // webView好像默认以手机版显示网页,浏览器里过滤掉这个跳转
if (ComparatorUtils.equals(newValue, url) || ComparatorUtils.equals(newValue, SiteCenter.getInstance().acquireUrlByKind("bbs.mobile"))) { if (ComparatorUtils.equals(newValue, url) || ComparatorUtils.equals(newValue, CloudCenter.getInstance().acquireUrlByKind("bbs.mobile"))) {
return; return;
} }
LoginWebBridge.getHelper().openUrlAtLocalWebBrowser(webEngine, newValue); LoginWebBridge.getHelper().openUrlAtLocalWebBrowser(webEngine, newValue);

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

@ -10,7 +10,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -296,7 +296,7 @@ public class WebViewDlgHelper {
new SwingWorker<Void, Void>() { new SwingWorker<Void, Void>() {
@Override @Override
protected Void doInBackground() throws Exception { protected Void doInBackground() throws Exception {
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("shop.plugin.cv_10") + "&version=" + PluginStoreConstants.getInstance().getProps("VERSION")); HttpClient httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("shop.plugin.update") + "?" + PluginUtils.FR_VERSION + "=" + ProductConstants.VERSION + "&version=" + PluginStoreConstants.getInstance().getProps("VERSION"));
httpClient.asGet(); httpClient.asGet();
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
String text = httpClient.getResponseText(); String text = httpClient.getResponseText();

4
designer-base/src/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java

@ -2,7 +2,7 @@ package com.fr.design.extra.exe;
import com.fr.design.extra.PluginConstants; import com.fr.design.extra.PluginConstants;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
/** /**
@ -27,7 +27,7 @@ public class GetPluginCategoriesExecutor implements Executor {
@Override @Override
public void run(Process<String> process) { public void run(Process<String> process) {
String url = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.category"); String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.category");
if (url != null) { if (url != null) {
HttpClient httpClient = new HttpClient(url); HttpClient httpClient = new HttpClient(url);
result = httpClient.getResponseText(); result = httpClient.getResponseText();

4
designer-base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java

@ -4,7 +4,7 @@ import com.fr.design.extra.PluginConstants;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginUtils;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
@ -52,7 +52,7 @@ public class GetPluginFromStoreExecutor implements Executor {
@Override @Override
public void run(Process<String> process) { public void run(Process<String> process) {
String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.plist") + "?"; String plistUrl = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.plist") + "?";
boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee) && StringUtils.isEmpty(scope); boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee) && StringUtils.isEmpty(scope);
if (getRecommend) { if (getRecommend) {
result = PluginOperateUtils.getRecommendPlugins(); result = PluginOperateUtils.getRecommendPlugins();

4
designer-base/src/com/fr/design/extra/exe/GetPluginPrefixExecutor.java

@ -1,7 +1,7 @@
package com.fr.design.extra.exe; package com.fr.design.extra.exe;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
/** /**
@ -26,7 +26,7 @@ public class GetPluginPrefixExecutor implements Executor {
@Override @Override
public void run(Process<String> process) { public void run(Process<String> process) {
result = SiteCenter.getInstance().acquireUrlByKind("plugin.url.prefix"); result = CloudCenter.getInstance().acquireUrlByKind("plugin.url.prefix");
} }
} }
}; };

4
designer-base/src/com/fr/design/extra/exe/SearchOnlineExecutor.java

@ -3,7 +3,7 @@ package com.fr.design.extra.exe;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginUtils;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
@ -42,7 +42,7 @@ public class SearchOnlineExecutor implements Executor {
result = PluginOperateUtils.getRecommendPlugins(); result = PluginOperateUtils.getRecommendPlugins();
return; return;
} }
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("shop.plugin.store") + "&keyword=" + keyword); HttpClient httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("shop.plugin.store") + "&keyword=" + keyword);
httpClient.asGet(); httpClient.asGet();
String responseText = httpClient.getResponseText(); String responseText = httpClient.getResponseText();
JSONObject jsonObject = new JSONObject(responseText); JSONObject jsonObject = new JSONObject(responseText);

6
designer-base/src/com/fr/design/extra/ucenter/Client.java

@ -1,7 +1,7 @@
package com.fr.design.extra.ucenter; package com.fr.design.extra.ucenter;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
@ -92,8 +92,8 @@ public class Client extends AbstractClient {
sep = "&"; sep = "&";
} }
String postData = ucApiRequestdata(module, action, str.toString(), ""); String postData = ucApiRequestdata(module, action, str.toString(), "");
UC_API = SiteCenter.getInstance().acquireUrlByKind("bbs.ucapi"); UC_API = CloudCenter.getInstance().acquireUrlByKind("bbs.ucapi");
UC_IP = SiteCenter.getInstance().acquireUrlByKind("bbs.ip"); UC_IP = CloudCenter.getInstance().acquireUrlByKind("bbs.ip");
return ucFopen2(UC_API + "/index.php", 500000, postData, "", true, UC_IP, 20, true); return ucFopen2(UC_API + "/index.php", 500000, postData, "", true, UC_IP, 20, true);
} }

8
designer-base/src/com/fr/design/file/HistoryTemplateListPane.java

@ -43,18 +43,22 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C
private JTemplate<?, ?> editingTemplate; private JTemplate<?, ?> editingTemplate;
private FileToolbarStateChangeListener toobarStateChangeListener; private FileToolbarStateChangeListener toobarStateChangeListener;
private static HistoryTemplateListPane THIS; private static volatile HistoryTemplateListPane THIS;
private UIList list; private UIList list;
public static final HistoryTemplateListPane getInstance() { public static final HistoryTemplateListPane getInstance() {
if (THIS == null) {
synchronized (HistoryTemplateListPane.class) {
if (THIS == null) { if (THIS == null) {
THIS = new HistoryTemplateListPane(); THIS = new HistoryTemplateListPane();
} }
}
}
return THIS; return THIS;
} }
public HistoryTemplateListPane() { private HistoryTemplateListPane() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
historyList = new ArrayList<JTemplate<?, ?>>(); historyList = new ArrayList<JTemplate<?, ?>>();
list = new UIList(new HistoryListDataMode()) { list = new UIList(new HistoryListDataMode()) {

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

@ -1,6 +1,7 @@
package com.fr.design.gui; package com.fr.design.gui;
import com.fr.design.constants.UIConstants;
import com.fr.design.utils.ThemeUtils; import com.fr.design.utils.ThemeUtils;
import javax.swing.*; import javax.swing.*;
@ -79,6 +80,8 @@ public class UIDefaultTheme extends DefaultMetalTheme {
table.put("TableHeader.background", new ColorUIResource(229, 229, 229)); table.put("TableHeader.background", new ColorUIResource(229, 229, 229));
table.put("ProgressBar.foreground", ThemeUtils.PROCESS_COLOR); table.put("ProgressBar.foreground", ThemeUtils.PROCESS_COLOR);
table.put("ProgressBar.background", ThemeUtils.TEXT_BG_COLOR); table.put("ProgressBar.background", ThemeUtils.TEXT_BG_COLOR);
table.put("ProgressBar.modern.foreground", new ColorUIResource(0x3497FF));
table.put("ProgressBar.modern.background", UIConstants.PROPERTY_PANE_BACKGROUND);
table.put("ProgressBar.selectionForeground", ThemeUtils.NORMAL_FOREGROUND); table.put("ProgressBar.selectionForeground", ThemeUtils.NORMAL_FOREGROUND);
table.put("ProgressBar.selectionBackground", ThemeUtils.NORMAL_FOREGROUND); table.put("ProgressBar.selectionBackground", ThemeUtils.NORMAL_FOREGROUND);
table.put("PopupMenu.background", ThemeUtils.NORMAL_BG); table.put("PopupMenu.background", ThemeUtils.NORMAL_BG);

83
designer-base/src/com/fr/design/gui/iprogressbar/ModernUIProgressBarUI.java

@ -0,0 +1,83 @@
package com.fr.design.gui.iprogressbar;
import com.fr.design.utils.ThemeUtils;
import javax.swing.LookAndFeel;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.RoundRectangle2D;
/**
* 新进度条UI(暂时只处理了非模糊场景)
* Created by zack on 2018/6/21.
*/
public class ModernUIProgressBarUI extends UIProgressBarUI {
// draw determinate
@Override
protected void drawXpHorzProgress(Graphics g, int x, int y,
int w, int h, int amountFull) {
Graphics2D g2d = (Graphics2D) g;
g2d.translate(x, y);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
if (!progressBar.isOpaque()) {
//绘制进度条背板
g2d.setColor(progressBar.getBackground());
RoundRectangle2D roundedRectangle = new RoundRectangle2D.Float(0, 0, w, h, 10, 10);
g2d.fill(roundedRectangle);
}
//
g2d.setColor(progressBar.getForeground());
int mx = 0;
while (mx < amountFull) {
RoundRectangle2D roundedRectangle = new RoundRectangle2D.Float(0, 0, amountFull, h, 10, 10);
g2d.fill(roundedRectangle);
mx += 8;
}
g2d.translate(-x, -y);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
// draw determinate
@Override
protected void drawXpVertProgress(Graphics g, int x, int y,
int w, int h, int amountFull) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.translate(x, y);
// paint the track
if (!progressBar.isOpaque()) {
g.setColor(progressBar.getBackground());
RoundRectangle2D roundedRectangle = new RoundRectangle2D.Float(0, 0, w, h, 10, 10);
g2d.fill(roundedRectangle);
}
// paints bottom to top...
int my = 0;
while (my < amountFull) {
RoundRectangle2D roundedRectangle = new RoundRectangle2D.Float(0, 0, w, amountFull, 10, 10);
g2d.fill(roundedRectangle);
my += 8;
}
g.translate(-x, -y);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
@Override
protected Color getSelectionForeground() {
return ThemeUtils.PROCESS_SELECTED_FORECOLOR;
}
@Override
protected Color getSelectionBackground() {
return ThemeUtils.PROCESS_SELECTED_BACKCOLOR;
}
@Override
protected void installDefaults() {
LookAndFeel.installBorder(progressBar, "ProgressBar.border");
LookAndFeel.installColorsAndFont(progressBar,
"ProgressBar.modern.background", "ProgressBar.modern.foreground", "ProgressBar.font");
}
}

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

@ -0,0 +1,80 @@
package com.fr.design.gui.iprogressbar;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.plaf.ColorUIResource;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Frame;
/**
* 加载进度弹窗
*/
public class ProgressDialog extends UIDialog {
private JProgressBar progressBar;
private JDialog centerDialog;
private JLabel text;
public ProgressDialog(Frame parent) {
super(parent);
setUndecorated(true);
setSize(parent.getSize());
setLocationRelativeTo(null);
setOpacity(0.5f);
initComponent();
}
private void initComponent() {
centerDialog = new JDialog(this);
centerDialog.setSize(new Dimension(482, 124));
centerDialog.setUndecorated(true);
GUICoreUtils.centerWindow(centerDialog);
JPanel panel = new JPanel();
panel.setBorder(new UIProgressBorder(3, UIConstants.DEFAULT_BG_RULER, 14, 46, 47, 37, 47));
panel.setLayout(new BorderLayout(4, 15));
progressBar = new JProgressBar();
progressBar.setUI(new ModernUIProgressBarUI());
progressBar.setBorderPainted(false);
progressBar.setOpaque(false);
progressBar.setBorder(null);
panel.add(progressBar, BorderLayout.CENTER);
text = new UILabel(Inter.getLocText("Fine-Designer_Loading_Project"), JLabel.CENTER);
FRFont font = FRFont.getInstance().applySize(14).applyForeground(new ColorUIResource(333334));
text.setFont(font);
panel.add(text, BorderLayout.SOUTH);
panel.setVisible(true);
centerDialog.getContentPane().add(panel);
}
@Override
public void checkValid() throws Exception {
}
@Override
public void setVisible(boolean b) {
centerDialog.setVisible(b);
super.setVisible(b);
}
public void setProgressValue(int value) {
progressBar.setValue(value);
}
@Override
public void dispose() {
centerDialog.dispose();
super.dispose();
}
}

4
designer-base/src/com/fr/design/gui/iprogressbar/UIProgressBarUI.java

@ -74,7 +74,7 @@ public class UIProgressBarUI extends BasicProgressBarUI {
} }
// draw determinate // draw determinate
private void drawXpHorzProgress(Graphics g, int x, int y, protected void drawXpHorzProgress(Graphics g, int x, int y,
int w, int h, int amountFull) { int w, int h, int amountFull) {
g.translate(x, y); g.translate(x, y);
if (!progressBar.isOpaque()) { if (!progressBar.isOpaque()) {
@ -124,7 +124,7 @@ public class UIProgressBarUI extends BasicProgressBarUI {
// draw determinate // draw determinate
private void drawXpVertProgress(Graphics g, int x, int y, protected void drawXpVertProgress(Graphics g, int x, int y,
int w, int h, int amountFull) { int w, int h, int amountFull) {
g.translate(x, y); g.translate(x, y);
// paint the track // paint the track

96
designer-base/src/com/fr/design/gui/iprogressbar/UIProgressBorder.java

@ -0,0 +1,96 @@
package com.fr.design.gui.iprogressbar;
import com.fr.design.border.UIRoundedBorder;
import com.fr.stable.OperatingSystem;
import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.RenderingHints;
import java.awt.geom.RoundRectangle2D;
/**
* 进度条带阴影的边框
*/
public class UIProgressBorder extends UIRoundedBorder {
private int left;
private int right;
private int top;
private int bottom;
private static final long serialVersionUID = 1L;
public UIProgressBorder(Color color) {
super(color);
}
public UIProgressBorder(Color color, int thickness) {
super(color, thickness);
}
public UIProgressBorder(Color color, int thickness, int roundedCorners) {
super(color, thickness, roundedCorners);
}
public UIProgressBorder(int lineStyle, Color color, int roundedCorners) {
super(lineStyle, color, roundedCorners);
}
public UIProgressBorder(int lineStyle, Color color, int roundedCorners, int top, int left, int bottom, int right) {
super(lineStyle, color, roundedCorners);
this.top = top;
this.right = right;
this.bottom = bottom;
this.left = left;
}
@Override
public Insets getBorderInsets(Component c) {
Insets insets = new Insets(top, left, bottom, right);
return insets;
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Color oldColor = g.getColor();
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(getLineColor());
g2d.fill(new RoundRectangle2D.Double(x, y, width, height, 0, 0));
g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
if(OperatingSystem.isWindows()){//mac下自带阴影
paintBorderShadow(g2d, 7, x, y, width, height);
}
g2d.setColor(oldColor);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1f));
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
private void paintBorderShadow(Graphics2D g2, int shadowWidth, int x, int y, int width, int height) {
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
shadowWidth = Math.max(shadowWidth, 2);
int sw = shadowWidth;
for (int i = sw; i > 0; i--) {
float pct = (float) (sw - i) / (sw - 1);
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.01f * i));
g2.setColor(getMixedColor(Color.LIGHT_GRAY, 1.0f - pct, Color.WHITE, pct));
g2.setStroke(new BasicStroke(i));
g2.draw(new RoundRectangle2D.Double(x, y, width, height, getRoundedCorner(), getRoundedCorner()));
}
}
private static Color getMixedColor(Color c1, float pct1, Color c2, float pct2) {
float[] clr1 = c1.getComponents(null);
float[] clr2 = c2.getComponents(null);
for (int i = 0; i < clr1.length; i++) {
clr1[i] = (clr1[i] * pct1) + (clr2[i] * pct2);
}
return new Color(clr1[0], clr1[1], clr1[2], clr1[3]);
}
}

5
designer-base/src/com/fr/design/hyperlink/WebHyperNorthPane.java

@ -3,6 +3,7 @@ package com.fr.design.hyperlink;
import com.fr.config.ServerPreferenceConfig; import com.fr.config.ServerPreferenceConfig;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
@ -47,11 +48,9 @@ public class WebHyperNorthPane extends AbstractHyperNorthPane<WebHyperlink> {
protected JPanel setHeaderPanel() { protected JPanel setHeaderPanel() {
JPanel headerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel headerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
urlTextField = new UITextField(43); urlTextField = new UITextField(headerPane.getWidth());
urlTextField.setText(ProductConstants.WEBSITE_URL); urlTextField.setText(ProductConstants.WEBSITE_URL);
//UILabel label = new UILabel(Inter.getLocText(new String[]{"Example","Or"}, new String[]{":http://www.baidu.com","/main.jsp"}));
JPanel urlWithHelp = GUICoreUtils.createNamedPane(urlTextField, "URL:"); JPanel urlWithHelp = GUICoreUtils.createNamedPane(urlTextField, "URL:");
if (this.needRenamePane) { if (this.needRenamePane) {

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

@ -23,6 +23,7 @@ import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.fun.TitlePlaceProcessor;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.gui.imenu.UIMenuHighLight;
import com.fr.design.gui.iprogressbar.ProgressDialog;
import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.iscrollbar.UIScrollBar;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -192,6 +193,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
closeButton.repaint(); closeButton.repaint();
} }
}; };
private ProgressDialog progressDialog;
public DesignerFrame(ToolBarMenuDock ad) { public DesignerFrame(ToolBarMenuDock ad) {
@ -269,6 +271,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
this.setDropTarget(new DropTarget(this, DnDConstants.ACTION_MOVE, new FileDropTargetListener(), true)); this.setDropTarget(new DropTarget(this, DnDConstants.ACTION_MOVE, new FileDropTargetListener(), true));
closeMode = UIConstants.CLOSE_OF_AUTHORITY; closeMode = UIConstants.CLOSE_OF_AUTHORITY;
initMenuPane(); initMenuPane();
this.progressDialog = new ProgressDialog(this);
} }
/** /**
@ -1049,4 +1052,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
} }
public ProgressDialog getProgressDialog() {
return progressDialog;
}
} }

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

@ -53,7 +53,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
private static final String FILE = "file"; private static final String FILE = "file";
private static DesignerFrameFileDealerPane THIS; private static volatile DesignerFrameFileDealerPane THIS;
private CardLayout card; private CardLayout card;
@ -84,9 +84,13 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public static final DesignerFrameFileDealerPane getInstance() { public static final DesignerFrameFileDealerPane getInstance() {
if (THIS == null) {
synchronized (DesignerFrameFileDealerPane.class) {
if (THIS == null) { if (THIS == null) {
THIS = new DesignerFrameFileDealerPane(); THIS = new DesignerFrameFileDealerPane();
} }
}
}
return THIS; return THIS;
} }

8
designer-base/src/com/fr/design/mainframe/EastRegionContainerPane.java

@ -30,7 +30,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
public class EastRegionContainerPane extends UIEastResizableContainer { public class EastRegionContainerPane extends UIEastResizableContainer {
private static EastRegionContainerPane THIS; private static volatile EastRegionContainerPane THIS;
private Map<String, PropertyItem> propertyItemMap; private Map<String, PropertyItem> propertyItemMap;
private CardLayout propertyCard; private CardLayout propertyCard;
private JPanel leftPane; private JPanel leftPane;
@ -83,14 +83,18 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
* @return * @return
*/ */
public static EastRegionContainerPane getInstance() { public static EastRegionContainerPane getInstance() {
if (THIS == null) {
synchronized (EastRegionContainerPane.class) {
if (THIS == null) { if (THIS == null) {
THIS = new EastRegionContainerPane(); THIS = new EastRegionContainerPane();
THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastEastRegionContainerWidth()); THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastEastRegionContainerWidth());
} }
}
}
return THIS; return THIS;
} }
public EastRegionContainerPane() { private EastRegionContainerPane() {
super(); super();
initPropertyItemList(); initPropertyItemList();
defaultPane = getDefaultPane(Inter.getLocText("FR-Designer_No_Settings_Available")); defaultPane = getDefaultPane(Inter.getLocText("FR-Designer_No_Settings_Available"));

6
designer-base/src/com/fr/design/mainframe/TemplatePane.java

@ -137,7 +137,8 @@ public class TemplatePane extends JPanel implements MouseListener {
@Override @Override
public void fail() { public void fail() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"})); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}),
null, 0, UIManager.getIcon("OptionPane.errorIcon"));
} }
@Override @Override
@ -152,7 +153,8 @@ public class TemplatePane extends JPanel implements MouseListener {
} }
setJLabel(selectedName); setJLabel(selectedName);
} catch (Exception e) { } catch (Exception e) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"})); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}),
null, 0, UIManager.getIcon("OptionPane.errorIcon"));
return false; return false;
} }
TemplateTreePane.getInstance().refreshDockingView(); TemplateTreePane.getInstance().refreshDockingView();

20
designer-base/src/com/fr/design/mainframe/loghandler/LogMessageBar.java

@ -1,28 +1,30 @@
package com.fr.design.mainframe.loghandler; package com.fr.design.mainframe.loghandler;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JFrame;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class LogMessageBar extends JPanel { public class LogMessageBar extends JPanel {
private UILabel messageLabel; private UILabel messageLabel;
private int width = 600; private int width = 600;
public static LogMessageBar THIS; public static volatile LogMessageBar THIS;
private JFrame dlg = new LogDetailPane().showDialog(); private JFrame dlg = new LogDetailPane().showDialog();
public static LogMessageBar getInstance() { public static LogMessageBar getInstance() {
if (THIS == null) {
synchronized (LogMessageBar.class) {
if (THIS == null) { if (THIS == null) {
THIS = new LogMessageBar(); THIS = new LogMessageBar();
} }
}
}
return THIS; return THIS;
} }
@ -32,7 +34,7 @@ public class LogMessageBar extends JPanel {
return bar; return bar;
} }
public LogMessageBar() { private LogMessageBar() {
messageLabel = new UILabel(); messageLabel = new UILabel();
setLayout(new BorderLayout()); setLayout(new BorderLayout());
add(messageLabel, BorderLayout.CENTER); add(messageLabel, BorderLayout.CENTER);

92
designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java

@ -1,92 +0,0 @@
package com.fr.design.mainframe.loghandler.socketio;
import com.fr.design.mainframe.loghandler.DesignerLogHandler;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.general.LogRecordTime;
import com.fr.general.LogUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.third.guava.base.Optional;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent;
import io.socket.client.Socket;
import io.socket.emitter.Emitter;
import java.io.ByteArrayInputStream;
public class DesignerSocketIO {
private static Optional<Socket> socketIO = Optional.absent();
private static final Emitter.Listener printLog = new Emitter.Listener() {
@Override
public void call(Object... objects) {
try {
LogRecordTime[] logRecordTimes = LogUtils.readXMLLogRecords(new ByteArrayInputStream((byte[]) objects[0]));
for (LogRecordTime logRecordTime : logRecordTimes) {
DesignerLogHandler.getInstance().printRemoteLog(logRecordTime);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
};
static {
EventDispatcher.listen(WorkspaceEvent.BeforeSwitch, new Listener<Workspace>() {
@Override
public void on(Event event, Workspace param) {
if (socketIO.isPresent()) {
socketIO.get().close();
socketIO = Optional.absent();
}
}
});
EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener<Workspace>() {
@Override
public void on(Event event, Workspace param) {
updateSocket();
}
});
}
public static void init() {
updateSocket();
}
private static void updateSocket() {
if (WorkContext.getCurrent().isLocal()) {
return;
}
try {
// RemoteEnvConfig config = ((RemoteEnv)env).getEnvConfig();
// String uri = String.format("http://%s:%s%s?%s=%s",
// config.getHost(),
// WebSocketConfig.getInstance().getPort(),
// EnvConstants.WS_NAMESPACE,
// DecisionServiceConstants.WEB_SOCKET_TOKEN_NAME,
// EnvContext.currentToken());
//
// socketIO = Optional.of(IO.socket(new URI(uri)));
// socketIO.get().on(EnvConstants.WS_LOGRECORD, printLog);
// socketIO.get().on(EnvConstants.CONFIG, new Emitter.Listener() {
// @Override
// public void call(Object... objects) {
// if (objects == null || objects.length != 1) {
// throw new IllegalArgumentException("config should have only one param");
// }
// Object param = objects[0];
// if (param instanceof Class) {
// EventDispatcher.fire(ConfigEvent.EDIT, (Class<? extends Configuration>) param);
// }
// }
// });
// socketIO.get().connect();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}

6
designer-base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java

@ -10,7 +10,7 @@ import com.fr.design.mainframe.SiteCenterToken;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -305,8 +305,8 @@ public class TemplateInfoCollector<T extends BaseBook> implements Serializable,
*/ */
public void sendTemplateInfo() { public void sendTemplateInfo() {
addDayCount(); addDayCount();
String consumingUrl = SiteCenter.getInstance().acquireUrlByKind("tempinfo.consuming") + "/single"; String consumingUrl = CloudCenter.getInstance().acquireUrlByKind("tempinfo.consuming") + "/single";
String processUrl = SiteCenter.getInstance().acquireUrlByKind("tempinfo.process") + "/single"; String processUrl = CloudCenter.getInstance().acquireUrlByKind("tempinfo.process") + "/single";
ArrayList<HashMap<String, String>> completeTemplatesInfo = getCompleteTemplatesInfo(); ArrayList<HashMap<String, String>> completeTemplatesInfo = getCompleteTemplatesInfo();
for (HashMap<String, String> templateInfo : completeTemplatesInfo) { for (HashMap<String, String> templateInfo : completeTemplatesInfo) {
String jsonConsumingMap = templateInfo.get(JSON_CONSUMING_MAP); String jsonConsumingMap = templateInfo.get(JSON_CONSUMING_MAP);

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

@ -439,8 +439,7 @@ public abstract class ToolBarMenuDock {
} }
private boolean shouldShowPlugin() { private boolean shouldShowPlugin() {
return WorkContext.getCurrent().isLocal() && FRContext.isChineseEnv();
return !(WorkContext.getCurrent().isLocal()) && FRContext.isChineseEnv();
} }
/** /**

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

@ -9,7 +9,6 @@ import com.fr.stable.StableUtils;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -20,9 +19,9 @@ import java.util.concurrent.TimeUnit;
public class UpdateActionManager { public class UpdateActionManager {
private static UpdateActionManager updateActionManager = null; private static UpdateActionManager updateActionManager = null;
private List<UpdateActionModel> updateActions; private List<UpdateActionModel> updateActions;
private ExecutorService threadPoolExecutor = new ThreadPoolExecutor( private ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
1, 1, 1, 2,
0L, TimeUnit.MILLISECONDS, 30000L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(), new LinkedBlockingQueue<Runnable>(),
new ThreadFactoryBuilder().setNameFormat("alphafine-thread-%s").build());//目前测下来一个线程慢慢做处理总共大概也只要两秒,暂时就这样 new ThreadFactoryBuilder().setNameFormat("alphafine-thread-%s").build());//目前测下来一个线程慢慢做处理总共大概也只要两秒,暂时就这样
@ -57,6 +56,7 @@ public class UpdateActionManager {
} }
public synchronized void dealWithSearchText(final String paneClass, final UpdateAction updateAction) { public synchronized void dealWithSearchText(final String paneClass, final UpdateAction updateAction) {
threadPoolExecutor.allowCoreThreadTimeOut(true);
threadPoolExecutor.execute(new Runnable() { threadPoolExecutor.execute(new Runnable() {
@Override @Override
public void run() { public void run() {

102
designer-base/src/com/fr/design/module/DesignModule.java

@ -1,102 +0,0 @@
package com.fr.design.module;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.fun.ElementUIProvider;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.hyperlink.ReportletHyperlinkPane;
import com.fr.design.hyperlink.WebHyperlinkPane;
import com.fr.design.javascript.EmailPane;
import com.fr.design.javascript.JavaScriptImplPane;
import com.fr.design.javascript.ParameterJavaScriptPane;
import com.fr.design.mainframe.App;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.general.Inter;
import com.fr.general.ModuleContext;
import com.fr.js.EmailJavaScript;
import com.fr.js.JavaScriptImpl;
import com.fr.js.ParameterJavaScript;
import com.fr.js.ReportletHyperlink;
import com.fr.js.WebHyperlink;
import com.fr.module.TopModule;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.plugin.ExtraDesignClassManagerProvider;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-24
* Time : 下午2:52
* 所有设计器模块的父类
*/
public abstract class DesignModule extends TopModule {
public static final String LOCALE_FILE_PATH = "com/fr/design/i18n/main";
public void start() {
super.start();
App<?>[] apps = apps4TemplateOpener();
for (App<?> app : apps) {
DesignerFrame.registApp(app);
}
ModuleContext.registerStartedModule(DesignModule.class.getName(), this);
StableFactory.registerMarkedClass(ExtraDesignClassManagerProvider.XML_TAG, ExtraDesignClassManager.class);
ActionFactory.registerCellInsertActionClass(actionsForInsertCellElement());
ActionFactory.registerFloatInsertActionClass(actionsForInsertFloatElement());
DesignModuleFactory.registerCreators4Hyperlink(hyperlinkTypes());
}
public boolean isStarted() {
return ModuleContext.isModuleStarted(DesignModule.class.getName());
}
/**
* 返回设计器能打开的模板类型的一个数组列表
*
* @return 可以打开的模板类型的数组
*/
public abstract App<?>[] apps4TemplateOpener();
/**
* 国际化文件路径
*
* @return 国际化文件路径
*/
public String[] getLocaleFile() {
return new String[]{LOCALE_FILE_PATH};
}
public Class<?>[] actionsForInsertCellElement() {
List<Class<?>> classes = new ArrayList<>();
Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING);
for (ElementUIProvider provider : providers) {
classes.add(provider.actionForInsertCellElement());
}
return classes.toArray(new Class<?>[classes.size()]);
}
public Class<?>[] actionsForInsertFloatElement() {
List<Class<?>> classes = new ArrayList<>();
Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING);
for (ElementUIProvider provider : providers) {
classes.add(provider.actionForInsertFloatElement());
}
return classes.toArray(new Class<?>[classes.size()]);
}
public NameableCreator[] hyperlinkTypes() {
return new NameableCreator[]{
new NameObjectCreator(Inter.getLocText("FR-Hyperlink_Reportlet"), ReportletHyperlink.class, ReportletHyperlinkPane.ChartNoRename.class),
new NameObjectCreator(Inter.getLocText("FR-Designer_Email"), EmailJavaScript.class, EmailPane.class),
new NameObjectCreator(Inter.getLocText("Hyperlink-Web_link"), WebHyperlink.class, WebHyperlinkPane.ChartNoRename.class),
new NameObjectCreator(Inter.getLocText("JavaScript-Dynamic_Parameters"), ParameterJavaScript.class, ParameterJavaScriptPane.ChartNoRename.class),
new NameObjectCreator(Inter.getLocText("FR-Designer_JavaScript"), JavaScriptImpl.class, JavaScriptImplPane.ChartNoRename.class)
};
}
}

2
designer-base/src/com/fr/design/utils/DesignUtils.java

@ -301,7 +301,7 @@ public class DesignUtils {
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
try { try {
String urlPath = getWebBrowserPath(); String urlPath = getWebBrowserPath();
Desktop.getDesktop().browse(new URI(urlPath + postfixOfUri)); Desktop.getDesktop().browse(new URI(urlPath + baseRoute + postfixOfUri));
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error("cannot open the url Successful", e); FRContext.getLogger().error("cannot open the url Successful", e);
} }

8
designer-base/src/com/fr/env/RemoteEnvPane.java vendored

@ -64,7 +64,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
private UILabel message = new UILabel(); private UILabel message = new UILabel();
private UIButton okButton = new UIButton(Inter.getLocText("OK")); private UIButton okButton = new UIButton(Inter.getLocText("OK"));
private UIButton cancelButton = new UIButton(Inter.getLocText("Cancel")); private UIButton cancelButton = new UIButton(Inter.getLocText("Cancel"));
; private UILabel uiLabel = new UILabel();
/** /**
* 是否启用 https 勾选框 * 是否启用 https 勾选框
@ -477,6 +477,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
protected Boolean doInBackground() throws Exception { protected Boolean doInBackground() throws Exception {
final RemoteDesignerWorkspaceInfo remoteEnv = updateBean(); final RemoteDesignerWorkspaceInfo remoteEnv = updateBean();
return WorkContext.getConnector().testConnection(remoteEnv.getConnection()); return WorkContext.getConnector().testConnection(remoteEnv.getConnection());
} }
@ -486,11 +487,14 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
try { try {
if (get()) { if (get()) {
message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Successful")); message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Successful"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon"));
} else { } else {
message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Failed")); message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Failed"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
} }
} catch (InterruptedException | ExecutionException e) { } catch (InterruptedException | ExecutionException e) {
message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Failed")); message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Failed"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
} }
} }
}; };
@ -530,7 +534,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
JPanel jp = new JPanel(); JPanel jp = new JPanel();
JPanel upPane = new JPanel(); JPanel upPane = new JPanel();
JPanel downPane = new JPanel(); JPanel downPane = new JPanel();
UILabel uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon")); uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon"));
upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
upPane.add(uiLabel); upPane.add(uiLabel);
upPane.add(message); upPane.add(message);

31
designer-base/src/com/fr/start/BaseDesigner.java

@ -11,7 +11,6 @@ import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerStartOpenFileProcessor; import com.fr.design.fun.DesignerStartOpenFileProcessor;
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.loghandler.LogMessageBar;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
@ -27,8 +26,6 @@ import com.fr.stable.OperatingSystem;
import java.awt.Window; import java.awt.Window;
import java.io.File; import java.io.File;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* The main class of Report Designer. * The main class of Report Designer.
@ -47,39 +44,22 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
EventDispatcher.fire(ModuleEvent.MajorModuleStarting, InterProviderFactory.getProvider().getLocText("FR-Designer_Initializing")); EventDispatcher.fire(ModuleEvent.MajorModuleStarting, InterProviderFactory.getProvider().getLocText("FR-Designer_Initializing"));
// 初始化look and feel.这个在预加载之前执行是因为lookAndFeel里的东西,预加载时也要用到 // 初始化look and feel.这个在预加载之前执行是因为lookAndFeel里的东西,预加载时也要用到
DesignUtils.initLookAndFeel(); DesignUtils.initLookAndFeel();
// 预加载一些耗时的单例面板
preLoadPane();
// 初始化Log Handler // 初始化Log Handler
DesignerEnvManager.loadLogSetting(); DesignerEnvManager.loadLogSetting();
createDesignerFrame(); createDesignerFrame();
} }
private void preLoadPane() {
ExecutorService service = Executors.newCachedThreadPool();
service.submit(new Runnable() {
@Override
public void run() {
LogMessageBar.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
HistoryTemplateListPane.getInstance();
}
});
service.shutdown();
}
public void show(final String[] args) { public void show(final String[] args) {
collectUserInformation(); collectUserInformation();
DesignerContext.getDesignerFrame().getProgressDialog().setProgressValue(10);
showDesignerFrame(args, DesignerContext.getDesignerFrame(), false); showDesignerFrame(args, DesignerContext.getDesignerFrame(), false);
DesignerContext.getDesignerFrame().getProgressDialog().setProgressValue(60);
DesignerContext.getDesignerFrame().refreshEnv(); DesignerContext.getDesignerFrame().refreshEnv();
DesignerContext.getDesignerFrame().getProgressDialog().setProgressValue(90);
for (int i = 0; !TemplateTreePane.getInstance().getTemplateFileTree().isTemplateShowing() && i < LOAD_TREE_MAXNUM; i++) { for (int i = 0; !TemplateTreePane.getInstance().getTemplateFileTree().isTemplateShowing() && i < LOAD_TREE_MAXNUM; i++) {
TemplateTreePane.getInstance().getTemplateFileTree().refresh(); TemplateTreePane.getInstance().getTemplateFileTree().refresh();
} }
DesignerContext.getDesignerFrame().getProgressDialog().setProgressValue(100);
} }
@ -172,9 +152,6 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
} }
} }
protected abstract String module2Start();
// 收集用户信息码 // 收集用户信息码
protected void collectUserInformation() { protected void collectUserInformation() {

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

@ -5,6 +5,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.module.ModuleRole; import com.fr.module.ModuleRole;
import com.fr.stable.EncodeConstants;
import com.fr.startup.FineWebApplicationInitializer; import com.fr.startup.FineWebApplicationInitializer;
import com.fr.third.springframework.web.SpringServletContainerInitializer; import com.fr.third.springframework.web.SpringServletContainerInitializer;
import com.fr.third.springframework.web.context.support.AnnotationConfigWebApplicationContext; import com.fr.third.springframework.web.context.support.AnnotationConfigWebApplicationContext;
@ -12,6 +13,7 @@ import com.fr.workspace.WorkContext;
import org.apache.catalina.Context; import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleException;
import org.apache.catalina.Wrapper; import org.apache.catalina.Wrapper;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.loader.VirtualWebappLoader; import org.apache.catalina.loader.VirtualWebappLoader;
import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.Tomcat;
@ -55,6 +57,8 @@ public class FineEmbedServerActivator extends Activator {
tomcat = new Tomcat(); tomcat = new Tomcat();
tomcat.setPort(DesignerEnvManager.getEnvManager().getEmbedServerPort()); tomcat.setPort(DesignerEnvManager.getEnvManager().getEmbedServerPort());
// 设置解码uri使用的字符编码
tomcat.getConnector().setURIEncoding(EncodeConstants.ENCODING_UTF_8);
String docBase = new File(WorkContext.getCurrent().getPath()).getParent(); String docBase = new File(WorkContext.getCurrent().getPath()).getParent();
String appName = "/" + FRContext.getCommonOperator().getAppName(); String appName = "/" + FRContext.getCommonOperator().getAppName();
Context context = tomcat.addContext(appName, docBase); Context context = tomcat.addContext(appName, docBase);

50
designer-chart/src/com/fr/design/ChartTypeInterfaceManager.java

@ -275,26 +275,13 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
List<Integer> priorityList = getPriorityInOrder(); List<Integer> priorityList = getPriorityInOrder();
for (Integer aPriorityList : priorityList) { for (Integer aPriorityList : priorityList) {
String priority = String.valueOf(aPriorityList); String priority = String.valueOf(aPriorityList);
Iterator<Map.Entry<String, IndependentChartUIProvider>> chartUIIterator = chartTypeInterfaces.get(priority).entrySet().iterator(); addPlotTypePaneList(priority, paneList);
while (chartUIIterator.hasNext()) {
Map.Entry<String, IndependentChartUIProvider> chartUIEntry = chartUIIterator.next();
IndependentChartUIProvider provider = chartUIEntry.getValue();
AbstractChartTypePane pane = provider.getPlotTypePane();
pane.setPlotID(chartUIEntry.getKey());
paneList.add(pane);
}
} }
} }
private static String getChartName(String plotID, IndependentChartUIProvider provider) {
String name = provider.getPlotTypeTitle4PopupWindow();
if (StringUtils.isEmpty(name)) {
name = ChartTypeManager.getInstance().getChartName(plotID);
}
return name;
}
private void addTitles(String priority, List<String> list) { public void addPlotTypePaneList(String priority, List<FurtherBasicBeanPane<? extends Chart>> paneList) {
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)) { if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)) {
Map<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority); Map<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority);
@ -305,30 +292,31 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
String plotID = entry.getKey(); String plotID = entry.getKey();
if (enabledChart(plotID)) { if (enabledChart(plotID)) {
list.add(getChartName(plotID, entry.getValue())); AbstractChartTypePane pane = entry.getValue().getPlotTypePane();
pane.setPlotID(plotID);
paneList.add(pane);
} }
} }
} }
} }
public String[] getTitle4PopupWindow() {
List<Integer> priorityList = getPriorityInOrder();
List<String> result = new ArrayList<String>();
for (Integer priority : priorityList) { public void addPlotTypePaneList(List<FurtherBasicBeanPane<? extends Chart>> paneList,
addTitles(String.valueOf(priority), result); String priority, String plotID) {
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)) {
IndependentChartUIProvider provider = chartTypeInterfaces.get(priority).get(plotID);
AbstractChartTypePane pane = provider.getPlotTypePane();
pane.setPlotID(plotID);
paneList.add(pane);
} }
return result.toArray(new String[result.size()]);
} }
public String[] getTitle4PopupWindow(String priority) { private static String getChartName(String plotID, IndependentChartUIProvider provider) {
List<String> list = new ArrayList<String>(); String name = provider.getPlotTypeTitle4PopupWindow();
if (StringUtils.isEmpty(name)) {
addTitles(priority, list); name = ChartTypeManager.getInstance().getChartName(plotID);
}
return list.toArray(new String[list.size()]); return name;
} }
/** /**

30
designer-chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -206,19 +206,30 @@ public class ChartTypePane extends AbstractChartAttrPane{
boolean enabledChart = ChartTypeManager.enabledChart(plotID); boolean enabledChart = ChartTypeManager.enabledChart(plotID);
String item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(priority, plotID); String item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(priority, plotID);
//第一步就是重构cardNames //第一步就是重构cards
cards.clear();
if (enabledChart) { if (enabledChart) {
cardNames = collection.getState() == SwitchState.DEFAULT if (collection.getState() == SwitchState.DEFAULT) {
? ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow() ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(cards);
: ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(priority);
} else { } else {
cardNames = new String[]{item}; ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(priority, cards);
}
} else {
ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(cards, priority, plotID);
} }
//下拉框重构开始。为了防止重构是触发update //下拉框重构开始。为了防止重构是触发update
((FlexibleComboBox)jcb).setItemEvenType(ItemEventType.REACTOR); ((FlexibleComboBox)jcb).setItemEvenType(ItemEventType.REACTOR);
//重构下拉框选项 //重构下拉框选项
reactorComboBox(); cardNames = new String[cards.size()];
cardPane.removeAll();
jcb.removeAllItems();
for (int i = 0; i < this.cards.size(); i++) {
String name = this.cards.get(i).title4PopupWindow();// Name从各自的pane里面获取
cardNames[i] = name;
cardPane.add(this.cards.get(i), cardNames[i]);
addComboBoxItem(cards, i);
}
//重新选择选中的下拉项 //重新选择选中的下拉项
jcb.setSelectedItem(item); jcb.setSelectedItem(item);
jcb.setEnabled(enabledChart); jcb.setEnabled(enabledChart);
@ -233,13 +244,6 @@ public class ChartTypePane extends AbstractChartAttrPane{
cl.show(cardPane, cardNames[jcb.getSelectedIndex()]); cl.show(cardPane, cardNames[jcb.getSelectedIndex()]);
} }
private void reactorComboBox() {
jcb.removeAllItems();
for (int i = 0; i < this.cardNames.length; i++) {
jcb.addItem(cardNames[i]);
}
}
@Override @Override
public void populateBean(Chart ob) { public void populateBean(Chart ob) {
for (int i = 0; i < this.cards.size(); i++) { for (int i = 0; i < this.cards.size(); i++) {

14
designer-chart/src/com/fr/design/mainframe/chart/gui/style/ChartFillStylePane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.chart.gui.style; package com.fr.design.mainframe.chart.gui.style;
import com.fr.base.ChartPreStyleConfig;
import com.fr.base.ChartPreStyleManagerProvider; import com.fr.base.ChartPreStyleManagerProvider;
import com.fr.base.ChartPreStyleServerManager; import com.fr.base.ChartPreStyleServerManager;
import com.fr.base.Utils; import com.fr.base.Utils;
@ -16,8 +17,13 @@ import com.fr.design.style.background.gradient.FixedGradientBar;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JPanel;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
@ -128,10 +134,10 @@ public class ChartFillStylePane extends BasicBeanPane<AttrFillStyle>{
} }
private String[] getNameObj() { private String[] getNameObj() {
ChartPreStyleManagerProvider manager = ChartPreStyleServerManager.getProviderInstance(); ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
ArrayList<String> nameArr = new ArrayList<String>(); ArrayList<String> nameArr = new ArrayList<String>();
nameArr.add(Inter.getLocText("FR-Designer_DEFAULT")); nameArr.add(Inter.getLocText("FR-Designer_DEFAULT"));
Iterator keys = manager.names(); Iterator keys = config.names();
while (keys.hasNext()) { while (keys.hasNext()) {
Object key = keys.next(); Object key = keys.next();
nameArr.add(Utils.objectToString(key)); nameArr.add(Utils.objectToString(key));

90
designer-chart/src/com/fr/design/module/ChartDesignerModule.java

@ -1,90 +0,0 @@
package com.fr.design.module;
import com.fr.chart.base.ChartInternationalNameContentBean;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.chart.ChartDialog;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.ChartWidgetOption;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.core.WidgetOption;
import com.fr.design.mainframe.App;
import com.fr.design.mainframe.ChartPropertyPane;
import com.fr.form.ui.ChartEditor;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.plugin.chart.vanchart.imgevent.design.DesignImageEvent;
import com.fr.stable.ArrayUtils;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider;
import com.fr.van.chart.DownloadOnlineSourcesHelper;
import com.fr.van.chart.map.server.ChartMapEditorAction;
import javax.swing.Icon;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 7.0.3
* Date: 13-7-8
* Time: 上午9:13
*/
public class ChartDesignerModule extends DesignModule {
public static void register(){
StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class);
StableFactory.getStaticMarkedInstanceObjectFromClass(ExtraChartDesignClassManagerProvider.XML_TAG, ExtraChartDesignClassManagerProvider.class);
DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup());
DesignModuleFactory.registerChartEditorClass(ChartEditor.class);
DesignModuleFactory.registerChartComponentClass(ChartComponent.class);
DesignModuleFactory.registerChartDialogClass(ChartDialog.class);
DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class);
ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction());
ActionFactory.registerChartMapEditorAction(new ChartMapEditorAction());
ActionFactory.registerChartCollection(ChartCollection.class);
DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption());
DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance());
DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper());
}
/**
* 返回设计器能打开的模板类型的一个数组列表
*
* @return 可以打开的模板类型的数组
*/
public App<?>[] apps4TemplateOpener() {
return new App[0];
}
protected WidgetOption[] options4Show() {
ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames();
ChartWidgetOption[] child = new ChartWidgetOption[typeName.length];
for (int i = 0; i < typeName.length; i++) {
String plotID = typeName[i].getPlotID();
Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID);
if (ArrayUtils.isEmpty(rowChart)) {
continue;
}
String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID);
Icon icon = IOUtils.readIcon(iconPath);
child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]);
}
return child;
}
public String getInterNationalName() {
return Inter.getLocText("FR-Chart-Design_ChartModule");
}
}

22
designer-chart/src/com/fr/design/module/ChartPreStyleManagerPane.java

@ -1,7 +1,6 @@
package com.fr.design.module; package com.fr.design.module;
import com.fr.base.ChartPreStyleManagerProvider; import com.fr.base.ChartPreStyleConfig;
import com.fr.base.ChartPreStyleServerManager;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.ChartPreStyle; import com.fr.chart.base.ChartPreStyle;
import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.JListControlPane;
@ -42,14 +41,14 @@ public class ChartPreStyleManagerPane extends JListControlPane {
} }
public void populateBean() { public void populateBean() {
ChartPreStyleManagerProvider manager = ChartPreStyleServerManager.getProviderInstance(); ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
Iterator keys = manager.names(); Iterator keys = config.names();
while(keys.hasNext()) { while(keys.hasNext()) {
Object key = keys.next(); Object key = keys.next();
ChartPreStyle value = (ChartPreStyle)manager.getPreStyle(key); ChartPreStyle value = (ChartPreStyle)config.getPreStyle(key);
list.add(new NameObject(Utils.objectToString(key), value)); list.add(new NameObject(Utils.objectToString(key), value));
} }
@ -57,26 +56,23 @@ public class ChartPreStyleManagerPane extends JListControlPane {
Nameable[] values = (Nameable[])list.toArray(new Nameable[list.size()]); Nameable[] values = (Nameable[])list.toArray(new Nameable[list.size()]);
populate(values); populate(values);
if(manager.containsName(manager.getCurrentStyle())) { if(config.containsName(config.getCurrentStyle())) {
this.setSelectedName(manager.getCurrentStyle()); this.setSelectedName(config.getCurrentStyle());
} }
} }
public void updateBean() { public void updateBean() {
ChartPreStyleManagerProvider manager = ChartPreStyleServerManager.getProviderInstance(); ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
manager.clearPreStyles();
Nameable[] values = this.update(); Nameable[] values = this.update();
manager.setCurrentStyle(getSelectedName()); config.setCurrentStyle(getSelectedName());
for(int i = 0; i < values.length; i++) { for(int i = 0; i < values.length; i++) {
Nameable value = values[i]; Nameable value = values[i];
manager.putPreStyle(value.getName(), ((NameObject)value).getObject()); config.putPreStyle(value.getName(), ((NameObject)value).getObject());
} }
manager.writerPreChartStyle();
// 通知报表整个刷新. // 通知报表整个刷新.
DesignerFrame frame = DesignerContext.getDesignerFrame(); DesignerFrame frame = DesignerContext.getDesignerFrame();
if(frame != null) { if(frame != null) {

6
designer-chart/src/com/fr/van/chart/DownloadOnlineSourcesHelper.java

@ -7,7 +7,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.plugin.chart.DownloadSourcesEvent; import com.fr.plugin.chart.DownloadSourcesEvent;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -68,7 +68,7 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent {
//本地有这个资源,不下载 //本地有这个资源,不下载
return; return;
} }
httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind(siteKind)); httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind(siteKind));
if (httpClient.getResponseCode() != HttpURLConnection.HTTP_OK) { if (httpClient.getResponseCode() != HttpURLConnection.HTTP_OK) {
//服务器连不上,不下载 //服务器连不上,不下载
return; return;
@ -116,7 +116,7 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent {
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
SiteInfo siteInfo = list.get(i); SiteInfo siteInfo = list.get(i);
httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind(siteInfo.siteKind)); httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind(siteInfo.siteKind));
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
InputStream reader = httpClient.getResponseStream(); InputStream reader = httpClient.getResponseStream();
String temp = StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE); String temp = StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE);

4
designer-chart/src/com/fr/van/chart/gantt/designer/style/axis/GanttTimeAxisPane.java

@ -22,7 +22,9 @@ import java.awt.Component;
public class GanttTimeAxisPane extends AbstractVanChartScrollPane<VanChart> { public class GanttTimeAxisPane extends AbstractVanChartScrollPane<VanChart> {
private static final ZoomLevel[] ZOOM_LEVELS = new ZoomLevel[]{ZoomLevel.AUTO, ZoomLevel.ZERO, ZoomLevel.ONE, private static final ZoomLevel[] ZOOM_LEVELS = new ZoomLevel[]{ZoomLevel.AUTO, ZoomLevel.ZERO, ZoomLevel.ONE,
ZoomLevel.TWO, ZoomLevel.THREE, ZoomLevel.FOUR, ZoomLevel.FIVE, ZoomLevel.SIX, ZoomLevel.SEVEN, ZoomLevel.TWO, ZoomLevel.THREE, ZoomLevel.FOUR, ZoomLevel.FIVE, ZoomLevel.SIX, ZoomLevel.SEVEN,
ZoomLevel.EIGHT, ZoomLevel.NINE, ZoomLevel.TEN, ZoomLevel.ELEVEN, ZoomLevel.TWELVE}; ZoomLevel.EIGHT, ZoomLevel.NINE, ZoomLevel.TEN, ZoomLevel.ELEVEN, ZoomLevel.TWELVE, ZoomLevel.THIRTEEN,
ZoomLevel.FOURTEEN, ZoomLevel.FIFTEEN, ZoomLevel.SIXTEEN, ZoomLevel.SEVENTEEN, ZoomLevel.EIGHTEEN,
ZoomLevel.NINETEEN, ZoomLevel.TWENTY, ZoomLevel.TWENTY_ONE};
private UIButtonGroup timeZoom; private UIButtonGroup timeZoom;
private UIComboBox initialLevel; private UIComboBox initialLevel;

12
designer-form/src/com/fr/design/designer/beans/adapters/layout/FRBodyLayoutAdapter.java

@ -620,8 +620,8 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter {
} else { } else {
currentCreator.setLocation(finalX, finalY); currentCreator.setLocation(finalX, finalY);
currentCreator.setSize(finalW, finalH); currentCreator.setSize(finalW, finalH);
currentCreator.recalculateChildWidth(finalW); currentCreator.recalculateChildWidth(finalW, false);
currentCreator.recalculateChildHeight(finalH); currentCreator.recalculateChildHeight(finalH, false);
child.setLocation(xL, yL); child.setLocation(xL, yL);
child.setSize(dim); child.setSize(dim);
} }
@ -1078,7 +1078,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter {
int offset = comp.getHeight() - length; int offset = comp.getHeight() - length;
comp.setSize(comp.getWidth(), offset); comp.setSize(comp.getWidth(), offset);
XCreator creator = (XCreator) comp; XCreator creator = (XCreator) comp;
creator.recalculateChildHeight(offset); creator.recalculateChildHeight(offset, false);
} }
} }
@ -1100,7 +1100,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter {
int offset = comp.getHeight() - length; int offset = comp.getHeight() - length;
comp.setSize(comp.getWidth(), offset); comp.setSize(comp.getWidth(), offset);
XCreator creator = (XCreator) comp; XCreator creator = (XCreator) comp;
creator.recalculateChildHeight(offset); creator.recalculateChildHeight(offset, false);
} }
} }
childY += actualVal; childY += actualVal;
@ -1134,7 +1134,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter {
int offset = comp.getWidth() - length; int offset = comp.getWidth() - length;
comp.setSize(offset, comp.getHeight()); comp.setSize(offset, comp.getHeight());
XCreator creator = (XCreator) comp; XCreator creator = (XCreator) comp;
creator.recalculateChildWidth(offset); creator.recalculateChildWidth(offset, false);
} }
} }
childX += actualVal; childX += actualVal;
@ -1155,7 +1155,7 @@ public class FRBodyLayoutAdapter extends AbstractLayoutAdapter {
int offset = comp.getWidth() - length; int offset = comp.getWidth() - length;
comp.setSize(offset, comp.getHeight()); comp.setSize(offset, comp.getHeight());
XCreator creator = (XCreator) comp; XCreator creator = (XCreator) comp;
creator.recalculateChildWidth(offset); creator.recalculateChildWidth(offset, false);
} }
} }

6
designer-form/src/com/fr/design/designer/creator/XCreator.java

@ -576,15 +576,17 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
/** /**
* 重新调整子组件宽度 * 重新调整子组件宽度
* @param width 宽度 * @param width 宽度
* @param actualSize 是否按照实际大小计算
*/ */
public void recalculateChildWidth(int width){ public void recalculateChildWidth(int width, boolean actualSize){
return; return;
} }
/** /**
* 重新调整子组件高度 * 重新调整子组件高度
* @param height 高度 * @param height 高度
* @param actualSize 是否按照实际大小计算
*/ */
public void recalculateChildHeight(int height){ public void recalculateChildHeight(int height, boolean actualSize){
return; return;
} }

8
designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -248,10 +248,10 @@ public class XWAbsoluteLayout extends XLayoutContainer {
for (int i = 0; i < this.getComponentCount(); i++) { for (int i = 0; i < this.getComponentCount(); i++) {
XCreator creator = getXCreator(i); XCreator creator = getXCreator(i);
Rectangle rec = new Rectangle(creator.getBounds()); Rectangle rec = new Rectangle(creator.getBounds());
rec.x = (int) (rec.x / prevContainerPercent * containerPercent); rec.x = (int)Math.round (rec.x / prevContainerPercent * containerPercent);
rec.y = (int) (rec.y / prevContainerPercent * containerPercent); rec.y = (int)Math.round (rec.y / prevContainerPercent * containerPercent);
rec.height = (int) (rec.height / prevContainerPercent * containerPercent); rec.height = (int)Math.round (rec.height / prevContainerPercent * containerPercent);
rec.width = (int) (rec.width / prevContainerPercent * containerPercent); rec.width = (int)Math.round (rec.width / prevContainerPercent * containerPercent);
BoundsWidget wgt = (BoundsWidget) toData().getBoundsWidget(creator.toData()); BoundsWidget wgt = (BoundsWidget) toData().getBoundsWidget(creator.toData());
wgt.setBounds(rec); wgt.setBounds(rec);
creator.setBounds(rec); creator.setBounds(rec);

3
designer-form/src/com/fr/design/designer/creator/XWFitLayout.java

@ -373,7 +373,7 @@ public class XWFitLayout extends XLayoutContainer {
if (x == 0) { if (x == 0) {
int width = notHasRightCreator(rec) ? this.getWidth() : rec.width+dw; int width = notHasRightCreator(rec) ? this.getWidth() : rec.width+dw;
creator.setBounds(0, rec.y, width, rec.height); creator.setBounds(0, rec.y, width, rec.height);
creator.recalculateChildWidth(width); creator.recalculateChildWidth(width, true);
} else { } else {
XCreator leftCreator = getCreatorAt(rec.x-1, rec.y); XCreator leftCreator = getCreatorAt(rec.x-1, rec.y);
int posX = getPosX(leftCreator); int posX = getPosX(leftCreator);
@ -502,6 +502,7 @@ public class XWFitLayout extends XLayoutContainer {
if (y==0) { if (y==0) {
int height = notHasBottomCreator(rec) ? this.getHeight() : rec.height+dh; int height = notHasBottomCreator(rec) ? this.getHeight() : rec.height+dh;
creator.setBounds(rec.x, 0, rec.width, height); creator.setBounds(rec.x, 0, rec.width, height);
creator.recalculateChildHeight(height, true);
} else { } else {
XCreator topCreator = getCreatorAt(rec.x, rec.y-1); XCreator topCreator = getCreatorAt(rec.x, rec.y-1);
int posY = getPosY(topCreator); int posY = getPosY(topCreator);

56
designer-form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -263,29 +263,31 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
/** /**
* 重新调整子组件的宽度 * 重新调整子组件的宽度
* @param width 宽度 * @param width 宽度
* @param actualSize 是否按照实际大小计算
*/ */
@Override @Override
public void recalculateChildWidth(int width){ public void recalculateChildWidth(int width, boolean actualSize){
ArrayList<?> childrenList = this.getTargetChildrenList(); ArrayList<?> childrenList = this.getTargetChildrenList();
int size = childrenList.size(); int size = childrenList.size();
if (size > 0) { if (size > 0) {
for (int j = 0; j < size; j++) { for (int j = 0; j < size; j++) {
XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList
.get(j); .get(j);
tabLayout.setBackupBound(tabLayout.getBounds());
int refSize = tabLayout.getWidth();
Dimension d = new Dimension(tabLayout.toData().getContainerWidth(), tabLayout.toData().getContainerHeight());
Rectangle rec = actualSize? new Rectangle(d): tabLayout.getBounds();
// 容器大小改变时,设下backupBound为其之前的实际大小
tabLayout.setBackupBound(rec);
int refSize = rec.width;
int offest = width - refSize; int offest = width - refSize;
double percent = (double) offest / refSize; double percent = (double) offest / refSize;
if (percent < 0 && !tabLayout.canReduce(percent)) { if (percent < 0 && !tabLayout.canReduce(percent)) {
return; return;
} }
tabLayout.setSize(tabLayout.getWidth() + offest, tabLayout.setSize(rec.width + offest, rec.height);
tabLayout.getHeight()); if(!actualSize){
for (int m = 0; m < tabLayout.getComponentCount(); m++) { updateChildWidgetBounds(tabLayout);
XCreator childCreator = tabLayout.getXCreator(m);
BoundsWidget wgt = (BoundsWidget) tabLayout.toData()
.getBoundsWidget(childCreator.toData());
wgt.setBounds(tabLayout.getComponent(m).getBounds());
} }
tabLayout.adjustCreatorsWidth(percent); tabLayout.adjustCreatorsWidth(percent);
} }
@ -295,38 +297,52 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
/** /**
* 重新调整子组件的高度 * 重新调整子组件的高度
* @param height 高度 * @param height 高度
* @param actualSize 是否按照实际大小计算
*/ */
@Override @Override
public void recalculateChildHeight(int height){ public void recalculateChildHeight(int height, boolean actualSize){
ArrayList<?> childrenList = this.getTargetChildrenList(); ArrayList<?> childrenList = this.getTargetChildrenList();
int size = childrenList.size(); int size = childrenList.size();
if (size > 0) { if (size > 0) {
for (int j = 0; j < size; j++) { for (int j = 0; j < size; j++) {
XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList
.get(j); .get(j);
tabLayout.setBackupBound(tabLayout.getBounds()); Dimension d = new Dimension(tabLayout.toData().getContainerWidth(), tabLayout.toData().getContainerHeight());
int refSize = tabLayout.getHeight(); Rectangle rec = actualSize? new Rectangle(d): tabLayout.getBounds();
// 容器大小改变时,设下backupBound为其之前的实际大小
tabLayout.setBackupBound(rec);
int refSize = rec.height;
int offset = height - refSize - WCardMainBorderLayout.TAB_HEIGHT; int offset = height - refSize - WCardMainBorderLayout.TAB_HEIGHT;
if(offset < 0){ if(offset < 0){
// 缩放时需要备份原tab布局宽高 // 缩放时需要备份原tab布局宽高
tabLayout.setReferDim(new Dimension(tabLayout.getWidth(),tabLayout.getHeight())); tabLayout.setReferDim(new Dimension(rec.width, rec.height));
} }
double percent = (double) offset / refSize; double percent = (double) offset / refSize;
if (percent < 0 && !tabLayout.canReduce(percent)) { if (percent < 0 && !tabLayout.canReduce(percent)) {
return; return;
} }
tabLayout.setSize(tabLayout.getWidth(), tabLayout.setSize(rec.width, rec.height + offset);
tabLayout.getHeight() + offset); if(!actualSize){
updateChildWidgetBounds(tabLayout);
}
tabLayout.adjustCreatorsHeight(percent);
}
}
}
/**
* 更新下子组件bounds
* @param tabLayout tabFit布局
*/
private void updateChildWidgetBounds(XWTabFitLayout tabLayout){
for (int m = 0; m < tabLayout.getComponentCount(); m++) { for (int m = 0; m < tabLayout.getComponentCount(); m++) {
XCreator childCreator = tabLayout.getXCreator(m); XCreator childCreator = tabLayout.getXCreator(m);
BoundsWidget wgt = (BoundsWidget) tabLayout.toData() BoundsWidget wgt = (BoundsWidget) tabLayout.toData()
.getBoundsWidget(childCreator.toData()); .getBoundsWidget(childCreator.toData());
wgt.setBounds(tabLayout.getComponent(m).getBounds()); wgt.setBounds(tabLayout.getComponent(m).getBounds());
} }
tabLayout.adjustCreatorsHeight(percent);
}
}
} }
@Override @Override

4
designer-form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java

@ -222,8 +222,8 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
} }
for (int i = 0;i < components.length;i++){ for (int i = 0;i < components.length;i++){
if (components[i] instanceof XWCardMainBorderLayout){ if (components[i] instanceof XWCardMainBorderLayout){
((XWCardMainBorderLayout)components[i]).recalculateChildWidth(components[i].getWidth()); ((XWCardMainBorderLayout)components[i]).recalculateChildWidth(components[i].getWidth(), false);
((XWCardMainBorderLayout)components[i]).recalculateChildHeight(components[i].getHeight()); ((XWCardMainBorderLayout)components[i]).recalculateChildHeight(components[i].getHeight(), false);
} }
xwFitLayout.dealDirections((XCreator)components[i], false); xwFitLayout.dealDirections((XCreator)components[i], false);
} }

4
designer-form/src/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -11,7 +11,7 @@ import com.fr.form.share.ShareLoader;
import com.fr.form.ui.SharableWidgetBindInfo; import com.fr.form.ui.SharableWidgetBindInfo;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import com.fr.share.ShareConstants; import com.fr.share.ShareConstants;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -298,7 +298,7 @@ public class FormWidgetDetailPane extends FormDockView{
downloadButton.addActionListener(new ActionListener() { downloadButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
String url = SiteCenter.getInstance().acquireUrlByKind("reuse.url"); String url = CloudCenter.getInstance().acquireUrlByKind("reuse.url");
if (StringUtils.isEmpty(url)) { if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!"); FRContext.getLogger().info("The URL is empty!");
return; return;

1
designer-form/src/com/fr/design/mainframe/JForm.java

@ -340,7 +340,6 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
} }
ParameterPropertyPane.getInstance().setAddParaPaneVisible(isAddParaPaneVisible(comp), this); ParameterPropertyPane.getInstance().setAddParaPaneVisible(isAddParaPaneVisible(comp), this);
editingComponent = comp.createToolPane(this, formDesign); editingComponent = comp.createToolPane(this, formDesign);
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM);
if (BaseUtils.isAuthorityEditing()) { if (BaseUtils.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane( EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(
ComparatorUtils.equals(editingComponent.getClass(), NoSupportAuthorityEdit.class) ? editingComponent : createAuthorityEditPane()); ComparatorUtils.equals(editingComponent.getClass(), NoSupportAuthorityEdit.class) ? editingComponent : createAuthorityEditPane());

105
designer-form/src/com/fr/design/module/FormDesignerModule.java

@ -1,105 +0,0 @@
package com.fr.design.module;
import com.fr.base.FRContext;
import com.fr.base.io.XMLEncryptUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.bridge.DesignToolbarProvider;
import com.fr.design.form.parameter.FormParaDesigner;
import com.fr.design.mainframe.*;
import com.fr.design.mainframe.actions.NewFormAction;
import com.fr.design.parameter.FormParameterReader;
import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane;
import com.fr.file.FILE;
import com.fr.form.main.Form;
import com.fr.form.stable.ElementCaseThumbnailProcessor;
import com.fr.general.Inter;
import com.fr.general.ModuleContext;
import com.fr.stable.Constants;
import com.fr.stable.bridge.StableFactory;
import java.util.HashMap;
/**
* Created by IntelliJ IDEA. Author : Richer Version: 6.5.6 Date : 11-11-24 Time
* : 下午3:43
*/
public class FormDesignerModule extends DesignModule {
public void start() {
super.start();
ModuleContext.startModule(CHART_DESIGNER_MODULE);
StableFactory.registerMarkedObject(DesignToolbarProvider.STRING_MARKED, WidgetToolBarPane.getInstance());
DesignModuleFactory.registerNewFormActionClass(NewFormAction.class);
DesignModuleFactory.registerFormParaDesignerClass(FormParaDesigner.class);
DesignModuleFactory.registerParaPropertyPaneClass(ParameterPropertyPane.class);
DesignModuleFactory.registerFormHierarchyPaneClass(FormHierarchyTreePane.class);
DesignModuleFactory.registerWidgetPropertyPaneClass(WidgetPropertyPane.class);
DesignModuleFactory.registerButtonDetailPaneClass(FormSubmitButtonDetailPane.class);
DesignModuleFactory.registerParameterReader(new FormParameterReader());
registerData4Designer();
StableFactory.registerMarkedObject(ElementCaseThumbnailProcessor.MARK_STRING, new ElementCaseThumbnail());
}
private void registerData4Designer(){
StableFactory.registerMarkedClass(BaseJForm.XML_TAG, JForm.class);
}
/**
*apps模板的Opener
* @return 返回app
*/
public App<?>[] apps4TemplateOpener() {
return new App[]{new AbstractAppProvider<Form>() {
@Override
public String[] defaultExtensions() {
return new String[]{"frm", "form"};
}
@Override
public JTemplate<Form, ?> openTemplate(FILE tplFile) {
HashMap<String, Class> classType = new HashMap<String, Class>();
classType.put(Constants.ARG_0, Form.class);
classType.put(Constants.ARG_1, FILE.class);
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG,
new Object[]{asIOFile(tplFile), tplFile}, classType, BaseJForm.class);
}
@Override
public Form asIOFile(FILE file) {
if (XMLEncryptUtils.isCptEncoded() &&
!XMLEncryptUtils.checkVaild(DesignerEnvManager.getEnvManager().getEncryptionKey())) {
if (!new DecodeDialog(file).isPwdRight()) {
FRContext.getLogger().error(Inter.getLocText("FR-Engine_ECP_error_pwd"));
return new Form();
}
}
// peter:打开新报表.
Form tpl = new Form();
// richer:打开报表通知
// FRContext.getLogger().info(Inter.getLocText("LOG-Is_Being_Openned") + "\"" + file.getName() + "\"" + "," + Inter.getLocText("LOG-Please_Wait") + "...");
FRContext.getLogger().info(Inter.getLocText(new String[]{"LOG-Is_Being_Openned", "LOG-Please_Wait"},
new String[]{"\"" + file.getName() + "\"" + ",", "..."}));
try {
tpl.readStream(file.asInputStream());
} catch (Exception exp) {
FRContext.getLogger().error("Failed to generate frm from " + file, exp);
return null;
}
return tpl;
}
}};
}
public String getInterNationalName() {
return Inter.getLocText("FR-Designer_formDesignerModule");
}
}

4
designer-form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java

@ -232,8 +232,8 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
} }
for (int i = 0; i < components.length; i++) { for (int i = 0; i < components.length; i++) {
if (components[i] instanceof XWCardMainBorderLayout) { if (components[i] instanceof XWCardMainBorderLayout) {
((XWCardMainBorderLayout) components[i]).recalculateChildWidth(components[i].getWidth()); ((XWCardMainBorderLayout) components[i]).recalculateChildWidth(components[i].getWidth(), false);
((XWCardMainBorderLayout) components[i]).recalculateChildHeight(components[i].getHeight()); ((XWCardMainBorderLayout) components[i]).recalculateChildHeight(components[i].getHeight(), false);
} }
xwFitLayout.dealDirections((XCreator) components[i], false); xwFitLayout.dealDirections((XCreator) components[i], false);
} }

36
designer-form/src/com/fr/start/Designer4Form.java

@ -1,36 +0,0 @@
package com.fr.start;
import com.fr.design.mainframe.actions.NewFormAction;
import com.fr.design.menu.ShortCut;
import com.fr.design.module.FormDesignerModule;
public class Designer4Form extends BaseDesigner {
/**
* 主函数
* @param args 入口参数
*/
public static void main(String[] args) {
new Designer4Form(args);
}
public Designer4Form(String[] args) {
super(args);
}
@Override
protected String module2Start() {
return FormDesignerModule.class.getName();
}
/**
* 创建新建文件菜单
* @return 菜单
*/
public ShortCut[] createNewFileShortCuts() {
return new ShortCut[]{
new NewFormAction()
};
}
}

7
designer-realize/pom.xml

@ -8,7 +8,6 @@
<artifactId>design</artifactId> <artifactId>design</artifactId>
<version>10.0-RELEASE-SNAPSHOT</version> <version>10.0-RELEASE-SNAPSHOT</version>
</parent> </parent>
<groupId>com.fr.report</groupId>
<artifactId>designer-realize</artifactId> <artifactId>designer-realize</artifactId>
<version>10.0-RELEASE-SNAPSHOT</version> <version>10.0-RELEASE-SNAPSHOT</version>
<dependencies> <dependencies>
@ -22,5 +21,11 @@
<artifactId>designer-chart</artifactId> <artifactId>designer-chart</artifactId>
<version>10.0-RELEASE-SNAPSHOT</version> <version>10.0-RELEASE-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>com.fr.report</groupId>
<artifactId>designer-base</artifactId>
<version>10.0-RELEASE-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

4
designer-realize/src/com/fr/design/actions/file/export/AbstractExportAction.java

@ -3,6 +3,7 @@
*/ */
package com.fr.design.actions.file.export; package com.fr.design.actions.file.export;
import com.fr.Message.ErrorMessage_;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.design.actions.JWorkBookAction; import com.fr.design.actions.JWorkBookAction;
@ -133,7 +134,8 @@ public abstract class AbstractExportAction extends JWorkBookAction {
} catch (Exception exp) { } catch (Exception exp) {
this.setProgress(100); this.setProgress(100);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Export_failed") + "\n" + filePath); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Export_failed") + "\n" + filePath,
null, 0, UIManager.getIcon("OptionPane.errorIcon"));
} }
return null; return null;
} }

4
designer-realize/src/com/fr/design/mainframe/ActiveKeyGenerator.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -102,7 +102,7 @@ public class ActiveKeyGenerator {
para.put("uuid", envManager.getUUID()); para.put("uuid", envManager.getUUID());
para.put("key", key); para.put("key", key);
para.put("username", MarketConfig.getInstance().getBbsUsername()); para.put("username", MarketConfig.getInstance().getBbsUsername());
HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("verify.code"), para); HttpClient hc = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("verify.code"), para);
if (timeout != -1) { if (timeout != -1) {
hc.setTimeout(timeout); hc.setTimeout(timeout);
} }

6
designer-realize/src/com/fr/design/mainframe/CellElementPropertyPane.java

@ -68,13 +68,17 @@ public class CellElementPropertyPane extends DockingView {
public synchronized static CellElementPropertyPane getInstance() { public synchronized static CellElementPropertyPane getInstance() {
if (singleton == null) {
synchronized (CellElementPropertyPane.class) {
if (singleton == null) { if (singleton == null) {
singleton = new CellElementPropertyPane(); singleton = new CellElementPropertyPane();
} }
}
}
return singleton; return singleton;
} }
private static CellElementPropertyPane singleton; private static volatile CellElementPropertyPane singleton;
private CellElementEditPane cellElementEditPane; private CellElementEditPane cellElementEditPane;

6
designer-realize/src/com/fr/design/mainframe/InformationCollector.java

@ -13,12 +13,12 @@ import com.fr.data.core.db.dml.Table;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.errorinfo.ErrorInfoUploader; import com.fr.design.mainframe.errorinfo.ErrorInfoUploader;
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.DateUtils; import com.fr.general.DateUtils;
import com.fr.general.DesUtils; import com.fr.general.DesUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONException; import com.fr.json.JSONException;
@ -187,7 +187,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
return; return;
} }
byte[] content = getJSONContentAsByte(); byte[] content = getJSONContentAsByte();
HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("user.info")); HttpClient hc = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("user.info"));
hc.setContent(content); hc.setContent(content);
if (!hc.isServerAlive()) { if (!hc.isServerAlive()) {
return; return;
@ -230,7 +230,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
DBUtils.closeConnection(conn); DBUtils.closeConnection(conn);
} }
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("functions.info")); HttpClient httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("functions.info"));
httpClient.setContent(content); httpClient.setContent(content);
httpClient.setTimeout(5000); httpClient.setTimeout(5000);

20
designer-realize/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe.alphafine; package com.fr.design.mainframe.alphafine;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import java.awt.*; import java.awt.*;
@ -68,24 +68,24 @@ public class AlphaFineConstants {
public static final String IMAGE_URL = "/com/fr/design/mainframe/alphafine/images/"; public static final String IMAGE_URL = "/com/fr/design/mainframe/alphafine/images/";
public static final String PLUGIN_SEARCH_URL = SiteCenter.getInstance().acquireUrlByKind("plugin.searchAPI"); public static final String PLUGIN_SEARCH_URL = CloudCenter.getInstance().acquireUrlByKind("plugin.searchAPI");
public static final String PLUGIN_URL = SiteCenter.getInstance().acquireUrlByKind("af.pluginInfo"); public static final String PLUGIN_URL = CloudCenter.getInstance().acquireUrlByKind("af.pluginInfo");
public static final String REUSE_URL = SiteCenter.getInstance().acquireUrlByKind("af.reuseInfo"); public static final String REUSE_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo");
public static final String DOCUMENT_DOC_URL = SiteCenter.getInstance().acquireUrlByKind("af.doc_view"); public static final String DOCUMENT_DOC_URL = CloudCenter.getInstance().acquireUrlByKind("af.doc_view");
public static final String DOCUMENT_SEARCH_URL = SiteCenter.getInstance().acquireUrlByKind("af.doc_search"); public static final String DOCUMENT_SEARCH_URL = CloudCenter.getInstance().acquireUrlByKind("af.doc_search");
public static final String DOCUMENT_INFORMATION_URL = SiteCenter.getInstance().acquireUrlByKind("af.doc_info"); public static final String DOCUMENT_INFORMATION_URL = CloudCenter.getInstance().acquireUrlByKind("af.doc_info");
public static final String PLUGIN_IMAGE_URL = SiteCenter.getInstance().acquireUrlByKind("af.plugin_image"); public static final String PLUGIN_IMAGE_URL = CloudCenter.getInstance().acquireUrlByKind("af.plugin_image");
public static final String CLOUD_SERVER_URL = SiteCenter.getInstance().acquireUrlByKind("af.record"); public static final String CLOUD_SERVER_URL = CloudCenter.getInstance().acquireUrlByKind("af.record");
public static final String SEARCH_API = SiteCenter.getInstance().acquireUrlByKind("af.cloud_search"); public static final String SEARCH_API = CloudCenter.getInstance().acquireUrlByKind("af.cloud_search");

4
designer-realize/src/com/fr/design/mainframe/bbs/BBSConstants.java

@ -4,7 +4,7 @@
package com.fr.design.mainframe.bbs; package com.fr.design.mainframe.bbs;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.util.Properties; import java.util.Properties;
@ -42,7 +42,7 @@ public class BBSConstants {
//加载所有用户的信息, 用户名, 论坛连接 //加载所有用户的信息, 用户名, 论坛连接
private static String[] loadAllGuestsInfoOnline(String key, String defaultValue) { private static String[] loadAllGuestsInfoOnline(String key, String defaultValue) {
String[] allGuests = new String[0]; String[] allGuests = new String[0];
String guest = SiteCenter.getInstance().acquireUrlByKind(key, defaultValue); String guest = CloudCenter.getInstance().acquireUrlByKind(key, defaultValue);
if (StringUtils.isNotEmpty(guest)) { if (StringUtils.isNotEmpty(guest)) {
allGuests = guest.split("\\|"); allGuests = guest.split("\\|");
} }

4
designer-realize/src/com/fr/design/mainframe/bbs/BBSDialog.java

@ -6,7 +6,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.general.SiteCenter; import com.fr.general.CloudCenter;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
@ -96,7 +96,7 @@ public class BBSDialog extends UIDialog {
public void changed(ObservableValue<? extends String> observable, final String oldValue, String newValue) { public void changed(ObservableValue<? extends String> observable, final String oldValue, String newValue) {
disableLink(eng); disableLink(eng);
// webView好像默认以手机版显示网页,浏览器里过滤掉这个跳转 // webView好像默认以手机版显示网页,浏览器里过滤掉这个跳转
if (ComparatorUtils.equals(newValue, url) || ComparatorUtils.equals(newValue, SiteCenter.getInstance().acquireUrlByKind("bbs.mobile"))) { if (ComparatorUtils.equals(newValue, url) || ComparatorUtils.equals(newValue, CloudCenter.getInstance().acquireUrlByKind("bbs.mobile"))) {
return; return;
} }
PluginWebBridge.getHelper().openUrlAtLocalWebBrowser(eng, newValue); PluginWebBridge.getHelper().openUrlAtLocalWebBrowser(eng, newValue);

12
designer-realize/src/com/fr/design/mainframe/bbs/BBSLoginDialog.java

@ -105,8 +105,8 @@ public class BBSLoginDialog extends UIDialog {
nameField = new UITextField(); nameField = new UITextField();
passField = new UIPassWordField(); passField = new UIPassWordField();
loginButton = new UIButton(Inter.getLocText("FR-Designer-BBSLogin_Login")); loginButton = new UIButton(Inter.getLocText("FR-Designer-BBSLogin_Login"));
passwordReset = getURLActionLabel(SiteCenter.getInstance().acquireUrlByKind("bbs.reset")); passwordReset = getURLActionLabel(CloudCenter.getInstance().acquireUrlByKind("bbs.reset"));
registerLabel = getURLActionLabel(SiteCenter.getInstance().acquireUrlByKind("bbs.register")); registerLabel = getURLActionLabel(CloudCenter.getInstance().acquireUrlByKind("bbs.register"));
loginButton.addActionListener(new ActionListener() { loginButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent arg0) { public void actionPerformed(ActionEvent arg0) {
@ -163,7 +163,7 @@ public class BBSLoginDialog extends UIDialog {
} }
private boolean testConnection() { private boolean testConnection() {
HttpClient client = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("bbs.test")); HttpClient client = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("bbs.test"));
return client.isServerAlive(); return client.isServerAlive();
} }
@ -283,8 +283,8 @@ public class BBSLoginDialog extends UIDialog {
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
FineLoggerFactory.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.login") + "&username=" + username + "&password=" + password; String url = CloudCenter.getInstance().acquireUrlByKind("bbs.login") + "&username=" + username + "&password=" + password;
String loginSuccessFlag = SiteCenter.getInstance().acquireUrlByKind("bbs"); String loginSuccessFlag = CloudCenter.getInstance().acquireUrlByKind("bbs");
HttpClient client = new HttpClient(url); HttpClient client = new HttpClient(url);
client.setTimeout(TIME_OUT); client.setTimeout(TIME_OUT);
if (client.getResponseCodeNoException() == HttpURLConnection.HTTP_OK) { if (client.getResponseCodeNoException() == HttpURLConnection.HTTP_OK) {
@ -303,7 +303,7 @@ public class BBSLoginDialog extends UIDialog {
private BoxCenterAligmentPane getURLActionLabel(final String url) { private BoxCenterAligmentPane getURLActionLabel(final String url) {
ActionLabel actionLabel = new ActionLabel(url); ActionLabel actionLabel = new ActionLabel(url);
if (ComparatorUtils.equals(url, SiteCenter.getInstance().acquireUrlByKind("bbs.reset"))) { if (ComparatorUtils.equals(url, CloudCenter.getInstance().acquireUrlByKind("bbs.reset"))) {
actionLabel.setText(Inter.getLocText("FR-Designer-BBSLogin_Forgot-Password")); actionLabel.setText(Inter.getLocText("FR-Designer-BBSLogin_Forgot-Password"));
} else { } else {
actionLabel.setText(Inter.getLocText("FR-Designer-BBSLogin_Register-Account")); actionLabel.setText(Inter.getLocText("FR-Designer-BBSLogin_Register-Account"));

8
designer-realize/src/com/fr/design/mainframe/bbs/UserInfoLabel.java

@ -18,10 +18,10 @@ import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.DateUtils; import com.fr.general.DateUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
@ -93,7 +93,7 @@ public class UserInfoLabel extends UILabel {
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
if (StringUtils.isNotEmpty(userName)) { if (StringUtils.isNotEmpty(userName)) {
try { try {
String loginUrl = SiteCenter.getInstance().acquireUrlByKind("bbs.default"); String loginUrl = CloudCenter.getInstance().acquireUrlByKind("bbs.default");
Desktop.getDesktop().browse(new URI(loginUrl)); Desktop.getDesktop().browse(new URI(loginUrl));
} catch (Exception exp) { } catch (Exception exp) {
FRContext.getLogger().info(exp.getMessage()); FRContext.getLogger().info(exp.getMessage());
@ -151,7 +151,7 @@ public class UserInfoLabel extends UILabel {
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRContext.getLogger().error(e.getMessage()); FRContext.getLogger().error(e.getMessage());
} }
HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("bbs.popup")); HttpClient hc = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("bbs.popup"));
if (!hc.isServerAlive()) { if (!hc.isServerAlive()) {
return; return;
} }
@ -164,7 +164,7 @@ public class UserInfoLabel extends UILabel {
Constructor constructor = clazz.getConstructor(Frame.class); Constructor constructor = clazz.getConstructor(Frame.class);
Object instance = constructor.newInstance(DesignerContext.getDesignerFrame()); Object instance = constructor.newInstance(DesignerContext.getDesignerFrame());
Method showWindow = clazz.getMethod("showWindow", String.class); Method showWindow = clazz.getMethod("showWindow", String.class);
showWindow.invoke(instance, SiteCenter.getInstance().acquireUrlByKind("bbs.popup")); showWindow.invoke(instance, CloudCenter.getInstance().acquireUrlByKind("bbs.popup"));
DesignerEnvManager.getEnvManager().setLastShowBBSNewsTime(DateUtils.DATEFORMAT2.format(new Date())); DesignerEnvManager.getEnvManager().setLastShowBBSNewsTime(DateUtils.DATEFORMAT2.format(new Date()));
} catch (Throwable ignored) { } catch (Throwable ignored) {
// ignored // ignored

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

@ -2,10 +2,10 @@ package com.fr.design.mainframe.errorinfo;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.mainframe.SiteCenterToken; import com.fr.design.mainframe.SiteCenterToken;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
@ -89,7 +89,7 @@ public class ErrorInfoUploader {
private void downloadSolution(File localCacheZip) { private void downloadSolution(File localCacheZip) {
try { try {
String downloadURL = SiteCenter.getInstance().acquireUrlByKind("solution.download", "http://cloud.fanruan.com/api/solution"); String downloadURL = CloudCenter.getInstance().acquireUrlByKind("solution.download", "http://cloud.fanruan.com/api/solution");
downloadURL = String.format("%s?token=%s", downloadURL, SiteCenterToken.generateToken()); downloadURL = String.format("%s?token=%s", downloadURL, SiteCenterToken.generateToken());
HttpClient hc = new HttpClient(downloadURL); HttpClient hc = new HttpClient(downloadURL);
hc.asGet(); hc.asGet();
@ -110,7 +110,7 @@ public class ErrorInfoUploader {
private boolean needUpdate(File localCacheZip) { private boolean needUpdate(File localCacheZip) {
if (localCacheZip.exists()) { if (localCacheZip.exists()) {
// 判断本地文件大小. // 判断本地文件大小.
String checkURL = SiteCenter.getInstance().acquireUrlByKind("solution.check", "http://cloud.fanruan.com/api/solution/cache/check"); String checkURL = CloudCenter.getInstance().acquireUrlByKind("solution.check", "http://cloud.fanruan.com/api/solution/cache/check");
checkURL = String.format("%s?token=%s", checkURL, SiteCenterToken.generateToken()); checkURL = String.format("%s?token=%s", checkURL, SiteCenterToken.generateToken());
HttpClient client = new HttpClient(checkURL); HttpClient client = new HttpClient(checkURL);
client.asGet(); client.asGet();
@ -156,7 +156,7 @@ public class ErrorInfoUploader {
continue; continue;
} }
String url = SiteCenter.getInstance().acquireUrlByKind("design.error"); String url = CloudCenter.getInstance().acquireUrlByKind("design.error");
if (sendErroInfo(url, content)) { if (sendErroInfo(url, content)) {
file.delete(); file.delete();
} }

501
designer-realize/src/com/fr/design/module/DesignerModule.java

@ -1,501 +0,0 @@
package com.fr.design.module;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.Formula;
import com.fr.base.MultiFieldParameter;
import com.fr.base.Style;
import com.fr.base.TempNameStyle;
import com.fr.base.extension.FileExtension;
import com.fr.base.frpx.exception.FRPackageRunTimeException;
import com.fr.base.frpx.exception.InvalidWorkBookException;
import com.fr.base.io.XMLEncryptUtils;
import com.fr.base.process.ProcessOperator;
import com.fr.base.remote.RemoteDeziConstants;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.BiasCellAction;
import com.fr.design.actions.insert.cell.ChartCellAction;
import com.fr.design.actions.insert.cell.DSColumnCellAction;
import com.fr.design.actions.insert.cell.FormulaCellAction;
import com.fr.design.actions.insert.cell.GeneralCellAction;
import com.fr.design.actions.insert.cell.ImageCellAction;
import com.fr.design.actions.insert.cell.RichTextCellAction;
import com.fr.design.actions.insert.cell.SubReportCellAction;
import com.fr.design.actions.insert.flot.ChartFloatAction;
import com.fr.design.actions.insert.flot.FormulaFloatAction;
import com.fr.design.actions.insert.flot.ImageFloatAction;
import com.fr.design.actions.insert.flot.TextBoxFloatAction;
import com.fr.design.actions.server.StyleListAction;
import com.fr.design.fun.ElementUIProvider;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.javascript.ProcessTransitionAdapter;
import com.fr.design.mainframe.App;
import com.fr.design.mainframe.DecodeDialog;
import com.fr.design.mainframe.InformationCollector;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JWorkBook;
import com.fr.design.mainframe.bbs.BBSGuestPane;
import com.fr.design.mainframe.form.FormECCompositeProvider;
import com.fr.design.mainframe.form.FormECDesignerProvider;
import com.fr.design.mainframe.form.FormElementCaseDesigner;
import com.fr.design.mainframe.form.FormReportComponentComposite;
import com.fr.design.mainframe.loghandler.DesignerLogImpl;
import com.fr.design.parameter.WorkBookParameterReader;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.FILE;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import com.fr.general.ModuleContext;
import com.fr.general.xml.GeneralXMLTools;
import com.fr.io.importer.Excel2007ReportImporter;
import com.fr.io.importer.ExcelReportImporter;
import com.fr.io.utils.ResourceIOUtils;
import com.fr.main.impl.WorkBook;
import com.fr.main.impl.WorkBookAdapter;
import com.fr.main.impl.WorkBookX;
import com.fr.quickeditor.cellquick.CellBiasTextPainterEditor;
import com.fr.quickeditor.cellquick.CellDSColumnEditor;
import com.fr.quickeditor.cellquick.CellFormulaQuickEditor;
import com.fr.quickeditor.cellquick.CellImageQuickEditor;
import com.fr.quickeditor.cellquick.CellRichTextEditor;
import com.fr.quickeditor.cellquick.CellStringQuickEditor;
import com.fr.quickeditor.cellquick.CellSubReportEditor;
import com.fr.quickeditor.chartquick.BasicChartQuickEditor;
import com.fr.quickeditor.chartquick.FloatChartQuickEditor;
import com.fr.quickeditor.floatquick.FloatImageQuickEditor;
import com.fr.quickeditor.floatquick.FloatStringQuickEditor;
import com.fr.report.cell.CellElementValueConverter;
import com.fr.report.cell.cellattr.core.RichText;
import com.fr.report.cell.cellattr.core.SubReport;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.painter.BiasTextPainter;
import com.fr.report.cell.painter.CellImagePainter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.fun.LogProvider;
import com.fr.stable.script.CalculatorProviderContext;
import com.fr.stable.script.ValueConverter;
import com.fr.stable.web.ServletContext;
import com.fr.stable.web.ServletContextAdapter;
import com.fr.stable.xml.ObjectTokenizer;
import com.fr.stable.xml.ObjectXMLWriterFinder;
import com.fr.start.BBSGuestPaneProvider;
import com.fr.xml.ReportXMLUtils;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Set;
public class DesignerModule extends DesignModule {
static {
ServletContext.addServletContextListener(new ServletContextAdapter() {
@Override
public void onServletStart() {
ModuleContext.startModule(DesignerModule.class.getName());
}
});
}
/**
* 启动设计器模块
*/
@Override
public void start() {
super.start();
justStartModules4Engine();
justStartModules4Designer();
CalculatorProviderContext.setValueConverter(valueConverter());
GeneralXMLTools.Object_Tokenizer = startXMLReadObjectTokenizer();
GeneralXMLTools.Object_XML_Writer_Finder = startObjectXMLWriterFinder();
addAdapterForPlate();
registerCellEditor();
registerFloatEditor();
registerData4Form();
registerOtherPane();
InformationCollector.getInstance().collectStartTime();
ExtraDesignClassManager.getInstance().getFeedback().didFeedback();
StableFactory.registerMarkedObject(LogProvider.MARK_STRING, DesignerLogImpl.getInstance());
}
private void registerOtherPane() {
StableFactory.registerMarkedClass(BBSGuestPaneProvider.XML_TAG, BBSGuestPane.class);
}
/**
* kunsnat:注册单元格选中Editor
*/
private void registerCellEditor() {
ActionFactory.registerCellEditor(String.class, new CellStringQuickEditor());
ActionFactory.registerCellEditor(Number.class, new CellStringQuickEditor());
ActionFactory.registerCellEditor(BaseFormula.class, new CellFormulaQuickEditor());
ActionFactory.registerCellEditor(SubReport.class, new CellSubReportEditor());
ActionFactory.registerCellEditor(RichText.class, new CellRichTextEditor());
ActionFactory.registerCellEditor(DSColumn.class, new CellDSColumnEditor());
ActionFactory.registerCellEditor(Image.class, new CellImageQuickEditor());
ActionFactory.registerCellEditor(BiasTextPainter.class, new CellBiasTextPainterEditor());
ActionFactory.registerCellEditor(BufferedImage.class, new CellImageQuickEditor());
ActionFactory.registerCellEditor(CellImagePainter.class, new CellImageQuickEditor());
//todo 图表编辑器populate没能实现刷新面板显示
ActionFactory.registerChartCellEditorInEditor(BasicChartQuickEditor.class);
Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING);
for (ElementUIProvider provider : providers) {
try {
ActionFactory.registerCellEditor(provider.targetObjectClass(), provider.quickEditor().newInstance());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
@Override
public String getInterNationalName() {
return Inter.getLocText("FR-Module_Designer");
}
/**
* kunnat: 注册悬浮选中Editor
*/
private void registerFloatEditor() {
ActionFactory.registerFloatEditor(String.class, new FloatStringQuickEditor());
ActionFactory.registerFloatEditor(Formula.class, new FloatStringQuickEditor());
ActionFactory.registerFloatEditor(Image.class, new FloatImageQuickEditor());
ActionFactory.registerFloatEditor(BufferedImage.class, new FloatImageQuickEditor());
ActionFactory.registerFloatEditor(CellImagePainter.class, new FloatImageQuickEditor());
//todo 图表编辑器populate没能实现刷新面板显示
ActionFactory.registerChartFloatEditorInEditor(FloatChartQuickEditor.class);
}
/**
* kunsnat: 一些模块信息 必须跟随设计器启动,
* 比如 读取CC.XML, 设计器启动之后, 马上会读取XML, 需要Chart_Module中的注册信息
*/
private void justStartModules4Engine() {
ModuleContext.startModule(ENGINE_MODULE);
}
private void justStartModules4Designer() {
ModuleContext.startModule(CHART_DESIGNER_MODULE);
ModuleContext.startModule(FORM_DESIGNER_MODULE);
}
/**
* CellElementValueConverter用来处理设计器格子里的值将公式/数组/其他元素转换成对应的值
*
* @return 返回处理格子值的转换器
*/
@Override
public ValueConverter valueConverter() {
return new CellElementValueConverter();
}
@Override
/*
* 针对不同的对象在读取Object对象的xml的时候需要使用不同的对象生成器
* @return 返回对象生成器
*/
public ObjectTokenizer startXMLReadObjectTokenizer() {
return new ReportXMLUtils.ReportObjectTokenizer();
}
/**
* 针对不同的对象在写对象的XML时需要使用不同的XML生成器
*
* @return 返回xml生成器
*/
@Override
public ObjectXMLWriterFinder startObjectXMLWriterFinder() {
return new ReportXMLUtils.ReportObjectXMLWriterFinder();
}
//wei:fs的模块中可能有需要设计器界面做设置的地方,在这边添加
private void addAdapterForPlate() {
ProcessTransitionAdapter.setProcessTransitionAdapter(new ProcessTransitionAdapter() {
@Override
protected String[] getTransitionNamesByBook(String book) {
return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getTransitionNamesByBook(book);
}
@Override
protected String[] getParaNames(String book) {
return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getParaNames(book);
}
@Override
protected ParameterProvider[] getParas(String book) {
return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getParas(book);
}
@Override
protected MultiFieldParameter[] getAllMultiFieldParas(String book) {
return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getAllMultiFieldParas(book);
}
});
}
private static abstract class AbstractWorkBookApp implements App<WorkBook> {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public JTemplate<WorkBook, ?> openTemplate(FILE tplFile) {
return new JWorkBook(asIOFile(tplFile), tplFile);
}
@Override
public String mark4Provider() {
return getClass().getName();
}
@Override
public void process() {
}
@Override
public void undo() {
}
}
@Override
/*
* 返回设计器能打开的模板类型的一个数组列表
* @return 可以打开的模板类型的数组
*/
public App[] apps4TemplateOpener() {
return new App[]{getCptxApp(), getCptApp(), getXlsApp(), getXlsxApp()};
}
private AbstractWorkBookApp getXlsxApp() {
return new AbstractWorkBookApp() {
@Override
public String[] defaultExtensions() {
return new String[]{FileExtension.XLSX.getExtension()};
}
@Override
public WorkBook asIOFile(FILE tplFile) {
WorkBook workbook = null;
try {
workbook = new Excel2007ReportImporter().generateWorkBookByStream(tplFile.asInputStream());
} catch (Exception exp) {
FRContext.getLogger().error("Failed to generate xlsx from " + tplFile, exp);
}
return workbook;
}
};
}
private AbstractWorkBookApp getXlsApp() {
return new AbstractWorkBookApp() {
@Override
public String[] defaultExtensions() {
return new String[]{FileExtension.XLS.getExtension()};
}
@Override
public WorkBook asIOFile(FILE tplFile) {
WorkBook workbook = null;
try {
workbook = new ExcelReportImporter().generateWorkBookByStream(tplFile.asInputStream());
} catch (Exception exp) {
FRContext.getLogger().error("Failed to generate xls from " + tplFile, exp);
}
return workbook;
}
};
}
private AbstractWorkBookApp getCptApp() {
return new AbstractWorkBookApp() {
@Override
public String[] defaultExtensions() {
return new String[]{FileExtension.CPT.getExtension()};
}
@Override
public WorkBook asIOFile(FILE file) {
if (XMLEncryptUtils.isCptEncoded() &&
!XMLEncryptUtils.checkVaild(DesignerEnvManager.getEnvManager().getEncryptionKey())) {
if (!new DecodeDialog(file).isPwdRight()) {
FRContext.getLogger().error(Inter.getLocText("ECP-error_pwd"));
return new WorkBook();
}
}
WorkBook tpl = new WorkBook();
// richer:打开报表通知
FRContext.getLogger().info(Inter.getLocText(new String[]{"LOG-Is_Being_Openned", "LOG-Please_Wait"}, new String[]{"\"" + file.getName() + "\"" + ",", "..."}));
TempNameStyle namestyle = TempNameStyle.getInstance();
namestyle.clear();
String checkStr = StringUtils.EMPTY;
try {
checkStr = ResourceIOUtils.inputStream2String(file.asInputStream());
tpl.readStream(file.asInputStream());
} catch (Exception exp) {
String errorMessage = StringUtils.EMPTY;
errorMessage = ComparatorUtils.equals(RemoteDeziConstants.INVALID_USER, checkStr) ? Inter.getLocText("FR-Designer_No-Privilege")
: Inter.getLocText("NS-exception_readError");
FRContext.getLogger().error(errorMessage + file, exp);
}
checkNameStyle(namestyle);
return tpl;
}
};
}
private AbstractWorkBookApp getCptxApp() {
return new AbstractWorkBookApp() {
@Override
public String[] defaultExtensions() {
return new String[]{FileExtension.CPTX.getExtension()};
}
@Override
public WorkBook asIOFile(FILE file) {
FRContext.getLogger().info(Inter.getLocText(new String[]{"LOG-Is_Being_Openned", "LOG-Please_Wait"}, new String[]{"\"" + file.getName() + "\"" + ",", "..."}));
WorkBookX tpl;
InputStream inputStream;
try {
inputStream = file.asInputStream();
long time = System.currentTimeMillis();
tpl = new WorkBookX(inputStream);
FRContext.getLogger().error("cost: " + (System.currentTimeMillis() - time) + " ms");
} catch (Exception exp) {
if (exp instanceof FRPackageRunTimeException) {
throw (FRPackageRunTimeException) exp;
}
throw new InvalidWorkBookException(file + ":" + exp.getMessage(), exp);
}
return new WorkBookAdapter(tpl);
}
};
}
private static void checkNameStyle(TempNameStyle namestyle) {
Iterator it = namestyle.getIterator();
ArrayList<String> al = new ArrayList<String>();
while (it.hasNext()) {
al.add((String) it.next());
}
if (!al.isEmpty()) {
showConfirmDialog(al);
}
}
private static void showConfirmDialog(final ArrayList<String> namelist) {
final JDialog jd = new JDialog();
// 模态一下,因为可能会多个样式丢失
// jd.setModal(true);
jd.setAlwaysOnTop(true);
jd.setSize(450, 150);
jd.setResizable(false);
jd.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png"));
String message = namelist.toString().replaceAll("\\[", "").replaceAll("\\]", "");
UILabel jl = new UILabel(Inter.getLocText(new String[]{"Current_custom_global", "Has_been_gone"}, new String[]{message}));
jl.setHorizontalAlignment(SwingConstants.CENTER);
jd.add(jl, BorderLayout.CENTER);
JPanel jp = new JPanel();
// ”是“按钮,点击之后将生成一个全局样式,并写入xml
UIButton confirmButton = new UIButton(Inter.getLocText("FR-Designer_Yes"));
confirmButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
for (int i = 0; i < namelist.size(); i++) {
ServerPreferenceConfig.getInstance().putStyle(namelist.get(i), Style.DEFAULT_STYLE);
}
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage());
}
jd.dispose();
new StyleListAction().actionPerformed(e);// 弹窗
}
});
UIButton noButton = new UIButton(Inter.getLocText("FR-Designer_No"));
noButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
jd.dispose();
}
});
jp.add(confirmButton);
jp.add(noButton);
jd.setTitle(Inter.getLocText("FR-Custom_styles_lost"));
jd.add(jp, BorderLayout.SOUTH);
GUICoreUtils.centerWindow(jd);
jd.setVisible(true);
}
@Override
public Class<?>[] actionsForInsertCellElement() {
return (Class<?>[]) ArrayUtils.addAll(new Class<?>[]{
DSColumnCellAction.class,
GeneralCellAction.class,
RichTextCellAction.class,
FormulaCellAction.class,
ChartCellAction.class,
ImageCellAction.class,
BiasCellAction.class,
SubReportCellAction.class
}, super.actionsForInsertCellElement());
}
@Override
public Class<?>[] actionsForInsertFloatElement() {
return (Class<?>[]) ArrayUtils.addAll(new Class<?>[]{
TextBoxFloatAction.class,
FormulaFloatAction.class,
ChartFloatAction.class,
ImageFloatAction.class
}, super.actionsForInsertFloatElement());
}
private void registerData4Form() {
StableFactory.registerMarkedClass(FormECDesignerProvider.XML_TAG, FormElementCaseDesigner.class);
StableFactory.registerMarkedClass(FormECCompositeProvider.XML_TAG, FormReportComponentComposite.class);
DesignModuleFactory.registerParameterReader(new WorkBookParameterReader());
}
}

4
designer-realize/src/com/fr/design/report/share/ShareButton.java

@ -17,9 +17,9 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.general.CloudCenter;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.general.SiteCenter;
import com.fr.io.exporter.ImageExporter; import com.fr.io.exporter.ImageExporter;
import com.fr.main.TemplateWorkBook; import com.fr.main.TemplateWorkBook;
import com.fr.main.workbook.ResultWorkBook; import com.fr.main.workbook.ResultWorkBook;
@ -66,7 +66,7 @@ public class ShareButton extends UIButton{
//打开论坛, url可在bbs.properties中配置 //打开论坛, url可在bbs.properties中配置
private void openBBS(){ private void openBBS(){
try { try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.share"))); Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.share")));
} catch (Exception e1) { } catch (Exception e1) {
FRContext.getLogger().error(e1.getMessage()); FRContext.getLogger().error(e1.getMessage());
} }

45
designer-realize/src/com/fr/poly/PolyDesignUI.java

@ -3,30 +3,23 @@
*/ */
package com.fr.poly; package com.fr.poly;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.text.DecimalFormat;
import java.util.ArrayList;
import javax.swing.JComponent;
import javax.swing.JScrollBar;
import javax.swing.plaf.ComponentUI;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.Margin; import com.fr.base.Margin;
import com.fr.base.PaperSize; import com.fr.base.PaperSize;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.main.FineBook;
import com.fr.page.PaperSettingProvider; import com.fr.page.PaperSettingProvider;
import com.fr.page.ReportSettingsProvider; import com.fr.page.ReportSettingsProvider;
import com.fr.page.WatermarkPainter;
import com.fr.poly.creator.BlockCreator; import com.fr.poly.creator.BlockCreator;
import com.fr.poly.creator.ECBlockCreator;
import com.fr.poly.creator.ECBlockEditor;
import com.fr.poly.model.AddedData; import com.fr.poly.model.AddedData;
import com.fr.poly.model.AddingData; import com.fr.poly.model.AddingData;
import com.fr.report.core.ReportUtils;
import com.fr.report.report.Report; import com.fr.report.report.Report;
import com.fr.report.report.TemplateReport; import com.fr.report.report.TemplateReport;
import com.fr.report.stable.ReportConstants; import com.fr.report.stable.ReportConstants;
@ -34,6 +27,21 @@ import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper; import com.fr.stable.CoreGraphHelper;
import com.fr.stable.unit.UNIT; import com.fr.stable.unit.UNIT;
import javax.swing.JComponent;
import javax.swing.JScrollBar;
import javax.swing.plaf.ComponentUI;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.text.DecimalFormat;
import java.util.ArrayList;
/** /**
* @author richer * @author richer
* @since 6.5.3 聚合报表设计块的ui类 * @since 6.5.3 聚合报表设计块的ui类
@ -48,6 +56,7 @@ public class PolyDesignUI extends ComponentUI {
private PolyDesigner designer; private PolyDesigner designer;
private int resolution; private int resolution;
private float time; private float time;
private WatermarkPainter watermarkPainter;
public PolyDesignUI(int resolution) { public PolyDesignUI(int resolution) {
if (resolution == 0){ if (resolution == 0){
@ -97,6 +106,18 @@ public class PolyDesignUI extends ComponentUI {
paintAddingData(g2d, addData); paintAddingData(g2d, addData);
} }
paintPaginateLine(g2d); paintPaginateLine(g2d);
paintWatermark(g2d, designer.getTarget().getBook(), c.getWidth(), c.getHeight());
}
// 绘制水印
private void paintWatermark(Graphics2D g2d, FineBook book, int width, int height) {
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(book);
// 不要每次都 new 一个 WatermarkPainter
if (watermarkPainter == null || !ComparatorUtils.equals(watermarkPainter.getWatermark(), watermark)) {
watermarkPainter = new WatermarkPainter(watermark);
}
watermarkPainter.paint(g2d, width, height);
} }
private void paintAddedData(Graphics g) { private void paintAddedData(Graphics g) {

10
designer-realize/src/com/fr/start/CollectUserInformationDialog.java

@ -12,9 +12,9 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.ActiveKeyGenerator; import com.fr.design.mainframe.ActiveKeyGenerator;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -40,10 +40,10 @@ public class CollectUserInformationDialog extends UIDialog {
private static final int ONLINE_VERIFY_TIMEOUT = 30 * 1000; private static final int ONLINE_VERIFY_TIMEOUT = 30 * 1000;
private static final String CN_LOGIN_HTML = SiteCenter.getInstance().acquireUrlByKind("frlogin.cn"); private static final String CN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.cn");
private static final String EN_LOGIN_HTML = SiteCenter.getInstance().acquireUrlByKind("frlogin.en"); private static final String EN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.en");
private static final String TW_LOGIN_HTML = SiteCenter.getInstance().acquireUrlByKind("frlogin.tw"); private static final String TW_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.tw");
private static final String JP_LOGIN_HTML = SiteCenter.getInstance().acquireUrlByKind("frlogin.jp"); private static final String JP_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.jp");
private UITextField keyTextField; private UITextField keyTextField;

30
designer-realize/src/com/fr/start/Designer.java

@ -35,12 +35,14 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.design.module.DesignerModule;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.module.Module; import com.fr.module.Module;
import com.fr.module.ModuleContext; import com.fr.module.ModuleContext;
import com.fr.stable.BuildContext; import com.fr.stable.BuildContext;
@ -56,9 +58,14 @@ import com.fr.start.preload.ImagePreLoader;
import com.fr.start.server.ServerTray; import com.fr.start.server.ServerTray;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.*; import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.border.MatteBorder; import javax.swing.border.MatteBorder;
import java.awt.*; import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.File; import java.io.File;
@ -90,9 +97,15 @@ public class Designer extends BaseDesigner {
* @param args 参数 * @param args 参数
*/ */
public static void main(String[] args) { public static void main(String[] args) {
preloadResource();
BuildContext.setBuildFilePath("/com/fr/stable/build.properties"); BuildContext.setBuildFilePath("/com/fr/stable/build.properties");
preloadResource();
SplashContext.getInstance().registerSplash(createSplash()); SplashContext.getInstance().registerSplash(createSplash());
// 如果端口被占用了 说明程序已经运行了一次,也就是说,已经建立一个监听服务器,现在只要给服务器发送命令就好了
if (DesignUtils.isStarted()) {
DesignUtils.clientSend(args);
return;
}
SplashContext.getInstance().show(); SplashContext.getInstance().show();
Module designerRoot = ModuleContext.parseRoot("designer-startup.xml"); Module designerRoot = ModuleContext.parseRoot("designer-startup.xml");
//传递启动参数 //传递启动参数
@ -111,7 +124,7 @@ public class Designer extends BaseDesigner {
service.submit(new Runnable() { service.submit(new Runnable() {
@Override @Override
public void run() { public void run() {
SiteCenter.getInstance(); CloudCenter.getInstance();
Cursor cursor = UIConstants.CELL_DEFAULT_CURSOR; Cursor cursor = UIConstants.CELL_DEFAULT_CURSOR;
} }
}); });
@ -146,11 +159,6 @@ public class Designer extends BaseDesigner {
super(args); super(args);
} }
@Override
protected String module2Start() {
return DesignerModule.class.getName();
}
/** /**
* 创建新建文件的快捷方式数组 * 创建新建文件的快捷方式数组

10
designer-realize/src/com/fr/start/fx/FastGifImage.java

@ -97,17 +97,7 @@ public class FastGifImage extends WritableImage {
} }
} }
private void finishImage(Exception e) {
e.printStackTrace();
}
private void finishImage(ImageLoader loader) { private void finishImage(ImageLoader loader) {
final Exception loadingException = loader.getException();
if (loadingException != null) {
finishImage(loadingException);
return;
}
initializeAnimatedImage(loader); initializeAnimatedImage(loader);
} }

720
designer-realize/src/com/fr/start/module/DesignerModuleActivator.java

@ -1,12 +1,165 @@
package com.fr.start.module; package com.fr.start.module;
import com.fr.design.mainframe.loghandler.socketio.DesignerSocketIO; import com.fr.base.BaseFormula;
import com.fr.design.module.ChartDesignerModule; import com.fr.base.BaseUtils;
import com.fr.design.module.DesignerModule; import com.fr.base.FRContext;
import com.fr.base.Formula;
import com.fr.base.MultiFieldParameter;
import com.fr.base.Style;
import com.fr.base.TempNameStyle;
import com.fr.base.extension.FileExtension;
import com.fr.base.frpx.exception.FRPackageRunTimeException;
import com.fr.base.frpx.exception.InvalidWorkBookException;
import com.fr.base.io.XMLEncryptUtils;
import com.fr.base.process.ProcessOperator;
import com.fr.base.remote.RemoteDeziConstants;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.BiasCellAction;
import com.fr.design.actions.insert.cell.ChartCellAction;
import com.fr.design.actions.insert.cell.DSColumnCellAction;
import com.fr.design.actions.insert.cell.FormulaCellAction;
import com.fr.design.actions.insert.cell.GeneralCellAction;
import com.fr.design.actions.insert.cell.ImageCellAction;
import com.fr.design.actions.insert.cell.RichTextCellAction;
import com.fr.design.actions.insert.cell.SubReportCellAction;
import com.fr.design.actions.insert.flot.ChartFloatAction;
import com.fr.design.actions.insert.flot.FormulaFloatAction;
import com.fr.design.actions.insert.flot.ImageFloatAction;
import com.fr.design.actions.insert.flot.TextBoxFloatAction;
import com.fr.design.actions.server.StyleListAction;
import com.fr.design.bridge.DesignToolbarProvider;
import com.fr.design.chart.ChartDialog;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.form.parameter.FormParaDesigner;
import com.fr.design.fun.ElementUIProvider;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.hyperlink.ReportletHyperlinkPane;
import com.fr.design.hyperlink.WebHyperlinkPane;
import com.fr.design.javascript.EmailPane;
import com.fr.design.javascript.JavaScriptImplPane;
import com.fr.design.javascript.ParameterJavaScriptPane;
import com.fr.design.javascript.ProcessTransitionAdapter;
import com.fr.design.mainframe.AbstractAppProvider;
import com.fr.design.mainframe.App;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.ChartPropertyPane;
import com.fr.design.mainframe.DecodeDialog;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.ElementCaseThumbnail;
import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.InformationCollector;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JWorkBook;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.WidgetToolBarPane;
import com.fr.design.mainframe.actions.NewFormAction;
import com.fr.design.mainframe.bbs.BBSGuestPane;
import com.fr.design.mainframe.form.FormECCompositeProvider;
import com.fr.design.mainframe.form.FormECDesignerProvider;
import com.fr.design.mainframe.form.FormElementCaseDesigner;
import com.fr.design.mainframe.form.FormReportComponentComposite;
import com.fr.design.mainframe.loghandler.DesignerLogImpl;
import com.fr.design.mainframe.loghandler.LogMessageBar;
import com.fr.design.module.ChartHyperlinkGroup;
import com.fr.design.module.ChartPreStyleAction;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.parameter.FormParameterReader;
import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.design.parameter.WorkBookParameterReader;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane;
import com.fr.file.FILE;
import com.fr.form.main.Form;
import com.fr.form.stable.ElementCaseThumbnailProcessor;
import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.general.ModuleContext; import com.fr.general.ModuleContext;
import com.fr.general.xml.GeneralXMLTools;
import com.fr.io.importer.Excel2007ReportImporter;
import com.fr.io.importer.ExcelReportImporter;
import com.fr.io.utils.ResourceIOUtils;
import com.fr.js.EmailJavaScript;
import com.fr.js.JavaScriptImpl;
import com.fr.js.ParameterJavaScript;
import com.fr.js.ReportletHyperlink;
import com.fr.js.WebHyperlink;
import com.fr.locale.InterMutableKey; import com.fr.locale.InterMutableKey;
import com.fr.log.FineLoggerFactory;
import com.fr.main.impl.WorkBook;
import com.fr.main.impl.WorkBookAdapter;
import com.fr.main.impl.WorkBookX;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.module.extension.Prepare; import com.fr.module.extension.Prepare;
import com.fr.plugin.chart.vanchart.imgevent.design.DesignImageEvent;
import com.fr.quickeditor.cellquick.CellBiasTextPainterEditor;
import com.fr.quickeditor.cellquick.CellDSColumnEditor;
import com.fr.quickeditor.cellquick.CellFormulaQuickEditor;
import com.fr.quickeditor.cellquick.CellImageQuickEditor;
import com.fr.quickeditor.cellquick.CellRichTextEditor;
import com.fr.quickeditor.cellquick.CellStringQuickEditor;
import com.fr.quickeditor.cellquick.CellSubReportEditor;
import com.fr.quickeditor.chartquick.BasicChartQuickEditor;
import com.fr.quickeditor.chartquick.FloatChartQuickEditor;
import com.fr.quickeditor.floatquick.FloatImageQuickEditor;
import com.fr.quickeditor.floatquick.FloatStringQuickEditor;
import com.fr.report.cell.CellElementValueConverter;
import com.fr.report.cell.cellattr.core.RichText;
import com.fr.report.cell.cellattr.core.SubReport;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.painter.BiasTextPainter;
import com.fr.report.cell.painter.CellImagePainter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.fun.LogProvider;
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider;
import com.fr.stable.plugin.ExtraDesignClassManagerProvider;
import com.fr.stable.script.CalculatorProviderContext;
import com.fr.stable.script.ValueConverter;
import com.fr.stable.web.ServletContext;
import com.fr.stable.web.ServletContextAdapter;
import com.fr.stable.xml.ObjectTokenizer;
import com.fr.stable.xml.ObjectXMLWriterFinder;
import com.fr.start.BBSGuestPaneProvider;
import com.fr.van.chart.DownloadOnlineSourcesHelper;
import com.fr.van.chart.map.server.ChartMapEditorAction;
import com.fr.xml.ReportXMLUtils;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static com.fr.stable.module.Module.ENGINE_MODULE;
/** /**
* Created by juhaoyu on 2018/1/31. * Created by juhaoyu on 2018/1/31.
@ -15,17 +168,570 @@ import com.fr.module.extension.Prepare;
*/ */
public class DesignerModuleActivator extends Activator implements Prepare { public class DesignerModuleActivator extends Activator implements Prepare {
static {
ServletContext.addServletContextListener(new ServletContextAdapter() {
@Override
public void onServletStart() {
designerModuleStart();
}
});
}
@Override @Override
public void start() { public void start() {
designerModuleStart();
}
private static void designerModuleStart() {
if (com.fr.module.ModuleContext.getModule(DesignerModuleActivator.class).isRunning()) {
return;
}
App<?>[] apps = apps4TemplateOpener();
for (App<?> app : apps) {
DesignerFrame.registApp(app);
}
StableFactory.registerMarkedClass(ExtraDesignClassManagerProvider.XML_TAG, ExtraDesignClassManager.class);
ActionFactory.registerCellInsertActionClass(actionsForInsertCellElement());
ActionFactory.registerFloatInsertActionClass(actionsForInsertFloatElement());
DesignModuleFactory.registerCreators4Hyperlink(hyperlinkTypes());
justStartModules4Engine();
justStartModules4Designer();
CalculatorProviderContext.setValueConverter(valueConverter());
GeneralXMLTools.Object_Tokenizer = startXMLReadObjectTokenizer();
GeneralXMLTools.Object_XML_Writer_Finder = startObjectXMLWriterFinder();
addAdapterForPlate();
designerRegister();
InformationCollector.getInstance().collectStartTime();
ExtraDesignClassManager.getInstance().getFeedback().didFeedback();
StableFactory.registerMarkedObject(LogProvider.MARK_STRING, DesignerLogImpl.getInstance());
preLoadPane();
}
private static void preLoadPane() {
ExecutorService service = Executors.newCachedThreadPool();
service.submit(new Runnable() {
@Override
public void run() {
LogMessageBar.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
HistoryTemplateListPane.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
WidgetInfoConfig.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
CellElementPropertyPane.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
DesignerFrameFileDealerPane.getInstance();//这边会涉及到TemplateTreePane
}
});
service.submit(new Runnable() {
@Override
public void run() {
EastRegionContainerPane.getInstance();
}
});
service.shutdown();
}
private static Class<?>[] actionsForInsertCellElement() {
List<Class<?>> classes = new ArrayList<>();
Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING);
for (ElementUIProvider provider : providers) {
classes.add(provider.actionForInsertCellElement());
}
return ArrayUtils.addAll(new Class<?>[]{
DSColumnCellAction.class,
GeneralCellAction.class,
RichTextCellAction.class,
FormulaCellAction.class,
ChartCellAction.class,
ImageCellAction.class,
BiasCellAction.class,
SubReportCellAction.class
}, classes.toArray(new Class<?>[classes.size()]));
}
private static Class<?>[] actionsForInsertFloatElement() {
List<Class<?>> classes = new ArrayList<>();
Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING);
for (ElementUIProvider provider : providers) {
classes.add(provider.actionForInsertFloatElement());
}
return ArrayUtils.addAll(new Class<?>[]{
TextBoxFloatAction.class,
FormulaFloatAction.class,
ChartFloatAction.class,
ImageFloatAction.class
}, classes.toArray(new Class<?>[classes.size()]));
}
private static NameableCreator[] hyperlinkTypes() {
return new NameableCreator[]{
new NameObjectCreator(Inter.getLocText("FR-Hyperlink_Reportlet"), ReportletHyperlink.class, ReportletHyperlinkPane.ChartNoRename.class),
new NameObjectCreator(Inter.getLocText("FR-Designer_Email"), EmailJavaScript.class, EmailPane.class),
new NameObjectCreator(Inter.getLocText("Hyperlink-Web_link"), WebHyperlink.class, WebHyperlinkPane.ChartNoRename.class),
new NameObjectCreator(Inter.getLocText("JavaScript-Dynamic_Parameters"), ParameterJavaScript.class, ParameterJavaScriptPane.ChartNoRename.class),
new NameObjectCreator(Inter.getLocText("FR-Designer_JavaScript"), JavaScriptImpl.class, JavaScriptImplPane.ChartNoRename.class)
};
}
/**
* kunsnat: 一些模块信息 必须跟随设计器启动,
* 比如 读取CC.XML, 设计器启动之后, 马上会读取XML, 需要Chart_Module中的注册信息
*/
private static void justStartModules4Engine() {
ModuleContext.startModule(ENGINE_MODULE);
}
private static void justStartModules4Designer() {
chartDesignerRegister();
formDesignerRegister();
}
/**
* CellElementValueConverter用来处理设计器格子里的值将公式/数组/其他元素转换成对应的值
*
* @return 返回处理格子值的转换器
*/
private static ValueConverter valueConverter() {
return new CellElementValueConverter();
}
/*
* 针对不同的对象在读取Object对象的xml的时候需要使用不同的对象生成器
* @return 返回对象生成器
*/
private static ObjectTokenizer startXMLReadObjectTokenizer() {
return new ReportXMLUtils.ReportObjectTokenizer();
}
/**
* 针对不同的对象在写对象的XML时需要使用不同的XML生成器
*
* @return 返回xml生成器
*/
private static ObjectXMLWriterFinder startObjectXMLWriterFinder() {
return new ReportXMLUtils.ReportObjectXMLWriterFinder();
}
//wei:fs的模块中可能有需要设计器界面做设置的地方,在这边添加
private static void addAdapterForPlate() {
ProcessTransitionAdapter.setProcessTransitionAdapter(new ProcessTransitionAdapter() {
@Override
protected String[] getTransitionNamesByBook(String book) {
return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getTransitionNamesByBook(book);
}
@Override
protected String[] getParaNames(String book) {
return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getParaNames(book);
}
@Override
protected ParameterProvider[] getParas(String book) {
return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getParas(book);
}
@Override
protected MultiFieldParameter[] getAllMultiFieldParas(String book) {
return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getAllMultiFieldParas(book);
}
});
}
private static abstract class AbstractWorkBookApp implements App<WorkBook> {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public JTemplate<WorkBook, ?> openTemplate(FILE tplFile) {
return new JWorkBook(asIOFile(tplFile), tplFile);
}
@Override
public String mark4Provider() {
return getClass().getName();
}
@Override
public void process() {
}
@Override
public void undo() {
}
}
/*
* 返回设计器能打开的模板类型的一个数组列表
* @return 可以打开的模板类型的数组
*/
private static App[] apps4TemplateOpener() {
return new App[]{getCptxApp(), getCptApp(), getXlsApp(), getXlsxApp(), getFrmApp()};
}
private static AbstractWorkBookApp getXlsxApp() {
return new AbstractWorkBookApp() {
@Override
public String[] defaultExtensions() {
return new String[]{FileExtension.XLSX.getExtension()};
}
@Override
public WorkBook asIOFile(FILE tplFile) {
WorkBook workbook = null;
try {
workbook = new Excel2007ReportImporter().generateWorkBookByStream(tplFile.asInputStream());
} catch (Exception exp) {
FRContext.getLogger().error("Failed to generate xlsx from " + tplFile, exp);
}
return workbook;
}
};
}
private static AbstractAppProvider getFrmApp() {
return new AbstractAppProvider<Form>() {
@Override
public String[] defaultExtensions() {
return new String[]{"frm", "form"};
}
@Override
public JTemplate<Form, ?> openTemplate(FILE tplFile) {
HashMap<String, Class> classType = new HashMap<String, Class>();
classType.put(Constants.ARG_0, Form.class);
classType.put(Constants.ARG_1, FILE.class);
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG,
new Object[]{asIOFile(tplFile), tplFile}, classType, BaseJForm.class);
}
@Override
public Form asIOFile(FILE file) {
if (XMLEncryptUtils.isCptEncoded() &&
!XMLEncryptUtils.checkVaild(DesignerEnvManager.getEnvManager().getEncryptionKey())) {
if (!new DecodeDialog(file).isPwdRight()) {
FRContext.getLogger().error(Inter.getLocText("FR-Engine_ECP_error_pwd"));
return new Form();
}
}
// peter:打开新报表.
Form tpl = new Form();
// richer:打开报表通知
// FRContext.getLogger().info(Inter.getLocText("LOG-Is_Being_Openned") + "\"" + file.getName() + "\"" + "," + Inter.getLocText("LOG-Please_Wait") + "...");
FRContext.getLogger().info(Inter.getLocText(new String[]{"LOG-Is_Being_Openned", "LOG-Please_Wait"},
new String[]{"\"" + file.getName() + "\"" + ",", "..."}));
try {
tpl.readStream(file.asInputStream());
} catch (Exception exp) {
FRContext.getLogger().error("Failed to generate frm from " + file, exp);
return null;
}
return tpl;
}
};
}
private static AbstractWorkBookApp getXlsApp() {
return new AbstractWorkBookApp() {
@Override
public String[] defaultExtensions() {
return new String[]{FileExtension.XLS.getExtension()};
}
@Override
public WorkBook asIOFile(FILE tplFile) {
WorkBook workbook = null;
try {
workbook = new ExcelReportImporter().generateWorkBookByStream(tplFile.asInputStream());
} catch (Exception exp) {
FRContext.getLogger().error("Failed to generate xls from " + tplFile, exp);
}
return workbook;
}
};
}
private static AbstractWorkBookApp getCptApp() {
return new AbstractWorkBookApp() {
@Override
public String[] defaultExtensions() {
return new String[]{FileExtension.CPT.getExtension()};
}
@Override
public WorkBook asIOFile(FILE file) {
if (XMLEncryptUtils.isCptEncoded() &&
!XMLEncryptUtils.checkVaild(DesignerEnvManager.getEnvManager().getEncryptionKey())) {
if (!new DecodeDialog(file).isPwdRight()) {
FRContext.getLogger().error(Inter.getLocText("ECP-error_pwd"));
return new WorkBook();
}
}
WorkBook tpl = new WorkBook();
// richer:打开报表通知
FRContext.getLogger().info(Inter.getLocText(new String[]{"LOG-Is_Being_Openned", "LOG-Please_Wait"}, new String[]{"\"" + file.getName() + "\"" + ",", "..."}));
TempNameStyle namestyle = TempNameStyle.getInstance();
namestyle.clear();
String checkStr = StringUtils.EMPTY;
try {
checkStr = ResourceIOUtils.inputStream2String(file.asInputStream());
tpl.readStream(file.asInputStream());
} catch (Exception exp) {
String errorMessage = StringUtils.EMPTY;
errorMessage = ComparatorUtils.equals(RemoteDeziConstants.INVALID_USER, checkStr) ? Inter.getLocText("FR-Designer_No-Privilege")
: Inter.getLocText("NS-exception_readError");
FRContext.getLogger().error(errorMessage + file, exp);
}
checkNameStyle(namestyle);
return tpl;
}
};
}
private static AbstractWorkBookApp getCptxApp() {
return new AbstractWorkBookApp() {
@Override
public String[] defaultExtensions() {
return new String[]{FileExtension.CPTX.getExtension()};
}
@Override
public WorkBook asIOFile(FILE file) {
FRContext.getLogger().info(Inter.getLocText(new String[]{"LOG-Is_Being_Openned", "LOG-Please_Wait"}, new String[]{"\"" + file.getName() + "\"" + ",", "..."}));
WorkBookX tpl;
InputStream inputStream;
try {
inputStream = file.asInputStream();
long time = System.currentTimeMillis();
tpl = new WorkBookX(inputStream);
FRContext.getLogger().error("cost: " + (System.currentTimeMillis() - time) + " ms");
} catch (Exception exp) {
if (exp instanceof FRPackageRunTimeException) {
throw (FRPackageRunTimeException) exp;
}
throw new InvalidWorkBookException(file + ":" + exp.getMessage(), exp);
}
return new WorkBookAdapter(tpl);
}
};
}
private static void checkNameStyle(TempNameStyle namestyle) {
Iterator it = namestyle.getIterator();
ArrayList<String> al = new ArrayList<String>();
while (it.hasNext()) {
al.add((String) it.next());
}
if (!al.isEmpty()) {
showConfirmDialog(al);
}
}
private static void showConfirmDialog(final ArrayList<String> namelist) {
final JDialog jd = new JDialog();
// 模态一下,因为可能会多个样式丢失
// jd.setModal(true);
jd.setAlwaysOnTop(true);
jd.setSize(450, 150);
jd.setResizable(false);
jd.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png"));
String message = namelist.toString().replaceAll("\\[", "").replaceAll("\\]", "");
UILabel jl = new UILabel(Inter.getLocText(new String[]{"Current_custom_global", "Has_been_gone"}, new String[]{message}));
jl.setHorizontalAlignment(SwingConstants.CENTER);
jd.add(jl, BorderLayout.CENTER);
JPanel jp = new JPanel();
// ”是“按钮,点击之后将生成一个全局样式,并写入xml
UIButton confirmButton = new UIButton(Inter.getLocText("FR-Designer_Yes"));
confirmButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
for (int i = 0; i < namelist.size(); i++) {
ServerPreferenceConfig.getInstance().putStyle(namelist.get(i), Style.DEFAULT_STYLE);
}
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage());
}
jd.dispose();
new StyleListAction().actionPerformed(e);// 弹窗
}
});
UIButton noButton = new UIButton(Inter.getLocText("FR-Designer_No"));
noButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
jd.dispose();
}
});
jp.add(confirmButton);
jp.add(noButton);
jd.setTitle(Inter.getLocText("FR-Custom_styles_lost"));
jd.add(jp, BorderLayout.SOUTH);
GUICoreUtils.centerWindow(jd);
jd.setVisible(true);
}
private static void designerRegister() {
registerCellEditor();
registerFloatEditor();
registerData4Form();
registerOtherPane();
}
private static void registerOtherPane() {
StableFactory.registerMarkedClass(BBSGuestPaneProvider.XML_TAG, BBSGuestPane.class);
}
/**
* kunsnat:注册单元格选中Editor
*/
private static void registerCellEditor() {
ActionFactory.registerCellEditor(String.class, new CellStringQuickEditor());
ActionFactory.registerCellEditor(Number.class, new CellStringQuickEditor());
ActionFactory.registerCellEditor(BaseFormula.class, new CellFormulaQuickEditor());
ActionFactory.registerCellEditor(SubReport.class, new CellSubReportEditor());
ActionFactory.registerCellEditor(RichText.class, new CellRichTextEditor());
ActionFactory.registerCellEditor(DSColumn.class, new CellDSColumnEditor());
ActionFactory.registerCellEditor(Image.class, new CellImageQuickEditor());
ActionFactory.registerCellEditor(BiasTextPainter.class, new CellBiasTextPainterEditor());
ActionFactory.registerCellEditor(BufferedImage.class, new CellImageQuickEditor());
ActionFactory.registerCellEditor(CellImagePainter.class, new CellImageQuickEditor());
//todo 图表编辑器populate没能实现刷新面板显示
ActionFactory.registerCellEditorClass(ChartCollection.class, BasicChartQuickEditor.class);
Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING);
for (ElementUIProvider provider : providers) {
try {
ActionFactory.registerCellEditor(provider.targetObjectClass(), provider.quickEditor().newInstance());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
/**
* kunnat: 注册悬浮选中Editor
*/
private static void registerFloatEditor() {
ActionFactory.registerFloatEditor(String.class, new FloatStringQuickEditor());
ActionFactory.registerFloatEditor(Formula.class, new FloatStringQuickEditor());
ActionFactory.registerFloatEditor(Image.class, new FloatImageQuickEditor());
ActionFactory.registerFloatEditor(BufferedImage.class, new FloatImageQuickEditor());
ActionFactory.registerFloatEditor(CellImagePainter.class, new FloatImageQuickEditor());
//todo 图表编辑器populate没能实现刷新面板显示
ActionFactory.registerFloatEditorClass(ChartCollection.class, FloatChartQuickEditor.class);
}
private static void registerData4Form() {
StableFactory.registerMarkedClass(FormECDesignerProvider.XML_TAG, FormElementCaseDesigner.class);
StableFactory.registerMarkedClass(FormECCompositeProvider.XML_TAG, FormReportComponentComposite.class);
DesignModuleFactory.registerParameterReader(new WorkBookParameterReader());
}
private static void chartDesignerRegister() {
StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class);
StableFactory.getStaticMarkedInstanceObjectFromClass(ExtraChartDesignClassManagerProvider.XML_TAG, ExtraChartDesignClassManagerProvider.class);
DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup());
DesignModuleFactory.registerChartEditorClass(ChartEditor.class);
DesignModuleFactory.registerChartComponentClass(ChartComponent.class);
DesignModuleFactory.registerChartDialogClass(ChartDialog.class);
DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class);
ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction());
ActionFactory.registerChartMapEditorAction(new ChartMapEditorAction());
ActionFactory.registerChartCollection(ChartCollection.class);
DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption());
DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance());
DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper());
}
private static void formDesignerRegister() {
StableFactory.registerMarkedObject(DesignToolbarProvider.STRING_MARKED, WidgetToolBarPane.getInstance());
DesignModuleFactory.registerNewFormActionClass(NewFormAction.class);
DesignModuleFactory.registerFormParaDesignerClass(FormParaDesigner.class);
DesignModuleFactory.registerParaPropertyPaneClass(ParameterPropertyPane.class);
DesignModuleFactory.registerFormHierarchyPaneClass(FormHierarchyTreePane.class);
DesignModuleFactory.registerWidgetPropertyPaneClass(WidgetPropertyPane.class);
DesignModuleFactory.registerButtonDetailPaneClass(FormSubmitButtonDetailPane.class);
DesignModuleFactory.registerParameterReader(new FormParameterReader());
StableFactory.registerMarkedClass(BaseJForm.XML_TAG, JForm.class);
ModuleContext.startModule(DesignerModule.class.getName()); StableFactory.registerMarkedObject(ElementCaseThumbnailProcessor.MARK_STRING, new ElementCaseThumbnail());
DesignerSocketIO.init();
ChartDesignerModule.register();
} }
@Override @Override
public void stop() { public void stop() {
ModuleContext.stopModule(DesignerModule.class.getName());
} }
@Override @Override

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

@ -11,6 +11,9 @@ import com.fr.startup.activators.BasicActivator;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.WorkspaceEvent;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* Created by juhaoyu on 2018/1/8. * Created by juhaoyu on 2018/1/8.
*/ */
@ -21,18 +24,27 @@ public class DesignerStartup extends Activator {
startSub(PreStartActivator.class); startSub(PreStartActivator.class);
//启动基础部分 //启动基础部分
startSub(BasicActivator.class); startSub(BasicActivator.class);
String[] args = getModule().upFindSingleton(StartupArgs.class).get(); final String[] args = getModule().upFindSingleton(StartupArgs.class).get();
Designer designer = new Designer(args); final Designer designer = new Designer(args);
//启动env //启动env
startSub(DesignerWorkspaceProvider.class); startSub(DesignerWorkspaceProvider.class);
startSub(EnvBasedModule.class); startSub(EnvBasedModule.class);
getRoot().getSingleton(EnvSwitcher.class).switch2LastEnv(); getRoot().getSingleton(EnvSwitcher.class).switch2LastEnv();
ExecutorService service = Executors.newSingleThreadExecutor();
registerEnvListener(); registerEnvListener();
service.submit(new Runnable() {
@Override
public void run() {
designer.show(args);
DesignerContext.getDesignerFrame().getProgressDialog().dispose();
}
});
service.shutdown();
DesignerContext.getDesignerFrame().setVisible(true); DesignerContext.getDesignerFrame().setVisible(true);
//启动画面结束 //启动画面结束
SplashContext.getInstance().hide(); SplashContext.getInstance().hide();
//启动设计器界面
designer.show(args); DesignerContext.getDesignerFrame().getProgressDialog().setVisible(true);
startSub(StartFinishActivator.class); startSub(StartFinishActivator.class);
} }

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

@ -20,11 +20,12 @@ public class DesignerWorkspaceProvider extends Activator {
for (String arg : args) { for (String arg : args) {
if (ComparatorUtils.equals(arg, "demo")) { if (ComparatorUtils.equals(arg, "demo")) {
DesignerEnvManager.getEnvManager().setCurrentEnv2Default(); DesignerEnvManager.getEnvManager().setCurrentEnv2Default();
ServerStarter.browserDemoURL(); // ServerStarter.browserDemoURL();
break; break;
} }
} }
} }
getRoot().setSingleton(EnvSwitcher.class, new EnvSwitcher()); getRoot().setSingleton(EnvSwitcher.class, new EnvSwitcher());
//设置好环境即可,具体跟环境有关的模块会自动调用 //设置好环境即可,具体跟环境有关的模块会自动调用
getRoot().getSingleton(EnvSwitcher.class).switch2LastEnv(); getRoot().getSingleton(EnvSwitcher.class).switch2LastEnv();

3
designer-realize/src/com/fr/start/module/EnvBasedModule.java

@ -1,5 +1,6 @@
package com.fr.start.module; package com.fr.start.module;
import com.fr.chart.activator.ChartBaseActivator;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.stable.CoreActivator; import com.fr.stable.CoreActivator;
import com.fr.start.server.FineEmbedServer; import com.fr.start.server.FineEmbedServer;
@ -14,6 +15,7 @@ public class EnvBasedModule extends Activator {
public void start() { public void start() {
//core和设计器启动 //core和设计器启动
startSub(CoreActivator.class); startSub(CoreActivator.class);
startSub(ChartBaseActivator.class);
getSub("designer").start(); getSub("designer").start();
//这里不启动tomcat,由客户手动触发 //这里不启动tomcat,由客户手动触发
} }
@ -24,6 +26,7 @@ public class EnvBasedModule extends Activator {
FineEmbedServer.stop(); FineEmbedServer.stop();
//倒叙关闭其他模块 //倒叙关闭其他模块
getSub("designer").stop(); getSub("designer").stop();
stopSub(ChartBaseActivator.class);
stopSub(CoreActivator.class); stopSub(CoreActivator.class);
} }
} }

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

@ -4,10 +4,9 @@ import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.SiteCenter;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.stable.BuildContext;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import java.io.File; import java.io.File;
@ -25,7 +24,7 @@ public class PreStartActivator extends Activator {
public void start() { public void start() {
RestartHelper.deleteRecordFilesWhenStart(); RestartHelper.deleteRecordFilesWhenStart();
SiteCenter.getInstance(); CloudCenter.getInstance();
if (checkMultiStart()) { if (checkMultiStart()) {
return; return;
} }
@ -39,11 +38,7 @@ public class PreStartActivator extends Activator {
} else { } else {
DesignUtils.setPort(getStartPort()); DesignUtils.setPort(getStartPort());
} }
// 如果端口被占用了 说明程序已经运行了一次,也就是说,已经建立一个监听服务器,现在只要给服务器发送命令就好了
if (DesignUtils.isStarted()) {
DesignUtils.clientSend(getModule().upFindSingleton(StartupArgs.class).get());
return true;
}
return false; return false;
} }

1
pom.xml

@ -17,7 +17,6 @@
<module>designer-form</module> <module>designer-form</module>
<module>designer-realize</module> <module>designer-realize</module>
</modules> </modules>
<groupId>com.fr.report</groupId>
<artifactId>design</artifactId> <artifactId>design</artifactId>
<version>10.0-RELEASE-SNAPSHOT</version> <version>10.0-RELEASE-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>

Loading…
Cancel
Save