Permalink
Browse files

started mutation handler overhaul and other changes for Dart compatab…

…ility
  • Loading branch information...
prujohn committed Mar 15, 2012
1 parent 92e92c5 commit d864e96a8f5b0fb9632f09277ab7317a8ba649a0
View
@@ -0,0 +1,13 @@
+demos/todo/todo.dart
+demos/Colors/Colors.dart
+debug/debug.dart
+core/LUCA_UI_Framework.dart
+core_tests/TestGroup.dart
+unit_test_framework/UnitTestFramework.dart
+demos/DemoStyles/DemoStyles.dart
+core_tests/LUCA_UI_Tests.dart
+extensions/social/lucaui_extension_social.dart
+extensions/media/lucaui_extension_media.dart
+demos/ValueConversion/ValueConversion.dart
+demos/Life/GameOfLife.dart
+demos/tryit/Tryit.dart
View
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>lucaui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.google.dart.tools.core.dartBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.google.dart.tools.core.dartNature</nature>
+ </natures>
+</projectDescription>
View
@@ -0,0 +1 @@
+LUCA_UI_Framework.dart
View
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.google.dart.tools.core.dartBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.google.dart.tools.core.dartNature</nature>
+ </natures>
+</projectDescription>
View
@@ -121,7 +121,9 @@ class FrameworkElement extends FrameworkObject {
_initFrameworkProperties();
- _component.attributes["data-lucaui-element"] = _type;
+ //TODO bugged
+ // this._component.get$attributes().$setindex("data-lucaui-element", this.get$_LUCAUI_Extensions_Media_type());
+ //_component.attributes["data-lucaui-element"] = this._type;
_initFrameworkEvents();
}
@@ -560,8 +562,43 @@ class FrameworkElement extends FrameworkObject {
if (this is Panel) updateLayout();
}
- void _initFrameworkEvents(){
- _rawElement.addEventListener("DOMNodeInsertedIntoDocument",(e){
+ //TODO load/unload should be asynchronous
+ void _addToLayoutTree(FrameworkElement parentElement){
+
+ parentElement._component.elements.add(_component);
+
+ _isLoaded = true;
+
+ if (!parentElement._isLoaded) return;
+
+ onAddedToDOM();
+ }
+
+ void onAddedToDOM(){
+ //parent is in the DOM so we should call loaded event and check for children
+
+ updateDataContext();
+
+ updateLayout();
+
+ loaded.invoke(this, new EventArgs());
+
+ if (this.isContainer){
+ this.dynamic.children.forEach((FrameworkElement child) => child.onAddedToDOM());
+ }
+ }
+
+ void _removeFromLayoutTree(){
+ //enforce DOM participation
+ if (!_isLoaded)
+ throw new FrameworkException('Attempted to remove element that is not already loaded into the DOM.');
+
+ }
+
+
+ void _initFrameworkEvents(){
+
+ _component._addEventListener("DOMNodeInsertedIntoDocument",(e){
_isLoaded = true;
updateDataContext();
@@ -571,7 +608,7 @@ class FrameworkElement extends FrameworkObject {
loaded.invoke(this, new EventArgs());
});
- _rawElement.addEventListener("DOMNodeRemovedFromDocument", (e){
+ _component._addEventListener("DOMNodeRemovedFromDocument", (e){
_isLoaded = false;
unloaded.invoke(this, new EventArgs());
});
@@ -53,7 +53,7 @@ class FrameworkObject extends LucaObject {
_Dom.appendClass(_component, "luca_ui_frameworkobject");
//grab the unwrapped version
- _rawElement = LevelDom.unwrap(_component);
+ //_rawElement = _unwrap(_component);
_initFrameworkObjectProperties();
@@ -0,0 +1 @@
+interface IFrameworkContainer{}
@@ -0,0 +1,5 @@
+
+interface IMultiChildContainer extends IFrameworkContainer{
+
+ ObservableList<FrameworkElement> children;
+}
@@ -0,0 +1,4 @@
+
+interface ISingleChildContainer extends IFrameworkContainer{
+ FrameworkElement get content();
+}
@@ -25,10 +25,12 @@
#library('LUCAUI_Framework_Core');
-#import('dart:coreimpl');
-#import('dart:htmlimpl');
+//#import('dart:coreimpl');
#import('dart:html');
+//required for now to prevent IDE squiggles on top-level functions like 'print()'
+// #import('dart:builtin');
+
#source('globals.dart');
#source('LucaSystem.dart');
#source('FrameworkObject.dart');
@@ -65,6 +67,7 @@
#source('events/PropertyChangingEventArgs.dart');
#source('events/ListChangedEventArgs.dart');
#source('events/RoutedEventArgs.dart');
+#source('events/SelectedItemChangedEventArgs.dart');
#source('primitives/Tuple.dart');
#source('primitives/Thickness.dart');
@@ -102,6 +105,8 @@
#source('elements/grid/GridCell.dart');
#source('elements/grid/GridLayoutDefinition.dart');
#source('elements/grid/GridLength.dart');
+#source('elements/DropDownList.dart');
+#source('elements/ListBox.dart');
//#source('elements/grid/Grid2.dart');
#source('exceptions/PresentationProviderException.dart');
@@ -132,8 +137,9 @@
#source('resources/GradientStop.dart');
#source('DataTemplate.dart');
#source('CollectionPresenter.dart');
-#source('DropDownList.dart');
-#source('SelectedItemChangedEventArgs.dart');
-#source('ListBox.dart');
#source('BindingData.dart');
#source('ControlTemplate.dart');
+
+#source('IFrameworkContainer.dart');
+#source('IMultiChildContainer.dart');
+#source('ISingleChildContainer.dart');
View
@@ -43,7 +43,19 @@ class ObservableList<T> implements List<T>{
void forEach(void f(element)) => _list.forEach(f);
- int indexOf(T element, [int startingFrom = 0]) => _list.indexOf(element, startingFrom);
+ Collection map(f(T element)) => _list.map(f);
+
+ Collection<T> filter(bool f(T element)) => _list.filter(f);
+
+ bool every(bool f(T element)) => _list.every(f);
+
+ bool some(bool f(T element)) => _list.some(f);
+
+ Iterator<T> iterator() => _list.iterator();
+
+ int indexOf(T element, [int start = 0]) => _list.indexOf(element, start);
+
+ int lastIndexOf(T element, [int start = 0]) => _list.lastIndexOf(element, start);
int get length() => _list.length;
@@ -82,8 +94,6 @@ class ObservableList<T> implements List<T>{
T last() => _list.last();
- void set length(int newLength) => _list.length(newLength);
-
void sort(int compare(a, b)) => _list.sort(compare);
void insertRange(int start, int length, [T initialValue = null]){
@@ -106,13 +116,6 @@ class ObservableList<T> implements List<T>{
listChanged.invoke(this, new ListChangedEventArgs<T>(ol, from.getRange(startFrom, from.length - startFrom)));
}
- void copyFrom(List<T> src, int srcStart, int dstStart, int count) {
- var ol = getRange(dstStart, count);
- _list.copyFrom(src, srcStart, dstStart, count);
-
- listChanged.invoke(this, new ListChangedEventArgs<T>(ol, src));
- }
-
void _notifySingleOld(T oldItem){
var ol = new List<T>();
ol.add(oldItem);
@@ -18,7 +18,7 @@
/**
* A button control element.
*/
-class Button extends Control
+class Button extends Control implements ISingleChildContainer
{
Dynamic _content;
File renamed without changes.
@@ -18,7 +18,7 @@
/**
* An element that renders a browser link.
*/
-class Hyperlink extends FrameworkElement
+class Hyperlink extends FrameworkElement implements ISingleChildContainer
{
Dynamic _content;
File renamed without changes.
View
@@ -23,7 +23,7 @@
* * [LayoutCanvas]
* * [StackPanel]
*/
-class Panel extends _ContainerElement {
+class Panel extends _ContainerElement implements IMultiChildContainer {
/// An observable list of the child elements associated with the panel.
final ObservableList<FrameworkElement> children;
static final String childHasParentExceptionMessage = "Element is already child of another element.";
Oops, something went wrong.

0 comments on commit d864e96

Please sign in to comment.