1 26 package org.objectweb.util.explorer.property.lib; 27 28 import java.util.HashMap ; 29 import java.util.Map ; 30 31 import org.objectweb.util.explorer.api.DropAction; 32 import org.objectweb.util.explorer.core.code.api.CodeDescription; 33 import org.objectweb.util.explorer.core.common.api.Description; 34 import org.objectweb.util.explorer.core.dnd.api.DnDDescription; 35 import org.objectweb.util.explorer.core.dnd.api.DnDDescriptions; 36 import org.objectweb.util.explorer.core.dnd.lib.BasicDnDDescriptions; 37 38 46 public class DnDProperty 47 extends AbstractProperty 48 { 49 50 56 57 protected Map properties_ = null; 58 59 65 public DnDProperty(){ 66 properties_ = new HashMap (); 67 } 68 69 75 protected void addDnDDescription(Object key, DnDDescription dndDesc){ 76 if(!dndDesc.isEmpty()){ 77 DnDDescriptions dndDescs = (DnDDescriptions)properties_.get(key); 78 if(dndDescs==null){ 79 dndDescs = new BasicDnDDescriptions(); 80 properties_.put(key, dndDescs); 81 } 82 CodeDescription codeDesc = (CodeDescription)dndDesc.getCodeDescription(); 83 if(getCodeProvider().getCode(codeDesc).isInstanceOf(DropAction.class)){ 84 dndDescs.addDropAction(dndDesc); 85 } else { 86 getTrace().warn(codeDesc.getCode() + " is not assignable from DropAction!"); 87 } 88 } 89 } 90 91 97 100 public void feed(String propertyType, Object key, Description value) { 101 if(value!=null && value instanceof DnDDescription){ 102 addDnDDescription(key, (DnDDescription)value); 103 } 104 } 105 106 112 115 public Description getPropertyDescription(String propertyType, Object key) { 116 return (Description)properties_.get(key); 117 } 118 119 } 120 121 122 | Popular Tags |