Browse Source

REPORT-34465 预览视图页面无法关闭

bugfix/10.0
hades 4 years ago
parent
commit
197cb42014
  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必须转化为内置的 * 这个TableModel主要是预览数据的. 字段TableData必须转化为内置的
*/ */
public class PreviewTableModel extends AbstractTableModel { public class PreviewTableModel extends AbstractTableModel {
private static final int LEN_LIMIT = 1000;
private static final String THREE_DOT = "...";
private DataModel dataModel; private DataModel dataModel;
private String erroMessage = null; private String erroMessage = null;
@ -127,11 +131,21 @@ public class PreviewTableModel extends AbstractTableModel {
public Object getValueAt(int row, int column) { public Object getValueAt(int row, int column) {
try { 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) { } catch (TableDataException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
DesignUtils.errorMessage(e.getMessage()); DesignUtils.errorMessage(e.getMessage());
return ""; return StringUtils.EMPTY;
} }
} }

Loading…
Cancel
Save