Browse Source

REPORT-75998 修复数据集面板不更新的bug、优化魔术数

feature/x
Destiny.Lin 2 years ago
parent
commit
0afa23c3c3
  1. 7
      designer-realize/src/main/java/com/fr/design/actions/replace/info/ReplaceObject.java
  2. 18
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java

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

@ -1,7 +1,10 @@
package com.fr.design.actions.replace.info;
import com.fr.data.impl.DBTableData;
import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.form.event.Listener;
import com.fr.general.GeneralUtils;
import com.fr.js.JavaScriptImpl;
@ -248,6 +251,10 @@ public enum ReplaceObject implements DealWithInfoValue {
DBTableData dbTableData = (DBTableData) info.getContent().getReplaceObject();
info.updateOldStr(dbTableData.getQuery(), findStr);
dbTableData.setQuery(ShowValueUtils.replaceAll(dbTableData.getQuery(), findStr, replaceStr));
//清除缓存
DesignTableDataManager.removeSelectedColumnNames(dbTableData.getName());
//收缩菜单
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView();
}
@Override

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

@ -46,6 +46,14 @@ public class ShowValueUtils {
public static final int HTML_TAIL_LEN = HTML_TAIL.length();
public static final int NOBR_LEN = NOBR.length();
public static final int NOBR_TAIL_LEN = NOBR_TAIL.length();
/**
* <转变为&lt;的长度差
*/
public static final int LEFT_DIFFERENT = 3;
/**
* >转变为&gt的长度差
*/
public static final int RIGHT_DIFFERENT = 2;
public static Pattern containPattern;
private static List<String> specialCharList = new ArrayList<>();
@ -168,7 +176,6 @@ public class ShowValueUtils {
String ans = HEAD + replaceAll(str, searchStr, FONT_HEAD + changeHtmlStr(searchStr) + FONT_TAIL) + TAIL;
return changeOriginHtmlStr(ans);
}
}
/**
@ -176,14 +183,13 @@ public class ShowValueUtils {
*/
private static String changeOriginHtmlStr(String str) {
int count = 0;
int different = 3;
StringBuilder builder = new StringBuilder(str);
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (c == LEFT_HTML_CHAR) {
if (!checkValid(str, i)) {
builder.replace(i + count, i + count + 1, "&lt;");
count += different;
count += LEFT_DIFFERENT;
}
}
}
@ -232,14 +238,12 @@ public class ShowValueUtils {
private static int getIncreaseCount(String str) {
int count = 0;
int leftDifferent = 3;
int rightDifferent = 2;
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) == LEFT_HTML_CHAR) {
count += leftDifferent;
count += LEFT_DIFFERENT;
}
if (str.charAt(i) == RIGHT_HTML_CHAR) {
count += rightDifferent;
count += RIGHT_DIFFERENT;
}
}
return count;

Loading…
Cancel
Save