2005-05-13 00:25:27 +00:00
|
|
|
/**
|
|
|
|
ModelerEntityEditor.m
|
|
|
|
|
|
|
|
Author: Matt Rice <ratmice@yahoo.com>
|
2006-09-21 07:24:22 +00:00
|
|
|
Date: 2005, 2006
|
2005-05-13 00:25:27 +00:00
|
|
|
|
|
|
|
This file is part of DBModeler.
|
|
|
|
|
|
|
|
<license>
|
|
|
|
DBModeler is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
DBModeler is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with DBModeler; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
</license>
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
|
|
#include "DefaultColumnProvider.h"
|
|
|
|
#include "ModelerAttributeEditor.h"
|
|
|
|
#include "ModelerEntityEditor.h"
|
|
|
|
#include "KVDataSource.h"
|
|
|
|
|
|
|
|
#include <EOInterface/EODisplayGroup.h>
|
|
|
|
#include <EOAccess/EOEntity.h>
|
|
|
|
#include <EOControl/EOObserver.h>
|
|
|
|
#include <EOModeler/EOModelerApp.h>
|
|
|
|
#include <EOModeler/EOModelerDocument.h>
|
|
|
|
|
|
|
|
#include <AppKit/NSImage.h>
|
|
|
|
#include <AppKit/NSSplitView.h>
|
|
|
|
#include <AppKit/NSScrollView.h>
|
|
|
|
#include <AppKit/NSTableColumn.h>
|
|
|
|
#include <AppKit/NSTableView.h>
|
|
|
|
#include <AppKit/NSMenu.h>
|
|
|
|
#include <AppKit/NSMenuItem.h>
|
|
|
|
#include <AppKit/NSPopUpButton.h>
|
|
|
|
#include <AppKit/NSPopUpButtonCell.h>
|
|
|
|
|
|
|
|
@interface EOModelerDocument (asdf)
|
|
|
|
-(void)_setDisplayGroup:(id)displayGroup;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface ModelerEntityEditor (Private)
|
|
|
|
- (void) _loadColumnsForClass:(Class) aClass;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation ModelerEntityEditor
|
|
|
|
|
|
|
|
- (BOOL) canSupportCurrentSelection
|
|
|
|
{
|
|
|
|
id selection = [self selectionWithinViewedObject];
|
|
|
|
BOOL flag;
|
|
|
|
|
|
|
|
if ([selection count] == 0)
|
|
|
|
{
|
|
|
|
flag = NO;
|
|
|
|
return flag;
|
|
|
|
}
|
|
|
|
selection = [selection objectAtIndex:0];
|
|
|
|
flag = [selection isKindOfClass:[EOModel class]];
|
|
|
|
return flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *) friendEditorClasses
|
|
|
|
{
|
|
|
|
return [NSArray arrayWithObjects: [ModelerAttributeEditor class], nil];
|
|
|
|
}
|
|
|
|
|
* DBModeler/AdaptorsPanel.m (-init): Add parenthesis around
assignment. Replace label with window title.
(-runAdaptorsPanel:): Remove unused variable.
* DBModeler/DefaultColumnProvider.m: Add missing braces, remove
unused ivars.
(-cellForColumnNamed:): Autorelease cells.
* DBModeler/EOAdditions.m: New EOAttribute KVC methods -allowNull and
-setAllowNull:.
* DBModeler/GNUmakefile: Add new to project.
* DBModeler/KVDataSource.m (-createObject:): Return nil after
throwing exception.
* DBModeler/MainModelEditor.m
(-dragImageForRows:event:dragImageOffset:):: Enable drag and
drop for relationships.
(-initWithDocument:): Add parenthesis around assignment. Don't
release the document window on close.
(-ecStuff:): temporarily reload everything in the outline view when
something changes.
(-viewSelectedObject:): Remove NSLog. Rewrite editor activation.
Fix leaks.
* DBModeler/Modeler.m (-applicationWillFinishLaunching:): Add new menu
items. Don't order our menu in.
(-new:,-open:): Move document initializition to _newDocumentWithModel:.
(-_newDocumentWithModel:,-newFromDatabase:): New methods.
(-validateMenuItem:,-generateSQL:): Ditto.
* DBModeler/ModelerAttributeEditor.m (-initWithParentEditor:):
Remove unused variables.
(-displayGroupDidChangeSelection:): return early if there is no
longer a selection.
* DBModeler/ModelerEntityEditor.m:
(-canSupportCurrentSelection): Remove NSLog.
(-displayGroupDidChangeSelection:): Ditto.
(-dealloc:): New method.
(-initWithParentEditor:): Remove unused variables. Add parens around
assignment. Release local variables.
* DBModeler/ModelerTableEmbedibleEditor:
(-addDefaultTableColumnsForTableView:displayGroup:): Release table
columns.
(-addTableColumnForItem:tableView:): Ditto.
* DBModeler/Inspectors/RelationshipInspector.m:
(-selectedEntity, -selectedDestinationAttribute): New methods.
(-selectedSourceAttribute, -indexOfSourceAttribute:): Ditto.
(-indexOfDestinationAttribute:,joinWithSource:destination:): Ditto.
(-selectedJoin:,updateConnectButton,): Ditto.
(-refresh): Rewrite using new methods.
(-numberOfRowsInTableView:): Add fallback return value.
(-tableView:objectValueForTableColumn:row:): Ditto.
(-tableView:selectionDidChange:): If a source or destination
attribute is now selected, select its counterpart.
(-tableView:shouldSelectRow:): New method to disallow entity
selection if there is a destination entity.
(-tableView:willDisplayCell:forTableColumn:row:): New method,
set the cell text color to disabled text color, if we would disallow
selection.
(-connectionChanged:): Implement disconnection.
* DBModeler/SQLGenerator.h/m: New files initial implementation.
* DBModeler/Resources/SQLGenerator.gorm: Ditto.
* DBModeler/ConsistencyChecker.h/m: Ditto.
* DBModeler/ConsistencyResults.h/m: Ditto.
* DBModeler/ConsistencyResults.gorm: Ditto.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21438 72102866-910b-0410-8b05-ffd578937521
2005-07-09 02:07:42 +00:00
|
|
|
- (void) dealloc
|
|
|
|
{
|
|
|
|
[EOObserverCenter removeObserver:self forObject:[[self document] model]];
|
|
|
|
RELEASE(_splitView);
|
|
|
|
RELEASE(dg);
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
2005-05-13 00:25:27 +00:00
|
|
|
- (id) initWithParentEditor: (EOModelerCompoundEditor *)parentEditor
|
|
|
|
{
|
* DBModeler/AdaptorsPanel.m (-init): Add parenthesis around
assignment. Replace label with window title.
(-runAdaptorsPanel:): Remove unused variable.
* DBModeler/DefaultColumnProvider.m: Add missing braces, remove
unused ivars.
(-cellForColumnNamed:): Autorelease cells.
* DBModeler/EOAdditions.m: New EOAttribute KVC methods -allowNull and
-setAllowNull:.
* DBModeler/GNUmakefile: Add new to project.
* DBModeler/KVDataSource.m (-createObject:): Return nil after
throwing exception.
* DBModeler/MainModelEditor.m
(-dragImageForRows:event:dragImageOffset:):: Enable drag and
drop for relationships.
(-initWithDocument:): Add parenthesis around assignment. Don't
release the document window on close.
(-ecStuff:): temporarily reload everything in the outline view when
something changes.
(-viewSelectedObject:): Remove NSLog. Rewrite editor activation.
Fix leaks.
* DBModeler/Modeler.m (-applicationWillFinishLaunching:): Add new menu
items. Don't order our menu in.
(-new:,-open:): Move document initializition to _newDocumentWithModel:.
(-_newDocumentWithModel:,-newFromDatabase:): New methods.
(-validateMenuItem:,-generateSQL:): Ditto.
* DBModeler/ModelerAttributeEditor.m (-initWithParentEditor:):
Remove unused variables.
(-displayGroupDidChangeSelection:): return early if there is no
longer a selection.
* DBModeler/ModelerEntityEditor.m:
(-canSupportCurrentSelection): Remove NSLog.
(-displayGroupDidChangeSelection:): Ditto.
(-dealloc:): New method.
(-initWithParentEditor:): Remove unused variables. Add parens around
assignment. Release local variables.
* DBModeler/ModelerTableEmbedibleEditor:
(-addDefaultTableColumnsForTableView:displayGroup:): Release table
columns.
(-addTableColumnForItem:tableView:): Ditto.
* DBModeler/Inspectors/RelationshipInspector.m:
(-selectedEntity, -selectedDestinationAttribute): New methods.
(-selectedSourceAttribute, -indexOfSourceAttribute:): Ditto.
(-indexOfDestinationAttribute:,joinWithSource:destination:): Ditto.
(-selectedJoin:,updateConnectButton,): Ditto.
(-refresh): Rewrite using new methods.
(-numberOfRowsInTableView:): Add fallback return value.
(-tableView:objectValueForTableColumn:row:): Ditto.
(-tableView:selectionDidChange:): If a source or destination
attribute is now selected, select its counterpart.
(-tableView:shouldSelectRow:): New method to disallow entity
selection if there is a destination entity.
(-tableView:willDisplayCell:forTableColumn:row:): New method,
set the cell text color to disabled text color, if we would disallow
selection.
(-connectionChanged:): Implement disconnection.
* DBModeler/SQLGenerator.h/m: New files initial implementation.
* DBModeler/Resources/SQLGenerator.gorm: Ditto.
* DBModeler/ConsistencyChecker.h/m: Ditto.
* DBModeler/ConsistencyResults.h/m: Ditto.
* DBModeler/ConsistencyResults.gorm: Ditto.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21438 72102866-910b-0410-8b05-ffd578937521
2005-07-09 02:07:42 +00:00
|
|
|
if ((self = [super initWithParentEditor:parentEditor]))
|
2005-05-13 00:25:27 +00:00
|
|
|
{
|
|
|
|
EOClassDescription *classDescription = nil;
|
|
|
|
KVDataSource *wds;
|
|
|
|
NSScrollView *scrollView;
|
|
|
|
NSPopUpButton *cornerView;
|
|
|
|
NSMenuItem *mi = [[NSMenuItem alloc] initWithTitle:@"+" action:(SEL)nil keyEquivalent:@""];
|
|
|
|
|
|
|
|
_splitView = [[NSSplitView alloc] initWithFrame:NSMakeRect(0,0,10,10)];
|
|
|
|
scrollView = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,10,10)];
|
|
|
|
[scrollView setHasHorizontalScroller:YES];
|
|
|
|
[scrollView setHasVerticalScroller:YES];
|
|
|
|
[scrollView setBorderType: NSBezelBorder];
|
|
|
|
|
|
|
|
_topTable = [[NSTableView alloc] initWithFrame:NSMakeRect(0,0,10,10)];
|
|
|
|
_bottomTable = [[NSTableView alloc] initWithFrame:NSMakeRect(0,0,10,10)];
|
2006-09-05 22:18:35 +00:00
|
|
|
[_topTable setAutoresizesAllColumnsToFit:NO];
|
2005-05-13 00:25:27 +00:00
|
|
|
[scrollView setDocumentView:_topTable];
|
* DBModeler/AdaptorsPanel.m (-init): Add parenthesis around
assignment. Replace label with window title.
(-runAdaptorsPanel:): Remove unused variable.
* DBModeler/DefaultColumnProvider.m: Add missing braces, remove
unused ivars.
(-cellForColumnNamed:): Autorelease cells.
* DBModeler/EOAdditions.m: New EOAttribute KVC methods -allowNull and
-setAllowNull:.
* DBModeler/GNUmakefile: Add new to project.
* DBModeler/KVDataSource.m (-createObject:): Return nil after
throwing exception.
* DBModeler/MainModelEditor.m
(-dragImageForRows:event:dragImageOffset:):: Enable drag and
drop for relationships.
(-initWithDocument:): Add parenthesis around assignment. Don't
release the document window on close.
(-ecStuff:): temporarily reload everything in the outline view when
something changes.
(-viewSelectedObject:): Remove NSLog. Rewrite editor activation.
Fix leaks.
* DBModeler/Modeler.m (-applicationWillFinishLaunching:): Add new menu
items. Don't order our menu in.
(-new:,-open:): Move document initializition to _newDocumentWithModel:.
(-_newDocumentWithModel:,-newFromDatabase:): New methods.
(-validateMenuItem:,-generateSQL:): Ditto.
* DBModeler/ModelerAttributeEditor.m (-initWithParentEditor:):
Remove unused variables.
(-displayGroupDidChangeSelection:): return early if there is no
longer a selection.
* DBModeler/ModelerEntityEditor.m:
(-canSupportCurrentSelection): Remove NSLog.
(-displayGroupDidChangeSelection:): Ditto.
(-dealloc:): New method.
(-initWithParentEditor:): Remove unused variables. Add parens around
assignment. Release local variables.
* DBModeler/ModelerTableEmbedibleEditor:
(-addDefaultTableColumnsForTableView:displayGroup:): Release table
columns.
(-addTableColumnForItem:tableView:): Ditto.
* DBModeler/Inspectors/RelationshipInspector.m:
(-selectedEntity, -selectedDestinationAttribute): New methods.
(-selectedSourceAttribute, -indexOfSourceAttribute:): Ditto.
(-indexOfDestinationAttribute:,joinWithSource:destination:): Ditto.
(-selectedJoin:,updateConnectButton,): Ditto.
(-refresh): Rewrite using new methods.
(-numberOfRowsInTableView:): Add fallback return value.
(-tableView:objectValueForTableColumn:row:): Ditto.
(-tableView:selectionDidChange:): If a source or destination
attribute is now selected, select its counterpart.
(-tableView:shouldSelectRow:): New method to disallow entity
selection if there is a destination entity.
(-tableView:willDisplayCell:forTableColumn:row:): New method,
set the cell text color to disabled text color, if we would disallow
selection.
(-connectionChanged:): Implement disconnection.
* DBModeler/SQLGenerator.h/m: New files initial implementation.
* DBModeler/Resources/SQLGenerator.gorm: Ditto.
* DBModeler/ConsistencyChecker.h/m: Ditto.
* DBModeler/ConsistencyResults.h/m: Ditto.
* DBModeler/ConsistencyResults.gorm: Ditto.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21438 72102866-910b-0410-8b05-ffd578937521
2005-07-09 02:07:42 +00:00
|
|
|
RELEASE(_topTable);
|
2005-05-13 00:25:27 +00:00
|
|
|
[_splitView addSubview:scrollView];
|
* DBModeler/AdaptorsPanel.m (-init): Add parenthesis around
assignment. Replace label with window title.
(-runAdaptorsPanel:): Remove unused variable.
* DBModeler/DefaultColumnProvider.m: Add missing braces, remove
unused ivars.
(-cellForColumnNamed:): Autorelease cells.
* DBModeler/EOAdditions.m: New EOAttribute KVC methods -allowNull and
-setAllowNull:.
* DBModeler/GNUmakefile: Add new to project.
* DBModeler/KVDataSource.m (-createObject:): Return nil after
throwing exception.
* DBModeler/MainModelEditor.m
(-dragImageForRows:event:dragImageOffset:):: Enable drag and
drop for relationships.
(-initWithDocument:): Add parenthesis around assignment. Don't
release the document window on close.
(-ecStuff:): temporarily reload everything in the outline view when
something changes.
(-viewSelectedObject:): Remove NSLog. Rewrite editor activation.
Fix leaks.
* DBModeler/Modeler.m (-applicationWillFinishLaunching:): Add new menu
items. Don't order our menu in.
(-new:,-open:): Move document initializition to _newDocumentWithModel:.
(-_newDocumentWithModel:,-newFromDatabase:): New methods.
(-validateMenuItem:,-generateSQL:): Ditto.
* DBModeler/ModelerAttributeEditor.m (-initWithParentEditor:):
Remove unused variables.
(-displayGroupDidChangeSelection:): return early if there is no
longer a selection.
* DBModeler/ModelerEntityEditor.m:
(-canSupportCurrentSelection): Remove NSLog.
(-displayGroupDidChangeSelection:): Ditto.
(-dealloc:): New method.
(-initWithParentEditor:): Remove unused variables. Add parens around
assignment. Release local variables.
* DBModeler/ModelerTableEmbedibleEditor:
(-addDefaultTableColumnsForTableView:displayGroup:): Release table
columns.
(-addTableColumnForItem:tableView:): Ditto.
* DBModeler/Inspectors/RelationshipInspector.m:
(-selectedEntity, -selectedDestinationAttribute): New methods.
(-selectedSourceAttribute, -indexOfSourceAttribute:): Ditto.
(-indexOfDestinationAttribute:,joinWithSource:destination:): Ditto.
(-selectedJoin:,updateConnectButton,): Ditto.
(-refresh): Rewrite using new methods.
(-numberOfRowsInTableView:): Add fallback return value.
(-tableView:objectValueForTableColumn:row:): Ditto.
(-tableView:selectionDidChange:): If a source or destination
attribute is now selected, select its counterpart.
(-tableView:shouldSelectRow:): New method to disallow entity
selection if there is a destination entity.
(-tableView:willDisplayCell:forTableColumn:row:): New method,
set the cell text color to disabled text color, if we would disallow
selection.
(-connectionChanged:): Implement disconnection.
* DBModeler/SQLGenerator.h/m: New files initial implementation.
* DBModeler/Resources/SQLGenerator.gorm: Ditto.
* DBModeler/ConsistencyChecker.h/m: Ditto.
* DBModeler/ConsistencyResults.h/m: Ditto.
* DBModeler/ConsistencyResults.gorm: Ditto.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21438 72102866-910b-0410-8b05-ffd578937521
2005-07-09 02:07:42 +00:00
|
|
|
RELEASE(scrollView);
|
2005-05-13 00:25:27 +00:00
|
|
|
|
|
|
|
scrollView = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,10,10)];
|
|
|
|
[scrollView setHasHorizontalScroller:YES];
|
|
|
|
[scrollView setHasVerticalScroller:YES];
|
|
|
|
[scrollView setBorderType: NSBezelBorder];
|
2006-09-05 22:18:35 +00:00
|
|
|
[_bottomTable setAutoresizesAllColumnsToFit:NO];
|
2005-05-13 00:25:27 +00:00
|
|
|
[scrollView setDocumentView:_bottomTable];
|
* DBModeler/AdaptorsPanel.m (-init): Add parenthesis around
assignment. Replace label with window title.
(-runAdaptorsPanel:): Remove unused variable.
* DBModeler/DefaultColumnProvider.m: Add missing braces, remove
unused ivars.
(-cellForColumnNamed:): Autorelease cells.
* DBModeler/EOAdditions.m: New EOAttribute KVC methods -allowNull and
-setAllowNull:.
* DBModeler/GNUmakefile: Add new to project.
* DBModeler/KVDataSource.m (-createObject:): Return nil after
throwing exception.
* DBModeler/MainModelEditor.m
(-dragImageForRows:event:dragImageOffset:):: Enable drag and
drop for relationships.
(-initWithDocument:): Add parenthesis around assignment. Don't
release the document window on close.
(-ecStuff:): temporarily reload everything in the outline view when
something changes.
(-viewSelectedObject:): Remove NSLog. Rewrite editor activation.
Fix leaks.
* DBModeler/Modeler.m (-applicationWillFinishLaunching:): Add new menu
items. Don't order our menu in.
(-new:,-open:): Move document initializition to _newDocumentWithModel:.
(-_newDocumentWithModel:,-newFromDatabase:): New methods.
(-validateMenuItem:,-generateSQL:): Ditto.
* DBModeler/ModelerAttributeEditor.m (-initWithParentEditor:):
Remove unused variables.
(-displayGroupDidChangeSelection:): return early if there is no
longer a selection.
* DBModeler/ModelerEntityEditor.m:
(-canSupportCurrentSelection): Remove NSLog.
(-displayGroupDidChangeSelection:): Ditto.
(-dealloc:): New method.
(-initWithParentEditor:): Remove unused variables. Add parens around
assignment. Release local variables.
* DBModeler/ModelerTableEmbedibleEditor:
(-addDefaultTableColumnsForTableView:displayGroup:): Release table
columns.
(-addTableColumnForItem:tableView:): Ditto.
* DBModeler/Inspectors/RelationshipInspector.m:
(-selectedEntity, -selectedDestinationAttribute): New methods.
(-selectedSourceAttribute, -indexOfSourceAttribute:): Ditto.
(-indexOfDestinationAttribute:,joinWithSource:destination:): Ditto.
(-selectedJoin:,updateConnectButton,): Ditto.
(-refresh): Rewrite using new methods.
(-numberOfRowsInTableView:): Add fallback return value.
(-tableView:objectValueForTableColumn:row:): Ditto.
(-tableView:selectionDidChange:): If a source or destination
attribute is now selected, select its counterpart.
(-tableView:shouldSelectRow:): New method to disallow entity
selection if there is a destination entity.
(-tableView:willDisplayCell:forTableColumn:row:): New method,
set the cell text color to disabled text color, if we would disallow
selection.
(-connectionChanged:): Implement disconnection.
* DBModeler/SQLGenerator.h/m: New files initial implementation.
* DBModeler/Resources/SQLGenerator.gorm: Ditto.
* DBModeler/ConsistencyChecker.h/m: Ditto.
* DBModeler/ConsistencyResults.h/m: Ditto.
* DBModeler/ConsistencyResults.gorm: Ditto.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21438 72102866-910b-0410-8b05-ffd578937521
2005-07-09 02:07:42 +00:00
|
|
|
RELEASE(_bottomTable);
|
2005-05-13 00:25:27 +00:00
|
|
|
[_splitView addSubview:scrollView];
|
* DBModeler/AdaptorsPanel.m (-init): Add parenthesis around
assignment. Replace label with window title.
(-runAdaptorsPanel:): Remove unused variable.
* DBModeler/DefaultColumnProvider.m: Add missing braces, remove
unused ivars.
(-cellForColumnNamed:): Autorelease cells.
* DBModeler/EOAdditions.m: New EOAttribute KVC methods -allowNull and
-setAllowNull:.
* DBModeler/GNUmakefile: Add new to project.
* DBModeler/KVDataSource.m (-createObject:): Return nil after
throwing exception.
* DBModeler/MainModelEditor.m
(-dragImageForRows:event:dragImageOffset:):: Enable drag and
drop for relationships.
(-initWithDocument:): Add parenthesis around assignment. Don't
release the document window on close.
(-ecStuff:): temporarily reload everything in the outline view when
something changes.
(-viewSelectedObject:): Remove NSLog. Rewrite editor activation.
Fix leaks.
* DBModeler/Modeler.m (-applicationWillFinishLaunching:): Add new menu
items. Don't order our menu in.
(-new:,-open:): Move document initializition to _newDocumentWithModel:.
(-_newDocumentWithModel:,-newFromDatabase:): New methods.
(-validateMenuItem:,-generateSQL:): Ditto.
* DBModeler/ModelerAttributeEditor.m (-initWithParentEditor:):
Remove unused variables.
(-displayGroupDidChangeSelection:): return early if there is no
longer a selection.
* DBModeler/ModelerEntityEditor.m:
(-canSupportCurrentSelection): Remove NSLog.
(-displayGroupDidChangeSelection:): Ditto.
(-dealloc:): New method.
(-initWithParentEditor:): Remove unused variables. Add parens around
assignment. Release local variables.
* DBModeler/ModelerTableEmbedibleEditor:
(-addDefaultTableColumnsForTableView:displayGroup:): Release table
columns.
(-addTableColumnForItem:tableView:): Ditto.
* DBModeler/Inspectors/RelationshipInspector.m:
(-selectedEntity, -selectedDestinationAttribute): New methods.
(-selectedSourceAttribute, -indexOfSourceAttribute:): Ditto.
(-indexOfDestinationAttribute:,joinWithSource:destination:): Ditto.
(-selectedJoin:,updateConnectButton,): Ditto.
(-refresh): Rewrite using new methods.
(-numberOfRowsInTableView:): Add fallback return value.
(-tableView:objectValueForTableColumn:row:): Ditto.
(-tableView:selectionDidChange:): If a source or destination
attribute is now selected, select its counterpart.
(-tableView:shouldSelectRow:): New method to disallow entity
selection if there is a destination entity.
(-tableView:willDisplayCell:forTableColumn:row:): New method,
set the cell text color to disabled text color, if we would disallow
selection.
(-connectionChanged:): Implement disconnection.
* DBModeler/SQLGenerator.h/m: New files initial implementation.
* DBModeler/Resources/SQLGenerator.gorm: Ditto.
* DBModeler/ConsistencyChecker.h/m: Ditto.
* DBModeler/ConsistencyResults.h/m: Ditto.
* DBModeler/ConsistencyResults.gorm: Ditto.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21438 72102866-910b-0410-8b05-ffd578937521
2005-07-09 02:07:42 +00:00
|
|
|
RELEASE(scrollView);
|
|
|
|
|
2005-05-13 00:25:27 +00:00
|
|
|
|
|
|
|
[DefaultColumnProvider class]; // calls +initialize
|
|
|
|
|
|
|
|
cornerView = [[NSPopUpButton alloc] initWithFrame:[[_topTable cornerView] bounds] pullsDown:YES];
|
|
|
|
[cornerView setPreferredEdge:NSMinYEdge];
|
|
|
|
[cornerView setTitle:@"+"];
|
2006-09-05 22:18:35 +00:00
|
|
|
[cornerView setBezelStyle:NSShadowlessSquareBezelStyle];
|
|
|
|
[[cornerView cell] setBezelStyle:NSShadowlessSquareBezelStyle];
|
2005-05-13 00:25:27 +00:00
|
|
|
[[cornerView cell] setArrowPosition:NSPopUpNoArrow];
|
|
|
|
//[mi setImage:[NSImage imageNamed:@"plus"]];
|
|
|
|
// [mi setOnStateImage:[NSImage imageNamed:@"plus"]];
|
|
|
|
// [mi setOffStateImage:[NSImage imageNamed:@"plus"]];
|
|
|
|
//[mi setState:NSOnState];
|
|
|
|
[[cornerView cell] setUsesItemFromMenu:NO];
|
|
|
|
[[cornerView cell] setShowsFirstResponder:NO];
|
|
|
|
[[cornerView cell] setShowsStateBy:NSContentsCellMask];
|
|
|
|
[[cornerView cell] setMenuItem:mi];
|
* DBModeler/AdaptorsPanel.m (-init): Add parenthesis around
assignment. Replace label with window title.
(-runAdaptorsPanel:): Remove unused variable.
* DBModeler/DefaultColumnProvider.m: Add missing braces, remove
unused ivars.
(-cellForColumnNamed:): Autorelease cells.
* DBModeler/EOAdditions.m: New EOAttribute KVC methods -allowNull and
-setAllowNull:.
* DBModeler/GNUmakefile: Add new to project.
* DBModeler/KVDataSource.m (-createObject:): Return nil after
throwing exception.
* DBModeler/MainModelEditor.m
(-dragImageForRows:event:dragImageOffset:):: Enable drag and
drop for relationships.
(-initWithDocument:): Add parenthesis around assignment. Don't
release the document window on close.
(-ecStuff:): temporarily reload everything in the outline view when
something changes.
(-viewSelectedObject:): Remove NSLog. Rewrite editor activation.
Fix leaks.
* DBModeler/Modeler.m (-applicationWillFinishLaunching:): Add new menu
items. Don't order our menu in.
(-new:,-open:): Move document initializition to _newDocumentWithModel:.
(-_newDocumentWithModel:,-newFromDatabase:): New methods.
(-validateMenuItem:,-generateSQL:): Ditto.
* DBModeler/ModelerAttributeEditor.m (-initWithParentEditor:):
Remove unused variables.
(-displayGroupDidChangeSelection:): return early if there is no
longer a selection.
* DBModeler/ModelerEntityEditor.m:
(-canSupportCurrentSelection): Remove NSLog.
(-displayGroupDidChangeSelection:): Ditto.
(-dealloc:): New method.
(-initWithParentEditor:): Remove unused variables. Add parens around
assignment. Release local variables.
* DBModeler/ModelerTableEmbedibleEditor:
(-addDefaultTableColumnsForTableView:displayGroup:): Release table
columns.
(-addTableColumnForItem:tableView:): Ditto.
* DBModeler/Inspectors/RelationshipInspector.m:
(-selectedEntity, -selectedDestinationAttribute): New methods.
(-selectedSourceAttribute, -indexOfSourceAttribute:): Ditto.
(-indexOfDestinationAttribute:,joinWithSource:destination:): Ditto.
(-selectedJoin:,updateConnectButton,): Ditto.
(-refresh): Rewrite using new methods.
(-numberOfRowsInTableView:): Add fallback return value.
(-tableView:objectValueForTableColumn:row:): Ditto.
(-tableView:selectionDidChange:): If a source or destination
attribute is now selected, select its counterpart.
(-tableView:shouldSelectRow:): New method to disallow entity
selection if there is a destination entity.
(-tableView:willDisplayCell:forTableColumn:row:): New method,
set the cell text color to disabled text color, if we would disallow
selection.
(-connectionChanged:): Implement disconnection.
* DBModeler/SQLGenerator.h/m: New files initial implementation.
* DBModeler/Resources/SQLGenerator.gorm: Ditto.
* DBModeler/ConsistencyChecker.h/m: Ditto.
* DBModeler/ConsistencyResults.h/m: Ditto.
* DBModeler/ConsistencyResults.gorm: Ditto.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21438 72102866-910b-0410-8b05-ffd578937521
2005-07-09 02:07:42 +00:00
|
|
|
RELEASE(mi);
|
2005-05-13 00:25:27 +00:00
|
|
|
[[cornerView cell] setImagePosition:NSNoImage];
|
|
|
|
|
|
|
|
[_topTable setCornerView:cornerView];
|
|
|
|
RELEASE(cornerView);
|
|
|
|
[_topTable setAllowsMultipleSelection:YES];
|
|
|
|
|
|
|
|
classDescription = nil;
|
|
|
|
wds = [[KVDataSource alloc]
|
|
|
|
initWithClassDescription:classDescription
|
|
|
|
editingContext:[[self document] editingContext]];
|
|
|
|
|
|
|
|
[wds setDataObject: [[self document] model]];
|
|
|
|
[wds setKey:@"entities"];
|
|
|
|
dg = [[EODisplayGroup alloc] init];
|
|
|
|
[EOObserverCenter addObserver:self forObject:[[self document] model]];
|
|
|
|
[dg setDataSource: wds];
|
* DBModeler/AdaptorsPanel.m (-init): Add parenthesis around
assignment. Replace label with window title.
(-runAdaptorsPanel:): Remove unused variable.
* DBModeler/DefaultColumnProvider.m: Add missing braces, remove
unused ivars.
(-cellForColumnNamed:): Autorelease cells.
* DBModeler/EOAdditions.m: New EOAttribute KVC methods -allowNull and
-setAllowNull:.
* DBModeler/GNUmakefile: Add new to project.
* DBModeler/KVDataSource.m (-createObject:): Return nil after
throwing exception.
* DBModeler/MainModelEditor.m
(-dragImageForRows:event:dragImageOffset:):: Enable drag and
drop for relationships.
(-initWithDocument:): Add parenthesis around assignment. Don't
release the document window on close.
(-ecStuff:): temporarily reload everything in the outline view when
something changes.
(-viewSelectedObject:): Remove NSLog. Rewrite editor activation.
Fix leaks.
* DBModeler/Modeler.m (-applicationWillFinishLaunching:): Add new menu
items. Don't order our menu in.
(-new:,-open:): Move document initializition to _newDocumentWithModel:.
(-_newDocumentWithModel:,-newFromDatabase:): New methods.
(-validateMenuItem:,-generateSQL:): Ditto.
* DBModeler/ModelerAttributeEditor.m (-initWithParentEditor:):
Remove unused variables.
(-displayGroupDidChangeSelection:): return early if there is no
longer a selection.
* DBModeler/ModelerEntityEditor.m:
(-canSupportCurrentSelection): Remove NSLog.
(-displayGroupDidChangeSelection:): Ditto.
(-dealloc:): New method.
(-initWithParentEditor:): Remove unused variables. Add parens around
assignment. Release local variables.
* DBModeler/ModelerTableEmbedibleEditor:
(-addDefaultTableColumnsForTableView:displayGroup:): Release table
columns.
(-addTableColumnForItem:tableView:): Ditto.
* DBModeler/Inspectors/RelationshipInspector.m:
(-selectedEntity, -selectedDestinationAttribute): New methods.
(-selectedSourceAttribute, -indexOfSourceAttribute:): Ditto.
(-indexOfDestinationAttribute:,joinWithSource:destination:): Ditto.
(-selectedJoin:,updateConnectButton,): Ditto.
(-refresh): Rewrite using new methods.
(-numberOfRowsInTableView:): Add fallback return value.
(-tableView:objectValueForTableColumn:row:): Ditto.
(-tableView:selectionDidChange:): If a source or destination
attribute is now selected, select its counterpart.
(-tableView:shouldSelectRow:): New method to disallow entity
selection if there is a destination entity.
(-tableView:willDisplayCell:forTableColumn:row:): New method,
set the cell text color to disabled text color, if we would disallow
selection.
(-connectionChanged:): Implement disconnection.
* DBModeler/SQLGenerator.h/m: New files initial implementation.
* DBModeler/Resources/SQLGenerator.gorm: Ditto.
* DBModeler/ConsistencyChecker.h/m: Ditto.
* DBModeler/ConsistencyResults.h/m: Ditto.
* DBModeler/ConsistencyResults.gorm: Ditto.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21438 72102866-910b-0410-8b05-ffd578937521
2005-07-09 02:07:42 +00:00
|
|
|
RELEASE(wds);
|
2005-05-13 00:25:27 +00:00
|
|
|
[dg setFetchesOnLoad:YES];
|
|
|
|
[dg setDelegate: self];
|
2006-09-05 22:18:35 +00:00
|
|
|
|
2005-05-13 00:25:27 +00:00
|
|
|
[self setupCornerView:cornerView
|
|
|
|
tableView:_topTable
|
|
|
|
displayGroup:dg
|
|
|
|
forClass:[EOEntity class]];
|
|
|
|
|
|
|
|
[self addDefaultTableColumnsForTableView:_topTable
|
|
|
|
displayGroup:dg];
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
* DBModeler/AdaptorsPanel.m (-init): Add parenthesis around
assignment. Replace label with window title.
(-runAdaptorsPanel:): Remove unused variable.
* DBModeler/DefaultColumnProvider.m: Add missing braces, remove
unused ivars.
(-cellForColumnNamed:): Autorelease cells.
* DBModeler/EOAdditions.m: New EOAttribute KVC methods -allowNull and
-setAllowNull:.
* DBModeler/GNUmakefile: Add new to project.
* DBModeler/KVDataSource.m (-createObject:): Return nil after
throwing exception.
* DBModeler/MainModelEditor.m
(-dragImageForRows:event:dragImageOffset:):: Enable drag and
drop for relationships.
(-initWithDocument:): Add parenthesis around assignment. Don't
release the document window on close.
(-ecStuff:): temporarily reload everything in the outline view when
something changes.
(-viewSelectedObject:): Remove NSLog. Rewrite editor activation.
Fix leaks.
* DBModeler/Modeler.m (-applicationWillFinishLaunching:): Add new menu
items. Don't order our menu in.
(-new:,-open:): Move document initializition to _newDocumentWithModel:.
(-_newDocumentWithModel:,-newFromDatabase:): New methods.
(-validateMenuItem:,-generateSQL:): Ditto.
* DBModeler/ModelerAttributeEditor.m (-initWithParentEditor:):
Remove unused variables.
(-displayGroupDidChangeSelection:): return early if there is no
longer a selection.
* DBModeler/ModelerEntityEditor.m:
(-canSupportCurrentSelection): Remove NSLog.
(-displayGroupDidChangeSelection:): Ditto.
(-dealloc:): New method.
(-initWithParentEditor:): Remove unused variables. Add parens around
assignment. Release local variables.
* DBModeler/ModelerTableEmbedibleEditor:
(-addDefaultTableColumnsForTableView:displayGroup:): Release table
columns.
(-addTableColumnForItem:tableView:): Ditto.
* DBModeler/Inspectors/RelationshipInspector.m:
(-selectedEntity, -selectedDestinationAttribute): New methods.
(-selectedSourceAttribute, -indexOfSourceAttribute:): Ditto.
(-indexOfDestinationAttribute:,joinWithSource:destination:): Ditto.
(-selectedJoin:,updateConnectButton,): Ditto.
(-refresh): Rewrite using new methods.
(-numberOfRowsInTableView:): Add fallback return value.
(-tableView:objectValueForTableColumn:row:): Ditto.
(-tableView:selectionDidChange:): If a source or destination
attribute is now selected, select its counterpart.
(-tableView:shouldSelectRow:): New method to disallow entity
selection if there is a destination entity.
(-tableView:willDisplayCell:forTableColumn:row:): New method,
set the cell text color to disabled text color, if we would disallow
selection.
(-connectionChanged:): Implement disconnection.
* DBModeler/SQLGenerator.h/m: New files initial implementation.
* DBModeler/Resources/SQLGenerator.gorm: Ditto.
* DBModeler/ConsistencyChecker.h/m: Ditto.
* DBModeler/ConsistencyResults.h/m: Ditto.
* DBModeler/ConsistencyResults.gorm: Ditto.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21438 72102866-910b-0410-8b05-ffd578937521
2005-07-09 02:07:42 +00:00
|
|
|
|
2005-05-13 00:25:27 +00:00
|
|
|
- (NSArray *)defaultColumnNamesForClass:(Class)aClass
|
|
|
|
{
|
|
|
|
NSArray *colNames = [super defaultColumnNamesForClass:aClass];
|
|
|
|
if (colNames == nil || [colNames count] == 0)
|
|
|
|
{
|
|
|
|
if (aClass == [EOEntity class])
|
|
|
|
return DefaultEntityColumns;
|
|
|
|
else return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
return colNames;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) activate
|
|
|
|
{
|
|
|
|
[dg fetch];
|
2006-09-05 22:18:35 +00:00
|
|
|
|
|
|
|
[dg selectObjectsIdenticalTo:[self selectionWithinViewedObject]
|
|
|
|
selectFirstOnNoMatch:NO];
|
2005-05-13 00:25:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSView *)mainView
|
|
|
|
{
|
|
|
|
return _splitView;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) objectWillChange:(id)anObject
|
|
|
|
{
|
2006-09-05 22:18:35 +00:00
|
|
|
[[NSRunLoop currentRunLoop]
|
|
|
|
performSelector:@selector(needToFetch:)
|
|
|
|
target:self
|
|
|
|
argument:nil
|
|
|
|
order:999 /* this number is probably arbitrary */
|
|
|
|
modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
|
2005-05-13 00:25:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) needToFetch:(id)sth
|
|
|
|
{
|
|
|
|
[dg fetch];
|
|
|
|
}
|
2006-09-05 22:18:35 +00:00
|
|
|
|
2005-05-13 00:25:27 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation ModelerEntityEditor (DisplayGroupDelegate)
|
|
|
|
- (void) displayGroupDidChangeSelection:(EODisplayGroup *)displayGroup
|
|
|
|
{
|
2006-09-05 22:18:35 +00:00
|
|
|
[[self parentEditor] setSelectionWithinViewedObject: [displayGroup selectedObjects]];
|
2005-05-13 00:25:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|