|
|
@ -3,13 +3,16 @@ package com.fr.design.actions.replace.info; |
|
|
|
import com.fr.data.impl.DBTableData; |
|
|
|
import com.fr.data.impl.DBTableData; |
|
|
|
import com.fr.design.actions.replace.utils.ShowValueUtils; |
|
|
|
import com.fr.design.actions.replace.utils.ShowValueUtils; |
|
|
|
import com.fr.form.event.Listener; |
|
|
|
import com.fr.form.event.Listener; |
|
|
|
|
|
|
|
import com.fr.general.GeneralUtils; |
|
|
|
import com.fr.js.JavaScriptImpl; |
|
|
|
import com.fr.js.JavaScriptImpl; |
|
|
|
import com.fr.js.NameJavaScript; |
|
|
|
import com.fr.js.NameJavaScript; |
|
|
|
import com.fr.plugin.chart.base.VanChartHtmlLabel; |
|
|
|
import com.fr.plugin.chart.base.VanChartHtmlLabel; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.collections.combination.Pair; |
|
|
|
import com.fr.stable.collections.combination.Pair; |
|
|
|
|
|
|
|
import com.fr.web.attr.ReportWebAttr; |
|
|
|
import org.jetbrains.annotations.Nullable; |
|
|
|
import org.jetbrains.annotations.Nullable; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
@ -184,36 +187,77 @@ public enum ReplaceObject implements DealWithInfoValue { |
|
|
|
return StringUtils.equals(javaScript.getContent(), info.getContent().getOldShowStr()); |
|
|
|
return StringUtils.equals(javaScript.getContent(), info.getContent().getOldShowStr()); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 模板Web属性——引用JS |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
IMPORT_JS("String") { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Map<String, String> getValue(Object... o) { |
|
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>(); |
|
|
|
|
|
|
|
addValue2Map(contentKey, GeneralUtils.objectToString(o[0]), map); |
|
|
|
|
|
|
|
return map; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) { |
|
|
|
|
|
|
|
if (info.getContent().getHoldObject() instanceof ReportWebAttr) { |
|
|
|
|
|
|
|
ReportWebAttr attr = (ReportWebAttr) info.getContent().getHoldObject(); |
|
|
|
|
|
|
|
List<String> jsImports = Arrays.asList(attr.getJSImport()); |
|
|
|
|
|
|
|
String jsName = GeneralUtils.objectToString(info.getContent().getReplaceObject()); |
|
|
|
|
|
|
|
for (int i = 0, len = jsImports.size(); i < len; i++) { |
|
|
|
|
|
|
|
if (StringUtils.equals(jsImports.get(i), jsName)) { |
|
|
|
|
|
|
|
jsImports.set(i, ShowValueUtils.replaceAll(jsName, findStr, replaceStr)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
attr.clearJSImportList(); |
|
|
|
|
|
|
|
for (int i = 0, len = jsImports.size(); i < len; i++) { |
|
|
|
|
|
|
|
attr.addJSImport(jsImports.get(i)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public String getInfoShowStr(Info info) { |
|
|
|
|
|
|
|
return GeneralUtils.objectToString(info.getContent().getReplaceObject()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
boolean check(Info info) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
/** |
|
|
|
/** |
|
|
|
* DBTableData——SQL |
|
|
|
* DBTableData——SQL |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
DB_TABLE_DATA("DBTableData") { |
|
|
|
DB_TABLE_DATA("DBTableData") { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
boolean check(Info info) { |
|
|
|
boolean check (Info info){ |
|
|
|
DBTableData dbTableData = (DBTableData) info.getContent().getReplaceObject(); |
|
|
|
DBTableData dbTableData = (DBTableData) info.getContent().getReplaceObject(); |
|
|
|
return StringUtils.equals(dbTableData.getQuery(), info.getContent().getOldShowStr()); |
|
|
|
return StringUtils.equals(dbTableData.getQuery(), info.getContent().getOldShowStr()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Map<String, String> getValue(Object... o) { |
|
|
|
public Map<String, String> getValue (Object...o){ |
|
|
|
HashMap<String, String> map = new HashMap<>(); |
|
|
|
HashMap<String, String> map = new HashMap<>(); |
|
|
|
addValue2Map(contentKey, ((DBTableData) o[0]).getQuery(), map); |
|
|
|
addValue2Map(contentKey, ((DBTableData) o[0]).getQuery(), map); |
|
|
|
return map; |
|
|
|
return map; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) { |
|
|
|
public void setValue (Info info, String findStr, String |
|
|
|
|
|
|
|
replaceStr, List < Pair < Integer, Integer >> operatorArray){ |
|
|
|
DBTableData dbTableData = (DBTableData) info.getContent().getReplaceObject(); |
|
|
|
DBTableData dbTableData = (DBTableData) info.getContent().getReplaceObject(); |
|
|
|
info.updateOldStr(dbTableData.getQuery(), findStr); |
|
|
|
info.updateOldStr(dbTableData.getQuery(), findStr); |
|
|
|
dbTableData.setQuery(ShowValueUtils.replaceAll(dbTableData.getQuery(), findStr, replaceStr)); |
|
|
|
dbTableData.setQuery(ShowValueUtils.replaceAll(dbTableData.getQuery(), findStr, replaceStr)); |
|
|
|
//todo DesignTableDataManager
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public String getInfoShowStr(Info info) { |
|
|
|
public String getInfoShowStr (Info info){ |
|
|
|
return info.getInfoShowStr(info); |
|
|
|
return info.getInfoShowStr(info); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String name; |
|
|
|
String name; |
|
|
@ -256,4 +300,4 @@ public enum ReplaceObject implements DealWithInfoValue { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abstract boolean check(Info info); |
|
|
|
abstract boolean check(Info info); |
|
|
|
} |
|
|
|
} |
|
|
|