KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > jsf > wizards > ManagedBeanPanelVisual


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.web.jsf.wizards;
21 import javax.swing.event.ListDataEvent JavaDoc;
22 import javax.swing.event.ListDataListener JavaDoc;
23 import org.netbeans.api.project.Project;
24 import org.netbeans.modules.web.api.webmodule.WebModule;
25 import org.netbeans.modules.web.jsf.JSFConfigUtilities;
26 //import org.netbeans.modules.web.struts.StrutsConfigUtilities;
27
import org.openide.WizardDescriptor;
28 import org.openide.util.HelpCtx;
29 import org.openide.util.NbBundle;
30
31
32 public class ManagedBeanPanelVisual extends javax.swing.JPanel JavaDoc implements HelpCtx.Provider, ListDataListener JavaDoc {
33     
34     /**
35      * Creates new form PropertiesPanelVisual
36      */

37     public ManagedBeanPanelVisual(Project proj) {
38         initComponents();
39         
40         WebModule wm = WebModule.getWebModule(proj.getProjectDirectory());
41         if (wm != null){
42             String JavaDoc[] configFiles = JSFConfigUtilities.getConfigFiles(wm.getDeploymentDescriptor());
43             jComboBoxConfigFile.setModel(new javax.swing.DefaultComboBoxModel JavaDoc(configFiles));
44         }
45         
46         
47 // this.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(FormBeanNewPanelVisual.class, "ACS_BeanFormProperties")); // NOI18N
48
}
49     
50     /** This method is called from within the constructor to
51      * initialize the form.
52      * WARNING: Do NOT modify this code. The content of this method is
53      * always regenerated by the Form Editor.
54      */

55     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
56
private void initComponents() {
57         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
58
59         jLabelConfigFile = new javax.swing.JLabel JavaDoc();
60         jComboBoxConfigFile = new javax.swing.JComboBox JavaDoc();
61         jLabelScope = new javax.swing.JLabel JavaDoc();
62         jComboBoxScope = new javax.swing.JComboBox JavaDoc();
63         jLabelDesc = new javax.swing.JLabel JavaDoc();
64         jScrollPaneDesc = new javax.swing.JScrollPane JavaDoc();
65         jTextAreaDesc = new javax.swing.JTextArea JavaDoc();
66
67         setLayout(new java.awt.GridBagLayout JavaDoc());
68
69         jLabelConfigFile.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(ManagedBeanPanelVisual.class, "MNE_ConfigFile").charAt(0));
70         jLabelConfigFile.setLabelFor(jComboBoxConfigFile);
71         jLabelConfigFile.setText(org.openide.util.NbBundle.getMessage(ManagedBeanPanelVisual.class, "LBL_ConfigFile"));
72         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
73         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
74         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 5, 12);
75         add(jLabelConfigFile, gridBagConstraints);
76
77         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
78         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
79         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
80         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 5, 0);
81         add(jComboBoxConfigFile, gridBagConstraints);
82         jComboBoxConfigFile.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/jsf/wizards/Bundle").getString("ACSD_ConfigurationFile"));
83
84         jLabelScope.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(ManagedBeanPanelVisual.class, "MNE_Scope").charAt(0));
85         jLabelScope.setLabelFor(jComboBoxScope);
86         jLabelScope.setText(org.openide.util.NbBundle.getMessage(ManagedBeanPanelVisual.class, "LBL_Scope"));
87         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
88         gridBagConstraints.gridx = 0;
89         gridBagConstraints.gridy = 1;
90         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
91         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 5, 12);
92         add(jLabelScope, gridBagConstraints);
93
94         jComboBoxScope.setModel(new javax.swing.DefaultComboBoxModel JavaDoc(new String JavaDoc[] { "request", "session", "application", "none" }));
95         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
96         gridBagConstraints.gridx = 1;
97         gridBagConstraints.gridy = 1;
98         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
99         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
100         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 5, 0);
101         add(jComboBoxScope, gridBagConstraints);
102         jComboBoxScope.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/jsf/wizards/Bundle").getString("ACSD_ManagedBeanScope"));
103
104         jLabelDesc.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(ManagedBeanPanelVisual.class, "MNE_BeanDescription").charAt(0));
105         jLabelDesc.setLabelFor(jTextAreaDesc);
106         jLabelDesc.setText(org.openide.util.NbBundle.getMessage(ManagedBeanPanelVisual.class, "LBL_BeanDescription"));
107         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
108         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
109         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
110         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 0, 12);
111         add(jLabelDesc, gridBagConstraints);
112
113         jTextAreaDesc.setColumns(20);
114         jTextAreaDesc.setRows(5);
115         jScrollPaneDesc.setViewportView(jTextAreaDesc);
116         jTextAreaDesc.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/jsf/wizards/Bundle").getString("ACSD_BeanDescription"));
117
118         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
119         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
120         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
121         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
122         gridBagConstraints.weightx = 1.0;
123         gridBagConstraints.weighty = 1.0;
124         add(jScrollPaneDesc, gridBagConstraints);
125
126     }
127     // </editor-fold>//GEN-END:initComponents
128

129     // Variables declaration - do not modify//GEN-BEGIN:variables
130
private javax.swing.JComboBox JavaDoc jComboBoxConfigFile;
131     private javax.swing.JComboBox JavaDoc jComboBoxScope;
132     private javax.swing.JLabel JavaDoc jLabelConfigFile;
133     private javax.swing.JLabel JavaDoc jLabelDesc;
134     private javax.swing.JLabel JavaDoc jLabelScope;
135     private javax.swing.JScrollPane JavaDoc jScrollPaneDesc;
136     private javax.swing.JTextArea JavaDoc jTextAreaDesc;
137     // End of variables declaration//GEN-END:variables
138

139     boolean valid(WizardDescriptor wizardDescriptor) {
140         String JavaDoc configFile = (String JavaDoc) jComboBoxConfigFile.getSelectedItem();
141         boolean result = (configFile != null && !configFile.trim().equals(""));
142         if (!result){
143             wizardDescriptor.putProperty("WizardPanel_errorMessage",
144                     NbBundle.getMessage(ManagedBeanPanelVisual.class, "MSG_NoConfFileSelected"));
145         }
146         return result;
147     }
148     
149     void read(WizardDescriptor settings) {
150     }
151     
152     void store(WizardDescriptor settings) {
153         settings.putProperty(WizardProperties.CONFIG_FILE, jComboBoxConfigFile.getSelectedItem());
154         settings.putProperty(WizardProperties.SCOPE, jComboBoxScope.getSelectedItem());
155         settings.putProperty(WizardProperties.DESCRIPTION, jTextAreaDesc.getText());
156     }
157     
158     /** Help context where to find more about the paste type action.
159      * @return the help context for this action
160      */

161     public HelpCtx getHelpCtx() {
162         return new HelpCtx(ManagedBeanPanelVisual.class);
163     }
164     
165     public void intervalRemoved(ListDataEvent JavaDoc e) {
166     }
167     
168     public void intervalAdded(ListDataEvent JavaDoc e) {
169     }
170     
171     public void contentsChanged(ListDataEvent JavaDoc e) {
172
173     }
174     
175 }
176
Popular Tags