1 19 20 package org.netbeans.modules.ruby.rubyproject.ui.wizards; 21 22 import java.io.File ; 23 import javax.swing.JPanel ; 24 import javax.swing.event.DocumentEvent ; 25 import javax.swing.event.DocumentListener ; 26 import javax.swing.text.Document ; 27 import org.openide.WizardDescriptor; 28 import org.openide.WizardValidationException; 29 import org.openide.util.NbBundle; 30 31 36 public class PanelConfigureProjectVisual extends JPanel { 37 38 private PanelConfigureProject panel; 39 40 private boolean ignoreProjectDirChanges; 41 42 private boolean ignoreRakeProjectNameChanges; 43 44 private boolean noDir = true; 45 46 private SettingsPanel projectLocationPanel; 47 48 private PanelOptionsVisual optionsPanel; 49 50 private int type; 51 52 53 public PanelConfigureProjectVisual( PanelConfigureProject panel, int type ) { 54 this.panel = panel; 55 initComponents(); 56 this.type = type; 57 setName(NbBundle.getMessage(PanelConfigureProjectVisual.class,"TXT_NameAndLoc")); if (type == NewRubyProjectWizardIterator.TYPE_APP) { 59 projectLocationPanel = new PanelProjectLocationVisual( panel, type ); 60 putClientProperty ("NewProjectWizard_Title", NbBundle.getMessage(PanelConfigureProjectVisual.class,"TXT_NewJavaApp")); jSeparator1.setVisible(true); 62 getAccessibleContext ().setAccessibleName (NbBundle.getMessage(PanelConfigureProjectVisual.class,"TXT_NewJavaApp")); getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage(PanelConfigureProjectVisual.class,"ACSD_NewJavaApp")); } 65 else { 73 projectLocationPanel = new PanelProjectLocationExtSrc ( panel ); 74 jSeparator1.setVisible(true); 75 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")); } 79 locationContainer.add( projectLocationPanel, java.awt.BorderLayout.CENTER ); 80 optionsPanel = new PanelOptionsVisual( panel, type ); 81 projectLocationPanel.addPropertyChangeListener(optionsPanel); 82 optionsContainer.add( optionsPanel, java.awt.BorderLayout.CENTER ); 83 } 84 85 boolean valid( WizardDescriptor wizardDescriptor ) { 86 wizardDescriptor.putProperty( "WizardPanel_errorMessage", "" ); return projectLocationPanel.valid( wizardDescriptor ) && optionsPanel.valid(wizardDescriptor); 88 } 89 90 void read (WizardDescriptor d) { 91 Integer lastType = (Integer ) d.getProperty("ruby-wizard-type"); if (lastType == null || lastType.intValue() != this.type) { 93 d.putProperty ("name", null); 95 d.putProperty ("projdir",null); 96 } 97 projectLocationPanel.read (d); 98 optionsPanel.read (d); 99 } 100 101 void store( WizardDescriptor d ) { 102 d.putProperty("ruby-wizard-type", new Integer (this.type)); projectLocationPanel.store( d ); 104 optionsPanel.store( d ); 105 } 106 107 void validate (WizardDescriptor d) throws WizardValidationException { 108 projectLocationPanel.validate (d); 109 } 110 111 112 117 private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; 119 120 locationContainer = new javax.swing.JPanel (); 121 jSeparator1 = new javax.swing.JSeparator (); 122 optionsContainer = new javax.swing.JPanel (); 123 124 setLayout(new java.awt.GridBagLayout ()); 125 126 locationContainer.setLayout(new java.awt.BorderLayout ()); 127 128 gridBagConstraints = new java.awt.GridBagConstraints (); 129 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 130 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 131 gridBagConstraints.weightx = 1.0; 132 add(locationContainer, gridBagConstraints); 133 locationContainer.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(PanelConfigureProjectVisual.class).getString("ACSN_locationContainer")); 134 locationContainer.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(PanelConfigureProjectVisual.class).getString("ACSD_locationContainer")); 135 136 gridBagConstraints = new java.awt.GridBagConstraints (); 137 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 138 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 139 gridBagConstraints.weightx = 1.0; 140 gridBagConstraints.insets = new java.awt.Insets (12, 0, 12, 0); 141 add(jSeparator1, gridBagConstraints); 142 143 optionsContainer.setLayout(new java.awt.BorderLayout ()); 144 145 gridBagConstraints = new java.awt.GridBagConstraints (); 146 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 147 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 148 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 149 gridBagConstraints.weightx = 1.0; 150 gridBagConstraints.weighty = 1.0; 151 add(optionsContainer, gridBagConstraints); 152 optionsContainer.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(PanelConfigureProjectVisual.class).getString("ACSN_optionsContainer")); 153 optionsContainer.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(PanelConfigureProjectVisual.class).getString("ACSD_optionsContainer")); 154 155 } 157 159 160 private javax.swing.JSeparator jSeparator1; 162 private javax.swing.JPanel locationContainer; 163 private javax.swing.JPanel optionsContainer; 164 166 167 } 168 | Popular Tags |