home *** CD-ROM | disk | FTP | other *** search
- ////////////////////////
- // ObjectArrayEditor
- // by Charles Lloyd
- ////////////////////////
-
-
-
- ///////////////////
- // User Options
- ///////////////////
- id labelArray;
- id keyArray;
- id objectArray;
- id columnWidthArray;
- id isEditable;
-
- id borderSize;
- id cellPadding;
- id cellSpacing;
-
- ////////////////////
- // Internal State
- ////////////////////
- id colCount;
- id rowCount;
- id colIndex;
- id rowIndex;
- id fieldSize;
-
- id labelString;
- id valueString;
-
-
- - awake
- {
- borderSize = 1;
- cellSpacing = 0;
- cellPadding = 2;
- fieldSize = 12;
- }
-
- - setLabelArray:anArray
- {
- labelArray = anArray;
- colCount = [labelArray count];
- }
-
- - setObjectArray:anArray
- {
- objectArray = anArray;
- rowCount = [objectArray count];
- }
-
- - labelString
- {
- return [labelArray objectAtIndex:colIndex];
- }
-
- - valueString
- {
- id aKey = [keyArray objectAtIndex:colIndex];
- id anObject = [objectArray objectAtIndex:rowIndex];
- id aDict = [anObject valuesForKeys:keyArray];
- return [aDict objectForKey:aKey];
- }
-
- - fieldSize
- {
- if (columnWidthArray) {
- return [columnWidthArray objectAtIndex:colIndex];
- }
- return fieldSize;
- }
-
- - setValueString:aValue
- {
- id aKey;
- id aDict;
- id aTargetObject;
- if (!aValue) {
- return nil;
- }
- aDict = [NSMutableDictionary dictionary];
- aKey = [keyArray objectAtIndex:colIndex];
- [aDict setObject:aValue forKey:aKey];
- aTargetObject = [objectArray objectAtIndex:rowIndex];
- [aTargetObject takeValuesFromDictionary:aDict];
- }
-
-
-