001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.exceptions;
043:
044: import java.awt.Cursor;
045: import java.net.MalformedURLException;
046: import org.openide.awt.HtmlBrowser;
047:
048: /**
049: *
050: * @author Jindrich Sedek
051: */
052:
053: public class ReportPanel extends javax.swing.JPanel {
054: private final ExceptionsSettings exSettings = new ExceptionsSettings();
055:
056: /** Creates new form ReportPanel */
057: public ReportPanel() {
058: initComponents();
059: jLabel10.setVisible(false);
060: jCheckBox1ActionPerformed(null);
061: }
062:
063: /** This method is called from within the constructor to
064: * initialize the form.
065: * WARNING: Do NOT modify this code. The content of this method is
066: * always regenerated by the Form Editor.
067: */
068: // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
069: private void initComponents() {
070:
071: jLabel3 = new javax.swing.JLabel();
072: jLabel6 = new javax.swing.JLabel();
073: jLabel6.setCursor(Cursor
074: .getPredefinedCursor(Cursor.HAND_CURSOR));
075: jLabel1 = new javax.swing.JLabel();
076: loginField = new javax.swing.JTextField();
077: jSeparator1 = new javax.swing.JSeparator();
078: jLabel9 = new javax.swing.JLabel();
079: summaryField = new javax.swing.JTextField();
080: jLabel4 = new javax.swing.JLabel();
081: jScrollPane1 = new javax.swing.JScrollPane();
082: commentArea = new javax.swing.JTextArea();
083: jLabel2 = new javax.swing.JLabel();
084: jLabel7 = new javax.swing.JLabel();
085: jLabel8 = new javax.swing.JLabel();
086: jLabel5 = new javax.swing.JLabel();
087: jPasswordField1 = new javax.swing.JPasswordField();
088: jCheckBox1 = new javax.swing.JCheckBox();
089: jLabel10 = new javax.swing.JLabel();
090: jLabel11 = new javax.swing.JLabel();
091:
092: jLabel3.setText(org.openide.util.NbBundle.getMessage(
093: ReportPanel.class, "ReportPanel.jLabel3.text")); // NOI18N
094:
095: jLabel6.setForeground(new java.awt.Color(0, 0, 255));
096: jLabel6.setText(org.openide.util.NbBundle.getMessage(
097: ReportPanel.class, "ReportPanel.jLabel6.text")); // NOI18N
098: jLabel6.addMouseListener(new java.awt.event.MouseAdapter() {
099: public void mouseClicked(java.awt.event.MouseEvent evt) {
100: registerClicked(evt);
101: }
102: });
103:
104: jLabel1.setLabelFor(loginField);
105: org.openide.awt.Mnemonics.setLocalizedText(jLabel1,
106: org.openide.util.NbBundle.getMessage(ReportPanel.class,
107: "ReportPanel.jLabel1.text")); // NOI18N
108:
109: loginField.setText(exSettings.getUserName());
110:
111: jLabel9.setLabelFor(summaryField);
112: org.openide.awt.Mnemonics.setLocalizedText(jLabel9,
113: org.openide.util.NbBundle.getMessage(ReportPanel.class,
114: "ReportPanel.jLabel9.text")); // NOI18N
115:
116: summaryField.setText(org.openide.util.NbBundle.getMessage(
117: ReportPanel.class, "ReportPanel.summaryField.text")); // NOI18N
118:
119: jLabel4.setLabelFor(commentArea);
120: org.openide.awt.Mnemonics.setLocalizedText(jLabel4,
121: org.openide.util.NbBundle.getMessage(ReportPanel.class,
122: "ReportPanel.jLabel4.text")); // NOI18N
123:
124: commentArea.setColumns(20);
125: commentArea.setLineWrap(true);
126: commentArea.setRows(5);
127: commentArea.setWrapStyleWord(true);
128: jScrollPane1.setViewportView(commentArea);
129: commentArea
130: .getAccessibleContext()
131: .setAccessibleName(
132: org.openide.util.NbBundle
133: .getMessage(ReportPanel.class,
134: "ReportPanel.commentArea.AccessibleContext.accessibleName")); // NOI18N
135: commentArea
136: .getAccessibleContext()
137: .setAccessibleDescription(
138: org.openide.util.NbBundle
139: .getMessage(ReportPanel.class,
140: "ReportPanel.commentArea.AccessibleContext.accessibleDescription")); // NOI18N
141:
142: jLabel2.setText(org.openide.util.NbBundle.getMessage(
143: ReportPanel.class, "ReportPanel.jLabel2.text")); // NOI18N
144:
145: jLabel7.setText(org.openide.util.NbBundle.getMessage(
146: ReportPanel.class, "ReportPanel.jLabel7.text_1")); // NOI18N
147:
148: jLabel8.setText(org.openide.util.NbBundle.getMessage(
149: ReportPanel.class, "ReportPanel.jLabel8.text_1")); // NOI18N
150:
151: org.openide.awt.Mnemonics.setLocalizedText(jLabel5,
152: org.openide.util.NbBundle.getMessage(ReportPanel.class,
153: "ReportPanel.jLabel5.text_1")); // NOI18N
154:
155: jPasswordField1.setText(exSettings.getPasswd());
156:
157: jCheckBox1.setSelected(exSettings.isGuest());
158: org.openide.awt.Mnemonics.setLocalizedText(jCheckBox1,
159: org.openide.util.NbBundle.getMessage(ReportPanel.class,
160: "jCheckBox1.text")); // NOI18N
161: jCheckBox1.setBorder(javax.swing.BorderFactory
162: .createEmptyBorder(0, 0, 0, 0));
163: jCheckBox1
164: .addActionListener(new java.awt.event.ActionListener() {
165: public void actionPerformed(
166: java.awt.event.ActionEvent evt) {
167: jCheckBox1ActionPerformed(evt);
168: }
169: });
170:
171: jLabel10.setForeground(new java.awt.Color(255, 51, 51));
172: jLabel10.setText(org.openide.util.NbBundle.getMessage(
173: ReportPanel.class, "ReportPanel.jLabel10.text")); // NOI18N
174:
175: jLabel11.setText(org.openide.util.NbBundle.getMessage(
176: ReportPanel.class, "ReportPanel.jLabel11.text")); // NOI18N
177:
178: org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
179: this );
180: this .setLayout(layout);
181: layout
182: .setHorizontalGroup(layout
183: .createParallelGroup(
184: org.jdesktop.layout.GroupLayout.LEADING)
185: .add(
186: layout
187: .createSequentialGroup()
188: .addContainerGap()
189: .add(
190: layout
191: .createParallelGroup(
192: org.jdesktop.layout.GroupLayout.LEADING)
193: .add(
194: layout
195: .createSequentialGroup()
196: .add(
197: layout
198: .createParallelGroup(
199: org.jdesktop.layout.GroupLayout.LEADING)
200: .add(
201: jLabel8)
202: .add(
203: layout
204: .createSequentialGroup()
205: .add(
206: layout
207: .createParallelGroup(
208: org.jdesktop.layout.GroupLayout.LEADING)
209: .add(
210: jLabel1)
211: .add(
212: jLabel5))
213: .addPreferredGap(
214: org.jdesktop.layout.LayoutStyle.RELATED)
215: .add(
216: layout
217: .createParallelGroup(
218: org.jdesktop.layout.GroupLayout.LEADING)
219: .add(
220: jPasswordField1,
221: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
222: 214,
223: Short.MAX_VALUE)
224: .add(
225: jCheckBox1)
226: .add(
227: loginField,
228: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
229: 214,
230: Short.MAX_VALUE))
231: .addPreferredGap(
232: org.jdesktop.layout.LayoutStyle.RELATED,
233: 13,
234: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
235: .add(
236: layout
237: .createParallelGroup(
238: org.jdesktop.layout.GroupLayout.LEADING)
239: .add(
240: jLabel10)
241: .add(
242: jLabel11))))
243: .addContainerGap())
244: .add(
245: layout
246: .createSequentialGroup()
247: .add(
248: layout
249: .createParallelGroup(
250: org.jdesktop.layout.GroupLayout.LEADING)
251: .add(
252: layout
253: .createSequentialGroup()
254: .add(
255: jLabel9)
256: .addPreferredGap(
257: org.jdesktop.layout.LayoutStyle.RELATED)
258: .add(
259: summaryField,
260: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
261: 393,
262: Short.MAX_VALUE))
263: .add(
264: jLabel3,
265: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
266: 453,
267: Short.MAX_VALUE)
268: .add(
269: layout
270: .createSequentialGroup()
271: .add(
272: jLabel2)
273: .addPreferredGap(
274: org.jdesktop.layout.LayoutStyle.RELATED)
275: .add(
276: jLabel6)
277: .addPreferredGap(
278: org.jdesktop.layout.LayoutStyle.RELATED)
279: .add(
280: jLabel7,
281: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
282: 215,
283: Short.MAX_VALUE))
284: .add(
285: jLabel4,
286: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
287: 453,
288: Short.MAX_VALUE))
289: .addContainerGap())
290: .add(
291: org.jdesktop.layout.GroupLayout.TRAILING,
292: layout
293: .createSequentialGroup()
294: .add(
295: layout
296: .createParallelGroup(
297: org.jdesktop.layout.GroupLayout.TRAILING)
298: .add(
299: jScrollPane1,
300: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
301: 454,
302: Short.MAX_VALUE)
303: .add(
304: jSeparator1,
305: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
306: 454,
307: Short.MAX_VALUE))
308: .add(
309: 11,
310: 11,
311: 11)))));
312: layout
313: .setVerticalGroup(layout
314: .createParallelGroup(
315: org.jdesktop.layout.GroupLayout.LEADING)
316: .add(
317: org.jdesktop.layout.GroupLayout.TRAILING,
318: layout
319: .createSequentialGroup()
320: .addContainerGap()
321: .add(jLabel3)
322: .addPreferredGap(
323: org.jdesktop.layout.LayoutStyle.RELATED)
324: .add(
325: layout
326: .createParallelGroup(
327: org.jdesktop.layout.GroupLayout.BASELINE)
328: .add(jLabel6)
329: .add(jLabel2)
330: .add(jLabel7))
331: .addPreferredGap(
332: org.jdesktop.layout.LayoutStyle.RELATED)
333: .add(
334: layout
335: .createParallelGroup(
336: org.jdesktop.layout.GroupLayout.BASELINE)
337: .add(jLabel9)
338: .add(
339: summaryField,
340: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
341: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
342: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
343: .addPreferredGap(
344: org.jdesktop.layout.LayoutStyle.RELATED)
345: .add(jLabel4)
346: .addPreferredGap(
347: org.jdesktop.layout.LayoutStyle.RELATED)
348: .add(
349: jScrollPane1,
350: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
351: 224, Short.MAX_VALUE)
352: .addPreferredGap(
353: org.jdesktop.layout.LayoutStyle.UNRELATED)
354: .add(
355: jSeparator1,
356: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
357: 10,
358: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
359: .addPreferredGap(
360: org.jdesktop.layout.LayoutStyle.RELATED)
361: .add(
362: layout
363: .createParallelGroup(
364: org.jdesktop.layout.GroupLayout.BASELINE)
365: .add(jLabel1)
366: .add(jLabel11)
367: .add(
368: loginField,
369: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
370: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
371: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
372: .addPreferredGap(
373: org.jdesktop.layout.LayoutStyle.RELATED)
374: .add(
375: layout
376: .createParallelGroup(
377: org.jdesktop.layout.GroupLayout.BASELINE)
378: .add(jLabel5)
379: .add(jLabel10)
380: .add(
381: jPasswordField1,
382: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
383: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
384: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
385: .add(4, 4, 4)
386: .add(jCheckBox1)
387: .addPreferredGap(
388: org.jdesktop.layout.LayoutStyle.RELATED)
389: .add(jLabel8)));
390:
391: loginField
392: .getAccessibleContext()
393: .setAccessibleName(
394: org.openide.util.NbBundle
395: .getMessage(ReportPanel.class,
396: "ReportPanel.loginField.AccessibleContext.accessibleName")); // NOI18N
397: loginField
398: .getAccessibleContext()
399: .setAccessibleDescription(
400: org.openide.util.NbBundle
401: .getMessage(ReportPanel.class,
402: "ReportPanel.loginField.AccessibleContext.accessibleDescription")); // NOI18N
403: summaryField
404: .getAccessibleContext()
405: .setAccessibleName(
406: org.openide.util.NbBundle
407: .getMessage(ReportPanel.class,
408: "ReportPanel.summaryField.AccessibleContext.accessibleName")); // NOI18N
409: summaryField
410: .getAccessibleContext()
411: .setAccessibleDescription(
412: org.openide.util.NbBundle
413: .getMessage(ReportPanel.class,
414: "ReportPanel.summaryField.AccessibleContext.accessibleDescription")); // NOI18N
415:
416: getAccessibleContext()
417: .setAccessibleName(
418: org.openide.util.NbBundle
419: .getMessage(ReportPanel.class,
420: "ReportPanel.AccessibleContext.accessibleName")); // NOI18N
421: getAccessibleContext()
422: .setAccessibleDescription(
423: org.openide.util.NbBundle
424: .getMessage(ReportPanel.class,
425: "ReportPanel.AccessibleContext.accessibleDescription")); // NOI18N
426: }// </editor-fold>//GEN-END:initComponents
427:
428: private void registerClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_registerClicked
429: try {
430: HtmlBrowser.URLDisplayer.getDefault().showURL(
431: new java.net.URL(org.openide.util.NbBundle
432: .getMessage(ReportPanel.class,
433: "REGISTRATION_URL")));
434: } catch (MalformedURLException ex) {
435: java.util.logging.Logger.getLogger(
436: ReportPanel.class.getName()).log(
437: java.util.logging.Level.INFO, ex.getMessage(), ex);
438: }
439: }//GEN-LAST:event_registerClicked
440:
441: private void jCheckBox1ActionPerformed(
442: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
443: if (jCheckBox1.isSelected()) {
444: loginField.setEnabled(false);
445: jPasswordField1.setEnabled(false);
446: jLabel10.setVisible(false);
447: } else {
448: loginField.setEnabled(true);
449: jPasswordField1.setEnabled(true);
450: }
451: }//GEN-LAST:event_jCheckBox1ActionPerformed
452:
453: public void saveUserName() {
454: if (jCheckBox1.isSelected()) {
455: exSettings.setGuest(true);
456: return;
457: }
458: String login = loginField.getText();
459: if ((login != null) && (login.length() != 0)) {
460: exSettings.setUserName(login);
461: }
462: String passwd = new String(jPasswordField1.getPassword());
463: if ((passwd != null) && (passwd.length() != 0)) {
464: exSettings.setPasswd(passwd);
465: }
466: exSettings.setGuest(false);
467: }
468:
469: public boolean asAGuest() {
470: return jCheckBox1.isSelected();
471: }
472:
473: public String getSummary() {
474: return summaryField.getText();
475: }
476:
477: public String getComment() {
478: return commentArea.getText();
479: }
480:
481: public void setSummary(String str) {
482: summaryField.setText(str);
483: }
484:
485: public void showWrongPassword() {
486: jLabel10.setVisible(true);
487: }
488:
489: // Variables declaration - do not modify//GEN-BEGIN:variables
490: private javax.swing.JTextArea commentArea;
491: private javax.swing.JCheckBox jCheckBox1;
492: private javax.swing.JLabel jLabel1;
493: private javax.swing.JLabel jLabel10;
494: private javax.swing.JLabel jLabel11;
495: private javax.swing.JLabel jLabel2;
496: private javax.swing.JLabel jLabel3;
497: private javax.swing.JLabel jLabel4;
498: private javax.swing.JLabel jLabel5;
499: private javax.swing.JLabel jLabel6;
500: private javax.swing.JLabel jLabel7;
501: private javax.swing.JLabel jLabel8;
502: private javax.swing.JLabel jLabel9;
503: private javax.swing.JPasswordField jPasswordField1;
504: private javax.swing.JScrollPane jScrollPane1;
505: private javax.swing.JSeparator jSeparator1;
506: private javax.swing.JTextField loginField;
507: private javax.swing.JTextField summaryField;
508: // End of variables declaration//GEN-END:variables
509: }
|