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