column = tableColumnModel.getColumn(i);
if (MetadataTableModel.COMMENTS_INDEX == i) {// 注释
column.setPreferredWidth(250);
} else if (MetadataTableModel.SQL_DATA_TYPE_INDEX == i) {// SQL数据类型
JComboBox sqlDataTypeComboBox = new JComboBox(new SqlDataTypeComboBoxModel());
column.setCellEditor(new DefaultCellEditor(sqlDataTypeComboBox));
column.setPreferredWidth(220);
} else if (MetadataTableModel.DATA_LENGTH_INDEX == i) {// 数据长度
column.setPreferredWidth(100);
} else if (MetadataTableModel.DATA_PRECISION_INDEX == i) {// 精度
column.setPreferredWidth(100);
} else if (MetadataTableModel.PROPERTY_TYPE_INDEX == i) {// 属性数据类型
JComboBox propertyTypeComboBox = new JComboBox(new PropertyTypeComboBoxModel(new JavaTypes()));
propertyTypeComboBox.setEditable(true);
column.setCellEditor(new DefaultCellEditor(propertyTypeComboBox));
column.setPreferredWidth(250);
} else if (MetadataTableModel.NULLABLE_INDEX == i) {// isEmpty
column.setPreferredWidth(120);
} else if (MetadataTableModel.DATA_DEFAULT_INDEX == i) {// defaultValue
column.setPreferredWidth(130);
} else if (MetadataTableModel.IS_KEY_FIELD_INDEX == i) {// isKey
column.setPreferredWidth(70);
} else if (MetadataTableModel.CONSTRAINT_TYPE_INDEX == i) {// keyType
JComboBox constraintTypeComboBox = new JComboBox(new ConstraintTypeComboBoxModel());
constraintTypeComboBox.addItemListener(new ConstraintTypeComboBoxItemListener(this));
column.setCellEditor(new DefaultCellEditor(constraintTypeComboBox));
column.setPreferredWidth(250);
} else if (MetadataTableModel.REFERENCING_TABLE_INDEX == i) {// ReferencingTable
JComboBox referencingTableComboBox = new JComboBox();
referencingTableComboBox.addPopupMenuListener(new TableComboBoxPopupMenuListener(this));
column.setCellEditor(new DefaultCellEditor(referencingTableComboBox));
// column.setCellRenderer(new DefaultTableCellRenderer());
column.setPreferredWidth(250);
} else if (MetadataTableModel.REFERENCING_COLUMN_INDEX == i) {// ReferencingTableColumn
JComboBox referencingTableColumnComboBox = new JComboBox();
referencingTableColumnComboBox.addPopupMenuListener(new TableColumnComboBoxPopupMenuListener(this));
column.setCellEditor(new DefaultCellEditor(referencingTableColumnComboBox));
column.setPreferredWidth(250);
} else if (MetadataTableModel.DELETE_RULE_INDEX == i) {// Referential Triggered Action
JComboBox deleteRuleComboBox = new JComboBox(new DeleteRuleComboBoxModel());
column.setCellEditor(new DefaultCellEditor(deleteRuleComboBox));
column.setPreferredWidth(250);
} else if (MetadataTableModel.IS_QUERY_FIELD_INDEX == i) {// queryField
column.setPreferredWidth(120);
} else if (MetadataTableModel.QUERY_MODE_INDEX == i) {// queryMode
JComboBox queryModeComboBox = new JComboBox(new QueryModeComboBoxModel());
column.setCellEditor(new DefaultCellEditor(queryModeComboBox));
column.setPreferredWidth(200);
} else if (MetadataTableModel.COMPONENT_TYPE_INDEX == i) {// componentType
JComboBox componentTypeComboBox = new JComboBox(new ComponentTypeComboBoxModel());
componentTypeComboBox.setRenderer(new ComponentTypeListCellRenderer());
column.setCellEditor(new DefaultCellEditor(componentTypeComboBox));
column.setPreferredWidth(250);
} else {
column.setPreferredWidth(200);
}
}