|
@@ -8,9 +8,9 @@ |
8 |
8 |
|
import com.google.gwt.dom.client.*; |
9 |
9 |
|
import com.google.gwt.gen2.table.client.*; |
10 |
10 |
|
import com.google.gwt.gen2.table.client.TableDefinition.*; |
11 |
|
- |
import com.google.gwt.user.client.ui.*; |
12 |
11 |
|
import com.google.gwt.user.client.ui.HasHorizontalAlignment.*; |
13 |
12 |
|
import com.google.gwt.user.client.ui.HasVerticalAlignment.*; |
|
13 |
+ |
import com.google.gwt.user.client.ui.*; |
14 |
14 |
|
|
15 |
15 |
|
class MockTable |
16 |
16 |
|
{ |
|
@@ -31,9 +31,9 @@ |
31 |
31 |
|
TableRowElement gridRow = Document.get().createTRElement(); // item 0 is the "ghost row" |
32 |
32 |
|
|
33 |
33 |
|
RowType rowValue = pTableDefinition.getPrototypeRowValue(); |
34 |
|
- |
if (rowValue != null) |
|
34 |
+ |
if ( rowValue != null ) |
35 |
35 |
|
{ |
36 |
|
- |
renderPrototypeRow(pTableDefinition, rowValue, gridRow); |
|
36 |
+ |
renderPrototypeRow( pTableDefinition, rowValue, gridRow ); |
37 |
37 |
|
} |
38 |
38 |
|
else |
39 |
39 |
|
{ |
|
@@ -41,17 +41,17 @@ |
41 |
41 |
|
int maxPaddingTop = 0; |
42 |
42 |
|
int maxPaddingBottom = 0; |
43 |
43 |
|
List<ColumnDefinition<RowType, ?>> colDefs = pTableDefinition.getVisibleColumnDefinitions(); |
44 |
|
- |
for (ColumnDefinition<RowType, ?> colDef : colDefs) |
|
44 |
+ |
for ( ColumnDefinition<RowType, ?> colDef : colDefs ) |
45 |
45 |
|
{ |
46 |
46 |
|
int paddingTop = colDef.getColumnProperty( PaddingProperty.TOP ).getValue(); |
47 |
47 |
|
int paddingBottom = colDef.getColumnProperty( PaddingProperty.BOTTOM ).getValue(); |
48 |
|
- |
maxPaddingTop = Math.max(paddingTop, maxPaddingTop); |
49 |
|
- |
maxPaddingBottom = Math.max(paddingBottom, maxPaddingBottom); |
|
48 |
+ |
maxPaddingTop = Math.max( paddingTop, maxPaddingTop ); |
|
49 |
+ |
maxPaddingBottom = Math.max( paddingBottom, maxPaddingBottom ); |
50 |
50 |
|
} |
51 |
51 |
|
TableCellElement td = Document.get().createTDElement(); |
52 |
52 |
|
td.setInnerHTML( " " ); |
53 |
|
- |
td.getStyle().setPropertyPx("paddingTop", maxPaddingTop); |
54 |
|
- |
td.getStyle().setPropertyPx("paddingBottom", maxPaddingBottom); |
|
53 |
+ |
td.getStyle().setPropertyPx( "paddingTop", maxPaddingTop ); |
|
54 |
+ |
td.getStyle().setPropertyPx( "paddingBottom", maxPaddingBottom ); |
55 |
55 |
|
gridRow.appendChild( td ); |
56 |
56 |
|
} |
57 |
57 |
|
gridBody.appendChild( gridRow ); |
|
@@ -60,28 +60,28 @@ |
60 |
60 |
|
outer.appendChild( headerWrapper ); |
61 |
61 |
|
outer.appendChild( dataWrapper ); |
62 |
62 |
|
CommonElementHelper.hide( outer ); |
63 |
|
- |
return new CreateResult(outer, gridRow); |
|
63 |
+ |
return new CreateResult( outer, gridRow ); |
64 |
64 |
|
} |
65 |
65 |
|
|
66 |
66 |
|
/** |
67 |
67 |
|
* Render full row w/ prototype values |
68 |
68 |
|
*/ |
69 |
69 |
|
@SuppressWarnings({"unchecked"}) |
70 |
|
- |
public static <RowType> void renderPrototypeRow(TableDefinition<RowType> pTableDefinition, RowType pValue, Element pTr) |
|
70 |
+ |
public static <RowType> void renderPrototypeRow( TableDefinition<RowType> pTableDefinition, RowType pValue, Element pTr ) |
71 |
71 |
|
{ |
72 |
|
- |
for (Node child; (child = pTr.getFirstChild()) != null; ) |
|
72 |
+ |
for ( Node child; (child = pTr.getFirstChild()) != null; ) |
73 |
73 |
|
{ |
74 |
|
- |
pTr.removeChild(child); |
|
74 |
+ |
pTr.removeChild( child ); |
75 |
75 |
|
} |
76 |
76 |
|
|
77 |
77 |
|
List<ColumnDefinition<RowType, ?>> colDefs = pTableDefinition.getVisibleColumnDefinitions(); |
78 |
78 |
|
PrototypeTableCellView<RowType> view = new PrototypeTableCellView<RowType>(); |
79 |
|
- |
for (ColumnDefinition<RowType, ?> colDef : colDefs) |
|
79 |
+ |
for ( ColumnDefinition<RowType, ?> colDef : colDefs ) |
80 |
80 |
|
{ |
81 |
81 |
|
TableCellElement td = Document.get().createTDElement(); |
82 |
|
- |
view.setTd(td); |
|
82 |
+ |
view.setTd( td ); |
83 |
83 |
|
CellRenderer cellRenderer = colDef.getCellRenderer(); |
84 |
|
- |
cellRenderer.renderRowValue(pValue, colDef, view); |
|
84 |
+ |
cellRenderer.renderRowValue( pValue, colDef, view ); |
85 |
85 |
|
pTr.appendChild( td ); |
86 |
86 |
|
} |
87 |
87 |
|
} |
|
@@ -92,54 +92,54 @@ |
92 |
92 |
|
|
93 |
93 |
|
public PrototypeTableCellView() |
94 |
94 |
|
{ |
95 |
|
- |
super(null); |
|
95 |
+ |
super( null ); |
96 |
96 |
|
} |
97 |
97 |
|
|
98 |
|
- |
public void setTd(TableCellElement pTd) |
|
98 |
+ |
public void setTd( TableCellElement pTd ) |
99 |
99 |
|
{ |
100 |
100 |
|
mTd = pTd; |
101 |
101 |
|
} |
102 |
102 |
|
|
103 |
103 |
|
@Override |
104 |
|
- |
public void setHTML(String pHtml) |
|
104 |
+ |
public void setHTML( String pHtml ) |
105 |
105 |
|
{ |
106 |
|
- |
mTd.setInnerHTML(pHtml); |
|
106 |
+ |
mTd.setInnerHTML( pHtml ); |
107 |
107 |
|
} |
108 |
108 |
|
|
109 |
109 |
|
@Override |
110 |
|
- |
public void setHorizontalAlignment(HorizontalAlignmentConstant pAlign) |
|
110 |
+ |
public void setHorizontalAlignment( HorizontalAlignmentConstant pAlign ) |
111 |
111 |
|
{ |
112 |
|
- |
mTd.setAlign(pAlign.getTextAlignString()); |
|
112 |
+ |
mTd.setAlign( pAlign.getTextAlignString() ); |
113 |
113 |
|
} |
114 |
114 |
|
|
115 |
115 |
|
@Override |
116 |
|
- |
public void setStyleAttribute(String pAttr, String pValue) |
|
116 |
+ |
public void setStyleAttribute( String pAttr, String pValue ) |
117 |
117 |
|
{ |
118 |
|
- |
mTd.getStyle().setProperty(pAttr, pValue); |
|
118 |
+ |
mTd.getStyle().setProperty( pAttr, pValue ); |
119 |
119 |
|
} |
120 |
120 |
|
|
121 |
121 |
|
@Override |
122 |
|
- |
public void setStyleName(String pStylename) |
|
122 |
+ |
public void setStyleName( String pStylename ) |
123 |
123 |
|
{ |
124 |
|
- |
mTd.setPropertyString("className", pStylename); |
|
124 |
+ |
mTd.setPropertyString( "className", pStylename ); |
125 |
125 |
|
} |
126 |
126 |
|
|
127 |
127 |
|
@Override |
128 |
|
- |
public void setText(String pText) |
|
128 |
+ |
public void setText( String pText ) |
129 |
129 |
|
{ |
130 |
|
- |
mTd.setInnerText(pText); |
|
130 |
+ |
mTd.setInnerText( pText ); |
131 |
131 |
|
} |
132 |
132 |
|
|
133 |
133 |
|
@Override |
134 |
|
- |
public void setVerticalAlignment(VerticalAlignmentConstant pAlign) |
|
134 |
+ |
public void setVerticalAlignment( VerticalAlignmentConstant pAlign ) |
135 |
135 |
|
{ |
136 |
|
- |
mTd.setVAlign(pAlign.getVerticalAlignString()); |
|
136 |
+ |
mTd.setVAlign( pAlign.getVerticalAlignString() ); |
137 |
137 |
|
} |
138 |
138 |
|
|
139 |
139 |
|
@Override |
140 |
|
- |
public void setWidget(Widget pWidget) |
|
140 |
+ |
public void setWidget( Widget pWidget ) |
141 |
141 |
|
{ |
142 |
|
- |
mTd.appendChild(pWidget.getElement()); |
|
142 |
+ |
mTd.appendChild( pWidget.getElement() ); |
143 |
143 |
|
} |
144 |
144 |
|
} |
145 |
145 |
|
|
|
@@ -148,7 +148,7 @@ |
148 |
148 |
|
public final Element mTable; |
149 |
149 |
|
public final TableRowElement mPrototypeRow; |
150 |
150 |
|
|
151 |
|
- |
public CreateResult(Element pTable, TableRowElement pPrototypeRow) |
|
151 |
+ |
public CreateResult( Element pTable, TableRowElement pPrototypeRow ) |
152 |
152 |
|
{ |
153 |
153 |
|
mTable = pTable; |
154 |
154 |
|
mPrototypeRow = pPrototypeRow; |