/* * HtmlChoice.java * * Created on October 20, 2003, 9:22 PM */ package downey; import java.util.HashMap; /** * * @author Tim Downey */ public class BeanChoice { /** Creates a new instance of HtmlChoice */ public BeanChoice() { mapSelected = new HashMap(); } public void initChoice() { mapSelected = new HashMap(); } public void initChoice(HashMap map) { if (map == null) { map = new HashMap(); } mapSelected = map; } public String getChoice(String key) { if (key == null) { return ""; } if (mapSelected.containsKey(key)) { return (String) mapSelected.get(key); } else { return ""; } } public void setChoice(String key, String value) { if (key != null && !key.equals("")) { mapSelected.put(key, value); } } public void setChoice(String[] keys, String value) { if (keys != null) { for(int pos=0; pos < keys.length; pos++) { setChoice(keys[pos], value); } } } protected HashMap mapSelected; }