mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-02-20 18:12:04 +00:00
* GDL2Palette/KeyWrapper.h: Add LocalType.
* GDL2Palette/ConnectInspector.m (_localKeysFromDisplayGroup): New method. (updateValues:): Add local keys. (_oaBrowserAction:): Enable ok button for LocalType. Handle relationships explicitly (browser:willDisplayCell:atRow:column:): Enable and set leaf for LocalType keys. * GDL2Palette/DisplayGroupInspector.[hm]: Add editor for local keys. * GDL2Palette/GDL2DisplayGroupInspector.gorm: Ditto. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@23563 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
06ba08fb90
commit
c30d6c1913
7 changed files with 106 additions and 9 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
2006-09-19 Matt Rice <ratmice@yahoo.com>
|
||||||
|
|
||||||
|
* GDL2Palette/KeyWrapper.h: Add LocalType.
|
||||||
|
* GDL2Palette/ConnectInspector.m (_localKeysFromDisplayGroup): New
|
||||||
|
method.
|
||||||
|
(updateValues:): Add local keys.
|
||||||
|
(_oaBrowserAction:): Enable ok button for LocalType.
|
||||||
|
Handle relationships explicitly
|
||||||
|
(browser:willDisplayCell:atRow:column:): Enable and set leaf for
|
||||||
|
LocalType keys.
|
||||||
|
* GDL2Palette/DisplayGroupInspector.[hm]: Add editor for local keys.
|
||||||
|
* GDL2Palette/GDL2DisplayGroupInspector.gorm: Ditto.
|
||||||
|
|
||||||
2006-09-18 Matt Rice <ratmice@yahoo.com>
|
2006-09-18 Matt Rice <ratmice@yahoo.com>
|
||||||
|
|
||||||
* DBModeler/SQLGenerator.m (-executeSQL:): Fix memory leak,
|
* DBModeler/SQLGenerator.m (-executeSQL:): Fix memory leak,
|
||||||
|
|
|
@ -210,6 +210,23 @@ static NSMapTable *_objectToAssociation;
|
||||||
return AUTORELEASE(ret);
|
return AUTORELEASE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSArray *) _localKeysFromDisplayGroup:(EODisplayGroup *)dg
|
||||||
|
{
|
||||||
|
NSMutableArray *ret = [[NSMutableArray alloc] init];
|
||||||
|
NSArray *local = [dg localKeys];
|
||||||
|
int i,c;
|
||||||
|
|
||||||
|
for (i = 0, c = [local count]; i < c; i++)
|
||||||
|
{
|
||||||
|
id obj = [local objectAtIndex:i];
|
||||||
|
id key = [KeyWrapper wrapperWithKey:obj type:LocalType];
|
||||||
|
|
||||||
|
[ret addObject:key];
|
||||||
|
}
|
||||||
|
|
||||||
|
return AUTORELEASE(ret);
|
||||||
|
}
|
||||||
|
|
||||||
/* for normal outlets/actions */
|
/* for normal outlets/actions */
|
||||||
- (NSArray *) _keysFromArray:(NSArray *)arr
|
- (NSArray *) _keysFromArray:(NSArray *)arr
|
||||||
{
|
{
|
||||||
|
@ -234,6 +251,7 @@ static NSMapTable *_objectToAssociation;
|
||||||
id cd = [ds classDescriptionForObjects];
|
id cd = [ds classDescriptionForObjects];
|
||||||
[_values addObjectsFromArray:[self _keysFromClassDescription:cd]];
|
[_values addObjectsFromArray:[self _keysFromClassDescription:cd]];
|
||||||
}
|
}
|
||||||
|
[_values addObjectsFromArray:[self _localKeysFromDisplayGroup:dest]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,9 +456,12 @@ static NSMapTable *_objectToAssociation;
|
||||||
for (i = 1; i < column; i++)
|
for (i = 1; i < column; i++)
|
||||||
{
|
{
|
||||||
int aRow = [sender selectedRowInColumn:i];
|
int aRow = [sender selectedRowInColumn:i];
|
||||||
val = [vals objectAtIndex:aRow];
|
|
||||||
|
|
||||||
if ([val keyType] != AttributeType)
|
val = [vals objectAtIndex:aRow];
|
||||||
|
type = [val keyType];
|
||||||
|
|
||||||
|
if (type == ToManyRelationshipType
|
||||||
|
|| type == ToOneRelationshipType)
|
||||||
{
|
{
|
||||||
classDesc =
|
classDesc =
|
||||||
[classDesc classDescriptionForDestinationKey:[val key]];
|
[classDesc classDescriptionForDestinationKey:[val key]];
|
||||||
|
@ -458,7 +479,8 @@ static NSMapTable *_objectToAssociation;
|
||||||
case 'M': wantsTypes |= ToManyRelationshipType; break;
|
case 'M': wantsTypes |= ToManyRelationshipType; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[okButton setEnabled:(wantsTypes & type)];
|
[okButton setEnabled:(wantsTypes & type)
|
||||||
|
|| (type == LocalType)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -682,11 +704,13 @@ willDisplayCell:(id)cell atRow:(int)row column:(int)column
|
||||||
case 'M': wantsTypes |= ToManyRelationshipType; break;
|
case 'M': wantsTypes |= ToManyRelationshipType; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[cell setLeaf: (type == AttributeType)];
|
[cell setLeaf: (type == AttributeType
|
||||||
|
|| type == LocalType)];
|
||||||
// TODO relationships should be NO...
|
// TODO relationships should be NO...
|
||||||
[cell setStringValue: [val key]];
|
[cell setStringValue: [val key]];
|
||||||
[cell setEnabled:(wantsTypes & type)
|
[cell setEnabled:(wantsTypes & type)
|
||||||
|| (wantsTypes & AttributeType)];
|
|| (wantsTypes & AttributeType)
|
||||||
|
|| (type == LocalType)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (sender == connectionsBrowser)
|
else if (sender == connectionsBrowser)
|
||||||
|
|
|
@ -1,12 +1,21 @@
|
||||||
#include <InterfaceBuilder/IBInspector.h>
|
#include <InterfaceBuilder/IBInspector.h>
|
||||||
#include <AppKit/NSNibDeclarations.h>
|
#include <AppKit/NSNibDeclarations.h>
|
||||||
#include <AppKit/NSButton.h>
|
|
||||||
|
@class NSButton;
|
||||||
|
@class NSTableView;
|
||||||
|
@class NSMutableArray;
|
||||||
|
|
||||||
@interface GDL2DisplayGroupInspector : IBInspector
|
@interface GDL2DisplayGroupInspector : IBInspector
|
||||||
{
|
{
|
||||||
IBOutlet NSButton *_fetchesOnLoad;
|
IBOutlet NSButton *_fetchesOnLoad;
|
||||||
IBOutlet NSButton *_refresh;
|
IBOutlet NSButton *_refresh;
|
||||||
IBOutlet NSButton *_validate;
|
IBOutlet NSButton *_validate;
|
||||||
|
|
||||||
|
IBOutlet NSTableView *_localKeysTable;
|
||||||
|
IBOutlet NSButton *_addKey;
|
||||||
|
IBOutlet NSButton *_removeKey;
|
||||||
|
|
||||||
|
NSMutableArray *_localKeys;
|
||||||
}
|
}
|
||||||
-(IBAction) setValidatesImmediately:(id)sender;
|
-(IBAction) setValidatesImmediately:(id)sender;
|
||||||
-(IBAction) setRefreshesAll:(id)sender;
|
-(IBAction) setRefreshesAll:(id)sender;
|
||||||
|
|
|
@ -1,15 +1,24 @@
|
||||||
#include "DisplayGroupInspector.h"
|
#include "DisplayGroupInspector.h"
|
||||||
#include <EOInterface/EODisplayGroup.h>
|
#include <EOInterface/EODisplayGroup.h>
|
||||||
#include <AppKit/NSNibLoading.h>
|
#include <AppKit/NSNibLoading.h>
|
||||||
|
#include <AppKit/NSButton.h>
|
||||||
|
#include <AppKit/NSTableView.h>
|
||||||
|
#include <Foundation/NSArray.h>
|
||||||
|
|
||||||
@implementation GDL2DisplayGroupInspector
|
@implementation GDL2DisplayGroupInspector
|
||||||
- (id) init
|
- (id) init
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
[NSBundle loadNibNamed:@"GDL2DisplayGroupInspector" owner:self];
|
[NSBundle loadNibNamed:@"GDL2DisplayGroupInspector" owner:self];
|
||||||
|
_localKeys = [[NSMutableArray alloc] init];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
RELEASE(_localKeys);
|
||||||
|
}
|
||||||
|
|
||||||
-(IBAction) setValidatesImmediately:(id)sender;
|
-(IBAction) setValidatesImmediately:(id)sender;
|
||||||
{
|
{
|
||||||
[(EODisplayGroup *)[self object]
|
[(EODisplayGroup *)[self object]
|
||||||
|
@ -38,6 +47,40 @@
|
||||||
[_refresh setIntValue:[object usesOptimisticRefresh] ? NO : YES];
|
[_refresh setIntValue:[object usesOptimisticRefresh] ? NO : YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) addKey:(id)sender
|
||||||
|
{
|
||||||
|
[_localKeys addObject:@""];
|
||||||
|
[_localKeysTable reloadData];
|
||||||
|
[_localKeysTable selectRow:([_localKeys count] - 1) byExtendingSelection:NO];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) removeKey:(id)sender
|
||||||
|
{
|
||||||
|
int selRow = [_localKeysTable selectedRow];
|
||||||
|
if (selRow != NSNotFound && selRow > 0 && selRow < [_localKeys count])
|
||||||
|
{
|
||||||
|
[_localKeys removeObjectAtIndex:[_localKeysTable selectedRow]];
|
||||||
|
[_localKeysTable reloadData];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) numberOfRowsInTableView:(NSTableView *)tv
|
||||||
|
{
|
||||||
|
return [_localKeys count];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) tableView:(NSTableView *)tv objectValueForTableColumn:(NSTableColumn *)tc
|
||||||
|
row:(int)row
|
||||||
|
{
|
||||||
|
return [_localKeys objectAtIndex:row];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) tableView:(NSTableView *)tv setObjectValue:(id)newValue forTableColumn:(NSTableColumn *)tc row:(int) row;
|
||||||
|
{
|
||||||
|
[_localKeys replaceObjectAtIndex:row withObject:newValue];
|
||||||
|
[object setLocalKeys:_localKeys];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
"## Comment" = "Do NOT change this file, Gorm maintains it";
|
"## Comment" = "Do NOT change this file, Gorm maintains it";
|
||||||
FirstResponder = {
|
FirstResponder = {
|
||||||
Actions = (
|
Actions = (
|
||||||
|
"addKey:",
|
||||||
|
"removeKey:",
|
||||||
"setFetchesOnLoad:",
|
"setFetchesOnLoad:",
|
||||||
"setRefreshesAll:",
|
"setRefreshesAll:",
|
||||||
"setValidatesImmediately:"
|
"setValidatesImmediately:"
|
||||||
|
@ -12,12 +14,17 @@
|
||||||
Actions = (
|
Actions = (
|
||||||
"setValidatesImmediately:",
|
"setValidatesImmediately:",
|
||||||
"setRefreshesAll:",
|
"setRefreshesAll:",
|
||||||
"setFetchesOnLoad:"
|
"setFetchesOnLoad:",
|
||||||
|
"addKey:",
|
||||||
|
"removeKey:"
|
||||||
);
|
);
|
||||||
Outlets = (
|
Outlets = (
|
||||||
_fetchesOnLoad,
|
_fetchesOnLoad,
|
||||||
_refresh,
|
_refresh,
|
||||||
_validate
|
_validate,
|
||||||
|
_addKey,
|
||||||
|
_localKeysTable,
|
||||||
|
_removeKey
|
||||||
);
|
);
|
||||||
Super = IBInspector;
|
Super = IBInspector;
|
||||||
};
|
};
|
||||||
|
|
Binary file not shown.
|
@ -30,7 +30,8 @@ typedef enum KeyType
|
||||||
AttributeType = 1,
|
AttributeType = 1,
|
||||||
ToOneRelationshipType = 2,
|
ToOneRelationshipType = 2,
|
||||||
ToManyRelationshipType = 4,
|
ToManyRelationshipType = 4,
|
||||||
OtherType = 8
|
OtherType = 8,
|
||||||
|
LocalType = 16
|
||||||
}KeyType;
|
}KeyType;
|
||||||
|
|
||||||
@interface KeyWrapper: NSObject
|
@interface KeyWrapper: NSObject
|
||||||
|
|
Loading…
Reference in a new issue