1 19 20 package org.netbeans.modules.web.jsf.wizards; 21 import javax.swing.event.ListDataEvent ; 22 import javax.swing.event.ListDataListener ; 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.openide.WizardDescriptor; 28 import org.openide.util.HelpCtx; 29 import org.openide.util.NbBundle; 30 31 32 public class ManagedBeanPanelVisual extends javax.swing.JPanel implements HelpCtx.Provider, ListDataListener { 33 34 37 public ManagedBeanPanelVisual(Project proj) { 38 initComponents(); 39 40 WebModule wm = WebModule.getWebModule(proj.getProjectDirectory()); 41 if (wm != null){ 42 String [] configFiles = JSFConfigUtilities.getConfigFiles(wm.getDeploymentDescriptor()); 43 jComboBoxConfigFile.setModel(new javax.swing.DefaultComboBoxModel (configFiles)); 44 } 45 46 47 } 49 50 55 private void initComponents() { 57 java.awt.GridBagConstraints gridBagConstraints; 58 59 jLabelConfigFile = new javax.swing.JLabel (); 60 jComboBoxConfigFile = new javax.swing.JComboBox (); 61 jLabelScope = new javax.swing.JLabel (); 62 jComboBoxScope = new javax.swing.JComboBox (); 63 jLabelDesc = new javax.swing.JLabel (); 64 jScrollPaneDesc = new javax.swing.JScrollPane (); 65 jTextAreaDesc = new javax.swing.JTextArea (); 66 67 setLayout(new java.awt.GridBagLayout ()); 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 (); 73 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 74 gridBagConstraints.insets = new java.awt.Insets (0, 0, 5, 12); 75 add(jLabelConfigFile, gridBagConstraints); 76 77 gridBagConstraints = new java.awt.GridBagConstraints (); 78 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 79 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 80 gridBagConstraints.insets = new java.awt.Insets (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 (); 88 gridBagConstraints.gridx = 0; 89 gridBagConstraints.gridy = 1; 90 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 91 gridBagConstraints.insets = new java.awt.Insets (0, 0, 5, 12); 92 add(jLabelScope, gridBagConstraints); 93 94 jComboBoxScope.setModel(new javax.swing.DefaultComboBoxModel (new String [] { "request", "session", "application", "none" })); 95 gridBagConstraints = new java.awt.GridBagConstraints (); 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 (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 (); 108 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 109 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 110 gridBagConstraints.insets = new java.awt.Insets (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 (); 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 129 private javax.swing.JComboBox jComboBoxConfigFile; 131 private javax.swing.JComboBox jComboBoxScope; 132 private javax.swing.JLabel jLabelConfigFile; 133 private javax.swing.JLabel jLabelDesc; 134 private javax.swing.JLabel jLabelScope; 135 private javax.swing.JScrollPane jScrollPaneDesc; 136 private javax.swing.JTextArea jTextAreaDesc; 137 139 boolean valid(WizardDescriptor wizardDescriptor) { 140 String configFile = (String ) 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 161 public HelpCtx getHelpCtx() { 162 return new HelpCtx(ManagedBeanPanelVisual.class); 163 } 164 165 public void intervalRemoved(ListDataEvent e) { 166 } 167 168 public void intervalAdded(ListDataEvent e) { 169 } 170 171 public void contentsChanged(ListDataEvent e) { 172 173 } 174 175 } 176 | Popular Tags |