1 19 20 package org.netbeans.modules.apisupport.project.ui.wizard.javahelp; 21 22 import javax.swing.JTextField ; 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 33 final class JavaHelpPanel extends BasicWizardIterator.Panel { 34 private NewJavaHelpIterator.DataModel data; 35 36 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", NbBundle.getMessage(JavaHelpPanel.class,"LBL_JavaHelpWizardTitle")); 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 String [] invalid = data.getCreatedModifiedFiles().getInvalidPaths(); 57 if (invalid.length > 0) { 58 setError(NbBundle.getMessage(JavaHelpPanel.class, "ERR_ToBeCreateFileExists", invalid[0])); } else { 60 markValid(); 61 } 62 } 63 64 protected String getPanelName() { 65 return NbBundle.getMessage(JavaHelpPanel.class,"LBL_JavaHelpPanel_Title"); } 67 68 69 protected HelpCtx getHelp() { 70 return new HelpCtx(JavaHelpPanel.class); 71 } 72 73 private static String getMessage(String key) { 74 return NbBundle.getMessage(JavaHelpPanel.class, key); 75 } 76 77 private void initAccessibility() { 78 this.getAccessibleContext().setAccessibleDescription(getMessage("ACS_JavaHelpPanel")); projectNameValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_ProjectName")); createdFilesValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_CreatedFilesValue")); modifiedFilesValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_ModifiedFilesValue")); } 83 84 public void addNotify() { 85 super.addNotify(); 86 updateData(); 87 } 88 89 94 private void initComponents() { 96 java.awt.GridBagConstraints gridBagConstraints; 97 98 projectName = new javax.swing.JLabel (); 99 projectNameValue = new JTextField (ProjectUtils.getInformation(this.data.getProject()).getDisplayName()); 100 createdFiles = new javax.swing.JLabel (); 101 modifiedFiles = new javax.swing.JLabel (); 102 createdFilesValueS = new javax.swing.JScrollPane (); 103 createdFilesValue = new javax.swing.JTextArea (); 104 modifiedFilesValueS = new javax.swing.JScrollPane (); 105 modifiedFilesValue = new javax.swing.JTextArea (); 106 107 setLayout(new java.awt.GridBagLayout ()); 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 (); 112 gridBagConstraints.gridx = 0; 113 gridBagConstraints.gridy = 0; 114 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 115 gridBagConstraints.insets = new java.awt.Insets (1, 0, 6, 12); 116 add(projectName, gridBagConstraints); 117 118 projectNameValue.setEditable(false); 119 gridBagConstraints = new java.awt.GridBagConstraints (); 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 (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 (); 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 (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 (); 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 (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 (); 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 (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 (); 169 gridBagConstraints.gridx = 1; 170 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 171 gridBagConstraints.weightx = 1.0; 172 add(modifiedFilesValueS, gridBagConstraints); 173 174 } 176 private javax.swing.JLabel createdFiles; 178 private javax.swing.JTextArea createdFilesValue; 179 private javax.swing.JScrollPane createdFilesValueS; 180 private javax.swing.JLabel modifiedFiles; 181 private javax.swing.JTextArea modifiedFilesValue; 182 private javax.swing.JScrollPane modifiedFilesValueS; 183 private javax.swing.JLabel projectName; 184 private javax.swing.JTextField projectNameValue; 185 187 } 188 | Popular Tags |