aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-10-01 09:18:27 +0000
committerBibiko <bibiko@eva.mpg.de>2010-10-01 09:18:27 +0000
commitd7efae3ff6e5cf9407af16dbba09a55be092ce45 (patch)
tree19719e68ab1960e989bed92b996a8899f05f6b35 /Source
parent27c7baef4a847d3894bc47f8ea2cf3e5284caae2 (diff)
downloadsequelpro-d7efae3ff6e5cf9407af16dbba09a55be092ce45.tar.gz
sequelpro-d7efae3ff6e5cf9407af16dbba09a55be092ce45.tar.bz2
sequelpro-d7efae3ff6e5cf9407af16dbba09a55be092ce45.zip
• some further work on Filter Table
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTableContent.h1
-rw-r--r--Source/SPTableContent.m35
2 files changed, 32 insertions, 4 deletions
diff --git a/Source/SPTableContent.h b/Source/SPTableContent.h
index 47a29a17..5a085ad7 100644
--- a/Source/SPTableContent.h
+++ b/Source/SPTableContent.h
@@ -105,6 +105,7 @@
NSMutableDictionary *filterTableData;
BOOL filterTableNegate;
BOOL filterTableDistinct;
+ BOOL filterTableIsSwapped;
NSString *filterTableDefaultOperator;
NSString *lastEditedFilterTableValue;
NSInteger activeFilter; // 0 = default filter; 1 = filter table
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 55d48b90..71173f96 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -75,6 +75,7 @@
filterTableNegate = NO;
filterTableDistinct = NO;
+ filterTableIsSwapped = NO;
lastEditedFilterTableValue = nil;
activeFilter = 0;
@@ -3348,7 +3349,10 @@
- (NSInteger)numberOfRowsInTableView:(SPCopyTable *)aTableView
{
if(aTableView == filterTableView) {
- return [[[filterTableData objectForKey:[NSNumber numberWithInteger:0]] objectForKey:@"filter"] count];
+ if(filterTableIsSwapped)
+ return [filterTableData count];
+ else
+ return [[[filterTableData objectForKey:[NSNumber numberWithInteger:0]] objectForKey:@"filter"] count];
}
else if(aTableView == tableContentView) {
return tableRowsCount;
@@ -3359,7 +3363,15 @@
{
if(aTableView == filterTableView) {
- return NSArrayObjectAtIndex([[filterTableData objectForKey:[aTableColumn identifier]] objectForKey:@"filter"], rowIndex);
+ if(filterTableIsSwapped)
+ // First column shows the field names
+ if([[aTableColumn identifier] integerValue] == 0) {
+ NSTableHeaderCell *c = [[[NSTableHeaderCell alloc] initTextCell:[[filterTableData objectForKey:[NSNumber numberWithInteger:rowIndex]] objectForKey:@"name"]] autorelease];
+ return c;
+ } else
+ return NSArrayObjectAtIndex([[filterTableData objectForKey:[NSNumber numberWithInteger:rowIndex]] objectForKey:@"filter"], [[aTableColumn identifier] integerValue]-1);
+ else
+ return NSArrayObjectAtIndex([[filterTableData objectForKey:[aTableColumn identifier]] objectForKey:@"filter"], rowIndex);
}
else if(aTableView == tableContentView) {
@@ -3402,6 +3414,12 @@
{
if(aTableView == filterTableView) {
+ if(filterTableIsSwapped && [[aTableColumn identifier] integerValue] == 0) {
+ [cell setDrawsBackground:YES];
+ [cell setBackgroundColor:lightGrayColor];
+ } else {
+ [cell setDrawsBackground:NO];
+ }
return;
}
else if(aTableView == tableContentView) {
@@ -3452,7 +3470,10 @@
- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
if(aTableView == filterTableView) {
- [[[filterTableData objectForKey:[aTableColumn identifier]] objectForKey:@"filter"] replaceObjectAtIndex:rowIndex withObject:(NSString*)anObject];
+ if(filterTableIsSwapped)
+ [[[filterTableData objectForKey:[NSNumber numberWithInteger:rowIndex]] objectForKey:@"filter"] replaceObjectAtIndex:([[aTableColumn identifier] integerValue]-1) withObject:(NSString*)anObject];
+ else
+ [[[filterTableData objectForKey:[aTableColumn identifier]] objectForKey:@"filter"] replaceObjectAtIndex:rowIndex withObject:(NSString*)anObject];
[self updateFilterTableClause:nil];
return;
}
@@ -3779,7 +3800,13 @@
{
if ([tableDocumentInstance isWorking]) return NO;
- if ( aTableView == tableContentView ) {
+ if(aTableView == filterTableView) {
+ if(filterTableIsSwapped && [[aTableColumn identifier] integerValue] == 0)
+ return NO;
+ else
+ return YES;
+ }
+ else if ( aTableView == tableContentView ) {
// Ensure that row is editable since it could contain "(not loaded)" columns together with
// issue that the table has no primary key