1 19 package org.netbeans.modules.xml.tax.beans.editor; 20 21 import javax.swing.JPanel ; 22 23 import org.openide.explorer.propertysheet.editors.EnhancedCustomPropertyEditor; 24 25 30 public class NullStringCustomEditor extends JPanel implements EnhancedCustomPropertyEditor { 31 32 33 private static final long serialVersionUID =-7120244860529998751L; 34 35 39 40 public NullStringCustomEditor (NullStringEditor editor) { 41 initComponents (); 42 43 textArea.setText (editor.getAsText()); 44 textArea.setEditable (editor.isEditable()); 45 46 initAccessibility(); 47 } 48 49 50 54 59 public Object getPropertyValue () throws IllegalStateException { 60 String text = textArea.getText(); 61 62 if ( NullStringEditor.DEFAULT_NULL.equals (text) ) { 63 return null; 64 } else if ( text.length() == 0 ) { 65 return null; 66 } else { 67 return text; 68 } 69 } 70 71 75 80 private void initComponents() { textAreaScroll = new javax.swing.JScrollPane (); 82 textArea = new javax.swing.JTextArea (); 83 84 setLayout(new java.awt.BorderLayout ()); 85 86 setBorder(new javax.swing.border.EmptyBorder (new java.awt.Insets (6, 6, 6, 6))); 87 setPreferredSize(new java.awt.Dimension (350, 230)); 88 textAreaScroll.setViewportView(textArea); 89 90 add(textAreaScroll, java.awt.BorderLayout.CENTER); 91 92 } 94 95 private javax.swing.JTextArea textArea; 97 private javax.swing.JScrollPane textAreaScroll; 98 100 102 public void initAccessibility(){ 103 104 this.getAccessibleContext().setAccessibleDescription(Util.THIS.getString("ACSD_NullStringCustomEditor")); 105 textArea.getAccessibleContext().setAccessibleDescription(Util.THIS.getString("ACSD_textArea")); 106 } 107 } 108 | Popular Tags |