KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > jdnc > markup > elem > DataFieldEnumerationElement


1 /*
2  * $Id: DataFieldEnumerationElement.java,v 1.1.1.1 2004/06/16 01:43:40 davidson1 Exp $
3  *
4  * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
5  * Santa Clara, California 95054, U.S.A. All rights reserved.
6  */

7
8 package org.jdesktop.jdnc.markup.elem;
9
10 import java.util.ArrayList JavaDoc;
11 import java.util.Hashtable JavaDoc;
12 import java.util.List JavaDoc;
13 import java.util.Map JavaDoc;
14
15 import net.openmarkup.ElementAssimilator;
16 import net.openmarkup.ElementHandler;
17 import net.openmarkup.ElementType;
18 import net.openmarkup.Realizable;
19
20 import org.w3c.dom.Element JavaDoc;
21 import org.w3c.dom.Node JavaDoc;
22 import org.w3c.dom.NodeList JavaDoc;
23
24 import org.jdesktop.jdnc.markup.ElementTypes;
25 import org.jdesktop.jdnc.markup.Namespace;
26
27 /**
28  * @author Amy Fowler
29  */

30 public class DataFieldEnumerationElement extends ElementProxy {
31     private static final Map JavaDoc elementMap = new Hashtable JavaDoc();
32
33     public DataFieldEnumerationElement(Element JavaDoc element, ElementType elementType) {
34         super(element, elementType);
35     }
36
37     public Object JavaDoc instantiate() {
38         return new ArrayList JavaDoc();
39     }
40
41     protected Map JavaDoc registerElementHandlers() {
42         Map JavaDoc handlerMap = super.registerElementHandlers();
43         if (handlerMap != null) {
44             handlerMap.put(Namespace.JDNC + ":" +
45                            ElementTypes.FIELD_META_DATA_ENUMERATION.getLocalName(),
46                            enumerationValueElementHandler);
47         }
48         return handlerMap;
49     }
50
51     protected Map JavaDoc getElementHandlerMap() {
52         return elementMap;
53     }
54
55     public static final ElementAssimilator dataEnumerationValueAssimilator = new ElementAssimilator() {
56         public void assimilate(Realizable parent, Realizable child) {
57             List JavaDoc list = (List JavaDoc)parent.getObject();
58             list.add(child.getObject());
59         }
60     };
61
62     private static final ElementHandler enumerationValueElementHandler =
63          new ElementHandler(ElementTypes.FIELD_META_DATA_ENUMERATION,
64                             dataEnumerationValueAssimilator);
65
66 }
67
Popular Tags