1 19 20 package org.netbeans.modules.web.project.ui.customizer; 21 22 import java.awt.Component ; 23 import javax.swing.JPanel ; 24 import javax.swing.JTable ; 25 import javax.swing.ListSelectionModel ; 26 import javax.swing.table.DefaultTableCellRenderer ; 27 import javax.swing.table.TableColumn ; 28 import org.openide.util.HelpCtx; 29 import org.openide.util.NbBundle; 30 31 33 public class CustomizerWar extends JPanel implements HelpCtx.Provider { 34 35 WebProjectProperties uiProperties; 36 37 38 public CustomizerWar(WebProjectProperties uiProperties) { 39 this.uiProperties = uiProperties; 40 initComponents(); 41 this.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerWar.class, "ACS_CustomizeWAR_A11YDesc")); 43 jTextFieldFileName.setDocument( uiProperties.WAR_NAME_MODEL ); 44 jTextFieldExContent.setDocument( uiProperties.BUILD_CLASSES_EXCLUDES_MODEL ); 45 uiProperties.WAR_COMPRESS_MODEL.setMnemonic( jCheckBoxCompress.getMnemonic() ); 46 jCheckBoxCompress.setModel( uiProperties.WAR_COMPRESS_MODEL ); 47 uiProperties.WAR_PACKAGE_MODEL.setMnemonic( jCheckBoxCreateWAR.getMnemonic() ); 48 jCheckBoxCreateWAR.setModel( uiProperties.WAR_PACKAGE_MODEL ); 49 50 initTableVisualProperties(jTableAddContent); 51 52 WarIncludesUi.EditMediator.register( uiProperties.getProject(), 53 jTableAddContent, 54 jButtonAddJar.getModel(), 55 jButtonAddLib.getModel(), 56 jButtonAddProject.getModel(), 57 jButtonRemove.getModel()); 58 } 59 60 private void initTableVisualProperties(JTable table) { 61 WarIncludesUiSupport.ClasspathTableModel model = uiProperties.WAR_CONTENT_ADDITIONAL_MODEL; 62 table.setModel(model); 63 64 table.getColumnModel().getColumn(0).setHeaderValue(NbBundle.getMessage(CustomizerWar.class, "TXT_WAR_Item")); 65 table.getColumnModel().getColumn(1).setHeaderValue(NbBundle.getMessage(CustomizerWar.class, "TXT_WAR_PathInWAR")); 66 table.getColumnModel().getColumn(0).setCellRenderer(new WarIncludesUi.ClassPathCellRenderer()); 67 table.getColumnModel().getColumn(1).setCellRenderer(new DefaultTableCellRenderer () { 68 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { 69 if (value != null) { 70 setToolTipText(value.toString()); 71 } 72 return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); 73 } 74 }); 75 76 table.setRowHeight(jTableAddContent.getRowHeight() + 4); 77 table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 78 table.setIntercellSpacing(new java.awt.Dimension (0, 0)); 79 table.getParent().setBackground(table.getBackground()); 81 82 table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); 85 TableColumn column = table.getColumnModel().getColumn(0); 86 column.setMinWidth(240); 87 column.setWidth(240); 88 column.setMinWidth(75); 89 column = table.getColumnModel().getColumn(1); 90 column.setMinWidth(187); 91 column.setWidth(187); 92 column.setMinWidth(75); 93 } 94 95 100 private void initComponents() { 102 java.awt.GridBagConstraints gridBagConstraints; 103 104 jPanel1 = new javax.swing.JPanel (); 105 jLabelFileName = new javax.swing.JLabel (); 106 jTextFieldFileName = new javax.swing.JTextField (); 107 jLabelExContent = new javax.swing.JLabel (); 108 jTextFieldExContent = new javax.swing.JTextField (); 109 excludeMessage = new javax.swing.JLabel (); 110 jCheckBoxCompress = new javax.swing.JCheckBox (); 111 jCheckBoxCreateWAR = new javax.swing.JCheckBox (); 112 jLabelAddContent = new javax.swing.JLabel (); 113 jScrollPane2 = new javax.swing.JScrollPane (); 114 jTableAddContent = new javax.swing.JTable (); 115 jButtonAddProject = new javax.swing.JButton (); 116 jButtonAddLib = new javax.swing.JButton (); 117 jButtonAddJar = new javax.swing.JButton (); 118 jButtonRemove = new javax.swing.JButton (); 119 120 setLayout(new java.awt.GridBagLayout ()); 121 122 jPanel1.setLayout(new java.awt.GridBagLayout ()); 123 124 jLabelFileName.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/project/ui/customizer/Bundle").getString("LBL_CustomizeWAR_FileName_LabelMnemonic").charAt(0)); 125 jLabelFileName.setLabelFor(jTextFieldFileName); 126 jLabelFileName.setText(org.openide.util.NbBundle.getMessage(CustomizerWar.class, "LBL_CustomizeWAR_FileName_JLabel")); 127 gridBagConstraints = new java.awt.GridBagConstraints (); 128 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 129 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 130 gridBagConstraints.insets = new java.awt.Insets (0, 0, 11, 11); 131 jPanel1.add(jLabelFileName, gridBagConstraints); 132 133 jTextFieldFileName.setEditable(false); 134 gridBagConstraints = new java.awt.GridBagConstraints (); 135 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 136 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 137 gridBagConstraints.weightx = 1.0; 138 gridBagConstraints.insets = new java.awt.Insets (0, 0, 11, 0); 139 jPanel1.add(jTextFieldFileName, gridBagConstraints); 140 jTextFieldFileName.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/project/ui/customizer/Bundle").getString("ACS_CustomizeWAR_FileName_A11YDesc")); 141 142 jLabelExContent.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/project/ui/customizer/Bundle").getString("LBL_CustomizeWAR_Content_LabelMnemonic").charAt(0)); 143 jLabelExContent.setLabelFor(jTextFieldExContent); 144 jLabelExContent.setText(org.openide.util.NbBundle.getMessage(CustomizerWar.class, "LBL_CustomizeWAR_Content_JLabel")); 145 gridBagConstraints = new java.awt.GridBagConstraints (); 146 gridBagConstraints.gridx = 0; 147 gridBagConstraints.gridy = 1; 148 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 149 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 150 gridBagConstraints.insets = new java.awt.Insets (0, 0, 0, 11); 151 jPanel1.add(jLabelExContent, gridBagConstraints); 152 153 gridBagConstraints = new java.awt.GridBagConstraints (); 154 gridBagConstraints.gridx = 1; 155 gridBagConstraints.gridy = 1; 156 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 157 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 158 jPanel1.add(jTextFieldExContent, gridBagConstraints); 159 jTextFieldExContent.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerWar.class, "ACS_CustomizeWAR_Content_A11YDesc")); 160 161 excludeMessage.setLabelFor(jTextFieldExContent); 162 excludeMessage.setText(NbBundle.getMessage(CustomizerWar.class, "LBL_CustomizerWAR_ExcludeMessage")); 163 gridBagConstraints = new java.awt.GridBagConstraints (); 164 gridBagConstraints.gridx = 1; 165 gridBagConstraints.gridy = 2; 166 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 167 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 168 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 169 jPanel1.add(excludeMessage, gridBagConstraints); 170 171 gridBagConstraints = new java.awt.GridBagConstraints (); 172 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 173 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 174 gridBagConstraints.insets = new java.awt.Insets (0, 0, 12, 0); 175 add(jPanel1, gridBagConstraints); 176 177 jCheckBoxCompress.setMnemonic(org.openide.util.NbBundle.getMessage(CustomizerWar.class, "LBL_CustomizeWAR_Commpres_LabelMnemonic").charAt(0)); 178 jCheckBoxCompress.setText(org.openide.util.NbBundle.getMessage(CustomizerWar.class, "LBL_CustomizeWAR_Commpres_JCheckBox")); 179 jCheckBoxCompress.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 180 jCheckBoxCompress.setMargin(new java.awt.Insets (0, 0, 0, 0)); 181 gridBagConstraints = new java.awt.GridBagConstraints (); 182 gridBagConstraints.gridx = 0; 183 gridBagConstraints.gridy = 1; 184 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 185 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 186 gridBagConstraints.insets = new java.awt.Insets (0, 0, 12, 0); 187 add(jCheckBoxCompress, gridBagConstraints); 188 jCheckBoxCompress.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/project/ui/customizer/Bundle").getString("ACS_CustomizeWAR_Commpres_A11YDesc")); 189 190 jCheckBoxCreateWAR.setMnemonic(org.openide.util.NbBundle.getMessage(CustomizerWar.class, "LBL_CustomizeWAR_CreateWAR_LabelMnemonic").charAt(0)); 191 jCheckBoxCreateWAR.setSelected(true); 192 jCheckBoxCreateWAR.setText(org.openide.util.NbBundle.getMessage(CustomizerWar.class, "LBL_CustomizeWAR_CreateWAR_JCheckBox")); 193 jCheckBoxCreateWAR.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 194 jCheckBoxCreateWAR.setMargin(new java.awt.Insets (0, 0, 0, 0)); 195 gridBagConstraints = new java.awt.GridBagConstraints (); 196 gridBagConstraints.gridx = 0; 197 gridBagConstraints.gridy = 2; 198 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 199 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 200 gridBagConstraints.insets = new java.awt.Insets (0, 0, 12, 0); 201 add(jCheckBoxCreateWAR, gridBagConstraints); 202 jCheckBoxCreateWAR.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerWar.class, "ACS_CustomizeWAR_CreateWAR_A11YDesc")); 203 204 jLabelAddContent.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/project/ui/customizer/Bundle").getString("LBL_CustomizeWAR_AddContent_LabelMnemonic").charAt(0)); 205 jLabelAddContent.setLabelFor(jTableAddContent); 206 jLabelAddContent.setText(NbBundle.getMessage(CustomizerWar.class, "LBL_CustomizeWAR_AddContent_JLabel")); 207 gridBagConstraints = new java.awt.GridBagConstraints (); 208 gridBagConstraints.gridx = 0; 209 gridBagConstraints.gridy = 3; 210 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 211 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 212 gridBagConstraints.insets = new java.awt.Insets (11, 0, 2, 0); 213 add(jLabelAddContent, gridBagConstraints); 214 215 jTableAddContent.setModel(new javax.swing.table.DefaultTableModel ( 216 new Object [][] { 217 218 }, 219 new String [] { 220 221 } 222 )); 223 jScrollPane2.setViewportView(jTableAddContent); 224 jTableAddContent.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/project/ui/customizer/Bundle").getString("ACS_CustomizeWAR_AddContent_A11YDesc")); 225 226 gridBagConstraints = new java.awt.GridBagConstraints (); 227 gridBagConstraints.gridx = 0; 228 gridBagConstraints.gridy = 4; 229 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 230 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 231 gridBagConstraints.weightx = 1.0; 232 gridBagConstraints.weighty = 1.0; 233 gridBagConstraints.insets = new java.awt.Insets (0, 0, 0, 11); 234 add(jScrollPane2, gridBagConstraints); 235 236 jButtonAddProject.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/project/ui/customizer/Bundle").getString("LBL_CustomizeWAR_AddProject_LabelMnemonic").charAt(0)); 237 jButtonAddProject.setText(NbBundle.getMessage(CustomizerWar.class, "LBL_CustomizeWAR_AddProject_JButton")); 238 gridBagConstraints = new java.awt.GridBagConstraints (); 239 gridBagConstraints.gridx = 1; 240 gridBagConstraints.gridy = 4; 241 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 242 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 243 gridBagConstraints.insets = new java.awt.Insets (0, 0, 5, 0); 244 add(jButtonAddProject, gridBagConstraints); 245 jButtonAddProject.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/project/ui/customizer/Bundle").getString("ACS_CustomizeWAR_AddProject_A11YDesc")); 246 247 jButtonAddLib.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/project/ui/customizer/Bundle").getString("LBL_CustomizeWAR_AddLib_LabelMnemonic").charAt(0)); 248 jButtonAddLib.setText(NbBundle.getMessage(CustomizerWar.class, "LBL_CustomizeWAR_AddLib_JButton")); 249 gridBagConstraints = new java.awt.GridBagConstraints (); 250 gridBagConstraints.gridx = 1; 251 gridBagConstraints.gridy = 5; 252 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 253 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 254 gridBagConstraints.insets = new java.awt.Insets (0, 0, 5, 0); 255 add(jButtonAddLib, gridBagConstraints); 256 jButtonAddLib.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/project/ui/customizer/Bundle").getString("ACS_CustomizeWAR_AddLib_A11YDesc")); 257 258 jButtonAddJar.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/project/ui/customizer/Bundle").getString("LBL_CustomizeWAR_AddJar_LabelMnemonic").charAt(0)); 259 jButtonAddJar.setText(NbBundle.getMessage(CustomizerWar.class, "LBL_CustomizeWAR_AddJar_JButton")); 260 gridBagConstraints = new java.awt.GridBagConstraints (); 261 gridBagConstraints.gridx = 1; 262 gridBagConstraints.gridy = 6; 263 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 264 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 265 gridBagConstraints.insets = new java.awt.Insets (0, 0, 11, 0); 266 add(jButtonAddJar, gridBagConstraints); 267 jButtonAddJar.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/project/ui/customizer/Bundle").getString("ACS_CustomizeWAR_AddJar_A11YDesc")); 268 269 jButtonRemove.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/project/ui/customizer/Bundle").getString("LBL_CustomizeWAR_AdditionalRemove_LabelMnemonic").charAt(0)); 270 jButtonRemove.setText(NbBundle.getMessage(CustomizerWar.class, "LBL_CustomizeWAR_Remove_JButton")); 271 gridBagConstraints = new java.awt.GridBagConstraints (); 272 gridBagConstraints.gridx = 1; 273 gridBagConstraints.gridy = 7; 274 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 275 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 276 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 277 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; 278 add(jButtonRemove, gridBagConstraints); 279 jButtonRemove.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/project/ui/customizer/Bundle").getString("ACS_CustomizeWAR_AdditionalRemove_A11YDesc")); 280 281 } 283 private javax.swing.JLabel excludeMessage; 285 private javax.swing.JButton jButtonAddJar; 286 private javax.swing.JButton jButtonAddLib; 287 private javax.swing.JButton jButtonAddProject; 288 private javax.swing.JButton jButtonRemove; 289 private javax.swing.JCheckBox jCheckBoxCompress; 290 private javax.swing.JCheckBox jCheckBoxCreateWAR; 291 private javax.swing.JLabel jLabelAddContent; 292 private javax.swing.JLabel jLabelExContent; 293 private javax.swing.JLabel jLabelFileName; 294 private javax.swing.JPanel jPanel1; 295 private javax.swing.JScrollPane jScrollPane2; 296 private javax.swing.JTable jTableAddContent; 297 private javax.swing.JTextField jTextFieldExContent; 298 private javax.swing.JTextField jTextFieldFileName; 299 301 304 public HelpCtx getHelpCtx() { 305 return new HelpCtx(CustomizerWar.class); 306 } 307 308 } 309 | Popular Tags |