1 20 package net.mlw.vlh.web.tag.support; 21 22 import java.util.HashMap ; 23 import java.util.Map ; 24 25 import net.mlw.vlh.web.util.JspUtils; 26 27 33 public class Attributes implements Attributeable 34 { 35 private Map attributes = new HashMap (); 36 37 40 public Attributes() 41 { 42 43 } 44 45 49 public void setCellAttribute(String name, String value) 50 { 51 attributes.put(name, value); 52 } 53 54 59 public String getCellAttributesAsString() 60 { 61 return JspUtils.toAttributesString(attributes); 62 } 63 64 public Map getMap() 65 { 66 return attributes; 67 } 68 69 72 public void reset() 73 { 74 attributes.clear(); 75 } 76 77 85 public void appendCellAttribute(String key, String style) 86 { 87 if (attributes.containsKey(key)) 88 { 89 String current = (String ) attributes.get(key); 90 if (current!=null && current.length()>0){ 91 attributes.put(key, current + " " + style); 92 } else { 93 setCellAttribute(key, style); 94 } 95 } 96 else 97 { 98 setCellAttribute(key, style); 99 } 100 101 } 102 } | Popular Tags |