diff options
author | avenjamin <avenjamin@gmail.com> | 2008-05-07 04:02:13 +0000 |
---|---|---|
committer | avenjamin <avenjamin@gmail.com> | 2008-05-07 04:02:13 +0000 |
commit | eb72b9122f57fa31c86229c3c698d90853dcb4ec (patch) | |
tree | 62e9d917505c8081f004d132d34dfe3745306b7f /TablesList.m | |
parent | caa1709c33fd44b51460b6f8357b581658d5b560 (diff) | |
download | sequelpro-eb72b9122f57fa31c86229c3c698d90853dcb4ec.tar.gz sequelpro-eb72b9122f57fa31c86229c3c698d90853dcb4ec.tar.bz2 sequelpro-eb72b9122f57fa31c86229c3c698d90853dcb4ec.zip |
Changed the tables list, custom cell to handle image+text+indentation, added table information (commented out until bug resolved)
Diffstat (limited to 'TablesList.m')
-rw-r--r-- | TablesList.m | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/TablesList.m b/TablesList.m index d26336e9..5733b008 100644 --- a/TablesList.m +++ b/TablesList.m @@ -27,7 +27,7 @@ #import "TableSource.h" #import "TableContent.h" #import "TableDump.h" - +#import "ImageAndTextCell.h" @implementation TablesList @@ -45,6 +45,7 @@ loads all table names in array tables and reload the tableView [tablesListView deselectAll:self]; [tables removeAllObjects]; + [tables addObject:@"TABLES"]; theResult = [mySQLConnection listTables]; for ( i = 0 ; i < [theResult numOfRows] ; i++ ) { @@ -329,9 +330,11 @@ returns the currently selected table or nil if no table or mulitple tables are s { if ( [tablesListView numberOfSelectedRows] == 1 ) { return [tables objectAtIndex:[tablesListView selectedRow]]; + } else if ([tablesListView numberOfSelectedRows] > 1) { + return @""; } else { - return nil; - } + return nil; + } } - (BOOL)structureLoaded @@ -369,7 +372,7 @@ returns YES if table status has already been loaded objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { - return [tables objectAtIndex:rowIndex]; + return [tables objectAtIndex:rowIndex]; } /** @@ -580,6 +583,7 @@ loads a table in content or source view (if tab selected) // set window title [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@@%@/%@/%@", [tableDocumentInstance mySQLVersion], [tableDocumentInstance user], [tableDocumentInstance host], [tableDocumentInstance database], [tables objectAtIndex:[tablesListView selectedRow]]]]; + } else { [tableSourceInstance loadTable:nil]; [tableContentInstance loadTable:nil]; @@ -590,7 +594,7 @@ loads a table in content or source view (if tab selected) // set window title [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@@%@/%@", [tableDocumentInstance mySQLVersion], [tableDocumentInstance user], [tableDocumentInstance host], [tableDocumentInstance database]]]; - } + } } //tabView delegate methods @@ -629,6 +633,30 @@ loads structure or source if tab selected the first time */ } +- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(int)rowIndex +{ + return (rowIndex != 0); +} + + +- (BOOL)tableView:(NSTableView *)aTableView isGroupRow:(int)row +{ + return (row == 0); +} + +- (void)tableView:(NSTableView *)aTableView + willDisplayCell:(id)aCell + forTableColumn:(NSTableColumn *)aTableColumn + row:(int)rowIndex +{ + if ((rowIndex > 0) && [[aTableColumn identifier] isEqualToString:@"tables"]) { + [(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"sl-icon_table"]]; + [(ImageAndTextCell*)aCell setIndentationLevel:1]; + } else { + [(ImageAndTextCell*)aCell setImage:nil]; + [(ImageAndTextCell*)aCell setIndentationLevel:0]; + } +} //last but not least - (id)init @@ -638,7 +666,7 @@ loads structure or source if tab selected the first time tables = [[NSMutableArray alloc] init]; structureLoaded = NO; contentLoaded = NO; - + [tables addObject:@"TABLES"]; return self; } |