[ruleeditor commit] r101 - branches/CPRuleEditor

0 views
Skip to first unread message

codesite...@google.com

unread,
Feb 5, 2009, 6:55:54 PM2/5/09
to psruleedit...@googlegroups.com
Author: cacaodev
Date: Thu Feb 5 14:04:14 2009
New Revision: 101

Added:
branches/CPRuleEditor/CPRuleEditorCache.j
- copied unchanged from r97,
/branches/CPRuleEditor/_CPRuleEditorCache.j
branches/CPRuleEditor/CPRuleEditorLocalizer.j
- copied, changed from r99, /branches/CPRuleEditor/Localizer.j
branches/CPRuleEditor/CPRuleEditorViewSliceHolder.j
- copied, changed from r98,
/branches/CPRuleEditor/_CPRuleEditorViewSliceHolder.j
branches/CPRuleEditor/CPRuleEditorViewUnboundRowHolder.j
- copied, changed from r97,
/branches/CPRuleEditor/_CPRuleEditorViewUnboundRowHolder.j
branches/CPRuleEditor/CPViewAnimation.j
branches/CPRuleEditor/EditableTextField.j
branches/CPRuleEditor/Slider.j
Removed:
branches/CPRuleEditor/CPRuleEditorButtonCell.j
branches/CPRuleEditor/CPRuleEditorPopupButtonCell.j
branches/CPRuleEditor/Localizer.j
branches/CPRuleEditor/_CPRuleEditorCache.j
branches/CPRuleEditor/_CPRuleEditorViewSliceHolder.j
branches/CPRuleEditor/_CPRuleEditorViewUnboundRowHolder.j
Modified:
branches/CPRuleEditor/AppController.j
branches/CPRuleEditor/CPComparisonPredicate.j
branches/CPRuleEditor/CPCompoundPredicate.j
branches/CPRuleEditor/CPRuleEditor.j
branches/CPRuleEditor/CPRuleEditorPopupButton.j
branches/CPRuleEditor/CPRuleEditorTextField.j
branches/CPRuleEditor/CPRuleEditorViewSlice.j
branches/CPRuleEditor/CPRuleEditorViewSliceDropSeparator.j
branches/CPRuleEditor/CPRuleEditorViewSliceRow.j
branches/CPRuleEditor/Info.plist
branches/CPRuleEditor/RowObject.j
branches/CPRuleEditor/RuleDelegate.j
branches/CPRuleEditor/criteria.plist
branches/CPRuleEditor/format.strings

Log:
implemented rows animations, drag and drop, fixed the right-view-vanishes
bug.

Modified: branches/CPRuleEditor/AppController.j
==============================================================================
--- branches/CPRuleEditor/AppController.j (original)
+++ branches/CPRuleEditor/AppController.j Thu Feb 5 14:04:14 2009
@@ -1,7 +1,5 @@
-@import <Foundation/CPObject.j>
@import "CPRuleEditor.j"
@import "RuleDelegate.j"
-@import "Localizer.j"

@implementation CPDictionary (ReadFile)

@@ -39,6 +37,7 @@
@end

@implementation CPString (ReadFile)
+
+(id)stringWithContentsOfURL:(CPURL)url
{
var request = [CPURLRequest requestWithURL:url];
@@ -49,8 +48,8 @@
}

return nil;
-
}
+
@end


@@ -59,21 +58,16 @@
CPTextField textField;
CPTextField tableField;
CPArray tableArray;
-CPView ruleEditor;
+CPRuleEditor ruleEditor;
}

- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{

CPLogRegister(CPLogConsole);
- var isWebkit = CPBrowserIsEngine(CPWebKitBrowserEngine);
- if(!isWebkit)
- {
- var alert = [[CPAlert alloc] init];
- [alert setAlertStyle:CPCriticalAlertStyle];
- [alert setMessageText:"Works in Webkit only"];
- [alert runModal];
- }
+
+var next = [["a","b","c"] nextUnusedObjectIn:["a","a","b","c"]];
+CPLogConsole("NEXT ="+next);

var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero()
styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
@@ -84,24 +78,32 @@
var datasource = [[RuleDelegate alloc] init];
[ruleEditor setDelegate:datasource];

- [ruleEditor setNestingMode:CPRuleEditorNestingModeSimple];
+ [ruleEditor setNestingMode:CPRuleEditorNestingModeSimple];
+ CPLogConsole(_cmd);
[ruleEditor setFormattingStringsFilename:"format.strings"];
- [ruleEditor setCanRemoveAllRows:NO];
-
+ [ruleEditor setCanRemoveAllRows:NO];
+
[contentView addSubview:ruleEditor];
+
+ [ruleEditor addObserver:self forKeyPath:"predicate"
options:CPKeyValueObservingOptionOld|CPKeyValueObservingOptionNew
context:"predicate"];
[ruleEditor addRow:self];
- /*
+
var button = [[CPButton alloc]
initWithFrame:CGRectMake(610,20,100,20)];
- [button setAction:@selector(addRow:)];
- [button setTarget:ruleEditor];
- [button setTitle:"Add Row"];
+ [button setAction:@selector(reloadPredicate:)];
+ [button setButtonType:CPPushOnPushOffButton];
+ [button setTarget:self];
+ [button setTitle:"Reload Predicate"];
[contentView addSubview:button];
-*/

tableArray = [CPArray arrayWithObjects:[CPDictionary
dictionaryWithObjects:["Jim ","McNulty",46]
forKeys:["firstName","lastName","age"]],
- [CPDictionary dictionaryWithObjects:["Kima","Williams",41]
forKeys:["firstName","lastName","age"]],
+ [CPDictionary dictionaryWithObjects:["Kima","Greggs",41]
forKeys:["firstName","lastName","age"]],
+ [CPDictionary dictionaryWithObjects:["Lester","Freamon",57]
forKeys:["firstName","lastName","age"]],
+ [CPDictionary dictionaryWithObjects:["Kevin","Russel",37]
forKeys:["firstName","lastName","age"]],
+ [CPDictionary dictionaryWithObjects:["William","Moreland",53]
forKeys:["firstName","lastName","age"]],
+ [CPDictionary dictionaryWithObjects:["Cedric","Daniels",47]
forKeys:["firstName","lastName","age"]],
+ [CPDictionary dictionaryWithObjects:["Roland","Pryzbylewski",27]
forKeys:["firstName","lastName","age"]],
[CPDictionary dictionaryWithObjects:["Omar","Little",29]
forKeys:["firstName","lastName","age"]],
- [CPDictionary dictionaryWithObjects:["Avon","Barkstale",51]
forKeys:["firstName","lastName","age"]],nil];
+ [CPDictionary dictionaryWithObjects:["Avon","Barkstale",49]
forKeys:["firstName","lastName","age"]],nil];

textField = [[CPTextField alloc] initWithFrame:CGRectMake(0,200,600,50)];
[textField setBackgroundColor:[CPColor colorWithCalibratedWhite:0.0
alpha:1]];
@@ -116,22 +118,50 @@
[tableField setFont:[CPFont systemFontOfSize:14]];
[tableField setLineBreakMode:CPLineBreakByWordWrapping];
[contentView addSubview:tableField];
-
-
+/*
+ var tableView = [[CPTableView alloc]
initWithFrame:CGRectMake(0,260,600,150)];
+ var firstName = [[CPTableColumn alloc] initWithIdentifier:"firstName"];
+ var lastName = [[CPTableColumn alloc] initWithIdentifier:"lastName"];
+ var age = [[CPTableColumn alloc] initWithIdentifier:"age"];
+ [tableView addTableColumn:firstName];
+ [tableView addTableColumn:lastName];
+ [tableView addTableColumn:age];
+ [tableView setDataSource:self];
+ [contentView addSubview:tableView];
+*/
[theWindow orderFront:self];
- }
+
+ }

--(void)refresh:(CPPredicate)predicate
+-(void)numberOfColumns
{
- [textField setStringValue:[predicate predicateFormat]];
+ return [tableArray count];
+}
+-(void)tableView:table objectValueForTableColumn:column row:row
+{
+ return [[tableArray objectAtIndex:row] objectForKey:[column identifier]];
+}

- var desc = "";
-
- var filtered = [tableArray filteredArrayUsingPredicate:predicate];
- for(var i=0;i<[filtered count];i++)
- desc += [[[filtered objectAtIndex:i] allValues]
componentsJoinedByString:" "] +"\n";
+- (void)reloadPredicate:(id)sender
+{
+ [ruleEditor reloadPredicate];
+}
+
+-(void)observeValueForKeyPath:keypath ofObject:object change:change
context:context
+{
+ if(context = "predicate")
+ {
+ var predicate = [object predicate];
+ [textField setStringValue:[predicate predicateFormat]];

- [tableField setStringValue:desc];
+ var desc = "";
+
+ var filtered = [tableArray filteredArrayUsingPredicate:predicate];
+ for(var i=0;i<[filtered count];i++)
+ desc += [[[filtered objectAtIndex:i] allValues]
componentsJoinedByString:" "] +"\n";
+
+ [tableField setStringValue:desc];
+ }

}


Modified: branches/CPRuleEditor/CPComparisonPredicate.j
==============================================================================
--- branches/CPRuleEditor/CPComparisonPredicate.j (original)
+++ branches/CPRuleEditor/CPComparisonPredicate.j Thu Feb 5 14:04:14 2009
@@ -23,12 +23,14 @@
CPEndsWithPredicateOperatorType = 9;
CPInPredicateOperatorType = 10;
CPCustomSelectorPredicateOperatorType = 11;
-CPContainsPredicateOperatorType = 12;
-CPBetweenPredicateOperatorType = 13;
+CPContainsPredicateOperatorType = 99;
+CPBetweenPredicateOperatorType = 100;

CPCaseInsensitivePredicateOption = 1;
CPDiacriticInsensitivePredicateOption = 2;

+CPDiacriticInsensitiveSearch = 128;
+
var CPComparisonPredicateModifier;
var CPPredicateOperatorType;

@@ -38,9 +40,15 @@
{
if (range.location + range.length > [self length])
[CPException raise:CPRangeException reason:"Range exceeds the
length of the receiver"]; // should raise in cocoa but doesn't
-
+
var lhs = [self substringWithRange:range],
rhs = aString;
+
+ if(aMask & CPDiacriticInsensitiveSearch)
+ {
+ lhs = _stripDiacritics(lhs);
+ rhs = _stripDiacritics(rhs);
+ }

return [lhs compare:rhs options:aMask];
}
@@ -70,7 +78,8 @@
type != CPLikePredicateOperatorType &&
type != CPBeginsWithPredicateOperatorType &&
type != CPEndsWithPredicateOperatorType &&
- type != CPInPredicateOperatorType)
+ type != CPInPredicateOperatorType &&
+ type != CPContainsPredicateOperatorType)
_options = 0;

_customSelector = 0;
@@ -202,6 +211,9 @@
case CPInPredicateOperatorType:
operator = "IN";
break;
+ case CPContainsPredicateOperatorType:
+ operator = "CONTAINS";
+ break;

// FIX, not right
case CPCustomSelectorPredicateOperatorType:
@@ -256,8 +268,7 @@

- (BOOL)_evaluateValue:leftResult rightValue:rightResult
{
- var CPDiacriticInsensitiveSearch = 128; // this has to be declared in
CPString rather than here
-
+
var leftIsNil = (leftResult == nil || [leftResult isEqual:[CPNull
null]]);
var rightIsNil = (rightResult == nil || [rightResult isEqual:[CPNull
null]]);

@@ -349,6 +360,27 @@

case CPCustomSelectorPredicateOperatorType:
return [leftResult performSelector:_customSelector
withObject:rightResult];
+
+ case CPContainsPredicateOperatorType:
+
+ if (![leftResult isKindOfClass: [CPString class]])
+ {
+ if (![leftResult respondsToSelector:
@selector(objectEnumerator)])
+ [CPException raise:CPInvalidArgumentException
reason:@"The left hand side for a CONTAINS operator must be a collection"];
+
+ var e = [leftResult objectEnumerator],
+ value;
+ while (value = [e nextObject])
+ if ([value isEqual:rightResult])
+ return YES;
+
+ return NO;
+ }
+
+ if (_options & CPCaseInsensitivePredicateOption)
string_compare_options |= CPCaseInsensitiveSearch;
+ if (_options & CPDiacriticInsensitivePredicateOption)
string_compare_options |= CPDiacriticInsensitiveSearch;
+
+ return ([leftResult rangeOfString:rightResult
options:string_compare_options].location != CPNotFound);

default:
return NO;

Modified: branches/CPRuleEditor/CPCompoundPredicate.j
==============================================================================
--- branches/CPRuleEditor/CPCompoundPredicate.j (original)
+++ branches/CPRuleEditor/CPCompoundPredicate.j Thu Feb 5 14:04:14 2009
@@ -79,7 +79,6 @@
break;

case CPOrPredicateType:
- CPLogConsole("result = "+result);
result += [args objectAtIndex:0];

for(var j=1;j<[args count];j++) result += " OR " + [args
objectAtIndex:j];

Modified: branches/CPRuleEditor/CPRuleEditor.j
==============================================================================
--- branches/CPRuleEditor/CPRuleEditor.j (original)
+++ branches/CPRuleEditor/CPRuleEditor.j Thu Feb 5 14:04:14 2009
@@ -3,16 +3,23 @@
* Copyright (c) 2008 Pear, Inc. All rights reserved.
*/

-
-
@import "CPPredicate.j"
-@import "_CPRuleEditorCache.j"
-@import "_CPRuleEditorViewSliceHolder.j"
-@import "_CPRuleEditorViewUnboundRowHolder.j"
+@import "CPRuleEditorCache.j"
+@import "CPRuleEditorViewSliceHolder.j"
+@import "CPRuleEditorViewUnboundRowHolder.j"
@import "CPRuleEditorViewSliceDropSeparator.j"
@import "CPRuleEditorViewSliceRow.j"
@import "RowObject.j"
-@import "Localizer.j"
+@import "CPRuleEditorLocalizer.j"
+@import "CPViewAnimation.j"
+
+ CPDragOperationNone = 0;
+ CPDragOperationCopy = 1;
+ CPDragOperationLink = 2;
+ CPDragOperationGeneric = 4;
+ CPDragOperationPrivate = 8;
+ CPDragOperationMove = 16;
+ CPDragOperationDelete = 32;

CPRuleEditorPredicateLeftExpression
= "CPRuleEditorPredicateLeftExpression";
CPRuleEditorPredicateRightExpression
= "CPRuleEditorPredicateRightExpression";
@@ -42,6 +49,45 @@
subrowsContext = "subrows_array";
boundArrayContext = "bound_array";

+@implementation CPArray (Additions)
+
+-(int)nextUnusedObjectIn:(CPArray)objects
+{
+
+ var found = CPNotFound;
+ var count = [self count];
+ var current_objects = objects;
+
+ while(found == CPNotFound)
+ {
+ CPLogConsole(@"CURRENT OBJECTS"+current_objects);
+ var buffer = [CPMutableArray arrayWithArray:current_objects];
+ var i;
+ for(i=0;i<count;i++)
+ {
+ var o = [self objectAtIndex:i];
+ if(![current_objects containsObject:o])
+ {
+ found = i;
+ break;
+ }
+ }
+ if(found == CPNotFound)
+ {
+ var k;
+ for(k = 0;k <count;k++){
+ var anobject = [self objectAtIndex:k];
+ var index = [buffer indexOfObject:anobject];
+ if(index != CPNotFound)[buffer removeObjectAtIndex:index];
+ }
+ current_objects = buffer;
+ }
+ }
+
+ return found;
+}
+
+@end

@implementation CPRuleEditor : CPView
{
@@ -79,8 +125,8 @@

CPTimer _frameTimer;
CPView _slicesHolder;
- // CPViewAnimation _currentAnimation;
-
+ CPViewAnimation _currentAnimation;
+
int _lastRow;
int _nestingMode;

@@ -92,8 +138,8 @@
id _boundArrayOwner;

CPString _stringsFilename;
- id _headerLocalizer;
- id _standardLocalizer;
+ CPRuleEditorLocalizer _headerLocalizer;
+ CPRuleEditorLocalizer _standardLocalizer;

id _ruleReserved1;
id _ruleReserved2;
@@ -104,6 +150,11 @@
return _standardLocalizer;
}

+- (void)_setStandardLocalizer:(id)loc
+{
+ _standardLocalizer = loc;
+}
+
+ (void)initialize
{

@@ -167,7 +218,7 @@
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
- if (self != nil) {
+ if (self != nil){
[self _initRuleEditorShared];
}
return self;
@@ -175,8 +226,8 @@

- (void)_initRuleEditorShared
{
-// _currentAnimation = [[CPViewAnimation alloc] initWithDuration:0.
animationCurve:CPAnimationEaseInOut];
-// [_currentAnimation setAnimationBlockingMode:CPAnimationNonblocking];
+ _currentAnimation = [[CPViewAnimation alloc] initWithDuration:0.5
animationCurve:CPAnimationEaseInOut];
+ // [_currentAnimation setAnimationBlockingMode:CPAnimationNonblocking];

_rowCache = [[CPMutableArray alloc] init];
_slices = [[CPMutableArray alloc] init];
@@ -196,16 +247,16 @@
_valuesKeyPath = @"displayValues";
_boundArrayKeyPath = @"boundArray";

- _sliceHeight = 25;
+ _sliceHeight = 26;

_dropLineView = [self _createSliceDropSeparator];

- _slicesHolder = [[RuleEditorViewSliceHolder alloc] initWithFrame:[self
bounds]];
+ _slicesHolder = [[CPRuleEditorViewSliceHolder alloc] initWithFrame:[self
bounds]];
[_slicesHolder setAutoresizingMask:CPViewHeightSizable |
CPViewWidthSizable];
[_slicesHolder addSubview:_dropLineView];
[self addSubview:_slicesHolder];

- _boundArrayOwner = [[RuleEditorViewUnboundRowHolder alloc] init];
+ _boundArrayOwner = [[CPRuleEditorViewUnboundRowHolder alloc] init];
[_boundArrayOwner addObserver:self forKeyPath:_boundArrayKeyPath
options:CPKeyValueObservingOptionOld|CPKeyValueObservingOptionNew
context:boundArrayContext];

[self registerForDraggedTypes:[CPArray
arrayWithObjects:CPRuleEditorItemPBoardType,nil]];
@@ -215,9 +266,9 @@
[center addObserver:self selector:@selector(reloadPredicate)
name:CPRuleEditorRulesDidChangeNotification object:nil];
}

-- (RuleEditorViewSliceDropSeparator)_createSliceDropSeparator
+- (CPRuleEditorViewSliceDropSeparator)_createSliceDropSeparator
{
- var view = [[RuleEditorViewSliceDropSeparator alloc]
initWithFrame:CGRectMake(0,-10, [self frame].size.width, 2)];
+ var view = [[CPRuleEditorViewSliceDropSeparator alloc]
initWithFrame:CGRectMake(0,-10, [self frame].size.width, 2)];
[view setAutoresizingMask:CPViewWidthSizable];
return view;
}
@@ -269,7 +320,7 @@

- (float)_minimumFrameHeight
{
- return 25.;
+ return 26.;
}

- (Class)rowClass
@@ -352,13 +403,12 @@
if (_ruleDelegate != newDelegate){

var nc = [CPNotificationCenter defaultCenter];
+ if (_ruleDelegate)[nc removeObserver:_ruleDelegate name:nil
object:self];

- if (_ruleDelegate)[nc removeObserver:_ruleDelegate name:nil object:self];
-
+ if ([newDelegate respondsToSelector:@selector(ruleEditorRowsDidChange:)])
+ [nc addObserver:newDelegate
selector:@selector(ruleEditorRowsDidChange:)
name:CPRuleEditorRowsDidChangeNotification object:nil];
+
_ruleDelegate = newDelegate;
-
- if ([_ruleDelegate
respondsToSelector:@selector(ruleEditorRowsDidChange:)])
- [nc addObserver:_ruleDelegate
selector:@selector(ruleEditorRowsDidChange:)
name:CPRuleEditorRowsDidChangeNotification object:self];
}
}

@@ -622,13 +672,57 @@

}

+-(int)nextUnusedCriterionOfType:(CPRuleEditorRowType)type
+{
+ var found = CPNotFound;
+ var count = [self _queryNumberOfChildrenOfItem:NULL withRowType:type];
+
+ var current_criterions = [CPMutableArray array];
+ var row;
+ for (row=0; row < [self numberOfRows]; row++) {
+ if([self rowTypeForRow:row] == type)
+ {
+ var crit = [[self criteriaForRow:row] objectAtIndex:0];
+ [current_criterions addObject:crit];
+ }
+ }
+
+ while(found == CPNotFound)
+ {
+ CPLogConsole("CURRENT OBJECTS"+current_criterions);
+ var buffer = [CPMutableArray arrayWithArray:current_criterions];
+ var i;
+ for(i=0;i<count;i++)
+ {
+ var o = [self _queryChild:i ofItem:NULL withRowType:type];
+ if(![current_criterions containsObject:o])
+ {
+ found = i;
+ break;
+ }
+ }
+
+ if(found == CPNotFound)
+ {
+ var k;
+ for(k = 0;k <count;k++){
+ var anobject = [self _queryChild:k ofItem:NULL withRowType:type];
+ var index = [buffer indexOfObject:anobject];
+ if(index != CPNotFound)[buffer removeObjectAtIndex:index];
+ }
+ current_criterions = buffer;
+ }
+ }
+
+ return found;
+}
+
- (CPMutableArray)_getItemsAndValuesToAddForRow:(int)rowIndex
ofType:(CPRuleEditorRowType)type
{
var itemsAndValues = [CPMutableArray array];
-
var item = nil;
var numItems;
- var firstItemAdded = NO;
+ var next = [self nextUnusedCriterionOfType:type];

var relativeIndex = (type == CPRuleEditorRowTypeSimple) ? rowIndex :
rowIndex - [self parentRowForRow:rowIndex] -1;

@@ -636,8 +730,7 @@

var itemAndValue = [CPDictionary dictionary];

- var childIndex = (firstItemAdded)?0:(relativeIndex % numItems);
-
+ var childIndex = (item == NULL) ? next : 0;
var child = [self _queryChild:childIndex ofItem:item withRowType:type];

[itemAndValue setObject:child forKey:@"item"];
@@ -713,18 +806,14 @@
var subrow = [self _insertNewRowAtIndex:insertIndex+1
ofType:CPRuleEditorRowTypeSimple withParentRow:insertIndex];
[[self _subrowObjectsOfObject:newObject] insertObject:subrow atIndex:0];
}
-CPLogConsole(_cmd);
+
var parentRowObject = (parentRowIndex === -1 || _nestingMode ==
CPRuleEditorNestingModeList) ? _boundArrayOwner:[[self
_rowCacheForIndex:parentRowIndex] rowObject];
var subrows_key_path = (parentRowObject === _boundArrayOwner) ?
_boundArrayKeyPath:_subrowsArrayKeyPath;
-CPLogConsole(_cmd);
+
var subrowsObjects = [self _subrowObjectsOfObject:parentRowObject];
var r_insertIndex = insertIndex-parentRowIndex-1;
-CPLogConsole(_cmd);
-// [parentRowObject willChange:CPKeyValueChangeInsertion
valuesAtIndexes:[CPIndexSet indexSetWithIndex:r_insertIndex]
forKey:subrows_key_path];
+
[subrowsObjects insertObject:newObject atIndex:r_insertIndex];
- CPLogConsole([subrowsObjects className]);
-// [parentRowObject didChange:CPKeyValueChangeInsertion
valuesAtIndexes:[CPIndexSet indexSetWithIndex:r_insertIndex]
forKey:subrows_key_path];
-CPLogConsole(_cmd);
}

- (id)_insertNewRowAtIndex:(int)insertIndex
ofType:(CPRuleEditorRowType)rowtype withParentRow:(int)parentRowIndex
@@ -832,7 +921,7 @@
oldRows = changeOldValue;
[self _changedRowArray:newRows withOldRowArray:oldRows
forParent:object];

- [self _reconfigureSubviewsAnimate:YES];
+ [self _reconfigureSubviewsAnimate:[self _wantsRowAnimations]];
[self reloadPredicate];

if ([newRows count] != [oldRows count])
@@ -908,7 +997,9 @@
else
parentCacheindentation = [[self _rowCacheForIndex:parentCacheIndex]
indentation];

- [_rowCache removeObjectsInRange:CPMakeRange(parentCacheIndex+1,
oldRowCount)];
+ var insertCacheIndexes = [CPIndexSet indexSet];
+ var newCaches = [CPArray array];
+
var newRowCacheindex;
for (newRowCacheindex = 0; newRowCacheindex < newRowCount;
newRowCacheindex++)
{
@@ -920,23 +1011,24 @@
[cache setRowObject:obj];
[cache setRowIndex:newCacheIndex];
[cache setIndentation:parentCacheindentation + 1];
- [_rowCache insertObject:cache atIndex:newCacheIndex];
+ [insertCacheIndexes addIndex:newCacheIndex];
+ [newCaches addObject:cache];

if ([[obj valueForKey:_itemsKeyPath] count]==0){
var itemsandvalues = [self
_getItemsAndValuesToAddForRow:newRowCacheindex ofType:newRowType];
var newitems = [itemsandvalues valueForKey:@"item"];
var newvalues = [itemsandvalues valueForKey:@"value"];
CPLogConsole("new Items:"+[newitems description]);
- [obj willChangeValueForKey:_itemsKeyPath];
+
[obj setValue:[CPMutableArray arrayWithArray:newitems]
forKey:_itemsKeyPath];
- [obj didChangeValueForKey:_itemsKeyPath];
-
- [obj willChangeValueForKey:_valuesKeyPath];
[obj setValue:[CPMutableArray arrayWithArray:newvalues]
forKey:_valuesKeyPath];
- [obj didChangeValueForKey:_valuesKeyPath];
}
}
-CPLogConsole("ROW CACHE"+_rowCache);
+
+ [_rowCache removeObjectsInRange:CPMakeRange(parentCacheIndex+1,
oldRowCount)];
+ [_rowCache insertObjects:newCaches atIndexes:insertCacheIndexes];
+
+ CPLogConsole("ROW CACHE"+_rowCache);
var deltaCount = newRowCount - oldRowCount;
var minusCount = MIN(newRowCount,oldRowCount);

@@ -985,10 +1077,8 @@

- (CPRuleEditorViewSliceRow)_newSlice
{
-CPLogConsole(_cmd);
var sliceRect = CGRectMake(0, 0, [self frame].size.width, 1);
var slice = [self _createNewSliceWithFrame:sliceRect ruleEditorView:self];
-CPLogConsole(slice);
[slice setEditable:editable];

return slice;
@@ -996,16 +1086,14 @@

- (CPRuleEditorViewSliceRow)_createNewSliceWithFrame:(CGRect)frame
ruleEditorView:(CPRuleEditor)editor
{
-CPLogConsole(_cmd);
var newslice = [[CPRuleEditorViewSliceRow alloc] initWithFrame:frame
ruleEditorView:editor];
-CPLogConsole(newslice);
return newslice;
}

- (void)_reconfigureSubviewsAnimate:(BOOL)animate
{
[self _updateSliceRows];
-
+
var viewAnimations = [CPMutableArray array];
var added_slices = [CPMutableArray array];

@@ -1017,18 +1105,18 @@
{
if ([aslice superview] == nil)
{
- var addFrame = CGRectMake(0, ([aslice rowIndex])*_sliceHeight, [self
frame].size.width, _sliceHeight);
- if (animate)addFrame.size.height = 1.;
+ var addFrame = CGRectMake(0, [aslice rowIndex]*_sliceHeight, [self
frame].size.width, _sliceHeight);
+ if (animate)addFrame.origin.y = ([aslice rowIndex]-1)*_sliceHeight;
[aslice setFrame:addFrame];

[aslice _reconfigureSubviews];
-
[added_slices addObject:aslice];
}

var animation = [CPDictionary dictionary];
- [animation setObject:aslice forKey:"CPViewAnimationTargetKey"];
- [animation setObject:targetRect.origin.y
forKey:"CPViewAnimationEndFrameKey"];
+ [animation setObject:aslice forKey:CPViewAnimationTargetKey];
+ [animation setObject:[CPValue valueWithRect:[aslice frame]]
forKey:CPViewAnimationStartFrameKey];
+ [animation setObject:[CPValue valueWithRect:targetRect]
forKey:CPViewAnimationEndFrameKey];

[viewAnimations insertObject:animation atIndex:0];
}
@@ -1044,19 +1132,18 @@
}

if (animate)
- {
+ {
+ [_currentAnimation setViewAnimations:viewAnimations];
+ [_currentAnimation startAnimation];
+ }else
+ {
for (var k= 0;k< [viewAnimations count];k++)
{
-CPLogConsole(_cmd);
var anim = [viewAnimations objectAtIndex:k];
-CPLogConsole([anim description]);
- var endOrigin = [anim objectForKey:"CPViewAnimationEndFrameKey"];
-CPLogConsole(_cmd);
- var target = [anim objectForKey:"CPViewAnimationTargetKey"];
-CPLogConsole(_cmd);
-var endFrame = CPRectMake(0,endOrigin,[self
frame].size.width,_sliceHeight);
- [target setFrame:endFrame];
- }
+ var endFrame = [[anim objectForKey:CPViewAnimationEndFrameKey]
rectValue];
+ var target = [anim objectForKey:CPViewAnimationTargetKey];
+ [target setFrame:endFrame];
+ }
}
/*
[[_slices objectAtIndex:_lastRow] setNeedsDisplay:YES];
@@ -1155,8 +1242,6 @@
[self setPredicate:new_predicate];
//[self didChangeValueForKey:@"predicate"];
CPLogConsole(@"new Predicate:" + new_predicate);
- [[[CPApplication sharedApplication] delegate] refresh:new_predicate];
-
}

- (void)_updatePredicate
@@ -1195,8 +1280,8 @@
var i;
for (i = 0; i < [items count]; i++){
var item = [items objectAtIndex:i];
- var displayValue = [self _queryValueForItem:item inRow:row]; // A voir.
On peut aussi prendre la valeur affichée dans le row cache.
-
+ //var displayValue = [self _queryValueForItem:item inRow:row]; A voir.
On peut aussi prendre la valeur affichée dans le row cache.
+ var displayValue = [[self displayValuesForRow:row] objectAtIndex:i];
var predpart = [_ruleDelegate ruleEditor:self
predicatePartsForCriterion:item withDisplayValue:displayValue inRow:row];
CPLogConsole("Predicate part = " + [predpart description]+" for item "+i+"
in row "+row);
if (predpart)[predicateParts addEntriesFromDictionary:predpart];
@@ -1281,6 +1366,7 @@
type:[operator intValue] // CPNumber
options:(options) ? [options
intValue]:CPCaseInsensitivePredicateOption // CPNumber
];
+ CPLogConsole("built options:"+[predicate options]+" predicate
= "+[predicate predicateFormat]);
}
catch(error)
{
@@ -1490,7 +1576,7 @@

- (void)_postRowCountChangedNotificationOfType:(CPString)notificationName
indexes:indexes
{
- [[CPNotificationCenter defaultCenter]
postNotificationName:notificationName object:indexes];
+ [[CPNotificationCenter defaultCenter]
postNotificationName:notificationName object:self userInfo:[CPDictionary
dictionaryWithObject:indexes forKey:"indexes"]];
}

- (void)bind:(CPString)binding toObject:(id)observableController
withKeyPath:(CPString)keyPath options:(CPDictionary)options
@@ -1559,7 +1645,7 @@
{
_stringsFilename = value;
var strings = [CPString stringWithContentsOfURL:value];
- _standardLocalizer = [[Localizer alloc] initWithStrings:strings];
+ _standardLocalizer = [[CPRuleEditorLocalizer alloc]
initWithStrings:strings];
}
}

@@ -1568,23 +1654,70 @@
var point = [self convertPoint:[event locationInWindow] fromView:nil];
var view = [self hitTest:point];

- CPLogConsole("Drag from "+CPStringFromPoint(point));
+ CPLogConsole(_cmd+CPStringFromPoint(point));
if ([self _dragShouldBeginFromMouseDown:view])
- [self _performDragForSlice:view withEvent:event];
+ [self _performDragForSlice:view withEvent:event];
}

- (BOOL)_dragShouldBeginFromMouseDown:(CPView)view
{
- return (editable && [view isKindOfClass:[CPRuleEditorViewSliceRow
class]]);
+ return (([self nestingMode] == CPRuleEditorNestingModeList || [view
rowIndex] != 0) && editable && [view
isKindOfClass:[CPRuleEditorViewSliceRow class]] && _draggingRows == nil);
}

+- (BOOL)_performDragForSlice:(id)slice withEvent:(CPEvent)event
+{
+CPLogConsole("START"+_cmd);
+ var size;
+ var dragPoint, pt;
+
+ var mainRowIndex = [slice rowIndex];
+ var draggingRows = [CPMutableIndexSet indexSetWithIndex:mainRowIndex];
+ var selected_indices = [self _selectedSliceIndices];
+ if ([selected_indices containsIndex:mainRowIndex])[draggingRows
addIndexes:selected_indices];
+
+ _draggingRows = [self _includeSubslicesForSlicesAtIndexes:draggingRows];
+CPLogConsole(_draggingRows);
+ var pasteboard = [CPPasteboard pasteboardWithName: CPDragPboard];
+ [pasteboard declareTypes:[CPArray arrayWithObjects:
CPRuleEditorItemPBoardType, nil] owner: self];
+
+ dragPoint = CPMakePoint(0, ([_draggingRows lastIndex]) * _sliceHeight);
+ var date = [CPDate date];
+// var dragview = [CPKeyedUnarchiver
unarchiveObjectWithData:[CPKeyedArchiver archivedDataWithRootObject:slice]];
+
+
+ var dragview = [[CPView alloc] initWithFrame:[slice frame]];
+ var subviews = [slice subviews];
+ for(var i=0;i < [subviews count];i++)
+ {
+ var s = [subviews objectAtIndex:i];
+ CPLogConsole("Subview "+i+" = "+[s className] + CPStringFromRect([s
frame]));
+ var sc = [[[s class] alloc] initWithFrame:CGRectMakeZero()];
+ [sc setFrame:[s frame]];
+ [dragview addSubview:sc];
+ }
+
+ CPLogConsole([CPDate date] - date);
+ [dragview setBackgroundColor:[slice backgroundColor]];
+ [dragview setAlphaValue:0.7];
+ [self dragView: dragview
+ at: dragPoint
+ offset: CPMakeSize(0,_sliceHeight)
+ event: event
+ pasteboard: pasteboard
+ source: self
+ slideBack: YES];
+CPLogConsole("END"+_cmd);
+
+ return YES;
+}
+

- (CPDragOperation)draggingEntered:(id < CPDraggingInfo >)sender
{
CPLogConsole(_cmd);
if ([sender draggingSource] == self){
[self _clearDropLine];
- return CPDragOperationGeneric;
+ return CPDragOperationMove;
}

return CPDragOperationNone;
@@ -1611,12 +1744,13 @@
CPLogConsole(_cmd);
var point = [self convertPoint:[sender draggingLocation] fromView:nil];
var y = point.y + _sliceHeight /2;
- var indexOfDropLine = floor(y / _sliceHeight);
+ var indexOfDropLine = Math.floor(y / _sliceHeight);

if (indexOfDropLine < 0 || indexOfDropLine > [self numberOfRows])
return CPDragOperationNone;

var current_index = [_draggingRows firstIndex];
+ CPLogConsole(_cmd+indexOfDropLine);
while (current_index != CPNotFound) {

if (indexOfDropLine == 0 || indexOfDropLine == current_index ||
indexOfDropLine == current_index + 1)
@@ -1634,74 +1768,71 @@
return CPDragOperationMove;
}

-- (BOOL)_performDragForSlice:(id)slice withEvent:(CPEvent)event
+- (void)_rightMouseDownOnSlice:(CPRuleEditorViewSlice)slice
withEvent:(CPEvent)event
{
-CPLogConsole(_cmd);
- var size;
- var dragPoint, pt;
-
- var mainRowIndex = [slice rowIndex];
- var draggingRows = [CPMutableIndexSet indexSetWithIndex:mainRowIndex];
- var selected_indices = [self _selectedSliceIndices];
- if ([selected_indices containsIndex:mainRowIndex])[draggingRows
addIndexes:selected_indices];
-
- _draggingRows = [self _includeSubslicesForSlicesAtIndexes:draggingRows];
-CPLogConsole(_draggingRows);
- var pasteboard = [CPPasteboard pasteboardWithName: CPDragPboard];
- [pasteboard declareTypes:[CPArray arrayWithObjects:
CPRuleEditorItemPBoardType, nil] owner: self];
-
-/*
- var dragImage = [self _dragImageForIndices:_draggingRows];
-
- dragPoint = CPMakePoint(0, ([_draggingRows lastIndex] + 1) *
_sliceHeight);
-
- [self dragImage: dragImage
- at: dragPoint
- offset: CPZeroSize
- event: event
- pasteboard: pasteboard
- source: self
- slideBack: YES];
-*/
- return YES;
}

-- (CPImage)_dragImageForIndices:(CPIndexSet)indices
+- (void)_performClickOnSlice:(id)slice withEvent:(CPEvent)event
{
- var firstIndex = [indices firstIndex];
- var lastIndex = [indices lastIndex];
-
- var theDraggedSliceFrame = CGRectMake(0, firstIndex *_sliceHeight, [self
frame].size.width, (lastIndex - firstIndex + 1) *_sliceHeight);
-
- var pdfData = [self dataWithPDFInsideRect:theDraggedSliceFrame];
- var pdfImage = [[CPImage alloc] initWithData:pdfData];
- var dragImage = [[CPImage alloc] initWithSize:theDraggedSliceFrame.size];
-
- [dragImage lockFocus];
- [pdfImage dissolveToPoint: CPMakePoint(0,0) fraction: .75];
- [dragImage unlockFocus];
-
- return dragImage;
}

-- (void)_rightMouseDownOnSlice:(CPRuleEditorViewSlice)slice
withEvent:(CPEvent)event
+- (void)selectRowIndexes:(CPIndexSet)indexes
byExtendingSelection:(BOOL)flag
{
}

-- (void)_performClickOnSlice:(id)slice withEvent:(CPEvent)event
+- (BOOL)prepareForDragOperation:(id < CPDraggingInfo >)sender
{
+CPLogConsole(_cmd);
+var insertIndex = Math.floor([_dropLineView frame].origin.y /
_sliceHeight);
+if (insertIndex < 0)
+ {
+ _draggingRows = nil;
+ return NO;
+ }
+return YES;
}

-- (void)selectRowIndexes:(CPIndexSet)indexes
byExtendingSelection:(BOOL)flag
-{
-}

-- (BOOL)performDragOperation:(id)sender
+}
+- (BOOL)performDragOperation:(id < CPDraggingInfo >)info
{
- CPLogConsole(@"ROW CACHE BEFORE %@", [_rowCache description]);
+CPLogConsole(_cmd+[info draggingSource]);
+
+ var aboveInsertIndexCount = 0;
+ var object;
+ var removeIndex;
+
+ var rowObjects = [_rowCache valueForKey:@"rowObject"];
+ var index = [_draggingRows lastIndex];

- CPLogConsole(@"ROW CACHE AFTER%@", [_rowCache description]);
+ var parentRowIndex = [self parentRowForRow:index]; // first index of
draggingrows
+ var parentRowObject = (parentRowIndex == -1) ? _boundArrayOwner : [[self
_rowCacheForIndex:parentRowIndex] rowObject];
+ var insertIndex = Math.floor([_dropLineView frame].origin.y /
_sliceHeight);
+
+ CPLogConsole("insertIndex "+insertIndex+" sourceindex "+index);
+
+ while (CPNotFound != index) {
+ if (index >= insertIndex)
+ {
+ removeIndex = index + aboveInsertIndexCount;
+ aboveInsertIndexCount += 1;
+ }
+ else
+ {
+ removeIndex = index;
+ insertIndex -= 1;
+ }
+
+ object = [rowObjects objectAtIndex:removeIndex];
+ [self removeRowAtIndex:removeIndex];
+ [[self _subrowObjectsOfObject:parentRowObject] insertObject:object
atIndex:insertIndex - parentRowIndex - 1];
+
+ index = [_draggingRows indexLessThanIndex:index];
+ }
+
[self _clearDropLine];
+ _draggingRows = nil;
+ return YES;
}

- (CPIndexSet)_draggingTypes
@@ -1715,22 +1846,28 @@

- (CPDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
{
- if (isLocal) return CPDragOperationMove;
+ if (isLocal)
+ return CPDragOperationMove;
+
return CPDragOperationNone;
}


- (int)_updateDragging:(id)fp8
{
- return (NO) ? CPDragOperationMove : CPDragOperationGeneric;
+ CPLogConsole(_cmd);
+ return CPDragOperationMove;
}

-- (void)draggedImage:(CPImage)dragImage endedAt:(CPPoint)aPoint
operation:(CPDragOperation)operation
+- (void)draggedView:(CPView)dragView endedAt:(CPPoint)aPoint
operation:(CPDragOperation)operation
{
+CPLogConsole(_cmd+operation);
+
}

- (BOOL)wantsPeriodicDraggingUpdates
{
+ return NO;
}

- (id)_dragHandleColors
@@ -1827,9 +1964,7 @@
- (void)_setHeaderLocalizer:(id)loc
{
}
-- (void)_setStandardLocalizer:(id)loc
-{
-}
+
- (void)setFormattingDictionary:(id)dict
{
}

Copied: branches/CPRuleEditor/CPRuleEditorLocalizer.j (from r99,
/branches/CPRuleEditor/Localizer.j)
==============================================================================
--- /branches/CPRuleEditor/Localizer.j (original)
+++ branches/CPRuleEditor/CPRuleEditorLocalizer.j Thu Feb 5 14:04:14 2009
@@ -1,6 +1,6 @@
@import <Foundation/Foundation.j>

-@implementation Localizer : CPObject
+@implementation CPRuleEditorLocalizer : CPObject
{
CPDictionary _dictionary;
}
@@ -11,12 +11,8 @@
if(self != nil)
{
var dict = [CPDictionary dictionary];
- CPLogConsole([strings className]);
var lines = [strings componentsSeparatedByString:"\n"];
- CPLogConsole("lines ="+[lines className]);
- var reg = new RegExp("\"(.+)\"\\s*=\\s*\"(.+)\"\\s*;\\s*");
-
- CPLogConsole("RegExp = "+reg);
+ var reg = new RegExp("\"(.+)\"\\s*=\\s*\"(.+)\"\\s*;\\s*(//.+)?");

for(var i=0;i <[lines count];i++)
{
@@ -24,9 +20,7 @@
if(line.length>1)
{
var match = reg.exec(line);
- CPLogConsole(match[1]+"/"+match[2]+"length = "+match.length);
-
- if(match.length == 3)
+ if(match.length >= 3)
[dict setObject:match[2] forKey:match[1]];
}
}
@@ -38,12 +32,10 @@

-(CPString)localizedStringForString:(CPString)aString
{
-var localized;

if(aString != nil)
{
-CPLogConsole(_dictionary);
- localized = [_dictionary objectForKey:aString];
+ var localized = [_dictionary objectForKey:aString];
if(localized != nil) return localized;
}


Modified: branches/CPRuleEditor/CPRuleEditorPopupButton.j
==============================================================================
--- branches/CPRuleEditor/CPRuleEditorPopupButton.j (original)
+++ branches/CPRuleEditor/CPRuleEditorPopupButton.j Thu Feb 5 14:04:14 2009
@@ -9,5 +9,38 @@
{
}

+- (id)initWithFrame:(CPRect)rect
+{
+ self = [super initWithFrame:rect];
+ if (self != nil) {
+ [self setFont:[CPFont systemFontOfSize:12]];
+ [self setBezelStyle:CPRoundRectBezelStyle];
+ [self setControlSize:CPRegularControlSize];
+ }
+ return self;
+}
+
+- (BOOL)sliceIsEditable
+{
+ var slice = [self superview];
+ return [slice isEditable];
+}
+
+- (BOOL)trackMouse:(CPEvent)theEvent inRect:(CGRect)cellFrame
ofView:(CPView)controlView untilMouseUp:(BOOL)untilMouseUp
+{
+ if (![self sliceIsEditable])
+ return NO;
+
+ return [super trackMouse:theEvent inRect:cellFrame ofView:controlView
untilMouseUp:untilMouseUp];
+}
+
+- (unsigned int)arrowPosition
+{
+ if ([self sliceIsEditable])
+ return CPPopUpArrowAtBottom;
+
+ return CPPopUpNoArrow;
+}
+
@end


Modified: branches/CPRuleEditor/CPRuleEditorTextField.j
==============================================================================
--- branches/CPRuleEditor/CPRuleEditorTextField.j (original)
+++ branches/CPRuleEditor/CPRuleEditorTextField.j Thu Feb 5 14:04:14 2009
@@ -14,16 +14,10 @@
{
self = [super initWithFrame:frame];
if (self != nil) {
- CPLogConsole(_cmd);
- // [self setControlSize:CPMiniControlSize];
- CPLogConsole(_cmd);
[self setBordered:NO];
- CPLogConsole(_cmd);
[self setEditable:NO];
[self setDrawsBackground:NO];
- CPLogConsole(_cmd);
// [self setFont:[CPFont fontWithName:@"LuciaGrande" size:11.]];
-
}
return self;
}

Modified: branches/CPRuleEditor/CPRuleEditorViewSlice.j
==============================================================================
--- branches/CPRuleEditor/CPRuleEditorViewSlice.j (original)
+++ branches/CPRuleEditor/CPRuleEditorViewSlice.j Thu Feb 5 14:04:14 2009
@@ -7,7 +7,7 @@
@implementation CPRuleEditorViewSlice : CPView
{
CPRuleEditor _ruleEditor;
- CPColor _backgroundColor;
+ CPColor backgroundColor;
int _indentation;
CPRect _animationTargetRect;

@@ -17,10 +17,15 @@
unsigned int reserved;

int _rowIndex;
-
}

-- (CPString)descriptionWithLocale:(id)locale
+-(void)removeFromSuperview
+{
+ CPLogConsole([self description]+_cmd);
+ [super removeFromSuperview];
+}
+
+- (CPString)description
{
return [CPString stringWithFormat:@"<%@ %p index:%d
indentation:%d>",[self className],self,[self rowIndex],[self indentation]];
}
@@ -44,9 +49,9 @@
if (self = [super initWithFrame:frame]){

_ruleEditor = editor;
- selected = 0;
- lastSelected = 0;
-
+ selected = NO;
+ lastSelected = NO;
+ [self setBackgroundColor:[CPColor colorWithCalibratedWhite:0.91
alpha:1]];
}
return self;
}
@@ -76,15 +81,15 @@
return selected;
}

-- (CPColor)bgColor
+- (CPColor)backgroundColor
{
- return _backgroundColor ;
+ return backgroundColor ;
}

-- (void)setBgColor:(CPColor)color
+- (void)setBackgroundColor:(CPColor)color
{
- if (_backgroundColor != color)
- _backgroundColor = color;
+ if (backgroundColor != color)
+ backgroundColor = color;
}

- (int)indentation
@@ -119,34 +124,34 @@


-(void)drawRect:(CPRect)rect{
-
var context = [[CPGraphicsContext currentContext] graphicsPort];
+
+//- (void)drawLayer:(CALayer)aLayer inContext:(CGContext)context{
+// var rect = [self bounds];
var bgColor;
if ([self _isSelected])
{
var isKey = [[self window] isKeyWindow];
bgColor = [(isKey) ? [_ruleEditor
_selectedActiveRowColor]:[_ruleEditor _selectedInactiveRowColor]];
}else
- bgColor = [CPColor colorWithCalibratedWhite:0.91 alpha:1];
+ bgColor = [self backgroundColor];

CGContextSetFillColor(context,bgColor);
CGContextFillRect(context,rect);

var drawrect = CGRectMake(0, 0, [self frame].size.width, 1);
-
+ CGContextSetFillColor(context,[_ruleEditor _sliceTopBorderColor]);
+
+ CGContextFillRect(context,drawrect);
+
+ drawrect.origin.y += [self frame].size.height -1;
+
if([self rowIndex] == [_ruleEditor numberOfRows] - 1)
CGContextSetFillColor(context,[_ruleEditor
_sliceLastBottomBorderColor]);
else
CGContextSetFillColor(context,[_ruleEditor _sliceBottomBorderColor]);

CGContextFillRect(context,drawrect);
-
- drawrect.origin.y += [self frame].size.height -1;
- CGContextSetFillColor(context,[_ruleEditor _sliceTopBorderColor]);
-
- CGContextFillRect(context,drawrect);
-
- CPLogConsole(_cmd+[self className]);
}

- (void)mouseDown:(CPEvent)theEvent

Modified: branches/CPRuleEditor/CPRuleEditorViewSliceDropSeparator.j
==============================================================================
--- branches/CPRuleEditor/CPRuleEditorViewSliceDropSeparator.j (original)
+++ branches/CPRuleEditor/CPRuleEditorViewSliceDropSeparator.j Thu Feb 5
14:04:14 2009
@@ -3,20 +3,14 @@
* Copyright (c) 2008 Pear, Inc. All rights reserved.
*/

-@implementation RuleEditorViewSliceDropSeparator : CPView
+@implementation CPRuleEditorViewSliceDropSeparator : CPView
{
- CALayer _rootLayer;
}

- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self != nil) {
- _rootLayer = [CALayer layer];
-
- [self setWantsLayer:YES];
- [self setLayer:_rootLayer];
- [_rootLayer setNeedsDisplay];

}
return self;
@@ -27,9 +21,11 @@
return YES;
}

-- (void)drawInContext:(CGContext)context
+- (void)drawRect:(CPRect)rect
{
- CGContextSetFillColor(context, [CPColor redColor]);
+CPLogConsole(_cmd);
+ var context = [[CPGraphicsContext currentContext] graphicsPort];
+ CGContextSetFillColor(context, [CPColor lightGrayColor]);
CGContextFillRect(context, [self bounds]);
}


Copied: branches/CPRuleEditor/CPRuleEditorViewSliceHolder.j (from r98,
/branches/CPRuleEditor/_CPRuleEditorViewSliceHolder.j)
==============================================================================
--- /branches/CPRuleEditor/_CPRuleEditorViewSliceHolder.j (original)
+++ branches/CPRuleEditor/CPRuleEditorViewSliceHolder.j Thu Feb 5 14:04:14
2009
@@ -4,7 +4,7 @@
*/


-@implementation RuleEditorViewSliceHolder : CPView
+@implementation CPRuleEditorViewSliceHolder : CPView
{

}

Modified: branches/CPRuleEditor/CPRuleEditorViewSliceRow.j
==============================================================================
--- branches/CPRuleEditor/CPRuleEditorViewSliceRow.j (original)
+++ branches/CPRuleEditor/CPRuleEditorViewSliceRow.j Thu Feb 5 14:04:14
2009
@@ -7,7 +7,6 @@
@import "CPRuleEditorViewSlice.j"

@import "CPRuleEditor.j"
-// @import "CPRuleEditorButtonCell.j"
@import "CPRuleEditorPopupButton.j"
@import "CPRuleEditorTextField.j"

@@ -45,7 +44,7 @@
_ruleOptionFrames = [[CPMutableArray alloc] init];
_ruleOptionInitialViewFrames = [[CPMutableArray alloc] init];
_ruleOptionViews = [[CPMutableArray alloc] init];
- editable = 1;
+ editable = YES;
_addButton = [self _createAddRowButton];
_subtractButton = [self _createDeleteRowButton];

@@ -66,7 +65,6 @@
[self addSubview:_addButton];
[self addSubview:_subtractButton];
}
-
}

- (CPButton )_createAddRowButton
@@ -102,10 +100,7 @@
- (CPMenuItem )_createMenuItemWithTitle:(CPString )title
{
var loc_title = [[_ruleEditor standardLocalizer]
localizedStringForString:title];
-
-CPLogConsole("TITLE="+title+" loc = "+[_ruleEditor
standardLocalizer]+"loc_title="+loc_title);
-
- return [[CPMenuItem alloc] initWithTitle:loc_title action:0
keyEquivalent:@""];
+ return [[CPMenuItem alloc] initWithTitle:loc_title action:nil
keyEquivalent:@""];
}

- (CPPopUpButton )_createPopUpButtonWithItems:(CPArray )itemsArray
selectedItemIndex:(int)index
@@ -117,8 +112,8 @@
var rect = CPMakeRect(0, ([_ruleEditor rowHeight] - CONTROL_HEIGHT)/2,
size.width +30, CONTROL_HEIGHT);

var popup = [[CPRuleEditorPopupButton alloc] initWithFrame:rect];
- [popup setBezelStyle:CPRoundRectBezelStyle];
- var menu = [[CPMenu alloc] initWithTitle:@""];
+
+ var menu = [[CPMenu alloc] init];

for (var i=0;i<[itemsArray count];i++)
[menu addItem:[itemsArray objectAtIndex:i]];
@@ -209,9 +204,9 @@

while ( (numItems = [_ruleEditor _queryNumberOfChildrenOfItem:currentItem
withRowType:rowtype]) >0){

- var isCustomRightControl = false;
- var isStaticTextField = false;
- var isPopupMenu = false;
+ var isCustomRightControl = NO;
+ var isStaticTextField = NO;
+ var isPopupMenu = NO;
var isMultiValue = numItems > 1;
var selectedMenuItemIndex =0;

@@ -246,7 +241,7 @@
[menuItem setTag:indexInCriteria];

[itemsArray addObject:menuItem];
- isPopupMenu = true;
+ isPopupMenu = YES;

if ((childIndex == numItems - 1 && selectedItem == nil)
|| ([current_display_value isEqual:display_value_cached])
@@ -259,12 +254,12 @@
}
else if ([current_display_value isKindOfClass:[CPString class]])
{
- isStaticTextField = true;
+ isStaticTextField = YES;
selectedItem = childItem; selectedMenuItemIndex =0;
}
- else if ([current_display_value isKindOfClass:[CPControl class]])
+ else if ([current_display_value isKindOfClass:[CPView class]])
{
- isCustomRightControl = true;
+ isCustomRightControl = YES;
selectedItem = childItem; selectedMenuItemIndex =0;
} else
[CPException raise:CPGenericException reason:@"Display value must be a
string or a custom control"];
@@ -281,10 +276,10 @@
}
else if (isCustomRightControl)
{
- optionView = display_value_cached;
+ optionView = display_value_cached; //display_value_cached
[optionView setFrame:CPMakeRect(0, 0, 150, CONTROL_HEIGHT)];
- if ([optionView respondsToSelector:@selector(cell)])
- [[optionView cell] setEditable:editable];
+ if ([optionView respondsToSelector:@selector(setEditable:)])
+ [optionView setEditable:[self isEditable]];
}

[_ruleOptionViews addObject:optionView];
@@ -323,7 +318,7 @@
var _ruleOptionView;
while (_ruleOptionView = [collection nextObject])
{
- var shouldAddView = ([_ruleOptionView superview] == nil);
+ var shouldAddView = YES;
if (changedWidth || shouldAddView)
{
var optionFrame = [_ruleOptionView frame];
@@ -468,17 +463,26 @@
{
[super drawRect:rect];
}
-/*
-- (BOOL)_dropsIndentWhenImmediatelyBelow
+
+- (BOOL)_isRulePopup:(CPView)view
{
+ if([view isKindOfClass:[CPRuleEditorPopupButton class]])
+ return YES;
+ return NO;
}
-- (double)_minWidthForPass:(int)pass forView:(id)view
withProposedMinWidth:(double)minWidth
+
+- (BOOL)_isRuleStaticTextField:(CPView)view
{
+ if([view isKindOfClass:[CPRuleEditorTextField class]])
+ return YES;
+ return NO;
}
-- (BOOL)_isRulePopup:(id)fp8
+
+/*
+- (BOOL)_dropsIndentWhenImmediatelyBelow
{
}
-- (BOOL)_isRuleStaticTextField:(id)fp8
+- (double)_minWidthForPass:(int)pass forView:(id)view
withProposedMinWidth:(double)minWidth
{
}
- (id)_sortOptionDictionariesByLayoutOrder:(id)fp8

Copied: branches/CPRuleEditor/CPRuleEditorViewUnboundRowHolder.j (from r97,
/branches/CPRuleEditor/_CPRuleEditorViewUnboundRowHolder.j)
==============================================================================
--- /branches/CPRuleEditor/_CPRuleEditorViewUnboundRowHolder.j (original)
+++ branches/CPRuleEditor/CPRuleEditorViewUnboundRowHolder.j Thu Feb 5
14:04:14 2009
@@ -3,7 +3,7 @@
* Copyright (c) 2008 Pear, Inc. All rights reserved.
*/

-@implementation RuleEditorViewUnboundRowHolder : CPObject
+@implementation CPRuleEditorViewUnboundRowHolder : CPObject
{
CPArray boundArray;
}

Added: branches/CPRuleEditor/CPViewAnimation.j
==============================================================================
--- (empty file)
+++ branches/CPRuleEditor/CPViewAnimation.j Thu Feb 5 14:04:14 2009
@@ -0,0 +1,189 @@
+@import <AppKit/CPView.j>
+@import <AppKit/CPAnimation.j>
+@import <Foundation/CPString.j>
+@import <Foundation/CPArray.j>
+@import <Foundation/CPValue.j>
+
+CPViewAnimationStartFrameKey = "CPViewAnimationStartFrameKey";
+CPViewAnimationEndFrameKey = "CPViewAnimationEndFrameKey";
+CPViewAnimationTargetKey = "CPViewAnimationTargetKey";
+CPViewAnimationEffectKey = "CPViewAnimationEffectKey";
+
+CPViewAnimationFadeInEffect = "CPViewAnimationFadeInEffect";
+CPViewAnimationFadeOutEffect = "CPViewAnimationFadeOutEffect";
+
+@implementation CPValue (Rect)
+
++ (CPValue)valueWithRect:(CPRect)rect
+{
+ return [CPValue
valueWithJSObject:[rect.origin.x,rect.origin.y,rect.size.width,rect.size.height]];
+}
+
+-(CPRect)rectValue
+{
+ var value = [self JSObject];
+ return CPMakeRect(value[0],value[1],value[2],value[3]);
+}
+@end
+
+@implementation CPViewAnimation : CPAnimation
+{
+ CPArray _viewAnimations;
+ CPDictionary _viewAnimationInfo;
+}
+
+
+- (id)initWithViewAnimations:(CPArray)animations
+{
+ [super initWithDuration:0.5 animationCurve:CPAnimationEaseInOut];
+ [self setViewAnimations:animations];
+ return self;
+}
+
+-(CPArray)viewAnimations
+{
+ return _viewAnimations;
+}
+
+-(void)setViewAnimations:(CPArray)animations
+{
+ _viewAnimations = animations;
+
+ if(!CPBrowserIsEngine(CPWebKitBrowserEngine)) return;
+
+ count = [_viewAnimations count];
+
+ for(var i = 0; i < count; i++)
+ {
+ var timingFunction;
+ var animation = [_viewAnimations objectAtIndex:i];
+ var target = [animation objectForKey:CPViewAnimationTargetKey];
+ var style = target._DOMElement.style;
+
+ switch([self animationCurve])
+ {
+ case CPAnimationEaseInOut:
+ timingFunction = "ease-in-out";
+ break;
+ case CPAnimationEaseIn:
+ timingFunction = "ease-in";
+ break;
+ case CPAnimationEaseOut:
+ timingFunction = "ease-out";
+ break;
+ case CPAnimationLinear:
+ timingFunction = "linear";
+ break;
+ case "CPAnimationCool":
+ timingFunction = "cubic-bezier(0.1, 0.25, 0.1, 1.0)";
+ break;
+ default:
+ timingFunction = "ease-in-out";
+ }
+
+ var properties = "top, left, width, height";
+ if ([animation objectForKey:CPViewAnimationEffectKey] != nil)
+ properties += ", opacity";
+
+ style.webkitTransitionProperty = properties;
+ style.webkitTransitionDuration = [self duration] + "s";
+ style.webkitTransitionTimingFunction = timingFunction;
+ }
+CPLogConsole(_cmd);
+}
+
+- (void)setCurrentProgress:(float)progress
+{
+ [super setCurrentProgress:progress];
+
+if(CPBrowserIsEngine(CPWebKitBrowserEngine)) return;
+
+ var i;
+ count = [_viewAnimations count],
+ t = [self currentValue],
+ _needsDisplay = NO;
+
+for(var i = 0; i < count; i++)
+{
+ var animation = [_viewAnimations objectAtIndex:i];
+ var target = [animation objectForKey:CPViewAnimationTargetKey];
+ var startFrame = [[animation objectForKey:CPViewAnimationStartFrameKey]
rectValue];
+ var endFrame = [[animation objectForKey:CPViewAnimationEndFrameKey]
rectValue];
+
+ if(CPRectEqualToRect(startFrame,endFrame) == NO)
+ {
+ var borig = endFrame.origin;
+ var aorig = startFrame.origin;
+ var bsize = endFrame.size;
+ var asize = startFrame.size;
+
+ var frame = CPMakeRect(borig.x*t + aorig.x *(1-t),
+ borig.y*t + aorig.y *(1-t),
+ bsize.width*t + asize.width *(1-t),
+ bsize.height*t + asize.height *(1-t));
+
+ [target setFrame:frame];
+
+ _needsDisplay = YES;
+ }
+
+ var effect = [animation objectForKey:CPViewAnimationEffectKey];
+ if (effect == CPViewAnimationFadeInEffect)
+ [target setAlphaValue:t];
+ else if (effect == CPViewAnimationFadeOutEffect)
+ [target setAlphaValue:1-t];
+}
+ CPLogConsole(_cmd+progress);
+}
+
+-(float)currentValue
+{
+ return _progress;
+}
+- (void)startAnimation
+{
+
+if(!CPBrowserIsEngine(CPWebKitBrowserEngine))
+{
+ [super startAnimation];
+ return;
+}
+
+ var count = [_viewAnimations count];
+
+ for(var i = 0; i < count; i++)
+ {
+ var animation = [_viewAnimations objectAtIndex:i];
+ var target = [animation objectForKey:CPViewAnimationTargetKey];
+ var endFrame = [[animation objectForKey:CPViewAnimationEndFrameKey]
rectValue];
+
+ var effect = [animation objectForKey:CPViewAnimationEffectKey];
+ if(effect)
+ {
+ var opacity;
+ switch(effect)
+ {
+ case CPViewAnimationFadeInEffect: opacity = 1;
+ break;
+ case CPViewAnimationFadeOutEffect: opacity = 0;
+ break;
+ default : opacity = 1;
+ }
+ [target setAlphaValue:opacity];
+ }
+ [target setFrame:endFrame];
+ }
+ CPLogConsole(_cmd);
+}
+
+- (void)_stopAnimation:(int)value
+{
+
+}
+
+- (BOOL)_drawView:(CPView)view
+{
+ return YES;
+}
+
+@end
\ No newline at end of file

Added: branches/CPRuleEditor/EditableTextField.j
==============================================================================
--- (empty file)
+++ branches/CPRuleEditor/EditableTextField.j Thu Feb 5 14:04:14 2009
@@ -0,0 +1,28 @@
+@implementation EditableTextField : CPTextField
+{
+}
+
+- (id) initWithFrame:(CPRect)frame
+{
+ self = [super initWithFrame:CGRectMake(0,0,100,18)];
+
+ if (self != nil)
+ {
+ [self setBezeled:YES];
+ [self setBezelStyle:CPTextFieldSquareBezel];
+ [self setBordered:YES];
+ [self setEditable:YES];
+ [self setDrawsBackground:YES];
+ [self setDelegate:self];
+ // [self setFont:[CPFont fontWithName:@"LuciaGrande" size:11.]];
+ }
+ return self;
+}
+
+- (void)controlTextDidEndEditing:(CPNotification)aNotification
+{
+ CPLogConsole(_cmd);
+ [[CPNotificationCenter defaultCenter]
postNotificationName:@"CPRuleEditorRulesDidChangeNotification" object:nil];
+}
+
+@end
\ No newline at end of file

Modified: branches/CPRuleEditor/Info.plist
==============================================================================
--- branches/CPRuleEditor/Info.plist (original)
+++ branches/CPRuleEditor/Info.plist Thu Feb 5 14:04:14 2009
@@ -5,7 +5,7 @@
<key>CPApplicationDelegateClass</key>
<string>AppController</string>
<key>CPBundleName</key>
- <string>Hello World</string>
+ <string>CPRuleEditor</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>

Modified: branches/CPRuleEditor/RowObject.j
==============================================================================
--- branches/CPRuleEditor/RowObject.j (original)
+++ branches/CPRuleEditor/RowObject.j Thu Feb 5 14:04:14 2009
@@ -1,7 +1,7 @@
@implementation RowObject : CPObject
{
-CPArray subrows;
-CPArray criteria;
-CPArray displayValues;
-int rowType;
+ CPArray subrows;
+ CPArray criteria;
+ CPArray displayValues;
+ int rowType;
}

Modified: branches/CPRuleEditor/RuleDelegate.j
==============================================================================
--- branches/CPRuleEditor/RuleDelegate.j (original)
+++ branches/CPRuleEditor/RuleDelegate.j Thu Feb 5 14:04:14 2009
@@ -1,6 +1,8 @@

@import <Foundation/Foundation.j>
@import "CPRuleEditor.j"
+@import "EditableTextField.j"
+@import "Slider.j"

var CPRuleEditorPredicateKeys = new
Array(CPRuleEditorPredicateLeftExpression,CPRuleEditorPredicateRightExpression,CPRuleEditorPredicateComparisonModifier,CPRuleEditorPredicateOptions,CPRuleEditorPredicateOperatorType,CPRuleEditorPredicateCustomSelector,CPRuleEditorPredicateCompoundType);

@@ -24,7 +26,7 @@

/* When called, you should return the number of child items of the given
criterion. If criterion is nil, you should return the number of root
criteria for the given row type. Implementation of this method is required.
*/

-- (int)ruleEditor:(RuleEditor )editor
numberOfChildrenForCriterion:(id)criterion
withRowType:(CPRuleEditorRowType)rowType
+- (int)ruleEditor:(CPRuleEditor)editor
numberOfChildrenForCriterion:(id)criterion
withRowType:(CPRuleEditorRowType)rowType
{
var childs;
if (criterion)
@@ -36,7 +38,7 @@

/* When called, you should return the child of the given item at the given
index. If criterion is nil, return the root criterion for the given row
type at the given index. Implementation of this method is required. */

-- (id)ruleEditor:(RuleEditor *)editor child:(int)index
forCriterion:(id)criterion withRowType:(CPRuleEditorRowType)rowType
+- (id)ruleEditor:(CPRuleEditor)editor child:(int)index
forCriterion:(id)criterion withRowType:(CPRuleEditorRowType)rowType
{
var childs;

@@ -54,25 +56,17 @@
(1) CPMenuItem: not implemented yet.
*/

-- (id)ruleEditor:(RuleEditor)editor displayValueForCriterion:(id)criterion
inRow:(int)row
+- (id)ruleEditor:(CPRuleEditor)editor
displayValueForCriterion:(id)criterion inRow:(int)row
{

var custom_control_class = [criterion
objectForKey:@"CPRuleEditorCustomControlClass"];

if (custom_control_class != nil)
{
- var viewkey = [CPString stringWithFormat:@"view_%d", row];
-
- var view = [criterion objectForKey:viewkey];
- if (view == nil)
- {
- var custom_class = CPClassFromString(custom_control_class);
- view = [[custom_class alloc] initWithFrame:CGRectMake(0,0,100,18)];
- [view setBackgroundColor:[CPColor whiteColor]];
- [view setEditable:YES];
- [view setObjectValue:"truc"];
- [criterion setObject:view forKey:viewkey];
- }
+ var custom_class = CPClassFromString(custom_control_class);
+ view = [[custom_class alloc] initWithFrame:CGRectMake(0,0,100,18)];
+
+ CPLogConsole("Will Add right view "+view+" For row "+row);
return view;
}

@@ -80,14 +74,14 @@

}

-- (CPDictionary)ruleEditor:(RuleEditor)editor
predicatePartsForCriterion:(id)criterion withDisplayValue:(id)value
inRow:(int)row
+- (CPDictionary)ruleEditor:(CPRuleEditor)editor
predicatePartsForCriterion:(id)criterion withDisplayValue:(id)value
inRow:(int)row
{
var predicatePartsForCriterion = [CPDictionary dictionary];

if ([editor rowTypeForRow:row] == CPRuleEditorRowTypeCompound)
{
var compound_type = [criterion
objectForKey:CPRuleEditorPredicateCompoundType];
- if (compound_type)[predicatePartsForCriterion setObject:compound_type
forKey:CPRuleEditorPredicateCompoundType];
+ if (compound_type != nil)[predicatePartsForCriterion
setObject:compound_type forKey:CPRuleEditorPredicateCompoundType];
return predicatePartsForCriterion;
}

@@ -100,7 +94,7 @@
if ([key isEqualToString:CPRuleEditorPredicateLeftExpression])
{
var str = [criterion objectForKey:key];
- if (str) predicatePart = [CPExpression expressionForKeyPath:str];
+ if (str != nil) predicatePart = [CPExpression
expressionForKeyPath:str];
}
else if ([key isEqualToString:CPRuleEditorPredicateRightExpression])
{
@@ -114,21 +108,21 @@
else if ([key isEqualToString:CPRuleEditorPredicateOperatorType])
{
var operator = [criterion objectForKey:key];
- if (operator) predicatePart = operator;
+ if (operator != nil) predicatePart = operator;
}
else if ([key isEqualToString:CPRuleEditorPredicateCustomSelector])
{
var selector = [criterion objectForKey:key];
- if (selector) predicatePart = selector;
+ if (selector != nil) predicatePart = selector;
}
else if ([key isEqualToString:CPRuleEditorPredicateOptions])
{
var options = [criterion objectForKey:key];
- if (options) predicatePart = options;
+ if (options != nil) predicatePart = options;
}
else continue;

- if (predicatePart)[predicatePartsForCriterion setObject:predicatePart
forKey:key];
+ if (predicatePart != nil)[predicatePartsForCriterion
setObject:predicatePart forKey:key];
}
return predicatePartsForCriterion;
}
@@ -136,7 +130,6 @@

- (void)ruleEditorRowsDidChange:(CPNotification)notification
{
- CPLogConsole(_cmd);
}

@end

Added: branches/CPRuleEditor/Slider.j
==============================================================================
--- (empty file)
+++ branches/CPRuleEditor/Slider.j Thu Feb 5 14:04:14 2009
@@ -0,0 +1,32 @@
+@implementation Slider : CPSlider
+{
+}
+
+- (id) initWithFrame:(CPRect)frame
+{
+ self = [super initWithFrame:CGRectMake(0,0,100,18)];
+
+ if (self != nil)
+ {
+ [self setMinValue:0];
+ [self setMaxValue:60];
+ }
+ return self;
+}
+/*
+- (void)controlValueDidChange:(CPNotification)aNotification
+{
+ CPLogConsole(_cmd);
+ [[CPNotificationCenter defaultCenter]
postNotificationName:@"CPRuleEditorRulesDidChangeNotification" object:nil];
+}
+*/
+-(id)objectValue
+{
+ return Math.round([self value]);
+}
+
+-(void)setObjectValue:(id)value
+{
+ [self setValue:value];
+}
+@end
\ No newline at end of file

Modified: branches/CPRuleEditor/criteria.plist
==============================================================================
--- branches/CPRuleEditor/criteria.plist (original)
+++ branches/CPRuleEditor/criteria.plist Thu Feb 5 14:04:14 2009
@@ -49,14 +49,12 @@
<key>CPRuleEditorPredicateOperatorType</key>
<integer>8</integer>
<key>CPRuleEditorPredicateOptions</key>
- <integer>0</integer>
+ <integer>3</integer>
<key>criteria</key>
<array>
<dict>
- <key>CPRuleEditorPredicateRightExpression</key>
- <string>k</string>
- <key>valeur</key>
- <string>k</string>
+ <key>CPRuleEditorCustomControlClass</key>
+ <string>EditableTextField</string>
</dict>
</array>
<key>valeur</key>
@@ -66,20 +64,35 @@
<key>CPRuleEditorPredicateComparisonModifier</key>
<integer>0</integer>
<key>CPRuleEditorPredicateOperatorType</key>
- <integer>9</integer>
+ <integer>99</integer>
+ <key>CPRuleEditorPredicateOptions</key>
+ <integer>1</integer>
+ <key>criteria</key>
+ <array>
+ <dict>
+ <key>CPRuleEditorCustomControlClass</key>
+ <string>EditableTextField</string>
+ </dict>
+ </array>
+ <key>valeur</key>
+ <string>CPContainsPredicateOperatorType</string>
+ </dict>
+ <dict>
+ <key>CPRuleEditorPredicateComparisonModifier</key>
+ <integer>0</integer>
+ <key>CPRuleEditorPredicateOperatorType</key>
+ <integer>6</integer>
<key>CPRuleEditorPredicateOptions</key>
<integer>0</integer>
<key>criteria</key>
<array>
<dict>
<key>CPRuleEditorCustomControlClass</key>
- <string>CPTextField</string>
- <key>valeur</key>
- <string>mov</string>
+ <string>EditableTextField</string>
</dict>
</array>
<key>valeur</key>
- <string>CPEndsWithPredicateOperatorType</string>
+ <string>CPMatchesPredicateOperatorType</string>
</dict>
</array>
<key>valeur</key>
@@ -94,39 +107,35 @@
<key>CPRuleEditorPredicateComparisonModifier</key>
<integer>0</integer>
<key>CPRuleEditorPredicateOperatorType</key>
- <integer>9</integer>
+ <integer>8</integer>
<key>CPRuleEditorPredicateOptions</key>
<integer>0</integer>
<key>criteria</key>
<array>
<dict>
- <key>CPRuleEditorPredicateRightExpression</key>
- <string>e</string>
- <key>valeur</key>
- <string>e</string>
+ <key>CPRuleEditorCustomControlClass</key>
+ <string>EditableTextField</string>
</dict>
</array>
<key>valeur</key>
- <string>CPEndsWithPredicateOperatorType</string>
+ <string>CPBeginsWithPredicateOperatorType</string>
</dict>
<dict>
<key>CPRuleEditorPredicateComparisonModifier</key>
<integer>0</integer>
<key>CPRuleEditorPredicateOperatorType</key>
- <integer>8</integer>
+ <integer>9</integer>
<key>CPRuleEditorPredicateOptions</key>
<integer>0</integer>
<key>criteria</key>
<array>
<dict>
- <key>CPRuleEditorPredicateRightExpression</key>
- <string>O</string>
- <key>valeur</key>
- <string>O</string>
+ <key>CPRuleEditorCustomControlClass</key>
+ <string>EditableTextField</string>
</dict>
</array>
<key>valeur</key>
- <string>CPBeginsWithPredicateOperatorType</string>
+ <string>CPEndsWithPredicateOperatorType</string>
</dict>
</array>
<key>valeur</key>
@@ -160,16 +169,14 @@
<key>CPRuleEditorPredicateComparisonModifier</key>
<integer>0</integer>
<key>CPRuleEditorPredicateOperatorType</key>
- <integer>1</integer>
+ <integer>0</integer>
<key>CPRuleEditorPredicateOptions</key>
<integer>0</integer>
<key>criteria</key>
<array>
<dict>
- <key>CPRuleEditorPredicateRightExpression</key>
- <integer>45</integer>
- <key>valeur</key>
- <string>45 ans</string>
+ <key>CPRuleEditorCustomControlClass</key>
+ <string>Slider</string>
</dict>
</array>
<key>valeur</key>

Modified: branches/CPRuleEditor/format.strings
==============================================================================
--- branches/CPRuleEditor/format.strings (original)
+++ branches/CPRuleEditor/format.strings Thu Feb 5 14:04:14 2009
@@ -1,17 +1,17 @@
-"CPLessThanPredicateOperatorType" = "is less than";
-"CPLessThanOrEqualToPredicateOperatorType" = "is less than or equal to";
-"CPGreaterThanPredicateOperatorType" = "is greater than";
-"CPGreaterThanOrEqualToPredicateOperatorType" = "is greater than or equal
to";
-"CPEqualToPredicateOperatorType" = "is equal to";
-"CPNotEqualToPredicateOperatorType" = "is not equal";
-"CPMatchesPredicateOperatorType" = "matches";
-"CPLikePredicateOperatorType" = "is like";
-"CPBeginsWithPredicateOperatorType" = "begins with";
-"CPEndsWithPredicateOperatorType" = "ends with";
-"CPInPredicateOperatorType" = "is in";
-"CPCustomSelectorPredicateOperatorType" = "function";
-"CPContainsPredicateOperatorType" = "contains";
-"CPBetweenPredicateOperatorType" = "is between";
+"CPLessThanPredicateOperatorType" = "is less than"; //0
+"CPLessThanOrEqualToPredicateOperatorType" = "is less than or equal to";
//1
+"CPGreaterThanPredicateOperatorType" = "is greater than"; //2
+"CPGreaterThanOrEqualToPredicateOperatorType" = "is greater than or equal
to"; //3
+"CPEqualToPredicateOperatorType" = "is equal to"; //4
+"CPNotEqualToPredicateOperatorType" = "is not equal"; //5
+"CPMatchesPredicateOperatorType" = "matches"; //6
+"CPLikePredicateOperatorType" = "is like"; //7
+"CPBeginsWithPredicateOperatorType" = "begins with"; //8
+"CPEndsWithPredicateOperatorType" = "ends with"; //9
+"CPInPredicateOperatorType" = "is in"; //10
+"CPCustomSelectorPredicateOperatorType" = "function"; //11
+"CPContainsPredicateOperatorType" = "contains"; //12
+"CPBetweenPredicateOperatorType" = "is between"; //13
"firstName" = "First Name";
"lastName" = "Last Name";
"age" = "Age";
Reply all
Reply to author
Forward
0 new messages