1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.seasar.uruma.binding.value.binder; |
17 | |
|
18 | |
import org.eclipse.jface.viewers.TableViewer; |
19 | |
import org.eclipse.swt.widgets.Table; |
20 | |
import org.eclipse.swt.widgets.TableColumn; |
21 | |
import org.seasar.framework.beans.PropertyDesc; |
22 | |
import org.seasar.uruma.binding.value.ValueBinder; |
23 | |
import org.seasar.uruma.component.UIComponent; |
24 | |
import org.seasar.uruma.component.jface.TableColumnComponent; |
25 | |
import org.seasar.uruma.component.jface.TableComponent; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | 8 | public class TableViewerValueBinder extends AbstractValueBinder<TableViewer> { |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
public TableViewerValueBinder() { |
39 | 4 | super(TableViewer.class); |
40 | 4 | } |
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
@Override |
47 | |
protected void doExportValue(final TableViewer widget, |
48 | |
final Object formObj, final PropertyDesc propDesc, |
49 | |
final UIComponent uiComp) { |
50 | 8 | super.doExportValue(widget, formObj, propDesc, uiComp); |
51 | |
|
52 | 8 | Table table = widget.getTable(); |
53 | 8 | table.setRedraw(false); |
54 | 8 | TableColumn[] columns = table.getColumns(); |
55 | 8 | TableComponent tableComp = (TableComponent) uiComp; |
56 | 32 | for (int i = 0; i < columns.length; i++) { |
57 | 24 | if (((TableColumnComponent) tableComp.getChildren().get(i)).width == null) { |
58 | 0 | columns[i].pack(); |
59 | |
} |
60 | |
} |
61 | 8 | table.setRedraw(true); |
62 | 8 | } |
63 | |
} |