1 24 25 package org.objectweb.cjdbc.console.wizard.objects; 26 27 import java.util.ArrayList ; 28 29 import org.objectweb.cjdbc.common.i18n.WizardTranslate; 30 import org.objectweb.cjdbc.console.wizard.WizardConstants; 31 32 39 public class ConnectionTypeInfo 40 { 41 42 String type = WizardConstants.CONNECTION_MANAGERS[0]; 43 final Exception badValue = new Exception ("Bad Parameter"); 44 private ArrayList values = new ArrayList (); 45 46 51 public String [] getAttributes() 52 { 53 if (type == WizardConstants.CONNECTION_MANAGERS[0]) 54 return new String []{}; 55 if (type == WizardConstants.CONNECTION_MANAGERS[1]) 56 return new String []{WizardTranslate.get("label.poolSize")}; 57 if (type == WizardConstants.CONNECTION_MANAGERS[2]) 58 return new String []{WizardTranslate.get("label.poolSize"), 59 WizardTranslate.get("label.timeout")}; 60 if (type == WizardConstants.CONNECTION_MANAGERS[3]) 61 return new String []{WizardTranslate.get("label.initPoolSize"), 62 WizardTranslate.get("label.minPoolSize"), 63 WizardTranslate.get("label.maxPoolSize"), 64 WizardTranslate.get("label.idleTimeout"), 65 WizardTranslate.get("label.waitTimeout")}; 66 else 67 return null; 68 } 69 70 75 public ArrayList getValues() 76 { 77 return values; 78 } 79 80 86 public int getValue(int index) 87 { 88 try 89 { 90 Object value = values.get(index); 91 if (value instanceof String ) 92 return Integer.parseInt((String ) value); 93 else if (value instanceof Integer ) 94 return ((Integer ) values.get(index)).intValue(); 95 else 96 throw badValue; 97 } 98 catch (Exception e) 99 { 100 e.printStackTrace(); 101 return 0; 102 } 103 } 104 105 110 public void setValues(ArrayList values) 111 { 112 this.values = values; 113 } 114 115 120 public String getType() 121 { 122 return type; 123 } 124 125 128 public String toString() 129 { 130 return type; 131 } 132 133 138 public void setType(String type) 139 { 140 this.type = type; 141 } 142 } | Popular Tags |