1 19 20 package org.netbeans.modules.web.wizards; 21 22 import java.awt.Dimension ; 23 import org.openide.util.NbBundle; 24 import org.netbeans.modules.web.api.webmodule.WebModule; 25 26 30 public class TagHandlerPanel extends javax.swing.JPanel { 31 32 36 private TagHandlerSelection wizardPanel; 37 private String j2eeVersion; 38 39 public TagHandlerPanel(TagHandlerSelection wizardPanel, String j2eeVersion) { 40 this.wizardPanel=wizardPanel; 41 this.j2eeVersion=j2eeVersion; 42 initComponents(); 43 setName(NbBundle.getMessage(TagHandlerPanel.class, "TITLE_tagHandlerPanel")); 45 if (WebModule.J2EE_13_LEVEL.equals(j2eeVersion)) { 46 simpleTagButton.setEnabled(false); 47 bodyTagButton.setSelected(true); 48 } else { 49 simpleTagButton.setSelected(true); 50 } 51 62 64 int height = jLabel1.getFontMetrics(jLabel1.getFont()).getHeight() * 6 + 35; 66 if (height > this.getHeight()) { 67 Dimension dim = new Dimension (this.getWidth(), height); 68 setMinimumSize(dim); 69 setPreferredSize(dim); 70 } 71 72 } 73 74 79 private void initComponents() { 81 java.awt.GridBagConstraints gridBagConstraints; 82 83 buttonGroup1 = new javax.swing.ButtonGroup (); 84 simpleTagButton = new javax.swing.JRadioButton (); 85 bodyTagButton = new javax.swing.JRadioButton (); 86 jLabel1 = new javax.swing.JLabel (); 87 jLabel2 = new javax.swing.JLabel (); 88 jScrollPane1 = new javax.swing.JScrollPane (); 89 descriptionArea = new javax.swing.JTextArea (); 90 91 setRequestFocusEnabled(false); 92 setLayout(new java.awt.GridBagLayout ()); 93 94 buttonGroup1.add(simpleTagButton); 95 simpleTagButton.setMnemonic(org.openide.util.NbBundle.getMessage(TagHandlerPanel.class, "LBL_SimpleTag_Mnemonic").charAt(0)); 96 simpleTagButton.setText(org.openide.util.NbBundle.getMessage(TagHandlerPanel.class, "OPT_SimpleTag")); simpleTagButton.setMargin(new java.awt.Insets (2, 2, 0, 2)); 98 simpleTagButton.addItemListener(new java.awt.event.ItemListener () { 99 public void itemStateChanged(java.awt.event.ItemEvent evt) { 100 TagHandlerPanel.this.itemStateChanged(evt); 101 } 102 }); 103 gridBagConstraints = new java.awt.GridBagConstraints (); 104 gridBagConstraints.gridx = 0; 105 gridBagConstraints.gridy = 1; 106 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 107 add(simpleTagButton, gridBagConstraints); 108 java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/web/wizards/Bundle"); simpleTagButton.getAccessibleContext().setAccessibleDescription(bundle.getString("DESC_SimpleTag")); 111 buttonGroup1.add(bodyTagButton); 112 bodyTagButton.setMnemonic(org.openide.util.NbBundle.getMessage(TagHandlerPanel.class, "LBL_BodyTag_Mnemonic").charAt(0)); 113 bodyTagButton.setText(org.openide.util.NbBundle.getMessage(TagHandlerPanel.class, "OPT_BodyTag")); bodyTagButton.setMargin(new java.awt.Insets (0, 2, 2, 2)); 115 bodyTagButton.addItemListener(new java.awt.event.ItemListener () { 116 public void itemStateChanged(java.awt.event.ItemEvent evt) { 117 TagHandlerPanel.this.itemStateChanged(evt); 118 } 119 }); 120 gridBagConstraints = new java.awt.GridBagConstraints (); 121 gridBagConstraints.gridx = 0; 122 gridBagConstraints.gridy = 2; 123 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 124 add(bodyTagButton, gridBagConstraints); 125 bodyTagButton.getAccessibleContext().setAccessibleDescription(bundle.getString("DESC_BodyTag")); 127 jLabel1.setText(org.openide.util.NbBundle.getMessage(TagHandlerPanel.class, "LBL_TagSupportClass")); gridBagConstraints = new java.awt.GridBagConstraints (); 129 gridBagConstraints.gridx = 0; 130 gridBagConstraints.gridy = 0; 131 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 132 gridBagConstraints.insets = new java.awt.Insets (0, 0, 2, 0); 133 add(jLabel1, gridBagConstraints); 134 135 jLabel2.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/wizards/Bundle").getString("A11Y_Description_mnem").charAt(0)); 136 jLabel2.setLabelFor(descriptionArea); 137 jLabel2.setText(org.openide.util.NbBundle.getMessage(TagHandlerPanel.class, "LBL_description")); gridBagConstraints = new java.awt.GridBagConstraints (); 139 gridBagConstraints.gridx = 0; 140 gridBagConstraints.gridy = 3; 141 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 142 gridBagConstraints.insets = new java.awt.Insets (12, 0, 0, 0); 143 add(jLabel2, gridBagConstraints); 144 145 descriptionArea.setEditable(false); 146 descriptionArea.setLineWrap(true); 147 descriptionArea.setText(org.openide.util.NbBundle.getMessage(TagHandlerPanel.class, "DESC_SimpleTag")); descriptionArea.setWrapStyleWord(true); 149 jScrollPane1.setViewportView(descriptionArea); 150 descriptionArea.getAccessibleContext().setAccessibleDescription(bundle.getString("A11Y_DESC_Description")); 152 gridBagConstraints = new java.awt.GridBagConstraints (); 153 gridBagConstraints.gridx = 0; 154 gridBagConstraints.gridy = 4; 155 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 156 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 157 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 158 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; 159 gridBagConstraints.weightx = 1.0; 160 gridBagConstraints.weighty = 1.0; 161 gridBagConstraints.insets = new java.awt.Insets (0, 0, 0, 6); 162 add(jScrollPane1, gridBagConstraints); 163 } 165 private void itemStateChanged(java.awt.event.ItemEvent evt) { if (simpleTagButton.isSelected()) 168 descriptionArea.setText(org.openide.util.NbBundle.getMessage(TagHandlerPanel.class, "DESC_SimpleTag")); 169 else 170 descriptionArea.setText(org.openide.util.NbBundle.getMessage(TagHandlerPanel.class, "DESC_BodyTag")); 171 wizardPanel.fireChangeEvent(); 172 } 174 private javax.swing.JRadioButton bodyTagButton; 176 private javax.swing.ButtonGroup buttonGroup1; 177 private javax.swing.JTextArea descriptionArea; 178 private javax.swing.JLabel jLabel1; 179 private javax.swing.JLabel jLabel2; 180 private javax.swing.JScrollPane jScrollPane1; 181 private javax.swing.JRadioButton simpleTagButton; 182 184 boolean isBodyTagSupport() { 185 return bodyTagButton.isSelected(); 186 } 187 188 } 189 | Popular Tags |