1 19 package org.netbeans.modules.j2ee.sun.ide.editors; 20 21 import java.awt.*; 22 import java.beans.*; 23 import org.openide.util.NbBundle; 24 import org.openide.explorer.propertysheet.editors.*; 25 26 public class Int0Editor extends PropertyEditorSupport implements EnhancedPropertyEditor { 27 28 public String prev = "null"; private String curValue; 30 private String errorMessage; 31 32 public Int0Editor() { 33 curValue = null; 34 35 } 36 37 public String getAsText () { 38 if (curValue==null || curValue.equals("")) { curValue = prev; 40 } 41 if (errorMessage != null) { 42 errorMessage = null; 44 } 45 return curValue; 46 } 47 48 public String checkValid(String string) { 49 if (EditorUtils.isValidInt0(string)) 50 return null; else 52 return NbBundle.getMessage(Int0Editor.class, "MSG_RangeForInt0"); 53 } 54 55 public void setAsText (String string) throws IllegalArgumentException { 56 prev = curValue; 57 if((string==null)||(string.equals(""))) { return; 59 } 60 61 errorMessage = checkValid(string); 62 if (errorMessage == null) { 63 prev = curValue; 64 curValue = string; 65 firePropertyChange(); 66 } 67 else 68 curValue = prev; 69 } 70 71 public void setValue (Object v) { 72 if(!(v.equals(""))){ prev = (String )v; 74 } 75 curValue = (String )v; 76 77 } 78 79 public Object getValue () { 80 return curValue; 81 } 82 83 public Component getInPlaceCustomEditor () { 84 return null; 85 } 86 87 public boolean hasInPlaceCustomEditor () { 88 return false; 89 } 90 91 public boolean supportsEditingTaggedValues () { 92 return false; 93 } 94 95 } 96 97 98 99 100 101 | Popular Tags |