KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > apisupport > project > ui > wizard > javahelp > JavaHelpPanel


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.apisupport.project.ui.wizard.javahelp;
21
22 import javax.swing.JTextField JavaDoc;
23 import org.netbeans.api.project.ProjectUtils;
24 import org.netbeans.modules.apisupport.project.ui.UIUtil;
25 import org.netbeans.modules.apisupport.project.ui.wizard.BasicWizardIterator;
26 import org.openide.WizardDescriptor;
27 import org.openide.util.HelpCtx;
28 import org.openide.util.NbBundle;
29
30 /**
31  * @author Radek Matous
32  */

33 final class JavaHelpPanel extends BasicWizardIterator.Panel {
34     private NewJavaHelpIterator.DataModel data;
35
36     /** Creates new NameAndLocationPanel */
37     public JavaHelpPanel(final WizardDescriptor setting, final NewJavaHelpIterator.DataModel data) {
38         super(setting);
39         this.data = data;
40         initComponents();
41         initAccessibility();
42         putClientProperty("NewFileWizard_Title",// NOI18N
43
NbBundle.getMessage(JavaHelpPanel.class,"LBL_JavaHelpWizardTitle")); // NOI18N
44

45     }
46     
47     protected void storeToDataModel() {}
48     protected void readFromDataModel() {}
49     
50     private void updateData() {
51         createdFilesValue.setText(UIUtil.generateTextAreaContent(
52                 data.getCreatedModifiedFiles().getCreatedPaths()));
53         modifiedFilesValue.setText(UIUtil.generateTextAreaContent(
54                 data.getCreatedModifiedFiles().getModifiedPaths()));
55         //#68294 check if the paths for newly created files are valid or not..
56
String JavaDoc[] invalid = data.getCreatedModifiedFiles().getInvalidPaths();
57         if (invalid.length > 0) {
58             setError(NbBundle.getMessage(JavaHelpPanel.class, "ERR_ToBeCreateFileExists", invalid[0]));//NOI18N
59
} else {
60             markValid();
61         }
62     }
63     
64     protected String JavaDoc getPanelName() {
65         return NbBundle.getMessage(JavaHelpPanel.class,"LBL_JavaHelpPanel_Title"); // NOI18N
66
}
67     
68     
69     protected HelpCtx getHelp() {
70         return new HelpCtx(JavaHelpPanel.class);
71     }
72     
73     private static String JavaDoc getMessage(String JavaDoc key) {
74         return NbBundle.getMessage(JavaHelpPanel.class, key);
75     }
76     
77     private void initAccessibility() {
78         this.getAccessibleContext().setAccessibleDescription(getMessage("ACS_JavaHelpPanel"));//NOI18N
79
projectNameValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_ProjectName"));//NOI18N
80
createdFilesValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_CreatedFilesValue"));//NOI18N
81
modifiedFilesValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_ModifiedFilesValue"));//NOI18N
82
}
83     
84     public void addNotify() {
85         super.addNotify();
86         updateData();
87     }
88     
89     /** This method is called from within the constructor to
90      * initialize the form.
91      * WARNING: Do NOT modify this code. The content of this method is
92      * always regenerated by the Form Editor.
93      */

94     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
95
private void initComponents() {
96         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
97
98         projectName = new javax.swing.JLabel JavaDoc();
99         projectNameValue = new JTextField JavaDoc(ProjectUtils.getInformation(this.data.getProject()).getDisplayName());
100         createdFiles = new javax.swing.JLabel JavaDoc();
101         modifiedFiles = new javax.swing.JLabel JavaDoc();
102         createdFilesValueS = new javax.swing.JScrollPane JavaDoc();
103         createdFilesValue = new javax.swing.JTextArea JavaDoc();
104         modifiedFilesValueS = new javax.swing.JScrollPane JavaDoc();
105         modifiedFilesValue = new javax.swing.JTextArea JavaDoc();
106
107         setLayout(new java.awt.GridBagLayout JavaDoc());
108
109         projectName.setLabelFor(projectNameValue);
110         org.openide.awt.Mnemonics.setLocalizedText(projectName, java.util.ResourceBundle.getBundle("org/netbeans/modules/apisupport/project/ui/wizard/javahelp/Bundle").getString("LBL_ProjectName"));
111         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
112         gridBagConstraints.gridx = 0;
113         gridBagConstraints.gridy = 0;
114         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
115         gridBagConstraints.insets = new java.awt.Insets JavaDoc(1, 0, 6, 12);
116         add(projectName, gridBagConstraints);
117
118         projectNameValue.setEditable(false);
119         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
120         gridBagConstraints.gridx = 1;
121         gridBagConstraints.gridy = 0;
122         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
123         gridBagConstraints.weightx = 1.0;
124         gridBagConstraints.insets = new java.awt.Insets JavaDoc(1, 0, 6, 0);
125         add(projectNameValue, gridBagConstraints);
126
127         createdFiles.setLabelFor(createdFilesValue);
128         org.openide.awt.Mnemonics.setLocalizedText(createdFiles, java.util.ResourceBundle.getBundle("org/netbeans/modules/apisupport/project/ui/wizard/javahelp/Bundle").getString("LBL_CreatedFiles"));
129         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
130         gridBagConstraints.gridx = 0;
131         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
132         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
133         gridBagConstraints.insets = new java.awt.Insets JavaDoc(36, 0, 6, 12);
134         add(createdFiles, gridBagConstraints);
135
136         modifiedFiles.setLabelFor(modifiedFilesValue);
137         org.openide.awt.Mnemonics.setLocalizedText(modifiedFiles, java.util.ResourceBundle.getBundle("org/netbeans/modules/apisupport/project/ui/wizard/javahelp/Bundle").getString("LBL_ModifiedFiles"));
138         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
139         gridBagConstraints.gridx = 0;
140         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
141         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
142         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 0, 12);
143         add(modifiedFiles, gridBagConstraints);
144
145         createdFilesValue.setBackground(javax.swing.UIManager.getDefaults().getColor("Label.background"));
146         createdFilesValue.setColumns(20);
147         createdFilesValue.setEditable(false);
148         createdFilesValue.setRows(5);
149         createdFilesValue.setBorder(null);
150         createdFilesValueS.setViewportView(createdFilesValue);
151
152         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
153         gridBagConstraints.gridx = 1;
154         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
155         gridBagConstraints.weightx = 1.0;
156         gridBagConstraints.weighty = 1.0;
157         gridBagConstraints.insets = new java.awt.Insets JavaDoc(36, 0, 6, 0);
158         add(createdFilesValueS, gridBagConstraints);
159
160         modifiedFilesValue.setBackground(javax.swing.UIManager.getDefaults().getColor("Label.background"));
161         modifiedFilesValue.setColumns(20);
162         modifiedFilesValue.setEditable(false);
163         modifiedFilesValue.setRows(5);
164         modifiedFilesValue.setToolTipText("modifiedFilesValue");
165         modifiedFilesValue.setBorder(null);
166         modifiedFilesValueS.setViewportView(modifiedFilesValue);
167
168         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
169         gridBagConstraints.gridx = 1;
170         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
171         gridBagConstraints.weightx = 1.0;
172         add(modifiedFilesValueS, gridBagConstraints);
173
174     }// </editor-fold>//GEN-END:initComponents
175

176     // Variables declaration - do not modify//GEN-BEGIN:variables
177
private javax.swing.JLabel JavaDoc createdFiles;
178     private javax.swing.JTextArea JavaDoc createdFilesValue;
179     private javax.swing.JScrollPane JavaDoc createdFilesValueS;
180     private javax.swing.JLabel JavaDoc modifiedFiles;
181     private javax.swing.JTextArea JavaDoc modifiedFilesValue;
182     private javax.swing.JScrollPane JavaDoc modifiedFilesValueS;
183     private javax.swing.JLabel JavaDoc projectName;
184     private javax.swing.JTextField JavaDoc projectNameValue;
185     // End of variables declaration//GEN-END:variables
186

187 }
188
Popular Tags