Browse Source

Pull request #1792: REPORT-34465 预览视图页面无法关闭

Merge in DESIGN/design from ~HADES/design:bugfix/10.0 to bugfix/10.0

* commit '197cb420144c5ec4825ff66fb3b8663166670f9d':
  REPORT-34465 预览视图页面无法关闭
bugfix/10.0
Hades 4 years ago
parent
commit
43f3b0760d
  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