1 19 20 package org.netbeans.lib.ddl.impl; 21 22 import java.text.MessageFormat ; 23 import java.util.Map ; 24 25 import org.openide.util.NbBundle; 26 27 import org.netbeans.lib.ddl.DDLException; 28 29 34 35 public class ColumnCommand extends AbstractCommand 36 { 37 38 private TableColumn column; 39 40 static final long serialVersionUID =-4554975764392047624L; 41 46 public TableColumn specifyColumn(String type, String name, String cmd) 47 throws ClassNotFoundException , IllegalAccessException , InstantiationException 48 { 49 Map gprops = (Map )getSpecification().getProperties(); 50 Map props = (Map )getSpecification().getCommandProperties(cmd); 51 Map bindmap = (Map )props.get("Binding"); String tname = (String )bindmap.get(type); 53 if (tname != null) { 54 Map typemap = (Map )gprops.get(tname); 55 if (typemap == null) throw new InstantiationException ( 56 MessageFormat.format(NbBundle.getBundle("org.netbeans.lib.ddl.resources.Bundle").getString("EXC_UnableLocateObject"), new String [] {tname})); 58 Class typeclass = Class.forName((String )typemap.get("Class")); String format = (String )typemap.get("Format"); column = (TableColumn)typeclass.newInstance(); 61 column.setObjectName(name); 62 column.setObjectType(type); 63 column.setColumnName(name); 64 column.setFormat(format); 65 } else throw new InstantiationException (MessageFormat.format(NbBundle.getBundle("org.netbeans.lib.ddl.resources.Bundle").getString("EXC_UnableLocateType"), new String [] {type, bindmap.toString() })); 67 68 return column; 69 } 70 71 public TableColumn getColumn() 72 { 73 return column; 74 } 75 76 public void setColumn(TableColumn col) 77 { 78 column = col; 79 } 80 81 85 public Map getCommandProperties() 86 throws DDLException 87 { 88 Map args = super.getCommandProperties(); 89 args.put("column", column.getCommand(this)); return args; 91 } 92 } 93 | Popular Tags |