You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cf...@apache.org on 2012/08/06 23:26:02 UTC
svn commit: r1370028 [22/43] - in
/incubator/flex/whiteboard/cframpton/adobe.next: ./ frameworks/
frameworks/projects/advancedgrids/src/mx/collections/
frameworks/projects/advancedgrids/src/mx/controls/
frameworks/projects/airframework/src/mx/managers/...
Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/playerglobal/bundles/en_US/docs/packages.dita
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/playerglobal/bundles/en_US/docs/packages.dita?rev=1370028&r1=1370027&r2=1370028&view=diff
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/playerglobal/bundles/en_US/docs/packages.dita (original)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/playerglobal/bundles/en_US/docs/packages.dita Mon Aug 6 21:25:54 2012
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?><apiMap><apiItemRef href="air.net.xml"/><apiItemRef href="flash.ui.xml"/><apiItemRef href="flash.net.xml"><apiItemRef href="flash.net.dns.xml"/><apiItemRef href="flash.net.drm.xml"/></apiItemRef><apiItemRef href="flash.xml.xml"/><apiItemRef href="__Global__.xml"/><apiItemRef href="air.update.xml"><apiItemRef href="air.update.events.xml"/></apiItemRef><apiItemRef href="flash.data.xml"/><apiItemRef href="flash.geom.xml"/><apiItemRef href="flash.html.xml"/><apiItemRef href="flash.text.xml"><apiItemRef href="flash.text.ime.xml"/><apiItemRef href="flash.text.engine.xml"/></apiItemRef><apiItemRef href="adobe.utils.xml"/><apiItemRef href="air.desktop.xml"/><apiItemRef href="flash.media.xml"/><apiItemRef href="flash.utils.xml"/><apiItemRef href="flash.errors.xml"/><apiItemRef href="flash.events.xml"/><apiItemRef href="flash.system.xml"/><apiItemRef href="flash.desktop.xml"/><apiItemRef href="flash.display.xml"/><apiItemRef href="flash.filters.xm
l"/><apiItemRef href="flash.sampler.xml"/><apiItemRef href="flash.sensors.xml"/><apiItemRef href="flash.external.xml"/><apiItemRef href="flash.printing.xml"/><apiItemRef href="flash.profiler.xml"/><apiItemRef href="flash.security.xml"/><apiItemRef href="flash.filesystem.xml"/><apiItemRef href="flash.accessibility.xml"/><apiItemRef href="flash.globalization.xml"/></apiMap><!--
+<?xml version="1.0" encoding="UTF-8"?><apiMap><apiItemRef href="air.net.xml"/><apiItemRef href="flash.ui.xml"/><apiItemRef href="flash.hid.xml"/><apiItemRef href="flash.net.xml"><apiItemRef href="flash.net.dns.xml"/><apiItemRef href="flash.net.drm.xml"/></apiItemRef><apiItemRef href="flash.xml.xml"/><apiItemRef href="__Global__.xml"/><apiItemRef href="air.update.xml"><apiItemRef href="air.update.events.xml"/></apiItemRef><apiItemRef href="flash.data.xml"/><apiItemRef href="flash.geom.xml"/><apiItemRef href="flash.html.xml"/><apiItemRef href="flash.text.xml"><apiItemRef href="flash.text.ime.xml"/><apiItemRef href="flash.text.engine.xml"/></apiItemRef><apiItemRef href="adobe.utils.xml"/><apiItemRef href="air.desktop.xml"/><apiItemRef href="flash.media.xml"/><apiItemRef href="flash.utils.xml"/><apiItemRef href="flash.errors.xml"/><apiItemRef href="flash.events.xml"/><apiItemRef href="flash.system.xml"/><apiItemRef href="flash.desktop.xml"/><apiItemRef href="flash.display.xml"/>
<apiItemRef href="flash.filters.xml"/><apiItemRef href="flash.sampler.xml"/><apiItemRef href="flash.sensors.xml"/><apiItemRef href="flash.external.xml"/><apiItemRef href="flash.printing.xml"/><apiItemRef href="flash.profiler.xml"/><apiItemRef href="flash.security.xml"/><apiItemRef href="flash.display3D.xml"><apiItemRef href="flash.display3D.textures.xml"/></apiItemRef><apiItemRef href="flash.filesystem.xml"/><apiItemRef href="flash.accessibility.xml"/><apiItemRef href="flash.globalization.xml"/></apiMap><!--
+
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.
@@ -13,4 +14,5 @@
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.
+
-->
Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/CurrencyFormatterExample1.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/CurrencyFormatterExample1.mxml?rev=1370028&r1=1370027&r2=1370028&view=diff
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/CurrencyFormatterExample1.mxml (original)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/CurrencyFormatterExample1.mxml Mon Aug 6 21:25:54 2012
@@ -22,15 +22,15 @@
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
-
+
<fx:Declarations>
<s:CurrencyFormatter id="currencyFormatter"/>
</fx:Declarations>
-
+
<fx:Script>
<![CDATA[
import flash.globalization.CurrencyParseResult;
-
+
private function localeChange():void
{
// Sets the locale style on the document UI component.
@@ -38,34 +38,34 @@
setStyle('locale', inputLocaleIDName.text);
inputCurrencyChange();
}
-
+
private function inputCurrencyChange():void
{
const cpr:CurrencyParseResult
- = currencyFormatter.parse(inputCurrency.text);
+ = currencyFormatter.parse(inputCurrency.text);
parsedResult.text = "Currency String: [" + cpr.currencyString
+ "], Amount: [" + cpr.value.toString() + "]";
}
]]>
</fx:Script>
-
- <mx:Form>
- <mx:FormItem label="Input Locale ID Name">
- <mx:HBox>
+
+ <s:Form>
+ <s:FormItem label="Input Locale ID Name">
+ <s:HGroup>
<s:TextInput id="inputLocaleIDName"/>
<s:Button click="localeChange()" label="Apply"/>
- </mx:HBox>
- <mx:Text text="Example: 'en-US', 'fr-FR', 'ja-JP', 'ar-SA'"/>
- </mx:FormItem>
- <mx:FormItem label="Input Currency Amount">
+ </s:HGroup>
+ <s:Label text="Example: 'en-US', 'fr-FR', 'ja-JP', 'ar-SA'"/>
+ </s:FormItem>
+ <s:FormItem label="Input Currency Amount">
<s:TextInput id="inputCurrency" change="inputCurrencyChange()"/>
- <mx:Text text="Example: {currencyFormatter.format(123456789.123)}"/>
- </mx:FormItem>
- <mx:FormItem label="Actual Locale ID Name">
- <mx:Text text="{currencyFormatter.actualLocaleIDName}"/>
- </mx:FormItem>
- <mx:FormItem label="Parsed Result">
- <mx:Text id="parsedResult"/>
- </mx:FormItem>
- </mx:Form>
+ <s:Label text="Example: {currencyFormatter.format(123456789.123)}"/>
+ </s:FormItem>
+ <s:FormItem label="Actual Locale ID Name">
+ <s:Label text="{currencyFormatter.actualLocaleIDName}"/>
+ </s:FormItem>
+ <s:FormItem label="Parsed Result">
+ <s:Label id="parsedResult"/>
+ </s:FormItem>
+ </s:Form>
</s:Application>
Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/CurrencyFormatterExample2.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/CurrencyFormatterExample2.mxml?rev=1370028&r1=1370027&r2=1370028&view=diff
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/CurrencyFormatterExample2.mxml (original)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/CurrencyFormatterExample2.mxml Mon Aug 6 21:25:54 2012
@@ -22,38 +22,38 @@
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
-
+
<fx:Declarations>
<s:CurrencyFormatter id="currencyFormatter"/>
</fx:Declarations>
-
+
<fx:Script>
<![CDATA[
[Bindable]
private var currencyAmount:Number = 123456.789;
]]>
</fx:Script>
-
- <mx:Form>
- <mx:FormItem label="Input Locale ID Name">
- <mx:HBox>
+
+ <s:Form>
+ <s:FormItem label="Input Locale ID Name">
+ <s:HGroup>
<s:TextInput id="inputLocaleIDName"/>
<!-- Upon button click, sets the locale style on the document
- UI component. The formatter will inherit this style. -->
+ UI component. The formatter will inherit this style. -->
<s:Button click="setStyle('locale', inputLocaleIDName.text);"
label="Apply"/>
- </mx:HBox>
- <mx:Text text="Example: 'en-US', 'fr-FR', 'ja-JP', 'ar-SA'"/>
- </mx:FormItem>
- <mx:FormItem label="Use Currency Symbol">
+ </s:HGroup>
+ <s:Label text="Example: 'en-US', 'fr-FR', 'ja-JP', 'ar-SA'"/>
+ </s:FormItem>
+ <s:FormItem label="Use Currency Symbol">
<s:CheckBox id="useSymbol"
- click="currencyFormatter.useCurrencySymbol = useSymbol.selected"/>
- </mx:FormItem>
- <mx:FormItem label="Actual Locale ID Name">
+ click="currencyFormatter.useCurrencySymbol = useSymbol.selected"/>
+ </s:FormItem>
+ <s:FormItem label="Actual Locale ID Name">
<s:Label text="{currencyFormatter.actualLocaleIDName}"/>
- </mx:FormItem>
- <mx:FormItem label="Formatted Result">
+ </s:FormItem>
+ <s:FormItem label="Formatted Result">
<s:Label text="{currencyFormatter.format(currencyAmount)}"/>
- </mx:FormItem>
- </mx:Form>
+ </s:FormItem>
+ </s:Form>
</s:Application>
Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/DateTimeFormatterExample.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/DateTimeFormatterExample.mxml?rev=1370028&r1=1370027&r2=1370028&view=diff
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/DateTimeFormatterExample.mxml (original)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/DateTimeFormatterExample.mxml Mon Aug 6 21:25:54 2012
@@ -22,50 +22,50 @@
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
-
+
<fx:Declarations>
<s:DateTimeFormatter id="dateTimeFormatter"/>
</fx:Declarations>
-
+
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
-
+
private static const dateTimeStyleMenuItems:ArrayCollection
- = new ArrayCollection(["long", "medium", "short", "none"]);
+ = new ArrayCollection(["long", "medium", "short", "none"]);
]]>
</fx:Script>
-
- <mx:Form>
- <mx:FormItem label="Input Locale ID Name">
- <mx:HBox>
+
+ <s:Form>
+ <s:FormItem label="Input Locale ID Name">
+ <s:HGroup>
<s:TextInput id="inputLocaleIDName"/>
<!-- Upon button click, sets the locale style on the document
- UI component. The formatter will inherit this style. -->
+ UI component. The formatter will inherit this style. -->
<s:Button click="setStyle('locale', inputLocaleIDName.text);"
label="Apply"/>
- </mx:HBox>
- <mx:Text text="Example: 'en-US', 'fr-FR', 'ja-JP', 'ar-SA'"/>
- </mx:FormItem>
- <mx:FormItem label="Date Style">
+ </s:HGroup>
+ <s:Label text="Example: 'en-US', 'fr-FR', 'ja-JP', 'ar-SA'"/>
+ </s:FormItem>
+ <s:FormItem label="Date Style">
<s:DropDownList id="dateStyle" requireSelection="true"
- change="dateTimeFormatter.dateStyle = dateTimeStyleMenuItems[dateStyle.selectedIndex]"
- dataProvider="{dateTimeStyleMenuItems}"/>
- </mx:FormItem>
- <mx:FormItem label="Time Style">
+ change="dateTimeFormatter.dateStyle = dateTimeStyleMenuItems[dateStyle.selectedIndex]"
+ dataProvider="{dateTimeStyleMenuItems}"/>
+ </s:FormItem>
+ <s:FormItem label="Time Style">
<s:DropDownList id="timeStyle" requireSelection="true"
- change="dateTimeFormatter.timeStyle = dateTimeStyleMenuItems[timeStyle.selectedIndex]"
- dataProvider="{dateTimeStyleMenuItems}"/>
- </mx:FormItem>
- <mx:FormItem label="Input Date">
- <mx:TextInput id="inputDate" text="{new Date().toString()}"/>
- </mx:FormItem>
- <mx:FormItem label="Actual Locale ID Name">
- <mx:Text text="{dateTimeFormatter.actualLocaleIDName}"/>
- </mx:FormItem>
- <mx:FormItem label="Formatted Result">
- <mx:Text id="uiFormattedDate"
- text="{dateTimeFormatter.format(inputDate.text)}"/>
- </mx:FormItem>
- </mx:Form>
+ change="dateTimeFormatter.timeStyle = dateTimeStyleMenuItems[timeStyle.selectedIndex]"
+ dataProvider="{dateTimeStyleMenuItems}"/>
+ </s:FormItem>
+ <s:FormItem label="Input Date">
+ <s:TextInput id="inputDate" text="{new Date().toString()}"/>
+ </s:FormItem>
+ <s:FormItem label="Actual Locale ID Name">
+ <s:Label text="{dateTimeFormatter.actualLocaleIDName}"/>
+ </s:FormItem>
+ <s:FormItem label="Formatted Result">
+ <s:Label id="uiFormattedDate"
+ text="{dateTimeFormatter.format(inputDate.text)}"/>
+ </s:FormItem>
+ </s:Form>
</s:Application>
Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/NumberFormatterExample1.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/NumberFormatterExample1.mxml?rev=1370028&r1=1370027&r2=1370028&view=diff
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/NumberFormatterExample1.mxml (original)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/NumberFormatterExample1.mxml Mon Aug 6 21:25:54 2012
@@ -22,42 +22,42 @@
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
-
+
<fx:Declarations>
<s:NumberFormatter id="numberFormatter"/>
</fx:Declarations>
-
+
<fx:Script>
<![CDATA[
[Bindable]
private var number:Number = 123456789.123456789;
]]>
</fx:Script>
-
- <mx:Form>
- <mx:FormItem label="Input Locale ID Name">
- <mx:HBox>
+
+ <s:Form>
+ <s:FormItem label="Input Locale ID Name">
+ <s:HGroup>
<s:TextInput id="inputLocaleIDName"/>
<!-- Upon button click, sets the locale style on the document
- UI component. The formatter will inherit this style. -->
+ UI component. The formatter will inherit this style. -->
<s:Button click="setStyle('locale', inputLocaleIDName.text);"
label="Apply"/>
- </mx:HBox>
- <mx:Text text="Example: 'en-US', 'fr-FR', 'ja-JP', 'ar-SA'"/>
- </mx:FormItem>
- <mx:FormItem label="Use Grouping">
- <mx:CheckBox id="useGrouping"
- change="numberFormatter.useGrouping= useGrouping.selected"/>
- </mx:FormItem>
- <mx:FormItem label="Fractional Digits">
- <mx:TextInput id="fractionalDigits"
- change="numberFormatter.fractionalDigits = Number(fractionalDigits.text)"/>
- </mx:FormItem>
- <mx:FormItem label="Actual Locale ID Name">
- <mx:Text text="{numberFormatter.actualLocaleIDName}"/>
- </mx:FormItem>
- <mx:FormItem label="Formatted Result">
- <mx:Text text="{numberFormatter.format(number)}"/>
- </mx:FormItem>
- </mx:Form>
+ </s:HGroup>
+ <s:Label text="Example: 'en-US', 'fr-FR', 'ja-JP', 'ar-SA'"/>
+ </s:FormItem>
+ <s:FormItem label="Use Grouping">
+ <s:CheckBox id="useGrouping"
+ change="numberFormatter.useGrouping = useGrouping.selected"/>
+ </s:FormItem>
+ <s:FormItem label="Fractional Digits">
+ <s:TextInput id="fractionalDigits"
+ change="numberFormatter.fractionalDigits = Number(fractionalDigits.text)"/>
+ </s:FormItem>
+ <s:FormItem label="Actual Locale ID Name">
+ <s:Label text="{numberFormatter.actualLocaleIDName}"/>
+ </s:FormItem>
+ <s:FormItem label="Formatted Result">
+ <s:Label text="{numberFormatter.format(number)}"/>
+ </s:FormItem>
+ </s:Form>
</s:Application>
Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/NumberFormatterExample2.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/NumberFormatterExample2.mxml?rev=1370028&r1=1370027&r2=1370028&view=diff
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/NumberFormatterExample2.mxml (original)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/asdoc/en_US/spark/formatters/examples/NumberFormatterExample2.mxml Mon Aug 6 21:25:54 2012
@@ -22,32 +22,32 @@
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
-
+
<fx:Declarations>
<s:NumberFormatter id="numberFormatter"/>
</fx:Declarations>
-
- <mx:Form>
- <mx:FormItem label="Input Locale ID Name">
- <mx:HBox>
+
+ <s:Form>
+ <s:FormItem label="Input Locale ID Name">
+ <s:HGroup>
<s:TextInput id="inputLocaleIDName"/>
<!-- Upon button click, sets the locale style on the document
- UI component. The formatter will inherit this style. -->
+ UI component. The formatter will inherit this style. -->
<s:Button click="setStyle('locale', inputLocaleIDName.text);"
label="Apply"/>
- </mx:HBox>
- <mx:Text text="Example: 'en-US', 'fr-FR', 'ja-JP', 'ar-SA'"/>
- </mx:FormItem>
- <mx:FormItem label="Input Number">
+ </s:HGroup>
+ <s:Label text="Example: 'en-US', 'fr-FR', 'ja-JP', 'ar-SA'"/>
+ </s:FormItem>
+ <s:FormItem label="Input Number">
<s:TextInput id="inputNumber"/>
- <mx:Text text="Example: {numberFormatter.format(123456789.123)}"/>
- </mx:FormItem>
- <mx:FormItem label="Actual Locale ID Name">
- <mx:Text text="{numberFormatter.actualLocaleIDName}"/>
- </mx:FormItem>
- <mx:FormItem label="Parsed Result">
- <mx:Text
+ <s:Label text="Example: {numberFormatter.format(123456789.123)}"/>
+ </s:FormItem>
+ <s:FormItem label="Actual Locale ID Name">
+ <s:Label text="{numberFormatter.actualLocaleIDName}"/>
+ </s:FormItem>
+ <s:FormItem label="Parsed Result">
+ <s:Label
text="{numberFormatter.parseNumber(inputNumber.text).toString()}"/>
- </mx:FormItem>
- </mx:Form>
+ </s:FormItem>
+ </s:Form>
</s:Application>
Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/bundles/en_US/components.properties
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/bundles/en_US/components.properties?rev=1370028&r1=1370027&r2=1370028&view=diff
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/bundles/en_US/components.properties (original)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/bundles/en_US/components.properties Mon Aug 6 21:25:54 2012
@@ -58,7 +58,7 @@ setChildIndexError=setChildIndex() is no
swapChildrenError=swapChildren() is not available in this class. Instead, use swapElements() or modify the skin, if you have one.
swapChildrenAtError=swapChildrenAt() is not available in this class. Instead, use swapElementsAt() or modify the skin, if you have one.
-# HGroup, VGroup
+# HGroup, VGroup, ViewStack
layoutReadOnly=You are not allowed to change the layout for this class. It is read-only.
# Scroller
Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/defaults.css
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/defaults.css?rev=1370028&r1=1370027&r2=1370028&view=diff
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/defaults.css (original)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/defaults.css Mon Aug 6 21:25:54 2012
@@ -19,8 +19,31 @@
@namespace "library://ns.adobe.com/flex/spark";
+/* Global Style Declaration */
+
+global
+{
+ /*toolTipClass: ClassReference("spark.components.ToolTip");*/
+ toolTipHideDelay: 10000;
+ toolTipScrubDelay: 100;
+ toolTipShowDelay: 500;
+}
+
/* Default Skins */
+Accordion
+{
+ skinClass: ClassReference("spark.skins.spark.VerticalAccordionSkin");
+}
+
+AccordionContent
+{
+ skinClass: ClassReference("spark.skins.spark.VerticalAccordionContentSkin");
+ backgroundColor: #F8F8F8;
+ borderVisible: true;
+ borderColor: #666666;
+}
+
Application
{
backgroundColor: #FFFFFF;
@@ -67,10 +90,20 @@ ComboBox
DataGrid
{
+ dragIndicatorClass: ClassReference("spark.components.gridClasses.DataGridDragProxy");
+ dropIndicatorSkin: ClassReference("spark.skins.spark.ListDropIndicator");
skinClass: ClassReference("spark.skins.spark.DataGridSkin");
stretchCursor: Embed(source="Assets.swf",symbol="cursorStretch");
}
+DateChooser
+{
+ contentBackgroundColor: #F4F4F4;
+ skinClass: ClassReference("spark.skins.spark.DateChooserSkin");
+ repeatInterval: 400;
+ todayColor: #F9EB21;
+}
+
DropDownList
{
/* dropShadowVisible: true; in spark.css */
@@ -146,12 +179,12 @@ Panel
cornerRadius: 0;
dropShadowVisible: true;
*/
- skinClass: ClassReference("spark.skins.spark.PanelSkin");
+ skinClass: ClassReference("spark.skins.spark.PanelSkin");
}
RadioButton
{
- skinClass: ClassReference("spark.skins.spark.RadioButtonSkin");
+ skinClass: ClassReference("spark.skins.spark.RadioButtonSkin");
}
RichEditableText
@@ -224,7 +257,7 @@ TextArea
paddingLeft: 3;
paddingRight: 3;
paddingTop: 5;
- skinClass: ClassReference("spark.skins.spark.TextAreaSkin");
+ skinClass: ClassReference("spark.skins.spark.TextAreaSkin");
}
TextInput
@@ -233,24 +266,39 @@ TextInput
paddingLeft: 3;
paddingRight: 3;
paddingTop: 5;
- skinClass: ClassReference("spark.skins.spark.TextInputSkin");
+ skinClass: ClassReference("spark.skins.spark.TextInputSkin");
}
TitleWindow
{
/* in spark.css */
/*
- borderAlpha: 0.8;
- borderColor: 0;
- cornerRadius: 0;
- dropShadowVisible: true;
+ borderAlpha: 0.8;
+ borderColor: 0;
+ cornerRadius: 0;
+ dropShadowVisible: true;
*/
- skinClass: ClassReference("spark.skins.spark.TitleWindowSkin");
+ skinClass: ClassReference("spark.skins.spark.TitleWindowSkin");
}
ToggleButton
{
- skinClass: ClassReference("spark.skins.spark.ToggleButtonSkin");
+ skinClass: ClassReference("spark.skins.spark.ToggleButtonSkin");
+}
+
+ToolTip
+{
+ backgroundColor: #F8FACD;
+ borderAlpha: 0.15;
+ borderColor: #000000;
+ cornerRadius: 0;
+ dropShadowVisible: true;
+ fontSize: 10;
+ paddingBottom: 4;
+ paddingLeft: 5;
+ paddingRight: 5;
+ paddingTop: 6;
+ skinClass: ClassReference("spark.skins.spark.ToolTipSkin");
}
VideoDisplay
Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/SparkClasses.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/SparkClasses.as?rev=1370028&r1=1370027&r2=1370028&view=diff
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/SparkClasses.as (original)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/SparkClasses.as Mon Aug 6 21:25:54 2012
@@ -34,17 +34,28 @@ internal class SparkClasses
import mx.controls.dataGridClasses.FTEDataGridItemRenderer; FTEDataGridItemRenderer;
import mx.controls.MXFTETextInput; MXFTETextInput;
import mx.core.UIFTETextField; UIFTETextField;
+
+import spark.collections.SubListView; SubListView; // temporary until DataGrid depends on this class
+import spark.components.gridClasses.GridDimensionsView; // ..
+
+import spark.core.ContainerDestructionPolicy; ContainerDestructionPolicy;
import spark.core.ContentCache; ContentCache;
import spark.core.IDisplayText; IDisplayText;
import spark.core.IEditableText; IEditableText;
import spark.core.SpriteVisualElement; SpriteVisualElement;
import spark.collections.OnDemandDataProvider; OnDemandDataProvider;
import spark.components.IconPlacement; IconPlacement;
+import spark.components.calendarClasses.DateRange; DateRange;
+import spark.components.calendarClasses.DateItemRenderer; DateItemRenderer;
import spark.components.calendarClasses.DateSelectorDisplayMode; DateSelectorDisplayMode;
+import spark.components.calendarClasses.MonthArrayList; MonthArrayList;
import spark.components.gridClasses.CellPosition; CellPosition;
import spark.components.gridClasses.CellRegion; CellRegion;
-import spark.components.supportClasses.ListItemDragProxy; ListItemDragProxy;
+import spark.components.gridClasses.DataGridDragProxy; DataGridDragProxy;
import spark.components.supportClasses.InteractionStateDetector; InteractionStateDetector;
+import spark.components.supportClasses.HorizontalAccordionLayout; HorizontalAccordionLayout;
+import spark.components.supportClasses.ListItemDragProxy; ListItemDragProxy;
+import spark.components.supportClasses.VerticalAccordionLayout; VerticalAccordionLayout;
import spark.globalization.supportClasses.CalendarDate; CalendarDate;
import spark.globalization.supportClasses.DateTimeFormatterEx; DateTimeFormatterEx;
import spark.skins.spark.ApplicationSkin; ApplicationSkin;
@@ -59,6 +70,13 @@ import spark.skins.spark.CheckBoxSkin; C
import spark.skins.spark.ComboBoxButtonSkin; ComboBoxButtonSkin;
import spark.skins.spark.ComboBoxSkin; ComboBoxSkin;
import spark.skins.spark.ComboBoxTextInputSkin; ComboBoxTextInputSkin;
+import spark.skins.spark.DateChooserSkin; DateChooserSkin;
+import spark.skins.spark.DateChooserMonthDropDownListSkin; DateChooserMonthDropDownListSkin;
+import spark.skins.spark.DateChooserMonthDropDownListButtonSkin; DateChooserMonthDropDownListButtonSkin;
+import spark.skins.spark.DateChooserNextMonthButtonSkin; DateChooserNextMonthButtonSkin;
+import spark.skins.spark.DateChooserPreviousMonthButtonSkin; DateChooserPreviousMonthButtonSkin;
+import spark.skins.spark.DateChooserYearComboBoxSkin; DateChooserYearComboBoxSkin;
+import spark.skins.spark.DateChooserYearComboBoxButtonSkin; DateChooserYearComboBoxButtonSkin;
import spark.skins.spark.DataGridSkin; DataGridSkin;
import spark.skins.spark.DefaultButtonSkin; DefaultButtonSkin;
import spark.skins.spark.DefaultComplexItemRenderer; DefaultComplexItemRenderer;
@@ -72,6 +90,9 @@ import spark.skins.spark.FormHeadingSkin
import spark.skins.spark.FormItemSkin; FormItemSkin;
import spark.skins.spark.FormSkin; FormSkin;
import spark.skins.spark.FocusSkin; FocusSkin;
+import spark.skins.spark.HorizontalAccordionContentSkin; HorizontalAccordionContentSkin;
+import spark.skins.spark.HorizontalAccordionSkin; HorizontalAccordionSkin;
+import spark.skins.spark.HorizontalAccordionToggleButtonSkin; HorizontalAccordionToggleButtonSkin;
import spark.skins.spark.HScrollBarSkin; HScrollBarSkin;
import spark.skins.spark.HScrollBarThumbSkin; HScrollBarThumbSkin;
import spark.skins.spark.HSliderSkin; HSliderSkin;
@@ -108,7 +129,11 @@ import spark.skins.spark.TextInputSkin;
import spark.skins.spark.TitleWindowSkin; TitleWindowSkin;
import spark.skins.spark.TitleWindowCloseButtonSkin; TitleWindowCloseButtonSkin;
import spark.skins.spark.ToggleButtonSkin; ToggleButtonSkin;
+import spark.skins.spark.ToolTipSkin; ToolTipSkin;
import spark.skins.spark.UITextFieldGridItemRenderer; UITextFieldGridItemRenderer;
+import spark.skins.spark.VerticalAccordionContentSkin; VerticalAccordionContentSkin;
+import spark.skins.spark.VerticalAccordionSkin; VerticalAccordionSkin;
+import spark.skins.spark.VerticalAccordionToggleButtonSkin; VerticalAccordionToggleButtonSkin;
import spark.skins.spark.VideoPlayerSkin; VideoPlayerSkin;
import spark.skins.spark.VScrollBarSkin; VScrollBarSkin;
import spark.skins.spark.VScrollBarThumbSkin; VScrollBarThumbSkin;
Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/mx/core/UIFTETextField.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/mx/core/UIFTETextField.as?rev=1370028&r1=1370027&r2=1370028&view=diff
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/mx/core/UIFTETextField.as (original)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/mx/core/UIFTETextField.as Mon Aug 6 21:25:54 2012
@@ -48,6 +48,7 @@ import mx.styles.StyleProtoChain;
import mx.utils.NameUtil;
import mx.utils.StringUtil;
+import spark.managers.ToolTipManager;
import spark.utils.TextUtil;
use namespace mx_internal;
@@ -1815,8 +1816,48 @@ public class UIFTETextField extends FTET
var oldValue:String = _toolTip;
_toolTip = value;
- ToolTipManager.registerToolTip(this, oldValue, value);
+ mx.managers.ToolTipManager.registerToolTip(this, oldValue, value);
}
+
+ //----------------------------------
+ // toolTipData
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage for the toolTipData property.
+ */
+ private var _toolTipData:Object;
+
+ /**
+ * Arbitrary data to render in this component's ToolTip.
+ * This may be a String or any other object.
+ *
+ * @default null
+ *
+ * @langversion 3.0
+ * @playerversion Flash 11
+ * @playerversion AIR 3.0
+ * @productversion Flex 5
+ */
+ public function get toolTipData():Object
+ {
+ return _toolTipData;
+ }
+
+ /**
+ * @private
+ */
+ public function set toolTipData(value:Object):void
+ {
+ var previousToolTipData:Object = _toolTipData;
+ _toolTipData = value;
+
+ if (!previousToolTipData && _toolTipData)
+ spark.managers.ToolTipManager.registerTarget(this);
+ else if (previousToolTipData && !_toolTipData)
+ spark.managers.ToolTipManager.unregisterTarget(this);
+ }
//----------------------------------
// tweeningProperties
Modified: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/accessibility/RichEditableTextAccImpl.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/accessibility/RichEditableTextAccImpl.as?rev=1370028&r1=1370027&r2=1370028&view=diff
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/accessibility/RichEditableTextAccImpl.as (original)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/accessibility/RichEditableTextAccImpl.as Mon Aug 6 21:25:54 2012
@@ -24,10 +24,12 @@ import flash.accessibility.Accessibility
import flash.events.Event;
import flash.events.FocusEvent;
-import mx.accessibility.AccImpl;
import mx.accessibility.AccConst;
+import mx.accessibility.AccImpl;
import mx.core.UIComponent;
import mx.core.mx_internal;
+import mx.utils.StringUtil;
+
import spark.components.RichEditableText;
use namespace mx_internal;
@@ -313,7 +315,12 @@ public class RichEditableTextAccImpl ext
*/
override public function get_accValue(childID:uint):String
{
- return RichEditableText(master).text;
+ var richEditableText:RichEditableText = RichEditableText(master);
+ if (richEditableText.displayAsPassword)
+ {
+ return StringUtil.repeat("*", richEditableText.text.length);
+ }
+ return richEditableText.text;
}
/**
Added: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/IMutableTreeDataAdapter.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/IMutableTreeDataAdapter.as?rev=1370028&view=auto
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/IMutableTreeDataAdapter.as (added)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/IMutableTreeDataAdapter.as Mon Aug 6 21:25:54 2012
@@ -0,0 +1,95 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 spark.collections
+{
+
+/**
+ * Dispatched when the IMutableTreeDataAdapter has been updated in some way.
+ *
+ * @eventType spark.events.TreeDataAdapterChangeEvent.TREE_DATA_ADAPTER_CHANGE
+ *
+ * @langversion 3.0
+ * @playerversion Flash 11
+ * @playerversion AIR 3.0
+ * @productversion Flex 5
+ */
+[Event(name="treeDataAdapterChange", type="spark.events.TreeDataAdapterChangeEvent")]
+
+/**
+ * The IMutableTreeDataAdapter interface defines the required methods for
+ * manipulating the structure and nodes of a tree adapter.
+ * An implementation of IMutableTreeDataAdapter must also dispatch
+ * <code>TreeDataAdapterChangeEvents</code> to notify other components that the
+ * tree structure or underlying data has changed.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 11
+ * @playerversion AIR 3.0
+ * @productversion Flex 5
+ */
+public interface IMutableTreeDataAdapter extends ITreeDataAdapter
+{
+ /**
+ * Inserts the provided nodes as children of the parent node
+ * starting at the specified index.
+ *
+ * @param parent A tree adapter node.
+ *
+ * @param nodes The nodes to insert as children of the
+ * <code>parent</code>. If parent is null, the nodes are inserted
+ * as root nodes.
+ *
+ * @param index The index at which to insert the nodes.
+ *
+ * @throws RangeError if index is less than 0 or is greater than
+ * <code>getNodeChildrenCount(parent)</code>.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 11
+ * @playerversion AIR 3.0
+ * @productversion Flex 5
+ */
+ function addNodeChildrenAt(parent:Object, index:int, nodes:Vector.<Object>):void;
+
+ /**
+ * Removes <code>count</code> number of children nodes starting
+ * at the specified index.
+ * If <code>parent</code> is null, then removes <code>count</code>
+ * root nodes starting at the specified index.
+ *
+ * @param parent A tree adapter node.
+ *
+ * @param index The index at which to remove the children.
+ *
+ * @param count The number of children to remove from <code>parent</code>.
+ *
+ * @return A vector of the nodes that were removed.
+ *
+ * @throws RangeError if index is less than 0, or if index or index + count is
+ * greater than <code>getNodeChildrenCount(parent)</code>.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 11
+ * @playerversion AIR 3.0
+ * @productversion Flex 5
+ */
+ function removeNodeChildrenAt(parent:Object, index:int, count:int):Vector.<Object>;
+}
+}
\ No newline at end of file
Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/IMutableTreeDataAdapter.as
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/IMutableTreeDataAdapter.as
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/ITreeDataAdapter.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/ITreeDataAdapter.as?rev=1370028&view=auto
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/ITreeDataAdapter.as (added)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/ITreeDataAdapter.as Mon Aug 6 21:25:54 2012
@@ -0,0 +1,170 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 spark.collections
+{
+import flash.events.IEventDispatcher;
+
+/**
+ * Exposes an arbitrary data structure as a set of trees, where each tree
+ * node has a parent and an ordered set of children.
+ * ITreeDataAdapter implementations are intended to be used with the Spark Tree
+ * component.
+ *
+ * <p>The methods in this interface operate on Object type "nodes" associated
+ * with this tree adapter.
+ * This class "adapts" an existing data structure as a tree without requiring
+ * the data structure to implement or subclass a special type (like a tree or
+ * a tree node class).
+ * For example, an application with typed objects as data can use the Spark
+ * Tree with a custom tree adapter without modifying the object's type.
+ * One need not wrap the underlying data structure's nodes with a node type
+ * defined here.
+ * If the underlying data's nodes already have parent and children properties,
+ * the corresponding ITreeDataAdapter implementation only needs to provide access
+ * to each child node.</p>
+ *
+ * <p>This interface treats root nodes as any node with a null parent (i.e.
+ * <code>getNodeParent(node)</code> returns null).
+ * The root nodes of the tree should be accessed by passing in a null <code>parent</code>.
+ * For example, <code>getNodeChildrenCount(null)</code> will return the number of root nodes and
+ * <code>getNodeChildAt(null, index)</code> returns the root node at the specified index.</p>
+ *
+ * <p>Cycles are not permitted: each child node may only appear in only once in the tree.</p>
+ *
+ * <p>ITreeDataAdapter defines read-only operations on the nodes.
+ * Implementations may allow changing the structure of the tree, but the adapter should dispatch
+ * corresponding TreeDataAdapterChangeEvents when changes occur to notify dependent components.
+ * Some manipulation methods are defined by the IMutableTreeDataAdapter interface.
+ * These methods are the ones used by Flex components to change the tree's structure.</p>
+ *
+ * @langversion 3.0
+ * @playerversion Flash 11
+ * @playerversion AIR 3.0
+ * @productversion Flex 5
+ */
+public interface ITreeDataAdapter extends IEventDispatcher
+{
+ /**
+ * Returns the parent of the specified tree adapter node.
+ * Returns null if the specified node is a root node or null.
+ *
+ * @param node A tree adapter node.
+ *
+ * @return The parent of the specified node. Null, if the node is a root node
+ * or if the node is null.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 11
+ * @playerversion AIR 3.0
+ * @productversion Flex 5
+ */
+ function getNodeParent(node:Object):Object;
+
+ /**
+ * True if the type of the node is limited to being a leaf node, i.e. it
+ * will never have children.
+ * For example, if this adapter represented a file system, then files
+ * would be leaf nodes and directories, even empty directories, would not.
+ * If the node is null, this method returns false.
+ *
+ * @param node A tree adapter node.
+ *
+ * @return True if the node is a leaf node. If the node is null, returns false.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 11
+ * @playerversion AIR 3.0
+ * @productversion Flex 5
+ */
+ function isLeafNode(node:Object):Boolean;
+
+ /**
+ * Returns the number of children of the specified parent node.
+ * Returns the number of root nodes, if parent is null.
+ * Returns 0, if <code>isLeafNode(parent)</code> is true.
+ *
+ * @param parent A tree adapter node.
+ *
+ * @return The number of children of the parent node. The number of root
+ * nodes if parent is null. 0, if <code>isLeafNode(parent)</code> is true.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 11
+ * @playerversion AIR 3.0
+ * @productversion Flex 5
+ */
+ function getNodeChildrenCount(parent:Object):int;
+
+ /**
+ * Returns the zero-indexed position of the specified node
+ * within the context of its parent.
+ *
+ * @param node A tree adapter node.
+ *
+ * @return The zero-indexed position of the provided node, -1 if
+ * the node is invalid.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 11
+ * @playerversion AIR 3.0
+ * @productversion Flex 5
+ */
+ function getNodeChildIndex(node:Object):int;
+
+ /**
+ * Returns the child node at the specified position.
+ * If parent is null, returns the root node at the specified position.
+ * Throws a RangeError if the index is invalid.
+ *
+ * @param parent A tree adapter node. If null, a root node
+ * at the specified index will be returned.
+ *
+ * @param index The index in the children list from which to retrieve the node.
+ *
+ * @return The child node at the specified position. If parent is null, then
+ * this method returns the root node at the specified position.
+ *
+ * @throws RangeError if <code>index < 0</code> or <code>index >= length</code>.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 11
+ * @playerversion AIR 3.0
+ * @productversion Flex 5
+ */
+ function getNodeChildAt(parent:Object, index:int):Object;
+
+ /**
+ * Returns the number of parent ancestors between this node and a root node.
+ * The depth of a root node is 0.
+ * Returns -1, if the specified node is null.
+ *
+ * @param node A tree adapter node.
+ *
+ * @return The number of parent ancestors between this node and a root
+ * node, -1 if node doesn't have a root node ancestor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 11
+ * @playerversion AIR 3.0
+ * @productversion Flex 5
+ */
+ function getNodeDepth(node:Object):int;
+}
+}
\ No newline at end of file
Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/ITreeDataAdapter.as
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/ITreeDataAdapter.as
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/ObjectTreeDataAdapter.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/ObjectTreeDataAdapter.as?rev=1370028&view=auto
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/ObjectTreeDataAdapter.as (added)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/ObjectTreeDataAdapter.as Mon Aug 6 21:25:54 2012
@@ -0,0 +1,625 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+// FIXME (klin): Should replace childrenField with "childrenPath" using the IDataPath, or we
+// could add childrenFunction. Same with parentField.
+
+package spark.collections
+{
+import flash.events.Event;
+import flash.events.EventDispatcher;
+import flash.utils.Dictionary;
+
+import mx.events.PropertyChangeEvent;
+import mx.resources.IResourceManager;
+import mx.resources.ResourceManager;
+
+import spark.events.TreeDataAdapterChangeEvent;
+import spark.events.TreeDataAdapterChangeEventKind;
+
+//--------------------------------------
+// Events
+//--------------------------------------
+
+/**
+ * ObjectTreeDataAdapter will dispatch different kinds of TreeDataAdapterChangeEvents
+ * when changes occur.
+ * <code>TreeDataAdapterChangeEventKind.RESET</code> events are dispatched whenever the adapter
+ * fundamentally changes including changes to childrenField, parentField, or rootNodes.
+ * <code>TreeDataAdapterChangeEventKind.ADD</code> and
+ * <code>TreeDataAdapterChangeEventKind.REMOVE</code> events are dispatched when the adapter
+ * has nodes added or removed from it through <code>addNodeChildrenAt()</code>
+ * and <code>removeNodeChildrenAt()</code>.
+ *
+ * @eventType spark.events.TreeDataAdapterChangeEvent.TREE_DATA_ADAPTER_CHANGE
+ */
+[Event(name="treeDataAdapterChange", type="spark.events.TreeDataAdapterChangeEvent")]
+
+//--------------------------------------
+// Other metadata
+//--------------------------------------
+
+[DefaultProperty("rootNodes")]
+
+/**
+ * The ObjectTreeDataAdapter class provides tree API for Objects including getting
+ * the children and parent of an Object.
+ * The tree has a list of "root" Objects whose parent is null.
+ * Each object that has children must have a property with a name that matches the
+ * value of the <code>childrenField</code> property.
+ * The value of a branch's object <code>childrenField</code> must either be an
+ * Array or a Vector.
+ * By default, <code>childrenField</code> is "children".
+ *
+ * <p>ObjectTreeDataAdapter keeps track of each child's parent node.
+ * By default, the child to parent mapping is stored in an internal cache.
+ * If the objects from the source already have a references to their parent
+ * objects, setting the <code>parentField</code>property will make parent
+ * look-ups more efficient.
+ * This will also disable caching of the child to parent relationships.</p>
+ */
+public class ObjectTreeDataAdapter extends EventDispatcher implements IMutableTreeDataAdapter
+{
+ include "../core/Version.as";
+
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @param rootNodes A vector of root nodes to populate this tree.
+ * By default, this is null.
+ *
+ * @param childrenField The name of the property used to retrieve
+ * the children of a parent object. By default, this is "children".
+ *
+ * @param parentField The name of the property used to retrieve the
+ * parent of a node. By default, this is null.
+ */
+ public function ObjectTreeDataAdapter(rootNodes:Vector.<Object> = null,
+ childrenField:String = "children",
+ parentField:String = null)
+ {
+ super();
+ // set these without causing a RESET event.
+ _childrenField = childrenField;
+ _parentField = parentField;
+ this.rootNodes = rootNodes;
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Variables
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * A map of each child node to its parent.
+ * A root node is mapped to null.
+ * If parentMap is null, the caching behavior is disabled.
+ */
+ private var parentMap:Dictionary = new Dictionary(true);
+
+ /**
+ * A map of each node to its depth.
+ * A root node is mapped to 0.
+ */
+ private var depthMap:Dictionary = new Dictionary(true);
+
+ //--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // childrenField
+ //----------------------------------
+
+ private var _childrenField:String = "children";
+
+ [Bindable(event="childrenFieldChanged")]
+
+ /**
+ * The name of the property used to retrieve
+ * the list of children from each data node.
+ * The value of a branch's object <code>childrenField</code> must
+ * either be an Array or a Vector.
+ * Changing this property will dispatch a
+ * <code>TreeAdapterChangeEventKind.RESET</code> event.
+ *
+ * @default "children"
+ */
+ public function get childrenField():String
+ {
+ return _childrenField;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function set childrenField(value:String):void
+ {
+ if (_childrenField == value)
+ return;
+
+ _childrenField = value;
+
+ reset();
+ dispatchChangeEvent("childrenFieldChanged");
+ }
+
+ //----------------------------------
+ // parentField
+ //----------------------------------
+
+ private var _parentField:String = null;
+
+ [Bindable(event="parentField")]
+
+ /**
+ * The name of the property used to retrieve the parent of a data node.
+ * By default this property is null, and ObjectTreeDataAdapter stores the
+ * child to parent mapping in an internal cache.
+ * Setting this property will disable the caching behavior and can improve
+ * the efficiency of calculating the parent.
+ * Changing this property will dispatch a
+ * <code>TreeDataAdapterChangeEventKind.RESET</code> event.
+ *
+ * @default null
+ */
+ public function get parentField():String
+ {
+ return _parentField;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function set parentField(value:String):void
+ {
+ if (_parentField == value)
+ return;
+
+ _parentField = value;
+
+ reset();
+ dispatchChangeEvent("parentFieldChanged");
+ }
+
+ //----------------------------------
+ // rootNodes
+ //----------------------------------
+
+ private var _rootNodes:Vector.<Object> = new Vector.<Object>(0, true);
+
+ [Bindable("rootNodesChanged")]
+
+ /**
+ * The vector of objects that represents the root nodes of this tree.
+ * The adapter does not track changes to this vector.
+ * If any changes are made to this vector, the rootNodes property should
+ * be set again.
+ *
+ * @default An empty vector.
+ */
+ public function get rootNodes():Vector.<Object>
+ {
+ return _rootNodes.concat();
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function set rootNodes(value:Vector.<Object>):void
+ {
+ // Don't need to short-circuit, because if _rootNodes == value, we should get the new
+ // set of nodes anyway.
+ // Defensively copy the incoming value; tolerate null value
+ const valueCopy:Vector.<Object> = (value) ? value.concat() : new Vector.<Object>(0, true);
+
+ _rootNodes = valueCopy;
+
+ reset();
+ dispatchChangeEvent("rootNodesChanged");
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * Throws a RangeError if the index is invalid.
+ */
+ private function checkIndex(index:int, list:Object):void
+ {
+ if (index < 0 || index >= list.length)
+ {
+ var message:String = ResourceManager.getInstance().getString(
+ "collections", "outOfBounds", [ index ]);
+ throw new RangeError(message);
+ }
+ }
+
+ /**
+ * Helper function to dispatch change events only when someone's listening.
+ */
+ private function dispatchChangeEvent(type:String):void
+ {
+ if (hasEventListener(type))
+ dispatchEvent(new Event(type));
+ }
+
+ /**
+ * Helper function to dispatch TreeAdapterChangeEvents.
+ * Checks to see if anyone is listening first.
+ */
+ private function dispatchTreeDataAdapterChangeEvent(
+ kind:String,
+ nodes:Vector.<Object> = null,
+ index:int = -1,
+ parent:Object = null):void
+ {
+ if (hasEventListener(TreeDataAdapterChangeEvent.TREE_DATA_ADAPTER_CHANGE))
+ {
+ var e:TreeDataAdapterChangeEvent =
+ new TreeDataAdapterChangeEvent(
+ TreeDataAdapterChangeEvent.TREE_DATA_ADAPTER_CHANGE,
+ false, false,
+ kind, nodes,
+ index, parent);
+ dispatchEvent(e);
+ }
+ }
+
+ /**
+ * Depth-first search for the parent.
+ */
+ private function findParent(parent:Object, targetNode:Object):Object
+ {
+ if (isLeafNode(parent))
+ return null;
+
+ var children:Object = getChildren(parent);
+
+ // targetNode is an immediate child of this parent
+ if (ArrayVectorUtil.getItemIndex(children, targetNode) != -1)
+ {
+ parentMap[targetNode] = parent;
+ return parent;
+ }
+
+ // Recursively call findParent() on each child.
+ var childrenLength:int = children.length;
+ for (var i:int = 0; i < childrenLength; i++)
+ {
+ var child:Object = ArrayVectorUtil.getItemAt(children, i);
+ parentMap[child] = parent;
+ var p:Object = findParent(child, targetNode);
+ if (p)
+ return p;
+ }
+
+ return null;
+ }
+
+ /**
+ * Retrieves the set of children from the specified parent object.
+ * This return value could be either an Array or Vector, so ArrayVectorUtil
+ * should be used to perform operations on it.
+ */
+ private function getChildren(parent:Object):Object
+ {
+ // FIXME (klin): This method will be used to enable
+ // childrenFunction or childrenPath?...
+ if (!parent)
+ return _rootNodes;
+
+ return parent[childrenField];
+ }
+
+ /**
+ * Resets the parent and depth maps.
+ */
+ private function reset():void
+ {
+ parentMap = parentField ? null : new Dictionary(true);
+ depthMap = new Dictionary(true);
+
+ if (parentMap)
+ {
+ const roots:Vector.<Object> = _rootNodes;
+ const numRoots:int = roots.length;
+ for (var i:int = 0; i < numRoots; i++)
+ {
+ parentMap[roots[i]] = null;
+ }
+ }
+ dispatchTreeDataAdapterChangeEvent(TreeDataAdapterChangeEventKind.RESET);
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // ITreeDataAdapter Methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @inheritDoc
+ */
+ public function getNodeParent(node:Object):Object
+ {
+ if (!node)
+ return null;
+
+ // FIXME (klin): Should enable parentFunction or parentPath here.
+ if (!parentMap)
+ return node[parentField];
+
+ // If we haven't calculated the node's parent,
+ // search for it and build the cache along the way.
+ return (node in parentMap) ? parentMap[node] : findParent(null, node);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function isLeafNode(node:Object):Boolean
+ {
+ if (!node)
+ return false;
+
+ return !(childrenField in node) || (node[childrenField] == undefined);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getNodeChildrenCount(parent:Object):int
+ {
+ if (isLeafNode(parent))
+ return 0;
+
+ var children:Object = getChildren(parent);
+ return (children) ? children.length : 0;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getNodeChildIndex(node:Object):int
+ {
+ if (!node)
+ return -1;
+
+ var p:Object = getNodeParent(node);
+ return ArrayVectorUtil.getItemIndex(getChildren(p), node);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getNodeChildAt(parent:Object, index:int):Object
+ {
+ if (isLeafNode(parent))
+ return null;
+
+ var children:Object = getChildren(parent);
+ checkIndex(index, children);
+
+ var node:Object = ArrayVectorUtil.getItemAt(children, index);
+ // Store parent whenever getNodeChildAt() is called.
+ // 99% of the time, we never need to search for the node's parent.
+ if (parentMap)
+ parentMap[node] = parent;
+ return node;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getNodeDepth(node:Object):int
+ {
+ if (!node)
+ return -1;
+
+ if (node in depthMap)
+ return depthMap[node];
+
+ var p:Object = getNodeParent(node);
+ var depth:int = p ? getNodeDepth(p) + 1 : 0;
+ depthMap[node] = depth;
+ return depth;
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // IMutableDataTreeAdapter Methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @inheritDoc
+ */
+ public function addNodeChildrenAt(parent:Object, index:int, nodes:Vector.<Object>):void
+ {
+ if (isLeafNode(parent))
+ return;
+
+ var children:Object = getChildren(parent);
+
+ if (index < 0 || index > children.length)
+ {
+ var message:String = ResourceManager.getInstance().getString(
+ "collections", "outOfBounds", [ index ]);
+ throw new RangeError(message);
+ }
+
+ ArrayVectorUtil.insertItemsAt(children, index, nodes);
+
+ if (parentMap)
+ {
+ for each (var node:Object in nodes)
+ {
+ parentMap[node] = parent;
+ }
+ }
+
+ dispatchTreeDataAdapterChangeEvent(TreeDataAdapterChangeEventKind.ADD, nodes.concat(), index, parent);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function removeNodeChildrenAt(parent:Object, index:int, count:int):Vector.<Object>
+ {
+ if (isLeafNode(parent))
+ return null;
+
+ var children:Object = getChildren(parent);
+
+ checkIndex(index, children);
+
+ var removedNodes:Vector.<Object> = ArrayVectorUtil.removeItemsAt(children, index, count);
+
+ if (parentMap)
+ {
+ for each (var node:Object in removedNodes)
+ {
+ delete parentMap[node];
+ }
+ }
+
+ dispatchTreeDataAdapterChangeEvent(TreeDataAdapterChangeEventKind.REMOVE, removedNodes, index, parent);
+ return removedNodes;
+ }
+}
+}
+
+//--------------------------------------------------------------------------
+//
+// ArrayVectorUtil
+//
+//--------------------------------------------------------------------------
+
+/**
+ * Helper class to perform common operations on arrays and vectors of any type.
+ * Any errors that may be thrown are ignored.
+ */
+class ArrayVectorUtil
+{
+ /**
+ * Returns the 0-based index of the specified item
+ * in the source array or vector.
+ */
+ public static function getItemIndex(source:Object, item:Object):int
+ {
+ if (!source)
+ return -1;
+
+ try
+ {
+ return source.indexOf(item);
+ }
+ catch (e:Error)
+ {
+ }
+
+ return -1;
+ }
+
+ /**
+ * Returns the item at the specified index from
+ * the array or vector.
+ */
+ public static function getItemAt(source:Object, index:int):Object
+ {
+ if (!source)
+ return null;
+
+ try
+ {
+ return source[index];
+ }
+ catch (e:Error)
+ {
+ }
+
+ return null;
+ }
+
+ /**
+ * Inserts the specified items into the source array or vector.
+ */
+ public static function insertItemsAt(source:Object, index:int, items:Vector.<Object>):void
+ {
+ if (!source || !items || items.length < 1)
+ return;
+
+ try
+ {
+ const numItems:int = items.length;
+ const oldLength:int = source.length;
+ const endIndex:int = index + numItems;
+ source.length += numItems;
+
+ // shift existing elements down
+ for (var i:int = oldLength - 1; i >= index; i--)
+ source[i + numItems] = source[i];
+
+ // insert new elements
+ var j:int = 0;
+ for (i = index; i < endIndex; i++)
+ source[i] = items[j++];
+ }
+ catch (e:Error)
+ {
+ }
+ }
+
+ /**
+ * Removes the specified items from the source array or vector.
+ */
+ public static function removeItemsAt(source:Object, index:int, count:int):Vector.<Object>
+ {
+ if (!source || count < 1)
+ return new Vector.<Object>(0, true);
+
+ try
+ {
+ var removedItems:Object = source.splice(index, count);
+ var rVec:Vector.<Object> = new Vector.<Object>(count);
+ for (var i:int = 0; i < count; i++)
+ {
+ rVec[i] = removedItems[i];
+ }
+ }
+ catch (e:Error)
+ {
+ }
+
+ return rVec;
+ }
+}
\ No newline at end of file
Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/ObjectTreeDataAdapter.as
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/ObjectTreeDataAdapter.as
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/SubListView.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/SubListView.as?rev=1370028&view=auto
==============================================================================
--- incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/SubListView.as (added)
+++ incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/SubListView.as Mon Aug 6 21:25:54 2012
@@ -0,0 +1,405 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 spark.collections
+{
+import flash.events.Event;
+import flash.events.EventDispatcher;
+
+import mx.collections.IList;
+import mx.events.CollectionEvent;
+import mx.events.CollectionEventKind;
+
+[ExcludeClass]
+
+/**
+ * A "view" of a contiguous IList interval that begins at startIndex and extends for count items.
+ *
+ * The list item index parameter for IList methods like getItemAt(index) are defined relative to
+ * this SubListView. For example the SubListView definition of getItemAt(0) is defined as
+ * list.getItemAt(startIndex). Similarly returned index values and the location CollectionEvent
+ * property are defined relative to the SubListView. In all other respects paraters, return values,
+ * and events, have the same semantics as defined for IList.
+ *
+ * This class is internal to the Grid implementation.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 11
+ * @playerversion AIR 3
+ * @productversion Flex 5.0*
+ */
+public class SubListView extends EventDispatcher implements IList
+{
+ /**
+ * Construct a SubListView and optionally specify the target list and the item interval
+ * this SubListView spans.
+ */
+ public function SubListView(list:IList = null, startIndex:int = 0, count:int = -1)
+ {
+ super();
+ this.list = list;
+ this.startIndex = startIndex;
+ this.count = count;
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ private function dispatchChangeEvent(type:String):void
+ {
+ if (hasEventListener(type))
+ dispatchEvent(new Event(type));
+ }
+
+ /**
+ * @private
+ */
+ private function dispatchCollectionResetEvent():void
+ {
+ if (hasEventListener(CollectionEvent.COLLECTION_CHANGE))
+ dispatchEvent(new CollectionEvent(CollectionEvent.COLLECTION_CHANGE, false, false, CollectionEventKind.RESET));
+ }
+
+ //----------------------------------
+ // list
+ //----------------------------------
+
+ private var _list:IList;
+
+ [Inspectable(category="General")]
+ [Bindable("listChanged")]
+
+ /**
+ * The IList to which all of IList methods are delegated.
+ *
+ * <p>If this property is null, the IList mutation methods, such as <code>setItemAt()</code>,
+ * are no-ops. The IList query methods, such <code>getItemAt()</code>, return null
+ * or zero (-1 for <code>getItemIndex()</code>), as appropriate.</p>
+ *
+ * @default null
+ */
+ public function get list():IList
+ {
+ return _list;
+ }
+
+ /**
+ * @private
+ */
+ public function set list(value:IList):void
+ {
+ if (_list == value)
+ return;
+
+ if (_list)
+ _list.removeEventListener(CollectionEvent.COLLECTION_CHANGE, handleCollectionChangeEvent);
+ _list = value;
+ if (_list)
+ _list.addEventListener(CollectionEvent.COLLECTION_CHANGE, handleCollectionChangeEvent, false, 0, true);
+
+ dispatchChangeEvent("listChanged");
+ dispatchCollectionResetEvent();
+ }
+
+ //----------------------------------
+ // startIndex
+ //----------------------------------
+
+ private var _startIndex:int = 0; // Typically this value is >= 0
+
+ [Inspectable(category="General")]
+ [Bindable("startIndexChanged")]
+
+ /**
+ * The index of the first list item included by this SubListView.
+ *
+ * @default 0
+ */
+ public function get startIndex():int
+ {
+ return _startIndex;
+ }
+
+ /**
+ * @private
+ */
+ public function set startIndex(value:int):void
+ {
+ if (_startIndex == value)
+ return;
+
+ _startIndex = value;
+
+ dispatchChangeEvent("startIndexChanged");
+ dispatchCollectionResetEvent();
+ }
+
+ //----------------------------------
+ // count
+ //----------------------------------
+
+ private var _count:int = -1;
+
+ [Inspectable(category="General")]
+ [Bindable("countChanged")]
+
+ /**
+ * The number of items to be included in this SubListView or -1, which means
+ * that all items, beginning with the one at startIndex, are to be included.
+ *
+ * @default -1
+ */
+ public function get count():int
+ {
+ return _count;
+ }
+
+ /**
+ * @private
+ */
+ public function set count(value:int):void
+ {
+ if (_count == value)
+ return;
+
+ _count = value;
+
+ dispatchChangeEvent("countChanged");
+ dispatchCollectionResetEvent();
+ }
+
+
+ //--------------------------------------------------------------------------
+ //
+ // CollectionEvent.COLLECTION_CHANGE Handlers
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ * All "collectionChange" events are redispatched to the SubListView listeners.
+ */
+ private function handleCollectionChangeEvent(event:CollectionEvent):void
+ {
+ var viewEvent:CollectionEvent = null;
+ var location:int = event.location;
+
+ switch (event.kind)
+ {
+ case CollectionEventKind.ADD:
+ case CollectionEventKind.REMOVE:
+ {
+ viewEvent = handleModifyCollectionChangeEvent(event);
+ break;
+ }
+
+ case CollectionEventKind.REPLACE:
+ case CollectionEventKind.UPDATE:
+ {
+ viewEvent = handleUpdateCollectionChangeEvent(event);
+ break;
+ }
+
+ case CollectionEventKind.MOVE:
+ {
+ // TBD: may require synthesizing add and/or remove events
+ break;
+ }
+
+ default: // refresh, reset, null
+ {
+ viewEvent = event;
+ break;
+ }
+ }
+
+ if (viewEvent)
+ dispatchEvent(viewEvent);
+ }
+
+ /**
+ * @private
+ */
+ private function createCollectionEvent(kind:String):CollectionEvent
+ {
+ return new CollectionEvent(CollectionEvent.COLLECTION_CHANGE, false, false, kind);
+ }
+
+ /**
+ * @private
+ * This method is called after (the underlying) list has been modified via add/remove.
+ *
+ * The incoming event.location is the list modification start point, event.items is the
+ * array of items that were inserted/removed/replaced.
+ *
+ * Returned event (if any) is a refresh if the insert was "to the left of" this SubListView,
+ * or a potentially truncated version of the insert was within the SubListView.
+ */
+ private function handleModifyCollectionChangeEvent(event:CollectionEvent):CollectionEvent
+ {
+ const viewEnd:int = startIndex + length;
+
+ // is "to the right of" the SubListView
+
+ if (event.location >= viewEnd)
+ return null;
+
+ // Insert is "to the left of" the SubListView; entire SubListView shifts
+
+ if (event.location <= startIndex)
+ return createCollectionEvent(CollectionEventKind.REFRESH);
+
+ // Insert is within the SubListView
+
+ const viewEvent:CollectionEvent = createCollectionEvent(event.kind);
+ viewEvent.location = event.location - startIndex;
+
+ const items:Array = new Array();
+ viewEvent.items = items;
+
+ var location:int = event.location;
+ for each (var item:Object in event.items)
+ {
+ items.push(item);
+ if (location++ >= viewEnd)
+ break;
+ }
+
+ return viewEvent;
+ }
+
+ /**
+ * @private
+ * This method is called after (the underlying) list has been modified via update/replace.
+ * This case is different than add/remove because the item locations do not change.
+ *
+ * The incoming event.location is the list modification start point, event.items is the
+ * array of PropertyChangeEvents that characterize the old and new item values.
+ *
+ */
+ private function handleUpdateCollectionChangeEvent(event:CollectionEvent):CollectionEvent
+ {
+ const viewEnd:int = startIndex + length;
+
+ // Update/replace doesn't overlap this SubListView
+
+ if (((event.location + event.items.length) < startIndex) || (event.location >= viewEnd))
+ return null;
+
+ const viewEvent:CollectionEvent = createCollectionEvent(event.kind);
+ var viewLocation:int = Math.max(startIndex, event.location);
+ viewEvent.location = viewLocation - startIndex;
+
+ const items:Array = new Array();
+ viewEvent.items = items;
+
+ for each (var item:Object in event.items)
+ {
+ items.push(item);
+ if (viewLocation++ >= viewEnd)
+ break;
+ }
+
+ return viewEvent;
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // IList Implementation
+ //
+ //--------------------------------------------------------------------------
+
+ [Bindable("collectionChange")]
+
+ public function get length():int
+ {
+ if (count == -1)
+ return (list) ? list.length - startIndex : 0;
+
+ return count;
+ }
+
+ public function addItem(item:Object):void
+ {
+ if (list)
+ list.addItem(item);
+ }
+
+ public function addItemAt(item:Object, index:int):void
+ {
+ if (list)
+ list.addItemAt(item, index + startIndex);
+ }
+
+ public function getItemAt(index:int, prefetch:int=0):Object
+ {
+ return (list) ? list.getItemAt(index + startIndex, prefetch) : null;
+ }
+
+ public function getItemIndex(item:Object):int
+ {
+ if (!list || (count == 0))
+ return -1;
+
+ const index:int = list.getItemIndex(item);
+ return ((index < startIndex) || (index >= (startIndex + length))) ? -1 : index - startIndex;
+ }
+
+ public function itemUpdated(item:Object, property:Object=null, oldValue:Object=null, newValue:Object=null):void
+ {
+ if (list)
+ list.itemUpdated(item, property, oldValue, newValue);
+ }
+
+ public function removeAll():void
+ {
+ if (list)
+ list.removeAll();
+ }
+
+ public function removeItemAt(index:int):Object
+ {
+ return (list) ? list.removeItemAt(startIndex + index) : null;
+ }
+
+ public function setItemAt(item:Object, index:int):Object
+ {
+ return (list) ? list.setItemAt(item, startIndex + index) : null;
+ }
+
+ public function toArray():Array
+ {
+ if (!list)
+ return [];
+
+ const a:Array = new Array(length);
+ const aCount:int = Math.min(a.length, list.length - startIndex);
+ for(var i:int = 0; i < aCount; i++)
+ a[i] = list.getItemAt(i + startIndex);
+ return a;
+ }
+
+}
+}
Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/SubListView.as
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/flex/whiteboard/cframpton/adobe.next/frameworks/projects/spark/src/spark/collections/SubListView.as
------------------------------------------------------------------------------
svn:mime-type = text/plain