You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/10/29 19:16:04 UTC
[09/23] git commit: [flex-asjs] [refs/heads/develop] - use a real
structure when sharing data
use a real structure when sharing data
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/5cf8fe02
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/5cf8fe02
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/5cf8fe02
Branch: refs/heads/develop
Commit: 5cf8fe0261cf4992bbb2b43f5d39cf2e56feff2d
Parents: 02ab1df
Author: Alex Harui <ah...@apache.org>
Authored: Mon Oct 27 13:40:29 2014 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Wed Oct 29 11:15:42 2014 -0700
----------------------------------------------------------------------
.../projects/FlexJSUI/src/mx/states/AddItems.as | 13 ++--
.../FlexJSUI/src/mx/states/ItemAndDescriptor.as | 70 ++++++++++++++++++++
.../org/apache/flex/core/SimpleStatesImpl.as | 4 +-
3 files changed, 81 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5cf8fe02/frameworks/as/projects/FlexJSUI/src/mx/states/AddItems.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/mx/states/AddItems.as b/frameworks/as/projects/FlexJSUI/src/mx/states/AddItems.as
index 45de88d..99777cb 100644
--- a/frameworks/as/projects/FlexJSUI/src/mx/states/AddItems.as
+++ b/frameworks/as/projects/FlexJSUI/src/mx/states/AddItems.as
@@ -56,7 +56,7 @@ package mx.states
public var itemsDescriptorIndex:int;
- public var itemsDescriptor:Object;
+ public var itemsDescriptor:ItemAndDescriptor;
public var destination:String;
@@ -71,12 +71,17 @@ package mx.states
public function setDocument(document:Object, id:String = null):void
{
this.document = document;
- itemsDescriptor = document.mxmlsd[itemsDescriptorIndex];
- if (itemsDescriptor is Array)
+ var data:Object = document.mxmlsd[itemsDescriptorIndex];
+ if (data is Array)
{
- itemsDescriptor = { object: null, descriptor: itemsDescriptor };
+ itemsDescriptor = new ItemAndDescriptor();
+ itemsDescriptor.descriptor = data as Array;
+ // replace the entry in the document so subsequent
+ // addItems know it is shared
document.mxmlsd[itemsDescriptorIndex] = itemsDescriptor;
}
+ else
+ itemsDescriptor = data as ItemAndDescriptor;
}
/**
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5cf8fe02/frameworks/as/projects/FlexJSUI/src/mx/states/ItemAndDescriptor.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/mx/states/ItemAndDescriptor.as b/frameworks/as/projects/FlexJSUI/src/mx/states/ItemAndDescriptor.as
new file mode 100644
index 0000000..e704917
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/mx/states/ItemAndDescriptor.as
@@ -0,0 +1,70 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 mx.states
+{
+
+ [ExcludeClass]
+
+ /**
+ * A data structure to store an instance
+ * and its descriptor array.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ItemAndDescriptor
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function ItemAndDescriptor()
+ {
+ super();
+ }
+
+ /**
+ * The item or items created from the descriptor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public var items:Object;
+
+ /**
+ * The descriptor used to create the item(s).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public var descriptor:Array;
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5cf8fe02/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleStatesImpl.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleStatesImpl.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleStatesImpl.as
index a31b680..754b008 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleStatesImpl.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleStatesImpl.as
@@ -142,13 +142,13 @@ package org.apache.flex.core
var ai:AddItems = AddItems(o);
if (ai.items == null)
{
- ai.items = ai.itemsDescriptor.object;
+ ai.items = ai.itemsDescriptor.items as Array;
if (ai.items == null)
{
ai.items =
MXMLDataInterpreter.generateMXMLArray(ai.document,
null, ai.itemsDescriptor.descriptor);
- ai.itemsDescriptor.object = ai.items;
+ ai.itemsDescriptor.items = ai.items;
}
}
for each (var item:DisplayObject in ai.items)