Lines 42-53
Link Here
|
42 |
|
42 |
|
43 |
package org.netbeans.modules.vmd.componentssupport.ui.wizard; |
43 |
package org.netbeans.modules.vmd.componentssupport.ui.wizard; |
44 |
|
44 |
|
|
|
45 |
import java.awt.BorderLayout; |
46 |
import java.awt.Component; |
47 |
import java.awt.event.ActionEvent; |
48 |
import java.awt.event.ActionListener; |
49 |
import java.beans.PropertyChangeEvent; |
50 |
import java.beans.PropertyChangeListener; |
45 |
import java.io.File; |
51 |
import java.io.File; |
|
|
52 |
import javax.swing.JComponent; |
46 |
import javax.swing.JFileChooser; |
53 |
import javax.swing.JFileChooser; |
47 |
import javax.swing.JPanel; |
54 |
import javax.swing.JPanel; |
48 |
import javax.swing.event.DocumentEvent; |
55 |
import javax.swing.event.DocumentEvent; |
49 |
import javax.swing.event.DocumentListener; |
56 |
import javax.swing.event.DocumentListener; |
50 |
import javax.swing.text.Document; |
57 |
import javax.swing.text.Document; |
|
|
58 |
import org.netbeans.modules.apisupport.project.ui.wizard.spi.ModuleTypePanel; |
51 |
import org.netbeans.spi.project.ui.support.ProjectChooser; |
59 |
import org.netbeans.spi.project.ui.support.ProjectChooser; |
52 |
import org.openide.WizardDescriptor; |
60 |
import org.openide.WizardDescriptor; |
53 |
import org.openide.WizardValidationException; |
61 |
import org.openide.WizardValidationException; |
Lines 55-61
Link Here
|
55 |
import org.openide.util.HelpCtx; |
63 |
import org.openide.util.HelpCtx; |
56 |
import org.openide.util.NbBundle; |
64 |
import org.openide.util.NbBundle; |
57 |
|
65 |
|
58 |
class CustomComponentVisualPanel extends JPanel implements DocumentListener { |
66 |
class CustomComponentVisualPanel extends JPanel { |
59 |
|
67 |
|
60 |
public static final String PROP_PROJECT_NAME = "projectName"; |
68 |
public static final String PROP_PROJECT_NAME = "projectName"; |
61 |
public static final String BROWSE = "BROWSE"; |
69 |
public static final String BROWSE = "BROWSE"; |
Lines 77-111
Link Here
|
77 |
public CustomComponentVisualPanel(CustomComponentWizardPanel panel) { |
85 |
public CustomComponentVisualPanel(CustomComponentWizardPanel panel) { |
78 |
initComponents(); |
86 |
initComponents(); |
79 |
this.myPanel = panel; |
87 |
this.myPanel = panel; |
|
|
88 |
|
80 |
putClientProperty("NewProjectWizard_Title", NbBundle.getMessage(CustomComponentVisualPanel.class, "TXT_MobileDesigner")); |
89 |
putClientProperty("NewProjectWizard_Title", NbBundle.getMessage(CustomComponentVisualPanel.class, "TXT_MobileDesigner")); |
81 |
// Register listener on the textFields to make the automatic updates |
90 |
initDocumentListeners(); |
82 |
projectNameTextField.getDocument().addDocumentListener(this); |
91 |
attachDocumentListeners(); |
83 |
projectLocationTextField.getDocument().addDocumentListener(this); |
|
|
84 |
|
92 |
|
85 |
initAccessibility();; |
93 |
initAccessibility(); |
86 |
} |
94 |
} |
87 |
|
95 |
|
88 |
@Override |
96 |
@Override |
89 |
public void addNotify() { |
97 |
public void addNotify() { |
90 |
super.addNotify(); |
98 |
super.addNotify(); |
|
|
99 |
attachDocumentListeners(); |
91 |
//same problem as in 31086, initial focus on Cancel button |
100 |
//same problem as in 31086, initial focus on Cancel button |
92 |
projectNameTextField.requestFocus(); |
101 |
projectNameTextField.requestFocus(); |
93 |
} |
102 |
} |
94 |
|
103 |
|
95 |
// Implementation of DocumentListener -------------------------------------- |
104 |
@Override |
96 |
public void changedUpdate(DocumentEvent e) { |
105 |
public void removeNotify() { |
97 |
updateTexts(e); |
106 |
// prevent checking when the panel is not "active" |
98 |
checkValidity(); |
107 |
removeDocumentListeners(); |
|
|
108 |
super.removeNotify(); |
99 |
} |
109 |
} |
100 |
|
|
|
101 |
public void insertUpdate(DocumentEvent e) { |
102 |
changedUpdate(e); |
103 |
} |
104 |
|
105 |
public void removeUpdate(DocumentEvent e) { |
106 |
changedUpdate(e); |
107 |
} |
108 |
// ------------- |
109 |
|
110 |
|
110 |
void store(WizardDescriptor d) { |
111 |
void store(WizardDescriptor d) { |
111 |
String name = projectNameTextField.getText().trim(); |
112 |
String name = projectNameTextField.getText().trim(); |
Lines 118-130
Link Here
|
118 |
} |
119 |
} |
119 |
|
120 |
|
120 |
void read(WizardDescriptor settings) { |
121 |
void read(WizardDescriptor settings) { |
121 |
mySettings = settings; |
122 |
if (mySettings == null){ |
|
|
123 |
mySettings = settings; |
124 |
mySettings.addPropertyChangeListener(new PropertyChangeListener() { |
125 |
|
126 |
public void propertyChange(PropertyChangeEvent evt) { |
127 |
if (ModuleTypePanel.isPanelUpdated(evt)){ |
128 |
moduleTypePanelUpdated(); |
129 |
} |
130 |
} |
131 |
}); |
132 |
initPanels(mySettings); |
133 |
} |
134 |
|
135 |
//typeChooserPanel.read(mySettings); |
136 |
// invoke store to have changes in mySettings |
137 |
//typeChooserPanel.store(mySettings); |
122 |
|
138 |
|
123 |
if (getIsMainProject() != null){ |
139 |
if (getIsMainProject() != null){ |
124 |
this.mainProject.setSelected(getIsMainProject()); |
140 |
this.mainProject.setSelected(getIsMainProject()); |
125 |
} |
141 |
} |
126 |
this.projectLocationTextField.setText( |
142 |
setLocation(getProjectLocation().getAbsolutePath()); |
127 |
getProjectLocation().getAbsolutePath()); |
|
|
128 |
|
143 |
|
129 |
this.projectNameTextField.setText(getProjectName()); |
144 |
this.projectNameTextField.setText(getProjectName()); |
130 |
this.projectNameTextField.selectAll(); |
145 |
this.projectNameTextField.selectAll(); |
Lines 134-139
Link Here
|
134 |
return new HelpCtx(CustomComponentVisualPanel.class); |
149 |
return new HelpCtx(CustomComponentVisualPanel.class); |
135 |
} |
150 |
} |
136 |
|
151 |
|
|
|
152 |
private void initDocumentListeners() { |
153 |
nameDL = new DocumentAdapter() { |
154 |
public void insertUpdate(DocumentEvent e) { |
155 |
updateTexts(e); |
156 |
checkValidity(); |
157 |
} |
158 |
}; |
159 |
locationDL = new DocumentAdapter() { |
160 |
public void insertUpdate(DocumentEvent e) { |
161 |
locationUpdated = true; |
162 |
updateTexts(e); |
163 |
checkValidity(); |
164 |
} |
165 |
}; |
166 |
isMainAL = new ActionListener() { |
167 |
public void actionPerformed(ActionEvent e) { |
168 |
mainProjectTouched = true; |
169 |
} |
170 |
}; |
171 |
} |
172 |
|
173 |
private void attachDocumentListeners() { |
174 |
if (!listenersAttached) { |
175 |
projectNameTextField.getDocument().addDocumentListener(nameDL); |
176 |
projectLocationTextField.getDocument().addDocumentListener(locationDL); |
177 |
mainProject.addActionListener(isMainAL); |
178 |
listenersAttached = true; |
179 |
} |
180 |
} |
181 |
|
182 |
private void removeDocumentListeners() { |
183 |
if (listenersAttached) { |
184 |
projectNameTextField.getDocument().removeDocumentListener(nameDL); |
185 |
projectLocationTextField.getDocument().removeDocumentListener(locationDL); |
186 |
mainProject.removeActionListener(isMainAL); |
187 |
listenersAttached = false; |
188 |
} |
189 |
} |
190 |
|
191 |
private void initPanels(WizardDescriptor settings){ |
192 |
if (typeChooserPanel != null){ |
193 |
typeChooserPanelContainer.removeAll(); |
194 |
typeChooserPanel = null; |
195 |
} |
196 |
typeChooserPanel = ModuleTypePanel.createComponent(settings); |
197 |
typeChooserPanelContainer.add(typeChooserPanel, BorderLayout.CENTER); |
198 |
typeChooserPanelContainer.validate(); |
199 |
validate(); |
200 |
} |
201 |
|
202 |
private void moduleTypePanelUpdated() { |
203 |
boolean isStandAlone = ModuleTypePanel.isStandalone(getSettings()); |
204 |
boolean isSuiteComponent = ModuleTypePanel.isSuiteComponent(getSettings()); |
205 |
// both radio buttons are deselected and disaled |
206 |
if (!isStandAlone && !isSuiteComponent){ |
207 |
return; |
208 |
} |
209 |
|
210 |
if (!mainProjectTouched) { |
211 |
mainProject.setSelected(isStandAlone); |
212 |
} |
213 |
if (!locationUpdated) { |
214 |
setLocation(computeInitialLocationValue()); |
215 |
} |
216 |
checkValidity(); |
217 |
} |
218 |
|
219 |
private void setLocation(String location) { |
220 |
boolean revert = !locationUpdated; |
221 |
projectLocationTextField.setText(location); |
222 |
locationUpdated = revert ^ true; |
223 |
} |
224 |
|
225 |
boolean checkValidity() { |
226 |
if (!isProjectNameValid()){ |
227 |
return false; |
228 |
} else if (!isProjectLocationValid()){ |
229 |
return false; |
230 |
} else if (!isCreatedFolderValid()){ |
231 |
return false; |
232 |
} else if (!ModuleTypePanel.validate(getSettings())){ |
233 |
return false; |
234 |
} |
235 |
|
236 |
markValid(); |
237 |
return true; |
238 |
} |
239 |
|
137 |
private boolean isProjectNameValid(){ |
240 |
private boolean isProjectNameValid(){ |
138 |
if (getProjectNameValue().trim().length() == 0) { |
241 |
if (getProjectNameValue().trim().length() == 0) { |
139 |
setError(getMessage(MSG_NAME_CANNOT_BE_EMPTY)); |
242 |
setError(getMessage(MSG_NAME_CANNOT_BE_EMPTY)); |
Lines 187-207
Link Here
|
187 |
return true; |
290 |
return true; |
188 |
} |
291 |
} |
189 |
|
292 |
|
190 |
// TODO |
|
|
191 |
boolean checkValidity() { |
192 |
if (!isProjectNameValid()){ |
193 |
return false; |
194 |
} else if (!isProjectLocationValid()){ |
195 |
return false; |
196 |
} else if (!isCreatedFolderValid()){ |
197 |
return false; |
198 |
} |
199 |
|
200 |
|
201 |
markValid(); |
202 |
return true; |
203 |
} |
204 |
|
205 |
private String getProjectNameValue(){ |
293 |
private String getProjectNameValue(){ |
206 |
return projectNameTextField.getText(); |
294 |
return projectNameTextField.getText(); |
207 |
} |
295 |
} |
Lines 232-238
Link Here
|
232 |
} |
320 |
} |
233 |
|
321 |
|
234 |
private final void setMessage(String message) { |
322 |
private final void setMessage(String message) { |
235 |
mySettings.putProperty( |
323 |
getSettings().putProperty( |
236 |
CustomComponentWizardIterator.WIZARD_PANEL_ERROR_MESSAGE, |
324 |
CustomComponentWizardIterator.WIZARD_PANEL_ERROR_MESSAGE, |
237 |
message); |
325 |
message); |
238 |
} |
326 |
} |
Lines 252-271
Link Here
|
252 |
* @return File Directory that will contain project folder |
340 |
* @return File Directory that will contain project folder |
253 |
*/ |
341 |
*/ |
254 |
File getProjectLocation(){ |
342 |
File getProjectLocation(){ |
255 |
File projectLocation = (File) mySettings |
343 |
File projectLocation = (File) getSettings() |
256 |
.getProperty(CustomComponentWizardIterator.PROJECT_DIR); |
344 |
.getProperty(CustomComponentWizardIterator.PROJECT_DIR); |
257 |
// project directory |
345 |
// project directory |
258 |
if (projectLocation == null |
346 |
if (projectLocation == null |
259 |
|| projectLocation.getParentFile() == null |
347 |
|| projectLocation.getParentFile() == null |
260 |
|| !projectLocation.getParentFile().isDirectory()) |
348 |
|| !projectLocation.getParentFile().isDirectory()) |
261 |
{ |
349 |
{ |
262 |
projectLocation = ProjectChooser.getProjectsFolder(); |
350 |
projectLocation = new File(computeInitialLocationValue()); |
263 |
} else { |
351 |
} else { |
264 |
projectLocation = projectLocation.getParentFile(); |
352 |
projectLocation = projectLocation.getParentFile(); |
265 |
} |
353 |
} |
266 |
return projectLocation; |
354 |
return projectLocation; |
267 |
} |
355 |
} |
268 |
|
356 |
|
|
|
357 |
private String computeInitialLocationValue(){ |
358 |
if (typeChooserPanel != null && isSuiteComponent()) { |
359 |
return computeLocationValue(getSelectedSuite()); |
360 |
} else { |
361 |
String path = ProjectChooser.getProjectsFolder().getAbsolutePath(); |
362 |
return computeLocationValue(path); |
363 |
} |
364 |
} |
365 |
|
366 |
private String computeLocationValue(String value) { |
367 |
if (value == null) { |
368 |
value = System.getProperty("user.home"); // NOI18N |
369 |
} |
370 |
File file = new File(value); |
371 |
if (!file.exists() && file.getParent() != null) { |
372 |
return computeLocationValue(file.getParent()); |
373 |
} else { |
374 |
return file.exists() ? value : System.getProperty("user.home"); // NOI18N |
375 |
} |
376 |
} |
377 |
|
378 |
private Boolean isSuiteComponent(){ |
379 |
if (getSettings() != null){ |
380 |
return ModuleTypePanel.isSuiteComponent(getSettings()); |
381 |
} |
382 |
return false; |
383 |
} |
384 |
|
385 |
private String getSelectedSuite(){ |
386 |
return ModuleTypePanel.getSuiteRoot(getSettings()); |
387 |
} |
388 |
|
269 |
/** |
389 |
/** |
270 |
* Returns project name value stored in WizardDescriptor, or |
390 |
* Returns project name value stored in WizardDescriptor, or |
271 |
* default value if it wasn't stored yet |
391 |
* default value if it wasn't stored yet |
Lines 274-280
Link Here
|
274 |
* name wich is not used as directory name in project location directory yet. |
394 |
* name wich is not used as directory name in project location directory yet. |
275 |
*/ |
395 |
*/ |
276 |
String getProjectName(){ |
396 |
String getProjectName(){ |
277 |
String projectName = (String) mySettings |
397 |
String projectName = (String) getSettings() |
278 |
.getProperty(CustomComponentWizardIterator.PROJECT_NAME); |
398 |
.getProperty(CustomComponentWizardIterator.PROJECT_NAME); |
279 |
// project name |
399 |
// project name |
280 |
if (projectName == null) { |
400 |
if (projectName == null) { |
Lines 284-290
Link Here
|
284 |
} |
404 |
} |
285 |
|
405 |
|
286 |
Boolean getIsMainProject(){ |
406 |
Boolean getIsMainProject(){ |
287 |
Boolean isMain = (Boolean) mySettings |
407 |
Boolean isMain = (Boolean) getSettings() |
288 |
.getProperty(CustomComponentWizardIterator.SET_AS_MAIN); |
408 |
.getProperty(CustomComponentWizardIterator.SET_AS_MAIN); |
289 |
return isMain; |
409 |
return isMain; |
290 |
} |
410 |
} |
Lines 304-324
Link Here
|
304 |
*/ |
424 |
*/ |
305 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
425 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
306 |
private void initComponents() { |
426 |
private void initComponents() { |
|
|
427 |
java.awt.GridBagConstraints gridBagConstraints; |
307 |
|
428 |
|
|
|
429 |
mainProject = new javax.swing.JCheckBox(); |
430 |
infoPanel = new javax.swing.JPanel(); |
308 |
projectNameLabel = new javax.swing.JLabel(); |
431 |
projectNameLabel = new javax.swing.JLabel(); |
309 |
projectNameTextField = new javax.swing.JTextField(); |
432 |
projectNameTextField = new javax.swing.JTextField(); |
|
|
433 |
createdFolderTextField = new javax.swing.JTextField(); |
310 |
projectLocationLabel = new javax.swing.JLabel(); |
434 |
projectLocationLabel = new javax.swing.JLabel(); |
|
|
435 |
createdFolderLabel = new javax.swing.JLabel(); |
311 |
projectLocationTextField = new javax.swing.JTextField(); |
436 |
projectLocationTextField = new javax.swing.JTextField(); |
312 |
browseButton = new javax.swing.JButton(); |
437 |
browseButton = new javax.swing.JButton(); |
313 |
createdFolderLabel = new javax.swing.JLabel(); |
438 |
typeChooserPanelContainer = new javax.swing.JPanel(); |
314 |
createdFolderTextField = new javax.swing.JTextField(); |
439 |
fillerPanel = new javax.swing.JPanel(); |
315 |
mainProject = new javax.swing.JCheckBox(); |
440 |
|
|
|
441 |
setLayout(new java.awt.GridBagLayout()); |
442 |
|
443 |
mainProject.setSelected(true); |
444 |
org.openide.awt.Mnemonics.setLocalizedText(mainProject, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_SetAsMainProject")); // NOI18N |
445 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
446 |
gridBagConstraints.gridx = 0; |
447 |
gridBagConstraints.gridy = 2; |
448 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
449 |
gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); |
450 |
add(mainProject, gridBagConstraints); |
451 |
mainProject.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSN_SetAsMainProject")); // NOI18N |
452 |
mainProject.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSD_SetAsMainProject")); // NOI18N |
453 |
|
454 |
infoPanel.setLayout(new java.awt.GridBagLayout()); |
316 |
|
455 |
|
317 |
projectNameLabel.setLabelFor(projectNameTextField); |
456 |
projectNameLabel.setLabelFor(projectNameTextField); |
318 |
org.openide.awt.Mnemonics.setLocalizedText(projectNameLabel, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_ProjectName")); // NOI18N |
457 |
org.openide.awt.Mnemonics.setLocalizedText(projectNameLabel, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_ProjectName")); // NOI18N |
|
|
458 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
459 |
gridBagConstraints.gridx = 0; |
460 |
gridBagConstraints.gridy = 0; |
461 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
462 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12); |
463 |
infoPanel.add(projectNameLabel, gridBagConstraints); |
464 |
projectNameLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSN_ProjectName")); // NOI18N |
465 |
projectNameLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSD_ProjectName")); // NOI18N |
466 |
|
467 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
468 |
gridBagConstraints.gridx = 1; |
469 |
gridBagConstraints.gridy = 0; |
470 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
471 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
472 |
gridBagConstraints.weightx = 1.0; |
473 |
infoPanel.add(projectNameTextField, gridBagConstraints); |
474 |
|
475 |
createdFolderTextField.setEditable(false); |
476 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
477 |
gridBagConstraints.gridx = 1; |
478 |
gridBagConstraints.gridy = 2; |
479 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
480 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
481 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 6, 0); |
482 |
infoPanel.add(createdFolderTextField, gridBagConstraints); |
319 |
|
483 |
|
320 |
projectLocationLabel.setLabelFor(projectLocationTextField); |
484 |
projectLocationLabel.setLabelFor(projectLocationTextField); |
321 |
org.openide.awt.Mnemonics.setLocalizedText(projectLocationLabel, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_ProjectLocation")); // NOI18N |
485 |
org.openide.awt.Mnemonics.setLocalizedText(projectLocationLabel, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_ProjectLocation")); // NOI18N |
|
|
486 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
487 |
gridBagConstraints.gridx = 0; |
488 |
gridBagConstraints.gridy = 1; |
489 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
490 |
gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 12); |
491 |
infoPanel.add(projectLocationLabel, gridBagConstraints); |
492 |
projectLocationLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSN_ProjectLocation")); // NOI18N |
493 |
projectLocationLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSD_ProjectLocation")); // NOI18N |
494 |
|
495 |
createdFolderLabel.setLabelFor(createdFolderTextField); |
496 |
org.openide.awt.Mnemonics.setLocalizedText(createdFolderLabel, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_ProjectFolder")); // NOI18N |
497 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
498 |
gridBagConstraints.gridx = 0; |
499 |
gridBagConstraints.gridy = 2; |
500 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
501 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 6, 12); |
502 |
infoPanel.add(createdFolderLabel, gridBagConstraints); |
503 |
createdFolderLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSN_ProjectFolder")); // NOI18N |
504 |
createdFolderLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSD_ProjectFolder")); // NOI18N |
505 |
|
506 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
507 |
gridBagConstraints.gridx = 1; |
508 |
gridBagConstraints.gridy = 1; |
509 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
510 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
511 |
gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 0); |
512 |
infoPanel.add(projectLocationTextField, gridBagConstraints); |
322 |
|
513 |
|
323 |
org.openide.awt.Mnemonics.setLocalizedText(browseButton, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_Browse_Button")); // NOI18N |
514 |
org.openide.awt.Mnemonics.setLocalizedText(browseButton, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_Browse_Button")); // NOI18N |
324 |
browseButton.setActionCommand(BROWSE); |
515 |
browseButton.setActionCommand(BROWSE); |
Lines 327-392
Link Here
|
327 |
browseButtonActionPerformed(evt); |
518 |
browseButtonActionPerformed(evt); |
328 |
} |
519 |
} |
329 |
}); |
520 |
}); |
330 |
|
521 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
331 |
createdFolderLabel.setLabelFor(createdFolderTextField); |
522 |
gridBagConstraints.gridx = 2; |
332 |
org.openide.awt.Mnemonics.setLocalizedText(createdFolderLabel, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_ProjectFolder")); // NOI18N |
523 |
gridBagConstraints.gridy = 1; |
333 |
|
524 |
gridBagConstraints.insets = new java.awt.Insets(6, 12, 6, 0); |
334 |
createdFolderTextField.setEditable(false); |
525 |
infoPanel.add(browseButton, gridBagConstraints); |
335 |
|
|
|
336 |
mainProject.setSelected(true); |
337 |
org.openide.awt.Mnemonics.setLocalizedText(mainProject, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_SetAsMainProject")); // NOI18N |
338 |
|
339 |
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); |
340 |
this.setLayout(layout); |
341 |
layout.setHorizontalGroup( |
342 |
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
343 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() |
344 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) |
345 |
.add(org.jdesktop.layout.GroupLayout.LEADING, mainProject, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE) |
346 |
.add(layout.createSequentialGroup() |
347 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
348 |
.add(projectLocationLabel) |
349 |
.add(createdFolderLabel) |
350 |
.add(projectNameLabel)) |
351 |
.add(19, 19, 19) |
352 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
353 |
.add(projectNameTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 441, Short.MAX_VALUE) |
354 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, projectLocationTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 441, Short.MAX_VALUE) |
355 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, createdFolderTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 441, Short.MAX_VALUE)))) |
356 |
.add(18, 18, 18) |
357 |
.add(browseButton) |
358 |
.add(0, 0, 0)) |
359 |
); |
360 |
layout.setVerticalGroup( |
361 |
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
362 |
.add(layout.createSequentialGroup() |
363 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
364 |
.add(projectNameLabel) |
365 |
.add(projectNameTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
366 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
367 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
368 |
.add(projectLocationTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
369 |
.add(projectLocationLabel) |
370 |
.add(browseButton)) |
371 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
372 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
373 |
.add(createdFolderTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
374 |
.add(createdFolderLabel)) |
375 |
.add(18, 18, 18) |
376 |
.add(mainProject) |
377 |
.addContainerGap(183, Short.MAX_VALUE)) |
378 |
); |
379 |
|
380 |
projectNameLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSN_ProjectName")); // NOI18N |
381 |
projectNameLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSD_ProjectName")); // NOI18N |
382 |
projectLocationLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSN_ProjectLocation")); // NOI18N |
383 |
projectLocationLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSD_ProjectLocation")); // NOI18N |
384 |
browseButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSN_Browse_Button")); // NOI18N |
526 |
browseButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSN_Browse_Button")); // NOI18N |
385 |
browseButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSN_Browse_Button")); // NOI18N |
527 |
browseButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSN_Browse_Button")); // NOI18N |
386 |
createdFolderLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSN_ProjectFolder")); // NOI18N |
528 |
|
387 |
createdFolderLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSD_ProjectFolder")); // NOI18N |
529 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
388 |
mainProject.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSN_SetAsMainProject")); // NOI18N |
530 |
gridBagConstraints.gridx = 0; |
389 |
mainProject.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSD_SetAsMainProject")); // NOI18N |
531 |
gridBagConstraints.gridy = 0; |
|
|
532 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
533 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
534 |
add(infoPanel, gridBagConstraints); |
535 |
|
536 |
typeChooserPanelContainer.setLayout(new java.awt.BorderLayout()); |
537 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
538 |
gridBagConstraints.gridx = 0; |
539 |
gridBagConstraints.gridy = 1; |
540 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
541 |
add(typeChooserPanelContainer, gridBagConstraints); |
542 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
543 |
gridBagConstraints.gridx = 0; |
544 |
gridBagConstraints.gridy = 3; |
545 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
546 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
547 |
gridBagConstraints.weightx = 1.0; |
548 |
gridBagConstraints.weighty = 1.0; |
549 |
add(fillerPanel, gridBagConstraints); |
390 |
}// </editor-fold>//GEN-END:initComponents |
550 |
}// </editor-fold>//GEN-END:initComponents |
391 |
|
551 |
|
392 |
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed |
552 |
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed |
Lines 405-412
Link Here
|
405 |
} |
565 |
} |
406 |
if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) { |
566 |
if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) { |
407 |
File projectDir = chooser.getSelectedFile();//GEN-LAST:event_browseButtonActionPerformed |
567 |
File projectDir = chooser.getSelectedFile();//GEN-LAST:event_browseButtonActionPerformed |
408 |
projectLocationTextField.setText( |
568 |
String projectDirPath = FileUtil.normalizeFile(projectDir).getAbsolutePath(); |
409 |
FileUtil.normalizeFile(projectDir).getAbsolutePath()); |
569 |
projectLocationTextField.setText(computeLocationValue(projectDirPath)); |
410 |
} |
570 |
} |
411 |
//myPanel.fireChangeEvent(); |
571 |
//myPanel.fireChangeEvent(); |
412 |
} |
572 |
} |
Lines 424-434
Link Here
|
424 |
private javax.swing.JButton browseButton; |
584 |
private javax.swing.JButton browseButton; |
425 |
private javax.swing.JLabel createdFolderLabel; |
585 |
private javax.swing.JLabel createdFolderLabel; |
426 |
private javax.swing.JTextField createdFolderTextField; |
586 |
private javax.swing.JTextField createdFolderTextField; |
|
|
587 |
private javax.swing.JPanel fillerPanel; |
588 |
private javax.swing.JPanel infoPanel; |
427 |
private javax.swing.JCheckBox mainProject; |
589 |
private javax.swing.JCheckBox mainProject; |
428 |
private javax.swing.JLabel projectLocationLabel; |
590 |
private javax.swing.JLabel projectLocationLabel; |
429 |
private javax.swing.JTextField projectLocationTextField; |
591 |
private javax.swing.JTextField projectLocationTextField; |
430 |
private javax.swing.JLabel projectNameLabel; |
592 |
private javax.swing.JLabel projectNameLabel; |
431 |
private javax.swing.JTextField projectNameTextField; |
593 |
private javax.swing.JTextField projectNameTextField; |
|
|
594 |
private javax.swing.JPanel typeChooserPanelContainer; |
432 |
// End of variables declaration//GEN-END:variables |
595 |
// End of variables declaration//GEN-END:variables |
433 |
|
596 |
|
434 |
// TODO: use FileUtil.findFreeFolderName here |
597 |
// TODO: use FileUtil.findFreeFolderName here |
Lines 464-478
Link Here
|
464 |
String projectName = projectNameTextField.getText(); |
627 |
String projectName = projectNameTextField.getText(); |
465 |
String projectFolder = projectLocationTextField.getText(); |
628 |
String projectFolder = projectLocationTextField.getText(); |
466 |
|
629 |
|
467 |
//if (projectFolder.trim().length() == 0 || projectFolder.equals(oldName)) { |
|
|
468 |
createdFolderTextField.setText(projectFolder + File.separatorChar + projectName); |
630 |
createdFolderTextField.setText(projectFolder + File.separatorChar + projectName); |
469 |
//} |
631 |
projectFolderChanged(getCreatedFolderValue()); |
470 |
|
632 |
|
471 |
} |
633 |
} |
472 |
//myPanel.fireChangeEvent(); // Notify that the myPanel changed |
634 |
} |
|
|
635 |
|
636 |
private void projectFolderChanged(String projectFolder){ |
637 |
File folder = FileUtil.normalizeFile(new File(projectFolder)); |
638 |
ModuleTypePanel.setProjectFolder(getSettings(), folder); |
639 |
} |
473 |
|
640 |
|
|
|
641 |
private WizardDescriptor getSettings(){ |
642 |
return mySettings; |
474 |
} |
643 |
} |
475 |
|
644 |
|
476 |
private WizardDescriptor mySettings; |
645 |
private WizardDescriptor mySettings; |
477 |
private CustomComponentWizardPanel myPanel; |
646 |
private CustomComponentWizardPanel myPanel; |
|
|
647 |
private JComponent typeChooserPanel; |
648 |
private boolean locationUpdated; |
649 |
private boolean mainProjectTouched; |
650 |
|
651 |
private boolean listenersAttached; |
652 |
private DocumentListener nameDL; |
653 |
private DocumentListener locationDL; |
654 |
private ActionListener isMainAL; |
478 |
} |
655 |
} |