1 19 20 package org.netbeans.modules.tasklist.usertasks.editors; 21 22 import java.beans.PropertyEditorSupport ; 23 import javax.swing.JLabel ; 24 25 import org.netbeans.modules.tasklist.usertasks.model.UserTask; 26 27 32 public final class PriorityPropertyEditor extends PropertyEditorSupport { 33 private static final String [] TAGS = UserTask.getPriorityNames(); 34 private static final JLabel LABEL = new JLabel (); 35 36 39 public PriorityPropertyEditor() { 40 } 41 42 public String getAsText() { 43 Object v = getValue(); 44 if (v instanceof Integer ) { 45 int value = ((Integer ) v).intValue(); 46 return UserTask.getPriorityName(value); 47 } else { 48 return ""; } 50 } 51 52 public void setAsText(String text) throws java.lang.IllegalArgumentException { 53 int index = UserTask.getPriority(text); 54 if (index == -1) 55 throw new IllegalArgumentException ("Unknown priority"); 57 setValue(new Integer (index)); 58 } 59 60 public String [] getTags() { 61 return TAGS; 62 } 63 } 64 | Popular Tags |