1 18 package net.sf.uitags.tagutil; 19 20 import java.util.HashMap ; 21 import java.util.Iterator ; 22 import java.util.Map ; 23 24 import net.sf.uitags.util.UiString; 25 26 32 public class AttributeSupportHelper implements AttributeSupport { 33 36 private Map attributeMap; 37 38 41 public AttributeSupportHelper() { 42 this.attributeMap = new HashMap (); 43 } 44 45 46 public void addAttribute(String name, String value) { 47 this.attributeMap.put(name, value); 48 } 49 50 57 public String eval() { 58 StringBuffer buffer = new StringBuffer (); 59 for ( 60 Iterator iter = this.attributeMap.entrySet().iterator(); 61 iter.hasNext(); ) { 62 Map.Entry entry = (Map.Entry ) iter.next(); 63 buffer.append(UiString.simpleConstruct(" {0}=\"{1}\"", new String [] { 64 (String ) entry.getKey(), (String ) entry.getValue() })); 65 } 66 return buffer.toString(); 67 } 68 } 69 | Popular Tags |