01: // ResourceHelper.java
02: // $Id: ResourceHelper.java,v 1.6 2000/08/16 21:37:27 ylafon Exp $
03: // (c) COPYRIGHT MIT and INRIA, 1997.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.jigadm.editors;
07:
08: import java.awt.Component;
09:
10: import java.util.EventObject;
11: import java.util.Properties;
12: import java.util.Vector;
13:
14: import org.w3c.jigsaw.admin.RemoteResource;
15: import org.w3c.tools.resources.Attribute;
16:
17: import org.w3c.tools.widgets.MessagePopup;
18:
19: import org.w3c.jigadm.RemoteResourceWrapper;
20:
21: import org.w3c.jigadm.events.ResourceChangeEvent;
22: import org.w3c.jigadm.events.ResourceListener;
23:
24: abstract public class ResourceHelper implements ResourceHelperInterface {
25:
26: protected Vector rls = null;
27:
28: abstract public String getTitle();
29:
30: abstract public Component getComponent();
31:
32: protected void errorPopup(String name, Exception ex) {
33: (new MessagePopup(name + " : " + ex.getMessage())).show();
34: }
35:
36: protected void msgPopup(String name) {
37: (new MessagePopup(name)).show();
38: }
39:
40: public synchronized void addResourceListener(ResourceListener rl) {
41: if (rls == null)
42: rls = new Vector(2);
43: rls.addElement(rl);
44: }
45:
46: public RemoteResource getValue() {
47: return null;
48: }
49:
50: public synchronized void removeResourceListener(ResourceListener rl) {
51: if (rls != null)
52: rls.removeElement(rl);
53: }
54:
55: protected void processEvent(EventObject eo) {
56: Vector rls = null;
57: ResourceListener rl;
58: synchronized (this ) {
59: if ((this .rls != null)
60: && (eo instanceof ResourceChangeEvent)) {
61: rls = (Vector) this .rls.clone();
62: } else {
63: return;
64: }
65: }
66: for (int i = 0; i < rls.size(); i++) {
67: rl = (ResourceListener) rls.elementAt(i);
68: rl.resourceChanged((ResourceChangeEvent) eo);
69: }
70: }
71: }
|