Browse Source

Merge pull request #10292 in DESIGN/design from release/11.0 to final/11.0

* commit 'e7a1c86eb21413a3cc38d84895a9f2f4b44e79a1': (116 commits)
  REPORT-81270 远程连接配置界面处理IPV6格式的url--忽略异常+单元测试
  REPORT-81270 远程连接配置界面处理IPV6格式的url--代码调整
  REPORT-81270 远程连接配置界面处理IPV6格式的url--代码调整
  REPORT-81583【运营产品化二期】自定义排序使用向上或向下到最顶或最底交互显示有问题;REPORT-80117 alphafine默认配置没有模板商城,首次打开却有模板商城 1、修改交互 2、修改升级兼容问题
  REPORT-81270 远程连接配置界面处理IPV6格式的url
  REPORT-81270 远程连接配置界面处理IPV6格式的url
  REPORT-81270 远程连接配置界面处理IPV6格式的url
  REPORT-81270 远程连接配置界面处理IPV6格式的url
  REPORT-75998 拼接字符串采用StableUtils.join
  REPORT-75998 修复地图类型图表的样式中JS缺漏的bug
  REPORT-75998 修改帮助文档网址参数
  REPORT-75998 更改跳转逻辑,更改帮助文档Icon
  REPORT-75998 更新错误信息
  REPORT-75998 添加帮助文档Icon
  REPORT-75998 添加帮助文档
  REPORT-81307 补充注释
  REPORT-81307 A列列宽概率显示为B列列宽值
  REPORT-81307 A列列宽概率显示为B列列宽值
  REPORT-78144 FVS报表块字号统一
  REPORT-81336 FR11决策报表报表块-编辑退出,编辑内容丢失
  ...
new-design
superman 2 years ago
parent
commit
73c097947d
  1. 4
      designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java
  2. 4
      designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java
  3. 19
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  4. 200
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java
  5. 75
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java
  6. 125
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java
  7. 67
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConstants.java
  8. 229
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java
  9. 96
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabel.java
  10. 34
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabelPane.java
  11. 19
      designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceOperator.java
  12. 7
      designer-base/src/main/java/com/fr/design/carton/FeedbackToolboxDialog.java
  13. 13
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  14. 56
      designer-base/src/main/java/com/fr/design/fun/DefaultValueAdjustProvider.java
  15. 24
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractDefaultValueAdjustProvider.java
  16. 7
      designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java
  17. 2
      designer-base/src/main/java/com/fr/design/gui/core/WidgetOptionFactory.java
  18. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java
  19. 12
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java
  20. 37
      designer-base/src/main/java/com/fr/design/mainframe/AbsoluteMeasureUIMode.java
  21. 17
      designer-base/src/main/java/com/fr/design/mainframe/DesignerUIMode.java
  22. 63
      designer-base/src/main/java/com/fr/design/mainframe/DesignerUIModeConfig.java
  23. 38
      designer-base/src/main/java/com/fr/design/mainframe/SimulateWebUIMode.java
  24. 6
      designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java
  25. 8
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  26. 34
      designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java
  27. 10
      designer-base/src/main/java/com/fr/design/remote/button/IconButton.java
  28. 67
      designer-base/src/main/java/com/fr/design/report/SelectImagePane.java
  29. 18
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  30. 6
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  31. 30
      designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java
  32. 1
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java
  33. 3
      designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties
  34. 3
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties
  35. 3
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties
  36. 3
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties
  37. 3
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties
  38. 3
      designer-base/src/main/resources/com/fr/design/images/buttonicon/replace_help.svg
  39. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/picture_widget_16.png
  40. BIN
      designer-base/src/main/resources/com/fr/design/images/form/designer/widget/picture_widget_designer_bg.png
  41. 10
      designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java
  42. 6
      designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java
  43. 7
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java
  44. 7
      designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java
  45. 2
      designer-form/src/main/java/com/fr/design/actions/NewFormAction.java
  46. 23
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  47. 27
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  48. 74
      designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java
  49. 113
      designer-form/src/main/java/com/fr/design/designer/ui/ImgPanel.java
  50. 4
      designer-form/src/main/java/com/fr/design/fit/NewJForm.java
  51. 63
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  52. 77
      designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java
  53. 57
      designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleUrlLinkModelEditor.java
  54. 17
      designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java
  55. 17
      designer-form/src/main/java/com/fr/design/mainframe/widget/editors/UrlLinkEditor.java
  56. 15
      designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/PictureRenderer.java
  57. 16
      designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/UrlLinkRenderer.java
  58. 34
      designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/PictureModelWrapper.java
  59. 33
      designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/UrlLinkModelWrapper.java
  60. 3
      designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java
  61. 64
      designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java
  62. 23
      designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchAction.java
  63. 30
      designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchManager.java
  64. 211
      designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchManagerCenter.java
  65. 428
      designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java
  66. 34
      designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowValue.java
  67. 222
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/cell/SearchCellAction.java
  68. 365
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/component/ComponentType.java
  69. 185
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/component/SearchComponentAction.java
  70. 136
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/floatelement/SearchFloatAction.java
  71. 566
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java
  72. 188
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java
  73. 38
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/SearchFormula.java
  74. 106
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/SearchFormulaManager.java
  75. 38
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormula.java
  76. 315
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaAction.java
  77. 108
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaManager.java
  78. 62
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaTypeAction.java
  79. 156
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchDSColumnFormulaAction.java
  80. 79
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchRichFormulaAction.java
  81. 70
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchSubReportFormulaAction.java
  82. 95
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBoxDataFormulaAction.java
  83. 79
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBubbleDataFormulaAction.java
  84. 392
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java
  85. 79
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCustomDataFormulaAction.java
  86. 46
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDataFormula.java
  87. 160
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDataFormulaManager.java
  88. 93
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDrillMapDataFormulaAction.java
  89. 108
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartGanttDataFormulaAction.java
  90. 246
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMapDataFormulaAction.java
  91. 68
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMeterDataFormulaAction.java
  92. 71
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMultiPieDataFormulaAction.java
  93. 65
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartNormalReportDataFormulaAction.java
  94. 69
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartStructureDataFormulaAction.java
  95. 74
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartVanNormalDataFormulaAction.java
  96. 63
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartWordCloudDataFormulaAction.java
  97. 132
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/data/DataType.java
  98. 110
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/data/SearchDataFormulaAction.java
  99. 33
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/floatelement/SearchFloatFormula.java
  100. 156
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/floatelement/SearchFloatFormulaAction.java
  101. Some files were not shown because too many files have changed in this diff Show More

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

@ -114,7 +114,7 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
for (ParameterWidgetOptionProvider provider : set) {
WidgetOption option = WidgetOptionFactory.createByWidgetClass(
provider.nameForWidget(),
IOUtils.readIcon(provider.iconPathForWidget()),
provider.iconPathForWidget(),
provider.classForWidget()
);
result.add(option);
@ -186,7 +186,7 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
if (provider.isContainer() == isContainer) {
WidgetOption option = WidgetOptionFactory.createByWidgetClass(
provider.nameForWidget(),
BaseUtils.readIcon(provider.iconPathForWidget()),
provider.iconPathForWidget(),
provider.classForWidget()
);
result.add(option);

4
designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java

@ -1,9 +1,9 @@
package com.fr.design.actions;
import com.fr.base.svg.IconUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.designer.TargetComponent;
@ -61,6 +61,8 @@ public class AllowAuthorityEditAction extends TemplateComponentAction {
DesignerContext.getDesignerFrame().refreshDottedLine();
EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance());
EastRegionContainerPane.getInstance().removeParameterPane();
//进入时要关闭查找替换面板
DesignModuleFactory.getReplaceOperator().close();
//画虚线
return true;

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

@ -119,6 +119,7 @@ public class PreferencePane extends BasicPane {
private static final int CACHING_DEFAULT = 5;
private static final int CACHING_GAP = 5;
private static final int MEMORY_TIP_LABEL_MAX_WIDTH = 230;
private static final int PREFERENCE_LABEL_MAX_WIDTH = 460;
private static final int OFFSET_HEIGHT = 60;
private static final String TYPE = "pressed";
@ -423,22 +424,20 @@ public class PreferencePane extends BasicPane {
private void createFunctionPane(JPanel generalPane) {
JPanel topVerticalTitledBorderPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Function"));
JPanel upper = new JPanel(FRGUIPaneFactory.createLeftZeroVgapNormalHgapLayout());
JPanel lower = new JPanel(FRGUIPaneFactory.createLeftZeroVgapNormalHgapLayout());
topVerticalTitledBorderPane.add(upper);
topVerticalTitledBorderPane.add(lower);
JPanel supportUndoPanel = new JPanel(FRGUIPaneFactory.createLeftZeroVgapNormalHgapLayout());
topVerticalTitledBorderPane.add(supportUndoPanel);
generalPane.add(topVerticalTitledBorderPane);
//添加supportUndo选择项
supportUndoCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Preference_Support_Undo"));
upper.add(supportUndoCheckBox);
supportUndoPanel.add(supportUndoCheckBox);
//添加maxUndoLimit
//String[] undoTimes = {"最大撤销次数","5次","10次","15次","20次","50次"};
String[] undoTimes = {i18nText("Fine-Design_Basic_Max_Undo_Limit"), MAX_UNDO_LIMIT_5 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_10 + i18nText("Fine-Design_Basic_Time(s)")
, MAX_UNDO_LIMIT_15 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_20 + i18nText("Fine-Design_Basic_Time(s)"), MAX_UNDO_LIMIT_50 + i18nText("Fine-Design_Basic_Time(s)")};
maxUndoLimit = new UIComboBox(undoTimes);
upper.add(maxUndoLimit);
supportUndoPanel.add(maxUndoLimit);
//不支持撤销则不能选择撤销可缓存,也不能设置最大撤销次数
supportUndoCheckBox.addActionListener(new ActionListener() {
@ -452,14 +451,14 @@ public class PreferencePane extends BasicPane {
//添加supportDefaultParentCalculate选择项
supportDefaultParentCalculateCheckBox = new UICheckBox(
i18nText("Fine-Design_Basic_Preference_Support_Default_Parent_Calculate"));
upper.add(supportDefaultParentCalculateCheckBox);
topVerticalTitledBorderPane.add(supportDefaultParentCalculateCheckBox);
//添加是否展示打开模板提示缺少插件选择项
showTemplateMissingPlugin = new UICheckBox(
i18nText("Fine-Design_Basic_Preference_Show-Template-Missing-Plugin"));
upper.add(showTemplateMissingPlugin);
topVerticalTitledBorderPane.add(showTemplateMissingPlugin);
startWithEmptyFile = new UICheckBox(i18nText("Fine-Design_Basic_Preference_Start_Empty_File"));
lower.add(startWithEmptyFile);
topVerticalTitledBorderPane.add(startWithEmptyFile);
}
private void createEditPane(JPanel generalPane) {
@ -661,7 +660,7 @@ public class PreferencePane extends BasicPane {
startupPageEnabledCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Startup_Page_Config_Check_Text"));
startupPane.add(startupPageEnabledCheckBox);
UILabel descLabel = new UILabel(Toolkit.i18nText("Fine-Design_Startup_Page_Config_Desc"));
UILabel descLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Startup_Page_Config_Desc"), PREFERENCE_LABEL_MAX_WIDTH);
descLabel.setForeground(new Color(51, 51, 52, (int)Math.round(0.5 * 255)));
startupPane.add(descLabel);
}

200
designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineCloudConstants.java

@ -0,0 +1,200 @@
package com.fr.design.actions.help.alphafine;
import com.fr.design.i18n.Toolkit;
import com.fr.general.CloudCenter;
import com.fr.json.JSONArray;
import java.util.HashMap;
import java.util.Map;
/**
* 云端变量统一管理
*
* @author Link
* @version 11.0
* Created by Link on 2022/9/21
*/
public class AlphaFineCloudConstants {
private static final String PLUGIN_SEARCH_API = "plugin.searchAPI";
private static final String PLUGIN_ALL_SEARCH_API = "plugin.all.searchAPI";
private static final String AF_PLUGIN_INFO = "af.pluginInfo";
private static final String AF_REUSE_INFO = "af.reuseInfo";
private static final String AF_DOC_VIEW = "af.doc_view";
private static final String AF_DOC_SEARCH = "af.doc_search";
private static final String AF_DOC_INFO = "af.doc_info";
private static final String AF_PLUGIN_IMAGE = "af.plugin_image";
private static final String AF_RECORD = "af.record";
private static final String AF_CLOUD_SEARCH = "af.cloud_search";
private static final String AF_SIMILAR_SEARCH = "af.similar_search";
private static final String AF_ADVICE_SEARCH = "af.advice_search";
private static final String AF_HOT_SEARCH = "af.hot_search";
private static final String AF_GO_FORUM = "af.go_fourm";
private static final String AF_GO_WEB = "af.go_web";
private static final String AF_PREVIEW = "af.preview";
private static final String AF_CID_NEW = "af.cid.new";
private static final String AF_CID_USER_GROUP_INFO = "af.cid.user.group.info";
private static final String AF_HELP_QUICK_START = "af.help.quick.start";
private static final String AF_HELP_REPORT_LEARNING_PATH = "af.help.report.learning.path";
private static final String AF_HELP_PARAM_LEARNING_PATH = "af.help.param.learning.path";
private static final String AF_HELP_FILL_LEARNING_PATH = "af.help.fill.learning.path";
private static final String AF_HELP_API_SUMMARY = "af.help.api.summary";
private static final String AF_HELP_MONTHLY_DOCUMENT = "af.help.monthly.document";
private static final String AF_RECOMMEND = "af.recommend";
private static final String LINK_NAME = "name";
private static final String LINK_URL = "link";
/**
* 获取插件搜索api
*/
public static String getPluginSearchUrl() {
return CloudCenter.getInstance().acquireUrlByKind(PLUGIN_SEARCH_API);
};
/**
* 帆软市场里全部插件api
*/
public static String getSearchAllPluginUrl() {
return CloudCenter.getInstance().acquireUrlByKind(PLUGIN_ALL_SEARCH_API);
}
/**
* 获取插件信息api
*/
public static String getPluginUrl() {
return CloudCenter.getInstance().acquireUrlByKind(AF_PLUGIN_INFO);
}
/**
* 获取组件信息api
*/
public static String getReuseUrl() {
return CloudCenter.getInstance().acquireUrlByKind(AF_REUSE_INFO);
}
/**
* 获取帮助文档url
*/
public static String getDocumentDocUrl() {
return CloudCenter.getInstance().acquireUrlByKind(AF_DOC_VIEW);
}
/**
* 帮助文档搜索api
*/
public static String getDocumentSearchUrl() {
return CloudCenter.getInstance().acquireUrlByKind(AF_DOC_SEARCH);
}
/**
* 帮助文档信息api
*/
public static String getDocumentInformationUrl() {
return CloudCenter.getInstance().acquireUrlByKind(AF_DOC_INFO);
}
/**
* 插件图片api
*/
public static String getPluginImageUrl() {
return CloudCenter.getInstance().acquireUrlByKind(AF_PLUGIN_IMAGE);
}
/**
* 获取云端接口用于上传alphafine搜索记录
*/
public static String getCloudServerUrl() {
return CloudCenter.getInstance().acquireUrlByKind(AF_RECORD);
}
/**
* 获取搜索api输入搜索词返回fr的相关功能
*/
public static String getSearchApi() {
return CloudCenter.getInstance().acquireUrlByKind(AF_CLOUD_SEARCH);
}
/**
* 获取模糊搜索api前缀输入搜索词返回alphaFine相关内容插件文档功能等
*/
public static String getSimilarSearchUrlPrefix() {
return CloudCenter.getInstance().acquireUrlByKind(AF_SIMILAR_SEARCH);
}
/**
* 补全建议搜索结果 api与AF_SIMILAR_SEARCH接口类似但是返回的信息更全
*/
public static String getComplementAdviceSearchUrlPrefix() {
return CloudCenter.getInstance().acquireUrlByKind(AF_ADVICE_SEARCH);
}
/**
* 获取热门问题
*/
public static String getAlphaHotSearch() {
return CloudCenter.getInstance().acquireUrlByKind(AF_HOT_SEARCH);
}
/**
* 跳转论坛url
*/
public static String getAlphaGoToForum() {
return CloudCenter.getInstance().acquireUrlByKind(AF_GO_FORUM);
}
/**
* 推荐搜索api输入搜索词返回猜你想搜的内容html格式
*/
public static String getAlphaGoToWeb() {
return CloudCenter.getInstance().acquireUrlByKind(AF_GO_WEB);
}
/**
* 帆软智能客服页面url
*/
public static String getAlphaPreview() {
return CloudCenter.getInstance().acquireUrlByKind(AF_PREVIEW);
}
/**
* cid系统的产品动态api
*/
public static String getAlphaCid() {
return CloudCenter.getInstance().acquireUrlByKind(AF_CID_NEW);
}
/**
* cid系统的 用户组信息api
*/
public static String getAlphaCidUserGroupInfo() {
return CloudCenter.getInstance().acquireUrlByKind(AF_CID_USER_GROUP_INFO);
}
private static String getDefaultRecommend() {
String[][] links = new String[][]{
{Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Quick_Start"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_QUICK_START)},
{Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Report_Learning"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_REPORT_LEARNING_PATH)},
{Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Parameter_Learning"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_PARAM_LEARNING_PATH)},
{Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Fill_Learning"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_FILL_LEARNING_PATH)},
{Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Api_Summary"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_API_SUMMARY)},
{Toolkit.i18nText("Fine-Design_Report_AlphaFine_Doc_Monthly_Document"), CloudCenter.getInstance().acquireUrlByKind(AF_HELP_MONTHLY_DOCUMENT)}
};
JSONArray jsonArray = new JSONArray();
for (String[] link : links) {
Map<String, String> map = new HashMap<>();
map.put(LINK_NAME, link[0]);
map.put(LINK_URL, link[1]);
jsonArray.put(map);
}
return jsonArray.toString();
}
/**
* 获取默认推荐帮助文档url
*/
public static String getAlphaHelpRecommend() {
return CloudCenter.getInstance().acquireUrlByKind(AF_RECOMMEND, getDefaultRecommend());
}
}

75
designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java

@ -29,6 +29,7 @@ import java.util.Stack;
*/
public class AlphaFineConfigManager implements XMLable {
public static final String COMMA = ",";
private static final long serialVersionUID = -8170289826729582122L;
private static AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager();
/**
@ -91,21 +92,23 @@ public class AlphaFineConfigManager implements XMLable {
* 是否提醒
*/
private boolean needRemind = true;
/**
* 产品动态
*/
private boolean productDynamics = true;
/**
* 模板商城是否展示
* */
*/
private boolean showTemplateShop = true;
/**
* tab页排序
* 默认排序动态模板商城帮助文档插件中心功能我的模板
*/
private String[] tabOrder;
private Map<String, String> actionSearchTextCache = new HashMap<>(8);
private String cacheBuildNO;
private static final String CONTAIN_TEMPLATE_SHOP = "isContainTemplateShop";
/**
* key: 登录的bbs用户
@ -149,6 +152,7 @@ public class AlphaFineConfigManager implements XMLable {
this.setContainPlugin(reader.getAttrAsBoolean("isContainDocument", true));
this.setContainDocument(reader.getAttrAsBoolean("isContainDocument", true));
this.setContainRecommend(reader.getAttrAsBoolean("isContainRecommend", true));
this.setShowTemplateShop(reader.getAttrAsBoolean(CONTAIN_TEMPLATE_SHOP, true));
this.setContainAction(reader.getAttrAsBoolean("isContainAction", true));
this.setContainTemplate(reader.getAttrAsBoolean("isContainTemplate", true));
this.setContainFileContent(reader.getAttrAsBoolean("isContainFileContent", false));
@ -158,6 +162,7 @@ public class AlphaFineConfigManager implements XMLable {
this.setShortcuts(reader.getAttrAsString("shortcuts", getDefaultShortCuts()));
this.setNeedRemind(reader.getAttrAsBoolean("isNeedRemind", true));
this.setOperateCount(reader.getAttrAsInt("operateCount", 0));
this.setTabOrder(reader.getAttrAsString("tabOrder", getDefaultTabOrder()).split(","));
} else if (reader.isChildNode()) {
if (ComparatorUtils.equals(reader.getTagName(), "ActionSearchTextCache")) {
readActionSearchTextCacheXML(reader);
@ -198,7 +203,7 @@ public class AlphaFineConfigManager implements XMLable {
if (ComparatorUtils.equals(reader.getTagName(), "history")) {
String tmpVal = reader.getElementValue();
if (tmpVal != null) {
tmpVal = tmpVal.replace("[",StringUtils.EMPTY).replace("]",StringUtils.EMPTY);
tmpVal = tmpVal.replace("[", StringUtils.EMPTY).replace("]", StringUtils.EMPTY);
Stack<String> stack = new SizedStack<>(3);
String[] historyList = tmpVal.split(",");
for (String history : historyList) {
@ -222,7 +227,7 @@ public class AlphaFineConfigManager implements XMLable {
if (ComparatorUtils.equals(reader.getTagName(), "readId")) {
String tmpVal = reader.getElementValue();
if (tmpVal != null) {
tmpVal = tmpVal.replace("[",StringUtils.EMPTY).replace("]",StringUtils.EMPTY);
tmpVal = tmpVal.replace("[", StringUtils.EMPTY).replace("]", StringUtils.EMPTY);
String[] idArr = tmpVal.split(",");
Set<Long> setId = new HashSet<>();
for (String id : idArr) {
@ -254,7 +259,9 @@ public class AlphaFineConfigManager implements XMLable {
.attr("operateCount", this.getOperateCount())
.attr("needSegmentationCheckbox", this.isNeedSegmentationCheckbox())
.attr("needIntelligentCustomerService", this.isNeedIntelligentCustomerService())
.attr("productDynamics", this.isProductDynamics());
.attr("productDynamics", this.isProductDynamics())
.attr(CONTAIN_TEMPLATE_SHOP, this.showTemplateShop)
.attr("tabOrder", this.getTabOrderString());
writeActionSearchTextCacheXML(writer);
writeSearchHistory(writer);
writeReadSet(writer);
@ -317,6 +324,13 @@ public class AlphaFineConfigManager implements XMLable {
return OperatingSystem.isMacOS() ? "meta + D" : "ctrl + D";
}
/**
* 返回默认排序
*/
private String getDefaultTabOrder() {
return AlphaFineConstants.PRODUCT_NEWS + COMMA + AlphaFineConstants.TEMPLATE_SHOP + COMMA + AlphaFineConstants.HELP + COMMA + AlphaFineConstants.PLUGIN + COMMA + AlphaFineConstants.FUNCTION + COMMA + AlphaFineConstants.MY_TEMPLATES;
}
public boolean isContainAction() {
return containAction;
}
@ -333,14 +347,14 @@ public class AlphaFineConfigManager implements XMLable {
this.containDocument = containDocument;
}
public void setContainMyTemplate(boolean containMyTemplate) {
this.containMyTemplate = containMyTemplate;
}
public boolean isContainMyTemplate() {
return containMyTemplate;
}
public void setContainMyTemplate(boolean containMyTemplate) {
this.containMyTemplate = containMyTemplate;
}
public boolean isContainTemplate() {
return containTemplate;
}
@ -461,6 +475,10 @@ public class AlphaFineConfigManager implements XMLable {
return productDynamics && FRContext.isChineseEnv();
}
public void setProductDynamics(boolean productDynamics) {
this.productDynamics = productDynamics;
}
public boolean hasTemplateShop() {
return showTemplateShop && FRContext.isChineseEnv();
}
@ -469,7 +487,36 @@ public class AlphaFineConfigManager implements XMLable {
this.showTemplateShop = showTemplateShop;
}
public void setProductDynamics(boolean productDynamics) {
this.productDynamics = productDynamics;
/**
* 是否展示alphafine窗口设置-搜索范围 0勾选则不显示
*/
public boolean needShowAlphaFineDialog() {
return hasTemplateShop() || isContainDocument() || isContainPlugin() ||
isContainAction() || isProductDynamics() || isContainMyTemplate();
}
/**
* 返回tab显示顺序
*/
public String[] getTabOrder() {
if (tabOrder == null) {
tabOrder = getDefaultTabOrder().split(COMMA);
}
return tabOrder;
}
public void setTabOrder(String[] tabOrder) {
this.tabOrder = tabOrder;
}
/**
* getTabOrder的tostring
*/
public String getTabOrderString() {
StringBuilder sb = new StringBuilder();
for (String s : getTabOrder()) {
sb.append(s + COMMA);
}
return sb.toString();
}
}

125
designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java

@ -3,8 +3,11 @@ package com.fr.design.actions.help.alphafine;
import com.fr.base.FRContext;
import com.fr.base.svg.IconUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.component.CustomSortPane;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.itextfield.UITextField;
@ -17,6 +20,7 @@ import com.fr.log.FineLoggerFactory;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.KeyStroke;
import java.awt.BorderLayout;
import java.awt.Color;
@ -30,6 +34,8 @@ import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
/**
* Created by XiaXiang on 2017/4/6.
@ -39,14 +45,24 @@ public class AlphaFineConfigPane extends BasicPane {
private static final String DISPLAY_TYPE = "+";
private static final Color LABEL_TEXT = new Color(0x919193);
private static final int SEARCH_CONFIG_PANE_HEIGHT = 70;
private static final int SEARCH_CONFIG_PANE_WIDTH = 87;
private static final double COLUMN_WIDTH = 150;
private static final double ROW_HEIGHT = 25;
private KeyStroke shortCutKeyStore = null;
private UICheckBox enabledCheckbox, searchOnlineCheckbox, needSegmentationCheckbox;
private UICheckBox productDynamicsCheckbox, containTemplateShopCheckbox, containDocumentCheckbox,
containPluginCheckbox, containActionCheckbox, containMyTemplateCheckbox;
// 自定义排序按钮
private ActionLabel customSortLabel;
private UITextField shortcutsField;
// 当前tab排序。点击确定后会保存到配置文件中
private String[] currentOrder;
// 搜索范围-我的模板,相关组件
private JPanel containMyTemplatePane;
private JButton myTemplateSearchConfigButton;
@ -79,7 +95,8 @@ public class AlphaFineConfigPane extends BasicPane {
double[] rowSize = {ROW_HEIGHT, ROW_HEIGHT, ROW_HEIGHT};
double[] columnSize = {COLUMN_WIDTH, COLUMN_WIDTH, COLUMN_WIDTH};
JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Search_Range"));
JPanel searchConfigWrapperPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_AlphaFine_Search_Range"));
// 搜索选项
productDynamicsCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Product_News"));
containActionCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Function"));
containPluginCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon"));
@ -89,10 +106,39 @@ public class AlphaFineConfigPane extends BasicPane {
containTemplateShopCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Shop"));
containMyTemplateCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_My_Templates"));
JPanel searchConfigPane = TableLayoutHelper.createTableLayoutPane(initSearchRangeComponents(), rowSize, columnSize);
northPane.add(searchConfigPane);
contentPane.add(northPane);
// 自定义排序
JPanel customSortWrapperPane = new JPanel();
customSortWrapperPane.setPreferredSize(new Dimension(SEARCH_CONFIG_PANE_HEIGHT, SEARCH_CONFIG_PANE_WIDTH));
customSortWrapperPane.setAlignmentY(JPanel.TOP_ALIGNMENT);
customSortLabel = new ActionLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Config_Custom_Sort"), false);
customSortLabel.setForeground(UIConstants.NORMAL_BLUE);
customSortLabel.addActionListener((event)->{
if (customSortLabel.isEnabled()) {
openCustomSortMenu();
}
});
customSortWrapperPane.add(customSortLabel);
if (!hasSelectedSearchRangeCheckBox()) {
customSortLabel.setEnabled(false);
}
searchConfigWrapperPane.add(searchConfigPane);
searchConfigWrapperPane.add(customSortWrapperPane);
contentPane.add(searchConfigWrapperPane);
}
/**
* 打开自定义排序面板
* */
private void openCustomSortMenu() {
CustomSortPane customSortPane = new CustomSortPane(getSelectedSearchRangeCheckBox(), this);
JPopupMenu popupMenu = new JPopupMenu();
popupMenu.add(customSortPane);
GUICoreUtils.showPopupMenu(popupMenu, customSortLabel, 0, customSortLabel.getHeight());
}
private Component[][] initSearchRangeComponents() {
// 我的模板checkbox设置,点击后
initMyTemplateSearchPane();
@ -102,12 +148,12 @@ public class AlphaFineConfigPane extends BasicPane {
new Component[]{containPluginCheckbox, containActionCheckbox, containMyTemplatePane},
};
for (int i = 0; i < components.length; i++) {
for (int j = 0; j < components[i].length; j++) {
if (components[i][j] instanceof UICheckBox) {
UICheckBox box = (UICheckBox) components[i][j];
}
}
// 添加选项点事件,无选中选项时自定排序按钮置灰
UICheckBox[] checkBoxes = new UICheckBox[]{productDynamicsCheckbox, containTemplateShopCheckbox, containDocumentCheckbox, containPluginCheckbox, containActionCheckbox, containMyTemplateCheckbox};
for (UICheckBox box : checkBoxes) {
box.addActionListener((e)->{
customSortLabel.setEnabled(hasSelectedSearchRangeCheckBox());
});
}
return components;
}
@ -120,25 +166,39 @@ public class AlphaFineConfigPane extends BasicPane {
|| containPluginCheckbox.isSelected() || containActionCheckbox.isSelected() || containMyTemplateCheckbox.isSelected();
}
// 搜索范围-我的模板
/**
* 获取当前选中的搜索范围选项
* */
private List<UICheckBox> getSelectedSearchRangeCheckBox() {
List<UICheckBox> res = new ArrayList<>();
UICheckBox[] checkBoxes = new UICheckBox[]{productDynamicsCheckbox, containTemplateShopCheckbox, containDocumentCheckbox, containPluginCheckbox, containActionCheckbox, containMyTemplateCheckbox};
for (UICheckBox c : checkBoxes) {
if (c.isSelected()) {
res.add(c);
}
}
return res;
}
/**
* 搜索范围-我的模板
*/
private void initMyTemplateSearchPane() {
containMyTemplatePane = new JPanel(new FlowLayout(FlowLayout.LEFT,4,5));
containMyTemplatePane = new JPanel(new FlowLayout(FlowLayout.LEFT, 4, 5));
containMyTemplateCheckbox.setBorder(BorderFactory.createEmptyBorder());
containMyTemplateCheckbox.addActionListener(
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (containMyTemplateCheckbox.isSelected()) {
myTemplateSearchConfigButton.setVisible(true);
} else {
myTemplateSearchConfigButton.setVisible(false);
}
}
containMyTemplateCheckbox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (containMyTemplateCheckbox.isSelected()) {
myTemplateSearchConfigButton.setVisible(true);
} else {
myTemplateSearchConfigButton.setVisible(false);
}
);
}
});
myTemplateSearchConfigButton = new JButton();
myTemplateSearchConfigButton.setBorder(BorderFactory.createEmptyBorder());
myTemplateSearchConfigButton.setMargin(new Insets(0,0,0,0));
myTemplateSearchConfigButton.setMargin(new Insets(0, 0, 0, 0));
myTemplateSearchConfigButton.setIcon(IconUtils.readIcon("/com/fr/design/mainframe/alphafine/images/config.svg"));
myTemplateSearchMenu = new UIPopupMenu();
containTemplateNameSearchCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_AlphaFine_Config_Name_Search"));
@ -280,6 +340,14 @@ public class AlphaFineConfigPane extends BasicPane {
this.needSegmentationCheckbox.setSelected(alphaFineConfigManager.isNeedSegmentationCheckbox());
shortCutKeyStore = convert2KeyStroke(alphaFineConfigManager.getShortcuts());
this.currentOrder = alphaFineConfigManager.getTabOrder().clone();
if (!hasSelectedSearchRangeCheckBox()) {
customSortLabel.setEnabled(false);
} else {
customSortLabel.setEnabled(true);
}
}
public void update() {
@ -296,6 +364,9 @@ public class AlphaFineConfigPane extends BasicPane {
alphaFineConfigManager.setContainFileContent(this.containFileContentSearchCheckbox.isSelected());
alphaFineConfigManager.setNeedSegmentationCheckbox(this.needSegmentationCheckbox.isSelected());
alphaFineConfigManager.setShortcuts(shortCutKeyStore != null ? shortCutKeyStore.toString().replace(TYPE, DISPLAY_TYPE) : this.shortcutsField.getText());
alphaFineConfigManager.setTabOrder(currentOrder);
designerEnvManager.setAlphaFineConfigManager(alphaFineConfigManager);
try {
DesignerEnvManager.loadLogSetting();
@ -327,4 +398,12 @@ public class AlphaFineConfigPane extends BasicPane {
public void setIsContainFileContentCheckbox(UICheckBox isContainFileContentCheckbox) {
this.containFileContentSearchCheckbox = isContainFileContentCheckbox;
}
public String[] getCurrentOrder() {
return currentOrder;
}
public void setCurrentOrder(String[] currentOrder) {
this.currentOrder = currentOrder;
}
}

67
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java → designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConstants.java

@ -1,10 +1,9 @@
package com.fr.design.mainframe.alphafine;
package com.fr.design.actions.help.alphafine;
import com.fr.base.extension.FileExtension;
import com.fr.base.svg.IconUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.DesignUtils;
import com.fr.general.CloudCenter;
import com.fr.general.IOUtils;
import javax.swing.Icon;
@ -22,6 +21,19 @@ import java.util.Set;
*/
public class AlphaFineConstants {
public static final String FUNCTION = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Function");
public static final String MY_TEMPLATES = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_My_Templates");
public static final String PRODUCT_NEWS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Product_News");
public static final String HELP = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Community_Help");
public static final String PLUGIN = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Plugin_Addon");
public static final String TEMPLATE_SHOP = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Template_Shop");
public static final int SHOW_SIZE = 5;
public static final int MAX_FILE_SIZE = 1000;
@ -40,7 +52,7 @@ public class AlphaFineConstants {
public static final int CONTENT_HEIGHT = 405;
public static final int CELL_HEIGHT = 32;
public static final int CELL_HEIGHT = 29;
public static final int CELL_TITLE_HEIGHT = 24;
@ -55,11 +67,9 @@ public class AlphaFineConstants {
/**
* 帮助文档搜索间隔ms api限制了1s之内只能搜索一次
*
*/
public static final long DOCUMENT_SEARCH_GAP = 1000;
public static final Dimension FULL_SIZE = new Dimension(680, 460);
public static final Dimension CONTENT_SIZE = new Dimension(680, 405);
@ -113,25 +123,6 @@ public class AlphaFineConstants {
public static final String ALPHA_HOT_IMAGE_NAME = "alphafine_hot";
public static final String PLUGIN_SEARCH_URL = CloudCenter.getInstance().acquireUrlByKind("plugin.searchAPI");
public static final String PLUGIN_URL = CloudCenter.getInstance().acquireUrlByKind("af.pluginInfo");
public static final String REUSE_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo");
public static final String DOCUMENT_DOC_URL = CloudCenter.getInstance().acquireUrlByKind("af.doc_view");
public static final String DOCUMENT_SEARCH_URL = CloudCenter.getInstance().acquireUrlByKind("af.doc_search");
public static final String DOCUMENT_INFORMATION_URL = CloudCenter.getInstance().acquireUrlByKind("af.doc_info");
public static final String PLUGIN_IMAGE_URL = CloudCenter.getInstance().acquireUrlByKind("af.plugin_image");
public static final String CLOUD_SERVER_URL = CloudCenter.getInstance().acquireUrlByKind("af.record");
public static final String SEARCH_API = CloudCenter.getInstance().acquireUrlByKind("af.cloud_search");
public static final String SPECIAL_CHARACTER_REGEX = "[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】';:”“’。,、?]";
public static final String BOTTOM_REGEX_FIRST = "<div class=\"bang\">([\\s\\S]*?)class=\"jiaoyes\">YES</a><br/>";
@ -144,36 +135,8 @@ public class AlphaFineConstants {
public static final String ALPHA_ROBOT_SEARCH_TOKEN = "K8dl0Np6l0gs";
public static final String SIMILAR_SEARCH_URL_PREFIX = CloudCenter.getInstance().acquireUrlByKind("af.similar_search");
public static final String COMPLEMENT_ADVICE_SEARCH_URL_PREFIX = CloudCenter.getInstance().acquireUrlByKind("af.advice_search");
public static final String ALPHA_HOT_SEARCH = CloudCenter.getInstance().acquireUrlByKind("af.hot_search");
public static final String ALPHA_GO_TO_FORUM = CloudCenter.getInstance().acquireUrlByKind("af.go_fourm");
public static final String ALPHA_GO_TO_WEB = CloudCenter.getInstance().acquireUrlByKind("af.go_web");
public static final String ALPHA_PREVIEW = CloudCenter.getInstance().acquireUrlByKind("af.preview");
public static final String ALPHA_CID = CloudCenter.getInstance().acquireUrlByKind("af.cid.new");
public static final String ALPHA_CID_USER_GROUP_INFO = CloudCenter.getInstance().acquireUrlByKind("af.cid.user.group.info");
public static final String SEARCH_BY_ID = "?id=";
private static final String QUICK_START_URL = CloudCenter.getInstance().acquireUrlByKind("af.help.quick.start");
private static final String REPORT_LEARNING_PATH = CloudCenter.getInstance().acquireUrlByKind("af.help.report.learning.path");
private static final String PARAMETER_LEARNING_PATH = CloudCenter.getInstance().acquireUrlByKind("af.help.param.learning.path");
private static final String FILL_LEARNING_PATH = CloudCenter.getInstance().acquireUrlByKind("af.help.fill.learning.path");
private static final String API_SUMMARY = CloudCenter.getInstance().acquireUrlByKind("af.help.api.summary");
private static final String MONTHLY_DOCUMENT = CloudCenter.getInstance().acquireUrlByKind("af.help.monthly.document");
private static final String DEFAULT_RECOMMEND = "[ { \"name\":\"快速入门指南\", \"link\":\"" + QUICK_START_URL + "\" }, { \"name\":\"报表应用学习路径\", \"link\":\"" + REPORT_LEARNING_PATH + "\" }, { \"name\":\"参数应用学习路径\", \"link\":\"" + PARAMETER_LEARNING_PATH + "\" }, { \"name\":\"填报学习路径\", \"link\":\"" + FILL_LEARNING_PATH + "\" }, { \"name\":\"API接口汇总\", \"link\":\"" + API_SUMMARY + "\" }, { \"name\":\"文档月刊\", \"link\":\"" + MONTHLY_DOCUMENT + "\" } ]";
public static final String ALPHA_HELP_RECOMMEND = CloudCenter.getInstance().acquireUrlByKind("af.recommend", DEFAULT_RECOMMEND);
public static final String JAVASCRIPT_PREFIX = "javascript:SendJava";
public static final String CHINESE_CHARACTERS = "[\\u4e00-\\u9fa5]";

229
designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java

@ -0,0 +1,229 @@
package com.fr.design.actions.help.alphafine.component;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.help.alphafine.AlphaFineConfigPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.plaf.PanelUI;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
/**
* alphafine设置 - 搜索范围 - 自定义排序 - 弹出面板
*
* @author Link
* @version 11.0
* Created by Link on 2022/9/18
*/
public class CustomSortPane extends JPanel {
private static final int WIDTH = 147;
private static final int ITEM_HEIGHT = 23;
private static final int GAP = 1;
private static final Color BACKGROUND_COLOR = new Color(0xdadadd);
private UIButton top;
private UIButton bottom;
private UIButton up;
private UIButton down;
private JPanel toolbarPane;
private MenuLabelPane sortItemPane;
private List<UICheckBox> sortItems;
private MenuLabel selectedLabel;
private AlphaFineConfigPane parentPane;
public CustomSortPane(List<UICheckBox> items, AlphaFineConfigPane parentPane) {
this.sortItems = items;
this.parentPane = parentPane;
setLayout(new BorderLayout(GAP, GAP));
int height = (sortItems.size() + 1) * (ITEM_HEIGHT + GAP) + GAP;
setPreferredSize(new Dimension(WIDTH, height));
initComponent();
add(toolbarPane, BorderLayout.NORTH);
add(sortItemPane, BorderLayout.CENTER);
revalidate();
this.setVisible(true);
}
@Override
public void setUI(PanelUI ui) {
super.setUI(ui);
setBackground(BACKGROUND_COLOR);
}
private void initComponent() {
createToolbarPane();
createSortItemPane();
}
private void createToolbarPane() {
top = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/top.svg"), false);
bottom = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/bottom.svg"), false);
up = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/up.svg"), false);
down = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/down.svg"), false);
top.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/top_disable.svg"));
bottom.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/bottom_disable.svg"));
up.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/up_disable.svg"));
down.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/down_disable.svg"));
top.addActionListener(e -> {
SwingUtilities.invokeLater(() -> {
sortItemPane.setComponentZOrder(selectedLabel, 0);
setToolbarEnable(sortItemPane.getComponentZOrder(selectedLabel), sortItemPane.getComponentCount());
CustomSortPane.this.revalidate();
CustomSortPane.this.repaint();
refreshCurrentOrder();
});
});
bottom.addActionListener(e -> {
SwingUtilities.invokeLater(() -> {
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentCount() - 1);
setToolbarEnable(sortItemPane.getComponentZOrder(selectedLabel), sortItemPane.getComponentCount());
CustomSortPane.this.revalidate();
CustomSortPane.this.repaint();
refreshCurrentOrder();
});
});
up.addActionListener(e -> {
SwingUtilities.invokeLater(() -> {
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentZOrder(selectedLabel) - 1);
setToolbarEnable(sortItemPane.getComponentZOrder(selectedLabel), sortItemPane.getComponentCount());
CustomSortPane.this.revalidate();
CustomSortPane.this.repaint();
refreshCurrentOrder();
});
});
down.addActionListener(e -> {
SwingUtilities.invokeLater(() -> {
sortItemPane.setComponentZOrder(selectedLabel, sortItemPane.getComponentZOrder(selectedLabel) + 1);
setToolbarEnable(sortItemPane.getComponentZOrder(selectedLabel), sortItemPane.getComponentCount());
CustomSortPane.this.revalidate();
CustomSortPane.this.repaint();
refreshCurrentOrder();
});
});
toolbarPane = new JPanel(new FlowLayout(FlowLayout.TRAILING, GAP, GAP));
toolbarPane.setBorder(BorderFactory.createEmptyBorder());
toolbarPane.add(top);
toolbarPane.add(bottom);
toolbarPane.add(up);
toolbarPane.add(down);
}
private void createSortItemPane() {
String[] currentTabOrder = parentPane.getCurrentOrder();
Map<String, Integer> sortMap = new HashMap<>();
for (int i = 0; i < currentTabOrder.length; i++) {
sortMap.put(currentTabOrder[i], i);
}
List<MenuLabel> sortLabels = new ArrayList<>();
for (UICheckBox item : sortItems) {
MenuLabel label = new MenuLabel(item.getText(), (Function<MenuLabel, Object>) o -> {
selectedLabel = o;
disableButton();
return null;
});
sortLabels.add(label);
}
sortLabels.sort(Comparator.comparingInt(tab -> sortMap.get(tab.getText())));
sortItemPane = new MenuLabelPane(sortLabels);
}
/**
* 如果选中第一个和最后一个则置灰向上和向下的按钮
*/
private void disableButton() {
int order = sortItemPane.getComponentZOrder(selectedLabel);
if (order == 0) {
setToolbarEnable(false, false, true, true);
} else if (order == sortItemPane.getComponentCount() - 1) {
setToolbarEnable(true, true, false, false);
} else {
setToolbarEnable(true, true, true, true);
}
}
/**
* 设置 置顶上移下移置底 按钮的状态
* true启用
* false关闭
*/
private void setToolbarEnable(boolean top, boolean up, boolean down, boolean bottom) {
this.top.setEnabled(top);
this.up.setEnabled(up);
this.down.setEnabled(down);
this.bottom.setEnabled(bottom);
}
/**
* 根据选项当前位置以及菜单大小设置 置顶上移下移置底 按钮的状态
*/
private void setToolbarEnable(int order, int maxOrder) {
this.top.setEnabled(true);
this.up.setEnabled(true);
this.down.setEnabled(true);
this.bottom.setEnabled(true);
// 选项处于顶端,则置灰上移和置顶按钮
if (order == 0) {
this.top.setEnabled(false);
this.up.setEnabled(false);
}
// 选项处于底端,则置灰下移和置底按钮
if (order == maxOrder - 1) {
this.down.setEnabled(false);
this.bottom.setEnabled(false);
}
}
private void refreshCurrentOrder() {
String[] currentTabOrder = parentPane.getCurrentOrder();
HashSet<String> selectedTab = new HashSet<>();
for (UICheckBox item : sortItems) {
selectedTab.add(item.getText());
}
// 未选中的tab,保持原排序不变
Map<String, Integer> exTab = new HashMap<>();
for (int i = 0; i < currentTabOrder.length; i++) {
if (!selectedTab.contains(currentTabOrder[i])) {
exTab.put(currentTabOrder[i], i);
}
}
// 计算当前排序
String[] newOrder = new String[currentTabOrder.length];
Component[] components = sortItemPane.getComponents();
for (String s : exTab.keySet()) {
newOrder[exTab.get(s)] = s;
}
int t = 0;
for (int i = 0; i < newOrder.length; i++) {
if (StringUtils.isEmpty(newOrder[i])) {
newOrder[i] = ((MenuLabel) components[t++]).getText();
}
}
parentPane.setCurrentOrder(newOrder);
}
}

96
designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabel.java

@ -0,0 +1,96 @@
package com.fr.design.actions.help.alphafine.component;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.DesignUtils;
import javax.swing.BorderFactory;
import javax.swing.plaf.LabelUI;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.function.Function;
/**
* 菜单选项label
*
* @author Link
* @version 11.0
* Created by Link on 2022/9/18
*/
public class MenuLabel extends UILabel {
private static final Color BACKGROUND_COLOR = Color.white;
private static final Color SELECTED_COLOR = new Color(0x419BF9);
private static final Color HOVERED_COLOR = new Color(0xd9ebfe);
private static final int HEIGHT = 23;
private static final int WIDTH = 147;
private MenuLabelPane parentMenu;
private final Function function;
private boolean selected;
public MenuLabel(String text, Function function) {
super(text);
this.function = function;
setOpaque(true);
addMouseListener(createMouseListener());
}
public void setParentMenu(MenuLabelPane menu) {
this.parentMenu = menu;
}
@Override
public void setUI(LabelUI ui) {
super.setUI(ui);
this.setBackground(BACKGROUND_COLOR);
this.setBorder(BorderFactory.createEmptyBorder(2, 10, 1, 10));
this.setPreferredSize(new Dimension(WIDTH, HEIGHT));
this.setFont(DesignUtils.getDefaultGUIFont().applySize(12));
}
public boolean isSelected() {
return selected;
}
public void setSelected(boolean selected) {
if (selected) {
parentMenu.setNoneSelected();
setBackground(SELECTED_COLOR);
function.apply(this);
this.selected = true;
} else {
setBackground(BACKGROUND_COLOR);
this.selected = false;
}
}
MouseListener createMouseListener() {
return new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
setSelected(true);
}
@Override
public void mouseEntered(MouseEvent e) {
super.mouseEntered(e);
if (!selected) {
setBackground(HOVERED_COLOR);
}
}
@Override
public void mouseExited(MouseEvent e) {
super.mouseExited(e);
if (!selected) {
setBackground(BACKGROUND_COLOR);
}
}
};
}
}

34
designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabelPane.java

@ -0,0 +1,34 @@
package com.fr.design.actions.help.alphafine.component;
import javax.swing.JPanel;
import java.awt.FlowLayout;
import java.util.List;
/**
* 简单菜单面板
*
* @author Link
* @version 11.0
* Created by Link on 2022/9/18
*/
public class MenuLabelPane extends JPanel {
private static final int GAP = 1;
private List<MenuLabel> labels;
public MenuLabelPane(List<MenuLabel> labels) {
this.labels = labels;
setLayout(new FlowLayout(FlowLayout.CENTER, GAP, GAP));
for (MenuLabel label : labels) {
label.setParentMenu(this);
add(label);
}
}
public void setNoneSelected() {
for (MenuLabel label : labels) {
label.setSelected(false);
}
}
}

19
designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceOperator.java

@ -0,0 +1,19 @@
package com.fr.design.actions.help.replace;
/**
* 定义一些底层操作
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-27
*/
public interface ITReplaceOperator {
/**
* 关闭面板
*/
void close();
}

7
designer-base/src/main/java/com/fr/design/carton/FeedbackToolboxDialog.java

@ -94,8 +94,7 @@ public class FeedbackToolboxDialog extends JDialog {
private JPanel createInfoPane() {
JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 10, 10);
UILabel title = new UILabel();
//空格布局会好看一点
title.setText(" " + Toolkit.i18nText("Fine-Design_Basic_Carton_Record_Lag_Time") + ": ");
title.setText(" " + Toolkit.i18nText("Fine-Design_Basic_Carton_Record_Lag_Time") + ": ");
//判断一下当天是否有卡顿日志记录,如果有将日期设置为当天,如果没有设置为空
boolean cartonExists = SwitchForSwingChecker.isCartonExists();
if (cartonExists) {
@ -344,8 +343,8 @@ public class FeedbackToolboxDialog extends JDialog {
/**
* 导出卡顿日志到本地或远程服务器WEB-INF下
*
* @param sourceFile 导出的卡顿日志所在文件夹
* @param path 文件需要导出到的路径
* @param sourceFile 导出的卡顿日志所在文件夹
* @param path 文件需要导出到的路径
* @param sourceFilePath 导出的卡顿日志所在文件夹的路径
*/
private void exportCartonLog(File sourceFile, String path, String sourceFilePath) {

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

@ -11,6 +11,7 @@ import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.imenu.UIScrollPopUpMenu;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
@ -24,6 +25,7 @@ import com.fr.design.utils.TemplateUtils;
import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.file.FILE;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
@ -67,6 +69,7 @@ import java.awt.geom.Line2D;
import java.awt.geom.Path2D;
import java.awt.geom.RoundRectangle2D;
import java.util.List;
import java.util.Locale;
import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog;
import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
@ -197,7 +200,9 @@ public class MutilTempalteTabPane extends JComponent {
height += 25;
}
}
menu.setPreferredSize(new Dimension(170, height));
//根据当前i18n语言环境,动态调整popupMenu的宽度
menu.setPreferredSize(new Dimension((int) DesignSizeI18nManager.getInstance().
i18nDimension("com.fr.design.file.MultiTemplateTabPane.popUpMenu").getWidth(), height));
GUICoreUtils.showPopupMenu(menu, MutilTempalteTabPane.getInstance(), e.getX(), MutilTempalteTabPane.getInstance().getY() - 1 + MutilTempalteTabPane.getInstance().getHeight());
}
}
@ -334,7 +339,7 @@ public class MutilTempalteTabPane extends JComponent {
}
}
private void closeTemplate(JTemplate<?, ?>[] templates, JTemplate<?, ?> currentTemplate) {
private void closeTemplate(JTemplate<?, ?>[] templates, JTemplate<?, ?> currentTemplate) {
for (int i = 0; i < templates.length; i++) {
if (option.shouldClose(tplIndex, i)) {
JTemplate<?, ?> jTemplate = templates[i];
@ -935,7 +940,7 @@ public class MutilTempalteTabPane extends JComponent {
/**
* 后台关闭当前编辑模板
*/
public void closeCurrentTpl(){
public void closeCurrentTpl() {
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
this.setIsCloseCurrent(true);
this.closeFormat(jTemplate);
@ -1159,7 +1164,7 @@ public class MutilTempalteTabPane extends JComponent {
boolean completed = WorkerManager.getInstance().isCompleted(template.getTarget().getTemplateID());
if (!completed) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Close_Template_Tip", template.getEditingFILE().getName()));
Toolkit.i18nText("Fine-Design_Close_Template_Tip", template.getEditingFILE().getName()));
return;
}
}

56
designer-base/src/main/java/com/fr/design/fun/DefaultValueAdjustProvider.java

@ -0,0 +1,56 @@
package com.fr.design.fun;
import com.fr.base.chart.BaseChartCollection;
import com.fr.chartx.attr.ChartProvider;
import com.fr.general.FRFont;
import com.fr.report.cell.CellElement;
import com.fr.stable.fun.mark.Selectable;
import java.awt.Font;
/**
* 主要用于fvs报表块内元素默认值的调整以达到所见所得效果后续fvs内置后删除
*/
public interface DefaultValueAdjustProvider extends Selectable {
String MARK_STRING = "DefaultValueAdjustProvider";
int CURRENT_LEVEL = 1;
/**
* 调整单元格对象默认值
*
* @param cellElement
*/
void adjustCellElement(CellElement cellElement);
/**
* 调整富文本默认值
*
* @param fontSize
* @return
*/
int adjustRichTextTransform(int fontSize, double transformedFontSize);
/**
* 调整ChartCollection
*
* @param chartCollection
*/
void adjustChartCollectionStyle(BaseChartCollection chartCollection);
/**
* 调整图表
*
* @param chartProvider
*/
void adjustChart(ChartProvider chartProvider);
/**
* 转成当前分辨率下显示的font
* @param font
* @param resolution
* @return
*/
Font transformFontByResolution(FRFont font, int resolution);
}

24
designer-base/src/main/java/com/fr/design/fun/impl/AbstractDefaultValueAdjustProvider.java

@ -0,0 +1,24 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.stable.fun.assist.Selector;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
@API(level = DefaultValueAdjustProvider.CURRENT_LEVEL)
public abstract class AbstractDefaultValueAdjustProvider extends AbstractProvider implements DefaultValueAdjustProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
public String mark4Provider() {
return this.getClass().getName();
}
public Selector selector() {
return Selector.ALWAYS;
}
}

7
designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java

@ -1,6 +1,7 @@
package com.fr.design.gui.core;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.form.ui.Button;
import com.fr.form.ui.CheckBox;
import com.fr.form.ui.CheckBoxGroup;
@ -14,6 +15,7 @@ import com.fr.form.ui.ListEditor;
import com.fr.form.ui.MultiFileEditor;
import com.fr.form.ui.NumberEditor;
import com.fr.form.ui.Password;
import com.fr.form.ui.PictureWidget;
import com.fr.form.ui.RadioGroup;
import com.fr.form.ui.TextArea;
import com.fr.form.ui.TextEditor;
@ -142,7 +144,7 @@ public abstract class WidgetOption implements Serializable {
*/
public static WidgetOption[] getFormWidgetIntance() {
return new WidgetOption[]{TEXTEDITOR, LABEL, FREEBUTTON, COMBOBOX, COMBOCHECKBOX, DATEEDITOR,
NUMBEREDITOR, TREECOMBOBOX, RADIOGROUP, CHECKBOXGROUP, TEXTAREA, PASSWORD, CHECKBOX, TREE, MULTI_FILEEDITOR};
NUMBEREDITOR, TREECOMBOBOX, RADIOGROUP, CHECKBOXGROUP, TEXTAREA, PASSWORD, CHECKBOX, TREE, MULTI_FILEEDITOR,PICTURE};
}
public static final WidgetOption DATEEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Date"),
@ -214,4 +216,7 @@ public abstract class WidgetOption implements Serializable {
public static final WidgetOption IFRAMEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Form_Iframe"), BaseUtils.readIcon("/com/fr/web/images/form/resources/iframe_16.png"),
IframeEditor.class);
public static final WidgetOption PICTURE = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Image"), IconUtils.readIcon("/com/fr/web/images/form/resources/picture_widget_16.png"),
PictureWidget.class);
}

2
designer-base/src/main/java/com/fr/design/gui/core/WidgetOptionFactory.java

@ -4,7 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.form.ui.Widget;
import javax.swing.*;
import javax.swing.Icon;
public class WidgetOptionFactory {

2
designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java

@ -8,6 +8,8 @@ import com.fr.design.designer.TargetComponent;
*/
public interface HyperlinkGroupPaneActionProvider {
String XML_TAG = "HyperlinkGroupPane";
/**
* 刷新面板展示
*

12
designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java

@ -61,6 +61,14 @@ public class UIButton extends JButton implements UIObserver, UITextComponent {
init();
}
public UIButton(Icon icon, boolean decorate) {
this(icon);
if (!decorate) {
setContentAreaFilled(false);
setFocusPainted(false);
setBorderPainted(false);
}
}
public UIButton(Icon icon) {
super(icon);
@ -397,4 +405,8 @@ public class UIButton extends JButton implements UIObserver, UITextComponent {
public boolean shouldResponseChangeListener() {
return true;
}
}

37
designer-base/src/main/java/com/fr/design/mainframe/AbsoluteMeasureUIMode.java

@ -0,0 +1,37 @@
package com.fr.design.mainframe;
import com.fr.base.AutoChangeLineProvider;
import com.fr.base.DefaultAutoChangeLine;
import com.fr.base.ScreenResolution;
import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.design.unit.UnitConvertUtil;
public class AbsoluteMeasureUIMode implements DesignerUIMode {
private static class AbsoluteMeasureUIModeHolder {
private static final AbsoluteMeasureUIMode absoluteMeasureUIMode = new AbsoluteMeasureUIMode();
}
private AbsoluteMeasureUIMode() {
}
public static AbsoluteMeasureUIMode getInstance() {
return AbsoluteMeasureUIModeHolder.absoluteMeasureUIMode;
}
@Override
public ReportLengthUNITProvider parseLengthUNIT(int unitType) {
return UnitConvertUtil.parseLengthUNIT(unitType);
}
@Override
public AutoChangeLineProvider getAutoChangeLineStrategy() {
return new DefaultAutoChangeLine();
}
@Override
public int getScreenResolution() {
return ScreenResolution.getScreenResolution();
}
}

17
designer-base/src/main/java/com/fr/design/mainframe/DesignerUIMode.java

@ -0,0 +1,17 @@
package com.fr.design.mainframe;
import com.fr.base.AutoChangeLineProvider;;
import com.fr.design.fun.ReportLengthUNITProvider;
/**
* 设计器上和展示相关配置
*/
public interface DesignerUIMode {
ReportLengthUNITProvider parseLengthUNIT(int unitType);
AutoChangeLineProvider getAutoChangeLineStrategy();
int getScreenResolution();
}

63
designer-base/src/main/java/com/fr/design/mainframe/DesignerUIModeConfig.java

@ -1,19 +1,14 @@
package com.fr.design.mainframe;
import com.fr.base.AutoChangeLineProvider;
import com.fr.base.DefaultAutoChangeLine;
import com.fr.base.ScreenResolution;
import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.design.unit.UnitConvertUtil;
import com.fr.form.fit.NewUIModeAutoChangeLine;
import com.fr.general.ComparatorUtils;
import com.fr.stable.Constants;
/**
* Created by kerry on 2020-06-05
*/
public class DesignerUIModeConfig {
private DesignerUIMode mode = DesignerUIMode.ABSOLUTE_MEASURE_UI_MODE;
private DesignerUIMode mode = AbsoluteMeasureUIMode.getInstance();
private static class DesignerUIModeConfigHolder {
private static final DesignerUIModeConfig designerUIModeConfig = new DesignerUIModeConfig();
@ -34,21 +29,25 @@ public class DesignerUIModeConfig {
* @return boolean
*/
public boolean simulateWebUIMode() {
return ComparatorUtils.equals(DesignerUIMode.SIMULATE_WEB_UI_MODE, mode);
return ComparatorUtils.equals(SimulateWebUIMode.getInstance(), mode);
}
/**
* 设置新ui模式
*/
public void setSimulateWebUIMode() {
this.mode = DesignerUIMode.SIMULATE_WEB_UI_MODE;
this.mode = SimulateWebUIMode.getInstance();
}
public void setDesignerUIMode(DesignerUIMode mode) {
this.mode = mode;
}
/**
* 设置老ui模式
*/
public void setAbsoluteMeasureUIMode() {
this.mode = DesignerUIMode.ABSOLUTE_MEASURE_UI_MODE;
this.mode = AbsoluteMeasureUIMode.getInstance();
}
/**
@ -78,50 +77,4 @@ public class DesignerUIModeConfig {
return mode.getScreenResolution();
}
private enum DesignerUIMode {
ABSOLUTE_MEASURE_UI_MODE {
@Override
protected ReportLengthUNITProvider parseLengthUNIT(int unitType) {
return UnitConvertUtil.parseLengthUNIT(unitType);
}
@Override
public AutoChangeLineProvider getAutoChangeLineStrategy() {
return new DefaultAutoChangeLine();
}
@Override
protected int getScreenResolution() {
return ScreenResolution.getScreenResolution();
}
},
SIMULATE_WEB_UI_MODE {
@Override
protected ReportLengthUNITProvider parseLengthUNIT(int unitType) {
return new PXReportLengthUNIT();
}
@Override
public AutoChangeLineProvider getAutoChangeLineStrategy() {
return new NewUIModeAutoChangeLine();
}
@Override
protected int getScreenResolution() {
return Constants.DEFAULT_WEBWRITE_AND_SCREEN_RESOLUTION;
}
};
protected abstract ReportLengthUNITProvider parseLengthUNIT(int unitType);
public abstract AutoChangeLineProvider getAutoChangeLineStrategy();
protected abstract int getScreenResolution();
}
}

38
designer-base/src/main/java/com/fr/design/mainframe/SimulateWebUIMode.java

@ -0,0 +1,38 @@
package com.fr.design.mainframe;
import com.fr.base.AutoChangeLineProvider;
import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.form.fit.NewUIModeAutoChangeLine;
import com.fr.stable.Constants;
public class SimulateWebUIMode implements DesignerUIMode {
private static class SimulateWebUIModeHolder {
private static final SimulateWebUIMode simulateWebUIMode = new SimulateWebUIMode();
}
private SimulateWebUIMode() {
}
public static SimulateWebUIMode getInstance() {
return SimulateWebUIModeHolder.simulateWebUIMode;
}
@Override
public ReportLengthUNITProvider parseLengthUNIT(int unitType) {
return new PXReportLengthUNIT();
}
@Override
public AutoChangeLineProvider getAutoChangeLineStrategy() {
return new NewUIModeAutoChangeLine();
}
@Override
public int getScreenResolution() {
return Constants.DEFAULT_WEBWRITE_AND_SCREEN_RESOLUTION;
}
}

6
designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java

@ -5,7 +5,9 @@ import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.settings.ThemedCellStyle;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.DesignUtils;
import com.fr.report.cell.DefaultTemplateCellElement;
/**
@ -41,6 +43,10 @@ public class DefaultThemedTemplateCellElementCase {
cellElement.setStyle(DesignModeContext.isDuchampMode() ? nameStyle.getRealStyle() : nameStyle);
}
}
DefaultValueAdjustProvider adjustProvider = DesignUtils.getValueAdjust();
if (adjustProvider != null) {
adjustProvider.adjustCellElement(cellElement);
}
return cellElement;
}
}

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

@ -60,6 +60,7 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.remote.action.RemoteDesignAuthManagerAction;
import com.fr.design.update.actions.SoftwareUpdateAction;
@ -579,6 +580,13 @@ public abstract class ToolBarMenuDock {
}
shortCuts.add(new AboutAction());
try {
if (DesignModuleFactory.getITReplaceAction() != null) {
shortCuts.add((ShortCut) DesignModuleFactory.getITReplaceAction().newInstance());
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return shortCuts.toArray(new ShortCut[0]);
}

34
designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java

@ -1,6 +1,7 @@
package com.fr.design.module;
import com.fr.base.chart.BaseChartCollection;
import com.fr.design.actions.help.replace.ITReplaceOperator;
import com.fr.design.gui.chart.BaseChartPropertyPane;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.design.gui.chart.MiddleChartDialog;
@ -47,8 +48,10 @@ public class DesignModuleFactory {
private Class<MiddleChartDialog> autoChartDialogClass;
private Class<? extends BaseChartPropertyPane> chartPropertyPaneClass;
private Class newFormAction;
private Class ITReplaceAction;
private Class formParaDesigner;
private Class paraPropertyPane;
private static ITReplaceOperator replaceHelper;
private Class<? extends HierarchyTreePane> formHierarchyPaneCls;
private Class<? extends BaseWidgetPropertyPane> widgetPropertyPane;
private Class buttonDetailPaneClass;
@ -69,7 +72,7 @@ public class DesignModuleFactory {
@NotNull
public static NameableCreator[] getCreators4Hyperlink() {
return instance.creators4Hyperlink == null? new NameableCreator[0]:instance.creators4Hyperlink;
return instance.creators4Hyperlink == null ? new NameableCreator[0] : instance.creators4Hyperlink;
}
public static void registerExtraWidgetOptions(WidgetOption[] options) {
@ -117,6 +120,35 @@ public class DesignModuleFactory {
return instance.newFormAction;
}
/**
* 注册一下查找替换
*
* @param r
*/
public static void registerReplaceActionClass(Class r) {
instance.ITReplaceAction = r;
}
public static Class getITReplaceAction() {
return instance.ITReplaceAction;
}
/**
* 注册一下查找替换面板
* @param
*/
public static void registerReplace(ITReplaceOperator replace) {
replaceHelper = replace;
}
/**
* 获取查找替换面板的操作类
* @return
*/
public static ITReplaceOperator getReplaceOperator() {
return replaceHelper;
}
public static void registerParaPropertyPaneClass(Class p) {
instance.paraPropertyPane = p;
}

10
designer-base/src/main/java/com/fr/design/remote/button/IconButton.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
@ -15,14 +16,19 @@ import java.awt.Graphics2D;
import java.awt.Point;
public final class IconButton extends JButton {
public IconButton() {
public IconButton(Icon icon) {
super(StringUtils.EMPTY);
setContentAreaFilled(false);
setFocusPainted(false);
setIcon(BaseUtils.readIcon("com/fr/design/remote/images/icon_tab_close_normal.png"));
setIcon(icon);
setBorder(null);
}
public IconButton() {
this(BaseUtils.readIcon("com/fr/design/remote/images/icon_tab_close_normal.png"));
}
@Override
protected void paintBorder(Graphics g) {
}

67
designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java → designer-base/src/main/java/com/fr/design/report/SelectImagePane.java

@ -13,22 +13,24 @@ import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage;
import com.fr.report.cell.painter.CellImagePainter;
import com.fr.stable.Constants;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
/**
* 这个类主要用于插入图片时的设置
*/
* <p>这个类主要用于插入图片时的设置</p>
* <p>这个类原本在designer-realize包下面现在表单也可选择图片所以应该抽为公用的base包包名不变应该不影响插件使用</p>
*
* @author Jimmy.Zheng created on 2022/8/11 21:22
**/
public class SelectImagePane extends BasicPane {
private ImagePreviewPane previewPane = null;
@ -39,8 +41,31 @@ public class SelectImagePane extends BasicPane {
private UIRadioButton adjustRadioButton = null;
private Style imageStyle = null;
ActionListener layoutActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
setImageStyle();
changeImageStyle();
}
};
private File imageFile;
/**
* Select picture.
*/
ActionListener selectPictureActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
int returnVal = imageFileChooser
.showOpenDialog(SelectImagePane.this);
if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = imageFileChooser.getSelectedFile();
imageFile = selectedFile;
ImgChooseWrapper.getInstance(previewPane, imageFileChooser, imageStyle, null).dealWithImageFile(returnVal);
}
}
};
public SelectImagePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -102,23 +127,6 @@ public class SelectImagePane extends BasicPane {
imageFileChooser.setMultiSelectionEnabled(false);
}
/**
* Select picture.
*/
ActionListener selectPictureActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
int returnVal = imageFileChooser
.showOpenDialog(SelectImagePane.this);
if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = imageFileChooser.getSelectedFile();
imageFile = selectedFile;
ImgChooseWrapper.getInstance(previewPane, imageFileChooser, imageStyle, null).dealWithImageFile(returnVal);
}
}
};
// 调整图片样式,只有水平和垂直对齐以及拉伸。相对于背景,平铺不予考虑。
private void changeImageStyle() {
previewPane.setImageStyle(this.imageStyle);
@ -137,15 +145,6 @@ public class SelectImagePane extends BasicPane {
}
}
ActionListener layoutActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
setImageStyle();
changeImageStyle();
}
};
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Image");

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

@ -7,6 +7,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.deeplink.DeepLinkCore;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.gui.UILookAndFeel;
import com.fr.design.i18n.Toolkit;
@ -18,11 +19,14 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.injectable.PluginModule;
import com.fr.stable.ArrayUtils;
import com.fr.stable.CommonCodeUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.bridge.ObjectHolder;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.plugin.ExtraDesignClassManagerProvider;
import com.fr.start.ServerStarter;
import com.fr.start.common.DesignerStartupContext;
import com.fr.start.common.DesignerStartupUtil;
@ -48,6 +52,7 @@ import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -463,4 +468,17 @@ public class DesignUtils {
return xmlDesignerVersion;
}
public static DefaultValueAdjustProvider getValueAdjust() {
ExtraDesignClassManager extraDesignClassManager = PluginModule.getAgent(PluginModule.ExtraDesign);
if (extraDesignClassManager != null) {
Set<DefaultValueAdjustProvider> providers = extraDesignClassManager.getArray(DefaultValueAdjustProvider.MARK_STRING);
for (DefaultValueAdjustProvider provider : providers) {
if (provider.selector().accept(new ObjectHolder())) {
return provider;
}
}
}
return null;
}
}

6
designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

@ -17,6 +17,7 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.border.UITitledBorder;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icheckbox.UICheckBox;
@ -32,6 +33,7 @@ import com.fr.design.style.color.ColorCell;
import com.fr.design.style.color.ColorFactory;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.style.color.ColorSelectable;
import com.fr.design.utils.DesignUtils;
import com.fr.general.FRFont;
import com.fr.stable.AssistUtils;
import com.fr.stable.Constants;
@ -171,6 +173,10 @@ public final class GUICoreUtils {
FRFont frFont = style.getFRFont();
textField.setFont(new Font(frFont.getFontName(), frFont.getStyle(), frFont.getShowSize(resolution)));
DefaultValueAdjustProvider valueAdjust = DesignUtils.getValueAdjust();
if (valueAdjust != null) {
textField.setFont(valueAdjust.transformFontByResolution(frFont, resolution));
}
textField.setForeground(style.getFRFont().getForeground());
if (style.getBackground() instanceof ColorBackground) {

30
designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java vendored

@ -1,13 +1,20 @@
package com.fr.env;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.AssistUtils;
import com.fr.stable.FCloneable;
import com.fr.stable.StringUtils;
import java.net.URI;
import java.net.URISyntaxException;
import com.fr.third.guava.base.Strings;
/**
* @author yaohwu
*/
public class RemoteWorkspaceURL implements FCloneable {
private static final String IPV6_JUDGE_SYMBOL = "[";
private static final String IPV6_JUDGE_SYMBOL2 = "]";
public static final String SYSTEM_LOGIN_PATH = "#management/system/login";
@ -98,6 +105,8 @@ public class RemoteWorkspaceURL implements FCloneable {
parserWebAndServlet(lefts);
}
}
//判断一下IPV6
this.refreshIPV6Format();
}
public boolean hasDefaultHostName() {
@ -129,6 +138,27 @@ public class RemoteWorkspaceURL implements FCloneable {
return this.url;
}
/**
* IPV6地址格式不同,处理字符串的方式不同,需要处理的是port和host
* 形如 http://[XXXX::XXXX:XXXX:XXXX:XXXX]:8080/webroot/decision
*/
public void refreshIPV6Format() {
String url = this.url;
if (Strings.isNullOrEmpty(url)) {
return;
}
if (!url.contains(IPV6_JUDGE_SYMBOL) || !url.contains(IPV6_JUDGE_SYMBOL2)) {
return;
}
URI uri = null;
try {
uri = new URI(url);
this.host = uri.getHost();
this.port = String.valueOf(uri.getPort());
} catch (URISyntaxException ignored) {
}
}
public void setHttps(boolean https) {
isHttps = https;

1
designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java

@ -162,6 +162,7 @@ public class StartupPageWindow extends JFrame {
revalidate();
setFullScreen();
}
private void setFullScreen() {

3
designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties

@ -21,4 +21,5 @@ com.fr.design.ds.column.sort.pane=250*180
com.fr.design.sort.expand.header.pane=95*10
com.fr.design.plugin.remind.PluginInvalidateRemindDialog.dialog=600*500
com.fr.design.plugin.remind.PluginInvalidateRemindDialog.centerPane=580*369
com.fr.design.report.WatermarkSettingPane=720*600
com.fr.design.report.WatermarkSettingPane=720*600
com.fr.design.file.MultiTemplateTabPane.popUpMenu=350*65

3
designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties

@ -20,4 +20,5 @@ com.fr.design.ds.column.sort.pane=250*165
com.fr.design.sort.expand.header.pane=95*10
com.fr.design.plugin.remind.PluginInvalidateRemindDialog.dialog=600*500
com.fr.design.plugin.remind.PluginInvalidateRemindDialog.centerPane=580*369
com.fr.design.report.WatermarkSettingPane=720*600
com.fr.design.report.WatermarkSettingPane=720*600
com.fr.design.file.MultiTemplateTabPane.popUpMenu=240*65

3
designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties

@ -20,4 +20,5 @@ com.fr.design.ds.column.sort.pane=250*180
com.fr.design.sort.expand.header.pane=95*10
com.fr.design.plugin.remind.PluginInvalidateRemindDialog.dialog=600*500
com.fr.design.plugin.remind.PluginInvalidateRemindDialog.centerPane=580*369
com.fr.design.report.WatermarkSettingPane=720*600
com.fr.design.report.WatermarkSettingPane=720*600
com.fr.design.file.MultiTemplateTabPane.popUpMenu=240*65

3
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties

@ -22,4 +22,5 @@ com.fr.design.ds.column.sort.pane=220*150
com.fr.design.sort.expand.header.pane=108*10
com.fr.design.plugin.remind.PluginInvalidateRemindDialog.dialog=600*500
com.fr.design.plugin.remind.PluginInvalidateRemindDialog.centerPane=580*369
com.fr.design.report.WatermarkSettingPane=720*600
com.fr.design.report.WatermarkSettingPane=720*600
com.fr.design.file.MultiTemplateTabPane.popUpMenu=170*65

3
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties

@ -20,4 +20,5 @@ com.fr.design.ds.column.sort.pane=220*150
com.fr.design.sort.expand.header.pane=108*10
com.fr.design.plugin.remind.PluginInvalidateRemindDialog.dialog=600*500
com.fr.design.plugin.remind.PluginInvalidateRemindDialog.centerPane=580*369
com.fr.design.report.WatermarkSettingPane=720*600
com.fr.design.report.WatermarkSettingPane=720*600
com.fr.design.file.MultiTemplateTabPane.popUpMenu=170*65

3
designer-base/src/main/resources/com/fr/design/images/buttonicon/replace_help.svg

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15ZM8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14ZM6.193 4.696C6.655 4.223 7.293 3.992 8.107 3.992C8.811 3.992 9.383 4.179 9.823 4.575C10.263 4.96 10.483 5.488 10.483 6.148C10.483 6.687 10.34 7.138 10.065 7.49C9.966 7.611 9.658 7.897 9.141 8.348C8.932 8.524 8.778 8.722 8.679 8.92C8.558 9.14 8.503 9.382 8.503 9.646V9.733C8.503 9.78823 8.45823 9.833 8.403 9.833H7.426C7.37077 9.833 7.326 9.78823 7.326 9.733V9.646C7.326 9.239 7.392 8.887 7.546 8.601C7.689 8.293 8.107 7.842 8.789 7.237L8.976 7.028C9.174 6.775 9.284 6.511 9.284 6.225C9.284 5.84 9.174 5.543 8.965 5.323C8.745 5.103 8.426 4.993 8.03 4.993C7.535 4.993 7.172 5.147 6.952 5.466C6.76786 5.71152 6.66935 6.05217 6.65646 6.48796C6.65482 6.54316 6.61023 6.588 6.555 6.588H5.6C5.54477 6.588 5.49986 6.54311 5.50122 6.4879C5.51978 5.7327 5.75038 5.13862 6.193 4.696ZM7.337 10.647C7.491 10.493 7.689 10.427 7.909 10.427C8.14 10.427 8.338 10.493 8.492 10.647C8.646 10.79 8.723 10.977 8.723 11.208C8.723 11.439 8.635 11.626 8.481 11.78C8.327 11.923 8.129 12 7.909 12C7.689 12 7.491 11.923 7.337 11.769C7.183 11.615 7.106 11.428 7.106 11.208C7.106 10.977 7.183 10.79 7.337 10.647Z" fill="#419BF9"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/picture_widget_16.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/form/designer/widget/picture_widget_designer_bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

10
designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java vendored

@ -242,4 +242,14 @@ public class RemoteWorkspaceURLTest {
assertEquals("servlet", b.getServlet());
//others begin
}
@Test
public void testIPV6Url() {
String trueUrl = "http://[fe80::4d83:cc10:9f6f:3303]:8080/webroot/decision";
RemoteWorkspaceURL remoteWorkspaceURL1 = new RemoteWorkspaceURL(trueUrl);
assertEquals("[fe80::4d83:cc10:9f6f:3303]", remoteWorkspaceURL1.getHost());
assertEquals("8080", remoteWorkspaceURL1.getPort());
assertEquals("webroot", remoteWorkspaceURL1.getWeb());
assertEquals("decision", remoteWorkspaceURL1.getServlet());
}
}

6
designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java

@ -4,9 +4,11 @@ import com.fr.base.chart.BaseChartCollection;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.gui.chart.MiddleChartDialog;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.third.joda.time.DateTime;
@ -87,6 +89,10 @@ public class ChartDialog extends MiddleChartDialog {
return new ActionListener() {
public void actionPerformed(ActionEvent e) {
chartTypePane.update((ChartCollection) cc, createTime);
DefaultValueAdjustProvider adjustProvider = DesignUtils.getValueAdjust();
if (adjustProvider != null) {
adjustProvider.adjustChartCollectionStyle(cc);
}
doOK();
}
};

7
designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java

@ -8,10 +8,12 @@ import com.fr.chart.web.ChartHyperPoplink;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.hyperlink.AbstractHyperLinkPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.ChartHyperEditPane;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.van.chart.config.DefaultStyleHelper4Van;
@ -67,7 +69,10 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane<ChartHyperPopli
private ChartCollection createChartCollection() {
ChartCollection cc = new ChartCollection();
cc.setThemeStyle(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplateTheme());
DefaultValueAdjustProvider adjustProvider = DesignUtils.getValueAdjust();
if (adjustProvider != null) {
adjustProvider.adjustChartCollectionStyle(cc);
}
ChartProvider chart = ChartTypeManager.getInstanceWithCheck().getFirstChart();
if (chart != null) {
try {

7
designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java

@ -11,7 +11,9 @@ import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.DataSheet;
import com.fr.chartx.attr.ChartProvider;
import com.fr.config.predefined.ColorFillStyle;
import com.fr.design.fun.DefaultValueAdjustProvider;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.DesignUtils;
import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.attr.axis.VanChartAlertValue;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
@ -54,7 +56,12 @@ public class DefaultStyleHelper4Van {
dealChartColor((VanChart) chartProvider);
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
DefaultValueAdjustProvider adjustProvider = DesignUtils.getValueAdjust();
if (adjustProvider != null) {
adjustProvider.adjustChart(chartProvider);
}
}
}
public static void dealVanPlot4Custom(VanChartPlot plot, CustomPlotType customPlotType) {

2
designer-form/src/main/java/com/fr/design/actions/NewFormAction.java

@ -43,7 +43,7 @@ public class NewFormAction extends UpdateAction {
@Override
public KeyStroke getKeyStroke() {
return KeyStroke.getKeyStroke(KeyEvent.VK_F, DEFAULT_MODIFIER);
return null;
}
};
}

23
designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java

@ -131,6 +131,29 @@ public class SelectionModel {
}
}
/**
* 用于强制定位所需组件不对布局组件的顶层布局进行编辑判定即使上层未展开或者未处于编辑状态依然可以强制跳转到对应的子组件
* @param comp 设计组件
*/
public void selectACreator4ITLocation(XCreator comp) {
// 如果父层是scale和title两个专属容器,返回其父层,组件本身是不让被选中的
if (comp != designer.getRootComponent() && comp != designer.getParaComponent()) {
dealParentContainer(comp);
}
if (selection.removeSelectedCreator(comp) || selection.addSelectedCreator(comp)) {
designer.getEditListenerTable().fireCreatorModified(comp, DesignerEvent.CREATOR_SELECTED);
designer.repaint();
}
}
private void dealParentContainer(XCreator comp) {
XCreator parentContainer = (XCreator) comp.getParent();
if (parentContainer != null) {
comp = parentContainer.isDedicateContainer() || comp instanceof XCardSwitchButton ? parentContainer : comp;
}
}
/**
* 将所选组件剪切到剪切板上
*/

27
designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

@ -4,6 +4,7 @@
package com.fr.design.designer.creator;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.svg.IconUtils;
import com.fr.base.theme.FineColorSynchronizer;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.TemplateTheme;
@ -18,6 +19,7 @@ import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fit.common.TemplateTool;
import com.fr.design.fun.ChartWidgetOptionProvider;
import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.fun.ParameterWidgetOptionProvider;
@ -38,6 +40,7 @@ import com.fr.form.ui.ComboCheckBox;
import com.fr.form.ui.DateEditor;
import com.fr.form.ui.EditorHolder;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.FieldEditor;
import com.fr.form.ui.FileEditor;
import com.fr.form.ui.FreeButton;
import com.fr.form.ui.IframeEditor;
@ -46,10 +49,12 @@ import com.fr.form.ui.MultiFileEditor;
import com.fr.form.ui.NameWidget;
import com.fr.form.ui.NumberEditor;
import com.fr.form.ui.Password;
import com.fr.form.ui.PictureWidget;
import com.fr.form.ui.Radio;
import com.fr.form.ui.RadioGroup;
import com.fr.form.ui.TextArea;
import com.fr.form.ui.TextEditor;
import com.fr.form.ui.ToggleButton;
import com.fr.form.ui.TreeComboBoxEditor;
import com.fr.form.ui.TreeEditor;
import com.fr.form.ui.Widget;
@ -71,7 +76,6 @@ import com.fr.form.ui.container.cardlayout.WCardTitleLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.invoke.Reflect;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
@ -84,13 +88,13 @@ import com.fr.report.fit.ReportFitAttr;
import com.fr.report.fit.ReportFitConfig;
import com.fr.stable.StringUtils;
import com.fr.third.javax.annotation.Nonnull;
import java.util.Set;
import org.jetbrains.annotations.Nullable;
import javax.swing.Icon;
import java.awt.Container;
import java.awt.Dimension;
import java.util.List;
import java.util.Set;
/**
* XCreator的相关处理
@ -183,6 +187,7 @@ public class XCreatorUtils {
objectMap.put(CardSwitchButton.class, XCardSwitchButton.class);
objectMap.put(CardAddButton.class, XCardAddButton.class);
objectMap.put(WidgetErrorMarker.class, ErrorCreator.class);
objectMap.put(PictureWidget.class, XPicture.class);
}
private static void reInitExtra() {
@ -236,14 +241,30 @@ public class XCreatorUtils {
}
public static XCreator createThemedXCreator(Widget widget) {
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
TemplateTheme theme = template.getTemplateTheme();
if (theme instanceof FormTheme) {
widget = setupTemplateTheme(widget, true, (FormTheme) theme, TemplateThemeCompatible.NONE);
}
if (TemplateTool.isCurrentEditingNewJForm()){
resetWidgetDefaultProperty(widget);
}
return createXCreator(widget);
}
/**
* 新表单下控件的字体默认都为9pt
* @param widget 控件
*/
private static void resetWidgetDefaultProperty(Widget widget) {
if (widget.acceptType(FieldEditor.class)) {
((FieldEditor) widget).setFontSize(Widget.DEFAULT_FONT_PT_SIZE);
} else if (widget.acceptType(ToggleButton.class)) {
((ToggleButton) widget).setFontSize(Widget.DEFAULT_FONT_PT_SIZE);
}
}
/**
* 创建creator
*
@ -361,7 +382,7 @@ public class XCreatorUtils {
if (StringUtils.isEmpty(iconPath)) {
return null;
}
return IOUtils.readIcon(iconPath);
return IconUtils.readIcon(iconPath);
}
public static boolean containComponent(Container ancestor, Container xCreator) {

74
designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java

@ -0,0 +1,74 @@
package com.fr.design.designer.creator;
import com.fr.design.designer.ui.ImgPanel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.editors.PictureEditor;
import com.fr.design.mainframe.widget.editors.UrlLinkEditor;
import com.fr.design.mainframe.widget.renderer.PictureRenderer;
import com.fr.design.mainframe.widget.renderer.UrlLinkRenderer;
import com.fr.form.ui.PictureWidget;
import com.fr.general.IOUtils;
import com.fr.stable.ArrayUtils;
import java.awt.Dimension;
import java.awt.Image;
import java.beans.IntrospectionException;
import javax.swing.JComponent;
/**
*
* <p>图片控件的creator</p>
*
* @author Jimmy.Zheng created on 2022/8/11 21:16
**/
public class XPicture extends XWidgetCreator {
public XPicture(PictureWidget widget, Dimension dimension) {
super(widget, dimension);
}
@Override
protected String getIconName() {
return "picture_widget_16.png";
}
@Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), new CRPropertyDescriptor[]{
new CRPropertyDescriptor("picUrl", toData().getClass())
.setI18NName(Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Image"))
.setEditorClass(PictureEditor.class)
.setRendererClass(PictureRenderer.class)
.putKeyValue("category", "Fine-Design_Basic_Advanced"),
new CRPropertyDescriptor("urlLink", toData().getClass())
.setI18NName(Toolkit.i18nText("Fine-Design_Basic_Hyperlink"))
.setEditorClass(UrlLinkEditor.class)
.setRendererClass(UrlLinkRenderer.class)
.putKeyValue(
"category", "Fine-Design_Basic_Advanced")});
}
@Override
protected JComponent initEditor() {
PictureWidget pictureWidget = (PictureWidget) this.data;
if (this.editor == null) {
this.editor = FRGUIPaneFactory.createBorderLayout_S_Pane();
Object value = pictureWidget.getPicUrl().getValue();
ImgPanel imgPanel = new ImgPanel();
if (value instanceof Image) {
imgPanel.setBackgroundImage((Image) value);
imgPanel.setImageDisplayMode(pictureWidget.getShowType());
} else {
imgPanel.setBackgroundImage(IOUtils.readImage("com/fr/design/images/form/designer/widget/picture_widget_designer_bg.png"));
imgPanel.setImageDisplayMode(0);
}
this.editor.add(imgPanel, "Center");
}
return this.editor;
}
@Override
public boolean canEnterIntoParaPane() {
return false;
}
}

113
designer-form/src/main/java/com/fr/design/designer/ui/ImgPanel.java

@ -0,0 +1,113 @@
package com.fr.design.designer.ui;
import com.fr.general.ImageWithSuffix;
import com.fr.stable.Constants;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JComponent;
/**
* <p>图片控件中的已选图片展示面板</p>
*
* @author Jimmy.Zheng created on 2022/8/11 21:17
**/
public class ImgPanel extends JComponent {
private static final long serialVersionUID = 1L;
private Image backgroundImage;
private int imageDisplayMode;
private int modeIndex;
public ImgPanel() {
this(null, 0);
}
public ImgPanel(Image image, int modeName) {
setBackgroundImage(image);
setImageDisplayMode(modeName);
}
public Image getBackgroundImage() {
return this.backgroundImage;
}
public void setBackgroundImage(Image image) {
this.backgroundImage = image;
repaint();
}
public int getImageDisplayMode() {
return this.imageDisplayMode;
}
public void setImageDisplayMode(int modeName) {
switch (modeName) {
case Constants.IMAGE_CENTER:
this.modeIndex = 0;
break;
case Constants.IMAGE_TILED:
this.imageDisplayMode = 0;
this.modeIndex = 1;
break;
case Constants.IMAGE_EXTEND:
this.imageDisplayMode = 2;
this.modeIndex = 2;
break;
case Constants.IMAGE_ADJUST:
this.imageDisplayMode = 4;
this.modeIndex = 3;
break;
default:
}
repaint();
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (this.backgroundImage != null) {
if (this.backgroundImage instanceof ImageWithSuffix) {
this.backgroundImage = ((ImageWithSuffix) backgroundImage).getImage();
}
int width = getWidth();
int height = getHeight();
int imageWidth = this.backgroundImage.getWidth(this);
int imageHeight = this.backgroundImage.getHeight(this);
switch (this.modeIndex) {
case 0:
int x = (width - imageWidth) / 2;
int y = (height - imageHeight) / 2;
g.drawImage(this.backgroundImage, x, y, this);
break;
case 1:
for (int ix = 0; ix < width; ix += imageWidth) {
for (int iy = 0; iy < height; iy += imageHeight) {
g.drawImage(this.backgroundImage, ix, iy, this);
}
}
break;
case 2:
g.drawImage(this.backgroundImage, 0, 0, width, height, this);
break;
case 3:
double sx = 1.0 * width / imageWidth;
double sy = 1.0 * height / imageHeight;
if (sx > sy) {
sx = sy;
width = (int) (sx * imageWidth);
} else {
sy = sx;
height = (int) (sy * imageHeight);
}
int xx = (getWidth() - width) / 2;
int yy = (getHeight() - height) / 2;
g.drawImage(this.backgroundImage, xx, yy, width, height, this);
default:
}
}
}
}

4
designer-form/src/main/java/com/fr/design/fit/NewJForm.java

@ -243,7 +243,7 @@ public class NewJForm extends JForm {
return;
}
if (xCreator instanceof XElementCase) {
getFormDesign().getSelectionModel().selectACreator(xCreator);
getFormDesign().getSelectionModel().selectACreator4ITLocation(xCreator);
xCreator.startEditing();
if (getElementCaseDesign() != null) {
getElementCaseDesign().navigate(trl);
@ -251,7 +251,7 @@ public class NewJForm extends JForm {
} else {
tabChanged(FORM_TAB);
getFormDesign().getSelectionModel().reset();
getFormDesign().getSelectionModel().selectACreator(xCreator);
getFormDesign().getSelectionModel().selectACreator4ITLocation(xCreator);
}
}, XCreator.class);
}

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

@ -704,8 +704,8 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
}
}
} else {
// 只在报表块里撤销是不需要修改外部form对象的, 因为编辑的是当前报表块.
// 修改了JForm的Target需要同步修改formDesign的Target.
this.setTarget(undoForm);
String widgetName = this.formDesign.getElementCaseContainerName();
//这儿太坑了,u.getForm() 与 getTarget内容不一样
FormElementCaseProvider dataTable = undoForm.getElementCaseByName(widgetName);
@ -1249,29 +1249,47 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
@Override
public void setTemplateTheme(TemplateTheme newTheme, TemplateThemeCompatible compatible) {
FormTheme oldTheme = getTarget().getTemplateTheme();
boolean shouldCreateUndoState = compatible == TemplateThemeCompatible.NONE && !StringUtils.equals(oldTheme.getName(), newTheme.getName());
FormArea formArea = formDesign.getArea();
int horizontalValue = formArea.getHorizontalValue();
int verticalValue = formArea.getVerticalValue();
Dimension areaSize = formArea.getAreaSize();
double widthValue = formArea.getWidthPaneValue();
double heightValue = formArea.getHeightPaneValue();
double slideValue = formArea.getSlideValue();
Form target = getTarget();
target.setTemplateTheme(newTheme, compatible);
target = (Form) FineColorSynchronizer.flush(target, target.getTemplateTheme());
refreshTarget(target);
super.setTemplateTheme(newTheme, compatible);
fireTargetModified(shouldCreateUndoState);
}
getTarget().setTemplateTheme(newTheme, compatible);
setTarget((Form) FineColorSynchronizer.flush(getTarget(), newTheme, compatible));
private void refreshTarget(Form form) {
setTarget(form);
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) {
fireTargetModified(shouldCreateUndoState);
formDesign.refreshRoot();
// 刷新界面后恢复原来的尺寸
formDesign.getArea().setAreaSize(areaSize, horizontalValue, verticalValue, widthValue, heightValue, slideValue);
formDesign.getArea().undoFixLayoutState(formArea.isFixLayout());
if (this.index != FORM_TAB) {
if (this.index == FORM_TAB) {
// save state
FormArea formArea = formDesign.getArea();
int horizontalValue = formArea.getHorizontalValue();
int verticalValue = formArea.getVerticalValue();
Dimension areaSize = formArea.getAreaSize();
double widthValue = formArea.getWidthPaneValue();
double heightValue = formArea.getHeightPaneValue();
double slideValue = formArea.getSlideValue();
Widget[] selectedWidgets = formArea.getFormEditor().getSelectionModel().getSelection().getSelectedWidgets();
// refresh ui
JForm.this.refreshRoot();
// restore state
formDesign.getArea().setAreaSize(areaSize, horizontalValue, verticalValue, widthValue, heightValue, slideValue);
formDesign.getArea().undoFixLayoutState(formArea.isFixLayout());
this.formDesign.getSelectionModel().setSelectedCreators(FormSelectionUtils.rebuildSelection(formDesign.getRootComponent(),
formDesign.getRootComponent() == selectedBodyLayout() ? selectedWidgets : new Widget[]{selectedBodyLayout().toData()}));
refreshToolArea();
} else {
// CHART-20568: 当图表块处于编辑状态时,任何界面内容的修改都会导致其进行截图操作,进而引起设计器界面再次重绘,导致死循环,因而需要停止编辑 恢复浮层展示
// 停止编辑 恢复浮层展示
TreePath[] treePaths = FormHierarchyTreePane.getInstance(formDesign).getComponentTree().getSelectedTreePath();
if (treePaths != null) {
for (TreePath path : treePaths) {
@ -1280,11 +1298,14 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
}
}
}
} else {
String widgetName = this.formDesign.getElementCaseContainerName();
FormElementCaseProvider dataTable = form.getElementCaseByName(widgetName);
this.reportComposite.setSelectedWidget(dataTable);
formDesign.setElementCase(dataTable);
}
FormHierarchyTreePane.getInstance().refreshRoot();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView();
}
super.setTemplateTheme(newTheme, compatible);
}
@Override

77
designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java

@ -0,0 +1,77 @@
package com.fr.design.mainframe.widget.accessibles;
import com.fr.base.Style;
import com.fr.design.DesignModelAdapter;
import com.fr.design.designer.creator.XPicture;
import com.fr.design.designer.ui.ImgPanel;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.wrappers.PictureModelWrapper;
import com.fr.design.report.SelectImagePane;
import com.fr.form.ui.PictureWidget;
import com.fr.general.ComparatorUtils;
import com.fr.report.cell.FloatElement;
import com.fr.report.cell.cellattr.CellImage;
import javax.swing.JComponent;
/**
*
* <p>图片控件的图片选择编辑器</p>
*
* @author Jimmy.Zheng created on 2022/8/11 21:13
**/
public class AccessiblePictureModelEditor extends UneditableAccessibleEditor {
protected FloatElement element = new FloatElement();
private PictureWidget pic;
public AccessiblePictureModelEditor(PictureWidget pic) {
super(new PictureModelWrapper());
this.pic = pic;
}
@Override
public FloatElement getValue() {
return (FloatElement) super.getValue();
}
@Override
protected void showEditorPane() {
final SelectImagePane imageEditorPane = new SelectImagePane();
if (super.getValue() != null) {
this.element = ((FloatElement) super.getValue());
}
this.element.setStyle(Style.getInstance().deriveImageLayout(this.pic.getShowType()));
imageEditorPane.populate(this.element);
final Object oldValue = this.element.getValue();
final Style oldStyle = this.element.getStyle();
final String oldname = this.element.getName();
imageEditorPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
CellImage cellImage = imageEditorPane.update();
if ((!ComparatorUtils.equals(cellImage.getImage(), oldValue)) || (!ComparatorUtils.equals(cellImage.getStyle(), oldStyle))) {
AccessiblePictureModelEditor.this.element.setValue(cellImage.getImage());
AccessiblePictureModelEditor.this.element.setStyle(cellImage.getStyle());
AccessiblePictureModelEditor.this.element.setName(imageEditorPane.getSelectedImage() == null ? oldname : imageEditorPane.getSelectedImage().toString());
AccessiblePictureModelEditor.this.setValue(AccessiblePictureModelEditor.this.element);
AccessiblePictureModelEditor.this.pic.setShowType(cellImage.getStyle().getImageLayout());
AccessiblePictureModelEditor.this.pic.setPicUrl(element);
ImgPanel p = AccessiblePictureModelEditor.this.getCurrentImgPanel();
p.setBackgroundImage(cellImage.getBufferImage());
p.setImageDisplayMode(cellImage.getStyle().getImageLayout());
AccessiblePictureModelEditor.this.fireStateChanged();
DesignModelAdapter d = DesignModelAdapter.getCurrentModelAdapter();
d.fireTargetModified();
}
}
}).setVisible(true);
}
private ImgPanel getCurrentImgPanel() {
XPicture xPicture = (XPicture) WidgetPropertyPane.getInstance().getEditingFormDesigner().getSelectionModel().getSelection().getSelectedCreator();
JComponent editor = (JComponent) xPicture.getComponent(0);
return (ImgPanel) editor.getComponent(0);
}
}

57
designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleUrlLinkModelEditor.java

@ -0,0 +1,57 @@
package com.fr.design.mainframe.widget.accessibles;
import com.fr.design.DesignModelAdapter;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.gui.xpane.FormHyperlinkGroupPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.widget.wrappers.UrlLinkModelWrapper;
import com.fr.js.NameJavaScriptGroup;
import com.fr.stable.bridge.StableFactory;
/**
* <p>表单图片控件的链接编辑器</p>
* @author Jimmy
*/
public class AccessibleUrlLinkModelEditor extends UneditableAccessibleEditor {
private FormHyperlinkGroupPane hyperlinkPane;
public AccessibleUrlLinkModelEditor() {
super(new UrlLinkModelWrapper());
}
/**
* 原插件使用
* <p>DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPaneNoPop(
* HyperlinkGroupPaneActionImpl.getInstance()));</p>获取{@see this.hyperlinkPane}
* 合并插件依赖不到换种方式 {@see DesignerActivator将实例注册了}
*/
@Override
protected void showEditorPane() {
if (this.hyperlinkPane == null) {
HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider = StableFactory.getMarkedInstanceObjectFromClass(HyperlinkGroupPaneActionProvider.XML_TAG,HyperlinkGroupPaneActionProvider.class);
this.hyperlinkPane = (FormHyperlinkGroupPane) DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPaneNoPop(
hyperlinkGroupPaneActionProvider);
}
BasicDialog dialog = this.hyperlinkPane.showWindow(DesignerContext.getDesignerFrame());
dialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
super.doOk();
NameJavaScriptGroup hyperlinks = AccessibleUrlLinkModelEditor.this.hyperlinkPane.updateJSGroup();
AccessibleUrlLinkModelEditor.this.setValue(hyperlinks);
AccessibleUrlLinkModelEditor.this.fireStateChanged();
DesignModelAdapter d = DesignModelAdapter.getCurrentModelAdapter();
d.fireTargetModified();
}
});
this.hyperlinkPane.populate(getValue());
dialog.setVisible(true);
}
@Override
public NameJavaScriptGroup getValue() {
return (NameJavaScriptGroup) super.getValue();
}
}

17
designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java

@ -0,0 +1,17 @@
package com.fr.design.mainframe.widget.editors;
import com.fr.design.mainframe.widget.accessibles.AccessiblePictureModelEditor;
import com.fr.design.mainframe.widget.accessibles.AccessiblePropertyEditor;
import com.fr.form.ui.PictureWidget;
/**
*
* <p>图片控件的图片选择编辑器</p>
*
* @author Jimmy.Zheng created on 2022/8/11 21:15
**/
public class PictureEditor extends AccessiblePropertyEditor {
public PictureEditor(Object o) {
super(new AccessiblePictureModelEditor((PictureWidget) o));
}
}

17
designer-form/src/main/java/com/fr/design/mainframe/widget/editors/UrlLinkEditor.java

@ -0,0 +1,17 @@
package com.fr.design.mainframe.widget.editors;
import com.fr.design.mainframe.widget.accessibles.AccessiblePropertyEditor;
import com.fr.design.mainframe.widget.accessibles.AccessibleUrlLinkModelEditor;
/**
*
* <p><p>图片控件的链接编辑器</p></p>
*
* @author Jimmy.Zheng created on 2022/8/11 21:19
**/
public class UrlLinkEditor extends AccessiblePropertyEditor {
public UrlLinkEditor() {
super(new AccessibleUrlLinkModelEditor());
}
}

15
designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/PictureRenderer.java

@ -0,0 +1,15 @@
package com.fr.design.mainframe.widget.renderer;
import com.fr.design.mainframe.widget.wrappers.PictureModelWrapper;
/**
* <p>图片控件的图片编辑器的EncoderCellRenderer</p>
*
* @author Jimmy.Zheng created on 2022/8/11 21:29
**/
public class PictureRenderer extends EncoderCellRenderer {
public PictureRenderer() {
super(new PictureModelWrapper());
}
}

16
designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/UrlLinkRenderer.java

@ -0,0 +1,16 @@
package com.fr.design.mainframe.widget.renderer;
import com.fr.design.mainframe.widget.wrappers.UrlLinkModelWrapper;
/**
* <p>图片控件的链接编辑器的EncoderCellRenderer</p>
*
* @author Jimmy.Zheng created on 2022/8/11 21:29
**/
public class UrlLinkRenderer extends EncoderCellRenderer {
public UrlLinkRenderer() {
super(new UrlLinkModelWrapper());
}
}

34
designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/PictureModelWrapper.java

@ -0,0 +1,34 @@
package com.fr.design.mainframe.widget.wrappers;
import com.fr.design.Exception.ValidationException;
import com.fr.design.designer.properties.Decoder;
import com.fr.design.designer.properties.Encoder;
import com.fr.report.cell.FloatElement;
import com.fr.stable.StringUtils;
/**
* <p>图片选择器 {@link com.fr.design.mainframe.widget.accessibles.AccessiblePictureModelEditor} Wrapper</p>
* <p>插件中直接移入未作改动</p>
*
* @author Jimmy.Zheng created on 2022/8/11 21:25
**/
public class PictureModelWrapper implements Encoder<FloatElement>, Decoder<FloatElement> {
@Override
public FloatElement decode(String txt) {
return null;
}
@Override
public void validate(String txt) throws ValidationException {
// do nothing
}
@Override
public String encode(FloatElement v) {
if (v != null) {
return v.getName();
}
return StringUtils.EMPTY;
}
}

33
designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/UrlLinkModelWrapper.java

@ -0,0 +1,33 @@
package com.fr.design.mainframe.widget.wrappers;
import com.fr.design.Exception.ValidationException;
import com.fr.design.designer.properties.Decoder;
import com.fr.design.designer.properties.Encoder;
import com.fr.js.NameJavaScriptGroup;
/**
* <p>链接选择器 {@link com.fr.design.mainframe.widget.accessibles.AccessibleUrlLinkModelEditor} Wrapper</p>
* <p>插件中直接移入未作改动</p>
*
* @author Jimmy.Zheng created on 2022/8/11 21:28
**/
public class UrlLinkModelWrapper implements Encoder<NameJavaScriptGroup>, Decoder<NameJavaScriptGroup> {
@Override
public NameJavaScriptGroup decode(String txt) {
return null;
}
@Override
public void validate(String txt) throws ValidationException {
// do nothing
}
@Override
public String encode(NameJavaScriptGroup v) {
if (v.size() > 0) {
return v.getNameHyperlink(0).getName();
}
return null;
}
}

3
designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java

@ -6,6 +6,7 @@ import com.fr.design.fun.impl.AbstractPreviewProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.worker.WorkerManager;
import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.general.web.ParameterConstants;
@ -47,6 +48,8 @@ public class DeveloperPreview extends AbstractPreviewProvider {
@Override
public void onClick(JTemplate<?, ?> jt) {
super.onClick(jt);
//进入时要关闭查找替换面板
DesignModuleFactory.getReplaceOperator().close();
SwingWorker worker = WorkerManager.getInstance().getWorker(jt.getRuntimeId());
if (worker instanceof CallbackSaveWorker) {
CallbackSaveWorker callbackSaveWorker = (CallbackSaveWorker) worker;

64
designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java

@ -0,0 +1,64 @@
package com.fr.design.actions.replace;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.UIDialog;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.actions.replace.ui.ITReplaceMainDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/**
* 将全局查找替换选项插入帮助菜单底部
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-10
*/
public class ITReplaceAction extends UpdateAction {
public ITReplaceAction() {
this.setMenuKeySet(IT_REPLACE);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setAccelerator(getMenuKeySet().getKeyStroke());
}
private static final MenuKeySet IT_REPLACE = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'I';
}
@Override
public String getMenuName() {
return Toolkit.i18nText("Fine-Design_Replace_Title");
}
@Override
public KeyStroke getKeyStroke() {
return KeyStroke.getKeyStroke(KeyEvent.VK_F, DEFAULT_MODIFIER);
}
};
/**
* 点击选项后的行为
*
* @param event
*/
public void actionPerformed(ActionEvent event) {
ITReplaceMainDialog mainFrame = ITReplaceMainDialog.getInstance();
mainFrame.fitScreen();
mainFrame.setVisible(true);
}
}

23
designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchAction.java

@ -0,0 +1,23 @@
package com.fr.design.actions.replace.action;
import com.fr.design.mainframe.JTemplate;
/**
* 顶层行为接口
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-11
*/
public interface SearchAction {
/**
* 搜索模板获取信息列表
*
* @param jTemplate 指定搜索的模板
*/
default void search4Infos(JTemplate jTemplate) {
}
}

30
designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchManager.java

@ -0,0 +1,30 @@
package com.fr.design.actions.replace.action;
/**
* 管理搜索元素的注册与注销
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-16
*/
public interface SearchManager {
/**
* 注册搜索行为
* @param tag
* @param searchAction
*/
void registerAction(String tag , SearchAction searchAction);
/**
* 根据tag注销搜索行为
* @param tag
*/
default void removeAction(String tag){};
/**
* 根据行为注销指定的搜索行为
* @param searchAction
*/
default void removeAction(SearchAction searchAction){};
}

211
designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchManagerCenter.java

@ -0,0 +1,211 @@
package com.fr.design.actions.replace.action;
import com.fr.design.actions.replace.action.content.formula.cell.SearchCellFormulaManager;
import com.fr.design.actions.replace.action.content.formula.highlight.SearchHighlightFormulaManager;
import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchConditionManager;
import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchJSFormulaManager;
import com.fr.design.actions.replace.action.content.formula.widget.SearchWidgetFormulaManager;
import com.fr.design.actions.replace.action.content.js.SearchJSManager;
import org.jetbrains.annotations.Nullable;
/**
* 管理各个管理类的注入的管理中心
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-16
*/
public class SearchManagerCenter {
public static final int CELL_FORMULA = 0;
public static final int CONDITION_FORMULA = 1;
public static final int JS_FORMULA = 2;
public static final int HIGHLIGHT_FORMULA = 3;
public static final int WIDGET_FORMULA = 4;
public static final int JS = 5;
private SearchManagerCenter() {
}
/**
* 注册
*
* @param index 指定类型编号
* @param tag 类名称
* @param searchAction 对应搜索行为
*/
public void register(int index, String tag, SearchAction searchAction) {
ManagerType managerType = ManagerType.match(index);
if (managerType != null) {
managerType.registerAction(tag, searchAction);
}
}
/**
* 注销
*
* @param index 指定类型编号
* @param tag 类名称
*/
public void remove(int index, String tag) {
ManagerType managerType = ManagerType.match(index);
if (managerType != null) {
managerType.removeAction(tag);
}
}
/**
* 管理类的类型
*/
public enum ManagerType implements SearchManager {
/**
* 注册单元格不同值类型中自己特有的公式数据列子报表公式可自己添加
*/
CELL_FORMULA(0) {
@Override
public void registerAction(String tag, SearchAction searchAction) {
SearchCellFormulaManager.getInstance().registerAction(tag, searchAction);
}
@Override
public void removeAction(String tag) {
SearchCellFormulaManager.getInstance().removeAction(tag);
}
},
/**
* 注册条件属性中的公式公式类型的条件属性包装了一个比较器作为条件的条件对象组合条件用多个AND或者OR连接起来的条件组成的对象简单比较的条件可自己添加
*/
CONDITION_FORMULA(1) {
@Override
public void registerAction(String tag, SearchAction searchAction) {
SearchConditionManager.getInstance().registerAction(tag, searchAction);
}
@Override
public void removeAction(String tag) {
SearchConditionManager.getInstance().removeAction(tag);
}
},
/**
* 注冊超链类型中的自己特有的公式提交入库导出事件移动端弹窗可自己添加
* 其他类型的超链都只有参数部分会存在公式属于公有统一处理
*/
JS_FORMULA(2) {
@Override
public void registerAction(String tag, SearchAction searchAction) {
SearchJSFormulaManager.getInstance().registerAction(tag, searchAction);
}
@Override
public void removeAction(String tag) {
SearchJSFormulaManager.getInstance().removeAction(tag);
}
},
/**
* 注册条件属性中自己特有的公式超级链接控件... 可自己添加
*/
HIGHLIGHT_FORMULA(3) {
@Override
public void registerAction(String tag, SearchAction searchAction) {
SearchHighlightFormulaManager.getInstance().registerAction(tag, searchAction);
}
@Override
public void removeAction(String tag) {
SearchHighlightFormulaManager.getInstance().removeAction(tag);
}
},
/**
* 注册不同控件中的公式非树形数据字典树形数据字典无数据字典可自己添加
*/
WIDGET_FORMULA(4) {
@Override
public void registerAction(String tag, SearchAction searchAction) {
SearchWidgetFormulaManager.getInstance().registerAction(tag, searchAction);
}
@Override
public void removeAction(String tag) {
SearchWidgetFormulaManager.getInstance().removeAction(tag);
}
},
/**
* 注册获取JS的场景当前控件单元格模板Web属性悬浮元素可自行添加
*/
JS(5) {
@Override
public void registerAction(String tag, SearchAction searchAction) {
SearchJSManager.getInstance().registerAction(tag, searchAction);
}
@Override
public void removeAction(SearchAction searchAction) {
SearchJSManager.getInstance().removeAction(searchAction);
}
};
int index;
ManagerType(int index) {
this.index = index;
}
/**
* 匹配
*
* @param index
* @return
*/
@Nullable
public static ManagerType match(int index) {
ManagerType[] values = ManagerType.values();
for (ManagerType value : values) {
if (value.index == index) {
return value;
}
}
return null;
}
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchManagerCenter getInstance() {
return SearchManagerCenterEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchManagerCenterEnum {
/**
* 单例
*/
SINGLETON;
private SearchManagerCenter instance;
SearchManagerCenterEnum() {
instance = new SearchManagerCenter();
}
/**
* 获取单例对象
*
* @return
*/
public SearchManagerCenter getInstance() {
return instance;
}
}
}

428
designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java

@ -0,0 +1,428 @@
package com.fr.design.actions.replace.action;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Title;
import com.fr.design.actions.replace.action.content.cell.SearchCellAction;
import com.fr.design.actions.replace.action.content.component.SearchComponentAction;
import com.fr.design.actions.replace.action.content.floatelement.SearchFloatAction;
import com.fr.design.actions.replace.action.content.formula.SearchFormulaManager;
import com.fr.design.actions.replace.action.content.js.SearchJSManager;
import com.fr.design.actions.replace.action.content.sql.SearchSQLAction;
import com.fr.design.actions.replace.action.content.widget.SearchWidgetAction;
import com.fr.design.actions.replace.info.CellInfo;
import com.fr.design.actions.replace.info.ComponentInfo;
import com.fr.design.actions.replace.info.FloatInfo;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.info.JSInfo;
import com.fr.design.actions.replace.info.SQLInfo;
import com.fr.design.actions.replace.info.WidgetInfo;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.GeneralUtils;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.FloatElement;
import com.fr.report.cell.cellattr.core.RichText;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 对展示结果进行处理获取过滤
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-22
*/
public enum ShowSearchResultAction implements ShowValue {
/**
* 搜索单元格
*/
CELL(Toolkit.i18nText("Fine-Design_Basic_Cell")) {
@Override
public List<? extends Info> showSearchValue(JTemplate jTemplate) {
SearchCellAction.getInstance().search4Infos(jTemplate);
return SearchCellAction.getInstance().getCellInfos();
}
@Override
public List<? extends Info> addMatchResult(String str, List<? extends Info> list) {
List<CellInfo> cellInfos = new ArrayList<>();
for (Info info : list) {
if (((CellInfo) info).isChartExist()) {
CellElement cellElement = (CellElement) info.getContent().getReplaceObject();
ChartCollection chartCollection = (ChartCollection) cellElement.getValue();
for (int i = 0; i < chartCollection.getChartCount(); i++) {
if (isTitleNameValid(chartCollection.getChart(i).getTitle(), str)) {
String titleName = GeneralUtils.objectToString(chartCollection.getChart(i).getTitle().getTextObject());
CellInfo cellInfo = ((CellInfo) info).copy();
cellInfo.setCellChartIndex(i);
cellInfo.getContent().addOtherPos(
Toolkit.i18nText("Fine-Design_Replace_Chart_Title"),
chartCollection.getChartName(i),
titleName
);
setShowInfo(cellInfo, titleName, str);
cellInfos.add(cellInfo);
}
}
} else {
Map<String, String> stringHashMap = info.getValue();
String content = stringHashMap.getOrDefault(objectContentKey, StringUtils.EMPTY);
if (isValueValid(content, str, info)) {
info.getContent().setShowStr(ShowValueUtils.getCommonString(content, str));
info.getContent().setOldShowStr(content);
info.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(content, str));
info.getContent().setSelected(true);
cellInfos.add((CellInfo) info);
}
}
}
return cellInfos;
}
private void setShowInfo(CellInfo cellInfo, String titleName, String str) {
cellInfo.getContent().setShowStr(ShowValueUtils.getCommonString(titleName, str));
cellInfo.getContent().setOldShowStr(titleName);
cellInfo.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(titleName, str));
cellInfo.getContent().setSelected(true);
}
private boolean isValueValid(String content, String str, Info info) {
CellElement cellElement = (CellElement) info.getContent().getReplaceObject();
return ShowValueUtils.contains(content, str) && StringUtils.isNotEmpty(content) && !(cellElement.getValue() instanceof RichText);
}
},
/**
* 搜索JS事件
*/
JS(Toolkit.i18nText("Fine-Design_Replace_JS")) {
@Override
public List<? extends Info> showSearchValue(JTemplate jTemplate) {
SearchJSManager.getInstance().search4Infos(jTemplate);
return SearchJSManager.getInstance().getJsInfos();
}
@Override
public List<? extends Info> addMatchResult(String str, List<? extends Info> list) {
List<JSInfo> jsInfos = new ArrayList<>();
Map<String, String> stringHashMap = new HashMap<>();
for (Info info : list) {
stringHashMap = info.getValue();
if (StringUtils.isEmpty(str)) {
if (StringUtils.isNotEmpty(stringHashMap.getOrDefault(objectContentKey, StringUtils.EMPTY))) {
JSInfo contentJSInfo = ((JSInfo) info).copy();
contentJSInfo.getContent().setShowStr(stringHashMap.get(objectContentKey));
contentJSInfo.getContent().setOldShowStr(stringHashMap.get(objectContentKey));
contentJSInfo.getContent().setSelected(true);
contentJSInfo.setContentFlag(true);
jsInfos.add(contentJSInfo);
}
if (StringUtils.isNotEmpty(stringHashMap.getOrDefault(objectNameKey, StringUtils.EMPTY))) {
JSInfo nameJSInfo = ((JSInfo) info).copy();
nameJSInfo.getContent().setShowStr(stringHashMap.get(objectNameKey));
nameJSInfo.getContent().setOldShowStr(stringHashMap.get(objectNameKey));
nameJSInfo.getContent().setSelected(true);
nameJSInfo.setContentFlag(false);
jsInfos.add(nameJSInfo);
}
} else {
searchMap4JS(stringHashMap, jsInfos, ((JSInfo) info), str);
}
}
return jsInfos;
}
private void searchMap4JS(Map<String, String> map, List<JSInfo> jsInfos, JSInfo info, String str) {
if (map.containsKey(objectNameKey) && StringUtils.isNotEmpty(map.get(objectNameKey))) {
String name = map.get(objectNameKey);
if (ShowValueUtils.contains(name,str)) {
JSInfo nameJSInfo = info.copy();
nameJSInfo.getContent().setShowStr(ShowValueUtils.getCommonString(name, str));
nameJSInfo.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(name, str));
nameJSInfo.getContent().setOldShowStr(map.get(objectNameKey));
nameJSInfo.setContentFlag(false);
nameJSInfo.getContent().setSelected(true);
jsInfos.add(nameJSInfo);
}
}
if (map.containsKey(objectContentKey) && StringUtils.isNotEmpty(map.get(objectContentKey))) {
String content = map.get(objectContentKey);
if (ShowValueUtils.contains(content,str)) {
JSInfo contentJSInfo = info.copy();
contentJSInfo.getContent().setShowStr(ShowValueUtils.getCommonString(content, str));
contentJSInfo.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(content, str));
contentJSInfo.getContent().setOldShowStr(map.get(objectContentKey));
contentJSInfo.setContentFlag(true);
contentJSInfo.getContent().setSelected(true);
jsInfos.add(contentJSInfo);
}
}
}
},
/**
* 搜索SQL
*/
SQL("SQL") {
@Override
public List<? extends Info> showSearchValue(JTemplate jTemplate) {
SearchSQLAction.getInstance().search4Infos(jTemplate);
return SearchSQLAction.getInstance().getSqlInfos();
}
@Override
public List<? extends Info> addMatchResult(String str, List<? extends Info> list) {
List<SQLInfo> sqlInfos = new ArrayList<>();
Map<String, String> stringHashMap = new HashMap<>();
for (Info info : list) {
stringHashMap = ((SQLInfo) info).getValue();
if (StringUtils.isEmpty(str)) {
info.getContent().setShowStr(stringHashMap.get(objectContentKey));
info.getContent().setOldShowStr(stringHashMap.get(objectContentKey));
info.getContent().setSelected(true);
sqlInfos.add((SQLInfo) info);
} else {
searchMap4SQLContent(stringHashMap, sqlInfos, ((SQLInfo) info), str);
}
}
return sqlInfos;
}
private void searchMap4SQLContent(Map<String, String> map, List<SQLInfo> sqlInfos, SQLInfo info, String str) {
if (map.containsKey(objectContentKey) && StringUtils.isNotEmpty(map.get(objectContentKey))) {
String content = map.get(objectContentKey);
if (ShowValueUtils.contains(content,str)) {
SQLInfo contentJSInfo = info.copy();
contentJSInfo.getContent().setShowStr(ShowValueUtils.getCommonString(content, str));
contentJSInfo.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(content, str));
contentJSInfo.getContent().setOldShowStr(map.get(objectContentKey));
contentJSInfo.getContent().setSelected(true);
sqlInfos.add(contentJSInfo);
}
}
}
private void updateOperatorArray(int index, int preLength, int strLength, SQLInfo sqlInfo) {
ArrayList<Pair<Integer, Integer>> pairs = new ArrayList<>();
pairs.add(new Pair<>(index + preLength, index + preLength + strLength));
sqlInfo.getContent().setOperatorArray(pairs);
}
},
/**
* 搜索悬浮元素
*/
FLOAT(Toolkit.i18nText("Fine-Design_Basic_Float_Element")) {
@Override
public List<? extends Info> showSearchValue(JTemplate jTemplate) {
SearchFloatAction.getInstance().search4Infos(jTemplate);
return SearchFloatAction.getInstance().getFloatInfos();
}
@Override
public List<? extends Info> addMatchResult(String str, List<? extends Info> list) {
List<FloatInfo> floatInfos = new ArrayList<>();
for (Info info : list) {
FloatElement floatElement = ((FloatElement) (info.getContent().getReplaceObject()));
//如果存的是图表,就要特殊处理
if (((FloatInfo) info).isChartExist()) {
ChartCollection chartCollection = (ChartCollection) floatElement.getValue();
for (int i = 0; i < chartCollection.getChartCount(); i++) {
if (isTitleNameValid(chartCollection.getChart(i).getTitle(), str)) {
String titleName = GeneralUtils.objectToString(chartCollection.getChart(i).getTitle().getTextObject());
FloatInfo floatInfo = ((FloatInfo) info).copy();
floatInfo.setFloatChartIndex(i);
floatInfo.getContent().addOtherPos(
Toolkit.i18nText("Fine-Design_Replace_Chart_Title"),
chartCollection.getChartName(i),
titleName);
setShowInfo(floatInfo, titleName, str);
floatInfos.add(floatInfo);
}
}
} else {
if (ShowValueUtils.contains(GeneralUtils.objectToString(floatElement.getValue()), str)) {
FloatInfo floatInfo = ((FloatInfo) info).copy();
setShowInfo(floatInfo, GeneralUtils.objectToString(floatElement.getValue()), str);
floatInfos.add(floatInfo);
}
}
}
return floatInfos;
}
private void setShowInfo(FloatInfo floatInfo, String value, String str) {
floatInfo.getContent().setOldShowStr(value);
floatInfo.getContent().setShowStr(ShowValueUtils.getCommonString(value, str));
floatInfo.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(value, str));
floatInfo.getContent().setSelected(true);
}
},
/**
* 搜索组件
*/
COMPONENT(Toolkit.i18nText("Fine-Design_Replace_Component")) {
@Override
public List<? extends Info> showSearchValue(JTemplate jTemplate) {
SearchComponentAction.getInstance().search4Infos(jTemplate);
return SearchComponentAction.getInstance().getComponentInfos();
}
@Override
public List<? extends Info> addMatchResult(String str, List<? extends Info> list) {
ArrayList<ComponentInfo> componentInfos = new ArrayList<>();
Map<String, String> map = new HashMap<>();
for (Info info : list) {
map = info.getValue(info.getContent().getReplaceObject());
searchMap4Component(map, componentInfos, ((ComponentInfo) info), str);
}
return componentInfos;
}
private void searchMap4Component(Map<String, String> stringHashMap, ArrayList<ComponentInfo> componentInfos, ComponentInfo info, String str) {
if (stringHashMap.containsKey(objectContentKey)) {
String content = stringHashMap.get(objectContentKey);
if (ShowValueUtils.contains(content,str)) {
info.getContent().setShowStr(ShowValueUtils.getCommonString(content, str));
info.getContent().setOldShowStr(stringHashMap.get(objectContentKey));
info.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(content, str));
info.getContent().setSelected(true);
componentInfos.add(info);
}
}
}
},
/**
* 搜索控件
*/
WIDGET(Toolkit.i18nText("Fine-Design_Basic_Widget")) {
@Override
public List<? extends Info> showSearchValue(JTemplate jTemplate) {
SearchWidgetAction.getInstance().search4Infos(jTemplate);
return SearchWidgetAction.getInstance().getWidgetInfos();
}
@Override
public List<? extends Info> addMatchResult(String str, List<? extends Info> list) {
ArrayList<WidgetInfo> widgetInfos = new ArrayList<>();
Map<String, String> stringHashMap = new HashMap<>();
for (Info info : list) {
stringHashMap = info.getValue();
searchMap4Widget(stringHashMap, widgetInfos, ((WidgetInfo) info), str);
}
return widgetInfos;
}
private void searchMap4Widget(Map<String, String> map, List<WidgetInfo> widgetInfos, WidgetInfo info, String str) {
if (map.containsKey(objectNameKey)) {
String name = map.get(objectNameKey);
if (StringUtils.isNotEmpty(name) && ShowValueUtils.contains(name,str)) {
WidgetInfo nameInfo = info.copy(info);
nameInfo.getContent().setShowStr(ShowValueUtils.getCommonString(name, str));
nameInfo.getContent().setOldShowStr(map.get(objectNameKey));
nameInfo.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(name, str));
nameInfo.getContent().setSelected(true);
nameInfo.setWaterMarkFlag(false);
widgetInfos.add(nameInfo);
}
}
if (map.containsKey(objectWaterMarkKey)) {
String waterMark = map.get(objectWaterMarkKey);
if (StringUtils.isNotEmpty(waterMark) && ShowValueUtils.contains(waterMark,str)) {
WidgetInfo widgetInfo = info.copy(info);
widgetInfo.getContent().setShowStr(ShowValueUtils.getCommonString(waterMark, str));
widgetInfo.getContent().setOldShowStr(map.get(objectWaterMarkKey));
widgetInfo.getContent().setShowObject(widgetInfo.getContent().getShowObject() + Toolkit.i18nText("Fine-Design_Form_WaterMark"));
widgetInfo.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(waterMark, str));
widgetInfo.getContent().setSelected(true);
widgetInfo.setWaterMarkFlag(true);
widgetInfos.add(widgetInfo);
}
}
}
},
/**
* 搜索公式
*/
FORMULA(Toolkit.i18nText("Fine-Design_Basic_Formula")) {
@Override
public List<? extends Info> showSearchValue(JTemplate jTemplate) {
SearchFormulaManager.getInstance().search4Infos(jTemplate);
return SearchFormulaManager.getInstance().getFormulaInfos();
}
@Override
public List<? extends Info> addMatchResult(String str, List<? extends Info> list) {
List<FormulaInfo> formulaInfos = new ArrayList<>();
Map<String, String> stringHashMap = new HashMap<>();
for (Info info : list) {
stringHashMap = info.getValue();
searchMap4Formula(stringHashMap, formulaInfos, ((FormulaInfo) info), str);
}
return formulaInfos;
}
private void searchMap4Formula(Map<String, String> stringHashMap, List<FormulaInfo> formulaInfos, FormulaInfo info, String str) {
if (stringHashMap.containsKey(objectContentKey)) {
String name = stringHashMap.get(objectContentKey);
if (ShowValueUtils.contains(name,str)) {
info.getContent().setShowStr(ShowValueUtils.getCommonString(name, str));
info.getContent().setOldShowStr(stringHashMap.get(objectContentKey));
info.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(name, str));
info.getContent().setSelected(true);
formulaInfos.add(info);
}
}
}
};
String name;
//存储的对象名称key值
String objectNameKey = "name";
//存储的对象内容key值
String objectContentKey = "content";
//存储的对象水印Key值
String objectWaterMarkKey = "waterMark";
ShowSearchResultAction(String name) {
this.name = name;
}
/**
* 匹配
*
* @param name
* @return
*/
@Nullable
public static ShowSearchResultAction match(String name) {
ShowSearchResultAction[] values = ShowSearchResultAction.values();
for (ShowSearchResultAction value : values) {
if (value.name.equals(name)) {
return value;
}
}
return null;
}
/**
* 标题是否可用
*
* @param title
* @param str
* @return
*/
public boolean isTitleNameValid(Title title, String str) {
return title != null && ShowValueUtils.contains(GeneralUtils.objectToString(title.getTextObject()), str) && StringUtils.isNotEmpty(GeneralUtils.objectToString(title.getTextObject()));
}
}

34
designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowValue.java

@ -0,0 +1,34 @@
package com.fr.design.actions.replace.action;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.mainframe.JTemplate;
import java.util.List;
/**
* 用于展示结果的处理获取过滤
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-22
*/
public interface ShowValue {
/**
* 获取搜索结果
*
* @param jTemplate
* @return
*/
List<? extends Info> showSearchValue(JTemplate jTemplate);
/**
* 对搜索结果进行过滤
*
* @param str
* @param list
* @return
*/
List<? extends Info> addMatchResult(String str, List<? extends Info> list);
}

222
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/cell/SearchCellAction.java

@ -0,0 +1,222 @@
package com.fr.design.actions.replace.action.content.cell;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.action.content.component.SearchComponentAction;
import com.fr.design.actions.replace.info.ComponentInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.actions.replace.info.CellInfo;
import com.fr.form.main.Form;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.general.GeneralUtils;
import com.fr.main.impl.WorkBook;
import com.fr.report.cell.CellElement;
import com.fr.report.elementcase.ElementCase;
import com.fr.report.poly.PolyECBlock;
import com.fr.report.report.Report;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* 获取有内容的单元格相关信息
* <p>
* tips:这边报表分为两块决策报表dealForm和普通报表dealWorkBook二者最后都会归于ElementCase
* 决策报表虽然分为绝对布局和自适应布局但是单元格可能存在的地方只有report 二者对它report的处理是统一的都属于WTitleLayout因此没必要划分两种布局
* 普通报表获取elementCase拿到cellIterator遍历即可
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-11
*/
public class SearchCellAction implements SearchAction {
private List<CellInfo> cellInfos;
private SearchCellAction() {
}
public List<CellInfo> getCellInfos() {
return cellInfos;
}
public void setCellInfos(List<CellInfo> cellInfos) {
this.cellInfos = cellInfos;
}
/**
* 搜索对应的信息
*
* @param jTemplate 要搜索的报表对象
*/
@Override
public void search4Infos(JTemplate jTemplate) {
ITContent content = new ITContent();
content.setTemplateName(jTemplate.getTemplateName());
content.addTRL(jTemplate.getTemplateName());
content.setTemplatePath(jTemplate.getPath());
if (jTemplate.getTarget() instanceof Form) {
setCellInfos(dealForm(jTemplate));
} else if (jTemplate.getTarget() instanceof WorkBook) {
setCellInfos(dealWorkBook((WorkBook) jTemplate.getTarget(), content));
} else {
setCellInfos(new ArrayList<>());
}
}
/**
* 处理决策报表
* 流程dealForm>getCellInfosFromBoundsWidget>getCellInfoFromElementCase
*
* @param jTemplate 要搜索的报表对象
* @return 返回单元格信息Array
*/
private List<CellInfo> dealForm(JTemplate jTemplate) {
ArrayList<CellInfo> result = new ArrayList<>();
SearchComponentAction searchComponentAction = SearchComponentAction.getInstance();
searchComponentAction.search4Infos(jTemplate);
for (ComponentInfo info : searchComponentAction.getComponentInfos()) {
ITContent content = ITContent.copy(info.getContent());
getCellInfosFromBoundsWidget(result, content, (Widget) info.getContent().getReplaceObject());
}
return result;
}
/**
* 从组件信息中获取到的layout中的BoundsWidget中获取真正的报表块并且将信息添加到列表中
*
* @param result 要操作的Array
* @param content 存储查找替换相关信息的类
* @param widget 控件和组件的最高层接口
*/
private void getCellInfosFromBoundsWidget(List<CellInfo> result, ITContent content, Widget widget) {
//report在两种布局中都属于WTitleLayout
if (widget instanceof WTitleLayout) {
for (int i = 0; i < ((WTitleLayout) widget).getWidgetCount(); i++) {
//这里它又套了一层BoundsWidget
if (((CRBoundsWidget) ((WTitleLayout) widget).getWidget(i)).getWidget() instanceof ElementCaseEditor) {
ElementCaseEditor editor = (ElementCaseEditor) ((CRBoundsWidget) ((WTitleLayout) widget).getWidget(i)).getWidget();
ITContent newContent = ITContent.copy(content);
getCellInfoFromElementCase((ElementCase) editor.getElementCase(), result, newContent);
}
}
}
}
/**
* 处理普通报表
*
* @param workBook 要搜索的报表对象
* @return 对应信息Array
*/
public List<CellInfo> dealWorkBook(WorkBook workBook, ITContent workBookContent) {
ArrayList<CellInfo> result = new ArrayList<>();
for (int i = 0; i < workBook.getReportCount(); i++) {
Report report = workBook.getReport(i);
ITContent content = ITContent.copy(workBookContent);
content.setSheetID(String.valueOf(i));
content.setSheetName(workBook.getReportName(i));
getCellInfoFromReport(report, result, content);
}
return result;
}
/**
* 处理普通报表的sheet
*
* @param report sheet
* @param result 要操作的信息Array
* @param content 存储查找替换相关信息的类
*/
private void getCellInfoFromReport(Report report, List<CellInfo> result, ITContent content) {
if (report != null) {
Iterator it = report.iteratorOfElementCase();
while (it.hasNext()) {
ITContent newContent = ITContent.copy(content);
ElementCase elementCase = (ElementCase) it.next();
getCellInfoFromElementCase(elementCase, result, newContent);
}
}
}
private void getCellInfoFromElementCase(ElementCase elementCase, List<CellInfo> result, ITContent content) {
Iterator cellIterator = elementCase.cellIterator();
while (cellIterator.hasNext()) {
ITContent newContent = ITContent.copy(content);
CellElement cell = (CellElement) cellIterator.next();
newContent.setReplaceObject(cell);
//单元格
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Cell") + cell);
newContent.setShowObject(cell);
newContent.addTRL(newContent.getSheetID());
if (elementCase instanceof PolyECBlock) {
newContent.setBlockName(((PolyECBlock) elementCase).getBlockName());
newContent.addTRL(((PolyECBlock) elementCase).getBlockName());
}
newContent.addTRL(GeneralUtils.objectToString(cell));
CellInfo cellInfo = new CellInfo(newContent);
if (cell.getValue() instanceof ChartCollection) {
cellInfo.setChartExist(true);
}
result.add(cellInfo);
}
}
/**
* 对应的单元格信息列表是否有内容
*
* @return 判断的布尔值
*/
public boolean isCellInfosExist() {
return this.getCellInfos().size() > 0;
}
/**
* 对外开放的获取对象的方法
*
* @return
*/
public static SearchCellAction getInstance() {
return SearchCellAction.SearchCellActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchCellActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchCellAction instance;
SearchCellActionEnum() {
instance = new SearchCellAction();
}
/**
* 获取对象
*
* @return
*/
public SearchCellAction getInstance() {
return instance;
}
}
}

365
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/component/ComponentType.java

@ -0,0 +1,365 @@
package com.fr.design.actions.replace.action.content.component;
import com.fr.design.actions.replace.info.ComponentInfo;
import com.fr.design.actions.replace.info.DealWithInfoValue;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WCardLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WCardTitleLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 决策报表组件类型
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-08
*/
public enum ComponentType implements DealWithInfoValue {
/**
* WCardMainBorderLayout属于Tab块组件中的最外层默认命名方式为tablayout0的类型
* WCardMainBorderLayout里面放两个一个WCardTitleLayout,一个WCardLayout
* 处理该类型时需要先将该对象加入我们的组件列表中再对其包含的内容进行递归处理
* TIP:该类型对其设置组件名时直接setWidgetName即可设计器右侧上方和右侧下方面板中的组件名称会同步更改
*/
W_CARD_MAIN_BORDER_LAYOUT("WCardMainBorderLayout") {
@Override
public void addComponent2Array(List<ComponentInfo> componentInfos, ITContent bodyContent, Widget widget) {
super.addComponent2Array(componentInfos, bodyContent, widget);
ITContent content = ITContent.copy(bodyContent);
content.addOtherPos(widget.getWidgetName());
for (int i = 0; i < ((WCardMainBorderLayout) widget).getWidgetCount(); i++) {
Widget cardLayoutWidget = ((WCardMainBorderLayout) widget).getWidget(i);
if (cardLayoutWidget instanceof WCardTitleLayout) {
for (int j = 0; j < ((WCardTitleLayout) cardLayoutWidget).getWidgetCount(); j++) {
if (((WCardTitleLayout) cardLayoutWidget).getWidget(j) instanceof WCardTagLayout) {
content.addOtherPos(((WCardTitleLayout) cardLayoutWidget).getWidget(j).getWidgetName());
}
}
}
}
searchLayout4Component(componentInfos, content, ((WCardMainBorderLayout) widget));
}
},
/**
* WCardTitleLayout里面两个一个CardAddButton不必处理一个WCardTagLayout默认命名方式为tabpane0的类型
* 处理该类型时不用对该对象进行处理直接对其包含的内容进行递归处理即可
*/
W_CARD_TITLE_LAYOUT("WCardTitleLayout") {
@Override
public void addComponent2Array(List<ComponentInfo> componentInfos, ITContent bodyContent, Widget widget) {
searchLayout4Component(componentInfos, bodyContent, (WCardTitleLayout) widget);
}
},
/**
* 对于WCardLayout 里面就是放的WTabFitLayouttab00tab10
* 处理该类型时不用对该对象进行处理直接对其包含的内容进行递归处理即可
*/
W_CARD_LAYOUT("WCardLayout") {
@Override
public void addComponent2Array(List<ComponentInfo> componentInfos, ITContent bodyContent, Widget widget) {
searchLayout4Component(componentInfos, bodyContent, (WCardLayout) widget);
}
},
/**
* WCardTagLayout默认命名方式为tabpane0的类型
* TIP:该类型对其设置组件名时直接setWidgetName即可设计器右侧上方和右侧下方面板中的组件名称会同步更改
*/
W_CARD_TAG_LAYOUT("WCardTagLayout") {
@Override
public void addComponent2Array(List<ComponentInfo> componentInfos, ITContent bodyContent, Widget widget) {
super.addComponent2Array(componentInfos, bodyContent, widget);
searchLayout4Component(componentInfos, bodyContent, (WCardTagLayout) widget);
}
},
/**
* WAbsoluteLayout属于绝对布局块
* 处理该类型时需要先将该对象加入我们的组件列表中再对其包含的内容进行递归处理
* TIP:该类型对其设置组件名时直接setWidgetName即可设计器右侧上方和右侧下方面板中的组件名称会同步更改
*/
W_ABSOLUTE_LAYOUT("WAbsoluteLayout") {
@Override
public void addComponent2Array(List<ComponentInfo> componentInfos, ITContent bodyContent, Widget widget) {
super.addComponent2Array(componentInfos, bodyContent, widget);
serachCRBoundsWidget4Component(componentInfos, bodyContent, (WAbsoluteLayout) widget);
}
},
/**
* WTabFitLayout里面放的是命名方式为tab00tab10的tab块在该块内部可以递归存放所有决策报表组件
* 处理该类型时需要先将该对象加入我们的组件列表中再对其包含的内容进行递归处理
* TIP:该类型对其设置组件名时直接setWidgetName即可设计器右侧上方和右侧下方面板中的组件名称会同步更改
*/
W_TAB_FIT_LAYOUT("WTabFitLayout") {
@Override
public void addComponent2Array(List<ComponentInfo> componentInfos, ITContent bodyContent, Widget widget) {
super.addComponent2Array(componentInfos, bodyContent, widget);
serachCRBoundsWidget4Component(componentInfos, bodyContent, (WTabFitLayout) widget);
}
},
/**
* 自适应布局下报表块和图表的存储方式
* TIP:该类型对其设置组件名时需要对内外层进行setWidgetName设计器右侧上方和右侧下方面板中的组件名称不会同步更改
*/
W_TITLE_LAYOUT("WTitleLayout") {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
if (replaceObject instanceof WTitleLayout) {
WTitleLayout titleLayout = (WTitleLayout) replaceObject;
info.updateOldStr(titleLayout.getWidgetName(), findStr);
titleLayout.setWidgetName(ShowValueUtils.replaceAll(titleLayout.getWidgetName(), findStr, replaceStr));
CRBoundsWidget crBoundsWidget = ((CRBoundsWidget) titleLayout.getWidget(0));
crBoundsWidget.getWidget().setWidgetName(ShowValueUtils.replaceAll(crBoundsWidget.getWidget().getWidgetName(), findStr, replaceStr));
}
}
},
/**
* 自适应布局下下拉框控件下拉复选框控件日期控件数字控件下拉树控件密码控件都属于该类型
* TIP:该类型对其设置组件名时需要对内外层进行setWidgetName设计器右侧上方和右侧下方面板中的组件名称不会同步更改
*/
W_SCALE_LAYOUT("WScaleLayout") {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
if (replaceObject instanceof WScaleLayout) {
WScaleLayout scaleLayout = (WScaleLayout) replaceObject;
info.updateOldStr(scaleLayout.getWidgetName(), findStr);
scaleLayout.setWidgetName(ShowValueUtils.replaceAll(scaleLayout.getWidgetName(), findStr, replaceStr));
CRBoundsWidget crBoundsWidget = ((CRBoundsWidget) scaleLayout.getWidget(0));
crBoundsWidget.getWidget().setWidgetName(ShowValueUtils.replaceAll(crBoundsWidget.getWidget().getWidgetName(), findStr, replaceStr));
}
}
},
/**
* 绝对布局文本控件
*/
TEXT_EDITOR("TextEditor"),
/**
* 自适应布局和绝对布局标签控件
*/
LABEL("Label"),
/**
* 自适应布局和绝对布局按钮控件
*/
FREE_BUTTON("FreeButton"),
/**
* 下绝对布局拉框控件
*/
COMBO_BOX("ComboBox"),
/**
* 绝对布局下拉复选框控件
*/
COMBO_CHECK_BOX("ComboCheckBox"),
/**
* 绝对布局日期控件
*/
DATE_EDITOR("DateEditor"),
/**
* 绝对布局数字控件
*/
NUMBER_EDITOR("NumberEditor"),
/**
* 绝对布局下拉树控件
*/
TREE_COMBO_BOX_EDITOR("TreeComboBoxEditor"),
/**
* 自适应布局和绝对布局单选按钮组控件
*/
RADIO_GROUP("RadioGroup"),
/**
* 自适应布局和绝对布局复选按钮组控件
*/
CHECK_BOX_GROUP("CheckBoxGroup"),
/**
* 自适应布局和绝对布局查询按钮
*/
FORM_SUBMIT_BUTTON("FormSubmitButton"),
/**
* 自适应布局和绝对布局文本域控件
*/
TEXT_AREA("TextArea"),
/**
* 绝对布局密码控件
*/
PASS_WORD("Password"),
/**
* 自适应布局和绝对布局复选按钮控件
*/
CHECK_BOX("CheckBox"),
/**
* 自适应布局和绝对布局视图树
*/
TREE_EDITOR("TreeEditor"),
/**
* 自适应布局和绝对布局文件控件
*/
MULTI_FILE_EDITOR("MultiFileEditor");
String name;
ComponentType(String name) {
this.name = name;
}
/**
* 匹配
*
* @param name
* @return
*/
@Nullable
public static ComponentType match(String name) {
ComponentType[] values = ComponentType.values();
for (ComponentType value : values) {
if (value.name.equals(name)) {
return value;
}
}
return null;
}
/**
* 添加组件到数组中
*
* @param componentInfos
* @param bodyContent
* @param widget
*/
public void addComponent2Array(List<ComponentInfo> componentInfos, ITContent bodyContent, Widget widget) {
componentInfos.add(new ComponentInfo(getComponentContent(bodyContent, widget)));
}
/**
* 处理ITContent
*
* @param componentContent
* @param widget
* @return
*/
public ITContent getComponentContent(ITContent componentContent, Widget widget) {
ITContent content = ITContent.copy(componentContent);
content.setReplaceObject(widget);
String widgetName = widget.getWidgetName();
if (!(widget instanceof WCardTagLayout)) {
content.addOtherPos(widgetName);
}
content.setBlockName(widgetName);
content.setShowObject(widgetName);
content.addTRL(widgetName);
return content;
}
/**
* 从Layout里面拿组件
*
* @param componentInfos
* @param bodyContent
* @param layout
*/
public void searchLayout4Component(List<ComponentInfo> componentInfos, ITContent bodyContent, WLayout layout) {
for (int i = 0; i < layout.getWidgetCount(); i++) {
ComponentType componentType = ComponentType.match(layout.getWidget(i).getClass().getSimpleName());
if (componentType != null) {
componentType.addComponent2Array(componentInfos, bodyContent, layout.getWidget(i));
}
}
}
/**
* 从CRBoundWidget里面拿组件
*
* @param componentInfos
* @param bodyContent
* @param layout
*/
public void serachCRBoundsWidget4Component(List<ComponentInfo> componentInfos, ITContent bodyContent, WLayout layout) {
for (int i = 0; i < layout.getWidgetCount(); i++) {
//这边会套一层CRBoundsWidget
ComponentType componentType = ComponentType.match(((CRBoundsWidget) (layout.getWidget(i))).getWidget().getClass().getSimpleName());
if (componentType != null) {
ITContent content = ITContent.copy(bodyContent);
content.addOtherPos(layout.getWidgetName());
componentType.addComponent2Array(componentInfos, content, ((CRBoundsWidget) (layout.getWidget(i))).getWidget());
}
}
}
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> hashMap = new HashMap<>();
if (o != null && o[0] instanceof Widget) {
hashMap.put("content", ((Widget) o[0]).getWidgetName());
}
return hashMap;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
if (replaceObject instanceof Widget) {
Widget widget = ((Widget) replaceObject);
info.updateOldStr(widget.getWidgetName(), findStr);
widget.setWidgetName(widget.getWidgetName().replaceAll(findStr, replaceStr));
}
}
@Override
public String getInfoShowStr(Info info) {
if (info instanceof ComponentInfo && info.getContent().getReplaceObject() instanceof Widget) {
return ((Widget) info.getContent().getReplaceObject()).getWidgetName();
}
return StringUtils.EMPTY;
}
/**
* 校验是否被修改
*
* @param info
* @return
*/
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof Widget) {
Widget widget = (Widget) info.getContent().getReplaceObject();
return StringUtils.equals(widget.getWidgetName(), info.getContent().getOldShowStr());
}
return false;
}
}

185
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/component/SearchComponentAction.java

@ -0,0 +1,185 @@
package com.fr.design.actions.replace.action.content.component;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.info.ComponentInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.mainframe.JTemplate;
import com.fr.form.main.Form;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import java.util.ArrayList;
import java.util.List;
/**
* 获取决策报表组件
* TIPS:组件只在决策报表中只用考虑决策报表Form分为para和body两部分来处理
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-29
*/
public class SearchComponentAction implements SearchAction {
private SearchComponentAction() {
}
private List<ComponentInfo> componentInfos;
public List<ComponentInfo> getComponentInfos() {
return componentInfos;
}
public void setComponentInfos(List<ComponentInfo> componentInfos) {
this.componentInfos = componentInfos;
}
/**
* 搜索决策报表参数面板以及body面板两个地方的组件
*
* @param jTemplate 要搜索的模板
*/
@Override
public void search4Infos(JTemplate jTemplate) {
List<ComponentInfo> componentInfos = new ArrayList<>();
if (jTemplate.getTarget() instanceof Form) {
Form form = (Form) jTemplate.getTarget();
ITContent content = new ITContent();
content.setTemplateName(jTemplate.getTemplateName());
content.setTemplatePath(jTemplate.getPath());
content.addTRL(jTemplate.getTemplateName());
content.setFrmFlag(true);
//处理最底层form组件
dealForm(componentInfos, content, form.getContainer());
//参数面板
dealPara(componentInfos, content, form.getParaContainer());
//body面板
dealBody(componentInfos, content, form.getBody());
}
setComponentInfos(componentInfos);
}
private void dealForm(List<ComponentInfo> componentInfos, ITContent content, WLayout container) {
ITContent formContent = ITContent.copy(content);
formContent.setReplaceObject(container);
dealContent(formContent, container.getWidgetName());
formContent.addOtherPos(container.getWidgetName());
formContent.setJumpAble(false);
componentInfos.add(new ComponentInfo(formContent));
}
private void dealBody(List<ComponentInfo> componentInfos, ITContent content, Widget body) {
if (body instanceof WLayout) {
ITContent bodyContent = ITContent.copy(content);
bodyContent.addOtherPos(body.getWidgetName());
//单独处理一下body组件
dealBodyContainer(componentInfos, bodyContent, (WLayout) body);
//处理body的子组件
searchBodyComponent(componentInfos, bodyContent, body);
//searchBodyComponent();
}
}
private void searchBodyComponent(List<ComponentInfo> componentInfos, ITContent bodyContent, Widget body) {
for (int i = 0; i < ((WLayout) body).getWidgetCount(); i++) {
//body下面的每个控件都会有一层BoundsWidget,为了兼容用了CRBoundsWidget,boundsWidget.getWidget()里面才是真正我们需要的widget
CRBoundsWidget boundsWidget = (CRBoundsWidget) ((WLayout) body).getWidget(i);
ComponentType componentType = ComponentType.match(boundsWidget.getWidget().getClass().getSimpleName());
if (componentType != null) {
componentType.addComponent2Array(componentInfos, bodyContent, boundsWidget.getWidget());
}
}
}
private void dealBodyContainer(List<ComponentInfo> componentInfos, ITContent bodyContent, WLayout body) {
ITContent content = ITContent.copy(bodyContent);
content.setReplaceObject(body);
content.setJumpAble(false);
dealContent(content, body.getWidgetName());
//WParameterLayout
componentInfos.add(new ComponentInfo(content));
}
private void dealPara(List<ComponentInfo> componentInfos, ITContent content, WLayout paraContainer) {
if (paraContainer != null) {
ITContent paraContent = ITContent.copy(content);
paraContent.addOtherPos(paraContainer.getWidgetName());
paraContent.setJumpAble(false);
//单独处理一下para组件
dealParaContainer(componentInfos, paraContent, paraContainer);
//处理para的子组件
searchParaComponent(componentInfos, paraContent, paraContainer);
}
}
private void searchParaComponent(List<ComponentInfo> componentInfos, ITContent paraContent, WLayout paraContainer) {
for (int i = 0; i < paraContainer.getWidgetCount(); i++) {
ITContent content = ITContent.copy(paraContent);
String widgetName = ((CRBoundsWidget) (paraContainer.getWidget(i))).getWidget().getWidgetName();
content.addOtherPos(widgetName);
content.setReplaceObject(((CRBoundsWidget) (paraContainer.getWidget(i))).getWidget());
dealContent(content, widgetName);
componentInfos.add(new ComponentInfo(content));
}
}
/**
* 单独处理WParameterLayout组件
*
* @param componentInfos
* @param content
* @param paraContainer
*/
private void dealParaContainer(List<ComponentInfo> componentInfos, ITContent content, WLayout paraContainer) {
ITContent paraContent = ITContent.copy(content);
paraContent.setReplaceObject(paraContainer);
dealContent(paraContent, paraContainer.getWidgetName());
//WParameterLayout
componentInfos.add(new ComponentInfo(paraContent));
}
private void dealContent(ITContent content, String widgetName) {
content.setBlockName(widgetName);
content.setShowObject(widgetName);
content.addTRL(widgetName);
}
/**
* 对外开放的获取对象的方法
*
* @return
*/
public static SearchComponentAction getInstance() {
return SearchComponentAction.SearchComponentActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchComponentActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchComponentAction instance;
SearchComponentActionEnum() {
instance = new SearchComponentAction();
}
/**
* 获取对象
*
* @return
*/
public SearchComponentAction getInstance() {
return instance;
}
}
}

136
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/floatelement/SearchFloatAction.java

@ -0,0 +1,136 @@
package com.fr.design.actions.replace.action.content.floatelement;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.info.FloatInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.ImageWithSuffix;
import com.fr.main.impl.WorkBook;
import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.ElementCase;
import com.fr.report.poly.PolyECBlock;
import com.fr.report.report.Report;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* 查找悬浮元素的信息
* <p>
* 由于决策报表没有悬浮元素因此不用考虑决策报表只需要考虑普通报表即可
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-16
*/
public class SearchFloatAction implements SearchAction {
private List<FloatInfo> floatInfos;
/**
* 查找悬浮元素信息只需要考虑普通报表
*
* @param jTemplate 指定搜索模板
*/
@Override
public void search4Infos(JTemplate jTemplate) {
List<FloatInfo> result = new ArrayList<>();
if (jTemplate.getTarget() instanceof WorkBook) {
WorkBook workBook = (WorkBook) jTemplate.getTarget();
for (int i = 0; i < workBook.getReportCount(); i++) {
Report report = workBook.getReport(i);
ITContent content = new ITContent();
content.setTemplateName(jTemplate.getTemplateName());
content.setTemplatePath(jTemplate.getPath());
content.setSheetID(String.valueOf(i));
content.setSheetName(workBook.getReportName(i));
content.addTRL(jTemplate.getTemplateName());
content.addTRL(String.valueOf(i));
getFloatInfoFromReport(report, result, content);
}
}
setFloatInfos(result);
}
private void getFloatInfoFromReport(Report report, List<FloatInfo> result, ITContent content) {
if (report != null) {
Iterator it = report.iteratorOfElementCase();
while (it.hasNext()) {
ITContent newContent = ITContent.copy(content);
ElementCase elementCase = (ElementCase) it.next();
getFloatInfoFromElementCase(elementCase, result, newContent);
}
}
}
private void getFloatInfoFromElementCase(ElementCase elementCase, List<FloatInfo> result, ITContent content) {
Iterator floatIterator = elementCase.floatIterator();
while (floatIterator.hasNext()) {
ITContent newContent = ITContent.copy(content);
FloatElement floatElement = (FloatElement) floatIterator.next();
newContent.setReplaceObject(floatElement);
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Float_Element"));
if (elementCase instanceof PolyECBlock) {
newContent.setBlockName(((PolyECBlock) elementCase).getBlockName());
newContent.addTRL(((PolyECBlock) elementCase).getBlockName());
}
newContent.setShowObject(floatElement.getName());
newContent.addTRL(floatElement.getName());
FloatInfo floatInfo = new FloatInfo(newContent);
if (floatElement.getValue() instanceof ChartCollection) {
floatInfo.setChartExist(true);
}
if (!(floatElement.getValue() instanceof ImageWithSuffix)) {
result.add(floatInfo);
}
}
}
public List<FloatInfo> getFloatInfos() {
return floatInfos;
}
public void setFloatInfos(List<FloatInfo> floatInfos) {
this.floatInfos = floatInfos;
}
/**
* 对外开放的获取对象的方法
*
* @return
*/
public static SearchFloatAction getInstance() {
return SearchFloatAction.SearchFloatActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
enum SearchFloatActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchFloatAction instance;
SearchFloatActionEnum() {
instance = new SearchFloatAction();
}
/**
* 获取对象
*
* @return
*/
public SearchFloatAction getInstance() {
return instance;
}
}
}

566
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java

@ -0,0 +1,566 @@
package com.fr.design.actions.replace.action.content.formula;
import com.fr.base.BaseFormula;
import com.fr.base.Formula;
import com.fr.base.Parameter;
import com.fr.base.StoreProcedureParameter;
import com.fr.base.core.KV;
import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.base.present.FormulaPresent;
import com.fr.base.present.Present;
import com.fr.data.condition.FormulaCondition;
import com.fr.data.core.Compare;
import com.fr.design.actions.replace.info.DealWithInfoValue;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.form.main.Form;
import com.fr.function.IF;
import com.fr.general.GeneralUtils;
import com.fr.js.SingleJavaScript;
import com.fr.main.impl.WorkBook;
import com.fr.report.cell.cellattr.CellInsertPolicyAttr;
import com.fr.report.cell.cellattr.core.RichChar;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.core.sort.sortexpression.FormulaSortExpression;
import com.fr.stable.FormulaProvider;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 公式可能存在的形式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-25
*/
public enum FormulaReplaceObject implements DealWithInfoValue {
/**
* Formula类型最基础也是最常见
*/
FORMULA("Formula") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(((Formula) o[0]).getContent())) {
map.put("content", ((Formula) o[0]).getContent());
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((Formula) replaceObject).getContent(), findStr);
((Formula) replaceObject).setContent(ShowValueUtils.replaceAll(((Formula) replaceObject).getContent(), findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof Formula){
Formula formula = (Formula) info.getContent().getReplaceObject();
return StringUtils.equals(formula.getContent(), info.getContent().getOldShowStr());
}
return false;
}
},
/**
* FormulaCondition
*/
FORMULA_CONDITION("FormulaCondition") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(((FormulaCondition) o[0]).getFormula())) {
map.put("content", ((FormulaCondition) o[0]).getFormula());
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
//更新上一次操作的信息
info.updateOldStr(((FormulaCondition) replaceObject).getFormula(), findStr);
((FormulaCondition) replaceObject).setFormula(ShowValueUtils.replaceAll(((FormulaCondition) replaceObject).getFormula(), findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof FormulaCondition){
FormulaCondition condition = (FormulaCondition) info.getContent().getReplaceObject();
return StringUtils.equals(condition.getFormula(), info.getContent().getOldShowStr());
}
return false;
}
},
/**
* Compare
*/
COMPARE("Compare") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(((Formula) ((Compare) o[0]).getValue()).getContent())) {
map.put("content", ((Formula) ((Compare) o[0]).getValue()).getContent());
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
if (((Compare) replaceObject).getValue() instanceof Formula) {
Formula formula = (Formula) ((Compare) replaceObject).getValue();
info.updateOldStr(formula.getContent(), findStr);
formula.setContent(ShowValueUtils.replaceAll(formula.getContent(), findStr, replaceStr));
}
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof Compare){
Compare compare = (Compare) info.getContent().getReplaceObject();
return StringUtils.equals(GeneralUtils.objectToString(compare.getValue()), info.getContent().getOldShowStr());
}
return false;
}
},
/**
* KV
*/
KV("KV") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(((Formula) ((com.fr.base.core.KV) o[0]).getValue()).getContent())) {
map.put("content", ((Formula) ((com.fr.base.core.KV) o[0]).getValue()).getContent());
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((Formula) ((com.fr.base.core.KV) replaceObject).getValue()).getContent(), findStr);
((Formula) ((com.fr.base.core.KV) replaceObject).getValue()).setContent(ShowValueUtils.replaceAll(((Formula) ((com.fr.base.core.KV) replaceObject).getValue()).getContent(), findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof com.fr.base.core.KV){
com.fr.base.core.KV kv = (com.fr.base.core.KV) info.getContent().getReplaceObject();
return StringUtils.equals(GeneralUtils.objectToString(kv.getValue()), info.getContent().getOldShowStr());
}
return false;
}
},
/**
* 插入策略
*/
CELL_INSERT_POLICY_ATTR("CellInsertPolicyAttr") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(((Formula) (((CellInsertPolicyAttr) o[0]).getDefaultInsertValue())).getContent())) {
map.put("content", ((Formula) (((CellInsertPolicyAttr) o[0]).getDefaultInsertValue())).getContent());
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((Formula) (((CellInsertPolicyAttr) replaceObject).getDefaultInsertValue())).getContent(), findStr);
((Formula) (((CellInsertPolicyAttr) replaceObject).getDefaultInsertValue())).setContent(ShowValueUtils.replaceAll(((Formula) (((CellInsertPolicyAttr) replaceObject).getDefaultInsertValue())).getContent(), findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof CellInsertPolicyAttr){
CellInsertPolicyAttr policyAttr = (CellInsertPolicyAttr) info.getContent().getReplaceObject();
return StringUtils.equals(GeneralUtils.objectToString(policyAttr.getDefaultInsertValue()), info.getContent().getOldShowStr());
}
return false;
}
},
/**
* present
*/
FORMULA_PRESENT("FormulaPresent") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(((FormulaPresent) o[0]).getFormulaContent())) {
map.put("content", ((FormulaPresent) o[0]).getFormulaContent());
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((FormulaPresent) replaceObject).getFormulaContent(), findStr);
((FormulaPresent) replaceObject).setFormulaContent(ShowValueUtils.replaceAll(((FormulaPresent) replaceObject).getFormulaContent(), findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof FormulaPresent){
FormulaPresent present = (FormulaPresent) info.getContent().getReplaceObject();
return StringUtils.equals(present.getFormulaContent(), info.getContent().getOldShowStr());
}
return false;
}
},
/**
* SingleJavaScript
*/
SINGLE_JAVA_SCRIPT("SingleJavaScript") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(((SingleJavaScript) o[0]).getFileName())) {
map.put("content", ((SingleJavaScript) o[0]).getFileName());
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((SingleJavaScript) replaceObject).getFileName(), findStr);
((SingleJavaScript) replaceObject).setFileName(ShowValueUtils.replaceAll(((SingleJavaScript) replaceObject).getFileName(), findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof SingleJavaScript){
SingleJavaScript javaScript = (SingleJavaScript) info.getContent().getReplaceObject();
return StringUtils.equals(javaScript.getFileName(), info.getContent().getOldShowStr());
}
return false;
}
},
/**
* 参数
*/
PARAMETER_PROVIDER("ParameterProvider") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(((Formula) (((ParameterProvider) o[0]).getValue())).getContent())) {
map.put("content", ((Formula) (((ParameterProvider) o[0]).getValue())).getContent());
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((Formula) (((ParameterProvider) replaceObject).getValue())).getContent(), findStr);
((Formula) (((ParameterProvider) replaceObject).getValue())).setContent(ShowValueUtils.replaceAll(((Formula) (((ParameterProvider) replaceObject).getValue())).getContent(), findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof ParameterProvider){
ParameterProvider provider = (ParameterProvider) info.getContent().getReplaceObject();
if (provider.getValue() instanceof Formula){
return StringUtils.equals(GeneralUtils.objectToString(provider.getValue()), info.getContent().getOldShowStr());
}
}
return false;
}
},
/**
* FormulaProvider
*/
FORMULA_PROVIDER("FormulaProvider") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(((FormulaProvider) o[0]).getContent())) {
map.put("content", ((FormulaProvider) o[0]).getContent());
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((FormulaProvider) replaceObject).getContent(), findStr);
((FormulaProvider) replaceObject).setContent(ShowValueUtils.replaceAll(((FormulaProvider) replaceObject).getContent(), findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof FormulaProvider){
FormulaProvider provider = (FormulaProvider) info.getContent().getReplaceObject();
return StringUtils.equals(provider.getContent(), info.getContent().getOldShowStr());
}
return false;
}
},
/**
* 参数
*/
PARAMETER("Parameter") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(((Formula) (((Parameter) o[0]).getValue())).getContent())) {
map.put("content", ((Formula) (((Parameter) o[0]).getValue())).getContent());
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((Formula) (((Parameter) replaceObject).getValue())).getContent(), findStr);
((Formula) (((Parameter) replaceObject).getValue())).setContent(ShowValueUtils.replaceAll(((Formula) (((Parameter) replaceObject).getValue())).getContent(), findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof Parameter){
Parameter parameter = (Parameter) info.getContent().getReplaceObject();
if (parameter.getValue() instanceof Formula){
return StringUtils.equals(((Formula) parameter.getValue()).getContent(), info.getContent().getOldShowStr());
}
}
return false;
}
},
/**
* 数据列
*/
DS_COLUMN("DSColumn") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(((DSColumn) o[0]).getResult())) {
map.put("content", ((DSColumn) o[0]).getResult());
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((DSColumn) replaceObject).getResult(), findStr);
((DSColumn) replaceObject).setResult(ShowValueUtils.replaceAll(((DSColumn) replaceObject).getResult(), findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof DSColumn){
DSColumn column = (DSColumn) info.getContent().getReplaceObject();
return StringUtils.equals(column.getResult(), info.getContent().getOldShowStr());
}
return false;
}
},
/**
* 公式类型
*/
BASE_FORMULA("BaseFormula") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(((BaseFormula) o[0]).getContent())) {
map.put("content", ((BaseFormula) o[0]).getContent());
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((BaseFormula) replaceObject).getContent(), findStr);
((BaseFormula) replaceObject).setContent(ShowValueUtils.replaceAll(((BaseFormula) replaceObject).getContent(), findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof BaseFormula){
BaseFormula formula = (BaseFormula) info.getContent().getReplaceObject();
return StringUtils.equals(formula.getContent(), info.getContent().getOldShowStr());
}
return false;
}
},
/**
* 存储过程的参数
*/
STORE_PROCEDURE_PARAMETER("StoreProcedureParameter") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(((Formula) ((StoreProcedureParameter) o[0]).getValue()).getContent())) {
map.put("content", ((Formula) ((StoreProcedureParameter) o[0]).getValue()).getContent());
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((Formula) ((StoreProcedureParameter) replaceObject).getValue()).getContent(), findStr);
((Formula) ((StoreProcedureParameter) replaceObject).getValue()).setContent(ShowValueUtils.replaceAll(((Formula) ((StoreProcedureParameter) replaceObject).getValue()).getContent(), findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof StoreProcedureParameter){
StoreProcedureParameter procedureParameter = (StoreProcedureParameter) info.getContent().getReplaceObject();
if (procedureParameter.getValue() instanceof Formula){
return StringUtils.equals(GeneralUtils.objectToString(procedureParameter.getValue()), info.getContent().getOldShowStr());
}
}
return false;
}
},
/**
* WatermarkAttr水印
*/
WATER_MARK_ATTR("WatermarkAttr") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(((WatermarkAttr) o[0]).getText())) {
map.put("content", ((WatermarkAttr) o[0]).getText());
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
WorkBook workBook = (WorkBook) HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget();
WatermarkAttr watermarkAttr = (WatermarkAttr) info.getContent().getReplaceObject();
info.updateOldStr(watermarkAttr.getText(), findStr);
watermarkAttr.setText(ShowValueUtils.replaceAll(watermarkAttr.getText(), findStr, replaceStr));
workBook.addAttrMark(watermarkAttr);
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof WatermarkAttr){
WatermarkAttr watermarkAttr = ((WatermarkAttr) info.getContent().getReplaceObject());
return StringUtils.equals(watermarkAttr.getText(), info.getContent().getOldShowStr());
}
return false;
}
},
/**
* 存储字符串类型需要特殊处理
*/
STRING("String"){
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(GeneralUtils.objectToString(o[0]))){
map.put("content", GeneralUtils.objectToString(o[0]));
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
FormulaTag formulaTag = FormulaTag.match(info.getContent().getTag());
if (formulaTag != null){
info.updateOldStr(GeneralUtils.objectToString(info.getContent().getReplaceObject()), findStr);
formulaTag.setValue(info, findStr, replaceStr, operatorArray);
}
}
@Override
public boolean check(Info info) {
return true;
}
},
/**
* 排序
*/
FORMULA_SORT_EXPRESSION("FormulaSortExpression"){
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(((FormulaSortExpression) o[0]).getFormula())) {
map.put("content", ((FormulaSortExpression) o[0]).getFormula());
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr((((FormulaSortExpression) replaceObject).getFormula()), findStr);
((FormulaSortExpression) replaceObject).setFormula(ShowValueUtils.replaceAll((((FormulaSortExpression) replaceObject).getFormula()), findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof FormulaSortExpression){
FormulaSortExpression sortExpression = (FormulaSortExpression) info.getContent().getReplaceObject();
return StringUtils.equals(sortExpression.getFormula(), info.getContent().getOldShowStr());
}
return false;
}
}
;
String name;
FormulaReplaceObject(String name) {
this.name = name;
}
/**
* 匹配
*
* @param name
* @return
*/
@Nullable
public static FormulaReplaceObject match(String name) {
FormulaReplaceObject[] values = FormulaReplaceObject.values();
for (FormulaReplaceObject value : values) {
if (value.name.equals(name)) {
return value;
}
}
return null;
}
/**
* 校验内容
* @param info
* @return
*/
abstract public boolean check(Info info);
@Override
public String getInfoShowStr(Info info) {
return info.getContent().getOldShowStr();
}
}

188
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java

@ -0,0 +1,188 @@
package com.fr.design.actions.replace.action.content.formula;
import com.fr.chart.chartdata.MeterReportDefinition;
import com.fr.data.VerifyItem;
import com.fr.data.impl.FormulaDictionary;
import com.fr.design.actions.replace.info.DealWithInfoValue;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.info.base.SearchTag;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.general.GeneralUtils;
import com.fr.main.impl.WorkBook;
import com.fr.plugin.chart.map.data.VanMapReportDefinition;
import com.fr.report.cell.cellattr.CellGUIAttr;
import com.fr.stable.collections.combination.Pair;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* 针对特殊类型进行处理负责公式校验公式设置值时如果是new一个新的公式都要放进来这里根据持有对象来校验
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-21
*/
public enum FormulaTag implements DealWithInfoValue {
/**
* 经度
*/
CHART_DATA_LONGITUDE(SearchTag.CHART_DATA_LONGITUDE) {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) {
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject();
definition.setLongitude(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getLongitude()), findStr, replaceStr));
}
}
},
/**
* 纬度
*/
CHART_DATA_LATITUDE(SearchTag.CHART_DATA_LATITUDE) {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) {
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject();
definition.setLatitude(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getLatitude()), findStr, replaceStr));
}
}
},
/**
* 区域名
*/
CHART_AREA_NAME(SearchTag.CHART_AREA_NAME) {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) {
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject();
definition.setCategoryName(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getCategoryName()), findStr, replaceStr));
}
}
},
/**
* 终点经度
*/
CHART_DATA_END_LONGITUDE(SearchTag.CHART_DATA_END_LONGITUDE) {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) {
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject();
definition.setEndLongitude(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getEndLongitude()), findStr, replaceStr));
}
}
},
/**
* 终点纬度
*/
CHART_DATA_END_LATITUDE(SearchTag.CHART_DATA_END_LATITUDE) {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) {
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject();
definition.setEndLatitude(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getEndLatitude()), findStr, replaceStr));
}
}
},
/**
* 终点区域名
*/
CHART_AREA_END_NAME(SearchTag.CHART_AREA_END_NAME) {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) {
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject();
definition.setEndAreaName(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getEndAreaName()), findStr, replaceStr));
}
}
},
/**
* 模板填报属性数据校验提示
*/
WRITE_ATTR_MESSAGE(SearchTag.WRITE_ATTR_MESSAGE) {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof VerifyItem) {
VerifyItem item = (VerifyItem) info.getContent().getHoldObject();
item.setMessage(ShowValueUtils.replaceAll(item.getMessage(), findStr, replaceStr));
}
}
},
/**
* sheet名称
*/
SHEET_NAME(SearchTag.SHEET_NAME) {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof WorkBook) {
WorkBook workBook = (WorkBook) info.getContent().getHoldObject();
int sheetId = Integer.parseInt(info.getContent().getSheetID());
String name = workBook.getReportName(sheetId);
workBook.setReportName(sheetId, ShowValueUtils.replaceAll(name, findStr, replaceStr));
}
}
},
/**
* 单元格属性-其他-内容提示
*/
CELL_TOOL_TIP(SearchTag.CELL_TOOL_TIP) {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof CellGUIAttr) {
CellGUIAttr attr = (CellGUIAttr) info.getContent().getHoldObject();
attr.setTooltipText(ShowValueUtils.replaceAll(attr.getTooltipText(), findStr, replaceStr));
}
}
},
DICT_EXCUTE(SearchTag.DICT_EXCUTE) {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof FormulaDictionary) {
FormulaDictionary dictionary = (FormulaDictionary) info.getContent().getHoldObject();
dictionary.setExcuteFormula(ShowValueUtils.replaceAll(dictionary.getExcuteFormula(), findStr, replaceStr));
}
}
},
DICT_PRODUCE(SearchTag.DICT_PRODUCE) {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof FormulaDictionary) {
FormulaDictionary dictionary = (FormulaDictionary) info.getContent().getHoldObject();
dictionary.setProduceFormula(ShowValueUtils.replaceAll(dictionary.getProduceFormula(), findStr, replaceStr));
}
}
};
int index;
FormulaTag(int index) {
this.index = index;
}
/**
* 匹配
*
* @param index
* @return
*/
@Nullable
public static FormulaTag match(int index) {
FormulaTag[] values = FormulaTag.values();
for (FormulaTag value : values) {
if (value.index == index) {
return value;
}
}
return null;
}
@Override
abstract public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray);
@Override
public String getInfoShowStr(Info info) {
return info.getContent().getOldShowStr();
}
}

38
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/SearchFormula.java

@ -0,0 +1,38 @@
package com.fr.design.actions.replace.action.content.formula;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.mainframe.JTemplate;
import java.util.List;
/**
* 获取公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-18
*/
public interface SearchFormula extends SearchAction {
/**
* 获取公式
*
* @param formulaInfos 存储公式信息的列表
* @param content ITContent的数据结构
*/
default void searchFormula(List<FormulaInfo> formulaInfos, ITContent content) {
}
/**
* 获取各个地方的公式
*
* @param jTemplate
* @param formulaInfos
*/
default void searchFormulaFromObject(JTemplate jTemplate, List<FormulaInfo> formulaInfos) {
}
}

106
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/SearchFormulaManager.java

@ -0,0 +1,106 @@
package com.fr.design.actions.replace.action.content.formula;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.action.content.formula.cell.SearchCellFormulaAction;
import com.fr.design.actions.replace.action.content.formula.data.SearchDataFormulaAction;
import com.fr.design.actions.replace.action.content.formula.floatelement.SearchFloatFormulaAction;
import com.fr.design.actions.replace.action.content.formula.template.SearchTemplateFormulaAction;
import com.fr.design.actions.replace.action.content.formula.widget.SearchWidgetFormulaAction;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.mainframe.JTemplate;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* 管理公式类型搜索的注册
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-17
*/
public class SearchFormulaManager implements SearchAction {
private List<FormulaInfo> formulaInfos;
private Set<SearchFormula> formulaProviderSet = new HashSet<>();
private SearchFormulaManager() {
register(SearchCellFormulaAction.getInstance());
register(SearchWidgetFormulaAction.getInstance());
register(SearchDataFormulaAction.getInstance());
register(SearchTemplateFormulaAction.getInstance());
register(SearchFloatFormulaAction.getInstance());
}
@Override
public void search4Infos(JTemplate jTemplate) {
List<FormulaInfo> formulaInfos = new ArrayList<>();
for (SearchFormula searchFormula : formulaProviderSet) {
searchFormula.searchFormulaFromObject(jTemplate, formulaInfos);
}
setFormulaInfos(formulaInfos);
}
/**
* 注册对应的SearchFormula
*
* @param searchFormula
*/
public void register(SearchFormula searchFormula) {
formulaProviderSet.add(searchFormula);
}
/**
* 注销对应的SearchFormula
*
* @param searchFormula
*/
public void remove(SearchFormula searchFormula) {
formulaProviderSet.remove(searchFormula);
}
public List<FormulaInfo> getFormulaInfos() {
return formulaInfos;
}
public void setFormulaInfos(List<FormulaInfo> formulaInfos) {
this.formulaInfos = formulaInfos;
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchFormulaManager getInstance() {
return SearchFormulaManagerEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchFormulaManagerEnum {
/**
* 单例
*/
SINGLETON;
private SearchFormulaManager instance;
SearchFormulaManagerEnum() {
instance = new SearchFormulaManager();
}
/**
* 获取单例对象
*
* @return
*/
public SearchFormulaManager getInstance() {
return instance;
}
}
}

38
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormula.java

@ -0,0 +1,38 @@
package com.fr.design.actions.replace.action.content.formula.cell;
import com.fr.design.actions.replace.action.content.formula.SearchFormula;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.mainframe.JTemplate;
import java.util.List;
/**
* 查找单元格中可能存在的公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-19
*/
public interface SearchCellFormula extends SearchFormula {
/**
* 查找单元格可能存在的共有的公式
*
* @param jTemplate 指定搜索模板
* @param formulaInfos 要存储对应信息列表的数据结构
*/
default void searchFormulaFromCell(JTemplate jTemplate, List<FormulaInfo> formulaInfos) {
}
/**
* 查找不同单元格内容类型各自可能存在的公式
*
* @param formulaInfos
* @param content
*/
default void searchFormulaFromCellType(List<FormulaInfo> formulaInfos, ITContent content) {
}
}

315
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaAction.java

@ -0,0 +1,315 @@
package com.fr.design.actions.replace.action.content.formula.cell;
import com.fr.base.Formula;
import com.fr.base.present.DictPresent;
import com.fr.base.present.FormulaPresent;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.actions.replace.action.content.cell.SearchCellAction;
import com.fr.design.actions.replace.action.content.formula.chart.SearchChartCollectionFormulaAction;
import com.fr.design.actions.replace.action.content.formula.highlight.condition.*;
import com.fr.design.actions.replace.action.content.formula.highlight.SearchHighlightFormulaAction;
import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchJSHighlightAction;
import com.fr.design.actions.replace.action.content.formula.widget.DictionaryType;
import com.fr.design.actions.replace.info.CellInfo;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.info.base.SearchTag;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.data.Condition;
import com.fr.js.NameJavaScriptGroup;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellGUIAttr;
import com.fr.report.cell.cellattr.highlight.DefaultHighlight;
import com.fr.report.cell.cellattr.highlight.HighlightAction;
import com.fr.report.cell.cellattr.highlight.HighlightGroup;
import com.fr.report.core.sort.common.CellSortAttr;
import com.fr.report.core.sort.sortexpression.FormulaSortExpression;
import com.fr.report.core.sort.sortexpression.SortExpression;
import com.fr.stable.CommonUtils;
import java.util.List;
import java.util.Map;
/**
* 搜索单元格中的公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-17
*/
public class SearchCellFormulaAction implements SearchCellFormula {
private SearchCellFormulaAction() {
}
@Override
public void searchFormulaFromObject(JTemplate jTemplate, List<FormulaInfo> formulaInfos) {
searchFormulaFromCell(jTemplate, formulaInfos);
}
/**
* 从单元格中寻找公式
*
* @param jTemplate 指定搜索模板
* @param formulaInfos 指定添加信息的数组
*/
@Override
public void searchFormulaFromCell(JTemplate jTemplate, List<FormulaInfo> formulaInfos) {
SearchCellAction searchCellAction = SearchCellAction.getInstance();
searchCellAction.search4Infos(jTemplate);
if (searchCellAction.isCellInfosExist()) {
for (CellInfo cellInfo : searchCellAction.getCellInfos()) {
//根据单元格类型的不同来进行不同的操作
searchFormulaFromCellInfo(cellInfo, formulaInfos);
if (cellInfo.getContent().getReplaceObject() instanceof TemplateCellElement) {
//单元格属性-排序
searchCellSortAttr4Formula(cellInfo, formulaInfos);
//单元格属性-形态
searchCellPresent4Formula(cellInfo, formulaInfos);
//单元格属性-其他-内容提示-自定义
searchCellToolTip4Formula(cellInfo, formulaInfos);
//单元格属性-其他-插入策略
searchCellInsertPolicy4Formula(cellInfo, formulaInfos);
//单元格条件属性-参数-公式
searchCellConditionPara4Formula(cellInfo, formulaInfos);
//单元格条件属性-属性-参数
searchCellHighlightPara4Formula(cellInfo, formulaInfos);
//单元格超链
searchCellHyperLink4Formula(cellInfo, formulaInfos);
}
}
}
}
private void searchCellToolTip4Formula(CellInfo cellInfo, List<FormulaInfo> formulaInfos) {
if (cellInfo.getContent().getReplaceObject() instanceof TemplateCellElement) {
TemplateCellElement cellElement = (TemplateCellElement) cellInfo.getContent().getReplaceObject();
if (isCellGUIAttrValid(cellElement.getCellGUIAttr())) {
CellGUIAttr attr = cellElement.getCellGUIAttr();
ITContent attrContent = ITContent.copy(cellInfo.getContent());
attrContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Cell_Attributes"),
Toolkit.i18nText("Fine-Design_Report_Other"),
Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip"),
Toolkit.i18nText("Fine-Design_Basic_Custom")
);
attrContent.setReplaceObject(attr.getTooltipText());
attrContent.setHoldObject(attr);
attrContent.setTag(SearchTag.CELL_TOOL_TIP);
formulaInfos.add(new FormulaInfo(attrContent));
}
}
}
private boolean isCellGUIAttrValid(CellGUIAttr attr) {
return attr != null && attr.isCustomTooltip() && CommonUtils.canBeFormula(attr.getTooltipText());
}
private void searchCellHyperLink4Formula(CellInfo cellInfo, List<FormulaInfo> formulaInfos) {
NameJavaScriptGroup nameJavaScriptGroup = ((CellElement) cellInfo.getContent().getReplaceObject()).getNameHyperlinkGroup();
if (nameJavaScriptGroup != null) {
for (int i = 0; i < nameJavaScriptGroup.size(); i++) {
SearchJSHighlightAction action = SearchJSHighlightAction.getInstance();
ITContent content = ITContent.copy(cellInfo.getContent());
content.addOtherPos(nameJavaScriptGroup.getNameHyperlink(i).getName());
action.searchJSFormulaFromOther(formulaInfos, content, nameJavaScriptGroup.getNameHyperlink(i).getJavaScript());
}
}
}
private void searchCellHighlightPara4Formula(CellInfo cellInfo, List<FormulaInfo> formulaInfos) {
if (isHighlightGroupEmpty(cellInfo)) {
HighlightGroup highlightGroup = ((TemplateCellElement) cellInfo.getContent().getReplaceObject()).getHighlightGroup();
for (int i = 0; i < highlightGroup.size(); i++) {
for (int j = 0; j < ((DefaultHighlight) highlightGroup.getHighlight(i)).actionCount(); j++) {
HighlightAction highlightAction = ((DefaultHighlight) highlightGroup.getHighlight(i)).getHighlightAction(j);
//处理HighlightAction
SearchHighlightFormulaAction searchHighlightAction = SearchHighlightFormulaAction.getInstance();
ITContent newContent = ITContent.copy(cellInfo.getContent());
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Condition_Attributes"),
highlightGroup.getHighlight(i).getName());
searchHighlightAction.dealWithHighlightAction(newContent, formulaInfos, highlightAction);
}
}
}
}
private void searchCellConditionPara4Formula(CellInfo cellInfo, List<FormulaInfo> formulaInfos) {
if (isHighlightGroupEmpty(cellInfo)) {
HighlightGroup highlightGroup = ((TemplateCellElement) cellInfo.getContent().getReplaceObject()).getHighlightGroup();
for (int i = 0; i < highlightGroup.size(); i++) {
DefaultHighlight defaultHighlight = (DefaultHighlight) highlightGroup.getHighlight(i);
if (isConditionKeyExist(defaultHighlight.getCondition())) {
Map<String, SearchConditionFormula> conditionType = SearchConditionManager.getInstance().getConditionType();
SearchConditionFormula searchCondition = conditionType.get(((DefaultHighlight) highlightGroup.getHighlight(i)).getCondition().getClass().getSimpleName());
ITContent newContent = ITContent.copy(cellInfo.getContent());
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Condition_Attributes"),
Toolkit.i18nText("Fine-Design_Basic_Formula"));
searchCondition.searchFormulaFromCondition(formulaInfos, newContent, ((DefaultHighlight) highlightGroup.getHighlight(i)).getCondition());
}
}
}
}
private boolean isHighlightGroupEmpty(CellInfo cellInfo) {
return ((TemplateCellElement) cellInfo.getContent().getReplaceObject()).getHighlightGroup() != null;
}
private boolean isConditionKeyExist(Condition condition) {
return SearchConditionManager.getInstance().getConditionType().containsKey(condition.getClass().getSimpleName());
}
private void searchCellPresent4Formula(CellInfo cellInfo, List<FormulaInfo> formulaInfos) {
if (isFormulaPresentValid(cellInfo)) {
ITContent newContent = ITContent.copy(cellInfo.getContent());
newContent.setReplaceObject((((TemplateCellElement) cellInfo.getContent().getReplaceObject()).getPresent()));
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Cell_Attributes"),
Toolkit.i18nText("Fine-Design_Report_Present"));
formulaInfos.add(new FormulaInfo(newContent));
}
if (isDictPresentValid(cellInfo)) {
ITContent dictContent = ITContent.copy(cellInfo.getContent());
dictContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Cell_Attributes"),
Toolkit.i18nText("Fine-Design_Report_Present")
);
DictPresent present = (DictPresent) ((TemplateCellElement) cellInfo.getContent().getReplaceObject()).getPresent();
if (present.getDictionary() != null) {
DictionaryType type = DictionaryType.match(present.getDictionary().getClass().getSimpleName());
if (type != null) {
type.searchFormulaFromDictionary(dictContent, formulaInfos, present.getDictionary());
}
}
}
}
private void searchCellInsertPolicy4Formula(CellInfo cellInfo, List<FormulaInfo> formulaInfos) {
if (isInsertPolicyValid(cellInfo)) {
ITContent newContent = ITContent.copy(cellInfo.getContent());
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Cell_Attributes"),
Toolkit.i18nText("Fine-Design_Report_Other"),
Toolkit.i18nText("Fine-Design_Basic_CellWrite_InsertRow_Policy"));
newContent.setReplaceObject(((TemplateCellElement) cellInfo.getContent().getReplaceObject()).getCellInsertPolicyAttr());
formulaInfos.add(new FormulaInfo(newContent));
}
}
private boolean isFormulaPresentValid(CellInfo cellInfo) {
return ((TemplateCellElement) cellInfo.getContent().getReplaceObject()).getPresent() != null
&& ((TemplateCellElement) cellInfo.getContent().getReplaceObject()).getPresent() instanceof FormulaPresent;
}
private boolean isDictPresentValid(CellInfo cellInfo) {
return ((TemplateCellElement) cellInfo.getContent().getReplaceObject()).getPresent() != null
&& ((TemplateCellElement) cellInfo.getContent().getReplaceObject()).getPresent() instanceof DictPresent;
}
private boolean isInsertPolicyValid(CellInfo cellInfo) {
return ((TemplateCellElement) cellInfo.getContent().getReplaceObject()).getCellInsertPolicyAttr() != null
&& ((TemplateCellElement) cellInfo.getContent().getReplaceObject()).getCellInsertPolicyAttr().getDefaultInsertValue() instanceof Formula;
}
private void searchCellSortAttr4Formula(CellInfo cellInfo, List<FormulaInfo> formulaInfos) {
if (isSortAttrValid(cellInfo)) {
CellSortAttr sortAttr = ((TemplateCellElement) cellInfo.getContent().getReplaceObject()).getCellExpandAttr().getCellSortAttr();
if (isSortAttrExist(sortAttr)) {
for (SortExpression sortExpression : sortAttr.getSortExpressions()) {
if (sortExpression instanceof FormulaSortExpression) {
ITContent newContent = ITContent.copy(cellInfo.getContent());
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Cell_Attributes"),
Toolkit.i18nText("Fine-Design_Report_Expand"),
Toolkit.i18nText("Fine-Design_Basic_Action_Sort")
);
newContent.setReplaceObject(sortExpression);
formulaInfos.add(new FormulaInfo(newContent));
}
}
}
}
}
private boolean isSortAttrExist(CellSortAttr sortAttr) {
return sortAttr != null && sortAttr.getSortExpressions() != null;
}
private boolean isSortAttrValid(CellInfo cellInfo) {
return ((TemplateCellElement) cellInfo.getContent().getReplaceObject()).getCellExpandAttr() != null;
}
private void searchFormulaFromCellInfo(CellInfo cellInfo, List<FormulaInfo> formulaInfos) {
Map<String, SearchCellFormula> cellType = SearchCellFormulaManager.getInstance().getCellType();
CellElement cellElement = ((CellElement) (cellInfo.getContent().getReplaceObject()));
if (isCellValueValid(cellInfo)) {
SearchCellFormula searchCellFormula = cellType.get(cellElement.getValue().getClass().getSimpleName());
searchCellFormula.searchFormulaFromCellType(formulaInfos, cellInfo.getContent());
} else if (isChart(cellInfo)) {
ITContent chartContent = cellInfo.getContent();
//这边置否的原因是决策报表里面单元格里面放的图表是可以有多个的,每个还是有各自的名字,和普通报表一样处理即可
chartContent.setFrmFlag(false);
SearchChartCollectionFormulaAction.getInstance().searchChartCollectionFormula(formulaInfos, cellInfo.getContent(), (ChartCollection) cellElement.getValue());
}
}
private boolean isChart(CellInfo cellInfo) {
return ((CellElement) (cellInfo.getContent().getReplaceObject())).getValue() != null
&& ((CellElement) (cellInfo.getContent().getReplaceObject())).getValue() instanceof ChartCollection;
}
private boolean isCellValueValid(CellInfo cellInfo) {
Map<String, SearchCellFormula> cellType = SearchCellFormulaManager.getInstance().getCellType();
return ((CellElement) (cellInfo.getContent().getReplaceObject())).getValue() != null
&& cellType.containsKey(((CellElement) (cellInfo.getContent().getReplaceObject())).getValue().getClass().getSimpleName());
}
/**
* 获取单例
*
* @return
*/
public static SearchCellFormulaAction getInstance() {
return SearchCellFormulaActionEnum.SINGLETON.getInstance();
}
/**
* SearchCellFormulaAction 的单例
*/
enum SearchCellFormulaActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchCellFormulaAction instance;
SearchCellFormulaActionEnum() {
instance = new SearchCellFormulaAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchCellFormulaAction getInstance() {
return instance;
}
}
}

108
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaManager.java

@ -0,0 +1,108 @@
package com.fr.design.actions.replace.action.content.formula.cell;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.action.SearchManager;
import java.util.HashMap;
import java.util.Map;
/**
* 管理要搜索的单元格类型公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-16
*/
public class SearchCellFormulaManager implements SearchManager {
private Map<String, SearchCellFormula> cellType = new HashMap<>();
public static final String DS_COLUMN = "DSColumn";
public static final String FORMULA = "Formula";
public static final String RICH_TEXT = "RichText";
public static final String SUB_REPORT = "SubReport";
private SearchCellFormulaManager() {
//数据列
register(DS_COLUMN, SearchDSColumnFormulaAction.getInstance());
//公式
register(FORMULA, SearchCellFormulaTypeAction.getInstance());
//子报表
register(SUB_REPORT, SearchSubReportFormulaAction.getInstance());
}
@Override
public void registerAction(String tag, SearchAction searchAction) {
if (searchAction instanceof SearchCellFormula){
register(tag, (SearchCellFormula) searchAction);
}
}
@Override
public void removeAction(String tag) {
remove(tag);
}
/**
* 注册
*
* @param tag 用于匹配的类型tag
* @param searchCellFormula 对应的实现类
*/
private void register(String tag, SearchCellFormula searchCellFormula) {
cellType.put(tag, searchCellFormula);
}
/**
* 注销
*
* @param tag 用于匹配的tag
*/
private void remove(String tag) {
cellType.remove(tag);
}
/**
* 获取单元格类型
*
* @return
*/
public Map<String, SearchCellFormula> getCellType() {
return cellType;
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchCellFormulaManager getInstance() {
return SearchCellFormulaManagerEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchCellFormulaManagerEnum {
/**
* 单例
*/
SINGLETON;
private SearchCellFormulaManager instance;
SearchCellFormulaManagerEnum() {
instance = new SearchCellFormulaManager();
}
/**
* 获取单例对象
*
* @return
*/
public SearchCellFormulaManager getInstance() {
return instance;
}
}
}

62
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaTypeAction.java

@ -0,0 +1,62 @@
package com.fr.design.actions.replace.action.content.formula.cell;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.report.cell.CellElement;
import java.util.List;
/**
* 查找公式时单元格格式如果是公式类型则操作此类
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-18
*/
public class SearchCellFormulaTypeAction implements SearchCellFormula {
private SearchCellFormulaTypeAction(){}
@Override
public void searchFormulaFromCellType(List<FormulaInfo> formulaInfos, ITContent content) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(((CellElement) (content.getReplaceObject())).getValue());
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Formula"));
formulaInfos.add(new FormulaInfo(newContent));
}
/**
* 获取单例
*
* @return
*/
public static SearchCellFormulaTypeAction getInstance() {
return SearchCellFormulaTypeActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchCellFormulaTypeActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchCellFormulaTypeAction instance;
SearchCellFormulaTypeActionEnum() {
instance = new SearchCellFormulaTypeAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchCellFormulaTypeAction getInstance() {
return instance;
}
}
}

156
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchDSColumnFormulaAction.java

@ -0,0 +1,156 @@
package com.fr.design.actions.replace.action.content.formula.cell;
import com.fr.base.Formula;
import com.fr.base.Parameter;
import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchConditionFormula;
import com.fr.design.actions.replace.action.content.formula.highlight.condition.SearchConditionManager;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.general.data.Condition;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.core.sort.sortexpression.FormulaSortExpression;
import com.fr.report.core.sort.sortexpression.SortExpression;
import java.util.List;
import java.util.Map;
/**
* 查找公式时单元格格式如果是数据列型则操作此类
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-18
*/
public class SearchDSColumnFormulaAction implements SearchCellFormula {
private SearchDSColumnFormulaAction(){}
@Override
public void searchFormulaFromCellType(List<FormulaInfo> formulaInfos, ITContent itContent) {
if (itContent.getReplaceObject() instanceof CellElement){
CellElement cellElement = (CellElement) itContent.getReplaceObject();
if (cellElement.getValue() instanceof DSColumn) {
if (((DSColumn) cellElement.getValue()).getCondition() != null) {
ITContent content = ITContent.copy(itContent);
//数据列
content.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_DS_Column"));
DSColumn dsColumn = (DSColumn) ((CellElement) (itContent.getReplaceObject())).getValue();
//过滤条件中的公式
addFormulaInfos2ArrayFromCondition(content, dsColumn.getCondition(), formulaInfos);
//动态参数中的公式
addFormulaInfos2ArrayFromPara(content, dsColumn, formulaInfos);
//高级-排序中的公式
addFormulaInfos2ArrayFromSortExpression(content, dsColumn, formulaInfos);
//高级-显示值中的公式
addFormulaInfos2ArrayFromResult(content, dsColumn, formulaInfos);
}
}
}
}
private void addFormulaInfos2ArrayFromResult(ITContent content, DSColumn dsColumn, List<FormulaInfo> formulaInfos) {
char formulaLabel = '=';
if (dsColumn.getResult() != null && dsColumn.getResult().length() > 0 && dsColumn.getResult().charAt(0) == formulaLabel) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(dsColumn);
//高级-显示值
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Advanced"),
Toolkit.i18nText("Fine-Design_Basic_Display_Value")
);
formulaInfos.add(new FormulaInfo(newContent));
}
}
private void addFormulaInfos2ArrayFromSortExpression(ITContent content, DSColumn dsColumn, List<FormulaInfo> formulaInfos) {
if (dsColumn.getCellSortAttr() != null && dsColumn.getCellSortAttr().getSortExpressions() != null) {
for (SortExpression sortExpression : dsColumn.getCellSortAttr().getSortExpressions()) {
if (sortExpression instanceof FormulaSortExpression) {
ITContent newContent = ITContent.copy(content);
//高级-排序
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Advanced"),
Toolkit.i18nText("Fine-Design_Basic_Action_Sort")
);
newContent.setReplaceObject(sortExpression);
formulaInfos.add(new FormulaInfo(newContent));
}
}
}
}
private void addFormulaInfos2ArrayFromPara(ITContent content, DSColumn dsColumn, List<FormulaInfo> formulaInfos) {
for (Parameter parameter : dsColumn.getParameters()) {
if (parameter.getValue() instanceof Formula) {
ITContent newContent = ITContent.copy(content);
//动态参数注入
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_TableData_Dynamic_Parameter_Setting"));
newContent.setReplaceObject(parameter.getValue());
formulaInfos.add(new FormulaInfo(newContent));
}
}
}
/**
* 数据列过滤条件中的公式
*/
private void addFormulaInfos2ArrayFromCondition(ITContent content, Condition condition, List<FormulaInfo> formulaInfos) {
//这边condition有三种情况:FormulaCondition、CommonCondition、ListCondition,分别处理
Map<String, SearchConditionFormula> conditionType = SearchConditionManager.getInstance().getConditionType();
if (conditionType.containsKey(condition.getClass().getSimpleName())){
SearchConditionFormula searchCondition = conditionType.get(condition.getClass().getSimpleName());
ITContent newContent = ITContent.copy(content);
//过滤条件
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Filter_Conditions"));
searchCondition.searchFormulaFromCondition(formulaInfos, newContent, condition);
}
}
/**
* 获取单例
*
* @return
*/
public static SearchDSColumnFormulaAction getInstance() {
return SearchDSColumnFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchDSColumnFormulaActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchDSColumnFormulaAction instance;
SearchDSColumnFormulaActionEnum() {
instance = new SearchDSColumnFormulaAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchDSColumnFormulaAction getInstance() {
return instance;
}
}
}

79
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchRichFormulaAction.java

@ -0,0 +1,79 @@
package com.fr.design.actions.replace.action.content.formula.cell;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.cellattr.core.RichChar;
import com.fr.report.cell.cellattr.core.RichText;
import java.util.Iterator;
import java.util.List;
/**
* 搜索单元格富文本类型的公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-18
*/
public class SearchRichFormulaAction implements SearchCellFormula {
private SearchRichFormulaAction() {
}
@Override
public void searchFormulaFromCellType(List<FormulaInfo> formulaInfos, ITContent content) {
RichText richText = ((RichText) ((CellElement) (content.getReplaceObject())).getValue());
Iterator<RichChar> it = richText.charIterator();
while (it.hasNext()) {
RichChar richChar = it.next();
if (richChar.isFormula()) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(richChar);
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Rich_Text"),
Toolkit.i18nText("Fine-Design_Basic_Formula")
);
formulaInfos.add(new FormulaInfo(newContent));
}
}
}
/**
* 获取单例
*
* @return
*/
public static SearchRichFormulaAction getInstance() {
return SearchRichFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchRichFormulaActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchRichFormulaAction instance;
SearchRichFormulaActionEnum() {
instance = new SearchRichFormulaAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchRichFormulaAction getInstance() {
return instance;
}
}
}

70
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchSubReportFormulaAction.java

@ -0,0 +1,70 @@
package com.fr.design.actions.replace.action.content.formula.cell;
import com.fr.base.Formula;
import com.fr.base.core.KV;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.cellattr.core.SubReport;
import java.util.List;
/**
* 搜索单元格子报表类型的公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-18
*/
public class SearchSubReportFormulaAction implements SearchCellFormula {
private SearchSubReportFormulaAction() {
}
@Override
public void searchFormulaFromCellType(List<FormulaInfo> formulaInfos, ITContent content) {
KV[] kvs = ((SubReport) (((CellElement) content.getReplaceObject()).getValue())).getParameterKVS();
for (KV kv : kvs) {
if (kv.getValue() instanceof Formula) {
ITContent newContent = ITContent.copy(content);
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Sub_Report_Parameter"));
newContent.setReplaceObject(kv);
formulaInfos.add(new FormulaInfo(newContent));
}
}
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchSubReportFormulaAction getInstance() {
return SearchSubReportFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchSubReportFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchSubReportFormulaAction instance;
SearchSubReportFormulaActionEnum() {
instance = new SearchSubReportFormulaAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchSubReportFormulaAction getInstance() {
return instance;
}
}
}

95
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBoxDataFormulaAction.java

@ -0,0 +1,95 @@
package com.fr.design.actions.replace.action.content.formula.chart;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.box.data.VanBoxReportDefinition;
import com.fr.plugin.chart.box.data.VanBoxReportDetailedDefinition;
import com.fr.plugin.chart.box.data.VanBoxReportResultDefinition;
import java.util.List;
/**
* 箱型图
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-21
*/
public class SearchChartBoxDataFormulaAction implements SearchChartDataFormula {
private SearchChartBoxDataFormulaAction() {
}
@Override
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
if (provider instanceof VanBoxReportDefinition) {
VanBoxReportDefinition definition = (VanBoxReportDefinition) provider;
//明细数据
ITContent detailContent = ITContent.copy(content);
detailContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Detailed_Data"));
dealDetailDefinition(formulaInfos, detailContent, definition.getDetailedDefinition());
//结果数据
ITContent resultContent = ITContent.copy(content);
resultContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Result_Data"));
dealResultDefinition(formulaInfos, resultContent, definition.getResultDefinition());
}
}
private void dealResultDefinition(List<FormulaInfo> formulaInfos, ITContent content, VanBoxReportResultDefinition resultDefinition) {
//分类
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Category"), resultDefinition.getCategoryName());
//系列名
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Series_Name"), resultDefinition.getSeriesName());
//最大值
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Data_Max"), resultDefinition.getMax());
//上四分位数
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Data_Q3"), resultDefinition.getQ3());
//中位数
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Data_Median"), resultDefinition.getMedian());
//下四分位数
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Data_Q1"), resultDefinition.getQ1());
//最小值
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Min_Value"), resultDefinition.getMin());
}
private void dealDetailDefinition(List<FormulaInfo> formulaInfos, ITContent content, VanBoxReportDetailedDefinition detailedDefinition) {
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Category_Name"), detailedDefinition.getCategoryName());
SearchChartMapDataFormulaAction.dealSeriesDefinition(formulaInfos, content, detailedDefinition.getSeriesList());
}
/**
* 对外开放获取对象的方法
*
* @return
*/
public static SearchChartBoxDataFormulaAction getInstance() {
return SearchChartBoxDataFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchChartBoxDataFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchChartBoxDataFormulaAction instance;
SearchChartBoxDataFormulaActionEnum() {
instance = new SearchChartBoxDataFormulaAction();
}
/**
* 获取单例的方法
*
* @return
*/
public SearchChartBoxDataFormulaAction getInstance() {
return instance;
}
}
}

79
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartBubbleDataFormulaAction.java

@ -0,0 +1,79 @@
package com.fr.design.actions.replace.action.content.formula.chart;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartdata.BubbleReportDefinition;
import com.fr.chart.chartdata.BubbleSeriesValue;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import java.util.List;
/**
* 散点图气泡图数据
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-21
*/
public class SearchChartBubbleDataFormulaAction implements SearchChartDataFormula {
private SearchChartBubbleDataFormulaAction() {
}
@Override
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
if (provider instanceof BubbleReportDefinition) {
BubbleReportDefinition reportDefinition = (BubbleReportDefinition) provider;
for (int i = 0; i < reportDefinition.size(); i++) {
if (reportDefinition.get(i) instanceof BubbleSeriesValue) {
BubbleSeriesValue seriesValue = (BubbleSeriesValue) reportDefinition.get(i);
dealBubbleSeriesValue(formulaInfos, content, seriesValue);
}
}
}
}
private void dealBubbleSeriesValue(List<FormulaInfo> formulaInfos, ITContent content, BubbleSeriesValue seriesValue) {
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Series_Name"), seriesValue.getBubbleSereisName());
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Size"), seriesValue.getBubbleSeriesSize());
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_X_Axis"), seriesValue.getBubbleSeriesX());
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Y_Axis"), seriesValue.getBubbleSeriesY());
}
/**
* 对外开放获取对象的方法
*
* @return
*/
public static SearchChartBubbleDataFormulaAction getInstance() {
return SearchChartBubbleDataFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchChartBubbleDataFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchChartBubbleDataFormulaAction instance;
SearchChartBubbleDataFormulaActionEnum() {
instance = new SearchChartBubbleDataFormulaAction();
}
/**
* 获取单例的方法
*
* @return
*/
public SearchChartBubbleDataFormulaAction getInstance() {
return instance;
}
}
}

392
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java

@ -0,0 +1,392 @@
package com.fr.design.actions.replace.action.content.formula.chart;
import com.fr.base.Formula;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.base.present.DictPresent;
import com.fr.base.present.FormulaPresent;
import com.fr.base.present.Present;
import com.fr.chart.base.AttrChangeConfig;
import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartattr.SwitchTitle;
import com.fr.chart.chartattr.Title;
import com.fr.chart.chartdata.NormalReportDataDefinition;
import com.fr.chart.chartdata.SeriesDefinition;
import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchJSHighlightAction;
import com.fr.design.actions.replace.action.content.formula.widget.DictionaryType;
import com.fr.design.actions.replace.info.CellInfo;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.JSInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.js.NameJavaScript;
import com.fr.js.NameJavaScriptGroup;
import com.fr.plugin.chart.attr.axis.VanChartAlertValue;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartValueAxis;
import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.report.cell.TemplateCellElement;
import com.fr.stable.StringUtils;
import java.util.List;
import java.util.Map;
/**
* 图表类型获取公式汇总
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-12
*/
public class SearchChartCollectionFormulaAction {
private SearchChartCollectionFormulaAction() {
}
/**
* 搜索图表中的公式
*
* @param formulaInfos
* @param content
* @param chartCollection
*/
public void searchChartCollectionFormula(List<FormulaInfo> formulaInfos, ITContent content, ChartCollection chartCollection) {
for (int i = 0; i < chartCollection.getChartCount(); i++) {
ITContent chartContent = ITContent.copy(content);
searchChartPatternFormula(formulaInfos, chartContent, chartCollection.getChart(i));
if (isChangeConfigAttrValid(chartCollection.getChangeConfigAttr())) {
//图表切换属性
dealChangeConfig(formulaInfos, chartContent, chartCollection.getChart(i));
}
//图表-交互属性-超级链接
dealChartHyperLink(formulaInfos, chartContent, chartCollection.getChart(i));
//数据-单元格数据-分类名&系列名&值
SearchChartDataFormulaManager searchChartDataFormulaManager = SearchChartDataFormulaManager.getInstance();
Map<String, SearchChartDataFormula> type = searchChartDataFormulaManager.getChartDataType();
if (isDefinitionValid(chartCollection.getChart(i).getFilterDefinition())) {
String name = chartCollection.getChart(i).getFilterDefinition().getClass().getSimpleName();
SearchChartDataFormula searchChartDataFormula = type.get(name);
TopDefinitionProvider provider = chartCollection.getChart(i).getFilterDefinition();
ITContent dataContent = ITContent.copy(content);
dataContent.addOtherPos(chartCollection.getChart(i).getChartName(), Toolkit.i18nText("Fine-Design_Basic_Data"));
searchChartDataFormula.searchChartDataFormula(formulaInfos, dataContent, provider);
}
//数据-形态
if (chartCollection.getChart(i).getFilterDefinition() != null) {
ITContent presentContent = ITContent.copy(content);
presentContent.addOtherPos(chartCollection.getChart(i).getChartName(), Toolkit.i18nText("Fine-Design_Basic_Data"));
searchFormulaFromChartPresent(formulaInfos, presentContent, chartCollection.getChart(i).getFilterDefinition());
}
}
}
private void dealChartHyperLink(List<FormulaInfo> formulaInfos, ITContent content, Chart chart) {
ITContent conditionContent = ITContent.copy(content);
if (StringUtils.isNotEmpty(chart.getChartName())) {
conditionContent.addOtherPos(chart.getChartName());
}
conditionContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Animation_Special"),
Toolkit.i18nText("Fine-Design_Chart_Interactive")
);
if (chart.getPlot() instanceof VanChartCustomPlot) {
VanChartCustomPlot plot = chart.getPlot();
for (int i = 0; i < plot.getCustomPlotList().size(); i++) {
ITContent customContent = ITContent.copy(conditionContent);
customContent.addOtherPos(CustomPlotFactory.getTitle(CustomPlotFactory.getCustomType(plot.getCustomPlotList().get(i))));
dealPlot(formulaInfos, customContent, plot.getCustomPlotList().get(i));
}
} else if (chart.getPlot() != null) {
dealPlot(formulaInfos, conditionContent, chart.getPlot());
}
}
private void dealPlot(List<FormulaInfo> formulaInfos, ITContent content, Plot plot) {
NameJavaScriptGroup javaScriptGroup = plot.getHotHyperLink();
if (javaScriptGroup != null) {
for (int i = 0; i < javaScriptGroup.size(); i++) {
NameJavaScript javaScript = javaScriptGroup.getNameHyperlink(i);
content.addOtherPos(javaScript.getName());
SearchJSHighlightAction action = SearchJSHighlightAction.getInstance();
action.searchJSFormulaFromOther(formulaInfos, content, javaScript.getJavaScript());
}
}
}
private void searchFormulaFromChartPresent(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
searchPresent4Formula(provider.getCategoryPresent(), content, formulaInfos);
searchPresent4Formula(provider.getSeriesPresent(), content, formulaInfos);
}
private void searchPresent4Formula(Present present, ITContent content, List<FormulaInfo> formulaInfos) {
if (present instanceof FormulaPresent) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(present);
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Style_Present"),
Toolkit.i18nText("Fine-Design_Basic_Present_Formula_Present"));
formulaInfos.add(new FormulaInfo(newContent));
}
if (present instanceof DictPresent) {
ITContent dictContent = ITContent.copy(content);
dictContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Style_Present"),
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary")
);
DictPresent dictPresent = (DictPresent) present;
if (dictPresent.getDictionary() != null) {
DictionaryType type = DictionaryType.match(dictPresent.getDictionary().getClass().getSimpleName());
if (type != null) {
type.searchFormulaFromDictionary(dictContent, formulaInfos, dictPresent.getDictionary());
}
}
}
}
private boolean isChangeConfigAttrValid(AttrChangeConfig attrChangeConfig) {
return attrChangeConfig != null && attrChangeConfig.isEnable();
}
private void dealChangeConfig(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) {
ITContent content = ITContent.copy(chartContent);
if (StringUtils.isNotEmpty(chart.getChartName())) {
content.addOtherPos(chart.getChartName());
}
content.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Type"),
Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes")
);
if (isSwitchTitleValid(chart.getSwitchTitle())) {
SwitchTitle title = chart.getSwitchTitle();
content.setReplaceObject(title.getContent());
formulaInfos.add(new FormulaInfo(content));
}
}
private boolean isSwitchTitleValid(SwitchTitle title) {
return title != null && title.getContent() instanceof Formula;
}
private boolean isDefinitionValid(TopDefinitionProvider provider) {
return provider != null && SearchChartDataFormulaManager.getInstance().getChartDataType().containsKey(provider.getClass().getSimpleName());
}
private void searchChartPatternFormula(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) {
//样式-标题
searchChartPatternFormulaFromTitle(formulaInfos, chartContent, chart);
//样式-坐标轴-值定义&样式-坐标轴-轴标题
searchChartPatternFormulaFromAxisValue(formulaInfos, chartContent, chart);
//样式-背景-警戒线
searchChartPatternFormulaFromAlertLine(formulaInfos, chartContent, chart);
}
private void searchChartPatternFormulaFromAlertLine(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) {
if (chart.getPlot() != null) {
Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis();
ITContent content = ITContent.copy(chartContent);
content.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Pattern"),
Toolkit.i18nText("Fine-Design_Chart_Background"),
Toolkit.i18nText("Fine-Design_Chart_Plot_Region"),
Toolkit.i18nText("Fine-Design_Chart_Alert_Line")
);
if (xAxis instanceof VanChartAxis) {
List<VanChartAlertValue> list = ((VanChartAxis) xAxis).getAlertValues();
for (VanChartAlertValue alertValue : list) {
//警戒线设置
dealAlertValue(formulaInfos, content, alertValue);
//提示文字
dealAlertContent(formulaInfos, content, alertValue);
}
}
if (yAxis instanceof VanChartAxis) {
List<VanChartAlertValue> list = ((VanChartAxis) yAxis).getAlertValues();
for (VanChartAlertValue alertValue : list) {
//警戒线设置
dealAlertValue(formulaInfos, content, alertValue);
//提示文字
dealAlertContent(formulaInfos, content, alertValue);
}
}
}
}
private void dealAlertContent(List<FormulaInfo> formulaInfos, ITContent content, VanChartAlertValue alertValue) {
if (alertValue.getAlertContentFormula() != null) {
ITContent alertContent = ITContent.copy(content);
alertContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Alert_Text"));
alertContent.setReplaceObject(alertValue.getAlertContentFormula());
formulaInfos.add(new FormulaInfo(alertContent));
}
}
private void dealAlertValue(List<FormulaInfo> formulaInfos, ITContent content, VanChartAlertValue alertValue) {
if (alertValue.getAlertValueFormula() != null) {
ITContent valueContent = ITContent.copy(content);
valueContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Alert_Set"));
valueContent.setReplaceObject(alertValue.getAlertValueFormula());
formulaInfos.add(new FormulaInfo(valueContent));
}
}
private void searchChartPatternFormulaFromAxisValue(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) {
if (chart.getPlot() != null) {
Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis();
//样式-坐标轴-x轴
if (xAxis != null) {
//轴标题
ITContent xAxisContent = ITContent.copy(chartContent);
if (!chartContent.isFrm()) {
xAxisContent.addOtherPos(chart.getChartName());
}
xAxisContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Pattern"),
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_X_Axis")
);
dealTitle(formulaInfos, xAxisContent, xAxis.getTitle());
dealChartValueDefine(formulaInfos, xAxisContent, xAxis);
}
//样式-坐标轴-y轴-轴标题
if (yAxis != null) {
ITContent yAxisContent = ITContent.copy(chartContent);
yAxisContent.addOtherPos(
chart.getChartName(),
Toolkit.i18nText("Fine-Design_Chart_Pattern"),
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_Y_Axis")
);
dealTitle(formulaInfos, yAxisContent, yAxis.getTitle());
dealChartValueDefine(formulaInfos, yAxisContent, yAxis);
}
}
}
private void dealChartValueDefine(List<FormulaInfo> formulaInfos, ITContent axisContent, Axis axis) {
ITContent content = ITContent.copy(axisContent);
content.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Value_Define"));
//自定义最大值最小值
dealChartMaxAndMinValue(formulaInfos, content, axis);
//自定义主次刻度
dealChartMainAndSecUnit(formulaInfos, content, axis);
//自定义对数底数
dealChartLogBase(formulaInfos, content, axis);
}
private void dealChartLogBase(List<FormulaInfo> formulaInfos, ITContent content, Axis axis) {
if (axis instanceof VanChartValueAxis) {
if (axis.isLog() && ((VanChartValueAxis) axis).getLogBase() != null) {
ITContent logContent = ITContent.copy(content);
logContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Custom_LogBase_Value"));
logContent.setReplaceObject(((VanChartValueAxis) axis).getLogBase());
formulaInfos.add(new FormulaInfo(logContent));
}
}
}
private void dealChartMainAndSecUnit(List<FormulaInfo> formulaInfos, ITContent content, Axis axis) {
if (axis.isCustomMainUnit() && axis.getMainUnit() != null) {
ITContent mainContent = ITContent.copy(content);
mainContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Custom_Main_Type"));
mainContent.setReplaceObject(axis.getMainUnit());
formulaInfos.add(new FormulaInfo(mainContent));
}
if (axis.isCustomSecUnit() && axis.getSecUnit() != null) {
ITContent secContent = ITContent.copy(content);
secContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Custom_Second_Type"));
secContent.setReplaceObject(axis.getSecUnit());
formulaInfos.add(new FormulaInfo(secContent));
}
}
private void dealChartMaxAndMinValue(List<FormulaInfo> formulaInfos, ITContent axisContent, Axis axis) {
if (axis.isCustomMaxValue() && axis.getMaxValue() != null) {
ITContent maxContent = ITContent.copy(axisContent);
maxContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Custom_Max_Value"));
maxContent.setReplaceObject(axis.getMaxValue());
formulaInfos.add(new FormulaInfo(maxContent));
}
if (axis.isCustomMinValue() && axis.getMinValue() != null) {
ITContent minContent = ITContent.copy(axisContent);
minContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Custom_Min_Value"));
minContent.setReplaceObject(axis.getMinValue());
formulaInfos.add(new FormulaInfo(minContent));
}
}
private void searchChartPatternFormulaFromTitle(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) {
//样式-标题
ITContent titleContent = ITContent.copy(chartContent);
titleContent.addOtherPos(
chart.getChartName(),
Toolkit.i18nText("Fine-Design_Chart_Pattern")
);
dealTitle(formulaInfos, titleContent, chart.getTitle());
}
private void dealTitle(List<FormulaInfo> formulaInfos, ITContent chartContent, Title title) {
if (title != null && title.getTextObject() instanceof Formula) {
ITContent content = ITContent.copy(chartContent);
content.addOtherPos(Toolkit.i18nText("Fine-Design_Form_Title"));
content.setReplaceObject(title.getTextObject());
formulaInfos.add(new FormulaInfo(content));
}
}
/**
* 对外开放获取对象的方法
*
* @return
*/
public static SearchChartCollectionFormulaAction getInstance() {
return SearchChartCollectionFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchChartCollectionFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchChartCollectionFormulaAction instance;
SearchChartCollectionFormulaActionEnum() {
instance = new SearchChartCollectionFormulaAction();
}
/**
* 获取单例的方法
*
* @return
*/
public SearchChartCollectionFormulaAction getInstance() {
return instance;
}
}
}

79
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCustomDataFormulaAction.java

@ -0,0 +1,79 @@
package com.fr.design.actions.replace.action.content.formula.chart;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.plugin.chart.custom.CustomDefinition;
import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.type.CustomPlotType;
import java.util.List;
import java.util.Map;
/**
* 组合图
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-21
*/
public class SearchChartCustomDataFormulaAction implements SearchChartDataFormula {
private SearchChartCustomDataFormulaAction() {
}
@Override
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
if (provider instanceof CustomDefinition) {
CustomDefinition definition = (CustomDefinition) provider;
Map<String, SearchChartDataFormula> map = SearchChartDataFormulaManager.getInstance().getChartDataType();
for (CustomPlotType customPlotType : definition.getDefinitionProviderMap().keySet()) {
TopDefinitionProvider definitionProvider = definition.getDefinitionProviderMap().get(customPlotType);
if (map.containsKey(definitionProvider.getClass().getSimpleName())) {
ITContent customContent = ITContent.copy(content);
customContent.addOtherPos(CustomPlotFactory.getTitle(customPlotType));
map.get(definitionProvider.getClass().getSimpleName()).searchChartDataFormula(formulaInfos, customContent, definitionProvider);
}
}
}
}
/**
* 对外开放获取对象的方法
*
* @return
*/
public static SearchChartCustomDataFormulaAction getInstance() {
return SearchChartCustomDataFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchChartCustomDataFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchChartCustomDataFormulaAction instance;
SearchChartCustomDataFormulaActionEnum() {
instance = new SearchChartCustomDataFormulaAction();
}
/**
* 获取单例的方法
*
* @return
*/
public SearchChartCustomDataFormulaAction getInstance() {
return instance;
}
}
}

46
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDataFormula.java

@ -0,0 +1,46 @@
package com.fr.design.actions.replace.action.content.formula.chart;
import com.fr.base.Formula;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.design.actions.replace.action.content.formula.SearchFormula;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import java.util.List;
/**
* 搜索图表-数据中的公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-21
*/
public interface SearchChartDataFormula extends SearchFormula {
/**
* 搜索图表-数据中的公式
*
* @param formulaInfos
* @param content
* @param provider
*/
void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider);
/**
* 快速处理Formula
*
* @param formulaInfos
* @param reportContent
* @param otherPos
* @param o
*/
default void dealFormulaObject(List<FormulaInfo> formulaInfos, ITContent reportContent, String otherPos, Object o) {
if (o instanceof Formula) {
ITContent content = ITContent.copy(reportContent);
content.addOtherPos(otherPos);
content.setReplaceObject(o);
formulaInfos.add(new FormulaInfo(content));
}
}
}

160
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDataFormulaManager.java

@ -0,0 +1,160 @@
package com.fr.design.actions.replace.action.content.formula.chart;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.action.SearchManager;
import java.util.HashMap;
import java.util.Map;
/**
* 管理图表-数据中的公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-21
*/
public class SearchChartDataFormulaManager implements SearchManager {
private static Map<String, SearchChartDataFormula> chartDataType = new HashMap<>();
/**
* 其余普通类型
*/
public static final String VAN_CHART_NORMAL_REPORT_DATA_DEFINITION = "VanChartNormalReportDataDefinition";
/**
* 散点图气泡图数据
*/
public static final String BUBBLE_REPORT_DEFINITION = "BubbleReportDefinition";
/**
* 组合图
*/
public static final String CUSTOM_DEFINITION = "CustomDefinition";
/**
* 多层饼图矩形树图
*/
public static final String MULTI_PIE_REPORT_DATA_DEFINITION = "MultiPieReportDataDefinition";
/**
* 地图热力地图
*/
public static final String VAN_MAP_DEFINITION = "VanMapDefinition";
/**
* 钻取地图
*/
public static final String DRILL_MAP_DEFINITION = "DrillMapDefinition";
/**
* 词云
*/
public static final String WORD_CLOUD_REPORT_DEFINITION = "WordCloudReportDefinition";
/**
* 漏斗图
*/
public static final String METER_REPORT_DEFINITION = "MeterReportDefinition";
/**
* 甘特图
*/
public static final String VAN_GANTT_DEFINITION = "VanGanttDefinition";
/**
* 框架图
*/
public static final String STRUCTURE_REPORT_DEFINITION = "StructureReportDefinition";
/**
* 箱型图
*/
public static final String VAN_BOX_REPORT_DEFINITION = "VanBoxReportDefinition";
/**
* 组合图中的大部分类型
*/
public static final String NORMAL_REPORT_DATA_DEFINITION = "NormalReportDataDefinition";
private SearchChartDataFormulaManager() {
register(VAN_CHART_NORMAL_REPORT_DATA_DEFINITION, SearchChartVanNormalDataFormulaAction.getInstance());
register(BUBBLE_REPORT_DEFINITION, SearchChartBubbleDataFormulaAction.getInstance());
register(MULTI_PIE_REPORT_DATA_DEFINITION, SearchChartMultiPieDataFormulaAction.getInstance());
register(VAN_MAP_DEFINITION, SearchChartMapDataFormulaAction.getInstance());
register(DRILL_MAP_DEFINITION, SearchChartDrillMapDataFormulaAction.getInstance());
register(WORD_CLOUD_REPORT_DEFINITION, SearchChartWordCloudDataFormulaAction.getInstance());
register(METER_REPORT_DEFINITION, SearchChartMeterDataFormulaAction.getInstance());
register(VAN_GANTT_DEFINITION, SearchChartGanttDataFormulaAction.getInstance());
register(STRUCTURE_REPORT_DEFINITION, SearchChartStructureDataFormulaAction.getInstance());
register(VAN_BOX_REPORT_DEFINITION, SearchChartBoxDataFormulaAction.getInstance());
register(CUSTOM_DEFINITION, SearchChartCustomDataFormulaAction.getInstance());
register(NORMAL_REPORT_DATA_DEFINITION, SearchChartNormalReportDataFormulaAction.getInstance());
}
/**
* 获取类别
*
* @return
*/
public Map<String, SearchChartDataFormula> getChartDataType() {
return chartDataType;
}
@Override
public void registerAction(String tag, SearchAction searchAction) {
if (searchAction instanceof SearchChartDataFormula) {
register(tag, (SearchChartDataFormula) searchAction);
}
}
@Override
public void removeAction(String tag) {
remove(tag);
}
/**
* 注册
*
* @param tag 用于匹配的类型tag
* @param searchChartDataFormula 对应的实现类
*/
private void register(String tag, SearchChartDataFormula searchChartDataFormula) {
chartDataType.put(tag, searchChartDataFormula);
}
/**
* 注销
*
* @param tag 用于匹配的tag
*/
private void remove(String tag) {
chartDataType.remove(tag);
}
/**
* 对外开放获取对象的方法
*
* @return
*/
public static SearchChartDataFormulaManager getInstance() {
return SearchChartCollectionFormulaManagerEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchChartCollectionFormulaManagerEnum {
/**
* 单例
*/
SINGLETON;
private SearchChartDataFormulaManager instance;
SearchChartCollectionFormulaManagerEnum() {
instance = new SearchChartDataFormulaManager();
}
/**
* 获取单例的方法
*
* @return
*/
public SearchChartDataFormulaManager getInstance() {
return instance;
}
}
}

93
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartDrillMapDataFormulaAction.java

@ -0,0 +1,93 @@
package com.fr.design.actions.replace.action.content.formula.chart;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.chartx.data.DrillMapChartDataDefinition;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.drillmap.data.DrillMapDefinition;
import com.fr.plugin.chart.map.data.VanMapReportDefinition;
import java.util.List;
/**
* 钻取地图
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-21
*/
public class SearchChartDrillMapDataFormulaAction implements SearchChartDataFormula {
private SearchChartDrillMapDataFormulaAction() {
}
@Override
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
if (provider instanceof DrillMapDefinition) {
DrillMapDefinition definition = (DrillMapDefinition) provider;
if (definition.isFromBottomData()) {
dealDefinition(formulaInfos, content, definition.getBottomDataDefinition());
} else {
for (int i = 0; i < definition.getEachLayerDataDefinitionList().size(); i++) {
ITContent listContent = ITContent.copy(content);
int index = i + 1;
listContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Index_Article") + index + Toolkit.i18nText("Fine-Design_Chart_Index_Layer")
);
dealDefinition(formulaInfos, listContent, definition.getEachLayerDataDefinitionList().get(i));
}
}
}
}
/**
* 这边存在点地图和区域地图两种点地图特殊的地方需要处理一下
*
* @param formulaInfos
* @param content
* @param provider
*/
private void dealDefinition(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
if (provider instanceof VanMapReportDefinition) {
SearchChartMapDataFormulaAction.getInstance().dealAreaName(formulaInfos, content, ((VanMapReportDefinition) provider).getCategoryName(), (VanMapReportDefinition) provider);
SearchChartMapDataFormulaAction.dealSeriesDefinition(formulaInfos, content, ((VanMapReportDefinition) provider).getSeriesList());
SearchChartMapDataFormulaAction.getInstance().dealPointDefinition4Special(formulaInfos, content, provider);
}
}
/**
* 对外开放获取对象的方法
*
* @return
*/
public static SearchChartDrillMapDataFormulaAction getInstance() {
return SearchChartDrillMapDataFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchChartDrillMapDataFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchChartDrillMapDataFormulaAction instance;
SearchChartDrillMapDataFormulaActionEnum() {
instance = new SearchChartDrillMapDataFormulaAction();
}
/**
* 获取单例的方法
*
* @return
*/
public SearchChartDrillMapDataFormulaAction getInstance() {
return instance;
}
}
}

108
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartGanttDataFormulaAction.java

@ -0,0 +1,108 @@
package com.fr.design.actions.replace.action.content.formula.chart;
import com.fr.base.Formula;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.gantt.data.VanGanttDefinition;
import com.fr.plugin.chart.gantt.data.VanGanttLinkReportDefinition;
import com.fr.plugin.chart.gantt.data.VanGanttReportDefinition;
import java.util.List;
/**
* 甘特图
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-21
*/
public class SearchChartGanttDataFormulaAction implements SearchChartDataFormula {
private SearchChartGanttDataFormulaAction() {
}
@Override
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
if (provider instanceof VanGanttDefinition) {
VanGanttDefinition definition = (VanGanttDefinition) provider;
if (definition.getDataDefinition() instanceof VanGanttReportDefinition) {
VanGanttReportDefinition reportDefinition = (VanGanttReportDefinition) definition.getDataDefinition();
ITContent reportContent = ITContent.copy(content);
reportContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Gantt_Chart"));
dealReportDefinition(formulaInfos, reportContent, reportDefinition);
}
if (definition.getLinkDefinition() instanceof VanGanttLinkReportDefinition) {
VanGanttLinkReportDefinition linkReportDefinition = (VanGanttLinkReportDefinition) definition.getLinkDefinition();
ITContent linkContent = ITContent.copy(content);
linkContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Task_Link"));
dealLinkDefinition(formulaInfos, linkContent, linkReportDefinition);
}
}
}
private void dealLinkDefinition(List<FormulaInfo> formulaInfos, ITContent linkContent, VanGanttLinkReportDefinition linkReportDefinition) {
//起始任务id
dealFormulaObject(formulaInfos, linkContent, Toolkit.i18nText("Fine-Design_Chart_Start_Task_ID"), linkReportDefinition.getStartTaskID());
//结束任务id
dealFormulaObject(formulaInfos, linkContent, Toolkit.i18nText("Fine-Design_Chart_End_Task_ID"), linkReportDefinition.getEndTaskID());
//关联类型
dealFormulaObject(formulaInfos, linkContent, Toolkit.i18nText("Fine-Design_Chart_Link_Type"), linkReportDefinition.getLinkType());
}
private void dealReportDefinition(List<FormulaInfo> formulaInfos, ITContent reportContent, VanGanttReportDefinition reportDefinition) {
//系列名
dealFormulaObject(formulaInfos, reportContent, Toolkit.i18nText("Fine-Design_Chart_Series_Name"), reportDefinition.getSeriesName());
//开始时间
dealFormulaObject(formulaInfos, reportContent, Toolkit.i18nText("Fine-Design_Chart_Start_Time"), reportDefinition.getStartTime());
//结束时间
dealFormulaObject(formulaInfos, reportContent, Toolkit.i18nText("Fine-Design_Chart_End_Time"), reportDefinition.getEndTime());
//里程碑时间
dealFormulaObject(formulaInfos, reportContent, Toolkit.i18nText("Fine-Design_Chart_Marker_Time"), reportDefinition.getMarkTime());
//进度
dealFormulaObject(formulaInfos, reportContent, Toolkit.i18nText("Fine-Design_Chart_Process"), reportDefinition.getProgress());
//任务ID
dealFormulaObject(formulaInfos, reportContent, Toolkit.i18nText("Fine-Design_Chart_Task_ID"), reportDefinition.getLinkID());
//项目名称
dealFormulaObject(formulaInfos, reportContent, Toolkit.i18nText("Fine-Design_Chart_Project_Name"), reportDefinition.getFirstProcess());
//项目
for (Object o : reportDefinition.getProcessList()) {
dealFormulaObject(formulaInfos, reportContent, Toolkit.i18nText("Fine-Design_Chart_Project"), o);
}
}
/**
* 对外开放获取对象的方法
*
* @return
*/
public static SearchChartGanttDataFormulaAction getInstance() {
return SearchChartGanttDataFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchChartGanttDataFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchChartGanttDataFormulaAction instance;
SearchChartGanttDataFormulaActionEnum() {
instance = new SearchChartGanttDataFormulaAction();
}
/**
* 获取单例的方法
*
* @return
*/
public SearchChartGanttDataFormulaAction getInstance() {
return instance;
}
}
}

246
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMapDataFormulaAction.java

@ -0,0 +1,246 @@
package com.fr.design.actions.replace.action.content.formula.chart;
import com.fr.base.Formula;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartdata.SeriesDefinition;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.info.base.SearchTag;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.map.data.VanMapDefinition;
import com.fr.plugin.chart.map.data.VanMapReportDefinition;
import java.util.List;
/**
* 地图
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-21
*/
public class SearchChartMapDataFormulaAction implements SearchChartDataFormula {
private SearchChartMapDataFormulaAction() {
}
@Override
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
if (provider instanceof VanMapDefinition) {
VanMapDefinition mapDefinition = (VanMapDefinition) provider;
//区域地图
ITContent areaContent = ITContent.copy(content);
areaContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Region_Map"));
dealAreaDefinition(formulaInfos, areaContent, mapDefinition.getAreaDefinition());
//流向地图
ITContent lineContent = ITContent.copy(content);
lineContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_LineMap"));
dealLineDefinition(formulaInfos, content, mapDefinition.getLineDefinition());
//点地图
ITContent pointContent = ITContent.copy(content);
pointContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_PointMap"));
dealPointDefinition(formulaInfos, content, mapDefinition.getPointDefinition());
}
}
/**
* 处理点地图
*
* @param formulaInfos
* @param content
* @param pointDefinition
*/
public void dealPointDefinition(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider pointDefinition) {
if (pointDefinition instanceof VanMapReportDefinition) {
VanMapReportDefinition definition = (VanMapReportDefinition) pointDefinition;
ITContent pointContent = ITContent.copy(content);
//系列名&值
dealSeriesDefinition(formulaInfos, pointContent, definition.getSeriesList());
//经纬度
dealLongitudeAndLatitude(formulaInfos, pointContent, definition);
//区域名
dealAreaName(formulaInfos, pointContent, definition.getCategoryName(), definition);
}
}
private boolean isFormulaString(Object o) {
String formulaFlag = "=";
return o instanceof String && ((String) o).startsWith(formulaFlag);
}
private void dealLineDefinition(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider lineDefinition) {
if (lineDefinition instanceof VanMapReportDefinition) {
VanMapReportDefinition definition = (VanMapReportDefinition) lineDefinition;
ITContent lineContent = ITContent.copy(content);
//系列名&值
dealSeriesDefinition(formulaInfos, lineContent, definition.getSeriesList());
//经纬度
dealLongitudeAndLatitude(formulaInfos, lineContent, definition);
//终点经纬度
if (isFormulaString(definition.getEndLongitude())) {
ITContent longContent = ITContent.copy(lineContent);
longContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_End_Longitude"));
longContent.setReplaceObject(definition.getEndLongitude());
longContent.setTag(SearchTag.CHART_DATA_END_LONGITUDE);
longContent.setHoldObject(definition);
formulaInfos.add(new FormulaInfo(longContent));
}
if (isFormulaString(definition.getEndLatitude())) {
ITContent latitudeContent = ITContent.copy(lineContent);
latitudeContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_End_Latitude"));
latitudeContent.setReplaceObject(definition.getEndLatitude());
latitudeContent.setTag(SearchTag.CHART_DATA_END_LATITUDE);
latitudeContent.setHoldObject(definition);
formulaInfos.add(new FormulaInfo(latitudeContent));
}
if (isFormulaString(definition.getEndAreaName())) {
ITContent endAreaNameContent = ITContent.copy(lineContent);
endAreaNameContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_End_Area_Name"));
endAreaNameContent.setReplaceObject(definition.getEndAreaName());
endAreaNameContent.setTag(SearchTag.CHART_AREA_END_NAME);
endAreaNameContent.setHoldObject(definition);
formulaInfos.add(new FormulaInfo(endAreaNameContent));
}
//区域名
dealAreaName(formulaInfos, lineContent, definition.getCategoryName(), definition);
}
}
private void dealLongitudeAndLatitude(List<FormulaInfo> formulaInfos, ITContent content, VanMapReportDefinition definition) {
if (isFormulaString(definition.getLongitude())) {
ITContent longContent = ITContent.copy(content);
longContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Longitude"));
longContent.setReplaceObject(definition.getLongitude());
longContent.setTag(SearchTag.CHART_DATA_LONGITUDE);
longContent.setHoldObject(definition);
formulaInfos.add(new FormulaInfo(longContent));
}
if (isFormulaString(definition.getLatitude())) {
ITContent latitudeContent = ITContent.copy(content);
latitudeContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Latitude"));
latitudeContent.setReplaceObject(definition.getLatitude());
latitudeContent.setHoldObject(definition);
latitudeContent.setTag(SearchTag.CHART_DATA_LATITUDE);
formulaInfos.add(new FormulaInfo(latitudeContent));
}
}
/**
* 处理区域地图
*
* @param formulaInfos
* @param content
* @param areaDefinition
*/
public void dealAreaDefinition(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider areaDefinition) {
if (areaDefinition instanceof VanMapReportDefinition) {
VanMapReportDefinition reportDefinition = (VanMapReportDefinition) areaDefinition;
ITContent mapContent = ITContent.copy(content);
//系列名&值
dealSeriesDefinition(formulaInfos, mapContent, reportDefinition.getSeriesList());
//区域名
dealAreaName(formulaInfos, mapContent, reportDefinition.getCategoryName(), reportDefinition);
}
}
/**
* 处理点地图特有的
*
* @param formulaInfos
* @param content
* @param pointDefinition
*/
public void dealPointDefinition4Special(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider pointDefinition) {
if (pointDefinition instanceof VanMapReportDefinition) {
VanMapReportDefinition definition = (VanMapReportDefinition) pointDefinition;
ITContent pointContent = ITContent.copy(content);
//经纬度
dealLongitudeAndLatitude(formulaInfos, pointContent, definition);
}
}
/**
* 处理区域名
* @param formulaInfos
* @param content
* @param object
* @param definition
*/
public void dealAreaName(List<FormulaInfo> formulaInfos, ITContent content, Object object, VanMapReportDefinition definition) {
if (object instanceof Formula) {
ITContent cateContent = ITContent.copy(content);
cateContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Area_Name")
);
cateContent.setReplaceObject(object);
formulaInfos.add(new FormulaInfo(cateContent));
} else if (isFormulaString(object)) {
ITContent strContent = ITContent.copy(content);
strContent.setHoldObject(definition);
strContent.setTag(SearchTag.CHART_AREA_NAME);
strContent.setReplaceObject(object);
strContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Area_Name"));
formulaInfos.add(new FormulaInfo(strContent));
}
}
/**
* 处理系列名&
*/
public static void dealSeriesDefinition(List<FormulaInfo> formulaInfos, ITContent content, List<SeriesDefinition> seriesDefinitions) {
for (SeriesDefinition seriesDefinition : seriesDefinitions) {
if (seriesDefinition.getValue() instanceof Formula) {
ITContent valueContent = ITContent.copy(content);
valueContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Series_Value")
);
valueContent.setReplaceObject(seriesDefinition.getValue());
formulaInfos.add(new FormulaInfo(valueContent));
}
if (seriesDefinition.getSeriesName() instanceof Formula) {
ITContent nameContent = ITContent.copy(content);
nameContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Series_Name")
);
nameContent.setReplaceObject(seriesDefinition.getSeriesName());
formulaInfos.add(new FormulaInfo(nameContent));
}
}
}
/**
* 对外开放获取对象的方法
*
* @return
*/
public static SearchChartMapDataFormulaAction getInstance() {
return SearchChartMapDataFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchChartMapDataFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchChartMapDataFormulaAction instance;
SearchChartMapDataFormulaActionEnum() {
instance = new SearchChartMapDataFormulaAction();
}
/**
* 获取单例的方法
*
* @return
*/
public SearchChartMapDataFormulaAction getInstance() {
return instance;
}
}
}

68
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMeterDataFormulaAction.java

@ -0,0 +1,68 @@
package com.fr.design.actions.replace.action.content.formula.chart;
import com.fr.base.Formula;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartdata.MeterReportDefinition;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import java.util.List;
/**
* 漏斗图
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-21
*/
public class SearchChartMeterDataFormulaAction implements SearchChartDataFormula {
private SearchChartMeterDataFormulaAction() {
}
@Override
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
if (provider instanceof MeterReportDefinition) {
MeterReportDefinition definition = (MeterReportDefinition) provider;
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Series_Name"), definition.getName());
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Series_Value"), definition.getValue());
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Target_Value"), definition.getTarget());
}
}
/**
* 对外开放获取对象的方法
*
* @return
*/
public static SearchChartMeterDataFormulaAction getInstance() {
return SearchChartMeterDataFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchChartMeterDataFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchChartMeterDataFormulaAction instance;
SearchChartMeterDataFormulaActionEnum() {
instance = new SearchChartMeterDataFormulaAction();
}
/**
* 获取单例的方法
*
* @return
*/
public SearchChartMeterDataFormulaAction getInstance() {
return instance;
}
}
}

71
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartMultiPieDataFormulaAction.java

@ -0,0 +1,71 @@
package com.fr.design.actions.replace.action.content.formula.chart;
import com.fr.base.Formula;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.multilayer.data.MultiPieReportDataDefinition;
import java.util.List;
/**
* 层次图
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-21
*/
public class SearchChartMultiPieDataFormulaAction implements SearchChartDataFormula {
private SearchChartMultiPieDataFormulaAction() {
}
@Override
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
if (provider instanceof MultiPieReportDataDefinition) {
//层次
MultiPieReportDataDefinition definition = (MultiPieReportDataDefinition) provider;
for (int i = 0; i < definition.getLevelColumnNameList().size(); i++) {
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Level"), definition.getLevelColumnNameList().get(i));
}
//值字段
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Basic_Base_Value"), definition.getValue());
}
}
/**
* 对外开放获取对象的方法
*
* @return
*/
public static SearchChartMultiPieDataFormulaAction getInstance() {
return SearchChartMultiPieDataFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchChartMultiPieDataFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchChartMultiPieDataFormulaAction instance;
SearchChartMultiPieDataFormulaActionEnum() {
instance = new SearchChartMultiPieDataFormulaAction();
}
/**
* 获取单例的方法
*
* @return
*/
public SearchChartMultiPieDataFormulaAction getInstance() {
return instance;
}
}
}

65
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartNormalReportDataFormulaAction.java

@ -0,0 +1,65 @@
package com.fr.design.actions.replace.action.content.formula.chart;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartdata.NormalReportDataDefinition;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import java.util.List;
/**
* 组合图中的大部分类型
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-22
*/
public class SearchChartNormalReportDataFormulaAction implements SearchChartDataFormula {
private SearchChartNormalReportDataFormulaAction() {
}
@Override
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
if (provider instanceof NormalReportDataDefinition) {
NormalReportDataDefinition dataDefinition = (NormalReportDataDefinition) provider;
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Category_Name"), dataDefinition.getCategoryName());
SearchChartMapDataFormulaAction.dealSeriesDefinition(formulaInfos, content, dataDefinition.getSeriesList());
}
}
/**
* 对外开放获取对象的方法
*
* @return
*/
public static SearchChartNormalReportDataFormulaAction getInstance() {
return SearchChartNormalReportDataFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchChartNormalReportDataFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchChartNormalReportDataFormulaAction instance;
SearchChartNormalReportDataFormulaActionEnum() {
instance = new SearchChartNormalReportDataFormulaAction();
}
/**
* 获取单例的方法
*
* @return
*/
public SearchChartNormalReportDataFormulaAction getInstance() {
return instance;
}
}
}

69
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartStructureDataFormulaAction.java

@ -0,0 +1,69 @@
package com.fr.design.actions.replace.action.content.formula.chart;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.structure.data.StructureReportDefinition;
import java.util.List;
/**
* 框架图
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-21
*/
public class SearchChartStructureDataFormulaAction implements SearchChartDataFormula {
private SearchChartStructureDataFormulaAction() {
}
@Override
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
if (provider instanceof StructureReportDefinition) {
StructureReportDefinition definition = (StructureReportDefinition) provider;
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Node_Name"), definition.getNodeName());
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Node_Id"), definition.getNodeID());
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Parent_Node_Id"), definition.getParentID());
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Series_Value"), definition.getNodeValue());
}
}
/**
* 对外开放获取对象的方法
*
* @return
*/
public static SearchChartStructureDataFormulaAction getInstance() {
return SearchChartStructureDataFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchChartStructureDataFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchChartStructureDataFormulaAction instance;
SearchChartStructureDataFormulaActionEnum() {
instance = new SearchChartStructureDataFormulaAction();
}
/**
* 获取单例的方法
*
* @return
*/
public SearchChartStructureDataFormulaAction getInstance() {
return instance;
}
}
}

74
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartVanNormalDataFormulaAction.java

@ -0,0 +1,74 @@
package com.fr.design.actions.replace.action.content.formula.chart;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartdata.NormalReportDataDefinition;
import com.fr.chart.chartdata.SeriesDefinition;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import java.util.List;
/**
* 普通图表类型
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-21
*/
public class SearchChartVanNormalDataFormulaAction implements SearchChartDataFormula {
private SearchChartVanNormalDataFormulaAction() {
}
@Override
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
if (provider instanceof NormalReportDataDefinition) {
NormalReportDataDefinition normalReportDataDefinition = (NormalReportDataDefinition) provider;
//分类名
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Category_Name"), normalReportDataDefinition.getCategoryName());
//系列名&值
for (Object seriesDefinition : normalReportDataDefinition.getSeriesList()) {
if (seriesDefinition instanceof SeriesDefinition) {
SeriesDefinition definition = (SeriesDefinition) seriesDefinition;
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Series_Name"), definition.getSeriesName());
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Series_Value"), definition.getValue());
}
}
}
}
/**
* 对外开放获取对象的方法
*
* @return
*/
public static SearchChartVanNormalDataFormulaAction getInstance() {
return SearchChartNormalDataFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchChartNormalDataFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchChartVanNormalDataFormulaAction instance;
SearchChartNormalDataFormulaActionEnum() {
instance = new SearchChartVanNormalDataFormulaAction();
}
/**
* 获取单例的方法
*
* @return
*/
public SearchChartVanNormalDataFormulaAction getInstance() {
return instance;
}
}
}

63
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartWordCloudDataFormulaAction.java

@ -0,0 +1,63 @@
package com.fr.design.actions.replace.action.content.formula.chart;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.wordcloud.data.WordCloudReportDefinition;
import java.util.List;
/**
* 词云
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-21
*/
public class SearchChartWordCloudDataFormulaAction implements SearchChartDataFormula {
private SearchChartWordCloudDataFormulaAction() {
}
@Override
public void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
if (provider instanceof WordCloudReportDefinition) {
WordCloudReportDefinition definition = (WordCloudReportDefinition) provider;
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Word_Name"), definition.getWordName());
dealFormulaObject(formulaInfos, content, Toolkit.i18nText("Fine-Design_Chart_Word_Value"), definition.getWordValue());
}
}
/**
* 对外开放获取对象的方法
*
* @return
*/
public static SearchChartWordCloudDataFormulaAction getInstance() {
return SearchWordCloudDataFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchWordCloudDataFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchChartWordCloudDataFormulaAction instance;
SearchWordCloudDataFormulaActionEnum() {
instance = new SearchChartWordCloudDataFormulaAction();
}
/**
* 获取单例的方法
*
* @return
*/
public SearchChartWordCloudDataFormulaAction getInstance() {
return instance;
}
}
}

132
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/data/DataType.java

@ -0,0 +1,132 @@
package com.fr.design.actions.replace.action.content.formula.data;
import com.fr.base.Formula;
import com.fr.base.TableData;
import com.fr.data.impl.ConditionTableData;
import com.fr.data.impl.DBTableData;
import com.fr.data.impl.RecursionTableData;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* 分别对不同类型的数据集进行获取公式处理
* 暂不支持ClassTableData(用户自定义数据集)FileTableData(用户自定义数据集),EmbeddedTableData(无公式)
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-26
*/
public enum DataType {
/**
* 数据库查询
*/
DB_TABLE_DATA("DBTableData") {
@Override
public void searchFormula(TableData tableData, ITContent content, List<FormulaInfo> fomulaInfos) {
if (((DBTableData) tableData).getParameters() != null) {
for (ParameterProvider provider : ((DBTableData) tableData).getParameters()) {
dealProvider(provider, content, fomulaInfos);
}
}
}
},
/**
* 存储过程
*/
STORE_PROCEDURE("StoreProcedure") {
@Override
public void searchFormula(TableData tableData, ITContent content, List<FormulaInfo> fomulaInfos) {
if (((StoreProcedure) tableData).getParameters() != null) {
for (ParameterProvider provider : ((StoreProcedure) tableData).getParameters()) {
dealProvider(provider, content, fomulaInfos);
}
}
}
},
/**
* 关联数据集
*/
CONDITION_TABLE_DATA("ConditionTableData") {
@Override
public void searchFormula(TableData tableData, ITContent content, List<FormulaInfo> fomulaInfos) {
if (((ConditionTableData) tableData).getDefineParameters() != null) {
for (ParameterProvider provider : ((ConditionTableData) tableData).getDefineParameters()) {
dealProvider(provider, content, fomulaInfos);
}
}
}
},
/**
* 树数据集
*/
RECURSION_TABLE_DATA("RecursionTableData") {
@Override
public void searchFormula(TableData tableData, ITContent content, List<FormulaInfo> fomulaInfos) {
if (((RecursionTableData) tableData).getParameters() != null) {
for (ParameterProvider provider : ((RecursionTableData) tableData).getParameters()) {
dealProvider(provider, content, fomulaInfos);
}
}
}
};
String name;
DataType(String name) {
this.name = name;
}
/**
* 处理参数
*
* @param provider
* @param content
* @param formulaInfos
*/
public void dealProvider(ParameterProvider provider, ITContent content, List<FormulaInfo> formulaInfos) {
if (provider.getValue() instanceof Formula && StringUtils.isNotEmpty((((Formula) provider.getValue())).getContent())) {
ITContent newContent = ITContent.copy(content);
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Parameter"));
newContent.setReplaceObject(provider);
formulaInfos.add(new FormulaInfo(newContent));
}
}
/**
* 匹配
*
* @param name
* @return
*/
@Nullable
public static DataType match(String name) {
DataType[] values = DataType.values();
for (DataType value : values) {
if (value.name.equals(name)) {
return value;
}
}
return null;
}
/**
* 从数据集中获取公式
*
* @param tableData
* @param content
* @param formulaInfos
*/
abstract void searchFormula(TableData tableData, ITContent content, List<FormulaInfo> formulaInfos);
}

110
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/data/SearchDataFormulaAction.java

@ -0,0 +1,110 @@
package com.fr.design.actions.replace.action.content.formula.data;
import com.fr.data.TableDataSource;
import com.fr.design.actions.replace.action.content.formula.SearchFormula;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.data.tabledata.wrapper.TableDataFactory;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.file.TableDataConfig;
import java.util.Iterator;
import java.util.List;
/**
* 搜索数据集中的公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-26
*/
public class SearchDataFormulaAction implements SearchFormula {
private SearchDataFormulaAction() {
}
@Override
public void searchFormulaFromObject(JTemplate jTemplate, List<FormulaInfo> formulaInfos) {
//模板数据集
dealTemplateData(jTemplate, formulaInfos);
////服务器数据集二期再考虑
//dealServerData(formulaInfos);
}
private void dealServerData(List<FormulaInfo> fomulaInfos) {
TableDataConfig tableDataConfig = TableDataConfig.getInstance();
String[] nameArray = TableDataFactory.getSortOfChineseNameOfServerData(tableDataConfig);
for (String dataName : nameArray) {
ITContent content = new ITContent();
content.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData"),
dataName
);
content.setJumpAble(false);
content.setShowObject(Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData"));
DataType dataType = DataType.match(tableDataConfig.getTableData(dataName).getClass().getSimpleName());
if (dataType != null) {
dataType.searchFormula(tableDataConfig.getTableData(dataName), content, fomulaInfos);
}
}
}
private void dealTemplateData(JTemplate jTemplate, List<FormulaInfo> fomulaInfos) {
if (jTemplate.getTarget() instanceof TableDataSource) {
TableDataSource source = (TableDataSource) jTemplate.getTarget();
Iterator dataIterator = source.getTableDataNameIterator();
while (dataIterator.hasNext()) {
String dataName = (String) dataIterator.next();
ITContent content = new ITContent();
content.setTemplateName(jTemplate.getTemplateName());
content.setJumpAble(false);
content.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_DS_Report_TableData"),
dataName
);
content.setShowObject(Toolkit.i18nText("Fine-Design_Basic_DS_Report_TableData"));
DataType dataType = DataType.match(source.getTableData(dataName).getClass().getSimpleName());
if (dataType != null) {
dataType.searchFormula(source.getTableData(dataName), content, fomulaInfos);
}
}
}
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchDataFormulaAction getInstance() {
return SearchDataFormulaAction.SearchDataFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchDataFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchDataFormulaAction instance;
SearchDataFormulaActionEnum() {
instance = new SearchDataFormulaAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchDataFormulaAction getInstance() {
return instance;
}
}
}

33
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/floatelement/SearchFloatFormula.java

@ -0,0 +1,33 @@
package com.fr.design.actions.replace.action.content.formula.floatelement;
import com.fr.design.actions.replace.action.content.formula.SearchFormula;
import com.fr.design.actions.replace.info.FloatInfo;
import com.fr.design.actions.replace.info.FormulaInfo;
import java.util.List;
/**
* 搜索悬浮元素的公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-12
*/
public interface SearchFloatFormula extends SearchFormula {
/**
* 查找悬浮元素可能存在的共有的公式
*
* @param floatInfo FloatInfo信息
* @param formulaInfos 要存储对应信息列表的数据结构
*/
void searchFormulaFromCommonFloat(List<FormulaInfo> formulaInfos, FloatInfo floatInfo);
/**
* 查找不同悬浮元素内容类型各自可能存在的公式
*
* @param formulaInfos 要存储对应信息列表的数据结构
* @param floatInfo FloatInfo信息
*/
void searchFormulaFromFloatType(List<FormulaInfo> formulaInfos, FloatInfo floatInfo);
}

156
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/floatelement/SearchFloatFormulaAction.java

@ -0,0 +1,156 @@
package com.fr.design.actions.replace.action.content.formula.floatelement;
import com.fr.base.Formula;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.actions.replace.action.content.floatelement.SearchFloatAction;
import com.fr.design.actions.replace.action.content.formula.chart.SearchChartCollectionFormulaAction;
import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchJSHighlightAction;
import com.fr.design.actions.replace.info.FloatInfo;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.js.NameJavaScriptGroup;
import com.fr.report.cell.FloatElement;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* 搜索悬浮元素中的公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-12
*/
public class SearchFloatFormulaAction implements SearchFloatFormula {
private SearchFloatFormulaAction() {
}
@Override
public void searchFormulaFromObject(JTemplate jTemplate, List<FormulaInfo> formulaInfos) {
SearchFloatAction searchFloatAction = SearchFloatAction.getInstance();
searchFloatAction.search4Infos(jTemplate);
for (FloatInfo floatInfo : searchFloatAction.getFloatInfos()) {
searchFormulaFromCommonFloat(formulaInfos, floatInfo);
searchFormulaFromFloatType(formulaInfos, floatInfo);
}
}
@Override
public void searchFormulaFromCommonFloat(List<FormulaInfo> formulaInfos, FloatInfo floatInfo) {
NameJavaScriptGroup nameJavaScriptGroup = ((FloatElement) floatInfo.getContent().getReplaceObject()).getNameHyperlinkGroup();
if (nameJavaScriptGroup != null) {
for (int i = 0; i < nameJavaScriptGroup.size(); i++) {
SearchJSHighlightAction action = SearchJSHighlightAction.getInstance();
action.searchJSFormulaFromOther(formulaInfos, floatInfo.getContent(), nameJavaScriptGroup.getNameHyperlink(i).getJavaScript());
}
}
}
@Override
public void searchFormulaFromFloatType(List<FormulaInfo> formulaInfos, FloatInfo floatInfo) {
Object value = ((FloatElement) floatInfo.getContent().getReplaceObject()).getValue();
FloatFormulaType floatFormulaType = FloatFormulaType.match(value.getClass().getSimpleName());
if (floatFormulaType != null) {
floatFormulaType.searchFormulaFromFloatElementType(formulaInfos, floatInfo);
}
}
/**
* 悬浮元素的类型
*/
public enum FloatFormulaType {
/**
* 公式
*/
FORMULA("Formula") {
@Override
public void searchFormulaFromFloatElementType(List<FormulaInfo> formulaInfos, FloatInfo floatInfo) {
ITContent content = ITContent.copy(floatInfo.getContent());
Formula value = (Formula) ((FloatElement) floatInfo.getContent().getReplaceObject()).getValue();
content.setReplaceObject(value);
formulaInfos.add(new FormulaInfo(content));
}
},
/**
* 图表
*/
CHART_COLLECTION("ChartCollection") {
@Override
public void searchFormulaFromFloatElementType(List<FormulaInfo> formulaInfos, FloatInfo floatInfo) {
ITContent content = ITContent.copy(floatInfo.getContent());
ChartCollection chartCollection = (ChartCollection) ((FloatElement) floatInfo.getContent().getReplaceObject()).getValue();
content.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Chart"));
SearchChartCollectionFormulaAction.getInstance().searchChartCollectionFormula(formulaInfos, content, chartCollection);
}
};
String name;
FloatFormulaType(String name) {
this.name = name;
}
/**
* 匹配
*
* @param name
* @return
*/
@Nullable
public static FloatFormulaType match(String name) {
FloatFormulaType[] values = FloatFormulaType.values();
for (FloatFormulaType value : values) {
if (value.name.equals(name)) {
return value;
}
}
return null;
}
/**
* 从特殊类型的悬浮元素值中获取到所需的公式
*
* @param formulaInfos
* @param floatInfo
*/
abstract public void searchFormulaFromFloatElementType(List<FormulaInfo> formulaInfos, FloatInfo floatInfo);
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchFloatFormulaAction getInstance() {
return SearchFloatFormulaAction.SearchFloatFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 单例实现枚举
*/
private enum SearchFloatFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchFloatFormulaAction instance;
SearchFloatFormulaActionEnum() {
instance = new SearchFloatFormulaAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchFloatFormulaAction getInstance() {
return instance;
}
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save