KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > tasklist > usertasks > UserTaskDuePanel


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.usertasks;
21
22 import org.openide.awt.Mnemonics;
23 import org.openide.util.NbBundle;
24 import org.netbeans.modules.tasklist.usertasks.model.UserTask;
25
26 /**
27  * OK, it might be "overkill" to use this class. I should rather use the
28  * EditTaskPanel, (but I need to figure out where I can get all the information
29  * I need ;)
30  * Please read comment at the beginning of initA11y before editing
31  * this file using the form builder.
32  *
33  * @author Trond Norbye
34  * @author Tor Norbye
35  */

36 public class UserTaskDuePanel extends javax.swing.JPanel JavaDoc {
37
38     private static final long serialVersionUID = 1;
39
40     /** Creates new form UserTaskDuePanel */
41     public UserTaskDuePanel() {
42         initComponents();
43         initA11y();
44     }
45     
46     public UserTaskDuePanel(UserTask task) {
47         this();
48         detailsArea.setText(task.getDetails());
49         descriptionFld.setText(task.getSummary());
50     }
51     
52     /** This method is called from within the constructor to
53      * initialize the form.
54      * WARNING: Do NOT modify this code. The content of this method is
55      * always regenerated by the Form Editor.
56      */

57     private void initComponents() {//GEN-BEGIN:initComponents
58
java.awt.GridBagConstraints JavaDoc gridBagConstraints;
59
60         jLabel1 = new javax.swing.JLabel JavaDoc();
61         descriptionFld = new javax.swing.JTextField JavaDoc();
62         jLabel2 = new javax.swing.JLabel JavaDoc();
63         jScrollPane1 = new javax.swing.JScrollPane JavaDoc();
64         detailsArea = new javax.swing.JTextArea JavaDoc();
65
66         setLayout(new java.awt.GridBagLayout JavaDoc());
67
68         jLabel1.setLabelFor(descriptionFld);
69         /*
70         jLabel1.setText("Summary:");
71         */

72         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
73         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
74         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
75         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 12);
76         add(jLabel1, gridBagConstraints);
77
78         descriptionFld.setEnabled(false);
79         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
80         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
81         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
82         gridBagConstraints.weightx = 1.0;
83         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 12, 0, 12);
84         add(descriptionFld, gridBagConstraints);
85
86         jLabel2.setLabelFor(detailsArea);
87         /*
88         jLabel2.setText("Description:");
89         */

90         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
91         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
92         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
93         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 12);
94         add(jLabel2, gridBagConstraints);
95
96         detailsArea.setPreferredSize(new java.awt.Dimension JavaDoc(400, 200));
97         detailsArea.setEnabled(false);
98         jScrollPane1.setViewportView(detailsArea);
99
100         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
101         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
102         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
103         gridBagConstraints.weightx = 1.0;
104         gridBagConstraints.weighty = 1.0;
105         gridBagConstraints.insets = new java.awt.Insets JavaDoc(2, 12, 11, 11);
106         add(jScrollPane1, gridBagConstraints);
107
108     }//GEN-END:initComponents
109

110     private void initA11y() {
111         /*
112           I couldn't figure out how to use Mnemonics.setLocalizedText
113           to set labels and checkboxes with a mnemonic using the
114           form builder, so the closest I got was to use "/*" and "* /
115           as code pre-init/post-init blocks, such that I don't actually
116           execute the bundle lookup code - and then call it explicitly
117           below. (I wanted to keep the text on the components so that
118           I can see them when visually editing the GUI.
119         */

120
121         Mnemonics.setLocalizedText(jLabel1, NbBundle.getMessage(
122                 UserTaskDuePanel.class, "Brief_Description")); // NOI18N
123
Mnemonics.setLocalizedText(jLabel2, NbBundle.getMessage(
124                 UserTaskDuePanel.class, "DetailsLabel")); // NOI18N
125

126         // accessible
127
this.getAccessibleContext().setAccessibleDescription(
128                 NbBundle.getMessage(UserTaskDuePanel.class,
129                                     "ACSD_DuePanel")); // NOI18N
130
descriptionFld.getAccessibleContext().setAccessibleName(
131                 NbBundle.getMessage(UserTaskDuePanel.class,
132                                     "ACSD_Brief_Description")); // NOI18N
133
detailsArea.getAccessibleContext().setAccessibleName(
134                 NbBundle.getMessage(UserTaskDuePanel.class,
135                                     "ACSD_Details")); // NOI18N
136
}
137
138     
139     // Variables declaration - do not modify//GEN-BEGIN:variables
140
private javax.swing.JTextField JavaDoc descriptionFld;
141     private javax.swing.JTextArea JavaDoc detailsArea;
142     private javax.swing.JLabel JavaDoc jLabel1;
143     private javax.swing.JLabel JavaDoc jLabel2;
144     private javax.swing.JScrollPane JavaDoc jScrollPane1;
145     // End of variables declaration//GEN-END:variables
146

147 }
148
Popular Tags