|
@@ -1,41 +1,38 @@ |
1 |
1 |
|
package com.temp.client.foundation.widget.table.column; |
2 |
2 |
|
|
3 |
|
- |
import com.temp.client.foundation.widget.table.DataRow; |
4 |
|
- |
import com.temp.client.foundation.widget.table.cell.CellDecorator; |
5 |
|
- |
import com.temp.client.foundation.widget.table.cell.CellDecoratorAccessor; |
6 |
|
- |
import com.temp.client.foundation.widget.table.cell.TextDataCell; |
7 |
|
- |
import com.temp.shared.utils.ObjectUtils; |
8 |
|
- |
|
9 |
|
- |
import com.google.gwt.cell.client.Cell.Context; |
10 |
|
- |
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; |
11 |
|
- |
import com.google.gwt.user.cellview.client.Column; |
|
3 |
+ |
import com.google.gwt.cell.client.Cell.*; |
|
4 |
+ |
import com.google.gwt.safehtml.shared.*; |
|
5 |
+ |
import com.google.gwt.user.cellview.client.*; |
|
6 |
+ |
import com.temp.client.foundation.widget.table.*; |
|
7 |
+ |
import com.temp.client.foundation.widget.table.cell.*; |
|
8 |
+ |
import com.temp.shared.utils.*; |
12 |
9 |
|
|
13 |
10 |
|
public class TextDataColumn<R extends DataRow<F>, F> extends Column<R, String> implements DataColumn { |
14 |
11 |
|
|
15 |
12 |
|
private F field; |
16 |
13 |
|
private CellDecorator<R> cellDecorator; |
17 |
14 |
|
|
18 |
|
- |
public TextDataColumn(F field) { |
19 |
|
- |
this(field, false, false); |
|
15 |
+ |
public TextDataColumn( F field ) { |
|
16 |
+ |
this( field, false, false ); |
20 |
17 |
|
} |
21 |
18 |
|
|
22 |
|
- |
public TextDataColumn(F field, boolean isSortable) { |
23 |
|
- |
this(field, isSortable, false); |
|
19 |
+ |
public TextDataColumn( F field, boolean isSortable ) { |
|
20 |
+ |
this( field, isSortable, false ); |
24 |
21 |
|
} |
25 |
22 |
|
|
26 |
|
- |
public TextDataColumn(F field, boolean isSortable, boolean isNumeric) { |
|
23 |
+ |
public TextDataColumn( F field, boolean isSortable, boolean isNumeric ) { |
27 |
24 |
|
//super(new TextCell()); |
28 |
|
- |
super(new TextDataCell<String>()); |
|
25 |
+ |
super( new TextDataCell<String>() ); |
29 |
26 |
|
this.field = field; |
30 |
|
- |
setSortable(isSortable); |
31 |
|
- |
if (isNumeric) { |
32 |
|
- |
setHorizontalAlignment(ALIGN_RIGHT); |
|
27 |
+ |
setSortable( isSortable ); |
|
28 |
+ |
if ( isNumeric ) { |
|
29 |
+ |
setHorizontalAlignment( ALIGN_RIGHT ); |
33 |
30 |
|
} |
34 |
|
- |
if (field instanceof CellDecorator) { |
35 |
|
- |
cellDecorator = ObjectUtils.cast(field); |
|
31 |
+ |
if ( field instanceof CellDecorator ) { |
|
32 |
+ |
cellDecorator = ObjectUtils.cast( field ); |
36 |
33 |
|
} |
37 |
|
- |
if (field instanceof CellDecoratorAccessor) { |
38 |
|
- |
CellDecoratorAccessor<R> accessor = ObjectUtils.cast(field); |
|
34 |
+ |
if ( field instanceof CellDecoratorAccessor ) { |
|
35 |
+ |
CellDecoratorAccessor<R> accessor = ObjectUtils.cast( field ); |
39 |
36 |
|
cellDecorator = accessor.getCellDecorator(); |
40 |
37 |
|
} |
41 |
38 |
|
} |
|
@@ -46,17 +43,17 @@ |
46 |
43 |
|
} |
47 |
44 |
|
|
48 |
45 |
|
@Override |
49 |
|
- |
public String getValue(R rowData) { |
50 |
|
- |
return rowData.getNonNullValueString(field); |
|
46 |
+ |
public String getValue( R rowData ) { |
|
47 |
+ |
return rowData.getNonNullValueString( field ); |
51 |
48 |
|
} |
52 |
49 |
|
|
53 |
|
- |
public void render(Context context, R object, SafeHtmlBuilder sb) { |
54 |
|
- |
if (cellDecorator == null) { |
55 |
|
- |
super.render(context, object, sb); |
|
50 |
+ |
public void render( Context context, R object, SafeHtmlBuilder sb ) { |
|
51 |
+ |
if ( cellDecorator == null ) { |
|
52 |
+ |
super.render( context, object, sb ); |
56 |
53 |
|
} else { |
57 |
|
- |
cellDecorator.prepend(context, object, sb); |
58 |
|
- |
super.render(context, object, sb); |
59 |
|
- |
cellDecorator.append(context, object, sb); |
|
54 |
+ |
cellDecorator.prepend( context, object, sb ); |
|
55 |
+ |
super.render( context, object, sb ); |
|
56 |
+ |
cellDecorator.append( context, object, sb ); |
60 |
57 |
|
} |
61 |
58 |
|
} |
62 |
59 |
|
} |