Browse Source

Merge branch 'bugfix/10.0' of https://code.fineres.com/scm/~henry.wang/design into bugfix/10.0

bugfix/10.0
Henry.Wang 4 years ago
parent
commit
fdd588154d
  1. 18
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java

18
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java

@ -17,6 +17,10 @@ import javax.swing.table.AbstractTableModel;
* 这个TableModel主要是预览数据的. 字段TableData必须转化为内置的
*/
public class PreviewTableModel extends AbstractTableModel {
private static final int LEN_LIMIT = 1000;
private static final String THREE_DOT = "...";
private DataModel dataModel;
private String erroMessage = null;
@ -127,11 +131,21 @@ public class PreviewTableModel extends AbstractTableModel {
public Object getValueAt(int row, int column) {
try {
return dataModel.getValueAt(row, column);
Object value = dataModel.getValueAt(row, column);
if (value != null) {
String strValue = value.toString();
// 字符长度过长 swing会卡住一会
// 同时设计器内预览展示也不需要展示太长的字符
if (strValue.length() > LEN_LIMIT) {
strValue = strValue.substring(0, LEN_LIMIT) + THREE_DOT;
return strValue;
}
}
return value;
} catch (TableDataException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
DesignUtils.errorMessage(e.getMessage());
return "";
return StringUtils.EMPTY;
}
}

Loading…
Cancel
Save