1 16 package org.apache.cocoon.portal.util; 17 18 import org.apache.cocoon.portal.coplet.CopletInstanceData; 19 import org.apache.cocoon.portal.layout.impl.CopletLayout; 20 21 28 public class CopletInstanceDataReferenceFieldHandler 29 extends ReferenceFieldHandler { 30 31 public Object getValue(Object object) { 32 CopletInstanceData copletInstanceData = ((CopletLayout)object).getCopletInstanceData(); 33 if (copletInstanceData != null) { 34 return copletInstanceData.getId(); 35 } 36 return null; 37 } 38 39 public Object newInstance(Object parent) { 40 return new CopletInstanceData(); 41 } 42 43 public void resetValue(Object object) { 44 ((CopletLayout)object).setCopletInstanceData(null); 45 } 46 47 public void setValue(Object object, Object value) { 48 CopletInstanceData copletInstanceData = (CopletInstanceData)getObjectMap().get(value); 49 if (copletInstanceData == null) { 50 throw new ProfileException( 51 "Referenced Coplet Instance Data "+value+" does not exist."); 52 } 53 ((CopletLayout)object).setCopletInstanceData(copletInstanceData); 54 } 55 } 56 | Popular Tags |