mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-02-19 01:30:48 +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>
|
||||
|
||||
* DBModeler/SQLGenerator.m (-executeSQL:): Fix memory leak,
|
||||
|
|
|
@ -210,6 +210,23 @@ static NSMapTable *_objectToAssociation;
|
|||
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 */
|
||||
- (NSArray *) _keysFromArray:(NSArray *)arr
|
||||
{
|
||||
|
@ -234,6 +251,7 @@ static NSMapTable *_objectToAssociation;
|
|||
id cd = [ds classDescriptionForObjects];
|
||||
[_values addObjectsFromArray:[self _keysFromClassDescription:cd]];
|
||||
}
|
||||
[_values addObjectsFromArray:[self _localKeysFromDisplayGroup:dest]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,9 +456,12 @@ static NSMapTable *_objectToAssociation;
|
|||
for (i = 1; i < column; 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 classDescriptionForDestinationKey:[val key]];
|
||||
|
@ -458,7 +479,8 @@ static NSMapTable *_objectToAssociation;
|
|||
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;
|
||||
}
|
||||
}
|
||||
[cell setLeaf: (type == AttributeType)];
|
||||
[cell setLeaf: (type == AttributeType
|
||||
|| type == LocalType)];
|
||||
// TODO relationships should be NO...
|
||||
[cell setStringValue: [val key]];
|
||||
[cell setEnabled:(wantsTypes & type)
|
||||
|| (wantsTypes & AttributeType)];
|
||||
|| (wantsTypes & AttributeType)
|
||||
|| (type == LocalType)];
|
||||
}
|
||||
}
|
||||
else if (sender == connectionsBrowser)
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
#include <InterfaceBuilder/IBInspector.h>
|
||||
#include <AppKit/NSNibDeclarations.h>
|
||||
#include <AppKit/NSButton.h>
|
||||
|
||||
@class NSButton;
|
||||
@class NSTableView;
|
||||
@class NSMutableArray;
|
||||
|
||||
@interface GDL2DisplayGroupInspector : IBInspector
|
||||
{
|
||||
IBOutlet NSButton *_fetchesOnLoad;
|
||||
IBOutlet NSButton *_refresh;
|
||||
IBOutlet NSButton *_validate;
|
||||
|
||||
IBOutlet NSTableView *_localKeysTable;
|
||||
IBOutlet NSButton *_addKey;
|
||||
IBOutlet NSButton *_removeKey;
|
||||
|
||||
NSMutableArray *_localKeys;
|
||||
}
|
||||
-(IBAction) setValidatesImmediately:(id)sender;
|
||||
-(IBAction) setRefreshesAll:(id)sender;
|
||||
|
|
|
@ -1,15 +1,24 @@
|
|||
#include "DisplayGroupInspector.h"
|
||||
#include <EOInterface/EODisplayGroup.h>
|
||||
#include <AppKit/NSNibLoading.h>
|
||||
#include <AppKit/NSButton.h>
|
||||
#include <AppKit/NSTableView.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
|
||||
@implementation GDL2DisplayGroupInspector
|
||||
- (id) init
|
||||
{
|
||||
self = [super init];
|
||||
[NSBundle loadNibNamed:@"GDL2DisplayGroupInspector" owner:self];
|
||||
_localKeys = [[NSMutableArray alloc] init];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_localKeys);
|
||||
}
|
||||
|
||||
-(IBAction) setValidatesImmediately:(id)sender;
|
||||
{
|
||||
[(EODisplayGroup *)[self object]
|
||||
|
@ -38,6 +47,40 @@
|
|||
[_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
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
"## Comment" = "Do NOT change this file, Gorm maintains it";
|
||||
FirstResponder = {
|
||||
Actions = (
|
||||
"addKey:",
|
||||
"removeKey:",
|
||||
"setFetchesOnLoad:",
|
||||
"setRefreshesAll:",
|
||||
"setValidatesImmediately:"
|
||||
|
@ -12,12 +14,17 @@
|
|||
Actions = (
|
||||
"setValidatesImmediately:",
|
||||
"setRefreshesAll:",
|
||||
"setFetchesOnLoad:"
|
||||
"setFetchesOnLoad:",
|
||||
"addKey:",
|
||||
"removeKey:"
|
||||
);
|
||||
Outlets = (
|
||||
_fetchesOnLoad,
|
||||
_refresh,
|
||||
_validate
|
||||
_validate,
|
||||
_addKey,
|
||||
_localKeysTable,
|
||||
_removeKey
|
||||
);
|
||||
Super = IBInspector;
|
||||
};
|
||||
|
|
Binary file not shown.
|
@ -30,7 +30,8 @@ typedef enum KeyType
|
|||
AttributeType = 1,
|
||||
ToOneRelationshipType = 2,
|
||||
ToManyRelationshipType = 4,
|
||||
OtherType = 8
|
||||
OtherType = 8,
|
||||
LocalType = 16
|
||||
}KeyType;
|
||||
|
||||
@interface KeyWrapper: NSObject
|
||||
|
|
Loading…
Reference in a new issue