01: // AttributeEditor.java
02: // $Id: AttributeEditor.java,v 1.6 2000/08/16 21:37:26 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.jigadm.events.AttributeChangeEvent;
18: import org.w3c.jigadm.events.AttributeListener;
19:
20: /*
21: * The purpose of this class is to specialize the AttributeEditorInterface
22: * for graphical purposes.
23: */
24:
25: abstract public class AttributeEditor implements
26: AttributeEditorInterface {
27:
28: protected Vector als = null;
29:
30: public synchronized void addAttributeListener(AttributeListener al) {
31: if (als == null)
32: als = new Vector(2);
33: als.addElement(al);
34: }
35:
36: public synchronized void removeAttributeListener(
37: AttributeListener al) {
38: if (als != null)
39: als.removeElement(al);
40: }
41:
42: protected void processEvent(EventObject eo) {
43: Vector als = null;
44: AttributeListener al;
45: synchronized (this ) {
46: if ((this .als != null)
47: && (eo instanceof AttributeChangeEvent)) {
48: als = (Vector) this .als.clone();
49: } else {
50: return;
51: }
52: }
53: for (int i = 0; i < als.size(); i++) {
54: al = (AttributeListener) als.elementAt(i);
55: al.attributeChanged((AttributeChangeEvent) eo);
56: }
57: }
58:
59: /**
60: * get the Component created by the editor.
61: * @return a Component
62: */
63:
64: abstract public Component getComponent();
65: }
|