KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: SorterElement.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.regex.Pattern JavaDoc;
11
12 import org.w3c.dom.Element JavaDoc;
13 import org.jdesktop.swing.decorator.ShuttleSorter;
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.Decoder;
18 import java.util.Hashtable JavaDoc;
19 import java.util.Map JavaDoc;
20 import net.openmarkup.AttributeHandler;
21 import org.jdesktop.jdnc.markup.attr.SorterAttributes;
22
23 /**
24  *
25  * @author Ramesh Gupta
26  */

27 public class SorterElement extends FilterElement {
28     private static final Map JavaDoc attrMap = new Hashtable JavaDoc();
29
30     public SorterElement(Element JavaDoc element, ElementType elementType) {
31         super(element, elementType);
32     }
33
34     protected Object JavaDoc instantiate() {
35         return new ShuttleSorter(getColumnIndex(), true);
36     }
37
38     protected void applyAttributesAfter() {
39         super.applyAttributesAfter();
40         applyAttribute(Namespace.JDNC, Attributes.DIRECTION);
41     }
42     protected Map JavaDoc registerAttributeHandlers() {
43         Map JavaDoc handlerMap = super.registerAttributeHandlers();
44         if (handlerMap != null) {
45             handlerMap.put(Namespace.JDNC + ":" + Attributes.DIRECTION,
46                            directionAttrHandler);
47         }
48         return handlerMap;
49     }
50
51     protected Map JavaDoc getAttributeHandlerMap() {
52         return attrMap;
53     }
54
55     private static final AttributeHandler directionAttrHandler =
56         new AttributeHandler(Namespace.JDNC, Attributes.DIRECTION, SorterAttributes.directionApplier);
57
58 }
59
Popular Tags