1 19 package org.netbeans.modules.j2ee.sun.ide.editors; 20 21 22 import java.awt.Component ; 23 import java.beans.PropertyEditorSupport ; 24 25 import org.openide.util.NbBundle; 26 import org.openide.explorer.propertysheet.editors.EnhancedPropertyEditor; 27 28 public class BooleanEditor extends PropertyEditorSupport implements EnhancedPropertyEditor { 29 30 public String curr_Sel; 31 public String [] choices = { 32 "true", "false" }; 35 36 public BooleanEditor() { 37 curr_Sel = null; 38 } 39 40 public String getAsText() { 41 return curr_Sel; 42 } 43 44 public void setAsText(String string) throws IllegalArgumentException { 45 if((string==null)||(string.equals(""))) throw new IllegalArgumentException (); 47 else 48 curr_Sel = string; 49 this.firePropertyChange(); 50 } 51 52 public void setValue(Object val) { 53 if (val == null) { 54 String str = NbBundle.getMessage(BooleanEditor.class, "TXT_Null_Value"); curr_Sel = str; 56 } 57 else { 58 if (! (val instanceof String )) { 59 throw new IllegalArgumentException (); 60 } 61 curr_Sel = (String ) val; 62 } 63 super.setValue(curr_Sel); 64 } 65 66 public Object getValue() { 67 return curr_Sel; 68 } 69 70 public String getJavaInitializationString() { 71 return getAsText(); 72 } 73 74 public String [] getTags() { 75 return choices; 76 } 77 78 public Component getInPlaceCustomEditor() { 79 return null; 80 } 81 82 83 public boolean hasInPlaceCustomEditor() { 84 return false; 85 } 86 87 public boolean supportsEditingTaggedValues() { 88 return false; 89 } 90 91 } 92 93 94 | Popular Tags |