mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 21:17:03 +00:00
Merge pull request #1573 from mrcarlberg/binding_support_popup_button
Added key value binding support for CPPopupButton
This commit is contained in:
+35
-15
@@ -190,7 +190,7 @@ var CPBindingOperationAnd = 0,
|
||||
var destination = [_info objectForKey:CPObservedObjectKey],
|
||||
keyPath = [_info objectForKey:CPObservedKeyPathKey],
|
||||
options = [_info objectForKey:CPOptionsKey],
|
||||
newValue = [_source valueForKeyPath:aBinding];
|
||||
newValue = [self valueForBinding:aBinding];
|
||||
|
||||
newValue = [self reverseTransformValue:newValue withOptions:options];
|
||||
|
||||
@@ -199,6 +199,11 @@ var CPBindingOperationAnd = 0,
|
||||
[self unsuppressSpecificNotificationFromObject:destination keyPath:keyPath];
|
||||
}
|
||||
|
||||
- (id)valueForBinding:(CPString)aBinding
|
||||
{
|
||||
return [_source valueForKeyPath:aBinding];
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:(CPString)aKeyPath ofObject:(id)anObject change:(CPDictionary)changes context:(id)context
|
||||
{
|
||||
if (!changes)
|
||||
@@ -546,20 +551,35 @@ CPNotApplicableMarker = @"CPNotApplicableMarker";
|
||||
CPNullMarker = @"CPNullMarker";
|
||||
|
||||
// Binding name constants
|
||||
CPAlignmentBinding = @"alignment";
|
||||
CPEditableBinding = @"editable";
|
||||
CPEnabledBinding = @"enabled";
|
||||
CPFontBinding = @"font";
|
||||
CPHiddenBinding = @"hidden";
|
||||
CPSelectedIndexBinding = @"selectedIndex";
|
||||
CPTextColorBinding = @"textColor";
|
||||
CPToolTipBinding = @"toolTip";
|
||||
CPValueBinding = @"value";
|
||||
CPValueURLBinding = @"valueURL";
|
||||
CPValuePathBinding = @"valuePath";
|
||||
CPDataBinding = @"data";
|
||||
CPContentBinding = @"content";
|
||||
CPContentValuesBinding = @"contentValues";
|
||||
CPAlignmentBinding = @"alignment";
|
||||
CPContentArrayBinding = @"contentArray";
|
||||
CPContentBinding = @"content";
|
||||
CPContentObjectBinding = @"contentObject";
|
||||
CPContentObjectsBinding = @"contentObjects";
|
||||
CPContentValuesBinding = @"contentValues";
|
||||
CPEditableBinding = @"editable";
|
||||
CPEnabledBinding = @"enabled";
|
||||
CPFontBinding = @"font";
|
||||
CPFontNameBinding = @"fontName";
|
||||
CPFontBoldBinding = @"fontBold";
|
||||
CPHiddenBinding = @"hidden";
|
||||
CPFilterPredicateBinding = @"filterPredicate";
|
||||
CPPredicateBinding = @"predicate";
|
||||
CPSelectedIndexBinding = @"selectedIndex";
|
||||
CPSelectedLabelBinding = @"selectedLabel";
|
||||
CPSelectedObjectBinding = @"selectedObject";
|
||||
CPSelectedObjectsBinding = @"selectedObjects";
|
||||
CPSelectedTagBinding = @"selectedTag";
|
||||
CPSelectedValueBinding = @"selectedValue";
|
||||
CPSelectedValuesBinding = @"selectedValues";
|
||||
CPSelectionIndexesBinding = @"selectionIndexes";
|
||||
CPTextColorBinding = @"textColor";
|
||||
CPTitleBinding = @"title";
|
||||
CPToolTipBinding = @"toolTip";
|
||||
CPValueBinding = @"value";
|
||||
CPValueURLBinding = @"valueURL";
|
||||
CPValuePathBinding = @"valuePath";
|
||||
CPDataBinding = @"data";
|
||||
|
||||
//Binding options constants
|
||||
CPAllowsEditingMultipleValuesSelectionBindingOption = @"CPAllowsEditingMultipleValuesSelection";
|
||||
|
||||
+275
-21
@@ -23,10 +23,10 @@
|
||||
@import <Foundation/CPGeometry.j>
|
||||
|
||||
@import "CPButton.j"
|
||||
@import "CPKeyValueBinding.j"
|
||||
@import "CPMenu.j"
|
||||
@import "CPMenuItem.j"
|
||||
|
||||
|
||||
var VISIBLE_MARGIN = 7.0;
|
||||
|
||||
CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
@@ -247,22 +247,6 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
return _selectedIndex;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (int)_selectedTag
|
||||
{
|
||||
return [[self selectedItem] tag];
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (void)_setSelectedTag:(int)aTag
|
||||
{
|
||||
[self selectItemWithTag:aTag];
|
||||
}
|
||||
|
||||
// Setting the Current Selection
|
||||
/*!
|
||||
Selects the specified menu item.
|
||||
@@ -787,16 +771,286 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
|
||||
- (void)_reverseSetBinding
|
||||
{
|
||||
var binderClass = [[self class] _binderClassForBinding:CPSelectedIndexBinding],
|
||||
theBinding = [binderClass getBinding:CPSelectedIndexBinding forObject:self];
|
||||
|
||||
[theBinding reverseSetValueFor:@"objectValue"];
|
||||
[_CPPopUpButtonSelectionBinder reverseSetValueForObject:self];
|
||||
|
||||
[super _reverseSetBinding];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPPopUpButton (BindingSupport)
|
||||
|
||||
+ (Class)_binderClassForBinding:(CPString)aBinding
|
||||
{
|
||||
if (aBinding == CPSelectedIndexBinding ||
|
||||
aBinding == CPSelectedObjectBinding ||
|
||||
aBinding == CPSelectedTagBinding ||
|
||||
aBinding == CPSelectedValueBinding ||
|
||||
aBinding == CPContentBinding ||
|
||||
aBinding == CPContentObjectsBinding ||
|
||||
aBinding == CPContentValuesBinding)
|
||||
{
|
||||
var capitalizedBinding = aBinding.charAt(0).toUpperCase() + aBinding.substr(1);
|
||||
|
||||
return [CPClassFromString(@"_CPPopUpButton" + capitalizedBinding + "Binder") class];
|
||||
}
|
||||
|
||||
return [super _binderClassForBinding:aBinding];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation _CPPopUpButtonContentBinder : CPBinder
|
||||
{
|
||||
}
|
||||
|
||||
- (CPInteger)_getInsertNullOffset
|
||||
{
|
||||
var options = [_info objectForKey:CPOptionsKey];
|
||||
|
||||
return [options objectForKey:CPInsertsNullPlaceholderBindingOption] ? 1 : 0;
|
||||
}
|
||||
|
||||
- (CPString)_getNullPlaceholder
|
||||
{
|
||||
var options = [_info objectForKey:CPOptionsKey],
|
||||
placeholder = [options objectForKey:CPNullPlaceholderBindingOption] || @"";
|
||||
|
||||
if (placeholder === [CPNull null])
|
||||
placeholder = @"";
|
||||
|
||||
return placeholder;
|
||||
}
|
||||
|
||||
- (id)transformValue:(CPArray)contentArray withOptions:(CPDictionary)options
|
||||
{
|
||||
// Desactivate the full array transformation forced by super because we don't want this. We want individual transformations (see below).
|
||||
return contentArray;
|
||||
}
|
||||
|
||||
- (void)setValue:(CPArray)contentArray forBinding:(CPString)aBinding
|
||||
{
|
||||
[self _setContent:contentArray];
|
||||
[self _setContentValuesIfNeeded:contentArray];
|
||||
}
|
||||
|
||||
- (void)valueForBinding:(CPString)aBinding
|
||||
{
|
||||
return [self _content];
|
||||
}
|
||||
|
||||
- (void)_setContent:(CPArray)aValue
|
||||
{
|
||||
var count = [aValue count],
|
||||
options = [_info objectForKey:CPOptionsKey],
|
||||
offset = [self _getInsertNullOffset];
|
||||
|
||||
if (count + offset != [_source numberOfItems])
|
||||
{
|
||||
[_source removeAllItems];
|
||||
|
||||
if (offset)
|
||||
[_source addItemWithTitle:[self _getNullPlaceholder]];
|
||||
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var item = [[CPMenuItem alloc] initWithTitle:@"" action:NULL keyEquivalent:nil];
|
||||
[self _setValue:[aValue objectAtIndex:i] forItem:item withOptions:options];
|
||||
[_source addItem:item];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
[self _setValue:[aValue objectAtIndex:i] forItem:[_source itemAtIndex:i + offset] withOptions:options];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_setContentValuesIfNeeded:(CPArray)values
|
||||
{
|
||||
var offset = [self _getInsertNullOffset];
|
||||
|
||||
if (![_source infoForBinding:CPContentValuesBinding])
|
||||
{
|
||||
if (offset)
|
||||
[[_source itemAtIndex:0] setTitle:[self _getNullPlaceholder]];
|
||||
|
||||
var count = [values count];
|
||||
|
||||
for (var i = 0; i < count; i++)
|
||||
[[_source itemAtIndex:i + offset] setTitle:[[values objectAtIndex:i] description]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_setValue:(id)aValue forItem:(CPMenuItem)aMenuItem withOptions:(CPDictionary)options
|
||||
{
|
||||
var value = [self _transformValue:aValue withOptions:options];
|
||||
[aMenuItem setRepresentedObject:value];
|
||||
}
|
||||
|
||||
- (id)_transformValue:(id)aValue withOptions:(CPDictionary)options
|
||||
{
|
||||
return [super transformValue:aValue withOptions:options];
|
||||
}
|
||||
|
||||
- (CPArray)_content
|
||||
{
|
||||
return [_source valueForKeyPath:@"itemArray.representedObject"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation _CPPopUpButtonContentValuesBinder : _CPPopUpButtonContentBinder
|
||||
{
|
||||
}
|
||||
|
||||
- (void)setValue:(id)aValue forBinding:(CPString)aBinding
|
||||
{
|
||||
[super _setContent:aValue];
|
||||
}
|
||||
|
||||
- (void)_setValue:(id)aValue forItem:(CPMenuItem)aMenuItem withOptions:(CPDictionary)options
|
||||
{
|
||||
if (aValue === [CPNull null])
|
||||
aValue = nil;
|
||||
|
||||
var value = [self _transformValue:aValue withOptions:options];
|
||||
[aMenuItem setTitle:value];
|
||||
}
|
||||
|
||||
- (CPArray)_content
|
||||
{
|
||||
return [_source valueForKeyPath:@"itemArray.title"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var binderForObject = {};
|
||||
|
||||
@implementation _CPPopUpButtonSelectionBinder : CPBinder
|
||||
{
|
||||
CPString _selectionBinding @accessors;
|
||||
}
|
||||
|
||||
- (id)initWithBinding:(CPString)aBinding name:(CPString)aName to:(id)aDestination keyPath:(CPString)aKeyPath options:(CPDictionary)options from:(id)aSource
|
||||
{
|
||||
self = [super initWithBinding:aBinding name:aName to:aDestination keyPath:aKeyPath options:options from:aSource];
|
||||
|
||||
if (self)
|
||||
{
|
||||
binderForObject[[aSource UID]] = self;
|
||||
_selectionBinding = aName;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (void)reverseSetValueForObject:(id)aSource
|
||||
{
|
||||
var binder = binderForObject[[aSource UID]];
|
||||
[binder reverseSetValueFor:[binder _selectionBinding]];
|
||||
}
|
||||
|
||||
- (void)setPlaceholderValue:(id)aValue withMarker:(CPString)aMarker forBinding:(CPString)aBinding
|
||||
{
|
||||
[self setValue:aValue forBinding:aBinding];
|
||||
}
|
||||
|
||||
- (CPInteger)_getInsertNullOffset
|
||||
{
|
||||
var options = [[CPBinder infoForBinding:CPContentBinding forObject:_source] objectForKey:CPOptionsKey];
|
||||
|
||||
return [options objectForKey:CPInsertsNullPlaceholderBindingOption] ? 1 : 0;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation _CPPopUpButtonSelectedIndexBinder : _CPPopUpButtonSelectionBinder
|
||||
{
|
||||
}
|
||||
|
||||
- (void)setValue:(id)aValue forBinding:(CPString)aBinding
|
||||
{
|
||||
[_source selectItemAtIndex:aValue + [self _getInsertNullOffset]];
|
||||
}
|
||||
|
||||
- (id)valueForBinding:(CPString)aBinding
|
||||
{
|
||||
return [_source indexOfSelectedItem] - [self _getInsertNullOffset];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation _CPPopUpButtonSelectedObjectBinder : _CPPopUpButtonSelectionBinder
|
||||
{
|
||||
}
|
||||
|
||||
- (void)setValue:(id)aValue forBinding:(CPString)aBinding
|
||||
{
|
||||
var index = [_source indexOfItemWithRepresentedObject:aValue],
|
||||
offset = [self _getInsertNullOffset];
|
||||
|
||||
// If the content binding has the option CPNullPlaceholderBindingOption and the object to select is nil, select the first item (i.e., the placeholder).
|
||||
// Other cases to consider:
|
||||
// 1. no binding:
|
||||
// 1.1 there's no item with a represented object matching the object to select.
|
||||
// 1.2 the object to select is nil/CPNull
|
||||
// 2. there's a binding:
|
||||
// 2.1 there's a CPNullPlaceholderBindingOption:
|
||||
// 2.1.1 there's no item with a represented object matching the object to select?
|
||||
// 2.1.2 the object to select is nil/CPNull
|
||||
// 2.2 there's no CPNullPlaceholderBindingOption:
|
||||
// 2.2.1 there's no item with a represented object matching the object to select?
|
||||
// 2.2.2 the object to select is nil/CPNull
|
||||
// More cases? Behaviour that depends on array controller settings?
|
||||
|
||||
if (offset === 1 && index === CPNotFound)
|
||||
index = 0;
|
||||
|
||||
[_source selectItemAtIndex:index];
|
||||
}
|
||||
|
||||
- (id)valueForBinding:(CPString)aBinding
|
||||
{
|
||||
return [[_source selectedItem] representedObject];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation _CPPopUpButtonSelectedTagBinder : _CPPopUpButtonSelectionBinder
|
||||
{
|
||||
}
|
||||
|
||||
- (void)setValue:(id)aValue forBinding:(CPString)aBinding
|
||||
{
|
||||
[_source selectItemWithTag:aValue];
|
||||
}
|
||||
|
||||
- (id)valueForBinding:(CPString)aBinding
|
||||
{
|
||||
return [[_source selectedItem] tag];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation _CPPopUpButtonSelectedValueBinder : _CPPopUpButtonSelectionBinder
|
||||
{
|
||||
}
|
||||
|
||||
- (void)setValue:(id)aValue forBinding:(CPString)aBinding
|
||||
{
|
||||
[_source selectItemWithTitle:aValue];
|
||||
}
|
||||
|
||||
- (id)valueForBinding:(CPString)aBinding
|
||||
{
|
||||
return [_source titleOfSelectedItem];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var DEPRECATED_CPPopUpButtonMenuKey = @"CPPopUpButtonMenuKey",
|
||||
DEPRECATED_CPPopUpButtonSelectedIndexKey = @"CPPopUpButtonSelectedIndexKey";
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
|
||||
@import <AppKit/CPKeyValueBinding.j>
|
||||
@import <AppKit/CPPopUpButton.j>
|
||||
@import <AppKit/CPApplication.j>
|
||||
|
||||
@implementation CPPopUpButtonTest : OJTestCase
|
||||
{
|
||||
CPPopUpButton button @accessors;
|
||||
id objects @accessors;
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
@@ -205,6 +207,251 @@
|
||||
[self assert:2 equals:[[self button] indexOfItemWithTitle:@"three"]];
|
||||
}
|
||||
|
||||
- (void)testSimpleStringBindingArrayController
|
||||
{
|
||||
var arrayController = [[CPArrayController alloc] init],
|
||||
objectController = [[CPObjectController alloc] init],
|
||||
testObject = [CPMutableDictionary dictionary],
|
||||
martin = @"Martin",
|
||||
malte = @"Malte",
|
||||
johan = @"Johan",
|
||||
menuObjects = [martin, malte, johan];
|
||||
|
||||
[testObject setObject:@"I'm a testObject" forKey:@"Who am I"];
|
||||
[arrayController setContent:menuObjects];
|
||||
[objectController setContent:testObject];
|
||||
|
||||
[button bind:CPContentBinding toObject:arrayController withKeyPath:@"arrangedObjects" options:nil];
|
||||
[button bind:CPSelectedObjectBinding toObject:objectController withKeyPath:@"selection.xxx" options:nil];
|
||||
|
||||
[[self button] selectItemWithTitle:@"Martin"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self]; // This has to be done to trigger the reverse set of the binding
|
||||
[self assert:martin equals:[testObject objectForKey:@"xxx"]];
|
||||
[[self button] selectItemWithTitle:@"Malte"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self];
|
||||
[self assert:malte equals:[testObject objectForKey:@"xxx"]];
|
||||
[[self button] selectItemWithTitle:@"Johan"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self];
|
||||
[self assert:johan equals:[testObject objectForKey:@"xxx"]];
|
||||
|
||||
[testObject setObject:martin forKey:@"xxx"];
|
||||
[self assert:0 equals:[[self button] indexOfSelectedItem]];
|
||||
[testObject setObject:malte forKey:@"xxx"];
|
||||
[self assert:1 equals:[[self button] indexOfSelectedItem]];
|
||||
[testObject setObject:johan forKey:@"xxx"];
|
||||
[self assert:2 equals:[[self button] indexOfSelectedItem]];
|
||||
}
|
||||
|
||||
- (void)testSimpleStringBindingNullPlaceholderOption
|
||||
{
|
||||
var arrayController = [[CPArrayController alloc] init],
|
||||
objectController = [[CPObjectController alloc] init],
|
||||
testObject = [CPMutableDictionary dictionary],
|
||||
martin = @"Martin",
|
||||
malte = @"Malte",
|
||||
johan = @"Johan",
|
||||
menuObjects = [martin, malte, johan],
|
||||
insertsNullPlaceholderOption = [CPDictionary dictionaryWithObjects:[YES, @"Null Placeholder"] forKeys:[CPInsertsNullPlaceholderBindingOption, CPNullPlaceholderBindingOption]];
|
||||
|
||||
[testObject setObject:@"I'm a testObject" forKey:@"Who am I"];
|
||||
[arrayController setContent:menuObjects];
|
||||
[objectController setContent:testObject];
|
||||
|
||||
[button bind:CPContentBinding toObject:arrayController withKeyPath:@"arrangedObjects" options:insertsNullPlaceholderOption];
|
||||
[button bind:CPSelectedObjectBinding toObject:objectController withKeyPath:@"selection.xxx" options:insertsNullPlaceholderOption];
|
||||
|
||||
[[self button] selectItemWithTitle:@"Martin"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self]; // This has to be done to trigger the reverse set of the binding
|
||||
[self assert:martin equals:[testObject objectForKey:@"xxx"]];
|
||||
[[self button] selectItemWithTitle:@"Malte"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self];
|
||||
[self assert:malte equals:[testObject objectForKey:@"xxx"]];
|
||||
[[self button] selectItemWithTitle:@"Johan"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self];
|
||||
[self assert:johan equals:[testObject objectForKey:@"xxx"]];
|
||||
|
||||
[[self button] selectItemWithTitle:@"Null Placeholder"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self];
|
||||
[self assertNull:[testObject objectForKey:@"xxx"]];
|
||||
|
||||
[testObject setObject:martin forKey:@"xxx"];
|
||||
[self assert:1 equals:[[self button] indexOfSelectedItem]];
|
||||
[testObject setObject:malte forKey:@"xxx"];
|
||||
[self assert:2 equals:[[self button] indexOfSelectedItem]];
|
||||
[testObject setObject:johan forKey:@"xxx"];
|
||||
[self assert:3 equals:[[self button] indexOfSelectedItem]];
|
||||
|
||||
[testObject removeObjectForKey:@"xxx"];
|
||||
[self assert:0 equals:[[self button] indexOfSelectedItem]];
|
||||
}
|
||||
|
||||
- (void)testSimpleObjectBindingArrayController
|
||||
{
|
||||
var arrayController = [[CPArrayController alloc] init],
|
||||
objectController = [[CPObjectController alloc] init],
|
||||
testObject = [CPMutableDictionary dictionary],
|
||||
martin = [CPDictionary dictionaryWithJSObject:{@"name": @"Martin"}],
|
||||
malte = [CPDictionary dictionaryWithJSObject:{@"name": @"Malte"}],
|
||||
johan = [CPDictionary dictionaryWithJSObject:{@"name": @"Johan"}],
|
||||
menuObjects = [martin, malte, johan];
|
||||
|
||||
[testObject setObject:@"I'm a testObject" forKey:@"Who am I"];
|
||||
[arrayController setContent:menuObjects];
|
||||
[objectController setContent:testObject];
|
||||
|
||||
[button bind:CPContentBinding toObject:arrayController withKeyPath:@"arrangedObjects" options:nil];
|
||||
[button bind:CPContentValuesBinding toObject:arrayController withKeyPath:@"arrangedObjects.name" options:nil];
|
||||
[button bind:CPSelectedObjectBinding toObject:objectController withKeyPath:@"selection.xxx" options:nil];
|
||||
|
||||
[[self button] selectItemWithTitle:@"Martin"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self]; // This has to be done to trigger the reverse set of the binding
|
||||
[self assert:martin equals:[testObject objectForKey:@"xxx"]];
|
||||
[[self button] selectItemWithTitle:@"Malte"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self];
|
||||
[self assert:malte equals:[testObject objectForKey:@"xxx"]];
|
||||
[[self button] selectItemWithTitle:@"Johan"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self];
|
||||
[self assert:johan equals:[testObject objectForKey:@"xxx"]];
|
||||
|
||||
[testObject setObject:martin forKey:@"xxx"];
|
||||
[self assert:0 equals:[[self button] indexOfSelectedItem]];
|
||||
[testObject setObject:malte forKey:@"xxx"];
|
||||
[self assert:1 equals:[[self button] indexOfSelectedItem]];
|
||||
[testObject setObject:johan forKey:@"xxx"];
|
||||
[self assert:2 equals:[[self button] indexOfSelectedItem]];
|
||||
}
|
||||
|
||||
- (void)testObjectBindingNullPlaceholderOption
|
||||
{
|
||||
var arrayController = [[CPArrayController alloc] init],
|
||||
martin = [CPDictionary dictionaryWithJSObject:{@"name": @"Martin"}],
|
||||
malte = [CPDictionary dictionaryWithJSObject:{@"name": @"Malte"}],
|
||||
johan = [CPDictionary dictionaryWithJSObject:{@"name": @"Johan"}],
|
||||
menuObjects = [martin, malte, johan],
|
||||
insertsNullPlaceholderOption = [CPDictionary dictionaryWithObjects:[YES, @"Null Placeholder"] forKeys:[CPInsertsNullPlaceholderBindingOption, CPNullPlaceholderBindingOption]];
|
||||
|
||||
[arrayController setContent:menuObjects];
|
||||
[button bind:CPContentBinding toObject:arrayController withKeyPath:@"arrangedObjects" options:insertsNullPlaceholderOption];
|
||||
[button bind:CPContentValuesBinding toObject:arrayController withKeyPath:@"arrangedObjects.name" options:insertsNullPlaceholderOption];
|
||||
|
||||
[self assert:4 equals:[[self button] numberOfItems]];
|
||||
[self assert:0 equals:[[self button] indexOfItemWithTitle:@"Null Placeholder"]];
|
||||
[self assert:1 equals:[[self button] indexOfItemWithTitle:@"Martin"]];
|
||||
[self assert:2 equals:[[self button] indexOfItemWithTitle:@"Malte"]];
|
||||
[self assert:3 equals:[[self button] indexOfItemWithTitle:@"Johan"]];
|
||||
|
||||
[button unbind:CPContentValuesBinding];
|
||||
[button unbind:CPContentBinding];
|
||||
[button bind:CPContentValuesBinding toObject: arrayController withKeyPath:@"arrangedObjects.name" options:nil];
|
||||
[button bind:CPContentBinding toObject:arrayController withKeyPath:@"arrangedObjects" options:nil];
|
||||
|
||||
[self assert:3 equals:[[self button] numberOfItems]];
|
||||
[self assert:0 equals:[[self button] indexOfItemWithTitle:@"Martin"]];
|
||||
[self assert:1 equals:[[self button] indexOfItemWithTitle:@"Malte"]];
|
||||
[self assert:2 equals:[[self button] indexOfItemWithTitle:@"Johan"]];
|
||||
}
|
||||
|
||||
- (void)testSelectedObjectBindingArrayController
|
||||
{
|
||||
var arrayController = [[CPArrayController alloc] init],
|
||||
objectController = [[CPObjectController alloc] init],
|
||||
testObject = [CPMutableDictionary dictionary],
|
||||
martin = [CPDictionary dictionaryWithJSObject:{@"name": @"Martin"}],
|
||||
malte = [CPDictionary dictionaryWithJSObject:{@"name": @"Malte"}],
|
||||
johan = [CPDictionary dictionaryWithJSObject:{@"name": @"Johan"}],
|
||||
menuObjects = [martin, malte, johan],
|
||||
insertsNullPlaceholderOption = [CPDictionary dictionaryWithObjects:[YES, @"Null Placeholder"] forKeys:[CPInsertsNullPlaceholderBindingOption, CPNullPlaceholderBindingOption]];
|
||||
|
||||
[testObject setObject:@"I'm a testObject" forKey:@"Who am I"];
|
||||
[arrayController setContent:menuObjects];
|
||||
[objectController setContent:testObject];
|
||||
|
||||
[button bind:CPContentBinding toObject:arrayController withKeyPath:@"arrangedObjects" options:insertsNullPlaceholderOption];
|
||||
[button bind:CPContentValuesBinding toObject:arrayController withKeyPath:@"arrangedObjects.name" options:insertsNullPlaceholderOption];
|
||||
[button bind:CPSelectedObjectBinding toObject:objectController withKeyPath:@"selection.xxx" options:nil];
|
||||
|
||||
[self assert:4 equals:[[self button] numberOfItems]];
|
||||
[self assert:0 equals:[[self button] indexOfItemWithTitle:@"Null Placeholder"]];
|
||||
[self assert:1 equals:[[self button] indexOfItemWithTitle:@"Martin"]];
|
||||
[self assert:2 equals:[[self button] indexOfItemWithTitle:@"Malte"]];
|
||||
[self assert:3 equals:[[self button] indexOfItemWithTitle:@"Johan"]];
|
||||
|
||||
[[self button] selectItemWithTitle:@"Martin"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self]; // This has to be done to trigger the reverse set of the binding
|
||||
[self assert:martin equals:[testObject objectForKey:@"xxx"]];
|
||||
[[self button] selectItemWithTitle:@"Malte"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self];
|
||||
[self assert:malte equals:[testObject objectForKey:@"xxx"]];
|
||||
[[self button] selectItemWithTitle:@"Johan"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self];
|
||||
[self assert:johan equals:[testObject objectForKey:@"xxx"]];
|
||||
|
||||
[[self button] selectItemWithTitle:@"Null Placeholder"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self];
|
||||
[self assertNull:[testObject objectForKey:@"xxx"]];
|
||||
|
||||
[testObject setObject:martin forKey:@"xxx"];
|
||||
[self assert:1 equals:[[self button] indexOfSelectedItem]];
|
||||
[testObject setObject:malte forKey:@"xxx"];
|
||||
[self assert:2 equals:[[self button] indexOfSelectedItem]];
|
||||
[testObject setObject:johan forKey:@"xxx"];
|
||||
[self assert:3 equals:[[self button] indexOfSelectedItem]];
|
||||
|
||||
[testObject removeObjectForKey:@"xxx"];
|
||||
[self assert:0 equals:[[self button] indexOfSelectedItem]];
|
||||
}
|
||||
|
||||
- (void)testContentValuesWithValueTransformer
|
||||
{
|
||||
var arrayController = [[CPArrayController alloc] init],
|
||||
martin = [CPDictionary dictionaryWithJSObject:{@"name": @"Martin"}],
|
||||
malte = [CPDictionary dictionaryWithJSObject:{@"name": @"Malte"}],
|
||||
johan = [CPDictionary dictionaryWithJSObject:{@"name": @"Johan"}],
|
||||
menuObjects = [martin, malte, johan];
|
||||
|
||||
[arrayController setContent:menuObjects];
|
||||
|
||||
[button bind:CPContentBinding toObject:arrayController withKeyPath:@"arrangedObjects" options:nil];
|
||||
var options = [CPDictionary dictionary];
|
||||
[options setObject:[ContentValuesTransformer new] forKey:CPValueTransformerBindingOption];
|
||||
[button bind:CPContentValuesBinding toObject:arrayController withKeyPath:@"arrangedObjects.name" options:options];
|
||||
|
||||
[self assert:@"Transformed-Malte" equals:[[[self button] itemAtIndex:1] title]];
|
||||
}
|
||||
|
||||
- (void)testSelectedIndexBindingWithInsertsNullOption
|
||||
{
|
||||
var arrayController = [[CPArrayController alloc] init],
|
||||
testObject = [CPMutableDictionary dictionary],
|
||||
martin = @"Martin",
|
||||
malte = @"Malte",
|
||||
johan = @"Johan",
|
||||
menuObjects = [martin, malte, johan],
|
||||
insertsNullPlaceholderOption = [CPDictionary dictionaryWithObjects:[YES, @"Null Placeholder"] forKeys:[CPInsertsNullPlaceholderBindingOption, CPNullPlaceholderBindingOption]];
|
||||
|
||||
[arrayController setContent:menuObjects];
|
||||
[button bind:CPContentBinding toObject:arrayController withKeyPath:@"arrangedObjects" options:insertsNullPlaceholderOption];
|
||||
[button bind:CPSelectedIndexBinding toObject:testObject withKeyPath:@"index" options:nil];
|
||||
|
||||
[[self button] selectItemWithTitle:@"Martin"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self]; // This has to be done to trigger the reverse set of the binding
|
||||
[self assert:0 equals:[testObject objectForKey:@"index"]];
|
||||
[[self button] selectItemWithTitle:@"Malte"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self];
|
||||
[self assert:1 equals:[testObject objectForKey:@"index"]];
|
||||
[[self button] selectItemWithTitle:@"Johan"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self];
|
||||
[self assert:2 equals:[testObject objectForKey:@"index"]];
|
||||
|
||||
[[self button] selectItemWithTitle:@"Null Placeholder"];
|
||||
[[self button] sendAction:@selector(actionTest:) to:self];
|
||||
[self assert:-1 equals:[testObject objectForKey:@"index"]];
|
||||
}
|
||||
|
||||
- (void)actionTest:(id)sender
|
||||
{
|
||||
}
|
||||
|
||||
- (void)testRemoveItemAtIndex_
|
||||
{
|
||||
button = [[CPPopUpButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 28.0) pullsDown:NO];
|
||||
@@ -231,5 +478,16 @@
|
||||
[self assert:1 equals:[button indexOfSelectedItem] message:"selection index reduced when a prior item is removed"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation ContentValuesTransformer : CPValueTransformer
|
||||
{
|
||||
}
|
||||
|
||||
- (id)transformedValue:(id)aValue
|
||||
{
|
||||
return "Transformed-" + aValue;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* CPPopUpButtonBindings
|
||||
*
|
||||
* Created by You on December 2, 2010.
|
||||
* Copyright 2010, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/CPObject.j>
|
||||
|
||||
@implementation AppController : CPObject
|
||||
{
|
||||
@outlet CPWindow mainWindow;
|
||||
@outlet CPPopUpButton tagPopUp;
|
||||
|
||||
CPArray people @accessors;
|
||||
}
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
[CPValueTransformer setValueTransformer:[Transformer new] forName:@"Transformer"];
|
||||
}
|
||||
|
||||
- (void)awakeFromCib
|
||||
{
|
||||
var array = [];
|
||||
[array addObject:[CPDictionary dictionaryWithObjectsAndKeys:@"John",@"name",@"Butcher",@"job",@"john@meat.com",@"email", 2, @"tag", @"Resources/Jakabos1.jpg", @"image"]];
|
||||
[array addObject:[CPDictionary dictionaryWithObjectsAndKeys:@"Alberto",@"name",@"Seller",@"job",@"alberto@gmail.com",@"email", 0, @"tag", @"Resources/Jakabos2.jpg", @"image"]];
|
||||
[array addObject:[CPDictionary dictionaryWithObjectsAndKeys:@"Barack",@"name",@"President",@"job",@"barack@whitehouse.gov",@"email", 1, @"tag", @"Resources/Jakabos4.jpg", @"image"]];
|
||||
|
||||
[self setPeople:array];
|
||||
|
||||
// Setup tags for the second popup
|
||||
var items = [tagPopUp itemArray];
|
||||
[items enumerateObjectsUsingBlock:function(item, idx)
|
||||
{
|
||||
[item setTag:idx];
|
||||
[item setTitle:([item title] + " Tag:" + idx)];
|
||||
}];
|
||||
|
||||
[mainWindow setFullBridge:YES];
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation Transformer : CPValueTransformer
|
||||
{
|
||||
}
|
||||
|
||||
- (id)transformedValue:(CPString)aValue
|
||||
{
|
||||
return "transformed " + aValue;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1 @@
|
||||
../../../AppKit/CPPopUpButton.j
|
||||
@@ -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>CPPopUpButtonBindings</string>
|
||||
<key>CPPrincipalClass</key>
|
||||
<string>CPApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Jakefile
|
||||
* CPPopUpButtonBindings
|
||||
*
|
||||
* Created by You on November 2, 2010.
|
||||
* Copyright 2010, 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 ("CPPopUpButtonBindings", function(task)
|
||||
{
|
||||
task.setBuildIntermediatesPath(FILE.join("Build", "CPPopUpButtonBindings.build", configuration));
|
||||
task.setBuildPath(FILE.join("Build", configuration));
|
||||
|
||||
task.setProductName("CPPopUpButtonBindings");
|
||||
task.setIdentifier("com.yourcompany.CPPopUpButtonBindings");
|
||||
task.setVersion("1.0");
|
||||
task.setAuthor("Your Company");
|
||||
task.setEmail("feedback @nospam@ yourcompany.com");
|
||||
task.setSummary("CPPopUpButtonBindings");
|
||||
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", ["CPPopUpButtonBindings"], 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", "CPPopUpButtonBindings", "index.html")]);
|
||||
});
|
||||
|
||||
task ("run-release", ["release"], function()
|
||||
{
|
||||
OS.system(["open", FILE.join("Build", "Release", "CPPopUpButtonBindings", "index.html")]);
|
||||
});
|
||||
|
||||
task ("deploy", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Deployment", "CPPopUpButtonBindings"));
|
||||
OS.system(["press", "-f", FILE.join("Build", "Release", "CPPopUpButtonBindings"), FILE.join("Build", "Deployment", "CPPopUpButtonBindings")]);
|
||||
printResults("Deployment")
|
||||
});
|
||||
|
||||
task ("desktop", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Desktop", "CPPopUpButtonBindings"));
|
||||
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "CPPopUpButtonBindings"), FILE.join("Build", "Desktop", "CPPopUpButtonBindings", "CPPopUpButtonBindings.app"));
|
||||
printResults("Desktop")
|
||||
});
|
||||
|
||||
task ("run-desktop", ["desktop"], function()
|
||||
{
|
||||
OS.system([FILE.join("Build", "Desktop", "CPPopUpButtonBindings", "CPPopUpButtonBindings.app", "Contents", "MacOS", "NativeHost"), "-i"]);
|
||||
});
|
||||
|
||||
function printResults(configuration)
|
||||
{
|
||||
print("----------------------------");
|
||||
print(configuration+" app built at path: "+FILE.join("Build", configuration, "CPPopUpButtonBindings"));
|
||||
print("----------------------------");
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,104 @@
|
||||
<!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
|
||||
CPPopUpButtonBindings
|
||||
|
||||
Created by You on November 2, 2010.
|
||||
Copyright 2010, Your Company All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
<meta http-equiv="X-UA-Compatible" content="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>CPPopUpButtonBindings</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 CPPopUpButtonBindings...</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,78 @@
|
||||
<!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
|
||||
CPPopUpButtonBindings
|
||||
|
||||
Created by You on November 2, 2010.
|
||||
Copyright 2010, Your Company All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
<meta http-equiv="X-UA-Compatible" content="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>CPPopUpButtonBindings</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 CPPopUpButtonBindings...</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
|
||||
* CPPopUpButtonBindings
|
||||
*
|
||||
* Created by You on November 2, 2010.
|
||||
* Copyright 2010, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/Foundation.j>
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
@import "AppController.j"
|
||||
|
||||
|
||||
function main(args, namedArgs)
|
||||
{
|
||||
CPApplicationMain(args, namedArgs);
|
||||
}
|
||||
Reference in New Issue
Block a user