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; |
46 |
import javax.swing.JFileChooser; |
52 |
import javax.swing.JFileChooser; |
47 |
import javax.swing.JPanel; |
53 |
import javax.swing.JPanel; |
48 |
import javax.swing.event.DocumentEvent; |
54 |
import javax.swing.event.DocumentEvent; |
49 |
import javax.swing.event.DocumentListener; |
55 |
import javax.swing.event.DocumentListener; |
50 |
import javax.swing.text.Document; |
56 |
import javax.swing.text.Document; |
|
|
57 |
import org.netbeans.modules.apisupport.project.ui.wizard.spi.ModuleTypePanelCreator; |
58 |
import org.netbeans.modules.apisupport.project.ui.wizard.spi.ModuleTypePanelCreator.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 76-111
Link Here
|
76 |
|
84 |
|
77 |
public CustomComponentVisualPanel(CustomComponentWizardPanel panel) { |
85 |
public CustomComponentVisualPanel(CustomComponentWizardPanel panel) { |
78 |
initComponents(); |
86 |
initComponents(); |
|
|
87 |
initPanels(); |
79 |
this.myPanel = panel; |
88 |
this.myPanel = panel; |
|
|
89 |
|
80 |
putClientProperty("NewProjectWizard_Title", NbBundle.getMessage(CustomComponentVisualPanel.class, "TXT_MobileDesigner")); |
90 |
putClientProperty("NewProjectWizard_Title", NbBundle.getMessage(CustomComponentVisualPanel.class, "TXT_MobileDesigner")); |
81 |
// Register listener on the textFields to make the automatic updates |
91 |
initDocumentListeners(); |
82 |
projectNameTextField.getDocument().addDocumentListener(this); |
92 |
attachDocumentListeners(); |
83 |
projectLocationTextField.getDocument().addDocumentListener(this); |
|
|
84 |
|
93 |
|
85 |
initAccessibility();; |
94 |
initAccessibility(); |
86 |
} |
95 |
} |
87 |
|
96 |
|
88 |
@Override |
97 |
@Override |
89 |
public void addNotify() { |
98 |
public void addNotify() { |
90 |
super.addNotify(); |
99 |
super.addNotify(); |
|
|
100 |
attachDocumentListeners(); |
91 |
//same problem as in 31086, initial focus on Cancel button |
101 |
//same problem as in 31086, initial focus on Cancel button |
92 |
projectNameTextField.requestFocus(); |
102 |
projectNameTextField.requestFocus(); |
93 |
} |
103 |
} |
94 |
|
104 |
|
95 |
// Implementation of DocumentListener -------------------------------------- |
105 |
@Override |
96 |
public void changedUpdate(DocumentEvent e) { |
106 |
public void removeNotify() { |
97 |
updateTexts(e); |
107 |
// prevent checking when the panel is not "active" |
98 |
checkValidity(); |
108 |
removeDocumentListeners(); |
|
|
109 |
super.removeNotify(); |
99 |
} |
110 |
} |
100 |
|
|
|
101 |
public void insertUpdate(DocumentEvent e) { |
102 |
changedUpdate(e); |
103 |
} |
104 |
|
105 |
public void removeUpdate(DocumentEvent e) { |
106 |
changedUpdate(e); |
107 |
} |
108 |
// ------------- |
109 |
|
111 |
|
110 |
void store(WizardDescriptor d) { |
112 |
void store(WizardDescriptor d) { |
111 |
String name = projectNameTextField.getText().trim(); |
113 |
String name = projectNameTextField.getText().trim(); |
Lines 118-130
Link Here
|
118 |
} |
120 |
} |
119 |
|
121 |
|
120 |
void read(WizardDescriptor settings) { |
122 |
void read(WizardDescriptor settings) { |
121 |
mySettings = settings; |
123 |
if (mySettings == null){ |
|
|
124 |
mySettings = settings; |
125 |
mySettings.addPropertyChangeListener(new PropertyChangeListener() { |
126 |
|
127 |
public void propertyChange(PropertyChangeEvent evt) { |
128 |
String name = evt.getPropertyName(); |
129 |
Object value = evt.getNewValue(); |
130 |
|
131 |
if (ModuleTypePanel.IS_STANDALONE_OR_SUITE_COMPONENT.equals(name)) { |
132 |
moduletypeChanged(value); |
133 |
} else if (ModuleTypePanel.SUITE_ROOT.equals(name)) { |
134 |
moduleSuiteValueChanged(value); |
135 |
} else if (ModuleTypePanel.ACTIVE_PLATFORM.equals(name)){ |
136 |
checkValidity(); |
137 |
} |
138 |
} |
139 |
}); |
140 |
} |
141 |
|
142 |
//typeChooserPanel.read(mySettings); |
143 |
// invoke store to have changes in mySettings |
144 |
//typeChooserPanel.store(mySettings); |
122 |
|
145 |
|
123 |
if (getIsMainProject() != null){ |
146 |
if (getIsMainProject() != null){ |
124 |
this.mainProject.setSelected(getIsMainProject()); |
147 |
this.mainProject.setSelected(getIsMainProject()); |
125 |
} |
148 |
} |
126 |
this.projectLocationTextField.setText( |
149 |
setLocation(getProjectLocation().getAbsolutePath()); |
127 |
getProjectLocation().getAbsolutePath()); |
|
|
128 |
|
150 |
|
129 |
this.projectNameTextField.setText(getProjectName()); |
151 |
this.projectNameTextField.setText(getProjectName()); |
130 |
this.projectNameTextField.selectAll(); |
152 |
this.projectNameTextField.selectAll(); |
Lines 134-139
Link Here
|
134 |
return new HelpCtx(CustomComponentVisualPanel.class); |
156 |
return new HelpCtx(CustomComponentVisualPanel.class); |
135 |
} |
157 |
} |
136 |
|
158 |
|
|
|
159 |
private void initDocumentListeners() { |
160 |
nameDL = new DocumentAdapter() { |
161 |
public void insertUpdate(DocumentEvent e) { |
162 |
updateTexts(e); |
163 |
checkValidity(); |
164 |
} |
165 |
}; |
166 |
locationDL = new DocumentAdapter() { |
167 |
public void insertUpdate(DocumentEvent e) { |
168 |
locationUpdated = true; |
169 |
updateTexts(e); |
170 |
checkValidity(); |
171 |
} |
172 |
}; |
173 |
isMainAL = new ActionListener() { |
174 |
public void actionPerformed(ActionEvent e) { |
175 |
mainProjectTouched = true; |
176 |
} |
177 |
}; |
178 |
} |
179 |
|
180 |
private void attachDocumentListeners() { |
181 |
if (!listenersAttached) { |
182 |
projectNameTextField.getDocument().addDocumentListener(nameDL); |
183 |
projectLocationTextField.getDocument().addDocumentListener(locationDL); |
184 |
mainProject.addActionListener(isMainAL); |
185 |
listenersAttached = true; |
186 |
} |
187 |
} |
188 |
|
189 |
private void removeDocumentListeners() { |
190 |
if (listenersAttached) { |
191 |
projectNameTextField.getDocument().removeDocumentListener(nameDL); |
192 |
projectLocationTextField.getDocument().removeDocumentListener(locationDL); |
193 |
mainProject.removeActionListener(isMainAL); |
194 |
listenersAttached = false; |
195 |
} |
196 |
} |
197 |
|
198 |
private void initPanels(){ |
199 |
if (typeChooserPanel != null){ |
200 |
typeChooserPanelContainer.removeAll(); |
201 |
typeChooserPanel = null; |
202 |
} |
203 |
typeChooserPanel = ModuleTypePanelCreator.create(); |
204 |
Component component = typeChooserPanel.getComponent(); |
205 |
typeChooserPanelContainer.add(component, BorderLayout.CENTER); |
206 |
typeChooserPanelContainer.validate(); |
207 |
validate(); |
208 |
} |
209 |
|
210 |
private void moduleSuiteValueChanged(Object val) { |
211 |
String suite = null; |
212 |
if (val != null && val instanceof String){ |
213 |
suite = (String)val; |
214 |
} |
215 |
if (!locationUpdated) { |
216 |
setLocation(computeLocationValue(suite)); |
217 |
} |
218 |
checkValidity(); |
219 |
} |
220 |
|
221 |
private void moduletypeChanged(Object val) { |
222 |
Boolean isStandAlone = null; |
223 |
if (val != null && val instanceof Boolean){ |
224 |
isStandAlone = ((Boolean)val).booleanValue(); |
225 |
} |
226 |
// null means both radio uttons are deselected and disaled |
227 |
if (isStandAlone == null){ |
228 |
return; |
229 |
} |
230 |
|
231 |
if (!mainProjectTouched) { |
232 |
mainProject.setSelected(isStandAlone); |
233 |
} |
234 |
if (!locationUpdated) { |
235 |
setLocation(computeInitialLocationValue()); |
236 |
} |
237 |
checkValidity(); |
238 |
} |
239 |
|
240 |
private void setLocation(String location) { |
241 |
boolean revert = !locationUpdated; |
242 |
projectLocationTextField.setText(location); |
243 |
locationUpdated = revert ^ true; |
244 |
} |
245 |
|
246 |
boolean checkValidity() { |
247 |
if (!isProjectNameValid()){ |
248 |
return false; |
249 |
} else if (!isProjectLocationValid()){ |
250 |
return false; |
251 |
} else if (!isCreatedFolderValid()){ |
252 |
return false; |
253 |
} else if (!typeChooserPanel.validate(getSettings())){ |
254 |
return false; |
255 |
} |
256 |
|
257 |
markValid(); |
258 |
return true; |
259 |
} |
260 |
|
137 |
private boolean isProjectNameValid(){ |
261 |
private boolean isProjectNameValid(){ |
138 |
if (getProjectNameValue().trim().length() == 0) { |
262 |
if (getProjectNameValue().trim().length() == 0) { |
139 |
setError(getMessage(MSG_NAME_CANNOT_BE_EMPTY)); |
263 |
setError(getMessage(MSG_NAME_CANNOT_BE_EMPTY)); |
Lines 187-207
Link Here
|
187 |
return true; |
311 |
return true; |
188 |
} |
312 |
} |
189 |
|
313 |
|
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(){ |
314 |
private String getProjectNameValue(){ |
206 |
return projectNameTextField.getText(); |
315 |
return projectNameTextField.getText(); |
207 |
} |
316 |
} |
Lines 232-238
Link Here
|
232 |
} |
341 |
} |
233 |
|
342 |
|
234 |
private final void setMessage(String message) { |
343 |
private final void setMessage(String message) { |
235 |
mySettings.putProperty( |
344 |
getSettings().putProperty( |
236 |
CustomComponentWizardIterator.WIZARD_PANEL_ERROR_MESSAGE, |
345 |
CustomComponentWizardIterator.WIZARD_PANEL_ERROR_MESSAGE, |
237 |
message); |
346 |
message); |
238 |
} |
347 |
} |
Lines 252-271
Link Here
|
252 |
* @return File Directory that will contain project folder |
361 |
* @return File Directory that will contain project folder |
253 |
*/ |
362 |
*/ |
254 |
File getProjectLocation(){ |
363 |
File getProjectLocation(){ |
255 |
File projectLocation = (File) mySettings |
364 |
File projectLocation = (File) getSettings() |
256 |
.getProperty(CustomComponentWizardIterator.PROJECT_DIR); |
365 |
.getProperty(CustomComponentWizardIterator.PROJECT_DIR); |
257 |
// project directory |
366 |
// project directory |
258 |
if (projectLocation == null |
367 |
if (projectLocation == null |
259 |
|| projectLocation.getParentFile() == null |
368 |
|| projectLocation.getParentFile() == null |
260 |
|| !projectLocation.getParentFile().isDirectory()) |
369 |
|| !projectLocation.getParentFile().isDirectory()) |
261 |
{ |
370 |
{ |
262 |
projectLocation = ProjectChooser.getProjectsFolder(); |
371 |
projectLocation = new File(computeInitialLocationValue()); |
263 |
} else { |
372 |
} else { |
264 |
projectLocation = projectLocation.getParentFile(); |
373 |
projectLocation = projectLocation.getParentFile(); |
265 |
} |
374 |
} |
266 |
return projectLocation; |
375 |
return projectLocation; |
267 |
} |
376 |
} |
268 |
|
377 |
|
|
|
378 |
private String computeInitialLocationValue(){ |
379 |
boolean ddd = isSuiteComponent(); |
380 |
if (typeChooserPanel != null && isSuiteComponent()) { |
381 |
return computeLocationValue(getSelectedSuite()); |
382 |
} else { |
383 |
String path = ProjectChooser.getProjectsFolder().getAbsolutePath(); |
384 |
return computeLocationValue(path); |
385 |
} |
386 |
} |
387 |
|
388 |
private String computeLocationValue(String value) { |
389 |
if (value == null) { |
390 |
value = System.getProperty("user.home"); // NOI18N |
391 |
} |
392 |
File file = new File(value); |
393 |
if (!file.exists() && file.getParent() != null) { |
394 |
return computeLocationValue(file.getParent()); |
395 |
} else { |
396 |
return file.exists() ? value : System.getProperty("user.home"); // NOI18N |
397 |
} |
398 |
} |
399 |
|
400 |
private Boolean isSuiteComponent(){ |
401 |
Boolean result = null; |
402 |
if (getSettings() != null){ |
403 |
result = (Boolean) getSettings().getProperty( |
404 |
ModuleTypePanel.IS_STANDALONE_OR_SUITE_COMPONENT); |
405 |
} |
406 |
return result != null ? !result : false; |
407 |
} |
408 |
|
409 |
private String getSelectedSuite(){ |
410 |
return (String)getSettings().getProperty(ModuleTypePanel.SUITE_ROOT); |
411 |
} |
412 |
|
269 |
/** |
413 |
/** |
270 |
* Returns project name value stored in WizardDescriptor, or |
414 |
* Returns project name value stored in WizardDescriptor, or |
271 |
* default value if it wasn't stored yet |
415 |
* 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. |
418 |
* name wich is not used as directory name in project location directory yet. |
275 |
*/ |
419 |
*/ |
276 |
String getProjectName(){ |
420 |
String getProjectName(){ |
277 |
String projectName = (String) mySettings |
421 |
String projectName = (String) getSettings() |
278 |
.getProperty(CustomComponentWizardIterator.PROJECT_NAME); |
422 |
.getProperty(CustomComponentWizardIterator.PROJECT_NAME); |
279 |
// project name |
423 |
// project name |
280 |
if (projectName == null) { |
424 |
if (projectName == null) { |
Lines 284-290
Link Here
|
284 |
} |
428 |
} |
285 |
|
429 |
|
286 |
Boolean getIsMainProject(){ |
430 |
Boolean getIsMainProject(){ |
287 |
Boolean isMain = (Boolean) mySettings |
431 |
Boolean isMain = (Boolean) getSettings() |
288 |
.getProperty(CustomComponentWizardIterator.SET_AS_MAIN); |
432 |
.getProperty(CustomComponentWizardIterator.SET_AS_MAIN); |
289 |
return isMain; |
433 |
return isMain; |
290 |
} |
434 |
} |
Lines 304-324
Link Here
|
304 |
*/ |
448 |
*/ |
305 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
449 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
306 |
private void initComponents() { |
450 |
private void initComponents() { |
|
|
451 |
java.awt.GridBagConstraints gridBagConstraints; |
307 |
|
452 |
|
|
|
453 |
mainProject = new javax.swing.JCheckBox(); |
454 |
infoPanel = new javax.swing.JPanel(); |
308 |
projectNameLabel = new javax.swing.JLabel(); |
455 |
projectNameLabel = new javax.swing.JLabel(); |
309 |
projectNameTextField = new javax.swing.JTextField(); |
456 |
projectNameTextField = new javax.swing.JTextField(); |
|
|
457 |
createdFolderTextField = new javax.swing.JTextField(); |
310 |
projectLocationLabel = new javax.swing.JLabel(); |
458 |
projectLocationLabel = new javax.swing.JLabel(); |
|
|
459 |
createdFolderLabel = new javax.swing.JLabel(); |
311 |
projectLocationTextField = new javax.swing.JTextField(); |
460 |
projectLocationTextField = new javax.swing.JTextField(); |
312 |
browseButton = new javax.swing.JButton(); |
461 |
browseButton = new javax.swing.JButton(); |
313 |
createdFolderLabel = new javax.swing.JLabel(); |
462 |
typeChooserPanelContainer = new javax.swing.JPanel(); |
314 |
createdFolderTextField = new javax.swing.JTextField(); |
463 |
fillerPanel = new javax.swing.JPanel(); |
315 |
mainProject = new javax.swing.JCheckBox(); |
464 |
|
|
|
465 |
setLayout(new java.awt.GridBagLayout()); |
466 |
|
467 |
mainProject.setSelected(true); |
468 |
org.openide.awt.Mnemonics.setLocalizedText(mainProject, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_SetAsMainProject")); // NOI18N |
469 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
470 |
gridBagConstraints.gridx = 0; |
471 |
gridBagConstraints.gridy = 2; |
472 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
473 |
gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); |
474 |
add(mainProject, gridBagConstraints); |
475 |
mainProject.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSN_SetAsMainProject")); // NOI18N |
476 |
mainProject.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSD_SetAsMainProject")); // NOI18N |
477 |
|
478 |
infoPanel.setLayout(new java.awt.GridBagLayout()); |
316 |
|
479 |
|
317 |
projectNameLabel.setLabelFor(projectNameTextField); |
480 |
projectNameLabel.setLabelFor(projectNameTextField); |
318 |
org.openide.awt.Mnemonics.setLocalizedText(projectNameLabel, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_ProjectName")); // NOI18N |
481 |
org.openide.awt.Mnemonics.setLocalizedText(projectNameLabel, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_ProjectName")); // NOI18N |
|
|
482 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
483 |
gridBagConstraints.gridx = 0; |
484 |
gridBagConstraints.gridy = 0; |
485 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
486 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12); |
487 |
infoPanel.add(projectNameLabel, gridBagConstraints); |
488 |
projectNameLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSN_ProjectName")); // NOI18N |
489 |
projectNameLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSD_ProjectName")); // NOI18N |
490 |
|
491 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
492 |
gridBagConstraints.gridx = 1; |
493 |
gridBagConstraints.gridy = 0; |
494 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
495 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
496 |
gridBagConstraints.weightx = 1.0; |
497 |
infoPanel.add(projectNameTextField, gridBagConstraints); |
498 |
|
499 |
createdFolderTextField.setEditable(false); |
500 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
501 |
gridBagConstraints.gridx = 1; |
502 |
gridBagConstraints.gridy = 2; |
503 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
504 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
505 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 6, 0); |
506 |
infoPanel.add(createdFolderTextField, gridBagConstraints); |
319 |
|
507 |
|
320 |
projectLocationLabel.setLabelFor(projectLocationTextField); |
508 |
projectLocationLabel.setLabelFor(projectLocationTextField); |
321 |
org.openide.awt.Mnemonics.setLocalizedText(projectLocationLabel, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_ProjectLocation")); // NOI18N |
509 |
org.openide.awt.Mnemonics.setLocalizedText(projectLocationLabel, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_ProjectLocation")); // NOI18N |
|
|
510 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
511 |
gridBagConstraints.gridx = 0; |
512 |
gridBagConstraints.gridy = 1; |
513 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
514 |
gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 12); |
515 |
infoPanel.add(projectLocationLabel, gridBagConstraints); |
516 |
projectLocationLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSN_ProjectLocation")); // NOI18N |
517 |
projectLocationLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSD_ProjectLocation")); // NOI18N |
518 |
|
519 |
createdFolderLabel.setLabelFor(createdFolderTextField); |
520 |
org.openide.awt.Mnemonics.setLocalizedText(createdFolderLabel, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_ProjectFolder")); // NOI18N |
521 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
522 |
gridBagConstraints.gridx = 0; |
523 |
gridBagConstraints.gridy = 2; |
524 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
525 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 6, 12); |
526 |
infoPanel.add(createdFolderLabel, gridBagConstraints); |
527 |
createdFolderLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSN_ProjectFolder")); // NOI18N |
528 |
createdFolderLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSD_ProjectFolder")); // NOI18N |
529 |
|
530 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
531 |
gridBagConstraints.gridx = 1; |
532 |
gridBagConstraints.gridy = 1; |
533 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
534 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
535 |
gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 0); |
536 |
infoPanel.add(projectLocationTextField, gridBagConstraints); |
322 |
|
537 |
|
323 |
org.openide.awt.Mnemonics.setLocalizedText(browseButton, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_Browse_Button")); // NOI18N |
538 |
org.openide.awt.Mnemonics.setLocalizedText(browseButton, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_Browse_Button")); // NOI18N |
324 |
browseButton.setActionCommand(BROWSE); |
539 |
browseButton.setActionCommand(BROWSE); |
Lines 327-392
Link Here
|
327 |
browseButtonActionPerformed(evt); |
542 |
browseButtonActionPerformed(evt); |
328 |
} |
543 |
} |
329 |
}); |
544 |
}); |
330 |
|
545 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
331 |
createdFolderLabel.setLabelFor(createdFolderTextField); |
546 |
gridBagConstraints.gridx = 2; |
332 |
org.openide.awt.Mnemonics.setLocalizedText(createdFolderLabel, org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "LBL_ProjectFolder")); // NOI18N |
547 |
gridBagConstraints.gridy = 1; |
333 |
|
548 |
gridBagConstraints.insets = new java.awt.Insets(6, 12, 6, 0); |
334 |
createdFolderTextField.setEditable(false); |
549 |
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 |
550 |
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 |
551 |
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 |
552 |
|
387 |
createdFolderLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSD_ProjectFolder")); // NOI18N |
553 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
388 |
mainProject.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSN_SetAsMainProject")); // NOI18N |
554 |
gridBagConstraints.gridx = 0; |
389 |
mainProject.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomComponentVisualPanel.class, "ACSD_SetAsMainProject")); // NOI18N |
555 |
gridBagConstraints.gridy = 0; |
|
|
556 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
557 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
558 |
add(infoPanel, gridBagConstraints); |
559 |
|
560 |
typeChooserPanelContainer.setLayout(new java.awt.BorderLayout()); |
561 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
562 |
gridBagConstraints.gridx = 0; |
563 |
gridBagConstraints.gridy = 1; |
564 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
565 |
add(typeChooserPanelContainer, gridBagConstraints); |
566 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
567 |
gridBagConstraints.gridx = 0; |
568 |
gridBagConstraints.gridy = 3; |
569 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
570 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
571 |
gridBagConstraints.weightx = 1.0; |
572 |
gridBagConstraints.weighty = 1.0; |
573 |
add(fillerPanel, gridBagConstraints); |
390 |
}// </editor-fold>//GEN-END:initComponents |
574 |
}// </editor-fold>//GEN-END:initComponents |
391 |
|
575 |
|
392 |
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed |
576 |
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed |
Lines 405-412
Link Here
|
405 |
} |
589 |
} |
406 |
if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) { |
590 |
if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) { |
407 |
File projectDir = chooser.getSelectedFile();//GEN-LAST:event_browseButtonActionPerformed |
591 |
File projectDir = chooser.getSelectedFile();//GEN-LAST:event_browseButtonActionPerformed |
408 |
projectLocationTextField.setText( |
592 |
String projectDirPath = FileUtil.normalizeFile(projectDir).getAbsolutePath(); |
409 |
FileUtil.normalizeFile(projectDir).getAbsolutePath()); |
593 |
projectLocationTextField.setText(computeLocationValue(projectDirPath)); |
410 |
} |
594 |
} |
411 |
//myPanel.fireChangeEvent(); |
595 |
//myPanel.fireChangeEvent(); |
412 |
} |
596 |
} |
Lines 424-434
Link Here
|
424 |
private javax.swing.JButton browseButton; |
608 |
private javax.swing.JButton browseButton; |
425 |
private javax.swing.JLabel createdFolderLabel; |
609 |
private javax.swing.JLabel createdFolderLabel; |
426 |
private javax.swing.JTextField createdFolderTextField; |
610 |
private javax.swing.JTextField createdFolderTextField; |
|
|
611 |
private javax.swing.JPanel fillerPanel; |
612 |
private javax.swing.JPanel infoPanel; |
427 |
private javax.swing.JCheckBox mainProject; |
613 |
private javax.swing.JCheckBox mainProject; |
428 |
private javax.swing.JLabel projectLocationLabel; |
614 |
private javax.swing.JLabel projectLocationLabel; |
429 |
private javax.swing.JTextField projectLocationTextField; |
615 |
private javax.swing.JTextField projectLocationTextField; |
430 |
private javax.swing.JLabel projectNameLabel; |
616 |
private javax.swing.JLabel projectNameLabel; |
431 |
private javax.swing.JTextField projectNameTextField; |
617 |
private javax.swing.JTextField projectNameTextField; |
|
|
618 |
private javax.swing.JPanel typeChooserPanelContainer; |
432 |
// End of variables declaration//GEN-END:variables |
619 |
// End of variables declaration//GEN-END:variables |
433 |
|
620 |
|
434 |
// TODO: use FileUtil.findFreeFolderName here |
621 |
// TODO: use FileUtil.findFreeFolderName here |
Lines 464-478
Link Here
|
464 |
String projectName = projectNameTextField.getText(); |
651 |
String projectName = projectNameTextField.getText(); |
465 |
String projectFolder = projectLocationTextField.getText(); |
652 |
String projectFolder = projectLocationTextField.getText(); |
466 |
|
653 |
|
467 |
//if (projectFolder.trim().length() == 0 || projectFolder.equals(oldName)) { |
|
|
468 |
createdFolderTextField.setText(projectFolder + File.separatorChar + projectName); |
654 |
createdFolderTextField.setText(projectFolder + File.separatorChar + projectName); |
469 |
//} |
655 |
projectFolderChanged(getCreatedFolderValue()); |
|
|
656 |
typeChooserPanel.setProjectFolder(getSettings()); |
470 |
|
657 |
|
471 |
} |
658 |
} |
472 |
//myPanel.fireChangeEvent(); // Notify that the myPanel changed |
659 |
//myPanel.fireChangeEvent(); // Notify that the myPanel changed |
473 |
|
660 |
|
474 |
} |
661 |
} |
|
|
662 |
|
663 |
private void projectFolderChanged(String projectFolder){ |
664 |
File folder = FileUtil.normalizeFile(new File(projectFolder)); |
665 |
getSettings().putProperty(ModuleTypePanel.PROJECT_FOLDER, folder); |
666 |
} |
667 |
|
668 |
private WizardDescriptor getSettings(){ |
669 |
return mySettings; |
670 |
} |
475 |
|
671 |
|
476 |
private WizardDescriptor mySettings; |
672 |
private WizardDescriptor mySettings; |
477 |
private CustomComponentWizardPanel myPanel; |
673 |
private CustomComponentWizardPanel myPanel; |
|
|
674 |
private ModuleTypePanel typeChooserPanel; |
675 |
private boolean locationUpdated; |
676 |
private boolean mainProjectTouched; |
677 |
|
678 |
private boolean listenersAttached; |
679 |
private DocumentListener nameDL; |
680 |
private DocumentListener locationDL; |
681 |
private ActionListener isMainAL; |
478 |
} |
682 |
} |