01: package fr.aliacom.form.swt.ui;
02:
03: import org.eclipse.swt.graphics.Image;
04: import org.eclipse.swt.widgets.TableItem;
05:
06: import fr.aliacom.common.ui.IIcon;
07: import fr.aliacom.common.ui.table.ICell;
08: import fr.aliacom.form.swt.utils.SWTUtils;
09:
10: /**
11: * @author tom
12: *
13: * (C) 2001, 2003 Thomas Cataldo
14: */
15: public final class SWTTableCell implements ICell {
16:
17: private TableItem it;
18: private int column;
19:
20: public SWTTableCell() {
21: }
22:
23: public void setItem(TableItem it, int column) {
24: this .it = it;
25: this .column = column;
26: }
27:
28: /**
29: * @see fr.aliacom.common.ui.table.ICell#setText(java.lang.String)
30: */
31: public void setText(String text) {
32: it.setText(column, text);
33: }
34:
35: /**
36: * @see fr.aliacom.common.ui.table.ICell#setIcon(fr.aliacom.common.ui.IIcon)
37: */
38: public void setIcon(IIcon icon) {
39: final Image img = (Image) icon.getNativeWidget();
40: if (img != null) {
41: it.setImage(column, img);
42: SWTUtils.addDisposeHandler(it, img);
43: }
44: }
45:
46: }
|