1 16 package org.apache.cocoon.portal.util; 17 18 import java.util.HashMap ; 19 import java.util.Iterator ; 20 import java.util.Map ; 21 22 import org.apache.cocoon.portal.layout.Parameters; 23 24 31 public class ParameterFieldHandler extends AbstractFieldHandler { 32 33 public Object getValue(Object object) { 34 HashMap map = new HashMap (); 35 Iterator iterator = 36 ((Parameters) object).getParameters().entrySet().iterator(); 37 Map.Entry entry; 38 Object key; 39 while (iterator.hasNext()) { 40 entry = (Map.Entry ) iterator.next(); 41 key = entry.getKey(); 42 map.put(key, new AttributedMapItem(key, entry.getValue())); 43 } 44 return map; 45 } 46 47 public Object newInstance(Object parent) { 48 return new AttributedMapItem(); 49 } 50 51 public void resetValue(Object object) { 52 ((Parameters) object).getParameters().clear(); 53 } 54 55 public void setValue(Object object, Object value) { 56 AttributedMapItem item = (AttributedMapItem) value; 57 ((Parameters) object).getParameters().put( 58 item.getKey(), 59 item.getValue()); 60 } 61 } 62 | Popular Tags |