1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.extremecomponents.table.cell;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.apache.commons.logging.Log;
20 import org.apache.commons.logging.LogFactory;
21 import org.extremecomponents.table.model.TableModelUtils;
22 import org.extremecomponents.util.HtmlBuilder;
23
24
25
26 /***
27 * Will generate a simple cell to display.
28 *
29 * @author Jeff Johnston
30 */
31 public class DisplayCell extends BaseCell
32 {
33 private static Log logger = LogFactory.getLog(DisplayCell.class);
34
35 public String html()
36 {
37 HtmlBuilder html = new HtmlBuilder();
38
39 html.append(startTD());
40
41 Object value = column.getValue();
42 if (value != null && StringUtils.isNotEmpty(value.toString()))
43 {
44 html.append(value);
45 }
46 else
47 {
48 html.append(" ");
49 }
50
51 html.append(endTD());
52
53 return html.toString();
54 }
55
56 public String value()
57 {
58 Object obj = column.getValue();
59 if (obj != null && StringUtils.isNotBlank(obj.toString()))
60 {
61 return TableModelUtils.parseCell(obj.toString());
62 }
63
64 return "";
65 }
66 }