API 0.9.5
AppKit/CPRuleEditor/CPPredicateEditorRowTemplate.j
Go to the documentation of this file.
00001 /*
00002  * CPPredicateEditorRowTemplate.j
00003  * AppKit
00004  *
00005  * Created by cacaodev.
00006  * Copyright 2011, cacaodev.
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2.1 of the License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00021  */
00022 
00023 CPUndefinedAttributeType     = 0;
00024 CPInteger16AttributeType     = 100;
00025 CPInteger32AttributeType     = 200;
00026 CPInteger64AttributeType     = 300;
00027 CPDecimalAttributeType       = 400;
00028 CPDoubleAttributeType        = 500;
00029 CPFloatAttributeType         = 600;
00030 CPStringAttributeType        = 700;
00031 CPBooleanAttributeType       = 800;
00032 CPDateAttributeType          = 900;
00033 CPBinaryDataAttributeType    = 1000;
00034 CPTransformableAttributeType = 1800;
00035 
00036 @implementation CPPredicateEditorRowTemplate : CPObject
00037 {
00038     int            _templateType;
00039     unsigned   _predicateOptions;
00040     unsigned  _predicateModifier;
00041     unsigned  _leftAttributeType;
00042     unsigned _rightAttributeType;
00043     BOOL         _leftIsWildcard;
00044     BOOL        _rightIsWildcard;
00045     CPArray               _views;
00046 
00047 }
00048 
00083 - (id)initWithLeftExpressions:(CPArray)leftExpressions rightExpressions:(CPArray)rightExpressions modifier:(int)modifier operators:(CPArray)operators options:(int)options
00084 {
00085     self = [super init];
00086     if (self != nil)
00087     {
00088         _templateType = 1;
00089         _leftIsWildcard = NO;
00090         _rightIsWildcard = NO;
00091         _leftAttributeType = 0;
00092         _rightAttributeType = 0;
00093         _predicateModifier = modifier;
00094         _predicateOptions = options;
00095 
00096         var leftView = [self _viewFromExpressions:leftExpressions],
00097             rightView = [self _viewFromExpressions:rightExpressions],
00098             middleView = [self _viewFromOperatorTypes:operators];
00099 
00100         _views = [[CPArray alloc] initWithObjects:leftView, middleView, rightView];
00101     }
00102 
00103     return self;
00104 }
00105 
00115 - (id)initWithLeftExpressions:(CPArray )leftExpressions rightExpressionAttributeType:(CPAttributeType)attributeType modifier:(CPComparisonPredicateModifier)modifier operators:(CPArray )operators options:(int)options
00116 {
00117     self = [super init];
00118     if (self != nil)
00119     {
00120         var leftView = [self _viewFromExpressions:leftExpressions],
00121             middleView = [self _viewFromOperatorTypes:operators],
00122             rightView = [self _viewFromAttributeType:attributeType];
00123 
00124         _templateType = 1;
00125         _leftIsWildcard = NO;
00126         _rightIsWildcard = YES;
00127         _leftAttributeType = 0;
00128         _rightAttributeType = attributeType;
00129         _predicateModifier = modifier;
00130         _predicateOptions = options;
00131         _views = [[CPArray alloc] initWithObjects:leftView, middleView, rightView];
00132     }
00133 
00134     return self;
00135 }
00136 
00143 - (id)initWithCompoundTypes:(CPArray )compoundTypes
00144 {
00145     self = [super init];
00146     if (self != nil)
00147     {
00148         var leftView = [self _viewFromCompoundTypes:compoundTypes],
00149             rightView = [[CPPopUpButton alloc] init];
00150 
00151         [rightView addItemWithTitle:@"of the following are true"];
00152 
00153         _templateType = 2;
00154         _leftIsWildcard = NO;
00155         _rightIsWildcard = NO;
00156         _rightAttributeType = 0;
00157         _views = [[CPArray alloc] initWithObjects:leftView, rightView];
00158     }
00159     return self;
00160 }
00161 
00172 - (double)matchForPredicate:(CPPredicate)predicate
00173 {
00174     // How exactly this value (float 0-1) is computed ?
00175     if ([self _templateType] == 2 && [predicate isKindOfClass:[CPCompoundPredicate class]])
00176     {
00177         if ([[self compoundTypes] containsObject:[predicate compoundPredicateType]])
00178                 return 1;
00179     }
00180     else if ([self _templateType] == 1 && [predicate isKindOfClass:[CPComparisonPredicate class]])
00181     {
00182         if (!_leftIsWildcard && ![[self leftExpressions] containsObject:[predicate leftExpression]])
00183             return 0;
00184 
00185         if (![[self operators] containsObject:[predicate predicateOperatorType]])
00186             return 0;
00187 
00188         if (!_rightIsWildcard && ![[self rightExpressions] containsObject:[predicate rightExpression]]) return 0;
00189 
00190         return 1;
00191     }
00192 
00193     return 0;
00194 }
00195 
00201 - (CPArray)templateViews
00202 {
00203     return _views;
00204 }
00205 
00213 - (void)setPredicate:(CPPredicate)predicate
00214 {
00215     if (_templateType == 2)
00216         [self _setCompoundPredicate:predicate];
00217     else
00218         [self _setComparisonPredicate:predicate];
00219 }
00220 
00227 - (CPArray)displayableSubpredicatesOfPredicate:(CPPredicate)predicate
00228 {
00229     if ([predicate isKindOfClass:[CPCompoundPredicate class]])
00230     {
00231         var subpredicates = [predicate subpredicates];
00232         if ([subpredicates count] == 0)
00233             return nil;
00234 
00235         return subpredicates;
00236     }
00237 
00238     return nil;
00239 }
00240 
00249 - (CPPredicate)predicateWithSubpredicates:(CPArray)subpredicates
00250 {
00251     if (_templateType == 2)
00252     {
00253         var type = [[_views[0] selectedItem] representedObject];
00254         return [[CPCompoundPredicate alloc] initWithType:type subpredicates:subpredicates];
00255     }
00256 
00257     if (_templateType == 1)
00258     {
00259         var lhs = [self _leftExpression],
00260             rhs = [self _rightExpression],
00261             operator = [[_views[1] selectedItem] representedObject];
00262 
00263         return [CPComparisonPredicate predicateWithLeftExpression:lhs
00264                                                   rightExpression:rhs
00265                                                          modifier:[self modifier]
00266                                                              type:operator
00267                                                           options:[self options]];
00268     }
00269 
00270     return nil;
00271 }
00272 
00281 - (CPArray)leftExpressions
00282 {
00283     if (_templateType ==1 && !_leftIsWildcard)
00284     {
00285         var view = [_views objectAtIndex:0];
00286         return [[view itemArray] valueForKey:@"representedObject"];
00287     }
00288 
00289     return nil;
00290 }
00291 
00296 - (CPArray)rightExpressions
00297 {
00298     if (_templateType == 1 && !_rightIsWildcard)
00299     {
00300         var view = [_views objectAtIndex:2];
00301         return [[view itemArray] valueForKey:@"representedObject"];
00302     }
00303 
00304     return nil;
00305 }
00306 
00311 - (CPArray)compoundTypes
00312 {
00313     if (_templateType == 2)
00314     {
00315         var view = [_views objectAtIndex:0];
00316         return [[view itemArray] valueForKey:@"representedObject"];
00317     }
00318 
00319     return nil;
00320 }
00321 
00326 - (CPComparisonPredicateModifier)modifier
00327 {
00328     if (_templateType == 1)
00329         return _predicateModifier;
00330 
00331     return nil;
00332 }
00333 
00338 - (CPArray)operators
00339 {
00340     if (_templateType == 1)
00341     {
00342         var view = [_views objectAtIndex:1];
00343         return [[view itemArray] valueForKey:@"representedObject"];
00344     }
00345 
00346     return nil;
00347 }
00348 
00353 - (int)options
00354 {
00355     if (_templateType == 1)
00356         return _predicateOptions;
00357 
00358     return nil;
00359 }
00360 
00365 - (CPAttributeType)rightExpressionAttributeType
00366 {
00367     return _rightAttributeType;
00368 }
00369 
00374 - (CPAttributeType)leftExpressionAttributeType
00375 {
00376     return _leftAttributeType;
00377 }
00378 
00380 + (id)_bestMatchForPredicate:(CPPredicate)predicate inTemplates:(CPArray)templates quality:(double)quality
00381 {
00382     var count = [templates count],
00383         match_value = 0,
00384         templateIndex = CPNotFound,
00385         i;
00386 
00387     for (i = 0; i < count; i++)
00388     {
00389         var template = [templates objectAtIndex:i],
00390             amatch = [template matchForPredicate:predicate];
00391 
00392         if (amatch > match_value)
00393         {
00394             templateIndex = i;
00395             match_value = amatch;
00396         }
00397     }
00398 
00399     if (templateIndex == CPNotFound)
00400     {
00401         [CPException raise:CPRangeException reason:@"Unable to find template matching predicate: " +  [predicate predicateFormat]];
00402         return nil;
00403     }
00404 
00405     return [templates objectAtIndex:templateIndex];
00406 }
00407 
00408 - (void)_setCompoundPredicate:(CPCompoundPredicate)predicate
00409 {
00410     var left = [_views objectAtIndex:0],
00411         type = [predicate compoundPredicateType],
00412         index = [left indexOfItemWithRepresentedObject:type];
00413 
00414     [left selectItemAtIndex:index];
00415 }
00416 
00417 - (void)_setComparisonPredicate:(CPComparisonPredicate)predicate
00418 {
00419     var left = [_views objectAtIndex:0],
00420         middle = [_views objectAtIndex:1],
00421         right = [_views objectAtIndex:2],
00422         leftExpression = [predicate leftExpression],
00423         rightExpression = [predicate rightExpression],
00424         operator = [predicate predicateOperatorType];
00425 
00426     if (_leftIsWildcard)
00427         [left setObjectValue:[leftExpression constantValue]];
00428     else
00429     {
00430         var index = [left indexOfItemWithRepresentedObject:leftExpression];
00431         [left selectItemAtIndex:index];
00432     }
00433 
00434     var op_index = [middle indexOfItemWithRepresentedObject:operator];
00435     [middle selectItemAtIndex:op_index];
00436 
00437     if (_rightIsWildcard)
00438         [right setObjectValue:[rightExpression constantValue]];
00439     else
00440     {
00441         var index = [right indexOfItemWithRepresentedObject:rightExpression];
00442         [right selectItemAtIndex:index];
00443     }
00444 }
00445 
00446 - (CPExpression)_leftExpression
00447 {
00448     return [self _expressionFromView:_views[0] forAttributeType:_leftAttributeType];
00449 }
00450 
00451 - (CPExpression)_rightExpression
00452 {
00453     return [self _expressionFromView:_views[2] forAttributeType:_rightAttributeType];
00454 }
00455 
00456 - (CPExpression)_expressionFromView:(CPView)aView forAttributeType:(CPAttributeType)attributeType
00457 {
00458     if (attributeType == 0)
00459         return [[aView selectedItem] representedObject];
00460 
00461     var value;
00462     if (attributeType >= CPInteger16AttributeType && attributeType <= CPFloatAttributeType)
00463         value = [aView intValue];
00464     else if (attributeType == CPBooleanAttributeType)
00465         value = [aView state];
00466     else
00467         value = [aView stringValue];
00468 
00469     return [CPExpression expressionForConstantValue:value];
00470 }
00471 
00472 - (int)_rowType
00473 {
00474     return (_templateType - 1);
00475 }
00476 
00477 - (id)copy
00478 {
00479     return [CPKeyedUnarchiver unarchiveObjectWithData:[CPKeyedArchiver archivedDataWithRootObject:self]];
00480 }
00481 
00482 + (id)_operatorsForAttributeType:(CPAttributeType)attributeType
00483 {
00484     var operators_array = [CPMutableArray array];
00485 
00486     switch (attributeType)
00487     {
00488         case CPInteger16AttributeType   : [operators_array addObjects:4,5,0,2,1,3];
00489             break;
00490         case CPInteger32AttributeType   : [operators_array addObjects:4,5,0,2,1,3];
00491             break;
00492         case CPInteger64AttributeType   : [operators_array addObjects:4,5,0,2,1,3];
00493             break;
00494         case CPDecimalAttributeType     : [operators_array addObjects:4,5,0,2,1,3];
00495             break;
00496         case CPDoubleAttributeType      : [operators_array addObjects:4,5,0,2,1,3];
00497             break;
00498         case CPFloatAttributeType       : [operators_array addObjects:4,5,0,2,1,3];
00499             break;
00500         case CPStringAttributeType      : [operators_array addObjects:99,4,5,8,9];
00501             break;
00502         case CPBooleanAttributeType     : [operators_array addObjects:4,5];
00503             break;
00504         case CPDateAttributeType        : [operators_array addObjects:4,5,0,2,1,3];
00505             break;
00506         default : CPLogConsole("Cannot create operators for an CPAttributeType " + attributeType);
00507             break;
00508     }
00509 
00510     return operators_array;
00511 }
00512 
00513 - (int)_templateType
00514 {
00515     return _templateType;
00516 }
00517 
00518 - (id)_displayValueForPredicateOperator:(int)operator
00519 {
00520     var value;
00521 
00522     switch (operator)
00523     {
00524         case CPLessThanPredicateOperatorType            : value = @"is less than";
00525             break;
00526         case CPLessThanOrEqualToPredicateOperatorType   : value = @"is less than or equal to";
00527             break;
00528         case CPGreaterThanPredicateOperatorType         : value = @"is greater than";
00529             break;
00530         case CPGreaterThanOrEqualToPredicateOperatorType : value = @"is greater than or equal to";
00531             break;
00532         case CPEqualToPredicateOperatorType             : value = @"is";
00533             break;
00534         case CPNotEqualToPredicateOperatorType          : value = @"is not";
00535             break;
00536         case CPMatchesPredicateOperatorType             : value = @"matches";
00537             break;
00538         case CPLikePredicateOperatorType                : value = @"is like";
00539             break;
00540         case CPBeginsWithPredicateOperatorType          : value = @"begins with";
00541             break;
00542         case CPEndsWithPredicateOperatorType            : value = @"ends with";
00543             break;
00544         case CPInPredicateOperatorType                  : value = @"in";
00545             break;
00546         case CPContainsPredicateOperatorType            : value = @"contains";
00547             break;
00548         case CPBetweenPredicateOperatorType             : value = @"between";
00549             break;
00550         default : CPLogConsole(@"unknown predicate operator %d" + operator);
00551     }
00552 
00553     return value;
00554 }
00555 
00556 - (id)_displayValueForCompoundPredicateType:(unsigned int)predicateType
00557 {
00558     var value;
00559     switch (predicateType)
00560     {
00561         case CPNotPredicateType: value = @"None";
00562             break;
00563         case CPAndPredicateType: value = @"All";
00564             break;
00565         case CPOrPredicateType: value = @"Any";
00566             break;
00567         default : value = [CPString stringWithFormat:@"unknown compound predicate type %d",predicateType];
00568     }
00569 
00570     return value;
00571 }
00572 
00573 - (id)_displayValueForConstantValue:(id)value
00574 {
00575     return [value description]; // number, date, string, ... localize
00576 }
00577 
00578 - (id)_displayValueForKeyPath:(CPString)keyPath
00579 {
00580     return keyPath; // localize
00581 }
00582 
00583 - (CPPopUpButton)_viewFromExpressions:(CPArray)expressions
00584 {
00585     var popup = [[CPPopUpButton alloc] initWithFrame:CPMakeRect(0, 0, 100, 18)],
00586         count = [expressions count];
00587 
00588     for (var i = 0; i < count; i++)
00589     {
00590         var exp = expressions[i],
00591             type = [exp expressionType],
00592             title;
00593 
00594         switch (type)
00595         {
00596             case CPKeyPathExpressionType: title = [self _displayValueForKeyPath:[exp keyPath]];
00597                 break;
00598             case CPConstantValueExpressionType: title = [self _displayValueForConstantValue:[exp constantValue]];
00599                 break;
00600             default: [CPException raise:CPInvalidArgumentException reason:@"Invalid Expression type " + type];
00601                 break;
00602         }
00603 
00604         var item = [[CPMenuItem alloc] initWithTitle:title action:nil keyEquivalent:@""];
00605         [item setRepresentedObject:exp];
00606         [popup addItem:item];
00607     }
00608 
00609     [popup sizeToFit];
00610 
00611     return popup;
00612 }
00613 
00614 - (CPPopUpButton)_viewFromOperatorTypes:(CPArray)operators
00615 {
00616     var popup = [[CPPopUpButton alloc] initWithFrame:CGRectMake(0, 0, 100, 18)],
00617         count = [operators count];
00618 
00619     for (var i = 0; i < count; i++)
00620     {
00621         var op = operators[i],
00622             title = [self _displayValueForPredicateOperator:op],
00623             item = [[CPMenuItem alloc] initWithTitle:title action:nil keyEquivalent:@""];
00624 
00625         [item setRepresentedObject:op];
00626         [popup addItem:item];
00627     }
00628 
00629     [popup sizeToFit];
00630 
00631     return popup;
00632 }
00633 
00634 - (CPView)_viewFromCompoundTypes:(CPArray)compoundTypes
00635 {
00636     var popup = [[CPPopUpButton alloc] initWithFrame:CGRectMake(0, 0, 100, 18)],
00637         count = [compoundTypes count];
00638 
00639     for (var i = 0; i < count; i++)
00640     {
00641         var type = compoundTypes[i],
00642             title = [self _displayValueForCompoundPredicateType:type],
00643             item = [[CPMenuItem alloc] initWithTitle:title action:nil keyEquivalent:@""];
00644 
00645         [item setRepresentedObject:type];
00646         [popup addItem:item];
00647     }
00648 
00649     [popup sizeToFit];
00650 
00651     return popup;
00652 }
00653 
00654 - (CPView)_viewFromAttributeType:(CPAttributeType)attributeType
00655 {
00656     var view;
00657 
00658     if (attributeType >= CPInteger16AttributeType && attributeType <= CPFloatAttributeType)
00659     {
00660         view = [self _textFieldWithFrame:CGRectMake(0, 0, 50, 26)];
00661     }
00662     else if (attributeType == CPStringAttributeType)
00663     {
00664         view = [self _textFieldWithFrame:CGRectMake(0, 0, 150, 26)];
00665     }
00666     else if (attributeType == CPBooleanAttributeType)
00667     {
00668         view = [[CPCheckBox alloc] initWithFrame:CGRectMake(0, 0, 50, 26)];
00669     }
00670     else if (attributeType == CPDateAttributeType)
00671         view = [[CPDatePicker alloc] initWithFrame:CGRectMake(0, 0, 150, 26)];
00672     else
00673         return nil;
00674 
00675     [view setTag:attributeType];
00676 
00677     return view;
00678 }
00679 
00680 - (CPTextField)_textFieldWithFrame:(CGRect)frame
00681 {
00682     var textField = [[CPTextField alloc] initWithFrame:frame];
00683     [textField setBezeled:YES];
00684     [textField setBezelStyle:CPTextFieldSquareBezel];
00685     [textField setBordered:YES];
00686     [textField setEditable:YES];
00687     [textField setFont:[CPFont systemFontOfSize:10]];
00688 
00689     return textField;
00690 }
00691 
00692 - (void)_setOptions:(unsigned int)options
00693 {
00694     _predicateOptions = options;
00695 }
00696 
00697 - (void)_setModifier:(unsigned int)modifier
00698 {
00699     _predicateModifier = modifier;
00700 }
00701 
00702 - (CPString)description
00703 {
00704     if (_templateType == 2)
00705         return [CPString stringWithFormat:@"<%@ %p %@>",[self className],self,[[self compoundTypes] componentsJoinedByString:@", "]];
00706     else if (_templateType == 1 && _rightIsWildcard)
00707         return [CPString stringWithFormat:@"<%@ %p [%@] [%@] %d>",[self className],self,[[self leftExpressions] componentsJoinedByString:@", "],[[self operators] componentsJoinedByString:@", "],[self rightExpressionAttributeType]];
00708     else
00709         return [CPString stringWithFormat:@"<%@ %p [%@] [%@] [%@]>",[self className],self,[[self leftExpressions] componentsJoinedByString:@", "],[[self operators] componentsJoinedByString:@", "],[[self rightExpressions] componentsJoinedByString:@", "]];
00710 }
00711 
00712 /*
00713 - (void)_setLeftExpressionObject:(id)object
00714 {
00715 }
00716 - (void)_setRightExpressionObject:(id)object
00717 {
00718 }
00719 - (BOOL)_predicateIsNoneAreTrue:(id)predicate
00720 {
00721 }
00722 - (id)_viewFromExpressionObject:(id)object
00723 {
00724 }
00725 */
00726 @end
00727 
00728 var CPPredicateTemplateTypeKey = @"CPPredicateTemplateType",
00729     CPPredicateTemplateOptionsKey = @"CPPredicateTemplateOptions",
00730     CPPredicateTemplateModifierKey = @"CPPredicateTemplateModifier",
00731     CPPredicateTemplateLeftAttributeTypeKey = @"CPPredicateTemplateLeftAttributeType",
00732     CPPredicateTemplateRightAttributeTypeKey = @"CPPredicateTemplateRightAttributeType",
00733     CPPredicateTemplateLeftIsWildcardKey = @"CPPredicateTemplateLeftIsWildcard",
00734     CPPredicateTemplateRightIsWildcardKey = @"CPPredicateTemplateRightIsWildcard",
00735     CPPredicateTemplateViewsKey = @"CPPredicateTemplateViews";
00736 
00737 @implementation CPPredicateEditorRowTemplate (CPCoding)
00738 
00739 - (id)initWithCoder:(CPCoder)coder
00740 {
00741     self = [super init];
00742     if (self != nil)
00743     {
00744         _templateType = [coder decodeIntForKey:CPPredicateTemplateTypeKey];
00745         _predicateOptions = [coder decodeIntForKey:CPPredicateTemplateOptionsKey];
00746         _predicateModifier = [coder decodeIntForKey:CPPredicateTemplateModifierKey];
00747         _leftAttributeType = [coder decodeIntForKey:CPPredicateTemplateLeftAttributeTypeKey];
00748         _rightAttributeType = [coder decodeIntForKey:CPPredicateTemplateRightAttributeTypeKey];
00749         _leftIsWildcard = [coder decodeBoolForKey:CPPredicateTemplateLeftIsWildcardKey];
00750         _rightIsWildcard = [coder decodeBoolForKey:CPPredicateTemplateRightIsWildcardKey];
00751         _views = [coder decodeObjectForKey:CPPredicateTemplateViewsKey];
00752 
00753         // In Xcode 4, when the menu item title == template's expression keypath, representedObject is empty.
00754         // So we need to regenerate expressions from titles.
00755         if (_templateType == 1 && _leftIsWildcard == NO)
00756         {
00757             var itemArray = [_views[0] itemArray],
00758                 count = [itemArray count];
00759 
00760             for (var i = 0; i < count; i++)
00761             {
00762                 var item = itemArray[i];
00763                 if ([item representedObject] == nil)
00764                 {
00765                     var exp = [CPExpression expressionForKeyPath:[item title]];
00766                     [item setRepresentedObject:exp];
00767                 }
00768             }
00769         }
00770     }
00771 
00772     return self;
00773 }
00774 
00775 - (void)encodeWithCoder:(CPCoder)coder
00776 {
00777     [coder encodeInt:_templateType forKey:CPPredicateTemplateTypeKey];
00778     [coder encodeInt:_predicateOptions forKey:CPPredicateTemplateOptionsKey];
00779     [coder encodeInt:_predicateModifier forKey:CPPredicateTemplateModifierKey];
00780     [coder encodeInt:_leftAttributeType forKey:CPPredicateTemplateLeftAttributeTypeKey];
00781     [coder encodeInt:_rightAttributeType forKey:CPPredicateTemplateRightAttributeTypeKey];
00782     [coder encodeBool:_leftIsWildcard forKey:CPPredicateTemplateLeftIsWildcardKey];
00783     [coder encodeBool:_rightIsWildcard forKey:CPPredicateTemplateRightIsWildcardKey];
00784     [coder encodeObject:_views forKey:CPPredicateTemplateViewsKey];
00785 }
00786 
00787 @end
00790 @implementation CPPredicateEditorRowTemplate (CPSynthesizedAccessors)
00791 
00792 
00795 - (int)_templateType
00796 {
00797     return _templateType;
00798 }
00799 
00803 - (void)_setTemplateType:(int)aValue
00804 {
00805     _templateType = aValue;
00806 }
00807 
00811 - (void)_setOptions:(unsigned)aValue
00812 {
00813     _predicateOptions = aValue;
00814 }
00815 
00819 - (void)_setModifier:(unsigned)aValue
00820 {
00821     _predicateModifier = aValue;
00822 }
00823 
00827 - (unsigned)leftAttributeType
00828 {
00829     return _leftAttributeType;
00830 }
00831 
00835 - (void)_setLeftAttributeType:(unsigned)aValue
00836 {
00837     _leftAttributeType = aValue;
00838 }
00839 
00843 - (unsigned)rightAttributeType
00844 {
00845     return _rightAttributeType;
00846 }
00847 
00851 - (void)_setRightAttributeType:(unsigned)aValue
00852 {
00853     _rightAttributeType = aValue;
00854 }
00855 
00859 - (BOOL)leftIsWildcard
00860 {
00861     return _leftIsWildcard;
00862 }
00863 
00867 - (void)setLeftIsWildcard:(BOOL)aValue
00868 {
00869     _leftIsWildcard = aValue;
00870 }
00871 
00875 - (BOOL)rightIsWildcard
00876 {
00877     return _rightIsWildcard;
00878 }
00879 
00883 - (void)setRightIsWildcard:(BOOL)aValue
00884 {
00885     _rightIsWildcard = aValue;
00886 }
00887 
00891 - (void)setTemplateViews:(CPArray)aValue
00892 {
00893     _views = aValue;
00894 }
00895 
00896 @end
 All Classes Files Functions Variables Defines