litesoft
Diff Revisions
282
vs
475
for /trunk/Java/GWT/Client/src/com/google/gwt/gen2/table/client/DefaultRowRenderer.java
|
@@ -15,40 +15,45 @@ |
15 |
15 |
|
*/ |
16 |
16 |
|
package com.google.gwt.gen2.table.client; |
17 |
17 |
|
|
18 |
|
- |
import com.google.gwt.gen2.table.client.TableDefinition.AbstractRowView; |
|
18 |
+ |
import com.google.gwt.gen2.table.client.TableDefinition.*; |
19 |
19 |
|
|
20 |
20 |
|
/** |
21 |
21 |
|
* The default {@link RowRenderer} used by the {@link DefaultTableDefinition} |
22 |
22 |
|
* when the user does not specify one. |
23 |
|
- |
* |
|
23 |
+ |
* |
24 |
24 |
|
* @param <RowType> the type of the row value |
25 |
25 |
|
*/ |
26 |
|
- |
public class DefaultRowRenderer<RowType> implements RowRenderer<RowType> { |
27 |
|
- |
/** |
28 |
|
- |
* The alternating colors to apply to the rows. |
29 |
|
- |
*/ |
30 |
|
- |
private String[] rowColors; |
|
26 |
+ |
public class DefaultRowRenderer<RowType> implements RowRenderer<RowType> |
|
27 |
+ |
{ |
|
28 |
+ |
/** |
|
29 |
+ |
* The alternating colors to apply to the rows. |
|
30 |
+ |
*/ |
|
31 |
+ |
private String[] rowColors; |
31 |
32 |
|
|
32 |
|
- |
/** |
33 |
|
- |
* Construct a new {@link DefaultRowRenderer}. |
34 |
|
- |
*/ |
35 |
|
- |
public DefaultRowRenderer() { |
36 |
|
- |
this(null); |
37 |
|
- |
} |
|
33 |
+ |
/** |
|
34 |
+ |
* Construct a new {@link DefaultRowRenderer}. |
|
35 |
+ |
*/ |
|
36 |
+ |
public DefaultRowRenderer() |
|
37 |
+ |
{ |
|
38 |
+ |
this( null ); |
|
39 |
+ |
} |
38 |
40 |
|
|
39 |
|
- |
/** |
40 |
|
- |
* Construct a new {@link DefaultRowRenderer}. |
41 |
|
- |
* |
42 |
|
- |
* @param rowColors an array of alternating colors to apply to the rows |
43 |
|
- |
*/ |
44 |
|
- |
public DefaultRowRenderer(String[] rowColors) { |
45 |
|
- |
this.rowColors = rowColors; |
46 |
|
- |
} |
|
41 |
+ |
/** |
|
42 |
+ |
* Construct a new {@link DefaultRowRenderer}. |
|
43 |
+ |
* |
|
44 |
+ |
* @param rowColors an array of alternating colors to apply to the rows |
|
45 |
+ |
*/ |
|
46 |
+ |
public DefaultRowRenderer( String[] rowColors ) |
|
47 |
+ |
{ |
|
48 |
+ |
this.rowColors = rowColors; |
|
49 |
+ |
} |
47 |
50 |
|
|
48 |
|
- |
public void renderRowValue(RowType rowValue, AbstractRowView<RowType> view) { |
49 |
|
- |
if (rowColors != null) { |
50 |
|
- |
int index = view.getRowIndex() % rowColors.length; |
51 |
|
- |
view.setStyleAttribute("background", rowColors[index]); |
|
51 |
+ |
public void renderRowValue( RowType rowValue, AbstractRowView<RowType> view ) |
|
52 |
+ |
{ |
|
53 |
+ |
if ( rowColors != null ) |
|
54 |
+ |
{ |
|
55 |
+ |
int index = view.getRowIndex() % rowColors.length; |
|
56 |
+ |
view.setStyleAttribute( "background", rowColors[index] ); |
|
57 |
+ |
} |
52 |
58 |
|
} |
53 |
|
- |
} |
54 |
59 |
|
} |