mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 21:17:03 +00:00
Merge branch 'master' of github.com:280north/cappuccino
This commit is contained in:
+105
-13
@@ -46,10 +46,12 @@
|
||||
BOOL _selectsInsertedObjects;
|
||||
BOOL _alwaysUsesMultipleValuesMarker;
|
||||
|
||||
id _selectionIndexes;
|
||||
id _sortDescriptors;
|
||||
id _filterPredicate;
|
||||
id _arrangedObjects;
|
||||
BOOL _automaticallyRearrangesObjects; // FIXME: Not in use
|
||||
|
||||
CPIndexSet _selectionIndexes;
|
||||
CPArray _sortDescriptors;
|
||||
CPPredicate _filterPredicate;
|
||||
CPArray _arrangedObjects;
|
||||
}
|
||||
|
||||
+ (void)initialize
|
||||
@@ -116,13 +118,29 @@
|
||||
|
||||
if (self)
|
||||
{
|
||||
_sortDescriptors = [CPArray array];
|
||||
_selectionIndexes = [CPIndexSet indexSet];
|
||||
_preservesSelection = YES;
|
||||
_selectsInsertedObjects = YES;
|
||||
_avoidsEmptySelection = YES;
|
||||
_clearsFilterPredicateOnInsertion = YES;
|
||||
_alwaysUsesMultipleValuesMarker = NO;
|
||||
_automaticallyRearrangesObjects = NO;
|
||||
|
||||
_filterRestrictsInsertion = YES; // FIXME: Not in use
|
||||
|
||||
[self _init];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)_init
|
||||
{
|
||||
_sortDescriptors = [CPArray array];
|
||||
_filterPredicate = nil;
|
||||
_selectionIndexes = [CPIndexSet indexSet];
|
||||
_arrangedObjects = nil;
|
||||
}
|
||||
|
||||
- (void)prepareContent
|
||||
{
|
||||
[self _setContentArray:[[self newObject]]];
|
||||
@@ -156,7 +174,7 @@
|
||||
|
||||
/*!
|
||||
Sets whether the controller will automatically select objects as they are inserted.
|
||||
@return BOOL aFlag - YES if new objects are selected, otherwise NO.
|
||||
@return BOOL - YES if new objects are selected, otherwise NO.
|
||||
*/
|
||||
- (void)setSelectsInsertedObjects:(BOOL)value
|
||||
{
|
||||
@@ -164,7 +182,7 @@
|
||||
}
|
||||
|
||||
/*!
|
||||
@return BOOL aFlag - Returns YES if the controller should try to avoid an empty selection otherwise NO.
|
||||
@return BOOL - YES if the controller should try to avoid an empty selection otherwise NO.
|
||||
*/
|
||||
- (BOOL)avoidsEmptySelection
|
||||
{
|
||||
@@ -180,6 +198,76 @@
|
||||
_avoidsEmptySelection = value;
|
||||
}
|
||||
|
||||
/*!
|
||||
Whether the receiver will clear its filter predicate when a new object is inserted.
|
||||
|
||||
@return BOOL YES if the receiver clears filter predicates on insert
|
||||
*/
|
||||
- (BOOL)clearsFilterPredicateOnInsertion
|
||||
{
|
||||
return _clearsFilterPredicateOnInsertion;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets whether the receiver should clear its filter predicate when a new object is inserted.
|
||||
|
||||
@param BOOL YES if the receiver should clear filter predicates on insert
|
||||
*/
|
||||
- (void)setClearsFilterPredicateOnInsertion:(BOOL)aFlag
|
||||
{
|
||||
_clearsFilterPredicateOnInsertion = aFlag;
|
||||
}
|
||||
|
||||
/*!
|
||||
Whether the receiver will always return the multiple values marker when multiple
|
||||
items are selected, even if the items have the same value.
|
||||
|
||||
@return BOOL YES if the receiver always uses the multiple values marker
|
||||
*/
|
||||
- (BOOL)alwaysUsesMultipleValuesMarker
|
||||
{
|
||||
return _alwaysUsesMultipleValuesMarker;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets whether the receiver should always return the multiple values marker when multiple
|
||||
items are selected, even if the items have the same value.
|
||||
|
||||
@param BOOL aFlag YES if the receiver should always use the multiple values marker
|
||||
*/
|
||||
- (void)setAlwaysUsesMultipleValuesMarker:(BOOL)aFlag
|
||||
{
|
||||
_alwaysUsesMultipleValuesMarker = aFlag;
|
||||
}
|
||||
|
||||
/*!
|
||||
Whether the receiver will rearrange its contents automatically whenever the sort
|
||||
descriptors or filter predicates are changed.
|
||||
|
||||
NOTE: not yet implemented. Cappuccino always act as if this value was YES.
|
||||
|
||||
@return BOOL YES if the receiver will automatically rearrange its content on new sort
|
||||
descriptors or filter predicates
|
||||
*/
|
||||
- (BOOL)automaticallyRearrangesObjects
|
||||
{
|
||||
return _automaticallyRearrangesObjects;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets whether the receiver should rearrange its contents automatically whenever the sort
|
||||
descriptors or filter predicates are changed.
|
||||
|
||||
NOTE: not yet implemented. Cappuccino always act as if this value was YES.
|
||||
|
||||
@param BOOL YES if the receiver should automatically rearrange its content on new sort
|
||||
descriptors or filter predicates
|
||||
*/
|
||||
- (void)setAutomaticallyRearrangesObjects:(BOOL)aFlag
|
||||
{
|
||||
_automaticallyRearrangesObjects = aFlag;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the controller's content object.
|
||||
|
||||
@@ -220,7 +308,7 @@
|
||||
// We need to be in control of when notifications fire.
|
||||
_contentObject = value;
|
||||
|
||||
if (_clearsFilterPredicateOnInsertion)
|
||||
if (_clearsFilterPredicateOnInsertion && _filterPredicate != nil)
|
||||
[self __setFilterPredicate:nil]; // Causes a _rearrangeObjects.
|
||||
else
|
||||
[self _rearrangeObjects];
|
||||
@@ -280,7 +368,7 @@
|
||||
var filterPredicate = [self filterPredicate],
|
||||
sortDescriptors = [self sortDescriptors];
|
||||
|
||||
if (filterPredicate && sortDescriptors)
|
||||
if (filterPredicate && [sortDescriptors count] > 0)
|
||||
{
|
||||
var sortedObjects = [objects filteredArrayUsingPredicate:filterPredicate];
|
||||
[sortedObjects sortUsingDescriptors:sortDescriptors];
|
||||
@@ -288,7 +376,7 @@
|
||||
}
|
||||
else if (filterPredicate)
|
||||
return [objects filteredArrayUsingPredicate:filterPredicate];
|
||||
else if (sortDescriptors)
|
||||
else if ([sortDescriptors count] > 0)
|
||||
return [objects sortedArrayUsingDescriptors:sortDescriptors];
|
||||
|
||||
return [objects copy];
|
||||
@@ -338,7 +426,7 @@
|
||||
if (_arrangedObjects === value)
|
||||
return;
|
||||
|
||||
_arrangedObjects = [[_CPObservableArray alloc] initWithArray:value];
|
||||
_arrangedObjects = [[_CPObservableArray alloc] initWithArray:value];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -829,7 +917,8 @@ var CPArrayControllerAvoidsEmptySelection = @"CPArrayControllerAvoid
|
||||
CPArrayControllerFilterRestrictsInsertion = @"CPArrayControllerFilterRestrictsInsertion",
|
||||
CPArrayControllerPreservesSelection = @"CPArrayControllerPreservesSelection",
|
||||
CPArrayControllerSelectsInsertedObjects = @"CPArrayControllerSelectsInsertedObjects",
|
||||
CPArrayControllerAlwaysUsesMultipleValuesMarker = @"CPArrayControllerAlwaysUsesMultipleValuesMarker";
|
||||
CPArrayControllerAlwaysUsesMultipleValuesMarker = @"CPArrayControllerAlwaysUsesMultipleValuesMarker",
|
||||
CPArrayControllerAutomaticallyRearrangesObjects = @"CPArrayControllerAutomaticallyRearrangesObjects";
|
||||
|
||||
@implementation CPArrayController (CPCoding)
|
||||
|
||||
@@ -845,6 +934,8 @@ var CPArrayControllerAvoidsEmptySelection = @"CPArrayControllerAvoid
|
||||
_preservesSelection = [aCoder decodeBoolForKey:CPArrayControllerPreservesSelection];
|
||||
_selectsInsertedObjects = [aCoder decodeBoolForKey:CPArrayControllerSelectsInsertedObjects];
|
||||
_alwaysUsesMultipleValuesMarker = [aCoder decodeBoolForKey:CPArrayControllerAlwaysUsesMultipleValuesMarker];
|
||||
_automaticallyRearrangesObjects = [aCoder decodeBoolForKey:CPArrayControllerAutomaticallyRearrangesObjects];
|
||||
_sortDescriptors = [CPArray array];
|
||||
|
||||
if (![self content] && [self automaticallyPreparesContent])
|
||||
[self prepareContent];
|
||||
@@ -865,6 +956,7 @@ var CPArrayControllerAvoidsEmptySelection = @"CPArrayControllerAvoid
|
||||
[aCoder encodeBool:_preservesSelection forKey:CPArrayControllerPreservesSelection];
|
||||
[aCoder encodeBool:_selectsInsertedObjects forKey:CPArrayControllerSelectsInsertedObjects];
|
||||
[aCoder encodeBool:_alwaysUsesMultipleValuesMarker forKey:CPArrayControllerAlwaysUsesMultipleValuesMarker];
|
||||
[aCoder encodeBool:_automaticallyRearrangesObjects forKey:CPArrayControllerAutomaticallyRearrangesObjects];
|
||||
}
|
||||
|
||||
- (void)awakeFromCib
|
||||
|
||||
+31
-20
@@ -65,11 +65,6 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
BOOL _disableResizingPosting @accessors(property=disableResizingPosting);
|
||||
}
|
||||
|
||||
+ (Class)_binderClassForBinding:(CPString)theBinding
|
||||
{
|
||||
return [CPBinder class];
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
@@ -200,7 +195,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the minimum width of the column.
|
||||
Sets the minimum width of the column.
|
||||
Default value is 10.
|
||||
*/
|
||||
- (void)setMinWidth:(float)aMinWidth
|
||||
@@ -228,7 +223,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the maximum width of the table column.
|
||||
Sets the maximum width of the table column.
|
||||
Default value is: 1000000
|
||||
*/
|
||||
- (void)setMaxWidth:(float)aMaxWidth
|
||||
@@ -257,7 +252,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
|
||||
/*!
|
||||
<pre>
|
||||
Set the resizing mask of the column.
|
||||
Set the resizing mask of the column.
|
||||
By default the column can be resized automatically with the tableview and manaully by the user
|
||||
|
||||
Possible masking values are:
|
||||
@@ -281,7 +276,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sizes the column to fix the column header text.
|
||||
Sizes the column to fix the column header text.
|
||||
*/
|
||||
- (void)sizeToFit
|
||||
{
|
||||
@@ -322,7 +317,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
/*!
|
||||
Returns the headerview for the column.
|
||||
|
||||
In order to change the text of the headerview for a column you should call setStringValue: on the headerview.
|
||||
In order to change the text of the headerview for a column you should call setStringValue: on the headerview.
|
||||
For example: [[myTableColumn headerView] setStringValue:"My Column"];
|
||||
*/
|
||||
- (CPView)headerView
|
||||
@@ -479,7 +474,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the sort descriptor prototype for the column.
|
||||
Sets the sort descriptor prototype for the column.
|
||||
*/
|
||||
- (void)setSortDescriptorPrototype:(CPSortDescriptor)aSortDescriptor
|
||||
{
|
||||
@@ -552,15 +547,39 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPTableColumnValueBinder : CPBinder
|
||||
{
|
||||
}
|
||||
|
||||
- (void)setValueFor:(CPString)aBinding
|
||||
{
|
||||
var tableView = [_source tableView],
|
||||
column = [[tableView tableColumns] indexOfObjectIdenticalTo:_source],
|
||||
rowIndexes = [CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, [tableView numberOfRows])],
|
||||
columnIndexes = [CPIndexSet indexSetWithIndex:column];
|
||||
|
||||
[tableView reloadDataForRowIndexes:rowIndexes columnIndexes:columnIndexes];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPTableColumn (Bindings)
|
||||
|
||||
+ (id)_binderClassForBinding:(CPString)aBinding
|
||||
{
|
||||
if (aBinding == CPValueBinding)
|
||||
return [CPTableColumnValueBinder class];
|
||||
|
||||
return [super _binderClassForBinding:aBinding];
|
||||
}
|
||||
|
||||
/*!
|
||||
Binds the reciever to an object.
|
||||
|
||||
@param CPString aBinding - The binding you wish to make. Typically CPValueBinding.
|
||||
@param id anObject - The object to bind the reciever to.
|
||||
@param CPString aKeyPath - The key path you wish to bind the reciver to.
|
||||
@param CPDictionary options - A dictionary of options for the binding. This paramater is optional, pass nil if you do not wish to use it.
|
||||
@param CPDictionary options - A dictionary of options for the binding. This paramater is optional, pass nil if you do not wish to use it.
|
||||
*/
|
||||
- (void)bind:(CPString)aBinding toObject:(id)anObject withKeyPath:(CPString)aKeyPath options:(CPDictionary)options
|
||||
{
|
||||
@@ -624,14 +643,6 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
// return nil;
|
||||
//}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (void)setValue:(CPArray)content
|
||||
{
|
||||
[[self tableView] reloadData];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey",
|
||||
|
||||
@@ -509,7 +509,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
var contentRect = [self contentRectForBounds:[self bounds]],
|
||||
verticalAlign = [self currentValueForThemeAttribute:"vertical-alignment"];
|
||||
|
||||
switch(verticalAlign)
|
||||
switch (verticalAlign)
|
||||
{
|
||||
case CPTopVerticalTextAlignment:
|
||||
var topPoint = (_CGRectGetMinY(contentRect) + 1) + "px"; // for the same reason we have a -1 for the left, we also have a + 1 here
|
||||
@@ -528,7 +528,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
break;
|
||||
}
|
||||
|
||||
element.style.top = topPoint;
|
||||
element.style.top = topPoint;
|
||||
element.style.left = (_CGRectGetMinX(contentRect) - 1) + "px"; // why -1?
|
||||
element.style.width = _CGRectGetWidth(contentRect) + "px";
|
||||
element.style.height = font._lineHeight + "px"; // private ivar for the line height of the DOM text at this particaulr size
|
||||
@@ -719,11 +719,11 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
/*!
|
||||
Invoke the action specified by aSelector on the current responder.
|
||||
|
||||
This is implemented by CPResponder and by default it passes any unrecignized
|
||||
actions on to the next responder but text fields appearently aren't supposed
|
||||
|
||||
This is implemented by CPResponder and by default it passes any unrecignized
|
||||
actions on to the next responder but text fields appearently aren't supposed
|
||||
to do that according to this documentation by Apple:
|
||||
|
||||
|
||||
http://developer.apple.com/mac/library/documentation/cocoa/reference/NSTextInputClient_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/NSTextInputClient/doCommandBySelector:
|
||||
*/
|
||||
- (void)doCommandBySelector:(SEL)aSelector
|
||||
|
||||
@@ -12,15 +12,15 @@
|
||||
- (id)initForReadingWithData:(CPData)data bundle:(CPBundle)aBundle awakenCustomResources:(BOOL)shouldAwakenCustomResources
|
||||
{
|
||||
self = [super initForReadingWithData:data];
|
||||
|
||||
|
||||
if (self)
|
||||
{
|
||||
_bundle = aBundle;
|
||||
_awakenCustomResources = shouldAwakenCustomResources;
|
||||
|
||||
|
||||
[self setDelegate:self];
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,19 +5,19 @@
|
||||
@import "CPWindow.j"
|
||||
|
||||
|
||||
var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinSizeKey",
|
||||
_CPCibWindowTemplateMaxSizeKey = @"_CPCibWindowTemplateMaxSizeKey",
|
||||
|
||||
_CPCibWindowTemplateViewClassKey = @"_CPCibWindowTemplateViewClassKey",
|
||||
_CPCibWindowTemplateWindowClassKey = @"_CPCibWindowTemplateWindowClassKey",
|
||||
|
||||
_CPCibWindowTemplateWindowRectKey = @"_CPCibWindowTemplateWindowRectKey",
|
||||
_CPCibWindowTemplateWindowStyleMaskKey = @"_CPCibWindowTempatStyleMaskKey",
|
||||
_CPCibWindowTemplateWindowTitleKey = @"_CPCibWindowTemplateWindowTitleKey",
|
||||
_CPCibWindowTemplateWindowViewKey = @"_CPCibWindowTemplateWindowViewKey",
|
||||
var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinSizeKey",
|
||||
_CPCibWindowTemplateMaxSizeKey = @"_CPCibWindowTemplateMaxSizeKey",
|
||||
|
||||
_CPCibWindowTemplateWindowAutorecalculatesKeyViewLoop = @"_CPCibWindowTemplateWindowAutorecalculatesKeyViewLoop";
|
||||
_CPCibWindowTemplateWindowIsFullPlatformWindowKey = @"_CPCibWindowTemplateWindowIsFullPlatformWindowKey";
|
||||
_CPCibWindowTemplateViewClassKey = @"_CPCibWindowTemplateViewClassKey",
|
||||
_CPCibWindowTemplateWindowClassKey = @"_CPCibWindowTemplateWindowClassKey",
|
||||
|
||||
_CPCibWindowTemplateWindowRectKey = @"_CPCibWindowTemplateWindowRectKey",
|
||||
_CPCibWindowTemplateWindowStyleMaskKey = @"_CPCibWindowTempatStyleMaskKey",
|
||||
_CPCibWindowTemplateWindowTitleKey = @"_CPCibWindowTemplateWindowTitleKey",
|
||||
_CPCibWindowTemplateWindowViewKey = @"_CPCibWindowTemplateWindowViewKey",
|
||||
|
||||
_CPCibWindowTemplateWindowAutorecalculatesKeyViewLoop = @"_CPCibWindowTemplateWindowAutorecalculatesKeyViewLoop",
|
||||
_CPCibWindowTemplateWindowIsFullPlatformWindowKey = @"_CPCibWindowTemplateWindowIsFullPlatformWindowKey";
|
||||
|
||||
@implementation _CPCibWindowTemplate : CPObject
|
||||
{
|
||||
@@ -60,27 +60,27 @@ var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinS
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
|
||||
if (self)
|
||||
{
|
||||
if ([aCoder containsValueForKey:_CPCibWindowTemplateMinSizeKey])
|
||||
_minSize = [aCoder decodeSizeForKey:_CPCibWindowTemplateMinSizeKey];
|
||||
if ([aCoder containsValueForKey:_CPCibWindowTemplateMaxSizeKey])
|
||||
_maxSize = [aCoder decodeSizeForKey:_CPCibWindowTemplateMaxSizeKey];
|
||||
|
||||
|
||||
_viewClass = [aCoder decodeObjectForKey:_CPCibWindowTemplateViewClassKey];
|
||||
|
||||
|
||||
_windowClass = [aCoder decodeObjectForKey:_CPCibWindowTemplateWindowClassKey];
|
||||
_windowRect = [aCoder decodeRectForKey:_CPCibWindowTemplateWindowRectKey];
|
||||
_windowStyleMask = [aCoder decodeIntForKey:_CPCibWindowTemplateWindowStyleMaskKey];
|
||||
|
||||
|
||||
_windowTitle = [aCoder decodeObjectForKey:_CPCibWindowTemplateWindowTitleKey];
|
||||
_windowView = [aCoder decodeObjectForKey:_CPCibWindowTemplateWindowViewKey];
|
||||
|
||||
_windowAutorecalculatesKeyViewLoop = !![aCoder decodeObjectForKey:_CPCibWindowTemplateWindowAutorecalculatesKeyViewLoop];
|
||||
_windowIsFullPlatformWindow = !![aCoder decodeObjectForKey:_CPCibWindowTemplateWindowIsFullPlatformWindowKey];
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -90,13 +90,13 @@ var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinS
|
||||
[aCoder encodeSize:_minSize forKey:_CPCibWindowTemplateMinSizeKey];
|
||||
if (_maxSize)
|
||||
[aCoder encodeSize:_maxSize forKey:_CPCibWindowTemplateMaxSizeKey];
|
||||
|
||||
|
||||
[aCoder encodeObject:_viewClass forKey:_CPCibWindowTemplateViewClassKey];
|
||||
|
||||
|
||||
[aCoder encodeObject:_windowClass forKey:_CPCibWindowTemplateWindowClassKey];
|
||||
[aCoder encodeRect:_windowRect forKey:_CPCibWindowTemplateWindowRectKey];
|
||||
[aCoder encodeInt:_windowStyleMask forKey:_CPCibWindowTemplateWindowStyleMaskKey];
|
||||
|
||||
|
||||
[aCoder encodeObject:_windowTitle forKey:_CPCibWindowTemplateWindowTitleKey];
|
||||
[aCoder encodeObject:_windowView forKey:_CPCibWindowTemplateWindowViewKey];
|
||||
|
||||
@@ -126,13 +126,13 @@ var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinS
|
||||
- (id)_cibInstantiate
|
||||
{
|
||||
var windowClass = CPClassFromString([self windowClass]);
|
||||
|
||||
|
||||
/* if (!windowClass)
|
||||
[NSException raise:NSInvalidArgumentException format:@"Unable to locate NSWindow class %@, using NSWindow",_windowClass];
|
||||
class=[NSWindow class];*/
|
||||
|
||||
|
||||
var theWindow = [[windowClass alloc] initWithContentRect:_windowRect styleMask:_windowStyleMask];
|
||||
|
||||
|
||||
if (_minSize)
|
||||
[theWindow setMinSize:_minSize];
|
||||
if (_maxSize)
|
||||
@@ -147,7 +147,7 @@ var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinS
|
||||
[theWindow setContentView:_windowView];
|
||||
|
||||
[_windowView setAutoresizesSubviews:YES];
|
||||
|
||||
|
||||
if ([_viewClass isKindOfClass:[CPToolbar class]])
|
||||
{
|
||||
[theWindow setToolbar:_viewClass];
|
||||
|
||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 227 B |
Binary file not shown.
|
Before Width: | Height: | Size: 307 B |
Binary file not shown.
|
Before Width: | Height: | Size: 4.0 KiB |
@@ -1,5 +1,6 @@
|
||||
|
||||
@import <AppKit/CPArrayController.j>
|
||||
@import <AppKit/CPTextField.j>
|
||||
|
||||
@implementation CPArrayControllerTest : OJTestCase
|
||||
{
|
||||
@@ -190,8 +191,7 @@
|
||||
|
||||
[arrayController setContent:newContent];
|
||||
|
||||
[self assert:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, 2)] equals:[arrayController selectionIndexes]
|
||||
message:@"last object cannot be selected"];
|
||||
[self assert:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, 2)] equals:[arrayController selectionIndexes] message:@"last object cannot be selected"];
|
||||
}
|
||||
|
||||
- (void)testContentBinding
|
||||
@@ -354,6 +354,16 @@
|
||||
[self assert:@"Building 1" equals:[[self arrayController] valueForKeyPath:@"selection.department.building"]];
|
||||
}
|
||||
|
||||
- (void)testArrangedObjectsNotEmptyAfterSetContentWhenClearsFilterOnInsertionIsTrue
|
||||
{
|
||||
var arrayController = [[CPArrayController alloc] init];
|
||||
[arrayController setFilterPredicate:nil];
|
||||
[arrayController setClearsFilterPredicateOnInsertion:YES];
|
||||
[arrayController setContent:[CPArray arrayWithObject:@"a"]];
|
||||
|
||||
[self assertTrue:[[arrayController arrangedObjects] count] > 0];
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:keyPath
|
||||
ofObject:anActivity
|
||||
change:change
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* TableBindings
|
||||
*
|
||||
* Created by You on January 16, 2011.
|
||||
* Copyright 2011, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/CPObject.j>
|
||||
|
||||
|
||||
@implementation AppController : CPObject
|
||||
{
|
||||
CPWindow theWindow; //this "outlet" is connected automatically by the Cib
|
||||
CPArrayController arrayController;
|
||||
CPTextField from;
|
||||
CPTextField to;
|
||||
|
||||
CPArray rows @accessors;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
||||
{
|
||||
// This is called when the application is done loading.
|
||||
}
|
||||
|
||||
- (void)awakeFromCib
|
||||
{
|
||||
rows = [CPArray new];
|
||||
|
||||
var path = [[CPBundle mainBundle] pathForResource:@"rows.plist"],
|
||||
request = [CPURLRequest requestWithURL:path],
|
||||
connection = [CPURLConnection connectionWithRequest:request delegate:self];
|
||||
|
||||
[theWindow setFullBridge:YES];
|
||||
}
|
||||
|
||||
- (void)connection:(CPURLConnection)connection didReceiveData:(CPString)dataString
|
||||
{
|
||||
if (!dataString)
|
||||
return;
|
||||
|
||||
var data = [[CPData alloc] initWithRawString:dataString],
|
||||
theRows = [CPPropertyListSerialization propertyListFromData:data format:CPPropertyListXMLFormat_v1_0];
|
||||
|
||||
[self setRows:theRows];
|
||||
}
|
||||
|
||||
- (void)test:(id)sender
|
||||
{
|
||||
var range = CPMakeRange([from intValue], [to intValue]);
|
||||
var indexes = [CPIndexSet indexSetWithIndexesInRange:range];
|
||||
|
||||
[[rows objectsAtIndexes:indexes] setValue:@"b" forKey:@"colTwo"];
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Main cib file base name</key>
|
||||
<string>MainMenu.cib</string>
|
||||
<key>CPBundleName</key>
|
||||
<string>TableBindings</string>
|
||||
<key>CPPrincipalClass</key>
|
||||
<string>CPApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Jakefile
|
||||
* TableBindings
|
||||
*
|
||||
* Created by You on January 16, 2011.
|
||||
* Copyright 2011, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
var ENV = require("system").env,
|
||||
FILE = require("file"),
|
||||
JAKE = require("jake"),
|
||||
task = JAKE.task,
|
||||
FileList = JAKE.FileList,
|
||||
app = require("cappuccino/jake").app,
|
||||
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
|
||||
OS = require("os");
|
||||
|
||||
app ("TableBindings", function(task)
|
||||
{
|
||||
task.setBuildIntermediatesPath(FILE.join("Build", "TableBindings.build", configuration));
|
||||
task.setBuildPath(FILE.join("Build", configuration));
|
||||
|
||||
task.setProductName("TableBindings");
|
||||
task.setIdentifier("com.yourcompany.TableBindings");
|
||||
task.setVersion("1.0");
|
||||
task.setAuthor("Your Company");
|
||||
task.setEmail("feedback @nospam@ yourcompany.com");
|
||||
task.setSummary("TableBindings");
|
||||
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
|
||||
task.setResources(new FileList("Resources/**"));
|
||||
task.setIndexFilePath("index.html");
|
||||
task.setInfoPlistPath("Info.plist");
|
||||
task.setNib2CibFlags("-R Resources/");
|
||||
|
||||
if (configuration === "Debug")
|
||||
task.setCompilerFlags("-DDEBUG -g");
|
||||
else
|
||||
task.setCompilerFlags("-O");
|
||||
});
|
||||
|
||||
task ("default", ["TableBindings"], function()
|
||||
{
|
||||
printResults(configuration);
|
||||
});
|
||||
|
||||
task ("build", ["default"]);
|
||||
|
||||
task ("debug", function()
|
||||
{
|
||||
ENV["CONFIGURATION"] = "Debug";
|
||||
JAKE.subjake(["."], "build", ENV);
|
||||
});
|
||||
|
||||
task ("release", function()
|
||||
{
|
||||
ENV["CONFIGURATION"] = "Release";
|
||||
JAKE.subjake(["."], "build", ENV);
|
||||
});
|
||||
|
||||
task ("run", ["debug"], function()
|
||||
{
|
||||
OS.system(["open", FILE.join("Build", "Debug", "TableBindings", "index.html")]);
|
||||
});
|
||||
|
||||
task ("run-release", ["release"], function()
|
||||
{
|
||||
OS.system(["open", FILE.join("Build", "Release", "TableBindings", "index.html")]);
|
||||
});
|
||||
|
||||
task ("deploy", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Deployment", "TableBindings"));
|
||||
OS.system(["press", "-f", FILE.join("Build", "Release", "TableBindings"), FILE.join("Build", "Deployment", "TableBindings")]);
|
||||
printResults("Deployment")
|
||||
});
|
||||
|
||||
task ("desktop", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Desktop", "TableBindings"));
|
||||
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "TableBindings"), FILE.join("Build", "Desktop", "TableBindings", "TableBindings.app"));
|
||||
printResults("Desktop")
|
||||
});
|
||||
|
||||
task ("run-desktop", ["desktop"], function()
|
||||
{
|
||||
OS.system([FILE.join("Build", "Desktop", "TableBindings", "TableBindings.app", "Contents", "MacOS", "NativeHost"), "-i"]);
|
||||
});
|
||||
|
||||
function printResults(configuration)
|
||||
{
|
||||
print("----------------------------");
|
||||
print(configuration+" app built at path: "+FILE.join("Build", configuration, "TableBindings"));
|
||||
print("----------------------------");
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,103 @@
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<!--
|
||||
index-debug.html
|
||||
TableBindings
|
||||
|
||||
Created by You on January 16, 2011.
|
||||
Copyright 2011, Your Company All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||
|
||||
<title>TableBindings</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
objj_msgSend_reset();
|
||||
|
||||
// DEBUG OPTIONS:
|
||||
|
||||
// Uncomment to enable printing of backtraces on exceptions:
|
||||
//objj_msgSend_decorate(objj_backtrace_decorator);
|
||||
|
||||
// Uncomment to supress exceptions that take place inside a message
|
||||
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
|
||||
|
||||
// Uncomment to enable runtime type checking:
|
||||
//objj_msgSend_decorate(objj_typecheck_decorator);
|
||||
|
||||
// Uncomment (along with both above) to print backtraces on type check errors:
|
||||
//objj_typecheck_prints_backtrace = true;
|
||||
|
||||
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
|
||||
//CPLogUnregister(CPLogDefault);
|
||||
|
||||
// Uncomment to enable a specific logger:
|
||||
//CPLogRegister(CPLogConsole);
|
||||
//CPLogRegister(CPLogPopup);
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
body{margin:0; padding:0;}
|
||||
#container {position: absolute; top:50%; left:50%;}
|
||||
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
|
||||
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
|
||||
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
|
||||
</style>
|
||||
|
||||
<!--[if lt IE 7]>
|
||||
<STYLE type="text/css">
|
||||
#container { position: relative; top: 50%; }
|
||||
#content { position: relative;}
|
||||
</STYLE>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
|
||||
<body style="">
|
||||
<div id="cappuccino-body">
|
||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||
<script type="text/javascript">
|
||||
document.write("<div id='container'><p id='content'>" +
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading TableBindings...</p></div>");
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<div id="container">
|
||||
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
|
||||
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
|
||||
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
|
||||
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
|
||||
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
|
||||
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
|
||||
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
|
||||
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
|
||||
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
|
||||
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,77 @@
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<!--
|
||||
index.html
|
||||
TableBindings
|
||||
|
||||
Created by You on January 16, 2011.
|
||||
Copyright 2011, Your Company All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||
|
||||
<title>TableBindings</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
|
||||
<style type="text/css">
|
||||
body{margin:0; padding:0;}
|
||||
#container {position: absolute; top:50%; left:50%;}
|
||||
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
|
||||
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
|
||||
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
|
||||
</style>
|
||||
|
||||
<!--[if lt IE 7]>
|
||||
<STYLE type="text/css">
|
||||
#container { position: relative; top: 50%; }
|
||||
#content { position: relative;}
|
||||
</STYLE>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
|
||||
<body style="">
|
||||
<div id="cappuccino-body">
|
||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||
<script type="text/javascript">
|
||||
document.write("<div id='container'><p id='content'>" +
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading TableBindings...</p></div>");
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<div id="container">
|
||||
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
|
||||
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
|
||||
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
|
||||
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
|
||||
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
|
||||
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
|
||||
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
|
||||
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
|
||||
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
|
||||
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* TableBindings
|
||||
*
|
||||
* Created by You on January 16, 2011.
|
||||
* Copyright 2011, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/Foundation.j>
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
@import "AppController.j"
|
||||
|
||||
|
||||
function main(args, namedArgs)
|
||||
{
|
||||
CPApplicationMain(args, namedArgs);
|
||||
}
|
||||
@@ -37,6 +37,7 @@
|
||||
_preservesSelection = [aCoder decodeBoolForKey:@"NSPreservesSelection"];
|
||||
_selectsInsertedObjects = [aCoder decodeBoolForKey:@"NSSelectsInsertedObjects"];
|
||||
_alwaysUsesMultipleValuesMarker = [aCoder decodeBoolForKey:@"NSAlwaysUsesMultipleValuesMarker"];
|
||||
_automaticallyRearrangesObjects = [aCoder decodeBoolForKey:@"NSAutomaticallyRearrangesObjects"];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
+18
-11
@@ -79,6 +79,24 @@ function check_and_exit () {
|
||||
}
|
||||
|
||||
function check_build_environment () {
|
||||
# make sure dependencies are installed and on the $PATH
|
||||
CAPP_BUILD_DEPS=(java gcc unzip)
|
||||
|
||||
for dep in ${CAPP_BUILD_DEPS[@]}; do
|
||||
which "$dep" &> /dev/null
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo "Error: $dep is required to bootstrap Cappuccino. Please install $dep and re-run bootstrap.sh."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# special case: check for curl or wget
|
||||
which curl &> /dev/null || which wget &> /dev/null
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo "Error: curl or wget are required to bootstrap Cappuccino. Please install one of them and re-run bootstrap.sh."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# make sure user is running the Sun JVM or OpenJDK >= 6b18
|
||||
java_version=$(java -version 2>&1)
|
||||
echo $java_version | grep OpenJDK > /dev/null
|
||||
@@ -90,17 +108,6 @@ function check_build_environment () {
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# make sure other dependencies are installed and on the $PATH
|
||||
OTHER_DEPS=(gcc unzip)
|
||||
|
||||
for dep in ${OTHER_DEPS[@]}; do
|
||||
which "$dep" &> /dev/null
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo "Error: $dep is required to build Cappuccino. Please install $dep and re-run bootstrap.sh."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
check_build_environment
|
||||
|
||||
Reference in New Issue
Block a user