--- /dev/null
+// AttributeEditor.java\r
+// $Id: AttributeEditor.java,v 1.1 2010/06/15 12:22:40 smhuang Exp $\r
+// (c) COPYRIGHT MIT and INRIA, 1997.\r
+// Please first read the full copyright statement in file COPYRIGHT.html\r
+\r
+package org.w3c.jigadm.editors ;\r
+\r
+import java.awt.Component;\r
+\r
+import java.util.EventObject;\r
+import java.util.Properties;\r
+import java.util.Vector;\r
+\r
+import org.w3c.jigsaw.admin.RemoteResource;\r
+import org.w3c.tools.resources.Attribute;\r
+\r
+import org.w3c.jigadm.events.AttributeChangeEvent;\r
+import org.w3c.jigadm.events.AttributeListener;\r
+\r
+ /*\r
+ * The purpose of this class is to specialize the AttributeEditorInterface\r
+ * for graphical purposes.\r
+ */\r
+\r
+abstract public class AttributeEditor implements AttributeEditorInterface {\r
+\r
+ protected Vector als = null;\r
+\r
+ public synchronized void addAttributeListener(AttributeListener al) {\r
+ if (als == null)\r
+ als = new Vector(2);\r
+ als.addElement(al);\r
+ }\r
+\r
+ public synchronized void removeAttributeListener(AttributeListener al) {\r
+ if ( als != null ) \r
+ als.removeElement(al);\r
+ }\r
+\r
+ protected void processEvent(EventObject eo) {\r
+ Vector als = null;\r
+ AttributeListener al;\r
+ synchronized(this) {\r
+ if((this.als != null) && (eo instanceof AttributeChangeEvent )) {\r
+ als = (Vector) this.als.clone();\r
+ } else {\r
+ return;\r
+ }\r
+ }\r
+ for(int i=0; i<als.size(); i++) {\r
+ al = (AttributeListener) als.elementAt(i);\r
+ al.attributeChanged((AttributeChangeEvent)eo);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * get the Component created by the editor.\r
+ * @return a Component\r
+ */\r
+\r
+ abstract public Component getComponent();\r
+}\r