rename mobile.View to TitleView and create a core.View so we don't have to use ViewBase in examples (trying to get rid of the 'Base' in examples)
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/40187884 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/40187884 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/40187884 Branch: refs/heads/spark Commit: 40187884359eedd6d495952147478d3970a3fc4e Parents: 080c6cb Author: Alex Harui <[email protected]> Authored: Thu Jun 9 13:10:11 2016 -0700 Committer: Alex Harui <[email protected]> Committed: Thu Jun 9 13:26:27 2016 -0700 ---------------------------------------------------------------------- .../flex/binding/MXMLBeadViewBaseDataBinding.as | 342 ------------------- .../flex/binding/MXMLBeadViewDataBinding.as | 342 +++++++++++++++++++ .../apache/flex/binding/ViewBaseDataBinding.as | 338 ------------------ .../org/apache/flex/binding/ViewDataBinding.as | 338 ++++++++++++++++++ .../src/main/resources/basic-manifest.xml | 4 +- .../src/main/flex/org/apache/flex/core/View.as | 34 ++ .../main/flex/org/apache/flex/core/ViewBase.as | 3 +- .../Core/src/main/resources/basic-manifest.xml | 2 +- .../Flat/src/main/resources/defaults.css | 4 +- .../Flat/src/main/resources/flat-manifest.xml | 6 +- frameworks/projects/HTML/readpom.xml | 26 ++ .../projects/HTML/src/main/flex/HTMLClasses.as | 1 - .../flex/org/apache/flex/html/MXMLBeadView.as | 317 +++++++++++++++++ .../org/apache/flex/html/MXMLBeadViewBase.as | 317 ----------------- .../apache/flex/html/beads/TitleBarView.mxml | 6 +- .../HTML/src/main/resources/basic-manifest.xml | 2 +- .../HTML/src/main/resources/defaults.css | 4 +- .../Mobile/src/main/flex/MobileClasses.as | 2 +- .../main/flex/org/apache/flex/mobile/IView.as | 43 --- .../flex/org/apache/flex/mobile/IViewManager.as | 4 +- .../org/apache/flex/mobile/IViewManagerView.as | 43 +++ .../apache/flex/mobile/StackedViewManager.as | 10 +- .../org/apache/flex/mobile/TabbedViewManager.as | 2 +- .../flex/org/apache/flex/mobile/TitleView.as | 103 ++++++ .../main/flex/org/apache/flex/mobile/View.as | 103 ------ .../org/apache/flex/mobile/ViewManagerBase.as | 8 +- .../flex/mobile/beads/StackedViewManagerView.as | 2 +- .../flex/mobile/beads/TabbedViewManagerView.as | 2 +- .../apache/flex/mobile/beads/ViewManagerView.as | 165 --------- .../flex/mobile/beads/ViewManagerViewBase.as | 165 +++++++++ .../src/main/resources/basic-manifest.xml | 2 +- 31 files changed, 1399 insertions(+), 1341 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/MXMLBeadViewBaseDataBinding.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/MXMLBeadViewBaseDataBinding.as b/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/MXMLBeadViewBaseDataBinding.as deleted file mode 100644 index 803ce56..0000000 --- a/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/MXMLBeadViewBaseDataBinding.as +++ /dev/null @@ -1,342 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.binding -{ - import org.apache.flex.binding.ConstantBinding; - import org.apache.flex.binding.GenericBinding; - import org.apache.flex.binding.PropertyWatcher; - import org.apache.flex.binding.SimpleBinding; - import org.apache.flex.binding.WatcherBase; - import org.apache.flex.core.DataBindingBase; - import org.apache.flex.core.IBead; - import org.apache.flex.core.IStrand; - import org.apache.flex.events.Event; - import org.apache.flex.events.IEventDispatcher; - - /** - * The ViewBaseDataBinding class implements databinding for - * ViewBase instances. Different classes can have - * different databinding implementation that optimize for - * the different lifecycles. For example, an item renderer - * databinding implementation can wait to execute databindings - * until the data property is set. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class MXMLBeadViewBaseDataBinding extends DataBindingBase implements IBead - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function MXMLBeadViewBaseDataBinding() - { - super(); - } - - private var _strand:IStrand; - - /** - * @copy org.apache.flex.core.IBead#strand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function set strand(value:IStrand):void - { - _strand = value; - IEventDispatcher(_strand).addEventListener("initBindings", initCompleteHandler); - } - - private function initCompleteHandler(event:Event):void - { - var fieldWatcher:Object; - var sb:SimpleBinding; - if (!("_bindings" in _strand)) - return; - var bindingData:Array = _strand["_bindings"]; - var n:int = bindingData[0]; - var bindings:Array = []; - var i:int; - var index:int = 1; - for (i = 0; i < n; i++) - { - var binding:Object = {}; - binding.source = bindingData[index++]; - binding.destFunc = bindingData[index++]; - binding.destination = bindingData[index++]; - bindings.push(binding); - } - var watchers:Object = decodeWatcher(bindingData.slice(index)); - for (i = 0; i < n; i++) - { - binding = bindings[i]; - if (binding.source is Array) - { - if (binding.source[0] in _strand) - { - if (binding.source.length == 2 && binding.destination.length == 2) - { - var destObject:Object; - var destination:IStrand; - // can be simplebinding or constantbinding - var modelWatcher:Object = watchers.watcherMap[binding.source[0]]; - fieldWatcher = modelWatcher.children.watcherMap[binding.source[1]]; - if (fieldWatcher.eventNames is String) - { - sb = new SimpleBinding(); - sb.destinationPropertyName = binding.destination[1]; - sb.eventName = fieldWatcher.eventNames as String; - sb.sourceID = binding.source[0]; - sb.sourcePropertyName = binding.source[1]; - sb.setDocument(_strand); - destObject = _strand[binding.destination[0]]; - destination = destObject as IStrand; - if (destination) - destination.addBead(sb); - else - { - if (destObject) - { - sb.destination = destObject; - _strand.addBead(sb); - } - else - { - deferredBindings[binding.destination[0]] = sb; - IEventDispatcher(_strand).addEventListener("valueChange", deferredBindingsHandler); - } - } - } - else if (fieldWatcher.eventNames == null) - { - var cb:ConstantBinding = new ConstantBinding(); - cb.destinationPropertyName = binding.destination[1]; - cb.sourceID = binding.source[0]; - cb.sourcePropertyName = binding.source[1]; - cb.setDocument(_strand); - destObject = _strand[binding.destination[0]]; - destination = destObject as IStrand; - if (destination) - destination.addBead(cb); - else - { - if (destObject) - { - cb.destination = destObject; - _strand.addBead(cb); - } - else - { - deferredBindings[binding.destination[0]] = cb; - IEventDispatcher(_strand).addEventListener("valueChange", deferredBindingsHandler); - } - } - } - } - } - } - else if (binding.source is String) - { - fieldWatcher = watchers.watcherMap[binding.source]; - if (fieldWatcher.eventNames is String) - { - sb = new SimpleBinding(); - sb.destinationPropertyName = binding.destination[1]; - sb.eventName = fieldWatcher.eventNames as String; - sb.sourcePropertyName = binding.source; - sb.setDocument(_strand); - destObject = _strand[binding.destination[0]]; - destination = destObject as IStrand; - if (destination) - destination.addBead(sb); - else - { - if (destObject) - { - sb.destination = destObject; - _strand.addBead(sb); - } - else - { - deferredBindings[binding.destination[0]] = sb; - IEventDispatcher(_strand).addEventListener("valueChange", deferredBindingsHandler); - } - } - } - } - else - { - makeGenericBinding(binding, i, watchers); - } - } - } - - private function makeGenericBinding(binding:Object, index:int, watchers:Object):void - { - var gb:GenericBinding = new GenericBinding(); - gb.setDocument(_strand); - gb.destinationData = binding.destination; - gb.destinationFunction = binding.destFunc; - gb.source = binding.source; - setupWatchers(gb, index, watchers.watchers, null); - } - - private function setupWatchers(gb:GenericBinding, index:int, watchers:Array, parentWatcher:WatcherBase):void - { - var foundWatcher:Boolean = false; - - var n:int = watchers.length; - for (var i:int = 0; i < n; i++) - { - var watcher:Object = watchers[i]; - var isValidWatcher:Boolean = false; - if (typeof(watcher.bindings) == "number") - isValidWatcher = (watcher.bindings == index); - else - isValidWatcher = (watcher.bindings.indexOf(index) != -1); - if (isValidWatcher) - { - var type:String = watcher.type; - switch (type) - { - case "property": - { - var pw:PropertyWatcher = new PropertyWatcher(this, - watcher.propertyName, - watcher.eventNames, - watcher.getterFunction); - watcher.watcher = pw; - if (parentWatcher) - pw.parentChanged(parentWatcher.value); - else - pw.parentChanged(_strand); - if (parentWatcher) - parentWatcher.addChild(pw); - if (watcher.children == null) - pw.addBinding(gb); - foundWatcher = true; - break; - } - } - if (watcher.children) - { - setupWatchers(gb, index, watcher.children.watchers, watcher.watcher); - } - } - } - if (!foundWatcher && parentWatcher == null) - { - // might be a binding to a function that doesn't have change events - // so just force an update - gb.valueChanged(null); - } - } - - private function decodeWatcher(bindingData:Array):Object - { - var watcherMap:Object = {}; - var watchers:Array = []; - var n:int = bindingData.length; - var index:int = 0; - var watcherData:Object; - // FalconJX adds an extra null to the data so make sure - // we have enough data for a complete watcher otherwise - // say we are done - while (index < n - 2) - { - var watcherIndex:int = bindingData[index++]; - var type:int = bindingData[index++]; - switch (type) - { - case 0: - { - watcherData = { type: "function" }; - watcherData.functionName = bindingData[index++]; - watcherData.paramFunction = bindingData[index++]; - watcherData.eventNames = bindingData[index++]; - watcherData.bindings = bindingData[index++]; - break; - } - case 1: - { - watcherData = { type: "static" }; - watcherData.propertyName = bindingData[index++]; - watcherData.eventNames = bindingData[index++]; - watcherData.bindings = bindingData[index++]; - watcherData.getterFunction = bindingData[index++]; - watcherData.parentObj = bindingData[index++]; - watcherMap[watcherData.propertyName] = watcherData; - break; - } - case 2: - { - watcherData = { type: "property" }; - watcherData.propertyName = bindingData[index++]; - watcherData.eventNames = bindingData[index++]; - watcherData.bindings = bindingData[index++]; - watcherData.getterFunction = bindingData[index++]; - watcherMap[watcherData.propertyName] = watcherData; - break; - } - case 3: - { - watcherData = { type: "xml" }; - watcherData.propertyName = bindingData[index++]; - watcherData.bindings = bindingData[index++]; - watcherMap[watcherData.propertyName] = watcherData; - break; - } - } - watcherData.children = bindingData[index++]; - if (watcherData.children != null) - { - watcherData.children = decodeWatcher(watcherData.children); - } - watcherData.index = watcherIndex; - watchers.push(watcherData); - } - return { watchers: watchers, watcherMap: watcherMap }; - } - - private var deferredBindings:Object = {}; - private function deferredBindingsHandler(event:Event):void - { - for (var p:String in deferredBindings) - { - if (_strand[p] != null) - { - var destination:IStrand = _strand[p] as IStrand; - destination.addBead(deferredBindings[p]); - delete deferredBindings[p]; - } - } - } - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/MXMLBeadViewDataBinding.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/MXMLBeadViewDataBinding.as b/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/MXMLBeadViewDataBinding.as new file mode 100644 index 0000000..1a12462 --- /dev/null +++ b/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/MXMLBeadViewDataBinding.as @@ -0,0 +1,342 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.binding +{ + import org.apache.flex.binding.ConstantBinding; + import org.apache.flex.binding.GenericBinding; + import org.apache.flex.binding.PropertyWatcher; + import org.apache.flex.binding.SimpleBinding; + import org.apache.flex.binding.WatcherBase; + import org.apache.flex.core.DataBindingBase; + import org.apache.flex.core.IBead; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.IEventDispatcher; + + /** + * The MXMLBeadViewDataBinding class implements databinding for + * MXMLBeadView instances. Different classes can have + * different databinding implementation that optimize for + * the different lifecycles. For example, an item renderer + * databinding implementation can wait to execute databindings + * until the data property is set. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class MXMLBeadViewDataBinding extends DataBindingBase implements IBead + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function MXMLBeadViewDataBinding() + { + super(); + } + + private var _strand:IStrand; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set strand(value:IStrand):void + { + _strand = value; + IEventDispatcher(_strand).addEventListener("initBindings", initCompleteHandler); + } + + private function initCompleteHandler(event:Event):void + { + var fieldWatcher:Object; + var sb:SimpleBinding; + if (!("_bindings" in _strand)) + return; + var bindingData:Array = _strand["_bindings"]; + var n:int = bindingData[0]; + var bindings:Array = []; + var i:int; + var index:int = 1; + for (i = 0; i < n; i++) + { + var binding:Object = {}; + binding.source = bindingData[index++]; + binding.destFunc = bindingData[index++]; + binding.destination = bindingData[index++]; + bindings.push(binding); + } + var watchers:Object = decodeWatcher(bindingData.slice(index)); + for (i = 0; i < n; i++) + { + binding = bindings[i]; + if (binding.source is Array) + { + if (binding.source[0] in _strand) + { + if (binding.source.length == 2 && binding.destination.length == 2) + { + var destObject:Object; + var destination:IStrand; + // can be simplebinding or constantbinding + var modelWatcher:Object = watchers.watcherMap[binding.source[0]]; + fieldWatcher = modelWatcher.children.watcherMap[binding.source[1]]; + if (fieldWatcher.eventNames is String) + { + sb = new SimpleBinding(); + sb.destinationPropertyName = binding.destination[1]; + sb.eventName = fieldWatcher.eventNames as String; + sb.sourceID = binding.source[0]; + sb.sourcePropertyName = binding.source[1]; + sb.setDocument(_strand); + destObject = _strand[binding.destination[0]]; + destination = destObject as IStrand; + if (destination) + destination.addBead(sb); + else + { + if (destObject) + { + sb.destination = destObject; + _strand.addBead(sb); + } + else + { + deferredBindings[binding.destination[0]] = sb; + IEventDispatcher(_strand).addEventListener("valueChange", deferredBindingsHandler); + } + } + } + else if (fieldWatcher.eventNames == null) + { + var cb:ConstantBinding = new ConstantBinding(); + cb.destinationPropertyName = binding.destination[1]; + cb.sourceID = binding.source[0]; + cb.sourcePropertyName = binding.source[1]; + cb.setDocument(_strand); + destObject = _strand[binding.destination[0]]; + destination = destObject as IStrand; + if (destination) + destination.addBead(cb); + else + { + if (destObject) + { + cb.destination = destObject; + _strand.addBead(cb); + } + else + { + deferredBindings[binding.destination[0]] = cb; + IEventDispatcher(_strand).addEventListener("valueChange", deferredBindingsHandler); + } + } + } + } + } + } + else if (binding.source is String) + { + fieldWatcher = watchers.watcherMap[binding.source]; + if (fieldWatcher.eventNames is String) + { + sb = new SimpleBinding(); + sb.destinationPropertyName = binding.destination[1]; + sb.eventName = fieldWatcher.eventNames as String; + sb.sourcePropertyName = binding.source; + sb.setDocument(_strand); + destObject = _strand[binding.destination[0]]; + destination = destObject as IStrand; + if (destination) + destination.addBead(sb); + else + { + if (destObject) + { + sb.destination = destObject; + _strand.addBead(sb); + } + else + { + deferredBindings[binding.destination[0]] = sb; + IEventDispatcher(_strand).addEventListener("valueChange", deferredBindingsHandler); + } + } + } + } + else + { + makeGenericBinding(binding, i, watchers); + } + } + } + + private function makeGenericBinding(binding:Object, index:int, watchers:Object):void + { + var gb:GenericBinding = new GenericBinding(); + gb.setDocument(_strand); + gb.destinationData = binding.destination; + gb.destinationFunction = binding.destFunc; + gb.source = binding.source; + setupWatchers(gb, index, watchers.watchers, null); + } + + private function setupWatchers(gb:GenericBinding, index:int, watchers:Array, parentWatcher:WatcherBase):void + { + var foundWatcher:Boolean = false; + + var n:int = watchers.length; + for (var i:int = 0; i < n; i++) + { + var watcher:Object = watchers[i]; + var isValidWatcher:Boolean = false; + if (typeof(watcher.bindings) == "number") + isValidWatcher = (watcher.bindings == index); + else + isValidWatcher = (watcher.bindings.indexOf(index) != -1); + if (isValidWatcher) + { + var type:String = watcher.type; + switch (type) + { + case "property": + { + var pw:PropertyWatcher = new PropertyWatcher(this, + watcher.propertyName, + watcher.eventNames, + watcher.getterFunction); + watcher.watcher = pw; + if (parentWatcher) + pw.parentChanged(parentWatcher.value); + else + pw.parentChanged(_strand); + if (parentWatcher) + parentWatcher.addChild(pw); + if (watcher.children == null) + pw.addBinding(gb); + foundWatcher = true; + break; + } + } + if (watcher.children) + { + setupWatchers(gb, index, watcher.children.watchers, watcher.watcher); + } + } + } + if (!foundWatcher && parentWatcher == null) + { + // might be a binding to a function that doesn't have change events + // so just force an update + gb.valueChanged(null); + } + } + + private function decodeWatcher(bindingData:Array):Object + { + var watcherMap:Object = {}; + var watchers:Array = []; + var n:int = bindingData.length; + var index:int = 0; + var watcherData:Object; + // FalconJX adds an extra null to the data so make sure + // we have enough data for a complete watcher otherwise + // say we are done + while (index < n - 2) + { + var watcherIndex:int = bindingData[index++]; + var type:int = bindingData[index++]; + switch (type) + { + case 0: + { + watcherData = { type: "function" }; + watcherData.functionName = bindingData[index++]; + watcherData.paramFunction = bindingData[index++]; + watcherData.eventNames = bindingData[index++]; + watcherData.bindings = bindingData[index++]; + break; + } + case 1: + { + watcherData = { type: "static" }; + watcherData.propertyName = bindingData[index++]; + watcherData.eventNames = bindingData[index++]; + watcherData.bindings = bindingData[index++]; + watcherData.getterFunction = bindingData[index++]; + watcherData.parentObj = bindingData[index++]; + watcherMap[watcherData.propertyName] = watcherData; + break; + } + case 2: + { + watcherData = { type: "property" }; + watcherData.propertyName = bindingData[index++]; + watcherData.eventNames = bindingData[index++]; + watcherData.bindings = bindingData[index++]; + watcherData.getterFunction = bindingData[index++]; + watcherMap[watcherData.propertyName] = watcherData; + break; + } + case 3: + { + watcherData = { type: "xml" }; + watcherData.propertyName = bindingData[index++]; + watcherData.bindings = bindingData[index++]; + watcherMap[watcherData.propertyName] = watcherData; + break; + } + } + watcherData.children = bindingData[index++]; + if (watcherData.children != null) + { + watcherData.children = decodeWatcher(watcherData.children); + } + watcherData.index = watcherIndex; + watchers.push(watcherData); + } + return { watchers: watchers, watcherMap: watcherMap }; + } + + private var deferredBindings:Object = {}; + private function deferredBindingsHandler(event:Event):void + { + for (var p:String in deferredBindings) + { + if (_strand[p] != null) + { + var destination:IStrand = _strand[p] as IStrand; + destination.addBead(deferredBindings[p]); + delete deferredBindings[p]; + } + } + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/ViewBaseDataBinding.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/ViewBaseDataBinding.as b/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/ViewBaseDataBinding.as deleted file mode 100644 index 6bfd5a2..0000000 --- a/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/ViewBaseDataBinding.as +++ /dev/null @@ -1,338 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.binding -{ - import org.apache.flex.binding.ConstantBinding; - import org.apache.flex.binding.GenericBinding; - import org.apache.flex.binding.PropertyWatcher; - import org.apache.flex.binding.SimpleBinding; - import org.apache.flex.binding.WatcherBase; - import org.apache.flex.core.IBead; - import org.apache.flex.core.IStrand; - import org.apache.flex.events.Event; - import org.apache.flex.events.IEventDispatcher; - - /** - * The ViewBaseDataBinding class implements databinding for - * ViewBase instances. Different classes can have - * different databinding implementation that optimize for - * the different lifecycles. For example, an item renderer - * databinding implementation can wait to execute databindings - * until the data property is set. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class ViewBaseDataBinding implements IBead - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function ViewBaseDataBinding() - { - super(); - } - - private var _strand:IStrand; - - /** - * @copy org.apache.flex.core.IBead#strand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function set strand(value:IStrand):void - { - _strand = value; - IEventDispatcher(_strand).addEventListener("initBindings", initCompleteHandler); - } - - private function initCompleteHandler(event:Event):void - { - var fieldWatcher:Object; - var sb:SimpleBinding; - if (!("_bindings" in _strand)) - return; - var bindingData:Array = _strand["_bindings"]; - var destObject:Object; - var n:int = bindingData[0]; - var bindings:Array = []; - var i:int; - var index:int = 1; - for (i = 0; i < n; i++) - { - var binding:Object = {}; - binding.source = bindingData[index++]; - binding.destFunc = bindingData[index++]; - binding.destination = bindingData[index++]; - bindings.push(binding); - } - var watchers:Object = decodeWatcher(bindingData.slice(index)); - for (i = 0; i < n; i++) - { - binding = bindings[i]; - if (binding.source is Array) - { - if (binding.source[0] == "applicationModel") - { - if (binding.source.length == 2 && binding.destination.length == 2) - { - var destination:IStrand; - // can be simplebinding or constantbinding - var modelWatcher:Object = watchers.watcherMap["applicationModel"]; - fieldWatcher = modelWatcher.children.watcherMap[binding.source[1]]; - if (fieldWatcher.eventNames is String) - { - sb = new SimpleBinding(); - sb.destinationPropertyName = binding.destination[1]; - sb.eventName = fieldWatcher.eventNames as String; - sb.sourceID = binding.source[0]; - sb.sourcePropertyName = binding.source[1]; - sb.setDocument(_strand); - destObject = _strand[binding.destination[0]]; - destination = destObject as IStrand; - if (destination) - destination.addBead(sb); - else - { - if (destObject) - { - sb.destination = destObject; - _strand.addBead(sb); - } - else - { - deferredBindings[binding.destination[0]] = sb; - IEventDispatcher(_strand).addEventListener("valueChange", deferredBindingsHandler); - } - } - } - else if (fieldWatcher.eventNames == null) - { - var cb:ConstantBinding = new ConstantBinding(); - cb.destinationPropertyName = binding.destination[1]; - cb.sourceID = binding.source[0]; - cb.sourcePropertyName = binding.source[1]; - cb.setDocument(_strand); - destObject = _strand[binding.destination[0]]; - destination = destObject as IStrand; - if (destination) - destination.addBead(cb); - else - { - if (destObject) - { - sb.destination = destObject; - _strand.addBead(sb); - } - else - { - deferredBindings[binding.destination[0]] = sb; - IEventDispatcher(_strand).addEventListener("valueChange", deferredBindingsHandler); - } - } - } - } - } - } - else if (binding.source is String) - { - fieldWatcher = watchers.watcherMap[binding.source]; - if (fieldWatcher.eventNames is String) - { - sb = new SimpleBinding(); - sb.destinationPropertyName = binding.destination[1]; - sb.eventName = fieldWatcher.eventNames as String; - sb.sourcePropertyName = binding.source; - sb.setDocument(_strand); - destObject = _strand[binding.destination[0]]; - destination = destObject as IStrand; - if (destination) - destination.addBead(sb); - else - { - if (destObject) - { - sb.destination = destObject; - _strand.addBead(sb); - } - else - { - deferredBindings[binding.destination[0]] = sb; - IEventDispatcher(_strand).addEventListener("valueChange", deferredBindingsHandler); - } - } - } - } - else - { - makeGenericBinding(binding, i, watchers); - } - } - } - - private function makeGenericBinding(binding:Object, index:int, watchers:Object):void - { - var gb:GenericBinding = new GenericBinding(); - gb.setDocument(_strand); - gb.destinationData = binding.destination; - gb.destinationFunction = binding.destFunc; - gb.source = binding.source; - setupWatchers(gb, index, watchers.watchers, null); - } - - private function setupWatchers(gb:GenericBinding, index:int, watchers:Array, parentWatcher:WatcherBase):void - { - var foundWatcher:Boolean = false; - - var n:int = watchers.length; - for (var i:int = 0; i < n; i++) - { - var watcher:Object = watchers[i]; - var isValidWatcher:Boolean = false; - if (typeof(watcher.bindings) == "number") - isValidWatcher = (watcher.bindings == index); - else - isValidWatcher = (watcher.bindings.indexOf(index) != -1); - if (isValidWatcher) - { - var type:String = watcher.type; - switch (type) - { - case "property": - { - var pw:PropertyWatcher = new PropertyWatcher(this, - watcher.propertyName, - watcher.eventNames, - watcher.getterFunction); - watcher.watcher = pw; - if (parentWatcher) - pw.parentChanged(parentWatcher.value); - else - pw.parentChanged(_strand); - if (parentWatcher) - parentWatcher.addChild(pw); - if (watcher.children == null) - pw.addBinding(gb); - foundWatcher = true; - break; - } - } - if (watcher.children) - { - setupWatchers(gb, index, watcher.children.watchers, watcher.watcher); - } - } - } - if (!foundWatcher && parentWatcher == null) - { - // might be a binding to a function that doesn't have change events - // so just force an update - gb.valueChanged(null); - } - } - - private function decodeWatcher(bindingData:Array):Object - { - var watcherMap:Object = {}; - var watchers:Array = []; - var n:int = bindingData.length; - var index:int = 0; - var watcherData:Object; - while (index < n) - { - var watcherIndex:int = bindingData[index++]; - var type:int = bindingData[index++]; - switch (type) - { - case 0: - { - watcherData = { type: "function" }; - watcherData.functionName = bindingData[index++]; - watcherData.paramFunction = bindingData[index++]; - watcherData.eventNames = bindingData[index++]; - watcherData.bindings = bindingData[index++]; - break; - } - case 1: - { - watcherData = { type: "static" }; - watcherData.propertyName = bindingData[index++]; - watcherData.eventNames = bindingData[index++]; - watcherData.bindings = bindingData[index++]; - watcherData.getterFunction = bindingData[index++]; - watcherData.parentObj = bindingData[index++]; - watcherMap[watcherData.propertyName] = watcherData; - break; - } - case 2: - { - watcherData = { type: "property" }; - watcherData.propertyName = bindingData[index++]; - watcherData.eventNames = bindingData[index++]; - watcherData.bindings = bindingData[index++]; - watcherData.getterFunction = bindingData[index++]; - watcherMap[watcherData.propertyName] = watcherData; - break; - } - case 3: - { - watcherData = { type: "xml" }; - watcherData.propertyName = bindingData[index++]; - watcherData.bindings = bindingData[index++]; - watcherMap[watcherData.propertyName] = watcherData; - break; - } - } - watcherData.children = bindingData[index++]; - if (watcherData.children != null) - { - watcherData.children = decodeWatcher(watcherData.children); - } - watcherData.index = watcherIndex; - watchers.push(watcherData); - } - return { watchers: watchers, watcherMap: watcherMap }; - } - - private var deferredBindings:Object = {}; - private function deferredBindingsHandler(event:Event):void - { - for (var p:String in deferredBindings) - { - if (_strand[p] != null) - { - var destination:IStrand = _strand[p] as IStrand; - destination.addBead(deferredBindings[p]); - delete deferredBindings[p]; - } - } - } - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/ViewDataBinding.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/ViewDataBinding.as b/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/ViewDataBinding.as new file mode 100644 index 0000000..0f8195e --- /dev/null +++ b/frameworks/projects/Binding/src/main/flex/org/apache/flex/binding/ViewDataBinding.as @@ -0,0 +1,338 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.binding +{ + import org.apache.flex.binding.ConstantBinding; + import org.apache.flex.binding.GenericBinding; + import org.apache.flex.binding.PropertyWatcher; + import org.apache.flex.binding.SimpleBinding; + import org.apache.flex.binding.WatcherBase; + import org.apache.flex.core.IBead; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.IEventDispatcher; + + /** + * The ViewDataBinding class implements databinding for + * View instances. Different classes can have + * different databinding implementation that optimize for + * the different lifecycles. For example, an item renderer + * databinding implementation can wait to execute databindings + * until the data property is set. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ViewDataBinding implements IBead + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ViewDataBinding() + { + super(); + } + + private var _strand:IStrand; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set strand(value:IStrand):void + { + _strand = value; + IEventDispatcher(_strand).addEventListener("initBindings", initCompleteHandler); + } + + private function initCompleteHandler(event:Event):void + { + var fieldWatcher:Object; + var sb:SimpleBinding; + if (!("_bindings" in _strand)) + return; + var bindingData:Array = _strand["_bindings"]; + var destObject:Object; + var n:int = bindingData[0]; + var bindings:Array = []; + var i:int; + var index:int = 1; + for (i = 0; i < n; i++) + { + var binding:Object = {}; + binding.source = bindingData[index++]; + binding.destFunc = bindingData[index++]; + binding.destination = bindingData[index++]; + bindings.push(binding); + } + var watchers:Object = decodeWatcher(bindingData.slice(index)); + for (i = 0; i < n; i++) + { + binding = bindings[i]; + if (binding.source is Array) + { + if (binding.source[0] == "applicationModel") + { + if (binding.source.length == 2 && binding.destination.length == 2) + { + var destination:IStrand; + // can be simplebinding or constantbinding + var modelWatcher:Object = watchers.watcherMap["applicationModel"]; + fieldWatcher = modelWatcher.children.watcherMap[binding.source[1]]; + if (fieldWatcher.eventNames is String) + { + sb = new SimpleBinding(); + sb.destinationPropertyName = binding.destination[1]; + sb.eventName = fieldWatcher.eventNames as String; + sb.sourceID = binding.source[0]; + sb.sourcePropertyName = binding.source[1]; + sb.setDocument(_strand); + destObject = _strand[binding.destination[0]]; + destination = destObject as IStrand; + if (destination) + destination.addBead(sb); + else + { + if (destObject) + { + sb.destination = destObject; + _strand.addBead(sb); + } + else + { + deferredBindings[binding.destination[0]] = sb; + IEventDispatcher(_strand).addEventListener("valueChange", deferredBindingsHandler); + } + } + } + else if (fieldWatcher.eventNames == null) + { + var cb:ConstantBinding = new ConstantBinding(); + cb.destinationPropertyName = binding.destination[1]; + cb.sourceID = binding.source[0]; + cb.sourcePropertyName = binding.source[1]; + cb.setDocument(_strand); + destObject = _strand[binding.destination[0]]; + destination = destObject as IStrand; + if (destination) + destination.addBead(cb); + else + { + if (destObject) + { + sb.destination = destObject; + _strand.addBead(sb); + } + else + { + deferredBindings[binding.destination[0]] = sb; + IEventDispatcher(_strand).addEventListener("valueChange", deferredBindingsHandler); + } + } + } + } + } + } + else if (binding.source is String) + { + fieldWatcher = watchers.watcherMap[binding.source]; + if (fieldWatcher.eventNames is String) + { + sb = new SimpleBinding(); + sb.destinationPropertyName = binding.destination[1]; + sb.eventName = fieldWatcher.eventNames as String; + sb.sourcePropertyName = binding.source; + sb.setDocument(_strand); + destObject = _strand[binding.destination[0]]; + destination = destObject as IStrand; + if (destination) + destination.addBead(sb); + else + { + if (destObject) + { + sb.destination = destObject; + _strand.addBead(sb); + } + else + { + deferredBindings[binding.destination[0]] = sb; + IEventDispatcher(_strand).addEventListener("valueChange", deferredBindingsHandler); + } + } + } + } + else + { + makeGenericBinding(binding, i, watchers); + } + } + } + + private function makeGenericBinding(binding:Object, index:int, watchers:Object):void + { + var gb:GenericBinding = new GenericBinding(); + gb.setDocument(_strand); + gb.destinationData = binding.destination; + gb.destinationFunction = binding.destFunc; + gb.source = binding.source; + setupWatchers(gb, index, watchers.watchers, null); + } + + private function setupWatchers(gb:GenericBinding, index:int, watchers:Array, parentWatcher:WatcherBase):void + { + var foundWatcher:Boolean = false; + + var n:int = watchers.length; + for (var i:int = 0; i < n; i++) + { + var watcher:Object = watchers[i]; + var isValidWatcher:Boolean = false; + if (typeof(watcher.bindings) == "number") + isValidWatcher = (watcher.bindings == index); + else + isValidWatcher = (watcher.bindings.indexOf(index) != -1); + if (isValidWatcher) + { + var type:String = watcher.type; + switch (type) + { + case "property": + { + var pw:PropertyWatcher = new PropertyWatcher(this, + watcher.propertyName, + watcher.eventNames, + watcher.getterFunction); + watcher.watcher = pw; + if (parentWatcher) + pw.parentChanged(parentWatcher.value); + else + pw.parentChanged(_strand); + if (parentWatcher) + parentWatcher.addChild(pw); + if (watcher.children == null) + pw.addBinding(gb); + foundWatcher = true; + break; + } + } + if (watcher.children) + { + setupWatchers(gb, index, watcher.children.watchers, watcher.watcher); + } + } + } + if (!foundWatcher && parentWatcher == null) + { + // might be a binding to a function that doesn't have change events + // so just force an update + gb.valueChanged(null); + } + } + + private function decodeWatcher(bindingData:Array):Object + { + var watcherMap:Object = {}; + var watchers:Array = []; + var n:int = bindingData.length; + var index:int = 0; + var watcherData:Object; + while (index < n) + { + var watcherIndex:int = bindingData[index++]; + var type:int = bindingData[index++]; + switch (type) + { + case 0: + { + watcherData = { type: "function" }; + watcherData.functionName = bindingData[index++]; + watcherData.paramFunction = bindingData[index++]; + watcherData.eventNames = bindingData[index++]; + watcherData.bindings = bindingData[index++]; + break; + } + case 1: + { + watcherData = { type: "static" }; + watcherData.propertyName = bindingData[index++]; + watcherData.eventNames = bindingData[index++]; + watcherData.bindings = bindingData[index++]; + watcherData.getterFunction = bindingData[index++]; + watcherData.parentObj = bindingData[index++]; + watcherMap[watcherData.propertyName] = watcherData; + break; + } + case 2: + { + watcherData = { type: "property" }; + watcherData.propertyName = bindingData[index++]; + watcherData.eventNames = bindingData[index++]; + watcherData.bindings = bindingData[index++]; + watcherData.getterFunction = bindingData[index++]; + watcherMap[watcherData.propertyName] = watcherData; + break; + } + case 3: + { + watcherData = { type: "xml" }; + watcherData.propertyName = bindingData[index++]; + watcherData.bindings = bindingData[index++]; + watcherMap[watcherData.propertyName] = watcherData; + break; + } + } + watcherData.children = bindingData[index++]; + if (watcherData.children != null) + { + watcherData.children = decodeWatcher(watcherData.children); + } + watcherData.index = watcherIndex; + watchers.push(watcherData); + } + return { watchers: watchers, watcherMap: watcherMap }; + } + + private var deferredBindings:Object = {}; + private function deferredBindingsHandler(event:Event):void + { + for (var p:String in deferredBindings) + { + if (_strand[p] != null) + { + var destination:IStrand = _strand[p] as IStrand; + destination.addBead(deferredBindings[p]); + delete deferredBindings[p]; + } + } + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/Binding/src/main/resources/basic-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Binding/src/main/resources/basic-manifest.xml b/frameworks/projects/Binding/src/main/resources/basic-manifest.xml index 5ce9333..4e7193b 100644 --- a/frameworks/projects/Binding/src/main/resources/basic-manifest.xml +++ b/frameworks/projects/Binding/src/main/resources/basic-manifest.xml @@ -23,8 +23,8 @@ <component id="ConstantBinding" class="org.apache.flex.binding.ConstantBinding"/> <component id="SimpleBinding" class="org.apache.flex.binding.SimpleBinding"/> - <component id="ViewBaseDataBinding" class="org.apache.flex.binding.ViewBaseDataBinding"/> - <component id="MXMLBeadViewBaseDataBinding" class="org.apache.flex.binding.MXMLBeadViewBaseDataBinding"/> + <component id="ViewDataBinding" class="org.apache.flex.binding.ViewDataBinding"/> + <component id="MXMLBeadViewDataBinding" class="org.apache.flex.binding.MXMLBeadViewDataBinding"/> <component id="ApplicationDataBinding" class="org.apache.flex.binding.ApplicationDataBinding"/> <component id="ContainerDataBinding" class="org.apache.flex.binding.ContainerDataBinding"/> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/Core/src/main/flex/org/apache/flex/core/View.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/View.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/View.as new file mode 100644 index 0000000..2d0f2c4 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/View.as @@ -0,0 +1,34 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.core +{ + /** + * The View class is the class for most views in a FlexJS + * application. It is generally used as the root tag of MXML + * documents and UI controls and containers are added to it. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class View extends ViewBase + { + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as index 0230e57..7e4b65e 100644 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as @@ -41,8 +41,7 @@ package org.apache.flex.core /** * The ViewBase class is the base class for most views in a FlexJS - * application. It is generally used as the root tag of MXML - * documents and UI controls and containers are added to it. + * application. * * @langversion 3.0 * @playerversion Flash 10.2 http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/Core/src/main/resources/basic-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/resources/basic-manifest.xml b/frameworks/projects/Core/src/main/resources/basic-manifest.xml index c1842df..a196a57 100644 --- a/frameworks/projects/Core/src/main/resources/basic-manifest.xml +++ b/frameworks/projects/Core/src/main/resources/basic-manifest.xml @@ -24,7 +24,7 @@ <component id="Application" class="org.apache.flex.core.Application"/> <component id="SimpleCSSValuesImpl" class="org.apache.flex.core.SimpleCSSValuesImpl"/> <component id="CSSFontFaceBead" class="org.apache.flex.core.CSSFontFaceBead" /> - <component id="ViewBase" class="org.apache.flex.core.ViewBase"/> + <component id="View" class="org.apache.flex.core.View"/> <component id="BrowserScroller" class="org.apache.flex.core.BrowserScroller"/> <component id="BrowserResizeHandler" class="org.apache.flex.core.BrowserResizeListener"/> <component id="SimpleValuesImpl" class="org.apache.flex.core.SimpleValuesImpl"/> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/Flat/src/main/resources/defaults.css ---------------------------------------------------------------------- diff --git a/frameworks/projects/Flat/src/main/resources/defaults.css b/frameworks/projects/Flat/src/main/resources/defaults.css index 53a91f1..c0f0770 100644 --- a/frameworks/projects/Flat/src/main/resources/defaults.css +++ b/frameworks/projects/Flat/src/main/resources/defaults.css @@ -496,7 +496,7 @@ ToolTip background-color: #FFFFCC; } -ViewBase +View { IBeadView: ClassReference("org.apache.flex.html.beads.ContainerView"); IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.BasicLayout"); @@ -832,7 +832,7 @@ ToggleTextButton IBeadView: ClassReference("org.apache.flex.html.beads.CSSTextButtonView"); } -ViewBase +View { iBackgroundBead: ClassReference("org.apache.flex.html.beads.SolidBackgroundBead"); iBorderBead: ClassReference("org.apache.flex.html.beads.SingleLineBorderBead"); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/Flat/src/main/resources/flat-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Flat/src/main/resources/flat-manifest.xml b/frameworks/projects/Flat/src/main/resources/flat-manifest.xml index 77f5ffc..1857f54 100644 --- a/frameworks/projects/Flat/src/main/resources/flat-manifest.xml +++ b/frameworks/projects/Flat/src/main/resources/flat-manifest.xml @@ -88,12 +88,12 @@ <component id="FlexibleFirstChildHorizontalLayout" class="org.apache.flex.html.beads.layouts.FlexibleFirstChildHorizontalLayout" lookupOnly="true" /> <component id="OneFlexibleChildVerticalLayout" class="org.apache.flex.html.beads.layouts.OneFlexibleChildVerticalLayout" lookupOnly="true" /> <component id="OneFlexibleChildHorizontalLayout" class="org.apache.flex.html.beads.layouts.OneFlexibleChildHorizontalLayout" lookupOnly="true" /> - <component id="MXMLBeadViewBase" class="org.apache.flex.html.MXMLBeadViewBase" lookupOnly="true" /> + <component id="MXMLBeadView" class="org.apache.flex.html.MXMLBeadView" lookupOnly="true" /> <component id="Border" class="org.apache.flex.html.supportClasses.Border" lookupOnly="true" /> - <component id="ViewBase" class="org.apache.flex.core.ViewBase" lookupOnly="true" /> - <component id="ViewBaseDataBinding" class="org.apache.flex.binding.ViewBaseDataBinding" lookupOnly="true" /> + <component id="View" class="org.apache.flex.core.View" lookupOnly="true" /> + <component id="ViewDataBinding" class="org.apache.flex.binding.ViewDataBinding" lookupOnly="true" /> <component id="State" class="org.apache.flex.states.State" lookupOnly="true" /> </componentPackage> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/HTML/readpom.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/readpom.xml b/frameworks/projects/HTML/readpom.xml new file mode 100644 index 0000000..5311d47 --- /dev/null +++ b/frameworks/projects/HTML/readpom.xml @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> + + +<project name="readpom" default="main" basedir="."> + + <xmlproperty file="pom.xml" collapseattributes="true"/> + <echoproperties /> +</project> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/HTML/src/main/flex/HTMLClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/HTMLClasses.as b/frameworks/projects/HTML/src/main/flex/HTMLClasses.as index 0834abb..fb0608c 100644 --- a/frameworks/projects/HTML/src/main/flex/HTMLClasses.as +++ b/frameworks/projects/HTML/src/main/flex/HTMLClasses.as @@ -167,7 +167,6 @@ internal class HTMLClasses import org.apache.flex.html.supportClasses.DateChooserButton; DateChooserButton; import org.apache.flex.html.supportClasses.GraphicsItemRenderer; GraphicsItemRenderer; - import org.apache.flex.html.MXMLBeadViewBase; MXMLBeadViewBase; import org.apache.flex.html.beads.TitleBarView; TitleBarView; import org.apache.flex.html.beads.TitleBarMeasurementBead; TitleBarMeasurementBead; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/40187884/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/MXMLBeadView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/MXMLBeadView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/MXMLBeadView.as new file mode 100644 index 0000000..894cf0c --- /dev/null +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/MXMLBeadView.as @@ -0,0 +1,317 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html +{ + import org.apache.flex.states.State; + + import org.apache.flex.core.IBead; + import org.apache.flex.core.ILayoutHost; + import org.apache.flex.core.IParent; + import org.apache.flex.core.IParentIUIBase; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.IStatesImpl; + import org.apache.flex.core.ValuesManager; + import org.apache.flex.html.beads.ContainerView; + import org.apache.flex.events.Event; + import org.apache.flex.events.ValueChangeEvent; + import org.apache.flex.utils.MXMLDataInterpreter; + + [DefaultProperty("mxmlContent")] + + /** + * The MXMLBeadView class extends ContainerView + * and adds support for databinding and specification + * of children in MXML. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class MXMLBeadView extends ContainerView implements IStrand, ILayoutHost + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function MXMLBeadView() + { + super(); + } + + [Bindable("strandChanged")] + /** + * An MXMLBeadView doesn't create its children until it is added to + * the strand. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + override public function set strand(value:IStrand):void + { + super.strand = value; + // each MXML file can also have styles in fx:Style block + ValuesManager.valuesImpl.init(this); + + dispatchEvent(new Event("strandChanged")); + + for each (var bead:IBead in beads) + addBead(bead); + + dispatchEvent(new org.apache.flex.events.Event("beadsAdded")); + + MXMLDataInterpreter.generateMXMLInstances(this, IParent(value), MXMLDescriptor); + + dispatchEvent(new Event("initBindings")) + dispatchEvent(new Event("initComplete")) + dispatchEvent(new Event("childrenAdded")); + } + + [Bindable("__NoChangeEvent__")] + /** + * The model object. + */ + public function get model():Object + { + return _strand["model"]; + } + + /** + * @copy org.apache.flex.core.Application#MXMLDescriptor + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get MXMLDescriptor():Array + { + return null; + } + + /** + * @copy org.apache.flex.core.Application#generateMXMLAttributes() + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function generateMXMLAttributes(data:Array):void + { + MXMLDataInterpreter.generateMXMLProperties(this, data); + } + + /** + * @copy org.apache.flex.core.ItemRendererClassFactory#mxmlContent + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public var mxmlContent:Array; + + private var _states:Array; + + /** + * The array of view states. These should + * be instances of org.apache.flex.states.State. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get states():Array + { + return _states; + } + + /** + * @private + */ + public function set states(value:Array):void + { + _states = value; + _currentState = _states[0].name; + + try{ + if (getBeadByType(IStatesImpl) == null) + addBead(new (ValuesManager.valuesImpl.getValue(this, "iStatesImpl")) as IBead); + } + //TODO: Need to handle this case more gracefully + catch(e:Error) + { + COMPILE::AS3 + { + trace(e.message); + } + } + + } + + /** + * <code>true</code> if the array of states + * contains a state with this name. + * + * @param state The state namem. + * @return True if state in state array + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function hasState(state:String):Boolean + { + for each (var s:State in _states) + { + if (s.name == state) + return true; + } + return false; + } + + private var _currentState:String; + + [Bindable("currentStateChange")] + /** + * The name of the current state. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get currentState():String + { + return _currentState; + } + + /** + * @private + */ + public function set currentState(value:String):void + { + var event:ValueChangeEvent = new ValueChangeEvent("currentStateChange", false, false, _currentState, value) + _currentState = value; + dispatchEvent(event); + } + + private var _transitions:Array; + + /** + * The array of transitions. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get transitions():Array + { + return _transitions; + } + + /** + * @private + */ + public function set transitions(value:Array):void + { + _transitions = value; + } + + /** + * @copy org.apache.flex.core.Application#beads + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public var beads:Array; + + private var _beads:Array; + + /** + * @copy org.apache.flex.core.IStrand#addBead() + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function addBead(bead:IBead):void + { + if (!_beads) + _beads = []; + _beads.push(bead); + bead.strand = this; + } + + /** + * @copy org.apache.flex.core.IStrand#getBeadByType() + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function getBeadByType(classOrInterface:Class):IBead + { + for each (var bead:IBead in _beads) + { + if (bead is classOrInterface) + return bead; + } + return null; + } + + /** + * @copy org.apache.flex.core.IStrand#removeBead() + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function removeBead(value:IBead):IBead + { + var n:int = _beads.length; + for (var i:int = 0; i < n; i++) + { + var bead:IBead = _beads[i]; + if (bead == value) + { + _beads.splice(i, 1); + return bead; + } + } + return null; + } + + } +} \ No newline at end of file
