1 7 8 package org.jdesktop.jdnc.markup.elem; 9 10 import java.util.Map ; 11 12 import org.w3c.dom.Element ; 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 24 public class LabelElement extends ComponentElement { 25 public LabelElement(Element 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 registerAttributeHandlers() { 38 Map 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 |