1 19 20 package org.netbeans.modules.websvc.wsdl.config; 21 22 import java.io.IOException ; 23 import java.lang.reflect.InvocationTargetException ; 24 25 import java.beans.PropertyChangeListener ; 26 import java.beans.PropertyChangeEvent ; 27 28 import org.openide.nodes.Node; 29 import org.openide.nodes.Children; 30 import org.openide.nodes.PropertySupport; 31 import org.openide.nodes.Sheet; 32 import org.openide.loaders.DataObject; 33 import org.openide.loaders.DataNode; 34 import org.openide.util.NbBundle; 35 36 import org.netbeans.modules.websvc.wsdl.xmlutils.XMLJ2eeDataObject; 37 38 42 public class WsCompileConfigDataNode extends DataNode { 43 44 private WsCompileConfigDataObject dataObject; 45 private PropertyChangeListener ddListener; 46 47 public WsCompileConfigDataNode(WsCompileConfigDataObject obj) { 48 super(obj, Children.LEAF); 49 50 this.dataObject = obj; 51 setIconBase(dataObject.getIconBaseForValidDocument()); 52 setShortDescription(null); 53 addListeners(); 54 } 55 56 public void destroy() throws IOException { 57 super.destroy(); 58 removeListeners(); 59 } 60 61 74 private void addListeners() { 75 ddListener = new PropertyChangeListener () { 76 public void propertyChange (PropertyChangeEvent evt) { 77 if (DataObject.PROP_VALID.equals (evt.getPropertyName ()) 81 && Boolean.TRUE.equals (evt.getNewValue ())) { 82 removePropertyChangeListener (WsCompileConfigDataNode.this.ddListener); 83 } 84 if (WsCompileConfigDataObject.PROP_DOC_VALID.equals (evt.getPropertyName ())) { 85 if (Boolean.TRUE.equals (evt.getNewValue ())) { 86 setIconBase (dataObject.getIconBaseForValidDocument ()); 87 } else { 88 setIconBase (dataObject.getIconBaseForInvalidDocument ()); 89 } 90 } 91 if (Node.PROP_PROPERTY_SETS.equals (evt.getPropertyName ())) { 92 firePropertySetsChange(null,null); 93 } 94 } 95 }; 96 97 dataObject.addPropertyChangeListener(ddListener); 98 } 99 100 private void removeListeners() { 101 dataObject.removePropertyChangeListener(ddListener); 102 } 103 104 protected org.openide.nodes.Sheet createSheet() { 105 Sheet sheet = super.createSheet(); 106 Sheet.Set ss = new Sheet.Set(); 107 108 ss.setName("service"); ss.setDisplayName(NbBundle.getBundle(WsCompileConfigDataNode.class).getString("LBL_WsConfigPropertiesName")); ss.setShortDescription(NbBundle.getBundle(WsCompileConfigDataNode.class).getString("LBL_WsConfigPropertiesDescription")); ss.put(new PackageProperty()); 112 113 sheet.put(ss); 114 return sheet; 115 } 116 117 121 private final class PackageProperty extends PropertySupport.ReadWrite { 122 123 public PackageProperty() { 124 super("Package" , String .class, 125 NbBundle.getBundle(WsCompileConfigDataNode.class).getString("LBL_WsConfigPackagePropertyName"), NbBundle.getBundle(WsCompileConfigDataNode.class).getString("LBL_WsConfigPackagePropertyDescription")); } 128 129 public Object getValue() throws IllegalAccessException , InvocationTargetException { 130 return dataObject.getServicePackageName(); 131 } 132 133 public void setValue(Object val) throws IllegalAccessException , IllegalArgumentException , InvocationTargetException { 134 if(val instanceof String ) { 135 dataObject.setServicePackageName((String ) val); 136 } else { 137 throw new IllegalArgumentException (); 138 } 139 } 140 } 141 } 142 | Popular Tags |