Greetings list,

My project employs a framework which loads several plugins. When the user 
interacts with these plugins s/he generates an intermediate abstraction of the 
plugin contents which I refer to as a rule. The rule abstraction exists to 
facilitate round-tripping back to the plugin of origin or onward to the 
rendered product. 

I am currently stuck in the stage of migrating the data from the plugin to a 
newly created rule instance.  I hit on the notion of using categories to 
shuffle the values from the plugin instance to the rule instance and vice 
versa. Two small dedicated categories for each plugin family (I have three 
families at the moment). Seems a manageable scheme.  However, I am getting an   
"unrecognized selector sent to instance 0xyaddayadda" when I try to run this. I 
know the selector does exist, so I must have a scoping issue (?)

Any observations appreciated.


Here are the two objects, one a Plugin API object, the other it's corresponding 
Rule, and following them the two categories I believe should be able to swap 
data between them.


#import "RSTrixiePlugin.h"

@interface RSReactionPlugin : RSTrixiePlugin

@property (retain) NSString * pluginName;
@property (retain) NSString * action;
@property (retain) IBOutlet NSTextField * targetField;
@property (retain) IBOutlet NSTextField * deltaField;
@property (retain) IBOutlet NSTextField * delayField;
@property (retain) IBOutlet NSTextField * periodField;
@property (retain) IBOutlet NSTextField * opacityField;
@property (retain) IBOutlet NSTextField * easingField;
@property (retain) IBOutlet NSTextField * callbackField;

- (BOOL) hasTargetField;
- (BOOL) hasDeltaField;
- (BOOL) hasDelayField;
- (BOOL) hasPeriodField;
- (BOOL) hasOpacityField;
- (BOOL) hasEasingField;
- (BOOL) hasCallbackField;

- (void) resetForm;

@end 

---------------

#import "RSAbstractRule.h"

@interface RSReactionRule : RSAbstractRule

@property (retain) NSString * pluginName;
@property (retain) NSString * action;
@property (retain) NSString * targetField;
@property (retain) NSString * deltaField;
@property (retain) NSString * delayField;
@property (retain) NSString * periodField;
@property (retain) NSString * opacityField;
@property (retain) NSString * easingField;
@property (retain) NSString * callbackField;

@property (assign,setter=setHasTargetField:) BOOL hasTargetField;
@property (assign,setter=setHasDeltaField:) BOOL hasDeltaField;
@property (assign,setter=setHasDelayField:) BOOL hasDelayField;
@property (assign,setter=setHasPeriodField:) BOOL hasPeriodField;
@property (assign,setter=setHasOpacityField:) BOOL hasOpacityField;
@property (assign,setter=setHasEasingField:) BOOL hasEasingField;
@property (assign,setter=setHasCallbackField:) BOOL hasCallbackField;

- (NSString*) action;
- (void) setAction:(NSString *)aStr;
- (NSString*) emitScript;

@end

------------


#import <RSTrixieFramework/RSTrixie.h>

@interface RSReactionRule (RSReactionRuleFromPlugin)

- (void) loadFromPlugin:(RSReactionPlugin*)plugin;

@end

#import "RSReactionRule+RSReactionRuleFromPlugin.h"

@implementation RSReactionRule (RSReactionRuleFromPlugin)

- (void) loadFromPlugin:(RSReactionPlugin*)plugin {

        [self setAction: plugin.action];
        
        if(plugin.hasTargetField) {
                [self setHasTargetField: YES];
                [self setTargetField:[plugin.targetField stringValue]];
        }
        if(plugin.hasDeltaField) {
                [self setHasDeltaField:YES];
                [self setDeltaField:[plugin.deltaField stringValue]];
        }
        if(plugin.hasDelayField) {
                [self setHasDelayField: YES];
                [self setDelayField: [plugin.delayField stringValue]];
        }
        if(plugin.hasPeriodField) {
                [self setHasPeriodField: YES];
                [self setPeriodField: [plugin.periodField stringValue]];
        }
        if(plugin.hasOpacityField) {
                [self setHasOpacityField:YES];
                [self setOpacityField:[plugin.opacityField stringValue] ];
        }
        if(plugin.hasEasingField) {
                [self setHasEasingField:YES];
                [self setEasingField:[plugin.easingField stringValue]];
        }
        if(plugin.hasCallbackField) {
                [self setHasCallbackField: YES];
                [self setCallbackField:[plugin.callbackField stringValue]];
        }
}

@end

------------

#import <RSTrixieFramework/RSTrixie.h>

@interface RSReactionPlugin (RSReactionPluginFromRule)

- (void) loadFromRule: (RSReactionRule*) rule;

@end

#import "RSReactionPlugin+RSReactionPluginFromRule.h"

@implementation RSReactionPlugin (RSReactionPluginFromRule)

- (void) loadFromRule: (RSReactionRule*) rule {
        self.action = rule.action;
        if([rule hasTargetField])       [self.targetField       
setStringValue:rule.targetField];
        if([rule hasDeltaField])        [self.deltaField        
setStringValue:rule.deltaField];
        if([rule hasDelayField])        [self.delayField        
setStringValue:rule.delayField];
        if([rule hasPeriodField])       [self.periodField       
setStringValue:rule.periodField];
        if([rule hasOpacityField])      [self.opacityField      
setStringValue:rule.opacityField];
        if([rule hasEasingField])       [self.easingField       
setStringValue:rule.easingField];
        if([rule hasCallbackField])     [self.callbackField 
setStringValue:rule.callbackField];
}

@end

---------------

End of message.

Erik Stainsby.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to