1 19 24 25 package org.netbeans.modules.j2ee.sun.ide.sunresources.wizards; 26 27 import java.awt.Component ; 28 import java.util.HashMap ; 29 import java.util.Vector ; 30 import org.netbeans.modules.j2ee.sun.sunresources.beans.WizardConstants; 31 import org.openide.util.HelpCtx; 32 33 import org.netbeans.modules.j2ee.sun.ide.editors.NameValuePair; 34 35 import org.netbeans.modules.j2ee.sun.sunresources.beans.FieldGroup; 36 import org.netbeans.modules.j2ee.sun.sunresources.beans.Wizard; 37 import org.netbeans.modules.j2ee.sun.sunresources.beans.FieldGroupHelper; 38 39 40 45 public class JmsPropertyPanel extends ResourceWizardPanel { 46 47 51 private JmsPropertyVisualPanel component; 52 private ResourceConfigHelper helper; 53 private Wizard wiz; 54 55 56 public JmsPropertyPanel(ResourceConfigHelper helper, Wizard wiz) { 57 this.helper = helper; 58 this.wiz = wiz; 59 } 60 61 public Component getComponent() { 66 if (component == null) { 67 component = new JmsPropertyVisualPanel(this); 68 } 69 return component; 70 } 71 72 public void refreshFields(){ 73 if(component != null){ 74 component.refreshFields(); 75 component.setInitialFocus(); 76 } 77 } 78 79 public FieldGroup getFieldGroup(String groupName) { 80 return FieldGroupHelper.getFieldGroup(wiz, groupName); 81 } 82 83 public HelpCtx getHelp() { 84 return new HelpCtx("AS_Wiz_JMS_props"); } 86 87 public boolean isValid() { 88 setErrorMsg(bundle.getString("Empty_String")); 89 ResourceConfigData data = helper.getData(); 90 Vector vec = data.getProperties(); 91 String resType = data.getString(__ResType); 92 if (resType.equals("javax.jms.Queue")||resType.equals("javax.jms.Topic")) { HashMap map = getHashMap(vec); 94 if(! map.containsKey(WizardConstants.__AdminObjPropertyName)){ 95 setErrorMsg(bundle.getString("Err_AOName")); 96 return false; 97 } 98 } 99 for (int i = 0; i < vec.size(); i++) { 100 NameValuePair pair = (NameValuePair)vec.elementAt(i); 101 if (pair.getParamName() == null || pair.getParamValue() == null || 102 pair.getParamName().length() == 0 || pair.getParamValue().length() == 0){ 103 setErrorMsg(bundle.getString("Err_InvalidNameValue")); 104 return false; 105 } 106 } 107 return true; 108 } 109 110 public ResourceConfigHelper getHelper() { 111 return helper; 112 } 113 114 private HashMap getHashMap(Vector vec){ 115 HashMap map = new HashMap (); 116 for (int i = 0; i < vec.size(); i++) { 117 NameValuePair pair = (NameValuePair)vec.elementAt(i); 118 String paramName = pair.getParamName(); 119 if (paramName != null && paramName.length() != 0) 120 map.put(paramName, pair.getParamValue()); 121 } 122 return map; 123 } 124 } 125 | Popular Tags |