mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-04-22 12:55:44 +00:00
* EOInterface/EODisplayGroup.m: Correct selector name.
* EOInterface/EOTableViewAssociation.m: Remove observer notification suppression. * DBModeler/Modeler.m: Add some debug code. * DBModeler/Inspectors/AttributeInspector.h/m: Implement. * DBModeler/Inspectors/AttributeInspector.gorm: Update interface. * DBModeler/ModelerTableEmbedibleEditor.m: Send notification on displayGroup:didSetValue:forObject:key. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@23530 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
261ec5f91f
commit
d8132f5e6e
9 changed files with 347 additions and 13 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2006-09-15 Matt Rice <ratmice@yahoo.com>
|
||||
|
||||
* EOInterface/EODisplayGroup.m: Correct selector name.
|
||||
* EOInterface/EOTableViewAssociation.m: Remove observer notification
|
||||
suppression.
|
||||
* DBModeler/Modeler.m: Add some debug code.
|
||||
* DBModeler/Inspectors/AttributeInspector.h/m: Implement.
|
||||
* DBModeler/Inspectors/AttributeInspector.gorm: Update interface.
|
||||
* DBModeler/ModelerTableEmbedibleEditor.m: Send notification on
|
||||
displayGroup:didSetValue:forObject:key.
|
||||
|
||||
2006-09-15 Matt Rice <ratmice@yahoo.com>
|
||||
2006-09-15 David Ayers <ayers@fsfe.org>
|
||||
|
||||
|
|
|
@ -5,7 +5,14 @@
|
|||
"setValueClassNameAndType:",
|
||||
"setExternalName:",
|
||||
"setExternalType:",
|
||||
"setName:"
|
||||
"setName:",
|
||||
"setConversionMethod:",
|
||||
"setClassName:",
|
||||
"setFactoryMethod:",
|
||||
"setInitArgument:",
|
||||
"setPrecision:",
|
||||
"setWidth:",
|
||||
"setTimeZone:"
|
||||
);
|
||||
Outlets = (
|
||||
_extNameField,
|
||||
|
@ -20,7 +27,17 @@
|
|||
_doubleFlip,
|
||||
_integerFlip,
|
||||
_stringFlip,
|
||||
_internalData
|
||||
_internalData,
|
||||
_custom_arg,
|
||||
_custom_class,
|
||||
_custom_conversion,
|
||||
_custom_factory,
|
||||
_custom_width,
|
||||
_string_width,
|
||||
_data_width,
|
||||
_decimal_precision,
|
||||
_decimal_width,
|
||||
_date_tz
|
||||
);
|
||||
Super = EOMInspector;
|
||||
};
|
||||
|
@ -35,10 +52,17 @@
|
|||
};
|
||||
FirstResponder = {
|
||||
Actions = (
|
||||
"setValueClassNameAndType:",
|
||||
"setTimeZone:",
|
||||
"setClassName:",
|
||||
"setConversionMethod:",
|
||||
"setExternalName:",
|
||||
"setExternalType:",
|
||||
"setName:"
|
||||
"setFactoryMethod:",
|
||||
"setInitArgument:",
|
||||
"setName:",
|
||||
"setPrecision:",
|
||||
"setValueClassNameAndType:",
|
||||
"setWidth:"
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
|
|
Binary file not shown.
|
@ -1,10 +1,64 @@
|
|||
#include <EOAccess/EOAttribute.h>
|
||||
#include <EOModeler/EOMInspector.h>
|
||||
|
||||
#include <AppKit/NSBox.h>
|
||||
#include <AppKit/NSTextField.h>
|
||||
#include <AppKit/NSPopUpButton.h>
|
||||
#include <AppKit/NSNibDeclarations.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
|
||||
|
||||
@interface AttributeInspector : EOMInspector
|
||||
{
|
||||
|
||||
}
|
||||
IBOutlet NSTextField *_extNameField;
|
||||
IBOutlet NSTextField *_extTypeField;
|
||||
IBOutlet NSPopUpButton *_flipSelect;// select which valueClassName/flip
|
||||
IBOutlet NSBox *_flipView; // gets replaced with a *Flip...
|
||||
IBOutlet NSBox *_internalData;
|
||||
IBOutlet NSTextField *_nameField;
|
||||
|
||||
NSDictionary *_flipDict;
|
||||
NSDictionary *_classTitleDict;
|
||||
NSDictionary *_titleClassDict;
|
||||
NSDictionary *_valueTypeTitleDict;
|
||||
|
||||
IBOutlet NSBox *_customFlip; // default
|
||||
IBOutlet NSBox *_dataFlip;
|
||||
IBOutlet NSBox *_dateFlip;
|
||||
IBOutlet NSBox *_decimalFlip;
|
||||
IBOutlet NSBox *_doubleFlip;
|
||||
IBOutlet NSBox *_integerFlip;
|
||||
IBOutlet NSBox *_stringFlip;
|
||||
|
||||
NSTextField *_custom_width;
|
||||
NSTextField *_custom_class;
|
||||
NSTextField *_custom_factory;
|
||||
NSTextField *_custom_conversion;
|
||||
NSPopUpButton *_custom_arg;
|
||||
|
||||
NSTextField *_string_width;
|
||||
|
||||
NSTextField *_decimal_precision;
|
||||
NSTextField *_decimal_width;
|
||||
|
||||
NSTextField *_data_width;
|
||||
|
||||
NSButton *_date_tz;
|
||||
}
|
||||
/* generic */
|
||||
- (IBAction) setName:(id)sender;
|
||||
- (IBAction) setExternalName:(id)sender;
|
||||
- (IBAction) setExternalType:(id)sender;
|
||||
- (IBAction) setValueClassNameAndType:(id)sender;
|
||||
|
||||
/* dependent on value class name */
|
||||
- (IBAction) setWidth:(id)sender;
|
||||
- (IBAction) setPrecision:(id)sender;
|
||||
- (IBAction) setClassName:(id)sender;
|
||||
- (IBAction) setFactoryMethod:(id)sender;
|
||||
- (IBAction) setConversionMethod:(id)sender;
|
||||
- (IBAction) setInitArgument:(id)sender;
|
||||
|
||||
- (IBAction) setTimeZone:(id)sender;
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,16 +1,244 @@
|
|||
#include "AttributeInspector.h"
|
||||
#include <Foundation/NSObjCRuntime.h>
|
||||
|
||||
@implementation AttributeInspector
|
||||
- (void) awakeFromNib
|
||||
{
|
||||
RETAIN(_internalData);
|
||||
_flipDict =
|
||||
[[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
_stringFlip, @"String",
|
||||
_customFlip, @"Custom",
|
||||
_dataFlip, @"Data",
|
||||
_dateFlip, @"Date",
|
||||
_decimalFlip, @"Decimal Number",
|
||||
_doubleFlip, @"Double",
|
||||
_integerFlip, @"Integer",
|
||||
nil];
|
||||
|
||||
/*
|
||||
* class name = key, pop-up item = value,
|
||||
* "Custom" is not found,
|
||||
* double and integer are both NSNumbers, but handled specially,
|
||||
* double is the default if a value type is not specified.
|
||||
*/
|
||||
_classTitleDict =
|
||||
[[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
@"String", @"NSString",
|
||||
@"Data", @"NSData",
|
||||
@"Double", @"NSNumber", // Integer and Double, Double is default.
|
||||
@"Date", @"NSCalendarDate",
|
||||
@"Decimal Number", @"NSDecimalNumber",
|
||||
nil];
|
||||
|
||||
_titleClassDict =
|
||||
[[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
@"NSString", @"String",
|
||||
@"NSData", @"Data",
|
||||
@"NSNumber", @"Double",
|
||||
@"NSNumber", @"Integer",
|
||||
@"NSDecimalNumber", @"Decimal Number",
|
||||
@"NSCalendarDate", @"Date",
|
||||
nil];
|
||||
|
||||
_valueTypeTitleDict =
|
||||
[[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
@"d", @"Double",
|
||||
@"i", @"Integer",
|
||||
nil];
|
||||
}
|
||||
|
||||
- (NSString *) _titleForPopUp
|
||||
{
|
||||
NSString *vcn = [(EOAttribute *)[self selectedObject] valueClassName];
|
||||
NSString *valueType = [(EOAttribute *)[self selectedObject] valueType];
|
||||
NSString *ret;
|
||||
|
||||
if (valueType)
|
||||
{
|
||||
if ([vcn isEqual: @"NSNumber"])
|
||||
{
|
||||
if ([valueType isEqual:@"d"])
|
||||
return @"Double";
|
||||
else if ([valueType isEqual:@"i"])
|
||||
return @"Integer";
|
||||
}
|
||||
}
|
||||
ret = [_classTitleDict objectForKey:vcn];
|
||||
if (!ret)
|
||||
return @"Custom";
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (NSString *)_valueTypeForTitle:(NSString *)title
|
||||
{
|
||||
return [_valueTypeTitleDict objectForKey:title];
|
||||
}
|
||||
|
||||
- (NSString *)_classNameForTitle:(NSString *)title
|
||||
{
|
||||
return [_titleClassDict objectForKey:title];
|
||||
}
|
||||
|
||||
- (NSBox *) _viewForTitle:(NSString *)title
|
||||
{
|
||||
return (NSBox *)[_flipDict objectForKey:title];
|
||||
}
|
||||
|
||||
- (float) displayOrder
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (IBAction) setName:(id)sender;
|
||||
{
|
||||
[(EOAttribute *)[self selectedObject] setName:[sender stringValue]];
|
||||
}
|
||||
|
||||
- (IBAction) setExternalName:(id)sender;
|
||||
{
|
||||
[(EOAttribute *)[self selectedObject] setColumnName:[sender stringValue]];
|
||||
}
|
||||
|
||||
- (IBAction) setExternalType:(id)sender;
|
||||
{
|
||||
[(EOAttribute *)[self selectedObject] setExternalType:[sender stringValue]];
|
||||
}
|
||||
|
||||
- (IBAction) setValueClassNameAndType:(id)sender;
|
||||
{
|
||||
EOAttribute *obj = [self selectedObject];
|
||||
NSString *title = [_flipSelect titleOfSelectedItem];
|
||||
NSString *className = [self _classNameForTitle:title];
|
||||
NSString *valueType = [self _valueTypeForTitle:title];
|
||||
|
||||
if (![[obj valueClassName] isEqual:className])
|
||||
{
|
||||
[obj setValueClassName:className];
|
||||
}
|
||||
if (![[obj valueType] isEqual:valueType])
|
||||
{
|
||||
[obj setValueType:valueType];
|
||||
}
|
||||
[self refresh];
|
||||
}
|
||||
|
||||
- (void) refresh
|
||||
{
|
||||
EOAttribute *obj = [self selectedObject];
|
||||
NSString *title = [self _titleForPopUp];
|
||||
NSBox *flipTo = [self _viewForTitle:title];
|
||||
|
||||
[_nameField setStringValue:[obj name]];
|
||||
[_extNameField setStringValue:[obj columnName]];
|
||||
[_extTypeField setStringValue:[obj externalType]];
|
||||
[_flipSelect selectItemWithTitle:title];
|
||||
[flipTo setFrame: [_flipView frame]];
|
||||
[_internalData replaceSubview:_flipView with:flipTo];
|
||||
_flipView = flipTo;
|
||||
[self performSelector:
|
||||
NSSelectorFromString([@"update" stringByAppendingString:[title stringByReplacingString:@" " withString:@""]])];
|
||||
}
|
||||
|
||||
- (void) updateString
|
||||
{
|
||||
int tmp;
|
||||
tmp = [[self selectedObject] width];
|
||||
tmp ? [_string_width setIntValue:tmp]
|
||||
: [_string_width setStringValue:@""];
|
||||
}
|
||||
|
||||
- (void) updateCustom
|
||||
{
|
||||
EOAttribute *obj = [self selectedObject];
|
||||
int tmp;
|
||||
tmp = [obj width];
|
||||
tmp ? [_custom_width setIntValue:tmp]
|
||||
: [_custom_width setStringValue:@""];
|
||||
[_custom_class setStringValue:[obj valueClassName]];
|
||||
[_custom_factory setStringValue:[obj valueFactoryMethodName]];
|
||||
[_custom_conversion setStringValue:[obj adaptorValueConversionMethodName]];
|
||||
[_custom_arg selectItemAtIndex:
|
||||
[_custom_arg indexOfItemWithTag: [obj factoryMethodArgumentType]]];
|
||||
}
|
||||
|
||||
- (void) updateDecimalNumber
|
||||
{
|
||||
EOAttribute *obj = [self selectedObject];
|
||||
int tmp;
|
||||
|
||||
tmp = [obj width];
|
||||
tmp ? [_decimal_width setIntValue:tmp]
|
||||
: [_decimal_width setStringValue:@""];
|
||||
tmp = [obj precision];
|
||||
tmp ? [_decimal_precision setIntValue:[obj width]]
|
||||
: [_decimal_precision setStringValue:@""];
|
||||
|
||||
}
|
||||
|
||||
- (void) updateInteger
|
||||
{
|
||||
}
|
||||
|
||||
- (void) updateDate
|
||||
{
|
||||
// fixme
|
||||
}
|
||||
|
||||
- (void) updateData
|
||||
{
|
||||
int tmp;
|
||||
|
||||
tmp = [[self selectedObject] width];
|
||||
tmp ? [_data_width setIntValue:tmp]
|
||||
: [_data_width setStringValue:@""];
|
||||
}
|
||||
|
||||
- (void) updateDouble;
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
- (BOOL) canInspectObject:(id)obj
|
||||
{
|
||||
return [obj isKindOfClass:[EOAttribute class]];
|
||||
}
|
||||
|
||||
- (IBAction) setTimeZone:(id)sender;
|
||||
{
|
||||
// fixme
|
||||
}
|
||||
|
||||
- (IBAction) setWidth:(id)sender;
|
||||
{
|
||||
[(EOAttribute *)[self selectedObject] setWidth:[sender intValue]];
|
||||
}
|
||||
|
||||
- (IBAction) setPrecision:(id)sender;
|
||||
{
|
||||
[(EOAttribute *)[self selectedObject] setPrecision:[sender intValue]];
|
||||
}
|
||||
|
||||
- (IBAction) setClassName:(id)sender;
|
||||
{
|
||||
[[self selectedObject] setValueClassName:[sender stringValue]];
|
||||
}
|
||||
|
||||
- (IBAction) setFactoryMethod:(id)sender;
|
||||
{
|
||||
[[self selectedObject] setValueFactoryMethodName:[sender stringValue]];
|
||||
|
||||
}
|
||||
|
||||
- (IBAction) setConversionMethod:(id)sender;
|
||||
{
|
||||
[[self selectedObject] setAdaptorValueConversionMethodName:[sender stringValue]];
|
||||
}
|
||||
|
||||
- (IBAction) setInitArgument:(id)sender
|
||||
{
|
||||
[[self selectedObject] setFactoryMethodArgumentType:[[sender selectedItem] tag]];
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
|
@ -42,11 +42,23 @@
|
|||
#include <EOAccess/EOAdaptorContext.h>
|
||||
#include <EOAccess/EOAdaptor.h>
|
||||
|
||||
#include <EOControl/EOObserver.h>
|
||||
|
||||
#include <AppKit/NSOpenPanel.h>
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
#include <Foundation/NSFileManager.h>
|
||||
@interface DebugObserver : NSObject <EOObserving>
|
||||
{
|
||||
|
||||
}
|
||||
@end
|
||||
@implementation DebugObserver
|
||||
- (void) objectWillChange:(id)subj
|
||||
{
|
||||
NSLog(@"%@ %@ %@", NSStringFromSelector(_cmd), [subj class], subj);
|
||||
}
|
||||
@end
|
||||
@interface NSMenu (im_lazy)
|
||||
-(id <NSMenuItem>) addItemWithTitle: (NSString *)s;
|
||||
-(id <NSMenuItem>) addItemWithTitle: (NSString *)s action: (SEL)sel;
|
||||
|
@ -83,7 +95,8 @@
|
|||
NSArray *bundlesToLoad = RETAIN([defaults arrayForKey: @"BundlesToLoad"]);
|
||||
NSMenu *mainMenu,*subMenu;
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
|
||||
|
||||
// [EOObserverCenter addOmniscientObserver:[DebugObserver new]];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(bundleDidLoad:)
|
||||
name:NSBundleDidLoadNotification
|
||||
|
|
|
@ -146,5 +146,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void) displayGroup:(EODisplayGroup *)dg didSetValue:(id)value
|
||||
forObject:(id)obj key:(NSString *)key
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:EOMSelectionChangedNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -1054,7 +1054,7 @@ static BOOL _globalDefaultForValidatesChangesImmediately = NO;
|
|||
|
||||
- (BOOL)setValue: (id)value forObject: (id)object key: (NSString *)key
|
||||
{
|
||||
SEL didSetValue = @selector(displayGroup:didSetValue:forKey:);
|
||||
SEL didSetValue = @selector(displayGroup:didSetValue:forObject:key:);
|
||||
NSException *exception = nil;
|
||||
|
||||
NS_DURING
|
||||
|
|
|
@ -152,12 +152,10 @@ static NSMapTable *tvAssociationMap;
|
|||
int rowIndex = [[selectionIndexes objectAtIndex:i] intValue];
|
||||
|
||||
/* don't extend the first selection */
|
||||
[EOObserverCenter suppressObserverNotification];
|
||||
[[self object] selectRow: rowIndex
|
||||
byExtendingSelection: (i != 0)];
|
||||
|
||||
[[self object] scrollRowToVisible:rowIndex];
|
||||
[EOObserverCenter enableObserverNotification];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -169,9 +167,7 @@ static NSMapTable *tvAssociationMap;
|
|||
*/
|
||||
if ([[self object] allowsEmptySelection])
|
||||
{
|
||||
[EOObserverCenter suppressObserverNotification];
|
||||
[[self object] deselectAll:self];
|
||||
[EOObserverCenter enableObserverNotification];
|
||||
[[self object] deselectAll:self];
|
||||
}
|
||||
else
|
||||
NSLog(@"attempting to clear selection when table view won't allow empty selection");
|
||||
|
|
Loading…
Reference in a new issue