* @return a new JComponent displaying the contents of (or the interface for searching) the given catalog
*/
protected JComponent makeCatalogComponent(Catalog catalog) {
// catalog may contain multiple tables and implement the CatalogDirectory interface
if (catalog instanceof CatalogDirectory) {
CatalogDirectory catalogDirectory = (CatalogDirectory) catalog;
int numCatalogs = catalogDirectory.getNumCatalogs();
if (numCatalogs == 1) {
Catalog c = catalogDirectory.getCatalog(0);
if (c instanceof TableQueryResult) {
return makeTableQueryResultComponent((TableQueryResult) c);
} else {
DialogUtil.error(_I18N.getString("subCatalogError") + ": " + c);
return new EmptyPanel();
}
} else if (numCatalogs > 1) {
return makeTableQueryResultComponent(catalogDirectory.getCatalogList());
}
}
if (catalog instanceof TableQueryResult) {
return makeTableQueryResultComponent((TableQueryResult) catalog);
}