|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| package org.displaytag.model; |
|
13 |
| |
|
14 |
| import org.apache.commons.lang.builder.ToStringBuilder; |
|
15 |
| import org.apache.commons.lang.builder.ToStringStyle; |
|
16 |
| import org.displaytag.util.HtmlAttributeMap; |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| public class Cell implements Comparable, Cloneable |
|
31 |
| { |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
| |
|
36 |
| public static final Cell EMPTY_CELL = new Cell(); |
|
37 |
| |
|
38 |
| |
|
39 |
| |
|
40 |
| |
|
41 |
| private Object staticValue; |
|
42 |
| |
|
43 |
| |
|
44 |
| |
|
45 |
| |
|
46 |
| private HtmlAttributeMap attributes; |
|
47 |
| |
|
48 |
| |
|
49 |
| |
|
50 |
| |
|
51 |
1
| private Cell()
|
|
52 |
| { |
|
53 |
1
| super();
|
|
54 |
| } |
|
55 |
| |
|
56 |
| |
|
57 |
| |
|
58 |
| |
|
59 |
| |
|
60 |
222
| public Cell(Object value)
|
|
61 |
| { |
|
62 |
222
| this.staticValue = value;
|
|
63 |
| } |
|
64 |
| |
|
65 |
| |
|
66 |
| |
|
67 |
| |
|
68 |
| |
|
69 |
1438
| public Object getStaticValue()
|
|
70 |
| { |
|
71 |
1438
| return this.staticValue;
|
|
72 |
| } |
|
73 |
| |
|
74 |
| |
|
75 |
| |
|
76 |
| |
|
77 |
| |
|
78 |
| |
|
79 |
| |
|
80 |
12
| public int compareTo(Object obj)
|
|
81 |
| { |
|
82 |
| |
|
83 |
12
| if (this.staticValue == null)
|
|
84 |
| { |
|
85 |
0
| return -1;
|
|
86 |
| } |
|
87 |
| |
|
88 |
12
| if (obj instanceof Cell)
|
|
89 |
| { |
|
90 |
12
| Object otherStatic = ((Cell) obj).getStaticValue();
|
|
91 |
12
| if (otherStatic == null)
|
|
92 |
| { |
|
93 |
0
| return 1;
|
|
94 |
| } |
|
95 |
12
| return ((Comparable) this.staticValue).compareTo(otherStatic);
|
|
96 |
| } |
|
97 |
| |
|
98 |
0
| return ((Comparable) this.staticValue).compareTo(obj);
|
|
99 |
| |
|
100 |
| } |
|
101 |
| |
|
102 |
| |
|
103 |
| |
|
104 |
| |
|
105 |
| |
|
106 |
1
| public String toString()
|
|
107 |
| { |
|
108 |
1
| return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
|
|
109 |
| .append("staticValue", this.staticValue).toString(); |
|
110 |
| } |
|
111 |
| |
|
112 |
6
| public void setPerRowAttributes(HtmlAttributeMap perRowValues)
|
|
113 |
| { |
|
114 |
6
| this.attributes = perRowValues;
|
|
115 |
| } |
|
116 |
| |
|
117 |
1059
| public HtmlAttributeMap getPerRowAttributes()
|
|
118 |
| { |
|
119 |
1059
| return this.attributes;
|
|
120 |
| } |
|
121 |
| |
|
122 |
| } |