1 19 24 25 package org.netbeans.modules.j2ee.sun.ide.sunresources.wizards; 26 27 import java.awt.Component ; 28 import java.util.Vector ; 29 import org.openide.util.HelpCtx; 30 31 import org.netbeans.modules.j2ee.sun.ide.editors.NameValuePair; 32 33 import org.netbeans.modules.j2ee.sun.sunresources.beans.FieldGroup; 34 import org.netbeans.modules.j2ee.sun.sunresources.beans.Wizard; 35 import org.netbeans.modules.j2ee.sun.sunresources.beans.FieldGroupHelper; 36 37 41 public class CommonPropertyPanel extends ResourceWizardPanel { 42 43 private CommonPropertyVisualPanel component; 44 private ResourceConfigHelper helper; 45 private Wizard wiz; 46 boolean firstTime = false; 47 48 public CommonPropertyPanel(ResourceConfigHelper helper, Wizard wiz) { 49 this.helper = helper; 50 this.wiz = wiz; 51 } 52 53 public Component getComponent() { 58 if (component == null) { 59 component = new CommonPropertyVisualPanel(this); 60 } 61 return component; 62 } 63 64 public void setInitialFocus(){ 65 if(component != null) { 66 component.refreshFields(); 67 component.setInitialFocus(); 68 } 69 } 70 71 public FieldGroup getFieldGroup(String groupName) { 72 return FieldGroupHelper.getFieldGroup(wiz, groupName); 73 } 74 75 public ResourceConfigHelper getHelper() { 76 return helper; 77 } 78 79 public HelpCtx getHelp() { 80 if (wiz.getName().equals(__JdbcResource)) { 81 return new HelpCtx("AS_Wiz_DataSource_props"); }else if (wiz.getName().equals(__PersistenceManagerFactoryResource)) { 83 return new HelpCtx("AS_Wiz_PMF_props"); }else { 85 return HelpCtx.DEFAULT_HELP; 86 } 87 } 88 89 public boolean isValid() { 90 setErrorMsg(bundle.getString("Empty_String")); 91 ResourceConfigData data = helper.getData(); 92 Vector vec = data.getProperties(); 93 for (int i = 0; i < vec.size(); i++) { 94 NameValuePair pair = (NameValuePair)vec.elementAt(i); 95 if (pair.getParamName() == null || pair.getParamValue() == null || 96 pair.getParamName().length() == 0 || pair.getParamValue().length() == 0){ 97 setErrorMsg(bundle.getString("Err_InvalidNameValue")); 98 return false; 99 } 100 } 101 return true; 102 } 103 104 105 } 106 | Popular Tags |