1 19 20 package org.netbeans.modules.xml.schema.abe.nodes.properties; 21 22 import java.lang.reflect.InvocationTargetException ; 23 import java.util.List ; 24 import org.netbeans.modules.xml.axi.AXIComponent; 25 import org.netbeans.modules.xml.schema.model.SchemaModel; 26 import org.netbeans.modules.xml.xam.ui.XAMUtils; 27 import org.openide.nodes.PropertySupport; 28 29 33 public class GlobalReferenceProperty extends PropertySupport.Reflection { 34 35 private List <Class > filterTypes; 36 private String referenceTypeDisplayName; 37 private String typeDisplayName; 38 39 52 public GlobalReferenceProperty(AXIComponent component, 53 String property, String dispName, String desc, 54 String typeDisplayName, String referenceTypeDisplayName, 55 Class referenceType, List <Class > filterTypes) 56 throws NoSuchMethodException { 57 super(component,referenceType,property); 58 super.setName(property); 59 super.setDisplayName(dispName); 60 super.setShortDescription(desc); 61 this.filterTypes = filterTypes; 62 this.referenceTypeDisplayName = referenceTypeDisplayName; 63 this.typeDisplayName = typeDisplayName; 64 } 65 66 protected AXIComponent getComponent() { 67 return (AXIComponent) instance; 68 } 69 70 protected void setComponent(AXIComponent sc) { 71 instance = sc; 72 } 73 74 75 79 @Override 80 public boolean canWrite() { 81 if(getComponent()== null || 83 (getComponent().getModel() == null)) 84 return false; 85 SchemaModel model = getComponent().getModel().getSchemaModel(); 86 return XAMUtils.isWritable(model); 87 } 88 89 96 @Override 97 public boolean isDefaultValue () { 98 try { 99 return getValue()==null; 100 } catch (IllegalArgumentException ex) { 101 } catch (InvocationTargetException ex) { 102 } catch (IllegalAccessException ex) { 103 } 104 return false; 105 } 106 107 112 @Override 113 public boolean supportsDefaultValue () { 114 return false; 115 } 116 117 121 @Override 122 public java.beans.PropertyEditor getPropertyEditor() { 123 return new GlobalReferenceEditor( 124 getComponent(), typeDisplayName, 125 getDisplayName(), referenceTypeDisplayName, filterTypes); 126 } 127 128 } 129 | Popular Tags |