KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: TableColumnHeaderElement.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.ElementType;
15 import net.openmarkup.Realizable;
16
17 import org.w3c.dom.Element JavaDoc;
18 import org.w3c.dom.Node JavaDoc;
19
20 import org.jdesktop.jdnc.markup.Attributes;
21 import org.jdesktop.jdnc.markup.Namespace;
22 import org.jdesktop.jdnc.markup.attr.ComponentAttributes;
23 import org.jdesktop.jdnc.markup.attr.LabelAttributes;
24
25 /**
26  *
27  * @author Amy Fowler
28  */

29 public class TableColumnHeaderElement extends ElementProxy {
30     private static final Map JavaDoc attrMap = new Hashtable JavaDoc();
31
32     public TableColumnHeaderElement(Element JavaDoc element, ElementType elementType) {
33         super(element, elementType);
34     }
35
36     protected void applyAttributesAfter() {
37         super.applyAttributesAfter();
38         //visual attributes applied to a LabelProperties object
39
applyAttribute(Namespace.JDNC, Attributes.BACKGROUND);
40         applyAttribute(Namespace.JDNC, Attributes.FOREGROUND);
41         applyAttribute(Namespace.JDNC, Attributes.HORIZONTAL_ALIGNMENT);
42         applyAttribute(Namespace.JDNC, Attributes.HORIZONTAL_TEXT_POSITION);
43         applyAttribute(Namespace.JDNC, Attributes.ICON);
44         applyAttribute(Namespace.JDNC, Attributes.ICON_TEXT_GAP);
45         applyAttribute(Namespace.JDNC, Attributes.VERTICAL_ALIGNMENT);
46         applyAttribute(Namespace.JDNC, Attributes.VERTICAL_TEXT_POSITION);
47
48         // now that column properties have been applied to a LabelProperties
49
// object, apply that to the column
50
//TableColumnAttributes.applyColumnProperties((TableColumnExt)getObject());
51

52     }
53
54     protected Map JavaDoc getAttributeHandlerMap() {
55         return attrMap;
56     }
57
58     protected Map JavaDoc registerAttributeHandlers() {
59         Map JavaDoc handlerMap = super.registerAttributeHandlers();
60         if (handlerMap != null) {
61             handlerMap.put(Namespace.JDNC + ":" + Attributes.BACKGROUND,
62                            backgroundHandler);
63             handlerMap.put(Namespace.JDNC + ":" + Attributes.FOREGROUND,
64                            foregroundHandler);
65             handlerMap.put(Namespace.JDNC + ":" + Attributes.HORIZONTAL_ALIGNMENT,
66                            horizontalAlignmentHandler);
67             handlerMap.put(Namespace.JDNC + ":" + Attributes.HORIZONTAL_TEXT_POSITION,
68                            horizontalTextPositionHandler);
69             handlerMap.put(Namespace.JDNC + ":" + Attributes.ICON,
70                            iconHandler);
71             handlerMap.put(Namespace.JDNC + ":" + Attributes.ICON_TEXT_GAP,
72                            iconTextGapHandler);
73             handlerMap.put(Namespace.JDNC + ":" + Attributes.VERTICAL_ALIGNMENT,
74                            verticalAlignmentHandler);
75             handlerMap.put(Namespace.JDNC + ":" + Attributes.VERTICAL_TEXT_POSITION,
76                            verticalTextPositionHandler);
77         }
78         return handlerMap;
79     }
80
81     private static final AttributeHandler backgroundHandler =
82         new AttributeHandler(Namespace.JDNC, Attributes.BACKGROUND,
83                              ComponentAttributes.backgroundApplier);
84
85     private static final AttributeHandler foregroundHandler =
86         new AttributeHandler(Namespace.JDNC, Attributes.FOREGROUND,
87                              ComponentAttributes.foregroundApplier);
88
89     private static final AttributeHandler horizontalAlignmentHandler =
90         new AttributeHandler(Namespace.JDNC, Attributes.HORIZONTAL_ALIGNMENT,
91                              LabelAttributes.horizontalAlignmentApplier);
92
93     private static final AttributeHandler horizontalTextPositionHandler =
94         new AttributeHandler(Namespace.JDNC, Attributes.HORIZONTAL_TEXT_POSITION,
95                              LabelAttributes.horizontalTextPositionApplier);
96
97     private static final AttributeHandler iconHandler =
98         new AttributeHandler(Namespace.JDNC, Attributes.ICON,
99                              LabelAttributes.iconApplier);
100
101     private static final AttributeHandler iconTextGapHandler =
102         new AttributeHandler(Namespace.JDNC, Attributes.ICON_TEXT_GAP,
103                              LabelAttributes.iconTextGapApplier);
104 /*
105     private static final AttributeHandler titleHandler =
106         new AttributeHandler(Namespace.JDNC, Attributes.TITLE,
107                              Label.titleApplier);
108         */

109
110     private static final AttributeHandler verticalAlignmentHandler =
111         new AttributeHandler(Namespace.JDNC, Attributes.VERTICAL_ALIGNMENT,
112                              LabelAttributes.verticalAlignmentApplier);
113
114     private static final AttributeHandler verticalTextPositionHandler =
115         new AttributeHandler(Namespace.JDNC, Attributes.VERTICAL_TEXT_POSITION,
116                              LabelAttributes.verticalTextPositionApplier);
117
118
119
120 }
121
Popular Tags