Browse Source

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

feature/x
Jimmy.Zheng 2 years ago
parent
commit
42a4eb898e
  1. 4
      designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java
  2. 30
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java
  3. 31
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java
  4. 4
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/MenuLabel.java
  5. 19
      designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceHelper.java
  6. 12
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java
  7. 18
      designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java
  8. 3
      designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java
  9. 1
      designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java
  10. 2
      designer-realize/src/main/java/com/fr/design/actions/replace/action/SearchManagerCenter.java
  11. 31
      designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowSearchResultAction.java
  12. 5
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/floatelement/SearchFloatAction.java
  13. 64
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java
  14. 2
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchCellFormulaManager.java
  15. 124
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java
  16. 1
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/condition/SearchFormulaConditionAction.java
  17. 18
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchCommit2DBJSFormulaAction.java
  18. 15
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/highlight/javascript/SearchExportJSFormulaAction.java
  19. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchDateEditorFormulaAction.java
  20. 40
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/widget/SearchTreeEditorFormulaAction.java
  21. 45
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchChartJSAction.java
  22. 35
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/SearchWebJSAction.java
  23. 28
      designer-realize/src/main/java/com/fr/design/actions/replace/info/CellInfo.java
  24. 24
      designer-realize/src/main/java/com/fr/design/actions/replace/info/ReplaceObject.java
  25. 21
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java
  26. 5
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java
  27. 11
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java
  28. 9
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java
  29. 25
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java
  30. 22
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java
  31. 25
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java
  32. 18
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java
  33. 113
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java
  34. 48
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/TemplateResourceDetail.java
  35. 3
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java
  36. 6
      designer-realize/src/test/java/com.fr/design/mainframe/alphafine/cell/model/ModelTest.java

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

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

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

@ -114,7 +114,9 @@ public class AlphaFineConfigPane extends BasicPane {
customSortLabel = new ActionLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Config_Custom_Sort"), false);
customSortLabel.setForeground(UIConstants.NORMAL_BLUE);
customSortLabel.addActionListener((event)->{
if (customSortLabel.isEnabled()) {
openCustomSortMenu();
}
});
customSortWrapperPane.add(customSortLabel);
if (!hasSelectedSearchRangeCheckBox()) {
@ -178,25 +180,25 @@ public class AlphaFineConfigPane extends BasicPane {
return res;
}
// 搜索范围-我的模板
/**
* 搜索范围-我的模板
*/
private void initMyTemplateSearchPane() {
containMyTemplatePane = new JPanel(new FlowLayout(FlowLayout.LEFT,4,5));
containMyTemplatePane = new JPanel(new FlowLayout(FlowLayout.LEFT, 4, 5));
containMyTemplateCheckbox.setBorder(BorderFactory.createEmptyBorder());
containMyTemplateCheckbox.addActionListener(
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (containMyTemplateCheckbox.isSelected()) {
myTemplateSearchConfigButton.setVisible(true);
} else {
myTemplateSearchConfigButton.setVisible(false);
}
}
containMyTemplateCheckbox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (containMyTemplateCheckbox.isSelected()) {
myTemplateSearchConfigButton.setVisible(true);
} else {
myTemplateSearchConfigButton.setVisible(false);
}
);
}
});
myTemplateSearchConfigButton = new JButton();
myTemplateSearchConfigButton.setBorder(BorderFactory.createEmptyBorder());
myTemplateSearchConfigButton.setMargin(new Insets(0,0,0,0));
myTemplateSearchConfigButton.setMargin(new Insets(0, 0, 0, 0));
myTemplateSearchConfigButton.setIcon(IconUtils.readIcon("/com/fr/design/mainframe/alphafine/images/config.svg"));
myTemplateSearchMenu = new UIPopupMenu();
containTemplateNameSearchCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_AlphaFine_Config_Name_Search"));

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

@ -74,10 +74,14 @@ public class CustomSortPane extends JPanel {
}
private void createToolbarPane() {
top = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/top.svg"));
bottom = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/bottom.svg"));
up = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/up.svg"));
down = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/down.svg"));
top = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/top.svg"), false);
bottom = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/bottom.svg"), false);
up = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/up.svg"), false);
down = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/down.svg"), false);
top.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/top_disable.svg"));
bottom.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/bottom_disable.svg"));
up.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/up_disable.svg"));
down.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/down_disable.svg"));
top.addActionListener(e -> {
SwingUtilities.invokeLater(() -> {
sortItemPane.setComponentZOrder(selectedLabel, 0);
@ -132,6 +136,7 @@ public class CustomSortPane extends JPanel {
for (UICheckBox item : sortItems) {
MenuLabel label = new MenuLabel(item.getText(), (Function<MenuLabel, Object>) o -> {
selectedLabel = o;
disableButton();
return null;
});
sortLabels.add(label);
@ -140,6 +145,24 @@ public class CustomSortPane extends JPanel {
sortItemPane = new MenuLabelPane(sortLabels);
}
/**
* 如果选中第一个和最后一个则置灰向上和向下的按钮
*/
private void disableButton() {
int order = sortItemPane.getComponentZOrder(selectedLabel);
if (order == 0) {
top.setEnabled(false);
up.setEnabled(false);
} else if (order == sortItemPane.getComponentCount() - 1) {
down.setEnabled(false);
bottom.setEnabled(false);
} else {
up.setEnabled(true);
top.setEnabled(true);
down.setEnabled(true);
bottom.setEnabled(true);
}
}
private void refreshCurrentOrder() {
String[] currentTabOrder = parentPane.getCurrentOrder();

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

@ -61,10 +61,10 @@ public class MenuLabel extends UILabel {
parentMenu.setNoneSelected();
setBackground(SELECTED_COLOR);
function.apply(this);
selected = true;
this.selected = true;
} else {
setBackground(BACKGROUND_COLOR);
selected = false;
this.selected = false;
}
}

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

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

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

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

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

@ -1,6 +1,7 @@
package com.fr.design.module;
import com.fr.base.chart.BaseChartCollection;
import com.fr.design.actions.help.replace.ITReplaceHelper;
import com.fr.design.gui.chart.BaseChartPropertyPane;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.design.gui.chart.MiddleChartDialog;
@ -50,6 +51,7 @@ public class DesignModuleFactory {
private Class ITReplaceAction;
private Class formParaDesigner;
private Class paraPropertyPane;
private static ITReplaceHelper replaceHelper;
private Class<? extends HierarchyTreePane> formHierarchyPaneCls;
private Class<? extends BaseWidgetPropertyPane> widgetPropertyPane;
private Class buttonDetailPaneClass;
@ -131,6 +133,22 @@ public class DesignModuleFactory {
return instance.ITReplaceAction;
}
/**
* 注册一下查找替换面板
* @param
*/
public static void registerReplace(ITReplaceHelper replace) {
replaceHelper = replace;
}
/**
* 获取查找替换面板的操作类
* @return
*/
public static ITReplaceHelper getReplaceOperator() {
return replaceHelper;
}
public static void registerParaPropertyPaneClass(Class p) {
instance.paraPropertyPane = p;
}

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

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

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

@ -55,6 +55,7 @@ public class ITReplaceAction extends UpdateAction {
*/
public void actionPerformed(ActionEvent event) {
ITReplaceMainDialog mainFrame = ITReplaceMainDialog.getInstance();
mainFrame.fitScreen();
mainFrame.setVisible(true);
}

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

@ -61,7 +61,7 @@ public class SearchManagerCenter {
*/
public enum ManagerType implements SearchManager {
/**
* 注册单元格不同值类型中自己特有的公式数据列子报表公式富文本可自己添加
* 注册单元格不同值类型中自己特有的公式数据列子报表公式可自己添加
*/
CELL_FORMULA(0) {
@Override

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

@ -24,6 +24,7 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.general.GeneralUtils;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.FloatElement;
import com.fr.report.cell.cellattr.core.RichText;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
import org.jetbrains.annotations.Nullable;
@ -75,7 +76,7 @@ public enum ShowSearchResultAction implements ShowValue {
} else {
Map<String, String> stringHashMap = info.getValue();
String content = stringHashMap.getOrDefault(objectContentKey, StringUtils.EMPTY);
if (content.contains(str) && StringUtils.isNotEmpty(content)) {
if (isValueValid(content, str, info)) {
info.getContent().setShowStr(ShowValueUtils.getCommonString(content, str));
info.getContent().setOldShowStr(content);
info.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(content, str));
@ -94,6 +95,11 @@ public enum ShowSearchResultAction implements ShowValue {
cellInfo.getContent().setSelected(true);
}
private boolean isValueValid(String content, String str, Info info) {
CellElement cellElement = (CellElement) info.getContent().getReplaceObject();
return ShowValueUtils.contains(content, str) && StringUtils.isNotEmpty(content) && !(cellElement.getValue() instanceof RichText);
}
},
/**
* 搜索JS事件
@ -139,7 +145,7 @@ public enum ShowSearchResultAction implements ShowValue {
private void searchMap4JS(Map<String, String> map, List<JSInfo> jsInfos, JSInfo info, String str) {
if (map.containsKey(objectNameKey) && StringUtils.isNotEmpty(map.get(objectNameKey))) {
String name = map.get(objectNameKey);
if (name.contains(str)) {
if (ShowValueUtils.contains(name,str)) {
JSInfo nameJSInfo = info.copy();
nameJSInfo.getContent().setShowStr(ShowValueUtils.getCommonString(name, str));
nameJSInfo.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(name, str));
@ -151,7 +157,7 @@ public enum ShowSearchResultAction implements ShowValue {
}
if (map.containsKey(objectContentKey) && StringUtils.isNotEmpty(map.get(objectContentKey))) {
String content = map.get(objectContentKey);
if (content.contains(str)) {
if (ShowValueUtils.contains(content,str)) {
JSInfo contentJSInfo = info.copy();
contentJSInfo.getContent().setShowStr(ShowValueUtils.getCommonString(content, str));
contentJSInfo.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(content, str));
@ -195,7 +201,7 @@ public enum ShowSearchResultAction implements ShowValue {
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)) {
if (ShowValueUtils.contains(content,str)) {
SQLInfo contentJSInfo = info.copy();
contentJSInfo.getContent().setShowStr(ShowValueUtils.getCommonString(content, str));
contentJSInfo.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(content, str));
@ -231,7 +237,7 @@ public enum ShowSearchResultAction implements ShowValue {
if (((FloatInfo) info).isChartExist()) {
ChartCollection chartCollection = (ChartCollection) floatElement.getValue();
for (int i = 0; i < chartCollection.getChartCount(); i++) {
if (isTitleNameValid(chartCollection.getChart(i).getTitle(),str)) {
if (isTitleNameValid(chartCollection.getChart(i).getTitle(), str)) {
String titleName = GeneralUtils.objectToString(chartCollection.getChart(i).getTitle().getTextObject());
FloatInfo floatInfo = ((FloatInfo) info).copy();
floatInfo.setFloatChartIndex(i);
@ -244,7 +250,7 @@ public enum ShowSearchResultAction implements ShowValue {
}
}
} else {
if (GeneralUtils.objectToString(floatElement.getValue()).contains(str)) {
if (ShowValueUtils.contains(GeneralUtils.objectToString(floatElement.getValue()), str)) {
FloatInfo floatInfo = ((FloatInfo) info).copy();
setShowInfo(floatInfo, GeneralUtils.objectToString(floatElement.getValue()), str);
floatInfos.add(floatInfo);
@ -285,7 +291,7 @@ public enum ShowSearchResultAction implements ShowValue {
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)) {
if (ShowValueUtils.contains(content,str)) {
info.getContent().setShowStr(ShowValueUtils.getCommonString(content, str));
info.getContent().setOldShowStr(stringHashMap.get(objectContentKey));
info.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(content, str));
@ -319,7 +325,7 @@ public enum ShowSearchResultAction implements ShowValue {
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)) {
if (StringUtils.isNotEmpty(name) && ShowValueUtils.contains(name,str)) {
WidgetInfo nameInfo = info.copy(info);
nameInfo.getContent().setShowStr(ShowValueUtils.getCommonString(name, str));
nameInfo.getContent().setOldShowStr(map.get(objectNameKey));
@ -331,7 +337,7 @@ public enum ShowSearchResultAction implements ShowValue {
}
if (map.containsKey(objectWaterMarkKey)) {
String waterMark = map.get(objectWaterMarkKey);
if (StringUtils.isNotEmpty(waterMark) && waterMark.contains(str)) {
if (StringUtils.isNotEmpty(waterMark) && ShowValueUtils.contains(waterMark,str)) {
WidgetInfo widgetInfo = info.copy(info);
widgetInfo.getContent().setShowStr(ShowValueUtils.getCommonString(waterMark, str));
widgetInfo.getContent().setOldShowStr(map.get(objectWaterMarkKey));
@ -368,7 +374,7 @@ public enum ShowSearchResultAction implements ShowValue {
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)) {
if (ShowValueUtils.contains(name,str)) {
info.getContent().setShowStr(ShowValueUtils.getCommonString(name, str));
info.getContent().setOldShowStr(stringHashMap.get(objectContentKey));
info.getContent().setOperatorArray(ShowValueUtils.getStringStartAndEndIndex(name, str));
@ -411,11 +417,12 @@ public enum ShowSearchResultAction implements ShowValue {
/**
* 标题是否可用
*
* @param title
* @param str
* @return
*/
public boolean isTitleNameValid(Title title, String str){
return title != null && GeneralUtils.objectToString(title.getTextObject()).contains(str) && StringUtils.isNotEmpty(GeneralUtils.objectToString(title.getTextObject()));
public boolean isTitleNameValid(Title title, String str) {
return title != null && ShowValueUtils.contains(GeneralUtils.objectToString(title.getTextObject()), str) && StringUtils.isNotEmpty(GeneralUtils.objectToString(title.getTextObject()));
}
}

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

@ -7,6 +7,7 @@ import com.fr.design.actions.replace.info.FloatInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.ImageWithSuffix;
import com.fr.main.impl.WorkBook;
import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.ElementCase;
@ -84,7 +85,9 @@ public class SearchFloatAction implements SearchAction {
if (floatElement.getValue() instanceof ChartCollection) {
floatInfo.setChartExist(true);
}
result.add(floatInfo);
if (!(floatElement.getValue() instanceof ImageWithSuffix)) {
result.add(floatInfo);
}
}
}

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

@ -22,6 +22,7 @@ import com.fr.main.impl.WorkBook;
import com.fr.report.cell.cellattr.CellInsertPolicyAttr;
import com.fr.report.cell.cellattr.core.RichChar;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.core.sort.sortexpression.FormulaSortExpression;
import com.fr.stable.FormulaProvider;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
@ -133,40 +134,6 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
return false;
}
},
/**
* 富文本
*/
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));
}
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof RichChar){
RichChar richChar = (RichChar) info.getContent().getReplaceObject();
return StringUtils.equals(richChar.getText(), info.getContent().getOldShowStr());
}
return false;
}
},
/**
* KV
*/
@ -529,6 +496,35 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
public boolean check(Info info) {
return true;
}
},
/**
* 排序
*/
FORMULA_SORT_EXPRESSION("FormulaSortExpression"){
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(((FormulaSortExpression) o[0]).getFormula())) {
map.put("content", ((FormulaSortExpression) o[0]).getFormula());
}
return map;
}
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr((((FormulaSortExpression) replaceObject).getFormula()), findStr);
((FormulaSortExpression) replaceObject).setFormula(ShowValueUtils.replaceAll((((FormulaSortExpression) replaceObject).getFormula()), findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof FormulaSortExpression){
FormulaSortExpression sortExpression = (FormulaSortExpression) info.getContent().getReplaceObject();
return StringUtils.equals(sortExpression.getFormula(), info.getContent().getOldShowStr());
}
return false;
}
}
;

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

@ -25,8 +25,6 @@ public class SearchCellFormulaManager implements SearchManager {
register(DS_COLUMN, SearchDSColumnFormulaAction.getInstance());
//公式
register(FORMULA, SearchCellFormulaTypeAction.getInstance());
//富文本
register(RICH_TEXT, SearchRichFormulaAction.getInstance());
//子报表
register(SUB_REPORT, SearchSubReportFormulaAction.getInstance());

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

@ -2,21 +2,38 @@ package com.fr.design.actions.replace.action.content.formula.chart;
import com.fr.base.Formula;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.base.present.DictPresent;
import com.fr.base.present.FormulaPresent;
import com.fr.base.present.Present;
import com.fr.chart.base.AttrChangeConfig;
import com.fr.chart.chartattr.Axis;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartattr.SwitchTitle;
import com.fr.chart.chartattr.Title;
import com.fr.chart.chartdata.NormalReportDataDefinition;
import com.fr.chart.chartdata.SeriesDefinition;
import com.fr.design.actions.replace.action.content.formula.highlight.javascript.SearchJSHighlightAction;
import com.fr.design.actions.replace.action.content.formula.widget.DictionaryType;
import com.fr.design.actions.replace.info.CellInfo;
import com.fr.design.actions.replace.info.FormulaInfo;
import com.fr.design.actions.replace.info.JSInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.js.NameJavaScript;
import com.fr.js.NameJavaScriptGroup;
import com.fr.plugin.chart.attr.axis.VanChartAlertValue;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartValueAxis;
import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.report.cell.TemplateCellElement;
import com.fr.stable.StringUtils;
import java.util.List;
import java.util.Map;
@ -44,7 +61,12 @@ public class SearchChartCollectionFormulaAction {
for (int i = 0; i < chartCollection.getChartCount(); i++) {
ITContent chartContent = ITContent.copy(content);
searchChartPatternFormula(formulaInfos, chartContent, chartCollection.getChart(i));
if (isChangeConfigAttrValid(chartCollection.getChangeConfigAttr())) {
//图表切换属性
dealChangeConfig(formulaInfos, chartContent, chartCollection.getChart(i));
}
//图表-交互属性-超级链接
dealChartHyperLink(formulaInfos, chartContent, chartCollection.getChart(i));
//数据-单元格数据-分类名&系列名&值
SearchChartDataFormulaManager searchChartDataFormulaManager = SearchChartDataFormulaManager.getInstance();
Map<String, SearchChartDataFormula> type = searchChartDataFormulaManager.getChartDataType();
@ -56,7 +78,103 @@ public class SearchChartCollectionFormulaAction {
dataContent.addOtherPos(chartCollection.getChart(i).getChartName(), Toolkit.i18nText("Fine-Design_Basic_Data"));
searchChartDataFormula.searchChartDataFormula(formulaInfos, dataContent, provider);
}
//数据-形态
if (chartCollection.getChart(i).getFilterDefinition() != null) {
ITContent presentContent = ITContent.copy(content);
presentContent.addOtherPos(chartCollection.getChart(i).getChartName(), Toolkit.i18nText("Fine-Design_Basic_Data"));
searchFormulaFromChartPresent(formulaInfos, presentContent, chartCollection.getChart(i).getFilterDefinition());
}
}
}
private void dealChartHyperLink(List<FormulaInfo> formulaInfos, ITContent content, Chart chart) {
ITContent conditionContent = ITContent.copy(content);
if (StringUtils.isNotEmpty(chart.getChartName())) {
conditionContent.addOtherPos(chart.getChartName());
}
conditionContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Animation_Special"),
Toolkit.i18nText("Fine-Design_Chart_Interactive")
);
if (chart.getPlot() instanceof VanChartCustomPlot) {
VanChartCustomPlot plot = chart.getPlot();
for (int i = 0; i < plot.getCustomPlotList().size(); i++) {
ITContent customContent = ITContent.copy(conditionContent);
customContent.addOtherPos(CustomPlotFactory.getTitle(CustomPlotFactory.getCustomType(plot.getCustomPlotList().get(i))));
dealPlot(formulaInfos, customContent, plot.getCustomPlotList().get(i));
}
} else if (chart.getPlot() != null) {
dealPlot(formulaInfos, conditionContent, chart.getPlot());
}
}
private void dealPlot(List<FormulaInfo> formulaInfos, ITContent content, Plot plot) {
NameJavaScriptGroup javaScriptGroup = plot.getHotHyperLink();
if (javaScriptGroup != null) {
for (int i = 0; i < javaScriptGroup.size(); i++) {
NameJavaScript javaScript = javaScriptGroup.getNameHyperlink(i);
content.addOtherPos(javaScript.getName());
SearchJSHighlightAction action = SearchJSHighlightAction.getInstance();
action.searchJSFormulaFromOther(formulaInfos, content, javaScript.getJavaScript());
}
}
}
private void searchFormulaFromChartPresent(List<FormulaInfo> formulaInfos, ITContent content, TopDefinitionProvider provider) {
searchPresent4Formula(provider.getCategoryPresent(), content, formulaInfos);
searchPresent4Formula(provider.getSeriesPresent(), content, formulaInfos);
}
private void searchPresent4Formula(Present present, ITContent content, List<FormulaInfo> formulaInfos) {
if (present instanceof FormulaPresent) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(present);
newContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Style_Present"),
Toolkit.i18nText("Fine-Design_Basic_Present_Formula_Present"));
formulaInfos.add(new FormulaInfo(newContent));
}
if (present instanceof DictPresent) {
ITContent dictContent = ITContent.copy(content);
dictContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Style_Present"),
Toolkit.i18nText("Fine-Design_Basic_DS_Dictionary")
);
DictPresent dictPresent = (DictPresent) present;
if (dictPresent.getDictionary() != null) {
DictionaryType type = DictionaryType.match(dictPresent.getDictionary().getClass().getSimpleName());
if (type != null) {
type.searchFormulaFromDictionary(dictContent, formulaInfos, dictPresent.getDictionary());
}
}
}
}
private boolean isChangeConfigAttrValid(AttrChangeConfig attrChangeConfig) {
return attrChangeConfig != null && attrChangeConfig.isEnable();
}
private void dealChangeConfig(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) {
ITContent content = ITContent.copy(chartContent);
if (StringUtils.isNotEmpty(chart.getChartName())) {
content.addOtherPos(chart.getChartName());
}
content.addOtherPos(
Toolkit.i18nText("Fine-Design_Chart_Type"),
Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes")
);
if (isSwitchTitleValid(chart.getSwitchTitle())) {
SwitchTitle title = chart.getSwitchTitle();
content.setReplaceObject(title.getContent());
formulaInfos.add(new FormulaInfo(content));
}
}
private boolean isSwitchTitleValid(SwitchTitle title) {
return title != null && title.getContent() instanceof Formula;
}
private boolean isDefinitionValid(TopDefinitionProvider provider) {
@ -76,7 +194,7 @@ public class SearchChartCollectionFormulaAction {
}
private void searchChartPatternFormulaFromAlertLine(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) {
if (chart.getPlot() != null){
if (chart.getPlot() != null) {
Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis();
ITContent content = ITContent.copy(chartContent);
@ -128,7 +246,7 @@ public class SearchChartCollectionFormulaAction {
}
private void searchChartPatternFormulaFromAxisValue(List<FormulaInfo> formulaInfos, ITContent chartContent, Chart chart) {
if (chart.getPlot() != null){
if (chart.getPlot() != null) {
Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis();
//样式-坐标轴-x轴

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

@ -21,7 +21,6 @@ public class SearchFormulaConditionAction implements SearchConditionFormula {
}
@Override
public void searchFormulaFromCondition(List<FormulaInfo> formulaInfos, ITContent content, Condition condition) {
if (((FormulaCondition) (condition)).getFormula() != null) {

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

@ -1,5 +1,6 @@
package com.fr.design.actions.replace.action.content.formula.highlight.javascript;
import com.fr.base.Formula;
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;
@ -10,6 +11,7 @@ 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.ColumnConfig;
import com.fr.write.config.DMLConfig;
import java.util.List;
@ -41,14 +43,28 @@ public class SearchCommit2DBJSFormulaAction implements SearchJSFormula {
private void dealWithDBManipulation(List<FormulaInfo> formulaInfos, ITContent content, DBManipulation dbManipulation) {
DMLConfig dmlConfig = dbManipulation.getDmlConfig();
//值中的公式
dealWithColumnValue(formulaInfos, content, dmlConfig);
//处理提交条件中的公式
dealWithCommit2DBCondition(formulaInfos, content, dmlConfig);
//处理DBManipulation
dealWithSubmitJob(formulaInfos, content, dmlConfig);
}
private void dealWithColumnValue(List<FormulaInfo> formulaInfos, ITContent content, DMLConfig dmlConfig) {
for (int i = 0, len = dmlConfig.getColumnConfigCount(); i < len; i++) {
ColumnConfig columnConfig = dmlConfig.getColumnConfig(i);
if (columnConfig.getColumnValue() instanceof Formula) {
ITContent configContent = ITContent.copy(content);
configContent.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Base_Value"));
configContent.setReplaceObject(columnConfig.getColumnValue());
formulaInfos.add(new FormulaInfo(configContent));
}
}
}
private void dealWithSubmitJob(List<FormulaInfo> formulaInfos, ITContent content, DMLConfig dmlConfig) {
for (int i = 0; i < dmlConfig.getSubmitJobCount(); i++) {
for (int i = 0, len = dmlConfig.getSubmitJobCount(); i < len; i++) {
//这边自定义事件不需要处理,只处理提交事件
if (dmlConfig.getSubmitJob(i) instanceof DMLConfigJob) {
ITContent newContent = ITContent.copy(content);

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

@ -1,11 +1,14 @@
package com.fr.design.actions.replace.action.content.formula.highlight.javascript;
import com.fr.base.Formula;
import com.fr.base.Parameter;
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 com.fr.stable.ParameterProvider;
import java.util.List;
@ -26,8 +29,10 @@ public class SearchExportJSFormulaAction implements SearchJSFormula {
public void searchJSFormulaFromOther(List<FormulaInfo> formulaInfos, ITContent content, JavaScript javaScript) {
//如果导出当前模板,可以存公式的地方就是命名方式-自定义
if (((ExportJavaScript) javaScript).isCurrentTemplate()) {
content.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current"));
dealSingleJavaScript(formulaInfos, content, ((ExportJavaScript) javaScript).getCurrentTemplateJavaScript());
} else {
content.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Other"));
List<SingleJavaScript> list = ((ExportJavaScript) javaScript).getJsListForOtherTemplates();
if (isListExist(list)) {
for (SingleJavaScript singleJavaScript : list) {
@ -51,6 +56,16 @@ public class SearchExportJSFormulaAction implements SearchJSFormula {
);
formulaInfos.add(new FormulaInfo(newContent));
}
if (!javaScript.isExtendParameters()) {
ITContent paraContent = ITContent.copy(content);
for (ParameterProvider parameter : javaScript.getParameters()) {
if (parameter.getValue() instanceof Formula) {
paraContent.addOtherPos(Toolkit.i18nText("Fine-Design_Basic_Base_Value"));
paraContent.setReplaceObject(parameter.getValue());
formulaInfos.add(new FormulaInfo(paraContent));
}
}
}
}
/**

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

@ -34,7 +34,7 @@ public class SearchDateEditorFormulaAction extends AbstractSearchWidgetFormulaAc
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"));
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_FS_End_Date"));
formulaInfos.add(new FormulaInfo(newContent));
}
}
@ -44,7 +44,7 @@ public class SearchDateEditorFormulaAction extends AbstractSearchWidgetFormulaAc
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"));
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_FS_Start_Date"));
formulaInfos.add(new FormulaInfo(newContent));
}
}

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

@ -1,11 +1,15 @@
package com.fr.design.actions.replace.action.content.formula.widget;
import com.fr.data.Dictionary;
import com.fr.data.impl.FormulaDictionary;
import com.fr.data.impl.FormulaDisplayDictionary;
import com.fr.data.impl.TableDataDictionary;
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.DictionaryContainer;
import com.fr.form.ui.TreeEditor;
import com.fr.form.ui.tree.LayerConfig;
import com.fr.stable.StringUtils;
@ -37,28 +41,38 @@ public class SearchTreeEditorFormulaAction extends AbstractSearchWidgetFormulaAc
if (((TreeEditor) content.getReplaceObject()).getBuildModelConfig() != null) {
//LayerConfig[] 急速分层构建
//TreeNodeWrapper 普通分层构建
if (((TreeEditor) content.getReplaceObject()).getBuildModelConfig() instanceof LayerConfig[]) {
LayerConfig[] layerConfigs = (LayerConfig[]) ((TreeEditor) content.getReplaceObject()).getBuildModelConfig();
//TableDataDictionary 自动构建
Object object = ((TreeEditor) content.getReplaceObject()).getBuildModelConfig();
if (object instanceof LayerConfig[]) {
LayerConfig[] layerConfigs = (LayerConfig[]) object;
dealWithLayerConfigs(layerConfigs, content, formulaInfos);
} else if (((TreeEditor) content.getReplaceObject()).getBuildModelConfig() instanceof TreeNodeWrapper) {
TreeNodeWrapper wrapper = (TreeNodeWrapper) ((TreeEditor) content.getReplaceObject()).getBuildModelConfig();
} else if (object instanceof TreeNodeWrapper) {
TreeNodeWrapper wrapper = (TreeNodeWrapper) object;
dealWithTreeNodeWrapper(wrapper, content, formulaInfos);
} else if (object instanceof TableDataDictionary) {
TableDataDictionary tableDataDictionary = (TableDataDictionary) object;
if (tableDataDictionary.getFormula() != null) {
ITContent autoContent = ITContent.copy(content);
autoContent.addOtherPos(
Toolkit.i18nText("Fine-Design_Basic_Auto_Build"),
Toolkit.i18nText("Fine-Design_Basic_Display_Value")
);
autoContent.setReplaceObject(tableDataDictionary.getFormula());
formulaInfos.add(new FormulaInfo(autoContent));
}
}
}
}
}
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));
if (attr.getDictionary() != null) {
DictionaryType type = DictionaryType.match(attr.getDictionary().getClass().getSimpleName());
if (type != null) {
type.searchFormulaFromDictionary(content, formulaInfos, attr.getDictionary());
}
}
}
}

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

@ -7,14 +7,20 @@ 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.JavaScriptImpl;
import com.fr.js.NameJavaScript;
import com.fr.js.NameJavaScriptGroup;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.RefreshMoreLabel;
import com.fr.plugin.chart.base.VanChartHtmlLabel;
import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.collections.combination.Pair;
import java.util.ArrayList;
import java.util.List;
/**
@ -54,22 +60,47 @@ public class SearchChartJSAction {
SearchJSUtils.addJSInfosFromNameJS(conditionContent, nameJavaScripts, jsInfos);
//图表-特效-交互属性-监控刷新
dealMonitorRefreshJS(conditionContent,chartCollection,jsInfos);
dealMonitorRefreshJS(conditionContent, chartCollection, jsInfos);
for (int i = 0; i < chartCollection.getChartCount(); i++) {
ITContent chartContent = ITContent.copy(content);
chartContent.addOtherPos(chartCollection.getChart(i).getChartName());
//坐标轴
searchAxisJS(jsInfos, chartContent, chartCollection.getChart(i));
//组合图表-条件属性-超链特判
dealCustomPlot(jsInfos, conditionContent, chartCollection.getChart(i));
}
}
private void dealCustomPlot(List<JSInfo> jsInfos, ITContent conditionContent, Chart chart) {
if (chart.getPlot() instanceof VanChartCustomPlot) {
VanChartCustomPlot customPlot = chart.getPlot();
for (VanChartPlot plot : customPlot.getCustomPlotList()) {
NameJavaScriptGroup javaScriptGroup = plot.getHotHyperLink();
if (javaScriptGroup != null) {
for (int i = 0; i < javaScriptGroup.size(); i++) {
if (javaScriptGroup.getNameHyperlink(i).getJavaScript() instanceof JavaScriptImpl) {
ITContent content = ITContent.copy(conditionContent);
content.addOtherPos(
CustomPlotFactory.getTitle(CustomPlotFactory.getCustomType(plot)),
javaScriptGroup.getNameHyperlink(i).getName()
);
content.setReplaceObject(javaScriptGroup.getNameHyperlink(i));
jsInfos.add(new JSInfo(content));
}
}
}
}
}
}
private void dealMonitorRefreshJS(ITContent conditionContent, ChartCollection chartCollection, List<JSInfo> jsInfos) {
for (int i = 0 ; i < chartCollection.getChartCount() ; i ++){
if (chartCollection.getChart(i) instanceof VanChart){
for (int i = 0; i < chartCollection.getChartCount(); i++) {
if (chartCollection.getChart(i) instanceof VanChart) {
VanChart chart = (VanChart) chartCollection.getChart(i);
if (isMonitorValid(chart.getRefreshMoreLabel())){
if (isMonitorValid(chart.getRefreshMoreLabel())) {
VanChartHtmlLabel htmlLabel = chart.getRefreshMoreLabel().getAttrTooltip().getContent().getHtmlLabel();
if (htmlLabel != null){
if (htmlLabel != null) {
ITContent content = ITContent.copy(conditionContent);
content.addOtherPos(Toolkit.i18nText("Fine-Design_Chart_Moniter_refresh"));
content.setReplaceObject(htmlLabel);
@ -80,12 +111,12 @@ public class SearchChartJSAction {
}
}
private boolean isMonitorValid(RefreshMoreLabel moreLabel){
private boolean isMonitorValid(RefreshMoreLabel moreLabel) {
return moreLabel.isMoreLabel() && moreLabel.getAttrTooltip() != null && moreLabel.getAttrTooltip().isEnable();
}
private void searchAxisJS(List<JSInfo> jsInfos, ITContent chartContent, Chart chart) {
if (chart.getPlot() != null){
if (chart.getPlot() != null) {
Axis xAxis = chart.getPlot().getxAxis();
Axis yAxis = chart.getPlot().getyAxis();
if (xAxis instanceof VanChartAxis) {

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

@ -15,6 +15,7 @@ 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.report.web.util.ReportEngineEventMapping;
import com.fr.web.attr.ReportWebAttr;
import java.util.ArrayList;
@ -32,6 +33,7 @@ import java.util.Map;
public class SearchWebJSAction implements SearchJS {
private final static Map<String, String> MAP = new HashMap<>();
private final static Map<String, String> SERVER_MAP = new HashMap<>();
private List<WebContent> arrayList = new ArrayList<>();
private SearchWebJSAction() {
@ -41,6 +43,9 @@ public class SearchWebJSAction implements SearchJS {
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"));
SERVER_MAP.put("WebPage", Toolkit.i18nText("Fine-Design_Report_ReportServerP_Report_Server_Parameter") + "-" + Toolkit.i18nText("Fine-Design_Report_Pagination_Setting"));
SERVER_MAP.put("WebWrite", Toolkit.i18nText("Fine-Design_Report_ReportServerP_Report_Server_Parameter") + "-" + Toolkit.i18nText("Fine-Design_Report_Write_Setting"));
SERVER_MAP.put("WebView", Toolkit.i18nText("Fine-Design_Report_ReportServerP_Report_Server_Parameter") + "-" + Toolkit.i18nText("Fine-Design_Report_Data_Analysis_Settings"));
}
@ -54,6 +59,25 @@ public class SearchWebJSAction implements SearchJS {
private void addJSInfos2ListFromWeb(JTemplate jTemplate, List<JSInfo> jsInfos) {
dealServerWebAttr(jTemplate, jsInfos);
dealTemplateWebAttr(jTemplate, jsInfos);
}
private void dealServerWebAttr(JTemplate jTemplate, List<JSInfo> jsInfos) {
ReportWebAttr webReportAttr = ReportWebAttr.getInstance();
if (webReportAttr != null) {
webReportAttr.getWebWrite();
ITContent content = new ITContent();
content.setTemplateName(jTemplate.getTemplateName());
content.setJumpAble(false);
addWebContent2Array(webReportAttr);
for (int i = 0; i < arrayList.size(); i++) {
addJSInfos2ListFromServerWebAttr(content, jsInfos, arrayList.get(i));
}
}
}
private void dealTemplateWebAttr(JTemplate jTemplate, List<JSInfo> jsInfos) {
if (jTemplate.getTarget() instanceof WorkBook) {
WorkBook workBook = (WorkBook) jTemplate.getTarget();
ReportWebAttr webAttr = workBook.getReportWebAttr();
@ -67,6 +91,15 @@ public class SearchWebJSAction implements SearchJS {
}
}
private void addJSInfos2ListFromServerWebAttr(ITContent content, List<JSInfo> jsInfos, WebContent webContent) {
ITContent newContent = ITContent.copy(content);
if (SERVER_MAP.containsKey(webContent.getClass().getSimpleName())) {
newContent.addOtherPos(SERVER_MAP.get(webContent.getClass().getSimpleName()));
}
addJSInfos2ListFromWebButton(newContent, jsInfos, webContent);
addJSInfos2ListFromWebListener(newContent, jsInfos, webContent);
}
private void addJSInfos2ListFromArray(ITContent content, List<JSInfo> jsInfos, WebContent webContent) {
ITContent newContent = ITContent.copy(content);
if (MAP.containsKey(webContent.getClass().getSimpleName())) {
@ -81,6 +114,7 @@ public class SearchWebJSAction implements SearchJS {
Listener listener = webContent.getListener(i);
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(listener);
newContent.addOtherPos(Toolkit.i18nText(ReportEngineEventMapping.getLocaleName(listener.getEventName())));
SearchJSUtils.searchJSFromListener(jsInfos, newContent);
}
}
@ -94,6 +128,7 @@ public class SearchWebJSAction implements SearchJS {
}
private void addWebContent2Array(ReportWebAttr webAttr) {
arrayList.clear();
if (webAttr != null) {
addContent(arrayList, webAttr.getWebWrite());
addContent(arrayList, webAttr.getWebPage());

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

@ -219,34 +219,6 @@ public class CellInfo implements Info {
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();
}
},
/**
* 公式类型
*/

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

@ -2,6 +2,7 @@ package com.fr.design.actions.replace.info;
import com.fr.data.impl.DBTableData;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.data.DesignTableDataManager;
import com.fr.form.event.Listener;
import com.fr.js.JavaScriptImpl;
import com.fr.js.NameJavaScript;
@ -45,7 +46,7 @@ public enum ReplaceObject implements DealWithInfoValue {
} else {
NameJavaScript javaScript = ((NameJavaScript) (info.getContent().getReplaceObject()));
info.updateOldStr(javaScript.getName(), findStr);
javaScript.setName(javaScript.getName().replaceAll(findStr, replaceStr));
javaScript.setName(ShowValueUtils.replaceAll(javaScript.getName(), findStr, replaceStr));
}
}
@ -86,15 +87,13 @@ public enum ReplaceObject implements DealWithInfoValue {
@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));
}
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())));
info.updateOldStr(listener.getName(), findStr);
listener.setName(listener.getName().replaceAll(findStr, replaceStr));
listener.setName(ShowValueUtils.replaceAll(listener.getName(), findStr, replaceStr));
}
}
@ -134,12 +133,10 @@ public enum ReplaceObject implements DealWithInfoValue {
@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));
}
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));
}
}
@ -210,6 +207,7 @@ public enum ReplaceObject implements DealWithInfoValue {
DBTableData dbTableData = (DBTableData) info.getContent().getReplaceObject();
info.updateOldStr(dbTableData.getQuery(), findStr);
dbTableData.setQuery(ShowValueUtils.replaceAll(dbTableData.getQuery(), findStr, replaceStr));
//todo DesignTableDataManager
}
@Override

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

@ -1,16 +1,15 @@
package com.fr.design.actions.replace.ui;
import com.fr.design.actions.help.replace.ITReplaceHelper;
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.icontainer.UIScrollPane;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
@ -31,6 +30,9 @@ import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import static com.fr.design.actions.replace.ui.ITTableEditorPane.getEditTable;
/**
* 主面板
@ -51,7 +53,7 @@ public class ITReplaceMainDialog extends UIDialog {
private boolean searchFlag;
private String searchStr;
private ITReplaceMainDialog() {
public ITReplaceMainDialog() {
super(DesignerContext.getDesignerFrame());
init();
}
@ -79,7 +81,6 @@ public class ITReplaceMainDialog extends UIDialog {
}
}
}
instance.fitScreen();
return instance;
}
@ -98,7 +99,7 @@ public class ITReplaceMainDialog extends UIDialog {
setSize(width, height);
setLocation(new Point(point.x, point.y + jTemplate.getHeight() / 2 + jTemplate.getHeight() / 2 - 385));
northPane.fitScreen(0, 0,width);
northPane.fitScreen(0, 0, width);
}
@ -162,16 +163,14 @@ public class ITReplaceMainDialog extends UIDialog {
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().fireTabChange();
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(true);
setSearchFlag(false);
search();
} else {
Object[] options = new Object[]{Toolkit.i18nText("Fine-Design_Replace_Search_Again"), Toolkit.i18nText("Fine-Design_Basic_Cancel")};
int optionSelected = FineJOptionPane.showOptionDialog(
@ -285,12 +284,15 @@ public class ITReplaceMainDialog extends UIDialog {
itTableEditor.clear();
String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText();
setSearchStr(searchStr);
ShowValueUtils.containPattern = Pattern.compile(ShowValueUtils.changeRegex(searchStr));
ShowSearchResultAction searchAction = ShowSearchResultAction.match(GeneralUtils.objectToString(northPane.getFindCombobox().getSelectedItem()));
if (searchAction != null) {
searchResultList = searchAction.addMatchResult(searchStr, 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"));
}
ITTableEditorPane.ITHeaderRenderer renderer = (ITTableEditorPane.ITHeaderRenderer) getEditTable().getTableHeader().getDefaultRenderer();
renderer.refreshHeader(getEditTable());
itTableEditor.fireTableDataChanged();
northPane.refreshFindInputComboBoxItems();
setSearchFlag(true);
@ -307,6 +309,9 @@ public class ITReplaceMainDialog extends UIDialog {
}
}
/**
* 检测结果是否合法
*/

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

@ -47,6 +47,7 @@ public class ITReplaceNorthPanel {
private static final int HEIGHT = 161;
private static final int BUTTON_WIDTH = 60;
private static final int BUTTON_GAP = 20;
private static final int MATCH_WIDTH = 70;
private int findLabelX, findLabelY, findLabelWidth, findLabelHeight;
@ -83,7 +84,7 @@ public class ITReplaceNorthPanel {
resultLabel = new UILabel();
String[] rangeItems = new String[]{Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current")};
String[] replaceInputItems = new String[]{""};
String[] replaceInputItems = new String[]{StringUtils.EMPTY};
findCombobox = new UIComboBox(findItems.toArray());
rangeCombobox = new UIComboBox(rangeItems);
findInputCombobox = new UIComboBox(findInputItems.toArray()) {
@ -247,7 +248,7 @@ public class ITReplaceNorthPanel {
private void setUIRadioButtonBounds(int x, int y, int templateWidth) {
matchX = x + templateWidth / 60;
matchY = y + 90;
matchWidth = templateWidth;
matchWidth = MATCH_WIDTH;
matchHeight = 25;
matchRadioButton.setBounds(matchX, matchY, matchWidth, matchHeight);
}

11
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java

@ -14,11 +14,20 @@ import java.awt.Color;
public class ITReplaceSouthPanel {
ITTableEditorPane tableEditorPane;
ITTableEditor itTableEditor;
//勾选框索引
public static final int CHECKBOX_INDEX = 0;
//ITContent在表格的列索引
public static final int CONTENT_INDEX = 6;
public ITReplaceSouthPanel() {
itTableEditor = new ITTableEditor();
tableEditorPane = new ITTableEditorPane<>(itTableEditor);
RowSorter<ITTableEditor> sorter = new TableRowSorter<ITTableEditor>(itTableEditor);
RowSorter<ITTableEditor> sorter = new TableRowSorter<ITTableEditor>(itTableEditor){
@Override
public boolean isSortable(int column) {
return column != CHECKBOX_INDEX || column != CONTENT_INDEX;
}
};
tableEditorPane.getEditTable().setRowSorter(sorter);
tableEditorPane.getEditTable().setSelectionBackground(new Color(217, 235, 254));
tableEditorPane.getEditTable().setRowHeight(tableEditorPane.getEditTable().getRowHeight() / 2 + tableEditorPane.getEditTable().getRowHeight());

9
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java

@ -5,11 +5,14 @@ import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ReportComponentComposite;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.Component;
@ -36,7 +39,7 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor
paraButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ITContent content = (ITContent) getEditTable().getValueAt(getEditTable().getEditingRow(), 7);
ITContent content = (ITContent) getEditTable().getValueAt(getEditTable().getEditingRow(), 6);
if (StringUtils.isNotEmpty(GeneralUtils.objectToString(content.getTrlString()))) {
ITReplaceMainDialog.setITReplaceFlag(true);
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().navigate(new TRL(GeneralUtils.objectToString(content.getTrlString())));
@ -60,7 +63,7 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor
*/
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
ITContent content = (ITContent) table.getValueAt(row, 7);
ITContent content = (ITContent) table.getValueAt(row, 6);
paraButton.setEnabled(content.isJumpAble());
return paraButton;
}
@ -78,7 +81,7 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor
*/
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
ITContent content = (ITContent) table.getValueAt(row, 7);
ITContent content = (ITContent) table.getValueAt(row, 6);
paraButton.setEnabled(content.isJumpAble());
return paraButton;
}

25
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java

@ -31,7 +31,6 @@ public class ITTableEditor extends UITableModelAdapter {
Toolkit.i18nText("Fine-Design_Replace_Template_Name"),
Toolkit.i18nText("Fine-Design_Replace_Sheet_Name"),
Toolkit.i18nText("Fine-Design_Replace_Block_Name"),
Toolkit.i18nText("Fine-Design_Replace_Location"),
Toolkit.i18nText("Fine-Design_Replace_Location_Info"),
Toolkit.i18nText("Fine-Design_Replace_Operator"),
});
@ -43,15 +42,14 @@ public class ITTableEditor extends UITableModelAdapter {
UILabel.class,
UILabel.class,
UILabel.class,
UILabel.class,
ITTableButton.class,
});
this.setDefaultEditor(ITTableButton.class, new ITTableButton());
this.setDefaultRenderer(ITTableButton.class, new ITTableButton());
this.createTable().getColumnModel().getColumn(7).setMaxWidth(50);
this.createTable().getColumnModel().getColumn(0).setMaxWidth(50);
this.createTable().getColumnModel().getColumn(ITReplaceSouthPanel.CONTENT_INDEX).setMaxWidth(50);
this.createTable().getColumnModel().getColumn(ITReplaceSouthPanel.CHECKBOX_INDEX).setMaxWidth(50);
}
@ -83,7 +81,7 @@ public class ITTableEditor extends UITableModelAdapter {
*/
@Override
public boolean isCellEditable(int row, int col) {
return col == 7 || col == 0;
return col == ITReplaceSouthPanel.CONTENT_INDEX || col == ITReplaceSouthPanel.CHECKBOX_INDEX;
}
/**
@ -157,21 +155,10 @@ public class ITTableEditor extends UITableModelAdapter {
return " " + content.getBlockName();
}
},
/**
* 第六列展示位置
* 第六列展示路径
*/
INDEX_5(5) {
@Override
public Object returnContentObject(ITContent content) {
return " " + content.getShowObject();
}
},
/**
* 第七列展示路径
*/
INDEX_6(6) {
@Override
public Object returnContentObject(ITContent content) {
return " " + content.getOtherPos();
@ -179,9 +166,9 @@ public class ITTableEditor extends UITableModelAdapter {
},
/**
* 展示定位按钮
* 展示定位按钮
*/
INDEX_7(7) {
INDEX_6(6) {
@Override
public Object returnContentObject(ITContent content) {
return content;

22
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java

@ -70,8 +70,8 @@ public class ITTableEditorPane<T> extends BasicPane {
public void mouseClicked(MouseEvent e) {
int row = ((JTable) e.getSource()).rowAtPoint(e.getPoint());
int col = ((JTable) e.getSource()).columnAtPoint(e.getPoint());
if (col == 0) {
ITContent content = (ITContent) editTable.getValueAt(row, 7);
if (col == ITReplaceSouthPanel.CHECKBOX_INDEX) {
ITContent content = (ITContent) editTable.getValueAt(row, ITReplaceSouthPanel.CONTENT_INDEX);
if (content.isSelected()) {
content.setSelected(false);
editTable.setValueAt(content.isSelected(), row, col);
@ -116,7 +116,7 @@ public class ITTableEditorPane<T> extends BasicPane {
if (e.getClickCount() > 0) {
//获得选中列
int selectColumn = tableHeader.columnAtPoint(e.getPoint());
if (selectColumn == 0) {
if (selectColumn == ITReplaceSouthPanel.CHECKBOX_INDEX) {
boolean value = !selectBox.isSelected();
selectBox.setSelected(value);
selectAllOrNull(value);
@ -128,6 +128,16 @@ public class ITTableEditorPane<T> extends BasicPane {
});
}
/**
* 刷新表头
* @param table
*/
public void refreshHeader(JTable table) {
selectBox.setSelected(true);
int rowHeight = table.getRowHeight();
table.updateUI();
table.setRowHeight(rowHeight);
}
@Override
public Component getTableCellRendererComponent(JTable table,
@ -142,13 +152,15 @@ public class ITTableEditorPane<T> extends BasicPane {
label.setHorizontalAlignment(SwingConstants.LEFT);
selectBox.setHorizontalAlignment(SwingConstants.CENTER);
selectBox.setBorderPainted(true);
JComponent component = (column == 0) ? selectBox : label;
JComponent component = (column == ITReplaceSouthPanel.CHECKBOX_INDEX) ? selectBox : label;
component.setForeground(tableHeader.getForeground());
component.setBackground(tableHeader.getBackground());
component.setFont(tableHeader.getFont());
component.setBorder(UIManager.getBorder("TableHeader.cellBorder"));
return component;
}
}
@ -175,7 +187,7 @@ public class ITTableEditorPane<T> extends BasicPane {
*/
public static void selectAllOrNull(Boolean value) {
for (int i = 0; i < getEditTable().getRowCount(); i++) {
((ITContent) (getEditTable().getValueAt(i, 7))).setSelected(value);
((ITContent) (getEditTable().getValueAt(i, ITReplaceSouthPanel.CONTENT_INDEX))).setSelected(value);
}
}

25
designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java

@ -0,0 +1,25 @@
package com.fr.design.actions.replace.utils;
import com.fr.design.actions.help.replace.ITReplaceHelper;
import com.fr.design.actions.replace.ui.ITReplaceMainDialog;
/**
* 操作面板
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-09-27
*/
public class ReplaceOperator implements ITReplaceHelper {
/**
* 关闭面板
* (当前关闭时机进入权限编辑状态&开发者调试)
*/
@Override
public void close(){
ITReplaceMainDialog.getInstance().dispose();
}
}

18
designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java

@ -73,7 +73,7 @@ public class SearchJSUtils {
*/
private static void addHtmlLabel2Array(List<Pair<VanChartHtmlLabel, String>> arrayList, ChartCollection collection) {
for (int i = 0; i < collection.getChartCount(); i++) {
if (collection.getChart(i) instanceof VanChart){
if (collection.getChart(i) instanceof VanChart) {
VanChart chart = ((VanChart) collection.getChart(i));
int size = chart.getPlot().getConditionCollection().getConditionAttrSize();
ConditionCollection conditionCollection = chart.getPlot().getConditionCollection();
@ -152,23 +152,23 @@ public class SearchJSUtils {
for (int t = 0; t < conditionSize; t++) {
DataSeriesCondition condition = conditionAttr.getDataSeriesCondition(t);
String str = Toolkit.i18nText("Fine-Design_Chart_Animation_Special") + "-" + Toolkit.i18nText("Fine-Design_Chart_Condition_Display");
if (StringUtils.isNotEmpty(conditionAttr.getName())){
str += "-"+conditionAttr.getName();
if (StringUtils.isNotEmpty(conditionAttr.getName())) {
str += "-" + conditionAttr.getName();
}
if (condition instanceof AttrTooltip) {
arrayList.add(new Pair<>(((AttrTooltip) condition).getContent().getHtmlLabel(), str+"-"+Toolkit.i18nText("Fine-Design_Chart_Data_Point_Tooltip")));
arrayList.add(new Pair<>(((AttrTooltip) condition).getContent().getHtmlLabel(), str + "-" + Toolkit.i18nText("Fine-Design_Chart_Data_Point_Tooltip")));
}
if (condition instanceof AttrLabel){
if (condition instanceof AttrLabel) {
AttrLabel label = (AttrLabel) condition;
if (isAttrLabelValid(label)){
arrayList.add(new Pair<>(label.getContent().getHtmlLabel(), str+"-"+Toolkit.i18nText("Fine-Design_Chart_Label")));
if (isAttrLabelValid(label)) {
arrayList.add(new Pair<>(label.getContent().getHtmlLabel(), str + "-" + Toolkit.i18nText("Fine-Design_Chart_Label")));
}
}
}
}
private static boolean isAttrLabelValid(AttrLabel label){
private static boolean isAttrLabelValid(AttrLabel label) {
return label.isEnable() && label.getContent() != null && label.getContent().getHtmlLabel() != null;
}
@ -181,7 +181,7 @@ public class SearchJSUtils {
public static List<NameJavaScript> getNameJavaScript(ChartCollection chartCollection) {
ArrayList<NameJavaScript> nameJavaScriptArrayList = new ArrayList<>();
for (int i = 0; i < chartCollection.getChartCount(); i++) {
if (chartCollection.getChart(i) instanceof VanChart){
if (chartCollection.getChart(i) instanceof VanChart) {
VanChart chart = ((VanChart) chartCollection.getChart(i));
NameJavaScriptGroup nameJavaScriptGroup = chart.getPlot().getHotHyperLink();
addNameJavaScript2Array(nameJavaScriptArrayList, nameJavaScriptGroup);

113
designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java

@ -1,9 +1,7 @@
package com.fr.design.actions.replace.utils;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.ui.ITReplaceMainDialog;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
@ -30,6 +28,23 @@ public class ShowValueUtils {
public static final String ANY_THING_REGEX = ".";
public static final String NUMBER_REGEX = "[0-9]";
public static final String ENGLISH_REGEX = "[a-zA-Z]";
public static Pattern containPattern;
private static List<String> specialCharList = new ArrayList<>();
static {
//正则特殊字符:? * () [] {} ^ $ .
//如果是? 并采用通配符 ,会自动转成“.” 所以 ? 不用处理
//$同理
specialCharList.add("*");
specialCharList.add("(");
specialCharList.add(")");
specialCharList.add("[");
specialCharList.add("]");
specialCharList.add("{");
specialCharList.add("}");
specialCharList.add("^");
specialCharList.add(".");
}
/**
* 获取除内容外其他一次性展示所有的内容名称水印...
@ -42,9 +57,7 @@ public class ShowValueUtils {
if (StringUtils.isEmpty(searchStr)) {
return str;
} else {
return "<html><body><div><nobr>" +
replaceAll(str, searchStr, "<font color = 'rgb(61,153,249)'>" + searchStr + "</font>") +
"</nobr></div></body></html>";
return updateHighlight(str, searchStr);
}
}
@ -57,20 +70,28 @@ public class ShowValueUtils {
* @return 替换后的字符串
*/
public static String replaceAll(String str, String regex, String replacement) {
return str.replace(regex, replacement);
if (ITReplaceMainDialog.isMatched()) {
return str.replaceAll(changeRegex(regex), replacement);
} else {
return str.replace(regex, replacement);
}
}
/**
* 转换正则表达式
*
* @param regex
* @param regexStr
* @return
*/
public static String changeRegex(String regex) {
regex = regex.replace(NUMBER, NUMBER_REGEX);
regex = regex.replace(ENGLISH, ENGLISH_REGEX);
regex = regex.replace(ANY_THING, ANY_THING_REGEX);
return regex;
public static String changeRegex(String regexStr) {
String change = "\\";
for (int i = 0; i < specialCharList.size(); i++) {
regexStr = regexStr.replace(specialCharList.get(i), change + specialCharList.get(i));
}
regexStr = regexStr.replace(NUMBER, NUMBER_REGEX);
regexStr = regexStr.replace(ENGLISH, ENGLISH_REGEX);
regexStr = regexStr.replace(ANY_THING, ANY_THING_REGEX);
return regexStr;
}
/**
@ -101,21 +122,45 @@ public class ShowValueUtils {
return pairs;
}
/**
* 更新高亮状态
* 更新高亮
*
* @param info
* @param replaceStr
* @param str
* @param searchStr
* @return
*/
public static void updateHighlight(Info info, String replaceStr) {
String s = info.getInfoShowStr(info);
s = s.replace(info.getContent().getLastSearchStr(), "<font color = 'rgb(61,153,249)'>" + replaceStr + "</font>");
info.getContent().setShowStr(
"<html><body><div><nobr>" + s + "</nobr></div></body></html>"
);
public static String updateHighlight(String str, String searchStr) {
if (ITReplaceMainDialog.isMatched()) {
String result = str;
Pattern pattern = containPattern;
Matcher matcher = pattern.matcher(str);
String head = "<font color = 'rgb(61,153,249)'>";
String tail = "</font>";
int size = head.length() + tail.length();
int index = 0;
StringBuilder builder = new StringBuilder(str);
while (matcher.find()) {
builder.replace(matcher.start() + index, matcher.end() + index, head + changeHtmlStr(matcher.group()) + tail);
index += size;
}
return "<html><body><div><nobr>" +
builder.toString() +
"</nobr></div></body></html>";
} else {
return "<html><body><div><nobr>" +
replaceAll(str, searchStr, "<font color = 'rgb(61,153,249)'>" + changeHtmlStr(searchStr) + "</font>") +
"</nobr></div></body></html>";
}
}
private static String changeHtmlStr(String searchStr){
String showStr = searchStr;
showStr = showStr.replace("<","&lt;");
showStr = showStr.replace(">", "&gt");
return showStr;
}
/**
* 集合是否不为空
@ -132,18 +177,34 @@ public class ShowValueUtils {
* 支持正则表达式的indexOf
*
* @param str
* @param regex
* @param regexStr
* @return
*/
public static int indexOf(String str, String regex) {
public static int indexOf(String str, String regexStr) {
CharSequence inputStr = str;
int failReturn = -1;
String patternStr = changeRegex(regex);
Pattern pattern = Pattern.compile(patternStr);
Pattern pattern = containPattern;
Matcher matcher = pattern.matcher(inputStr);
if (matcher.find()) {
return matcher.start();
}
return failReturn;
}
/**
* 支持通配符的contains
* @param originStr
* @param matchStr
* @return
*/
public static boolean contains(String originStr, String matchStr) {
if (ITReplaceMainDialog.isMatched()) {
Pattern pattern = containPattern;
Matcher matcher = pattern.matcher(originStr);
return matcher.find();
} else {
return originStr.contains(matchStr);
}
}
}

48
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/model/TemplateResourceDetail.java

@ -8,9 +8,10 @@ import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -169,7 +170,7 @@ public class TemplateResourceDetail {
JSONObject resource = embedResources.getJSONObject(i);
if (resourceId.equals(resource.getString(ID))) {
detail.setInfo(resource.getString(INFO));
detail.setHtmlText(resource.getString(DETAIL_INFO));
detail.setHtmlText(reformat(resource.getString(DETAIL_INFO)));
detail.setVendor(resource.getString(VENDOR));
detail.setPrice(resource.getDouble(PRICE));
detail.setResourceUrl(resource.getString(URL));
@ -191,7 +192,7 @@ public class TemplateResourceDetail {
// 1请求详细信息
JSONObject info = helper.getTemplateInfoById(resourceId);
detail.setInfo(info.getString(INFO));
detail.setHtmlText(info.getString(DETAIL_INFO));
detail.setHtmlText(reformat(info.getString(DETAIL_INFO)));
detail.setVendor(info.getString(VENDOR));
detail.setTagsId(info.getString(TAGS_ID).split(","));
detail.setPrice(info.getDouble(PRICE));
@ -214,25 +215,36 @@ public class TemplateResourceDetail {
return null;
}
static final String A_TAG_FORMAT = "<a href=%s>%s</a>";
static final String HTML_TAG_REGX="<[^>]+>";
static final Pattern A_TAG_PATTERN = Pattern.compile("<a[^>]*href=(\\\"([^\\\"]*)\\\"|\\'([^\\']*)\\'|([^\\\\s>]*))[^>]*>(.*?)</a>");
static final Pattern HTML_TAG_PATTERN = Pattern.compile(HTML_TAG_REGX);
/**
* 这里做下数据转换
* 原始数据是html标签写的如下
* "<ol style="list-style-type: decimal;" class=" list-paddingleft-2"><li><p>该模板需用10.0及以上版本设计器预览<br/></p></li><li><p>该模板为库存场景解决方案的部分内容,全部内容可下载<a href="https://market.fanruan.com/template/20000733" target="_self">库存场景解决方案</a>查看</p></li><li><p>为保障模板预览效果,建议安装<a href="https://help.fanruan.com/finereport10.0/doc-view-3665.html" target="_self">新自适应插件</a>(FR11.0版本插件已内置,无需手动安装),有使用需求或疑问,请联系帆软技术支持咨询<br/></p></li></ol>",
*
* 转换的后的数据 是原始数据中所有<p></p>标签内的包括标签的字符串List<String>,如上字符串会转为如下
* List [<p>该模板需用10.0及以上版本设计器预览<br/></p>,
* <p>该模板为库存场景解决方案的部分内容全部内容可下载<a href="https://market.fanruan.com/template/20000733" target="_self">库存场景解决方案</a>查看</p>,
* <p>为保障模板预览效果建议安装<a href="https://help.fanruan.com/finereport10.0/doc-view-3665.html" target="_self">新自适应插件</a>FR11.0版本插件已内置无需手动安装有使用需求或疑问请联系帆软技术支持咨询<br/></p>
* ]
* 数据格式转换
* 原始数据的格式不统一纯文本html都有; 统一转为纯文本如果有a标签则保留
* */
static final Pattern htmlPattern = Pattern.compile("<p>(.+?)</p>");
static List<String> parseDetailInfo(String htmlDetailInfo) {
List<String> infos = new ArrayList<>();
Matcher matcher = htmlPattern.matcher(htmlDetailInfo);
static String reformat(String htmlDetailInfo) {
String result = HTML_TAG_PATTERN.matcher(htmlDetailInfo).replaceAll("");
Map<String, String> aMap = getLink(htmlDetailInfo);
for (Map.Entry<String, String> entry : aMap.entrySet()) {
String aTag = String.format(A_TAG_FORMAT, entry.getValue(), entry.getKey());
result = result.replace(entry.getKey(), aTag);
}
return result;
}
/**
* 读取dom中的a标签转换为map
*/
static Map<String, String> getLink(String html) {
Map<String, String> map = new HashMap<>();
Matcher matcher = A_TAG_PATTERN.matcher(html);
while (matcher.find()) {
infos.add(matcher.group());
map.put(matcher.group(5), matcher.group(1));
}
return infos;
return map;
}
}

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

@ -32,6 +32,7 @@ import com.fr.design.actions.insert.flot.FormulaFloatAction;
import com.fr.design.actions.insert.flot.ImageFloatAction;
import com.fr.design.actions.insert.flot.TextBoxFloatAction;
import com.fr.design.actions.replace.ITReplaceAction;
import com.fr.design.actions.replace.utils.ReplaceOperator;
import com.fr.design.bridge.DesignToolbarProvider;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.env.DesignerWorkspaceLoader;
@ -473,6 +474,8 @@ public class DesignerActivator extends Activator implements Prepare {
DesignModuleFactory.registerFormHierarchyPaneClass(FormHierarchyTreePane.class);
DesignModuleFactory.registerWidgetPropertyPaneClass(WidgetPropertyPane.class);
DesignModuleFactory.registerButtonDetailPaneClass(FormSubmitButtonDetailPane.class);
DesignModuleFactory.registerReplace(new ReplaceOperator());
DesignModuleFactory.registerParameterReader(new FormParameterReader());
StableFactory.registerMarkedClass(BaseJForm.XML_TAG, NewJForm.class);

6
designer-realize/src/test/java/com.fr/design/mainframe/alphafine/cell/model/ModelTest.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe.alphafine.cell.model;
import com.fr.design.actions.help.alphafine.AlphaFineConstants;
import com.fr.design.actions.help.alphafine.AlphaFineCloudConstants;
import com.fr.design.mainframe.alphafine.CellType;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
@ -14,8 +14,8 @@ public class ModelTest {
Assert.assertEquals("name", documentModel.getName());
Assert.assertEquals("content", documentModel.getContent());
Assert.assertEquals(1, documentModel.getDocumentId());
Assert.assertEquals(AlphaFineConstants.DOCUMENT_DOC_URL + documentModel.getDocumentId() + ".html", documentModel.getDocumentUrl());
Assert.assertEquals(AlphaFineConstants.DOCUMENT_INFORMATION_URL + documentModel.getDocumentId(), documentModel.getInformationUrl());
Assert.assertEquals(AlphaFineCloudConstants.DOCUMENT_DOC_URL + documentModel.getDocumentId() + ".html", documentModel.getDocumentUrl());
Assert.assertEquals(AlphaFineCloudConstants.DOCUMENT_INFORMATION_URL + documentModel.getDocumentId(), documentModel.getInformationUrl());
Assert.assertEquals(documentModel.getStoreInformation(), documentModel.getInformationUrl());
Assert.assertEquals(CellType.DOCUMENT, documentModel.getType());
Assert.assertEquals(true, documentModel.hasAction());

Loading…
Cancel
Save