1 19 20 24 25 package org.netbeans.modules.xml.schema.ui.basic.editors; 26 27 import java.beans.PropertyEditorSupport ; 28 import org.netbeans.modules.xml.schema.model.Form; 29 import org.openide.util.NbBundle; 30 31 37 public class FormPropertyEditor extends PropertyEditorSupport { 38 39 42 public FormPropertyEditor() { 43 } 44 45 public String [] getTags() { 46 return new String [] {NbBundle.getMessage(FormPropertyEditor.class,getEmptyLabel()), 47 NbBundle.getMessage(FormPropertyEditor.class,"LBL_Qualified"), 48 NbBundle.getMessage(FormPropertyEditor.class,"LBL_Unqualified")}; 49 } 50 51 public void setAsText(String text) throws IllegalArgumentException { 52 if (text.equals(NbBundle.getMessage(FormPropertyEditor.class,getEmptyLabel()))){ 53 setValue(null); 54 } else if (text.equals(NbBundle.getMessage(FormPropertyEditor.class,"LBL_Qualified"))){ 55 setValue(Form.QUALIFIED); 56 } else if (text.equals(NbBundle.getMessage(FormPropertyEditor.class,"LBL_Unqualified"))){ 57 setValue(Form.UNQUALIFIED); 58 } 59 } 60 61 public String getAsText() { 62 Object val = getValue(); 63 if (val instanceof Form){ 64 if (Form.QUALIFIED.equals(val)) { 65 return NbBundle.getMessage(FormPropertyEditor.class,"LBL_Qualified"); 66 } else if (Form.UNQUALIFIED.equals(val)) { 67 return NbBundle.getMessage(FormPropertyEditor.class,"LBL_Unqualified"); 68 } 69 } 70 return NbBundle.getMessage(FormPropertyEditor.class,getEmptyLabel()); 72 } 73 74 protected String getEmptyLabel() { 75 return "LBL_Empty"; 76 } 77 78 public static class SchemaFormPropertyEditor extends FormPropertyEditor{ 79 82 public SchemaFormPropertyEditor() { 83 } 84 85 protected String getEmptyLabel() { 86 return "LBL_EmptyForSchema"; 87 } 88 89 } 90 } 91 | Popular Tags |