├── Icon.png
├── .gitignore
├── bin
└── flex-extensions.swc
├── lib
├── Degrafa_Beta3.2_Flex3.swc
└── hamcrest-as3-flex-1.1.3.swc
├── src
├── asset
│ ├── image
│ │ ├── cursor
│ │ │ ├── grab.png
│ │ │ ├── grabbing.png
│ │ │ ├── zoom-in.png
│ │ │ ├── zoom-out.png
│ │ │ ├── resize-row.png
│ │ │ ├── resize-column.png
│ │ │ └── CursorAsset.as
│ │ └── search
│ │ │ ├── busy.png
│ │ │ ├── search.png
│ │ │ ├── clearSearch.png
│ │ │ └── SearchAsset.as
│ └── skin
│ │ └── slider
│ │ ├── grip-pattern.png
│ │ ├── BackgroundSkin.mxml
│ │ └── HandleSkin.mxml
├── com
│ └── codecatalyst
│ │ ├── component
│ │ ├── behavior
│ │ │ ├── ui
│ │ │ │ ├── swap
│ │ │ │ │ ├── assets
│ │ │ │ │ │ └── swapMode.gif
│ │ │ │ │ └── events
│ │ │ │ │ │ └── SwapperEvent.as
│ │ │ │ └── events
│ │ │ │ │ └── ContentEvent.as
│ │ │ ├── IBehavior.as
│ │ │ └── AbstractBehavior.as
│ │ ├── renderer
│ │ │ ├── IContainerItemRenderer.as
│ │ │ └── IItemRenderer.as
│ │ ├── template
│ │ │ ├── Group.mxml
│ │ │ ├── RadioGroup.mxml
│ │ │ └── CheckGroup.mxml
│ │ ├── TabBar.as
│ │ ├── container
│ │ │ └── BoxFrame.as
│ │ ├── chart
│ │ │ ├── control
│ │ │ │ ├── ChartHoverCrosshairControl.as
│ │ │ │ ├── ChartHoverEvent.as
│ │ │ │ ├── ChartPanEvent.as
│ │ │ │ └── ChartZoomEvent.as
│ │ │ ├── DynamicAxisRenderer.as
│ │ │ ├── TruncatedAxisLabelRenderer.as
│ │ │ ├── element
│ │ │ │ ├── Background.as
│ │ │ │ ├── AbstractCartesianSeriesAnnotation.as
│ │ │ │ ├── AbstractDateTimeAxisAnnotation.as
│ │ │ │ └── DateTimeGridLineSet.as
│ │ │ └── DynamicChart.as
│ │ ├── Button.as
│ │ ├── date
│ │ │ └── DateRangeSliderEvent.as
│ │ ├── Tab.as
│ │ └── text
│ │ │ ├── Text.as
│ │ │ └── Label.as
│ │ ├── data
│ │ ├── enumeration
│ │ │ ├── IEnumeration.as
│ │ │ ├── AbstractEnumeration.as
│ │ │ └── AbstractLabeledEnumeration.as
│ │ ├── Option.as
│ │ ├── FrequencyBin.as
│ │ ├── Property.as
│ │ └── SampleSet.as
│ │ ├── util
│ │ ├── MouseUtil.as
│ │ ├── RandomUtil.as
│ │ ├── persistence
│ │ │ ├── IKeyValueStore.as
│ │ │ └── KeyValueStoreAdapter.as
│ │ ├── invalidation
│ │ │ ├── InvalidationFlags.as
│ │ │ └── mxml
│ │ │ │ └── InvalidationTracker.as
│ │ ├── IObjectPool.as
│ │ ├── MetadataUtil.as
│ │ ├── LogicUtil.as
│ │ ├── StringInflectionUtil.as
│ │ ├── EventDispatcherUtil.as
│ │ ├── FormatUtil.as
│ │ ├── GraphicsUtil.as
│ │ ├── NumberUtil.as
│ │ ├── RuntimeEvaluationUtil.as
│ │ ├── RectangleUtil.as
│ │ ├── ImageUtil.as
│ │ ├── SkinUtil.as
│ │ ├── AsyncTokenUtil.as
│ │ ├── ClassUtil.as
│ │ ├── CollectionViewUtil.as
│ │ ├── DelayedCall.as
│ │ ├── DisplayObjectContainerUtil.as
│ │ ├── FactoryPool.as
│ │ ├── BitmapDataUtil.as
│ │ ├── StyleUtil.as
│ │ └── IterableUtil.as
│ │ └── spark
│ │ └── AnimatedNumericLabel.mxml
├── utils
│ ├── number
│ │ └── clamp.as
│ └── display
│ │ └── bringToFront.as
├── metadata.xml
├── qs
│ ├── charts
│ │ ├── DashedAreaRenderer.as
│ │ └── DashedLineRenderer.as
│ └── utils
│ │ └── GraphicsUtils.as
├── manifest.xml
└── design.xml
├── .project
├── misc
└── SourceMateMetadataConfig.xml
└── .actionScriptProperties
/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CC-Archived/flex-extensions/HEAD/Icon.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
3 | .settings
4 | bin-debug
5 | html-template
6 |
7 | /bin/flex-extensions.swc Folder/
--------------------------------------------------------------------------------
/bin/flex-extensions.swc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CC-Archived/flex-extensions/HEAD/bin/flex-extensions.swc
--------------------------------------------------------------------------------
/lib/Degrafa_Beta3.2_Flex3.swc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CC-Archived/flex-extensions/HEAD/lib/Degrafa_Beta3.2_Flex3.swc
--------------------------------------------------------------------------------
/lib/hamcrest-as3-flex-1.1.3.swc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CC-Archived/flex-extensions/HEAD/lib/hamcrest-as3-flex-1.1.3.swc
--------------------------------------------------------------------------------
/src/asset/image/cursor/grab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CC-Archived/flex-extensions/HEAD/src/asset/image/cursor/grab.png
--------------------------------------------------------------------------------
/src/asset/image/search/busy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CC-Archived/flex-extensions/HEAD/src/asset/image/search/busy.png
--------------------------------------------------------------------------------
/src/asset/image/cursor/grabbing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CC-Archived/flex-extensions/HEAD/src/asset/image/cursor/grabbing.png
--------------------------------------------------------------------------------
/src/asset/image/cursor/zoom-in.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CC-Archived/flex-extensions/HEAD/src/asset/image/cursor/zoom-in.png
--------------------------------------------------------------------------------
/src/asset/image/cursor/zoom-out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CC-Archived/flex-extensions/HEAD/src/asset/image/cursor/zoom-out.png
--------------------------------------------------------------------------------
/src/asset/image/search/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CC-Archived/flex-extensions/HEAD/src/asset/image/search/search.png
--------------------------------------------------------------------------------
/src/asset/image/cursor/resize-row.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CC-Archived/flex-extensions/HEAD/src/asset/image/cursor/resize-row.png
--------------------------------------------------------------------------------
/src/asset/image/cursor/resize-column.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CC-Archived/flex-extensions/HEAD/src/asset/image/cursor/resize-column.png
--------------------------------------------------------------------------------
/src/asset/image/search/clearSearch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CC-Archived/flex-extensions/HEAD/src/asset/image/search/clearSearch.png
--------------------------------------------------------------------------------
/src/asset/skin/slider/grip-pattern.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CC-Archived/flex-extensions/HEAD/src/asset/skin/slider/grip-pattern.png
--------------------------------------------------------------------------------
/src/com/codecatalyst/component/behavior/ui/swap/assets/swapMode.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CC-Archived/flex-extensions/HEAD/src/com/codecatalyst/component/behavior/ui/swap/assets/swapMode.gif
--------------------------------------------------------------------------------
/src/com/codecatalyst/data/enumeration/IEnumeration.as:
--------------------------------------------------------------------------------
1 | package com.codecatalyst.data.enumeration
2 | {
3 | import flash.utils.Dictionary;
4 |
5 | /**
6 | * Interface that describes an enumerated type.
7 | */
8 | public interface IEnumeration
9 | {
10 | function get id():*;
11 | }
12 | }
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
id property.
6 | */
7 | public class AbstractEnumeration
8 | {
9 | // ========================================
10 | // Public properties
11 | // ========================================
12 |
13 | /**
14 | * Unique identifier.
15 | */
16 | public function get id():*
17 | {
18 | return _id;
19 | }
20 |
21 | // ========================================
22 | // Protected properties
23 | // ========================================
24 |
25 | /**
26 | * Backing variable for id.
27 | */
28 | protected var _id:* = null;
29 |
30 | // ========================================
31 | // Constructor
32 | // ========================================
33 |
34 | /**
35 | * Constructor.
36 | */
37 | public function AbstractEnumeration( id:String )
38 | {
39 | super();
40 |
41 | _id = id;
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/src/utils/display/bringToFront.as:
--------------------------------------------------------------------------------
1 | package utils.display
2 | {
3 | import flash.display.DisplayObject;
4 |
5 | import utils.number.clamp;
6 |
7 | /**
8 | * Brings the DisplayObject to the front of the display list. The back parameter can be used to pull the DisplayObject back a few levels from the front.
9 | * @param object the DisplayObject to reorder
10 | * @param back the number of levels from the front of the display list
11 | * @return the new index of the DisplayObject
12 | */
13 | public function bringToFront(object:DisplayObject, back:uint = 0):int
14 | {
15 | if (!object.parent) return -1;
16 |
17 | // Is this a Spark Container (with completely screwed up layer management) !?
18 |
19 | var spark : Boolean = object.parent.hasOwnProperty("setElementIndex");
20 |
21 | var invoke: Function = spark ? object.parent["setElementIndex"] : object.parent["setChildIndex"];
22 | var total : int = spark ? object.parent["numElements"] : object.parent["numChildren"];
23 | var index : int = total - (back + 1);
24 |
25 | index = clamp(index, 0, total - 1);
26 | invoke(object, index);
27 |
28 | return index;
29 | }
30 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/data/enumeration/AbstractLabeledEnumeration.as:
--------------------------------------------------------------------------------
1 | package com.codecatalyst.data.enumeration
2 | {
3 | [Bindable]
4 | /**
5 | * An abstract implementation of an enumerated type where each element has an immutable id and displayLabel property.
6 | */
7 | public class AbstractLabeledEnumeration extends AbstractEnumeration
8 | {
9 | // ========================================
10 | // Public properties
11 | // ========================================
12 |
13 | /**
14 | * Display label.
15 | */
16 | public function get displayLabel():String
17 | {
18 | return _displayLabel;
19 | }
20 |
21 | // ========================================
22 | // Public properties
23 | // ========================================
24 |
25 | /**
26 | * Backing variable for displayLabel.
27 | */
28 | protected var _displayLabel:String = null;
29 |
30 | // ========================================
31 | // Constructor
32 | // ========================================
33 |
34 | /**
35 | * Constructor.
36 | */
37 | public function AbstractLabeledEnumeration( id:String, displayLabel:String )
38 | {
39 | super( id );
40 |
41 | _displayLabel = displayLabel;
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/src/qs/charts/DashedAreaRenderer.as:
--------------------------------------------------------------------------------
1 | package qs.charts
2 | {
3 | import mx.charts.renderers.AreaRenderer;
4 | import mx.graphics.IStroke;
5 |
6 | import qs.utils.GraphicsUtils;
7 |
8 | public class DashedAreaRenderer extends AreaRenderer
9 | {
10 | /**
11 | * Backing variable for pattern property.
12 | *
13 | * @see #pattern
14 | */
15 | protected var _pattern:Array = [ 15 ];
16 |
17 | /**
18 | * Constructor.
19 | */
20 | public function DashedAreaRenderer()
21 | {
22 | super();
23 | }
24 |
25 | /**
26 | * Dash pattern.
27 | */
28 | public function set pattern( value:Array ):void
29 | {
30 | _pattern = value;
31 |
32 | invalidateDisplayList();
33 | }
34 | public function get pattern():Array
35 | {
36 | return _pattern;
37 | }
38 |
39 | /**
40 | * @inheritDoc
41 | */
42 | override public function getStyle( styleProp:String ):*
43 | {
44 | if ( styleProp == "areaStroke" )
45 | return null;
46 |
47 | return super.getStyle( styleProp );
48 | }
49 |
50 | /**
51 | * @inheritDoc
52 | */
53 | override protected function updateDisplayList( unscaledWidth:Number, unscaledHeight:Number ):void
54 | {
55 | super.updateDisplayList( unscaledWidth, unscaledHeight );
56 |
57 | var stroke:IStroke = super.getStyle( "areaStroke" );
58 |
59 | var boundary:Array = data.filteredCache;
60 | if (boundary.length == 0)
61 | return;
62 |
63 | GraphicsUtils.drawDashedPolyLine( graphics, stroke, pattern, boundary );
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/component/renderer/IContainerItemRenderer.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2008 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.component.renderer
24 | {
25 | import mx.core.IContainer;
26 |
27 | public interface IContainerItemRenderer extends IContainer, IItemRenderer
28 | {
29 | }
30 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/component/behavior/IBehavior.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2010 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.component.behavior
24 | {
25 | import flash.events.IEventDispatcher;
26 |
27 | import mx.core.IMXMLObject;
28 |
29 | public interface IBehavior extends IMXMLObject, IEventDispatcher
30 | {
31 | }
32 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/util/RandomUtil.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2009 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.util
24 | {
25 | public class RandomUtil
26 | {
27 | // ========================================
28 | // Public Methods
29 | // ========================================
30 |
31 | /**
32 | * Returns a random number between the two numbers specified.
33 | *
34 | * NOTE: The difference between 'a' and 'b' must be less than or equal to Math.MAX_VALUE.
35 | */
36 | public static function between( a:Number, b:Number ):Number
37 | {
38 | return ( a + ( Math.random() * ( b - a ) ) );
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/util/persistence/IKeyValueStore.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2011 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.util.persistence
24 | {
25 | /**
26 | * Interface describing a key value store.
27 | *
28 | * @author John Yanarella
29 | */
30 | public interface IKeyValueStore
31 | {
32 | // ========================================
33 | // Methods
34 | // ========================================
35 |
36 | /**
37 | * Get the value for the specified key.
38 | */
39 | function getValue( key:String ):Object;
40 |
41 | /**
42 | * Set the value for the specified key.
43 | */
44 | function setValue( key:String, value:Object ):void;
45 | }
46 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/util/invalidation/InvalidationFlags.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2011 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.util.invalidation
24 | {
25 | [ExcludeClass]
26 | public class InvalidationFlags
27 | {
28 | // ========================================
29 | // Public constants
30 | // ========================================
31 |
32 | /**
33 | * None.
34 | */
35 | public static const NONE:uint = 0;
36 |
37 | /**
38 | * Display list.
39 | */
40 | public static const DISPLAY_LIST:uint = 1;
41 |
42 | /**
43 | * Properties.
44 | */
45 | public static const PROPERTIES:uint = 2;
46 |
47 | /**
48 | * Size.
49 | */
50 | public static const SIZE:uint = 4;
51 | }
52 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/util/IObjectPool.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2010 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.util
24 | {
25 | public interface IObjectPool
26 | {
27 | // ========================================
28 | // Methods
29 | // ========================================
30 |
31 | /**
32 | * Acquire an instance (either new, or from the pool).
33 | */
34 | function acquireInstance():*
35 |
36 | /**
37 | * Release the specified instance back to the pool.
38 | */
39 | function releaseInstance( instance:* ):void
40 |
41 | /**
42 | * Resets this object pool.
43 | *
44 | * NOTE: Items previously requested from this pool will no longer be releaseable to it.
45 | */
46 | function reset():void
47 | }
48 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/component/template/Group.mxml:
--------------------------------------------------------------------------------
1 |
2 | singular or plural String based on count.
35 | *
36 | * @example
37 | * label property.
36 | *
37 | * @see #label
38 | */
39 | protected var _label:String = null;
40 |
41 | /**
42 | * Backing variable for value property.
43 | *
44 | * @see #value
45 | */
46 | protected var _value:* = null;
47 |
48 | // ========================================
49 | // Public properties
50 | // ========================================
51 |
52 | [Bindable("labelChanged")]
53 | /**
54 | * Display label.
55 | */
56 | public function get label():String
57 | {
58 | return _label;
59 | }
60 |
61 | [Bindable("valueChanged")]
62 | /**
63 | * Associated value.
64 | */
65 | public function get value():*
66 | {
67 | return _value;
68 | }
69 |
70 | // ========================================
71 | // Constructor
72 | // ========================================
73 |
74 | /**
75 | * Constructor.
76 | */
77 | public function Option( label:String, value:* )
78 | {
79 | super();
80 |
81 | _label = label;
82 | _value = value;
83 | }
84 | }
85 | }
--------------------------------------------------------------------------------
/src/asset/skin/slider/HandleSkin.mxml:
--------------------------------------------------------------------------------
1 |
2 | range property.
33 | *
34 | * @see #range
35 | */
36 | protected var _range:NumericRange;
37 |
38 | /**
39 | * Backing variable for frequency property.
40 | *
41 | * @see #frequency
42 | */
43 | protected var _frequency:Number;
44 |
45 | /**
46 | * Backing variable for percentage property.
47 | *
48 | * @see #percentage
49 | */
50 | protected var _percentage:Number;
51 |
52 | // ========================================
53 | // Public properties
54 | // ========================================
55 |
56 | [Bindable("maximumChanged")]
57 | /**
58 | * Sample range.
59 | */
60 | public function get range():NumericRange
61 | {
62 | return _range;
63 | }
64 |
65 | [Bindable("frequencyChanged")]
66 | /**
67 | * Sample frequency for range.
68 | */
69 | public function get frequency():Number
70 | {
71 | return _frequency;
72 | }
73 |
74 | /**
75 | * Sample frequency percentage.
76 | */
77 | public function get percentage():Number
78 | {
79 | return _percentage;
80 | }
81 |
82 | // ========================================
83 | // Constructor
84 | // ========================================
85 |
86 | /**
87 | * Constructor.
88 | */
89 | public function FrequencyBin( range:NumericRange, frequency:Number, percentage:Number )
90 | {
91 | super();
92 |
93 | _range = range;
94 | _frequency = frequency;
95 | _percentage = percentage;
96 | }
97 | }
98 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/util/RuntimeEvaluationUtil.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2011 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.util
24 | {
25 | import com.codecatalyst.data.Property;
26 |
27 | public class RuntimeEvaluationUtil
28 | {
29 | // ========================================
30 | // Public methods
31 | // ========================================
32 |
33 | /**
34 | * Evaluates the specified value against the specified object instance.
35 | *
36 | * If the specified value is a String, it is evaluated as a potential property path in 'dot notation' and the corresponding instance value is returned.
37 | * If the specified value is a Function, it is called with the object instance (or evaluated callback field) as a parameter and its result is returned.
38 | * Otherwise the value is returned unaltered.
39 | *
40 | * @param instance Target object instance.
41 | * @param value String - potentially specifying a property path in 'dot notation', Function callback or standalone value.
42 | * @param callbackField Optional field to evaluate and pass to the callback function.
43 | *
44 | * @return The evaluated value.
45 | */
46 | public static function evaluate( instance:*, value:*, callbackField:String = null ):*
47 | {
48 | if ( value is String )
49 | {
50 | var property:Property = new Property( value as String );
51 |
52 | return property.exists( instance ) ? property.getValue( instance ) : value;
53 | }
54 | else if ( value is Function )
55 | {
56 | var callback:Function = value as Function;
57 |
58 | if ( callbackField )
59 | {
60 | var callbackProperty:Property = new Property( callbackField );
61 |
62 | return callback( callbackProperty.getValue( instance ) );
63 | }
64 | else
65 | {
66 | return callback( instance );
67 | }
68 | }
69 | else
70 | {
71 | return value;
72 | }
73 | }
74 | }
75 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/component/chart/control/ChartZoomEvent.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2010 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.component.chart.control
24 | {
25 | import flash.events.Event;
26 | import flash.geom.Point;
27 | import flash.geom.Rectangle;
28 |
29 | public class ChartZoomEvent extends Event
30 | {
31 | // ========================================
32 | // Public constants
33 | // ========================================
34 |
35 | /**
36 | * Zoom in.
37 | *
38 | * @see #point
39 | */
40 | public static const ZOOM_IN:String = "zoomIn";
41 |
42 | /**
43 | * Zoom out.
44 | *
45 | * @see #point
46 | */
47 | public static const ZOOM_OUT:String = "zoomOut";
48 |
49 | /**
50 | * Zoom to a rectangle.
51 | *
52 | * @see #rectangle
53 | */
54 | public static const ZOOM_TO_RECTANGLE:String = "zoomToRectangle";
55 |
56 | // ========================================
57 | // Public properties
58 | // ========================================
59 |
60 | /**
61 | * Zoom origin point.
62 | */
63 | public var origin:Point = null;
64 |
65 | /**
66 | * Zoom rectangle.
67 | */
68 | public var rectangle:Rectangle = null;
69 |
70 | // ========================================
71 | // Constructor
72 | // ========================================
73 |
74 | /**
75 | * Constructor.
76 | */
77 | public function ChartZoomEvent( type:String, bubbles:Boolean = false, cancelable:Boolean = false )
78 | {
79 | super( type, bubbles, cancelable );
80 | }
81 |
82 | // ========================================
83 | // Public methods
84 | // ========================================
85 |
86 | /**
87 | * Duplicates an instance of the event to support re-dispatching.
88 | */
89 | override public function clone():Event
90 | {
91 | var event:ChartZoomEvent = new ChartZoomEvent( type, bubbles, cancelable );
92 |
93 | event.origin = origin;
94 | event.rectangle = rectangle;
95 |
96 | return event;
97 | }
98 | }
99 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/data/Property.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2009 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.data
24 | {
25 | import com.codecatalyst.util.PropertyUtil;
26 |
27 | public class Property
28 | {
29 | // ========================================
30 | // Protected properties
31 | // ========================================
32 |
33 | /**
34 | * Backing variable for path property.
35 | */
36 | protected var _path:String;
37 |
38 | // ========================================
39 | // Public properties
40 | // ========================================
41 |
42 | /**
43 | * Returns the path for this property, using 'dot notation' (ex. 'a.b.c').
44 | */
45 | public function get path():String
46 | {
47 | return _path;
48 | }
49 |
50 | // ========================================
51 | // Constructor
52 | // ========================================
53 |
54 | /**
55 | * Constructor
56 | */
57 | public function Property( path:String, parent:Property = null )
58 | {
59 | _path = ( parent != null ) ? parent.path + "." + path : path;
60 | }
61 |
62 | // ========================================
63 | // Public methods
64 | // ========================================
65 |
66 | /**
67 | * Gets the value for a property of this type for a given object instance.
68 | */
69 | public function getValue( object:Object ):*
70 | {
71 | return PropertyUtil.getObjectPropertyValue( object, path );
72 | }
73 |
74 | /**
75 | * Sets the value for a property of this type for a given object instance.
76 | */
77 | public function setValue( object:Object, value:* ):void
78 | {
79 | object[ path ] = value;
80 | }
81 |
82 | /**
83 | * Returns a Boolean indicating whether the specified object instance has this property.
84 | */
85 | public function exists( object:Object ):Boolean
86 | {
87 | return PropertyUtil.hasProperty( object, path );
88 | }
89 |
90 | /**
91 | * @inheritDoc
92 | */
93 | public function toString():String
94 | {
95 | return path;
96 | }
97 | }
98 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/util/persistence/KeyValueStoreAdapter.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2011 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.util.persistence
24 | {
25 | /**
26 | * Concrete implementation of IKeyValueStore that adapts any key value store's get value and set value functions.
27 | *
28 | * @author John Yanarella
29 | */
30 | public class KeyValueStoreAdapter implements IKeyValueStore
31 | {
32 | // ========================================
33 | // Public factory methods.
34 | // ========================================
35 |
36 | /**
37 | * Creates a new KeyValueStoreAdapter, adapting the specified get value / set value callback functions.
38 | */
39 | public static function adapt( getValueCallback:Function, setValueCallback:Function ):KeyValueStoreAdapter
40 | {
41 | return new KeyValueStoreAdapter( getValueCallback, setValueCallback );
42 | }
43 |
44 | // ========================================
45 | // Public properties
46 | // ========================================
47 |
48 | [Bindable]
49 | /**
50 | * Key value getter callback function.
51 | */
52 | public var getValueCallback:Function = null;
53 |
54 | [Bindable]
55 | /**
56 | * Key value setter callback function.
57 | */
58 | public var setValueCallback:Function = null;
59 |
60 | // ========================================
61 | // Constructor
62 | // ========================================
63 |
64 | /**
65 | * Constructor.
66 | */
67 | public function KeyValueStoreAdapter( getValueCallback:Function = null, setValueCallback:Function = null )
68 | {
69 | super();
70 |
71 | this.getValueCallback = getValueCallback;
72 | this.setValueCallback = setValueCallback;
73 | }
74 |
75 | // ========================================
76 | // Public methods.
77 | // ========================================
78 |
79 | /**
80 | * @inheritDoc
81 | */
82 | public function getValue( key:String ):Object
83 | {
84 | return getValueCallback( key );
85 | }
86 |
87 | /**
88 | * @inheritDoc
89 | */
90 | public function setValue( key:String, value:Object ):void
91 | {
92 | setValueCallback( key, value );
93 | }
94 | }
95 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/util/RectangleUtil.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2008 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.util
24 | {
25 | import flash.geom.Point;
26 | import flash.geom.Rectangle;
27 |
28 | public class RectangleUtil
29 | {
30 | // ========================================
31 | // Public methods
32 | // ========================================
33 |
34 | /**
35 | * Returns a Boolean value indicating whether the specified Rectangle is valid.
36 | */
37 | public static function isValid( rectangle:Rectangle ):Boolean
38 | {
39 | if ( ( rectangle == null ) || isNaN( rectangle.width ) || isNaN( rectangle.height ) )
40 | return false;
41 |
42 | return true;
43 | }
44 |
45 | /**
46 | * Returns a new normalized Rectangle based on the specified Rectangle.
47 | *
48 | * Any Rectangle with negative width or height becomes a Rectangle with positive width or height that extends to the upper-left of the original Rectangle.
49 | */
50 | public static function normalize( rectangle:Rectangle ):Rectangle
51 | {
52 | var normalizedRectangle:Rectangle = rectangle.clone();
53 |
54 | if ( normalizedRectangle.width < 0 )
55 | {
56 | normalizedRectangle.x = normalizedRectangle.x + normalizedRectangle.width;
57 | normalizedRectangle.width = normalizedRectangle.width * -1;
58 | }
59 |
60 | if ( normalizedRectangle.height < 0 )
61 | {
62 | normalizedRectangle.y = normalizedRectangle.y + normalizedRectangle.height;
63 | normalizedRectangle.height = normalizedRectangle.height * -1;
64 | }
65 |
66 | return normalizedRectangle;
67 | }
68 |
69 | /**
70 | * Returns a new Rectangle translated by the specified x and y coordinates.
71 | */
72 | public static function translate( rectangle:Rectangle, x:Number, y:Number ):Rectangle
73 | {
74 | var translatedRectangle:Rectangle = rectangle.clone();
75 |
76 | translatedRectangle.offset( x, y );
77 |
78 | return translatedRectangle;
79 | }
80 |
81 | /**
82 | * Returns the center Point of the specified Rectangle.
83 | */
84 | public static function center( rectangle:Rectangle ):Point
85 | {
86 | return new Point( ( rectangle.left + rectangle.right ) / 2.0, ( rectangle.top + rectangle.bottom ) / 2.0 );
87 | }
88 | }
89 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/component/date/DateRangeSliderEvent.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2009 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.component.date
24 | {
25 | import com.codecatalyst.data.DateRange;
26 |
27 | import flash.events.Event;
28 |
29 | public class DateRangeSliderEvent extends Event
30 | {
31 | // ========================================
32 | // Public constants
33 | // ========================================
34 |
35 | /**
36 | * Notifies listeners that the DateRange was panned.
37 | *
38 | * @see #dateRange
39 | * @see #index
40 | * @see #complete
41 | */
42 | public static const DATE_RANGE_PANNED:String = "dateRangePanned";
43 |
44 | /**
45 | * Notifies listeners that the DateRange was resized.
46 | *
47 | * @see #dateRange
48 | * @see #index
49 | * @see #complete
50 | */
51 | public static const DATE_RANGE_RESIZED:String = "dateRangeResized";
52 |
53 | // ========================================
54 | // Public properties
55 | // ========================================
56 |
57 | /**
58 | * DateRange.
59 | */
60 | public var dateRange:DateRange = null;
61 |
62 | /**
63 | * DateRange index.
64 | */
65 | public var index:int = 0;
66 |
67 | /**
68 | * Indicates whether the user interaction is 'complete'.
69 | */
70 | public var complete:Boolean = false;
71 |
72 | // ========================================
73 | // Constructor
74 | // ========================================
75 |
76 | /**
77 | * Constructor.
78 | */
79 | public function DateRangeSliderEvent( type:String, bubbles:Boolean = false, cancelable:Boolean = false )
80 | {
81 | super( type, bubbles, cancelable );
82 | }
83 |
84 | // ========================================
85 | // Public methods
86 | // ========================================
87 |
88 | /**
89 | * Duplicates an instance of the event to support re-dispatching.
90 | */
91 | override public function clone():Event
92 | {
93 | var event:DateRangeSliderEvent = new DateRangeSliderEvent( type, bubbles, cancelable );
94 |
95 | event.dateRange = dateRange;
96 | event.index = index;
97 | event.complete = complete;
98 |
99 | return event;
100 | }
101 | }
102 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/component/chart/element/Background.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2010 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.component.chart.element
24 | {
25 | import flash.geom.Rectangle;
26 |
27 | import mx.charts.chartClasses.ChartElement;
28 | import mx.graphics.IFill;
29 | import mx.graphics.IStroke;
30 | import mx.graphics.SolidColor;
31 | import mx.graphics.Stroke;
32 |
33 | /**
34 | * Background fill.
35 | */
36 | [Style(name="backgroundFill", type="mx.graphics.IFill", inherit="no")]
37 |
38 | /**
39 | * Border stroke.
40 | */
41 | [Style(name="borderStroke", type="mx.graphics.IStroke", inherit="no")]
42 |
43 | public class Background extends ChartElement
44 | {
45 | // ========================================
46 | // Constructor
47 | // ========================================
48 |
49 | /**
50 | * Constructor.
51 | */
52 | public function Background()
53 | {
54 | super();
55 |
56 | percentWidth = 100;
57 | percentHeight = 100;
58 | }
59 |
60 | // ========================================
61 | // Protected methods
62 | // ========================================
63 |
64 | /**
65 | * @inheritDoc
66 | */
67 | override protected function updateDisplayList( unscaledWidth:Number, unscaledHeight:Number ):void
68 | {
69 | super.updateDisplayList( unscaledWidth, unscaledHeight );
70 |
71 | if ( chart == null )
72 | return;
73 |
74 | // NOTE: ChartBase and CartesianChart incorrectly mask backgroundElements, so we just blow away the mask in the parent 'holder' component.
75 | parent.mask = null;
76 |
77 | var backgroundFill:IFill = getStyle( "backgroundFill" ) as IFill || new SolidColor( 0xffffff, 1.0 );
78 | var borderStroke:IStroke = getStyle( "borderStroke" ) as IStroke || new Stroke( 0x000000, 1.0 );
79 |
80 | var borderRectangle:Rectangle = new Rectangle( -1, -1, unscaledWidth + 1, unscaledHeight + 1 );
81 |
82 | graphics.clear();
83 |
84 | CONFIG::FLEX3 {
85 | borderStroke.apply( graphics );
86 | backgroundFill.begin( graphics, borderRectangle );
87 | }
88 | CONFIG::FLEX4 {
89 | borderStroke.apply( graphics, null, null );
90 | backgroundFill.begin( graphics, borderRectangle, null );
91 | }
92 |
93 | graphics.drawRect( borderRectangle.x, borderRectangle.y, borderRectangle.width, borderRectangle.height );
94 | backgroundFill.end( graphics );
95 | }
96 | }
97 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/data/SampleSet.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2011 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.data
24 | {
25 | import com.codecatalyst.util.ArrayUtil;
26 | import com.codecatalyst.util.DateUtil;
27 | import com.codecatalyst.util.IterableUtil;
28 |
29 | public class SampleSet extends TemporalData
30 | {
31 | // ========================================
32 | // Protected properties
33 | // ========================================
34 |
35 | /**
36 | * Backing variable for samplingInterval property.
37 | *
38 | * @see #samplingInterval
39 | */
40 | protected var _samplingInterval:TimeInterval = null;
41 |
42 | // ========================================
43 | // Public properties
44 | // ========================================
45 |
46 | /**
47 | * Time interval between samples in this sample set, in milliseconds.
48 | */
49 | public function get samplingInterval():TimeInterval
50 | {
51 | return _samplingInterval;
52 | }
53 |
54 | // ========================================
55 | // Constructor
56 | // ========================================
57 |
58 | /**
59 | * Constructor.
60 | */
61 | public function SampleSet( samples:Array, samplingInterval:TimeInterval, dateFieldName:String = "date", isSorted:Boolean = false )
62 | {
63 | super( samples, dateFieldName, isSorted );
64 |
65 | _samplingInterval = samplingInterval.clone();
66 | }
67 |
68 | // ========================================
69 | // Public methods
70 | // ========================================
71 |
72 | /**
73 | * Create a new SampleSet containing the subset of samples available for the specified date range.
74 | */
75 | override public function createSubset( targetDateRange:DateRange ):TemporalData
76 | {
77 | return new SampleSet( createDataSubset( targetDateRange ), samplingInterval, dateFieldName, true );
78 | }
79 |
80 | /**
81 | * Get the sample that occurs on the specified Date, or null if unavailable.
82 | */
83 | public function getSampleDyDate( date:Date ):Object
84 | {
85 | return IterableUtil.getItemByIndex( getDataItemsByDate( date ), 0 );
86 | }
87 |
88 | /**
89 | * Get the sample that occurs nearest to the specified Date.
90 | */
91 | public function getNearestSampleByDate( date:Date ):Object
92 | {
93 | return IterableUtil.getItemByIndex( getNearestDataItemsByDate( date ), 0 );
94 | }
95 | }
96 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/util/ImageUtil.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2009 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.util
24 | {
25 | import flash.display.Bitmap;
26 |
27 | public class ImageUtil
28 | {
29 | // ========================================
30 | // Public methods
31 | // ========================================
32 |
33 | /**
34 | * Return the specified image source converted to grayscale.
35 | */
36 | public static function grayscale( source:Object ):Bitmap
37 | {
38 | var bitmap:Bitmap = createBitmap( source );
39 |
40 | BitmapDataUtil.grayscale( bitmap.bitmapData );
41 |
42 | return bitmap;
43 | }
44 |
45 | /**
46 | * Return the specified image source tinted with the specified color.
47 | */
48 | public static function tint( source:Object, color:uint ):Bitmap
49 | {
50 | var bitmap:Bitmap = createBitmap( source );
51 |
52 | BitmapDataUtil.tint( bitmap.bitmapData, color );
53 |
54 | return bitmap;
55 | }
56 |
57 | /**
58 | * Return the specified image source with its brightness adjusted by the specified percentage.
59 | */
60 | public static function brightness( source:Object, percentage:Number ):Bitmap
61 | {
62 | var bitmap:Bitmap = createBitmap( source );
63 |
64 | BitmapDataUtil.brightness( bitmap.bitmapData, percentage );
65 |
66 | return bitmap;
67 | }
68 |
69 | /**
70 | * Return the specified image source with its brightness adjusted by the specified percentage.
71 | */
72 | public static function transparency( source:Object, percentage:Number ):Bitmap
73 | {
74 | var bitmap:Bitmap = createBitmap( source );
75 |
76 | BitmapDataUtil.transparency( bitmap.bitmapData, percentage );
77 |
78 | return bitmap;
79 | }
80 |
81 | // ========================================
82 | // Protected methods
83 | // ========================================
84 |
85 | /**
86 | * Create a Bitmap instance from the specified source.
87 | */
88 | protected static function createBitmap( source:Object ):Bitmap
89 | {
90 | if ( source is Class )
91 | {
92 | return new source() as Bitmap;
93 | }
94 | else if ( source is Bitmap )
95 | {
96 | return source as Bitmap;
97 | }
98 | else
99 | {
100 | throw new Error( "Unsuported source specified." );
101 | }
102 | }
103 | }
104 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/component/template/RadioGroup.mxml:
--------------------------------------------------------------------------------
1 |
2 | horizontalAxisRenderer and verticalAxisRenderer
75 | // properties are internally populated by CartesianChart and are not cleared when horizontalAxisRenderers or verticalAxisRenderers
76 | // are later dynamically populated.
77 |
78 | if ( ( horizontalAxisRenderers.length == 0 ) && ( horizontalAxisRenderer == null ) )
79 | {
80 | horizontalAxisRenderers = [ createTemporaryAxisRenderer() ];
81 | }
82 |
83 | if ( ( verticalAxisRenderers.length == 0 ) && ( verticalAxisRenderer == null ) )
84 | {
85 | verticalAxisRenderers = [ createTemporaryAxisRenderer() ];
86 | }
87 | }
88 |
89 | super.commitProperties();
90 | }
91 |
92 | /**
93 | * Create a temporary AxisRenderer.
94 | */
95 | protected function createTemporaryAxisRenderer():AxisRenderer
96 | {
97 | var axisRenderer:AxisRenderer = new AxisRenderer();
98 |
99 | axisRenderer.axis = new LinearAxis();
100 |
101 | return axisRenderer;
102 | }
103 | }
104 | }
--------------------------------------------------------------------------------
/src/qs/utils/GraphicsUtils.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2006 Adobe Systems Incorporated
3 |
4 | Permission is hereby granted, free of charge, to any person
5 | obtaining a copy of this software and associated documentation
6 | files (the "Software"), to deal in the Software without
7 | restriction, including without limitation the rights to use,
8 | copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the
10 | Software is furnished to do so, subject to the following
11 | conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | OTHER DEALINGS IN THE SOFTWARE.
24 | */
25 | package qs.utils
26 | {
27 |
28 | import mx.graphics.IStroke;
29 | import flash.display.Graphics;
30 |
31 | public class GraphicsUtils
32 | {
33 | public static function _drawDashedLine(target:Graphics, stroke:IStroke, pattern:Array, drawingState:DashStruct, x0:Number, y0:Number, x1:Number, y1:Number):void
34 | {
35 | var dX:Number = x1 - x0;
36 | var dY:Number = y1 - y0;
37 | var len:Number = Math.sqrt(dX*dX + dY*dY);
38 |
39 | if (len == 0)
40 | return;
41 |
42 | dX /= len;
43 | dY /= len;
44 | var tMax:Number = len;
45 |
46 | var t:Number = -drawingState.offset;
47 | var bDrawing:Boolean = drawingState.drawing;
48 | var patternIndex:int = drawingState.patternIndex;
49 | var styleInited:Boolean = drawingState.styleInited;
50 | while (t < tMax)
51 | {
52 | t += pattern[patternIndex];
53 | if (t < 0)
54 | {
55 | var x:int = 5;
56 | }
57 | if (t >= tMax)
58 | {
59 | drawingState.offset = pattern[patternIndex] - (t - tMax);
60 | drawingState.patternIndex = patternIndex;
61 | drawingState.drawing = bDrawing;
62 | drawingState.styleInited = true;
63 | t = tMax;
64 | }
65 |
66 | if (styleInited == false)
67 | {
68 | if (bDrawing)
69 | {
70 | CONFIG::FLEX3 {
71 | stroke.apply( target );
72 | }
73 | CONFIG::FLEX4 {
74 | stroke.apply( target, null, null );
75 | }
76 | }
77 | else
78 | target.lineStyle(0, 0, 0);
79 | }
80 | else
81 | {
82 | styleInited = false;
83 | }
84 |
85 | target.lineTo(x0 + t*dX, y0 + t*dY);
86 |
87 | bDrawing = !bDrawing;
88 | patternIndex = (patternIndex + 1) % pattern.length;
89 | }
90 | }
91 |
92 | public static function drawDashedLine(target:Graphics, stroke:IStroke, pattern:Array, x0:Number, y0:Number, x1:Number, y1:Number):void
93 | {
94 | target.moveTo(x0, y0);
95 | var struct:DashStruct = new DashStruct();
96 | _drawDashedLine(target, stroke, pattern, struct, x0, y0, x1, y1);
97 | }
98 |
99 | public static function drawDashedPolyLine(target:Graphics, stroke:IStroke, pattern:Array, points:Array):void
100 | {
101 | if (points.length == 0)
102 | return;
103 |
104 | var prev:Object = points[0];
105 |
106 | var struct:DashStruct = new DashStruct();
107 | target.moveTo(prev.x,prev.y);
108 | for (var i:int = 1; i < points.length; i++)
109 | {
110 | var current:Object = points[i];
111 | _drawDashedLine(target, stroke, pattern, struct, prev.x, prev.y, current.x, current.y);
112 | prev = current;
113 | }
114 | }
115 | }
116 | }
117 |
118 | class DashStruct
119 | {
120 | public function DashStruct() {}
121 |
122 | public function init():void
123 | {
124 | drawing = true;
125 | patternIndex = 0;
126 | offset = 0;
127 | }
128 |
129 | public var drawing:Boolean = true;
130 | public var patternIndex:int = 0;
131 | public var offset:Number = 0;
132 | public var styleInited:Boolean = false;
133 | }
134 |
--------------------------------------------------------------------------------
/src/com/codecatalyst/component/text/Text.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2010 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.component.text
24 | {
25 | import mx.controls.Text;
26 | import mx.core.UITextField;
27 |
28 | /**
29 | * Specifies whether links in htmlText are underlined.
30 | * Possible values are "none", and "underline".
31 | *
32 | * @default "none"
33 | */
34 | [Style(name="linkDecoration", type="String", enumeration="none,underline", inherit="yes")]
35 |
36 | /**
37 | * Color to use for links in htmlText.
38 | */
39 | [Style(name="linkColor", type="uint", format="Color", inherit="yes")]
40 |
41 | /**
42 | * Specifies whether links in htmlText are underlined when hovered over.
43 | * Possible values are "none", and "underline".
44 | *
45 | * @default "none"
46 | */
47 | [Style(name="hoverLinkDecoration", type="String", enumeration="none,underline", inherit="yes")]
48 |
49 | /**
50 | * Color to use for links in htmlText when hovered over.
51 | */
52 | [Style(name="hoverLinkColor", type="uint", format="Color", inherit="yes")]
53 |
54 | /**
55 | * Specifies whether links in htmlText are underlined when active
56 | * Possible values are "none", and "underline".
57 | *
58 | * @default "none"
59 | */
60 | [Style(name="activeLinkDecoration", type="String", enumeration="none,underline", inherit="yes")]
61 |
62 | /**
63 | * Color to use for links in htmlText when active.
64 | */
65 | [Style(name="activeLinkColor", type="uint", format="Color", inherit="yes")]
66 |
67 | /**
68 | * Extends the standard Flex 3 Halo Text component to support new styles for specifying
69 | * hyperlink color and decoration (including normal, active and hover states) for htmlText.
70 | *
71 | * @example CSS sample
72 | *
73 | * "none", and "underline".
31 | *
32 | * @default "none"
33 | */
34 | [Style(name="linkDecoration", type="String", enumeration="none,underline", inherit="yes")]
35 |
36 | /**
37 | * Color to use for links in htmlText.
38 | */
39 | [Style(name="linkColor", type="uint", format="Color", inherit="yes")]
40 |
41 | /**
42 | * Specifies whether links in htmlText are underlined when hovered over.
43 | * Possible values are "none", and "underline".
44 | *
45 | * @default "none"
46 | */
47 | [Style(name="hoverLinkDecoration", type="String", enumeration="none,underline", inherit="yes")]
48 |
49 | /**
50 | * Color to use for links in htmlText when hovered over.
51 | */
52 | [Style(name="hoverLinkColor", type="uint", format="Color", inherit="yes")]
53 |
54 | /**
55 | * Specifies whether links in htmlText are underlined when active
56 | * Possible values are "none", and "underline".
57 | *
58 | * @default "none"
59 | */
60 | [Style(name="activeLinkDecoration", type="String", enumeration="none,underline", inherit="yes")]
61 |
62 | /**
63 | * Color to use for links in htmlText when active.
64 | */
65 | [Style(name="activeLinkColor", type="uint", format="Color", inherit="yes")]
66 |
67 | /**
68 | * Extends the standard Flex 3 Halo Label component to support new styles for specifying
69 | * hyperlink color and decoration (including normal, active and hover states) for htmlText.
70 | *
71 | * @example CSS sample
72 | *
73 | * series property.
39 | *
40 | * @see #series
41 | */
42 | protected var _series:Series;
43 |
44 | [ArrayElementType("mx.chart.ChartItem")]
45 | /**
46 | * ChartItems for series.
47 | */
48 | protected function get chartItems():Array
49 | {
50 | if ( ( series != null ) && ( series.items != null ) )
51 | return series.items;
52 |
53 | return [];
54 | }
55 |
56 | /**
57 | * ChartItem item x value field.
58 | */
59 | protected function get xField():String
60 | {
61 | try
62 | {
63 | return series[ "xField" ];
64 | }
65 | catch ( error:Error )
66 | {
67 | throw new Error( "Unsupported Series type." );
68 | }
69 |
70 | return null;
71 | }
72 |
73 | /**
74 | * ChartItem item y value field.
75 | */
76 | protected function get yField():String
77 | {
78 | try
79 | {
80 | return series[ "yField" ];
81 | }
82 | catch ( error:Error )
83 | {
84 | throw new Error( "Unsupported Series type." );
85 | }
86 |
87 | return null;
88 | }
89 |
90 | // ========================================
91 | // Public properties
92 | // ========================================
93 |
94 | [Bindable("seriesChanged")]
95 | /**
96 | * Series.
97 | */
98 | public function get series():Series
99 | {
100 | return _series;
101 | }
102 |
103 | public function set series( value:Series ):void
104 | {
105 | if ( _series != value )
106 | {
107 | if ( _series != null )
108 | _series.addEventListener( FlexEvent.UPDATE_COMPLETE, series_updateCompleteHandler );
109 |
110 | _series = value;
111 |
112 | if ( _series != null )
113 | _series.addEventListener( FlexEvent.UPDATE_COMPLETE, series_updateCompleteHandler, false, 0, true );
114 |
115 | dispatchEvent( new Event( "seriesChanged" ) );
116 | }
117 | }
118 |
119 | // ========================================
120 | // Constructor
121 | // ========================================
122 |
123 | /**
124 | * Constructor
125 | */
126 | public function AbstractCartesianSeriesAnnotation()
127 | {
128 | super();
129 |
130 | percentWidth = 100;
131 | percentHeight = 100;
132 | }
133 |
134 | // ========================================
135 | // Protected methods
136 | // ========================================
137 |
138 | /**
139 | * Handle FlexEvent.UPDATE_COMPLETE.
140 | */
141 | protected function series_updateCompleteHandler( event:FlexEvent ):void
142 | {
143 | invalidateDisplayList();
144 | }
145 | }
146 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/util/CollectionViewUtil.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2009 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.util
24 | {
25 | import mx.collections.ArrayCollection;
26 | import mx.collections.ICollectionView;
27 | import mx.collections.IList;
28 | import mx.collections.ListCollectionView;
29 | import mx.collections.XMLListCollection;
30 | import mx.core.mx_internal;
31 |
32 | use namespace mx_internal;
33 |
34 | public class CollectionViewUtil
35 | {
36 | // ========================================
37 | // Public methods
38 | // ========================================
39 |
40 | /**
41 | * Create a ICollectionView for the specified data provider object.
42 | */
43 | public static function create( value:Object ):ICollectionView
44 | {
45 | var collectionView:ICollectionView = null;
46 |
47 | if ( value is Array )
48 | {
49 | collectionView = new ArrayCollection( value as Array );
50 | }
51 | else if ( value is ICollectionView )
52 | {
53 | collectionView = ICollectionView( value );
54 | }
55 | else if ( value is IList )
56 | {
57 | collectionView = new ListCollectionView( IList( value ) );
58 | }
59 | else if ( value is XMLList )
60 | {
61 | collectionView = new XMLListCollection( value as XMLList );
62 | }
63 | else if ( value is XML )
64 | {
65 | var xl:XMLList = new XMLList();
66 | xl += value;
67 |
68 | collectionView = new XMLListCollection( xl );
69 | }
70 | else
71 | {
72 | var temp:Array = [];
73 |
74 | if ( value != null )
75 | temp.push( value );
76 |
77 | collectionView = new ArrayCollection( temp );
78 | }
79 |
80 | return collectionView;
81 | }
82 |
83 | /**
84 | * Silently clear the filterFunction and reset the list to have all elements available
85 | * for a future filter scan.
86 | *
87 | * @param target
88 | * @param silent
89 | */
90 | public static function reset( target : ListCollectionView, silent:Boolean=true) : ListCollectionView
91 | {
92 | if (target.filterFunction != null) {
93 |
94 | var origFlag : Boolean = target.mx_internal::dispatchResetEvent;
95 |
96 | target.filterFunction = null;
97 |
98 | try {
99 | if (silent == true) {
100 |
101 | target.mx_internal::dispatchResetEvent = false;
102 | target.mx_internal::reset();
103 |
104 | } else {
105 |
106 | target.refresh();
107 |
108 | }
109 |
110 | } finally {
111 |
112 | target.mx_internal::dispatchResetEvent = origFlag;
113 | }
114 | }
115 |
116 | return target;
117 | }
118 |
119 | /**
120 | * Since ListCollectionViews may have filters applied to the list
121 | * this method quickly gathers all non-filtered items into an array.
122 | *
123 | * @param list ListCollectionView
124 | * @return Array
125 | */
126 | public static function toArray( list:ListCollectionView ) : Array
127 | {
128 | var results : Array = [ ];
129 |
130 | if ( list != null)
131 | {
132 | for each (var it:* in list)
133 | {
134 | results.push(it);
135 | }
136 | }
137 |
138 | return results;
139 | }
140 | }
141 |
142 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/util/DelayedCall.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2006 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.util
24 | {
25 | import flash.events.TimerEvent;
26 | import flash.utils.Dictionary;
27 | import flash.utils.Timer;
28 |
29 | public class DelayedCall
30 | {
31 | // ========================================
32 | // Protected properties
33 | // ========================================
34 |
35 | /**
36 | * Scheduled calls.
37 | */
38 | protected static var scheduledCalls:Dictionary = new Dictionary();
39 |
40 | /**
41 | * Function.
42 | */
43 | protected var func:Function = null;
44 |
45 | /**
46 | * Function arguments.
47 | */
48 | protected var args:Array = null;
49 |
50 | /**
51 | * Scope context for the function invocation
52 | */
53 | protected var scope:Object = null;
54 |
55 | // ========================================
56 | // Constructor
57 | // ========================================
58 |
59 | /**
60 | * Constructor.
61 | */
62 | public function DelayedCall()
63 | {
64 | super();
65 | }
66 |
67 | // ========================================
68 | // Public methods
69 | // ========================================
70 |
71 | /**
72 | * Schedule a delayed function or method call.
73 | *
74 | * @param func The function or class method to call.
75 | * @param args The parameters to pass to the function / class method.
76 | * @param delay The time in milliseconds to delay before making the function / class method call.
77 | */
78 | public static function schedule( func:Function, args:Array, delay:Number, scope:Object=null ):void
79 | {
80 | var call:DelayedCall = new DelayedCall();
81 |
82 | call.initiate( func, args, delay, scope );
83 |
84 | // Grab a reference so the call doesn't get prematurely garbage-collected
85 |
86 | scheduledCalls[ call ] = call;
87 | }
88 |
89 | // ========================================
90 | // Protected methods
91 | // ========================================
92 |
93 | /**
94 | * Release reference to a completed DelayedCall instance.
95 | */
96 | protected static function release( call:DelayedCall ):void
97 | {
98 | // Release reference so that call can be garbage-collected
99 |
100 | delete scheduledCalls[ call ];
101 | }
102 |
103 | /**
104 | * Initiate a delayed call.
105 | */
106 | protected function initiate( func:Function, args:Array, delay:Number, scope:Object=null ):void
107 | {
108 | this.func = func;
109 | this.args = args || [ ];
110 | this.scope= scope;
111 |
112 | // Create and start a timer
113 |
114 | var timer:Timer = new Timer( delay, 1 );
115 | timer.addEventListener( TimerEvent.TIMER_COMPLETE, timerCompleteHandler );
116 |
117 | timer.start();
118 | }
119 |
120 | /**
121 | * Handle TimerEvent.TIMER_COMPLETE - execute the delayed call.
122 | */
123 | protected function timerCompleteHandler( event:TimerEvent ):void
124 | {
125 | var timer:Timer = event.target as Timer;
126 | timer.removeEventListener( TimerEvent.TIMER_COMPLETE, timerCompleteHandler );
127 |
128 | // Execute the delayed function call
129 |
130 | if ( func != null )
131 | func.apply( scope, args );
132 |
133 | release( this );
134 | }
135 | }
136 | }
--------------------------------------------------------------------------------
/src/design.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/src/com/codecatalyst/util/DisplayObjectContainerUtil.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2010 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.util
24 | {
25 | import flash.display.DisplayObject;
26 | import flash.display.DisplayObjectContainer;
27 |
28 | public class DisplayObjectContainerUtil
29 | {
30 |
31 | // ========================================
32 | // Public methods
33 | // ========================================
34 |
35 | [ArrayElementType("flash.display.DisplayObject")]
36 | /**
37 | * Returns an Array of the specified DisplayObjectContainer's children.
38 | */
39 | public static function children(container:DisplayObjectContainer):Array
40 | {
41 | var children:Array = new Array();
42 |
43 | if (container != null)
44 | {
45 | var numChildren:int = container.numChildren;
46 | for (var childIndex:int = 0; childIndex < numChildren; childIndex++)
47 | {
48 | var child:DisplayObject = container.getChildAt(childIndex);
49 |
50 | children.push(child);
51 | }
52 | }
53 |
54 | return children;
55 | }
56 |
57 |
58 | public static function contains(container:DisplayObjectContainer, target:DisplayObject):Boolean
59 | {
60 | return (children(container).indexOf(target) > -1);
61 | }
62 |
63 | /**
64 | * Brings the specified DisplayObject forward in z-order within the specified DisplayObjectContainer.
65 | */
66 | public static function bringForward(container:DisplayObjectContainer, displayObject:DisplayObject):void
67 | {
68 | var childIndex:int = container.getChildIndex(displayObject);
69 | var targetIndex:int = (childIndex < container.numChildren - 1) ? childIndex++ : childIndex;
70 |
71 | container.setChildIndex(displayObject, targetIndex);
72 | }
73 |
74 | /**
75 | * Brings the specified DisplayObject to the front in z-order within the specified DisplayObjectContainer.
76 | */
77 | public static function bringToFront(container:DisplayObjectContainer, displayObject:DisplayObject):void
78 | {
79 | var lastIndex:int = container.numChildren - 1;
80 |
81 | container.setChildIndex(displayObject, lastIndex);
82 | }
83 |
84 | /**
85 | * Sends the specified DisplayObject backward in z-order within the specified DisplayObjectContainer.
86 | */
87 | public static function sendBackward(container:DisplayObjectContainer, displayObject:DisplayObject):void
88 | {
89 | var childIndex:int = container.getChildIndex(displayObject);
90 | var targetIndex:int = (childIndex > 0) ? childIndex-- : childIndex;
91 |
92 | container.setChildIndex(displayObject, targetIndex);
93 | }
94 |
95 | /**
96 | * Sends the specified DisplayObject to the back in z-order within the specified DisplayObjectContainer.
97 | */
98 | public static function sendToBack(container:DisplayObjectContainer, displayObject:DisplayObject):void
99 | {
100 | var firstIndex:int = 0;
101 |
102 | container.setChildIndex(displayObject, firstIndex);
103 | }
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/src/com/codecatalyst/util/FactoryPool.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2010 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.util
24 | {
25 | import flash.utils.Dictionary;
26 |
27 | import mx.core.ClassFactory;
28 | import mx.core.IFactory;
29 |
30 | public class FactoryPool implements IObjectPool
31 | {
32 | // ========================================
33 | // Protected properties
34 | // ========================================
35 |
36 | /**
37 | * Factory.
38 | */
39 | protected var factory:IFactory;
40 |
41 | /**
42 | * Maximum size (i.e. maximum # of pooled instances).
43 | */
44 | protected var maximumSize:Number = NaN;
45 |
46 | /**
47 | * Index of instances created by this pool.
48 | */
49 | protected var instanceIndex:Dictionary = new Dictionary();
50 |
51 | /**
52 | * Pooled instance(s).
53 | */
54 | protected var pooledInstances:Array = new Array();
55 |
56 | /**
57 | * Index of pooled instance(s) - for fast lookup.
58 | */
59 | protected var pooledInstanceIndex:Dictionary = new Dictionary();
60 |
61 | /**
62 | * Indicates whether this pool is full.
63 | */
64 | protected function get isFull():Boolean
65 | {
66 | return ( ! isNaN( maximumSize ) && pooledInstances.length >= maximumSize );
67 | }
68 |
69 | // ========================================
70 | // Constructor
71 | // ========================================
72 |
73 | /**
74 | * Constructor.
75 | */
76 | public function FactoryPool( factory:IFactory, maximumSize:Number = NaN )
77 | {
78 | super();
79 |
80 | this.factory = factory;
81 | this.maximumSize = maximumSize;
82 | }
83 |
84 | // ========================================
85 | // Public methods
86 | // ========================================
87 |
88 | /**
89 | * @inheritDoc
90 | */
91 | public function acquireInstance():*
92 | {
93 | if ( pooledInstances.length > 0 )
94 | {
95 | // Pop and return a pooled instance.
96 |
97 | var pooledInstance:* = pooledInstances.pop();
98 | pooledInstanceIndex[ pooledInstance ] = null;
99 |
100 | return pooledInstance;
101 | }
102 | else
103 | {
104 | // Create and return a new instance.
105 |
106 | var instance:* = factory.newInstance();
107 | instanceIndex[ instance ] = true;
108 |
109 | return instance;
110 | }
111 | }
112 |
113 | /**
114 | * @inheritDoc
115 | */
116 | public function releaseInstance( instance:* ):void
117 | {
118 | // Check that the specified instance was created by this FactoryPool instance.
119 |
120 | if ( instanceIndex[ instance ] != null )
121 | {
122 | // Check that the pool is not full.
123 |
124 | if ( ! isFull )
125 | {
126 | // Check that the specified instance is not already in the pool.
127 |
128 | if ( ! pooledInstanceIndex[ instance ] )
129 | {
130 | // Add the instance to the pool.
131 |
132 | pooledInstances.push( instance );
133 | pooledInstanceIndex[ instance ] = instance;
134 | }
135 | }
136 | else
137 | {
138 | instanceIndex[ instance ] = null;
139 | }
140 | }
141 | }
142 |
143 | /**
144 | * @inheritDoc
145 | */
146 | public function reset():void
147 | {
148 | instanceIndex = null;
149 | pooledInstances = new Array();
150 | pooledInstanceIndex = null;
151 | }
152 | }
153 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/component/chart/element/AbstractDateTimeAxisAnnotation.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2010 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.component.chart.element
24 | {
25 | import mx.charts.DateTimeAxis;
26 | import mx.charts.chartClasses.CartesianChart;
27 | import mx.charts.chartClasses.CartesianDataCanvas;
28 |
29 | public class AbstractDateTimeAxisAnnotation extends CartesianDataCanvas
30 | {
31 | // ========================================
32 | // Protected constants
33 | // ========================================
34 |
35 | /**
36 | * Vertical direction.
37 | */
38 | protected static const VERTICAL:String = "vertical";
39 |
40 | /**
41 | * Horizontal direction.
42 | */
43 | protected static const HORIZONTAL:String = "horizontal";
44 |
45 | // ========================================
46 | // Protected properties
47 | // ========================================
48 |
49 | /**
50 | * DateTimeAxis associated with the chart, if applicable.
51 | */
52 | protected var dateTimeAxis:DateTimeAxis = null;
53 |
54 | /**
55 | * Direction of the DateTimeAxis (HORIZONTAL or VERTICAL).
56 | */
57 | protected var dateTimeAxisDirection:String = null;
58 |
59 | // ========================================
60 | // Constructor
61 | // ========================================
62 |
63 | /**
64 | * Constructor.
65 | */
66 | public function AbstractDateTimeAxisAnnotation()
67 | {
68 | super();
69 |
70 | this.percentWidth = 100;
71 | this.percentHeight = 100;
72 | }
73 |
74 | // ========================================
75 | // Protected properties
76 | // ========================================
77 |
78 | /**
79 | * @inheritDoc
80 | */
81 | override protected function commitProperties():void
82 | {
83 | super.commitProperties();
84 |
85 | dateTimeAxis = getDateTimeAxis();
86 | dateTimeAxisDirection = getDateTimeAxisDirection();
87 | }
88 |
89 | /**
90 | * Returns the DateTimeAxis, or null if the parent chart does not have a DateTimeAxis.
91 | */
92 | protected function getDateTimeAxis():DateTimeAxis
93 | {
94 | if ( horizontalAxis is DateTimeAxis )
95 | return horizontalAxis as DateTimeAxis;
96 |
97 | if ( verticalAxis is DateTimeAxis )
98 | return verticalAxis as DateTimeAxis;
99 |
100 | if ( chart is CartesianChart )
101 | {
102 | var cartesianChart:CartesianChart = chart as CartesianChart;
103 |
104 | if ( cartesianChart.horizontalAxis is DateTimeAxis )
105 | return cartesianChart.horizontalAxis as DateTimeAxis;
106 |
107 | if ( cartesianChart.verticalAxis is DateTimeAxis )
108 | return cartesianChart.verticalAxis as DateTimeAxis;
109 | }
110 |
111 | return null;
112 | }
113 |
114 | /**
115 | * Returns the DateTimeAxis direction (HORIZONTAL or VERTICAL), or null if the parent chart does not have a DateTimeAxis.
116 | */
117 | protected function getDateTimeAxisDirection():String
118 | {
119 | if ( horizontalAxis is DateTimeAxis )
120 | return HORIZONTAL;
121 |
122 | if ( verticalAxis is DateTimeAxis )
123 | return VERTICAL;
124 |
125 | if ( chart is CartesianChart )
126 | {
127 | var cartesianChart:CartesianChart = chart as CartesianChart;
128 |
129 | if ( cartesianChart.horizontalAxis is DateTimeAxis )
130 | return HORIZONTAL;
131 |
132 | if ( cartesianChart.verticalAxis is DateTimeAxis )
133 | return VERTICAL;
134 | }
135 |
136 | return null;
137 | }
138 | }
139 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/util/BitmapDataUtil.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2009 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.util
24 | {
25 | import flash.display.BitmapData;
26 | import flash.display.Graphics;
27 | import flash.filters.ColorMatrixFilter;
28 | import flash.geom.ColorTransform;
29 | import flash.geom.Matrix;
30 | import flash.geom.Point;
31 | import flash.geom.Rectangle;
32 |
33 | public class BitmapDataUtil
34 | {
35 | // ========================================
36 | // Public methods
37 | // ========================================
38 |
39 | /**
40 | * Convert the specified BitmapData to grayscale.
41 | */
42 | public static function grayscale( bitmapData:BitmapData ):BitmapData
43 | {
44 | var rLum:Number = 0.3086;
45 | var gLum:Number = 0.6094;
46 | var bLum:Number = 0.082;
47 |
48 | var matrix:Array =
49 | [
50 | rLum, gLum, bLum, 0, 0,
51 | rLum, gLum, bLum, 0, 0,
52 | rLum, gLum, bLum, 0, 0,
53 | 0, 0, 0, 1, 0
54 | ];
55 |
56 | var bitmapBounds:Rectangle = new Rectangle( 0, 0, bitmapData.width, bitmapData.height );
57 | var filter:ColorMatrixFilter = new ColorMatrixFilter( matrix );
58 |
59 | bitmapData.applyFilter( bitmapData, bitmapBounds, new Point( 0, 0 ), filter );
60 |
61 | return bitmapData;
62 | }
63 |
64 | /**
65 | * Tint the specified BitmapData with the specified color.
66 | */
67 | public static function tint( bitmapData:BitmapData, color:uint ):BitmapData
68 | {
69 | var r:int = ( ( color >> 16 ) & 0xFF );
70 | var g:int = ( ( color >> 8 ) & 0xFF );
71 | var b:int = ( ( color ) & 0xFF );
72 |
73 | var bitmapBounds:Rectangle = new Rectangle( 0, 0, bitmapData.width, bitmapData.height );
74 | var colorTransform:ColorTransform = new ColorTransform( 1.0, 1.0, 1.0, 1.0, r, g, b );
75 |
76 | bitmapData.colorTransform( bitmapBounds, colorTransform );
77 |
78 | return bitmapData;
79 | }
80 |
81 | /**
82 | * Adjust the brightness of the specified BitmapData by the specified percentage.
83 | */
84 | public static function brightness( bitmapData:BitmapData, percentage:Number ):BitmapData
85 | {
86 | percentage = Math.max( -1.0, Math.min( 1.0, percentage ) ) * 255;
87 |
88 | if ( percentage != 0 )
89 | {
90 | var matrix:Array =
91 | [
92 | 1, 0, 0, 0, percentage,
93 | 0, 1, 0, 0, percentage,
94 | 0, 0, 1, 0, percentage,
95 | 0, 0, 0, 1, 0
96 | ];
97 |
98 | var bitmapBounds:Rectangle = new Rectangle( 0, 0, bitmapData.width, bitmapData.height );
99 | var filter:ColorMatrixFilter = new ColorMatrixFilter( matrix );
100 |
101 | bitmapData.applyFilter( bitmapData, bitmapBounds, new Point( 0, 0 ), filter );
102 | }
103 |
104 | return bitmapData;
105 | }
106 |
107 | /**
108 | * Adjust the transparency of the specified BitmapData by the specified percentage.
109 | */
110 | public static function transparency( bitmapData:BitmapData, percentage:Number ):BitmapData
111 | {
112 | percentage = Math.max( 0.0, Math.min( 1.0, percentage ) );
113 |
114 | var matrix:Array =
115 | [
116 | 1, 0, 0, 0, 0,
117 | 0, 1, 0, 0, 0,
118 | 0, 0, 1, 0, 0,
119 | 0, 0, 0, percentage, 0
120 | ];
121 |
122 | var bitmapBounds:Rectangle = new Rectangle( 0, 0, bitmapData.width, bitmapData.height );
123 | var filter:ColorMatrixFilter = new ColorMatrixFilter( matrix );
124 |
125 | bitmapData.applyFilter( bitmapData, bitmapBounds, new Point( 0, 0 ), filter );
126 |
127 | return bitmapData;
128 | }
129 | }
130 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/util/StyleUtil.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2009 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.util
24 | {
25 | import com.codecatalyst.util.PropertyUtil;
26 |
27 | import flash.geom.Point;
28 |
29 | import mx.core.IFlexModuleFactory;
30 | import mx.styles.CSSStyleDeclaration;
31 | import mx.styles.IStyleClient;
32 | import mx.styles.StyleManager;
33 |
34 |
35 | public class StyleUtil
36 | {
37 | // ========================================
38 | // Public methods
39 | // ========================================
40 |
41 | /**
42 | * Gets the CSSStyleDeclaration object that stores the rules for the specified CSS selector.
43 | *
44 | * Normalizes the changes between Flex 3.x and Flex 4.x - specify the full path to the component class for both.
45 | *
46 | * @see mx.styles.IStyleManager#getStyleDeclaration()
47 | * @see mx.styles.IStyleManager2#getStyleDeclaration()
48 | */
49 | public static function getStyleDeclaration( style:String, module:IFlexModuleFactory = null ):CSSStyleDeclaration
50 | {
51 | var result : CSSStyleDeclaration = null;
52 |
53 | CONFIG::FLEX3 {
54 | var expression:RegExp = /^(.*)\.([^.]+)$/;
55 | var match:Object = expression.exec( style );
56 |
57 | var className:String = ( match ) ? match[ 1 ] as String : style;
58 |
59 | result = StyleManager.getStyleDeclaration( className );
60 | }
61 | CONFIG::FLEX4 {
62 | result = StyleManager.getStyleManager( module ).getStyleDeclaration( style );
63 | }
64 |
65 | return result;
66 | }
67 |
68 | /**
69 | * Sets the CSSStyleDeclaration object that stores the rules for the specified CSS selector.
70 | *
71 | * @see mx.styles.IStyleManager#setStyleDeclaration()
72 | * @see mx.styles.IStyleManager2#setStyleDeclaration()
73 | */
74 | public static function setStyleDeclaration( style:String, declaration:CSSStyleDeclaration, update:Boolean = false, module:IFlexModuleFactory = null ):void
75 | {
76 | CONFIG::FLEX3 {
77 | StyleManager.setStyleDeclaration( style, declaration, update );
78 | }
79 | CONFIG::FLEX4 {
80 | StyleManager.getStyleManager( module ).setStyleDeclaration( style, declaration, update );
81 | }
82 | }
83 |
84 | /**
85 | * Applies the specified styles to the specified style client.
86 | */
87 | /**
88 | * Apply the specified style key / value pairs to the specified object instance.
89 | *
90 | * @param instance Target object instance.
91 | * @param properties Style key / value pairs.
92 | * @param evaluate Indicates whether to evaluate the values against the instance.
93 | */
94 | public static function applyStyles( styleClient:IStyleClient, styles:Object, evaluate:Boolean = false, callbackField:String = null ):void
95 | {
96 | if ( styles == null ) return;
97 |
98 | if ( styleClient != null )
99 | {
100 | for ( var key:String in styles )
101 | {
102 | var value:* = styles[ key ];
103 |
104 | if ( evaluate )
105 | {
106 | value = RuntimeEvaluationUtil.evaluate( styleClient, value, callbackField );
107 | }
108 |
109 | styleClient.setStyle( key, value );
110 | }
111 | }
112 | }
113 |
114 | /**
115 | * Parses a style value into a Point.
116 | */
117 | public static function parsePoint( value:Object ):Point
118 | {
119 | if ( value is Point )
120 | return value as Point;
121 |
122 | // TODO: Verify.
123 | if ( ( value is Array ) && ( value.length == 2 ) )
124 | return new Point( value[ 0 ], value[ 1 ] );
125 |
126 | return null;
127 | }
128 |
129 | // TODO:
130 | // parseRectangle( value:Object ):Rectangle
131 | // parseFill( value:Object ):IFill
132 | // parseStroke( value:Object ):IStroke
133 | }
134 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/component/chart/element/DateTimeGridLineSet.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2011 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.component.chart.element
24 | {
25 | import com.codecatalyst.data.TimeInterval;
26 |
27 | import flash.events.Event;
28 | import flash.events.EventDispatcher;
29 |
30 | [DefaultProperty("interval")]
31 | public class DateTimeGridLineSet extends EventDispatcher
32 | {
33 | // ========================================
34 | // Protected properties
35 | // ========================================
36 |
37 | /**
38 | * Backing variable for interval property.
39 | *
40 | * @see #interval
41 | */
42 | protected var _interval:TimeInterval = null;
43 |
44 | /**
45 | * Backing variable for maximumTimeSpan property.
46 | *
47 | * @see #maximumTimeSpan
48 | */
49 | protected var _maximumTimeSpan:Number = NaN;
50 |
51 | /**
52 | * Backing variable for strokeFilterFunction property.
53 | */
54 | protected var _strokeFilterFunction:Function = null;
55 |
56 | /**
57 | * Backing variable for fillFilterFunction property.
58 | */
59 | protected var _fillFilterFunction:Function = null;
60 |
61 | // ========================================
62 | // Public properties
63 | // ========================================
64 |
65 | [Bindable("intervalChanged")]
66 | /**
67 | * Time interval associated with this grid line set.
68 | */
69 | public function get interval():TimeInterval
70 | {
71 | return _interval;
72 | }
73 |
74 | public function set interval( value:TimeInterval ):void
75 | {
76 | if ( _interval != value )
77 | {
78 | _interval = value;
79 |
80 | dispatchEvent( new Event( "intervalChanged" ) );
81 | }
82 | }
83 |
84 | [Bindable("maximumTimeSpanChanged")]
85 | /**
86 | * Maximum time span threshold, in milliseconds.
87 | */
88 | public function get maximumTimeSpan():Number
89 | {
90 | return _maximumTimeSpan
91 | }
92 |
93 | public function set maximumTimeSpan( value:Number ):void
94 | {
95 | if ( _maximumTimeSpan != value )
96 | {
97 | _maximumTimeSpan = value;
98 |
99 | dispatchEvent( new Event( "maximumTimeSpanChanged" ) );
100 | }
101 | }
102 |
103 | [Bindable("strokeFilterFunctionChanged")]
104 | /**
105 | * Stroke filter function (optional).
106 | */
107 | public function get strokeFilterFunction():Function
108 | {
109 | return _strokeFilterFunction;
110 | }
111 |
112 | public function set strokeFilterFunction( value:Function ):void
113 | {
114 | if ( _strokeFilterFunction != value )
115 | {
116 | _strokeFilterFunction = value;
117 |
118 | dispatchEvent( new Event( "strokeFilterFunctionChanged" ) );
119 | }
120 | }
121 |
122 | [Bindable("fillFilterFunctionChanged")]
123 | /**
124 | * Fill filter function (optional).
125 | */
126 | public function get fillFilterFunction():Function
127 | {
128 | return _fillFilterFunction;
129 | }
130 |
131 | public function set fillFilterFunction( value:Function ):void
132 | {
133 | if ( _fillFilterFunction != value )
134 | {
135 | _fillFilterFunction = value;
136 |
137 | dispatchEvent( new Event( "fillFilterFunctionChanged" ) );
138 | }
139 | }
140 |
141 | // ========================================
142 | // Constructor
143 | // ========================================
144 |
145 | /**
146 | * Constructor.
147 | */
148 | public function DateTimeGridLineSet( interval:TimeInterval = null, maximumTimeSpan:Number = NaN, strokeFilterFunction:Function = null, fillFilterFunction:Function = null )
149 | {
150 | super();
151 |
152 | this.interval = interval;
153 | this.maximumTimeSpan = maximumTimeSpan;
154 | this.strokeFilterFunction = strokeFilterFunction;
155 | this.fillFilterFunction = fillFilterFunction;
156 | }
157 | }
158 | }
--------------------------------------------------------------------------------
/src/com/codecatalyst/util/IterableUtil.as:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) 2009 CodeCatalyst, LLC - http://www.codecatalyst.com/
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | package com.codecatalyst.util
24 | {
25 | public class IterableUtil
26 | {
27 | // ========================================
28 | // Public methods
29 | // ========================================
30 |
31 | public static function getItemsByProperty(items:*, propertyPath:String):Array {
32 | var results : Array = items ? [ ] : null;
33 |
34 | for each ( var item:Object in items )
35 | {
36 | results.push( PropertyUtil.getObjectPropertyValue( item, propertyPath ) );
37 | }
38 |
39 | return results;
40 | }
41 |
42 | /**
43 | * Get a item of an iterable set of items (Array, ArrayCollection, Proxy, etc.) by unique identifier.
44 | */
45 | public static function getItemById( items:*, id:Object, idFieldName:String, childrenFieldName:String = null ):Object
46 | {
47 | for each ( var item:Object in items )
48 | {
49 | var itemId:Object = PropertyUtil.getObjectPropertyValue( item, idFieldName );
50 |
51 | if ( itemId == id )
52 | return item;
53 |
54 | var children:* = getChildren( item, childrenFieldName );
55 |
56 | if ( children != null )
57 | {
58 | var result:Object = getItemById( children, id, idFieldName, childrenFieldName );
59 |
60 | if ( result != null )
61 | return result;
62 | }
63 | }
64 |
65 | return null;
66 | }
67 |
68 | /**
69 | * Get the index for an item of an iterable set of items (Array, ArrayCollection, Proxy, etc.) by unique identifier.
70 | */
71 | public static function getItemIndexById( items:*, id:Object, idFieldName:String ):int
72 | {
73 | var count:int = items.length;
74 | for ( var index:int = 0; index < count; index++ )
75 | {
76 | var item:Object = items[ index ];
77 |
78 | var itemId:Object = PropertyUtil.getObjectPropertyValue( item, idFieldName );
79 |
80 | if ( itemId == id )
81 | return index;
82 | }
83 |
84 | return -1;
85 | }
86 |
87 | /**
88 | * Returns the item at the specified index in the iterable set of items (Array, ArrayCollection, Proxy, etc.), or null if unavailable.
89 | */
90 | public static function getItemByIndex( items:*, index:int ):*
91 | {
92 | if ( ( items != null ) && ( index < items.length ) )
93 | {
94 | return items[ index ];
95 | }
96 |
97 | return null;
98 | }
99 |
100 | /**
101 | * Returns the first item in the iterable set of items (Array, ArrayCollection, Proxy, etc.), or null if unavailable.
102 | */
103 | public static function getFirstItem( items:* ):*
104 | {
105 | if ( ( items != null ) && ( items.length > 0 ) )
106 | {
107 | return items[ 0 ];
108 | }
109 |
110 | return null;
111 | }
112 |
113 | /**
114 | * Returns the last item in the iterable set of items (Array, ArrayCollection, Proxy, etc.), or null if unavailable.
115 | */
116 | public static function getLastItem( items:* ):*
117 | {
118 | if ( ( items != null ) && ( items.length > 0 ) )
119 | {
120 | return items[ items.length - 1 ];
121 | }
122 |
123 | return null;
124 | }
125 |
126 | // ========================================
127 | // Protected methods
128 | // ========================================
129 |
130 | /**
131 | * Get the iterable set of children (Array, ArrayCollection, Proxy, etc.) for the specified item and child field name.
132 | */
133 | protected static function getChildren( item:Object, childrenFieldName:String ):*
134 | {
135 | if ( item is XML )
136 | {
137 | var children:XMLList = ( item as XML ).children();
138 |
139 | if ( children.length() > 0 )
140 | return new XMLList( children );
141 |
142 | return null;
143 | }
144 | else
145 | {
146 | if ( ( childrenFieldName != null ) && ( item.hasOwnProperty( childrenFieldName ) ) )
147 | return item[ childrenFieldName ];
148 |
149 | return null;
150 | }
151 | }
152 | }
153 | }
--------------------------------------------------------------------------------