home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / WebObjects / WebObjectsDoc_HTML / Reuse / ReusableComponentsEx / AttributeEditor.wo / AttributeEditor.wos < prev    next >
Encoding:
Text File  |  1996-03-08  |  1.5 KB  |  81 lines

  1. ////////////////////////
  2. //  AttributeEditor
  3. //  by Charles Lloyd
  4. ////////////////////////
  5.  
  6. ///////////////////
  7. //    User Options
  8. ///////////////////
  9. id keyArray;
  10. id valueArray;
  11.  
  12. id borderSize;
  13. id cellPadding;
  14. id cellSpacing;
  15. id fieldSize;
  16.  
  17. ////////////////////
  18. //  Internal State
  19. ////////////////////
  20. id entryCount;
  21. id repetitionIndex;
  22. id isEditable;
  23.  
  24. - setKeyArray: anArray
  25. {
  26.     keyArray = anArray;
  27.     entryCount = [keyArray count];
  28. }
  29.  
  30. - setValueArray: anArray
  31. {
  32.     id aValueArrayCount;
  33.     valueArray = anArray;
  34.     aValueArrayCount = [valueArray count];
  35.     if ((entryCount) && (entryCount != aValueArrayCount)) {
  36.         [NSException raise:@"MismatchedCounts"
  37.                     format:@"keyArray count == %@, valueArray count == %@",
  38.             entryCount, aValueArrayCount];
  39.     }
  40. }
  41.  
  42. - awake
  43. {
  44.     id anArray1;
  45.     id anArray2;
  46.     anArray1 = @("Key 1", "A Longer Key");
  47.     anArray2 = @("Value 1", "A Longer Value");
  48.     anArray2 = [[anArray2 mutableCopy] autorelease];
  49.  
  50.     [self setKeyArray: anArray1];
  51.     [self setValueArray: anArray2];
  52.     borderSize = 1;
  53.     cellSpacing = 0;
  54.     cellPadding = 2;
  55.     fieldSize = 15;
  56.     repetitionIndex = 0;
  57.     isEditable = NO;
  58.     
  59.     entryCount = nil;
  60. }
  61.  
  62. - keyString
  63. {
  64.     return [keyArray objectAtIndex:repetitionIndex];
  65. }
  66.  
  67. - setKeyString:aString
  68. {
  69.     return nil;
  70. }
  71.  
  72. - valueString
  73. {
  74.     return [valueArray objectAtIndex:repetitionIndex];
  75. }
  76.  
  77. - setValueString:aValue
  78. {
  79.     [valueArray replaceObjectAtIndex:repetitionIndex withObject:aValue];
  80. }
  81.