* 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
{
NSString * newUSLStr = nil;
ASSIGN(_eomodel, [EOModel modelWithContentsOfFile: [absoluteURL path]]);
ASSIGN(_entityNames,[_eomodel entityNames]);
@ -851,6 +850,46 @@ NSString *EOMConsistencyModelObjectKey = @"EOMConsistencyModelObjectKey";
[_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
{
EOEntity * entity = [self outlineSelection];
@ -864,6 +903,10 @@ NSString *EOMConsistencyModelObjectKey = @"EOMConsistencyModelObjectKey";
}
- (IBAction)delete:(id)sender
{
}
#pragma mark -
#pragma mark key value observing
@ -896,4 +939,34 @@ NSString *EOMConsistencyModelObjectKey = @"EOMConsistencyModelObjectKey";
// 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

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
{
return (EOMEDocument *) [[NSDocumentController sharedDocumentController] currentDocument];

View file

@ -2,7 +2,7 @@
<!DOCTYPE gsmarkup>
<gsmarkup>
<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>
<box topPadding="0" bottomPadding="3" leftPadding="4" rightPadding="4" width="260">
<grid>

View file

@ -2,7 +2,7 @@
<!DOCTYPE gsmarkup>
<gsmarkup>
<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>
<box title="Names" topPadding="10" leftPadding="4" rightPadding="4" width="260">
<grid>

View file

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

View file

@ -2,7 +2,7 @@
<!DOCTYPE gsmarkup>
<gsmarkup>
<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>
<box topPadding="4" bottomPadding="200" leftPadding="4" rightPadding="4" width="260">
<grid>

View file

@ -2,7 +2,7 @@
<!DOCTYPE gsmarkup>
<gsmarkup>
<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>
<grid>
<gridRow>

View file

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

View file

@ -2,7 +2,7 @@
<!DOCTYPE gsmarkup>
<gsmarkup>
<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>
<splitView vertical="no" autosaveName="verticalsplit">
<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>
* Apps/EOModeler/EOMInspectorController.m
int -> NSUInteger, call sizeToCells