KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: LabelElement.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.Map JavaDoc;
11
12 import org.w3c.dom.Element JavaDoc;
13 import net.openmarkup.AttributeHandler;
14 import net.openmarkup.ElementType;
15 import org.jdesktop.jdnc.markup.Attributes;
16 import org.jdesktop.jdnc.markup.Namespace;
17 import org.jdesktop.jdnc.markup.attr.LabelAttributes;
18 import org.jdesktop.jdnc.markup.attr.NullAttribute;
19
20 /**
21  *
22  * @author Ramesh Gupta
23  */

24 public class LabelElement extends ComponentElement {
25     public LabelElement(Element JavaDoc element, ElementType elementType) {
26         super(element, elementType);
27     }
28
29     protected void applyAttributesAfter() {
30         super.applyAttributesAfter();
31         applyAttribute(Namespace.JDNC, Attributes.ICON);
32         applyAttribute(Namespace.JDNC, Attributes.TITLE);
33         applyAttribute(Namespace.JDNC, Attributes.HORIZONTAL_ALIGNMENT);
34         applyAttribute(Namespace.JDNC, Attributes.HORIZONTAL_TEXT_POSITION);
35     }
36
37     protected Map JavaDoc registerAttributeHandlers() {
38         Map JavaDoc handlerMap = super.registerAttributeHandlers();
39         if (handlerMap != null) {
40             handlerMap.put(Namespace.JDNC + ":" + Attributes.ICON, iconHandler);
41             handlerMap.put(Namespace.JDNC + ":" + Attributes.TITLE, titleHandler);
42             handlerMap.put(Namespace.JDNC + ":" + Attributes.HORIZONTAL_ALIGNMENT,
43                            horizontalAlignmentHandler);
44             handlerMap.put(Namespace.JDNC + ":" +
45                            Attributes.HORIZONTAL_TEXT_POSITION,
46                            horizontalTextPositionHandler);
47             handlerMap.put(Namespace.JDNC + ":" + Attributes.VALUE,
48                NullAttribute.valueHandler);
49         }
50         return handlerMap;
51     }
52
53     private static final AttributeHandler horizontalAlignmentHandler =
54         new AttributeHandler(Namespace.JDNC, Attributes.HORIZONTAL_ALIGNMENT, LabelAttributes.horizontalAlignmentApplier);
55
56     private static final AttributeHandler horizontalTextPositionHandler =
57         new AttributeHandler(Namespace.JDNC, Attributes.HORIZONTAL_TEXT_POSITION, LabelAttributes.horizontalTextPositionApplier);
58
59     private static final AttributeHandler iconHandler =
60         new AttributeHandler(Namespace.JDNC, Attributes.ICON, LabelAttributes.iconApplier);
61
62     private static final AttributeHandler titleHandler =
63         new AttributeHandler(Namespace.JDNC, Attributes.TITLE, LabelAttributes.titleApplier);
64
65 }
66
Popular Tags