1 19 20 21 package org.netbeans.modules.j2ee.sun.share.config; 22 23 import org.netbeans.modules.j2ee.deployment.plugins.api.*; 24 import org.netbeans.modules.schema2beans.*; 25 26 import java.util.Collection ; 27 import java.util.LinkedList ; 28 29 public class DDLeafBean extends DDCommon { 30 31 BaseProperty prop; 32 int index; 33 boolean indexed; 34 35 DDLeafBean(BaseProperty prop, int index, ModuleDDSupport support) { 36 this(prop.getParent(),support,prop.getDtdName()); 37 this.prop = prop; 38 indexed = index != -1; 39 this.index = index; 40 } 41 42 DDLeafBean(BaseProperty prop, ModuleDDSupport support) { 43 this(prop.getParent(),support,prop.getDtdName()); 44 this.prop = prop; 45 indexed = false; 46 index = -1; 47 } 48 49 private DDLeafBean(BaseBean bean, ModuleDDSupport support, String dtdName) { 50 super(support.getBean(bean).proxy,bean, support, dtdName); 51 } 52 53 Collection search(String xpath, boolean addCurrent) { 54 Collection ret = new LinkedList (); 55 if(addCurrent && (xpath.equals("") || xpath.equals("."))) ret.add(container); 57 return ret; 58 } 59 60 public String getText() { 61 Object ret; 62 if (indexed) 64 ret = prop.getParent().getValue(prop.getName(),index); 65 else 66 ret = prop.getParent().getValue(prop.getName()); 67 if (ret == null) 68 return null; 69 return ret.toString(); 70 } 71 72 public boolean equals(Object o) { 73 if(o instanceof DDLeafBean) { 74 DDLeafBean d = (DDLeafBean) o; 75 return d.prop == prop; 76 } 77 return false; 78 } 79 80 } 81 82 | Popular Tags |