1 19 20 package org.netbeans.modules.tasklist.usertasks.annotations; 21 22 import org.openide.text.Annotation; 23 import org.netbeans.modules.tasklist.usertasks.model.UserTask; 24 import org.netbeans.modules.tasklist.usertasks.*; 25 26 31 public class UTAnnotation extends Annotation { 32 protected UserTask task = null; 33 private boolean highlight = false; 34 private UserTaskView view; 35 private boolean done; 36 37 41 public UTAnnotation(UserTask task) { 42 this(task, true); 43 } 44 45 51 public UTAnnotation(UserTask task, boolean highlight) { 52 this.done = task.isDone(); 53 this.task = task; 54 this.highlight = highlight; 55 } 56 57 64 public UTAnnotation(UserTask task, UserTaskView view) { 65 this.task = task; 66 this.view = view; 67 highlight = true; 68 } 69 70 75 public void setDone(boolean done) { 76 if (this.done != done) { 77 String old = getAnnotationType(); 78 this.done = done; 79 firePropertyChange(PROP_ANNOTATION_TYPE, old, getAnnotationType()); 80 } 81 } 82 83 88 public void setHighlight(boolean highlight) { 89 if (this.highlight != highlight) { 90 String old = getAnnotationType(); 91 this.highlight = highlight; 92 firePropertyChange(PROP_ANNOTATION_TYPE, old, getAnnotationType()); 93 } 94 } 95 96 public String getAnnotationType () { 97 if (!done) { 98 if (!highlight) { 99 return "org-netbeans-modules-tasklist-usertasks-UTNoHighlight"; } else { 101 return "org-netbeans-modules-tasklist-usertasks-UT"; } 103 } else { 104 if (!highlight) 105 return "org-netbeans-modules-tasklist-usertasks-UTDoneNoHighlight"; else 107 return "org-netbeans-modules-tasklist-usertasks-UTDone"; } 109 } 110 111 public String getShortDescription () { 112 showTask(); 114 115 if (task.getDetails().length() > 0) { 116 return task.getSummary() + "\n\n" + task.getDetails(); } else { 118 return task.getSummary(); 119 } 120 } 121 122 123 protected void showTask() { 124 if (view != null) view.select(task); 125 } 126 127 128 public UserTask getTask() { 129 return task; 130 } 131 } 132 | Popular Tags |