KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > tasklist > bugs > scarab > SourcePanel


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.scarab;
21
22 import org.netbeans.modules.tasklist.bugs.BugQuery;
23 import org.netbeans.modules.tasklist.bugs.QueryPanelIF;
24 import org.netbeans.modules.tasklist.bugs.BugEngine;
25 import org.netbeans.modules.tasklist.bugs.ProjectDesc;
26 import org.netbeans.modules.tasklist.bugs.javanet.ProjectList;
27 import org.netbeans.modules.tasklist.bugs.issuezilla.Issuezilla;
28 import org.openide.util.RequestProcessor;
29
30 import javax.swing.*;
31 import java.awt.event.ActionListener JavaDoc;
32 import java.awt.event.ActionEvent JavaDoc;
33 import java.net.URL JavaDoc;
34 import java.net.MalformedURLException JavaDoc;
35
36 /**
37  * Allows to customize Scarab database connection.
38  *
39  * @author Petr Kuzel
40  */

41 public class SourcePanel extends javax.swing.JPanel JavaDoc implements QueryPanelIF {
42
43     /**
44      * Creates new form SourcePanel
45      */

46     public SourcePanel() {
47         initComponents();
48
49         serviceTextField.addActionListener(new ActionListener JavaDoc() {
50             public void actionPerformed(ActionEvent JavaDoc e) {
51                 try {
52                     serviceExampleLabel.setText("probing...");
53                     final URL JavaDoc url = new URL JavaDoc(serviceTextField.getText());
54                     serviceExampleLabel.setText("Server OK");
55                 } catch (MalformedURLException JavaDoc e1) {
56                     serviceExampleLabel.setText("Invalid server URL!");
57                 }
58             }
59         });
60     }
61
62
63     public BugQuery getQueryOptions(final BugQuery inQuery) {
64         final ScarabBugQuery sbq = new ScarabBugQuery(inQuery);
65         sbq.setBaseUrl(serviceTextField.getText());
66         sbq.setQueryString(customTextField.getText());
67         sbq.setAttributeName(Issue.SUMMARY,summaryField.getText());
68         sbq.setAttributeName(Issue.STATUS,statusField.getText());
69         sbq.setAttributeName(Issue.COMPONENT,componentField.getText());
70         sbq.setAttributeName(Issue.SUBCOMPONENT,subcomponentField.getText());
71         sbq.setAttributeName(Issue.ASSIGNED_TO,assignedToField.getText());
72         sbq.setAttributeName(Issue.PRIORITY,priorityField.getText());
73         sbq.setAttributeName(Issue.TARGET,targetField.getText());
74         sbq.setAttributeName(Issue.VOTES,votesField.getText());
75         sbq.setAttributeName(Issue.KEYWORDS,keywordsField.getText());
76         return sbq;
77     }
78
79     /** This method is called from within the constructor to
80      * initialize the form.
81      * WARNING: Do NOT modify this code. The content of this method is
82      * always regenerated by the Form Editor.
83      */

84     private void initComponents()//GEN-BEGIN:initComponents
85
{
86         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
87
88         buttonGroup1 = new javax.swing.ButtonGroup JavaDoc();
89         jLabel4 = new javax.swing.JLabel JavaDoc();
90         serviceLabel = new javax.swing.JLabel JavaDoc();
91         serviceTextField = new javax.swing.JTextField JavaDoc();
92         serviceExampleLabel = new javax.swing.JLabel JavaDoc();
93         customLabel = new javax.swing.JLabel JavaDoc();
94         customTextField = new javax.swing.JTextField JavaDoc();
95         customExLabel = new javax.swing.JLabel JavaDoc();
96         jPanel1 = new javax.swing.JPanel JavaDoc();
97         summaryLabel = new javax.swing.JLabel JavaDoc();
98         priorityLabel = new javax.swing.JLabel JavaDoc();
99         componentLabel = new javax.swing.JLabel JavaDoc();
100         subcomponentLabel = new javax.swing.JLabel JavaDoc();
101         keywordsLabel = new javax.swing.JLabel JavaDoc();
102         assignedToLabel = new javax.swing.JLabel JavaDoc();
103         statusLabel = new javax.swing.JLabel JavaDoc();
104         targetLabel = new javax.swing.JLabel JavaDoc();
105         votesLabel = new javax.swing.JLabel JavaDoc();
106         summaryField = new javax.swing.JTextField JavaDoc();
107         statusField = new javax.swing.JTextField JavaDoc();
108         componentField = new javax.swing.JTextField JavaDoc();
109         subcomponentField = new javax.swing.JTextField JavaDoc();
110         assignedToField = new javax.swing.JTextField JavaDoc();
111         priorityField = new javax.swing.JTextField JavaDoc();
112         targetField = new javax.swing.JTextField JavaDoc();
113         votesField = new javax.swing.JTextField JavaDoc();
114         keywordsField = new javax.swing.JTextField JavaDoc();
115
116         jLabel4.setText("jLabel4");
117
118         setLayout(new java.awt.GridBagLayout JavaDoc());
119
120         serviceLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/tasklist/bugs/scarab/Bundle").getString("ServiceUrl_Label"));
121         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
122         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
123         add(serviceLabel, gridBagConstraints);
124
125         serviceTextField.setColumns(60);
126         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
127         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
128         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
129         gridBagConstraints.weightx = 1.0;
130         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 6, 0, 0);
131         add(serviceTextField, gridBagConstraints);
132
133         serviceExampleLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/tasklist/bugs/scarab/Bundle").getString("ServiceUrlExample_Label"));
134         serviceExampleLabel.setEnabled(false);
135         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
136         gridBagConstraints.gridx = 0;
137         gridBagConstraints.gridy = 1;
138         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
139         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
140         gridBagConstraints.weightx = 1.0;
141         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 0);
142         add(serviceExampleLabel, gridBagConstraints);
143
144         customLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/tasklist/bugs/scarab/Bundle").getString("Query_Label"));
145         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
146         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
147         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 24, 0, 0);
148         add(customLabel, gridBagConstraints);
149
150         customTextField.setColumns(60);
151         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
152         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
153         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
154         gridBagConstraints.weightx = 1.0;
155         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 0);
156         add(customTextField, gridBagConstraints);
157
158         customExLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/tasklist/bugs/scarab/Bundle").getString("QueryExample_Label"));
159         customExLabel.setEnabled(false);
160         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
161         gridBagConstraints.gridx = 0;
162         gridBagConstraints.gridy = 3;
163         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
164         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
165         gridBagConstraints.weightx = 1.0;
166         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 6, 0, 0);
167         add(customExLabel, gridBagConstraints);
168
169         jPanel1.setLayout(new java.awt.GridBagLayout JavaDoc());
170
171         jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(java.util.ResourceBundle.getBundle("org/netbeans/modules/tasklist/bugs/scarab/Bundle").getString("AttributeMappings_Label")));
172         jPanel1.setToolTipText("Enter names for scarab's attributes to match NetBeans Tasklist names.");
173         summaryLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/tasklist/bugs/scarab/Bundle").getString("Summary_Label"));
174         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
175         gridBagConstraints.gridx = 0;
176         gridBagConstraints.gridy = 1;
177         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
178         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
179         jPanel1.add(summaryLabel, gridBagConstraints);
180
181         priorityLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/tasklist/bugs/scarab/Bundle").getString("Priority_Label"));
182         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
183         gridBagConstraints.gridx = 0;
184         gridBagConstraints.gridy = 8;
185         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
186         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
187         jPanel1.add(priorityLabel, gridBagConstraints);
188
189         componentLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/tasklist/bugs/scarab/Bundle").getString("Component_Label"));
190         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
191         gridBagConstraints.gridx = 0;
192         gridBagConstraints.gridy = 3;
193         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
194         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
195         jPanel1.add(componentLabel, gridBagConstraints);
196
197         subcomponentLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/tasklist/bugs/scarab/Bundle").getString("Subcomponent_Label"));
198         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
199         gridBagConstraints.gridx = 0;
200         gridBagConstraints.gridy = 4;
201         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
202         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
203         jPanel1.add(subcomponentLabel, gridBagConstraints);
204
205         keywordsLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/tasklist/bugs/scarab/Bundle").getString("Keywords_Label"));
206         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
207         gridBagConstraints.gridx = 0;
208         gridBagConstraints.gridy = 11;
209         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
210         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
211         jPanel1.add(keywordsLabel, gridBagConstraints);
212
213         assignedToLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/tasklist/bugs/scarab/Bundle").getString("AssignedTo_Label"));
214         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
215         gridBagConstraints.gridx = 0;
216         gridBagConstraints.gridy = 7;
217         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
218         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
219         jPanel1.add(assignedToLabel, gridBagConstraints);
220
221         statusLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/tasklist/bugs/scarab/Bundle").getString("Status_Label"));
222         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
223         gridBagConstraints.gridx = 0;
224         gridBagConstraints.gridy = 2;
225         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
226         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
227         jPanel1.add(statusLabel, gridBagConstraints);
228
229         targetLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/tasklist/bugs/scarab/Bundle").getString("Target_Label"));
230         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
231         gridBagConstraints.gridx = 0;
232         gridBagConstraints.gridy = 9;
233         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
234         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
235         jPanel1.add(targetLabel, gridBagConstraints);
236
237         votesLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/tasklist/bugs/scarab/Bundle").getString("Votes_Label"));
238         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
239         gridBagConstraints.gridx = 0;
240         gridBagConstraints.gridy = 10;
241         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
242         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
243         jPanel1.add(votesLabel, gridBagConstraints);
244
245         summaryField.setText("Summary");
246         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
247         gridBagConstraints.gridx = 1;
248         gridBagConstraints.gridy = 1;
249         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
250         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
251         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
252         gridBagConstraints.weightx = 1.0;
253         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
254         jPanel1.add(summaryField, gridBagConstraints);
255
256         statusField.setText("Status");
257         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
258         gridBagConstraints.gridx = 1;
259         gridBagConstraints.gridy = 2;
260         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
261         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
262         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
263         gridBagConstraints.weightx = 1.0;
264         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
265         jPanel1.add(statusField, gridBagConstraints);
266
267         componentField.setText("Component");
268         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
269         gridBagConstraints.gridx = 1;
270         gridBagConstraints.gridy = 3;
271         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
272         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
273         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
274         gridBagConstraints.weightx = 1.0;
275         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
276         jPanel1.add(componentField, gridBagConstraints);
277
278         subcomponentField.setText("Subcomponent");
279         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
280         gridBagConstraints.gridx = 1;
281         gridBagConstraints.gridy = 4;
282         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
283         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
284         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
285         gridBagConstraints.weightx = 1.0;
286         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
287         jPanel1.add(subcomponentField, gridBagConstraints);
288
289         assignedToField.setText("AssignedTo");
290         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
291         gridBagConstraints.gridx = 1;
292         gridBagConstraints.gridy = 7;
293         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
294         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
295         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
296         gridBagConstraints.weightx = 1.0;
297         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
298         jPanel1.add(assignedToField, gridBagConstraints);
299
300         priorityField.setText("Priority");
301         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
302         gridBagConstraints.gridx = 1;
303         gridBagConstraints.gridy = 8;
304         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
305         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
306         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
307         gridBagConstraints.weightx = 1.0;
308         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
309         jPanel1.add(priorityField, gridBagConstraints);
310
311         targetField.setText("Target");
312         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
313         gridBagConstraints.gridx = 1;
314         gridBagConstraints.gridy = 9;
315         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
316         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
317         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
318         gridBagConstraints.weightx = 1.0;
319         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
320         jPanel1.add(targetField, gridBagConstraints);
321
322         votesField.setText("Votes");
323         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
324         gridBagConstraints.gridx = 1;
325         gridBagConstraints.gridy = 10;
326         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
327         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
328         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
329         gridBagConstraints.weightx = 1.0;
330         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
331         jPanel1.add(votesField, gridBagConstraints);
332
333         keywordsField.setText("Keywords");
334         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
335         gridBagConstraints.gridx = 1;
336         gridBagConstraints.gridy = 11;
337         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
338         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
339         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
340         gridBagConstraints.weightx = 1.0;
341         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 5, 0, 0);
342         jPanel1.add(keywordsField, gridBagConstraints);
343
344         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
345         gridBagConstraints.gridx = 1;
346         gridBagConstraints.gridy = 4;
347         gridBagConstraints.gridwidth = 2;
348         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
349         add(jPanel1, gridBagConstraints);
350
351     }//GEN-END:initComponents
352

353     
354     // Variables declaration - do not modify//GEN-BEGIN:variables
355
public javax.swing.JTextField JavaDoc assignedToField;
356     public javax.swing.JLabel JavaDoc assignedToLabel;
357     public javax.swing.ButtonGroup JavaDoc buttonGroup1;
358     public javax.swing.JTextField JavaDoc componentField;
359     public javax.swing.JLabel JavaDoc componentLabel;
360     public javax.swing.JLabel JavaDoc customExLabel;
361     public javax.swing.JLabel JavaDoc customLabel;
362     public javax.swing.JTextField JavaDoc customTextField;
363     public javax.swing.JLabel JavaDoc jLabel4;
364     public javax.swing.JPanel JavaDoc jPanel1;
365     public javax.swing.JTextField JavaDoc keywordsField;
366     public javax.swing.JLabel JavaDoc keywordsLabel;
367     public javax.swing.JTextField JavaDoc priorityField;
368     public javax.swing.JLabel JavaDoc priorityLabel;
369     public javax.swing.JLabel JavaDoc serviceExampleLabel;
370     public javax.swing.JLabel JavaDoc serviceLabel;
371     public javax.swing.JTextField JavaDoc serviceTextField;
372     public javax.swing.JTextField JavaDoc statusField;
373     public javax.swing.JLabel JavaDoc statusLabel;
374     public javax.swing.JTextField JavaDoc subcomponentField;
375     public javax.swing.JLabel JavaDoc subcomponentLabel;
376     public javax.swing.JTextField JavaDoc summaryField;
377     public javax.swing.JLabel JavaDoc summaryLabel;
378     public javax.swing.JTextField JavaDoc targetField;
379     public javax.swing.JLabel JavaDoc targetLabel;
380     public javax.swing.JTextField JavaDoc votesField;
381     public javax.swing.JLabel JavaDoc votesLabel;
382     // End of variables declaration//GEN-END:variables
383

384 }
385
Popular Tags