1 19 20 package org.netbeans.modules.db.explorer; 21 22 import java.util.*; 23 import java.beans.PropertyEditor ; 24 import org.netbeans.lib.ddl.impl.*; 25 import org.netbeans.modules.db.explorer.infos.DatabaseNodeInfo; 26 27 public class DatabaseTypePropertySupport extends DatabasePropertySupport 28 { 29 private int[] types; 30 private String [] names; 31 32 public DatabaseTypePropertySupport(String name, Class type, String displayName, String shortDescription, DatabaseNodeInfo rep, boolean writable, boolean expert) 33 { 34 super(name, type, displayName, shortDescription, rep, writable); 35 repository = rep; 36 int i = 0; 37 38 Specification spec = (Specification)((DatabaseNodeInfo)repository).getSpecification(); 39 if (spec != null && writable) { 40 Map tmap = ((Specification)((DatabaseNodeInfo)repository).getSpecification()).getTypeMap(); 41 if (tmap == null) tmap = new HashMap(1); 42 Iterator enu = tmap.keySet().iterator(); 43 types = new int[tmap.size()]; 44 names = new String [tmap.size()]; 45 while(enu.hasNext()) { 46 String key = (String )enu.next(); 47 int xtype = Specification.getType(key); 48 String code = (String )tmap.get(key); 49 types[i] = xtype; 50 names[i++] = code; 51 } 52 } else { 53 types = new int[] {0}; 54 names = new String [] {name}; 55 } 56 57 if (expert) setExpert(true); 58 } 59 60 public PropertyEditor getPropertyEditor () 61 { 62 PropertyEditor pe = new DatabaseTypePropertyEditor(types, names); 63 return pe; 64 } 65 } 66 | Popular Tags |