Browse Source

Merge remote-tracking branch 'origin/feature/x' into feature/x

feature/x
Link.Zhao 2 years ago
parent
commit
4315b0cd01
  1. 14
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  2. 7
      designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java
  3. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java
  4. 1
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  5. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java
  6. 8
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  7. 16
      designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java
  8. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/picture_widget_16.png
  9. BIN
      designer-base/src/main/resources/com/fr/design/images/form/designer/widget/picture_widget_designer_bg.png
  10. 2
      designer-form/src/main/java/com/fr/design/actions/NewFormAction.java
  11. 23
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  12. 2
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  13. 74
      designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java
  14. 111
      designer-form/src/main/java/com/fr/design/designer/ui/ImgPanel.java
  15. 4
      designer-form/src/main/java/com/fr/design/fit/NewJForm.java
  16. 77
      designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessiblePictureModelEditor.java
  17. 57
      designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleUrlLinkModelEditor.java
  18. 17
      designer-form/src/main/java/com/fr/design/mainframe/widget/editors/PictureEditor.java
  19. 17
      designer-form/src/main/java/com/fr/design/mainframe/widget/editors/UrlLinkEditor.java
  20. 15
      designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/PictureRenderer.java
  21. 16
      designer-form/src/main/java/com/fr/design/mainframe/widget/renderer/UrlLinkRenderer.java
  22. 34
      designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/PictureModelWrapper.java
  23. 33
      designer-form/src/main/java/com/fr/design/mainframe/widget/wrappers/UrlLinkModelWrapper.java
  24. 63
      designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java
  25. 23
      designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchAction.java
  26. 30
      designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchManager.java
  27. 211
      designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchManagerCenter.java
  28. 409
      designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java
  29. 34
      designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowValue.java
  30. 221
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/cell/SearchCellAction.java
  31. 350
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/component/ComponentType.java
  32. 173
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/component/SearchComponentAction.java
  33. 132
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/floatelement/SearchFloatAction.java
  34. 403
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java
  35. 38
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/SearchFormula.java
  36. 106
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/SearchFormulaManager.java
  37. 38
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormula.java
  38. 283
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaAction.java
  39. 110
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaManager.java
  40. 62
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaTypeAction.java
  41. 156
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchDSColumnFormulaAction.java
  42. 79
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchRichFormulaAction.java
  43. 70
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchSubReportFormulaAction.java
  44. 259
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java
  45. 132
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/data/DataType.java
  46. 108
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/data/SearchDataFormulaAction.java
  47. 33
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/floatelement/SearchFloatFormula.java
  48. 156
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/floatelement/SearchFloatFormulaAction.java
  49. 30
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/SearchHighlightFormula.java
  50. 65
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/SearchHighlightFormulaAction.java
  51. 103
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/SearchHighlightFormulaManager.java
  52. 66
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchCommonConditionAction.java
  53. 26
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchConditionFormula.java
  54. 106
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchConditionManager.java
  55. 66
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchFormulaConditionAction.java
  56. 76
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchListConditionAction.java
  57. 65
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchObjectConditionAction.java
  58. 126
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java
  59. 88
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchExportJSFormulaAction.java
  60. 43
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchJSFormula.java
  61. 119
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchJSFormulaManager.java
  62. 120
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchJSHighlightAction.java
  63. 69
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchMobileHyperlinkFormulaAction.java
  64. 36
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/template/SearchTemplateFormula.java
  65. 105
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/template/SearchTemplateFormulaAction.java
  66. 73
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/AbstractSearchWidgetFormulaAction.java
  67. 26
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/DictionaryAction.java
  68. 117
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/DictionaryType.java
  69. 60
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchCommonWidgetFormulaAction.java
  70. 86
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchDateEditorFormulaAction.java
  71. 77
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchDictFormulaAction.java
  72. 113
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchTreeEditorFormulaAction.java
  73. 42
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormula.java
  74. 128
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaAction.java
  75. 144
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaManager.java
  76. 155
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchCellJSAction.java
  77. 129
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchChartJSAction.java
  78. 88
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchFloatJSAction.java
  79. 26
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchJS.java
  80. 119
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchJSManager.java
  81. 172
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchWebJSAction.java
  82. 92
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchWidgetJSAction.java
  83. 141
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/sql/SearchSQLAction.java
  84. 190
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/widget/FrmWidgetType.java
  85. 26
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/widget/SearchFrmWidget.java
  86. 205
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/widget/SearchWidgetAction.java
  87. 366
      designer-realize/src/main/java/com/fr/design/actions/replace/info/CellInfo.java
  88. 76
      designer-realize/src/main/java/com/fr/design/actions/replace/info/ComponentInfo.java
  89. 47
      designer-realize/src/main/java/com/fr/design/actions/replace/info/DealWithInfoValue.java
  90. 128
      designer-realize/src/main/java/com/fr/design/actions/replace/info/FloatInfo.java
  91. 80
      designer-realize/src/main/java/com/fr/design/actions/replace/info/FormulaInfo.java
  92. 45
      designer-realize/src/main/java/com/fr/design/actions/replace/info/Info.java
  93. 99
      designer-realize/src/main/java/com/fr/design/actions/replace/info/JSInfo.java
  94. 218
      designer-realize/src/main/java/com/fr/design/actions/replace/info/ReplaceObject.java
  95. 71
      designer-realize/src/main/java/com/fr/design/actions/replace/info/SQLInfo.java
  96. 128
      designer-realize/src/main/java/com/fr/design/actions/replace/info/WidgetInfo.java
  97. 285
      designer-realize/src/main/java/com/fr/design/actions/replace/info/base/ITContent.java
  98. 118
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITComboBoxEditor.java
  99. 302
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java
  100. 368
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java
  101. Some files were not shown because too many files have changed in this diff Show More

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

@ -41,6 +41,8 @@ public class HistoryTemplateListCache implements CallbackEvent {
private List<JTemplate<?, ?>> historyList;
private JTemplate<?, ?> editingTemplate;
private JTemplate<?, ?> openingOrEditingTemplate;
public static HistoryTemplateListCache getInstance() {
return Holder.INSTANCE;
}
@ -98,8 +100,15 @@ public class HistoryTemplateListCache implements CallbackEvent {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
public void setCurrentOpeningTemplate(JTemplate<?, ?> jt) {
this.openingOrEditingTemplate = jt;
}
public JTemplate<?, ?> getCurrentOpeningOrEditingTemplate() {
return openingOrEditingTemplate;
}
/**
* 需要使用 {@link JTemplate#isValid(JTemplate)} 来判断空
*
@ -116,6 +125,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
*/
public void setCurrentEditingTemplate(JTemplate<?, ?> jt) {
this.editingTemplate = jt;
this.openingOrEditingTemplate = jt;
if (!JTemplate.isValid(jt)) {
return;

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

@ -1,7 +1,6 @@
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;
@ -15,7 +14,6 @@ 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;
@ -144,7 +142,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,PICTURE};
NUMBEREDITOR, TREECOMBOBOX, RADIOGROUP, CHECKBOXGROUP, TEXTAREA, PASSWORD, CHECKBOX, TREE, MULTI_FILEEDITOR};
}
public static final WidgetOption DATEEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Date"),
@ -216,7 +214,4 @@ 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/frpane/HyperlinkGroupPaneActionProvider.java

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

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

@ -190,6 +190,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public JTemplate(T t, FILE file, boolean isNewFile, Parameter[] parameters) {
super(t);
HistoryTemplateListCache.getInstance().setCurrentOpeningTemplate(this);
if (isNewFile) {
// REPORT-58486: 必须在初始的UndoState创建前设置主题,使得初始的UndoState就包含了主题效果
setUpTheme4NewTemplate();

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

@ -32,7 +32,7 @@ public class DefaultThemedTemplateCellElementCase {
}
private static DefaultTemplateCellElement themingCellElement(DefaultTemplateCellElement cellElement) {
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentOpeningOrEditingTemplate();
if (JTemplate.isValid(template)) {
TemplateTheme theme = template.getTemplateTheme();
ThemedCellStyle themedCellStyle = theme.getCellStyleList().getUse4Default();

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]);
}

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

@ -47,6 +47,7 @@ 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 Class<? extends HierarchyTreePane> formHierarchyPaneCls;
@ -69,7 +70,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 +118,19 @@ public class DesignModuleFactory {
return instance.newFormAction;
}
/**
* 注册一下查找替换
*
* @param r
*/
public static void registerReplaceActionClass(Class r) {
instance.ITReplaceAction = r;
}
public static Class getITReplaceAction() {
return instance.ITReplaceAction;
}
public static void registerParaPropertyPaneClass(Class p) {
instance.paraPropertyPane = p;
}

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

Binary file not shown.

Before

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.

Before

Width:  |  Height:  |  Size: 4.8 KiB

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;
}
}
/**
* 将所选组件剪切到剪切板上
*/

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

@ -47,7 +47,6 @@ 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;
@ -184,7 +183,6 @@ 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() {

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

@ -1,74 +0,0 @@
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;
}
}

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

@ -1,111 +0,0 @@
package com.fr.design.designer.ui;
import com.fr.general.ImageWithSuffix;
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 void setBackgroundImage(Image image) {
this.backgroundImage = image;
repaint();
}
public Image getBackgroundImage() {
return this.backgroundImage;
}
public void setImageDisplayMode(int modeName) {
if (modeName == 1) {
this.modeIndex = 0;
}
if (modeName == 0) {
this.imageDisplayMode = 0;
this.modeIndex = 1;
}
if (modeName == 2) {
this.imageDisplayMode = 2;
this.modeIndex = 2;
}
if (modeName == 4) {
this.imageDisplayMode = 4;
this.modeIndex = 3;
}
repaint();
}
public int getImageDisplayMode() {
return this.imageDisplayMode;
}
@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);
}
}
}
}

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);
}

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

@ -1,77 +0,0 @@
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

@ -1,57 +0,0 @@
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

@ -1,17 +0,0 @@
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

@ -1,17 +0,0 @@
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

@ -1,15 +0,0 @@
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

@ -1,16 +0,0 @@
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

@ -1,34 +0,0 @@
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

@ -1,33 +0,0 @@
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;
}
}

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

@ -0,0 +1,63 @@
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.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;
}
}
}

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

@ -0,0 +1,409 @@
package com.fr.design.actions.replace.action;
import com.fr.chart.chartattr.ChartCollection;
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.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++) {
String titleName = GeneralUtils.objectToString(chartCollection.getChart(i).getTitle().getTextObject());
if (titleName.contains(str)) {
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 (content.contains(str) && StringUtils.isNotEmpty(content)) {
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);
}
},
/**
* 搜索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.isEmpty(map.get(objectNameKey))) {
String name = map.get(objectNameKey);
if (name.contains(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 (content.contains(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 (content.contains(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++) {
String titleName = GeneralUtils.objectToString(chartCollection.getChart(i).getTitle().getTextObject());
if (titleName.contains(str)) {
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 (GeneralUtils.objectToString(floatElement.getValue()).contains(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 (content.contains(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) && name.contains(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) && waterMark.contains(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 (name.contains(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;
}
}

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);
}

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

@ -0,0 +1,221 @@
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());
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;
}
}
}

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

@ -0,0 +1,350 @@
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;
}
}

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

@ -0,0 +1,173 @@
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.addTRL(jTemplate.getTemplateName());
content.setFrmFlag(true);
//参数面板
dealPara(componentInfos, content, form.getParaContainer());
//body面板
dealBody(componentInfos, content, form.getBody());
}
setComponentInfos(componentInfos);
}
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;
}
}
}

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

@ -0,0 +1,132 @@
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.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.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);
}
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;
}
}
}

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

@ -0,0 +1,403 @@
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.iofile.attr.WatermarkAttr;
import com.fr.base.present.FormulaPresent;
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.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.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));
}
},
/**
* 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));
}
},
/**
* 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));
}
}
},
/**
* 富文本
*/
RICH_CHAR("RichChar") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (o[0] instanceof RichChar) {
if (StringUtils.isNotEmpty(((RichChar) o[0]).getText())) {
map.put("content", (((RichChar) o[0]).getText()));
}
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
if (replaceObject instanceof RichChar) {
RichChar richChar = (RichChar) replaceObject;
info.updateOldStr(richChar.getText(), findStr);
richChar.setText(ShowValueUtils.replaceAll(richChar.getText(), findStr, replaceStr));
}
}
},
/**
* 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));
}
},
/**
* 插入策略
*/
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));
}
},
/**
* present
*/
PRESENT("Present") {
@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));
}
},
/**
* 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));
}
},
/**
* 参数
*/
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));
}
},
/**
* 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));
}
},
/**
* 参数
*/
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));
}
},
/**
* 数据列
*/
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));
}
},
/**
* 公式类型
*/
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));
}
},
/**
* 存储过程的参数
*/
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));
}
},
/**
* 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);
}
};
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;
}
@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) {
}
}

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

@ -0,0 +1,283 @@
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.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.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 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);
//单元格属性-其他-插入策略
searchCellInsertPolicy4Formula(cellInfo, formulaInfos);
//单元格条件属性-参数-公式
searchCellConditionPara4Formula(cellInfo, formulaInfos);
//单元格条件属性-属性-参数
searchCellHighlightPara4Formula(cellInfo, formulaInfos);
//单元格超链
searchCellHyperLink4Formula(cellInfo, formulaInfos);
}
}
}
}
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());
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;
}
}
}

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

@ -0,0 +1,110 @@
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(RICH_TEXT, SearchRichFormulaAction.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().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;
}
}
}

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

@ -0,0 +1,259 @@
package com.fr.design.actions.replace.action.content.formula.chart;
import com.fr.base.Formula;
import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Title;
import com.fr.chart.chartdata.NormalChartData;
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.attr.axis.VanChartAlertValue;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartValueAxis;
import java.util.List;
/**
* 图表类型获取公式汇总
*
* @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));
//数据-单元格数据-分类名&系列名&值
searchChartDataFormula(formulaInfos, content, chartCollection.getChart(i));
}
}
private void searchChartDataFormula(List<FormulaInfo> formulaInfos, ITContent content, Chart chart) {
if (chart.defaultChartData() instanceof NormalChartData) {
NormalChartData chartData = (NormalChartData) chart.defaultChartData();
//todo
}
}
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) {
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) {
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;
}
}
}

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);
}

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

@ -0,0 +1,108 @@
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.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.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;
}
}
}

30
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/SearchHighlightFormula.java

@ -0,0 +1,30 @@
package com.fr.design.actions.replace.action.content.formula.highlight;
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.report.cell.cellattr.highlight.HighlightAction;
import java.util.List;
/**
* 从条件属性中搜索公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-18
*/
public interface SearchHighlightFormula extends SearchFormula {
/**
* 处理条件属性中各种属性
*
* @param content
* @param formulaInfos
* @param highlightAction
*/
default void dealWithHighlightAction(ITContent content, List<FormulaInfo> formulaInfos, HighlightAction highlightAction) {
}
}

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

@ -0,0 +1,65 @@
package com.fr.design.actions.replace.action.content.formula.highlight;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.report.cell.cellattr.highlight.HighlightAction;
import java.util.List;
import java.util.Map;
/**
* 处理条件属性中各种属性的公式超级链接控件...
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-18
*/
public class SearchHighlightFormulaAction implements SearchHighlightFormula {
private SearchHighlightFormulaAction() {
}
@Override
public void dealWithHighlightAction(ITContent content, List<FormulaInfo> formulaInfos, HighlightAction highlightAction) {
Map<String, SearchHighlightFormula> highlightType = SearchHighlightFormulaManager.getInstance().getHighlightType();
if (highlightType.containsKey(highlightAction.getClass().getSimpleName())) {
SearchHighlightFormula searchHighlight = highlightType.get(highlightAction.getClass().getSimpleName());
searchHighlight.dealWithHighlightAction(content, formulaInfos, highlightAction);
}
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchHighlightFormulaAction getInstance() {
return SearchHighlightFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchHighlightFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchHighlightFormulaAction instance;
SearchHighlightFormulaActionEnum() {
instance = new SearchHighlightFormulaAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchHighlightFormulaAction getInstance() {
return instance;
}
}
}

103
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/SearchHighlightFormulaManager.java

@ -0,0 +1,103 @@
package com.fr.design.actions.replace.action.content.formula.highlight;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.action.SearchManager;
import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchJSHighlightAction;
import java.util.HashMap;
import java.util.Map;
/**
* 管理要搜索的条件属性类型公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-16
*/
public class SearchHighlightFormulaManager implements SearchManager {
private Map<String, SearchHighlightFormula> highlightType = new HashMap<>();
public static final String HYPERLINK_HIGHLIGHT_ACTION = "HyperlinkHighlightAction";
private SearchHighlightFormulaManager() {
//这边控件类型不做处理,在SearchWidgetFormulaAction统一处理即可
//条件属性-超级链接
register(HYPERLINK_HIGHLIGHT_ACTION, SearchJSHighlightAction.getInstance());
//条件属性-...
// TODO: 2022/9/14 条件属性的其他类型
}
@Override
public void registerAction(String tag, SearchAction searchAction) {
if (searchAction instanceof SearchHighlightFormula){
register(tag, (SearchHighlightFormula) searchAction);
}
}
@Override
public void removeAction(String tag) {
remove(tag);
}
/**
* 注册
*
* @param tag 用于匹配的类型tag
* @param searchHighlightFormula 对应的实现类
*/
private void register(String tag, SearchHighlightFormula searchHighlightFormula) {
highlightType.put(tag, searchHighlightFormula);
}
/**
* 注销
*
* @param tag 用于匹配的tag
*/
private void remove(String tag) {
highlightType.remove(tag);
}
/**
* 获取单元格类型
*
* @return
*/
public Map<String, SearchHighlightFormula> getHighlightType() {
return highlightType;
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchHighlightFormulaManager getInstance() {
return SearchHighlightFormulaManagerEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchHighlightFormulaManagerEnum {
/**
* 单例
*/
SINGLETON;
private SearchHighlightFormulaManager instance;
SearchHighlightFormulaManagerEnum() {
instance = new SearchHighlightFormulaManager();
}
/**
* 获取单例对象
*
* @return
*/
public SearchHighlightFormulaManager getInstance() {
return instance;
}
}
}

66
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchCommonConditionAction.java

@ -0,0 +1,66 @@
package com.fr.design.actions.replace.action.content.formula.highlight.condition;
import com.fr.base.Formula;
import com.fr.data.condition.CommonCondition;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.general.data.Condition;
import java.util.List;
/**
* 获取CommonCondition中的公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-17
*/
public class SearchCommonConditionAction implements SearchConditionFormula {
private SearchCommonConditionAction() {
}
@Override
public void searchFormulaFromCondition(List<FormulaInfo> formulaInfos, ITContent content, Condition condition) {
if (((CommonCondition) condition).getCompare().getValue() instanceof Formula) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(((CommonCondition) condition).getCompare());
formulaInfos.add(new FormulaInfo(newContent));
}
}
/**
* 获取单例
*
* @return
*/
public static SearchCommonConditionAction getInstance() {
return SearchCommonConditionActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchCommonConditionActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchCommonConditionAction instance;
SearchCommonConditionActionEnum() {
instance = new SearchCommonConditionAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchCommonConditionAction getInstance() {
return instance;
}
}
}

26
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchConditionFormula.java

@ -0,0 +1,26 @@
package com.fr.design.actions.replace.action.content.formula.highlight.condition;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.general.data.Condition;
import java.util.List;
/**
* 从条件相关对象中拿公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-17
*/
public interface SearchConditionFormula {
/**
* 从条件相关对象中获取公式
*
* @param formulaInfos
* @param content
* @param condition
*/
void searchFormulaFromCondition(List<FormulaInfo> formulaInfos, ITContent content, Condition condition);
}

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

@ -0,0 +1,106 @@
package com.fr.design.actions.replace.action.content.formula.highlight.condition;
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 SearchConditionManager implements SearchManager {
private Map<String, SearchConditionFormula> conditionType = new HashMap<>();
public static final String FORMULA_CONDITION = "FormulaCondition";
public static final String OBJECT_CONDITION = "ObjectCondition";
public static final String LIST_CONDITION = "ListCondition";
public static final String COMMON_CONDITION = "CommonCondition";
private SearchConditionManager() {
register(FORMULA_CONDITION, SearchFormulaConditionAction.getInstance());
register(OBJECT_CONDITION, SearchObjectConditionAction.getInstance());
register(LIST_CONDITION, SearchListConditionAction.getInstance());
register(COMMON_CONDITION, SearchCommonConditionAction.getInstance());
}
@Override
public void registerAction(String tag, SearchAction searchAction) {
if (searchAction instanceof SearchConditionFormula) {
register(tag, (SearchConditionFormula) searchAction);
}
}
@Override
public void removeAction(String tag) {
remove(tag);
}
/**
* 注册
*
* @param tag 用于匹配的类型tag
* @param searchConditionFormula 对应的实现类
*/
private void register(String tag, SearchConditionFormula searchConditionFormula) {
conditionType.put(tag, searchConditionFormula);
}
/**
* 注销
*
* @param tag 用于匹配的tag
*/
private void remove(String tag) {
conditionType.remove(tag);
}
/**
* 获取类型
*
* @return
*/
public Map<String, SearchConditionFormula> getConditionType() {
return conditionType;
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchConditionManager getInstance() {
return SearchConditionManagerEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchConditionManagerEnum {
/**
* 单例
*/
SINGLETON;
private SearchConditionManager instance;
SearchConditionManagerEnum() {
instance = new SearchConditionManager();
}
/**
* 获取单例对象
*
* @return
*/
public SearchConditionManager getInstance() {
return instance;
}
}
}

66
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchFormulaConditionAction.java

@ -0,0 +1,66 @@
package com.fr.design.actions.replace.action.content.formula.highlight.condition;
import com.fr.data.condition.FormulaCondition;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.general.data.Condition;
import java.util.List;
/**
* 获取FormulaCondition公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-17
*/
public class SearchFormulaConditionAction implements SearchConditionFormula {
private SearchFormulaConditionAction() {
}
@Override
public void searchFormulaFromCondition(List<FormulaInfo> formulaInfos, ITContent content, Condition condition) {
if (((FormulaCondition) (condition)).getFormula() != null) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(condition);
formulaInfos.add(new FormulaInfo(newContent));
}
}
/**
* 获取单例
*
* @return
*/
public static SearchFormulaConditionAction getInstance() {
return SearchFormulaConditionActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchFormulaConditionActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchFormulaConditionAction instance;
SearchFormulaConditionActionEnum() {
instance = new SearchFormulaConditionAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchFormulaConditionAction getInstance() {
return instance;
}
}
}

76
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchListConditionAction.java

@ -0,0 +1,76 @@
package com.fr.design.actions.replace.action.content.formula.highlight.condition;
import com.fr.data.condition.CommonCondition;
import com.fr.data.condition.FormulaCondition;
import com.fr.data.condition.ListCondition;
import com.fr.data.condition.ObjectCondition;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.general.data.Condition;
import java.util.List;
/**
* 获取ListCondition公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-17
*/
public class SearchListConditionAction implements SearchConditionFormula {
private SearchListConditionAction() {
}
@Override
public void searchFormulaFromCondition(List<FormulaInfo> formulaInfos, ITContent content, Condition condition) {
for (int i = 0; i < ((ListCondition) condition).getJoinConditionCount(); i++) {
Condition joinCondition = ((ListCondition) condition).getJoinCondition(i).getCondition();
if (joinCondition instanceof CommonCondition) {
SearchCommonConditionAction commonConditionAction = SearchCommonConditionAction.getInstance();
commonConditionAction.searchFormulaFromCondition(formulaInfos, content, joinCondition);
} else if (joinCondition instanceof FormulaCondition) {
SearchFormulaConditionAction formulaConditionAction = SearchFormulaConditionAction.getInstance();
formulaConditionAction.searchFormulaFromCondition(formulaInfos, content, joinCondition);
} else if (joinCondition instanceof ObjectCondition) {
SearchObjectConditionAction objectConditionAction = SearchObjectConditionAction.getInstance();
objectConditionAction.searchFormulaFromCondition(formulaInfos, content, joinCondition);
}
}
}
/**
* 获取单例
*
* @return
*/
public static SearchListConditionAction getInstance() {
return SearchListConditionActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchListConditionActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchListConditionAction instance;
SearchListConditionActionEnum() {
instance = new SearchListConditionAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchListConditionAction getInstance() {
return instance;
}
}
}

65
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchObjectConditionAction.java

@ -0,0 +1,65 @@
package com.fr.design.actions.replace.action.content.formula.highlight.condition;
import com.fr.base.Formula;
import com.fr.data.condition.ObjectCondition;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.general.data.Condition;
import java.util.List;
/**
* 获取ObjectCondition类型公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-18
*/
public class SearchObjectConditionAction implements SearchConditionFormula {
private SearchObjectConditionAction() {
}
@Override
public void searchFormulaFromCondition(List<FormulaInfo> formulaInfos, ITContent content, Condition condition) {
if (((ObjectCondition) condition).getCompare().getValue() != null && ((ObjectCondition) condition).getCompare().getValue() instanceof Formula) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(((ObjectCondition) condition).getCompare());
formulaInfos.add(new FormulaInfo(newContent));
}
}
/**
* 获取单例
*
* @return
*/
public static SearchObjectConditionAction getInstance() {
return SearchObjectConditionActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchObjectConditionActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchObjectConditionAction instance;
SearchObjectConditionActionEnum() {
instance = new SearchObjectConditionAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchObjectConditionAction getInstance() {
return instance;
}
}
}

126
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java

@ -0,0 +1,126 @@
package com.fr.design.actions.replace.action.content.formula.highlight.javascript;
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.js.Commit2DBJavaScript;
import com.fr.js.JavaScript;
import com.fr.write.DBManipulation;
import com.fr.write.DMLConfigJob;
import com.fr.write.config.DMLConfig;
import java.util.List;
import java.util.Map;
/**
* 获取提交入库中的公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-19
*/
public class SearchCommit2DBJSFormulaAction implements SearchJSFormula {
private SearchCommit2DBJSFormulaAction() {
}
@Override
public void searchJSFormulaFromOther(List<FormulaInfo> formulaInfos, ITContent content, JavaScript javaScript) {
if (!((Commit2DBJavaScript) javaScript).getDBManipulation().isEmpty()) {
//处理回调函数——这里单独摘出来是因为这边逻辑比较复杂,提交事件会再循环产生一个新的DBManipulation,后续统一处理
dealWithCallBack(formulaInfos, content, ((Commit2DBJavaScript) javaScript));
//处理DBManipulation
for (int i = 0; i < ((Commit2DBJavaScript) javaScript).getDBManipulation().size(); i++) {
dealWithDBManipulation(formulaInfos, content, (DBManipulation) ((Commit2DBJavaScript) javaScript).getDBManipulation().get(i));
}
}
}
private void dealWithDBManipulation(List<FormulaInfo> formulaInfos, ITContent content, DBManipulation dbManipulation) {
DMLConfig dmlConfig = dbManipulation.getDmlConfig();
//处理提交条件中的公式
dealWithCommit2DBCondition(formulaInfos, content, dmlConfig);
//处理DBManipulation
dealWithSubmitJob(formulaInfos, content, dmlConfig);
}
private void dealWithSubmitJob(List<FormulaInfo> formulaInfos, ITContent content, DMLConfig dmlConfig) {
for (int i = 0; i < dmlConfig.getSubmitJobCount(); i++) {
//这边自定义事件不需要处理,只处理提交事件
if (dmlConfig.getSubmitJob(i) instanceof DMLConfigJob) {
ITContent newContent = ITContent.copy(content);
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Write_Submit_Event")
);
dealWithDBManipulation(formulaInfos, newContent, (((DMLConfigJob) dmlConfig.getSubmitJob(i)).getDBManipulation()));
}
}
}
private void dealWithCallBack(List<FormulaInfo> formulaInfos, ITContent content, Commit2DBJavaScript javaScript) {
if (javaScript.getCallBack() != null) {
SearchJSHighlightAction jsHighlightAction = SearchJSHighlightAction.getInstance();
ITContent newContent = ITContent.copy(content);
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Set_Callback_Function")
);
jsHighlightAction.searchJSFormulaFromOther(formulaInfos, newContent, javaScript.getCallBack());
}
}
private void dealWithCommit2DBCondition(List<FormulaInfo> formulaInfos, ITContent content, DMLConfig dmlConfig) {
if (dmlConfig.getCondition() != null) {
//这边condition有三种情况:FormulaCondition、CommonCondition、ListCondition,分别处理
Condition condition = dmlConfig.getCondition();
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_Basic_Submit_Condition")
);
searchCondition.searchFormulaFromCondition(formulaInfos, newContent, condition);
}
}
}
/**
* 获取单例
*
* @return
*/
public static SearchCommit2DBJSFormulaAction getInstance() {
return SearchCommit2DBJSFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchCommit2DBJSFormulaActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchCommit2DBJSFormulaAction instance;
SearchCommit2DBJSFormulaActionEnum() {
instance = new SearchCommit2DBJSFormulaAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchCommit2DBJSFormulaAction getInstance() {
return instance;
}
}
}

88
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchExportJSFormulaAction.java

@ -0,0 +1,88 @@
package com.fr.design.actions.replace.action.content.formula.highlight.javascript;
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.js.ExportJavaScript;
import com.fr.js.JavaScript;
import com.fr.js.SingleJavaScript;
import java.util.List;
/**
* 获取导出事件的公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-19
*/
public class SearchExportJSFormulaAction implements SearchJSFormula {
private SearchExportJSFormulaAction() {
}
@Override
public void searchJSFormulaFromOther(List<FormulaInfo> formulaInfos, ITContent content, JavaScript javaScript) {
//如果导出当前模板,可以存公式的地方就是命名方式-自定义
if (((ExportJavaScript) javaScript).isCurrentTemplate()) {
dealSingleJavaScript(formulaInfos, content, ((ExportJavaScript) javaScript).getCurrentTemplateJavaScript());
} else {
List<SingleJavaScript> list = ((ExportJavaScript) javaScript).getJsListForOtherTemplates();
if (isListExist(list)) {
for (SingleJavaScript singleJavaScript : list) {
dealSingleJavaScript(formulaInfos, content, singleJavaScript);
}
}
}
}
public boolean isListExist(List<SingleJavaScript> list) {
return list != null && list.size() > 0;
}
private void dealSingleJavaScript(List<FormulaInfo> formulaInfos, ITContent content, SingleJavaScript javaScript) {
if (!javaScript.isDefaultFileName()) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(javaScript);
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Export_JS_Event"),
Toolkit.i18nText("Fine-Design_Basic_Export_JS_Filename")
);
formulaInfos.add(new FormulaInfo(newContent));
}
}
/**
* 获取单例
*
* @return
*/
public static SearchExportJSFormulaAction getInstance() {
return SearchExportJSFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchExportJSFormulaActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchExportJSFormulaAction instance;
SearchExportJSFormulaActionEnum() {
instance = new SearchExportJSFormulaAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchExportJSFormulaAction getInstance() {
return instance;
}
}
}

43
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchJSFormula.java

@ -0,0 +1,43 @@
package com.fr.design.actions.replace.action.content.formula.highlight.javascript;
import com.fr.design.actions.replace.action.content.formula.highlight.SearchHighlightFormula;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.js.JavaScript;
import java.util.List;
/**
* 获取各种类型JS的公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-18
*/
public interface SearchJSFormula extends SearchHighlightFormula {
/**
* 对各种类型的JS分别处理获取各自其他地方的公式
*
* @param formulaInfos
* @param content
* @param javaScript
*/
default void searchJSFormulaFromOther(List<FormulaInfo> formulaInfos, ITContent content, JavaScript javaScript) {
}
/**
* 从超链中的参数获取公式
*
* @param formulaInfos
* @param content
* @param javaScript
*/
default void addFormulaInfosFromJSPara(List<FormulaInfo> formulaInfos, ITContent content, JavaScript javaScript) {
}
}

119
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchJSFormulaManager.java

@ -0,0 +1,119 @@
package com.fr.design.actions.replace.action.content.formula.highlight.javascript;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.action.SearchManager;
import java.util.HashMap;
import java.util.Map;
/**
* 管理JS公式的注册
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-16
*/
public class SearchJSFormulaManager implements SearchManager {
private static Map<String, SearchJSFormula> javaScriptType = new HashMap<>();
public static final String COMMIT_2_DB_JAVASCRIPT = "Commit2DBJavaScript";
public static final String EXPORT_JAVASCRIPT = "ExportJavaScript";
public static final String MOBILE_POPUP_HYPERLINK = "MobilePopupHyperlink";
private SearchJSFormulaManager() {
//控件事件里面需要特殊处理的类型
//EmailJavaScript(这个暂时不做处理)
//ExportJavaScript
//MobilePopupHyperlink
//Commit2DBJavaScript
//单元格条件属性里面需要处理的类型
//WebHyperlink——只有参数可以放公式,不需要特殊处理
//ReportletHyperlink——只有参数可以放公式,不需要特殊处理
//EmailJavaScript(这个暂时不做处理)
//ParameterJavaScript——只有参数可以放公式,不需要特殊处理
//JavaScriptImpl——只有参数可以放公式,不需要特殊处理
//MobilePopupHyperlink
//ChartHyperPoplink
//ChartHyperRelateCellLink
//ChartHyperRelateFloatLink
register(COMMIT_2_DB_JAVASCRIPT, SearchCommit2DBJSFormulaAction.getInstance());
register(EXPORT_JAVASCRIPT, SearchExportJSFormulaAction.getInstance());
register(MOBILE_POPUP_HYPERLINK, SearchMobileHyperlinkFormulaAction.getInstance());
}
@Override
public void registerAction(String tag, SearchAction searchAction) {
if (searchAction instanceof SearchJSFormula) {
register(tag, (SearchJSFormula) searchAction);
}
}
@Override
public void removeAction(String tag) {
remove(tag);
}
/**
* 注册
*
* @param tag 用于匹配的类型tag
* @param searchJSFormula 对应的实现类
*/
private void register(String tag, SearchJSFormula searchJSFormula) {
javaScriptType.put(tag, searchJSFormula);
}
/**
* 注销
*
* @param tag 用于匹配的tag
*/
private void remove(String tag) {
javaScriptType.remove(tag);
}
/**
* 获取类型
*
* @return
*/
public Map<String, SearchJSFormula> getJSType() {
return javaScriptType;
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchJSFormulaManager getInstance() {
return SearchJSFormulaManagerEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchJSFormulaManagerEnum {
/**
* 单例
*/
SINGLETON;
private SearchJSFormulaManager instance;
SearchJSFormulaManagerEnum() {
instance = new SearchJSFormulaManager();
}
/**
* 获取单例对象
*
* @return
*/
public SearchJSFormulaManager getInstance() {
return instance;
}
}
}

120
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchJSHighlightAction.java

@ -0,0 +1,120 @@
package com.fr.design.actions.replace.action.content.formula.highlight.javascript;
import com.fr.base.Formula;
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.js.JavaScript;
import com.fr.js.NameJavaScriptGroup;
import com.fr.report.cell.cellattr.highlight.HighlightAction;
import com.fr.report.cell.cellattr.highlight.HyperlinkHighlightAction;
import com.fr.stable.ParameterProvider;
import java.util.List;
import java.util.Map;
/**
* 处理条件属性中各种超级链接内的公式也包括事件中的各种超链
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-18
*/
public class SearchJSHighlightAction implements SearchJSFormula {
private SearchJSHighlightAction() {
}
@Override
public void dealWithHighlightAction(ITContent content, List<FormulaInfo> formulaInfos, HighlightAction highlightAction) {
NameJavaScriptGroup nameJavaScriptGroup = ((HyperlinkHighlightAction) highlightAction).getHperlink();
if (nameJavaScriptGroup != null) {
for (int i = 0; i < nameJavaScriptGroup.size(); i++) {
//单元格条件属性-属性-超级链接里面参数的公式统一判断获取一下
ITContent newContent = ITContent.copy(content);
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Cell"),
Toolkit.i18nText("Fine-Design_Basic_Condition_Attributes"),
nameJavaScriptGroup.getNameHyperlink(i).getName()
);
addFormulaInfosFromJSPara(formulaInfos, newContent, nameJavaScriptGroup.getNameHyperlink(i).getJavaScript());
}
}
}
/**
* 仅仅获取JS中的参数中的公式
*
* @param formulaInfos
* @param content
* @param javaScript
*/
@Override
public void addFormulaInfosFromJSPara(List<FormulaInfo> formulaInfos, ITContent content, JavaScript javaScript) {
if (javaScript.getParameters() != null) {
for (ParameterProvider provider : javaScript.getParameters()) {
if (provider.getValue() instanceof Formula) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(provider);
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Parameters"));
formulaInfos.add(new FormulaInfo(newContent));
}
}
}
}
/**
* 对各种类型的JS分别处理获取公式
*
* @param formulaInfos
* @param content
* @param javaScript
*/
@Override
public void searchJSFormulaFromOther(List<FormulaInfo> formulaInfos, ITContent content, JavaScript javaScript) {
//获取JS中的参数中的公式
addFormulaInfosFromJSPara(formulaInfos, content, javaScript);
Map<String, SearchJSFormula> javaScriptType = SearchJSFormulaManager.getInstance().getJSType();
//这里面类型比较多,但是一部分不用处理——公式可能存在的地方只有参数,这部分在addFormulaInfosFromJSPara中就已经把公式拿完了
if (javaScriptType.containsKey(javaScript.getClass().getSimpleName())) {
SearchJSFormula javaScriptFormula = javaScriptType.get(javaScript.getClass().getSimpleName());
javaScriptFormula.searchJSFormulaFromOther(formulaInfos, content, javaScript);
}
}
/**
* 获取单例
*
* @return
*/
public static SearchJSHighlightAction getInstance() {
return SearchJSHighlightActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchJSHighlightActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchJSHighlightAction instance;
SearchJSHighlightActionEnum() {
instance = new SearchJSHighlightAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchJSHighlightAction getInstance() {
return instance;
}
}
}

69
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchMobileHyperlinkFormulaAction.java

@ -0,0 +1,69 @@
package com.fr.design.actions.replace.action.content.formula.highlight.javascript;
import com.fr.base.Formula;
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.js.JavaScript;
import com.fr.js.MobilePopupHyperlink;
import java.util.List;
/**
* 获取移动端弹窗相关公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-19
*/
public class SearchMobileHyperlinkFormulaAction implements SearchJSFormula {
private SearchMobileHyperlinkFormulaAction() {
}
@Override
public void searchJSFormulaFromOther(List<FormulaInfo> formulaInfos, ITContent content, JavaScript javaScript) {
if (((MobilePopupHyperlink) javaScript).getPopupText() instanceof Formula) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(((MobilePopupHyperlink) javaScript).getPopupText());
newContent.addOtherPos(
Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup"),
Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Text")
);
formulaInfos.add(new FormulaInfo(newContent));
}
}
/**
* 获取单例
*
* @return
*/
public static SearchMobileHyperlinkFormulaAction getInstance() {
return SearchMobileHyperlinkFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchMobileHyperlinkFormulaActionEnum {
/**
* 单例实现
*/
SINGLETON;
private SearchMobileHyperlinkFormulaAction instance;
SearchMobileHyperlinkFormulaActionEnum() {
instance = new SearchMobileHyperlinkFormulaAction();
}
/**
* 拿到对象
*
* @return
*/
public SearchMobileHyperlinkFormulaAction getInstance() {
return instance;
}
}
}

36
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/template/SearchTemplateFormula.java

@ -0,0 +1,36 @@
package com.fr.design.actions.replace.action.content.formula.template;
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-09-12
*/
public interface SearchTemplateFormula extends SearchFormula {
/**
* 搜索全局水印中的公式
*
* @param jTemplate
* @param formulaInfos
* @param content
*/
void searchTemplateWaterMarkFormula(JTemplate jTemplate, List<FormulaInfo> formulaInfos, ITContent content);
/**
* 搜索全局参数中的公式
*
* @param jTemplate
* @param formulaInfos
* @param content
*/
void searchTemplateParaFormula(JTemplate jTemplate, List<FormulaInfo> formulaInfos, ITContent content);
}

105
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/template/SearchTemplateFormulaAction.java

@ -0,0 +1,105 @@
package com.fr.design.actions.replace.action.content.formula.template;
import com.fr.base.Formula;
import com.fr.base.Parameter;
import com.fr.base.ParameterConfig;
import com.fr.base.io.AttrMark;
import com.fr.base.iofile.attr.WatermarkAttr;
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.report.core.ReportUtils;
import java.util.List;
/**
* 搜索模板的全局相关内容
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-12
*/
public class SearchTemplateFormulaAction implements SearchTemplateFormula {
private SearchTemplateFormulaAction() {
}
@Override
public void searchFormulaFromObject(JTemplate jTemplate, List<FormulaInfo> formulaInfos) {
ITContent content = new ITContent();
content.setTemplateName(jTemplate.getTemplateName());
searchTemplateParaFormula(jTemplate, formulaInfos, content);
searchTemplateWaterMarkFormula(jTemplate, formulaInfos, content);
}
@Override
public void searchTemplateWaterMarkFormula(JTemplate jTemplate, List<FormulaInfo> formulaInfos, ITContent content) {
WatermarkAttr watermarkAttr = ReportUtils.getWatermarkAttrFromTemplateAndGlobal((AttrMark) jTemplate.getTarget());
if (watermarkAttr != null) {
ITContent waterMarkContent = ITContent.copy(content);
waterMarkContent.addOtherPos(Toolkit.i18nText("Fine-Design_Form_WaterMark"));
waterMarkContent.setReplaceObject(watermarkAttr);
formulaInfos.add(new FormulaInfo(waterMarkContent));
}
}
@Override
public void searchTemplateParaFormula(JTemplate jTemplate, List<FormulaInfo> formulaInfos, ITContent content) {
Parameter[] parameters = jTemplate.getJTemplateParameters();
for (Parameter parameter : parameters) {
if (parameter.getValue() instanceof Formula) {
ITContent paraContent = ITContent.copy(content);
paraContent.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Template_Parameter"));
paraContent.setReplaceObject(parameter.getValue());
formulaInfos.add(new FormulaInfo(paraContent));
}
}
Parameter[] globalParameters = ParameterConfig.getInstance().getGlobalParameters();
for (Parameter parameter : globalParameters) {
if (parameter.getValue() instanceof Formula) {
ITContent paraContent = ITContent.copy(content);
paraContent.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Parameter_Source_Type_Server"));
paraContent.setReplaceObject(parameter.getValue());
formulaInfos.add(new FormulaInfo(paraContent));
}
}
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchTemplateFormulaAction getInstance() {
return SearchTemplateFormulaAction.SearchTemplateFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 单例实现枚举
*/
enum SearchTemplateFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchTemplateFormulaAction instance;
SearchTemplateFormulaActionEnum() {
instance = new SearchTemplateFormulaAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchTemplateFormulaAction getInstance() {
return instance;
}
}
}

73
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/AbstractSearchWidgetFormulaAction.java

@ -0,0 +1,73 @@
package com.fr.design.actions.replace.action.content.formula.widget;
import com.fr.base.Formula;
import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchJSHighlightAction;
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.form.event.Listener;
import com.fr.form.ui.DataControl;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import java.util.List;
/**
* 处理共有控件内容
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-19
*/
public abstract class AbstractSearchWidgetFormulaAction implements SearchWidgetFormula {
/**
* 用于处理控件共有的事件以及控件值中的公式
*
* @param content
* @param formulaInfos
*/
@Override
public void searchFormulaFromWidget(ITContent content, List<FormulaInfo> formulaInfos) {
Widget widget = (Widget) content.getReplaceObject();
//控件值中的公式
searchFormulaFromWidgetValue(content, formulaInfos);
for (int i = 0; i < widget.getListenerSize(); i++) {
Listener listener = widget.getListener(i);
ITContent newContent = ITContent.copy(content);
//控件的事件可以使用的JS有五种,这边统一交给Highlight那边判断超级链接并进行处理
SearchJSHighlightAction jsHighlightAction = SearchJSHighlightAction.getInstance();
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Event"),listener.getName());
jsHighlightAction.searchJSFormulaFromOther(formulaInfos, newContent, listener.getAction());
}
}
/**
* 判断一下控件有没有控件值接口如果有再判断一下控件值是否已经设置并且是公式
*
* @param content
* @param formulaInfos
*/
@Override
public void searchFormulaFromWidgetValue(ITContent content, List<FormulaInfo> formulaInfos) {
Widget widget = (Widget) content.getReplaceObject();
if (widget instanceof WScaleLayout){
widget = ((CRBoundsWidget)((WScaleLayout)widget).getWidget(0)).getWidget();
}
if (widget instanceof DataControl) {
if (isWidgetValueValid(((DataControl) widget))) {
ITContent newContent = ITContent.copy(content);
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Widget_Value"));
newContent.setReplaceObject(((DataControl) widget).getWidgetValue().getValue());
formulaInfos.add(new FormulaInfo(newContent));
}
}
}
private boolean isWidgetValueValid(DataControl control){
return control.getWidgetValue() != null
&& control.getWidgetValue().getValue() instanceof Formula;
}
}

26
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/DictionaryAction.java

@ -0,0 +1,26 @@
package com.fr.design.actions.replace.action.content.formula.widget;
import com.fr.data.Dictionary;
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-08-22
*/
public interface DictionaryAction {
/**
* 从数据字典中获取公式
*
* @param content
* @param formulaInfos
* @param dictionary
*/
void searchFormulaFromDictionary(ITContent content, List<FormulaInfo> formulaInfos, Dictionary dictionary);
}

117
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/DictionaryType.java

@ -0,0 +1,117 @@
package com.fr.design.actions.replace.action.content.formula.widget;
import com.fr.data.Dictionary;
import com.fr.data.impl.DatabaseDictionary;
import com.fr.data.impl.FormulaDictionary;
import com.fr.data.impl.TableDataDictionary;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* 数据字典处理
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-22
*/
public enum DictionaryType implements DictionaryAction {
/**
* 数据字典公式
*/
FORMULA_DICTIONARY("FormulaDictionary") {
@Override
public void searchFormulaFromDictionary(ITContent content, List<FormulaInfo> formulaInfos, Dictionary dictionary) {
if (dictionary instanceof FormulaDictionary) {
FormulaDictionary formulaDictionary = (FormulaDictionary) dictionary;
//显示值
if (formulaDictionary.getExcuteFormula() != null) {
ITContent excuteContent = ITContent.copy(content);
excuteContent.setReplaceObject(dictionary);
excuteContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"),
Toolkit.i18nText("Fine-Design_Basic_Formula"),
Toolkit.i18nText("Fine-Design_Basic_Display_Value")
);
formulaInfos.add(new FormulaInfo(excuteContent));
}
//实际值
if (formulaDictionary.getProduceFormula() != null) {
ITContent produceContent = ITContent.copy(content);
produceContent.setReplaceObject(dictionary);
produceContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"),
Toolkit.i18nText("Fine-Design_Basic_Formula"),
Toolkit.i18nText("Fine-Design_Basic_Actual_Value")
);
formulaInfos.add(new FormulaInfo(produceContent));
}
}
}
},
/**
* 数据查询
*/
TABLE_DATA_DICTIONARY("TableDataDictionary") {
@Override
public void searchFormulaFromDictionary(ITContent content, List<FormulaInfo> formulaInfos, Dictionary dictionary) {
if (((TableDataDictionary) dictionary).getFormula() != null) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(((TableDataDictionary) dictionary).getFormula());
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"),
Toolkit.i18nText("Fine-Design_Basic_Dic_Data_Query"),
Toolkit.i18nText("Fine-Design_Basic_Display_Value")
);
formulaInfos.add(new FormulaInfo(newContent));
}
}
},
/**
* 数据库表
*/
DATABASE_DICTIONARY("DatabaseDictionary") {
@Override
public void searchFormulaFromDictionary(ITContent content, List<FormulaInfo> formulaInfos, Dictionary dictionary) {
if (((DatabaseDictionary) dictionary).getFormula() != null) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(((DatabaseDictionary) dictionary).getFormula());
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"),
Toolkit.i18nText("Fine-Design_Basic_Datasource_From_Database"),
Toolkit.i18nText("Fine-Design_Basic_Display_Value")
);
formulaInfos.add(new FormulaInfo(newContent));
}
}
};
String name;
DictionaryType(String name) {
this.name = name;
}
/**
* 匹配
*
* @param name
* @return
*/
@Nullable
public static DictionaryType match(String name) {
DictionaryType[] values = DictionaryType.values();
for (DictionaryType value : values) {
if (value.name.equals(name)) {
return value;
}
}
return null;
}
}

60
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchCommonWidgetFormulaAction.java

@ -0,0 +1,60 @@
package com.fr.design.actions.replace.action.content.formula.widget;
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-08-19
*/
public class SearchCommonWidgetFormulaAction extends AbstractSearchWidgetFormulaAction {
private SearchCommonWidgetFormulaAction() {
}
@Override
public void searchFormulaFromWidget(ITContent content, List<FormulaInfo> formulaInfos) {
//每个事件的事件、控件值两部分的公式获取逻辑是一样的,直接调用即可,各自其他地方的公式就需要特殊处理
super.searchFormulaFromWidget(content, formulaInfos);
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchCommonWidgetFormulaAction getInstance() {
return SearchCommonWidgetFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchCommonWidgetFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchCommonWidgetFormulaAction instance;
SearchCommonWidgetFormulaActionEnum() {
instance = new SearchCommonWidgetFormulaAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchCommonWidgetFormulaAction getInstance() {
return instance;
}
}
}

86
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchDateEditorFormulaAction.java

@ -0,0 +1,86 @@
package com.fr.design.actions.replace.action.content.formula.widget;
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.form.ui.DateEditor;
import org.gradle.internal.impldep.org.apache.commons.lang.StringUtils;
import java.util.List;
/**
* 日期类型控件特殊处理
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-26
*/
public class SearchDateEditorFormulaAction extends AbstractSearchWidgetFormulaAction {
private SearchDateEditorFormulaAction() {
}
@Override
public void searchFormulaFromWidget(ITContent content, List<FormulaInfo> formulaInfos) {
super.searchFormulaFromWidget(content, formulaInfos);
dealStratDateFormula(content, formulaInfos);
dealEndDateFormula(content, formulaInfos);
}
private void dealEndDateFormula(ITContent content, List<FormulaInfo> formulaInfos) {
DateEditor dateEditor = (DateEditor) content.getReplaceObject();
if (dateEditor.getEndDateFM() != null && StringUtils.isNotEmpty(dateEditor.getEndDateFM().getContent())) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(dateEditor.getEndDateFM());
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_End_Time"));
formulaInfos.add(new FormulaInfo(newContent));
}
}
private void dealStratDateFormula(ITContent content, List<FormulaInfo> formulaInfos) {
DateEditor dateEditor = (DateEditor) content.getReplaceObject();
if (dateEditor.getStartDateFM() != null && StringUtils.isNotEmpty(dateEditor.getStartDateFM().getContent())) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(dateEditor.getStartDateFM());
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Start_Time"));
formulaInfos.add(new FormulaInfo(newContent));
}
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchDateEditorFormulaAction getInstance() {
return SearchDateEditorFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchDateEditorFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchDateEditorFormulaAction instance;
SearchDateEditorFormulaActionEnum() {
instance = new SearchDateEditorFormulaAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchDateEditorFormulaAction getInstance() {
return instance;
}
}
}

77
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchDictFormulaAction.java

@ -0,0 +1,77 @@
package com.fr.design.actions.replace.action.content.formula.widget;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.form.ui.DictionaryContainer;
import java.util.List;
/**
* 控件中的公式会存在 控件值 非树形结构数据字典 事件
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-20
*/
public class SearchDictFormulaAction extends AbstractSearchWidgetFormulaAction {
private SearchDictFormulaAction() {
}
@Override
public void searchFormulaFromWidget(ITContent content, List<FormulaInfo> formulaInfos) {
//控件值、事件
super.searchFormulaFromWidget(content, formulaInfos);
//数据字典
searchFormulaFromDict(content, formulaInfos);
}
private void searchFormulaFromDict(ITContent content, List<FormulaInfo> formulaInfos) {
if (content.getReplaceObject() instanceof DictionaryContainer) {
if (((DictionaryContainer) content.getReplaceObject()).getDictionary() != null) {
DictionaryType type = DictionaryType.match(((DictionaryContainer) content.getReplaceObject()).getDictionary().getClass().getSimpleName());
if (type != null) {
type.searchFormulaFromDictionary(content, formulaInfos, ((DictionaryContainer) content.getReplaceObject()).getDictionary());
}
}
}
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchDictFormulaAction getInstance() {
return SearchDictFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchDictFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchDictFormulaAction instance;
SearchDictFormulaActionEnum() {
instance = new SearchDictFormulaAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchDictFormulaAction getInstance() {
return instance;
}
}
}

113
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchTreeEditorFormulaAction.java

@ -0,0 +1,113 @@
package com.fr.design.actions.replace.action.content.formula.widget;
import com.fr.data.impl.FormulaDisplayDictionary;
import com.fr.data.impl.TreeNodeAttr;
import com.fr.data.impl.TreeNodeWrapper;
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.form.ui.TreeEditor;
import com.fr.form.ui.tree.LayerConfig;
import com.fr.stable.StringUtils;
import java.util.List;
/**
* 搜索树形结构数据字典的公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-22
*/
public class SearchTreeEditorFormulaAction extends AbstractSearchWidgetFormulaAction {
private SearchTreeEditorFormulaAction() {
}
@Override
public void searchFormulaFromWidget(ITContent content, List<FormulaInfo> formulaInfos) {
//控件值、事件
super.searchFormulaFromWidget(content, formulaInfos);
//树形结构数据字典
SearchFormulaFromModelConfig(content, formulaInfos);
}
private void SearchFormulaFromModelConfig(ITContent content, List<FormulaInfo> formulaInfos) {
if (((TreeEditor) content.getReplaceObject()).getBuildModelConfig() != null) {
//LayerConfig[] 急速分层构建
//TreeNodeWrapper 普通分层构建
if (((TreeEditor) content.getReplaceObject()).getBuildModelConfig() instanceof LayerConfig[]) {
LayerConfig[] layerConfigs = (LayerConfig[]) ((TreeEditor) content.getReplaceObject()).getBuildModelConfig();
dealWithLayerConfigs(layerConfigs, content, formulaInfos);
} else if (((TreeEditor) content.getReplaceObject()).getBuildModelConfig() instanceof TreeNodeWrapper) {
TreeNodeWrapper wrapper = (TreeNodeWrapper) ((TreeEditor) content.getReplaceObject()).getBuildModelConfig();
dealWithTreeNodeWrapper(wrapper, content, formulaInfos);
}
}
}
private void dealWithTreeNodeWrapper(TreeNodeWrapper wrapper, ITContent content, List<FormulaInfo> formulaInfos) {
for (TreeNodeAttr attr : wrapper.getTreeNodeAttrs()) {
if (((FormulaDisplayDictionary) attr.getDictionary()).getFormula() != null
&& StringUtils.isNotEmpty(((FormulaDisplayDictionary) attr.getDictionary()).getFormula().getContent())) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(((FormulaDisplayDictionary) attr.getDictionary()).getFormula());
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"),
Toolkit.i18nText("Fine-Design_Basic_Layer_Build")
);
formulaInfos.add(new FormulaInfo(newContent));
}
}
}
private void dealWithLayerConfigs(LayerConfig[] layerConfigs, ITContent content, List<FormulaInfo> formulaInfos) {
for (LayerConfig layerConfig : layerConfigs) {
if (layerConfig.getDictionary().getFormula() != null
&& StringUtils.isNotEmpty(layerConfig.getDictionary().getFormula().getContent())) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(layerConfig.getDictionary().getFormula());
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary"),
Toolkit.i18nText("Fine-Design_Basic_DataTable_Build")
);
formulaInfos.add(new FormulaInfo(newContent));
}
}
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchTreeEditorFormulaAction getInstance() {
return SearchTreeEditorFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchTreeEditorFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchTreeEditorFormulaAction instance;
SearchTreeEditorFormulaActionEnum() {
instance = new SearchTreeEditorFormulaAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchTreeEditorFormulaAction getInstance() {
return instance;
}
}
}

42
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormula.java

@ -0,0 +1,42 @@
package com.fr.design.actions.replace.action.content.formula.widget;
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.Info;
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-08-19
*/
public interface SearchWidgetFormula extends SearchFormula {
/**
* 从WidgetInfos列表中搜索所有公式
* @param info 对应的Info信息列表
* @param formulaInfos 要存储进去的公式信息列表
*/
default void searchFormulaFromWidgetInfos(Info info, List<FormulaInfo> formulaInfos){}
/**
* 从控件的不同类型中获取公式
*
* @param content 对应的ITContent数据结构
* @param formulaInfos 要存储进去的公式信息列表
*/
void searchFormulaFromWidget(ITContent content, List<FormulaInfo> formulaInfos);
/**
* 从控件值中获取公式
*
* @param content 对应的ITContent数据结构
* @param formulaInfos 要存储进去的公式信息列表
*/
void searchFormulaFromWidgetValue(ITContent content, List<FormulaInfo> formulaInfos);
}

128
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaAction.java

@ -0,0 +1,128 @@
package com.fr.design.actions.replace.action.content.formula.widget;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.actions.replace.action.content.component.SearchComponentAction;
import com.fr.design.actions.replace.action.content.formula.chart.SearchChartCollectionFormulaAction;
import com.fr.design.actions.replace.action.content.widget.SearchWidgetAction;
import com.fr.design.actions.replace.info.ComponentInfo;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.info.WidgetInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.mainframe.JTemplate;
import com.fr.form.main.Form;
import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.main.impl.WorkBook;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 查找控件内的公式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-19
*/
public class SearchWidgetFormulaAction extends AbstractSearchWidgetFormulaAction {
private SearchWidgetFormulaAction() {
}
@Override
public void searchFormulaFromObject(JTemplate jTemplate, List<FormulaInfo> formulaInfos) {
List<FormulaInfo> result = new ArrayList<>();
if (jTemplate.getTarget() instanceof WorkBook) {
SearchWidgetAction searchWidgetAction = SearchWidgetAction.getInstance();
searchWidgetAction.search4Infos(jTemplate);
if (!searchWidgetAction.isWidgetInfosEmpty()) {
for (WidgetInfo widgetInfo : searchWidgetAction.getWidgetInfos()) {
//由于控件类型比较多,各种控件也不大相同,可能存放公式的地方也都不一样,这边根据对应的类型进行处理
searchFormulaFromWidgetInfos(widgetInfo, result);
}
}
} else if (jTemplate.getTarget() instanceof Form) {
SearchComponentAction searchComponentAction = SearchComponentAction.getInstance();
searchComponentAction.search4Infos(jTemplate);
if (ShowValueUtils.isNotEmpty(searchComponentAction.getComponentInfos())) {
for (ComponentInfo componentInfo : searchComponentAction.getComponentInfos()) {
searchFormulaFromWidgetInfos(componentInfo, formulaInfos);
}
}
}
formulaInfos.addAll(result);
}
@Override
public void searchFormulaFromWidgetInfos(Info info, List<FormulaInfo> formulaInfos) {
if (isReplaceObjectExist(info)) {
searchFormulaFromWidgetValue(info, formulaInfos);
}
}
private void searchFormulaFromWidgetValue(Info info, List<FormulaInfo> formulaInfos) {
Widget widget = (Widget) info.getContent().getReplaceObject();
if (widget instanceof WScaleLayout) {
widget = ((CRBoundsWidget) ((WScaleLayout) widget).getWidget(0)).getWidget();
}
if (widget instanceof WTitleLayout) {
widget = ((CRBoundsWidget) ((WTitleLayout) widget).getWidget(0)).getWidget();
if (widget instanceof ChartEditor && ((ChartEditor) widget).getChartCollection() instanceof ChartCollection) {
SearchChartCollectionFormulaAction.getInstance().searchChartCollectionFormula(formulaInfos, info.getContent(), (ChartCollection) ((ChartEditor) widget).getChartCollection());
}
}
Map<String, SearchWidgetFormula> widgetType = SearchWidgetFormulaManager.getInstance().getWidgetType();
if (widgetType.containsKey(widget.getClass().getSimpleName())) {
SearchWidgetFormula searchWidgetFormula = widgetType.get(widget.getClass().getSimpleName());
ITContent content = ITContent.copy(info.getContent());
searchWidgetFormula.searchFormulaFromWidget(content, formulaInfos);
}
}
public boolean isReplaceObjectExist(Info info) {
return info.getContent() != null && info.getContent().getReplaceObject() != null;
}
/**
* 对外开放的获取对象的方法
*
* @return
*/
public static SearchWidgetFormulaAction getInstance() {
return SearchWidgetFormulaAction.SearchWidgetFormulaActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchWidgetFormulaActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchWidgetFormulaAction instance;
SearchWidgetFormulaActionEnum() {
instance = new SearchWidgetFormulaAction();
}
/**
* 获取对象
*
* @return
*/
public SearchWidgetFormulaAction getInstance() {
return instance;
}
}
}

144
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchWidgetFormulaManager.java

@ -0,0 +1,144 @@
package com.fr.design.actions.replace.action.content.formula.widget;
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 SearchWidgetFormulaManager implements SearchManager {
private Map<String, SearchWidgetFormula> widgetType = new HashMap<>();
private static final String FORM_SUBMIT_BUTTON = "FormSubmitButton";
private static final String W_PARAMETER_LAYOUT = "WParameterLayout";
private static final String TEXT_AREA = "TextArea";
private static final String PASSWORD = "Password";
private static final String CHECK_BOX = "CheckBox";
private static final String LABEL = "Label";
private static final String FREE_BUTTON = "FreeButton";
private static final String NUMBER_EDITOR = "NumberEditor";
private static final String TEXT_EDITOR = "TextEditor";
private static final String DATE_EDITOR = "DateEditor";
private static final String COMBO_BOX = "ComboBox";
private static final String RADIO_GROUP = "RadioGroup";
private static final String CHECK_BOX_GROUP = "CheckBoxGroup";
private static final String COMBO_CHECK_BOX = "ComboCheckBox";
private static final String PAGE_FIXED_ROW_COMBOBOX = "PageFixedRowComboBox";
private static final String TREE_COMBO_BOX_EDITOR = "TreeComboBoxEditor";
private static final String TREE_EDITOR = "TreeEditor";
private SearchWidgetFormulaManager() {
/**
* 可能有控件值 有事件
*/
register(FORM_SUBMIT_BUTTON, SearchCommonWidgetFormulaAction.getInstance());
register(W_PARAMETER_LAYOUT, SearchCommonWidgetFormulaAction.getInstance());
register(TEXT_AREA, SearchCommonWidgetFormulaAction.getInstance());
register(PASSWORD, SearchCommonWidgetFormulaAction.getInstance());
register(CHECK_BOX, SearchCommonWidgetFormulaAction.getInstance());
register(LABEL, SearchCommonWidgetFormulaAction.getInstance());
register(FREE_BUTTON, SearchCommonWidgetFormulaAction.getInstance());
register(NUMBER_EDITOR, SearchCommonWidgetFormulaAction.getInstance());
register(TEXT_EDITOR, SearchCommonWidgetFormulaAction.getInstance());
/**
* 日期类型
*/
register(DATE_EDITOR, SearchDateEditorFormulaAction.getInstance());
/**
* 控件值事件非树形数据字典
*/
register(COMBO_BOX, SearchDictFormulaAction.getInstance());
register(RADIO_GROUP, SearchDictFormulaAction.getInstance());
register(CHECK_BOX_GROUP, SearchDictFormulaAction.getInstance());
register(COMBO_CHECK_BOX, SearchDictFormulaAction.getInstance());
register(PAGE_FIXED_ROW_COMBOBOX, SearchDictFormulaAction.getInstance());
/**
* 控件值事件树形数据字典
*/
register(TREE_COMBO_BOX_EDITOR, SearchTreeEditorFormulaAction.getInstance());
register(TREE_EDITOR, SearchTreeEditorFormulaAction.getInstance());
}
@Override
public void registerAction(String tag, SearchAction searchAction) {
if (searchAction instanceof SearchWidgetFormula) {
register(tag, (SearchWidgetFormula) searchAction);
}
}
@Override
public void removeAction(String tag) {
remove(tag);
}
/**
* 注册
*
* @param tag 用于匹配的类型tag
* @param searchWidgetFormula 对应的实现类
*/
private void register(String tag, SearchWidgetFormula searchWidgetFormula) {
widgetType.put(tag, searchWidgetFormula);
}
/**
* 注销
*
* @param tag 用于匹配的tag
*/
private void remove(String tag) {
widgetType.remove(tag);
}
/**
* 获取单元格类型
*
* @return
*/
public Map<String, SearchWidgetFormula> getWidgetType() {
return widgetType;
}
/**
* 对外开放的获取单例对象的方法
*
* @return
*/
public static SearchWidgetFormulaManager getInstance() {
return SearchWidgetFormulaManagerEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchWidgetFormulaManagerEnum {
/**
* 单例
*/
SINGLETON;
private SearchWidgetFormulaManager instance;
SearchWidgetFormulaManagerEnum() {
instance = new SearchWidgetFormulaManager();
}
/**
* 获取单例对象
*
* @return
*/
public SearchWidgetFormulaManager getInstance() {
return instance;
}
}
}

155
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchCellJSAction.java

@ -0,0 +1,155 @@
package com.fr.design.actions.replace.action.content.js;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.actions.replace.action.content.cell.SearchCellAction;
import com.fr.design.actions.replace.info.CellInfo;
import com.fr.design.actions.replace.info.JSInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.utils.SearchJSUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.js.JavaScriptImpl;
import com.fr.js.NameJavaScriptGroup;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.highlight.DefaultHighlight;
import com.fr.report.cell.cellattr.highlight.HighlightAction;
import com.fr.report.cell.cellattr.highlight.HyperlinkHighlightAction;
import java.util.ArrayList;
import java.util.List;
/**
* 搜索单元格JS
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-13
*/
public class SearchCellJSAction implements SearchJS {
private SearchCellJSAction() {
}
@Override
public void searchJSFromObject(JTemplate jTemplate, List<JSInfo> jsInfos) {
List<JSInfo> CellJSInfos = new ArrayList<>();
addJSInfos2ListFromCell(jTemplate, CellJSInfos);
jsInfos.addAll(CellJSInfos);
}
private void addJSInfos2ListFromCell(JTemplate jTemplate, List<JSInfo> jsInfos) {
SearchCellAction searchCellAction = SearchCellAction.getInstance();
searchCellAction.search4Infos(jTemplate);
for (CellInfo cellInfo : searchCellAction.getCellInfos()) {
CellElement cell = (CellElement) cellInfo.getContent().getReplaceObject();
ITContent newContent4Cell = ITContent.copy(cellInfo.getContent());
ITContent newContent4CellCondition = ITContent.copy(cellInfo.getContent());
ITContent newContent4CellWidgetCondition = ITContent.copy(cellInfo.getContent());
//单元格的超级链接里面的JS
SearchJSUtils.addJSInfosFromHyperLink(cell, jsInfos, newContent4Cell);
//单元格条件属性里的JS
newContent4CellCondition.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Condition_Attributes"));
searchCellConditionJS(cell, jsInfos, newContent4CellCondition);
//单元格如果是图表还需要额外处理
if (cell.getValue() instanceof ChartCollection) {
SearchChartJSAction.getInstance().searchChartJS((ChartCollection) cell.getValue(), ITContent.copy(cellInfo.getContent()), jsInfos);
//List<Pair<VanChartHtmlLabel, String>> htmlLabels = SearchJSUtils.getHtmlLabel((ChartCollection) cell.getValue());
//List<NameJavaScript> nameJavaScripts = SearchJSUtils.getNameJavaScript((ChartCollection) cell.getValue());
////图表-样式-标签以及图表-特效-条件显示
//ITContent htmlITContent = ITContent.copy(cellInfo.getContent());
//htmlITContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Chart"));
//SearchJSUtils.addJSInfosFromHtmlLabel(htmlITContent, htmlLabels, jsInfos);
////图表-特效-交互属性
//ITContent conditionContent = ITContent.copy(cellInfo.getContent());
//conditionContent.addOtherPos(
// Toolkit.i18nText("Fine-Design_Chart_Chart"),
// Toolkit.i18nText("Fine-Design_Chart_Animation_Special"),
// Toolkit.i18nText("Fine-Design_Chart_Interactive")
//);
//SearchJSUtils.addJSInfosFromNameJS(conditionContent, nameJavaScripts, jsInfos);
}
}
}
private void searchCellConditionJS(CellElement cell, List<JSInfo> jsInfos, ITContent content) {
if (((TemplateCellElement) cell).getHighlightGroup() != null) {
for (int i = 0; i < ((TemplateCellElement) cell).getHighlightGroup().size(); i++) {
NameJavaScriptGroup njsg = getJSFromAction(((DefaultHighlight) ((TemplateCellElement) cell).getHighlightGroup().getHighlight(i)));
getAllJSFromNameJavaScriptGroup(cell, jsInfos, njsg, content);
}
}
}
private void getAllJSFromNameJavaScriptGroup(CellElement cell, List<JSInfo> jsInfos, NameJavaScriptGroup njsg, ITContent content) {
if (isJSExist(njsg)) {
for (int i = 0; i < njsg.size(); i++) {
if (njsg.getNameHyperlink(i).getJavaScript() instanceof JavaScriptImpl) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(njsg.getNameHyperlink(i));
SearchJSUtils.addJSInfos(jsInfos, new JSInfo(newContent));
}
}
}
}
private boolean isJSExist(NameJavaScriptGroup njsg) {
return njsg != null;
}
private NameJavaScriptGroup getJSFromAction(DefaultHighlight highlight) {
for (int i = 0; i < highlight.actionCount(); i++) {
if (isHighlightAction(highlight.getHighlightAction(i))) {
return ((HyperlinkHighlightAction) highlight.getHighlightAction(i)).getHperlink();
}
}
return null;
}
private boolean isHighlightAction(HighlightAction highlightAction) {
return highlightAction instanceof HyperlinkHighlightAction;
}
/**
* 开放对外的方法用于获取SearchCellJSAction的单例
*
* @return SearchCellJSAction的单例
*/
public static SearchCellJSAction getInstance() {
return SearchCellJSActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchCellJSActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchCellJSAction instance;
SearchCellJSActionEnum() {
instance = new SearchCellJSAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchCellJSAction getInstance() {
return instance;
}
}
}

129
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchChartJSAction.java

@ -0,0 +1,129 @@
package com.fr.design.actions.replace.action.content.js;
import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.actions.replace.info.JSInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.utils.SearchJSUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.js.NameJavaScript;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.base.VanChartHtmlLabel;
import com.fr.stable.collections.combination.Pair;
import java.util.List;
/**
* 获取图表的JS
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-15
*/
public class SearchChartJSAction {
private SearchChartJSAction() {
}
/**
* 寻找图表中的JS
*
* @param chartCollection
* @param content
* @param jsInfos
*/
public void searchChartJS(ChartCollection chartCollection, ITContent content, List<JSInfo> jsInfos) {
List<Pair<VanChartHtmlLabel, String>> htmlLabels = SearchJSUtils.getHtmlLabel(chartCollection);
List<NameJavaScript> nameJavaScripts = SearchJSUtils.getNameJavaScript(chartCollection);
//图表-样式-标签以及图表-特效-条件显示
ITContent htmlITContent = ITContent.copy(content);
htmlITContent.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Chart"));
SearchJSUtils.addJSInfosFromHtmlLabel(htmlITContent, htmlLabels, jsInfos);
//图表-特效-交互属性
ITContent conditionContent = ITContent.copy(content);
conditionContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Chart"),
Toolkit.i18nText("Fine-Design_Chart_Animation_Special"),
Toolkit.i18nText("Fine-Design_Chart_Interactive")
);
SearchJSUtils.addJSInfosFromNameJS(conditionContent, nameJavaScripts, jsInfos);
for (int i = 0; i < chartCollection.getChartCount(); i++) {
ITContent chartContent = ITContent.copy(content);
searchAxisJS(jsInfos, chartContent, chartCollection.getChart(i));
}
}
private void searchAxisJS(List<JSInfo> jsInfos, ITContent chartContent, Chart chart) {
Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis();
if (xAxis instanceof VanChartAxis) {
ITContent xAxisContent = ITContent.copy(chartContent);
xAxisContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_X_Axis"),
Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Format")
);
dealAxisHtmlLabelJS(jsInfos, ((VanChartAxis) xAxis).getHtmlLabel(), xAxisContent);
}
if (yAxis instanceof VanChartAxis) {
ITContent yAxisContent = ITContent.copy(chartContent);
yAxisContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Axis"),
Toolkit.i18nText("Fine-Design_Chart_Y_Axis"),
Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Format")
);
dealAxisHtmlLabelJS(jsInfos, ((VanChartAxis) yAxis).getHtmlLabel(), yAxisContent);
}
}
private void dealAxisHtmlLabelJS(List<JSInfo> jsInfos, VanChartHtmlLabel label, ITContent content) {
if (isHtmlLabelValid(label)) {
ITContent axisContent = ITContent.copy(content);
axisContent.setReplaceObject(label);
jsInfos.add(new JSInfo(axisContent));
}
}
private boolean isHtmlLabelValid(VanChartHtmlLabel label) {
return label != null && label.getCustomText() != null;
}
/**
* 对外开放的获取单例的方法
*
* @return
*/
public static SearchChartJSAction getInstance() {
return SearchChartJSAction.SearchChartJSActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchChartJSActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchChartJSAction instance;
SearchChartJSActionEnum() {
instance = new SearchChartJSAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchChartJSAction getInstance() {
return instance;
}
}
}

88
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchFloatJSAction.java

@ -0,0 +1,88 @@
package com.fr.design.actions.replace.action.content.js;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.actions.replace.action.content.floatelement.SearchFloatAction;
import com.fr.design.actions.replace.info.FloatInfo;
import com.fr.design.actions.replace.info.JSInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.utils.SearchJSUtils;
import com.fr.design.mainframe.JTemplate;
import com.fr.report.cell.FloatElement;
import java.util.*;
/**
* 搜索悬浮元素JS
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-15
*/
public class SearchFloatJSAction implements SearchJS {
private SearchFloatJSAction() {
}
@Override
public void searchJSFromObject(JTemplate jTemplate, List<JSInfo> jsInfos) {
List<JSInfo> floatJSInfos = new ArrayList<>();
addJSInfos2ListFromFloat(jTemplate, floatJSInfos);
jsInfos.addAll(floatJSInfos);
}
private void addJSInfos2ListFromFloat(JTemplate jTemplate, List<JSInfo> jsInfos) {
SearchFloatAction searchFloatAction = SearchFloatAction.getInstance();
searchFloatAction.search4Infos(jTemplate);
for (FloatInfo floatInfo : searchFloatAction.getFloatInfos()) {
FloatElement floatElement = (FloatElement) floatInfo.getContent().getReplaceObject();
ITContent content = ITContent.copy(floatInfo.getContent());
//从超级链接搜索
SearchJSUtils.addJSInfosFromHyperLink(floatElement, jsInfos, content);
if (floatElement.getValue() instanceof ChartCollection) {
SearchChartJSAction.getInstance().searchChartJS((ChartCollection) floatElement.getValue(), ITContent.copy(floatInfo.getContent()), jsInfos);
}
}
}
/**
* 对外开放的获取对象的方法
*
* @return
*/
public static SearchFloatJSAction getInstance() {
return SearchFloatJSActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchFloatJSActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchFloatJSAction instance;
SearchFloatJSActionEnum() {
instance = new SearchFloatJSAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchFloatJSAction getInstance() {
return instance;
}
}
}

26
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchJS.java

@ -0,0 +1,26 @@
package com.fr.design.actions.replace.action.content.js;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.info.JSInfo;
import com.fr.design.mainframe.JTemplate;
import java.util.List;
/**
* 搜索JS
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-15
*/
public interface SearchJS extends SearchAction {
/**
* 获取各个地方的JS
*
* @param jTemplate
* @param jsInfos
*/
default void searchJSFromObject(JTemplate jTemplate, List<JSInfo> jsInfos) {
}
}

119
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchJSManager.java

@ -0,0 +1,119 @@
package com.fr.design.actions.replace.action.content.js;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.action.SearchManager;
import com.fr.design.actions.replace.info.JSInfo;
import com.fr.design.mainframe.JTemplate;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* 管理搜索JS的注册销毁的管理类
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-12
*/
public class SearchJSManager implements SearchAction, SearchManager {
private List<JSInfo> jsInfos;
private Set<SearchJS> searchJSSet = new HashSet<>();
private SearchJSManager() {
//从控件
register(SearchWidgetJSAction.getInstance());
//从单元格获取JS
register(SearchCellJSAction.getInstance());
//从模板Web属性
register(SearchWebJSAction.getInstance());
//从悬浮元素
register(SearchFloatJSAction.getInstance());
}
@Override
public void search4Infos(JTemplate jTemplate) {
List<JSInfo> jsInfos = new ArrayList<>();
for (SearchJS searchJS : searchJSSet) {
searchJS.searchJSFromObject(jTemplate, jsInfos);
}
setJsInfos(jsInfos);
}
public List<JSInfo> getJsInfos() {
return jsInfos;
}
public void setJsInfos(List<JSInfo> jsInfos) {
this.jsInfos = jsInfos;
}
@Override
public void registerAction(String tag, SearchAction searchAction) {
if (searchAction instanceof SearchJS){
register((SearchJS) searchAction);
}
}
@Override
public void removeAction(SearchAction searchAction) {
if (searchAction instanceof SearchJS){
remove((SearchJS) searchAction);
}
}
/**
* 注册对象
*
* @param searchJS
*/
private void register(SearchJS searchJS) {
searchJSSet.add(searchJS);
}
/**
* 销毁对象
*/
private void remove(SearchJS searchJS) {
searchJSSet.remove(searchJS);
}
/**
* 对外开放的获取对象的方法
*
* @return
*/
public static SearchJSManager getInstance() {
return SearchJSActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchJSActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchJSManager instance;
SearchJSActionEnum() {
instance = new SearchJSManager();
}
/**
* 获取单例对象
*
* @return
*/
public SearchJSManager getInstance() {
return instance;
}
}
}

172
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchWebJSAction.java

@ -0,0 +1,172 @@
package com.fr.design.actions.replace.action.content.js;
import com.fr.design.actions.replace.info.JSInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.utils.SearchJSUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.form.event.Listener;
import com.fr.form.ui.CustomToolBarButton;
import com.fr.form.ui.Widget;
import com.fr.js.JavaScriptImpl;
import com.fr.main.impl.WorkBook;
import com.fr.report.web.ToolBarManager;
import com.fr.report.web.WebContent;
import com.fr.web.attr.ReportWebAttr;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 搜索模板Web属性里的JS
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-15
*/
public class SearchWebJSAction implements SearchJS {
private final static Map<String, String> MAP = new HashMap<>();
private List<WebContent> arrayList = new ArrayList<>();
private SearchWebJSAction() {
}
static {
MAP.put("WebPage", Toolkit.i18nText("Fine-Design_Report_Pagination_Setting"));
MAP.put("WebWrite", Toolkit.i18nText("Fine-Design_Report_Write_Setting"));
MAP.put("WebView", Toolkit.i18nText("Fine-Design_Report_Data_Analysis_Settings"));
}
@Override
public void searchJSFromObject(JTemplate jTemplate, List<JSInfo> jsInfos) {
arrayList.clear();
List<JSInfo> webJSInfos = new ArrayList<>();
addJSInfos2ListFromWeb(jTemplate, webJSInfos);
jsInfos.addAll(webJSInfos);
}
private void addJSInfos2ListFromWeb(JTemplate jTemplate, List<JSInfo> jsInfos) {
if (jTemplate.getTarget() instanceof WorkBook) {
WorkBook workBook = (WorkBook) jTemplate.getTarget();
ReportWebAttr webAttr = workBook.getReportWebAttr();
ITContent content = new ITContent();
content.setTemplateName(jTemplate.getTemplateName());
addWebContent2Array(webAttr);
for (int i = 0; i < arrayList.size(); i++) {
addJSInfos2ListFromArray(content, jsInfos, arrayList.get(i));
}
}
}
private void addJSInfos2ListFromArray(ITContent content, List<JSInfo> jsInfos, WebContent webContent) {
ITContent newContent = ITContent.copy(content);
if (MAP.containsKey(webContent.getClass().getSimpleName())) {
newContent.addOtherPos(MAP.get(webContent.getClass().getSimpleName()));
}
addJSInfos2ListFromWebButton(newContent, jsInfos, webContent);
addJSInfos2ListFromWebListener(newContent, jsInfos, webContent);
}
private void addJSInfos2ListFromWebListener(ITContent content, List<JSInfo> jsInfos, WebContent webContent) {
for (int i = 0; i < webContent.getListenerSize(); i++) {
Listener listener = webContent.getListener(i);
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(listener);
SearchJSUtils.searchJSFromListener(jsInfos, newContent);
}
}
private void addJSInfos2ListFromWebButton(ITContent content, List<JSInfo> jsInfos, WebContent webContent) {
if (hasToolBarManagers(webContent.getToolBarManagers())) {
for (ToolBarManager toolBarManager : webContent.getToolBarManagers()) {
dealWithCustonToolBarButtonImpl(content, jsInfos, toolBarManager);
}
}
}
private void addWebContent2Array(ReportWebAttr webAttr) {
if (webAttr != null) {
addContent(arrayList, webAttr.getWebWrite());
addContent(arrayList, webAttr.getWebPage());
addContent(arrayList, webAttr.getWebView());
}
}
private void addContent(List<WebContent> arrayList, WebContent webContent) {
if (webContent != null) {
arrayList.add(webContent);
}
}
private void dealWithCustonToolBarButtonImpl(ITContent content, List<JSInfo> jsInfos, ToolBarManager toolBarManager) {
for (int i = 0; i < toolBarManager.getToolBar().getWidgetSize(); i++) {
if (isWidgetIntanceofCustomToolBarButton(toolBarManager.getToolBar().getWidget(i))) {
ITContent newContent = ITContent.copy(content);
addJSInfos2ListFromButtonImpl(newContent, jsInfos, toolBarManager.getToolBar().getWidget(i));
}
}
}
private void addJSInfos2ListFromButtonImpl(ITContent content, List<JSInfo> jsInfos, Widget widget) {
if (((CustomToolBarButton) widget).getJSImpl() != null
&& ((CustomToolBarButton) widget).getJSImpl() instanceof JavaScriptImpl) {
ITContent newContent = ITContent.copy(content);
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Custom_Form_Button"));
newContent.setReplaceObject(((CustomToolBarButton) widget).getJSImpl());
SearchJSUtils.addJSInfos(jsInfos, new JSInfo(newContent));
}
}
private boolean hasToolBarManagers(ToolBarManager[] toolBarManagers) {
return toolBarManagers.length > 0;
}
private boolean isWidgetIntanceofCustomToolBarButton(Widget widget) {
return widget instanceof CustomToolBarButton;
}
/**
* 对外开放的获取单例的方法
*
* @return
*/
public static SearchWebJSAction getInstance() {
return SearchWebJSActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchWebJSActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchWebJSAction instance;
SearchWebJSActionEnum() {
instance = new SearchWebJSAction();
}
/**
* 获取单例对象
*
* @return
*/
public SearchWebJSAction getInstance() {
return instance;
}
}
}

92
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchWidgetJSAction.java

@ -0,0 +1,92 @@
package com.fr.design.actions.replace.action.content.js;
import com.fr.design.actions.replace.action.content.component.SearchComponentAction;
import com.fr.design.actions.replace.action.content.widget.SearchWidgetAction;
import com.fr.design.actions.replace.info.ComponentInfo;
import com.fr.design.actions.replace.info.JSInfo;
import com.fr.design.actions.replace.info.WidgetInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.utils.SearchJSUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.main.impl.WorkBook;
import java.util.ArrayList;
import java.util.List;
/**
* 搜索控件的JS
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-13
*/
public class SearchWidgetJSAction implements SearchJS {
private SearchWidgetJSAction() {
}
@Override
public void searchJSFromObject(JTemplate jTemplate, List<JSInfo> jsInfos) {
List<JSInfo> widgetJSInfos = new ArrayList<>();
addJSInfos2ListFromWidget(jTemplate, widgetJSInfos);
jsInfos.addAll(widgetJSInfos);
}
private void addJSInfos2ListFromWidget(JTemplate jTemplate, List<JSInfo> jsInfos) {
if (jTemplate.getTarget() instanceof WorkBook) {
SearchWidgetAction searchWidgetAction = SearchWidgetAction.getInstance();
searchWidgetAction.search4Infos(jTemplate);
for (WidgetInfo widgetInfo : searchWidgetAction.getWidgetInfos()) {
ITContent content = ITContent.copy(widgetInfo.getContent());
content.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Event"));
SearchJSUtils.selectJSAction(jsInfos, content);
}
} else {
SearchComponentAction searchComponentAction = SearchComponentAction.getInstance();
searchComponentAction.search4Infos(jTemplate);
for (ComponentInfo componentInfo : searchComponentAction.getComponentInfos()) {
ITContent content = ITContent.copy(componentInfo.getContent());
content.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Event"));
SearchJSUtils.selectJSAction(jsInfos, content);
}
}
}
/**
* 对外开放获取对象的方法
*
* @return
*/
public static SearchWidgetJSAction getInstance() {
return SearchWidgetJSActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchWidgetJSActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchWidgetJSAction instance;
SearchWidgetJSActionEnum() {
instance = new SearchWidgetJSAction();
}
/**
* 获取单例的方法
*
* @return
*/
public SearchWidgetJSAction getInstance() {
return instance;
}
}
}

141
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/sql/SearchSQLAction.java

@ -0,0 +1,141 @@
package com.fr.design.actions.replace.action.content.sql;
import com.fr.data.TableDataSource;
import com.fr.data.impl.DBTableData;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.info.SQLInfo;
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 com.fr.stable.AssistUtils;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* 搜索SQL
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-16
*/
public class SearchSQLAction implements SearchAction {
private List<SQLInfo> sqlInfos;
private SearchSQLAction() {
}
@Override
public void search4Infos(JTemplate jTemplate) {
List<SQLInfo> sqlInfos = new ArrayList<>();
ITContent content = new ITContent();
content.setTemplateName(jTemplate.getTemplateName());
addModelDataInfos2Array(jTemplate, content, sqlInfos);
addServerDataInfos2Array(content, sqlInfos);
setSqlInfos(sqlInfos);
}
/**
* 服务器数据集
*
* @param content
* @param sqlInfos
*/
private void addServerDataInfos2Array(ITContent content, List<SQLInfo> sqlInfos) {
TableDataConfig tableDataConfig = TableDataConfig.getInstance();
String[] nameArray = TableDataFactory.getSortOfChineseNameOfServerData(tableDataConfig);
for (String dataName : nameArray) {
if (tableDataConfig.getTableData(dataName) instanceof DBTableData) {
ITContent newContent = ITContent.copy(content);
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData"),
dataName
);
newContent.setShowObject(Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData"));
newContent.setReplaceObject(tableDataConfig.getTableData(dataName));
sqlInfos.add(new SQLInfo(newContent));
}
}
}
/**
* 模板数据集
*
* @param jTemplate
* @param content
* @param sqlInfos
*/
private void addModelDataInfos2Array(JTemplate jTemplate, ITContent content, List<SQLInfo> sqlInfos) {
if (jTemplate.getTarget() instanceof TableDataSource) {
TableDataSource source = (TableDataSource) jTemplate.getTarget();
Iterator dataIterator = source.getTableDataNameIterator();
while (dataIterator.hasNext()) {
String dataName = (String) dataIterator.next();
if (source.getTableData(dataName) instanceof DBTableData) {
ITContent newContent = ITContent.copy(content);
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_DS_Report_TableData"),
dataName
);
newContent.setShowObject(Toolkit.i18nText("Fine-Design_Basic_DS_Report_TableData"));
newContent.setReplaceObject(source.getTableData(dataName));
sqlInfos.add(new SQLInfo(newContent));
}
}
}
}
public List<SQLInfo> getSqlInfos() {
return sqlInfos;
}
public void setSqlInfos(List<SQLInfo> sqlInfos) {
this.sqlInfos = sqlInfos;
}
@Override
public String toString() {
return AssistUtils.toString(this);
}
/**
* 对外开放的获取单例对象方法
*
* @return
*/
public static SearchSQLAction getInstance() {
return SearchSQLAction.SearchSQLActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchSQLActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchSQLAction instance;
SearchSQLActionEnum() {
instance = new SearchSQLAction();
}
/**
* 获取对象
*
* @return
*/
public SearchSQLAction getInstance() {
return instance;
}
}
}

190
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/widget/FrmWidgetType.java

@ -0,0 +1,190 @@
package com.fr.design.actions.replace.action.content.widget;
import com.fr.design.actions.replace.action.content.component.ComponentType;
import com.fr.design.actions.replace.info.DealWithInfoValue;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.info.WidgetInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.form.ui.WaterMark;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
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-29
*/
public enum FrmWidgetType implements SearchFrmWidget, DealWithInfoValue {
/**
* 自适应布局
*/
W_SCALE_LAYOUT("WScaleLayout") {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
WScaleLayout widget = (WScaleLayout) info.getContent().getReplaceObject();
if (((WidgetInfo) info).isWaterMark()) {
FrmWidgetType frmWidgetType = FrmWidgetType.match(((CRBoundsWidget) widget.getWidget(0)).getWidget().getClass().getSimpleName());
if (frmWidgetType != null) {
frmWidgetType.setValue(info, findStr, replaceStr, operatorArray);
}
} else {
ComponentType componentType = ComponentType.match(widget.getClass().getSimpleName());
if (componentType != null) {
componentType.setValue(info, findStr, replaceStr, operatorArray);
}
}
}
},
/**
* 文本控件
*/
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;
FrmWidgetType(String name) {
this.name = name;
}
/**
* 处理绝对布局或者已经是真正存储对象的控件
*
* @param content
* @param widget
* @return
*/
public List<WidgetInfo> dealAbsoluteWidget(ITContent content, Widget widget) {
ArrayList<WidgetInfo> widgetInfos = new ArrayList<>();
ITContent newContent = ITContent.copy(content);
widgetInfos.add(new WidgetInfo(newContent));
return widgetInfos;
}
/**
* 匹配
*
* @param name
* @return
*/
@Nullable
public static FrmWidgetType match(String name) {
FrmWidgetType[] values = FrmWidgetType.values();
for (FrmWidgetType value : values) {
if (value.name.equals(name)) {
return value;
}
}
return null;
}
@Override
public Map<String, String> getValue(Object... o) {
return new HashMap<>();
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Widget widget = (Widget) info.getContent().getReplaceObject();
if (widget instanceof WScaleLayout) {
widget = ((CRBoundsWidget) ((WScaleLayout) widget).getWidget(0)).getWidget();
}
if (((WidgetInfo) info).isWaterMark()) {
WaterMark waterMark = (WaterMark) widget;
info.updateOldStr(waterMark.getWaterMark(), findStr);
waterMark.setWaterMark(ShowValueUtils.replaceAll(waterMark.getWaterMark(), findStr, replaceStr));
} else {
info.updateOldStr(widget.getWidgetName(), findStr);
ComponentType componentType = ComponentType.match(widget.getClass().getSimpleName());
if (componentType != null) {
componentType.setValue(info, findStr, replaceStr, operatorArray);
}
}
}
@Override
public String getInfoShowStr(Info info) {
return info.getContent().getOldShowStr();
}
@Override
public List<WidgetInfo> addFrmWidget2Array(ITContent content, Widget widget) {
return dealAbsoluteWidget(content, widget);
}
}

26
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/widget/SearchFrmWidget.java

@ -0,0 +1,26 @@
package com.fr.design.actions.replace.action.content.widget;
import com.fr.design.actions.replace.info.WidgetInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.form.ui.Widget;
import java.util.List;
/**
* 获取决策报表控件相关
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-29
*/
public interface SearchFrmWidget {
/**
* 将决策报表的控件加入数组中
*
* @param content ITContent信息
* @param widget 对应的控件
* @return
*/
List<WidgetInfo> addFrmWidget2Array(ITContent content, Widget widget);
}

205
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/widget/SearchWidgetAction.java

@ -0,0 +1,205 @@
package com.fr.design.actions.replace.action.content.widget;
import com.fr.base.parameter.ParameterUI;
import com.fr.design.actions.replace.action.SearchAction;
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.info.CellInfo;
import com.fr.design.actions.replace.info.ComponentInfo;
import com.fr.design.actions.replace.info.WidgetInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.form.main.Form;
import com.fr.form.ui.Widget;
import com.fr.main.impl.WorkBook;
import com.fr.main.parameter.ReportParameterAttr;
import com.fr.report.cell.TemplateCellElement;
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.cell.cellattr.highlight.WidgetHighlightAction;
import com.fr.stable.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
* 获取控件
* 目前获取位置单元格本身单元格条件属性内超链控件参数面板控件决策报表的组件
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-16
*/
public class SearchWidgetAction implements SearchAction {
List<WidgetInfo> widgetInfos;
private SearchWidgetAction() {
}
@Override
public void search4Infos(JTemplate jTemplate) {
ArrayList<WidgetInfo> widgetInfos = new ArrayList<>();
ITContent content = new ITContent();
content.setTemplateName(jTemplate.getTemplateName());
//这边拿SearchCellAction里的CellInfo来查找,由于在SearchCellAction里面已经考虑了决策报表和普通报表两种情况了,这边就不用再做区分
addCellWidget2Array(widgetInfos, jTemplate);
content.addTRL(jTemplate.getTemplateName());
if (jTemplate.getTarget() instanceof WorkBook) {
addWorkBookParaWidget2Array(content, widgetInfos, jTemplate);
} else if (jTemplate.getTarget() instanceof Form) {
addFrmWidget2Array(content, widgetInfos, jTemplate);
}
setWidgetInfos(widgetInfos);
}
private void addFrmWidget2Array(ITContent content, ArrayList<WidgetInfo> widgetInfos, JTemplate jTemplate) {
SearchComponentAction searchComponentAction = SearchComponentAction.getInstance();
searchComponentAction.search4Infos(jTemplate);
for (ComponentInfo componentInfo : searchComponentAction.getComponentInfos()) {
FrmWidgetType frmWidgetType = FrmWidgetType.match(componentInfo.getContent().getReplaceObject().getClass().getSimpleName());
if (frmWidgetType != null) {
widgetInfos.addAll(frmWidgetType.addFrmWidget2Array(componentInfo.getContent(), (Widget) componentInfo.getContent().getReplaceObject()));
}
}
}
private void addCellWidget2Array(ArrayList<WidgetInfo> widgetInfos, JTemplate jTemplate) {
SearchCellAction searchCellAction = SearchCellAction.getInstance();
searchCellAction.search4Infos(jTemplate);
if (searchCellAction.getCellInfos().size() > 0) {
for (CellInfo cellInfo : searchCellAction.getCellInfos()) {
//单元格本身的控件
addWidget2ArrayFromCell(widgetInfos, cellInfo);
//单元格条件属性中超链内的控件
addWidget2ArrayFromCellHighlight(widgetInfos, cellInfo);
}
}
}
private void addWidget2ArrayFromCellHighlight(ArrayList<WidgetInfo> widgetInfos, CellInfo cellInfo) {
if (cellInfo.getContent().getReplaceObject() instanceof TemplateCellElement) {
TemplateCellElement cell = (TemplateCellElement) cellInfo.getContent().getReplaceObject();
if (cell.getHighlightGroup() != null) {
HighlightGroup highlightGroup = cell.getHighlightGroup();
dealWithHighlightGroup4Widget(highlightGroup, widgetInfos, cellInfo);
}
}
}
private void dealWithHighlightGroup4Widget(HighlightGroup highlightGroup, ArrayList<WidgetInfo> widgetInfos, CellInfo cellInfo) {
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
if (isHighlightWidgetExist(highlightAction)) {
ITContent content = ITContent.copy(cellInfo.getContent());
content.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Condition_Attributes"),
Toolkit.i18nText("Fine-Design_Report_Hyperlink"),
Toolkit.i18nText("Fine-Design_Basic_Widget"));
content.setReplaceObject(((WidgetHighlightAction) highlightAction).getWidget());
content.setShowObject(cellInfo.getContent().getReplaceObject());
widgetInfos.add(new WidgetInfo(content));
}
}
}
}
private boolean isHighlightWidgetExist(HighlightAction highlightAction) {
return highlightAction instanceof WidgetHighlightAction && ((WidgetHighlightAction) highlightAction).getWidget() != null;
}
private void addWidget2ArrayFromCell(ArrayList<WidgetInfo> widgetInfos, CellInfo cellInfo) {
if (cellInfo.getContent().getReplaceObject() instanceof TemplateCellElement
&& ((TemplateCellElement) cellInfo.getContent().getReplaceObject()).getWidget() != null) {
// 单元格内有控件
ITContent newContent = ITContent.copy(cellInfo.getContent());
Widget widget = ((TemplateCellElement) cellInfo.getContent().getReplaceObject()).getWidget();
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Widget"));
if (StringUtils.isNotEmpty(widget.getWidgetName())) {
newContent.addOtherPos(widget.getWidgetName());
}
newContent.setReplaceObject(widget);
newContent.setShowObject(cellInfo.getContent().getReplaceObject());
widgetInfos.add(new WidgetInfo(newContent));
}
}
private void addWorkBookParaWidget2Array(ITContent content, ArrayList<WidgetInfo> widgetInfos, JTemplate jTemplate) {
WorkBook workBook = (WorkBook) jTemplate.getTarget();
ReportParameterAttr reportParameterAttr = workBook.getReportParameterAttr();
if (reportParameterAttr != null && reportParameterAttr.getParameterUI() != null) {
ParameterUI parameterUI = reportParameterAttr.getParameterUI();
Widget[] widgets = parameterUI.getAllWidgets();
for (Widget widget : widgets) {
ITContent newContent = ITContent.copy(content);
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Parameter_Panel"),
Toolkit.i18nText("Fine-Design_Basic_Widget"),
widget.getWidgetName());
newContent.setReplaceObject(widget);
newContent.setJumpAble(false);
newContent.setShowObject(Toolkit.i18nText("Fine-Design_Parameter_Panel"));
widgetInfos.add(new WidgetInfo(newContent));
}
}
}
/**
* 是否为空
*
* @return 为空返回true
*/
public boolean isWidgetInfosEmpty() {
return widgetInfos.isEmpty();
}
public List<WidgetInfo> getWidgetInfos() {
return widgetInfos;
}
public void setWidgetInfos(List<WidgetInfo> widgetInfos) {
this.widgetInfos = widgetInfos;
}
/**
* 对外开放获取对象的方法
*
* @return
*/
public static SearchWidgetAction getInstance() {
return SearchWidgetAction.SearchWidgetActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchWidgetActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchWidgetAction instance;
SearchWidgetActionEnum() {
instance = new SearchWidgetAction();
}
/**
* 获取对象
*
* @return
*/
public SearchWidgetAction getInstance() {
return instance;
}
}
}

366
designer-realize/src/main/java/com/fr/design/actions/replace/info/CellInfo.java

@ -0,0 +1,366 @@
package com.fr.design.actions.replace.info;
import com.fr.base.Formula;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Title;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.general.GeneralUtils;
import com.fr.main.impl.LinkWorkBookTemplate;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.cellattr.core.RichChar;
import com.fr.report.cell.cellattr.core.RichText;
import com.fr.report.cell.cellattr.core.SubReport;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.painter.BiasTextPainter;
import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* 存储单元格信息的Info
* 返回查找内容匹配词高亮模板名称所在sheet分布组件单元格位置操作
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-11
*/
public class CellInfo implements Info {
private ITContent content;
private int cellChartIndex = -1;
private boolean chartExist = false;
public CellInfo(ITContent content) {
this.content = content;
}
@Override
public ITContent getContent() {
return content;
}
public void setContent(ITContent content) {
this.content = content;
}
/**
* toString
*
* @return
*/
@Override
public String toString() {
return AssistUtils.toString(this);
}
/**
* 获取单元格的值不对图表进行处理如果是图表类型在展示阶段特殊处理
*
* @param o 用于替换的replaceObject
* @return
*/
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> stringHashMap = new HashMap<>();
CellElement cellElement = (((CellElement) (this.getContent().getReplaceObject())));
if (cellElement.getValue() != null && !this.isChartExist()) {
CellValueType cellValueType = CellValueType.match(cellElement.getValue().getClass().getSimpleName());
if (cellValueType != null) {
cellValueType.addValue2Map(cellElement.getValue(), stringHashMap);
} else {
stringHashMap.put("content", GeneralUtils.objectToString(cellElement.getValue()));
}
}
return stringHashMap;
}
/**
* 对不同类型的值进行设置与替换
*
* @param info 用于获取值和设置值
* @param findStr 要被替换的字符串
* @param replaceStr 用于替换的字符串
* @param operatorArray 存储内容类替换所要操作的所有位置Pair<起始位置,结束位置>
*/
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
CellElement cellElement = (((CellElement) (this.getContent().getReplaceObject())));
if (this.isChartExist() && this.getCellChartIndex() != -1) {
ChartCollection chartCollection = (ChartCollection) ((CellElement) this.getContent().getReplaceObject()).getValue();
Title title = chartCollection.getChart(this.getCellChartIndex()).getTitle();
if (title.getTextObject() instanceof Formula) {
Formula formula = (Formula) title.getTextObject();
updateOldStr(formula.getContent(), findStr);
formula.setContent(ShowValueUtils.replaceAll(formula.getContent(), findStr, replaceStr));
} else {
updateOldStr(GeneralUtils.objectToString(title.getTextObject()), findStr);
title.setTextObject(ShowValueUtils.replaceAll(GeneralUtils.objectToString(title.getTextObject()), findStr, replaceStr));
}
} else {
CellValueType cellValueType = CellValueType.match(cellElement.getValue().getClass().getSimpleName());
if (cellValueType != null) {
cellValueType.setValue(this, cellElement.getValue(), findStr, replaceStr);
} else {
updateOldStr(GeneralUtils.objectToString(cellElement.getValue()), findStr);
cellElement.setValue(ShowValueUtils.replaceAll(GeneralUtils.objectToString(cellElement.getValue()), findStr, replaceStr));
}
}
}
public int getCellChartIndex() {
return cellChartIndex;
}
public void setCellChartIndex(int cellChartIndex) {
this.cellChartIndex = cellChartIndex;
}
/**
* 是否是图表
*
* @return
*/
public boolean isChartExist() {
return chartExist;
}
public void setChartExist(boolean chartExist) {
this.chartExist = chartExist;
}
/**
* 复制一份CellInfo防止引用传递问题
*
* @return
*/
public CellInfo copy() {
ITContent content = ITContent.copy(this.getContent());
CellInfo cellInfo = new CellInfo(content);
cellInfo.setCellChartIndex(this.getCellChartIndex());
cellInfo.setChartExist(this.isChartExist());
return cellInfo;
}
/**
* 获取展示的字符串
*
* @param info 信息
* @return
*/
@Override
public String getInfoShowStr(Info info) {
return this.getContent().getOldShowStr();
}
/**
* 校验值有没有被修改
*
* @return
*/
@Override
public Boolean checkValid() {
CellElement cellElement = (((CellElement) (this.getContent().getReplaceObject())));
String newValue;
if (this.isChartExist() && this.getCellChartIndex() != -1) {
newValue = getChartCheckValue();
} else {
CellValueType cellValueType = CellValueType.match(cellElement.getValue().getClass().getSimpleName());
if (cellValueType != null) {
newValue = cellValueType.getCheckValue(this);
} else {
newValue = GeneralUtils.objectToString(cellElement.getValue());
}
}
return StringUtils.equals(newValue, this.getContent().getOldShowStr());
}
private String getChartCheckValue() {
ChartCollection chartCollection = (ChartCollection) ((CellElement) this.getContent().getReplaceObject()).getValue();
Title title = chartCollection.getChart(this.getCellChartIndex()).getTitle();
if (title.getTextObject() instanceof Formula) {
Formula formula = (Formula) title.getTextObject();
return formula.getContent();
} else {
return GeneralUtils.objectToString(title.getTextObject());
}
}
/**
* 单元格的值的类型
*/
public enum CellValueType {
/**
* 数据列类型目前只对数据集的名称进行修改对于其中的列名暂不支持修改
*/
DS_COLUMN("DSColumn") {
@Override
public void setValue(CellInfo cellInfo, Object o, String findStr, String replaceStr) {
cellInfo.updateOldStr(GeneralUtils.objectToString(((DSColumn) o).getDSName()), findStr);
((DSColumn) o).setDSName(ShowValueUtils.replaceAll(((DSColumn) o).getDSName(), findStr, replaceStr));
}
@Override
public void addValue2Map(Object o, HashMap<String, String> map) {
map.put("content", ((DSColumn) o).getDSName());
}
@Override
public String getCheckValue(Info info) {
CellElement o = (CellElement) info.getContent().getReplaceObject();
return ((DSColumn) o.getValue()).getDSName();
}
},
/**
* 富文本形式
* 为了不破坏富文本的格式暂时不对样式不同的文本进行连接替换每个样式不同的文本都是一个独立的个体
*/
RICH_TEXT("RichText") {
@Override
public void setValue(CellInfo cellInfo, Object o, String findStr, String replaceStr) {
cellInfo.updateOldStr(GeneralUtils.objectToString(((RichText) o).getContent()), findStr);
Iterator<RichChar> it = ((RichText) o).charIterator();
while (it.hasNext()) {
RichChar richChar = it.next();
richChar.setText(ShowValueUtils.replaceAll(richChar.getText(), findStr, replaceStr));
}
}
@Override
public void addValue2Map(Object o, HashMap<String, String> map) {
map.put("content", ((RichText) o).getContent());
}
@Override
public String getCheckValue(Info info) {
CellElement o = (CellElement) info.getContent().getReplaceObject();
return ((RichText) o.getValue()).getContent();
}
},
/**
* 公式类型
*/
FORMULA("Formula") {
@Override
public void setValue(CellInfo cellInfo, Object o, String findStr, String replaceStr) {
cellInfo.updateOldStr(GeneralUtils.objectToString(o), findStr);
((Formula) o).setContent(ShowValueUtils.replaceAll(((Formula) o).getContent(), findStr, replaceStr));
}
@Override
public String getCheckValue(Info info) {
CellElement o = (CellElement) info.getContent().getReplaceObject();
return ((Formula) o.getValue()).getContent();
}
},
/**
* 子报表类型目前支持修改路径
*/
SUB_REPORT("SubReport") {
@Override
public void setValue(CellInfo cellInfo, Object o, String findStr, String replaceStr) {
LinkWorkBookTemplate workBookTemplate = (LinkWorkBookTemplate) ((SubReport) o).getPackee();
cellInfo.updateOldStr(workBookTemplate.getTemplatePath(), findStr);
workBookTemplate.setTemplatePath(ShowValueUtils.replaceAll(workBookTemplate.getTemplatePath(), findStr, replaceStr));
}
@Override
public void addValue2Map(Object o, HashMap<String, String> map) {
LinkWorkBookTemplate workBookTemplate = (LinkWorkBookTemplate) ((SubReport) o).getPackee();
map.put("content", GeneralUtils.objectToString(workBookTemplate.getTemplatePath()));
}
@Override
public String getCheckValue(Info info) {
CellElement o = (CellElement) info.getContent().getReplaceObject();
LinkWorkBookTemplate workBookTemplate = (LinkWorkBookTemplate) ((SubReport) o.getValue()).getPackee();
return GeneralUtils.objectToString(workBookTemplate.getTemplatePath());
}
},
/**
* 斜线类型
*/
BIAS_TEXT_PAINTER("BiasTextPainter") {
@Override
public void setValue(CellInfo cellInfo, Object o, String findStr, String replaceStr) {
cellInfo.updateOldStr(((BiasTextPainter) o).getText(), findStr);
((BiasTextPainter) o).setText(ShowValueUtils.replaceAll(((BiasTextPainter) o).getText(), findStr, replaceStr));
}
@Override
public void addValue2Map(Object o, HashMap<String, String> map) {
map.put("content", ((BiasTextPainter) o).getText());
}
@Override
public String getCheckValue(Info info) {
CellElement o = (CellElement) info.getContent().getReplaceObject();
return ((BiasTextPainter) o.getValue()).getText();
}
};
String name;
CellValueType(String name) {
this.name = name;
}
/**
* 匹配
*
* @param name
* @return
*/
@Nullable
public static CellValueType match(String name) {
CellValueType[] values = CellValueType.values();
for (CellValueType value : values) {
if (value.name.equals(name)) {
return value;
}
}
return null;
}
/**
* 设置值
*
* @param cellInfo
* @param o
* @param findStr
* @param replaceStr
*/
public void setValue(CellInfo cellInfo, Object o, String findStr, String replaceStr) {
}
/**
* 将值加到Map中
*
* @param o
* @param map
*/
public void addValue2Map(Object o, HashMap<String, String> map) {
map.put("content", GeneralUtils.objectToString(o));
}
public String getCheckValue(Info info) {
return StringUtils.EMPTY;
}
}
}

76
designer-realize/src/main/java/com/fr/design/actions/replace/info/ComponentInfo.java

@ -0,0 +1,76 @@
package com.fr.design.actions.replace.info;
import com.fr.design.actions.replace.action.content.component.ComponentType;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.form.ui.Widget;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 存储组件的Info
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-29
*/
public class ComponentInfo implements Info {
private ITContent content;
public ComponentInfo(ITContent content) {
this.content = content;
}
public void setContent(ITContent content) {
this.content = content;
}
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> hashMap = new HashMap<>();
if (this.content.getReplaceObject() != null && this.content.getReplaceObject() instanceof Widget) {
hashMap.put("content", ((Widget) this.content.getReplaceObject()).getWidgetName());
}
return hashMap;
}
@Override
public ITContent getContent() {
return content;
}
/**
* 这边设置值其实就是修改组件的名称要注意的就是如果是layout的情况下有些需要对其外面封装的对象也进行名称的修改
*
* @param info 用于获取值和设置值
* @param findStr 要被替换的字符串
* @param replaceStr 用于替换的字符串
* @param operatorArray 存储内容类替换所要操作的所有位置Pair<起始位置,结束位置>
*/
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
ComponentType componentType = ComponentType.match(this.content.getReplaceObject().getClass().getSimpleName());
if (componentType != null) {
componentType.setValue(info, findStr, replaceStr, operatorArray);
}
}
/**
* 获取展示的信息
*
* @param info 信息
* @return
*/
@Override
public String getInfoShowStr(Info info) {
if (this.content.getReplaceObject() != null && this.content.getReplaceObject() instanceof Widget) {
return ((Widget) this.content.getReplaceObject()).getWidgetName();
}
return StringUtils.EMPTY;
}
}

47
designer-realize/src/main/java/com/fr/design/actions/replace/info/DealWithInfoValue.java

@ -0,0 +1,47 @@
package com.fr.design.actions.replace.info;
import com.fr.stable.collections.combination.Pair;
import java.util.List;
import java.util.Map;
/**
* 处理信息
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-23
*/
public interface DealWithInfoValue {
/**
* 获取存储的值
*
* @param o 用于替换的replaceObject
* @return 返回便于处理的Map不同类型可能会存在多个需要存储的数据eg控件名 & 水印
*/
Map<String, String> getValue(Object... o);
/**
* 替换时调用的方法设置值
*
* @param info 用于获取值和设置值
* @param findStr 要被替换的字符串
* @param replaceStr 用于替换的字符串
* @param operatorArray 存储内容类替换所要操作的所有位置Pair<起始位置,结束位置>
*/
void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray);
/**
* 获取用于展示给用户的值
*
* @param info 信息
* @return 返回用于展示的字符串
*/
String getInfoShowStr(Info info);
}

128
designer-realize/src/main/java/com/fr/design/actions/replace/info/FloatInfo.java

@ -0,0 +1,128 @@
package com.fr.design.actions.replace.info;
import com.fr.base.Formula;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Title;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.general.GeneralUtils;
import com.fr.report.cell.FloatElement;
import com.fr.stable.AssistUtils;
import com.fr.stable.collections.combination.Pair;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 存储悬浮元素的Info
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-15
*/
public class FloatInfo implements Info {
private ITContent content;
private int floatChartIndex = -1;
private boolean chartExist = false;
public FloatInfo(ITContent content) {
this.content = content;
}
@Override
public ITContent getContent() {
return content;
}
public void setContent(ITContent content) {
this.content = content;
}
/**
* toString
*
* @return
*/
@Override
public String toString() {
return AssistUtils.toString(this);
}
public int getFloatChartIndex() {
return floatChartIndex;
}
public void setFloatChartIndex(int charIndex) {
this.floatChartIndex = charIndex;
}
/**
* 是否是图表
*
* @return
*/
public boolean isChartExist() {
return chartExist;
}
public void setChartExist(boolean chartExist) {
this.chartExist = chartExist;
}
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> hashMap = new HashMap<>();
FloatElement floatElement = (((FloatElement) (this.getContent().getReplaceObject())));
if (!this.isChartExist()) {
hashMap.put("content", GeneralUtils.objectToString(floatElement.getValue()));
}
return hashMap;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (this.isChartExist() && this.getFloatChartIndex() != -1) {
ChartCollection chartCollection = (ChartCollection) ((FloatElement) this.getContent().getReplaceObject()).getValue();
Title title = chartCollection.getChart(this.getFloatChartIndex()).getTitle();
if (title.getTextObject() instanceof Formula) {
Formula formula = (Formula) title.getTextObject();
updateOldStr(formula.getContent(), findStr);
formula.setContent(ShowValueUtils.replaceAll(formula.getContent(), findStr, replaceStr));
} else {
updateOldStr(GeneralUtils.objectToString(title.getTextObject()), findStr);
title.setTextObject(ShowValueUtils.replaceAll(GeneralUtils.objectToString(title.getTextObject()), findStr, replaceStr));
}
} else {
FloatElement floatElement = ((FloatElement) this.getContent().getReplaceObject());
if (floatElement.getValue() instanceof Formula) {
Formula formula = (Formula) floatElement.getValue();
updateOldStr(formula.getContent(), findStr);
formula.setContent(ShowValueUtils.replaceAll(formula.getContent(), findStr, replaceStr));
} else {
updateOldStr(GeneralUtils.objectToString(floatElement.getValue()), findStr);
floatElement.setValue(ShowValueUtils.replaceAll(GeneralUtils.objectToString(floatElement.getValue()), findStr, replaceStr));
}
}
}
@Override
public String getInfoShowStr(Info info) {
return this.getContent().getOldShowStr();
}
/**
* 复制
*
* @return
*/
public FloatInfo copy() {
ITContent content = ITContent.copy(this.getContent());
FloatInfo floatInfo = new FloatInfo(content);
floatInfo.setFloatChartIndex(this.getFloatChartIndex());
floatInfo.setChartExist(this.isChartExist());
return floatInfo;
}
}

80
designer-realize/src/main/java/com/fr/design/actions/replace/info/FormulaInfo.java

@ -0,0 +1,80 @@
package com.fr.design.actions.replace.info;
import com.fr.data.impl.FormulaDictionary;
import com.fr.design.actions.replace.action.content.formula.FormulaReplaceObject;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 存储公式类型的Info
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-17
*/
public class FormulaInfo implements Info {
private ITContent content;
private static final String DISPLAY = Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary") + "-" + Toolkit.i18nText("Fine-Design_Chart_Formula") + "-" + Toolkit.i18nText("Fine-Design_Basic_Display_Value");
private static final String ACTUAL = Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary") + "-" + Toolkit.i18nText("Fine-Design_Chart_Formula") + "-" + Toolkit.i18nText("Fine-Design_Basic_Actual_Value");
public FormulaInfo(ITContent content) {
this.content = content;
}
@Override
public ITContent getContent() {
return content;
}
public void setContent(ITContent content) {
this.content = content;
}
@Override
public Map<String, String> getValue(Object... o) {
Map<String, String> map = new HashMap<>();
//这边比较特殊,存的都是FormulaDictionary ,特殊判断一下
if (this.content.getOtherPos().contains(DISPLAY)) {
map.put("content", ((FormulaDictionary) this.getContent().getReplaceObject()).getExcuteFormula());
} else if (this.content.getOtherPos().contains(ACTUAL)) {
map.put("content", ((FormulaDictionary) this.getContent().getReplaceObject()).getProduceFormula());
} else {
map = getCommonValue();
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
FormulaReplaceObject formulaReplaceObject = FormulaReplaceObject.match(this.content.getReplaceObject().getClass().getSimpleName());
if (formulaReplaceObject != null) {
formulaReplaceObject.setValue(this, findStr, replaceStr, operatorArray);
}
}
@Override
public String getInfoShowStr(Info info) {
FormulaReplaceObject formulaReplaceObject = FormulaReplaceObject.match(this.content.getReplaceObject().getClass().getSimpleName());
if (formulaReplaceObject != null) {
return formulaReplaceObject.getInfoShowStr(info);
}
return StringUtils.EMPTY;
}
private Map<String, String> getCommonValue() {
Map<String, String> map = new HashMap();
FormulaReplaceObject o = FormulaReplaceObject.match(this.content.getReplaceObject().getClass().getSimpleName());
if (o != null) {
return o.getValue(this.content.getReplaceObject());
}
return map;
}
}

45
designer-realize/src/main/java/com/fr/design/actions/replace/info/Info.java

@ -0,0 +1,45 @@
package com.fr.design.actions.replace.info;
import com.fr.design.actions.replace.info.base.ITContent;
/**
* 主要的数据结构
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-17
*/
public interface Info extends DealWithInfoValue {
/**
* 获取ITContent
*
* @return
*/
ITContent getContent();
/**
* 更新旧值
*
* @param oldShowStr
* @param lastSearchStr
*/
default void updateOldStr(String oldShowStr, String lastSearchStr) {
this.getContent().setOldShowStr(oldShowStr);
this.getContent().setLastSearchStr(lastSearchStr);
}
/**
* 校验正确性是否被修改
*
* @return
*/
default Boolean checkValid() {
//todo 完善所有类型的校验
return true;
}
;
}

99
designer-realize/src/main/java/com/fr/design/actions/replace/info/JSInfo.java

@ -0,0 +1,99 @@
package com.fr.design.actions.replace.info;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.stable.AssistUtils;
import com.fr.stable.collections.combination.Pair;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 存储JS信息的Info
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-11
*/
public class JSInfo implements Info {
private ITContent content;
private boolean contentFlag = true;
public JSInfo(ITContent content) {
this.content = content;
}
@Override
public ITContent getContent() {
return content;
}
public void setContent(ITContent content) {
this.content = content;
}
@Override
public Map<String, String> getValue(Object... object) {
ReplaceObject o = ReplaceObject.match(this.content.getReplaceObject().getClass().getSimpleName());
if (o != null) {
return o.getValue(this.content.getReplaceObject());
}
return new HashMap<>();
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
ReplaceObject o = ReplaceObject.match(this.content.getReplaceObject().getClass().getSimpleName());
if (o != null) {
o.setValue(this, findStr, replaceStr, this.getContent().getOperatorArray());
}
}
@Override
public String getInfoShowStr(Info info) {
return info.getContent().getOldShowStr();
}
/**
* toString
*
* @return
*/
@Override
public String toString() {
return AssistUtils.toString(this);
}
/**
* 复制
*
* @return
*/
public JSInfo copy() {
ITContent content = ITContent.copy(this.getContent());
JSInfo jsInfo = new JSInfo(content);
jsInfo.setContentFlag(this.isContent());
return jsInfo;
}
/**
* 是否属于存储内容
*
* @return
*/
public boolean isContent() {
return contentFlag;
}
public void setContentFlag(boolean contentFlag) {
this.contentFlag = contentFlag;
}
}

218
designer-realize/src/main/java/com/fr/design/actions/replace/info/ReplaceObject.java

@ -0,0 +1,218 @@
package com.fr.design.actions.replace.info;
import com.fr.data.impl.DBTableData;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.form.event.Listener;
import com.fr.js.JavaScriptImpl;
import com.fr.js.NameJavaScript;
import com.fr.plugin.chart.base.VanChartHtmlLabel;
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;
/**
* 处理所存储的不同类型的对象(除了Formula外的其他对象)
* 此处对象是ITContent中用于直接查找内容与替换内容的操作对象
* Formula要处理的对象太多而且会和其他类型有重叠所以单独开一个类放
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-23
*/
public enum ReplaceObject implements DealWithInfoValue {
/**
* NameJavaScriptJS
*/
NAME_JAVA_SCRIPT("NameJavaScript") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
addValue2Map(nameKey, ((NameJavaScript) o[0]).getName(), map);
addValue2Map(contentKey, ((JavaScriptImpl) (((NameJavaScript) o[0]).getJavaScript())).getContent(), map);
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (((JSInfo) info).isContent()) {
JavaScriptImpl javaScript = (JavaScriptImpl) ((NameJavaScript) (info.getContent().getReplaceObject())).getJavaScript();
info.updateOldStr(javaScript.getContent(), findStr);
javaScript.setContent(ShowValueUtils.replaceAll(javaScript.getContent(), findStr, replaceStr));
} else {
NameJavaScript javaScript = ((NameJavaScript) (info.getContent().getReplaceObject()));
info.updateOldStr(javaScript.getName(), findStr);
javaScript.setName(javaScript.getName().replaceAll(findStr, replaceStr));
}
}
@Override
public String getInfoShowStr(Info info) {
if (((JSInfo) info).isContent()) {
JavaScriptImpl javaScript = (JavaScriptImpl) ((NameJavaScript) (info.getContent().getReplaceObject())).getJavaScript();
return javaScript.getContent();
} else {
NameJavaScript javaScript = ((NameJavaScript) (info.getContent().getReplaceObject()));
return javaScript.getName();
}
}
},
/**
* ListenerJS
*/
LISTENER("Listener") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
addValue2Map(nameKey, ((Listener) o[0]).getName(), map);
addValue2Map(contentKey, ((JavaScriptImpl) (((Listener) o[0]).getAction())).getContent(), map);
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (((JSInfo) info).isContent()) {
if (operatorArray.size() > 0) {
JavaScriptImpl javaScript = (JavaScriptImpl) ((Listener) (info.getContent().getReplaceObject())).getAction();
info.updateOldStr(javaScript.getContent(), findStr);
javaScript.setContent(ShowValueUtils.replaceAll(javaScript.getContent(), findStr, replaceStr));
}
} else {
Listener listener = ((Listener) ((info.getContent().getReplaceObject())));
listener.setName(listener.getName().replaceAll(findStr, replaceStr));
}
}
@Override
public String getInfoShowStr(Info info) {
if (((JSInfo) info).isContent()) {
JavaScriptImpl javaScript = (JavaScriptImpl) ((Listener) (info.getContent().getReplaceObject())).getAction();
return javaScript.getContent();
} else {
Listener listener = ((Listener) (info.getContent().getReplaceObject()));
return listener.getName();
}
}
},
/**
* VanChartHtmlLabelJS
*/
VAN_CHART_HTML_LABEL("VanChartHtmlLabel") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
addValue2Map(contentKey, ((VanChartHtmlLabel) o[0]).getCustomText(), map);
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (((JSInfo) info).isContent()) {
if (operatorArray.size() > 0) {
VanChartHtmlLabel htmlLabel = ((VanChartHtmlLabel) (info.getContent().getReplaceObject()));
StringBuilder stringBuilder = new StringBuilder(htmlLabel.getCustomText());
info.updateOldStr(htmlLabel.getCustomText(), findStr);
htmlLabel.setCustomText(ShowValueUtils.replaceAll(htmlLabel.getCustomText(), findStr, replaceStr));
}
}
}
@Override
public String getInfoShowStr(Info info) {
VanChartHtmlLabel htmlLabel = ((VanChartHtmlLabel) (info.getContent().getReplaceObject()));
return htmlLabel.getCustomText();
}
},
/**
* JavaScriptImplJS
*/
JAVA_SCRIPT_IMPL("JavaScriptImpl") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
addValue2Map(contentKey, ((JavaScriptImpl) o[0]).getContent(), map);
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
JavaScriptImpl javaScript = (JavaScriptImpl) (info.getContent().getReplaceObject());
info.updateOldStr(javaScript.getContent(), findStr);
javaScript.setContent(ShowValueUtils.replaceAll(javaScript.getContent(), findStr, replaceStr));
}
@Override
public String getInfoShowStr(Info info) {
JavaScriptImpl javaScript = (JavaScriptImpl) (info.getContent().getReplaceObject());
return javaScript.getContent();
}
},
/**
* DBTableDataSQL
*/
DB_TABLE_DATA("DBTableData") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
addValue2Map(contentKey, ((DBTableData) o[0]).getQuery(), map);
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
DBTableData dbTableData = (DBTableData) info.getContent().getReplaceObject();
info.updateOldStr(dbTableData.getQuery(), findStr);
dbTableData.setQuery(ShowValueUtils.replaceAll(dbTableData.getQuery(), findStr, replaceStr));
}
@Override
public String getInfoShowStr(Info info) {
return info.getInfoShowStr(info);
}
};
String name;
String nameKey = "name";
String contentKey = "content";
ReplaceObject(String name) {
this.name = name;
}
/**
* 匹配
*
* @param name
* @return
*/
@Nullable
public static ReplaceObject match(String name) {
ReplaceObject[] values = ReplaceObject.values();
for (ReplaceObject value : values) {
if (value.name.equals(name)) {
return value;
}
}
return null;
}
/**
* 将键值放入Map中
*
* @param flag
* @param content
* @param map
*/
public void addValue2Map(String flag, String content, Map map) {
if (StringUtils.isNotEmpty(content)) {
map.put(flag, content);
}
}
}

71
designer-realize/src/main/java/com/fr/design/actions/replace/info/SQLInfo.java

@ -0,0 +1,71 @@
package com.fr.design.actions.replace.info;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.stable.AssistUtils;
import com.fr.stable.collections.combination.Pair;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 存储SQL信息的Info
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-16
*/
public class SQLInfo implements Info {
private ITContent content;
public SQLInfo(ITContent content) {
this.content = content;
}
@Override
public ITContent getContent() {
return content;
}
public void setContent(ITContent content) {
this.content = content;
}
@Override
public Map<String, String> getValue(Object... objects) {
ReplaceObject o = ReplaceObject.match(this.content.getReplaceObject().getClass().getSimpleName());
if (o != null) {
return o.getValue(this.content.getReplaceObject());
}
return new HashMap<>();
}
/**
* 复制
* @return
*/
public SQLInfo copy() {
ITContent content = ITContent.copy(this.getContent());
return new SQLInfo(content);
}
@Override
public String toString() {
return AssistUtils.toString(this);
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
ReplaceObject o = ReplaceObject.match(this.content.getReplaceObject().getClass().getSimpleName());
if (o != null) {
o.setValue(this, findStr, replaceStr, operatorArray);
}
}
@Override
public String getInfoShowStr(Info info) {
return this.getContent().getOldShowStr();
}
}

128
designer-realize/src/main/java/com/fr/design/actions/replace/info/WidgetInfo.java

@ -0,0 +1,128 @@
package com.fr.design.actions.replace.info;
import com.fr.design.actions.replace.action.content.widget.FrmWidgetType;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.form.ui.WaterMark;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.stable.AssistUtils;
import com.fr.stable.collections.combination.Pair;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 存储控件信息的Info
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-16
*/
public class WidgetInfo implements Info, DealWithInfoValue {
private ITContent content;
private boolean waterMarkFlag = true;
public WidgetInfo(ITContent content) {
this.content = content;
}
@Override
public ITContent getContent() {
return content;
}
public void setContent(ITContent content) {
this.content = content;
}
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
Widget widget = (Widget) this.content.getReplaceObject();
if (widget instanceof WScaleLayout) {
widget = ((CRBoundsWidget) ((WScaleLayout) widget).getWidget(0)).getWidget();
}
if (widget.getWidgetName() != null) {
map.put("name", widget.getWidgetName());
}
if (widget instanceof WaterMark && (((WaterMark) widget).getWaterMark() != null)) {
map.put("waterMark", ((WaterMark) widget).getWaterMark());
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Widget widget = ((Widget) (this.content.getReplaceObject()));
if (this.getContent().isFrm()) {
FrmWidgetType widgetType = FrmWidgetType.match(widget.getClass().getSimpleName());
if (widgetType != null) {
widgetType.setValue(info, findStr, replaceStr, this.getContent().getOperatorArray());
}
} else {
if (isWaterMark()) {
updateOldStr(((WaterMark) widget).getWaterMark(), findStr);
((WaterMark) widget).setWaterMark(ShowValueUtils.replaceAll(((WaterMark) widget).getWaterMark(), findStr, replaceStr));
} else {
updateOldStr(widget.getWidgetName(), findStr);
widget.setWidgetName(ShowValueUtils.replaceAll(widget.getWidgetName(), findStr, replaceStr));
}
}
}
@Override
public String getInfoShowStr(Info info) {
return this.getContent().getOldShowStr();
}
/**
* 复制
*
* @param widgetInfo
* @return
*/
public WidgetInfo copy(WidgetInfo widgetInfo) {
ITContent content = ITContent.copy(widgetInfo.getContent());
return new WidgetInfo(content);
}
/**
* 是否存储水印
*
* @return
*/
public boolean isWaterMark() {
return waterMarkFlag;
}
public void setWaterMarkFlag(boolean waterMarkFlag) {
this.waterMarkFlag = waterMarkFlag;
}
/**
* ReplaceObject是否存在
*
* @return
*/
public boolean isReplaceObjectExist() {
return content != null && content.getReplaceObject() != null;
}
/**
* toString
*
* @return
*/
@Override
public String toString() {
return AssistUtils.toString(this);
}
}

285
designer-realize/src/main/java/com/fr/design/actions/replace/info/base/ITContent.java

@ -0,0 +1,285 @@
package com.fr.design.actions.replace.info.base;
import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
import java.util.ArrayList;
import java.util.List;
/**
* 主要的存储信息的数据结构
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-11
*/
public class ITContent implements Cloneable {
private String sheetID;
private String sheetName;
private String templateName;
private String blockName;
/**
* 一些不好定位的位置先用字符串展示出来就好
*/
private String otherPos;
/**
* 用于操作替换相关的对象通过此属性获取所需的对象
*/
private Object replaceObject;
/**
* 用于展示给用户的位置
*/
private Object showObject;
/**
* 用于展示内容
*/
private String showStr;
/**
* 存储展示前的旧值
*/
private String oldShowStr;
/**
* 存储上一次搜索的string
*/
private String lastSearchStr;
/**
* 由于我们TRL是一次性的这边存字符串到时候new一个即可
*/
private String trlString;
/**
* 为操作字符串提供操作位置的定位信息Pair中存储的是开始操作的索引以及结束操作的索引
*/
private List<Pair<Integer, Integer>> operatorArray;
/**
* 是否是决策报表用于判断一些决策报表的特殊操作比如决策报表控件在设置值时要多设置几个地方一层套一层
*/
private boolean frmFlag = false;
/**
* 是否被选中
*/
private boolean selected = true;
/**
* 是否可跳转
*/
private boolean jumpAble = true;
public ITContent() {
this.sheetID = StringUtils.EMPTY;
this.sheetName = StringUtils.EMPTY;
this.blockName = StringUtils.EMPTY;
this.templateName = StringUtils.EMPTY;
this.otherPos = StringUtils.EMPTY;
this.replaceObject = StringUtils.EMPTY;
this.showObject = StringUtils.EMPTY;
this.showStr = StringUtils.EMPTY;
this.oldShowStr = StringUtils.EMPTY;
this.lastSearchStr = StringUtils.EMPTY;
this.trlString = StringUtils.EMPTY;
this.operatorArray = new ArrayList<>();
}
/**
* 复制
*
* @return
*/
public static ITContent copy(ITContent content) {
ITContent result = new ITContent();
result.setSheetID(content.getSheetID());
result.setSheetName(content.getSheetName());
result.setTemplateName(content.getTemplateName());
result.setBlockName(content.getBlockName());
result.addOtherPos(content.getOtherPos());
result.setReplaceObject(content.getReplaceObject());
result.setShowObject(content.getShowObject());
result.setTrlString(content.getTrlString());
result.setShowStr(content.getShowStr());
result.setOldShowStr(content.getOldShowStr());
result.setLastSearchStr(content.getLastSearchStr());
result.setOperatorArray(content.getOperatorArray());
result.setFrmFlag(content.isFrm());
result.setJumpAble(content.isJumpAble());
return result;
}
public Object getReplaceObject() {
return replaceObject;
}
public void setReplaceObject(Object replaceObject) {
this.replaceObject = replaceObject;
}
public String getSheetID() {
return sheetID;
}
public void setSheetID(String sheetID) {
this.sheetID = sheetID;
}
public String getSheetName() {
return sheetName;
}
public void setSheetName(String sheetName) {
this.sheetName = sheetName;
}
public String getTemplateName() {
return templateName;
}
public void setTemplateName(String templateName) {
this.templateName = templateName;
}
public String getBlockName() {
return blockName;
}
public void setBlockName(String blockName) {
this.blockName = blockName;
}
public String getOtherPos() {
return otherPos;
}
public Object getShowObject() {
return showObject;
}
public String getShowStr() {
return showStr;
}
public void setShowStr(String showStr) {
this.showStr = showStr;
}
public String getTrlString() {
return trlString;
}
public void setTrlString(String trlString) {
this.trlString = trlString;
}
public void setShowObject(Object showObject) {
this.showObject = showObject;
}
/**
* 添加位置信息
*
* @param otherPoses
*/
public void addOtherPos(String... otherPoses) {
for (String otherPos : otherPoses) {
if (StringUtils.isNotEmpty(this.otherPos)) {
this.otherPos = this.otherPos + "-" + otherPos;
} else {
this.otherPos = otherPos;
}
}
}
/**
* 添加跳转路径
*
* @param trlString
*/
public void addTRL(String trlString) {
if (StringUtils.isNotEmpty(trlString)) {
if (StringUtils.isNotEmpty(this.trlString)) {
this.trlString = this.trlString + ":" + trlString;
} else {
this.trlString = trlString;
}
}
}
public List<Pair<Integer, Integer>> getOperatorArray() {
return operatorArray;
}
public void setOperatorArray(List<Pair<Integer, Integer>> operatorArray) {
this.operatorArray = operatorArray;
}
public void setOtherPos(String otherPos) {
this.otherPos = otherPos;
}
/**
* 是否选中
*
* @return
*/
public boolean isSelected() {
return selected;
}
/**
* 设置选中
*
* @param selected
*/
public void setSelected(boolean selected) {
this.selected = selected;
}
/**
* 是否是决策报表
*
* @return
*/
public boolean isFrm() {
return frmFlag;
}
public void setFrmFlag(boolean frmFlag) {
this.frmFlag = frmFlag;
}
public String getOldShowStr() {
return oldShowStr;
}
public void setOldShowStr(String oldShowStr) {
this.oldShowStr = oldShowStr;
}
public String getLastSearchStr() {
return lastSearchStr;
}
public void setLastSearchStr(String lastSearchStr) {
this.lastSearchStr = lastSearchStr;
}
public boolean isJumpAble() {
return jumpAble;
}
public void setJumpAble(boolean jumpAble) {
this.jumpAble = jumpAble;
}
public boolean isFrmFlag() {
return frmFlag;
}
@Override
public String toString() {
return AssistUtils.toString(this);
}
}

118
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITComboBoxEditor.java

@ -0,0 +1,118 @@
package com.fr.design.actions.replace.ui;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.ComparatorUtils;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import javax.swing.plaf.basic.BasicComboBoxEditor;
import java.awt.Component;
import java.awt.Insets;
import java.awt.event.ActionListener;
import java.lang.reflect.Method;
/**
* 渲染带有默认值的ComboBox
* UIComboBox中设置默认值会整体上移需要自己重新实现一个
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-02
*/
public class ITComboBoxEditor extends BasicComboBoxEditor {
protected UITextField textField;
private Object oldValue;
/**
* 构造时重新设置一下TextField的上边距
*/
public ITComboBoxEditor() {
textField = new UITextField() {
@Override
public Insets getInsets() {
return new Insets(4, 4, 0, 4);
}
};
textField.setRectDirection(Constants.RIGHT);
}
@Override
public Component getEditorComponent() {
return textField;
}
/**
* 设置选项
*
* @param anObject 选项
*/
@Override
public void setItem(Object anObject) {
if (anObject != null) {
textField.setText(anObject.toString());
oldValue = anObject;
} else {
textField.setText(StringUtils.EMPTY);
}
}
/**
* 获取选项
*
* @return 选项
*/
@Override
public Object getItem() {
Object newValue = textField.getText();
if (oldValue != null && !(oldValue instanceof String)) {
// The original value is not a string. Should return the value in it's
// original type.
if (ComparatorUtils.equals(newValue, oldValue.toString())) {
return oldValue;
} else {
// Must take the value from the textField and get the value and cast it to the new type.
Class cls = oldValue.getClass();
try {
Method method = cls.getMethod("valueOf", new Class[]{String.class});
newValue = method.invoke(oldValue, new Object[]{textField.getText()});
} catch (Exception ignored) {
// Fail silently and return the newValue (a String object)
}
}
}
return newValue;
}
/**
* 选择所有
*/
@Override
public void selectAll() {
textField.selectAll();
textField.requestFocus();
}
/**
* 添加监听
*
* @param l 监听
*/
@Override
public void addActionListener(ActionListener l) {
textField.addActionListener(l);
}
/**
* 移除监听
*
* @param l 监听
*/
@Override
public void removeActionListener(ActionListener l) {
textField.removeActionListener(l);
}
}

302
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java

@ -0,0 +1,302 @@
package com.fr.design.actions.replace.ui;
import com.fr.design.actions.replace.action.ShowSearchResultAction;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/**
* 主面板
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-08-10
*/
public class ITReplaceMainDialog extends UIDialog {
List<? extends Info> searchResultList = new ArrayList<>();
private static boolean ITReplaceFlag = false;
private static volatile ITReplaceMainDialog instance = null;
private static String templateID;
private ITReplaceNorthPanel northPane;
private ITReplaceSouthPanel southPanel;
private ITReplaceWestPanel westPanel;
private boolean searchFlag;
private String searchStr;
private ITReplaceMainDialog() {
super(DesignerContext.getDesignerFrame());
init();
}
/**
* 初始化
*/
public void init() {
setTitle(Toolkit.i18nText("Fine-Design_Replace_Title"));
initFrame();
fitScreen();
ITReplaceFlag = true;
}
/**
* DCL
*
* @return 面板
*/
public static ITReplaceMainDialog getInstance() {
if (instance == null) {
synchronized (ITReplaceMainDialog.class) {
if (instance == null) {
instance = new ITReplaceMainDialog();
}
}
}
instance.fitScreen();
return instance;
}
/**
* 适配屏幕
*/
public void fitScreen() {
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
int height = 385;
int width = jTemplate.getWidth();
Point point = jTemplate.getLocationOnScreen();
setModal(false);
setMaximumSize(new Dimension(jTemplate.getWidth(), jTemplate.getHeight()));
setMinimumSize(new Dimension(jTemplate.getWidth(), 240));
setSize(width, height);
setLocation(new Point(point.x, point.y + jTemplate.getHeight() / 2 + jTemplate.getHeight() / 2 - 385));
northPane.fitScreen(0, 0, jTemplate.getWidth());
}
/**
* 创建面板
*/
public void initFrame() {
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
northPane = new ITReplaceNorthPanel();
southPanel = new ITReplaceSouthPanel();
westPanel = new ITReplaceWestPanel();
northPane.fitScreen(0, 0, jTemplate.getWidth());
JPanel center = new JPanel(new BorderLayout());
northPane.getFindInputCombobox().setEditable(true);
northPane.getReplaceInputCombobox().setEditable(false);
((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).setPlaceholder(Toolkit.i18nText("Fine-Design_Replace_Search_Input"));
((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).setPlaceholder(Toolkit.i18nText("Fine-Design_Replace_Input"));
((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
search();
String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText();
if (StringUtils.isNotEmpty(searchStr)) {
((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).setEditable(true);
northPane.getReplaceInputCombobox().setEditable(true);
} else {
((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).setEditable(false);
northPane.getReplaceInputCombobox().setEditable(false);
}
}
});
northPane.getSearchButton().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
search();
String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText();
if (StringUtils.isNotEmpty(searchStr)) {
((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).setEditable(true);
northPane.getReplaceInputCombobox().setEditable(true);
} else {
((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).setEditable(false);
northPane.getReplaceInputCombobox().setEditable(false);
}
}
});
northPane.getReplaceButton().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (isSearchFlag()) {
replace();
}
}
});
center.add(northPane.getUpPanel(), BorderLayout.NORTH);
center.add(southPanel.getTableEditorPane(), BorderLayout.CENTER);
add(westPanel.getLeftJpanel(), BorderLayout.WEST);
//主体部分
add(center, BorderLayout.CENTER);
center.setVisible(true);
}
/**
* 替换
*/
private void replace() {
if (isITReplaceValid() && checkTemplateChanged(searchResultList)) {
String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText();
String replaceStr = ((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).getText();
for (Info info : searchResultList) {
if (info.getContent().isSelected()) {
info.setValue(info, searchStr, replaceStr, info.getContent().getOperatorArray());
ShowValueUtils.updateHighlight(info, replaceStr);
}
}
southPanel.getTableEditorPane().update();
northPane.refreshReplaceInputComboBoxItems();
ITTableEditorPane.getEditTable().repaint();
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(true);
setSearchFlag(false);
} else {
Object[] options = new Object[]{Toolkit.i18nText("Fine-Design_Replace_Search_Again"), Toolkit.i18nText("Fine-Design_Basic_Cancel")};
int optionSelected = FineJOptionPane.showOptionDialog(
ITReplaceMainDialog.this,
Toolkit.i18nText("Fine-Design_Replace_Message"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.ERROR_MESSAGE,
null,
// 如果传null, 则按钮为 optionType 类型所表示的按钮(也就是确认对话框)
options,
options[0]
);
//如果选择了重新查找,则再查找一遍
if (optionSelected == 0) {
search();
}
}
}
private Boolean checkTemplateChanged(List<? extends Info> searchResultList) {
for (Info info : searchResultList) {
if (!info.checkValid()) {
return false;
}
}
return true;
}
/**
* 可行性判定模板是否可用是否是同个模板
*
* @return 检查无误则返回true
*/
public boolean isITReplaceValid() {
if (JTemplate.isValid(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate())) {
return StringUtils.equals(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget().getTemplateID(), templateID);
} else {
return false;
}
}
/**
* 是否选择过
*
* @return
*/
public boolean isSearchFlag() {
return searchFlag;
}
public void setSearchFlag(boolean searchFlag) {
this.searchFlag = searchFlag;
}
public String getSearchStr() {
return searchStr;
}
public void setSearchStr(String searchStr) {
this.searchStr = searchStr;
}
/**
* 设置标签
*
* @param ITReplaceFlag
*/
public static void setITReplaceFlag(boolean ITReplaceFlag) {
ITReplaceMainDialog.ITReplaceFlag = ITReplaceFlag;
}
/**
* 定位执行标签
*
* @return
*/
public static boolean isITReplaceFlag() {
return ITReplaceFlag;
}
/**
* 搜索
*/
public void search() {
ITTableEditor itTableEditor = southPanel.getItTableEditor();
if (JTemplate.isValid(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate())) {
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
templateID = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget().getTemplateID();
itTableEditor.clear();
ShowSearchResultAction searchAction = ShowSearchResultAction.match(GeneralUtils.objectToString(northPane.getFindCombobox().getSelectedItem()));
if (searchAction != null) {
searchResultList = searchAction.addMatchResult(((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText(), searchAction.showSearchValue(jTemplate));
itTableEditor.add(searchResultList);
northPane.getResultLabel().setText("<html>" + Toolkit.i18nText("Fine-Design_Replace_Search_Finish") + "<font color = 'rgb(61,153,249)'>" + searchResultList.size() + "</font>" + Toolkit.i18nText("Fine-Design_Replace_Result"));
}
itTableEditor.fireTableDataChanged();
northPane.refreshFindInputComboBoxItems();
setSearchFlag(true);
} else {
//todo
}
}
/**
* 检测结果是否合法
*/
@Override
public void checkValid() throws Exception {
}
}

368
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java

@ -0,0 +1,368 @@
package com.fr.design.actions.replace.ui;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.StringUtils;
import javax.swing.ComboBoxEditor;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.Collections;
/**
* 上面板
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-01
*/
public class ITReplaceNorthPanel {
private JPanel upPanel;
private UILabel findLabel;
private UILabel rangeLabel;
private UILabel resultLabel;
private UIComboBox findCombobox;
private UIComboBox rangeCombobox;
private JCheckBox matchRadioButton;
private UIComboBox findInputCombobox;
private UIComboBox replaceInputCombobox;
private UIButton replaceButton;
private UIButton searchButton;
//存储的5次最近输入
private int maxItemCount = 5;
private int findLabelX, findLabelY, findLabelWidth, findLabelHeight;
private int findComboBoxX, findComboBoxY, findComboBoxWidth, findComboBoxHeight;
private int rangeLabelX, rangeLabelY, rangeLabelWidth, rangeLabelHeight;
private int rangeComboBoxX, rangeComboBoxY, rangeComboBoxWidth, rangeComboBoxHeight;
private int matchX, matchY, matchWidth, matchHeight;
private int resultLabelX, resultLabelY, resultLabelWidth, resultLabelHeight;
private int findInputComboBoxX, findInputComboBoxY, findInputComboBoxWidth, findInputComboBoxHeight;
private int replaceInputComboBoxX, replaceInputComboBoxY, replaceInputComboBoxWidth, replaceInputComboBoxHeight;
private int replaceButtonX, replaceButtonY, replaceButtonWidth, replaceButtonHeight;
private int searchButtonX, searchButtonY, searchButtonWidth, searchButtonHeight;
private int buttonGap;
public static ArrayList<String> findItems = new ArrayList<>();
public static ArrayList<String> findInputItems = new ArrayList<>();
public static ArrayList<String> replaceInputItems = new ArrayList<>();
static {
findItems.add(Toolkit.i18nText("Fine-Design_Basic_Cell"));
findItems.add(Toolkit.i18nText("Fine-Design_Replace_JS"));
findItems.add("SQL");
findItems.add(Toolkit.i18nText("Fine-Design_Basic_Float_Element"));
findItems.add(Toolkit.i18nText("Fine-Design_Replace_Component"));
findItems.add(Toolkit.i18nText("Fine-Design_Basic_Widget"));
findItems.add(Toolkit.i18nText("Fine-Design_Basic_Formula"));
}
public ITReplaceNorthPanel() {
upPanel = new JPanel(null);
findLabel = new UILabel(Toolkit.i18nText("Fine-Design_Replace_Search_Element"));
rangeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Replace_Search_Range"));
resultLabel = new UILabel();
String[] rangeItems = new String[]{Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current")};
String[] replaceInputItems = new String[]{""};
findCombobox = new UIComboBox(findItems.toArray());
rangeCombobox = new UIComboBox(rangeItems);
findInputCombobox = new UIComboBox(findInputItems.toArray()) {
@Override
public void setEditor(ComboBoxEditor comboBoxEditor) {
super.setEditor(new ITComboBoxEditor());
}
};
replaceInputCombobox = new UIComboBox(replaceInputItems) {
@Override
public void setEditor(ComboBoxEditor comboBoxEditor) {
super.setEditor(new ITComboBoxEditor());
}
};
matchRadioButton = new JCheckBox(Toolkit.i18nText("Fine-Design_Replace_WildCard"));
replaceButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button"));
searchButton = new UIButton(Toolkit.i18nText("Fine-Design_Search_Button"));
setLimitSize(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getWidth());
upPanel.add(findLabel);
upPanel.add(rangeLabel);
upPanel.add(resultLabel);
upPanel.add(findCombobox);
upPanel.add(rangeCombobox);
upPanel.add(findInputCombobox);
upPanel.add(replaceInputCombobox);
upPanel.add(matchRadioButton);
upPanel.add(replaceButton);
upPanel.add(searchButton);
}
/**
* 限制尺寸
*
* @param width
*/
public void setLimitSize(int width) {
upPanel.setMaximumSize(new Dimension(width, 161));
upPanel.setMinimumSize(new Dimension(width, 161));
upPanel.setPreferredSize(new Dimension(width, 161));
}
/**
* 适配屏幕
*
* @param x
* @param y
* @param templateWidth
*/
public void fitScreen(int x, int y, int templateWidth) {
setFindLabelBounds(x, y, templateWidth);
setRangeLabelBounds(x, y, templateWidth);
setResultLabelBounds(x, y, templateWidth);
setFindComboboxBounds(x, y, templateWidth);
setRangeComboboxBounds(x, y, templateWidth);
setFindInputComboboxBounds(x, y, templateWidth);
setReplaceInputComboboxBounds(x, y, templateWidth);
setUIRadioButtonBounds(x, y, templateWidth);
setReplaceButtonBounds(x, y, templateWidth);
setSearchButtonBounds(x, y, templateWidth);
}
/**
* 刷新输入框
*/
public void refreshFindInputComboBoxItems() {
String text = ((UITextField) (this.getFindInputCombobox().getEditor().getEditorComponent())).getText();
if (StringUtils.isNotEmpty(text)) {
if (findInputItems.contains(text)) {
Collections.swap(findInputItems, 0, findInputItems.indexOf(text));
} else {
if (findInputItems.size() >= maxItemCount) {
findInputItems.remove(maxItemCount - 1);
findInputItems.add(0, text);
} else {
findInputItems.add(0, text);
}
}
this.getFindInputCombobox().refreshBoxItems(ITReplaceNorthPanel.findInputItems);
((UITextField) (this.getFindInputCombobox().getEditor().getEditorComponent())).setText(text);
}
}
/**
* 刷新替换框
*/
public void refreshReplaceInputComboBoxItems() {
String text = ((UITextField) (this.getReplaceInputCombobox().getEditor().getEditorComponent())).getText();
if (StringUtils.isNotEmpty(text)) {
if (replaceInputItems.contains(text)) {
Collections.swap(replaceInputItems, 0, replaceInputItems.indexOf(text));
} else {
if (replaceInputItems.size() >= maxItemCount) {
replaceInputItems.remove(maxItemCount - 1);
replaceInputItems.add(0, text);
} else {
replaceInputItems.add(0, text);
}
}
this.getReplaceInputCombobox().refreshBoxItems(ITReplaceNorthPanel.replaceInputItems);
((UITextField) (this.getReplaceInputCombobox().getEditor().getEditorComponent())).setText(text);
}
}
private void setSearchButtonBounds(int x, int y, int templateWidth) {
buttonGap = templateWidth / 90;
searchButtonWidth = templateWidth / 30;
searchButtonHeight = 25;
searchButtonY = resultLabelY;
searchButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - replaceButtonWidth * 2 - buttonGap;
searchButton.setBounds(searchButtonX, searchButtonY, searchButtonWidth, searchButtonHeight);
}
private void setReplaceButtonBounds(int x, int y, int templateWidth) {
buttonGap = templateWidth / 90;
replaceButtonWidth = templateWidth / 30;
replaceButtonHeight = 25;
replaceButtonY = resultLabelY;
replaceButtonX = replaceInputComboBoxX + replaceInputComboBoxWidth - replaceButtonWidth;
replaceButton.setBounds(replaceButtonX, replaceButtonY, replaceButtonWidth, replaceButtonHeight);
}
private void setReplaceInputComboboxBounds(int x, int y, int templateWidth) {
replaceInputComboBoxX = x + templateWidth / 2 + templateWidth / 30;
replaceInputComboBoxY = y + 55;
replaceInputComboBoxWidth = templateWidth / 3 + templateWidth / 30 * 2;
replaceInputComboBoxHeight = 25;
replaceInputCombobox.setBounds(replaceInputComboBoxX, replaceInputComboBoxY, replaceInputComboBoxWidth, replaceInputComboBoxHeight);
}
private void setFindInputComboboxBounds(int x, int y, int templateWidth) {
findInputComboBoxX = x + templateWidth / 60;
findInputComboBoxY = y + 55;
findInputComboBoxWidth = templateWidth / 3 + templateWidth / 30 * 2;
findInputComboBoxHeight = 25;
findInputCombobox.setBounds(findInputComboBoxX, findInputComboBoxY, findInputComboBoxWidth, findInputComboBoxHeight);
}
private void setUIRadioButtonBounds(int x, int y, int templateWidth) {
matchX = x + templateWidth / 60;
matchY = y + 90;
matchWidth = templateWidth;
matchHeight = 25;
matchRadioButton.setBounds(matchX, matchY, matchWidth, matchHeight);
}
private void setRangeComboboxBounds(int x, int y, int templateWidth) {
rangeComboBoxX = x + templateWidth / 2 + templateWidth / 15 + templateWidth / 60;
rangeComboBoxY = y + 20;
rangeComboBoxWidth = templateWidth / 3 + templateWidth / 60;
rangeComboBoxHeight = 25;
rangeCombobox.setBounds(rangeComboBoxX, rangeComboBoxY, rangeComboBoxWidth, rangeComboBoxHeight);
}
private void setFindComboboxBounds(int x, int y, int templateWidth) {
findComboBoxX = x + templateWidth / 30 * 2;
findComboBoxY = y + 20;
findComboBoxWidth = templateWidth / 3 + templateWidth / 60;
findComboBoxHeight = 25;
findCombobox.setBounds(findComboBoxX, findComboBoxY, findComboBoxWidth, findComboBoxHeight);
}
private void setResultLabelBounds(int x, int y, int templateWidth) {
resultLabelX = findLabelX;
resultLabelY = y + 125;
resultLabelWidth = templateWidth;
resultLabelHeight = 25;
resultLabel.setBounds(resultLabelX, resultLabelY, resultLabelWidth, resultLabelHeight);
}
private void setRangeLabelBounds(int x, int y, int templateWidth) {
rangeLabelX = x + templateWidth / 2 + templateWidth / 30;
rangeLabelY = y + 20;
rangeLabelWidth = findLabelWidth;
rangeLabelHeight = 25;
rangeLabel.setBounds(rangeLabelX, rangeLabelY, rangeLabelWidth, rangeLabelHeight);
}
private void setFindLabelBounds(int x, int y, int templateWidth) {
findLabelX = x + templateWidth / 60;
findLabelY = y + 20;
findLabelWidth = templateWidth / 20;
findLabelHeight = 25;
findLabel.setBounds(findLabelX, findLabelY, findLabelWidth, findLabelHeight);
}
public JPanel getUpPanel() {
return upPanel;
}
public void setUpPanel(JPanel upPanel) {
this.upPanel = upPanel;
}
public UILabel getFindLabel() {
return findLabel;
}
public void setFindLabel(UILabel findLabel) {
this.findLabel = findLabel;
}
public UILabel getRangeLabel() {
return rangeLabel;
}
public void setRangeLabel(UILabel rangeLabel) {
this.rangeLabel = rangeLabel;
}
public UILabel getResultLabel() {
return resultLabel;
}
public void setResultLabel(UILabel resultLabel) {
this.resultLabel = resultLabel;
}
public UIComboBox getFindCombobox() {
return findCombobox;
}
public void setFindCombobox(UIComboBox findCombobox) {
this.findCombobox = findCombobox;
}
public UIComboBox getRangeCombobox() {
return rangeCombobox;
}
public void setRangeCombobox(UIComboBox rangeCombobox) {
this.rangeCombobox = rangeCombobox;
}
public JCheckBox getMatchRadioButton() {
return matchRadioButton;
}
public void setMatchRadioButton(JCheckBox checkBox) {
this.matchRadioButton = checkBox;
}
public UIComboBox getFindInputCombobox() {
return findInputCombobox;
}
public void setFindInputCombobox(UIComboBox findInputCombobox) {
this.findInputCombobox = findInputCombobox;
}
public UIComboBox getReplaceInputCombobox() {
return replaceInputCombobox;
}
public void setReplaceInputCombobox(UIComboBox replaceInputCombobox) {
this.replaceInputCombobox = replaceInputCombobox;
}
public UIButton getReplaceButton() {
return replaceButton;
}
public void setReplaceButton(UIButton replaceButton) {
this.replaceButton = replaceButton;
}
public UIButton getSearchButton() {
return searchButton;
}
public void setSearchButton(UIButton searchButton) {
this.searchButton = searchButton;
}
}

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

Loading…
Cancel
Save