KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: HierarchicalDataElement.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.Hashtable JavaDoc;
11 import java.util.Map JavaDoc;
12
13 import net.openmarkup.AttributeHandler;
14 import net.openmarkup.ElementAssimilator;
15 import net.openmarkup.ElementHandler;
16 import net.openmarkup.ElementType;
17 import net.openmarkup.Realizable;
18
19 import org.w3c.dom.Element JavaDoc;
20
21 import org.jdesktop.jdnc.markup.Attributes;
22 import org.jdesktop.jdnc.markup.ElementTypes;
23 import org.jdesktop.jdnc.markup.Namespace;
24 import org.jdesktop.jdnc.markup.attr.HierarchicalDataAttributes;
25
26 /**
27  *
28  * @author Ramesh Gupta
29  */

30 public class HierarchicalDataElement extends ElementProxy {
31     private static final Map JavaDoc attrMap = new Hashtable JavaDoc();
32     private static final Map JavaDoc elementMap = new Hashtable JavaDoc();
33     private static final Map JavaDoc mediaTypeRepresentation = new Hashtable JavaDoc();
34
35     public HierarchicalDataElement(Element JavaDoc element, ElementType elementType) {
36         super(element, elementType);
37     }
38
39     protected void applyAttributesAfter() {
40         super.applyAttributesAfter();
41         applyAttribute(Namespace.JDNC, Attributes.SOURCE);
42     }
43
44     protected Map JavaDoc registerAttributeHandlers() {
45         Map JavaDoc handlerMap = super.registerAttributeHandlers();
46         if (handlerMap != null) {
47             handlerMap.put(Namespace.JDNC + ":" + Attributes.SOURCE, sourceHandler);
48         }
49         return handlerMap;
50     }
51
52     protected Map JavaDoc registerElementHandlers() {
53         Map JavaDoc handlerMap = super.registerElementHandlers();
54         if (handlerMap != null) {
55             handlerMap.put(Namespace.JDNC + ":" +
56                            ElementTypes.META_DATA.getLocalName(),
57                            metaDataElementHandler);
58         }
59         return handlerMap;
60     }
61
62     public static final ElementAssimilator metaDataAssimilator = new
63         ElementAssimilator() {
64         public void assimilate(Realizable parent, Realizable child) {
65
66         }
67     };
68
69     protected Map JavaDoc getAttributeHandlerMap() {
70         return attrMap;
71     }
72
73     protected Map JavaDoc getElementHandlerMap() {
74         return elementMap;
75     }
76
77
78     private static final AttributeHandler sourceHandler =
79         new AttributeHandler(Namespace.JDNC, Attributes.SOURCE, HierarchicalDataAttributes.sourceApplier);
80
81     private static final ElementHandler metaDataElementHandler =
82         new ElementHandler(ElementTypes.META_DATA, metaDataAssimilator);
83
84 }
85
Popular Tags