Lines 51-68
Link Here
|
51 |
import javax.swing.JFileChooser; |
51 |
import javax.swing.JFileChooser; |
52 |
import javax.swing.event.DocumentEvent; |
52 |
import javax.swing.event.DocumentEvent; |
53 |
import javax.swing.event.DocumentListener; |
53 |
import javax.swing.event.DocumentListener; |
|
|
54 |
import javax.swing.event.HyperlinkListener; |
54 |
import org.netbeans.installer.product.Registry; |
55 |
import org.netbeans.installer.product.Registry; |
55 |
import org.netbeans.installer.product.components.Product; |
56 |
import org.netbeans.installer.product.components.Product; |
56 |
import org.netbeans.installer.utils.BrowserUtils; |
57 |
import org.netbeans.installer.utils.BrowserUtils; |
57 |
import org.netbeans.installer.utils.FileUtils; |
58 |
import org.netbeans.installer.utils.FileUtils; |
58 |
import org.netbeans.installer.utils.helper.swing.NbiButton; |
|
|
59 |
import org.netbeans.installer.utils.helper.swing.NbiLabel; |
60 |
import org.netbeans.installer.utils.ResourceUtils; |
59 |
import org.netbeans.installer.utils.ResourceUtils; |
61 |
import org.netbeans.installer.utils.StringUtils; |
60 |
import org.netbeans.installer.utils.StringUtils; |
62 |
import org.netbeans.installer.utils.SystemUtils; |
61 |
import org.netbeans.installer.utils.SystemUtils; |
|
|
62 |
import org.netbeans.installer.utils.helper.Text; |
63 |
import org.netbeans.installer.utils.helper.Version; |
63 |
import org.netbeans.installer.utils.helper.Version; |
|
|
64 |
import org.netbeans.installer.utils.helper.swing.NbiButton; |
64 |
import org.netbeans.installer.utils.helper.swing.NbiComboBox; |
65 |
import org.netbeans.installer.utils.helper.swing.NbiComboBox; |
65 |
import org.netbeans.installer.utils.helper.swing.NbiDirectoryChooser; |
66 |
import org.netbeans.installer.utils.helper.swing.NbiDirectoryChooser; |
|
|
67 |
import org.netbeans.installer.utils.helper.swing.NbiLabel; |
66 |
import org.netbeans.installer.utils.helper.swing.NbiTextField; |
68 |
import org.netbeans.installer.utils.helper.swing.NbiTextField; |
67 |
import org.netbeans.installer.utils.helper.swing.NbiTextPane; |
69 |
import org.netbeans.installer.utils.helper.swing.NbiTextPane; |
68 |
import org.netbeans.installer.wizard.components.panels.ApplicationLocationPanel.LocationValidator; |
70 |
import org.netbeans.installer.wizard.components.panels.ApplicationLocationPanel.LocationValidator; |
Lines 71-79
Link Here
|
71 |
import org.netbeans.installer.wizard.components.panels.DestinationPanel; |
73 |
import org.netbeans.installer.wizard.components.panels.DestinationPanel; |
72 |
import org.netbeans.installer.wizard.components.panels.DestinationPanel.DestinationPanelUi; |
74 |
import org.netbeans.installer.wizard.components.panels.DestinationPanel.DestinationPanelUi; |
73 |
import org.netbeans.installer.wizard.components.panels.JdkLocationPanel; |
75 |
import org.netbeans.installer.wizard.components.panels.JdkLocationPanel; |
|
|
76 |
import org.netbeans.installer.wizard.containers.SwingContainer; |
74 |
import org.netbeans.installer.wizard.ui.SwingUi; |
77 |
import org.netbeans.installer.wizard.ui.SwingUi; |
75 |
import org.netbeans.installer.wizard.ui.WizardUi; |
78 |
import org.netbeans.installer.wizard.ui.WizardUi; |
76 |
import org.netbeans.installer.wizard.containers.SwingContainer; |
|
|
77 |
|
79 |
|
78 |
/** |
80 |
/** |
79 |
* |
81 |
* |
Lines 103-108
Link Here
|
103 |
DEFAULT_BROWSE_BUTTON_TEXT); |
105 |
DEFAULT_BROWSE_BUTTON_TEXT); |
104 |
setProperty(WARNING_INSTALL_INTO_USERDIR_PROPERTY, |
106 |
setProperty(WARNING_INSTALL_INTO_USERDIR_PROPERTY, |
105 |
DEFAULT_WARNING_INSTALL_INTO_USERDIR); |
107 |
DEFAULT_WARNING_INSTALL_INTO_USERDIR); |
|
|
108 |
setProperty(WARNING_JDK_NOT_RECOMMENDED_VERSION, |
109 |
DEFAULT_WARNING_JDK_NOT_RECOMMENDED_VERSION); |
106 |
} |
110 |
} |
107 |
|
111 |
|
108 |
@Override |
112 |
@Override |
Lines 229-234
Link Here
|
229 |
this.panel = panel; |
233 |
this.panel = panel; |
230 |
} |
234 |
} |
231 |
|
235 |
|
|
|
236 |
@Override |
232 |
public SwingUi getSwingUi(SwingContainer container) { |
237 |
public SwingUi getSwingUi(SwingContainer container) { |
233 |
if (swingUi == null) { |
238 |
if (swingUi == null) { |
234 |
swingUi = new NbBaseDestinationPanelSwingUi(panel, container); |
239 |
swingUi = new NbBaseDestinationPanelSwingUi(panel, container); |
Lines 250-255
Link Here
|
250 |
|
255 |
|
251 |
private NbiDirectoryChooser fileChooser; |
256 |
private NbiDirectoryChooser fileChooser; |
252 |
|
257 |
|
|
|
258 |
private Text jdkWarningMessage = null; |
259 |
private HyperlinkListener hyperlinkListener = null; |
260 |
|
253 |
public NbBaseDestinationPanelSwingUi( |
261 |
public NbBaseDestinationPanelSwingUi( |
254 |
final NbBasePanel panel, |
262 |
final NbBasePanel panel, |
255 |
final SwingContainer container) { |
263 |
final SwingContainer container) { |
Lines 268-274
Link Here
|
268 |
|
276 |
|
269 |
final JdkLocationPanel jdkLocationPanel = panel.getJdkLocationPanel(); |
277 |
final JdkLocationPanel jdkLocationPanel = panel.getJdkLocationPanel(); |
270 |
|
278 |
|
271 |
if (jdkLocationPanel.getLocations().size() == 0) { |
279 |
if (jdkLocationPanel.getLocations().isEmpty()) { |
272 |
final Version minVersion = Version.getVersion(jdkLocationPanel.getProperty( |
280 |
final Version minVersion = Version.getVersion(jdkLocationPanel.getProperty( |
273 |
JdkLocationPanel.MINIMUM_JDK_VERSION_PROPERTY)); |
281 |
JdkLocationPanel.MINIMUM_JDK_VERSION_PROPERTY)); |
274 |
final Version maxVersion = Version.getVersion(jdkLocationPanel.getProperty( |
282 |
final Version maxVersion = Version.getVersion(jdkLocationPanel.getProperty( |
Lines 281-287
Link Here
|
281 |
maxVersion.toJdkStyle(), |
289 |
maxVersion.toJdkStyle(), |
282 |
jdkLocationPanel.getProperty(JdkLocationPanel.JAVA_DOWNLOAD_PAGE_PROPERTY))); |
290 |
jdkLocationPanel.getProperty(JdkLocationPanel.JAVA_DOWNLOAD_PAGE_PROPERTY))); |
283 |
|
291 |
|
284 |
statusLabel.addHyperlinkListener(BrowserUtils.createHyperlinkListener()); |
292 |
statusLabel.addHyperlinkListener(getHyperlinkListener()); |
285 |
} else { |
293 |
} else { |
286 |
statusLabel.clearText(); |
294 |
statusLabel.clearText(); |
287 |
statusLabel.setVisible(false); |
295 |
statusLabel.setVisible(false); |
Lines 356-369
Link Here
|
356 |
jdkLocationField = new NbiTextField(); |
364 |
jdkLocationField = new NbiTextField(); |
357 |
jdkLocationField.getDocument().addDocumentListener( |
365 |
jdkLocationField.getDocument().addDocumentListener( |
358 |
new DocumentListener() { |
366 |
new DocumentListener() { |
|
|
367 |
@Override |
359 |
public void insertUpdate(DocumentEvent e) { |
368 |
public void insertUpdate(DocumentEvent e) { |
360 |
updateErrorMessage(); |
369 |
updateErrorMessage(); |
361 |
} |
370 |
} |
362 |
|
371 |
|
|
|
372 |
@Override |
363 |
public void removeUpdate(DocumentEvent e) { |
373 |
public void removeUpdate(DocumentEvent e) { |
364 |
// updateErrorMessage(); |
374 |
// updateErrorMessage(); |
365 |
} |
375 |
} |
366 |
|
376 |
|
|
|
377 |
@Override |
367 |
public void changedUpdate(DocumentEvent e) { |
378 |
public void changedUpdate(DocumentEvent e) { |
368 |
updateErrorMessage(); |
379 |
updateErrorMessage(); |
369 |
} |
380 |
} |
Lines 371-378
Link Here
|
371 |
|
382 |
|
372 |
// jdkLocationComboBox ////////////////////////////////////////////////// |
383 |
// jdkLocationComboBox ////////////////////////////////////////////////// |
373 |
final LocationValidator validator = new LocationValidator() { |
384 |
final LocationValidator validator = new LocationValidator() { |
|
|
385 |
@Override |
374 |
public void validate(String location) { |
386 |
public void validate(String location) { |
375 |
jdkLocationField.setText(location); |
387 |
jdkLocationField.setText(location); |
|
|
388 |
|
389 |
if (!panel.jdkLocationPanel.isJdkVersionRecommended(location)) { |
390 |
statusLabel.setText(getJdkWarningMessage()); |
391 |
if (statusLabel.getHyperlinkListeners().length == 0) { |
392 |
statusLabel.addHyperlinkListener(getHyperlinkListener()); |
393 |
} |
394 |
statusLabel.setVisible(true); |
395 |
} else { |
396 |
statusLabel.clearText(); |
397 |
statusLabel.setVisible(false); |
398 |
} |
376 |
} |
399 |
} |
377 |
}; |
400 |
}; |
378 |
|
401 |
|
Lines 380-385
Link Here
|
380 |
jdkLocationComboBox.setEditable(true); |
403 |
jdkLocationComboBox.setEditable(true); |
381 |
jdkLocationComboBox.setEditor(new LocationsComboBoxEditor(validator)); |
404 |
jdkLocationComboBox.setEditor(new LocationsComboBoxEditor(validator)); |
382 |
jdkLocationComboBox.addItemListener(new ItemListener() { |
405 |
jdkLocationComboBox.addItemListener(new ItemListener() { |
|
|
406 |
@Override |
383 |
public void itemStateChanged(ItemEvent event) { |
407 |
public void itemStateChanged(ItemEvent event) { |
384 |
final ComboBoxModel model = jdkLocationComboBox.getModel(); |
408 |
final ComboBoxModel model = jdkLocationComboBox.getModel(); |
385 |
|
409 |
|
Lines 397-402
Link Here
|
397 |
// browseButton ///////////////////////////////////////////////////////// |
421 |
// browseButton ///////////////////////////////////////////////////////// |
398 |
browseButton = new NbiButton(); |
422 |
browseButton = new NbiButton(); |
399 |
browseButton.addActionListener(new ActionListener() { |
423 |
browseButton.addActionListener(new ActionListener() { |
|
|
424 |
@Override |
400 |
public void actionPerformed(ActionEvent event) { |
425 |
public void actionPerformed(ActionEvent event) { |
401 |
browseButtonPressed(); |
426 |
browseButtonPressed(); |
402 |
} |
427 |
} |
Lines 443-448
Link Here
|
443 |
0, 0)); // padx, pady - ??? |
468 |
0, 0)); // padx, pady - ??? |
444 |
} |
469 |
} |
445 |
|
470 |
|
|
|
471 |
private Text getJdkWarningMessage() { |
472 |
if (jdkWarningMessage == null) { |
473 |
String messageContent = StringUtils.format( |
474 |
panel.getProperty(WARNING_JDK_NOT_RECOMMENDED_VERSION), |
475 |
panel.jdkLocationPanel.getProperty(JdkLocationPanel.JAVA_DOWNLOAD_PAGE_PROPERTY)); |
476 |
jdkWarningMessage = new Text(messageContent, Text.ContentType.HTML); |
477 |
} |
478 |
|
479 |
return jdkWarningMessage; |
480 |
} |
481 |
|
482 |
private HyperlinkListener getHyperlinkListener() { |
483 |
if (hyperlinkListener == null) { |
484 |
hyperlinkListener = BrowserUtils.createHyperlinkListener(); |
485 |
} |
486 |
|
487 |
return hyperlinkListener; |
488 |
} |
489 |
|
446 |
private void browseButtonPressed() { |
490 |
private void browseButtonPressed() { |
447 |
fileChooser.setSelectedFile(new File(jdkLocationField.getText().trim())); |
491 |
fileChooser.setSelectedFile(new File(jdkLocationField.getText().trim())); |
448 |
|
492 |
|
Lines 461-466
Link Here
|
461 |
"browse.button.text"; // NOI18N |
505 |
"browse.button.text"; // NOI18N |
462 |
public static final String WARNING_INSTALL_INTO_USERDIR_PROPERTY = |
506 |
public static final String WARNING_INSTALL_INTO_USERDIR_PROPERTY = |
463 |
"install.into.userdir.storage"; |
507 |
"install.into.userdir.storage"; |
|
|
508 |
public static final String WARNING_JDK_NOT_RECOMMENDED_VERSION = |
509 |
"jdk.not.recommended.version"; |
464 |
|
510 |
|
465 |
public static final String DEFAULT_TITLE = |
511 |
public static final String DEFAULT_TITLE = |
466 |
ResourceUtils.getString(NbBasePanel.class, |
512 |
ResourceUtils.getString(NbBasePanel.class, |
Lines 492-495
Link Here
|
492 |
public static final String DEFAULT_WARNING_INSTALL_INTO_USERDIR = |
538 |
public static final String DEFAULT_WARNING_INSTALL_INTO_USERDIR = |
493 |
ResourceUtils.getString(NbBasePanel.class, |
539 |
ResourceUtils.getString(NbBasePanel.class, |
494 |
"NBP.warning.install.into.userdir"); // NOI18N |
540 |
"NBP.warning.install.into.userdir"); // NOI18N |
|
|
541 |
public static final String DEFAULT_WARNING_JDK_NOT_RECOMMENDED_VERSION = |
542 |
ResourceUtils.getString(NbBasePanel.class, |
543 |
"NBP.warning.jdk.not.recommended.version"); // NOI18N |
495 |
} |
544 |
} |