1 19 20 26 package org.netbeans.modules.xml.wsdl.ui.view.property; 27 28 import java.beans.PropertyEditor ; 29 30 import org.netbeans.modules.xml.wsdl.ui.api.property.ComboBoxPropertyEditor; 31 import org.netbeans.modules.xml.wsdl.ui.api.property.PropertyAdapter; 32 import org.openide.nodes.PropertySupport; 33 import org.openide.util.NbBundle; 34 35 41 public class XSDBooleanAttributeProperty extends PropertySupport.Reflection { 42 43 private PropertyAdapter mPropAdapter; 44 private String valueNotSetMessage = NbBundle.getMessage(XSDBooleanAttributeProperty.class, "LBL_ValueNotSet"); 45 private boolean optional; 46 47 public XSDBooleanAttributeProperty(PropertyAdapter instance, 48 Class valueType, 49 String getter, 50 String setter, boolean isOptional) throws NoSuchMethodException { 51 super(instance, valueType, getter, setter); 52 mPropAdapter = instance; 53 optional = isOptional; 54 } 55 56 @Override 57 public PropertyEditor getPropertyEditor() { 58 String [] enuValues = getBooleanValues(); 59 return new ComboBoxPropertyEditor(enuValues); 60 } 61 62 private String [] getBooleanValues() { 63 if (optional) { 64 return new String [] {valueNotSetMessage, "true", "false"}; 65 } 66 return new String [] {"true", "false"}; } 68 69 @Override 70 public boolean canWrite() { 71 return mPropAdapter.isWritable(); 72 } 73 74 75 76 } 77 78 79 80 81 | Popular Tags |