|
|
1.1 ! root 1: // Employee.m ! 2: // ! 3: // Created on Fri Jan 13 15:56:20 PST 1995 by NeXT EOModeler.app Version 71 ! 4: /* ! 5: modified by enoyau ! 6: ! 7: You may freely copy, distribute, and reuse the code in this example. ! 8: NeXT disclaims any warranty of any kind, expressed or implied, as to its ! 9: fitness for any particular use. ! 10: */ ! 11: ! 12: #import "Employee.h" ! 13: #import <appkit/NXImage.h> ! 14: ! 15: @implementation Employee ! 16: static NSString *localLockString; ! 17: ! 18: + (void)setLocalLockString:(NSString *)lockString ! 19: { ! 20: if(localLockString) [localLockString autorelease]; ! 21: localLockString = [lockString copy]; ! 22: } ! 23: ! 24: - (NSString *)lock { return lock; } ! 25: ! 26: - (void)dealloc ! 27: { ! 28: [address autorelease]; ! 29: [city autorelease]; ! 30: [first_name autorelease]; ! 31: [hire_date autorelease]; ! 32: [last_name autorelease]; ! 33: [phone autorelease]; ! 34: [state autorelease]; ! 35: [zip autorelease]; ! 36: [toJob_Title autorelease]; ! 37: [toEmp_Photo autorelease]; ! 38: [photo autorelease]; ! 39: [lock autorelease]; ! 40: [super dealloc]; ! 41: } ! 42: ! 43: // Determine if the EO is editable by comparing the local lock string with ! 44: // the EO lock string stored in the database. ! 45: - (BOOL)isEditable ! 46: { ! 47: return [[self lock] isEqual:localLockString]; ! 48: } ! 49: ! 50: - (BOOL)isLocked ! 51: { ! 52: return ![[self lock] isEqual:[EONull null]]; ! 53: } ! 54: ! 55: // lockImage is an attribute added to the Employee entity in InterfaceBuilder. ! 56: // This method retrieves the proper lock image to be displayed in the ! 57: // tableview. ! 58: - lockImage ! 59: { ! 60: if(![self isLocked]) ! 61: return nil; ! 62: else if([self isEditable]) ! 63: return [NXImage findImageNamed:"lock_h"]; ! 64: else ! 65: return [NXImage findImageNamed:"lock"]; ! 66: } ! 67: ! 68: @end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.