KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > tracelog > ui > AbstractWidget


1 /*
2  * AbstractWidget.java May 7, 2007
3  */

4 package net.sourceforge.tracelog.ui;
5
6 import net.sourceforge.tracelog.utils.ProjectProperties;
7 import net.sourceforge.tracelog.utils.Util;
8
9 import org.eclipse.swt.widgets.Composite;
10 import org.eclipse.swt.widgets.Display;
11 import org.eclipse.swt.widgets.Shell;
12
13 public abstract class AbstractWidget {
14     protected Display display;
15     protected String JavaDoc appTitle;
16     protected String JavaDoc authorName;
17     protected String JavaDoc appVersion;
18     protected Shell parentShell;
19     protected Composite parentComposite;
20     protected ProjectProperties projectProperties;
21     protected WidgetFactory widgetFactory;
22     protected IMediator mediator;
23
24     protected AbstractWidget() {
25         this.mediator = null;
26         this.parentShell = null;
27         this.parentComposite = null;
28         this.display = Util.getDisplay();
29         this.projectProperties = ProjectProperties.getInstance();
30         this.appTitle = projectProperties.getApplicationTitle();
31         this.authorName = projectProperties.getAuthorName();
32         this.appVersion = Util.getLatestVersion();
33         this.widgetFactory = WidgetFactory.getInstance();
34     }
35
36     public final void setParentComposite(Composite parentComposite) {
37         this.parentComposite = parentComposite;
38     }
39
40     public final void setParentShell(Shell parentShell) {
41         this.parentShell = parentShell;
42     }
43
44     public final void setMediator(IMediator mediator) {
45         this.mediator = mediator;
46
47         if (mediator != null) {
48             this.mediator.register(this);
49         }
50     }
51
52     public abstract void run();
53 }
54
Popular Tags