* Apps/EOModelEditor/Inspectors/*.gsmarkup

tried to fix on X11
* Apps/EOModelEditor/EOModelEditorApp.m
  new: to create new models manually
* Apps/EOModelEditor/Inspectors/EntityInspector.m
  check for empty strings before filling fields
* Apps/EOModelEditor/Inspectors/RelationshipInspector.m
  check for empty name
* Apps/EOModelEditor/EOMEDocument.m
  addEntity, addRelationship, validateUserInterfaceItem



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@30519 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Dave Wetzel 2010-06-01 09:30:14 +00:00
parent 5095e6dfe9
commit bfd39c720e
10 changed files with 113 additions and 11 deletions

View file

@ -499,7 +499,6 @@ NSString *EOMConsistencyModelObjectKey = @"EOMConsistencyModelObjectKey";
- (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError - (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError
{ {
NSString * newUSLStr = nil;
ASSIGN(_eomodel, [EOModel modelWithContentsOfFile: [absoluteURL path]]); ASSIGN(_eomodel, [EOModel modelWithContentsOfFile: [absoluteURL path]]);
ASSIGN(_entityNames,[_eomodel entityNames]); ASSIGN(_entityNames,[_eomodel entityNames]);
@ -851,6 +850,46 @@ NSString *EOMConsistencyModelObjectKey = @"EOMConsistencyModelObjectKey";
[_outlineView reloadData]; [_outlineView reloadData];
} }
- (IBAction)addEntity:(id)sender
{
EOEntity * newEntity;
NSUInteger count;
count = [[_eomodel entityNames] count];
newEntity = [[EOEntity alloc] init];
[newEntity setName:[NSString stringWithFormat:@"Entity%d", count]];
[newEntity setClassName:@"EOGenericRecord"];
[_eomodel addEntity:newEntity];
RELEASE(newEntity);
[_outlineView reloadData];
}
- (IBAction)addRelationship:(id)sender
{
EORelationship * newRel;
EOEntity * selectedEntity;
NSUInteger count = 0;
selectedEntity = (EOEntity*) _outlineSelection;
if ([selectedEntity relationships]) {
count = [[selectedEntity relationships] count];
}
newRel = [[EORelationship alloc] init];
[newRel setName:[NSString stringWithFormat:@"Relationship%d", count]];
[selectedEntity addRelationship:newRel];
RELEASE(newRel);
[_bottomTableViewController setRepresentedObject:[selectedEntity relationships]];
[_bottomTableView reloadData];
}
- (IBAction)dataBrowser:(id)sender - (IBAction)dataBrowser:(id)sender
{ {
EOEntity * entity = [self outlineSelection]; EOEntity * entity = [self outlineSelection];
@ -864,6 +903,10 @@ NSString *EOMConsistencyModelObjectKey = @"EOMConsistencyModelObjectKey";
} }
- (IBAction)delete:(id)sender
{
}
#pragma mark - #pragma mark -
#pragma mark key value observing #pragma mark key value observing
@ -896,4 +939,34 @@ NSString *EOMConsistencyModelObjectKey = @"EOMConsistencyModelObjectKey";
// NSLog(@"%s: %@, %@, %@", __PRETTY_FUNCTION__, keyPath, object, change); // NSLog(@"%s: %@, %@, %@", __PRETTY_FUNCTION__, keyPath, object, change);
} }
- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem
{
SEL action = [anItem action];
//NSLog(@"%s: %@", __PRETTY_FUNCTION__, anItem);
if ((action == @selector(addAttribute:))) {
if ((!_outlineSelection) ||
(([_outlineSelection class] != [EOEntity class]) && ([_outlineSelection class] != [EOStoredProcedure class]))) {
return NO;
}
}
if ((action == @selector(addRelationship:))) {
if ((!_outlineSelection) ||
([_outlineSelection class] != [EOEntity class])) {
return NO;
}
}
if ((action == @selector(delete:))) {
if (!_outlineSelection) {
return NO;
}
}
return [super validateUserInterfaceItem:anItem];
}
@end @end

View file

@ -117,6 +117,16 @@
} }
} }
- (void) new:(id)sender
{
EOModel *newModel = [[EOModel alloc] init];
// [newModel setName: @"test"];
[self newDocumentWithModel:newModel];
RELEASE(newModel);
}
- (EOMEDocument *) activeDocument - (EOMEDocument *) activeDocument
{ {
return (EOMEDocument *) [[NSDocumentController sharedDocumentController] currentDocument]; return (EOMEDocument *) [[NSDocumentController sharedDocumentController] currentDocument];

View file

@ -2,7 +2,7 @@
<!DOCTYPE gsmarkup> <!DOCTYPE gsmarkup>
<gsmarkup> <gsmarkup>
<objects> <objects>
<window id="window" title="Inspector" width="268.0" resizable="no" autosaveName="Inspector" visible="no"> <window id="window" title="Inspector" width="268.0" height="405" resizable="no" autosaveName="Inspector" visible="no">
<vbox> <vbox>
<box topPadding="0" bottomPadding="3" leftPadding="4" rightPadding="4" width="260"> <box topPadding="0" bottomPadding="3" leftPadding="4" rightPadding="4" width="260">
<grid> <grid>

View file

@ -2,7 +2,7 @@
<!DOCTYPE gsmarkup> <!DOCTYPE gsmarkup>
<gsmarkup> <gsmarkup>
<objects> <objects>
<window id="window" title="Inspector" width="268.0" resizable="no" autosaveName="Inspector" visible="no"> <window id="window" title="Inspector" width="268.0" height="405" resizable="no" autosaveName="Inspector" visible="no">
<vbox> <vbox>
<box title="Names" topPadding="10" leftPadding="4" rightPadding="4" width="260"> <box title="Names" topPadding="10" leftPadding="4" rightPadding="4" width="260">
<grid> <grid>

View file

@ -88,14 +88,17 @@
- (void) refresh - (void) refresh
{ {
EOModel *activeModel = [[NSApp activeDocument] eomodel]; NSString * stringValue = nil;
EOModel * activeModel = [[NSApp activeDocument] eomodel];
ASSIGN(_currentEntity, (EOEntity *) [self selectedObject]); ASSIGN(_currentEntity, (EOEntity *) [self selectedObject]);
stringValue = [_currentEntity name];
[nameField setStringValue:[_currentEntity name]]; [nameField setStringValue:(stringValue) ? stringValue : @""];
[tableNameField setStringValue:[_currentEntity externalName]]; stringValue = [_currentEntity externalName];
[classNameField setStringValue:[_currentEntity className]]; [tableNameField setStringValue:(stringValue) ? stringValue : @""];
stringValue = [_currentEntity className];
[classNameField setStringValue:(stringValue) ? stringValue : @""];
} }

View file

@ -2,7 +2,7 @@
<!DOCTYPE gsmarkup> <!DOCTYPE gsmarkup>
<gsmarkup> <gsmarkup>
<objects> <objects>
<window id="window" title="Inspector" width="268.0" resizable="no" autosaveName="Inspector" visible="no"> <window id="window" title="Inspector" width="268.0" height="405" resizable="no" autosaveName="Inspector" visible="no">
<vbox> <vbox>
<box topPadding="4" bottomPadding="200" leftPadding="4" rightPadding="4" width="260"> <box topPadding="4" bottomPadding="200" leftPadding="4" rightPadding="4" width="260">
<grid> <grid>

View file

@ -2,7 +2,7 @@
<!DOCTYPE gsmarkup> <!DOCTYPE gsmarkup>
<gsmarkup> <gsmarkup>
<objects> <objects>
<window id="window" title="Inspector" width="268.0" resizable="no" autosaveName="Inspector" visible="no"> <window id="window" title="Inspector" width="268.0" height="405" resizable="no" autosaveName="Inspector" visible="no">
<vbox> <vbox>
<grid> <grid>
<gridRow> <gridRow>

View file

@ -241,6 +241,10 @@
if (!destinationEntity) { if (!destinationEntity) {
NSString * name = [[destinationEntityBrowser selectedCell] title]; NSString * name = [[destinationEntityBrowser selectedCell] title];
if (!name) {
return 0;
}
activeModel = [[NSApp activeDocument] eomodel]; activeModel = [[NSApp activeDocument] eomodel];
destinationEntity = [activeModel entityNamed:name]; destinationEntity = [activeModel entityNamed:name];

View file

@ -2,7 +2,7 @@
<!DOCTYPE gsmarkup> <!DOCTYPE gsmarkup>
<gsmarkup> <gsmarkup>
<objects> <objects>
<window id="window" title="Inspector" width="268.0" resizable="no" autosaveName="Inspector" visible="no"> <window id="window" title="Inspector" width="268.0" height="405" resizable="no" autosaveName="Inspector" visible="no">
<vbox> <vbox>
<splitView vertical="no" autosaveName="verticalsplit"> <splitView vertical="no" autosaveName="verticalsplit">
<vbox> <vbox>

View file

@ -1,3 +1,15 @@
2010-06-01 David Wetzel <dave@turbocat.de>
* Apps/EOModelEditor/Inspectors/*.gsmarkup
tried to fix on X11
* Apps/EOModelEditor/EOModelEditorApp.m
new: to create new models manually
* Apps/EOModelEditor/Inspectors/EntityInspector.m
check for empty strings before filling fields
* Apps/EOModelEditor/Inspectors/RelationshipInspector.m
check for empty name
* Apps/EOModelEditor/EOMEDocument.m
addEntity, addRelationship, validateUserInterfaceItem
2010-05-31 David Wetzel <dave@turbocat.de> 2010-05-31 David Wetzel <dave@turbocat.de>
* Apps/EOModeler/EOMInspectorController.m * Apps/EOModeler/EOMInspectorController.m
int -> NSUInteger, call sizeToCells int -> NSUInteger, call sizeToCells