KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > tasklist > bugs > BugsView


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.tasklist.bugs;
21
22 import java.util.Date JavaDoc;
23
24
25 import org.netbeans.modules.tasklist.core.*;
26 import org.netbeans.modules.tasklist.core.filter.FilterAction;
27 import org.netbeans.modules.tasklist.core.filter.RemoveFilterAction;
28 import org.openide.util.NbBundle;
29 import org.openide.util.Utilities;
30 import org.openide.util.actions.SystemAction;
31 import org.openide.nodes.Node;
32
33
34 /** View showing the todo list items
35  * @author Tor Norbye
36  */

37 public class BugsView extends TaskListView implements TaskListener {
38
39     private static final long serialVersionUID = 1;
40
41     final static String JavaDoc CATEGORY = "bugs"; // NOI18N
42

43     public BugsView() {
44         this(null);
45     }
46     
47     /** Construct a new TaskListView. Most work is deferred to
48     componentOpened. NOTE: this is only for use by the window
49     system when deserializing windows. Client code should not call
50     it; use the constructor which takes category, title and icon
51     parameters. I can't make it protected because then the window
52     system wouldn't be able to get to this. But the code relies on
53     readExternal getting called after this constructor to finalize
54     construction of the window.*/

55     public BugsView(BugQuery inQuery) {
56     super(
57        CATEGORY, // NOI18N
58
NbBundle.getMessage(BugsView.class, "ViewName"), // NOI18N
59
// I made a taskView.png, but it was larger (286 bytes) than the
60
// gif (186 bytes). More importantly, it had ugly display artifacts.
61
Utilities.loadImage(
62          "org/netbeans/modules/tasklist/bugs/bugsView.gif"),
63        true,
64            BugList.getDefault(inQuery));
65     }
66
67     static final String JavaDoc PROP_BUG_ID = "bugId"; // NOI18N
68
static final String JavaDoc PROP_BUG_SYNOPSIS = "bugSynopsis"; // NOI18N
69
static final String JavaDoc PROP_BUG_PRIO = "bugPrio"; // NOI18N
70
static final String JavaDoc PROP_BUG_TYPE = "bugType"; // NOI18N
71
static final String JavaDoc PROP_BUG_COMP = "bugComp"; // NOI18N
72
static final String JavaDoc PROP_BUG_SUBCOMP = "bugSubComp"; // NOI18N
73
static final String JavaDoc PROP_BUG_CREATED = "bugCreated"; // NOI18N
74
static final String JavaDoc PROP_BUG_KEYWORDS = "bugKeywords"; // NOI18N
75
static final String JavaDoc PROP_BUG_ASSIGNED = "bugAssigned"; // NOI18N
76
static final String JavaDoc PROP_BUG_REPORTEDBY = "bugReported"; // NOI18N
77
static final String JavaDoc PROP_BUG_STATUS = "bugStatus"; // NOI18N
78
static final String JavaDoc PROP_BUG_TARGET = "bugTarget"; // NOI18N
79
static final String JavaDoc PROP_BUG_VOTES = "bugVotes"; // NOI18N
80

81
82     public ColumnProperty getSummaryColumn(int width) {
83         // Tree column
84
// NOTE: Bug.getDisplayName() must also be kept in sync here
85
return new ColumnProperty(
86         0, // UID -- never change (part of serialization
87
PROP_TASK_SUMMARY,
88             NbBundle.getMessage(BugsView.class, "Summary"), // NOI18N
89
NbBundle.getMessage(BugsView.class, "Summary"), // NOI18N
90
true,
91             width
92         );
93     }
94
95
96     public ColumnProperty getSynopsisColumn(boolean visible, int width) {
97         return new ColumnProperty(
98         1, // UID -- never change (part of serialization
99
PROP_BUG_SYNOPSIS,
100             String JavaDoc.class,
101             NbBundle.getMessage(BugsView.class, "Synopsis"), // NOI18N
102
NbBundle.getMessage(BugsView.class, "SynopsisHint"), // NOI18N
103
true,
104             visible,
105             width
106             );
107     }
108    
109
110
111     public ColumnProperty getPriorityColumn(boolean visible, int width) {
112         return new ColumnProperty(
113         2, // UID -- never change (part of serialization
114
PROP_BUG_PRIO,
115             Integer.TYPE,
116             NbBundle.getMessage(BugsView.class, "Priority"), // NOI18N
117
NbBundle.getMessage(BugsView.class, "PriorityHint"), // NOI18N
118
true,
119             visible,
120             width
121             );
122     }
123
124     public ColumnProperty getBugIdColumn(boolean visible, int width) {
125         return new ColumnProperty(
126         3, // UID -- never change (part of serialization
127
PROP_BUG_ID,
128             String JavaDoc.class,
129             NbBundle.getMessage(BugsView.class, "BugId"), // NOI18N
130
NbBundle.getMessage(BugsView.class, "BugIdHint"), // NOI18N
131
true,
132             visible,
133             width
134             );
135     }
136     
137     public ColumnProperty getTypeColumn(boolean visible, int width) {
138         return new ColumnProperty(
139         4, // UID -- never change (part of serialization
140
PROP_BUG_TYPE,
141             String JavaDoc.class,
142             NbBundle.getMessage(BugsView.class, "Type"), // NOI18N
143
NbBundle.getMessage(BugsView.class, "TypeHint"), // NOI18N
144
true,
145             visible,
146             width
147             );
148     }
149    
150     public ColumnProperty getComponentColumn(boolean visible, int width) {
151         return new ColumnProperty(
152         5, // UID -- never change (part of serialization
153
PROP_BUG_COMP,
154             String JavaDoc.class,
155             NbBundle.getMessage(BugsView.class, "Component"), // NOI18N
156
NbBundle.getMessage(BugsView.class, "ComponentHint"), // NOI18N
157
true,
158             visible,
159             width
160             );
161     }
162    
163     public ColumnProperty getSubComponentColumn(boolean visible, int width) {
164         return new ColumnProperty(
165         6, // UID -- never change (part of serialization
166
PROP_BUG_SUBCOMP,
167             String JavaDoc.class,
168             NbBundle.getMessage(BugsView.class, "SubComponent"), // NOI18N
169
NbBundle.getMessage(BugsView.class, "SubComponentHint"), // NOI18N
170
true,
171             visible,
172             width
173             );
174     }
175    
176     public ColumnProperty getDateColumn(boolean visible, int width) {
177         return new ColumnProperty(
178         7, // UID -- never change (part of serialization
179
PROP_BUG_CREATED,
180             Date JavaDoc.class,
181             NbBundle.getMessage(BugsView.class, "Created"), // NOI18N
182
NbBundle.getMessage(BugsView.class, "CreatedHint"), // NOI18N
183
true,
184             visible,
185             width
186             );
187     }
188    
189     public ColumnProperty getKeywordsColumn(boolean visible, int width) {
190         return new ColumnProperty(
191         8, // UID -- never change (part of serialization
192
PROP_BUG_KEYWORDS,
193             String JavaDoc.class,
194             NbBundle.getMessage(BugsView.class, "Keywords"), // NOI18N
195
NbBundle.getMessage(BugsView.class, "KeywordsHint"), // NOI18N
196
true,
197             visible,
198             width
199             );
200     }
201    
202     public ColumnProperty getAssignedToColumn(boolean visible, int width) {
203         return new ColumnProperty(
204         9, // UID -- never change (part of serialization
205
PROP_BUG_ASSIGNED,
206             String JavaDoc.class,
207             NbBundle.getMessage(BugsView.class, "Assigned"), // NOI18N
208
NbBundle.getMessage(BugsView.class, "AssignedHint"), // NOI18N
209
true,
210             visible,
211             width
212             );
213     }
214    
215     public ColumnProperty getReportedByColumn(boolean visible, int width) {
216         return new ColumnProperty(
217         10, // UID -- never change (part of serialization
218
PROP_BUG_REPORTEDBY,
219             String JavaDoc.class,
220             NbBundle.getMessage(BugsView.class, "ReportedBy"), // NOI18N
221
NbBundle.getMessage(BugsView.class, "ReportedByHint"), // NOI18N
222
true,
223             visible,
224             width
225             );
226     }
227    
228     public ColumnProperty getStatusColumn(boolean visible, int width) {
229         return new ColumnProperty(
230         11, // UID -- never change (part of serialization
231
PROP_BUG_STATUS,
232             String JavaDoc.class,
233             NbBundle.getMessage(BugsView.class, "Status"), // NOI18N
234
NbBundle.getMessage(BugsView.class, "StatusHint"), // NOI18N
235
true,
236             visible,
237             width
238             );
239     }
240    
241     public ColumnProperty getTargetColumn(boolean visible, int width) {
242         return new ColumnProperty(
243         12, // UID -- never change (part of serialization
244
PROP_BUG_TARGET,
245             String JavaDoc.class,
246             NbBundle.getMessage(BugsView.class, "Target"), // NOI18N
247
NbBundle.getMessage(BugsView.class, "TargetHint"), // NOI18N
248
true,
249             visible,
250             width
251             );
252     }
253    
254     public ColumnProperty getVotesColumn(boolean visible, int width) {
255         return new ColumnProperty(
256         13, // UID -- never change (part of serialization
257
PROP_BUG_VOTES,
258             Integer.TYPE,
259             NbBundle.getMessage(BugsView.class, "Votes"), // NOI18N
260
NbBundle.getMessage(BugsView.class, "VotesHint"), // NOI18N
261
true,
262             visible,
263             width
264             );
265     }
266    
267
268
269     protected ColumnProperty[] createColumns() {
270         // No point allowing other attributes of the task since that's
271
// all we support for scan items (they are not created by
272
// the user - and they are not persisted.
273
return new ColumnProperty[] {
274             getSummaryColumn(800),
275
276             getBugIdColumn(false, 150),
277         getTypeColumn(false, 100),
278         getComponentColumn(false, 200),
279         getSubComponentColumn(false, 200),
280             getSynopsisColumn(false, 800),
281         getDateColumn(false, 200),
282         getKeywordsColumn(false, 200),
283         getAssignedToColumn(false, 200),
284         getReportedByColumn(false, 200),
285         getStatusColumn(true, 150),
286         getTargetColumn(false, 200),
287         getVotesColumn(false, 100),
288
289             getPriorityColumn(true, 100)
290
291         
292         };
293     };
294
295     /*
296     public void readExternal(java.io.ObjectInput objectInput) throws java.io.IOException, java.lang.ClassNotFoundException {
297         super.readExternal(objectInput);
298     }
299
300     public void writeExternal(java.io.ObjectOutput objectOutput) throws java.io.IOException {
301         super.writeExternal(objectOutput);
302     }
303     */

304
305     /** Create the root node to be used in this view */
306     protected Node createRootNode() {
307       return new TaskListNode(getModel());
308     }
309     
310     public org.netbeans.modules.tasklist.core.filter.Filter createFilter() {
311         return null; // TODO
312
}
313
314     protected SystemAction[] getToolBarActions() {
315         return new SystemAction[] {
316             SystemAction.get(RefreshAction.class),
317             SystemAction.get(ViewBugAction.class),
318 // SystemAction.get(FilterAction.class),
319
// SystemAction.get(RemoveFilterAction.class)
320
};
321     }
322
323 }
324
Popular Tags