From 51459eb4c978739e952fd4e576b275ff156aab0b Mon Sep 17 00:00:00 2001 From: Bibiko Date: Thu, 18 Feb 2010 17:06:16 +0000 Subject: =?UTF-8?q?=E2=80=A2=20CSV=20Import=20Field=20Mapper=20-=20added?= =?UTF-8?q?=20the=20csv=20source=20field=20popu:=20"Ignore=20field"=20to?= =?UTF-8?q?=20set=20the=20current=20field=20to=20doNotImport=20"Add=20glob?= =?UTF-8?q?al=20value=E2=80=A6"=20which=20opens=20the=20global=20value=20s?= =?UTF-8?q?heet=20-=20removed=20"Add=20global=20value"=20button?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note: still not the optimal solution - further work is needed. esp. avoid jittering if user selects "Ignore field" or "Add value…" --- Interfaces/English.lproj/DataMigrationDialog.xib | 140 +++++++++-------------- Source/SPFieldMapperController.m | 29 ++++- 2 files changed, 84 insertions(+), 85 deletions(-) diff --git a/Interfaces/English.lproj/DataMigrationDialog.xib b/Interfaces/English.lproj/DataMigrationDialog.xib index 19dc18bb..c2f52171 100644 --- a/Interfaces/English.lproj/DataMigrationDialog.xib +++ b/Interfaces/English.lproj/DataMigrationDialog.xib @@ -50,7 +50,7 @@ {3.40282e+38, 3.40282e+38} {465, 394} - + 274 YES @@ -69,7 +69,6 @@ 269 {{149, 12}, {168, 17}} - YES 68288064 @@ -104,12 +103,10 @@ {{1, 1}, {465, 39}} - {{-1, 365}, {467, 41}} - {0, 0} 67239424 @@ -159,14 +156,12 @@ 256 {465, 144} - YES 256 {465, 17} - @@ -174,7 +169,6 @@ -2147483392 {{-22, 0}, {12, 17}} - YES @@ -421,8 +415,6 @@ {{1, 17}, {465, 144}} - - 6 @@ -437,7 +429,6 @@ -2147483392 {{413, 18}, {11, 140}} - 256 _doScroller: @@ -448,7 +439,6 @@ -2147483392 {{-100, -100}, {227, 11}} - 257 _doScroller: @@ -464,8 +454,6 @@ {{1, 0}, {465, 17}} - - 4 @@ -474,8 +462,6 @@ {{-1, 168}, {467, 162}} - - 530 @@ -489,7 +475,6 @@ 289 {{286, 14}, {82, 32}} - YES 67239424 @@ -515,7 +500,6 @@ 289 {{368, 14}, {83, 32}} - 1 YES @@ -539,7 +523,6 @@ 292 {{20, 19}, {32, 24}} - YES 604110336 @@ -564,7 +547,6 @@ 292 {{51, 19}, {32, 24}} - 1 YES @@ -591,7 +573,6 @@ 294 {{88, 24}, {105, 14}} - YES 67239488 @@ -608,7 +589,6 @@ 267 {{244, 335}, {215, 22}} - YES -2076049856 @@ -639,9 +619,8 @@ 289 - {{357, 130}, {91, 22}} + {{350, 130}, {98, 22}} - YES -2076049856 @@ -707,7 +686,6 @@ 289 {{261, 135}, {94, 14}} - YES 68288064 @@ -732,7 +710,6 @@ {{5, 337}, {212, 20}} - YES 69336577 @@ -782,7 +759,6 @@ 292 {{17, 133}, {188, 18}} - YES -2080244224 @@ -820,7 +796,6 @@ 2322 {253, 66} - @@ -1005,8 +980,6 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA {253, 70} - - 2 @@ -1023,7 +996,6 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA -2147483392 {{-100, -100}, {15, 55}} - _doScroller: 1 @@ -1034,7 +1006,6 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA -2147483392 {{-100, -100}, {87, 18}} - 1 _doScroller: @@ -1044,8 +1015,6 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA {{198, 52}, {253, 70}} - - 512 @@ -1056,7 +1025,6 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA 292 {{17, 84}, {161, 22}} - YES -2076049856 @@ -1127,7 +1095,6 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA 292 {{19, 107}, {117, 14}} - YES 68288064 @@ -1141,10 +1108,9 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA - 292 + -2147483356 {{20, 59}, {155, 17}} - YES -2080244224 @@ -1165,7 +1131,6 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA 269 {{218, 340}, {23, 17}} - YES 68288064 @@ -1186,7 +1151,6 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA 289 {{192, 14}, {82, 32}} - YES 67239424 @@ -1204,8 +1168,6 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA {465, 405} - - {{0, 0}, {1280, 1002}} {465, 416} @@ -1213,17 +1175,17 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA SPCSVFieldMappingSheet - 15 + 9 2 {{131, 316}, {282, 186}} - 880279552 + 611845120 Window NSWindow {3.40282e+38, 3.40282e+38} {282, 186} - + 256 YES @@ -1242,14 +1204,12 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA 256 {282, 106} - YES 256 {282, 17} - @@ -1257,7 +1217,6 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA -2147483392 {{224, 0}, {16, 17}} - YES @@ -1344,8 +1303,6 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA {{1, 17}, {282, 106}} - - 4 @@ -1355,17 +1312,15 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA -2147483392 {{-100, -100}, {15, 102}} - _doScroller: - 0.87179487943649292 + 0.99065423011779785 -2147483392 {{-100, -100}, {238, 15}} - 1 _doScroller: @@ -1381,8 +1336,6 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA {{1, 0}, {282, 17}} - - 4 @@ -1391,8 +1344,6 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA {{-1, 52}, {284, 124}} - - 530 @@ -1406,7 +1357,6 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA 292 {{20, 17}, {20, 23}} - YES -2080244224 @@ -1428,10 +1378,9 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA - 292 + -2147483356 {{39, 17}, {20, 23}} - YES -2080244224 @@ -1454,15 +1403,14 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA 289 - {{207, 13}, {60, 28}} + {{181, 13}, {86, 28}} - 1 YES 67239424 134348800 - Save + OK -2038284033 @@ -1476,9 +1424,8 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA 292 - {{79, 19}, {76, 17}} + {{48, 17}, {76, 23}} - YES -2080244224 @@ -1486,8 +1433,9 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA Insert NULL - -2038152961 - 134217892 + -2038021889 + 134217890 + N 400 @@ -1496,13 +1444,11 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA {282, 186} - - {{0, 0}, {1280, 1002}} {282, 208} {3.40282e+38, 3.40282e+38} - SPGlobalValuesSheet + YES @@ -1647,14 +1593,6 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA 113 - - - window - - - - 119 - importButton @@ -1799,6 +1737,38 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA 195 + + + initialFirstResponder + + + + 197 + + + + delegate + + + + 204 + + + + delegate + + + + 205 + + + + window + + + + 217 + @@ -2625,9 +2595,9 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA YES com.apple.InterfaceBuilder.CocoaPlugin - {{136, 316}, {465, 405}} + {{334, 280}, {465, 405}} com.apple.InterfaceBuilder.CocoaPlugin - {{136, 316}, {465, 405}} + {{334, 280}, {465, 405}} {{387, 725}, {432, 282}} @@ -2698,9 +2668,9 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA com.apple.InterfaceBuilder.CocoaPlugin - {{388, 570}, {282, 186}} + {{232, 747}, {282, 186}} com.apple.InterfaceBuilder.CocoaPlugin - {{388, 570}, {282, 186}} + {{232, 747}, {282, 186}} {282, 186} @@ -2773,7 +2743,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{651, 435}, {95, 54}} + {{467, 414}, {106, 54}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2831,7 +2801,7 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA - 195 + 217 @@ -2918,6 +2888,8 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA rowUpButton tableTargetPopup theDelegate + useValueString + useValueView YES @@ -2939,6 +2911,8 @@ cyAKCQluZXcgcm93cyBSRVBMQUNFIElOVE8g4oCmA id NSPopUpButton id + id + id diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index 7ecdb8f0..61a00edc 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -356,6 +356,11 @@ } +// TDOD this won't be called - WHY? ask HansJB +// - (NSRect)window:(NSWindow *)window willPositionSheet:(NSWindow *)sheet usingRect:(NSRect)rect { +// return NSMakeRect(300,300,50,10); +// } + - (IBAction)addGlobalValue:(id)sender { [fieldMappingGlobalValues addObject:@""]; @@ -654,8 +659,14 @@ } else if ([[aTableColumn identifier] isEqualToString:@"import_value"]) { if ([[aTableColumn dataCell] isKindOfClass:[NSPopUpButtonCell class]]) { - [(NSPopUpButtonCell *)[aTableColumn dataCell] removeAllItems]; - [(NSPopUpButtonCell *)[aTableColumn dataCell] addItemsWithTitles:fieldMappingButtonOptions]; + NSPopUpButtonCell *c = [aTableColumn dataCell]; + NSMenu *m = [c menu]; + [c removeAllItems]; + [c addItemsWithTitles:fieldMappingButtonOptions]; + [m addItem:[NSMenuItem separatorItem]]; + [c addItemWithTitle:NSLocalizedString(@"Ignore field", @"ignore field menu item")]; + [c addItemWithTitle:NSLocalizedString(@"Add global value…", @"add global value menu item")]; + // Hide csv file column value if user doesn't want to import it if([fieldMappingOperatorArray objectAtIndex:rowIndex] != doNotImport) return [fieldMappingArray objectAtIndex:rowIndex]; @@ -689,6 +700,20 @@ if(aTableView == fieldMapperTableView) { if ([[aTableColumn identifier] isEqualToString:@"import_value"]) { + if([anObject integerValue] > [fieldMappingButtonOptions count]) { + // Ignore field - set operator to doNotImport + if([anObject integerValue] == [fieldMappingButtonOptions count]+1) { + lastDisabledCSVFieldcolumn = [fieldMappingArray objectAtIndex:rowIndex]; + [fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:doNotImport]; + [aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0]; + } + // Add global value + else if([anObject integerValue] == [fieldMappingButtonOptions count]+2) { + [aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0]; + [self addGlobalSourceVariable:nil]; + } + return; + } [fieldMappingArray replaceObjectAtIndex:rowIndex withObject:anObject]; // If user _changed_ the csv file column set the operator to doImport if([(NSNumber*)anObject integerValue] > -1) -- cgit v1.2.3