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.*; 18 19 23 public class AlternateRowsElement extends HighlighterElement { 24 public AlternateRowsElement(Element element, ElementType elementType) { 25 super(element, elementType); 26 } 27 28 protected void applyAttributesAfter() { 29 super.applyAttributesAfter(); 30 applyAttribute(Namespace.JDNC, Attributes.ODD_ROW_BACKGROUND); 31 applyAttribute(Namespace.JDNC, Attributes.EVEN_ROW_BACKGROUND); 32 } 33 34 protected Map registerAttributeHandlers() { 35 Map handlerMap = super.registerAttributeHandlers(); 36 if (handlerMap != null) { 37 handlerMap.put(Namespace.JDNC + ":" + 38 Attributes.EVEN_ROW_BACKGROUND, 39 evenRowBackgroundAttrHandler); 40 handlerMap.put(Namespace.JDNC + ":" + Attributes.ODD_ROW_BACKGROUND, 41 oddRowBackgroundAttrHandler); 42 } 43 return handlerMap; 44 } 45 46 private static final AttributeHandler evenRowBackgroundAttrHandler = 47 new AttributeHandler(Namespace.JDNC, Attributes.EVEN_ROW_BACKGROUND, 48 HighlighterAttributes.evenRowBackgroundApplier); 49 private static final AttributeHandler oddRowBackgroundAttrHandler = 50 new AttributeHandler(Namespace.JDNC, Attributes.ODD_ROW_BACKGROUND, 51 HighlighterAttributes.oddRowBackgroundApplier); 52 } 53 | Popular Tags |