01: package org.osbl.client.wings.control;
02:
03: import org.wings.*;
04: import org.concern.Subject;
05: import org.osbl.client.wings.concern.SubjectForm;
06: import org.osbl.client.wings.shell.Tool;
07:
08: import java.util.*;
09:
10: /**
11: * @author hengels
12: * @version $Revision$
13: */
14: public class SubjectPanel extends SPanel implements Plugin {
15: private Subject subject;
16: private SubjectForm subjectForm = new SubjectForm();
17:
18: public SubjectPanel() {
19: setPreferredSize(SDimension.FULLWIDTH);
20: add(new SRawTextComponent(""));
21: }
22:
23: public void setController(org.concern.Controller controller) {
24: }
25:
26: public void setSubject(Subject subject) {
27: this .subject = subject;
28: }
29:
30: public void update() {
31: if (subject == null)
32: return;
33:
34: try {
35: subjectForm.setSubject(subject);
36:
37: SComponent component = subjectForm.getComponent();
38: if (component != getComponent(0)) {
39: remove(0);
40: add(component, SBorderLayout.CENTER);
41: }
42:
43: subjectForm.setObject(subject);
44: } catch (Exception e) {
45: removeAll();
46: add(new SRawTextComponent(e.getMessage()));
47: e.printStackTrace(System.err);
48: }
49: }
50:
51: public List<Tool> getTools() {
52: return new LinkedList<Tool>();
53: }
54: }
|