01: package fr.aliacom.form.swt.ui;
02:
03: import org.eclipse.swt.SWT;
04: import org.eclipse.swt.widgets.Button;
05: import org.eclipse.swt.widgets.Composite;
06:
07: import fr.aliacom.common.ui.IButton;
08: import fr.aliacom.form.common.IFormComponent;
09: import fr.aliacom.form.swt.IItem;
10: import fr.aliacom.form.swt.events.CommandSelectionListener;
11:
12: /**
13: * @author tom
14: *
15: * (C) 2001, 2002 Thomas Cataldo
16: */
17: public final class SWTButton implements IButton, IItem {
18:
19: private Button button;
20:
21: /**
22: * @param parent
23: */
24: public SWTButton(IFormComponent parent) {
25: button = new Button((Composite) parent.getNativeWidget(),
26: SWT.PUSH);
27: }
28:
29: /**
30: * @see fr.aliacom.form.common.IFormComponent#getNativeWidget()
31: */
32: public Object getNativeWidget() {
33: return button;
34: }
35:
36: /**
37: * @see fr.aliacom.form.common.IFormComponent#reset()
38: */
39: public void reset() {
40: }
41:
42: /**
43: * @see fr.aliacom.form.common.IFormComponent#setValueBean(Object)
44: */
45: public void setValueBean(Object bean) {
46: }
47:
48: /**
49: * @see fr.aliacom.common.ui.IButton#setText(java.lang.String)
50: */
51: public void setText(String text) {
52: button.setText(text);
53: }
54:
55: /* (non-Javadoc)
56: * @see fr.aliacom.form.swt.IItem#addSelectionListener(fr.aliacom.form.swt.events.CommandSelectionListener)
57: */
58: public void addSelectionListener(CommandSelectionListener listener) {
59: button.addSelectionListener(listener);
60: }
61:
62: /* (non-Javadoc)
63: * @see fr.aliacom.form.swt.IItem#setEnabled(boolean)
64: */
65: public void setEnabled(boolean b) {
66: if (!button.isDisposed()) {
67: button.setEnabled(b);
68: }
69: }
70:
71: }
|