1 19 20 package org.netbeans.modules.java.j2seproject.ui.wizards; 21 22 import javax.swing.JPanel ; 23 import org.openide.WizardDescriptor; 24 import org.openide.WizardValidationException; 25 import org.openide.util.NbBundle; 26 27 32 public class PanelConfigureProjectVisual extends JPanel { 33 34 private PanelConfigureProject panel; 35 36 private boolean ignoreProjectDirChanges; 37 38 private boolean ignoreAntProjectNameChanges; 39 40 private boolean noDir = true; 41 42 private SettingsPanel projectLocationPanel; 43 44 private PanelOptionsVisual optionsPanel; 45 46 private NewJ2SEProjectWizardIterator.WizardType type; 47 48 public PanelConfigureProjectVisual(PanelConfigureProject panel, NewJ2SEProjectWizardIterator.WizardType type) { 49 this.panel = panel; 50 initComponents(); 51 this.type = type; 52 setName(NbBundle.getMessage(PanelConfigureProjectVisual.class,"TXT_NameAndLoc")); switch (type) { 54 case APP: 55 projectLocationPanel = new PanelProjectLocationVisual( panel, type ); 56 putClientProperty ("NewProjectWizard_Title", NbBundle.getMessage(PanelConfigureProjectVisual.class,"TXT_NewJavaApp")); jSeparator1.setVisible(true); 58 getAccessibleContext ().setAccessibleName (NbBundle.getMessage(PanelConfigureProjectVisual.class,"TXT_NewJavaApp")); getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage(PanelConfigureProjectVisual.class,"ACSD_NewJavaApp")); break; 61 case LIB: 62 projectLocationPanel = new PanelProjectLocationVisual( panel, type ); 63 jSeparator1.setVisible (false); 64 putClientProperty ("NewProjectWizard_Title", NbBundle.getMessage(PanelConfigureProjectVisual.class,"TXT_NewJavaLib")); getAccessibleContext ().setAccessibleName (NbBundle.getMessage(PanelConfigureProjectVisual.class,"TXT_NewJavaLib")); getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage(PanelConfigureProjectVisual.class,"ACSD_NewJavaLib")); break; 68 case EXT: 69 projectLocationPanel = new PanelProjectLocationExtSrc ( panel ); 70 jSeparator1.setVisible(true); 71 putClientProperty ("NewProjectWizard_Title", NbBundle.getMessage(PanelConfigureProjectVisual.class,"TXT_JavaExtSourcesProjectLocation")); getAccessibleContext ().setAccessibleName (NbBundle.getMessage(PanelConfigureProjectVisual.class,"TXT_JavaExtSourcesProjectLocation")); getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage(PanelConfigureProjectVisual.class,"ACSD_JavaExtSourcesProjectLocation")); } 75 locationContainer.add( projectLocationPanel, java.awt.BorderLayout.CENTER ); 76 optionsPanel = new PanelOptionsVisual( panel, type ); 77 projectLocationPanel.addPropertyChangeListener(optionsPanel); 78 optionsContainer.add( optionsPanel, java.awt.BorderLayout.CENTER ); 79 } 80 81 boolean valid( WizardDescriptor wizardDescriptor ) { 82 wizardDescriptor.putProperty( "WizardPanel_errorMessage", "" ); return projectLocationPanel.valid( wizardDescriptor ) && optionsPanel.valid(wizardDescriptor); 84 } 85 86 void read (WizardDescriptor d) { 87 NewJ2SEProjectWizardIterator.WizardType lastType = (NewJ2SEProjectWizardIterator.WizardType) d.getProperty("wizard-type"); if (lastType == null || lastType != type) { 89 d.putProperty ("name", null); 91 d.putProperty ("projdir",null); 92 } 93 projectLocationPanel.read (d); 94 optionsPanel.read (d); 95 } 96 97 void store( WizardDescriptor d ) { 98 d.putProperty("wizard-type", type); projectLocationPanel.store( d ); 100 optionsPanel.store( d ); 101 } 102 103 void validate (WizardDescriptor d) throws WizardValidationException { 104 projectLocationPanel.validate (d); 105 } 106 107 108 113 private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; 115 116 locationContainer = new javax.swing.JPanel (); 117 jSeparator1 = new javax.swing.JSeparator (); 118 optionsContainer = new javax.swing.JPanel (); 119 120 setLayout(new java.awt.GridBagLayout ()); 121 122 locationContainer.setLayout(new java.awt.BorderLayout ()); 123 124 gridBagConstraints = new java.awt.GridBagConstraints (); 125 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 126 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 127 gridBagConstraints.weightx = 1.0; 128 add(locationContainer, gridBagConstraints); 129 locationContainer.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(PanelConfigureProjectVisual.class).getString("ACSN_locationContainer")); 130 locationContainer.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(PanelConfigureProjectVisual.class).getString("ACSD_locationContainer")); 131 132 gridBagConstraints = new java.awt.GridBagConstraints (); 133 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 134 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 135 gridBagConstraints.weightx = 1.0; 136 gridBagConstraints.insets = new java.awt.Insets (12, 0, 12, 0); 137 add(jSeparator1, gridBagConstraints); 138 139 optionsContainer.setLayout(new java.awt.BorderLayout ()); 140 141 gridBagConstraints = new java.awt.GridBagConstraints (); 142 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 143 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 144 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 145 gridBagConstraints.weightx = 1.0; 146 gridBagConstraints.weighty = 1.0; 147 add(optionsContainer, gridBagConstraints); 148 optionsContainer.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(PanelConfigureProjectVisual.class).getString("ACSN_optionsContainer")); 149 optionsContainer.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(PanelConfigureProjectVisual.class).getString("ACSD_optionsContainer")); 150 151 } 153 155 156 private javax.swing.JSeparator jSeparator1; 158 private javax.swing.JPanel locationContainer; 159 private javax.swing.JPanel optionsContainer; 160 162 163 } 164 | Popular Tags |