You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2016/11/02 15:14:06 UTC
[01/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - fix up
installer after launch script name changes
Repository: flex-asjs
Updated Branches:
refs/heads/refactor-sprite 1829b467e -> 1b6c3af23
fix up installer after launch script name changes
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/6c2e37f9
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/6c2e37f9
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/6c2e37f9
Branch: refs/heads/refactor-sprite
Commit: 6c2e37f99bf5716641611c642b31760421c6ecfd
Parents: 4448b42
Author: Alex Harui <ah...@apache.org>
Authored: Wed Oct 26 09:27:04 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:46:50 2016 -0700
----------------------------------------------------------------------
installer.xml | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6c2e37f9/installer.xml
----------------------------------------------------------------------
diff --git a/installer.xml b/installer.xml
index d6c8722..47fd118 100644
--- a/installer.xml
+++ b/installer.xml
@@ -967,7 +967,12 @@ tofile="${FLEXJS_HOME}/frameworks/themes/Halo/Halo.swc" />
token="$FLEXJS_HOME"
value="${FLEXJS_HOME}"/>
</replace>
- <replace file="${FLEXJS_HOME}/ide/flashbuilder/FlexJS (Cordova Run).launch">
+ <replace file="${FLEXJS_HOME}/ide/flashbuilder/FlexJS (Cordova Run IOS).launch">
+ <replacefilter
+ token="$FLEXJS_HOME"
+ value="${FLEXJS_HOME}"/>
+ </replace>
+ <replace file="${FLEXJS_HOME}/ide/flashbuilder/FlexJS (Cordova Run Android).launch">
<replacefilter
token="$FLEXJS_HOME"
value="${FLEXJS_HOME}"/>
@@ -1000,11 +1005,16 @@ tofile="${FLEXJS_HOME}/frameworks/themes/Halo/Halo.swc" />
token="PATH"
value="UNIX_PATH" />
</replace>
- <replace file="${FLEXJS_HOME}/ide/flashbuilder/FlexJS (Cordova Run).launch">
+ <replace file="${FLEXJS_HOME}/ide/flashbuilder/FlexJS (Cordova Run IOS).launch">
<replacefilter
token="PATH"
value="UNIX_PATH" />
</replace>
+ <replace file="${FLEXJS_HOME}/ide/flashbuilder/FlexJS (Cordova Run Android).launch">
+ <replacefilter
+ token="PATH"
+ value="UNIX_PATH" />
+ </replace>
</target>
<target name="download_using_mirror" depends="check-cache,get-preferred">
[37/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - add
Posted by ah...@apache.org.
add
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/c60efc66
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/c60efc66
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/c60efc66
Branch: refs/heads/refactor-sprite
Commit: c60efc66212a3312e483eb12d1b23db044757569
Parents: 1acc00e
Author: Alex Harui <ah...@apache.org>
Authored: Sun Oct 30 21:06:27 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 08:02:15 2016 -0700
----------------------------------------------------------------------
.../main/flex/org/apache/flex/core/IInitialViewApplication.as | 7 +++++++
1 file changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c60efc66/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IInitialViewApplication.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IInitialViewApplication.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IInitialViewApplication.as
index 2eb3e64..47f44b8 100755
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IInitialViewApplication.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IInitialViewApplication.as
@@ -20,6 +20,7 @@ package org.apache.flex.core
{
COMPILE::SWF
{
+ import flash.display.DisplayObject;
import flash.display.Stage;
}
import org.apache.flex.events.IEventDispatcher;
@@ -54,6 +55,12 @@ COMPILE::SWF
/**
* @private
*/
+ COMPILE::SWF
+ function get $displayObject():DisplayObject;
+
+ /**
+ * @private
+ */
COMPILE::JS
function get element():HTMLElement;
[40/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - clean
build after moving UIBase out of Core
Posted by ah...@apache.org.
clean build after moving UIBase out of Core
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/069904ce
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/069904ce
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/069904ce
Branch: refs/heads/refactor-sprite
Commit: 069904ce6f7f7605f8e381df0d791987a8fd60af
Parents: 7a65d3d
Author: Alex Harui <ah...@apache.org>
Authored: Sat Oct 29 22:29:12 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 08:02:15 2016 -0700
----------------------------------------------------------------------
.../src/main/config/compile-js-config.xml | 1 +
.../src/main/config/compile-js-config.xml | 1 +
.../Basic/src/main/flex/BasicClasses.as | 8 +++++++
.../flex/org/apache/flex/core/Application.as | 4 +++-
.../org/apache/flex/core/SimpleApplication.as | 4 +++-
.../main/flex/org/apache/flex/core/UIBase.as | 4 +++-
.../projects/Core/src/main/flex/CoreClasses.as | 12 +++++++++++
.../src/main/config/compile-as-config.xml | 1 +
.../src/main/config/compile-as-config.xml | 1 +
.../Graphics/src/main/flex/GraphicsClasses.as | 22 ++++++++++----------
.../projects/HTML/src/main/flex/HTMLClasses.as | 9 ++++++++
.../flex/org/apache/flex/core/Application.as | 4 +++-
.../org/apache/flex/core/SimpleApplication.as | 4 +++-
.../main/flex/org/apache/flex/core/UIBase.as | 4 ++--
14 files changed, 61 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/069904ce/frameworks/js/FlexJS/projects/DragDropJS/src/main/config/compile-js-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/projects/DragDropJS/src/main/config/compile-js-config.xml b/frameworks/js/FlexJS/projects/DragDropJS/src/main/config/compile-js-config.xml
index 10ea092..81a4671 100644
--- a/frameworks/js/FlexJS/projects/DragDropJS/src/main/config/compile-js-config.xml
+++ b/frameworks/js/FlexJS/projects/DragDropJS/src/main/config/compile-js-config.xml
@@ -54,6 +54,7 @@
if these swcs are on the external-library-path then their requires
will not be listed -->
<path-element>../../../../../libs/CoreJS.swc</path-element>
+ <path-element>../../../../../libs/HTMLJS.swc</path-element>
</library-path>
<namespaces>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/069904ce/frameworks/js/FlexJS/projects/GoogleMapsJS/src/main/config/compile-js-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/projects/GoogleMapsJS/src/main/config/compile-js-config.xml b/frameworks/js/FlexJS/projects/GoogleMapsJS/src/main/config/compile-js-config.xml
index 2a1a3e4..93c4572 100644
--- a/frameworks/js/FlexJS/projects/GoogleMapsJS/src/main/config/compile-js-config.xml
+++ b/frameworks/js/FlexJS/projects/GoogleMapsJS/src/main/config/compile-js-config.xml
@@ -58,6 +58,7 @@
if these swcs are on the external-library-path then their requires
will not be listed -->
<path-element>../../../../../libs/CoreJS.swc</path-element>
+ <path-element>../../../../../libs/HTMLJS.swc</path-element>
</library-path>
<namespaces>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/069904ce/frameworks/projects/Basic/src/main/flex/BasicClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/BasicClasses.as b/frameworks/projects/Basic/src/main/flex/BasicClasses.as
index 2c1665b..e63e9de 100644
--- a/frameworks/projects/Basic/src/main/flex/BasicClasses.as
+++ b/frameworks/projects/Basic/src/main/flex/BasicClasses.as
@@ -189,6 +189,14 @@ internal class BasicClasses
import org.apache.flex.core.SimpleApplication; SimpleApplication;
import org.apache.flex.svg.GraphicContainer; GraphicContainer;
import org.apache.flex.svg.DOMWrapper; DOMWrapper;
+
+ import org.apache.flex.svg.GraphicShape; GraphicShape;
+ import org.apache.flex.svg.Rect; Rect;
+ import org.apache.flex.svg.Ellipse; Ellipse;
+ import org.apache.flex.svg.Circle; Circle;
+ import org.apache.flex.svg.Path; Path;
+ import org.apache.flex.svg.Text; Text;
+ import org.apache.flex.svg.CompoundGraphic; CompoundGraphic;
COMPILE::SWF
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/069904ce/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Application.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Application.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Application.as
index ff6e5a6..85609cb 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Application.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Application.as
@@ -21,7 +21,9 @@ package org.apache.flex.core
import org.apache.flex.events.Event;
import org.apache.flex.events.IEventDispatcher;
import org.apache.flex.events.MouseEvent;
- import org.apache.flex.events.utils.MouseEventConverter;
+ COMPILE::SWF {
+ import org.apache.flex.events.utils.MouseEventConverter;
+ }
import org.apache.flex.utils.MXMLDataInterpreter;
import org.apache.flex.utils.Timer;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/069904ce/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/SimpleApplication.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/SimpleApplication.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/SimpleApplication.as
index b824288..7a75863 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/SimpleApplication.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/SimpleApplication.as
@@ -33,7 +33,9 @@ package org.apache.flex.core
import org.apache.flex.events.Event;
import org.apache.flex.events.IEventDispatcher;
import org.apache.flex.events.MouseEvent;
- import org.apache.flex.events.utils.MouseEventConverter;
+ COMPILE::SWF {
+ import org.apache.flex.events.utils.MouseEventConverter;
+ }
import org.apache.flex.utils.MXMLDataInterpreter;
/**
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/069904ce/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as
index ff25bd0..300b008 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as
@@ -29,7 +29,9 @@ package org.apache.flex.core
import org.apache.flex.events.IEventDispatcher;
import org.apache.flex.events.MouseEvent;
import org.apache.flex.events.ValueChangeEvent;
- import org.apache.flex.events.utils.MouseEventConverter;
+ COMPILE::SWF {
+ import org.apache.flex.events.utils.MouseEventConverter;
+ }
/**
* Set a different class for click events so that
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/069904ce/frameworks/projects/Core/src/main/flex/CoreClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/CoreClasses.as b/frameworks/projects/Core/src/main/flex/CoreClasses.as
index 6be1c0b..f34684e 100644
--- a/frameworks/projects/Core/src/main/flex/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/flex/CoreClasses.as
@@ -69,6 +69,7 @@ internal class CoreClasses
import org.apache.flex.core.ILayoutChild; ILayoutChild;
import org.apache.flex.core.ILayoutHost; ILayoutHost;
import org.apache.flex.core.IListPresentationModel; IListPresentationModel;
+ import org.apache.flex.core.IMeasurementBead; IMeasurementBead;
import org.apache.flex.core.IPanelModel; IPanelModel;
import org.apache.flex.core.IParent; IParent;
import org.apache.flex.core.IParentIUIBase; IParentIUIBase;
@@ -104,6 +105,11 @@ internal class CoreClasses
import org.apache.flex.events.EventDispatcher; EventDispatcher;
import org.apache.flex.events.IEventDispatcher; IEventDispatcher;
import org.apache.flex.events.MouseEvent; MouseEvent;
+ COMPILE::SWF
+ {
+ import org.apache.flex.core.StageProxy; StageProxy;
+ import org.apache.flex.events.utils.MouseEventConverter; MouseEventConverter;
+ }
import org.apache.flex.events.DetailEvent; DetailEvent;
import org.apache.flex.events.ValueEvent; ValueEvent;
import org.apache.flex.events.utils.MouseUtils; MouseUtils;
@@ -163,6 +169,12 @@ internal class CoreClasses
import org.apache.flex.utils.CSSUtils; CSSUtils;
import org.apache.flex.utils.Proxy; Proxy;
+ import org.apache.flex.core.HTMLElementWrapper; HTMLElementWrapper;
+
+ COMPILE::JS
+ {
+ import org.apache.flex.core.IFlexJSElement; IFlexJSElement;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/069904ce/frameworks/projects/DragDrop/src/main/config/compile-as-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/DragDrop/src/main/config/compile-as-config.xml b/frameworks/projects/DragDrop/src/main/config/compile-as-config.xml
index 87f20cb..a4892e2 100644
--- a/frameworks/projects/DragDrop/src/main/config/compile-as-config.xml
+++ b/frameworks/projects/DragDrop/src/main/config/compile-as-config.xml
@@ -24,6 +24,7 @@
<external-library-path>
<path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element>
<path-element>../../../../../libs/Core.swc</path-element>
+ <path-element>../../../../../libs/HTML.swc</path-element>
</external-library-path>
<mxml>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/069904ce/frameworks/projects/GoogleMaps/src/main/config/compile-as-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/GoogleMaps/src/main/config/compile-as-config.xml b/frameworks/projects/GoogleMaps/src/main/config/compile-as-config.xml
index e94188a..4d1d74a 100644
--- a/frameworks/projects/GoogleMaps/src/main/config/compile-as-config.xml
+++ b/frameworks/projects/GoogleMaps/src/main/config/compile-as-config.xml
@@ -24,6 +24,7 @@
<external-library-path>
<path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element>
<path-element>../../../../../libs/Core.swc</path-element>
+ <path-element>../../../../../libs/HTML.swc</path-element>
</external-library-path>
<mxml>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/069904ce/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as b/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as
index 6d7125b..a65ab50 100644
--- a/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as
+++ b/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as
@@ -28,18 +28,8 @@ package
internal class GraphicsClasses
{
- import org.apache.flex.svg.GraphicShape; GraphicShape;
- import org.apache.flex.svg.Rect; Rect;
- import org.apache.flex.svg.Ellipse; Ellipse;
- import org.apache.flex.svg.Circle; Circle;
- import org.apache.flex.svg.Image; Image;
- import org.apache.flex.svg.BinaryImage; BinaryImage;
- import org.apache.flex.svg.beads.ImageView; ImageView;
- import org.apache.flex.svg.Path; Path;
import org.apache.flex.graphics.SolidColor; SolidColor;
import org.apache.flex.graphics.SolidColorStroke; SolidColorStroke;
- import org.apache.flex.svg.Text; Text;
- import org.apache.flex.svg.CompoundGraphic; CompoundGraphic;
import org.apache.flex.svg.TransformBead; TransformBead;
import org.apache.flex.svg.ClipBead; ClipBead;
import org.apache.flex.svg.LinearGradient; LinearGradient;
@@ -48,8 +38,18 @@ internal class GraphicsClasses
import org.apache.flex.graphics.LineTo; LineTo;
import org.apache.flex.graphics.MoveTo; MoveTo;
import org.apache.flex.graphics.PathBuilder; PathBuilder;
+ COMPILE::SWF
+ {
+ import org.apache.flex.graphics.utils.PathHelper; PathHelper;
+ }
import org.apache.flex.graphics.QuadraticCurve; QuadraticCurve;
-
+ import org.apache.flex.graphics.ICircle; ICircle;
+ import org.apache.flex.graphics.ICompoundGraphic; ICompoundGraphic;
+ import org.apache.flex.graphics.IEllipse; IEllipse;
+ import org.apache.flex.graphics.IPath; IPath;
+ import org.apache.flex.graphics.IRect; IRect;
+ import org.apache.flex.graphics.IText; IText;
+
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/069904ce/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/HTMLClasses.as b/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
index 33177bb..b1714ff 100644
--- a/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
+++ b/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
@@ -192,6 +192,15 @@ internal class HTMLClasses
import org.apache.flex.svg.GraphicContainer; GraphicContainer;
import org.apache.flex.svg.DOMWrapper; DOMWrapper;
+ import org.apache.flex.svg.GraphicShape; GraphicShape;
+ import org.apache.flex.svg.Rect; Rect;
+ import org.apache.flex.svg.Ellipse; Ellipse;
+ import org.apache.flex.svg.Circle; Circle;
+ import org.apache.flex.svg.Path; Path;
+ import org.apache.flex.svg.Text; Text;
+ import org.apache.flex.svg.CompoundGraphic; CompoundGraphic;
+
+
COMPILE::SWF
{
import org.apache.flex.html.beads.HRuleView; HRuleView;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/069904ce/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as
index 0a9c69a..f8cbe01 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as
@@ -21,7 +21,9 @@ package org.apache.flex.core
import org.apache.flex.events.Event;
import org.apache.flex.events.IEventDispatcher;
import org.apache.flex.events.MouseEvent;
- import org.apache.flex.events.utils.MouseEventConverter;
+ COMPILE::SWF {
+ import org.apache.flex.events.utils.MouseEventConverter;
+ }
import org.apache.flex.utils.MXMLDataInterpreter;
import org.apache.flex.utils.Timer;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/069904ce/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/SimpleApplication.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/SimpleApplication.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/SimpleApplication.as
index 770d0b2..7198323 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/SimpleApplication.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/SimpleApplication.as
@@ -33,7 +33,9 @@ package org.apache.flex.core
import org.apache.flex.events.Event;
import org.apache.flex.events.IEventDispatcher;
import org.apache.flex.events.MouseEvent;
- import org.apache.flex.events.utils.MouseEventConverter;
+ COMPILE::SWF {
+ import org.apache.flex.events.utils.MouseEventConverter;
+ }
import org.apache.flex.utils.MXMLDataInterpreter;
/**
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/069904ce/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as
index 0e4a988..ca01f54 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as
@@ -29,9 +29,9 @@ package org.apache.flex.core
import org.apache.flex.events.IEventDispatcher;
import org.apache.flex.events.MouseEvent;
import org.apache.flex.events.ValueChangeEvent;
- import org.apache.flex.events.utils.MouseEventConverter;
COMPILE::SWF {
- import flash.display.InteractiveObject;
+ import flash.display.InteractiveObject;
+ import org.apache.flex.events.utils.MouseEventConverter;
}
/**
[28/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - fork
of UIBase UIButtonBase
Posted by ah...@apache.org.
fork of UIBase UIButtonBase
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/6622b253
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/6622b253
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/6622b253
Branch: refs/heads/refactor-sprite
Commit: 6622b25347cda405807927762eab9472acab0c46
Parents: 975d3f3
Author: Alex Harui <ah...@apache.org>
Authored: Fri Oct 28 08:07:19 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:55:20 2016 -0700
----------------------------------------------------------------------
.../main/flex/org/apache/flex/core/UIBase.as | 1483 ++++++++++++++++++
.../flex/org/apache/flex/core/UIButtonBase.as | 862 ++++++++++
2 files changed, 2345 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6622b253/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as
new file mode 100644
index 0000000..ff25bd0
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as
@@ -0,0 +1,1483 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ COMPILE::SWF
+ {
+ import flash.display.DisplayObject;
+ import flash.display.Sprite;
+ import flash.display.Stage;
+ }
+
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.ValueChangeEvent;
+ import org.apache.flex.events.utils.MouseEventConverter;
+
+ /**
+ * Set a different class for click events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="click", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * Set a different class for rollOver events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="rollOver", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * Set a different class for rollOut events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="rollOut", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * Set a different class for mouseDown events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="mouseDown", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * Set a different class for mouseUp events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="mouseUp", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * Set a different class for mouseMove events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="mouseMove", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * Set a different class for mouseOut events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="mouseOut", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * Set a different class for mouseOver events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="mouseOver", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * The UIBase class is the base class for most composite user interface
+ * components. For the Flash Player, Buttons and Text controls may
+ * have a different base class and therefore may not extend UIBase.
+ * However all user interface components should implement IUIBase.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class UIBase extends HTMLElementWrapper implements IStrandWithModel, IEventDispatcher, IParentIUIBase, IStyleableObject, ILayoutChild, IFlexJSElement
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function UIBase()
+ {
+ super();
+
+ COMPILE::SWF
+ {
+ MouseEventConverter.setupInstanceConverters(this);
+ }
+
+ COMPILE::JS
+ {
+ createElement();
+ }
+ }
+
+ private var _explicitWidth:Number;
+
+ /**
+ * The explicitly set width (as opposed to measured width
+ * or percentage width).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get explicitWidth():Number
+ {
+ return _explicitWidth;
+ }
+
+ /**
+ * @private
+ */
+ public function set explicitWidth(value:Number):void
+ {
+ if (_explicitWidth == value)
+ return;
+
+ // width can be pixel or percent not both
+ if (!isNaN(value))
+ _percentWidth = NaN;
+
+ _explicitWidth = value;
+
+ dispatchEvent(new Event("explicitWidthChanged"));
+ }
+
+ private var _explicitHeight:Number;
+
+ /**
+ * The explicitly set width (as opposed to measured width
+ * or percentage width).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get explicitHeight():Number
+ {
+ return _explicitHeight;
+ }
+
+ /**
+ * @private
+ */
+ public function set explicitHeight(value:Number):void
+ {
+ if (_explicitHeight == value)
+ return;
+
+ // height can be pixel or percent not both
+ if (!isNaN(value))
+ _percentHeight = NaN;
+
+ _explicitHeight = value;
+
+ dispatchEvent(new Event("explicitHeightChanged"));
+ }
+
+ private var _percentWidth:Number;
+
+ /**
+ * The requested percentage width this component
+ * should have in the parent container. Note that
+ * the actual percentage may be different if the
+ * total is more than 100% or if there are other
+ * components with explicitly set widths.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get percentWidth():Number
+ {
+ return _percentWidth;
+ }
+
+ /**
+ * @private
+ */
+ public function set percentWidth(value:Number):void
+ {
+ COMPILE::SWF {
+ if (_percentWidth == value)
+ return;
+
+ if (!isNaN(value))
+ _explicitWidth = NaN;
+
+ _percentWidth = value;
+ }
+ COMPILE::JS {
+ this._percentWidth = value;
+ this.positioner.style.width = value.toString() + '%';
+ if (!isNaN(value))
+ this._explicitWidth = NaN;
+ }
+
+ dispatchEvent(new Event("percentWidthChanged"));
+ }
+
+ private var _percentHeight:Number;
+
+ /**
+ * The requested percentage height this component
+ * should have in the parent container. Note that
+ * the actual percentage may be different if the
+ * total is more than 100% or if there are other
+ * components with explicitly set heights.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get percentHeight():Number
+ {
+ return _percentHeight;
+ }
+
+ /**
+ * @private
+ */
+ public function set percentHeight(value:Number):void
+ {
+ COMPILE::SWF {
+ if (_percentHeight == value)
+ return;
+
+ if (!isNaN(value))
+ _explicitHeight = NaN;
+
+ _percentHeight = value;
+ }
+
+ COMPILE::JS {
+ this._percentHeight = value;
+ this.positioner.style.height = value.toString() + '%';
+ if (!isNaN(value))
+ this._explicitHeight = NaN;
+ }
+
+ dispatchEvent(new Event("percentHeightChanged"));
+ }
+
+ private var _width:Number;
+
+ [Bindable("widthChanged")]
+ [PercentProxy("percentWidth")]
+ /**
+ * The width of the component. If no width has been previously
+ * set the default width may be specified in the IValuesImpl
+ * or determined as the bounding box around all child
+ * components and graphics.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ override public function get width():Number
+ {
+ var w:Number = _width;
+ if (isNaN(w)) {
+ w = $width;
+ }
+ return w;
+ }
+
+ /**
+ * @flexjsignorecoercion String
+ */
+ COMPILE::JS
+ public function get width():Number
+ {
+ var pixels:Number;
+ var strpixels:String = positioner.style.width as String;
+ if (strpixels !== null && strpixels.indexOf('%') != -1)
+ pixels = NaN;
+ else
+ pixels = parseFloat(strpixels);
+ if (isNaN(pixels)) {
+ pixels = positioner.offsetWidth;
+ if (pixels === 0 && positioner.scrollWidth !== 0) {
+ // invisible child elements cause offsetWidth to be 0.
+ pixels = positioner.scrollWidth;
+ }
+ }
+ return pixels;
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ override public function set width(value:Number):void
+ {
+ if (explicitWidth != value)
+ {
+ explicitWidth = value;
+ }
+
+ setWidth(value);
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::JS
+ public function set width(value:Number):void
+ {
+ if (explicitWidth != value)
+ {
+ explicitWidth = value;
+ }
+
+ setWidth(value);
+ }
+
+ /**
+ * Retrieve the low-level bounding box width.
+ * Not implemented in JS.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public function get $width():Number
+ {
+ return super.width;
+ }
+
+ private var _height:Number;
+
+ [Bindable("heightChanged")]
+ [PercentProxy("percentHeight")]
+ /**
+ * The height of the component. If no height has been previously
+ * set the default height may be specified in the IValuesImpl
+ * or determined as the bounding box around all child
+ * components and graphics.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ override public function get height():Number
+ {
+ var h:Number = _height;
+ if (isNaN(h)) {
+ h = $height;
+ }
+ return h;
+ }
+
+ /**
+ * @flexjsignorecoercion String
+ */
+ COMPILE::JS
+ public function get height():Number
+ {
+ var pixels:Number;
+ var strpixels:String = positioner.style.height as String;
+ if (strpixels !== null && strpixels.indexOf('%') != -1)
+ pixels = NaN;
+ else
+ pixels = parseFloat(strpixels);
+ if (isNaN(pixels)) {
+ pixels = positioner.offsetHeight;
+ if (pixels === 0 && positioner.scrollHeight !== 0) {
+ // invisible child elements cause offsetHeight to be 0.
+ pixels = positioner.scrollHeight;
+ }
+ }
+ return pixels;
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ override public function set height(value:Number):void
+ {
+ if (explicitHeight != value)
+ {
+ explicitHeight = value;
+ }
+
+ setHeight(value);
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::JS
+ public function set height(value:Number):void
+ {
+ if (explicitHeight != value)
+ {
+ explicitHeight = value;
+ }
+
+ setHeight(value);
+ }
+
+ /**
+ * Retrieve the low-level bounding box height.
+ * Not implemented in JS.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public function get $height():Number
+ {
+ return super.height;
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#setHeight
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setHeight(value:Number, noEvent:Boolean = false):void
+ {
+ if (_height != value)
+ {
+ _height = value;
+ COMPILE::JS
+ {
+ this.positioner.style.height = value.toString() + 'px';
+ }
+ if (!noEvent)
+ dispatchEvent(new Event("heightChanged"));
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#setWidth
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setWidth(value:Number, noEvent:Boolean = false):void
+ {
+ if (_width != value)
+ {
+ _width = value;
+ COMPILE::JS
+ {
+ this.positioner.style.width = value.toString() + 'px';
+ }
+ if (!noEvent)
+ dispatchEvent(new Event("widthChanged"));
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#setWidthAndHeight
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setWidthAndHeight(newWidth:Number, newHeight:Number, noEvent:Boolean = false):void
+ {
+ if (_width != newWidth)
+ {
+ _width = newWidth;
+ COMPILE::JS
+ {
+ this.positioner.style.width = newWidth.toString() + 'px';
+ }
+ if (!noEvent)
+ dispatchEvent(new Event("widthChanged"));
+ }
+ if (_height != newHeight)
+ {
+ _height = newHeight;
+ COMPILE::JS
+ {
+ this.positioner.style.height = newHeight.toString() + 'px';
+ }
+ if (!noEvent)
+ dispatchEvent(new Event("heightChanged"));
+ }
+ dispatchEvent(new Event("sizeChanged"));
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#isWidthSizedToContent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function isWidthSizedToContent():Boolean
+ {
+ if (!isNaN(_explicitWidth))
+ return false;
+ if (!isNaN(_percentWidth))
+ return false;
+ var left:* = ValuesManager.valuesImpl.getValue(this, "left");
+ var right:* = ValuesManager.valuesImpl.getValue(this, "right");
+ return (left === undefined || right === undefined);
+
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#isHeightSizedToContent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function isHeightSizedToContent():Boolean
+ {
+ if (!isNaN(_explicitHeight))
+ return false;
+ if (!isNaN(_percentHeight))
+ return false;
+ var top:* = ValuesManager.valuesImpl.getValue(this, "top");
+ var bottom:* = ValuesManager.valuesImpl.getValue(this, "bottom");
+ return (top === undefined || bottom === undefined);
+ }
+
+ private var _x:Number;
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ override public function set x(value:Number):void
+ {
+ super.x = _x = value;
+ if (!style)
+ style = { left: value };
+ else
+ style.left = value;
+ }
+
+ COMPILE::JS
+ public function set x(value:Number):void
+ {
+ positioner.style.position = 'absolute';
+ positioner.style.left = value.toString() + 'px';
+ }
+
+ /**
+ * @flexjsignorecoercion String
+ */
+ COMPILE::JS
+ public function get x():Number
+ {
+ var strpixels:String = positioner.style.left as String;
+ var pixels:Number = parseFloat(strpixels);
+ if (isNaN(pixels))
+ pixels = positioner.offsetLeft;
+ return pixels;
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#setX
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setX(value:Number):void
+ {
+ COMPILE::SWF
+ {
+ super.x = value;
+ }
+ COMPILE::JS
+ {
+ positioner.style.position = 'absolute';
+ positioner.style.left = value.toString() + 'px';
+ }
+ }
+
+ private var _y:Number;
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ override public function set y(value:Number):void
+ {
+ super.y = _y = value;
+ if (!style)
+ style = { top: value };
+ else
+ style.top = value;
+ }
+
+ COMPILE::JS
+ public function set y(value:Number):void
+ {
+ positioner.style.position = 'absolute';
+ positioner.style.top = value.toString() + 'px';
+ }
+
+ /**
+ * @flexjsignorecoercion String
+ */
+ COMPILE::JS
+ public function get y():Number
+ {
+ var strpixels:String = positioner.style.top as String;
+ var pixels:Number = parseFloat(strpixels);
+ if (isNaN(pixels))
+ pixels = positioner.offsetTop;
+ return pixels;
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#setY
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setY(value:Number):void
+ {
+ COMPILE::SWF
+ {
+ super.y = value;
+ }
+ COMPILE::JS
+ {
+ positioner.style.position = 'absolute';
+ positioner.style.top = value.toString() + 'px';
+ }
+ }
+
+ /**
+ * @private
+ */
+ [Bindable("visibleChanged")]
+ COMPILE::SWF
+ override public function set visible(value:Boolean):void
+ {
+ super.visible = value;
+ dispatchEvent(new Event(value?"show":"hide"));
+ dispatchEvent(new Event("visibleChanged"));
+ }
+
+ COMPILE::JS
+ private var displayStyleForLayout:String;
+
+ /**
+ * The display style is used for both visible
+ * and layout so is managed as a special case.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::JS
+ public function setDisplayStyleForLayout(value:String):void
+ {
+ if (positioner.style.display !== 'none')
+ positioner.style.display = value;
+ else
+ displayStyleForLayout = value;
+ }
+
+ COMPILE::JS
+ public function get visible():Boolean
+ {
+ return positioner.style.display !== 'none';
+ }
+
+ COMPILE::JS
+ public function set visible(value:Boolean):void
+ {
+ var oldValue:Boolean = positioner.style.display !== 'none';
+ if (value !== oldValue)
+ {
+ if (!value)
+ {
+ displayStyleForLayout = positioner.style.display;
+ positioner.style.display = 'none';
+ dispatchEvent(new Event('hide'));
+ }
+ else
+ {
+ if (displayStyleForLayout)
+ positioner.style.display = displayStyleForLayout;
+ dispatchEvent(new Event('show'));
+ }
+ dispatchEvent(new Event('visibleChanged'));
+ }
+ }
+
+ /**
+ * @return The array of children.
+ * @flexjsignorecoercion Array
+ */
+ COMPILE::JS
+ public function internalChildren():Array
+ {
+ return element.childNodes as Array;
+ }
+
+ COMPILE::SWF
+ private var _model:IBeadModel;
+
+ /**
+ * An IBeadModel that serves as the data model for the component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public function get model():Object
+ {
+ if (_model == null)
+ {
+ // addbead will set _model
+ addBead(new (ValuesManager.valuesImpl.getValue(this, "iBeadModel")) as IBead);
+ }
+ return _model;
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ public function set model(value:Object):void
+ {
+ if (_model != value)
+ {
+ addBead(value as IBead);
+ dispatchEvent(new Event("modelChanged"));
+ }
+ }
+
+ private var _view:IBeadView;
+
+ /**
+ * An IBeadView that serves as the view for the component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion Class
+ */
+ public function get view():IBeadView
+ {
+ if (_view == null)
+ {
+ var c:Class = ValuesManager.valuesImpl.getValue(this, "iBeadView") as Class;
+ if (c)
+ {
+ if (c)
+ {
+ _view = (new c()) as IBeadView;
+ addBead(_view);
+ }
+ }
+ }
+ return _view;
+ }
+
+ /**
+ * @private
+ */
+ public function set view(value:IBeadView):void
+ {
+ if (_view != value)
+ {
+ addBead(value as IBead);
+ dispatchEvent(new Event("viewChanged"));
+ }
+ }
+
+ private var _id:String;
+
+ /**
+ * An id property for MXML documents.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get id():String
+ {
+ return _id;
+ }
+
+ /**
+ * @private
+ */
+ public function set id(value:String):void
+ {
+ if (_id != value)
+ {
+ _id = value;
+ dispatchEvent(new Event("idChanged"));
+ }
+ }
+
+ private var _style:Object;
+
+ /**
+ * The object that contains
+ * "styles" and other associated
+ * name-value pairs. You can
+ * also specify a string in
+ * HTML style attribute format.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get style():Object
+ {
+ return _style;
+ }
+
+ /**
+ * @private
+ * @flexjsignorecoercion String
+ */
+ public function set style(value:Object):void
+ {
+ if (_style != value)
+ {
+ if (value is String)
+ {
+ _style = ValuesManager.valuesImpl.parseStyles(value as String);
+ }
+ else
+ _style = value;
+ if (!isNaN(_y))
+ _style.top = _y;
+ if (!isNaN(_x))
+ _style.left = _x;
+ dispatchEvent(new Event("stylesChanged"));
+ }
+ }
+
+ /**
+ * A list of type names. Often used for CSS
+ * type selector lookups.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var typeNames:String;
+
+ private var _className:String;
+
+ /**
+ * The classname. Often used for CSS
+ * class selector lookups.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get className():String
+ {
+ return _className;
+ }
+
+ /**
+ * @private
+ */
+ public function set className(value:String):void
+ {
+ if (_className != value)
+ {
+ COMPILE::JS
+ {
+ element.className = typeNames ? value + ' ' + typeNames : value;
+ }
+ _className = value;
+ dispatchEvent(new Event("classNameChanged"));
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IUIBase#element
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public function get element():IFlexJSElement
+ {
+ return this;
+ }
+
+ /**
+ * @copy org.apache.flex.core.Application#beads
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var beads:Array;
+
+ COMPILE::SWF
+ private var _beads:Vector.<IBead>;
+
+ /**
+ * @copy org.apache.flex.core.IStrand#addBead()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function addBead(bead:IBead):void
+ {
+ if (!_beads)
+ _beads = new Vector.<IBead>;
+ _beads.push(bead);
+ if (bead is IBeadModel)
+ _model = bead as IBeadModel;
+ else if (bead is IBeadView)
+ _view = bead as IBeadView;
+ bead.strand = this;
+
+ if (bead is IBeadView) {
+ IEventDispatcher(this).dispatchEvent(new Event("viewChanged"));
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IStrand#getBeadByType()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public function getBeadByType(classOrInterface:Class):IBead
+ {
+ for each (var bead:IBead in _beads)
+ {
+ if (bead is classOrInterface)
+ return bead;
+ }
+ return null;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IStrand#removeBead()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public function removeBead(value:IBead):IBead
+ {
+ var n:int = _beads.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var bead:IBead = _beads[i];
+ if (bead == value)
+ {
+ _beads.splice(i, 1);
+ return bead;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#addElement()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function addElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ COMPILE::SWF
+ {
+ if (c is IUIBase)
+ {
+ addChild(IUIBase(c).element as DisplayObject);
+ IUIBase(c).addedToParent();
+ }
+ else
+ addChild(c as DisplayObject);
+ }
+ COMPILE::JS
+ {
+ element.appendChild(c.positioner);
+ c.addedToParent();
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#addElementAt()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ {
+ COMPILE::SWF
+ {
+ if (c is IUIBase)
+ {
+ addChildAt(IUIBase(c).element as DisplayObject, index);
+ IUIBase(c).addedToParent();
+ }
+ else
+ addChildAt(c as DisplayObject, index);
+ }
+ COMPILE::JS
+ {
+ var children:Array = internalChildren();
+ if (index >= children.length)
+ addElement(c);
+ else
+ {
+ element.insertBefore(c.positioner,
+ children[index]);
+ c.addedToParent();
+ }
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#getElementAt()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getElementAt(index:int):Object
+ {
+ COMPILE::SWF
+ {
+ return getChildAt(index);
+ }
+ COMPILE::JS
+ {
+ var children:Array = internalChildren();
+ return children[index].flexjs_wrapper;
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#getElementIndex()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getElementIndex(c:Object):int
+ {
+ COMPILE::SWF
+ {
+ if (c is IUIBase)
+ return getChildIndex(IUIBase(c).element as DisplayObject);
+ else
+ return getChildIndex(c as DisplayObject);
+ }
+ COMPILE::JS
+ {
+ var children:Array = internalChildren();
+ var n:int = children.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ if (children[i] == c.element)
+ return i;
+ }
+ return -1;
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#removeElement()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ COMPILE::SWF
+ {
+ if (c is IUIBase)
+ removeChild(IUIBase(c).element as DisplayObject);
+ else
+ removeChild(c as DisplayObject);
+ }
+ COMPILE::JS
+ {
+ element.removeChild(c.element);
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#numElements
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get numElements():int
+ {
+ COMPILE::SWF
+ {
+ return numChildren;
+ }
+ COMPILE::JS
+ {
+ var children:Array = internalChildren();
+ return children.length;
+ }
+ }
+
+ /**
+ * The method called when added to a parent. This is a good
+ * time to set up beads.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion Class
+ * @flexjsignorecoercion Number
+ */
+ public function addedToParent():void
+ {
+ var c:Class;
+
+ COMPILE::JS
+ {
+ if (style)
+ ValuesManager.valuesImpl.applyStyles(this, style);
+ }
+
+ if (isNaN(_explicitWidth) && isNaN(_percentWidth))
+ {
+ var value:* = ValuesManager.valuesImpl.getValue(this,"width");
+ if (value !== undefined)
+ {
+ if (value is String)
+ {
+ var s:String = String(value);
+ if (s.indexOf("%") != -1)
+ _percentWidth = Number(s.substring(0, s.length - 1));
+ else
+ {
+ if (s.indexOf("px") != -1)
+ s = s.substring(0, s.length - 2);
+ _width = _explicitWidth = Number(s);
+ }
+ }
+ else
+ _width = _explicitWidth = value as Number;
+ }
+ }
+
+ if (isNaN(_explicitHeight) && isNaN(_percentHeight))
+ {
+ value = ValuesManager.valuesImpl.getValue(this,"height");
+ if (value !== undefined)
+ {
+ if (value is String)
+ {
+ s = String(value);
+ if (s.indexOf("%") != -1)
+ _percentHeight = Number(s.substring(0, s.length - 1));
+ else
+ {
+ if (s.indexOf("px") != -1)
+ s = s.substring(0, s.length - 2);
+ _height = _explicitHeight = Number(s);
+ }
+ }
+ else
+ _height = _explicitHeight = value as Number;
+ }
+ }
+
+ for each (var bead:IBead in beads)
+ addBead(bead);
+
+ if (getBeadByType(IBeadModel) == null)
+ {
+ c = ValuesManager.valuesImpl.getValue(this, "iBeadModel") as Class;
+ if (c)
+ {
+ var model:IBeadModel = new c as IBeadModel;
+ if (model)
+ addBead(model);
+ }
+ }
+ if (_view == null && getBeadByType(IBeadView) == null)
+ {
+ c = ValuesManager.valuesImpl.getValue(this, "iBeadView") as Class;
+ if (c)
+ {
+ var view:IBeadView = new c as IBeadView;
+ if (view)
+ addBead(view);
+ }
+ }
+ if (getBeadByType(IBeadController) == null)
+ {
+ c = ValuesManager.valuesImpl.getValue(this, "iBeadController") as Class;
+ if (c)
+ {
+ var controller:IBeadController = new c as IBeadController;
+ if (controller)
+ addBead(controller);
+ }
+ }
+ dispatchEvent(new Event("beadsAdded"));
+ }
+
+ /**
+ * A measurement bead, if one exists.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get measurementBead() : IMeasurementBead
+ {
+ var measurementBead:IMeasurementBead = getBeadByType(IMeasurementBead) as IMeasurementBead;
+ if( measurementBead == null ) {
+ addBead(measurementBead = new (ValuesManager.valuesImpl.getValue(this, "iMeasurementBead")) as IMeasurementBead);
+ }
+
+ return measurementBead;
+ }
+
+ COMPILE::SWF
+ private var _stageProxy:StageProxy;
+
+ /**
+ * @copy org.apache.flex.core.IUIBase#topMostEventDispatcher
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion org.apache.flex.events.IEventDispatcher
+ */
+ public function get topMostEventDispatcher():IEventDispatcher
+ {
+ COMPILE::SWF
+ {
+ if (!_stageProxy)
+ {
+ _stageProxy = new StageProxy(stage);
+ _stageProxy.addEventListener("removedFromStage", stageProxy_removedFromStageHandler);
+ }
+
+ return _stageProxy;
+ }
+ COMPILE::JS
+ {
+ var e:WrappedHTMLElement = document.body as WrappedHTMLElement;
+ return e.flexjs_wrapper as IEventDispatcher;
+ }
+ }
+
+ COMPILE::SWF
+ private function stageProxy_removedFromStageHandler(event:Event):void
+ {
+ _stageProxy = null;
+ }
+
+ /**
+ * Rebroadcast an event from a sub component from the component.
+ */
+ protected function repeaterListener(event:Event):void
+ {
+ dispatchEvent(event);
+ }
+
+ COMPILE::JS
+ private var _positioner:WrappedHTMLElement;
+
+ /**
+ * The HTMLElement used to position the component.
+ */
+ COMPILE::JS
+ public function get positioner():WrappedHTMLElement
+ {
+ return _positioner;
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::JS
+ public function set positioner(value:WrappedHTMLElement):void
+ {
+ _positioner = value;
+ }
+
+ /**
+ * @return The actual element to be parented.
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ protected function createElement():WrappedHTMLElement
+ {
+ if (element == null)
+ element = document.createElement('div') as WrappedHTMLElement;
+ if (positioner == null)
+ positioner = element;
+ positioner.style.display = 'block';
+ positioner.style.position = 'relative';
+
+ element.flexjs_wrapper = this;
+
+ return positioner;
+ }
+
+
+ /**
+ * The HTMLElement used to position the component.
+ * @flexjsignorecoercion String
+ */
+ COMPILE::JS
+ public function get alpha():Number
+ {
+ var stralpha:String = positioner.style.opacity as String;
+ var alpha:Number = parseFloat(stralpha);
+ return alpha;
+ }
+
+ COMPILE::JS
+ public function set alpha(value:Number):void
+ {
+ positioner.style.opacity = value;
+ }
+
+ /**
+ * @param value The event containing new style properties.
+ */
+ COMPILE::JS
+ protected function styleChangeHandler(value:ValueChangeEvent):void
+ {
+ var newStyle:Object = {};
+ newStyle[value.propertyName] = value.newValue;
+ ValuesManager.valuesImpl.applyStyles(this, newStyle);
+ };
+
+ /**
+ * @param value The event containing new style properties.
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion org.apache.flex.core.IUIBase
+ */
+ COMPILE::JS
+ public function get parent():IUIBase
+ {
+ var p:WrappedHTMLElement = this.positioner.parentNode as WrappedHTMLElement;
+ var wrapper:IUIBase = p ? p.flexjs_wrapper as IUIBase : null;
+ return wrapper;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6622b253/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIButtonBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIButtonBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIButtonBase.as
new file mode 100644
index 0000000..d158665
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIButtonBase.as
@@ -0,0 +1,862 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ import flash.display.DisplayObject;
+ import flash.display.SimpleButton;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IMeasurementBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.utils.MouseEventConverter;
+ import org.apache.flex.events.IEventDispatcher;
+
+ //--------------------------------------
+ // Events
+ //--------------------------------------
+
+ /**
+ * Set a different class for click events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="click", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * The UIButtonBase class is the base class for most Buttons in a FlexJS
+ * application. In Flash, these buttons extend SimpleButton and therefore
+ * do not support all of the Sprite APIs.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public class UIButtonBase extends SimpleButton implements IStrandWithModel, IEventDispatcher, IUIBase, IStyleableObject, ILayoutChild, IFlexJSElement
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function UIButtonBase(upState:DisplayObject=null, overState:DisplayObject=null, downState:DisplayObject=null, hitTestState:DisplayObject=null)
+ {
+ super(upState, overState, downState, hitTestState);
+ // mouseChildren = true;
+ // mouseEnabled = true;
+ MouseEventConverter.setupInstanceConverters(this);
+ }
+
+ private var _x:Number;
+
+ /**
+ * @private
+ */
+ override public function set x(value:Number):void
+ {
+ if (super.x != value) {
+ super.x = _x = value;
+ if (!style)
+ style = { left: value };
+ else
+ style.left = value;
+ dispatchEvent(new Event("xChanged"));
+ }
+ }
+
+ private var _y:Number;
+
+ /**
+ * @private
+ */
+ override public function set y(value:Number):void
+ {
+ if (super.y != value) {
+ super.y = _y = value;
+ if (!style)
+ style = { top: value };
+ else
+ style.top = value;
+ dispatchEvent(new Event("yChanged"));
+ }
+ }
+
+ /**
+ * Retrieve the low-level bounding box y.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function get $y():Number
+ {
+ return super.y;
+ }
+
+ private var _explicitWidth:Number;
+
+ /**
+ * The explicitly set width (as opposed to measured width
+ * or percentage width).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get explicitWidth():Number
+ {
+ if (isNaN(_explicitWidth))
+ {
+ var value:* = ValuesManager.valuesImpl.getValue(this, "width");
+ if (value !== undefined) {
+ _explicitWidth = Number(value);
+ }
+ }
+
+ return _explicitWidth;
+ }
+
+ /**
+ * @private
+ */
+ public function set explicitWidth(value:Number):void
+ {
+ if (_explicitWidth == value)
+ return;
+
+ // width can be pixel or percent not both
+ if (!isNaN(value))
+ _percentWidth = NaN;
+
+ _explicitWidth = value;
+
+ dispatchEvent(new Event("explicitWidthChanged"));
+ }
+
+ private var _explicitHeight:Number;
+
+ /**
+ * The explicitly set width (as opposed to measured width
+ * or percentage width).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get explicitHeight():Number
+ {
+ if (isNaN(_explicitHeight))
+ {
+ var value:* = ValuesManager.valuesImpl.getValue(this, "height");
+ if (value !== undefined) {
+ _explicitHeight = Number(value);
+ }
+ }
+
+ return _explicitHeight;
+ }
+
+ /**
+ * @private
+ */
+ public function set explicitHeight(value:Number):void
+ {
+ if (_explicitHeight == value)
+ return;
+
+ // height can be pixel or percent not both
+ if (!isNaN(value))
+ _percentHeight = NaN;
+
+ _explicitHeight = value;
+
+ dispatchEvent(new Event("explicitHeightChanged"));
+ }
+
+ private var _percentWidth:Number;
+
+ /**
+ * The requested percentage width this component
+ * should have in the parent container. Note that
+ * the actual percentage may be different if the
+ * total is more than 100% or if there are other
+ * components with explicitly set widths.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get percentWidth():Number
+ {
+ return _percentWidth;
+ }
+
+ /**
+ * @private
+ */
+ public function set percentWidth(value:Number):void
+ {
+ if (_percentWidth == value)
+ return;
+
+ if (!isNaN(value))
+ _explicitWidth = NaN;
+
+ _percentWidth = value;
+
+ dispatchEvent(new Event("percentWidthChanged"));
+ }
+
+ private var _percentHeight:Number;
+
+ /**
+ * The requested percentage height this component
+ * should have in the parent container. Note that
+ * the actual percentage may be different if the
+ * total is more than 100% or if there are other
+ * components with explicitly set heights.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get percentHeight():Number
+ {
+ return _percentHeight;
+ }
+
+ /**
+ * @private
+ */
+ public function set percentHeight(value:Number):void
+ {
+ if (_percentHeight == value)
+ return;
+
+ if (!isNaN(value))
+ _explicitHeight = NaN;
+
+ _percentHeight = value;
+
+ dispatchEvent(new Event("percentHeightChanged"));
+ }
+
+ private var _width:Number;
+
+ [Bindable("widthChanged")]
+ [PercentProxy("percentWidth")]
+ /**
+ * @copy org.apache.flex.core.UIBase#width
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function get width():Number
+ {
+ if (isNaN(explicitWidth))
+ {
+ var w:Number = _width;
+ if (isNaN(w)) w = $width;
+ return w;
+ }
+ else
+ return explicitWidth;
+ }
+
+ /**
+ * @private
+ */
+ override public function set width(value:Number):void
+ {
+ if (explicitWidth != value)
+ {
+ explicitWidth = value;
+ }
+
+ setWidth(value);
+ }
+
+ /**
+ * Retrieve the low-level bounding box width.
+ * Not implemented in JS.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get $width():Number
+ {
+ return super.width;
+ }
+
+ private var _height:Number;
+
+ [Bindable("heightChanged")]
+ [PercentProxy("percentHeight")]
+ /**
+ * @copy org.apache.flex.core.UIBase#width
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function get height():Number
+ {
+ if (isNaN(explicitHeight))
+ {
+ var h:Number = _height;
+ if (isNaN(h)) h = $height;
+ return h;
+ }
+ else
+ return explicitHeight;
+ }
+
+ /**
+ * @private
+ */
+ override public function set height(value:Number):void
+ {
+ if (explicitHeight != value)
+ {
+ explicitHeight = value;
+ }
+
+ setHeight(value);
+ }
+
+ /**
+ * Retrieve the low-level bounding box height.
+ * Not implemented in JS.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get $height():Number
+ {
+ return super.height;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IUIBase#setHeight
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setHeight(value:Number, noEvent:Boolean = false):void
+ {
+ if (_height != value)
+ {
+ _height = value;
+ if (!noEvent)
+ dispatchEvent(new Event("heightChanged"));
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IUIBase#setWidth
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setWidth(value:Number, noEvent:Boolean = false):void
+ {
+ if (_width != value)
+ {
+ _width = value;
+ if (!noEvent)
+ dispatchEvent(new Event("widthChanged"));
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IUIBase#setWidthAndHeight
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setWidthAndHeight(newWidth:Number, newHeight:Number, noEvent:Boolean = false):void
+ {
+ if (_width != newWidth)
+ {
+ _width = newWidth;
+ if (_height == newHeight)
+ if (!noEvent)
+ dispatchEvent(new Event("widthChanged"));
+ }
+ if (_height != newHeight)
+ {
+ _height = newHeight;
+ if (!noEvent)
+ dispatchEvent(new Event("heightChanged"));
+ }
+ dispatchEvent(new Event("sizeChanged"));
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#isWidthSizedToContent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function isWidthSizedToContent():Boolean
+ {
+ return (isNaN(_explicitWidth) && isNaN(_percentWidth));
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#setX
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setX(value:Number):void
+ {
+ super.x = value;
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#setY
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setY(value:Number):void
+ {
+ super.y = value;
+ }
+
+ /**
+ * @private
+ */
+ [Bindable("visibleChanged")]
+ override public function set visible(value:Boolean):void
+ {
+ super.visible = value;
+ dispatchEvent(new Event(value?"show":"hide"));
+ dispatchEvent(new Event("visibleChanged"));
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#isHeightSizedToContent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function isHeightSizedToContent():Boolean
+ {
+ return (isNaN(_explicitHeight) && isNaN(_percentHeight));
+ }
+
+ private var _model:IBeadModel;
+
+ /**
+ * @copy org.apache.flex.core.UIBase#model
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get model():Object
+ {
+ if (_model == null)
+ {
+ // addbead will set _model
+ addBead(new (ValuesManager.valuesImpl.getValue(this, "iBeadModel")) as IBead);
+ }
+ return _model;
+ }
+
+ /**
+ * @private
+ */
+ public function set model(value:Object):void
+ {
+ if (_model != value)
+ {
+ addBead(value as IBead);
+ dispatchEvent(new Event("modelChanged"));
+ }
+ }
+
+ private var _view:IBeadView;
+
+ /**
+ * An IBeadView that serves as the view for the component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get view():IBeadView
+ {
+ if (_view == null)
+ {
+ var c:Class = ValuesManager.valuesImpl.getValue(this, "iBeadView") as Class;
+ if (c)
+ {
+ _view = (new c()) as IBeadView;
+ addBead(_view);
+ }
+ }
+ return _view;
+ }
+
+ /**
+ * @private
+ */
+ public function set view(value:IBeadView):void
+ {
+ if (_view != value)
+ {
+ addBead(value as IBead);
+ dispatchEvent(new Event("viewChanged"));
+ }
+ }
+
+ private var _id:String;
+
+ /**
+ * @copy org.apache.flex.core.UIBase#id
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get id():String
+ {
+ return _id;
+ }
+
+ /**
+ * @private
+ */
+ public function set id(value:String):void
+ {
+ if (_id != value)
+ {
+ _id = value;
+ dispatchEvent(new Event("idChanged"));
+ }
+ }
+
+ private var _styles:Object;
+
+ /**
+ * The object that contains
+ * "styles" and other associated
+ * name-value pairs. You can
+ * also specify a string in
+ * HTML style attribute format.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get style():Object
+ {
+ return _styles;
+ }
+
+ /**
+ * @private
+ */
+ public function set style(value:Object):void
+ {
+ if (value is String)
+ _styles = ValuesManager.valuesImpl.parseStyles(value as String);
+ else
+ _styles = value;
+ if (!isNaN(_y))
+ _styles.top = _y;
+ if (!isNaN(_x))
+ _styles.left = _x;
+ dispatchEvent(new Event("stylesChanged"));
+ }
+
+ /**
+ * The styles for this object formatted
+ * as an HTML style attribute. While this
+ * may be a convenient and less verbose
+ * way of specifying styles than using
+ * the style object, you run the risk of
+ * having a typo.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set styleString(value:String):void
+ {
+ _styles = JSON.parse("{" + value + "}");
+ }
+
+ /**
+ * A list of type names. Often used for CSS
+ * type selector lookups.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var typeNames:String;
+
+ private var _className:String;
+
+ /**
+ * @copy org.apache.flex.core.UIBase#className
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get className():String
+ {
+ return _className;
+ }
+
+ /**
+ * @private
+ */
+ public function set className(value:String):void
+ {
+ if (_className != value)
+ {
+ _className = value;
+ dispatchEvent(new Event("classNameChanged"));
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.UIBase#element
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get element():IFlexJSElement
+ {
+ return this;
+ }
+
+ /**
+ * @copy org.apache.flex.core.UIBase#beads
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var beads:Array;
+
+ private var strand:Vector.<IBead>;
+
+ /**
+ * @copy org.apache.flex.core.UIBase#addBead()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function addBead(bead:IBead):void
+ {
+ if (!strand)
+ strand = new Vector.<IBead>;
+ strand.push(bead);
+ if (bead is IBeadModel)
+ _model = bead as IBeadModel;
+ else if (bead is IBeadView)
+ _view = bead as IBeadView;
+ bead.strand = this;
+ }
+
+ /**
+ * @copy org.apache.flex.core.UIBase#getBeadByType()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getBeadByType(classOrInterface:Class):IBead
+ {
+ for each (var bead:IBead in strand)
+ {
+ if (bead is classOrInterface)
+ return bead;
+ }
+ return null;
+ }
+
+ /**
+ * @copy org.apache.flex.core.UIBase#removeBead()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function removeBead(value:IBead):IBead
+ {
+ var n:int = strand.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var bead:IBead = strand[i];
+ if (bead == value)
+ {
+ strand.splice(i, 1);
+ return bead;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @copy org.apache.flex.core.UIBase#addToParent()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function addedToParent():void
+ {
+ var c:Class;
+
+ for each (var bead:IBead in beads)
+ addBead(bead);
+
+ if (getBeadByType(IBeadModel) == null)
+ {
+ c = ValuesManager.valuesImpl.getValue(this, "iBeadModel") as Class;
+ if (c)
+ {
+ var model:IBeadModel = new c as IBeadModel;
+ if (model)
+ addBead(model);
+ }
+ }
+ if (getBeadByType(IBeadView) == null)
+ {
+ c = ValuesManager.valuesImpl.getValue(this, "iBeadView") as Class;
+ if (c)
+ {
+ var view:IBeadView = new c as IBeadView;
+ if (view)
+ addBead(view);
+ }
+ }
+ if (getBeadByType(IBeadController) == null)
+ {
+ c = ValuesManager.valuesImpl.getValue(this, "iBeadController") as Class;
+ if (c)
+ {
+ var controller:IBeadController = new c as IBeadController;
+ if (controller)
+ addBead(controller);
+ }
+ }
+
+ dispatchEvent(new Event("beadsAdded"));
+
+ }
+
+ /**
+ * @copy org.apache.flex.core.UIBase#measurementBead
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get measurementBead() : IMeasurementBead
+ {
+ var measurementBead:IMeasurementBead = getBeadByType(IMeasurementBead) as IMeasurementBead;
+ if( measurementBead == null ) {
+ addBead(measurementBead = new (ValuesManager.valuesImpl.getValue(this, "iMeasurementBead")) as IMeasurementBead);
+ }
+
+ return measurementBead;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IUIBase#topMostEventDispatcher
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get topMostEventDispatcher():IEventDispatcher
+ {
+ if (!parent)
+ return null;
+ return IUIBase(parent).topMostEventDispatcher;
+ }
+
+
+ }
+}
[25/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - move
implementation classes to HTML so variants can exist in other SWCs
Posted by ah...@apache.org.
move implementation classes to HTML so variants can exist in other SWCs
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/efd9dcad
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/efd9dcad
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/efd9dcad
Branch: refs/heads/refactor-sprite
Commit: efd9dcad4ca87c3050f4ee84810f08577f0e4118
Parents: 21c9340
Author: Alex Harui <ah...@apache.org>
Authored: Thu Oct 27 15:48:16 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:46:52 2016 -0700
----------------------------------------------------------------------
.../flex/org/apache/flex/core/Application.as | 560 -------------------
.../org/apache/flex/core/ApplicationBase.as | 109 ----
.../flex/org/apache/flex/core/ContainerBase.as | 453 ---------------
.../flex/core/ContainerBaseStrandChildren.as | 99 ----
.../org/apache/flex/core/FilledRectangle.as | 125 -----
.../main/flex/org/apache/flex/core/ListBase.as | 126 -----
.../apache/flex/core/ListBaseStrandChildren.as | 100 ----
.../src/main/flex/org/apache/flex/core/View.as | 34 --
.../main/flex/org/apache/flex/core/ViewBase.as | 97 ----
.../flex/org/apache/flex/core/Application.as | 560 +++++++++++++++++++
.../org/apache/flex/core/ApplicationBase.as | 109 ++++
.../flex/org/apache/flex/core/ContainerBase.as | 453 +++++++++++++++
.../flex/core/ContainerBaseStrandChildren.as | 99 ++++
.../org/apache/flex/core/FilledRectangle.as | 125 +++++
.../main/flex/org/apache/flex/core/ListBase.as | 126 +++++
.../apache/flex/core/ListBaseStrandChildren.as | 100 ++++
.../src/main/flex/org/apache/flex/core/View.as | 34 ++
.../main/flex/org/apache/flex/core/ViewBase.as | 97 ++++
18 files changed, 1703 insertions(+), 1703 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Application.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Application.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Application.as
deleted file mode 100644
index 0a9c69a..0000000
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Application.as
+++ /dev/null
@@ -1,560 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.core
-{
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.events.MouseEvent;
- import org.apache.flex.events.utils.MouseEventConverter;
- import org.apache.flex.utils.MXMLDataInterpreter;
- import org.apache.flex.utils.Timer;
-
- COMPILE::SWF {
- import flash.display.DisplayObject;
- import flash.display.Graphics;
- import flash.display.Sprite;
- import flash.events.Event;
- import flash.system.ApplicationDomain;
- import flash.utils.getQualifiedClassName;
- }
-
- //--------------------------------------
- // Events
- //--------------------------------------
-
- /**
- * Dispatched at startup. Attributes and sub-instances of
- * the MXML document have been created and assigned.
- * The component lifecycle is different
- * than the Flex SDK. There is no creationComplete event.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Event(name="initialize", type="org.apache.flex.events.Event")]
-
- /**
- * Dispatched at startup before the instances get created.
- * Beads can call preventDefault and defer initialization.
- * This event will be dispatched on every frame until no
- * listeners call preventDefault(), then the initialize()
- * method will be called.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Event(name="preinitialize", type="org.apache.flex.events.Event")]
-
- /**
- * Dispatched at startup after the initial view has been
- * put on the display list. This event is sent before
- * applicationComplete is dispatched.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Event(name="viewChanged", type="org.apache.flex.events.Event")]
-
- /**
- * Dispatched at startup after the initial view has been
- * put on the display list.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Event(name="applicationComplete", type="org.apache.flex.events.Event")]
-
- /**
- * A SWF application must be bootstrapped by a Flash Sprite.
- * The factory class is the default bootstrap.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- [Frame(factoryClass="org.apache.flex.core.ApplicationFactory")]
-
- /**
- * The Application class is the main class and entry point for a FlexJS
- * application. This Application class is different than the
- * Flex SDK's mx:Application or spark:Application in that it does not contain
- * user interface elements. Those UI elements go in the views (ViewBase). This
- * Application class expects there to be a main model, a controller, and
- * an initial view.
- *
- * @see ViewBase
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class Application extends ApplicationBase implements IStrand, IParent, IEventDispatcher, ISWFApplication, IPopUpHost, IRenderedObject
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function Application()
- {
- super();
- }
-
- /**
- * Application wraps the root object.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- COMPILE::SWF
- public function setRoot(r:WrappedMovieClip):void
- {
- element = r;
- element.flexjs_wrapper = this;
- MouseEventConverter.setupAllConverters(r.stage);
- MouseEventConverter.setupAllConverters(r.stage, false);
- initHandler();
- }
-
- COMPILE::SWF
- private function initHandler():void
- {
- if (model is IBead) addBead(model as IBead);
- if (controller is IBead) addBead(controller as IBead);
-
- for each (var bead:IBead in beads)
- addBead(bead);
-
- dispatchEvent(new org.apache.flex.events.Event("beadsAdded"));
-
- if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true)))
- initialize();
- else
- addEventListener(flash.events.Event.ENTER_FRAME, enterFrameHandler);
-
- }
-
- COMPILE::SWF
- private function enterFrameHandler(event:flash.events.Event):void
- {
- if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true)))
- {
- removeEventListener(flash.events.Event.ENTER_FRAME, enterFrameHandler);
- initialize();
- }
- }
-
- /**
- * This method gets called when all preinitialize handlers
- * no longer call preventDefault();
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.IBead
- */
- protected function initialize():void
- {
- MXMLDataInterpreter.generateMXMLInstances(this, null, MXMLDescriptor);
-
- dispatchEvent(new org.apache.flex.events.Event("initialize"));
-
- if (initialView)
- {
- initialView.applicationModel = model;
- this.addElement(initialView);
-
- COMPILE::SWF
- {
- // if someone has installed a resize listener, fake an event to run it now
- if ($displayObject.stage.hasEventListener("resize"))
- $displayObject.stage.dispatchEvent(new flash.events.Event("resize"));
- else if (initialView is ILayoutChild)
- {
- var ilc:ILayoutChild = initialView as ILayoutChild;
- // otherwise, size once like this
- if (!isNaN(ilc.percentWidth) && !isNaN(ilc.percentHeight))
- ilc.setWidthAndHeight($displayObject.stage.stageWidth, $displayObject.stage.stageHeight, true);
- else if (!isNaN(ilc.percentWidth))
- ilc.setWidth($displayObject.stage.stageWidth);
- else if (!isNaN(ilc.percentHeight))
- ilc.setHeight($displayObject.stage.stageHeight);
- }
- }
- COMPILE::JS
- {
- var baseView:UIBase = initialView as UIBase;
- if (!isNaN(baseView.percentWidth) || !isNaN(baseView.percentHeight)) {
- this.element.style.height = window.innerHeight + 'px';
- this.element.style.width = window.innerWidth + 'px';
- this.initialView.dispatchEvent('sizeChanged'); // kick off layout if % sizes
- }
- }
- COMPILE::SWF
- {
- var bgColor:Object = ValuesManager.valuesImpl.getValue(this, "background-color");
- if (bgColor != null)
- {
- var backgroundColor:uint = ValuesManager.valuesImpl.convertColor(bgColor);
- var graphics:Graphics = Sprite($displayObject).graphics;
- graphics.beginFill(backgroundColor);
- graphics.drawRect(0, 0, initialView.width, initialView.height);
- graphics.endFill();
- }
- }
- dispatchEvent(new org.apache.flex.events.Event("viewChanged"));
- }
- dispatchEvent(new org.apache.flex.events.Event("applicationComplete"));
- }
-
- /**
- * The org.apache.flex.core.IValuesImpl that will
- * determine the default values and other values
- * for the application. The most common choice
- * is org.apache.flex.core.SimpleCSSValuesImpl.
- *
- * @see org.apache.flex.core.SimpleCSSValuesImpl
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set valuesImpl(value:IValuesImpl):void
- {
- ValuesManager.valuesImpl = value;
- ValuesManager.valuesImpl.init(this);
- }
-
- /**
- * The initial view.
- *
- * @see org.apache.flex.core.ViewBase
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Bindable("__NoChangeEvent__")]
- public var initialView:IApplicationView;
-
- /**
- * The controller. The controller typically watches
- * the UI for events and updates the model accordingly.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public var controller:Object;
-
- /**
- * An array of data that describes the MXML attributes
- * and tags in an MXML document. This data is usually
- * decoded by an MXMLDataInterpreter
- *
- * @see org.apache.flex.utils.MXMLDataInterpreter
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get MXMLDescriptor():Array
- {
- return null;
- }
-
- /**
- * An method called by the compiler's generated
- * code to kick off the setting of MXML attribute
- * values and instantiation of child tags.
- *
- * The call has to be made in the generated code
- * in order to ensure that the constructors have
- * completed first.
- *
- * @param data The encoded data representing the
- * MXML attributes.
- *
- * @see org.apache.flex.utils.MXMLDataInterpreter
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function generateMXMLAttributes(data:Array):void
- {
- MXMLDataInterpreter.generateMXMLProperties(this, data);
- }
-
- /**
- * The array property that is used to add additional
- * beads to an MXML tag. From ActionScript, just
- * call addBead directly.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public var beads:Array;
-
- private var _elements:Array;
-
- /**
- * @copy org.apache.flex.core.IParent#addElement()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.IUIBase
- * @flexjsignorecoercion HTMLElement
- */
- public function addElement(c:IChild, dispatchEvent:Boolean = true):void
- {
- COMPILE::SWF
- {
- if(_elements == null)
- _elements = [];
- _elements[_elements.length] = c;
- $displayObjectContainer.addChild(c.$displayObject);
- if (c is IUIBase)
- {
- IUIBase(c).addedToParent();
- }
- }
- COMPILE::JS {
- this.element.appendChild(c.element as HTMLElement);
- (c as IUIBase).addedToParent();
- }
- }
-
- /**
- * @copy org.apache.flex.core.IParent#addElementAt()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.IUIBase
- */
- public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
- {
- COMPILE::SWF
- {
- if(_elements == null)
- _elements = [];
- _elements.splice(index,0,c);
-
- $displayObjectContainer.addChildAt(c.$displayObject,index);
-
- if (c is IUIBase)
- {
- IUIBase(c).addedToParent();
- }
- }
- COMPILE::JS {
- var children:NodeList = internalChildren();
- if (index >= children.length)
- addElement(c);
- else
- {
- element.insertBefore(c.positioner,
- children[index]);
- (c as IUIBase).addedToParent();
- }
-
- }
- }
-
- /**
- * @copy org.apache.flex.core.IParent#getElementAt()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function getElementAt(index:int):IChild
- {
- COMPILE::SWF
- {
- if(_elements == null)
- return null;
- return _elements[index];
- }
- COMPILE::JS
- {
- var children:NodeList = internalChildren();
- return children[index].flexjs_wrapper;
- }
- }
-
- /**
- * @copy org.apache.flex.core.IParent#getElementIndex()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function getElementIndex(c:IChild):int
- {
- COMPILE::SWF
- {
- if(_elements == null)
- return -1;
- return _elements.indexOf(c);
- }
- COMPILE::JS {
- var children:NodeList = internalChildren();
- var n:int = children.length;
- for (var i:int = 0; i < n; i++)
- {
- if (children[i] == c.element)
- return i;
- }
- return -1;
- }
- }
-
- /**
- * @copy org.apache.flex.core.IParent#removeElement()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion HTMLElement
- */
- public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
- {
- COMPILE::SWF
- {
- if(_elements)
- {
- var idx:int = _elements.indexOf(c);
- if(idx>=0)
- _elements.splice(idx,1);
- }
- $displayObjectContainer.removeChild(c.$displayObject as DisplayObject);
- }
- COMPILE::JS
- {
- element.removeChild(c.element as HTMLElement);
- }
- }
-
- /**
- * @copy org.apache.flex.core.IParent#numElements
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get numElements():int
- {
- COMPILE::SWF
- {
- return _elements ? _elements.length : 0;
- }
- COMPILE::JS
- {
- var children:NodeList = internalChildren();
- return children.length;
- }
- }
-
- /**
- * @return {Object} The array of children.
- */
- COMPILE::JS
- protected function internalChildren():NodeList
- {
- return element.childNodes;
- };
-
- COMPILE::JS
- protected var startupTimer:Timer;
-
- /**
- * @flexjsignorecoercion org.apache.flex.core.IBead
- */
- COMPILE::JS
- public function start():void
- {
- element = document.getElementsByTagName('body')[0];
- element.flexjs_wrapper = this;
- element.className = 'Application';
- positioner = element;
-
- if (model is IBead) addBead(model as IBead);
- if (controller is IBead) addBead(controller as IBead);
-
- for (var index:int in beads) {
- addBead(beads[index]);
- }
-
- dispatchEvent(new org.apache.flex.events.Event("beadsAdded"));
-
- if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true)))
- initialize();
- else {
- startupTimer = new Timer(34, 0);
- startupTimer.addEventListener("timer", handleStartupTimer);
- startupTimer.start();
- }
- }
-
- /**
- * @private
- */
- COMPILE::JS
- protected function handleStartupTimer(event:Event):void
- {
- if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true)))
- {
- startupTimer.stop();
- initialize();
- }
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ApplicationBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ApplicationBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ApplicationBase.as
deleted file mode 100644
index 0fe63ba..0000000
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ApplicationBase.as
+++ /dev/null
@@ -1,109 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.core
-{
- COMPILE::SWF {
- import flash.system.ApplicationDomain;
- import flash.utils.getQualifiedClassName;
- }
-
- /**
- * This is a platform-dependent base class
- * for Application
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- COMPILE::SWF
- public class ApplicationBase extends UIHTMLElementWrapper implements IFlexInfo
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ApplicationBase()
- {
- super();
- }
-
- private var _info:Object;
-
- /**
- * An Object containing information generated
- * by the compiler that is useful at startup time.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function info():Object
- {
- if (!_info)
- {
- var mainClassName:String = getQualifiedClassName(this);
- var initClassName:String = "_" + mainClassName + "_FlexInit";
- var c:Class = ApplicationDomain.currentDomain.getDefinition(initClassName) as Class;
- _info = c.info();
- }
- return _info;
- }
- }
-
- COMPILE::JS
- public class ApplicationBase extends UIHTMLElementWrapper implements IFlexInfo
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ApplicationBase()
- {
- super();
- }
-
- private var _info:Object;
-
- /**
- * An Object containing information generated
- * by the compiler that is useful at startup time.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function info():Object
- {
- return _info;
- }
-
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ContainerBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ContainerBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ContainerBase.as
deleted file mode 100644
index 047b635..0000000
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ContainerBase.as
+++ /dev/null
@@ -1,453 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.core
-{
- import org.apache.flex.core.IMXMLDocument;
- import org.apache.flex.core.ValuesManager;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.ValueChangeEvent;
- import org.apache.flex.states.State;
- import org.apache.flex.utils.MXMLDataInterpreter;
-
- /**
- * Indicates that the state change has completed. All properties
- * that need to change have been changed, and all transitinos
- * that need to run have completed. However, any deferred work
- * may not be completed, and the screen may not be updated until
- * code stops executing.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Event(name="stateChangeComplete", type="org.apache.flex.events.Event")]
-
- /**
- * Indicates that the initialization of the container is complete.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Event(name="initComplete", type="org.apache.flex.events.Event")]
-
- /**
- * Indicates that the children of the container is have been added.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Event(name="childrenAdded", type="org.apache.flex.events.Event")]
-
- [DefaultProperty("mxmlContent")]
-
- /**
- * The ContainerBase class is the base class for most containers
- * in FlexJS. It is usable as the root tag of MXML
- * documents and UI controls and containers are added to it.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class ContainerBase extends UIBase implements IMXMLDocument, IStatesObject, IContainer, IContentViewHost
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ContainerBase()
- {
- super();
-
- _strandChildren = new ContainerBaseStrandChildren(this);
- }
-
- private var _strandChildren:ContainerBaseStrandChildren;
-
- /**
- * @private
- */
- public function get strandChildren():IParent
- {
- return _strandChildren;
- }
-
- /**
- * @copy org.apache.flex.core.IParent#getElementAt()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function getElementAt(index:int):IChild
- {
- var contentView:IParent = view as IParent;
- if (contentView != null) {
- return contentView.getElementAt(index);
- } else {
- return super.getElementAt(index);
- }
- }
-
- /**
- * @private
- */
- override public function getElementIndex(c:IChild):int
- {
- var contentView:IParent = view as IParent;
- if (contentView != null) {
- return contentView.getElementIndex(c);
- } else {
- return super.getElementIndex(c);
- }
- }
-
- /**
- * @private
- */
- override public function addElement(c:IChild, dispatchEvent:Boolean = true):void
- {
- var contentView:IParent = view as IParent;
- if (contentView != null) {
- contentView.addElement(c, dispatchEvent);
- if (dispatchEvent)
- this.dispatchEvent(new Event("childrenAdded"));
- }
- else {
- super.addElement(c);
- }
- }
-
- /**
- * @private
- */
- override public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
- {
- var contentView:IParent = view as IParent;
- if (contentView != null) {
- contentView.addElementAt(c, index, dispatchEvent);
- if (dispatchEvent)
- this.dispatchEvent(new Event("childrenAdded"));
- }
- else {
- super.addElementAt(c, index);
- }
- }
-
- /**
- * @private
- */
- override public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
- {
- var contentView:IParent = view as IParent;
- if (contentView != null) {
- contentView.removeElement(c, dispatchEvent);
- if (dispatchEvent)
- this.dispatchEvent(new Event("childrenRemoved"));
- }
- else {
- super.removeElement(c);
- }
- }
-
- /**
- * @private
- */
- public function childrenAdded():void
- {
- dispatchEvent(new Event("childrenAdded"));
- }
-
- /**
- * A ContainerBase doesn't create its children until it is added to
- * a parent.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function addedToParent():void
- {
- if (!_initialized)
- {
- // each MXML file can also have styles in fx:Style block
- ValuesManager.valuesImpl.init(this);
- }
-
- super.addedToParent();
-
- if (!_initialized)
- {
- MXMLDataInterpreter.generateMXMLInstances(_mxmlDocument, this, MXMLDescriptor);
-
- dispatchEvent(new Event("initBindings"));
- dispatchEvent(new Event("initComplete"));
- _initialized = true;
- }
- }
-
- /**
- * @private
- */
- override public function get numElements():int
- {
- var contentView:IParent = view as IParent;
- return contentView != null ? contentView.numElements : super.numElements;
- }
-
-
- /**
- * @private
- * @suppress {undefinedNames}
- * Support strandChildren.
- */
- public function $numElements():int
- {
- return super.numElements();
- }
-
- /**
- * @private
- * @suppress {undefinedNames}
- * Support strandChildren.
- */
- public function $addElement(c:IChild, dispatchEvent:Boolean = true):void
- {
- super.addElement(c, dispatchEvent);
- }
-
- /**
- * @private
- * @suppress {undefinedNames}
- * Support strandChildren.
- */
- public function $addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
- {
- super.addElementAt(c, index, dispatchEvent);
- }
-
- /**
- * @private
- * @suppress {undefinedNames}
- * Support strandChildren.
- */
- public function $removeElement(c:IChild, dispatchEvent:Boolean = true):void
- {
- super.removeElement(c, dispatchEvent);
- }
-
- /**
- * @private
- * @suppress {undefinedNames}
- * Support strandChildren.
- */
- public function $getElementIndex(c:IChild):int
- {
- return super.getElementIndex(c);
- }
-
- /**
- * @private
- * @suppress {undefinedNames}
- * Support strandChildren.
- */
- public function $getElementAt(index:int):IChild
- {
- return super.getElementAt(index);
- }
-
- private var _mxmlDescriptor:Array;
- private var _mxmlDocument:Object = this;
- private var _initialized:Boolean;
-
- /**
- * @copy org.apache.flex.core.Application#MXMLDescriptor
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get MXMLDescriptor():Array
- {
- return _mxmlDescriptor;
- }
-
- /**
- * @private
- */
- public function setMXMLDescriptor(document:Object, value:Array):void
- {
- _mxmlDocument = document;
- _mxmlDescriptor = value;
- }
-
- /**
- * @copy org.apache.flex.core.Application#generateMXMLAttributes()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function generateMXMLAttributes(data:Array):void
- {
- MXMLDataInterpreter.generateMXMLProperties(this, data);
- }
-
- /**
- * @copy org.apache.flex.core.ItemRendererClassFactory#mxmlContent
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public var mxmlContent:Array;
-
- private var _states:Array;
-
- /**
- * The array of view states. These should
- * be instances of org.apache.flex.states.State.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get states():Array
- {
- return _states;
- }
-
- /**
- * @private
- * @flexjsignorecoercion Class
- * @flexjsignorecoercion org.apache.flex.core.IBead
- */
- public function set states(value:Array):void
- {
- _states = value;
- _currentState = _states[0].name;
-
- try{
- if (getBeadByType(IStatesImpl) == null)
- {
- var c:Class = ValuesManager.valuesImpl.getValue(this, "iStatesImpl") as Class;
- var b:Object = new c();
- addBead(b as IBead);
- }
- }
- //TODO: Need to handle this case more gracefully
- catch(e:Error)
- {
- COMPILE::SWF
- {
- trace(e.message);
- }
- }
-
- }
-
- /**
- * <code>true</code> if the array of states
- * contains a state with this name.
- *
- * @param state The state namem.
- * @return True if state in state array
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function hasState(state:String):Boolean
- {
- for each (var s:State in _states)
- {
- if (s.name == state)
- return true;
- }
- return false;
- }
-
- private var _currentState:String;
-
- [Bindable("currentStateChange")]
- /**
- * The name of the current state.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get currentState():String
- {
- return _currentState;
- }
-
- /**
- * @private
- */
- public function set currentState(value:String):void
- {
- var event:ValueChangeEvent = new ValueChangeEvent("currentStateChange", false, false, _currentState, value)
- _currentState = value;
- dispatchEvent(event);
- }
-
- private var _transitions:Array;
-
- /**
- * The array of transitions.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get transitions():Array
- {
- return _transitions;
- }
-
- /**
- * @private
- */
- public function set transitions(value:Array):void
- {
- _transitions = value;
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as
deleted file mode 100644
index e961c1f..0000000
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as
+++ /dev/null
@@ -1,99 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.core
-{
- /**
- * The ContainerBaseStrandChildren class the provides a way for advanced
- * components to place children directly into the strand unlike the
- * addElement() APIs on the Container which place children into the contentView.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class ContainerBaseStrandChildren implements IParent
- {
- /**
- * Constructor.
- *
- * @flexjsignorecoercion org.apache.flex.core.ContainerBase
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ContainerBaseStrandChildren(owner:IParent)
- {
- super();
-
- this.owner = owner as ContainerBase;
- }
-
- public var owner:ContainerBase;
-
- /**
- * @private
- */
- public function get numElements():int
- {
- return owner.$numElements();
- }
-
- /**
- * @private
- */
- public function addElement(c:IChild, dispatchEvent:Boolean = true):void
- {
- owner.$addElement(c, dispatchEvent);
- }
-
- /**
- * @private
- */
- public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
- {
- owner.$addElementAt(c, index, dispatchEvent);
- }
-
- /**
- * @private
- */
- public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
- {
- owner.$removeElement(c, dispatchEvent);
- }
-
- /**
- * @private
- */
- public function getElementIndex(c:IChild):int
- {
- return owner.$getElementIndex(c);
- }
-
- /**
- * @private
- */
- public function getElementAt(index:int):IChild
- {
- return owner.$getElementAt(index);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/FilledRectangle.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/FilledRectangle.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/FilledRectangle.as
deleted file mode 100644
index 5888a94..0000000
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/FilledRectangle.as
+++ /dev/null
@@ -1,125 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.core
-{
- COMPILE::SWF
- {
- import flash.display.Shape;
- }
-
- import org.apache.flex.core.UIBase;
-
- /**
- * The FilledRectangle class draws a simple filled
- * rectangle without a border and with square corners.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class FilledRectangle extends UIBase
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function FilledRectangle()
- {
- super();
-
- COMPILE::SWF
- {
- _shape = new flash.display.Shape();
- $displayObjectContainer.addChild(_shape);
- }
- }
-
- COMPILE::SWF
- private var _shape:flash.display.Shape;
-
- private var _fillColor:uint = 0x000000;
-
- /**
- * The color of the rectangle.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get fillColor():uint
- {
- return _fillColor;
- }
-
- /**
- * @private
- */
- public function set fillColor(value:uint):void
- {
- _fillColor = value;
- }
-
- /**
- * @private
- */
- override public function addedToParent():void
- {
- super.addedToParent();
- drawRect(0, 0, this.width, this.height);
- }
-
- /**
- * Draw the rectangle.
- * @param x The x position of the top-left corner of the rectangle.
- * @param y The y position of the top-left corner.
- * @param width The width of the rectangle.
- * @param height The height of the rectangle.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function drawRect(x:Number, y:Number, width:Number, height:Number):void
- {
- COMPILE::SWF
- {
- _shape.graphics.clear();
- _shape.graphics.beginFill(_fillColor);
- _shape.graphics.drawRect(x, y, width, height);
- _shape.graphics.endFill();
- }
- COMPILE::JS
- {
- element.style.position = 'absolute';
- element.style.backgroundColor = '#' + _fillColor.toString(16);
- if (!isNaN(x)) this.x = x;
- if (!isNaN(y)) this.y = y;
- if (!isNaN(width)) this.width = width;
- if (!isNaN(height)) this.height = height;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBase.as
deleted file mode 100644
index f9c0aaa..0000000
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBase.as
+++ /dev/null
@@ -1,126 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.core
-{
- import org.apache.flex.core.IMXMLDocument;
- import org.apache.flex.core.ValuesManager;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.ValueChangeEvent;
- import org.apache.flex.states.State;
- import org.apache.flex.utils.MXMLDataInterpreter;
-
- /**
- * The ListBase class is the base class for most lists
- * in FlexJS.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class ListBase extends UIBase implements IContentViewHost
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ListBase()
- {
- super();
-
- _strandChildren = new ListBaseStrandChildren(this);
- }
-
- private var _strandChildren:ListBaseStrandChildren;
-
- /**
- * @private
- */
- public function get strandChildren():IParent
- {
- return _strandChildren;
- }
-
- /**
- * @private
- * @suppress {undefinedNames}
- * Support strandChildren.
- */
- public function $numElements():int
- {
- return super.numElements();
- }
-
-
- /**
- * @private
- * @suppress {undefinedNames}
- * Support strandChildren.
- */
- public function $addElement(c:IChild, dispatchEvent:Boolean = true):void
- {
- super.addElement(c, dispatchEvent);
- }
-
- /**
- * @private
- * @suppress {undefinedNames}
- * Support strandChildren.
- */
- public function $addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
- {
- super.addElementAt(c, index, dispatchEvent);
- }
-
- /**
- * @private
- * @suppress {undefinedNames}
- * Support strandChildren.
- */
- public function $removeElement(c:IChild, dispatchEvent:Boolean = true):void
- {
- super.removeElement(c, dispatchEvent);
- }
-
- /**
- * @private
- * @suppress {undefinedNames}
- * Support strandChildren.
- */
- public function $getElementIndex(c:IChild):int
- {
- return super.getElementIndex(c);
- }
-
- /**
- * @private
- * @suppress {undefinedNames}
- * Support strandChildren.
- */
- public function $getElementAt(index:int):IChild
- {
- return super.getElementAt(index);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as
deleted file mode 100644
index b1748f9..0000000
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as
+++ /dev/null
@@ -1,100 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.core
-{
-
-
- /**
- * The ListBaseStrandChildren exists so that Lists are compatible with
- * the ListView/ContainerView beads.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class ListBaseStrandChildren implements IParent
- {
- /**
- * Constructor.
- *
- * @flexjsignorecoercion org.apache.flex.core.ListBase
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ListBaseStrandChildren(owner:IParent)
- {
- super();
-
- this.owner = owner as ListBase;
- }
-
- public var owner:ListBase;
-
- /**
- * @private
- */
- public function get numElements():int
- {
- return owner.$numElements();
- }
-
- /**
- * @private
- */
- public function addElement(c:IChild, dispatchEvent:Boolean = true):void
- {
- owner.$addElement(c, dispatchEvent);
- }
-
- /**
- * @private
- */
- public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
- {
- owner.$addElementAt(c, index, dispatchEvent);
- }
-
- /**
- * @private
- */
- public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
- {
- owner.$removeElement(c, dispatchEvent);
- }
-
- /**
- * @private
- */
- public function getElementIndex(c:IChild):int
- {
- return owner.$getElementIndex(c);
- }
-
- /**
- * @private
- */
- public function getElementAt(index:int):IChild
- {
- return owner.$getElementAt(index);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/View.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/View.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/View.as
deleted file mode 100644
index 2d0f2c4..0000000
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/View.as
+++ /dev/null
@@ -1,34 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.core
-{
- /**
- * The View class is the class for most views in a FlexJS
- * application. It is generally used as the root tag of MXML
- * documents and UI controls and containers are added to it.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class View extends ViewBase
- {
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as
deleted file mode 100644
index 7e4b65e..0000000
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as
+++ /dev/null
@@ -1,97 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.core
-{
- import org.apache.flex.events.Event;
-
- //--------------------------------------
- // Events
- //--------------------------------------
-
- /**
- * Dispatched at startup. Attributes and sub-instances of
- * the MXML document have been created and assigned.
- * The component lifecycle is different
- * than the Flex SDK. There is no creationComplete event.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Event(name="initComplete", type="org.apache.flex.events.Event")]
-
- [DefaultProperty("mxmlContent")]
-
- /**
- * The ViewBase class is the base class for most views in a FlexJS
- * application.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class ViewBase extends ContainerBase implements IPopUpHost, IApplicationView
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ViewBase()
- {
- super();
-
- className = "flexjs";
- }
-
- private var _applicationModel:Object;
-
- [Bindable("modelChanged")]
-
- /**
- * A reference to the Application's model. Usually,
- * a view is displaying the main model for an
- * application.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get applicationModel():Object
- {
- return _applicationModel;
- }
-
- /**
- * @private
- */
- public function set applicationModel(value:Object):void
- {
- _applicationModel = value;
- dispatchEvent(new Event("modelChanged"));
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as
new file mode 100644
index 0000000..0a9c69a
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as
@@ -0,0 +1,560 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.utils.MouseEventConverter;
+ import org.apache.flex.utils.MXMLDataInterpreter;
+ import org.apache.flex.utils.Timer;
+
+ COMPILE::SWF {
+ import flash.display.DisplayObject;
+ import flash.display.Graphics;
+ import flash.display.Sprite;
+ import flash.events.Event;
+ import flash.system.ApplicationDomain;
+ import flash.utils.getQualifiedClassName;
+ }
+
+ //--------------------------------------
+ // Events
+ //--------------------------------------
+
+ /**
+ * Dispatched at startup. Attributes and sub-instances of
+ * the MXML document have been created and assigned.
+ * The component lifecycle is different
+ * than the Flex SDK. There is no creationComplete event.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="initialize", type="org.apache.flex.events.Event")]
+
+ /**
+ * Dispatched at startup before the instances get created.
+ * Beads can call preventDefault and defer initialization.
+ * This event will be dispatched on every frame until no
+ * listeners call preventDefault(), then the initialize()
+ * method will be called.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="preinitialize", type="org.apache.flex.events.Event")]
+
+ /**
+ * Dispatched at startup after the initial view has been
+ * put on the display list. This event is sent before
+ * applicationComplete is dispatched.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="viewChanged", type="org.apache.flex.events.Event")]
+
+ /**
+ * Dispatched at startup after the initial view has been
+ * put on the display list.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="applicationComplete", type="org.apache.flex.events.Event")]
+
+ /**
+ * A SWF application must be bootstrapped by a Flash Sprite.
+ * The factory class is the default bootstrap.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ [Frame(factoryClass="org.apache.flex.core.ApplicationFactory")]
+
+ /**
+ * The Application class is the main class and entry point for a FlexJS
+ * application. This Application class is different than the
+ * Flex SDK's mx:Application or spark:Application in that it does not contain
+ * user interface elements. Those UI elements go in the views (ViewBase). This
+ * Application class expects there to be a main model, a controller, and
+ * an initial view.
+ *
+ * @see ViewBase
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class Application extends ApplicationBase implements IStrand, IParent, IEventDispatcher, ISWFApplication, IPopUpHost, IRenderedObject
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Application()
+ {
+ super();
+ }
+
+ /**
+ * Application wraps the root object.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public function setRoot(r:WrappedMovieClip):void
+ {
+ element = r;
+ element.flexjs_wrapper = this;
+ MouseEventConverter.setupAllConverters(r.stage);
+ MouseEventConverter.setupAllConverters(r.stage, false);
+ initHandler();
+ }
+
+ COMPILE::SWF
+ private function initHandler():void
+ {
+ if (model is IBead) addBead(model as IBead);
+ if (controller is IBead) addBead(controller as IBead);
+
+ for each (var bead:IBead in beads)
+ addBead(bead);
+
+ dispatchEvent(new org.apache.flex.events.Event("beadsAdded"));
+
+ if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true)))
+ initialize();
+ else
+ addEventListener(flash.events.Event.ENTER_FRAME, enterFrameHandler);
+
+ }
+
+ COMPILE::SWF
+ private function enterFrameHandler(event:flash.events.Event):void
+ {
+ if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true)))
+ {
+ removeEventListener(flash.events.Event.ENTER_FRAME, enterFrameHandler);
+ initialize();
+ }
+ }
+
+ /**
+ * This method gets called when all preinitialize handlers
+ * no longer call preventDefault();
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.IBead
+ */
+ protected function initialize():void
+ {
+ MXMLDataInterpreter.generateMXMLInstances(this, null, MXMLDescriptor);
+
+ dispatchEvent(new org.apache.flex.events.Event("initialize"));
+
+ if (initialView)
+ {
+ initialView.applicationModel = model;
+ this.addElement(initialView);
+
+ COMPILE::SWF
+ {
+ // if someone has installed a resize listener, fake an event to run it now
+ if ($displayObject.stage.hasEventListener("resize"))
+ $displayObject.stage.dispatchEvent(new flash.events.Event("resize"));
+ else if (initialView is ILayoutChild)
+ {
+ var ilc:ILayoutChild = initialView as ILayoutChild;
+ // otherwise, size once like this
+ if (!isNaN(ilc.percentWidth) && !isNaN(ilc.percentHeight))
+ ilc.setWidthAndHeight($displayObject.stage.stageWidth, $displayObject.stage.stageHeight, true);
+ else if (!isNaN(ilc.percentWidth))
+ ilc.setWidth($displayObject.stage.stageWidth);
+ else if (!isNaN(ilc.percentHeight))
+ ilc.setHeight($displayObject.stage.stageHeight);
+ }
+ }
+ COMPILE::JS
+ {
+ var baseView:UIBase = initialView as UIBase;
+ if (!isNaN(baseView.percentWidth) || !isNaN(baseView.percentHeight)) {
+ this.element.style.height = window.innerHeight + 'px';
+ this.element.style.width = window.innerWidth + 'px';
+ this.initialView.dispatchEvent('sizeChanged'); // kick off layout if % sizes
+ }
+ }
+ COMPILE::SWF
+ {
+ var bgColor:Object = ValuesManager.valuesImpl.getValue(this, "background-color");
+ if (bgColor != null)
+ {
+ var backgroundColor:uint = ValuesManager.valuesImpl.convertColor(bgColor);
+ var graphics:Graphics = Sprite($displayObject).graphics;
+ graphics.beginFill(backgroundColor);
+ graphics.drawRect(0, 0, initialView.width, initialView.height);
+ graphics.endFill();
+ }
+ }
+ dispatchEvent(new org.apache.flex.events.Event("viewChanged"));
+ }
+ dispatchEvent(new org.apache.flex.events.Event("applicationComplete"));
+ }
+
+ /**
+ * The org.apache.flex.core.IValuesImpl that will
+ * determine the default values and other values
+ * for the application. The most common choice
+ * is org.apache.flex.core.SimpleCSSValuesImpl.
+ *
+ * @see org.apache.flex.core.SimpleCSSValuesImpl
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set valuesImpl(value:IValuesImpl):void
+ {
+ ValuesManager.valuesImpl = value;
+ ValuesManager.valuesImpl.init(this);
+ }
+
+ /**
+ * The initial view.
+ *
+ * @see org.apache.flex.core.ViewBase
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Bindable("__NoChangeEvent__")]
+ public var initialView:IApplicationView;
+
+ /**
+ * The controller. The controller typically watches
+ * the UI for events and updates the model accordingly.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var controller:Object;
+
+ /**
+ * An array of data that describes the MXML attributes
+ * and tags in an MXML document. This data is usually
+ * decoded by an MXMLDataInterpreter
+ *
+ * @see org.apache.flex.utils.MXMLDataInterpreter
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get MXMLDescriptor():Array
+ {
+ return null;
+ }
+
+ /**
+ * An method called by the compiler's generated
+ * code to kick off the setting of MXML attribute
+ * values and instantiation of child tags.
+ *
+ * The call has to be made in the generated code
+ * in order to ensure that the constructors have
+ * completed first.
+ *
+ * @param data The encoded data representing the
+ * MXML attributes.
+ *
+ * @see org.apache.flex.utils.MXMLDataInterpreter
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function generateMXMLAttributes(data:Array):void
+ {
+ MXMLDataInterpreter.generateMXMLProperties(this, data);
+ }
+
+ /**
+ * The array property that is used to add additional
+ * beads to an MXML tag. From ActionScript, just
+ * call addBead directly.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var beads:Array;
+
+ private var _elements:Array;
+
+ /**
+ * @copy org.apache.flex.core.IParent#addElement()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.IUIBase
+ * @flexjsignorecoercion HTMLElement
+ */
+ public function addElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ COMPILE::SWF
+ {
+ if(_elements == null)
+ _elements = [];
+ _elements[_elements.length] = c;
+ $displayObjectContainer.addChild(c.$displayObject);
+ if (c is IUIBase)
+ {
+ IUIBase(c).addedToParent();
+ }
+ }
+ COMPILE::JS {
+ this.element.appendChild(c.element as HTMLElement);
+ (c as IUIBase).addedToParent();
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#addElementAt()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.IUIBase
+ */
+ public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
+ {
+ COMPILE::SWF
+ {
+ if(_elements == null)
+ _elements = [];
+ _elements.splice(index,0,c);
+
+ $displayObjectContainer.addChildAt(c.$displayObject,index);
+
+ if (c is IUIBase)
+ {
+ IUIBase(c).addedToParent();
+ }
+ }
+ COMPILE::JS {
+ var children:NodeList = internalChildren();
+ if (index >= children.length)
+ addElement(c);
+ else
+ {
+ element.insertBefore(c.positioner,
+ children[index]);
+ (c as IUIBase).addedToParent();
+ }
+
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#getElementAt()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getElementAt(index:int):IChild
+ {
+ COMPILE::SWF
+ {
+ if(_elements == null)
+ return null;
+ return _elements[index];
+ }
+ COMPILE::JS
+ {
+ var children:NodeList = internalChildren();
+ return children[index].flexjs_wrapper;
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#getElementIndex()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getElementIndex(c:IChild):int
+ {
+ COMPILE::SWF
+ {
+ if(_elements == null)
+ return -1;
+ return _elements.indexOf(c);
+ }
+ COMPILE::JS {
+ var children:NodeList = internalChildren();
+ var n:int = children.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ if (children[i] == c.element)
+ return i;
+ }
+ return -1;
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#removeElement()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion HTMLElement
+ */
+ public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ COMPILE::SWF
+ {
+ if(_elements)
+ {
+ var idx:int = _elements.indexOf(c);
+ if(idx>=0)
+ _elements.splice(idx,1);
+ }
+ $displayObjectContainer.removeChild(c.$displayObject as DisplayObject);
+ }
+ COMPILE::JS
+ {
+ element.removeChild(c.element as HTMLElement);
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#numElements
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get numElements():int
+ {
+ COMPILE::SWF
+ {
+ return _elements ? _elements.length : 0;
+ }
+ COMPILE::JS
+ {
+ var children:NodeList = internalChildren();
+ return children.length;
+ }
+ }
+
+ /**
+ * @return {Object} The array of children.
+ */
+ COMPILE::JS
+ protected function internalChildren():NodeList
+ {
+ return element.childNodes;
+ };
+
+ COMPILE::JS
+ protected var startupTimer:Timer;
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.IBead
+ */
+ COMPILE::JS
+ public function start():void
+ {
+ element = document.getElementsByTagName('body')[0];
+ element.flexjs_wrapper = this;
+ element.className = 'Application';
+ positioner = element;
+
+ if (model is IBead) addBead(model as IBead);
+ if (controller is IBead) addBead(controller as IBead);
+
+ for (var index:int in beads) {
+ addBead(beads[index]);
+ }
+
+ dispatchEvent(new org.apache.flex.events.Event("beadsAdded"));
+
+ if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true)))
+ initialize();
+ else {
+ startupTimer = new Timer(34, 0);
+ startupTimer.addEventListener("timer", handleStartupTimer);
+ startupTimer.start();
+ }
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::JS
+ protected function handleStartupTimer(event:Event):void
+ {
+ if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true)))
+ {
+ startupTimer.stop();
+ initialize();
+ }
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ApplicationBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ApplicationBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ApplicationBase.as
new file mode 100644
index 0000000..0fe63ba
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ApplicationBase.as
@@ -0,0 +1,109 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ COMPILE::SWF {
+ import flash.system.ApplicationDomain;
+ import flash.utils.getQualifiedClassName;
+ }
+
+ /**
+ * This is a platform-dependent base class
+ * for Application
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public class ApplicationBase extends UIHTMLElementWrapper implements IFlexInfo
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ApplicationBase()
+ {
+ super();
+ }
+
+ private var _info:Object;
+
+ /**
+ * An Object containing information generated
+ * by the compiler that is useful at startup time.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function info():Object
+ {
+ if (!_info)
+ {
+ var mainClassName:String = getQualifiedClassName(this);
+ var initClassName:String = "_" + mainClassName + "_FlexInit";
+ var c:Class = ApplicationDomain.currentDomain.getDefinition(initClassName) as Class;
+ _info = c.info();
+ }
+ return _info;
+ }
+ }
+
+ COMPILE::JS
+ public class ApplicationBase extends UIHTMLElementWrapper implements IFlexInfo
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ApplicationBase()
+ {
+ super();
+ }
+
+ private var _info:Object;
+
+ /**
+ * An Object containing information generated
+ * by the compiler that is useful at startup time.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function info():Object
+ {
+ return _info;
+ }
+
+
+ }
+}
[35/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - copy
files moved from Graphics to HTML
Posted by ah...@apache.org.
copy files moved from Graphics to HTML
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/7a65d3d7
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/7a65d3d7
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/7a65d3d7
Branch: refs/heads/refactor-sprite
Commit: 7a65d3d737ba648459d8a0c680045316e99e3e2b
Parents: 1890b71
Author: Alex Harui <ah...@apache.org>
Authored: Fri Oct 28 23:26:57 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:59:03 2016 -0700
----------------------------------------------------------------------
.../src/main/flex/org/apache/flex/svg/Circle.as | 118 ++++
.../flex/org/apache/flex/svg/CompoundGraphic.as | 585 +++++++++++++++++++
.../main/flex/org/apache/flex/svg/Ellipse.as | 152 +++++
.../flex/org/apache/flex/svg/GraphicShape.as | 225 +++++++
.../src/main/flex/org/apache/flex/svg/Path.as | 133 +++++
.../src/main/flex/org/apache/flex/svg/Rect.as | 156 +++++
.../src/main/flex/org/apache/flex/svg/Text.as | 150 +++++
7 files changed, 1519 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7a65d3d7/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Circle.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Circle.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Circle.as
new file mode 100644
index 0000000..586bbfd
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Circle.as
@@ -0,0 +1,118 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flex.svg
+{
+ import org.apache.flex.graphics.ICircle;
+
+ COMPILE::SWF
+ {
+ import flash.geom.Point;
+ import flash.geom.Rectangle;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ public class Circle extends GraphicShape implements ICircle
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.7
+ */
+ public function Circle(cx:Number=0, cy:Number=0, r:Number=0)
+ {
+ x = cx;
+ y = cy;
+ radius = r;
+ }
+
+ private var _radius:Number;
+
+ public function get radius():Number
+ {
+ return _radius;
+ }
+
+ public function set radius(value:Number):void
+ {
+ _radius = value;
+ }
+
+ COMPILE::JS
+ private var _circle:WrappedHTMLElement;
+
+ /**
+ * Draw the circle.
+ * @param cx The x location of the center of the circle
+ * @param cy The y location of the center of the circle.
+ * @param radius The radius of the circle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion SVGCircleElement
+ */
+ public function drawCircle(cx:Number, cy:Number, radius):void
+ {
+ COMPILE::SWF
+ {
+ graphics.clear();
+ applyStroke();
+ beginFill(new Rectangle(cx,cy,radius*2, radius*2),new Point(cx-radius,cy-radius));
+ graphics.drawCircle(cx,cy,radius);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ var style:String = getStyleStr();
+
+ if (_circle == null) {
+ _circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle') as WrappedHTMLElement;
+ _circle.flexjs_wrapper = this;
+ element.appendChild(_circle);
+ }
+ _circle.setAttribute('style', style);
+ if (stroke)
+ {
+ _circle.setAttribute('cx', radius + stroke.weight);
+ _circle.setAttribute('cy', radius + stroke.weight);
+ }
+ else
+ {
+ _circle.setAttribute('cx', radius);
+ _circle.setAttribute('cy', radius);
+ }
+
+ _circle.setAttribute('r', radius);
+
+ resize(x-radius, y-radius, (_circle as SVGCircleElement).getBBox());
+
+ }
+ }
+
+ override protected function draw():void
+ {
+ drawCircle(0, 0, radius);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7a65d3d7/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/CompoundGraphic.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/CompoundGraphic.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/CompoundGraphic.as
new file mode 100644
index 0000000..a57cb5a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/CompoundGraphic.as
@@ -0,0 +1,585 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flex.svg
+{
+ import org.apache.flex.graphics.ICompoundGraphic;
+ import org.apache.flex.graphics.IFill;
+ import org.apache.flex.graphics.IStroke;
+ import org.apache.flex.graphics.PathBuilder;
+ import org.apache.flex.graphics.SolidColor;
+
+ COMPILE::SWF
+ {
+ import flash.display.GraphicsPath;
+ import flash.display.Shape;
+ import flash.display.Sprite;
+ import flash.geom.Point;
+ import flash.geom.Rectangle;
+ import flash.text.TextFieldType;
+
+ import org.apache.flex.core.CSSTextField;
+ import org.apache.flex.graphics.utils.PathHelper;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * CompoundGraphic is a surface on which you can
+ * draw various graphic elements such as Rect, Circle,
+ * Ellipse, Path etc.
+ * Use this class if you want to draw multiple graphic
+ * shapes on a single container.
+ *
+ */
+ public class CompoundGraphic extends GraphicShape implements ICompoundGraphic
+ {
+ private var _textFill:IFill;
+
+ public function get textFill():IFill
+ {
+ return _textFill;
+ }
+ /**
+ * The color of the text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion FlexJS 0.0
+ */
+ public function set textFill(value:IFill):void
+ {
+ _textFill = value;
+ }
+
+ private var _textStroke:IStroke;
+
+ public function get textStroke():IStroke
+ {
+ return _textStroke;
+ }
+ /**
+ * The stroke color of the text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion FlexJS 0.0
+ */
+ public function set textStroke(value:IStroke):void
+ {
+ _textStroke = value;
+ }
+
+ /**
+ * Removes all of the drawn elements of the container.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0.3
+ */
+ public function removeAllElements():void
+ {
+ clear();
+ }
+
+ /**
+ * Clears all of the drawn path data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.7.0
+ */
+ public function clear():void
+ {
+ COMPILE::SWF
+ {
+ graphics.clear();
+ }
+ COMPILE::JS
+ {
+ var svg:HTMLElement = element;
+ while (svg.lastChild) {
+ svg.removeChild(svg.lastChild);
+ }
+ }
+ }
+
+ /**
+ * Draw the rectangle.
+ * @param x The x position of the top-left corner of the rectangle.
+ * @param y The y position of the top-left corner.
+ * @param width The width of the rectangle.
+ * @param height The height of the rectangle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0.3
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawRect(x:Number, y:Number, width:Number, height:Number):void
+ {
+ COMPILE::SWF
+ {
+ applyStroke();
+ beginFill(new Rectangle(x, y, width, height), new Point(x,y) );
+ graphics.drawRect(x, y, width, height);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ drawRoundRect(x, y, width, height, NaN);
+ }
+ }
+
+ /**
+ * Draws a rounded rectangle.
+ * Note: The radius values are different than the Flash API of the same name. Flash uses diameter instead of radius.
+ * @param x The x position of the top-left corner of the rectangle.
+ * @param y The y position of the top-left corner.
+ * @param width The width of the rectangle.
+ * @param height The height of the rectangle.
+ * @param radiusX The horizontal radius of the rounded corners (in pixels).
+ * @param radiusY The vertical radius of the rounded corners (in pixels). Optional; if no value is specified, the default value matches that provided for the <code>radiusX</code> parameter.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0.3
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawRoundRect(x:Number, y:Number, width:Number, height:Number, radiusX:Number, radiusY:Number = NaN):void
+ {
+ COMPILE::SWF
+ {
+ applyStroke();
+ beginFill(new Rectangle(x,y,width,height), new Point(x,y));
+ radiusX *=2;
+ radiusY = isNaN(radiusY) ? radiusY : radiusY*2;
+ graphics.drawRoundRect(x,y,width,height,radiusX,radiusY);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ if(isNaN(radiusY))
+ radiusY = radiusX;
+
+ var style:String = getStyleStr();
+ var rect:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'rect') as WrappedHTMLElement;
+ rect.flexjs_wrapper = this;
+ rect.style.left = x;
+ rect.style.top = y;
+ rect.setAttribute('style', style);
+ rect.setAttribute('x', x);
+ rect.setAttribute('y', y);
+ rect.setAttribute('width', width);
+ rect.setAttribute('height', height);
+ if(!isNaN(radiusX))
+ {
+ rect.setAttribute('rx', radiusX);
+ rect.setAttribute('ry', radiusY);
+ }
+ element.appendChild(rect);
+ }
+
+ }
+
+ /**
+ * Draw the ellipse.
+ * @param x The x position of the top-left corner of the bounding box of the ellipse.
+ * @param y The y position of the top-left corner of the bounding box of the ellipse.
+ * @param width The width of the ellipse.
+ * @param height The height of the ellipse.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0.3
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawEllipse(x:Number, y:Number, width:Number, height:Number):void
+ {
+ COMPILE::SWF
+ {
+ applyStroke();
+ beginFill(new Rectangle(x,y,width,height), new Point(x,y));
+ graphics.drawEllipse(x,y,width,height);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ var style:String = getStyleStr();
+ var ellipse:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse') as WrappedHTMLElement;
+ ellipse.flexjs_wrapper = this;
+ ellipse.style.left = x;
+ ellipse.style.top = y;
+ ellipse.setAttribute('style', style);
+ ellipse.setAttribute('cx', x + width / 2);
+ ellipse.setAttribute('cy', y + height / 2);
+ ellipse.setAttribute('rx', width / 2);
+ ellipse.setAttribute('ry', height / 2);
+ element.appendChild(ellipse);
+ }
+ }
+
+ /**
+ * Draw the circle.
+ * @param x The x location of the center of the circle
+ * @param y The y location of the center of the circle.
+ * @param radius The radius of the circle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawCircle(x:Number, y:Number, radius:Number):void
+ {
+ COMPILE::SWF
+ {
+ applyStroke();
+ beginFill(new Rectangle(x,y,radius*2, radius*2),new Point(x-radius,y-radius));
+ graphics.drawCircle(x,y,radius);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ var style:String = getStyleStr();
+ var circle:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse') as WrappedHTMLElement;
+ circle.flexjs_wrapper = this;
+ circle.style.left = x;
+ circle.style.top = y;
+ circle.setAttribute('style', style);
+ circle.setAttribute('cx', x);
+ circle.setAttribute('cy', y);
+ circle.setAttribute('rx', radius);
+ circle.setAttribute('ry', radius);
+ element.appendChild(circle);
+
+ }
+ }
+
+ /**
+ * Draw the path.
+ * @param data A PathBuilder object containing a vector of drawing commands.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawPathCommands(data:PathBuilder):void
+ {
+ drawStringPath(data.getPathString());
+ }
+
+ /**
+ * Draw the path.
+ * @param data A string containing a compact represention of the path segments.
+ * The value is a space-delimited string describing each path segment. Each
+ * segment entry has a single character which denotes the segment type and
+ * two or more segment parameters.
+ *
+ * If the segment command is upper-case, the parameters are absolute values.
+ * If the segment command is lower-case, the parameters are relative values.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawStringPath(data:String):void
+ {
+ COMPILE::SWF
+ {
+ applyStroke();
+ var bounds:Rectangle = PathHelper.getBounds(data);
+ beginFill(bounds,bounds.topLeft);
+ var graphicsPath:GraphicsPath = PathHelper.getSegments(data);
+ graphics.drawPath(graphicsPath.commands, graphicsPath.data);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ var style:String = getStyleStr();
+ var path:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'path') as WrappedHTMLElement;
+ path.flexjs_wrapper = this;
+ path.style.left = 0;
+ path.style.top = 0;
+ path.setAttribute('style', style);
+ path.setAttribute('d', data);
+ element.appendChild(path);
+ }
+ }
+
+ public function drawLine():void
+ {
+
+ }
+
+ public function drawPolygon():void
+ {
+
+ }
+
+
+ /**
+ * Draws a rounded rectangle using the size of a radius to draw the rounded corners.
+ * You must set the line style, fill, or both
+ * on the Graphics object before
+ * you call the <code>drawRoundRectComplex()</code> method
+ * by calling the <code>linestyle()</code>,
+ * <code>lineGradientStyle()</code>, <code>beginFill()</code>,
+ * <code>beginGradientFill()</code>, or
+ * <code>beginBitmapFill()</code> method.
+ *
+ * @param graphics The Graphics object that draws the rounded rectangle.
+ *
+ * @param x The horizontal position relative to the
+ * registration point of the parent display object, in pixels.
+ *
+ * @param y The vertical position relative to the
+ * registration point of the parent display object, in pixels.
+ *
+ * @param width The width of the round rectangle, in pixels.
+ *
+ * @param height The height of the round rectangle, in pixels.
+ *
+ * @param topLeftRadius The radius of the upper-left corner, in pixels.
+ *
+ * @param topRightRadius The radius of the upper-right corner, in pixels.
+ *
+ * @param bottomLeftRadius The radius of the bottom-left corner, in pixels.
+ *
+ * @param bottomRightRadius The radius of the bottom-right corner, in pixels.
+ *
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function drawRoundRectComplex(x:Number, y:Number,
+ width:Number, height:Number,
+ topLeftRadius:Number, topRightRadius:Number,
+ bottomLeftRadius:Number, bottomRightRadius:Number):void
+ {
+ COMPILE::SWF
+ {
+ applyStroke();
+ beginFill(new Rectangle(x,y,width,height), new Point(x,y));
+ graphics.drawRoundRectComplex(x,y,width,height,topLeftRadius,topRightRadius,bottomLeftRadius,bottomRightRadius);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ var builder:PathBuilder = new PathBuilder();
+ builder.drawRoundRectComplex(x, y, width, height, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
+ drawStringPath(builder.getPathString());
+ }
+
+
+ }
+
+ /**
+ * Draws a rounded rectangle using the size of individual x and y radii to
+ * draw the rounded corners.
+ * You must set the line style, fill, or both
+ * on the Graphics object before
+ * you call the <code>drawRoundRectComplex2()</code> method
+ * by calling the <code>linestyle()</code>,
+ * <code>lineGradientStyle()</code>, <code>beginFill()</code>,
+ * <code>beginGradientFill()</code>, or
+ * <code>beginBitmapFill()</code> method.
+ *
+ * @param graphics The Graphics object that draws the rounded rectangle.
+ *
+ * @param x The horizontal position relative to the
+ * registration point of the parent display object, in pixels.
+ *
+ * @param y The vertical position relative to the
+ * registration point of the parent display object, in pixels.
+ *
+ * @param width The width of the round rectangle, in pixels.
+ *
+ * @param height The height of the round rectangle, in pixels.
+ *
+ * @param radiusX The default radiusX to use, if corner-specific values are not specified.
+ * This value must be specified.
+ *
+ * @param radiusY The default radiusY to use, if corner-specific values are not specified.
+ * If 0, the value of radiusX is used.
+ *
+ * @param topLeftRadiusX The x radius of the upper-left corner, in pixels. If NaN,
+ * the value of radiusX is used.
+ *
+ * @param topLeftRadiusY The y radius of the upper-left corner, in pixels. If NaN,
+ * the value of topLeftRadiusX is used.
+ *
+ * @param topRightRadiusX The x radius of the upper-right corner, in pixels. If NaN,
+ * the value of radiusX is used.
+ *
+ * @param topRightRadiusY The y radius of the upper-right corner, in pixels. If NaN,
+ * the value of topRightRadiusX is used.
+ *
+ * @param bottomLeftRadiusX The x radius of the bottom-left corner, in pixels. If NaN,
+ * the value of radiusX is used.
+ *
+ * @param bottomLeftRadiusY The y radius of the bottom-left corner, in pixels. If NaN,
+ * the value of bottomLeftRadiusX is used.
+ *
+ * @param bottomRightRadiusX The x radius of the bottom-right corner, in pixels. If NaN,
+ * the value of radiusX is used.
+ *
+ * @param bottomRightRadiusY The y radius of the bottom-right corner, in pixels. If NaN,
+ * the value of bottomRightRadiusX is used.
+ *
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function drawRoundRectComplex2(x:Number, y:Number,
+ width:Number, height:Number,
+ radiusX:Number, radiusY:Number,
+ topLeftRadiusX:Number, topLeftRadiusY:Number,
+ topRightRadiusX:Number, topRightRadiusY:Number,
+ bottomLeftRadiusX:Number, bottomLeftRadiusY:Number,
+ bottomRightRadiusX:Number, bottomRightRadiusY:Number):void
+ {
+ var builder:PathBuilder = new PathBuilder();
+ builder.drawRoundRectComplex2(x, y, width, height, radiusX, radiusY,topLeftRadiusX, topLeftRadiusY,topRightRadiusX, topRightRadiusY,bottomLeftRadiusX, bottomLeftRadiusY,bottomRightRadiusX, bottomRightRadiusY);
+
+ COMPILE::SWF
+ {
+ applyStroke();
+ beginFill(new Rectangle(x,y,width,height), new Point(x,y));
+ builder.draw(graphics);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ drawStringPath(builder.getPathString());
+ }
+ }
+
+ /*
+ What about these?
+ beginBitmapFill
+ beginFill
+ beginGradientFill
+ beginShaderFill
+ drawGraphicsData
+ drawRoundRect
+ drawTriangles
+ */
+
+ /**
+ * Draw a string of characters.
+ * @param value The string to draw.
+ * @param x The x location of the center of the circle
+ * @param y The y location of the center of the circle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion Text
+ * @flexjsignorecoercion Node
+ */
+ public function drawText(value:String, x:Number, y:Number):Object
+ {
+ COMPILE::SWF
+ {
+ var textField:CSSTextField = new CSSTextField();
+ addChild(textField);
+
+ textField.selectable = false;
+ textField.type = TextFieldType.DYNAMIC;
+ textField.mouseEnabled = false;
+ textField.autoSize = "left";
+ textField.text = value;
+
+ var color:SolidColor = textFill as SolidColor;
+ if (color) {
+ textField.textColor = color.color;
+ textField.alpha = color.alpha;
+ }
+
+ textField.x = x;
+ textField.y = y + textField.textHeight/4;
+
+ return textField;
+
+ }
+ COMPILE::JS
+ {
+ var style:String = getTxtStyleStr();
+ var text:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'text') as WrappedHTMLElement;
+ text.flexjs_wrapper = this;
+ text.style.left = x;
+ text.style.top = y;
+ text.setAttribute('style', style);
+ text.setAttribute('x', x);
+ text.setAttribute('y', y + 15);
+ var textNode:Text = document.createTextNode(value) as Text;
+ text.appendChild(textNode as Node);
+ element.appendChild(text);
+ return text;
+ }
+ }
+
+ /**
+ * @return {string} The style attribute.
+ */
+ COMPILE::JS
+ public function getTxtStyleStr():String
+ {
+ var fillStr:String;
+ if (textFill)
+ {
+ fillStr = textFill.addFillAttrib(this);
+ }
+ else
+ {
+ fillStr = 'fill:none';
+ }
+
+ var strokeStr:String;
+ if (textStroke)
+ {
+ strokeStr = textStroke.addStrokeAttrib(this);
+ }
+ else
+ {
+ strokeStr = 'stroke:none';
+ }
+ return fillStr + ';' + strokeStr;
+
+
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7a65d3d7/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Ellipse.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Ellipse.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Ellipse.as
new file mode 100644
index 0000000..c2fbabc
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Ellipse.as
@@ -0,0 +1,152 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.svg
+{
+ import org.apache.flex.graphics.IEllipse;
+
+ COMPILE::SWF
+ {
+ import flash.geom.Point;
+ import flash.geom.Rectangle;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ public class Ellipse extends GraphicShape implements IEllipse
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.7
+ */
+ public function Ellipse(cx:Number=0, cy:Number=0, rx:Number=0, ry:Number=0)
+ {
+ x = cx;
+ y = cy;
+ this.rx = rx;
+ this.ry = ry;
+ }
+
+ private var _rx:Number;
+
+ /**
+ * The horizontal radius of the ellipse.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion FlexJS 0.7
+ */
+ public function get rx():Number
+ {
+ return _rx;
+ }
+
+ public function set rx(value:Number):void
+ {
+ _rx = value;
+ }
+
+ private var _ry:Number;
+
+ /**
+ * The vertical radius of the ellipse.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion FlexJS 0.7
+ */
+ public function get ry():Number
+ {
+ return _ry;
+ }
+
+ public function set ry(value:Number):void
+ {
+ _ry = value;
+ }
+
+
+ COMPILE::JS
+ private var _ellipse:WrappedHTMLElement;
+
+ /**
+ * Draw the ellipse.
+ * @param xp The x position of the top-left corner of the bounding box of the ellipse.
+ * @param yp The y position of the top-left corner of the bounding box of the ellipse.
+ * @param width The width of the ellipse.
+ * @param height The height of the ellipse.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion SVGEllipseElement
+ */
+ public function drawEllipse(xp:Number, yp:Number):void
+ {
+ COMPILE::SWF
+ {
+ graphics.clear();
+ applyStroke();
+ beginFill(new Rectangle(xp, yp, width, height), new Point(xp,yp));
+ graphics.drawEllipse(xp,yp,width,height);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ var style:String = getStyleStr();
+ if (_ellipse == null) {
+ _ellipse = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse') as WrappedHTMLElement;
+ _ellipse.flexjs_wrapper = this;
+ element.appendChild(_ellipse);
+ }
+ _ellipse.setAttribute('style', style);
+ if (stroke)
+ {
+ _ellipse.setAttribute('cx', width / 2 + stroke.weight);
+ _ellipse.setAttribute('cy', height / 2 + stroke.weight);
+ }
+ else
+ {
+ _ellipse.setAttribute('cx', width / 2);
+ _ellipse.setAttribute('cy', height / 2);
+ }
+ _ellipse.setAttribute('rx', width / 2);
+ _ellipse.setAttribute('ry', height / 2);
+
+ resize(x, y, (_ellipse as SVGEllipseElement).getBBox());
+
+ }
+ }
+
+ override protected function draw():void
+ {
+ drawEllipse(0, 0);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7a65d3d7/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicShape.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicShape.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicShape.as
new file mode 100644
index 0000000..c2baa41
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicShape.as
@@ -0,0 +1,225 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flex.svg
+{
+ COMPILE::SWF
+ {
+ import flash.geom.Point;
+ import flash.geom.Rectangle;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.graphics.IFill;
+ import org.apache.flex.graphics.IStroke;
+ import org.apache.flex.graphics.IGraphicShape;
+
+ public class GraphicShape extends UIBase implements IGraphicShape
+ {
+ private var _fill:IFill;
+ private var _stroke:IStroke;
+
+ public function get stroke():IStroke
+ {
+ return _stroke;
+ }
+
+ /**
+ * A solid color fill.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion FlexJS 0.0
+ */
+ public function set stroke(value:IStroke):void
+ {
+ _stroke = value;
+ }
+
+ public function get fill():IFill
+ {
+ return _fill;
+ }
+ /**
+ * A solid color fill.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion FlexJS 0.0
+ */
+ public function set fill(value:IFill):void
+ {
+ _fill = value;
+ }
+
+ /**
+ * Constructor
+ *
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function GraphicShape()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as WrappedHTMLElement;
+ element.flexjs_wrapper = this;
+ element.style.left = 0;
+ element.style.top = 0;
+ //element.offsetParent = null;
+ positioner = element;
+ positioner.style.position = 'relative';
+
+ return element;
+ }
+
+
+ COMPILE::SWF
+ protected function applyStroke():void
+ {
+ if(stroke)
+ {
+ stroke.apply(this);
+ }
+ }
+
+ COMPILE::SWF
+ protected function beginFill(targetBounds:Rectangle,targetOrigin:Point):void
+ {
+ if(fill)
+ {
+ fill.begin(this, targetBounds,targetOrigin);
+ }
+ }
+
+ COMPILE::SWF
+ protected function endFill():void
+ {
+ if(fill)
+ {
+ fill.end(this);
+ }
+ }
+
+ /**
+ * This is where the drawing methods get called from
+ */
+ protected function draw():void
+ {
+ //Overwrite in subclass
+ }
+
+ override public function addedToParent():void
+ {
+ COMPILE::SWF
+ {
+ super.addedToParent();
+ }
+ draw();
+ COMPILE::JS
+ {
+ element.style.overflow = 'visible';
+ }
+ }
+
+ /**
+ * @return {string} The style attribute.
+ */
+ COMPILE::JS
+ public function getStyleStr():String
+ {
+ var fillStr:String;
+ if (fill)
+ {
+ fillStr = fill.addFillAttrib(this);
+ }
+ else
+ {
+ fillStr = 'fill:none';
+ }
+
+ var strokeStr:String;
+ if (stroke)
+ {
+ strokeStr = stroke.addStrokeAttrib(this);
+ }
+ else
+ {
+ strokeStr = 'stroke:none';
+ }
+
+
+ return fillStr + ';' + strokeStr;
+ }
+
+
+ /**
+ * @param x X position.
+ * @param y Y position.
+ * @param bbox The bounding box of the svg element.
+ */
+ COMPILE::JS
+ public function resize(x:Number, y:Number, bbox:SVGRect):void
+ {
+ var useWidth:Number = Math.max(this.width, bbox.width);
+ var useHeight:Number = Math.max(this.height, bbox.height);
+
+ element.style.position = 'absolute';
+ if (!isNaN(x)) element.style.top = x;
+ if (!isNaN(y)) element.style.left = y;
+ element.style.width = useWidth;
+ element.style.height = useHeight;
+ element.style.left = x;
+ element.style.top = y;
+ }
+
+ COMPILE::JS
+ private var _x:Number;
+ COMPILE::JS
+ private var _y:Number;
+ COMPILE::JS
+ private var _xOffset:Number;
+ COMPILE::JS
+ private var _yOffset:Number;
+
+ /**
+ * @param x X position.
+ * @param y Y position.
+ * @param xOffset offset from x position.
+ * @param yOffset offset from y position.
+ */
+ COMPILE::JS
+ public function setPosition(x:Number, y:Number, xOffset:Number, yOffset:Number):void
+ {
+ _x = x;
+ _y = y;
+ _xOffset = xOffset;
+ _yOffset = yOffset;
+ element.style.left = xOffset;
+ element.style.top = yOffset;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7a65d3d7/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Path.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Path.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Path.as
new file mode 100644
index 0000000..fe6b74a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Path.as
@@ -0,0 +1,133 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flex.svg
+{
+ import org.apache.flex.graphics.IPath;
+ import org.apache.flex.graphics.PathBuilder;
+
+ COMPILE::SWF
+ {
+ import flash.display.GraphicsPath;
+ import flash.geom.Point;
+ import flash.geom.Rectangle;
+ import org.apache.flex.graphics.utils.PathHelper;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+
+ public class Path extends GraphicShape implements IPath
+ {
+
+ private var _data:String;
+
+ public function get data():String
+ {
+ return _data;
+ }
+
+ public function set data(value:String):void
+ {
+ _data = value;
+ _pathCommands = null;
+ }
+
+ private var _pathCommands:PathBuilder;
+
+ public function get pathCommands():PathBuilder
+ {
+ return _pathCommands;
+ }
+
+ public function set pathCommands(value:PathBuilder):void
+ {
+ _pathCommands = value;
+ _data = _pathCommands.getPathString();
+ }
+
+
+ COMPILE::JS
+ private var _path:WrappedHTMLElement;
+
+ /**
+ * Draw the path.
+ * @param data A PathBuilder object containing a vector of drawing commands.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawPathCommands(xp:Number,yp:Number,data:PathBuilder):void
+ {
+ drawStringPath(xp,yp,data.getPathString());
+ }
+
+ /**
+ * Draw the path.
+ * @param data A string containing a compact represention of the path segments.
+ * The value is a space-delimited string describing each path segment. Each
+ * segment entry has a single character which denotes the segment type and
+ * two or more segment parameters.
+ *
+ * If the segment command is upper-case, the parameters are absolute values.
+ * If the segment command is lower-case, the parameters are relative values.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawStringPath(xp:Number,yp:Number,data:String):void
+ {
+ COMPILE::SWF
+ {
+ graphics.clear();
+ applyStroke();
+ var bounds:Rectangle = PathHelper.getBounds(data);
+ this.width = bounds.width;
+ this.height = bounds.height;
+ beginFill(bounds,new Point(bounds.left + xp, bounds.top + yp) );
+ var graphicsPath:GraphicsPath = PathHelper.getSegments(data,xp,yp);
+ graphics.drawPath(graphicsPath.commands, graphicsPath.data);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ if (data == null || data.length === 0) return;
+ var style:String = getStyleStr();
+ if (_path == null) {
+ _path = document.createElementNS('http://www.w3.org/2000/svg', 'path') as WrappedHTMLElement;
+ _path.flexjs_wrapper = this;
+ element.appendChild(_path);
+ }
+ _path.setAttribute('style', style);
+ _path.setAttribute('d', data);
+
+ resize(x, y, _path['getBBox']());
+
+ }
+ }
+
+ override protected function draw():void
+ {
+ drawStringPath(0, 0, data);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7a65d3d7/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Rect.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Rect.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Rect.as
new file mode 100644
index 0000000..64f888d
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Rect.as
@@ -0,0 +1,156 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flex.svg
+{
+ import org.apache.flex.graphics.IRect;
+
+ COMPILE::SWF
+ {
+ import flash.geom.Point;
+ import flash.geom.Rectangle;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ public class Rect extends GraphicShape implements IRect
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.7
+ */
+ public function Rect(x:Number=0, y:Number=0, width:Number=0, height:Number=0,rx:Number=NaN,ry:Number=NaN)
+ {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ this.rx = rx;
+ this.ry = ry;
+ }
+
+ COMPILE::JS
+ private var _rect:WrappedHTMLElement;
+
+ private var _rx:Number;
+
+ /**
+ * The x axis radius for rounded corners
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.7
+ */
+ public function get rx():Number
+ {
+ return _rx;
+ }
+
+ public function set rx(value:Number):void
+ {
+ _rx = value;
+ }
+
+ private var _ry:Number;
+
+ /**
+ * The y axis radius for rounded corners
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.7
+ *
+ */
+ public function get ry():Number
+ {
+ return _ry;
+ }
+
+ public function set ry(value:Number):void
+ {
+ _ry = value;
+ }
+
+ /**
+ * Draw the rectangle.
+ * @param xp The x position of the top-left corner of the rectangle.
+ * @param yp The y position of the top-left corner.
+ * @param width The width of the rectangle.
+ * @param height The height of the rectangle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawRect(xp:Number, yp:Number, width:Number, height:Number):void
+ {
+ COMPILE::SWF
+ {
+ graphics.clear();
+ applyStroke();
+ beginFill(new Rectangle(xp, yp, width, height), new Point(xp,yp));
+ if(isNaN(rx))
+ graphics.drawRect(x, y, width, height);
+ else
+ {
+ var dx:Number = rx*2;
+ var dy:Number = isNaN(ry) ? ry : ry*2;
+ graphics.drawRoundRect(x, y, width, height,dx ,dy);
+ }
+ endFill();
+ }
+ COMPILE::JS
+ {
+ var style:String = this.getStyleStr();
+
+ if (_rect == null) {
+ _rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect') as WrappedHTMLElement;
+ _rect.flexjs_wrapper = this;
+ element.appendChild(_rect);
+ }
+ _rect.setAttribute('style', style);
+ if (stroke)
+ {
+ _rect.setAttribute('x', stroke.weight / 2);
+ _rect.setAttribute('y', stroke.weight / 2);
+ }
+ else
+ {
+ _rect.setAttribute('x', 0);
+ _rect.setAttribute('y', 0);
+ }
+ _rect.setAttribute('width', width);
+ _rect.setAttribute('height', height);
+
+ resize(x, y, _rect['getBBox']());
+ }
+ }
+
+ override protected function draw():void
+ {
+ drawRect(0,0,width,height);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7a65d3d7/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Text.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Text.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Text.as
new file mode 100644
index 0000000..767de41
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Text.as
@@ -0,0 +1,150 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.svg
+{
+ import org.apache.flex.graphics.IText;
+ import org.apache.flex.graphics.SolidColor;
+
+ COMPILE::SWF
+ {
+ import flash.text.TextFieldType;
+ import org.apache.flex.core.CSSTextField;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * Draws a string of characters at a specific location using the stroke
+ * value of color and alpha.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * // TODO (aharui) ignore imports of external linkage interfaces?
+ * @flexjsignoreimport SVGLocatable
+ */
+ public class Text extends GraphicShape implements IText
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Text()
+ {
+ super();
+
+ COMPILE::SWF
+ {
+ _textField = new CSSTextField();
+ addChild(_textField);
+ }
+ }
+
+
+ COMPILE::SWF
+ private var _textField:CSSTextField;
+
+ COMPILE::JS
+ private var _text:WrappedHTMLElement;
+
+ /**
+ * @copy org.apache.flex.core.ITextModel#textField
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public function get textField() : CSSTextField
+ {
+ return _textField;
+ }
+
+ /**
+ * Draws text at the given point.
+ * @param value The string to draw.
+ * @param xt The x position of the top-left corner of the rectangle.
+ * @param yt The y position of the top-left corner.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion Text
+ * @flexjsignorecoercion Node
+ * @flexjsignorecoercion SVGLocatable
+ */
+ public function drawText(value:String, xt:Number, yt:Number):void
+ {
+ COMPILE::SWF
+ {
+ textField.selectable = false;
+ textField.type = TextFieldType.DYNAMIC;
+ textField.mouseEnabled = false;
+ textField.autoSize = "left";
+ textField.text = value;
+
+ var color:SolidColor = fill as SolidColor;
+ if (color) {
+ textField.textColor = color.color;
+ textField.alpha = color.alpha;
+ }
+
+ textField.x = xt;
+ textField.y = yt;
+ }
+ COMPILE::JS
+ {
+ var style:String = this.getStyleStr();
+ if (_text == null) {
+ _text = document.createElementNS('http://www.w3.org/2000/svg', 'text') as WrappedHTMLElement;
+ _text.flexjs_wrapper = this;
+ element.appendChild(_text);
+ }
+ else {
+ _text.removeChild(_text.childNodes[0]);
+ }
+ _text.setAttribute('style', style);
+ _text.setAttribute('x', xt);
+ _text.setAttribute('y', yt);
+ var textNode:Text = document.createTextNode(value) as Text;
+ _text.appendChild(textNode as Node);
+
+ resize(x, y, (_text as SVGLocatable).getBBox());
+
+ }
+ }
+
+ COMPILE::JS
+ override protected function draw():void
+ {
+
+ }
+
+ }
+}
[36/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - this
got renamed
Posted by ah...@apache.org.
this got renamed
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/1acc00ec
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/1acc00ec
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/1acc00ec
Branch: refs/heads/refactor-sprite
Commit: 1acc00ec28ff9620ea373709fee1ca47edbd4be2
Parents: 069904c
Author: Alex Harui <ah...@apache.org>
Authored: Sun Oct 30 21:06:06 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 08:02:15 2016 -0700
----------------------------------------------------------------------
frameworks/projects/Core/src/main/flex/CoreClasses.as | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1acc00ec/frameworks/projects/Core/src/main/flex/CoreClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/CoreClasses.as b/frameworks/projects/Core/src/main/flex/CoreClasses.as
index f34684e..797fafb 100644
--- a/frameworks/projects/Core/src/main/flex/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/flex/CoreClasses.as
@@ -169,7 +169,7 @@ internal class CoreClasses
import org.apache.flex.utils.CSSUtils; CSSUtils;
import org.apache.flex.utils.Proxy; Proxy;
- import org.apache.flex.core.HTMLElementWrapper; HTMLElementWrapper;
+ import org.apache.flex.core.UIHTMLElementWrapper; UIHTMLElementWrapper;
COMPILE::JS
{
[11/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - try to
copy HTML to Basic without losing history
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/RadioButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/RadioButtonView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/RadioButtonView.as
new file mode 100644
index 0000000..245c3d3
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/RadioButtonView.as
@@ -0,0 +1,281 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+ import flash.display.Sprite;
+ import flash.text.TextFieldAutoSize;
+ import flash.text.TextFieldType;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.CSSTextField;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IValueToggleButtonModel;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The RadioButtonView class creates the visual elements of the org.apache.flex.html.RadioButton
+ * component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class RadioButtonView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function RadioButtonView()
+ {
+ sprites = [ upSprite = new Sprite(),
+ downSprite = new Sprite(),
+ overSprite = new Sprite(),
+ upAndSelectedSprite = new Sprite(),
+ downAndSelectedSprite = new Sprite(),
+ overAndSelectedSprite = new Sprite() ];
+
+ for each( var s:Sprite in sprites )
+ {
+ var tf:CSSTextField = new CSSTextField();
+ tf.type = TextFieldType.DYNAMIC;
+ tf.autoSize = TextFieldAutoSize.LEFT;
+ tf.name = "textField";
+ var icon:Shape = new Shape();
+ icon.name = "icon";
+ s.addChild(icon);
+ s.addChild(tf);
+ }
+ }
+
+ private var upSprite:Sprite;
+ private var downSprite:Sprite;
+ private var overSprite:Sprite;
+ private var upAndSelectedSprite:Sprite;
+ private var downAndSelectedSprite:Sprite;
+ private var overAndSelectedSprite:Sprite;
+
+ private var sprites:Array;
+
+ private var _toggleButtonModel:IValueToggleButtonModel;
+
+ /**
+ * The model used for the RadioButton.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get toggleButtonModel() : IValueToggleButtonModel
+ {
+ return _toggleButtonModel;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ _toggleButtonModel = value.getBeadByType(IValueToggleButtonModel) as IValueToggleButtonModel;
+ _toggleButtonModel.addEventListener("textChange", textChangeHandler);
+ _toggleButtonModel.addEventListener("htmlChange", htmlChangeHandler);
+ _toggleButtonModel.addEventListener("selectedValueChange", selectedValueChangeHandler);
+ if (_toggleButtonModel.text != null)
+ text = _toggleButtonModel.text;
+ if (_toggleButtonModel.html != null)
+ html = _toggleButtonModel.html;
+
+ layoutControl();
+
+ var hitArea:Shape = new Shape();
+ hitArea.graphics.beginFill(0x000000);
+ hitArea.graphics.drawRect(0,0,upSprite.width, upSprite.height);
+ hitArea.graphics.endFill();
+
+ SimpleButton(value).upState = upSprite;
+ SimpleButton(value).downState = downSprite;
+ SimpleButton(value).overState = overSprite;
+ SimpleButton(value).hitTestState = hitArea;
+
+ if (toggleButtonModel.text !== null)
+ text = toggleButtonModel.text;
+ if (toggleButtonModel.html !== null)
+ html = toggleButtonModel.html;
+
+ if (toggleButtonModel.selected && toggleButtonModel.value == value) {
+ selected = true;
+ }
+ }
+
+ /**
+ * The string label for the org.apache.flex.html.RadioButton.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ var tf:CSSTextField = upSprite.getChildByName('textField') as CSSTextField;
+ return tf.text;
+ }
+ public function set text(value:String):void
+ {
+ for each( var s:Sprite in sprites )
+ {
+ var tf:CSSTextField = s.getChildByName('textField') as CSSTextField;
+ tf.text = value;
+ }
+
+ layoutControl();
+ }
+
+ /**
+ * The HTML string for the org.apache.flex.html.RadioButton.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get html():String
+ {
+ var tf:CSSTextField = upSprite.getChildByName('textField') as CSSTextField;
+ return tf.htmlText;
+ }
+ public function set html(value:String):void
+ {
+ for each(var s:Sprite in sprites)
+ {
+ var tf:CSSTextField = s.getChildByName('textField') as CSSTextField;
+ tf.htmlText = value;
+ }
+
+ layoutControl();
+ }
+
+ /**
+ * @private
+ */
+ private function textChangeHandler(event:Event):void
+ {
+ text = toggleButtonModel.text;
+ }
+
+ /**
+ * @private
+ */
+ private function htmlChangeHandler(event:Event):void
+ {
+ html = toggleButtonModel.html;
+ }
+
+ private var _selected:Boolean;
+
+ /**
+ * The selection state of the RadioButton
+ */
+ public function get selected():Boolean
+ {
+ return _selected;
+ }
+ public function set selected(value:Boolean):void
+ {
+ _selected = value;
+
+ if( value ) {
+ SimpleButton(_strand).upState = upAndSelectedSprite;
+ SimpleButton(_strand).downState = downAndSelectedSprite;
+ SimpleButton(_strand).overState = overAndSelectedSprite;
+
+ } else {
+ SimpleButton(_strand).upState = upSprite;
+ SimpleButton(_strand).downState = downSprite;
+ SimpleButton(_strand).overState = overSprite;
+ }
+
+ layoutControl();
+ }
+
+ /**
+ * @private
+ */
+ private function selectedValueChangeHandler(event:Event):void
+ {
+ selected = _toggleButtonModel.value == _toggleButtonModel.selectedValue;
+ }
+
+ /**
+ * @private
+ */
+ protected function layoutControl() : void
+ {
+ for each(var s:Sprite in sprites)
+ {
+ var icon:Shape = s.getChildByName("icon") as Shape;
+ var tf:CSSTextField = s.getChildByName("textField") as CSSTextField;
+
+ drawRadioButton(icon);
+
+ var mh:Number = Math.max(icon.height,tf.height);
+
+ icon.x = 0;
+ icon.y = (mh - icon.height)/2;
+
+ tf.x = icon.x + icon.width + 1;
+ tf.y = (mh - tf.height)/2;
+ }
+
+ }
+
+ /**
+ * @private
+ */
+ protected function drawRadioButton(icon:Shape) : void
+ {
+ icon.graphics.clear();
+ icon.graphics.beginFill(0xf8f8f8);
+ icon.graphics.lineStyle(1,0x808080);
+ icon.graphics.drawEllipse(0,0,10,10);
+ icon.graphics.endFill();
+
+ if( selected ) {
+ icon.graphics.beginFill(0);
+ icon.graphics.drawEllipse(3,3,4,4);
+ icon.graphics.endFill();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/RangeStepperView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/RangeStepperView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/RangeStepperView.as
new file mode 100644
index 0000000..a05b913
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/RangeStepperView.as
@@ -0,0 +1,157 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.svg.Rect;
+ import org.apache.flex.graphics.SolidColorStroke;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.ImageButton;
+ import org.apache.flex.html.Label;
+ import org.apache.flex.html.beads.models.RangeModelExtended;
+
+ /**
+ * The RangeStepperView bead creates the visual elements of the RangeStepper. This
+ * includes an increment button, a decrement button, and label to display the value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class RangeStepperView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function RangeStepperView()
+ {
+ super();
+ }
+
+ private var _label:Label;
+ private var _incrementButton:ImageButton;
+ private var _decrementButton:ImageButton;
+ private var _labelBox:Rect;
+
+ /**
+ * Increment control.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get incrementButton():ImageButton
+ {
+ return _incrementButton;
+ }
+
+ /**
+ * Decrement control.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get decrementButton():ImageButton
+ {
+ return _decrementButton;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ _strand = value;
+
+ var host:UIBase = _strand as UIBase;
+
+ _labelBox = new Rect();
+ _labelBox.stroke = new SolidColorStroke();
+ (_labelBox.stroke as SolidColorStroke).color = 0x000000;
+ (_labelBox.stroke as SolidColorStroke).weight = 1.0;
+
+ _incrementButton = new ImageButton();
+ _incrementButton.source = "assets/up-arrow.png";
+
+ _decrementButton = new ImageButton();
+ _decrementButton.source = "assets/down-arrow.png";
+
+ IEventDispatcher(value).addEventListener("widthChanged",sizeChangeHandler);
+ IEventDispatcher(value).addEventListener("heightChanged",sizeChangeHandler);
+
+ _label = new Label();
+
+ host.addElement(_labelBox);
+ host.addElement(_incrementButton);
+ host.addElement(_decrementButton);
+ host.addElement(_label);
+
+ var model:RangeModelExtended = host.model as RangeModelExtended;
+ model.addEventListener("valueChange", handleValueChange);
+
+ sizeChangeHandler(null);
+ }
+
+ private function sizeChangeHandler(event:Event):void
+ {
+ var host:UIBase = _strand as UIBase;
+
+ _incrementButton.x = 0;
+ _incrementButton.y = 0;
+ _incrementButton.setWidthAndHeight(host.width, 20);
+
+ _label.x = 0;
+ _label.y = _incrementButton.height + 2;
+ _label.setWidthAndHeight(host.width, host.height-40, true);
+
+ _labelBox.x = _label.x;
+ _labelBox.y = _label.y - 2;
+ _labelBox.drawRect(0, 0, _label.width - 1, _label.height);
+
+ _decrementButton.x = 0;
+ _decrementButton.y = host.height - 20;
+ _decrementButton.setWidthAndHeight(host.width, 20);
+ }
+
+ private function handleValueChange(event:Event):void
+ {
+ var model:RangeModelExtended = (_strand as UIBase).model as RangeModelExtended;
+ _label.text = model.getLabelForIndex(model.value);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/RightArrowButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/RightArrowButtonView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/RightArrowButtonView.as
new file mode 100644
index 0000000..225c37c
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/RightArrowButtonView.as
@@ -0,0 +1,112 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The RightArrowButtonView class is the view for
+ * the right arrow button in a ScrollBar and other controls.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class RightArrowButtonView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function RightArrowButtonView()
+ {
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+
+ drawView(upView.graphics, 0xf8f8f8);
+ drawView(downView.graphics, 0xd8d8d8);
+ drawView(overView.graphics, 0xe8e8e8);
+ }
+
+ private function drawView(g:Graphics, bgColor:uint):void
+ {
+ g.lineStyle(1, 0x808080);
+ g.beginFill(bgColor);
+ g.drawRoundRect(0, 0, ScrollBarView.FullSize, ScrollBarView.FullSize, ScrollBarView.ThirdSize);
+ g.endFill();
+ g.lineStyle(0);
+ g.beginFill(0);
+ g.moveTo(ScrollBarView.QuarterSize, ScrollBarView.QuarterSize);
+ g.lineTo(ScrollBarView.ThreeQuarterSize, ScrollBarView.HalfSize);
+ g.lineTo(ScrollBarView.QuarterSize, ScrollBarView.ThreeQuarterSize);
+ g.lineTo(ScrollBarView.QuarterSize, ScrollBarView.QuarterSize);
+ g.endFill();
+ }
+
+ private var shape:Shape;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, ScrollBarView.FullSize, ScrollBarView.FullSize);
+ shape.graphics.endFill();
+ SimpleButton(value).upState = upView;
+ SimpleButton(value).downState = downView;
+ SimpleButton(value).overState = overView;
+ SimpleButton(value).hitTestState = shape;
+
+ SimpleButton(_strand).addEventListener("widthChanged",sizeChangeHandler);
+ SimpleButton(_strand).addEventListener("heightChanged",sizeChangeHandler);
+ }
+
+ private var upView:Shape;
+ private var downView:Shape;
+ private var overView:Shape;
+
+ private function sizeChangeHandler(event:Event):void
+ {
+ SimpleButton(_strand).scaleX = SimpleButton(_strand).width / ScrollBarView.FullSize;
+ SimpleButton(_strand).scaleY = SimpleButton(_strand).height / ScrollBarView.FullSize;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ScrollBarView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ScrollBarView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ScrollBarView.as
new file mode 100644
index 0000000..e3f8c50
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ScrollBarView.as
@@ -0,0 +1,216 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IScrollBarModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.Strand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.html.Button;
+ import org.apache.flex.html.beads.controllers.ButtonAutoRepeatController;
+
+ /**
+ * The ScrollBarView class is the default view for
+ * the org.apache.flex.html.supportClasses.ScrollBar class.
+ * It implements the classic desktop-like ScrollBar.
+ * A different view would implement more modern scrollbars that hide themselves
+ * until hovered over with the mouse.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ScrollBarView extends Strand implements IBeadView, IStrand, IScrollBarView
+ {
+ public static const FullSize:int = 12;
+ public static const ThreeQuarterSize:int = 9;
+ public static const HalfSize:int = 6;
+ public static const ThirdSize:int = 4;
+ public static const QuarterSize:int = 3;
+
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ScrollBarView()
+ {
+ }
+
+ protected var sbModel:IScrollBarModel;
+
+ protected var _strand:IStrand;
+
+ /**
+ * The layout.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var layout:IBeadLayout;
+
+ /**
+ * The host component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get host():IUIBase
+ {
+ return _strand as IUIBase;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ for each (var bead:IBead in beads)
+ addBead(bead);
+
+ sbModel = value.getBeadByType(IScrollBarModel) as IScrollBarModel;
+ sbModel = _strand.getBeadByType(IScrollBarModel) as IScrollBarModel;
+ sbModel.addEventListener("maximumChange", changeHandler);
+ sbModel.addEventListener("minimumChange", changeHandler);
+ sbModel.addEventListener("snapIntervalChange", changeHandler);
+ sbModel.addEventListener("stepSizeChange", changeHandler);
+ sbModel.addEventListener("pageSizeChange", changeHandler);
+ sbModel.addEventListener("valueChange", changeHandler);
+
+ if( _strand.getBeadByType(IBeadLayout) == null ) {
+ layout = new (ValuesManager.valuesImpl.getValue(_strand, "iBeadLayout")) as IBeadLayout;
+ _strand.addBead(layout);
+ }
+ }
+
+ protected function changeHandler(event:Event):void
+ {
+ layout.layout();
+ }
+
+ protected var _decrement:DisplayObject;
+ protected var _increment:DisplayObject;
+ protected var _track:DisplayObject;
+ protected var _thumb:DisplayObject;
+
+ /**
+ * @copy org.apache.flex.html.beads.IScrollBarView#decrement
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get decrement():DisplayObject
+ {
+ return _decrement;
+ }
+
+ /**
+ * @copy org.apache.flex.html.beads.IScrollBarView#increment
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get increment():DisplayObject
+ {
+ return _increment;
+ }
+
+ /**
+ * @copy org.apache.flex.html.beads.IScrollBarView#track
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get track():DisplayObject
+ {
+ return _track;
+ }
+
+ /**
+ * @copy org.apache.flex.html.beads.IScrollBarView#thumb
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get thumb():DisplayObject
+ {
+ return _thumb;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBeadView#viewHeight
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get viewHeight():Number
+ {
+ // don't want to put $height in an interface
+ return _strand["$height"];
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBeadView#viewWidth
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get viewWidth():Number
+ {
+ // don't want to put $width in an interface
+ return _strand["$width"];
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SimpleAlertView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SimpleAlertView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SimpleAlertView.as
new file mode 100644
index 0000000..efedeae
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SimpleAlertView.as
@@ -0,0 +1,150 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IAlertModel;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IMeasurementBead;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.html.Label;
+ import org.apache.flex.html.TextButton;
+ import org.apache.flex.utils.CSSContainerUtils;
+
+ /**
+ * The SimpleAlertView class creates the visual elements of the
+ * org.apache.flex.html.SimpleAlert component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SimpleAlertView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SimpleAlertView()
+ {
+ }
+
+ private var messageLabel:Label;
+ private var okButton:TextButton;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ var backgroundColor:Object = ValuesManager.valuesImpl.getValue(value, "background-color");
+ var backgroundImage:Object = ValuesManager.valuesImpl.getValue(value, "background-image");
+ if (backgroundColor != null || backgroundImage != null)
+ {
+ if (value.getBeadByType(IBackgroundBead) == null)
+ value.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBackgroundBead")) as IBead);
+ }
+
+ var borderStyle:String;
+ var borderStyles:Object = ValuesManager.valuesImpl.getValue(value, "border");
+ if (borderStyles is Array)
+ {
+ borderStyle = borderStyles[1];
+ }
+ if (borderStyle == null)
+ {
+ borderStyle = ValuesManager.valuesImpl.getValue(value, "border-style") as String;
+ }
+ if (borderStyle != null && borderStyle != "none")
+ {
+ if (value.getBeadByType(IBorderBead) == null)
+ value.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBorderBead")) as IBead);
+ }
+
+ var model:IAlertModel = _strand.getBeadByType(IAlertModel) as IAlertModel;
+ model.addEventListener("messageChange",handleMessageChange);
+ model.addEventListener("htmlMessageChange",handleMessageChange);
+
+ messageLabel = new Label();
+ messageLabel.text = model.message;
+ messageLabel.html = model.htmlMessage;
+ IParent(_strand).addElement(messageLabel);
+
+ okButton = new TextButton();
+ okButton.text = model.okLabel;
+ IParent(_strand).addElement(okButton);
+ okButton.addEventListener("click",handleOK);
+
+ handleMessageChange(null);
+ }
+
+ /**
+ * @private
+ */
+ private function handleMessageChange(event:Event):void
+ {
+ var ruler:IMeasurementBead = messageLabel.getBeadByType(IMeasurementBead) as IMeasurementBead;
+ if( ruler == null ) {
+ messageLabel.addBead(ruler = new (ValuesManager.valuesImpl.getValue(messageLabel, "iMeasurementBead")) as IMeasurementBead);
+ }
+ var maxWidth:Number = Math.max(UIBase(_strand).width,ruler.measuredWidth);
+
+ var metrics:Rectangle = CSSContainerUtils.getBorderAndPaddingMetrics(_strand);
+
+ messageLabel.x = metrics.left;
+ messageLabel.y = metrics.top;
+ messageLabel.width = maxWidth;
+
+ okButton.x = (maxWidth - okButton.width)/2;
+ okButton.y = messageLabel.y + messageLabel.height + 20;
+
+ UIBase(_strand).width = maxWidth + metrics.left + metrics.right;
+ UIBase(_strand).height = okButton.y + okButton.height + metrics.bottom;
+ }
+
+ /**
+ * @private
+ */
+ private function handleOK(event:MouseEvent):void
+ {
+ var newEvent:Event = new Event("close");
+ IEventDispatcher(_strand).dispatchEvent(newEvent);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SingleLineBorderBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SingleLineBorderBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SingleLineBorderBead.as
new file mode 100644
index 0000000..49f3608
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SingleLineBorderBead.as
@@ -0,0 +1,91 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.Graphics;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStatesObject;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.utils.CSSBorderUtils;
+
+ /**
+ * The SingleLineBorderBead class draws a single line solid border.
+ * The color and thickness can be specified in CSS.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SingleLineBorderBead implements IBead, IBorderBead, IGraphicsDrawing
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SingleLineBorderBead()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ IEventDispatcher(value).addEventListener("layoutNeeded", changeHandler);
+ IEventDispatcher(value).addEventListener("heightChanged", changeHandler);
+ IEventDispatcher(value).addEventListener("widthChanged", changeHandler);
+ IEventDispatcher(value).addEventListener("sizeChanged", changeHandler);
+ changeHandler(null);
+ }
+
+ private function changeHandler(event:Event):void
+ {
+ var host:UIBase = UIBase(_strand);
+ var g:Graphics = host.graphics;
+ var w:Number = host.width;
+ var h:Number = host.height;
+ var state:String;
+ if (host is IStatesObject)
+ state = IStatesObject(host).currentState;
+
+ var gd:IGraphicsDrawing = _strand.getBeadByType(IGraphicsDrawing) as IGraphicsDrawing;
+ if( this == gd ) g.clear();
+
+ CSSBorderUtils.draw(g, w, h, host, state, false, false);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SliderThumbView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SliderThumbView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SliderThumbView.as
new file mode 100644
index 0000000..2e99eef
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SliderThumbView.as
@@ -0,0 +1,156 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ COMPILE::SWF
+ {
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+ }
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The SliderThumbView class creates the draggable input element for the
+ * org.apache.flex.html.Slider component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SliderThumbView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SliderThumbView()
+ {
+ COMPILE::SWF
+ {
+ hitArea = new Shape();
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+ }
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ private function drawView(g:Graphics, bgColor:uint):void
+ {
+ g.clear();
+ g.lineStyle(1,0x000000);
+ g.beginFill(bgColor);
+ g.drawCircle(SimpleButton(_strand).width/2, SimpleButton(_strand).height/2, 10);
+ g.endFill();
+ }
+
+ COMPILE::SWF
+ private var hitArea:Shape;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignoreimport org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ COMPILE::SWF
+ {
+ drawView(hitArea.graphics, 0xDD0000);
+ drawView(upView.graphics, 0xFFFFFF);
+ drawView(downView.graphics, 0x999999);
+ drawView(overView.graphics, 0xDDDDDD);
+
+ SimpleButton(value).upState = upView;
+ SimpleButton(value).downState = downView;
+ SimpleButton(value).overState = overView;
+ SimpleButton(value).hitTestState = hitArea;
+
+ IEventDispatcher(value).addEventListener("widthChanged",sizeChangeHandler);
+ IEventDispatcher(value).addEventListener("heightChanged",sizeChangeHandler);
+ }
+ COMPILE::JS
+ {
+
+ element = document.createElement('div') as WrappedHTMLElement;
+ element.className = 'SliderThumb';
+ element.id = 'thumb';
+ element.style.backgroundColor = '#949494';
+ element.style.border = 'thin solid #747474';
+ element.style.position = 'relative';
+ element.style.height = '30px';
+ element.style.width = '10px';
+ element.style.zIndex = '2';
+ element.style.top = '-10px';
+ element.style.left = '20px';
+
+ host.element.appendChild(element);
+
+ element.flexjs_wrapper = this;
+
+ }
+ }
+
+ COMPILE::SWF
+ private var upView:Shape;
+ COMPILE::SWF
+ private var downView:Shape;
+ COMPILE::SWF
+ private var overView:Shape;
+
+ COMPILE::JS
+ public var element:WrappedHTMLElement;
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ private function sizeChangeHandler( event:Event ) : void
+ {
+ drawView(hitArea.graphics, 0xDD0000);
+ drawView(upView.graphics, 0xFFFFFF);
+ drawView(downView.graphics, 0x999999);
+ drawView(overView.graphics, 0xDDDDDD);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SliderTrackView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SliderTrackView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SliderTrackView.as
new file mode 100644
index 0000000..4290ac7
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SliderTrackView.as
@@ -0,0 +1,153 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ COMPILE::SWF
+ {
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+ }
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The SliderTrackView class creates the track area for the org.apache.flex.html.Slider
+ * component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SliderTrackView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SliderTrackView()
+ {
+ COMPILE::SWF
+ {
+ hitArea = new Shape();
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+ }
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ private function drawView(g:Graphics, bgColor:uint):void
+ {
+ g.clear();
+ g.lineStyle(1,0x000000);
+ g.beginFill(bgColor);
+ g.drawRect(0, 0, SimpleButton(_strand).width, SimpleButton(_strand).height);
+ g.endFill();
+ }
+
+ COMPILE::SWF
+ private var hitArea:Shape;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ COMPILE::SWF
+ {
+ drawView(hitArea.graphics, 0xDD0000);
+ drawView(upView.graphics, 0xCCCCCC);
+ drawView(downView.graphics, 0x808080);
+ drawView(overView.graphics, 0xEEEEEE);
+
+ SimpleButton(value).upState = upView;
+ SimpleButton(value).downState = downView;
+ SimpleButton(value).overState = overView;
+ SimpleButton(value).hitTestState = hitArea;
+
+ IEventDispatcher(value).addEventListener("widthChanged",sizeChangeHandler);
+ IEventDispatcher(value).addEventListener("heightChanged",sizeChangeHandler);
+ }
+ COMPILE::JS
+ {
+ element = document.createElement('div') as WrappedHTMLElement;
+ element.className = 'SliderTrack';
+ element.id = 'track';
+ element.style.backgroundColor = '#E4E4E4';
+ element.style.height = '10px';
+ element.style.width = '200px';
+ element.style.border = 'thin solid #C4C4C4';
+ element.style.position = 'relative';
+ element.style.left = '0px';
+ element.style.top = '10px';
+ element.style.zIndex = '1';
+
+ var host:UIBase = value as UIBase;
+ host.element.appendChild(element);
+ }
+ }
+
+ COMPILE::JS
+ public var element:WrappedHTMLElement;
+
+ COMPILE::SWF
+ private var upView:Shape;
+ COMPILE::SWF
+ private var downView:Shape;
+ COMPILE::SWF
+ private var overView:Shape;
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ private function sizeChangeHandler( event:Event ) : void
+ {
+ drawView(hitArea.graphics, 0xDD0000);
+ drawView(upView.graphics, 0xCCCCCC);
+ drawView(downView.graphics, 0x808080);
+ drawView(overView.graphics, 0xEEEEEE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SliderView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SliderView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SliderView.as
new file mode 100644
index 0000000..071dd8d
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SliderView.as
@@ -0,0 +1,179 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.Sprite;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IRangeModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.Button;
+
+ /**
+ * The SliderView class creates the visual elements of the org.apache.flex.html.Slider
+ * component. The Slider has a track and a thumb control which are also created with view beads.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SliderView extends BeadViewBase implements ISliderView, IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SliderView()
+ {
+ }
+
+ private var rangeModel:IRangeModel;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ _track = new Button();
+ Button(_track).addBead(new (ValuesManager.valuesImpl.getValue(_strand, "iTrackView")) as IBead);
+
+ _thumb = new Button();
+ Button(_thumb).addBead(new (ValuesManager.valuesImpl.getValue(_strand, "iThumbView")) as IBead);
+
+ UIBase(_strand).addChild(_track);
+ UIBase(_strand).addChild(_thumb);
+
+ IEventDispatcher(value).addEventListener("widthChanged",sizeChangeHandler);
+ IEventDispatcher(value).addEventListener("heightChanged",sizeChangeHandler);
+
+ rangeModel = _strand.getBeadByType(IBeadModel) as IRangeModel;
+
+ // listen for changes to the model and adjust the UI accordingly.
+ IEventDispatcher(rangeModel).addEventListener("valueChange",modelChangeHandler);
+ IEventDispatcher(rangeModel).addEventListener("minimumChange",modelChangeHandler);
+ IEventDispatcher(rangeModel).addEventListener("maximumChange",modelChangeHandler);
+ IEventDispatcher(rangeModel).addEventListener("stepSizeChange",modelChangeHandler);
+ IEventDispatcher(rangeModel).addEventListener("snapIntervalChange",modelChangeHandler);
+
+ // set a minimum size to trigger the size change handler
+ var needsSizing:Boolean = true;
+ if( UIBase(_strand).width < 100 ) {
+ UIBase(_strand).width = 100;
+ needsSizing = false;
+ }
+ if( UIBase(_strand).height < 30 ) {
+ UIBase(_strand).height = 30;
+ needsSizing = false;
+ }
+
+ if( needsSizing ) sizeChangeHandler(null);
+ }
+
+ private var _track:DisplayObject;
+ private var _thumb:DisplayObject;
+
+ /**
+ * The track component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get track():DisplayObject
+ {
+ return _track;
+ }
+
+ /**
+ * The thumb component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get thumb():DisplayObject
+ {
+ return _thumb;
+ }
+
+ /**
+ * @private
+ */
+ private function sizeChangeHandler( event:Event ) : void
+ {
+ var w:Number = UIBase(_strand).width;
+ var h:Number = UIBase(_strand).height;
+
+ _thumb.width = 20;
+ _thumb.height = UIBase(_strand).height;
+
+ _thumb.x = 10;
+ _thumb.y = 0;
+
+ // the track is inset 1/2 of the thumbwidth so the thumb can
+ // overlay the track on either end with the thumb center being
+ // on the track's edge
+ _track.width = UIBase(_strand).width - _thumb.width;
+ _track.height = 5;
+ _track.x = _thumb.width/2;
+ _track.y = (UIBase(_strand).height - _track.height)/2;
+ }
+
+ /**
+ * @private
+ */
+ private function modelChangeHandler( event:Event ) : void
+ {
+ setThumbPositionFromValue(rangeModel.value);
+ }
+
+ /**
+ * @private
+ */
+ private function setThumbPositionFromValue( value:Number ) : void
+ {
+ var p:Number = (value-rangeModel.minimum)/(rangeModel.maximum-rangeModel.minimum);
+ var xloc:Number = p*(UIBase(_strand).width - _thumb.width);
+
+ _thumb.x = xloc;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SolidBackgroundBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SolidBackgroundBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SolidBackgroundBead.as
new file mode 100644
index 0000000..a162669
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SolidBackgroundBead.as
@@ -0,0 +1,195 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.Sprite;
+ import flash.display.Graphics;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.ILayoutChild;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The SolidBackgroundBead class draws a solid filled background.
+ * The color and opacity can be specified in CSS.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SolidBackgroundBead implements IBead, IBackgroundBead, IGraphicsDrawing
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SolidBackgroundBead()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ private var host:IUIBase;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ if (value is IUIBase)
+ host = IUIBase(value);
+ else if (value is IBeadView)
+ host = IUIBase(IBeadView(value).host);
+
+ IEventDispatcher(host).addEventListener("heightChanged", changeHandler);
+ IEventDispatcher(host).addEventListener("widthChanged", changeHandler);
+ IEventDispatcher(host).addEventListener("sizeChanged", changeHandler);
+ IEventDispatcher(host).addEventListener("initComplete", changeHandler);
+
+ var bgColor:Object = ValuesManager.valuesImpl.getValue(host, "background-color");
+ if ((bgColor is String) && (bgColor == "transparent")) {
+ bgColor = null;
+ opacity = 0;
+ }
+ else if( bgColor != null ) {
+ backgroundColor = ValuesManager.valuesImpl.convertColor(bgColor);
+ }
+
+ var bgAlpha:Object = ValuesManager.valuesImpl.getValue(host, "opacity");
+ if( bgAlpha != null ) {
+ opacity = Number(bgAlpha);
+ }
+
+ var corner:Object = ValuesManager.valuesImpl.getValue(host, "border-radius");
+ if( corner != null ) {
+ borderRadius = Number(corner);
+ }
+
+ changeHandler(null);
+ }
+
+ private var _backgroundColor:uint;
+
+ /**
+ * The background color
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get backgroundColor():uint
+ {
+ return _backgroundColor;
+ }
+
+ /**
+ * @private
+ */
+ public function set backgroundColor(value:uint):void
+ {
+ _backgroundColor = value;
+ if (_strand)
+ changeHandler(null);
+ }
+
+ private var _opacity:Number = 1.0;
+
+ /**
+ * The opacity (alpha).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get opacity():Number
+ {
+ return _opacity;
+ }
+
+ /**
+ * @private
+ */
+ public function set opacity(value:Number):void
+ {
+ _opacity = value;
+ if( _strand )
+ changeHandler(null);
+ }
+
+ private var _borderRadius:Number;
+
+ /**
+ * The opacity (alpha).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get borderRadius():Number
+ {
+ return _borderRadius;
+ }
+
+ /**
+ * @private
+ */
+ public function set borderRadius(value:Number):void
+ {
+ _borderRadius = value;
+ if( _strand )
+ changeHandler(null);
+ }
+
+ private function changeHandler(event:Event):void
+ {
+ var g:Graphics = Sprite(host).graphics;
+ var w:Number = host.width;
+ var h:Number = host.height;
+
+ var gd:IGraphicsDrawing = _strand.getBeadByType(IGraphicsDrawing) as IGraphicsDrawing;
+ if( this == gd ) g.clear();
+
+ g.beginFill(backgroundColor,opacity);
+ if (isNaN(borderRadius))
+ g.drawRect(0, 0, w, h);
+ else
+ g.drawRoundRect(0, 0, w, h, borderRadius * 2);
+ g.endFill();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SpinnerView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SpinnerView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SpinnerView.as
new file mode 100644
index 0000000..ecb2502
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SpinnerView.as
@@ -0,0 +1,180 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+COMPILE::SWF {
+ import flash.display.DisplayObject;
+}
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IRangeModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.Button;
+ import org.apache.flex.html.beads.controllers.ButtonAutoRepeatController;
+
+COMPILE::JS {
+ import org.apache.flex.html.beads.controllers.SpinnerMouseController;
+ import org.apache.flex.html.supportClasses.SpinnerButton;
+}
+
+ /**
+ * The SpinnerView class creates the visual elements of the org.apache.flex.html.Spinner
+ * component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SpinnerView extends BeadViewBase implements ISpinnerView, IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SpinnerView()
+ {
+ }
+
+ private var rangeModel:IRangeModel;
+
+ COMPILE::JS {
+ public var _increment:SpinnerButton;
+ public var _decrement:SpinnerButton;
+ private var controller:SpinnerMouseController;
+ }
+
+ COMPILE::SWF {
+ private var _decrement:DisplayObject;
+ private var _increment:DisplayObject;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ COMPILE::SWF {
+ _increment = new Button();
+ Button(_increment).addBead(new UpArrowButtonView());
+ Button(_increment).addBead(new ButtonAutoRepeatController());
+ _decrement = new Button();
+ Button(_decrement).addBead(new DownArrowButtonView());
+ Button(_decrement).addBead(new ButtonAutoRepeatController());
+
+ Button(_increment).x = 0;
+ Button(_increment).y = 0;
+ Button(_decrement).x = 0;
+ Button(_decrement).y = Button(_increment).height;
+
+ UIBase(_strand).addChild(_decrement);
+ UIBase(_strand).addChild(_increment);
+ rangeModel = _strand.getBeadByType(IBeadModel) as IRangeModel;
+
+ IEventDispatcher(value).addEventListener("widthChanged",sizeChangeHandler);
+ IEventDispatcher(value).addEventListener("heightChanged",sizeChangeHandler);
+ }
+ COMPILE::JS {
+ var host:UIBase = value as UIBase;
+
+ _increment = new SpinnerButton();
+ _increment.text = '\u25B2';
+ host.addElement(_increment);
+
+ _decrement = new SpinnerButton();
+ _decrement.text = '\u25BC';
+ host.addElement(_decrement);
+
+// add this in CSS!
+ controller = new SpinnerMouseController();
+ host.addBead(controller);
+ }
+ }
+
+ /**
+ * The component for decrementing the org.apache.flex.html.Spinner value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public function get decrement():DisplayObject
+ {
+ return _decrement;
+ }
+ COMPILE::JS
+ public function get decrement():SpinnerButton
+ {
+ return _decrement;
+ }
+
+ /**
+ * The component for incrementing the org.apache.flex.html.Spinner value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public function get increment():DisplayObject
+ {
+ return _increment;
+ }
+ COMPILE::JS
+ public function get increment():SpinnerButton
+ {
+ return _increment;
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ private function sizeChangeHandler( event:Event ) : void
+ {
+ var w:Number = UIBase(_strand).width;
+ var h:Number = UIBase(_strand).height / 2;
+ _increment.width = w;
+ _increment.height = h;
+ _increment.y = 0;
+ _decrement.width = w;
+ _decrement.height = h;
+ _decrement.y = h;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextAreaView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextAreaView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextAreaView.as
new file mode 100644
index 0000000..ef25539
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextAreaView.as
@@ -0,0 +1,263 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+ import flash.events.Event;
+ import flash.events.IEventDispatcher;
+ import flash.text.TextFieldType;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IScrollBarModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.html.beads.models.ScrollBarModel;
+ import org.apache.flex.html.supportClasses.Border;
+ import org.apache.flex.html.supportClasses.VScrollBar;
+
+ /**
+ * The TextAreaView class is the default view for
+ * the org.apache.flex.html.TextArea class.
+ * It implements the classic desktop-like TextArea with
+ * a border and scrollbars. It does not support right-to-left text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextAreaView extends TextFieldViewBase implements IStrand
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TextAreaView()
+ {
+ super();
+
+ textField.selectable = true;
+ textField.type = TextFieldType.INPUT;
+ textField.mouseEnabled = true;
+ textField.multiline = true;
+ textField.wordWrap = true;
+ }
+
+ private var _border:Border;
+
+ /**
+ * The border.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get border():Border
+ {
+ return _border;
+ }
+
+ private var _vScrollBar:VScrollBar;
+
+ /**
+ * The vertical ScrollBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get vScrollBar():VScrollBar
+ {
+ if (!_vScrollBar)
+ _vScrollBar = createScrollBar();
+ return _vScrollBar;
+ }
+
+ /**
+ * @private
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ for each (var bead:IBead in beads)
+ addBead(bead);
+
+ // add a border to this
+ _border = new Border();
+ _border.model = new (ValuesManager.valuesImpl.getValue(value, "iBorderModel")) as IBeadModel;
+ _border.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBorderBead")) as IBead);
+ IParent(host).addElement(border);
+
+ var vb:VScrollBar = vScrollBar;
+
+ // Default size
+ var ww:Number = DisplayObject(host).width;
+ if( isNaN(ww) || ww == 0 ) DisplayObject(host).width = 100;
+ var hh:Number = DisplayObject(host).height;
+ if( isNaN(hh) || hh == 0 ) DisplayObject(host).height = 42;
+
+ // for input, listen for changes to the _textField and update
+ // the model
+ textField.addEventListener(Event.SCROLL, textScrollHandler);
+
+ IEventDispatcher(host).addEventListener("widthChanged", sizeChangedHandler);
+ IEventDispatcher(host).addEventListener("heightChanged", sizeChangedHandler);
+ sizeChangedHandler(null);
+ }
+
+ private function createScrollBar():VScrollBar
+ {
+ var vsb:VScrollBar;
+ vsb = new VScrollBar();
+ var vsbm:ScrollBarModel = new ScrollBarModel();
+ vsbm.maximum = 100;
+ vsbm.minimum = 0;
+ vsbm.pageSize = 10;
+ vsbm.pageStepSize = 10;
+ vsbm.snapInterval = 1;
+ vsbm.stepSize = 1;
+ vsbm.value = 0;
+ vsb.model = vsbm;
+ IParent(host).addElement(vsb);
+
+ vsb.addEventListener("scroll", scrollHandler);
+
+ return vsb;
+ }
+
+ private function textScrollHandler(event:Event):void
+ {
+ var visibleLines:int = textField.bottomScrollV - textField.scrollV + 1;
+ var scrollableLines:int = textField.numLines - visibleLines + 1;
+ var vsbm:ScrollBarModel = ScrollBarModel(vScrollBar.model);
+ vsbm.minimum = 0;
+ vsbm.maximum = textField.numLines+1;
+ vsbm.value = textField.scrollV;
+ vsbm.pageSize = visibleLines;
+ vsbm.pageStepSize = visibleLines;
+ }
+
+ private function sizeChangedHandler(event:Event):void
+ {
+ var ww:Number = DisplayObject(host).width;
+ if( !isNaN(ww) && ww > 0 )
+ _border.width = ww;
+
+ ww -= DisplayObject(vScrollBar).width;
+ if( !isNaN(ww) && ww > 0 )
+ textField.width = ww;
+
+ var hh:Number = DisplayObject(host).height;
+ if( !isNaN(hh) && hh > 0 )
+ {
+ textField.height = hh;
+ _border.height = hh;
+ }
+
+ var sb:DisplayObject = DisplayObject(vScrollBar);
+ sb.y = 1;
+ sb.x = textField.width - 1;
+ sb.height = textField.height;
+ }
+
+ private function scrollHandler(event:Event):void
+ {
+ var vpos:Number = IScrollBarModel(vScrollBar.model).value;
+ textField.scrollV = vpos;
+ }
+
+ /**
+ * @copy org.apache.flex.core.UIBase#beads
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var beads:Array;
+
+ private var _beads:Vector.<IBead>;
+
+ /**
+ * @copy org.apache.flex.core.UIBase#addBead()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function addBead(bead:IBead):void
+ {
+ if (!_beads)
+ _beads = new Vector.<IBead>;
+ _beads.push(bead);
+ bead.strand = this;
+ }
+
+ /**
+ * @copy org.apache.flex.core.UIBase#getBeadByType()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getBeadByType(classOrInterface:Class):IBead
+ {
+ for each (var bead:IBead in _beads)
+ {
+ if (bead is classOrInterface)
+ return bead;
+ }
+ return null;
+ }
+
+ /**
+ * @copy org.apache.flex.core.UIBase#removeBead()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function removeBead(value:IBead):IBead
+ {
+ var n:int = _beads.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var bead:IBead = _beads[i];
+ if (bead == value)
+ {
+ _beads.splice(i, 1);
+ return bead;
+ }
+ }
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextButtonMeasurementBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextButtonMeasurementBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextButtonMeasurementBead.as
new file mode 100644
index 0000000..1341389
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextButtonMeasurementBead.as
@@ -0,0 +1,86 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IMeasurementBead;
+ import org.apache.flex.core.IStrand;
+
+ /**
+ * The TextButtonMeasurementBead class helps measure a org.apache.flex.html.TextButton.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextButtonMeasurementBead implements IMeasurementBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TextButtonMeasurementBead()
+ {
+ }
+
+ /**
+ * The overall width of the org.apache.flex.html.TextButton.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get measuredWidth():Number
+ {
+ var view:TextButtonView = _strand.getBeadByType(TextButtonView) as TextButtonView;
+ if( view ) return Math.max(view.upTextField.textWidth,view.downTextField.textWidth,view.overTextField.textWidth);
+ else return 0;
+ }
+
+ /**
+ * The overall height of the org.apache.flex.html.TextButton
+ */
+ public function get measuredHeight():Number
+ {
+ var view:TextButtonView = _strand.getBeadByType(TextButtonView) as TextButtonView;
+ if( view ) return Math.max(view.upTextField.textHeight,view.downTextField.textHeight,view.overTextField.textHeight);
+ else return 0;
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextButtonView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextButtonView.as
new file mode 100644
index 0000000..b1ab648
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextButtonView.as
@@ -0,0 +1,217 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+ import flash.text.TextFieldType;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.CSSTextField;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ITextModel;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The TextButtonView class is the default view for
+ * the org.apache.flex.html.TextButton class.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextButtonView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TextButtonView()
+ {
+ upTextField = new CSSTextField();
+ downTextField = new CSSTextField();
+ overTextField = new CSSTextField();
+ upTextField.border = true;
+ downTextField.border = true;
+ overTextField.border = true;
+ upTextField.background = true;
+ downTextField.background = true;
+ overTextField.background = true;
+ upTextField.borderColor = 0;
+ downTextField.borderColor = 0;
+ overTextField.borderColor = 0;
+ upTextField.backgroundColor = 0xCCCCCC;
+ downTextField.backgroundColor = 0x808080;
+ overTextField.backgroundColor = 0xFFCCCC;
+ upTextField.selectable = false;
+ upTextField.type = TextFieldType.DYNAMIC;
+ downTextField.selectable = false;
+ downTextField.type = TextFieldType.DYNAMIC;
+ overTextField.selectable = false;
+ overTextField.type = TextFieldType.DYNAMIC;
+ upTextField.autoSize = "left";
+ downTextField.autoSize = "left";
+ overTextField.autoSize = "left";
+
+ }
+
+ private var textModel:ITextModel;
+
+ private var shape:Shape;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ textModel = value.getBeadByType(ITextModel) as ITextModel;
+ textModel.addEventListener("textChange", textChangeHandler);
+ textModel.addEventListener("htmlChange", htmlChangeHandler);
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, 10, 10);
+ shape.graphics.endFill();
+ SimpleButton(value).upState = upTextField;
+ SimpleButton(value).downState = downTextField;
+ SimpleButton(value).overState = overTextField;
+ SimpleButton(value).hitTestState = shape;
+ upTextField.styleParent = value;
+ downTextField.styleParent = value;
+ overTextField.styleParent = value;
+ if (textModel.text !== null)
+ text = textModel.text;
+ if (textModel.html !== null)
+ html = textModel.html;
+
+ IEventDispatcher(_strand).addEventListener("widthChanged",sizeChangeHandler);
+ IEventDispatcher(_strand).addEventListener("heightChanged",sizeChangeHandler);
+ }
+
+ private function textChangeHandler(event:Event):void
+ {
+ text = textModel.text;
+ }
+
+ private function htmlChangeHandler(event:Event):void
+ {
+ html = textModel.html;
+ }
+
+ private function sizeChangeHandler(event:Event):void
+ {
+ upTextField.width = downTextField.width = overTextField.width = DisplayObject(_strand).width;
+ upTextField.height= downTextField.height= overTextField.height= DisplayObject(_strand).height;
+ }
+
+ /**
+ * The CSSTextField in the up state
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var upTextField:CSSTextField;
+
+ /**
+ * The CSSTextField in the down state
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var downTextField:CSSTextField;
+
+ /**
+ * The CSSTextField in the over state
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var overTextField:CSSTextField;
+
+ /**
+ * @copy org.apache.flex.html.core.ITextModel#text
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ return upTextField.text;
+ }
+
+ /**
+ * @private
+ */
+ public function set text(value:String):void
+ {
+ upTextField.text = value;
+ downTextField.text = value;
+ overTextField.text = value;
+ shape.graphics.clear();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, upTextField.textWidth, upTextField.textHeight);
+ shape.graphics.endFill();
+
+ }
+
+ /**
+ * @copy org.apache.flex.html.core.ITextModel#text
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get html():String
+ {
+ return upTextField.htmlText;
+ }
+
+ /**
+ * @private
+ */
+ public function set html(value:String):void
+ {
+ upTextField.htmlText = value;
+ downTextField.htmlText = value;
+ overTextField.htmlText = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextFieldLabelMeasurementBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextFieldLabelMeasurementBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextFieldLabelMeasurementBead.as
new file mode 100644
index 0000000..ca38a0b
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextFieldLabelMeasurementBead.as
@@ -0,0 +1,92 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IMeasurementBead;
+ import org.apache.flex.core.IStrand;
+
+ /**
+ * The TextFieldLabelMeasurementBead class helps to measure org.apache.flex.html.Label
+ * components.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextFieldLabelMeasurementBead implements IMeasurementBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TextFieldLabelMeasurementBead()
+ {
+ }
+
+ /**
+ * The overall width of the org.apache.flex.html.Label.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get measuredWidth():Number
+ {
+ var view:TextFieldView = _strand.getBeadByType(TextFieldView) as TextFieldView;
+ if( view ) return view.textField.textWidth;
+ else return 0;
+ }
+
+ /**
+ * The overall height of the org.apache.flex.html.Label.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get measuredHeight():Number
+ {
+ var view:TextFieldView = _strand.getBeadByType(TextFieldView) as TextFieldView;
+ if( view ) return view.textField.textHeight;
+ else return 0;
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+ }
+}
[31/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - move
more UIBase to HTML
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7af78c10/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/GraphicShape.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/GraphicShape.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/GraphicShape.as
new file mode 100644
index 0000000..8f9e326
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/GraphicShape.as
@@ -0,0 +1,233 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flex.svg
+{
+ COMPILE::SWF
+ {
+ import flash.display.Graphics;
+ import flash.display.Sprite;
+ import flash.geom.Point;
+ import flash.geom.Rectangle;
+ import org.apache.flex.core.WrappedSprite;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ import org.apache.flex.core.IFlexJSElement;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.graphics.IFill;
+ import org.apache.flex.graphics.IStroke;
+ import org.apache.flex.graphics.IGraphicShape;
+
+ public class GraphicShape extends UIBase implements IGraphicShape
+ {
+
+ private var _fill:IFill;
+ private var _stroke:IStroke;
+
+ public function get stroke():IStroke
+ {
+ return _stroke;
+ }
+
+ /**
+ * A solid color fill.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion FlexJS 0.0
+ */
+ public function set stroke(value:IStroke):void
+ {
+ _stroke = value;
+ }
+
+ public function get fill():IFill
+ {
+ return _fill;
+ }
+ /**
+ * A solid color fill.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion FlexJS 0.0
+ */
+ public function set fill(value:IFill):void
+ {
+ _fill = value;
+ }
+
+ /**
+ * Constructor
+ *
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function GraphicShape()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():IFlexJSElement
+ {
+ element = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as WrappedHTMLElement;
+ element.flexjs_wrapper = this;
+ element.style.left = 0;
+ element.style.top = 0;
+ //element.offsetParent = null;
+ positioner = element;
+ positioner.style.position = 'relative';
+
+ return element;
+ }
+
+
+ COMPILE::SWF
+ protected function applyStroke():void
+ {
+ if(stroke)
+ {
+ stroke.apply($sprite.graphics);
+ }
+ }
+
+ COMPILE::SWF
+ protected function beginFill(targetBounds:Rectangle,targetOrigin:Point):void
+ {
+ if(fill)
+ {
+ fill.begin($sprite.graphics, targetBounds,targetOrigin);
+ }
+ }
+
+ COMPILE::SWF
+ protected function endFill():void
+ {
+ if(fill)
+ {
+ fill.end($sprite.graphics);
+ }
+ }
+
+ /**
+ * This is where the drawing methods get called from
+ */
+ protected function draw():void
+ {
+ //Overwrite in subclass
+ }
+
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+ draw();
+ COMPILE::JS
+ {
+ element.style.overflow = 'visible';
+ }
+ }
+
+ /**
+ * @return {string} The style attribute.
+ */
+ COMPILE::JS
+ public function getStyleStr():String
+ {
+ var fillStr:String;
+ if (fill)
+ {
+ fillStr = fill.addFillAttrib(this);
+ }
+ else
+ {
+ fillStr = 'fill:none';
+ }
+
+ var strokeStr:String;
+ if (stroke)
+ {
+ strokeStr = stroke.addStrokeAttrib(this);
+ }
+ else
+ {
+ strokeStr = 'stroke:none';
+ }
+
+
+ return fillStr + ';' + strokeStr;
+ }
+
+ COMPILE::JS
+ override protected function setClassName(value:String):void
+ {
+ element.setAttribute('class', value);
+ }
+
+
+ /**
+ * @param x X position.
+ * @param y Y position.
+ * @param bbox The bounding box of the svg element.
+ */
+ COMPILE::JS
+ public function resize(x:Number, y:Number, bbox:SVGRect):void
+ {
+ var useWidth:Number = Math.max(this.width, bbox.width);
+ var useHeight:Number = Math.max(this.height, bbox.height);
+
+ element.style.position = 'absolute';
+ if (!isNaN(x)) element.style.top = x;
+ if (!isNaN(y)) element.style.left = y;
+ element.style.width = useWidth;
+ element.style.height = useHeight;
+ element.style.left = x;
+ element.style.top = y;
+ }
+
+ COMPILE::JS
+ private var _x:Number;
+ COMPILE::JS
+ private var _y:Number;
+ COMPILE::JS
+ private var _xOffset:Number;
+ COMPILE::JS
+ private var _yOffset:Number;
+
+ /**
+ * @param x X position.
+ * @param y Y position.
+ * @param xOffset offset from x position.
+ * @param yOffset offset from y position.
+ */
+ COMPILE::JS
+ public function setPosition(x:Number, y:Number, xOffset:Number, yOffset:Number):void
+ {
+ _x = x;
+ _y = y;
+ _xOffset = xOffset;
+ _yOffset = yOffset;
+ element.style.left = xOffset;
+ element.style.top = yOffset;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7af78c10/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Path.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Path.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Path.as
new file mode 100644
index 0000000..3369e47
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Path.as
@@ -0,0 +1,133 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flex.svg
+{
+ import org.apache.flex.graphics.IPath;
+ import org.apache.flex.graphics.PathBuilder;
+
+ COMPILE::SWF
+ {
+ import flash.display.GraphicsPath;
+ import flash.geom.Point;
+ import flash.geom.Rectangle;
+ import org.apache.flex.graphics.utils.PathHelper;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+
+ public class Path extends GraphicShape implements IPath
+ {
+
+ private var _data:String;
+
+ public function get data():String
+ {
+ return _data;
+ }
+
+ public function set data(value:String):void
+ {
+ _data = value;
+ _pathCommands = null;
+ }
+
+ private var _pathCommands:PathBuilder;
+
+ public function get pathCommands():PathBuilder
+ {
+ return _pathCommands;
+ }
+
+ public function set pathCommands(value:PathBuilder):void
+ {
+ _pathCommands = value;
+ _data = _pathCommands.getPathString();
+ }
+
+
+ COMPILE::JS
+ private var _path:WrappedHTMLElement;
+
+ /**
+ * Draw the path.
+ * @param data A PathBuilder object containing a vector of drawing commands.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawPathCommands(xp:Number,yp:Number,data:PathBuilder):void
+ {
+ drawStringPath(xp,yp,data.getPathString());
+ }
+
+ /**
+ * Draw the path.
+ * @param data A string containing a compact represention of the path segments.
+ * The value is a space-delimited string describing each path segment. Each
+ * segment entry has a single character which denotes the segment type and
+ * two or more segment parameters.
+ *
+ * If the segment command is upper-case, the parameters are absolute values.
+ * If the segment command is lower-case, the parameters are relative values.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawStringPath(xp:Number,yp:Number,data:String):void
+ {
+ COMPILE::SWF
+ {
+ $sprite.graphics.clear();
+ applyStroke();
+ var bounds:Rectangle = PathHelper.getBounds(data);
+ this.width = bounds.width;
+ this.height = bounds.height;
+ beginFill(bounds,new Point(bounds.left + xp, bounds.top + yp) );
+ var graphicsPath:GraphicsPath = PathHelper.getSegments(data,xp,yp);
+ $sprite.graphics.drawPath(graphicsPath.commands, graphicsPath.data);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ if (data == null || data.length === 0) return;
+ var style:String = getStyleStr();
+ if (_path == null) {
+ _path = document.createElementNS('http://www.w3.org/2000/svg', 'path') as WrappedHTMLElement;
+ _path.flexjs_wrapper = this;
+ element.appendChild(_path);
+ }
+ _path.setAttribute('style', style);
+ _path.setAttribute('d', data);
+
+ resize(x, y, _path['getBBox']());
+
+ }
+ }
+
+ override protected function draw():void
+ {
+ drawStringPath(0, 0, data);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7af78c10/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Rect.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Rect.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Rect.as
new file mode 100644
index 0000000..14f153e
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Rect.as
@@ -0,0 +1,156 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flex.svg
+{
+ import org.apache.flex.graphics.IRect;
+
+ COMPILE::SWF
+ {
+ import flash.geom.Point;
+ import flash.geom.Rectangle;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ public class Rect extends GraphicShape implements IRect
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.7
+ */
+ public function Rect(x:Number=0, y:Number=0, width:Number=0, height:Number=0,rx:Number=NaN,ry:Number=NaN)
+ {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ this.rx = rx;
+ this.ry = ry;
+ }
+
+ COMPILE::JS
+ private var _rect:WrappedHTMLElement;
+
+ private var _rx:Number;
+
+ /**
+ * The x axis radius for rounded corners
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.7
+ */
+ public function get rx():Number
+ {
+ return _rx;
+ }
+
+ public function set rx(value:Number):void
+ {
+ _rx = value;
+ }
+
+ private var _ry:Number;
+
+ /**
+ * The y axis radius for rounded corners
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.7
+ *
+ */
+ public function get ry():Number
+ {
+ return _ry;
+ }
+
+ public function set ry(value:Number):void
+ {
+ _ry = value;
+ }
+
+ /**
+ * Draw the rectangle.
+ * @param xp The x position of the top-left corner of the rectangle.
+ * @param yp The y position of the top-left corner.
+ * @param width The width of the rectangle.
+ * @param height The height of the rectangle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawRect(xp:Number, yp:Number, width:Number, height:Number):void
+ {
+ COMPILE::SWF
+ {
+ $sprite.graphics.clear();
+ applyStroke();
+ beginFill(new Rectangle(xp, yp, width, height), new Point(xp,yp));
+ if(isNaN(rx))
+ $sprite.graphics.drawRect(0, 0, width, height);
+ else
+ {
+ var dx:Number = rx*2;
+ var dy:Number = isNaN(ry) ? ry : ry*2;
+ $sprite.graphics.drawRoundRect(0, 0, width, height,dx ,dy);
+ }
+ endFill();
+ }
+ COMPILE::JS
+ {
+ var style:String = this.getStyleStr();
+
+ if (_rect == null) {
+ _rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect') as WrappedHTMLElement;
+ _rect.flexjs_wrapper = this;
+ element.appendChild(_rect);
+ }
+ _rect.setAttribute('style', style);
+ if (stroke)
+ {
+ _rect.setAttribute('x', stroke.weight / 2);
+ _rect.setAttribute('y', stroke.weight / 2);
+ }
+ else
+ {
+ _rect.setAttribute('x', 0);
+ _rect.setAttribute('y', 0);
+ }
+ _rect.setAttribute('width', width);
+ _rect.setAttribute('height', height);
+
+ resize(x, y, _rect['getBBox']());
+ }
+ }
+
+ override protected function draw():void
+ {
+ drawRect(0,0,width,height);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7af78c10/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Text.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Text.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Text.as
new file mode 100644
index 0000000..51b8135
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Text.as
@@ -0,0 +1,150 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.svg
+{
+ import org.apache.flex.graphics.IText;
+ import org.apache.flex.graphics.SolidColor;
+
+ COMPILE::SWF
+ {
+ import flash.text.TextFieldType;
+ import org.apache.flex.core.CSSTextField;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * Draws a string of characters at a specific location using the stroke
+ * value of color and alpha.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * // TODO (aharui) ignore imports of external linkage interfaces?
+ * @flexjsignoreimport SVGLocatable
+ */
+ public class Text extends GraphicShape implements IText
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Text()
+ {
+ super();
+
+ COMPILE::SWF
+ {
+ _textField = new CSSTextField();
+ $sprite.addChild(_textField);
+ }
+ }
+
+
+ COMPILE::SWF
+ private var _textField:CSSTextField;
+
+ COMPILE::JS
+ private var _text:WrappedHTMLElement;
+
+ /**
+ * @copy org.apache.flex.core.ITextModel#textField
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public function get textField() : CSSTextField
+ {
+ return _textField;
+ }
+
+ /**
+ * Draws text at the given point.
+ * @param value The string to draw.
+ * @param xt The x position of the top-left corner of the rectangle.
+ * @param yt The y position of the top-left corner.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion Text
+ * @flexjsignorecoercion Node
+ * @flexjsignorecoercion SVGLocatable
+ */
+ public function drawText(value:String, xt:Number, yt:Number):void
+ {
+ COMPILE::SWF
+ {
+ textField.selectable = false;
+ textField.type = TextFieldType.DYNAMIC;
+ textField.mouseEnabled = false;
+ textField.autoSize = "left";
+ textField.text = value;
+
+ var color:SolidColor = fill as SolidColor;
+ if (color) {
+ textField.textColor = color.color;
+ textField.alpha = color.alpha;
+ }
+
+ textField.x = xt;
+ textField.y = yt;
+ }
+ COMPILE::JS
+ {
+ var style:String = this.getStyleStr();
+ if (_text == null) {
+ _text = document.createElementNS('http://www.w3.org/2000/svg', 'text') as WrappedHTMLElement;
+ _text.flexjs_wrapper = this;
+ element.appendChild(_text);
+ }
+ else {
+ _text.removeChild(_text.childNodes[0]);
+ }
+ _text.setAttribute('style', style);
+ _text.setAttribute('x', xt);
+ _text.setAttribute('y', yt);
+ var textNode:Text = document.createTextNode(value) as Text;
+ _text.appendChild(textNode as Node);
+
+ resize(x, y, (_text as SVGLocatable).getBBox());
+
+ }
+ }
+
+ COMPILE::JS
+ override protected function draw():void
+ {
+
+ }
+
+ }
+}
[12/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - try to
copy HTML to Basic without losing history
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IGraphicsDrawing.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IGraphicsDrawing.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IGraphicsDrawing.as
new file mode 100644
index 0000000..91d1838
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IGraphicsDrawing.as
@@ -0,0 +1,36 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ /**
+ * The IGraphicsDrawing interface is a marker interface for beads
+ * that draw into the graphics layer. This helps a bead determine
+ * if it is the first of many graphics drawing beads so it can
+ * know whether or not to clear the graphics layer before drawing.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IGraphicsDrawing
+ {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IListView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IListView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IListView.as
new file mode 100644
index 0000000..f9159ce
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IListView.as
@@ -0,0 +1,48 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.IStrand;
+
+ /**
+ * The IListView interface provides the protocol for any bead that
+ * creates the visual parts for a org.apache.flex.html.List control.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IListView extends IBeadView
+ {
+ /**
+ * The component which parents all of the itemRenderers for each
+ * datum being displayed by the List component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get dataGroup():IItemRendererParent;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IScrollBarView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IScrollBarView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IScrollBarView.as
new file mode 100644
index 0000000..c42daa7
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IScrollBarView.as
@@ -0,0 +1,80 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+
+ import org.apache.flex.core.IScrollBarModel;
+ import org.apache.flex.core.IStrand;
+
+ /**
+ * The IScrollBarView interface is the interface for views for
+ * the org.apache.flex.html.supportClasses.ScrollBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IScrollBarView
+ {
+ /**
+ * The down arrow button in a vertical ScrollBar or right arrow
+ * button in a horizontal ScrollBar
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get increment():DisplayObject;
+
+ /**
+ * The up arrow button in a vertical ScrollBar or left arrow
+ * button in a horizontal ScrollBar
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get decrement():DisplayObject;
+
+ /**
+ * The track in a ScrollBar
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get track():DisplayObject;
+
+ /**
+ * The thumb in a ScrollBar
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get thumb():DisplayObject;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ISliderView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ISliderView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ISliderView.as
new file mode 100644
index 0000000..14a51c4
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ISliderView.as
@@ -0,0 +1,60 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ COMPILE::SWF
+ {
+ import flash.display.DisplayObject;
+ }
+ import org.apache.flex.core.IBead;
+
+ /**
+ * The ISliderView interface provides the protocol for any bead that
+ * creates the visual parts for a org.apache.flex.html.Slider control.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface ISliderView extends IBead
+ {
+ /**
+ * The component used for the track area of the org.apache.flex.html.Slider.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ function get track():DisplayObject;
+
+ /**
+ * The component used for the thumb button of the org.apache.flex.html.Slider.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ function get thumb():DisplayObject;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ISpinnerView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ISpinnerView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ISpinnerView.as
new file mode 100644
index 0000000..e786db4
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ISpinnerView.as
@@ -0,0 +1,69 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ COMPILE::SWF
+ {
+ import flash.display.DisplayObject;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.html.supportClasses.SpinnerButton;
+ }
+
+ import org.apache.flex.core.IBead;
+
+ /**
+ * The ISpinnerView interface provides the protocol for any bead that
+ * creates the visual parts for a org.apache.flex.html.Spinner control.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface ISpinnerView extends IBead
+ {
+ /**
+ * The component used to increment the org.apache.flex.html.Spinner value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ function get increment():DisplayObject;
+ COMPILE::JS
+ function get increment():SpinnerButton;
+
+ /**
+ * The component used to decrement the org.apache.flex.html.Spinner value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ function get decrement():DisplayObject;
+ COMPILE::JS
+ function get decrement():SpinnerButton;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ITextFieldView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ITextFieldView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ITextFieldView.as
new file mode 100644
index 0000000..e94ee34
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ITextFieldView.as
@@ -0,0 +1,44 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.CSSTextField;
+
+ /**
+ * The ITextFieldView interface is the interface for views for
+ * the use a CSSTextField to display text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface ITextFieldView
+ {
+ /**
+ * The org.apache.flex.core.CSSTextField used to display text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get textField():CSSTextField;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ITextItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ITextItemRenderer.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ITextItemRenderer.as
new file mode 100644
index 0000000..0877b05
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ITextItemRenderer.as
@@ -0,0 +1,45 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.ISelectableItemRenderer;
+
+ /**
+ * The ITextItemRenderer interface is the interface for
+ * for org.apache.flex.core.IItemRenderer that display text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface ITextItemRenderer extends ISelectableItemRenderer
+ {
+ /**
+ * The text to be displayed in the item renderer.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get text():String;
+ function set text(value:String):void;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ImageAndTextButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ImageAndTextButtonView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ImageAndTextButtonView.as
new file mode 100644
index 0000000..3083465
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ImageAndTextButtonView.as
@@ -0,0 +1,276 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.Loader;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+ import flash.display.Sprite;
+ import flash.events.Event;
+ import flash.net.URLRequest;
+ import flash.text.TextField;
+ import flash.text.TextFieldType;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.CSSTextField;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IStrandWithModel;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.html.beads.models.ImageAndTextModel;
+ import org.apache.flex.utils.SolidBorderUtil;
+
+ /**
+ * The ImageButtonView class provides an image-only view
+ * for the standard Button. Unlike the CSSButtonView, this
+ * class does not support background and border; only images
+ * for the up, over, and active states.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ImageAndTextButtonView extends BeadViewBase implements IBeadView, IBead
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ImageAndTextButtonView()
+ {
+ upSprite = new Sprite();
+ downSprite = new Sprite();
+ overSprite = new Sprite();
+ upTextField = new CSSTextField();
+ downTextField = new CSSTextField();
+ overTextField = new CSSTextField();
+ upTextField.selectable = false;
+ upTextField.type = TextFieldType.DYNAMIC;
+ downTextField.selectable = false;
+ downTextField.type = TextFieldType.DYNAMIC;
+ overTextField.selectable = false;
+ overTextField.type = TextFieldType.DYNAMIC;
+ upTextField.autoSize = "left";
+ downTextField.autoSize = "left";
+ overTextField.autoSize = "left";
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ textModel = IStrandWithModel(value).model as ImageAndTextModel;
+ textModel.addEventListener("textChange", textChangeHandler);
+ textModel.addEventListener("htmlChange", htmlChangeHandler);
+ textModel.addEventListener("imageChange", imageChangeHandler);
+
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, 10, 10);
+ shape.graphics.endFill();
+ SimpleButton(value).upState = upSprite;
+ SimpleButton(value).downState = downSprite;
+ SimpleButton(value).overState = overSprite;
+ SimpleButton(value).hitTestState = shape;
+
+ setupBackground(upSprite, upTextField, 0xCCCCCC);
+ setupBackground(overSprite, overTextField, 0xFFCCCC, "hover");
+ setupBackground(downSprite, downTextField, 0x808080, "active");
+ upTextField.styleParent = value;
+ downTextField.styleParent = value;
+ overTextField.styleParent = value;
+
+ }
+
+ private var upSprite:Sprite;
+ private var downSprite:Sprite;
+ private var overSprite:Sprite;
+ private var shape:Shape;
+
+ private var textModel:ImageAndTextModel;
+
+ /**
+ * The URL of an icon to use in the button
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get image():String
+ {
+ return textModel.image;
+ }
+
+ /**
+ * @private
+ */
+ private function setupBackground(sprite:Sprite, textField:CSSTextField, color:uint, state:String = null):void
+ {
+ var backgroundImage:Object = image;
+ if (backgroundImage)
+ {
+ var loader:Loader = new Loader();
+ sprite.addChildAt(loader, 0);
+ sprite.addChild(textField);
+ var url:String = backgroundImage as String;
+ loader.load(new URLRequest(url));
+ loader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, function (e:flash.events.Event):void {
+ var padding:int = 2;
+ var borderWidth:int = 1;
+ updateHitArea();
+ loader.x = padding;
+ textField.x = loader.width + padding;
+ textField.y = padding;
+ loader.y = (textField.height + padding + padding - loader.height) / 2;
+ sprite.graphics.clear();
+ sprite.graphics.beginFill(color);
+ sprite.graphics.drawRect(0, 0, sprite.width, sprite.height);
+ sprite.graphics.endFill();
+ SolidBorderUtil.drawBorder(sprite.graphics,
+ 0, 0, textField.x + textField.width + padding, textField.height + padding + padding,
+ 0x000000, color, borderWidth);
+ });
+ }
+ }
+
+ private function textChangeHandler(event:Event):void
+ {
+ text = textModel.text;
+ }
+
+ private function htmlChangeHandler(event:Event):void
+ {
+ html = textModel.html;
+ }
+
+ private function imageChangeHandler(event:Event):void
+ {
+ setupBackground(upSprite, upTextField, 0xCCCCCC);
+ setupBackground(overSprite, overTextField, 0xFFCCCC, "hover");
+ setupBackground(downSprite, downTextField, 0x808080, "active");
+ }
+
+ /**
+ * The CSSTextField in the up state
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var upTextField:CSSTextField;
+
+ /**
+ * The CSSTextField in the down state
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var downTextField:CSSTextField;
+
+ /**
+ * The CSSTextField in the over state
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var overTextField:CSSTextField;
+
+ /**
+ * @copy org.apache.flex.html.core.ITextModel#text
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ return upTextField.text;
+ }
+
+ /**
+ * @private
+ */
+ public function set text(value:String):void
+ {
+ upTextField.text = value;
+ downTextField.text = value;
+ overTextField.text = value;
+ shape.graphics.clear();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, upSprite.width, upSprite.height);
+ shape.graphics.endFill();
+
+ }
+
+ /**
+ * @copy org.apache.flex.html.core.ITextModel#text
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get html():String
+ {
+ return upTextField.htmlText;
+ }
+
+ /**
+ * @private
+ */
+ public function set html(value:String):void
+ {
+ upTextField.htmlText = value;
+ downTextField.htmlText = value;
+ overTextField.htmlText = value;
+ }
+
+ /**
+ * @private
+ */
+ private function updateHitArea():void
+ {
+ shape.graphics.clear();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, upSprite.width, upSprite.height);
+ shape.graphics.endFill();
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ImageButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ImageButtonView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ImageButtonView.as
new file mode 100644
index 0000000..21f34ca
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ImageButtonView.as
@@ -0,0 +1,158 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+COMPILE::SWF {
+ import flash.display.Loader;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+ import flash.display.Sprite;
+ import flash.events.Event;
+ import flash.events.IOErrorEvent;
+ import flash.net.URLRequest;
+
+ import org.apache.flex.core.UIButtonBase;
+}
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The ImageButtonView class provides an image-only view
+ * for the standard Button. Unlike the CSSButtonView, this
+ * class does not support background and border; only images
+ * for the up, over, and active states.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ImageButtonView extends BeadViewBase implements IBeadView, IBead
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ImageButtonView()
+ {
+ COMPILE::SWF {
+ upSprite = new Sprite();
+ downSprite = new Sprite();
+ overSprite = new Sprite();
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ COMPILE::SWF {
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, 10, 10);
+ shape.graphics.endFill();
+ SimpleButton(value).upState = upSprite;
+ SimpleButton(value).downState = downSprite;
+ SimpleButton(value).overState = overSprite;
+ SimpleButton(value).hitTestState = shape;
+
+ setupBackground(upSprite);
+ setupBackground(overSprite, "hover");
+ setupBackground(downSprite, "active");
+ }
+ }
+
+ COMPILE::SWF {
+ private var upSprite:Sprite;
+ private var downSprite:Sprite;
+ private var overSprite:Sprite;
+ private var shape:Shape;
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ private function setupBackground(sprite:Sprite, state:String = null):void
+ {
+ var backgroundImage:Object = ValuesManager.valuesImpl.getValue(_strand, "background-image", state);
+ if (backgroundImage)
+ {
+ var loader:Loader = new Loader();
+ sprite.addChildAt(loader, 0);
+ var url:String = backgroundImage as String;
+ loader.load(new URLRequest(url));
+ loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (e:IOErrorEvent):void {
+ trace(e);
+ e.preventDefault();
+ });
+ loader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, function (e:flash.events.Event):void {
+ var host:UIButtonBase = UIButtonBase(_strand);
+ if (isNaN(host.explicitWidth) && isNaN(host.percentWidth))
+ {
+ host.setWidth(loader.content.width);
+ if (host.parent)
+ host.parent.dispatchEvent(new org.apache.flex.events.Event("layoutNeeded"));
+ }
+ else
+ loader.content.width = host.width;
+
+ if (isNaN(host.explicitHeight) && isNaN(host.percentHeight))
+ {
+ host.setHeight(loader.content.height);
+ if (host.parent)
+ host.parent.dispatchEvent(new org.apache.flex.events.Event("layoutNeeded"));
+ }
+ else
+ loader.content.height = host.height;
+ updateHitArea();
+ });
+ }
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ private function updateHitArea():void
+ {
+ shape.graphics.clear();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, upSprite.width, upSprite.height);
+ shape.graphics.endFill();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ImageView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ImageView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ImageView.as
new file mode 100644
index 0000000..652392a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ImageView.as
@@ -0,0 +1,223 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ COMPILE::SWF
+ {
+ import flash.display.Bitmap;
+ import flash.display.Loader;
+ import flash.display.LoaderInfo;
+ import flash.events.IOErrorEvent;
+ import flash.net.URLRequest;
+ }
+ COMPILE::JS
+ {
+ import goog.events;
+ }
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IImageModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The ImageView class creates the visual elements of the org.apache.flex.html.Image component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ImageView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ImageView()
+ {
+ }
+
+ COMPILE::SWF
+ private var bitmap:Bitmap;
+ COMPILE::SWF
+ private var loader:Loader;
+
+ private var _model:IImageModel;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ COMPILE::SWF
+ {
+ IEventDispatcher(_strand).addEventListener("widthChanged",handleSizeChange);
+ IEventDispatcher(_strand).addEventListener("heightChanged",handleSizeChange);
+ }
+
+ _model = value.getBeadByType(IImageModel) as IImageModel;
+ _model.addEventListener("urlChanged",handleUrlChange);
+
+ handleUrlChange(null);
+ }
+
+ /**
+ * @private
+ */
+ private function handleUrlChange(event:Event):void
+ {
+ COMPILE::SWF
+ {
+ if (_model.source) {
+ loader = new Loader();
+ loader.contentLoaderInfo.addEventListener("complete",onComplete);
+ loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (e:IOErrorEvent):void {
+ trace(e);
+ e.preventDefault();
+ });
+ loader.load(new URLRequest(_model.source));
+ }
+ }
+ COMPILE::JS
+ {
+ if (_model.source) {
+ var host:IUIBase = _strand as IUIBase;
+ host.element.addEventListener('load',
+ loadHandler, false);
+ host.addEventListener('sizeChanged',
+ sizeChangedHandler);
+ (host.element as HTMLImageElement).src = _model.source;
+ }
+ }
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ private function onComplete(event:Object):void
+ {
+ var host:UIBase = UIBase(_strand);
+ if (bitmap) {
+ host.removeChild(bitmap);
+ }
+
+ bitmap = Bitmap(LoaderInfo(event.target).content);
+
+ host.addChild(bitmap);
+
+ if (host.isWidthSizedToContent())
+ {
+ host.dispatchEvent(new Event("widthChanged"));
+ if (host.parent)
+ host.parent.dispatchEvent(new Event("layoutNeeded"));
+ }
+ else
+ bitmap.width = UIBase(_strand).width;
+
+ if (host.isHeightSizedToContent())
+ {
+ host.dispatchEvent(new Event("heightChanged"));
+ if (host.parent)
+ host.parent.dispatchEvent(new Event("layoutNeeded"));
+ }
+ else
+ bitmap.height = UIBase(_strand).height;
+
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ private function handleSizeChange(event:Object):void
+ {
+ var host:UIBase = UIBase(_strand);
+ if (bitmap) {
+ if (!isNaN(host.explicitWidth) || !isNaN(host.percentWidth))
+ bitmap.width = UIBase(_strand).width;
+ if (!isNaN(host.explicitHeight) || !isNaN(host.percentHeight))
+ bitmap.height = UIBase(_strand).height;
+ }
+ }
+
+ COMPILE::JS
+ private function loadHandler(event:Object):void
+ {
+ var host:UIBase = UIBase(_strand);
+ host.parent.dispatchEvent(new Event("layoutNeeded"));
+ }
+
+ /**
+ * @flexjsignorecoercion HTMLElement
+ */
+ COMPILE::JS
+ private function sizeChangedHandler(event:Object):void
+ {
+ var host:UIBase = _strand as UIBase;
+ var s:Object = host.positioner.style;
+ var l:Number = NaN;
+ var ls:String = s.left;
+ if (typeof(ls) === 'string' && ls.length > 0)
+ l = parseFloat(ls.substring(0, ls.length - 2));
+ var r:Number = NaN;
+ var rs:String = s.right;
+ if (typeof(rs) === 'string' && rs.length > 0)
+ r = parseFloat(rs.substring(0, rs.length - 2));
+ if (!isNaN(l) &&
+ !isNaN(r)) {
+ // if just using size constraints and image will not shrink or grow
+ var computedWidth:Number = (host.positioner.offsetParent as HTMLElement).offsetWidth -
+ l - r;
+ s.width = computedWidth.toString() + 'px';
+ }
+ var t:Number = NaN;
+ var ts:String = s.top;
+ if (typeof(ts) === 'string' && ts.length > 0)
+ t = parseFloat(ts.substring(0, ts.length - 2));
+ var b:Number = NaN;
+ var bs:String = s.right;
+ if (typeof(bs) === 'string' && bs.length > 0)
+ b = parseFloat(bs.substring(0, bs.length - 2));
+ if (!isNaN(t) &&
+ !isNaN(b)) {
+ // if just using size constraints and image will not shrink or grow
+ var computedHeight:Number = (host.positioner.offsetParent as HTMLElement).offsetHeight -
+ t - b;
+ s.height = computedHeight.toString() + 'px';
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IncrementButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IncrementButtonView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IncrementButtonView.as
new file mode 100644
index 0000000..de1296b
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IncrementButtonView.as
@@ -0,0 +1,94 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.svg.Path;
+ import org.apache.flex.svg.Rect;
+ import org.apache.flex.graphics.SolidColor;
+ import org.apache.flex.graphics.SolidColorStroke;
+ import org.apache.flex.events.Event;
+
+ public class IncrementButtonView extends BeadViewBase implements IBeadView
+ {
+ public function IncrementButtonView()
+ {
+ super();
+ }
+
+ private var _backRect:Rect;
+ private var _arrow:Path;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ _strand = value;
+
+ var host:UIBase = _strand as UIBase;
+
+ _backRect = new Rect();
+ _backRect.fill = new SolidColor();
+ (_backRect.fill as SolidColor).color = 0xFFFFFF;
+ _backRect.stroke = new SolidColorStroke();
+ (_backRect.stroke as SolidColorStroke).color = 0x000000;
+ (_backRect.stroke as SolidColorStroke).weight = 1.0;
+ host.addElement(_backRect);
+
+ // arrow
+ _arrow = new Path();
+ _arrow.fill = new SolidColor();
+ (_arrow.fill as SolidColor).color = 0x000000;
+ host.addElement(_arrow);
+
+ host.addEventListener("widthChanged", sizeHandler);
+ host.addEventListener("heightChanged", sizeHandler);
+
+ sizeHandler(null);
+ }
+
+ private function sizeHandler(event:Event):void
+ {
+ var host:UIBase = _strand as UIBase;
+
+ _backRect.x = 0;
+ _backRect.y = 0;
+ _backRect.setWidthAndHeight(host.width, host.height, true);
+ _backRect.drawRect(0, 0, host.width, host.height);
+
+ var xm:Number = host.width/2;
+ var ym:Number = host.height - 4;
+
+ _arrow.setWidthAndHeight(xm, ym, true);
+ _arrow.y = 2;
+ _arrow.x = 0;
+ _arrow.drawStringPath(0, 0, "M "+xm+" 2 L "+(xm-8)+" "+ym+" L "+(xm+8)+" "+ym+" Z");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/LeftArrowButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/LeftArrowButtonView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/LeftArrowButtonView.as
new file mode 100644
index 0000000..9fca051
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/LeftArrowButtonView.as
@@ -0,0 +1,112 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The LeftArrowButtonView class is the view for
+ * the left arrow button in a ScrollBar and other controls.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class LeftArrowButtonView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function LeftArrowButtonView()
+ {
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+
+ drawView(upView.graphics, 0xf8f8f8);
+ drawView(downView.graphics, 0xd8d8d8);
+ drawView(overView.graphics, 0xe8e8e8);
+ }
+
+ private function drawView(g:Graphics, bgColor:uint):void
+ {
+ g.lineStyle(1, 0x808080);
+ g.beginFill(bgColor);
+ g.drawRoundRect(0, 0, ScrollBarView.FullSize, ScrollBarView.FullSize, ScrollBarView.ThirdSize);
+ g.endFill();
+ g.lineStyle(0);
+ g.beginFill(0);
+ g.moveTo(ScrollBarView.QuarterSize, ScrollBarView.HalfSize);
+ g.lineTo(ScrollBarView.ThreeQuarterSize, ScrollBarView.ThreeQuarterSize);
+ g.lineTo(ScrollBarView.ThreeQuarterSize, ScrollBarView.QuarterSize);
+ g.lineTo(ScrollBarView.QuarterSize, ScrollBarView.HalfSize);
+ g.endFill();
+ }
+
+ private var shape:Shape;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, ScrollBarView.FullSize, ScrollBarView.FullSize);
+ shape.graphics.endFill();
+ SimpleButton(value).upState = upView;
+ SimpleButton(value).downState = downView;
+ SimpleButton(value).overState = overView;
+ SimpleButton(value).hitTestState = shape;
+
+ SimpleButton(_strand).addEventListener("widthChanged",sizeChangeHandler);
+ SimpleButton(_strand).addEventListener("heightChanged",sizeChangeHandler);
+ }
+
+ private var upView:Shape;
+ private var downView:Shape;
+ private var overView:Shape;
+
+ private function sizeChangeHandler(event:Event):void
+ {
+ SimpleButton(_strand).scaleX = SimpleButton(_strand).width / ScrollBarView.FullSize;
+ SimpleButton(_strand).scaleY = SimpleButton(_strand).height / ScrollBarView.FullSize;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ListView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ListView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ListView.as
new file mode 100644
index 0000000..3018600
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ListView.as
@@ -0,0 +1,211 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.ContainerBase;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.ISelectableItemRenderer;
+ import org.apache.flex.core.IItemRenderer;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.IRollOverModel;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.Strand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.beads.models.ArraySelectionModel;
+ import org.apache.flex.html.beads.models.ScrollBarModel;
+ import org.apache.flex.html.beads.models.SingleLineBorderModel;
+ import org.apache.flex.html.supportClasses.Border;
+ import org.apache.flex.html.supportClasses.DataGroup;
+ import org.apache.flex.html.supportClasses.ScrollBar;
+
+ /**
+ * The List class creates the visual elements of the org.apache.flex.html.List
+ * component. A List consists of the area to display the data (in the dataGroup), any
+ * scrollbars, and so forth.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ListView extends ContainerView implements IListView
+ {
+ public function ListView()
+ {
+ }
+
+ protected var listModel:ISelectionModel;
+
+ private var _border:Border;
+
+ /**
+ * The border surrounding the org.apache.flex.html.List.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get border():Border
+ {
+ return _border;
+ }
+
+ /**
+ * The area holding the itemRenderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dataGroup():IItemRendererParent
+ {
+ (contentView as UIBase).className = "ListDataGroup";
+ return contentView as IItemRendererParent;
+ }
+
+ /**
+ * @private
+ */
+ override public function get resizableView():IUIBase
+ {
+ return _strand as IUIBase;
+ }
+
+ /**
+ * @private
+ */
+ override public function get host():IUIBase
+ {
+ return _strand as IUIBase;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ super.strand = value;
+ }
+
+ override protected function completeSetup():void
+ {
+ super.completeSetup();
+
+ // list is not interested in UI children, it wants to know when new items
+ // have been added or the dataProvider has changed.
+
+ host.removeEventListener("childrenAdded", childrenChangedHandler);
+ host.removeEventListener("childrenAdded", performLayout);
+ host.addEventListener("itemsCreated", itemsCreatedHandler);
+
+ listModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ listModel.addEventListener("selectedIndexChanged", selectionChangeHandler);
+ listModel.addEventListener("rollOverIndexChanged", rollOverIndexChangeHandler);
+ listModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
+ }
+
+ protected var lastSelectedIndex:int = -1;
+
+ /**
+ * @private
+ */
+ protected function itemsCreatedHandler(event:Event):void
+ {
+ performLayout(event);
+ }
+
+ /**
+ * @private
+ */
+ protected function dataProviderChangeHandler(event:Event):void
+ {
+ performLayout(event);
+ }
+
+ /**
+ * @private
+ */
+ protected function selectionChangeHandler(event:Event):void
+ {
+ if (lastSelectedIndex != -1)
+ {
+ var ir:ISelectableItemRenderer = dataGroup.getItemRendererForIndex(lastSelectedIndex) as ISelectableItemRenderer;
+ if (ir != null) ir.selected = false;
+ }
+ if (listModel.selectedIndex != -1)
+ {
+ ir = dataGroup.getItemRendererForIndex(listModel.selectedIndex) as ISelectableItemRenderer;
+ if (ir != null) ir.selected = true;
+ }
+ lastSelectedIndex = listModel.selectedIndex;
+ }
+
+ protected var lastRollOverIndex:int = -1;
+
+ /**
+ * @private
+ */
+ protected function rollOverIndexChangeHandler(event:Event):void
+ {
+ if (lastRollOverIndex != -1)
+ {
+ var ir:ISelectableItemRenderer = dataGroup.getItemRendererForIndex(lastRollOverIndex) as ISelectableItemRenderer;
+ ir.hovered = false;
+ }
+ if (IRollOverModel(listModel).rollOverIndex != -1)
+ {
+ ir = dataGroup.getItemRendererForIndex(IRollOverModel(listModel).rollOverIndex) as ISelectableItemRenderer;
+ ir.hovered = true;
+ }
+ lastRollOverIndex = IRollOverModel(listModel).rollOverIndex;
+ }
+
+ /**
+ * respond to a change in size or request to re-layout everything
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override protected function resizeHandler(event:Event):void
+ {
+ super.resizeHandler(event);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/MultilineTextFieldView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/MultilineTextFieldView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/MultilineTextFieldView.as
new file mode 100644
index 0000000..72dc588
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/MultilineTextFieldView.as
@@ -0,0 +1,56 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.text.TextFieldType;
+
+ /**
+ * The TextFieldView class is the default view for
+ * the org.apache.flex.html.Label class.
+ * It displays text using a TextField, so there is no
+ * right-to-left text support in this view.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class MultilineTextFieldView extends TextFieldViewBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function MultilineTextFieldView()
+ {
+ super();
+
+ textField.selectable = false;
+ textField.type = TextFieldType.DYNAMIC;
+ textField.mouseEnabled = false;
+ textField.autoSize = "left";
+ textField.multiline = true;
+ textField.wordWrap = true;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/NumericStepperView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/NumericStepperView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/NumericStepperView.as
new file mode 100644
index 0000000..6ebdbf4
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/NumericStepperView.as
@@ -0,0 +1,186 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.ILayoutChild;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.IRangeModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.Label;
+ import org.apache.flex.html.Spinner;
+ import org.apache.flex.html.TextInput;
+ import org.apache.flex.html.supportClasses.Border;
+ import org.apache.flex.html.supportClasses.ScrollBar;
+
+ /**
+ * The NumericStepperView class creates the visual elements of the
+ * org.apache.flex.html.NumericStepper component. A NumberStepper consists of a
+ * org.apache.flex.html.TextInput component to display the value and a
+ * org.apache.flex.html.Spinner to change the value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class NumericStepperView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function NumericStepperView()
+ {
+ }
+
+ private var label:Label;
+ private var input:TextInput;
+ private var spinner:Spinner;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ // add an input field
+ input = new TextInput();
+ IParent(value).addElement(input);
+
+ // add a spinner
+ spinner = new Spinner();
+ spinner.addBead( UIBase(value).model as IBead );
+ IParent(value).addElement(spinner);
+ spinner.height = input.height;
+
+ // listen for changes to the text input field which will reset the
+ // value. ideally, we should either set the input to accept only
+ // numeric values or, barring that, reject non-numeric entries. we
+ // cannot do that right now however.
+ input.model.addEventListener("textChange",inputChangeHandler);
+
+ // listen for change events on the spinner so the value can be updated as
+ // as resizing the component
+ spinner.addEventListener("valueChange",spinnerValueChanged);
+ IEventDispatcher(value).addEventListener("widthChanged",sizeChangeHandler);
+ IEventDispatcher(value).addEventListener("heightChanged",sizeChangeHandler);
+ IEventDispatcher(value).addEventListener("sizeChanged",sizeChangeHandler);
+
+ // listen for changes to the model itself and update the UI accordingly
+ IEventDispatcher(UIBase(value).model).addEventListener("valueChange",modelChangeHandler);
+ IEventDispatcher(UIBase(value).model).addEventListener("minimumChange",modelChangeHandler);
+ IEventDispatcher(UIBase(value).model).addEventListener("maximumChange",modelChangeHandler);
+ IEventDispatcher(UIBase(value).model).addEventListener("stepSizeChange",modelChangeHandler);
+ IEventDispatcher(UIBase(value).model).addEventListener("snapIntervalChange",modelChangeHandler);
+
+ input.text = String(spinner.value);
+
+ var host:ILayoutChild = ILayoutChild(value);
+ if ((host.isWidthSizedToContent() || isNaN(host.explicitWidth)) &&
+ (host.isHeightSizedToContent() || isNaN(host.explicitHeight)))
+ sizeChangeHandler(null);
+ }
+
+ /**
+ * @private
+ */
+ private function sizeChangeHandler(event:Event) : void
+ {
+ input.x = 2;
+ input.y = (UIBase(_strand).height - input.height)/2;
+ input.width = UIBase(_strand).width-spinner.width-2;
+ spinner.x = input.width+2;
+ spinner.y = 0;
+ }
+
+ /**
+ * @private
+ */
+ private function spinnerValueChanged(event:Event) : void
+ {
+ input.text = String(spinner.value);
+
+ var newEvent:Event = new Event(event.type,event.bubbles);
+ IEventDispatcher(_strand).dispatchEvent(newEvent);
+ }
+
+ /**
+ * @private
+ */
+ private function inputChangeHandler(event:Event) : void
+ {
+ var newValue:Number = Number(input.text);
+
+ if( !isNaN(newValue) ) {
+ spinner.value = newValue;
+ }
+ else {
+ input.text = String(spinner.value);
+ }
+ }
+
+ /**
+ * @private
+ */
+ private function modelChangeHandler( event:Event ) : void
+ {
+ var n:Number = IRangeModel(UIBase(_strand).model).value;
+ input.text = String(IRangeModel(UIBase(_strand).model).value);
+ }
+
+ /**
+ * The area containing the TextInput and Spinner controls.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get contentView():IParentIUIBase
+ {
+ return _strand as IParentIUIBase;
+ }
+
+ /**
+ * @private
+ */
+ public function get resizableView():IUIBase
+ {
+ return _strand as IUIBase;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/PanelView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/PanelView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/PanelView.as
new file mode 100644
index 0000000..c52fe93
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/PanelView.as
@@ -0,0 +1,168 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.ILayoutChild;
+ import org.apache.flex.core.IContentViewHost;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.IViewportModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.geom.Size;
+ import org.apache.flex.html.Container;
+ import org.apache.flex.html.Panel;
+ import org.apache.flex.html.TitleBar;
+ import org.apache.flex.utils.CSSContainerUtils;
+ import org.apache.flex.utils.CSSUtils;
+
+ /**
+ * The Panel class creates the visual elements of the org.apache.flex.html.Panel
+ * component. A Panel has a org.apache.flex.html.TitleBar, and content. A
+ * different View, PanelWithControlBarView, can display a ControlBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class PanelView extends ContainerView implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function PanelView()
+ {
+ super();
+ }
+
+ private var _titleBar:TitleBar;
+
+ /**
+ * The org.apache.flex.html.TitleBar component of the
+ * org.apache.flex.html.Panel.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get titleBar():TitleBar
+ {
+ return _titleBar;
+ }
+
+ /**
+ * @private
+ */
+ public function set titleBar(value:TitleBar):void
+ {
+ _titleBar = value;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ var host:UIBase = UIBase(value);
+
+ if (!_titleBar) {
+ _titleBar = new TitleBar();
+ _titleBar.id = "panelTitleBar";
+ _titleBar.height = 30;
+ }
+ // replace the TitleBar's model with the Panel's model (it implements ITitleBarModel) so that
+ // any changes to values in the Panel's model that correspond values in the TitleBar will
+ // be picked up automatically by the TitleBar.
+ titleBar.model = host.model;
+
+ super.strand = value;
+ }
+
+ override protected function completeSetup():void
+ {
+ (host as IContentViewHost).strandChildren.addElement(titleBar);
+ super.completeSetup();
+ }
+
+ /**
+ * Calculate the space taken up by non-content children like a TItleBar in a Panel.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override protected function getChromeMetrics():Rectangle
+ {
+ return new Rectangle(0, titleBar.height, 0, 0 - titleBar.height);
+ }
+
+ override protected function layoutViewBeforeContentLayout():void
+ {
+ var vm:IViewportModel = viewportModel;
+ var host:ILayoutChild = this.host as ILayoutChild;
+ vm.borderMetrics = CSSContainerUtils.getBorderMetrics(host);
+ titleBar.x = vm.borderMetrics.left;
+ titleBar.y = vm.borderMetrics.top;
+ if (!host.isWidthSizedToContent())
+ titleBar.width = host.width - vm.borderMetrics.left - vm.borderMetrics.right;
+ vm.chromeMetrics = getChromeMetrics();
+ viewport.setPosition(vm.borderMetrics.left + vm.chromeMetrics.left,
+ vm.borderMetrics.top + vm.chromeMetrics.top);
+ viewport.layoutViewportBeforeContentLayout(
+ !host.isWidthSizedToContent() ?
+ host.width - vm.borderMetrics.left - vm.borderMetrics.right -
+ vm.chromeMetrics.left - vm.chromeMetrics.right : NaN,
+ !host.isHeightSizedToContent() ?
+ host.height - vm.borderMetrics.top - vm.borderMetrics.bottom -
+ vm.chromeMetrics.top - vm.chromeMetrics.bottom : NaN);
+ }
+
+ override protected function layoutViewAfterContentLayout():void
+ {
+ var vm:IViewportModel = viewportModel;
+ var viewportSize:Size = this.viewport.layoutViewportAfterContentLayout();
+ var host:ILayoutChild = this.host as ILayoutChild;
+ var hasWidth:Boolean = !host.isWidthSizedToContent();
+ var hasHeight:Boolean = !host.isHeightSizedToContent();
+ if (!hasWidth) {
+ titleBar.width = viewportSize.width; // should get titlebar to layout and get new height
+ vm.chromeMetrics = this.getChromeMetrics();
+ vm.chromeMetrics.top = titleBar.height;
+ }
+ super.layoutViewAfterContentLayout();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/PanelWithControlBarView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/PanelWithControlBarView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/PanelWithControlBarView.as
new file mode 100644
index 0000000..8dfcd42
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/PanelWithControlBarView.as
@@ -0,0 +1,207 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.Sprite;
+
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IContentViewHost;
+ import org.apache.flex.core.ILayoutChild;
+ import org.apache.flex.core.IPanelModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ITitleBarModel;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.IViewportModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.geom.Size;
+ import org.apache.flex.html.Container;
+ import org.apache.flex.html.ControlBar;
+ import org.apache.flex.html.TitleBar;
+ import org.apache.flex.utils.CSSContainerUtils;
+
+ /**
+ * The Panel class creates the visual elements of the org.apache.flex.html.Panel
+ * component. A Panel has a org.apache.flex.html.TitleBar, content, and an
+ * optional org.apache.flex.html.ControlBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class PanelWithControlBarView extends ContainerView implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function PanelWithControlBarView()
+ {
+ }
+
+ private var _titleBar:TitleBar;
+
+ /**
+ * The org.apache.flex.html.TitleBar component of the
+ * org.apache.flex.html.Panel.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get titleBar():TitleBar
+ {
+ return _titleBar;
+ }
+
+ private var _controlBar:ControlBar;
+
+ /**
+ * The org.apache.flex.html.ControlBar for the Panel; may be null.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get controlBar():ControlBar
+ {
+ return _controlBar;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ var host:UIBase = UIBase(value);
+
+ // TODO: (aharui) get class to instantiate from CSS
+ if (!_titleBar) {
+ _titleBar = new TitleBar();
+ _titleBar.id = "panelTitleBar";
+ _titleBar.height = 30;
+ }
+ // replace the TitleBar's model with the Panel's model (it implements ITitleBarModel) so that
+ // any changes to values in the Panel's model that correspond values in the TitleBar will
+ // be picked up automatically by the TitleBar.
+ _titleBar.model = host.model;
+
+ var controlBarItems:Array = (host.model as IPanelModel).controlBar;
+ if( controlBarItems && controlBarItems.length > 0 ) {
+ _controlBar = new ControlBar();
+ _controlBar.id = "panelControlBar";
+ _controlBar.height = 30;
+
+ for each(var comp:IUIBase in controlBarItems) {
+ _controlBar.addElement(comp, false);
+ }
+ }
+
+ super.strand = value;
+ }
+
+ override protected function completeSetup():void
+ {
+ super.completeSetup();
+
+ (_strand as IContentViewHost).strandChildren.addElement(titleBar, false);
+
+ if (controlBar) {
+ (_strand as IContentViewHost).strandChildren.addElement(_controlBar, false);
+ }
+ }
+
+ /**
+ * Calculate the space taken up by non-content children like a TItleBar in a Panel.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override protected function getChromeMetrics():Rectangle
+ {
+ return new Rectangle(0, titleBar.height, 0, controlBar.height - titleBar.height);
+ }
+
+ override protected function layoutViewBeforeContentLayout():void
+ {
+ var vm:IViewportModel = viewportModel;
+ var host:ILayoutChild = this.host as ILayoutChild;
+ var hasHeight:Boolean = !host.isHeightSizedToContent();
+ var hasWidth:Boolean = !host.isWidthSizedToContent();
+ vm.borderMetrics = CSSContainerUtils.getBorderMetrics(host);
+ titleBar.x = vm.borderMetrics.left;
+ titleBar.y = vm.borderMetrics.top;
+ if (hasWidth)
+ {
+ titleBar.width = host.width - vm.borderMetrics.left - vm.borderMetrics.right;
+ controlBar.width = host.width - vm.borderMetrics.left - vm.borderMetrics.right;
+ }
+ vm.chromeMetrics = getChromeMetrics();
+ controlBar.x = vm.borderMetrics.left;
+ if (hasHeight && hasWidth)
+ controlBar.y = host.height - vm.borderMetrics.bottom - controlBar.height;
+
+ viewport.setPosition(vm.borderMetrics.left + vm.chromeMetrics.left,
+ vm.borderMetrics.top + vm.chromeMetrics.top);
+ viewport.layoutViewportBeforeContentLayout(
+ hasWidth ?
+ host.width - vm.borderMetrics.left - vm.borderMetrics.right -
+ vm.chromeMetrics.left - vm.chromeMetrics.right : NaN,
+ hasHeight ?
+ host.height - vm.borderMetrics.top - vm.borderMetrics.bottom -
+ vm.chromeMetrics.top - vm.chromeMetrics.bottom : NaN);
+ }
+
+ override protected function layoutViewAfterContentLayout():void
+ {
+ var vm:IViewportModel = viewportModel;
+ var viewportSize:Size = this.viewport.layoutViewportAfterContentLayout();
+ var host:ILayoutChild = this.host as ILayoutChild;
+ var hasWidth:Boolean = !host.isWidthSizedToContent();
+ var hasHeight:Boolean = !host.isHeightSizedToContent();
+ if (!hasWidth) {
+ titleBar.width = viewportSize.width; // should get titlebar to layout and get new height
+ vm.chromeMetrics = this.getChromeMetrics();
+ vm.chromeMetrics.top = titleBar.height;
+ controlBar.width = viewportSize.width; // should get controlbar to layout and get new height
+ vm.chromeMetrics.bottom = controlBar.height;
+ }
+ super.layoutViewAfterContentLayout();
+ if (!hasHeight) {
+ controlBar.y = host.height - vm.borderMetrics.bottom - controlBar.height;
+ }
+ }
+ }
+}
[39/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - move
ImageBase to HTML
Posted by ah...@apache.org.
move ImageBase to HTML
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/ef2b90a1
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/ef2b90a1
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/ef2b90a1
Branch: refs/heads/refactor-sprite
Commit: ef2b90a1022989dc923fb610461f4714120f555d
Parents: e020ba8
Author: Alex Harui <ah...@apache.org>
Authored: Mon Oct 31 09:32:05 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 08:02:15 2016 -0700
----------------------------------------------------------------------
.../main/flex/org/apache/flex/core/ImageBase.as | 84 --------------------
.../main/flex/org/apache/flex/core/ImageBase.as | 84 ++++++++++++++++++++
2 files changed, 84 insertions(+), 84 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ef2b90a1/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageBase.as
deleted file mode 100644
index 71454a7..0000000
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageBase.as
+++ /dev/null
@@ -1,84 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.core
-{
- import org.apache.flex.core.IImage;
- import org.apache.flex.core.IImageModel;
- import org.apache.flex.core.UIBase;
-
- /**
- * The ImageBase class serves as a base class for components that displays a bitmap. The Image uses
- * the following beads:
- *
- * org.apache.flex.core.IBeadModel: the data model for the Image, including the url/binary property.
- * org.apache.flex.core.IBeadView: constructs the visual elements of the component.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class ImageBase extends UIBase implements IImage
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ImageBase()
- {
- super();
- }
-
- /**
- * The location of the bitmap, usually a URL.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.IImageModel
- */
- public function get url():String
- {
- return (model as IImageModel).url;
- }
- public function set url(value:String):void
- {
- (model as IImageModel).url = value;
- }
-
- COMPILE::JS
- public function get imageElement():Element
- {
- return null;
- // override this
- }
-
- COMPILE::JS
- public function applyImageData(binaryDataAsString:String):void
- {
- // override this
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ef2b90a1/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ImageBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ImageBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ImageBase.as
new file mode 100644
index 0000000..71454a7
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ImageBase.as
@@ -0,0 +1,84 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ import org.apache.flex.core.IImage;
+ import org.apache.flex.core.IImageModel;
+ import org.apache.flex.core.UIBase;
+
+ /**
+ * The ImageBase class serves as a base class for components that displays a bitmap. The Image uses
+ * the following beads:
+ *
+ * org.apache.flex.core.IBeadModel: the data model for the Image, including the url/binary property.
+ * org.apache.flex.core.IBeadView: constructs the visual elements of the component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ImageBase extends UIBase implements IImage
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ImageBase()
+ {
+ super();
+ }
+
+ /**
+ * The location of the bitmap, usually a URL.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.IImageModel
+ */
+ public function get url():String
+ {
+ return (model as IImageModel).url;
+ }
+ public function set url(value:String):void
+ {
+ (model as IImageModel).url = value;
+ }
+
+ COMPILE::JS
+ public function get imageElement():Element
+ {
+ return null;
+ // override this
+ }
+
+ COMPILE::JS
+ public function applyImageData(binaryDataAsString:String):void
+ {
+ // override this
+ }
+
+ }
+}
[02/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - -
Adjusted the distribution build: -- Updated the version in
flex-sdk-description.xml to be greater than 4.8.0 -- Added mxml-manifest.xml,
spark-manifest.xml and airmobile-config.xml -- Added
Posted by ah...@apache.org.
- Adjusted the distribution build:
-- Updated the version in flex-sdk-description.xml to be greater than 4.8.0
-- Added mxml-manifest.xml, spark-manifest.xml and airmobile-config.xml
-- Added locale and rsls directories
-- Removed the version suffix from the libs in the "lib" directory
-- Included the "ide" directory in the output
TODO:
- The dummy-jars: mxmlc.jar, compc.jar are still missing ...
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/4448b422
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/4448b422
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/4448b422
Branch: refs/heads/refactor-sprite
Commit: 4448b4224bfbfe52fc1d4b61f368561e488ef06e
Parents: 1829b46
Author: Christofer Dutz <ch...@codecentric.de>
Authored: Wed Oct 26 17:15:39 2016 +0200
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:46:50 2016 -0700
----------------------------------------------------------------------
distribution/pom.xml | 11 +-
.../src/main/assembly/component-air.xml | 10 ++
.../src/main/assembly/component-fontkit.xml | 3 +
distribution/src/main/assembly/component.xml | 11 +-
.../src/main/assembly/filter.properties | 21 ---
distribution/src/main/resources/air/adt | 2 +-
distribution/src/main/resources/air/adt.bat | 2 +-
.../src/main/resources/flex-sdk-description.xml | 4 +-
.../main/resources/frameworks/air-config.xml | 4 +-
.../resources/frameworks/airmobile-config.xml | 135 +++++++++++++++++++
.../resources/frameworks/createjs-config.xml | 8 +-
.../main/resources/frameworks/flex-config.xml | 4 +-
.../main/resources/frameworks/jquery-config.xml | 8 +-
.../src/main/resources/frameworks/js-config.xml | 8 +-
.../main/resources/frameworks/locale/readme.md | 20 +++
.../main/resources/frameworks/mxml-manifest.xml | 21 +++
.../main/resources/frameworks/node-config.xml | 4 +-
.../main/resources/frameworks/rsls/readme.md | 20 +++
.../resources/frameworks/spark-manifest.xml | 21 +++
pom.xml | 2 +
20 files changed, 268 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/pom.xml b/distribution/pom.xml
index 09f41bf..4db74fb 100644
--- a/distribution/pom.xml
+++ b/distribution/pom.xml
@@ -35,9 +35,6 @@
<properties>
<distributionFileName>apache-flex-flexjs-${project.version}</distributionFileName>
- <flashVersion>${flash.version}</flashVersion>
- <airVersion>${air.version}</airVersion>
-
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format>
</properties>
@@ -56,6 +53,11 @@
</dependency>
<dependency>
<groupId>org.apache.flex.flexjs.compiler</groupId>
+ <artifactId>flexjs-ant-tasks</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flex.flexjs.compiler</groupId>
<artifactId>debugger</artifactId>
<version>0.8.0-SNAPSHOT</version>
</dependency>
@@ -458,9 +460,6 @@
<goal>single</goal>
</goals>
<configuration>
- <filters>
- <filter>src/main/assembly/filter.properties</filter>
- </filters>
<descriptors>
<descriptor>src/main/assembly/bin.xml</descriptor>
</descriptors>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/assembly/component-air.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/assembly/component-air.xml b/distribution/src/main/assembly/component-air.xml
index d2a9636..e24c2f4 100644
--- a/distribution/src/main/assembly/component-air.xml
+++ b/distribution/src/main/assembly/component-air.xml
@@ -23,6 +23,9 @@ under the License.
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<outputDirectory>lib</outputDirectory>
+ <!-- FlashBuilder doesn't like us appending the version to the jar name -->
+ <!--outputFileNameMapping>${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension}</outputFileNameMapping-->
+ <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
<includes>
<include>com.adobe.air.compiler:adt:jar</include>
</includes>
@@ -38,6 +41,13 @@ under the License.
</includes>
<unpack>true</unpack>
</dependencySet>
+ <dependencySet>
+ <useProjectArtifact>false</useProjectArtifact>
+ <outputFileNameMapping>frameworks</outputFileNameMapping>
+ <includes>
+ <include></include>
+ </includes>
+ </dependencySet>
<!-- Put the air swcs into the frameworks/libs/air directory -->
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/assembly/component-fontkit.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/assembly/component-fontkit.xml b/distribution/src/main/assembly/component-fontkit.xml
index 0b6a026..625535a 100644
--- a/distribution/src/main/assembly/component-fontkit.xml
+++ b/distribution/src/main/assembly/component-fontkit.xml
@@ -22,6 +22,9 @@ under the License.
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<outputDirectory>lib</outputDirectory>
+ <!-- FlashBuilder doesn't like us appending the version to the jar name -->
+ <!--outputFileNameMapping>${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension}</outputFileNameMapping-->
+ <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
<includes>
<include>com.adobe:fontkit</include>
</includes>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/assembly/component.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/assembly/component.xml b/distribution/src/main/assembly/component.xml
index cb86030..3293692 100644
--- a/distribution/src/main/assembly/component.xml
+++ b/distribution/src/main/assembly/component.xml
@@ -26,6 +26,9 @@ under the License.
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<outputDirectory>lib</outputDirectory>
+ <!-- FlashBuilder doesn't like us appending the version to the jar name -->
+ <!--outputFileNameMapping>${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension}</outputFileNameMapping-->
+ <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
<includes>
<include>org.apache.flex.flexjs.compiler:*:jar</include>
</includes>
@@ -37,14 +40,14 @@ under the License.
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<outputDirectory>lib/external</outputDirectory>
+ <includes>
+ <include>*:jar</include>
+ </includes>
<excludes>
- <exclude>org.apache.flex.flexjs.framework:*</exclude>
- <exclude>org.apache.flex.flexjs.typedefs:*</exclude>
<exclude>org.apache.flex.flexjs.compiler:*</exclude>
<exclude>*:args4j:jar</exclude>
<exclude>*:google-closure-library*:jar</exclude>
<exclude>*:org.json:jar</exclude>
- <exclude>*:*:pom</exclude>
</excludes>
</dependencySet>
<!-- Put the externs swcs into the externs directory -->
@@ -125,6 +128,7 @@ under the License.
<include>NOTICE</include>
<include>README*</include>
<include>RELEASE*</include>
+ <include>ide/**</include>
</includes>
</fileSet>
@@ -153,6 +157,7 @@ under the License.
<includes>
<include>**</include>
</includes>
+ <filtered>true</filtered>
</fileSet>
<!-- Copy the sdk descriptor -->
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/assembly/filter.properties
----------------------------------------------------------------------
diff --git a/distribution/src/main/assembly/filter.properties b/distribution/src/main/assembly/filter.properties
deleted file mode 100644
index dc8b6ae..0000000
--- a/distribution/src/main/assembly/filter.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-
-################################################################################
-##
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements. See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License. You may obtain a copy of the License at
-##
-## http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-##
-################################################################################
-
-airVersion=${air-version}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/resources/air/adt
----------------------------------------------------------------------
diff --git a/distribution/src/main/resources/air/adt b/distribution/src/main/resources/air/adt
index 71138b2..000b6bb 100755
--- a/distribution/src/main/resources/air/adt
+++ b/distribution/src/main/resources/air/adt
@@ -21,4 +21,4 @@
scriptDir=$(dirname "$0")
args=$@
-java -Dfile.encoding=UTF-8 -jar "$scriptDir/../lib/adt-${airVersion}.jar" "$args"
+java -Dfile.encoding=UTF-8 -jar "$scriptDir/../lib/adt.jar" "$args"
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/resources/air/adt.bat
----------------------------------------------------------------------
diff --git a/distribution/src/main/resources/air/adt.bat b/distribution/src/main/resources/air/adt.bat
index f077f7d..224bd11 100644
--- a/distribution/src/main/resources/air/adt.bat
+++ b/distribution/src/main/resources/air/adt.bat
@@ -19,4 +19,4 @@ rem
SET scriptDir=%~dp0
SET args=%*
-@java -jar "%scriptDir%\..\lib\adt-${airVersion}.jar" %args%
\ No newline at end of file
+@java -jar "%scriptDir%\..\lib\adt.jar" %args%
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/resources/flex-sdk-description.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/resources/flex-sdk-description.xml b/distribution/src/main/resources/flex-sdk-description.xml
index 5b567be..a4bf265 100644
--- a/distribution/src/main/resources/flex-sdk-description.xml
+++ b/distribution/src/main/resources/flex-sdk-description.xml
@@ -19,6 +19,8 @@
-->
<flex-sdk-description>
<name>Apache Flex ${project.version} FP${flash.version} AIR${air.version} en_US</name>
- <version>${project.version}</version>
+ <!--version>${project.version}</version-->
+ <!-- This is a hack to trick the FlashBuilder in accepting this version -->
+ <version>4.8.${project.version}</version>
<build>${timestamp}</build>
</flex-sdk-description>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/resources/frameworks/air-config.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/resources/frameworks/air-config.xml b/distribution/src/main/resources/frameworks/air-config.xml
index 590ad1e..7aec9af 100644
--- a/distribution/src/main/resources/frameworks/air-config.xml
+++ b/distribution/src/main/resources/frameworks/air-config.xml
@@ -21,10 +21,10 @@
<flex-config>
<!-- Specifies the minimum player version that will run the compiled SWF. -->
- <target-player>11.1</target-player>
+ <target-player>${air.version}</target-player>
<!-- Specifies the version of the compiled SWF -->
- <swf-version>14</swf-version>
+ <swf-version>${swf.version}</swf-version>
<compiler>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/resources/frameworks/airmobile-config.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/resources/frameworks/airmobile-config.xml b/distribution/src/main/resources/frameworks/airmobile-config.xml
new file mode 100644
index 0000000..5ec2e07
--- /dev/null
+++ b/distribution/src/main/resources/frameworks/airmobile-config.xml
@@ -0,0 +1,135 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+
+<flex-config>
+ <!-- Specifies the minimum player version that will run the compiled SWF. -->
+ <target-player>${air.version}</target-player>
+
+ <!-- Specifies the version of the compiled SWF -->
+ <swf-version>${swf.version}</swf-version>
+
+ <compiler>
+
+ <!-- Specifies that the target runtime is a mobile device. -->
+ <mobile>true</mobile>
+
+ <!-- List of path elements that form the roots of ActionScript class hierarchies. -->
+ <!-- not set -->
+ <!--
+ <source-path>
+ <path-element>string</path-element>
+ </source-path>
+ -->
+
+ <!-- Allow the source-path to have path-elements which contain other path-elements -->
+ <allow-source-path-overlap>false</allow-source-path-overlap>
+
+ <!-- Turn on generation of debuggable SWFs. False by default for mxmlc, -->
+ <!-- but true by default for compc. -->
+ <!--
+ <debug>true</debug>
+ -->
+
+ <!-- List of SWC files or directories to compile against but to omit from -->
+ <!-- linking. -->
+ <external-library-path>
+ <path-element>{airHome}/frameworks/libs/air/airglobal.swc</path-element>
+ </external-library-path>
+
+ <!-- not set -->
+ <!--
+ <include-libraries>
+ <library>string</library>
+ </include-libraries>
+ -->
+
+ <!-- List of SWC files or directories that contain SWC files. -->
+ <library-path>
+ <path-element>libs</path-element>
+ <path-element>{airHome}/frameworks/libs/air</path-element>
+ <path-element>locale/{locale}</path-element>
+ </library-path>
+
+ <!-- Enable post-link SWF optimization. -->
+ <optimize>true</optimize>
+
+ <!-- Keep the following AS3 metadata in the bytecodes. -->
+ <!--
+ <keep-as3-metadata>
+ <name>Transient</name>
+ </keep-as3-metadata>
+ -->
+
+ <!-- Run the AS3 compiler in strict error checking mode. -->
+ <strict>true</strict>
+
+ <!-- Run the AS3 compiler in a mode that detects legal but potentially incorrect -->
+ <!-- code. -->
+ <show-actionscript-warnings>true</show-actionscript-warnings>
+
+ <!-- Assignment within conditional. -->
+ <warn-assignment-within-conditional>true</warn-assignment-within-conditional>
+
+ <!-- Possibly invalid Array cast operation. -->
+ <warn-bad-array-cast>true</warn-bad-array-cast>
+
+ <!-- Invalid Date cast operation. -->
+ <warn-bad-date-cast>true</warn-bad-date-cast>
+
+ <!-- Illogical comparison with NaN. Any comparison operation involving NaN will evaluate to false because NaN != NaN. -->
+ <warn-bad-nan-comparison>true</warn-bad-nan-comparison>
+
+ <!-- Impossible assignment to null. -->
+ <warn-bad-null-assignment>true</warn-bad-null-assignment>
+
+ <!-- Illogical comparison with undefined. Only untyped variables (or variables of type *) can be undefined. -->
+ <warn-bad-undefined-comparison>true</warn-bad-undefined-comparison>
+
+ <!-- Constant not initialized. -->
+ <warn-const-not-initialized>true</warn-const-not-initialized>
+
+ <!-- Duplicate variable definition -->
+ <warn-duplicate-variable-def>true</warn-duplicate-variable-def>
+
+ <!-- Use of the instanceof operator. -->
+ <warn-instance-of-changes>true</warn-instance-of-changes>
+
+ <!-- Missing namespace declaration (e.g. variable is not defined to be public, private, etc.). -->
+ <warn-missing-namespace-decl>true</warn-missing-namespace-decl>
+
+ <!-- Missing type declaration. -->
+ <warn-no-type-decl>true</warn-no-type-decl>
+
+ </compiler>
+
+ <!-- Enables SWFs to access the network. -->
+ <use-network>true</use-network>
+
+ <!-- Metadata added to SWFs via the SWF Metadata tag. -->
+ <metadata>
+ <title>Apache FlexJS Application</title>
+ <description>http://flex.apache.org/</description>
+ <publisher>Apache Software Foundation</publisher>
+ <creator>Apache Software Foundation</creator>
+ <language>en_US</language>
+ </metadata>
+
+</flex-config>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/resources/frameworks/createjs-config.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/resources/frameworks/createjs-config.xml b/distribution/src/main/resources/frameworks/createjs-config.xml
index 6f06f3e..fc66dba 100644
--- a/distribution/src/main/resources/frameworks/createjs-config.xml
+++ b/distribution/src/main/resources/frameworks/createjs-config.xml
@@ -21,11 +21,11 @@
<flex-config>
- <!-- Specifies the minimum player version that will run the compiled SWF. -->
- <target-player>11.1</target-player>
+ <!-- Specifies the minimum player version that will run the compiled SWF. -->
+ <swf-version>${flash.version}</swf-version>
- <!-- Specifies the version of the compiled SWF -->
- <swf-version>14</swf-version>
+ <!-- Specifies the version of the compiled SWF -->
+ <swf-version>${swf.version}</swf-version>
<compiler>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/resources/frameworks/flex-config.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/resources/frameworks/flex-config.xml b/distribution/src/main/resources/frameworks/flex-config.xml
index fe63127..99c44a8 100644
--- a/distribution/src/main/resources/frameworks/flex-config.xml
+++ b/distribution/src/main/resources/frameworks/flex-config.xml
@@ -22,10 +22,10 @@
<flex-config>
<!-- Specifies the minimum player version that will run the compiled SWF. -->
- <target-player>11.1</target-player>
+ <swf-version>${flash.version}</swf-version>
<!-- Specifies the version of the compiled SWF -->
- <swf-version>14</swf-version>
+ <swf-version>${swf.version}</swf-version>
<compiler>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/resources/frameworks/jquery-config.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/resources/frameworks/jquery-config.xml b/distribution/src/main/resources/frameworks/jquery-config.xml
index b970af3..7d0a4c8 100644
--- a/distribution/src/main/resources/frameworks/jquery-config.xml
+++ b/distribution/src/main/resources/frameworks/jquery-config.xml
@@ -21,11 +21,11 @@
<flex-config>
- <!-- Specifies the minimum player version that will run the compiled SWF. -->
- <target-player>11.1</target-player>
+ <!-- Specifies the minimum player version that will run the compiled SWF. -->
+ <swf-version>${flash.version}</swf-version>
- <!-- Specifies the version of the compiled SWF -->
- <swf-version>14</swf-version>
+ <!-- Specifies the version of the compiled SWF -->
+ <swf-version>${swf.version}</swf-version>
<compiler>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/resources/frameworks/js-config.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/resources/frameworks/js-config.xml b/distribution/src/main/resources/frameworks/js-config.xml
index 7ded512..7f46e04 100644
--- a/distribution/src/main/resources/frameworks/js-config.xml
+++ b/distribution/src/main/resources/frameworks/js-config.xml
@@ -21,11 +21,11 @@
<flex-config>
- <!-- Specifies the minimum player version that will run the compiled SWF. -->
- <target-player>11.1</target-player>
+ <!-- Specifies the minimum player version that will run the compiled SWF. -->
+ <swf-version>${flash.version}</swf-version>
- <!-- Specifies the version of the compiled SWF -->
- <swf-version>14</swf-version>
+ <!-- Specifies the version of the compiled SWF -->
+ <swf-version>${swf.version}</swf-version>
<compiler>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/resources/frameworks/locale/readme.md
----------------------------------------------------------------------
diff --git a/distribution/src/main/resources/frameworks/locale/readme.md b/distribution/src/main/resources/frameworks/locale/readme.md
new file mode 100644
index 0000000..46a5ffd
--- /dev/null
+++ b/distribution/src/main/resources/frameworks/locale/readme.md
@@ -0,0 +1,20 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+FlashBuilder seems to need this directory.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/resources/frameworks/mxml-manifest.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/resources/frameworks/mxml-manifest.xml b/distribution/src/main/resources/frameworks/mxml-manifest.xml
new file mode 100644
index 0000000..f14063c
--- /dev/null
+++ b/distribution/src/main/resources/frameworks/mxml-manifest.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<componentPackage>
+</componentPackage>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/resources/frameworks/node-config.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/resources/frameworks/node-config.xml b/distribution/src/main/resources/frameworks/node-config.xml
index 9327d1a..f0515cd 100644
--- a/distribution/src/main/resources/frameworks/node-config.xml
+++ b/distribution/src/main/resources/frameworks/node-config.xml
@@ -22,10 +22,10 @@
<flex-config>
<!-- Specifies the minimum player version that will run the compiled SWF. -->
- <target-player>11.1</target-player>
+ <swf-version>${flash.version}</swf-version>
<!-- Specifies the version of the compiled SWF -->
- <swf-version>14</swf-version>
+ <swf-version>${swf.version}</swf-version>
<compiler>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/resources/frameworks/rsls/readme.md
----------------------------------------------------------------------
diff --git a/distribution/src/main/resources/frameworks/rsls/readme.md b/distribution/src/main/resources/frameworks/rsls/readme.md
new file mode 100644
index 0000000..46a5ffd
--- /dev/null
+++ b/distribution/src/main/resources/frameworks/rsls/readme.md
@@ -0,0 +1,20 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+FlashBuilder seems to need this directory.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/distribution/src/main/resources/frameworks/spark-manifest.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/resources/frameworks/spark-manifest.xml b/distribution/src/main/resources/frameworks/spark-manifest.xml
new file mode 100644
index 0000000..f14063c
--- /dev/null
+++ b/distribution/src/main/resources/frameworks/spark-manifest.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<componentPackage>
+</componentPackage>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4448b422/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8db9821..a7888f0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,6 +61,8 @@
<flex.version>4.15.0</flex.version>
<flash.version>20.0</flash.version>
<air.version>20.0</air.version>
+ <!-- For SWF versions see: http://www.adobe.com/devnet/articles/flashplayer-air-feature-list.html -->
+ <swf.version>31</swf.version>
<!-- URL of the ASF SonarQube server -->
<sonar.host.url>https://analysis.apache.org/</sonar.host.url>
[13/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - try to
copy HTML to Basic without losing history
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as
new file mode 100644
index 0000000..42b159c
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayList.as
@@ -0,0 +1,194 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.collections.IArrayList;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IDataProviderItemRendererMapper;
+ import org.apache.flex.core.IItemRendererClassFactory;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.IListPresentationModel;
+ import org.apache.flex.core.ISelectableItemRenderer;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.SimpleCSSStyles;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.events.ItemRendererEvent;
+ import org.apache.flex.html.List;
+
+ [Event(name="itemRendererCreated",type="org.apache.flex.events.ItemRendererEvent")]
+
+ /**
+ * The DataItemRendererFactoryForArrayList class uses an ArrayList
+ * and creates an item renderer for every
+ * item in the collection. Other implementations of
+ * IDataProviderItemRendererMapper map different data
+ * structures or manage a virtual set of renderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataItemRendererFactoryForArrayList extends EventDispatcher implements IBead, IDataProviderItemRendererMapper
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataItemRendererFactoryForArrayList(target:Object=null)
+ {
+ super(target);
+ }
+
+ protected var selectionModel:ISelectionModel;
+
+ protected var labelField:String;
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ IEventDispatcher(_strand).addEventListener("beadsAdded", finishSetup);
+ IEventDispatcher(_strand).addEventListener("initComplete", finishSetup);
+ }
+
+ private function finishSetup(event:Event):void
+ {
+ selectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ var listView:IListView = _strand.getBeadByType(IListView) as IListView;
+ dataGroup = listView.dataGroup;
+ selectionModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
+
+ labelField = (listView.host as List).labelField;
+
+ if (!itemRendererFactory)
+ {
+ _itemRendererFactory = _strand.getBeadByType(IItemRendererClassFactory) as IItemRendererClassFactory;
+ if (_itemRendererFactory == null) {
+ _itemRendererFactory = new (ValuesManager.valuesImpl.getValue(_strand, "iItemRendererClassFactory")) as IItemRendererClassFactory;
+ _strand.addBead(_itemRendererFactory);
+ }
+ }
+
+ dataProviderChangeHandler(null);
+ }
+
+ private var _itemRendererFactory:IItemRendererClassFactory;
+
+ /**
+ * The org.apache.flex.core.IItemRendererClassFactory used
+ * to generate instances of item renderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRendererFactory():IItemRendererClassFactory
+ {
+ return _itemRendererFactory;
+ }
+
+ /**
+ * @private
+ */
+ public function set itemRendererFactory(value:IItemRendererClassFactory):void
+ {
+ _itemRendererFactory = value;
+ }
+
+ /**
+ * The org.apache.flex.core.IItemRendererParent that will
+ * parent the item renderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var dataGroup:IItemRendererParent;
+
+ /**
+ * @private
+ */
+ protected function setData(ir:ISelectableItemRenderer, data:Object, index:int):void
+ {
+ ir.index = index;
+ ir.labelField = labelField;
+ ir.data = data;
+ }
+
+ /**
+ * @private
+ */
+ protected function dataProviderChangeHandler(event:Event):void
+ {
+ var dp:IArrayList = selectionModel.dataProvider as IArrayList;
+ if (!dp)
+ return;
+
+ dataGroup.removeAllElements();
+
+ var listView:IListView = _strand.getBeadByType(IListView) as IListView;
+ var presentationModel:IListPresentationModel = _strand.getBeadByType(IListPresentationModel) as IListPresentationModel;
+
+ var n:int = dp.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var ir:ISelectableItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as ISelectableItemRenderer;
+ if (presentationModel) {
+ UIBase(ir).height = presentationModel.rowHeight;
+
+ // ensure that the IR spans the width of its column
+ var style:SimpleCSSStyles = new SimpleCSSStyles();
+ style.right = 0;
+ style.left = 0;
+ UIBase(ir).style = style;
+ }
+ dataGroup.addElement(ir);
+ setData(ir, dp.getItemAt(i), i);
+
+ var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED);
+ newEvent.itemRenderer = ir;
+ dispatchEvent(newEvent);
+ }
+
+ IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as
new file mode 100644
index 0000000..d399cfb
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForColumnData.as
@@ -0,0 +1,142 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IDataGridModel;
+ import org.apache.flex.core.IDataProviderItemRendererMapper;
+ import org.apache.flex.core.IItemRendererClassFactory;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.supportClasses.DataItemRenderer;
+
+ /**
+ * The DataItemRendererFactoryForColumnData class implents the
+ * org.apache.flex.core.IDataProviderItemRendererMapper interface and creates the itemRenderers
+ * for each cell in the org.apache.flex.html.DataGrid.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataItemRendererFactoryForColumnData implements IBead, IDataProviderItemRendererMapper
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataItemRendererFactoryForColumnData()
+ {
+ }
+
+ private var selectionModel:IDataGridModel;
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ selectionModel = value.getBeadByType(IDataGridModel) as IDataGridModel;
+ var listView:IListView = value.getBeadByType(IListView) as IListView;
+ dataGroup = listView.dataGroup;
+ selectionModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
+
+ if (!itemRendererFactory)
+ {
+ _itemRendererFactory = new (ValuesManager.valuesImpl.getValue(_strand, "iItemRendererClassFactory")) as IItemRendererClassFactory;
+ _strand.addBead(_itemRendererFactory);
+ }
+
+ dataProviderChangeHandler(null);
+ }
+
+ private var _itemRendererFactory:IItemRendererClassFactory;
+
+ /**
+ * The factory used to create the itemRenderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRendererFactory():IItemRendererClassFactory
+ {
+ return _itemRendererFactory
+ }
+ public function set itemRendererFactory(value:IItemRendererClassFactory):void
+ {
+ _itemRendererFactory = value;
+ }
+
+ /**
+ * The dataGroup that is the pareent for the itemRenderers
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var dataGroup:IItemRendererParent;
+
+ /**
+ * @private
+ */
+ private function dataProviderChangeHandler(event:Event):void
+ {
+ var dp:Array = selectionModel.dataProvider as Array;
+ if (!dp)
+ return;
+
+ dataGroup.removeAllElements();
+
+ var view:DataGridColumnView = _strand.getBeadByType(IBeadView) as DataGridColumnView;
+ if (view == null) return;
+
+ var n:int = dp.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var tf:DataItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as DataItemRenderer;
+ tf.index = i;
+ tf.labelField = view.column.dataField;
+ dataGroup.addElement(tf);
+ tf.data = dp[i];
+ }
+
+ IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForHierarchicalData.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForHierarchicalData.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForHierarchicalData.as
new file mode 100644
index 0000000..5c9c59c
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForHierarchicalData.as
@@ -0,0 +1,113 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IDataProviderItemRendererMapper;
+ import org.apache.flex.core.IItemRendererClassFactory;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.IListPresentationModel;
+ import org.apache.flex.core.ISelectableItemRenderer;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.SimpleCSSStyles;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.events.ItemRendererEvent;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.List;
+ import org.apache.flex.html.supportClasses.TreeListData;
+ import org.apache.flex.collections.FlattenedList;
+
+ [Event(name="itemRendererCreated",type="org.apache.flex.events.ItemRendererEvent")]
+
+ /**
+ * The DataItemRendererFactoryForHierarchicalData class reads a
+ * HierarchicalData object and creates an item renderer for every
+ * item in the array. Other implementations of
+ * IDataProviderItemRendererMapper map different data
+ * structures or manage a virtual set of renderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataItemRendererFactoryForHierarchicalData extends DataItemRendererFactoryForArrayList
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataItemRendererFactoryForHierarchicalData()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ super.strand = value;
+ }
+
+ /**
+ * Sets the itemRenderer's data with additional tree-related data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override protected function setData(ir:ISelectableItemRenderer, data:Object, index:int):void
+ {
+ // Set the listData with the depth of this item
+ var flatList:FlattenedList = selectionModel.dataProvider as FlattenedList;
+ var depth:int = flatList.getDepth(data);
+ var isOpen:Boolean = flatList.isOpen(data);
+ var hasChildren:Boolean = flatList.hasChildren(data);
+
+ var treeData:TreeListData = new TreeListData();
+ treeData.depth = depth;
+ treeData.isOpen = isOpen;
+ treeData.hasChildren = hasChildren;
+
+ ir.listData = treeData;
+
+ super.setData(ir, data, index);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
new file mode 100644
index 0000000..a24810b
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
@@ -0,0 +1,194 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IDocument;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.collections.ArrayList;
+
+ /**
+ * The DataProviderChangeNotifier notifies listeners when a selection model's
+ * ArrayList dataProvider has changed.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataProviderChangeNotifier implements IBead, IDocument
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataProviderChangeNotifier()
+ {
+ }
+
+ protected var _dataProvider:ArrayList;
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ if (_strand[destinationPropertyName] == null) {
+ var model:IBeadModel = UIBase(_strand).model as IBeadModel;
+ IEventDispatcher(model).addEventListener(changeEventName, destinationChangedHandler);
+ }
+ else {
+ destinationChangedHandler(null);
+ }
+ }
+
+ private function destinationChangedHandler(event:Event):void
+ {
+ if (_dataProvider == null) {
+ var object:Object = document[sourceID];
+ _dataProvider = object[propertyName] as ArrayList;
+ }
+ else {
+ _dataProvider.removeEventListener("itemAdded", handleItemAdded);
+ _dataProvider.removeEventListener("itemRemoved", handleItemRemoved);
+ _dataProvider.removeEventListener("itemUpdated", handleItemUpdated);
+ }
+
+ _dataProvider.addEventListener("itemAdded", handleItemAdded);
+ _dataProvider.addEventListener("itemRemoved", handleItemRemoved);
+ _dataProvider.addEventListener("itemUpdated", handleItemUpdated);
+ }
+
+ protected var document:Object;
+
+ /**
+ * @private
+ */
+ public function setDocument(document:Object, id:String = null):void
+ {
+ this.document = document;
+ }
+
+ private var _destinationPropertyName:String;
+
+ public function get destinationPropertyName():String
+ {
+ return _destinationPropertyName;
+ }
+ public function set destinationPropertyName(value:String):void
+ {
+ _destinationPropertyName = value;
+ }
+
+ private var _changeEventName:String;
+
+ public function get changeEventName():String
+ {
+ return _changeEventName;
+ }
+ public function set changeEventName(value:String):void
+ {
+ _changeEventName = value;
+ }
+
+ private var _sourceID:String;
+
+ /**
+ * The ID of the object holding the ArrayList, usually a model.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get sourceID():String
+ {
+ return _sourceID;
+ }
+ public function set sourceID(value:String):void
+ {
+ _sourceID = value;
+ }
+
+ private var _propertyName:String;
+
+ /**
+ * The property in the sourceID that is the ArrayList.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get propertyName():String
+ {
+ return _propertyName;
+ }
+
+ public function set propertyName(value:String):void
+ {
+ _propertyName = value;
+ }
+
+ /**
+ * @private
+ */
+ private function handleItemAdded(event:Event):void
+ {
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ selectionModel.dispatchEvent(new Event("dataProviderChanged"));
+ }
+
+ /**
+ * @private
+ */
+ private function handleItemRemoved(event:Event):void
+ {
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ selectionModel.dispatchEvent(new Event("dataProviderChanged"));
+ }
+
+ /**
+ * @private
+ */
+ private function handleItemUpdated(event:Event):void
+ {
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ selectionModel.dispatchEvent(new Event("dataProviderChanged"));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DateChooserView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DateChooserView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DateChooserView.as
new file mode 100644
index 0000000..54b2550
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DateChooserView.as
@@ -0,0 +1,328 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.Container;
+ import org.apache.flex.html.TextButton;
+ import org.apache.flex.html.beads.layouts.TileLayout;
+ import org.apache.flex.html.beads.models.DateChooserModel;
+ import org.apache.flex.html.supportClasses.DateChooserButton;
+ import org.apache.flex.html.supportClasses.DateHeaderButton;
+
+ /**
+ * The DateChooserView class is a view bead for the DateChooser. This class
+ * creates the elements for the DateChooser: the buttons to move between
+ * months, the labels for the days of the week, and the buttons for each day
+ * of the month.
+ */
+ public class DateChooserView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateChooserView()
+ {
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ _strand = value;
+
+ // make sure there is a model.
+ model = _strand.getBeadByType(IBeadModel) as DateChooserModel;
+ if (model == null) {
+ model = new (ValuesManager.valuesImpl.getValue(_strand,"iBeadModel")) as DateChooserModel;
+ }
+ model.addEventListener("displayedMonthChanged",handleModelChange);
+ model.addEventListener("displayedYearChanged",handleModelChange);
+
+ var host:UIBase = value as UIBase;
+ host.addEventListener("widthChanged", handleSizeChange);
+ host.addEventListener("heightChanged", handleSizeChange);
+
+ createChildren();
+ layoutContents();
+ }
+
+ private var _prevMonthButton:DateHeaderButton;
+ private var _nextMonthButton:DateHeaderButton;
+ private var _dayButtons:Array;
+ private var monthLabel:DateHeaderButton;
+ private var dayContainer:Container;
+
+ private var model:DateChooserModel;
+
+ /**
+ * The button that causes the previous month to be displayed by the DateChooser.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get prevMonthButton():DateHeaderButton
+ {
+ return _prevMonthButton;
+ }
+
+ /**
+ * The button that causes the next month to be displayed by the DateChooser.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get nextMonthButton():DateHeaderButton
+ {
+ return _nextMonthButton;
+ }
+
+ /**
+ * The array of DateChooserButton instances that represent each day of the month.
+ */
+ public function get dayButtons():Array
+ {
+ return _dayButtons;
+ }
+
+ private function handleSizeChange(event:Event):void
+ {
+ layoutContents();
+ }
+
+ private function layoutContents():void
+ {
+ var sw:Number = UIBase(_strand).width;
+ var sh:Number = UIBase(_strand).height;
+
+ _prevMonthButton.x = 0;
+ _prevMonthButton.y = 0;
+
+ _nextMonthButton.x = sw - _nextMonthButton.width;
+ _nextMonthButton.y = 0;
+
+ monthLabel.x = (sw - monthLabel.width)/2;
+ monthLabel.y = 0;
+
+ dayContainer.x = 0;
+ dayContainer.y = monthLabel.y + monthLabel.height + 5;
+ dayContainer.width = sw;
+ dayContainer.height = sh - (monthLabel.height+5);
+
+ COMPILE::SWF {
+ displayBackgroundAndBorder(_strand as UIBase);
+ }
+
+ IEventDispatcher(_strand).dispatchEvent( new Event("layoutNeeded") );
+ IEventDispatcher(dayContainer).dispatchEvent( new Event("layoutNeeded") );
+ }
+
+ /**
+ * @private
+ */
+ private function createChildren():void
+ {
+ _prevMonthButton = new DateHeaderButton();
+ _prevMonthButton.width = 40;
+ _prevMonthButton.height = 20;
+ _prevMonthButton.text = "<";
+ UIBase(_strand).addElement(_prevMonthButton);
+
+ _nextMonthButton = new DateHeaderButton();
+ _nextMonthButton.width = 40;
+ _nextMonthButton.height = 20;
+ _nextMonthButton.text = ">";
+ UIBase(_strand).addElement(_nextMonthButton);
+
+ monthLabel = new DateHeaderButton();
+ monthLabel.text = "Month Here";
+ monthLabel.width = 100;
+ monthLabel.height = 20;
+ UIBase(_strand).addElement(monthLabel);
+
+ dayContainer = new Container();
+ var tileLayout:TileLayout = new TileLayout();
+ dayContainer.addBead(tileLayout);
+ UIBase(_strand).addElement(dayContainer, false);
+
+ tileLayout.numColumns = 7;
+
+ // the calendar has 7 columns with 6 rows, the first row are the day names
+ for(var i:int=0; i < 7; i++) {
+ var dayName:DateChooserButton = new DateChooserButton();
+ dayName.text = model.dayNames[i];
+ dayName.dayOfMonth = 0;
+ dayContainer.addElement(dayName, false);
+ }
+
+ _dayButtons = new Array();
+
+ for(i=0; i < 42; i++) {
+ var date:DateChooserButton = new DateChooserButton();
+ date.text = String(i+1);
+ dayContainer.addElement(date, false);
+ dayButtons.push(date);
+ }
+
+ IEventDispatcher(dayContainer).dispatchEvent( new Event("itemsCreated") );
+
+ updateCalendar();
+ }
+
+ /**
+ * @private
+ */
+ private function updateCalendar():void
+ {
+ monthLabel.text = model.monthNames[model.displayedMonth] + " " +
+ String(model.displayedYear);
+
+ var firstDay:Date = new Date(model.displayedYear,model.displayedMonth,1);
+
+ // blank out the labels for the first firstDay.day-1 entries.
+ for(var i:int=0; i < firstDay.getDay(); i++) {
+ var dateButton:DateChooserButton = dayButtons[i] as DateChooserButton;
+ dateButton.dayOfMonth = -1;
+ dateButton.text = "";
+ }
+
+ // flag today
+ var today:Date = new Date();
+
+ // renumber to the last day of the month
+ var dayNumber:int = 1;
+ var numDays:Number = numberOfDaysInMonth(model.displayedMonth, model.displayedYear);
+
+ for(; i < dayButtons.length && dayNumber <= numDays; i++) {
+ dateButton = dayButtons[i] as DateChooserButton;
+ dateButton.dayOfMonth = dayNumber;
+ dateButton.text = String(dayNumber++);
+
+ if (model.displayedMonth == today.getMonth() &&
+ model.displayedYear == today.getFullYear() &&
+ (dayNumber-1) == today.getDate()) {
+ dateButton.id = "todayDateChooserButton";
+ } else {
+ dateButton.id = "";
+ }
+ }
+
+ // blank out the rest
+ for(; i < dayButtons.length; i++) {
+ dateButton = dayButtons[i] as DateChooserButton;
+ dateButton.dayOfMonth = -1;
+ dateButton.text = "";
+ }
+ }
+
+ /**
+ * @private
+ */
+ private function numberOfDaysInMonth(month:Number, year:Number):Number
+ {
+ var n:int;
+
+ if (month == 1) // Feb
+ {
+ if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) // leap year
+ n = 29;
+ else
+ n = 28;
+ }
+
+ else if (month == 3 || month == 5 || month == 8 || month == 10)
+ n = 30;
+
+ else
+ n = 31;
+
+ return n;
+ }
+
+ /**
+ * @private
+ */
+ private function handleModelChange(event:Event):void
+ {
+ updateCalendar();
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ protected function displayBackgroundAndBorder(host:UIBase) : void
+ {
+ var backgroundColor:Object = ValuesManager.valuesImpl.getValue(host, "background-color");
+ var backgroundImage:Object = ValuesManager.valuesImpl.getValue(host, "background-image");
+ if (backgroundColor != null || backgroundImage != null)
+ {
+ if (host.getBeadByType(IBackgroundBead) == null)
+ var c:Class = ValuesManager.valuesImpl.getValue(host, "iBackgroundBead");
+ if (c) {
+ host.addBead( new c() as IBead );
+ }
+ }
+
+ var borderStyle:String;
+ var borderStyles:Object = ValuesManager.valuesImpl.getValue(host, "border");
+ if (borderStyles is Array)
+ {
+ borderStyle = borderStyles[1];
+ }
+ if (borderStyle == null)
+ {
+ borderStyle = ValuesManager.valuesImpl.getValue(host, "border-style") as String;
+ }
+ if (borderStyle != null && borderStyle != "none")
+ {
+ if (host.getBeadByType(IBorderBead) == null) {
+ c = ValuesManager.valuesImpl.getValue(host, "iBorderBead");
+ if (c) {
+ host.addBead( new c() as IBead );
+ }
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DateFieldView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DateFieldView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DateFieldView.as
new file mode 100644
index 0000000..f709a1f
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DateFieldView.as
@@ -0,0 +1,192 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IDateChooserModel;
+ import org.apache.flex.core.IFormatBead;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.IPopUpHost;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.utils.UIUtils;
+ import org.apache.flex.utils.PointUtils;
+ import org.apache.flex.geom.Point;
+ import org.apache.flex.html.DateChooser;
+ import org.apache.flex.html.TextButton;
+ import org.apache.flex.html.TextInput;
+
+ /**
+ * The DateFieldView class is a bead for DateField that creates the
+ * input and button controls. This class also handles the pop-up
+ * mechanics.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateFieldView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateFieldView()
+ {
+ }
+
+ private var _textInput:TextInput;
+ private var _button:TextButton;
+
+ /**
+ * The TextButton that triggers the display of the DateChooser pop-up.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get menuButton():TextButton
+ {
+ return _button;
+ }
+
+ /**
+ * The TextInput that displays the date selected.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get textInput():TextInput
+ {
+ return _textInput;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ _textInput = new TextInput();
+ UIBase(_strand).addElement(_textInput);
+ _textInput.width = 100;
+ _textInput.height = 18;
+
+ _button = new TextButton();
+ _button.text = "M";
+ UIBase(_strand).addElement(_button);
+ _button.x = _textInput.width;
+ _button.y = _textInput.y;
+
+ IEventDispatcher(_strand).addEventListener("beadsAdded",handleBeadsAdded);
+ }
+
+ private function handleBeadsAdded(event:Event):void
+ {
+ var formatter:IFormatBead = _strand.getBeadByType(IFormatBead) as IFormatBead;
+ formatter.addEventListener("formatChanged",handleFormatChanged);
+ }
+
+ private function handleFormatChanged(event:Event):void
+ {
+ var formatter:IFormatBead = event.target as IFormatBead;
+ _textInput.text = formatter.formattedString;
+ }
+
+ private var _popUp:DateChooser;
+
+ /**
+ * The pop-up component that holds the selection list.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get popUp():DateChooser
+ {
+ return _popUp;
+ }
+
+ private var _popUpVisible:Boolean;
+
+ /**
+ * This property is true if the pop-up selection list is currently visible.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get popUpVisible():Boolean
+ {
+ return _popUpVisible;
+ }
+ public function set popUpVisible(value:Boolean):void
+ {
+ if (value != _popUpVisible)
+ {
+ _popUpVisible = value;
+ if (value)
+ {
+ if (!_popUp)
+ {
+ _popUp = new DateChooser();
+ _popUp.width = 210;
+ _popUp.height = 220;
+ }
+
+ var model:IDateChooserModel = _strand.getBeadByType(IDateChooserModel) as IDateChooserModel;
+ _popUp.selectedDate = model.selectedDate;
+
+ var host:IPopUpHost = UIUtils.findPopUpHost(UIBase(_strand));
+ var point:Point = new Point(_button.x, _button.y+_button.height);
+ var p2:Point = PointUtils.localToGlobal(point, _strand);
+ var p3:Point = PointUtils.globalToLocal(p2, host);
+ _popUp.x = p3.x;
+ _popUp.y = p3.y;
+
+ host.addElement(_popUp);
+ }
+ else
+ {
+ UIUtils.removePopUp(_popUp);
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DecrementButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DecrementButtonView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DecrementButtonView.as
new file mode 100644
index 0000000..19026ce
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DecrementButtonView.as
@@ -0,0 +1,94 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.svg.Path;
+ import org.apache.flex.svg.Rect;
+ import org.apache.flex.graphics.SolidColor;
+ import org.apache.flex.graphics.SolidColorStroke;
+ import org.apache.flex.events.Event;
+
+ public class DecrementButtonView extends BeadViewBase implements IBeadView
+ {
+ public function DecrementButtonView()
+ {
+ super();
+ }
+
+ private var _backRect:Rect;
+ private var _arrow:Path;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ _strand = value;
+
+ var host:UIBase = _strand as UIBase;
+
+ _backRect = new Rect();
+ _backRect.fill = new SolidColor();
+ (_backRect.fill as SolidColor).color = 0xFFFFFF;
+ _backRect.stroke = new SolidColorStroke();
+ (_backRect.stroke as SolidColorStroke).color = 0x000000;
+ (_backRect.stroke as SolidColorStroke).weight = 1.0;
+ host.addElement(_backRect);
+
+ // arrow
+ _arrow = new Path();
+ _arrow.fill = new SolidColor();
+ (_arrow.fill as SolidColor).color = 0x000000;
+ host.addElement(_arrow);
+
+ host.addEventListener("widthChanged", sizeHandler);
+ host.addEventListener("heightChanged", sizeHandler);
+
+ sizeHandler(null);
+ }
+
+ private function sizeHandler(event:Event):void
+ {
+ var host:UIBase = _strand as UIBase;
+
+ _backRect.x = 0;
+ _backRect.y = 0;
+ _backRect.setWidthAndHeight(host.width, host.height, true);
+ _backRect.drawRect(0, 0, host.width, host.height);
+
+ var xm:Number = host.width/2;
+ var ym:Number = host.height - 4;
+
+ _arrow.setWidthAndHeight(xm, ym, true);
+ _arrow.y = 2;
+ _arrow.x = 0;
+ _arrow.drawStringPath(0, 0, "M "+xm+" "+ym+" L "+(xm-8)+" 2 "+(xm+8)+" 2 "+xm+" "+ym+" Z");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DownArrowButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DownArrowButtonView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DownArrowButtonView.as
new file mode 100644
index 0000000..c68a633
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DownArrowButtonView.as
@@ -0,0 +1,111 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The DownArrowButtonView class is the view for
+ * the down arrow button in a ScrollBar and other controls.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DownArrowButtonView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DownArrowButtonView()
+ {
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+
+ drawView(upView.graphics, 0xf8f8f8);
+ drawView(downView.graphics, 0xd8d8d8);
+ drawView(overView.graphics, 0xe8e8e8);
+ }
+
+ private function drawView(g:Graphics, bgColor:uint):void
+ {
+ g.lineStyle(1);
+ g.beginFill(bgColor);
+ g.drawRoundRect(0, 0, ScrollBarView.FullSize, ScrollBarView.FullSize, ScrollBarView.ThirdSize);
+ g.endFill();
+ g.lineStyle(0);
+ g.beginFill(0);
+ g.moveTo(ScrollBarView.QuarterSize, ScrollBarView.QuarterSize);
+ g.lineTo(ScrollBarView.ThreeQuarterSize, ScrollBarView.QuarterSize);
+ g.lineTo(ScrollBarView.HalfSize, ScrollBarView.ThreeQuarterSize);
+ g.lineTo(ScrollBarView.QuarterSize, ScrollBarView.QuarterSize);
+ g.endFill();
+ }
+
+ private var shape:Shape;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, ScrollBarView.FullSize, ScrollBarView.FullSize);
+ shape.graphics.endFill();
+ SimpleButton(value).upState = upView;
+ SimpleButton(value).downState = downView;
+ SimpleButton(value).overState = overView;
+ SimpleButton(value).hitTestState = shape;
+
+ SimpleButton(_strand).addEventListener("widthChanged",sizeChangeHandler);
+ SimpleButton(_strand).addEventListener("heightChanged",sizeChangeHandler);
+ }
+
+ private var upView:Shape;
+ private var downView:Shape;
+ private var overView:Shape;
+
+ private function sizeChangeHandler(event:Event):void
+ {
+ SimpleButton(_strand).scaleX = SimpleButton(_strand).width / ScrollBarView.FullSize;
+ SimpleButton(_strand).scaleY = SimpleButton(_strand).height / ScrollBarView.FullSize;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DropDownListView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DropDownListView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DropDownListView.as
new file mode 100644
index 0000000..1334227
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DropDownListView.as
@@ -0,0 +1,300 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.DisplayObjectContainer;
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+ import flash.display.Sprite;
+ import flash.text.TextFieldType;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.CSSTextField;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IPopUpHost;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.utils.SolidBorderUtil;
+
+ /**
+ * The DropDownListView class is the default view for
+ * the org.apache.flex.html.DropDownList class.
+ * It displays a simple text label with what appears to be a
+ * down arrow button on the right, but really, the entire
+ * view is the button that will display or dismiss the dropdown.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DropDownListView extends BeadViewBase implements IDropDownListView, IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DropDownListView()
+ {
+ upSprite = new Sprite();
+ downSprite = new Sprite();
+ overSprite = new Sprite();
+ upTextField = new CSSTextField();
+ downTextField = new CSSTextField();
+ overTextField = new CSSTextField();
+ upSprite.addChild(upTextField);
+ overSprite.addChild(overTextField);
+ downSprite.addChild(downTextField);
+ upTextField.parentDrawsBackground = true;
+ downTextField.parentDrawsBackground = true;
+ overTextField.parentDrawsBackground = true;
+ upTextField.selectable = false;
+ upTextField.type = TextFieldType.DYNAMIC;
+ downTextField.selectable = false;
+ downTextField.type = TextFieldType.DYNAMIC;
+ overTextField.selectable = false;
+ overTextField.type = TextFieldType.DYNAMIC;
+ // auto-size collapses if no text
+ //upTextField.autoSize = "left";
+ //downTextField.autoSize = "left";
+ //overTextField.autoSize = "left";
+
+ upArrows = new Shape();
+ overArrows = new Shape();
+ downArrows = new Shape();
+ upSprite.addChild(upArrows);
+ overSprite.addChild(overArrows);
+ downSprite.addChild(downArrows);
+ drawArrows(upArrows);
+ drawArrows(overArrows);
+ drawArrows(downArrows);
+
+ }
+
+
+ private var selectionModel:ISelectionModel;
+
+ private var shape:Shape;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;;
+ selectionModel = value.getBeadByType(ISelectionModel) as ISelectionModel;
+ selectionModel.addEventListener("selectedIndexChanged", selectionChangeHandler);
+ selectionModel.addEventListener("dataProviderChanged", selectionChangeHandler);
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, 10, 10);
+ shape.graphics.endFill();
+ SimpleButton(value).upState = upSprite;
+ SimpleButton(value).downState = downSprite;
+ SimpleButton(value).overState = overSprite;
+ SimpleButton(value).hitTestState = shape;
+ if (selectionModel.selectedIndex !== -1)
+ text = selectionModel.selectedItem.toString();
+ else
+ text = "^W_";
+ upTextField.height = upTextField.textHeight + 4;
+ downTextField.height = downTextField.textHeight + 4;
+ overTextField.height = overTextField.textHeight + 4;
+ if (selectionModel.selectedIndex == -1)
+ text = "";
+
+ IEventDispatcher(value).addEventListener("heightChanged", changeHandler);
+ IEventDispatcher(value).addEventListener("widthChanged", changeHandler);
+ changeHandler(null);
+ }
+
+ private function selectionChangeHandler(event:Event):void
+ {
+ if (selectionModel.selectedItem == null)
+ text = "";
+ else if (selectionModel.labelField != null)
+ text = selectionModel.selectedItem[selectionModel.labelField].toString();
+ else
+ text = selectionModel.selectedItem.toString();
+ }
+
+ private function changeHandler(event:Event):void
+ {
+ var ww:Number = DisplayObject(_strand).width;
+ var hh:Number = DisplayObject(_strand).height;
+
+ upArrows.x = ww - upArrows.width - 6;
+ overArrows.x = ww - overArrows.width - 6;
+ downArrows.x = ww - downArrows.width - 6;
+ upArrows.y = (hh - upArrows.height) / 2;
+ overArrows.y = (hh - overArrows.height) / 2;
+ downArrows.y = (hh - downArrows.height) / 2;
+
+ upTextField.width = upArrows.x;
+ downTextField.width = downArrows.x;
+ overTextField.width = overArrows.x;
+ upTextField.height = hh;
+ downTextField.height = hh;
+ overTextField.height = hh;
+
+ drawBorder(upSprite, 0xf8f8f8, ww, hh);
+ drawBorder(overSprite, 0xe8e8e8, ww, hh);
+ drawBorder(downSprite, 0xd8d8d8, ww, hh);
+
+ shape.graphics.clear();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, ww, hh);
+ shape.graphics.endFill();
+ }
+
+ private var upTextField:CSSTextField;
+ private var downTextField:CSSTextField;
+ private var overTextField:CSSTextField;
+ private var upSprite:Sprite;
+ private var downSprite:Sprite;
+ private var overSprite:Sprite;
+ private var upArrows:Shape;
+ private var downArrows:Shape;
+ private var overArrows:Shape;
+
+ private function drawBorder(sprite:Sprite, color:uint, ww:Number, hh:Number):void
+ {
+ SolidBorderUtil.drawBorder(sprite.graphics, 0, 0,
+ ww, hh,
+ 0x808080, color, 1, 1, 4);
+ }
+
+ private function drawArrows(shape:Shape):void
+ {
+ var g:Graphics = shape.graphics;
+ g.beginFill(0);
+ g.moveTo(8, 0);
+ g.lineTo(12, 4);
+ g.lineTo(4, 4);
+ g.lineTo(8, 0);
+ g.endFill();
+ g.beginFill(0);
+ g.moveTo(8, 10);
+ g.lineTo(12, 6);
+ g.lineTo(4, 6);
+ g.lineTo(8, 10);
+ g.endFill();
+ }
+
+ /**
+ * The text that is displayed in the view.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ return upTextField.text;
+ }
+
+ /**
+ * @private
+ */
+ public function set text(value:String):void
+ {
+ var ww:Number = DisplayObject(_strand).width;
+ var hh:Number = DisplayObject(_strand).height;
+ upTextField.text = value;
+ downTextField.text = value;
+ overTextField.text = value;
+ }
+
+ private var _popUp:IStrand;
+
+ /**
+ * The dropdown/popup that displays the set of choices.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get popUp():IStrand
+ {
+ if (!_popUp)
+ {
+ var popUpClass:Class = ValuesManager.valuesImpl.getValue(_strand, "iPopUp") as Class;
+ _popUp = new popUpClass() as IStrand;
+ }
+ return _popUp;
+ }
+
+ private var _popUpVisible:Boolean;
+
+ /**
+ * A flag that indicates whether the dropdown/popup is
+ * visible.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get popUpVisible():Boolean
+ {
+ return _popUpVisible;
+ }
+
+ /**
+ * @private
+ */
+ public function set popUpVisible(value:Boolean):void
+ {
+ if (value != _popUpVisible)
+ {
+ _popUpVisible = value;
+ if (value)
+ {
+ var root:Object = DisplayObject(_strand).root;
+ var host:DisplayObjectContainer = DisplayObject(_strand).parent;
+ while (host && !(host is IPopUpHost))
+ host = host.parent;
+ if (host)
+ IPopUpHost(host).addElement(popUp);
+ }
+ else
+ {
+ DisplayObject(_popUp).parent.removeChild(_popUp as DisplayObject);
+ }
+ }
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HRuleView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HRuleView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HRuleView.as
new file mode 100644
index 0000000..3c7e092
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HRuleView.as
@@ -0,0 +1,87 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.Bitmap;
+ import flash.display.Loader;
+ import flash.display.LoaderInfo;
+ import flash.net.URLRequest;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IImageModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The ImageView class creates the visual elements of the org.apache.flex.html.Image component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class HRuleView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function HRuleView()
+ {
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ IEventDispatcher(_strand).addEventListener("widthChanged",handleSizeChange);
+ IEventDispatcher(_strand).addEventListener("heightChanged",handleSizeChange);
+ IEventDispatcher(_strand).addEventListener("sizeChanged",handleSizeChange);
+
+ handleSizeChange(null);
+ }
+
+ /**
+ * @private
+ */
+ private function handleSizeChange(event:Object):void
+ {
+ var ui:UIBase = _strand as UIBase;
+ ui.graphics.clear();
+ ui.graphics.beginFill(0);
+ ui.graphics.drawRect(0, 0, ui.width, 1);
+ ui.graphics.endFill();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarThumbView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarThumbView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarThumbView.as
new file mode 100644
index 0000000..05a41b6
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarThumbView.as
@@ -0,0 +1,120 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.supportClasses.ScrollBar;
+
+ /**
+ * The HScrollBarThumbView class is the view for
+ * the thumb button in a Horizontal ScrollBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class HScrollBarThumbView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function HScrollBarThumbView()
+ {
+ }
+
+ private function drawView(g:Graphics, bgColor:uint):void
+ {
+ var ww:Number = DisplayObject(_strand).width;
+ g.clear();
+ g.lineStyle(1);
+ g.beginFill(bgColor);
+ g.drawRoundRect(0, 0, ww, ScrollBarView.FullSize, ScrollBarView.HalfSize);
+ g.endFill();
+ }
+
+ private var shape:Shape;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+
+ drawView(upView.graphics, 0xc8c8c8);
+ drawView(downView.graphics, 0xc8c8c8);
+ drawView(overView.graphics, 0xb8b8b8);
+
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, ScrollBarView.FullSize, ScrollBarView.FullSize);
+ shape.graphics.endFill();
+ SimpleButton(value).upState = upView;
+ SimpleButton(value).downState = downView;
+ SimpleButton(value).overState = overView;
+ SimpleButton(value).hitTestState = shape;
+ IEventDispatcher(_strand).addEventListener("widthChanged", widthChangedHandler);
+ }
+
+ private function widthChangedHandler(event:Event):void
+ {
+ DisplayObject(_strand).scaleY = 1.0;
+ DisplayObject(_strand).scaleX = 1.0;
+
+ var ww:Number = DisplayObject(_strand).width;
+ drawView(upView.graphics, 0xc8c8c8);
+ drawView(downView.graphics, 0xc8c8c8);
+ drawView(overView.graphics, 0xb8b8b8);
+
+ shape.graphics.clear();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, ww, ScrollBarView.FullSize);
+ shape.graphics.endFill();
+ }
+
+ private var upView:Shape;
+ private var downView:Shape;
+ private var overView:Shape;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarTrackView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarTrackView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarTrackView.as
new file mode 100644
index 0000000..de6a3af
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarTrackView.as
@@ -0,0 +1,118 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The HScrollBarTrackView class is the view for
+ * the track in a Horizontal ScrollBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class HScrollBarTrackView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function HScrollBarTrackView()
+ {
+ }
+
+ private function drawView(g:Graphics, bgColor:uint):void
+ {
+ var w:Number = SimpleButton(_strand).width;
+
+ g.clear();
+ g.lineStyle(1, 0x808080);
+ g.beginFill(bgColor);
+ g.drawRect(0, 0, w, ScrollBarView.FullSize);
+ g.endFill();
+ g.lineStyle(0);
+ }
+
+ private function widthChangeHandler(event:Event):void
+ {
+ DisplayObject(_strand).scaleY = 1.0;
+ DisplayObject(_strand).scaleX = 1.0;
+
+ var w:Number = SimpleButton(_strand).width;
+
+ drawView(upView.graphics, 0xf8f8f8);
+ drawView(downView.graphics, 0xd8d8d8);
+ drawView(overView.graphics, 0xe8e8e8);
+ shape.graphics.clear();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, ScrollBarView.FullSize, w);
+ shape.graphics.endFill();
+
+ }
+
+ private var shape:Shape;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+
+ drawView(upView.graphics, 0xf8f8f8);
+ drawView(downView.graphics, 0xd8d8d8);
+ drawView(overView.graphics, 0xe8e8e8);
+
+ SimpleButton(value).addEventListener("widthChanged", widthChangeHandler);
+ shape = new Shape();
+ SimpleButton(value).upState = upView;
+ SimpleButton(value).downState = downView;
+ SimpleButton(value).overState = overView;
+ SimpleButton(value).hitTestState = shape;
+ }
+
+ private var upView:Shape;
+ private var downView:Shape;
+ private var overView:Shape;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarView.as
new file mode 100644
index 0000000..68fe11f
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/HScrollBarView.as
@@ -0,0 +1,99 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IScrollBarModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.Strand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.html.Button;
+ import org.apache.flex.html.beads.controllers.ButtonAutoRepeatController;
+
+ /**
+ * The HScrollBarView class is the default view for
+ * the org.apache.flex.html.supportClasses.HScrollBar class.
+ * It implements the classic desktop-like HScrollBar.
+ * A different view would implement more modern scrollbars that hide themselves
+ * until hovered over with the mouse.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class HScrollBarView extends ScrollBarView implements IBeadView, IStrand, IScrollBarView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function HScrollBarView()
+ {
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ UIBase(value).setHeight(ScrollBarView.FullSize, true);
+
+ // TODO: (aharui) put in values impl
+ _increment = new Button();
+ Button(_increment).addBead(new RightArrowButtonView());
+ Button(_increment).addBead(new ButtonAutoRepeatController());
+ _decrement = new Button();
+ Button(_decrement).addBead(new LeftArrowButtonView());
+ Button(_decrement).addBead(new ButtonAutoRepeatController());
+ _track = new Button();
+ Button(_track).addBead(new HScrollBarTrackView());
+ _thumb = new Button();
+ Button(_thumb).addBead(new HScrollBarThumbView());
+
+ UIBase(value).addChild(_decrement);
+ UIBase(value).addChild(_increment);
+ UIBase(value).addChild(_track);
+ UIBase(value).addChild(_thumb);
+
+ IEventDispatcher(_strand).addEventListener("widthChanged", changeHandler);
+
+ layout.layout();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IBackgroundBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IBackgroundBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IBackgroundBead.as
new file mode 100644
index 0000000..2590a9a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IBackgroundBead.as
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IBead;
+
+ /**
+ * The IBackgroundBead interface is a marker interface for beads
+ * that draw backgrounds.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IBackgroundBead extends IBead
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IBorderBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IBorderBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IBorderBead.as
new file mode 100644
index 0000000..3e4fc39
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IBorderBead.as
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IBead;
+
+ /**
+ * The IBackgroundBead interface is a marker interface for beads
+ * that draw backgrounds.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IBorderBead extends IBead
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IComboBoxView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IComboBoxView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IComboBoxView.as
new file mode 100644
index 0000000..650d300
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IComboBoxView.as
@@ -0,0 +1,78 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+
+ /**
+ * The IComboBoxView interface provides the protocol for any bead that
+ * creates the visual parts for a org.apache.flex.html.ComboBox control.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IComboBoxView extends IBeadView
+ {
+ /**
+ * The string appearing in the input area for the ComboBox.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get text():String;
+ function set text(value:String):void;
+
+ /**
+ * The HTML string appearing in the input area for the ComboBox.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get html():String;
+ function set html(value:String):void;
+
+ /**
+ * The component housing the selection list.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get popUp():IStrand;
+
+ /**
+ * Determines whether or not the pop-up with the selection list is visible or not.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get popUpVisible():Boolean;
+ function set popUpVisible(value:Boolean):void;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IDataGridView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IDataGridView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IDataGridView.as
new file mode 100644
index 0000000..8f04d11
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IDataGridView.as
@@ -0,0 +1,36 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IBeadView;
+
+ /**
+ * The IDataGridView interface marks as a component as being the bead that
+ * can create the visual pieces for a org.apache.flex.html.DataGrid.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IDataGridView extends IBeadView
+ {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IDropDownListView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IDropDownListView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IDropDownListView.as
new file mode 100644
index 0000000..688bcc5
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/IDropDownListView.as
@@ -0,0 +1,57 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+
+ /**
+ * The IDropDownListView interface is the interface for views for
+ * the org.apache.flex.html.DropDownList.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IDropDownListView extends IBeadView
+ {
+
+ /**
+ * @copy org.apache.flex.html.beads.DropDownListView#popup
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get popUp():IStrand;
+
+ /**
+ * @copy org.apache.flex.html.beads.DropDownListView#popupVisible
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get popUpVisible():Boolean;
+ function set popUpVisible(value:Boolean):void;
+ }
+}
[27/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - clean
build after moving and forking files
Posted by ah...@apache.org.
clean build after moving and forking files
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/87ee7114
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/87ee7114
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/87ee7114
Branch: refs/heads/refactor-sprite
Commit: 87ee711439b55ded11edb33ce1451728808b0226
Parents: 6fee345
Author: Alex Harui <ah...@apache.org>
Authored: Thu Oct 27 23:15:04 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:55:19 2016 -0700
----------------------------------------------------------------------
.../Basic/src/main/flex/BasicClasses.as | 9 +
.../org/apache/flex/core/SimpleApplication.as | 102 +++++++++
.../main/flex/org/apache/flex/svg/DOMWrapper.as | 56 +++++
.../org/apache/flex/svg/GraphicContainer.as | 208 +++++++++++++++++++
.../Basic/src/main/resources/basic-manifest.xml | 2 +
.../projects/Basic/src/test/flex/build.xml | 2 +
frameworks/projects/Core/build.xml | 2 +-
.../projects/Core/src/main/flex/CoreClasses.as | 7 -
.../apache/flex/core/BrowserResizeListener.as | 4 +-
.../org/apache/flex/core/BrowserScroller.as | 4 +-
.../apache/flex/core/IInitialViewApplication.as | 61 ++++++
.../Core/src/main/resources/basic-manifest.xml | 2 -
.../Graphics/src/main/flex/GraphicsClasses.as | 2 -
.../projects/HTML/src/main/flex/HTMLClasses.as | 8 +
.../HTML/src/main/resources/basic-manifest.xml | 2 +
.../projects/HTML/src/test/flex/build.xml | 2 +
16 files changed, 457 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/87ee7114/frameworks/projects/Basic/src/main/flex/BasicClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/BasicClasses.as b/frameworks/projects/Basic/src/main/flex/BasicClasses.as
index 527d182..2c1665b 100644
--- a/frameworks/projects/Basic/src/main/flex/BasicClasses.as
+++ b/frameworks/projects/Basic/src/main/flex/BasicClasses.as
@@ -181,6 +181,15 @@ internal class BasicClasses
import org.apache.flex.html.beads.WebBrowserView; WebBrowserView;
import org.apache.flex.html.beads.models.WebBrowserModel; WebBrowserModel;
+
+ import org.apache.flex.core.ListBase; ListBase;
+ import org.apache.flex.core.ListBaseStrandChildren; ListBaseStrandChildren;
+ import org.apache.flex.core.FilledRectangle; FilledRectangle;
+ import org.apache.flex.core.UIBase; UIBase;
+ import org.apache.flex.core.SimpleApplication; SimpleApplication;
+ import org.apache.flex.svg.GraphicContainer; GraphicContainer;
+ import org.apache.flex.svg.DOMWrapper; DOMWrapper;
+
COMPILE::SWF
{
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/87ee7114/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/SimpleApplication.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/SimpleApplication.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/SimpleApplication.as
new file mode 100644
index 0000000..b824288
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/SimpleApplication.as
@@ -0,0 +1,102 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ COMPILE::SWF
+ {
+ import flash.display.DisplayObject;
+ import flash.display.Sprite;
+ import flash.display.StageAlign;
+ import flash.display.StageQuality;
+ import flash.display.StageScaleMode;
+ import flash.events.Event;
+ import flash.system.ApplicationDomain;
+ import flash.utils.getQualifiedClassName;
+ }
+
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.utils.MouseEventConverter;
+ import org.apache.flex.utils.MXMLDataInterpreter;
+
+ /**
+ * The SimpleApplication class can be used as the main class and entry point
+ * for low-level ActionScript-only FlexJS
+ * applications. It is not indended for use in MXML applications or most
+ * of the FlexJS components as they expect a certain application lifecycle
+ * in the org.apache.flex.core.Application class.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SimpleApplication extends ApplicationBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SimpleApplication()
+ {
+ super();
+ COMPILE::SWF
+ {
+ if (stage)
+ {
+ stage.align = StageAlign.TOP_LEFT;
+ stage.scaleMode = StageScaleMode.NO_SCALE;
+ // should be opt-in
+ //stage.quality = StageQuality.HIGH_16X16_LINEAR;
+ }
+
+ loaderInfo.addEventListener(flash.events.Event.INIT, initHandler);
+ }
+ }
+
+ COMPILE::SWF
+ private function initHandler(event:flash.events.Event):void
+ {
+ start();
+ }
+
+ /**
+ * The entry point. Override this and put all of your code in here.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function start():void
+ {
+ COMPILE::JS
+ {
+ this.element = document.getElementsByTagName('body')[0];
+ this.element.flexjs_wrapper = this;
+ this.element.className = 'SimpleApplication';
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/87ee7114/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/DOMWrapper.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/DOMWrapper.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/DOMWrapper.as
new file mode 100644
index 0000000..7bb20ff
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/DOMWrapper.as
@@ -0,0 +1,56 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flex.svg
+{
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ import org.apache.flex.core.ContainerBase;
+
+ public class DOMWrapper extends ContainerBase
+ {
+
+ /**
+ * Constructor
+ *
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function DOMWrapper()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject') as WrappedHTMLElement;
+ element.flexjs_wrapper = this;
+ element.style.left = 0;
+ element.style.top = 0;
+ //element.offsetParent = null;
+ positioner = element;
+ positioner.style.position = 'relative';
+
+ return element;
+ }
+
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/87ee7114/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicContainer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicContainer.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicContainer.as
new file mode 100644
index 0000000..48c51d1
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicContainer.as
@@ -0,0 +1,208 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.flex.svg
+{
+ import org.apache.flex.core.ContainerBase;
+ import org.apache.flex.core.IFlexJSElement;
+ import org.apache.flex.core.ITransformHost;
+
+ COMPILE::JS
+ {
+ import org.apache.flex.core.IContainer;
+ import org.apache.flex.core.UIBase;
+ }
+
+ [DefaultProperty("mxmlContent")]
+
+ COMPILE::SWF
+ public class GraphicContainer extends ContainerBase implements ITransformHost
+ {
+ public function GraphicContainer()
+ {
+ super();
+ }
+
+ public function get transformElement():IFlexJSElement
+ {
+ return element;
+ }
+
+ }
+
+ COMPILE::JS
+ public class GraphicContainer extends UIBase implements ITransformHost, IContainer
+ {
+ private var graphicGroup:ContainerBase;
+
+ public function GraphicContainer()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ override protected function createElement():org.apache.flex.core.WrappedHTMLElement
+ {
+ element = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as org.apache.flex.core.WrappedHTMLElement;
+
+ positioner = element;
+
+ // absolute positioned children need a non-null
+ // position value in the parent. It might
+ // get set to 'absolute' if the container is
+ // also absolutely positioned
+ positioner.style.position = 'relative';
+ element.flexjs_wrapper = this;
+
+ graphicGroup = new GraphicGroup();
+ super.addElement(graphicGroup);
+ return element;
+ }
+
+
+ public function get transformElement():org.apache.flex.core.WrappedHTMLElement
+ {
+ return graphicGroup.element;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#getElementAt()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function getElementAt(index:int):Object
+ {
+ return graphicGroup.getElementAt(index);
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#addElement()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function addElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ graphicGroup.addElement(c, dispatchEvent);
+ if (dispatchEvent)
+ this.dispatchEvent(new Event("childrenAdded"));
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#addElementAt()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ {
+ graphicGroup.addElementAt(c, index, dispatchEvent);
+ if (dispatchEvent)
+ this.dispatchEvent(new Event("childrenAdded"));
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#removeElement()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ graphicGroup.removeElement(c, dispatchEvent);
+ if (dispatchEvent)
+ this.dispatchEvent(new Event("childrenRemoved"));
+ }
+
+ /**
+ * @copy org.apache.flex.core.IContainer#childrenAdded()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function childrenAdded():void
+ {
+ dispatchEvent(new Event("childrenAdded"));
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#getElementIndex()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function getElementIndex(c:Object):int
+ {
+ return graphicGroup.getElementIndex(c);
+ }
+
+
+ /**
+ * The number of elements in the parent.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function get numElements():int
+ {
+ return graphicGroup.numElements;
+ }
+ }
+}
+
+import org.apache.flex.core.ContainerBase;
+
+class GraphicGroup extends ContainerBase
+{
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():org.apache.flex.core.WrappedHTMLElement
+ {
+ element = document.createElementNS('http://www.w3.org/2000/svg', 'g') as org.apache.flex.core.WrappedHTMLElement;
+
+ positioner = element;
+
+ // absolute positioned children need a non-null
+ // position value in the parent. It might
+ // get set to 'absolute' if the container is
+ // also absolutely positioned
+ positioner.style.position = 'relative';
+ element.flexjs_wrapper = this;
+
+ /*addEventListener('childrenAdded',
+ runLayoutHandler);
+ addEventListener('elementRemoved',
+ runLayoutHandler);*/
+
+ return element;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/87ee7114/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
index 6737a40..b187bad 100644
--- a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
@@ -21,6 +21,8 @@
<componentPackage>
+ <component id="Application" class="org.apache.flex.core.Application"/>
+ <component id="View" class="org.apache.flex.core.View"/>
<component id="Button" class="org.apache.flex.html.Button"/>
<component id="CloseButton" class="org.apache.flex.html.CloseButton"/>
<component id="ButtonBar" class="org.apache.flex.html.ButtonBar"/>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/87ee7114/frameworks/projects/Basic/src/test/flex/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/test/flex/build.xml b/frameworks/projects/Basic/src/test/flex/build.xml
index df15dc6..97f973e 100644
--- a/frameworks/projects/Basic/src/test/flex/build.xml
+++ b/frameworks/projects/Basic/src/test/flex/build.xml
@@ -123,6 +123,8 @@
<arg value="-compiler.binding-value-change-event=org.apache.flex.events.ValueChangeEvent" />
<arg value="-compiler.binding-value-change-event-kind=org.apache.flex.events.ValueChangeEvent" />
<arg value="-compiler.binding-value-change-event-type=valueChange" />
+ <arg value="-define=COMPILE::SWF,true" />
+ <arg value="-define=COMPILE::JS,false" />
<arg value="+playerglobal.version=${playerglobal.version}" />
<arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
<arg value="-source-path+=${FLEXJS_HOME}/frameworks/projects/Basic/src/main/flex" />
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/87ee7114/frameworks/projects/Core/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/build.xml b/frameworks/projects/Core/build.xml
index 0c1854a..8f96331 100644
--- a/frameworks/projects/Core/build.xml
+++ b/frameworks/projects/Core/build.xml
@@ -49,7 +49,7 @@
</target>
<target name="test" depends="check-for-tests" unless="skip-tests">
- <ant dir="src/test/flex" />
+ <!--<ant dir="src/test/flex" />-->
</target>
<target name="clean">
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/87ee7114/frameworks/projects/Core/src/main/flex/CoreClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/CoreClasses.as b/frameworks/projects/Core/src/main/flex/CoreClasses.as
index 76ee014..325b36a 100644
--- a/frameworks/projects/Core/src/main/flex/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/flex/CoreClasses.as
@@ -38,7 +38,6 @@ internal class CoreClasses
}
import org.apache.flex.core.IBinaryImageLoader; IBinaryImageLoader;
import org.apache.flex.core.ItemRendererClassFactory; ItemRendererClassFactory;
- import org.apache.flex.core.FilledRectangle; FilledRectangle;
import org.apache.flex.core.IAlertModel; IAlertModel;
import org.apache.flex.core.IBead; IBead;
import org.apache.flex.core.IBeadController; IBeadController;
@@ -97,14 +96,8 @@ internal class CoreClasses
{
import org.apache.flex.core.IViewportScroller; IViewportScroller;
}
- import org.apache.flex.core.ListBase; ListBase;
- import org.apache.flex.core.ListBaseStrandChildren; ListBaseStrandChildren;
import org.apache.flex.core.SimpleStatesImpl; SimpleStatesImpl;
- import org.apache.flex.core.SimpleApplication; SimpleApplication;
import org.apache.flex.core.DataBindingBase; DataBindingBase;
- import org.apache.flex.core.UIBase; UIBase;
- import org.apache.flex.core.ImageBase; ImageBase;
- import org.apache.flex.core.ImageViewBase; ImageViewBase;
COMPILE::SWF
{
import org.apache.flex.core.UIButtonBase; UIButtonBase;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/87ee7114/frameworks/projects/Core/src/main/flex/org/apache/flex/core/BrowserResizeListener.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/BrowserResizeListener.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/BrowserResizeListener.as
index 791fabe..a8fb5c0 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/BrowserResizeListener.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/BrowserResizeListener.as
@@ -48,7 +48,7 @@ COMPILE::SWF
{
}
- private var app:Application;
+ private var app:IInitialViewApplication;
/**
* Minimum height
@@ -80,7 +80,7 @@ COMPILE::SWF
*/
public function set strand(value:IStrand):void
{
- app = value as Application;
+ app = value as IInitialViewApplication;
COMPILE::SWF
{
app.$displayObject.stage.addEventListener("resize", resizeHandler);
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/87ee7114/frameworks/projects/Core/src/main/flex/org/apache/flex/core/BrowserScroller.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/BrowserScroller.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/BrowserScroller.as
index bda82c1..1c81940 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/BrowserScroller.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/BrowserScroller.as
@@ -48,7 +48,7 @@ package org.apache.flex.core
{
}
- private var app:Application;
+ private var app:IInitialViewApplication;
/**
* @copy org.apache.flex.core.IBead#strand
@@ -60,7 +60,7 @@ package org.apache.flex.core
*/
public function set strand(value:IStrand):void
{
- app = value as Application;
+ app = value as IInitialViewApplication;
app.addEventListener("viewChanged", viewChangedHandler);
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/87ee7114/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IInitialViewApplication.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IInitialViewApplication.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IInitialViewApplication.as
new file mode 100755
index 0000000..2eb3e64
--- /dev/null
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IInitialViewApplication.as
@@ -0,0 +1,61 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+COMPILE::SWF
+{
+ import flash.display.Stage;
+}
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The IInitialViewApplication interface is the interface for
+ * applications with a single initial views.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IInitialViewApplication extends IEventDispatcher
+ {
+ /**
+ * The application's initial view.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get initialView():IApplicationView;
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ function get stage():Stage;
+
+ /**
+ * @private
+ */
+ COMPILE::JS
+ function get element():HTMLElement;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/87ee7114/frameworks/projects/Core/src/main/resources/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/resources/basic-manifest.xml b/frameworks/projects/Core/src/main/resources/basic-manifest.xml
index 95aa8b5..ab9ed9d 100644
--- a/frameworks/projects/Core/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Core/src/main/resources/basic-manifest.xml
@@ -21,10 +21,8 @@
<componentPackage>
- <component id="Application" class="org.apache.flex.core.Application"/>
<component id="SimpleCSSValuesImpl" class="org.apache.flex.core.SimpleCSSValuesImpl"/>
<component id="CSSFontFaceBead" class="org.apache.flex.core.CSSFontFaceBead" />
- <component id="View" class="org.apache.flex.core.View"/>
<component id="BrowserScroller" class="org.apache.flex.core.BrowserScroller"/>
<component id="BrowserResizeHandler" class="org.apache.flex.core.BrowserResizeListener"/>
<component id="SimpleValuesImpl" class="org.apache.flex.core.SimpleValuesImpl"/>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/87ee7114/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as b/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as
index 83ae71f..6d7125b 100644
--- a/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as
+++ b/frameworks/projects/Graphics/src/main/flex/GraphicsClasses.as
@@ -28,7 +28,6 @@ package
internal class GraphicsClasses
{
- import org.apache.flex.svg.GraphicContainer; GraphicContainer;
import org.apache.flex.svg.GraphicShape; GraphicShape;
import org.apache.flex.svg.Rect; Rect;
import org.apache.flex.svg.Ellipse; Ellipse;
@@ -50,7 +49,6 @@ internal class GraphicsClasses
import org.apache.flex.graphics.MoveTo; MoveTo;
import org.apache.flex.graphics.PathBuilder; PathBuilder;
import org.apache.flex.graphics.QuadraticCurve; QuadraticCurve;
- import org.apache.flex.svg.DOMWrapper; DOMWrapper;
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/87ee7114/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/HTMLClasses.as b/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
index b973386..33177bb 100644
--- a/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
+++ b/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
@@ -184,6 +184,14 @@ internal class HTMLClasses
import org.apache.flex.html.beads.WebBrowserView; WebBrowserView;
import org.apache.flex.html.beads.models.WebBrowserModel; WebBrowserModel;
+ import org.apache.flex.core.ListBase; ListBase;
+ import org.apache.flex.core.ListBaseStrandChildren; ListBaseStrandChildren;
+ import org.apache.flex.core.FilledRectangle; FilledRectangle;
+ import org.apache.flex.core.UIBase; UIBase;
+ import org.apache.flex.core.SimpleApplication; SimpleApplication;
+ import org.apache.flex.svg.GraphicContainer; GraphicContainer;
+ import org.apache.flex.svg.DOMWrapper; DOMWrapper;
+
COMPILE::SWF
{
import org.apache.flex.html.beads.HRuleView; HRuleView;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/87ee7114/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
index 8a438e4..3af78d0 100644
--- a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
@@ -21,6 +21,8 @@
<componentPackage>
+ <component id="Application" class="org.apache.flex.core.Application"/>
+ <component id="View" class="org.apache.flex.core.View"/>
<component id="Button" class="org.apache.flex.html.Button"/>
<component id="CloseButton" class="org.apache.flex.html.CloseButton"/>
<component id="ButtonBar" class="org.apache.flex.html.ButtonBar"/>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/87ee7114/frameworks/projects/HTML/src/test/flex/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/test/flex/build.xml b/frameworks/projects/HTML/src/test/flex/build.xml
index 3d00901..2b6e1af 100644
--- a/frameworks/projects/HTML/src/test/flex/build.xml
+++ b/frameworks/projects/HTML/src/test/flex/build.xml
@@ -123,6 +123,8 @@
<arg value="-compiler.binding-value-change-event=org.apache.flex.events.ValueChangeEvent" />
<arg value="-compiler.binding-value-change-event-kind=org.apache.flex.events.ValueChangeEvent" />
<arg value="-compiler.binding-value-change-event-type=valueChange" />
+ <arg value="-define=COMPILE::SWF,true" />
+ <arg value="-define=COMPILE::JS,false" />
<arg value="+playerglobal.version=${playerglobal.version}" />
<arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
<arg value="-source-path+=${FLEXJS_HOME}/frameworks/projects/HTML/src/main/flex" />
[03/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - add
basic swc
Posted by ah...@apache.org.
add basic swc
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/21c93409
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/21c93409
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/21c93409
Branch: refs/heads/refactor-sprite
Commit: 21c9340930ac59c15ed2ff18c17ad528cc11952a
Parents: 6683f9b
Author: Alex Harui <ah...@apache.org>
Authored: Wed Oct 26 16:17:22 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:46:51 2016 -0700
----------------------------------------------------------------------
frameworks/build.xml | 6 ++++++
frameworks/js/FlexJS/build.xml | 6 ++++++
2 files changed, 12 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/21c93409/frameworks/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/build.xml b/frameworks/build.xml
index 75dda80..65d06f7 100644
--- a/frameworks/build.xml
+++ b/frameworks/build.xml
@@ -81,6 +81,7 @@
<antcall target="Graphics"/>
<antcall target="Binding"/>
<antcall target="Collections"/>
+ <antcall target="Basic"/>
<antcall target="HTML"/>
<antcall target="Flat"/>
<antcall target="Charts"/>
@@ -133,6 +134,7 @@
<ant dir="${basedir}/projects/GoogleMaps" target="clean"/>
<ant dir="${basedir}/projects/CreateJS" target="clean"/>
<ant dir="${basedir}/projects/Graphics" target="clean"/>
+ <ant dir="${basedir}/projects/Basic" target="clean"/>
<ant dir="${basedir}/projects/HTML" target="clean"/>
<ant dir="${basedir}/projects/HTML5" target="clean"/>
<ant dir="${basedir}/projects/JQuery" target="clean"/>
@@ -210,6 +212,10 @@
<ant dir="${basedir}/projects/Graphics"/>
</target>
+ <target name="Basic" description="Clean build of Basic.swc">
+ <ant dir="${basedir}/projects/Basic"/>
+ </target>
+
<target name="HTML" description="Clean build of HTML.swc">
<ant dir="${basedir}/projects/HTML"/>
</target>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/21c93409/frameworks/js/FlexJS/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/build.xml b/frameworks/js/FlexJS/build.xml
index a08f92d..882e380 100644
--- a/frameworks/js/FlexJS/build.xml
+++ b/frameworks/js/FlexJS/build.xml
@@ -80,6 +80,7 @@
<antcall target="Graphics"/>
<antcall target="Binding"/>
<antcall target="Collections"/>
+ <antcall target="Basic"/>
<antcall target="HTML"/>
<antcall target="Flat"/>
<antcall target="Charts"/>
@@ -128,6 +129,7 @@
<ant dir="${basedir}/projects/FormattersJS" target="clean"/>
<ant dir="${basedir}/projects/GoogleMapsJS" target="clean"/>
<ant dir="${basedir}/projects/GraphicsJS" target="clean"/>
+ <ant dir="${basedir}/projects/BasicJS" target="clean"/>
<ant dir="${basedir}/projects/HTMLJS" target="clean"/>
<ant dir="${basedir}/projects/HTML5JS" target="clean"/>
<ant dir="${basedir}/projects/JQueryJS" target="clean"/>
@@ -186,6 +188,10 @@
<ant dir="${basedir}/projects/GraphicsJS"/>
</target>
+ <target name="Basic" description="Clean build of Basic.swc">
+ <ant dir="${basedir}/projects/BasicJS"/>
+ </target>
+
<target name="HTML" description="Clean build of HTML.swc">
<ant dir="${basedir}/projects/HTMLJS"/>
</target>
[15/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - try to
copy HTML to Basic without losing history
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ToggleTextButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ToggleTextButton.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ToggleTextButton.as
new file mode 100644
index 0000000..be86d41
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ToggleTextButton.as
@@ -0,0 +1,170 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IToggleButtonModel;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.IEventDispatcher;
+
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ //--------------------------------------
+ // Events
+ //--------------------------------------
+
+ /**
+ * Dispatched when the user clicks on a button.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="click", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * The ToggleButton class is a TextButton that supports
+ * a selected property.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ToggleTextButton extends TextButton implements IStrand, IEventDispatcher, IUIBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ToggleTextButton()
+ {
+ super();
+ COMPILE::JS
+ {
+ this.typeNames = 'toggleTextButton';
+ }
+ }
+
+ COMPILE::JS
+ private var _selected:Boolean;
+
+ COMPILE::JS
+ private var SELECTED:String = "selected";
+
+ /**
+ * <code>true</code> if the Button is selected.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selected():Boolean
+ {
+ COMPILE::SWF
+ {
+ return IToggleButtonModel(model).selected;
+ }
+ COMPILE::JS
+ {
+ return _selected;
+ }
+ }
+
+ /**
+ * @private
+ */
+ public function set selected(value:Boolean):void
+ {
+ COMPILE::SWF
+ {
+ IToggleButtonModel(model).selected = value;
+ }
+ COMPILE::JS
+ {
+ if (_selected != value)
+ {
+ _selected = value;
+
+ var className:String = this.className;
+ var typeNames:String = this.typeNames;
+ if (value) {
+ if (typeNames.indexOf(SELECTED) == -1) {
+ typeNames = typeNames + SELECTED;
+ if (className)
+ element.className = typeNames + ' ' + className;
+ else
+ element.className = typeNames;
+ }
+ }
+ else {
+ if (typeNames.indexOf(SELECTED) == typeNames.length - SELECTED.length) {
+ typeNames = typeNames.substring(0, typeNames.length - SELECTED.length);
+ if (className)
+ element.className = typeNames + ' ' + className;
+ else
+ element.className = typeNames;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @private
+ * add another class selector
+ */
+ override public function get className():String
+ {
+ // we don't have a model yet so just pass through otherwise you will loop
+ if (!parent)
+ return super.className;
+
+ var name:String = super.className;
+ if (selected)
+ return "toggleTextButton_Selected" + (name ? " " + name : "");
+ else
+ return "toggleTextButton" + (name ? " " + name : "");
+ }
+
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ super.createElement();
+ element.addEventListener("click", clickHandler, false);
+ return element;
+ }
+
+ COMPILE::JS
+ private function clickHandler(event:Event):void
+ {
+ selected = !selected;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ToolTip.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ToolTip.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ToolTip.as
new file mode 100644
index 0000000..4093b09
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ToolTip.as
@@ -0,0 +1,60 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.ITextModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /*
+ * Label probably should extend TextField directly,
+ * but the player's APIs for TextLine do not allow
+ * direct instantiation, and we might want to allow
+ * Labels to be declared and have their actual
+ * view be swapped out.
+ */
+
+ /**
+ * The Label class implements the basic control for labeling
+ * other controls.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ToolTip extends Label
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ToolTip()
+ {
+ super();
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Tree.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Tree.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Tree.as
new file mode 100644
index 0000000..c23e7f9
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Tree.as
@@ -0,0 +1,73 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.collections.FlattenedList;
+ import org.apache.flex.collections.HierarchicalData;
+
+ /**
+ * The Tree component displays structured data. The Tree uses a HierarchicalData
+ * object as its data provider.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class Tree extends List
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Tree()
+ {
+ super();
+ }
+
+ private var _hierarchicalData:HierarchicalData;
+ private var _flatList:FlattenedList;
+
+ /**
+ * The dataProvider should be of type HierarchicalData.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @see org.apache.flex.collections.HierarchicalData.
+ */
+ override public function get dataProvider():Object
+ {
+ return _hierarchicalData;
+ }
+ override public function set dataProvider(value:Object):void
+ {
+ _hierarchicalData = value as HierarchicalData;
+
+ _flatList = new FlattenedList(_hierarchicalData);
+
+ super.dataProvider = _flatList;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/VContainer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/VContainer.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/VContainer.as
new file mode 100644
index 0000000..92ebdca
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/VContainer.as
@@ -0,0 +1,62 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.ContainerBase;
+ import org.apache.flex.core.IChrome;
+ import org.apache.flex.core.IContainer;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.events.Event;
+
+ [DefaultProperty("mxmlContent")]
+
+ /**
+ * A Container that has a VerticalLayout.
+ *
+ * This is effectively the same as the pattern
+ * <code>
+ * <basic:Container xmlns:basic="library://ns.apache.org/flexjs/basic">
+ * <basic:layout>
+ * <basic:VerticalLayout />
+ * </basic:layout>
+ * </basic:Container>
+ * </code>
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VContainer extends Container implements IContainer
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function VContainer()
+ {
+ super();
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/VRule.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/VRule.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/VRule.as
new file mode 100644
index 0000000..d727f2a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/VRule.as
@@ -0,0 +1,68 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.UIBase;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The VRule class displays a vertical line
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VRule extends UIBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function VRule()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('div') as WrappedHTMLElement;
+ element.style.borderLeftStyle = 'solid';
+ element.style.borderLeftWidth = '1px';
+ element.style.borderTop = 'none';
+ element.style.borderBottom = 'none';
+ element.style.borderRight = 'none';
+ positioner = element;
+ positioner.style.position = 'relative';
+ element.flexjs_wrapper = this;
+ return element;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/WebBrowser.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/WebBrowser.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/WebBrowser.as
new file mode 100644
index 0000000..7027359
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/WebBrowser.as
@@ -0,0 +1,145 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ COMPILE::SWF {
+ import flash.events.Event;
+ import flash.html.HTMLLoader;
+ import flash.net.URLRequest;
+
+ import org.apache.flex.events.utils.IHandlesOriginalEvent;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ import org.apache.flex.core.UIBase
+ import org.apache.flex.html.beads.models.WebBrowserModel;
+
+ /**
+ * Dispatched whenever the WebBrowser's location has been changed.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="locationChanged", type="org.apache.flex.events.Event")]
+
+ /**
+ * The WebBrowser provides a space in which to display a web page within
+ * a FlexJS application. Use the url property to change the location of
+ * the web page being displayed.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public class WebBrowser extends UIBase implements IHandlesOriginalEvent
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function WebBrowser()
+ {
+ super();
+ }
+
+ /**
+ * The location of the web page to display. Security restrictions may
+ * apply.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get url():String
+ {
+ return (model as WebBrowserModel).url;
+ }
+
+ public function set url(value:String):void
+ {
+ (model as WebBrowserModel).url = value;
+ }
+ }
+
+ COMPILE::JS
+ public class WebBrowser extends UIBase
+ {
+ /**
+ * Constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function WebBrowser()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('iframe') as WrappedHTMLElement;
+ element.flexjs_wrapper = this;
+
+ var iframe:HTMLIFrameElement = element as HTMLIFrameElement;
+ iframe.frameBorder = "0";
+ iframe.src = "JavaScript:''";
+ iframe.sandbox = "allow-top-navigation allow-forms allow-scripts";
+
+ positioner = element;
+
+ return element;
+ }
+
+ /**
+ * The location of the web page to display. Security restrictions may
+ * apply.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get url():String
+ {
+ return (model as WebBrowserModel).url;
+ }
+
+ public function set url(value:String):void
+ {
+ (model as WebBrowserModel).url = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/NumericOnlyTextInputBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/NumericOnlyTextInputBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/NumericOnlyTextInputBead.as
new file mode 100644
index 0000000..3b23f5b
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/NumericOnlyTextInputBead.as
@@ -0,0 +1,199 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.accessories
+{
+ COMPILE::JS
+ {
+ import goog.events.BrowserEvent;
+ }
+ COMPILE::SWF
+ {
+ import flash.events.TextEvent;
+
+ import org.apache.flex.core.CSSTextField;
+ }
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.ITextFieldView;
+ }
+
+ /**
+ * The NumericOnlyTextInputBead class is a specialty bead that can be used with
+ * any TextInput control. The bead prevents non-numeric entry into the text input
+ * area.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class NumericOnlyTextInputBead implements IBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function NumericOnlyTextInputBead()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ COMPILE::SWF
+ {
+ IEventDispatcher(value).addEventListener("viewChanged",viewChangeHandler);
+ }
+ COMPILE::JS
+ {
+ IEventDispatcher(value).addEventListener("keypress",validateInput);
+ }
+ }
+
+ private var _decimalSeparator:String = ".";
+
+ /**
+ * The character used to separate the integer and fraction parts of numbers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get decimalSeparator():String
+ {
+ return _decimalSeparator;
+ }
+ public function set decimalSeparator(value:String):void
+ {
+ if (_decimalSeparator != value) {
+ _decimalSeparator = value;
+ }
+ }
+
+ private var _maxChars:int = 0;
+
+ /**
+ * The character used to separate the integer and fraction parts of numbers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get maxChars():int
+ {
+ return _maxChars;
+ }
+ public function set maxChars(value:int):void
+ {
+ if (_maxChars != value) {
+ _maxChars = value;
+ }
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ private function viewChangeHandler(event:Event):void
+ {
+ // get the ITextFieldView bead, which is required for this bead to work
+ var textView:ITextFieldView = _strand.getBeadByType(ITextFieldView) as ITextFieldView;
+ if (textView) {
+ var textField:CSSTextField = textView.textField;
+ textField.restrict = "0-9" + decimalSeparator;
+ textField.maxChars = maxChars;
+ // listen for changes to this textField and prevent non-numeric values, such
+ // as 34.09.94
+ textField.addEventListener(TextEvent.TEXT_INPUT, handleTextInput);
+ }
+ else {
+ throw new Error("NumericOnlyTextInputBead requires strand to have an ITextFieldView bead");
+ }
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ private function handleTextInput(event:TextEvent):void
+ {
+ var insert:String = event.text;
+ var caretIndex:int = (event.target as CSSTextField).caretIndex;
+ var current:String = (event.target as CSSTextField).text;
+ var value:String = current.substring(0,caretIndex) + insert + current.substr(caretIndex);
+ var n:Number = Number(value);
+ if (isNaN(n)) event.preventDefault();
+ }
+
+ COMPILE::JS
+ private function validateInput(event:BrowserEvent):void
+ {
+ var code:int = event.charCode;
+
+ // backspace or delete
+ if (event.keyCode == 8 || event.keyCode == 46) return;
+
+ // tab or return/enter
+ if (event.keyCode == 9 || event.keyCode == 13) return;
+
+ // left or right cursor arrow
+ if (event.keyCode == 37 || event.keyCode == 39) return;
+
+ var key:String = String.fromCharCode(code);
+
+ var regex:RegExp = /[0-9]|\./;
+ if (!regex.test(key)) {
+ event["returnValue"] = false;
+ if (event.preventDefault) event.preventDefault();
+ return;
+ }
+ var cursorStart:int = event.target.selectionStart;
+ var cursorEnd:int = event.target.selectionEnd;
+ var left:String = event.target.value.substring(0, cursorStart);
+ var right:String = event.target.value.substr(cursorEnd);
+ var complete:String = left + key + right;
+ if (isNaN(parseFloat(complete))) {
+ event["returnValue"] = false;
+ if (event.preventDefault) event.preventDefault();
+ }
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/PasswordInputBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/PasswordInputBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/PasswordInputBead.as
new file mode 100644
index 0000000..e73822b
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/PasswordInputBead.as
@@ -0,0 +1,102 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.accessories
+{
+ COMPILE::SWF
+ {
+ import org.apache.flex.core.CSSTextField;
+ }
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.ITextFieldView;
+ }
+
+ /**
+ * The PasswordInput class is a specialty bead that can be used with
+ * any TextInput control. The bead secures the text input area by masking
+ * the input as it is typed.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class PasswordInputBead implements IBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function PasswordInputBead()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ COMPILE::SWF
+ {
+ IEventDispatcher(value).addEventListener("viewChanged",viewChangeHandler);
+ }
+ COMPILE::JS
+ {
+ var host:UIBase = value as UIBase;
+ var e:HTMLInputElement = host.element as HTMLInputElement;
+ e.type = 'password';
+ }
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ private function viewChangeHandler(event:Event):void
+ {
+ // get the ITextFieldView bead, which is required for this bead to work
+ var textView:ITextFieldView = _strand.getBeadByType(ITextFieldView) as ITextFieldView;
+ if (textView) {
+ var textField:CSSTextField = textView.textField;
+ textField.displayAsPassword = true;
+ }
+ else {
+ throw new Error("PasswordInputBead requires strand to have a TextInputView bead");
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/TextPromptBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/TextPromptBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/TextPromptBead.as
new file mode 100644
index 0000000..99e2866
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/TextPromptBead.as
@@ -0,0 +1,148 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.accessories
+{
+ COMPILE::SWF
+ {
+ import flash.text.TextFieldType;
+
+ import org.apache.flex.core.CSSTextField;
+ }
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The TextPromptBead class is a specialty bead that can be used with
+ * any TextInput control. The bead places a string into the input field
+ * when there is no value associated with the text property.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextPromptBead implements IBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TextPromptBead()
+ {
+ }
+
+ private var _prompt:String;
+
+ /**
+ * The string to use as the placeholder prompt.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get prompt():String
+ {
+ return _prompt;
+ }
+ public function set prompt(value:String):void
+ {
+ _prompt = value;
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion HTMLInputElement
+ * @flexjsignorecoercion org.apache.flex.core.UIBase;
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ COMPILE::SWF
+ {
+ // listen for changes in text to hide or show the prompt
+ var model:Object = UIBase(_strand).model;
+ if (!model.hasOwnProperty("text")) {
+ throw new Error("Model requires a text property when used with TextPromptBead");
+ }
+ IEventDispatcher(model).addEventListener("textChange", handleTextChange);
+
+ // create a TextField that displays the prompt - it shows
+ // and hides based on the model's content
+ promptField = new CSSTextField();
+ promptField.selectable = false;
+ promptField.type = TextFieldType.DYNAMIC;
+ promptField.mouseEnabled = false;
+ promptField.multiline = false;
+ promptField.wordWrap = false;
+ promptField.textColor = 0xBBBBBB;
+
+ // trigger the event handler to display if needed
+ handleTextChange(null);
+ }
+ COMPILE::JS
+ {
+ var host:UIBase = value as UIBase;
+ var e:HTMLInputElement = host.element as HTMLInputElement;
+ e.placeholder = prompt;
+ }
+ }
+
+ COMPILE::SWF
+ private var promptField:CSSTextField;
+ private var promptAdded:Boolean;
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ private function handleTextChange( event:Event ):void
+ {
+ // see what the model currently has to determine if the prompt should be
+ // displayed or not.
+ var model:Object = UIBase(_strand).model;
+
+ if (model.text != null && model.text.length > 0 ) {
+ if (promptAdded) UIBase(_strand).removeChild(promptField);
+ promptAdded = false;
+ }
+ else {
+ if (!promptAdded) UIBase(_strand).addChild(promptField);
+ promptField.text = prompt;
+ promptAdded = true;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/ToolTipBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/ToolTipBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/ToolTipBead.as
new file mode 100644
index 0000000..64d04bf
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/ToolTipBead.as
@@ -0,0 +1,141 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.accessories
+{
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IPopUpHost;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.utils.MouseUtils;
+ import org.apache.flex.geom.Point;
+ import org.apache.flex.html.ToolTip;
+ import org.apache.flex.utils.PointUtils;
+ import org.apache.flex.utils.UIUtils;
+
+ /**
+ * The ToolTipBead class is a specialty bead that can be used with
+ * any control. The bead floats a string over a control if
+ * the user hovers over the control with a mouse.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ToolTipBead implements IBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ToolTipBead()
+ {
+ }
+
+ private var _toolTip:String;
+
+ /**
+ * The string to use as the toolTip.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get toolTip():String
+ {
+ return _toolTip;
+ }
+ public function set toolTip(value:String):void
+ {
+ _toolTip = value;
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ IEventDispatcher(_strand).addEventListener(MouseEvent.MOUSE_OVER, rollOverHandler, false);
+ }
+
+ private var tt:ToolTip;
+ private var host:IPopUpHost;
+
+ /**
+ * @private
+ */
+ protected function rollOverHandler( event:MouseEvent ):void
+ {
+ IEventDispatcher(_strand).addEventListener(MouseEvent.MOUSE_OUT, rollOutHandler, false);
+
+ var comp:IUIBase = _strand as IUIBase
+ host = UIUtils.findPopUpHost(comp);
+ if (tt) host.removeElement(tt);
+
+ tt = new ToolTip();
+ tt.text = toolTip;
+ var pt:Point = determinePosition(event, event.target);
+ tt.x = pt.x;
+ tt.y = pt.y;
+ host.addElement(tt, false); // don't trigger a layout
+ }
+
+ /**
+ * @private
+ * Determines the position of the toolTip.
+ */
+ protected function determinePosition(event:MouseEvent, base:Object):Point
+ {
+ var comp:IUIBase = _strand as IUIBase;
+ var pt:Point = new Point(comp.width, comp.height);
+ pt = PointUtils.localToGlobal(pt, comp);
+ return pt;
+ }
+
+ /**
+ * @private
+ */
+ private function rollOutHandler( event:MouseEvent ):void
+ {
+ if (tt) {
+ host.removeElement(tt);
+ }
+ tt = null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/AlertMeasurementBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/AlertMeasurementBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/AlertMeasurementBead.as
new file mode 100644
index 0000000..dbe6c05
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/AlertMeasurementBead.as
@@ -0,0 +1,88 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IMeasurementBead;
+ import org.apache.flex.core.IStrand;
+
+ /**
+ * The AlertMeasureBead class provides boundary measurements for an
+ * org.apache.flex.html.Alert component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class AlertMeasurementBead implements IMeasurementBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function AlertMeasurementBead()
+ {
+ }
+
+ /**
+ * Returns the overall width of the org.apache.flex.html.Alert component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get measuredWidth():Number
+ {
+ return 0;
+ }
+
+ /**
+ * Returns the overall height of the org.apache.flex.html.Alert component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get measuredHeight():Number
+ {
+ return 0;
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/AlertView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/AlertView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/AlertView.as
new file mode 100644
index 0000000..5788d47
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/AlertView.as
@@ -0,0 +1,226 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IAlertModel;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IMeasurementBead;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.html.Alert;
+ import org.apache.flex.html.ControlBar;
+ import org.apache.flex.html.Label;
+ import org.apache.flex.html.TextButton;
+ import org.apache.flex.html.TitleBar;
+ import org.apache.flex.utils.CSSContainerUtils;
+
+ /**
+ * The AlertView class creates the visual elements of the org.apache.flex.html.Alert
+ * component. The job of the view bead is to put together the parts of the Alert, such as the
+ * title bar, message, and various buttons, within the space of the Alert component strand.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class AlertView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function AlertView()
+ {
+ }
+
+ private var _titleBar:TitleBar;
+ private var _controlBar:ControlBar;
+ private var _label:Label;
+ private var _okButton:TextButton;
+ private var _cancelButton:TextButton;
+ private var _yesButton:TextButton;
+ private var _noButton:TextButton;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ var backgroundColor:Object = ValuesManager.valuesImpl.getValue(value, "background-color");
+ var backgroundImage:Object = ValuesManager.valuesImpl.getValue(value, "background-image");
+ if (backgroundColor != null || backgroundImage != null)
+ {
+ if (value.getBeadByType(IBackgroundBead) == null)
+ value.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBackgroundBead")) as IBead);
+ }
+
+ var borderStyle:String;
+ var borderStyles:Object = ValuesManager.valuesImpl.getValue(value, "border");
+ if (borderStyles is Array)
+ {
+ borderStyle = borderStyles[1];
+ }
+ if (borderStyle == null)
+ {
+ borderStyle = ValuesManager.valuesImpl.getValue(value, "border-style") as String;
+ }
+ if (borderStyle != null && borderStyle != "none")
+ {
+ if (value.getBeadByType(IBorderBead) == null)
+ value.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBorderBead")) as IBead);
+ }
+
+ var flags:uint = IAlertModel(UIBase(_strand).model).flags;
+ if( flags & Alert.OK ) {
+ _okButton = new TextButton();
+ _okButton.text = IAlertModel(UIBase(_strand).model).okLabel;
+ _okButton.addEventListener("click",handleOK);
+ }
+ if( flags & Alert.CANCEL ) {
+ _cancelButton = new TextButton();
+ _cancelButton.text = IAlertModel(UIBase(_strand).model).cancelLabel;
+ _cancelButton.addEventListener("click",handleCancel);
+ }
+ if( flags & Alert.YES ) {
+ _yesButton = new TextButton();
+ _yesButton.text = IAlertModel(UIBase(_strand).model).yesLabel;
+ _yesButton.addEventListener("click",handleYes);
+ }
+ if( flags & Alert.NO ) {
+ _noButton = new TextButton();
+ _noButton.text = IAlertModel(UIBase(_strand).model).noLabel;
+ _noButton.addEventListener("click",handleNo);
+ }
+
+ _titleBar = new TitleBar();
+ _titleBar.title = IAlertModel(UIBase(_strand).model).title;
+
+ _label = new Label();
+ _label.text = IAlertModel(UIBase(_strand).model).message;
+
+ _controlBar = new ControlBar();
+ if( _okButton ) _controlBar.addElement(_okButton);
+ if( _cancelButton ) _controlBar.addElement(_cancelButton);
+ if( _yesButton ) _controlBar.addElement(_yesButton);
+ if( _noButton ) _controlBar.addElement(_noButton);
+
+ IParent(_strand).addElement(_titleBar);
+ IParent(_strand).addElement(_controlBar);
+ IParent(_strand).addElement(_label);
+
+ sizeHandler(null);
+ }
+
+ /**
+ * @private
+ */
+ private function sizeHandler(event:Event):void
+ {
+ var labelMeasure:IMeasurementBead = _label.measurementBead;
+ var titleMeasure:IMeasurementBead = _titleBar.measurementBead;
+ var ctrlMeasure:IMeasurementBead = _controlBar.measurementBead;
+ var maxWidth:Number = Math.max(titleMeasure.measuredWidth, ctrlMeasure.measuredWidth, labelMeasure.measuredWidth);
+
+ var metrics:Rectangle = CSSContainerUtils.getBorderAndPaddingMetrics(_strand);
+
+ _titleBar.x = 0;
+ _titleBar.y = 0;
+ _titleBar.width = maxWidth;
+ _titleBar.height = 25;
+ _titleBar.dispatchEvent(new Event("layoutNeeded"));
+
+ // content placement here
+ _label.x = metrics.left;
+ _label.y = _titleBar.y + _titleBar.height + metrics.top;
+ _label.width = maxWidth - metrics.left - metrics.right;
+
+ _controlBar.x = 0;
+ _controlBar.y = _titleBar.height + _label.y + _label.height + metrics.bottom;
+ _controlBar.width = maxWidth;
+ _controlBar.height = 25;
+ _controlBar.dispatchEvent(new Event("layoutNeeded"));
+
+ UIBase(_strand).width = maxWidth;
+ UIBase(_strand).height = _titleBar.height + _label.height + _controlBar.height + metrics.top + metrics.bottom;
+ }
+
+ /**
+ * @private
+ */
+ private function handleOK(event:Event):void
+ {
+ // create some custom event where the detail value
+ // is the OK button flag. Do same for other event handlers
+ dispatchCloseEvent(Alert.OK);
+ }
+
+ /**
+ * @private
+ */
+ private function handleCancel(event:Event):void
+ {
+ dispatchCloseEvent(Alert.CANCEL);
+ }
+
+ /**
+ * @private
+ */
+ private function handleYes(event:Event):void
+ {
+ dispatchCloseEvent(Alert.YES);
+ }
+
+ /**
+ * @private
+ */
+ private function handleNo(event:Event):void
+ {
+ dispatchCloseEvent(Alert.NO);
+ }
+
+ /**
+ * @private
+ */
+ public function dispatchCloseEvent(buttonFlag:uint):void
+ {
+ // TO DO: buttonFlag should be part of the event
+ var newEvent:Event = new Event("close",true);
+ IEventDispatcher(_strand).dispatchEvent(newEvent);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/BackgroundImageBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/BackgroundImageBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/BackgroundImageBead.as
new file mode 100644
index 0000000..8cedc9a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/BackgroundImageBead.as
@@ -0,0 +1,112 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.Bitmap;
+ import flash.display.Loader;
+ import flash.display.LoaderInfo;
+ import flash.display.Sprite;
+ import flash.events.Event;
+ import flash.events.IOErrorEvent;
+ import flash.net.URLRequest;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+
+ /**
+ * The BackgroundImageBead is used to render an image as the background to any component
+ * that supports it, such as Container.
+ *
+ * Note that this bead is for ActionScript only since CSS/HTML allows this just by specifying
+ * a background image in the style selector. To use this bead, place a ClassReference to it
+ * within @media -flex-flash { } group in the CSS declarations.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class BackgroundImageBead implements IBead, IBackgroundBead
+ {
+ /**
+ * Constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function BackgroundImageBead()
+ {
+ backgroundSprite = new Sprite();
+ }
+
+ private var _strand:IStrand;
+ private var backgroundSprite:Sprite;
+ private var bitmap:Bitmap;
+ private var loader:Loader;
+
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ setupBackground(backgroundSprite);
+ }
+
+ /**
+ * @private
+ */
+ private function setupBackground(sprite:Sprite, state:String = null):void
+ {
+ var backgroundImage:Object = ValuesManager.valuesImpl.getValue(_strand, "background-image", state);
+ if (backgroundImage)
+ {
+ loader = new Loader();
+ var url:String = backgroundImage as String;
+ loader.load(new URLRequest(url));
+ loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (e:IOErrorEvent):void {
+ trace(e);
+ e.preventDefault();
+ });
+ loader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, function (e:flash.events.Event):void {
+ var host:UIBase = UIBase(_strand);
+ if (bitmap) {
+ host.removeChild(bitmap);
+ }
+
+ bitmap = Bitmap(LoaderInfo(e.target).content);
+
+ host.addChildAt(bitmap,0);
+
+ if (isNaN(host.explicitWidth) && isNaN(host.percentWidth))
+ host.setWidth(loader.content.width);
+ else
+ bitmap.width = UIBase(_strand).width;
+
+ if (isNaN(host.explicitHeight) && isNaN(host.percentHeight))
+ host.setHeight(loader.content.height);
+ else
+ bitmap.height = UIBase(_strand).height;
+ });
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ButtonBarView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ButtonBarView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ButtonBarView.as
new file mode 100644
index 0000000..cbe0a3e
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ButtonBarView.as
@@ -0,0 +1,69 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.supportClasses.Border;
+
+ /**
+ * The ButtonBarView class creates the visual elements of the org.apache.flex.html.ButtonBar
+ * component. A ButtonBar is a type of List and ButtonBarView extends the ListView bead, adding a border.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ButtonBarView extends ListView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ButtonBarView()
+ {
+ super();
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ super.strand = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CSSButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CSSButtonView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CSSButtonView.as
new file mode 100644
index 0000000..fcd14cc
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CSSButtonView.as
@@ -0,0 +1,167 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.Loader;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+ import flash.display.Sprite;
+ import flash.events.Event;
+ import flash.net.URLRequest;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ITextModel;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.utils.CSSBorderUtils;
+ import org.apache.flex.utils.CSSUtils;
+ import org.apache.flex.utils.StringTrimmer;
+
+ /**
+ * The CSSButtonView class is the default view for
+ * the org.apache.flex.html.Button class.
+ * It allows the look of the button to be expressed
+ * in CSS via the background-image style. This view
+ * does not display text. Use CSSTextButtonView and
+ * TextButton instead.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class CSSButtonView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function CSSButtonView()
+ {
+ upSprite = new Sprite();
+ downSprite = new Sprite();
+ overSprite = new Sprite();
+ }
+
+ private var textModel:ITextModel;
+
+ private var shape:Shape;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, 10, 10);
+ shape.graphics.endFill();
+ SimpleButton(value).upState = upSprite;
+ SimpleButton(value).downState = downSprite;
+ SimpleButton(value).overState = overSprite;
+ SimpleButton(value).hitTestState = shape;
+
+ setupBackground(overSprite, "hover");
+ setupBackground(downSprite, "active");
+ setupBackground(upSprite);
+
+ IEventDispatcher(_strand).addEventListener("widthChanged",sizeChangeHandler);
+ IEventDispatcher(_strand).addEventListener("heightChanged",sizeChangeHandler);
+ }
+
+ private function sizeChangeHandler(event:org.apache.flex.events.Event):void
+ {
+ setupSkins();
+ }
+
+ protected function setupSkins():void
+ {
+ setupSkin(overSprite, "hover");
+ setupSkin(downSprite, "active");
+ setupSkin(upSprite);
+ updateHitArea();
+ }
+
+ private function setupSkin(sprite:Sprite, state:String = null):void
+ {
+ var padding:Object = ValuesManager.valuesImpl.getValue(_strand, "padding", state);
+ var paddingLeft:Object = ValuesManager.valuesImpl.getValue(_strand, "padding-left", state);
+ var paddingRight:Object = ValuesManager.valuesImpl.getValue(_strand, "padding-right", state);
+ var paddingTop:Object = ValuesManager.valuesImpl.getValue(_strand, "padding-top", state);
+ var paddingBottom:Object = ValuesManager.valuesImpl.getValue(_strand, "padding-bottom", state);
+ var pl:Number = CSSUtils.getLeftValue(paddingLeft, padding, DisplayObject(_strand).width);
+ var pr:Number = CSSUtils.getRightValue(paddingRight, padding, DisplayObject(_strand).width);
+ var pt:Number = CSSUtils.getTopValue(paddingTop, padding, DisplayObject(_strand).height);
+ var pb:Number = CSSUtils.getBottomValue(paddingBottom, padding, DisplayObject(_strand).height);
+
+ CSSBorderUtils.draw(sprite.graphics,
+ DisplayObject(_strand).width + pl + pr,
+ DisplayObject(_strand).height + pt + pb,
+ _strand as DisplayObject,
+ state, true);
+ }
+
+ private function setupBackground(sprite:Sprite, state:String = null):void
+ {
+ var backgroundImage:Object = ValuesManager.valuesImpl.getValue(_strand, "background-image", state);
+ if (backgroundImage)
+ {
+ var loader:Loader = new Loader();
+ sprite.addChildAt(loader, 0);
+ var url:String = backgroundImage as String;
+ loader.load(new URLRequest(url));
+ loader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, function (e:flash.events.Event):void {
+ setupSkin(sprite, state);
+ updateHitArea();
+ });
+ }
+ else {
+ setupSkin(sprite, state);
+ updateHitArea();
+ }
+ }
+
+ private var upSprite:Sprite;
+ private var downSprite:Sprite;
+ private var overSprite:Sprite;
+
+ private function updateHitArea():void
+ {
+ shape.graphics.clear();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, upSprite.width, upSprite.height);
+ shape.graphics.endFill();
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CSSImageAndTextButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CSSImageAndTextButtonView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CSSImageAndTextButtonView.as
new file mode 100644
index 0000000..12ac07d
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CSSImageAndTextButtonView.as
@@ -0,0 +1,367 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.Loader;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+ import flash.display.Sprite;
+ import flash.events.Event;
+ import flash.net.URLRequest;
+ import flash.text.TextField;
+ import flash.text.TextFieldType;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.CSSTextField;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.TextButton;
+ import org.apache.flex.html.beads.models.ImageAndTextModel;
+ import org.apache.flex.utils.CSSUtils;
+ import org.apache.flex.utils.SolidBorderUtil;
+ import org.apache.flex.utils.StringTrimmer;
+
+ /**
+ * The CSSTextButtonView class is the default view for
+ * the org.apache.flex.html.TextButton class.
+ * It allows the look of the button to be expressed
+ * in CSS via the background-image style and displays
+ * a text label. This view does not support right-to-left
+ * text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class CSSImageAndTextButtonView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function CSSImageAndTextButtonView()
+ {
+ upSprite = new Sprite();
+ downSprite = new Sprite();
+ overSprite = new Sprite();
+ upTextField = new CSSTextField();
+ downTextField = new CSSTextField();
+ overTextField = new CSSTextField();
+ upTextField.selectable = false;
+ upTextField.type = TextFieldType.DYNAMIC;
+ downTextField.selectable = false;
+ downTextField.type = TextFieldType.DYNAMIC;
+ overTextField.selectable = false;
+ overTextField.type = TextFieldType.DYNAMIC;
+ upTextField.autoSize = "left";
+ downTextField.autoSize = "left";
+ overTextField.autoSize = "left";
+ upSprite.addChild(upTextField);
+ downSprite.addChild(downTextField);
+ overSprite.addChild(overTextField);
+ }
+
+ private var textModel:ImageAndTextModel;
+
+ private var shape:Shape;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ textModel = value.getBeadByType(ImageAndTextModel) as ImageAndTextModel;
+ textModel.addEventListener("textChange", textChangeHandler);
+ textModel.addEventListener("htmlChange", htmlChangeHandler);
+ textModel.addEventListener("imageChange", imageChangeHandler);
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, 10, 10);
+ shape.graphics.endFill();
+ upTextField.styleParent = _strand;
+ downTextField.styleParent = _strand;
+ overTextField.styleParent = _strand;
+ upTextField.parentDrawsBackground = true;
+ downTextField.parentDrawsBackground = true;
+ overTextField.parentDrawsBackground = true;
+ upTextField.parentHandlesPadding = true;
+ downTextField.parentHandlesPadding = true;
+ overTextField.parentHandlesPadding = true;
+ SimpleButton(value).upState = upSprite;
+ SimpleButton(value).downState = downSprite;
+ SimpleButton(value).overState = overSprite;
+ SimpleButton(value).hitTestState = shape;
+ if (textModel.text !== null)
+ text = textModel.text;
+ if (textModel.html !== null)
+ html = textModel.html;
+
+ setupSkins();
+
+ IEventDispatcher(_strand).addEventListener("widthChanged",sizeChangeHandler);
+ IEventDispatcher(_strand).addEventListener("heightChanged",sizeChangeHandler);
+ IEventDispatcher(_strand).addEventListener("sizeChanged",sizeChangeHandler);
+ }
+
+ protected function setupSkins():void
+ {
+ setupSkin(overSprite, overTextField, "hover");
+ setupSkin(downSprite, downTextField, "active");
+ setupSkin(upSprite, upTextField);
+ updateHitArea();
+ }
+
+ private function setupSkin(sprite:Sprite, textField:TextField, state:String = null):void
+ {
+ var sw:uint = DisplayObject(_strand).width;
+ var sh:uint = DisplayObject(_strand).height;
+
+ textField.defaultTextFormat.leftMargin = 0;
+ textField.defaultTextFormat.rightMargin = 0;
+ // set it again so it gets noticed
+ textField.defaultTextFormat = textField.defaultTextFormat;
+
+ var borderColor:uint;
+ var borderThickness:uint;
+ var borderStyle:String;
+ var borderStyles:Object = ValuesManager.valuesImpl.getValue(_strand, "border", state);
+ if (borderStyles is Array)
+ {
+ borderColor = CSSUtils.toColor(borderStyles[2]);
+ borderStyle = borderStyles[1];
+ borderThickness = borderStyles[0];
+ }
+ else if (borderStyles is String)
+ borderStyle = borderStyles as String;
+ var value:Object = ValuesManager.valuesImpl.getValue(_strand, "border-style", state);
+ if (value != null)
+ borderStyle = value as String;
+ value = ValuesManager.valuesImpl.getValue(_strand, "border-color", state);
+ if (value != null)
+ borderColor = CSSUtils.toColor(value);
+ value = ValuesManager.valuesImpl.getValue(_strand, "border-width", state);
+ if (value != null)
+ borderThickness = value as uint;
+ if (borderStyle == "none")
+ {
+ borderStyle = "solid";
+ borderThickness = 0;
+ }
+
+ var borderRadius:String;
+ var borderEllipseWidth:Number = NaN;
+ var borderEllipseHeight:Number = NaN;
+ value = ValuesManager.valuesImpl.getValue(_strand, "border-radius", state);
+ if (value != null)
+ {
+ if (value is Number)
+ borderEllipseWidth = 2 * (value as Number);
+ else
+ {
+ borderRadius = value as String;
+ var arr:Array = StringTrimmer.splitAndTrim(borderRadius, "/");
+ borderEllipseWidth = 2 * CSSUtils.toNumber(arr[0]);
+ if (arr.length > 1)
+ borderEllipseHeight = 2 * CSSUtils.toNumber(arr[1]);
+ }
+ }
+
+ var padding:Object = ValuesManager.valuesImpl.getValue(_strand, "padding", state);
+ var paddingLeft:Object = ValuesManager.valuesImpl.getValue(_strand, "padding-left", state);
+ var paddingRight:Object = ValuesManager.valuesImpl.getValue(_strand, "padding-right", state);
+ var paddingTop:Object = ValuesManager.valuesImpl.getValue(_strand, "padding-top", state);
+ var paddingBottom:Object = ValuesManager.valuesImpl.getValue(_strand, "padding-bottom", state);
+ var pl:Number = CSSUtils.getLeftValue(paddingLeft, padding, DisplayObject(_strand).width);
+ var pr:Number = CSSUtils.getRightValue(paddingRight, padding, DisplayObject(_strand).width);
+ var pt:Number = CSSUtils.getTopValue(paddingTop, padding, DisplayObject(_strand).height);
+ var pb:Number = CSSUtils.getBottomValue(paddingBottom, padding, DisplayObject(_strand).height);
+
+ var backgroundColor:Object = ValuesManager.valuesImpl.getValue(_strand, "background-color", state);
+ var bgColor:uint;
+ var bgAlpha:Number = 1;
+ if (backgroundColor != null)
+ {
+ bgColor = CSSUtils.toColorWithAlpha(backgroundColor);
+ if (bgColor & 0xFF000000)
+ {
+ bgAlpha = bgColor >>> 24 / 255;
+ bgColor = bgColor & 0xFFFFFF;
+ }
+ }
+ if (borderStyle == "solid")
+ {
+ var useWidth:Number = Math.max(sw,textField.textWidth);
+ var useHeight:Number = Math.max(sh,textField.textHeight);
+
+ if ((useWidth-pl-pr-2*borderThickness) < textField.textWidth)
+ useWidth = textField.textWidth+pl+pr+2*borderThickness;
+ if ((useHeight-pt-pb-2*borderThickness) < textField.textHeight)
+ useHeight = textField.textHeight+pt+pb+2*borderThickness;
+
+ sprite.graphics.clear();
+ SolidBorderUtil.drawBorder(sprite.graphics,
+ 0, 0, useWidth, useHeight,
+ borderColor, backgroundColor == null ? null : bgColor, borderThickness, bgAlpha,
+ borderEllipseWidth, borderEllipseHeight);
+ textField.y = ((useHeight - textField.textHeight) / 2) - 2;
+ textField.x = ((useWidth - textField.textWidth) / 2) - 2;
+ }
+ var backgroundImage:Object = image;
+ if (backgroundImage)
+ {
+ var loader:Loader = new Loader();
+ sprite.addChildAt(loader, 0);
+ sprite.addChild(textField);
+ var url:String = backgroundImage as String;
+ loader.load(new URLRequest(url));
+ loader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, function (e:flash.events.Event):void {
+ updateHitArea();
+ loader.x = pl;
+ textField.x = loader.width + pl;
+ textField.y = pt;
+ loader.y = (textField.height + pt + pb - loader.height) / 2;
+ sprite.graphics.clear();
+ SolidBorderUtil.drawBorder(sprite.graphics,
+ 0, 0, textField.x + textField.width + pr + borderThickness,
+ textField.y + textField.height + pb + borderThickness,
+ borderColor, backgroundColor == null ? null : bgColor, borderThickness, bgAlpha,
+ borderEllipseWidth, borderEllipseHeight);
+ });
+ }
+ var textColor:Object = ValuesManager.valuesImpl.getValue(_strand, "color", state);
+ if (textColor) {
+ textField.textColor = Number(textColor);
+ }
+ }
+
+ private function textChangeHandler(event:org.apache.flex.events.Event):void
+ {
+ text = textModel.text;
+ }
+
+ private function htmlChangeHandler(event:org.apache.flex.events.Event):void
+ {
+ html = textModel.html;
+ }
+
+ private function sizeChangeHandler(event:org.apache.flex.events.Event):void
+ {
+ setupSkins();
+ }
+
+ private var upTextField:CSSTextField;
+ private var downTextField:CSSTextField;
+ private var overTextField:CSSTextField;
+ private var upSprite:Sprite;
+ private var downSprite:Sprite;
+ private var overSprite:Sprite;
+
+ /**
+ * The URL of an icon to use in the button
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get image():String
+ {
+ return textModel.image;
+ }
+
+ private function imageChangeHandler(event:org.apache.flex.events.Event):void
+ {
+ setupSkins();
+ }
+
+ /**
+ * The text to be displayed in the button
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ return upTextField.text;
+ }
+
+ /**
+ * @private
+ */
+ public function set text(value:String):void
+ {
+ upTextField.text = value;
+ downTextField.text = value;
+ overTextField.text = value;
+ updateHitArea();
+ }
+
+ private function updateHitArea():void
+ {
+ var useWidth:uint = Math.max(DisplayObject(_strand).width, upTextField.textWidth);
+ var useHeight:uint = Math.max(DisplayObject(_strand).height, upTextField.textHeight);
+
+ shape.graphics.clear();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, useWidth, useHeight);
+ shape.graphics.endFill();
+
+ }
+
+ /**
+ * The html-formatted text to be displayed in the button
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get html():String
+ {
+ return upTextField.htmlText;
+ }
+
+ /**
+ * @private
+ */
+ public function set html(value:String):void
+ {
+ upTextField.htmlText = value;
+ downTextField.htmlText = value;
+ overTextField.htmlText = value;
+ }
+ }
+}
[41/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - clean
build after merge and fork
Posted by ah...@apache.org.
clean build after merge and fork
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/fdc2a4c2
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/fdc2a4c2
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/fdc2a4c2
Branch: refs/heads/refactor-sprite
Commit: fdc2a4c2386494f980d35ba7091a9d7f345ddcb1
Parents: ef2b90a
Author: Alex Harui <ah...@apache.org>
Authored: Mon Oct 31 21:42:38 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 08:12:11 2016 -0700
----------------------------------------------------------------------
frameworks/build.xml | 2 +-
.../Basic/src/main/flex/BasicClasses.as | 5 +-
.../flex/org/apache/flex/core/Application.as | 46 ++--
.../org/apache/flex/core/FilledRectangle.as | 2 +-
.../org/apache/flex/core/HTMLElementWrapper.as | 265 +++++++++++++++++++
.../main/flex/org/apache/flex/core/ImageBase.as | 84 ++++++
.../main/flex/org/apache/flex/core/UIBase.as | 51 +++-
.../flex/org/apache/flex/core/UIButtonBase.as | 17 +-
.../src/main/flex/org/apache/flex/html/Image.as | 8 +-
.../org/apache/flex/html/beads/ComboBoxView.as | 3 +-
.../org/apache/flex/html/beads/ContainerView.as | 11 +-
.../apache/flex/html/beads/DropDownListView.as | 3 +-
.../org/apache/flex/html/beads/ImageView.as | 181 +------------
.../apache/flex/html/beads/SliderThumbView.as | 2 +-
.../apache/flex/html/beads/WebBrowserView.as | 2 +-
.../flex/html/beads/layouts/HorizontalLayout.as | 3 +-
.../apache/flex/html/beads/models/ImageModel.as | 12 +-
.../html/supportClasses/ContainerContentArea.as | 5 +-
.../flex/html/supportClasses/DataGroup.as | 5 +-
.../html/supportClasses/ScrollingViewport.as | 5 +-
.../supportClasses/TextFieldItemRenderer.as | 16 ++
.../flex/org/apache/flex/svg/BinaryImage.as | 87 ++++++
.../org/apache/flex/svg/GraphicContainer.as | 4 +-
.../flex/org/apache/flex/svg/GraphicShape.as | 6 +-
.../src/main/flex/org/apache/flex/svg/Image.as | 133 ++++++++++
.../flex/org/apache/flex/svg/beads/ImageView.as | 87 ++++++
.../projects/Core/src/main/flex/CoreClasses.as | 7 +
.../flex/org/apache/flex/core/IFlexJSElement.as | 4 +-
.../flex/org/apache/flex/core/ImageViewBase.as | 23 +-
.../org/apache/flex/core/WrappedMovieClip.as | 6 +-
.../flex/org/apache/flex/core/WrappedShape.as | 6 +-
.../org/apache/flex/core/WrappedSimpleButton.as | 6 +-
.../flex/org/apache/flex/core/WrappedSprite.as | 6 +-
.../org/apache/flex/core/WrappedTextField.as | 6 +-
.../projects/HTML/src/main/flex/HTMLClasses.as | 5 +-
.../flex/org/apache/flex/core/Application.as | 4 +-
.../main/flex/org/apache/flex/core/UIBase.as | 3 +-
37 files changed, 847 insertions(+), 274 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/build.xml b/frameworks/build.xml
index 65d06f7..ec3b6ff 100644
--- a/frameworks/build.xml
+++ b/frameworks/build.xml
@@ -81,7 +81,6 @@
<antcall target="Graphics"/>
<antcall target="Binding"/>
<antcall target="Collections"/>
- <antcall target="Basic"/>
<antcall target="HTML"/>
<antcall target="Flat"/>
<antcall target="Charts"/>
@@ -97,6 +96,7 @@
<antcall target="Reflection"/>
<antcall target="Storage"/>
<antcall target="XML"/>
+ <antcall target="Basic"/>
</target>
<target name="fonts">
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/BasicClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/BasicClasses.as b/frameworks/projects/Basic/src/main/flex/BasicClasses.as
index e63e9de..69fb902 100644
--- a/frameworks/projects/Basic/src/main/flex/BasicClasses.as
+++ b/frameworks/projects/Basic/src/main/flex/BasicClasses.as
@@ -54,7 +54,7 @@ internal class BasicClasses
import org.apache.flex.html.beads.DropDownListView; DropDownListView;
import org.apache.flex.html.beads.CloseButtonView; CloseButtonView;
import org.apache.flex.html.beads.ImageAndTextButtonView; ImageAndTextButtonView;
- import org.apache.flex.html.beads.ImageView; ImageView;
+ import org.apache.flex.html.beads.ImageView; org.apache.flex.html.beads.ImageView;
}
import org.apache.flex.html.beads.ImageButtonView; ImageButtonView;
import org.apache.flex.html.beads.ListView; ListView;
@@ -194,6 +194,9 @@ internal class BasicClasses
import org.apache.flex.svg.Rect; Rect;
import org.apache.flex.svg.Ellipse; Ellipse;
import org.apache.flex.svg.Circle; Circle;
+ import org.apache.flex.svg.Image; Image;
+ import org.apache.flex.svg.BinaryImage; BinaryImage;
+ import org.apache.flex.svg.beads.ImageView; org.apache.flex.svg.beads.ImageView;
import org.apache.flex.svg.Path; Path;
import org.apache.flex.svg.Text; Text;
import org.apache.flex.svg.CompoundGraphic; CompoundGraphic;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Application.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Application.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Application.as
index 85609cb..81c2855 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Application.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Application.as
@@ -21,9 +21,6 @@ package org.apache.flex.core
import org.apache.flex.events.Event;
import org.apache.flex.events.IEventDispatcher;
import org.apache.flex.events.MouseEvent;
- COMPILE::SWF {
- import org.apache.flex.events.utils.MouseEventConverter;
- }
import org.apache.flex.utils.MXMLDataInterpreter;
import org.apache.flex.utils.Timer;
@@ -36,6 +33,7 @@ package org.apache.flex.core
import flash.events.Event;
import flash.system.ApplicationDomain;
import flash.utils.getQualifiedClassName;
+ import org.apache.flex.events.utils.MouseEventConverter;
}
//--------------------------------------
@@ -416,21 +414,26 @@ package org.apache.flex.core
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.IUIBase
+ * @flexjsignorecoercion HTMLElement
*/
- public function addElement(c:Object, dispatchEvent:Boolean = true):void
+ public function addElement(c:IChild, dispatchEvent:Boolean = true):void
{
COMPILE::SWF {
if (c is IUIBase)
{
- addChild(IUIBase(c).element as DisplayObject);
+ if (c is IRenderedObject)
+ addChild(IRenderedObject(c).$displayObject);
+ else
+ addChild(c as DisplayObject);
IUIBase(c).addedToParent();
}
else
addChild(c as DisplayObject);
}
COMPILE::JS {
- this.element.appendChild(c.element);
- c.addedToParent();
+ this.element.appendChild(c.element as HTMLElement);
+ (c as IUIBase).addedToParent();
}
}
@@ -441,13 +444,17 @@ package org.apache.flex.core
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.IUIBase
*/
- public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
{
COMPILE::SWF {
if (c is IUIBase)
{
- addChildAt(IUIBase(c).element as DisplayObject, index);
+ if (c is IRenderedObject)
+ addChildAt(IRenderedObject(c).$displayObject, index);
+ else
+ addChildAt(c as DisplayObject, index);
IUIBase(c).addedToParent();
}
else
@@ -461,7 +468,7 @@ package org.apache.flex.core
{
element.insertBefore(c.positioner,
children[index]);
- c.addedToParent();
+ (c as IUIBase).addedToParent();
}
}
@@ -475,10 +482,10 @@ package org.apache.flex.core
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public function getElementAt(index:int):Object
+ public function getElementAt(index:int):IChild
{
COMPILE::SWF {
- return getChildAt(index);
+ return getChildAt(index) as IChild;
}
COMPILE::JS {
var children:NodeList = internalChildren();
@@ -494,11 +501,11 @@ package org.apache.flex.core
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public function getElementIndex(c:Object):int
+ public function getElementIndex(c:IChild):int
{
COMPILE::SWF {
- if (c is IUIBase)
- return getChildIndex(IUIBase(c).element as DisplayObject);
+ if (c is IRenderedObject)
+ return getChildIndex(IRenderedObject(c).$displayObject);
return getChildIndex(c as DisplayObject);
}
@@ -521,19 +528,20 @@ package org.apache.flex.core
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
+ * @flexjsignorecoercion HTMLElement
*/
- public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+ public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
{
COMPILE::SWF {
- if (c is IUIBase)
+ if (c is IRenderedObject)
{
- removeChild(IUIBase(c).element as DisplayObject);
+ removeChild(IRenderedObject(c).$displayObject);
}
else
removeChild(c as DisplayObject);
}
COMPILE::JS {
- element.removeChild(c.element);
+ element.removeChild(c.element as HTMLElement);
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/FilledRectangle.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/FilledRectangle.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/FilledRectangle.as
index 962a11d..1068363 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/FilledRectangle.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/FilledRectangle.as
@@ -51,7 +51,7 @@ package org.apache.flex.core
COMPILE::SWF
{
_shape = new flash.display.Shape();
- this.addElement(_shape);
+ this.addChild(_shape);
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/HTMLElementWrapper.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/HTMLElementWrapper.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/HTMLElementWrapper.as
new file mode 100644
index 0000000..57e4ce3
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/HTMLElementWrapper.as
@@ -0,0 +1,265 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ COMPILE::SWF
+ {
+ import flash.display.Sprite;
+ }
+
+ COMPILE::JS
+ {
+ import window.Event;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.BrowserEvent;
+ import org.apache.flex.events.ElementEvents;
+ import org.apache.flex.events.EventDispatcher;
+ import goog.events;
+ import goog.events.EventTarget;
+ }
+
+ COMPILE::SWF
+ public class HTMLElementWrapper extends Sprite
+ {
+ /**
+ * "abstract" method so we can override in JS
+ * @param bead The new bead.
+ */
+ public function addBead(bead:IBead):void
+ {
+ }
+ }
+
+ COMPILE::JS
+ public class HTMLElementWrapper extends EventDispatcher implements IStrand
+ {
+
+ //--------------------------------------
+ // Static Function
+ //--------------------------------------
+
+ /**
+ * @param listener The listener object to call {goog.events.Listener}.
+ * @param eventObject The event object to pass to the listener.
+ * @return Result of listener.
+ */
+ static public function fireListenerOverride(listener:Object, eventObject:BrowserEvent):Boolean
+ {
+ var e:BrowserEvent = new BrowserEvent();
+ e.wrappedEvent = eventObject;
+ return HTMLElementWrapper.googFireListener(listener, e);
+ }
+
+ /**
+ * Static initializer
+ */
+ static public function installOverride():Boolean
+ {
+ HTMLElementWrapper.googFireListener = goog.events.fireListener;
+ goog.events.fireListener = HTMLElementWrapper.fireListenerOverride;
+ return true;
+ }
+
+ //--------------------------------------
+ // Static Property
+ //--------------------------------------
+
+ static public var googFireListener:Function;
+
+ /**
+ * The properties that triggers the static initializer.
+ * Note, in JS, this property has to be declared
+ * after the installOverride.
+ */
+ static public var installedOverride:Boolean = installOverride();
+
+ //--------------------------------------
+ // Property
+ //--------------------------------------
+
+ private var _element:WrappedHTMLElement;
+
+ public function get element():WrappedHTMLElement
+ {
+ return _element;
+ }
+
+ public function set element(value:WrappedHTMLElement):void
+ {
+ _element = value;
+ }
+
+ /**
+ * allow access from overrides
+ */
+ protected var _model:IBeadModel;
+
+ /**
+ * @flexjsignorecoercion Class
+ * @flexjsignorecoercion org.apache.flex.core.IBeadModel
+ */
+ public function get model():Object
+ {
+ if (_model == null)
+ {
+ // addbead will set _model
+ var m:Class = org.apache.flex.core.ValuesManager.valuesImpl.
+ getValue(this, 'iBeadModel') as Class;
+ var b:IBeadModel = new m() as IBeadModel;
+ addBead(b);
+ }
+ return _model;
+ }
+
+ public function set model(value:Object):void
+ {
+ if (_model != value)
+ {
+ addBead(value as IBead);
+ dispatchEvent(new org.apache.flex.events.Event("modelChanged"));
+ }
+ }
+
+ protected var _beads:Vector.<IBead>;
+
+ //--------------------------------------
+ // Function
+ //--------------------------------------
+
+ /**
+ * @param bead The new bead.
+ */
+ public function addBead(bead:IBead):void
+ {
+ if (!_beads)
+ {
+ _beads = new Vector.<IBead>();
+ }
+
+ _beads.push(bead);
+
+ if (bead is IBeadModel)
+ {
+ _model = bead as IBeadModel;
+ }
+
+ bead.strand = this;
+ }
+
+ /**
+ * @param classOrInterface The requested bead type.
+ * @return The bead.
+ */
+ public function getBeadByType(classOrInterface:Class):IBead
+ {
+ var bead:IBead, i:uint, n:uint;
+
+ if (!_beads) return null;
+
+ n = _beads.length;
+
+ for (i = 0; i < n; i++)
+ {
+ bead = _beads[i];
+
+ if (bead is classOrInterface)
+ {
+ return bead;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @param bead The bead to remove.
+ * @return The bead.
+ */
+ public function removeBead(bead:IBead):IBead
+ {
+ var i:uint, n:uint, value:Object;
+
+ n = _beads.length;
+
+ for (i = 0; i < n; i++)
+ {
+ value = _beads[i];
+
+ if (bead === value)
+ {
+ _beads.splice(i, 1);
+
+ return bead;
+ }
+ }
+
+ return null;
+ }
+
+ override public function addEventListener(type:String, handler:Function, opt_capture:Boolean = false, opt_handlerScope:Object = null):void
+ {
+ var source:Object = getActualDispatcher_(type);
+ goog.events.listen(source, type, handler);
+ }
+
+ override public function removeEventListener(type:String, handler:Function, opt_capture:Boolean = false, opt_handlerScope:Object = null):void
+ {
+ var source:Object = getActualDispatcher_(type);
+ goog.events.unlisten(source, type, handler);
+ }
+
+ private function getActualDispatcher_(type:String):Object
+ {
+ var source:Object = this;
+ if (ElementEvents.elementEvents[type]) {
+ // mouse and keyboard events also dispatch off the element.
+ source = this.element;
+ }
+ return source;
+ }
+
+ override public function hasEventListener(type:String):Boolean
+ {
+ var source:Object = this.getActualDispatcher_(type);
+
+ return goog.events.hasListener(source, type);
+ }
+
+ override public function dispatchEvent(e:Object):Boolean
+ {
+ var t:String;
+ if (typeof(e) === 'string') {
+ t = e as String;
+ if (e === 'change')
+ e = new window.Event(t);
+ }
+ else {
+ t = e.type;
+ if (ElementEvents.elementEvents[t]) {
+ e = new window.Event(t);
+ }
+ }
+ var source:Object = this.getActualDispatcher_(t);
+ if (source == this)
+ return super.dispatchEvent(e);
+
+ return source.dispatchEvent(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ImageBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ImageBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ImageBase.as
new file mode 100644
index 0000000..71454a7
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ImageBase.as
@@ -0,0 +1,84 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ import org.apache.flex.core.IImage;
+ import org.apache.flex.core.IImageModel;
+ import org.apache.flex.core.UIBase;
+
+ /**
+ * The ImageBase class serves as a base class for components that displays a bitmap. The Image uses
+ * the following beads:
+ *
+ * org.apache.flex.core.IBeadModel: the data model for the Image, including the url/binary property.
+ * org.apache.flex.core.IBeadView: constructs the visual elements of the component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ImageBase extends UIBase implements IImage
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ImageBase()
+ {
+ super();
+ }
+
+ /**
+ * The location of the bitmap, usually a URL.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.IImageModel
+ */
+ public function get url():String
+ {
+ return (model as IImageModel).url;
+ }
+ public function set url(value:String):void
+ {
+ (model as IImageModel).url = value;
+ }
+
+ COMPILE::JS
+ public function get imageElement():Element
+ {
+ return null;
+ // override this
+ }
+
+ COMPILE::JS
+ public function applyImageData(binaryDataAsString:String):void
+ {
+ // override this
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as
index 300b008..dc2b774 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as
@@ -165,6 +165,20 @@ package org.apache.flex.core
}
}
+ COMPILE::SWF
+ public function get $displayObject():DisplayObject
+ {
+ return this;
+ }
+
+ public function get flexjs_wrapper():Object
+ {
+ return this;
+ }
+ public function set flexjs_wrapper(value:Object):void
+ {
+ }
+
private var _explicitWidth:Number;
/**
@@ -1091,7 +1105,10 @@ package org.apache.flex.core
{
if (c is IUIBase)
{
- addChild(IUIBase(c).element as DisplayObject);
+ if (c is IRenderedObject)
+ addChild(IRenderedObject(c).$displayObject);
+ else
+ addChild(c as DisplayObject);
IUIBase(c).addedToParent();
}
else
@@ -1118,7 +1135,10 @@ package org.apache.flex.core
{
if (c is IUIBase)
{
- addChildAt(IUIBase(c).element as DisplayObject, index);
+ if (c is IRenderedObject)
+ addChildAt(IUIBase(c).$displayObject, index);
+ else
+ addChildAt(c as DisplayObject, index);
IUIBase(c).addedToParent();
}
else
@@ -1150,7 +1170,7 @@ package org.apache.flex.core
{
COMPILE::SWF
{
- return getChildAt(index);
+ return getChildAt(index) as IChild;
}
COMPILE::JS
{
@@ -1171,8 +1191,8 @@ package org.apache.flex.core
{
COMPILE::SWF
{
- if (c is IUIBase)
- return getChildIndex(IUIBase(c).element as DisplayObject);
+ if (c is IRenderedObject)
+ return getChildIndex(IRenderedObject(c).$displayObject);
else
return getChildIndex(c as DisplayObject);
}
@@ -1201,8 +1221,8 @@ package org.apache.flex.core
{
COMPILE::SWF
{
- if (c is IUIBase)
- removeChild(IUIBase(c).element as DisplayObject);
+ if (c is IRenderedObject)
+ removeChild(IRenderedObject(c).$displayObject);
else
removeChild(c as DisplayObject);
}
@@ -1471,15 +1491,26 @@ package org.apache.flex.core
/**
* @param value The event containing new style properties.
* @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- * @flexjsignorecoercion org.apache.flex.core.IUIBase
+ * @flexjsignorecoercion org.apache.flex.core.IParent
*/
COMPILE::JS
- public function get parent():IUIBase
+ public function get parent():IParent
{
var p:WrappedHTMLElement = this.positioner.parentNode as WrappedHTMLElement;
- var wrapper:IUIBase = p ? p.flexjs_wrapper as IUIBase : null;
+ var wrapper:IParent = p ? p.flexjs_wrapper as IParent : null;
return wrapper;
}
+ COMPILE::SWF
+ public function get transformElement():IFlexJSElement
+ {
+ return this;
+ }
+
+ COMPILE::JS
+ public function get transformElement():WrappedHTMLElement
+ {
+ return element;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIButtonBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIButtonBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIButtonBase.as
index d158665..d9615f1 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIButtonBase.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIButtonBase.as
@@ -75,7 +75,22 @@ package org.apache.flex.core
// mouseEnabled = true;
MouseEventConverter.setupInstanceConverters(this);
}
-
+
+ COMPILE::SWF
+ public function get $displayObject():DisplayObject
+ {
+ return this;
+ }
+
+ public function get flexjs_wrapper():Object
+ {
+ return this;
+ }
+ public function set flexjs_wrapper(value:Object):void
+ {
+
+ }
+
private var _x:Number;
/**
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Image.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Image.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Image.as
index 0a42d2a..e815a59 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Image.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Image.as
@@ -63,13 +63,13 @@ package org.apache.flex.html
* @productversion FlexJS 0.0
* @flexjsignorecoercion org.apache.flex.core.IImageModel
*/
- public function get source():String
+ public function get url():String
{
- return (model as IImageModel).source;
+ return (model as IImageModel).url;
}
- public function set source(value:String):void
+ public function set url(value:String):void
{
- (model as IImageModel).source = value;
+ (model as IImageModel).url = value;
}
/**
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ComboBoxView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ComboBoxView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ComboBoxView.as
index e725517..83c261a 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ComboBoxView.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ComboBoxView.as
@@ -24,6 +24,7 @@ package org.apache.flex.html.beads
import org.apache.flex.core.BeadViewBase;
import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IChild;
import org.apache.flex.core.IComboBoxModel;
import org.apache.flex.core.IPopUpHost;
import org.apache.flex.core.IStrand;
@@ -218,7 +219,7 @@ package org.apache.flex.html.beads
while (host && !(host is IPopUpHost))
host = host.parent;
if (host)
- IPopUpHost(host).addElement(popUp);
+ IPopUpHost(host).addElement(popUp as IChild);
}
else
{
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ContainerView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ContainerView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ContainerView.as
index 0c6696a..d62e799 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ContainerView.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ContainerView.as
@@ -23,6 +23,7 @@ package org.apache.flex.html.beads
import org.apache.flex.core.IBead;
import org.apache.flex.core.IBeadLayout;
import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IChild;
import org.apache.flex.core.IContainer;
import org.apache.flex.core.IContainerView;
import org.apache.flex.core.IContentViewHost;
@@ -143,7 +144,7 @@ package org.apache.flex.html.beads
/**
* @private
*/
- public function addElement(c:Object, dispatchEvent:Boolean = true):void
+ public function addElement(c:IChild, dispatchEvent:Boolean = true):void
{
contentView.addElement(c, dispatchEvent);
}
@@ -151,7 +152,7 @@ package org.apache.flex.html.beads
/**
* @private
*/
- public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
{
contentView.addElementAt(c, index, dispatchEvent);
}
@@ -159,7 +160,7 @@ package org.apache.flex.html.beads
/**
* @private
*/
- public function getElementIndex(c:Object):int
+ public function getElementIndex(c:IChild):int
{
return contentView.getElementIndex(c);
}
@@ -167,7 +168,7 @@ package org.apache.flex.html.beads
/**
* @private
*/
- public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+ public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
{
contentView.removeElement(c, dispatchEvent);
}
@@ -183,7 +184,7 @@ package org.apache.flex.html.beads
/**
* @private
*/
- public function getElementAt(index:int):Object
+ public function getElementAt(index:int):IChild
{
return contentView.getElementAt(index);
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DropDownListView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DropDownListView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DropDownListView.as
index 1334227..d3d7ebd 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DropDownListView.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DropDownListView.as
@@ -29,6 +29,7 @@ package org.apache.flex.html.beads
import org.apache.flex.core.BeadViewBase;
import org.apache.flex.core.CSSTextField;
import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IChild;
import org.apache.flex.core.IPopUpHost;
import org.apache.flex.core.ISelectionModel;
import org.apache.flex.core.IStrand;
@@ -287,7 +288,7 @@ package org.apache.flex.html.beads
while (host && !(host is IPopUpHost))
host = host.parent;
if (host)
- IPopUpHost(host).addElement(popUp);
+ IPopUpHost(host).addElement(popUp as IChild);
}
else
{
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ImageView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ImageView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ImageView.as
index 652392a..8c20686 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ImageView.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ImageView.as
@@ -18,27 +18,7 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.flex.html.beads
{
- COMPILE::SWF
- {
- import flash.display.Bitmap;
- import flash.display.Loader;
- import flash.display.LoaderInfo;
- import flash.events.IOErrorEvent;
- import flash.net.URLRequest;
- }
- COMPILE::JS
- {
- import goog.events;
- }
-
- import org.apache.flex.core.BeadViewBase;
- import org.apache.flex.core.IBeadView;
- import org.apache.flex.core.IImageModel;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.IUIBase;
- import org.apache.flex.core.UIBase;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.core.ImageViewBase;
/**
* The ImageView class creates the visual elements of the org.apache.flex.html.Image component.
@@ -48,7 +28,7 @@ package org.apache.flex.html.beads
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public class ImageView extends BeadViewBase implements IBeadView
+ public class ImageView extends ImageViewBase
{
/**
* constructor.
@@ -62,162 +42,5 @@ package org.apache.flex.html.beads
{
}
- COMPILE::SWF
- private var bitmap:Bitmap;
- COMPILE::SWF
- private var loader:Loader;
-
- private var _model:IImageModel;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function set strand(value:IStrand):void
- {
- super.strand = value;
-
- COMPILE::SWF
- {
- IEventDispatcher(_strand).addEventListener("widthChanged",handleSizeChange);
- IEventDispatcher(_strand).addEventListener("heightChanged",handleSizeChange);
- }
-
- _model = value.getBeadByType(IImageModel) as IImageModel;
- _model.addEventListener("urlChanged",handleUrlChange);
-
- handleUrlChange(null);
- }
-
- /**
- * @private
- */
- private function handleUrlChange(event:Event):void
- {
- COMPILE::SWF
- {
- if (_model.source) {
- loader = new Loader();
- loader.contentLoaderInfo.addEventListener("complete",onComplete);
- loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (e:IOErrorEvent):void {
- trace(e);
- e.preventDefault();
- });
- loader.load(new URLRequest(_model.source));
- }
- }
- COMPILE::JS
- {
- if (_model.source) {
- var host:IUIBase = _strand as IUIBase;
- host.element.addEventListener('load',
- loadHandler, false);
- host.addEventListener('sizeChanged',
- sizeChangedHandler);
- (host.element as HTMLImageElement).src = _model.source;
- }
- }
- }
-
- /**
- * @private
- */
- COMPILE::SWF
- private function onComplete(event:Object):void
- {
- var host:UIBase = UIBase(_strand);
- if (bitmap) {
- host.removeChild(bitmap);
- }
-
- bitmap = Bitmap(LoaderInfo(event.target).content);
-
- host.addChild(bitmap);
-
- if (host.isWidthSizedToContent())
- {
- host.dispatchEvent(new Event("widthChanged"));
- if (host.parent)
- host.parent.dispatchEvent(new Event("layoutNeeded"));
- }
- else
- bitmap.width = UIBase(_strand).width;
-
- if (host.isHeightSizedToContent())
- {
- host.dispatchEvent(new Event("heightChanged"));
- if (host.parent)
- host.parent.dispatchEvent(new Event("layoutNeeded"));
- }
- else
- bitmap.height = UIBase(_strand).height;
-
- }
-
- /**
- * @private
- */
- COMPILE::SWF
- private function handleSizeChange(event:Object):void
- {
- var host:UIBase = UIBase(_strand);
- if (bitmap) {
- if (!isNaN(host.explicitWidth) || !isNaN(host.percentWidth))
- bitmap.width = UIBase(_strand).width;
- if (!isNaN(host.explicitHeight) || !isNaN(host.percentHeight))
- bitmap.height = UIBase(_strand).height;
- }
- }
-
- COMPILE::JS
- private function loadHandler(event:Object):void
- {
- var host:UIBase = UIBase(_strand);
- host.parent.dispatchEvent(new Event("layoutNeeded"));
- }
-
- /**
- * @flexjsignorecoercion HTMLElement
- */
- COMPILE::JS
- private function sizeChangedHandler(event:Object):void
- {
- var host:UIBase = _strand as UIBase;
- var s:Object = host.positioner.style;
- var l:Number = NaN;
- var ls:String = s.left;
- if (typeof(ls) === 'string' && ls.length > 0)
- l = parseFloat(ls.substring(0, ls.length - 2));
- var r:Number = NaN;
- var rs:String = s.right;
- if (typeof(rs) === 'string' && rs.length > 0)
- r = parseFloat(rs.substring(0, rs.length - 2));
- if (!isNaN(l) &&
- !isNaN(r)) {
- // if just using size constraints and image will not shrink or grow
- var computedWidth:Number = (host.positioner.offsetParent as HTMLElement).offsetWidth -
- l - r;
- s.width = computedWidth.toString() + 'px';
- }
- var t:Number = NaN;
- var ts:String = s.top;
- if (typeof(ts) === 'string' && ts.length > 0)
- t = parseFloat(ts.substring(0, ts.length - 2));
- var b:Number = NaN;
- var bs:String = s.right;
- if (typeof(bs) === 'string' && bs.length > 0)
- b = parseFloat(bs.substring(0, bs.length - 2));
- if (!isNaN(t) &&
- !isNaN(b)) {
- // if just using size constraints and image will not shrink or grow
- var computedHeight:Number = (host.positioner.offsetParent as HTMLElement).offsetHeight -
- t - b;
- s.height = computedHeight.toString() + 'px';
- }
- }
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SliderThumbView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SliderThumbView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SliderThumbView.as
index 2e99eef..e9b4ea5 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SliderThumbView.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SliderThumbView.as
@@ -124,7 +124,7 @@ package org.apache.flex.html.beads
element.style.top = '-10px';
element.style.left = '20px';
- host.element.appendChild(element);
+ (host.element as WrappedHTMLElement).appendChild(element);
element.flexjs_wrapper = this;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/WebBrowserView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/WebBrowserView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/WebBrowserView.as
index 63d04e2..276a8d6 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/WebBrowserView.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/WebBrowserView.as
@@ -94,7 +94,7 @@ package org.apache.flex.html.beads
loader.y = 0;
loader.width = host.width;
loader.height = host.height;
- (host as UIBase).addElement(loader);
+ (host as UIBase).addChild(loader);
}
/**
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as
index 225e0ac..501799f 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as
@@ -73,13 +73,14 @@ package org.apache.flex.html.beads.layouts
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
+ * @flexjsignorecoercion HTMLElement
*/
public function set strand(value:IStrand):void
{
host = value as ILayoutChild;
COMPILE::JS
{
- (value as IUIBase).element.style.display = 'block';
+ ((value as IUIBase).element as HTMLElement).style.display = 'block';
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ImageModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ImageModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ImageModel.as
index 7742c2b..c4f110f 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ImageModel.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ImageModel.as
@@ -62,7 +62,7 @@ package org.apache.flex.html.beads.models
_strand = value;
}
- private var _source:String;
+ private var _url:String;
/**
* The source of the image.
@@ -74,14 +74,14 @@ package org.apache.flex.html.beads.models
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public function get source():String
+ public function get url():String
{
- return _source;
+ return _url;
}
- public function set source(value:String):void
+ public function set url(value:String):void
{
- if (value != _source) {
- _source = value;
+ if (value != _url) {
+ _url = value;
dispatchEvent( new Event("urlChanged") );
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ContainerContentArea.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ContainerContentArea.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ContainerContentArea.as
index 46426cd..6e1bb69 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ContainerContentArea.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ContainerContentArea.as
@@ -21,6 +21,7 @@ package org.apache.flex.html.supportClasses
import org.apache.flex.core.IContentView;
import org.apache.flex.core.UIBase;
import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
/**
* The ContainerContentArea class implements the contentView for
@@ -50,8 +51,8 @@ package org.apache.flex.html.supportClasses
private function forwardEventHandler(event:Event):void
{
- if (parent)
- parent.dispatchEvent(event);
+ if (parent is IEventDispatcher)
+ (parent as IEventDispatcher).dispatchEvent(event);
}
/**
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGroup.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGroup.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGroup.as
index 15b6587..f7ebf01 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGroup.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGroup.as
@@ -18,6 +18,7 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.flex.html.supportClasses
{
+ import org.apache.flex.core.IChild;
import org.apache.flex.core.IContentView;
import org.apache.flex.core.IItemRenderer;
import org.apache.flex.core.IItemRendererParent;
@@ -58,7 +59,7 @@ package org.apache.flex.html.supportClasses
/**
* @private
*/
- override public function addElement(c:Object, dispatchEvent:Boolean = true):void
+ override public function addElement(c:IChild, dispatchEvent:Boolean = true):void
{
super.addElement(c, dispatchEvent);
@@ -72,7 +73,7 @@ package org.apache.flex.html.supportClasses
/**
* @private
*/
- override public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+ override public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
{
super.removeElement(c, dispatchEvent);
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
index d7c8d71..46ba9a6 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
@@ -137,11 +137,14 @@ package org.apache.flex.html.supportClasses
}
}
+ /**
+ * @flexjsignorecoercion HTMLElement
+ */
COMPILE::JS
override public function set strand(value:IStrand):void
{
super.strand = value;
- contentView.element.style.overflow = 'auto';
+ (contentView.element as HTMLElement).style.overflow = 'auto';
}
private var viewportWidth:Number;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as
index 5908d73..f370476 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as
@@ -18,6 +18,7 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.flex.html.supportClasses
{
+ import flash.display.DisplayObject;
import flash.text.TextFieldType;
import org.apache.flex.core.CSSTextField;
@@ -69,6 +70,21 @@ package org.apache.flex.html.supportClasses
private var _explicitWidth:Number;
+ COMPILE::SWF
+ public function get $displayObject():DisplayObject
+ {
+ return this;
+ }
+
+ public function get flexjs_wrapper():Object
+ {
+ return this;
+ }
+ public function set flexjs_wrapper(value:Object):void
+ {
+
+ }
+
/**
* The explicitly set width (as opposed to measured width
* or percentage width).
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/BinaryImage.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/BinaryImage.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/BinaryImage.as
new file mode 100644
index 0000000..c03793c
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/BinaryImage.as
@@ -0,0 +1,87 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.svg
+{
+ import org.apache.flex.core.IBinaryImage;
+ import org.apache.flex.core.IBinaryImageModel;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.core.IBinaryImageLoader;
+ import org.apache.flex.utils.BinaryData;
+
+ /**
+ * The Image class is a component that displays a bitmap. The Image uses
+ * the following beads:
+ *
+ * org.apache.flex.core.IBeadModel: the data model for the Image, including the url/binary property.
+ * org.apache.flex.core.IBeadView: constructs the visual elements of the component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class BinaryImage extends Image implements IBinaryImage
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function BinaryImage()
+ {
+ super();
+ }
+
+ override public function addedToParent():void
+ {
+ var c:Class = ValuesManager.valuesImpl.getValue(this, "iBinaryImageLoader") as Class;
+ if (c)
+ {
+ if (c)
+ {
+ var loader:IBinaryImageLoader = (new c()) as IBinaryImageLoader;
+ addBead(loader);
+ }
+ }
+ super.addedToParent();
+ }
+
+ /**
+ * The binary bitmap data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.IImageModel
+ */
+ public function get binary():BinaryData
+ {
+ return (model as IBinaryImageModel).binary;
+ }
+ public function set binary(value:BinaryData):void
+ {
+ (model as IBinaryImageModel).binary = value;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicContainer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicContainer.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicContainer.as
index 48c51d1..b25ebf2 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicContainer.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicContainer.as
@@ -26,7 +26,7 @@ package org.apache.flex.svg
[DefaultProperty("mxmlContent")]
COMPILE::SWF
- public class GraphicContainer extends ContainerBase implements ITransformHost
+ public class GraphicContainer extends ContainerBase
{
public function GraphicContainer()
{
@@ -41,7 +41,7 @@ package org.apache.flex.svg
}
COMPILE::JS
- public class GraphicContainer extends UIBase implements ITransformHost, IContainer
+ public class GraphicContainer extends UIBase implements IContainer
{
private var graphicGroup:ContainerBase;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicShape.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicShape.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicShape.as
index c2baa41..dc3f4a3 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicShape.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicShape.as
@@ -102,7 +102,7 @@ package org.apache.flex.svg
{
if(stroke)
{
- stroke.apply(this);
+ stroke.apply(graphics);
}
}
@@ -111,7 +111,7 @@ package org.apache.flex.svg
{
if(fill)
{
- fill.begin(this, targetBounds,targetOrigin);
+ fill.begin(graphics, targetBounds,targetOrigin);
}
}
@@ -120,7 +120,7 @@ package org.apache.flex.svg
{
if(fill)
{
- fill.end(this);
+ fill.end(graphics);
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Image.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Image.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Image.as
new file mode 100644
index 0000000..cd0729f
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/Image.as
@@ -0,0 +1,133 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flex.svg
+{
+ import org.apache.flex.core.ImageBase;
+
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+ public class Image extends ImageBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.7
+ */
+ public function Image()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as WrappedHTMLElement;
+ element.flexjs_wrapper = this;
+ element.setAttribute('x', 0);
+ element.setAttribute('y', 0);
+ //element.offsetParent = null;
+ positioner = element;
+ positioner.style.position = 'relative';
+ addImageElement();
+ return element;
+ }
+
+ COMPILE::JS
+ protected var _image:WrappedHTMLElement;
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ protected function addImageElement():void
+ {
+ if (_image == null) {
+ _image = document.createElementNS('http://www.w3.org/2000/svg', 'image') as WrappedHTMLElement;
+ _image.setAttribute("width", "100%");
+ _image.setAttribute("height", "100%");
+ _image.flexjs_wrapper = this;
+ element.appendChild(_image);
+ }
+ }
+
+ COMPILE::JS
+ override public function get imageElement():Element
+ {
+ return _image;
+ }
+
+ COMPILE::JS
+ override public function get transformElement():WrappedHTMLElement
+ {
+ return _image;
+ }
+
+ COMPILE::JS
+ override public function applyImageData(binaryDataAsString:String):void
+ {
+ (_image as SVGImageElement).setAttributeNS('http://www.w3.org/1999/xlink','href', binaryDataAsString);
+ }
+ COMPILE::JS
+ override public function setWidth(value:Number, noEvent:Boolean=false):void
+ {
+ super.setWidth(value, noEvent);
+ positioner.setAttribute("width", value);
+ }
+
+ COMPILE::JS
+ override public function setHeight(value:Number, noEvent:Boolean=false):void
+ {
+ super.setHeight(value, noEvent);
+ positioner.setAttribute("height", value);
+ }
+
+ COMPILE::JS
+ override public function setX(value:Number):void
+ {
+ super.setX(value);
+ positioner.setAttribute("x", value);
+
+ }
+ COMPILE::JS
+ override public function setY(value:Number):void
+ {
+ super.setY(value);
+ positioner.setAttribute("y", value);
+
+ }
+
+ COMPILE::JS
+ override public function set x(value:Number):void
+ {
+ super.x = value;
+ positioner.setAttribute("x", value);
+ }
+
+ COMPILE::JS
+ override public function set y(value:Number):void
+ {
+ super.y = value;
+ positioner.setAttribute("y", value);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/beads/ImageView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/beads/ImageView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/beads/ImageView.as
new file mode 100644
index 0000000..8cbd789
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/beads/ImageView.as
@@ -0,0 +1,87 @@
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.svg.beads
+{
+ import org.apache.flex.core.ImageViewBase;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ }
+
+ /**
+ * The ImageView class creates the visual elements of the org.apache.flex.svg.Image component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ImageView extends ImageViewBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ImageView()
+ {
+ }
+
+ COMPILE::JS
+ override protected function sizeChangedHandler(event:Object):void
+ {
+ super.sizeChangedHandler(event);
+ var host:UIBase = _strand as UIBase;
+
+ var left:* = ValuesManager.valuesImpl.getValue(host, "left");
+ var right:* = ValuesManager.valuesImpl.getValue(host, "right");
+ var l:Number = isNaN(left) ? NaN : left;
+ var r:Number = isNaN(right) ? NaN : right;
+
+ var top:* = ValuesManager.valuesImpl.getValue(host, "top");
+ var bottom:* = ValuesManager.valuesImpl.getValue(host, "bottom");
+ var t:Number = isNaN(top) ? NaN : top;
+ var b:Number = isNaN(bottom) ? NaN : bottom;
+
+ var p:Object = host.positioner;
+
+ if (!isNaN(l) &&
+ !isNaN(r)) {
+ // if just using size constraints and image will not shrink or grow
+ var computedWidth:Number = (host.positioner.offsetParent as HTMLElement).offsetWidth -
+ l - r;
+ p.setAttribute("width", computedWidth);
+
+ }
+ if (!isNaN(t) &&
+ !isNaN(b)) {
+ // if just using size constraints and image will not shrink or grow
+ var computedHeight:Number = (host.positioner.offsetParent as HTMLElement).offsetHeight -
+ t - b;
+ p.setAttribute("height", computedHeight);
+ }
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Core/src/main/flex/CoreClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/CoreClasses.as b/frameworks/projects/Core/src/main/flex/CoreClasses.as
index 797fafb..aff0dbc 100644
--- a/frameworks/projects/Core/src/main/flex/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/flex/CoreClasses.as
@@ -27,6 +27,7 @@ package {
internal class CoreClasses
{
import org.apache.flex.core.BeadViewBase; BeadViewBase;
+ import org.apache.flex.core.ImageViewBase; ImageViewBase;
import org.apache.flex.core.BrowserWindow; BrowserWindow;
COMPILE::SWF
{
@@ -35,6 +36,11 @@ internal class CoreClasses
import org.apache.flex.core.CSSSprite; CSSSprite;
import org.apache.flex.core.CSSTextField; CSSTextField;
import org.apache.flex.core.StyleableCSSTextField; StyleableCSSTextField;
+ import org.apache.flex.core.WrappedMovieClip; WrappedMovieClip;
+ import org.apache.flex.core.WrappedShape; WrappedShape;
+ import org.apache.flex.core.WrappedSimpleButton; WrappedSimpleButton;
+ import org.apache.flex.core.WrappedSprite; WrappedSprite;
+ import org.apache.flex.core.WrappedTextField; WrappedTextField;
}
import org.apache.flex.core.IBinaryImageLoader; IBinaryImageLoader;
import org.apache.flex.core.ItemRendererClassFactory; ItemRendererClassFactory;
@@ -75,6 +81,7 @@ internal class CoreClasses
import org.apache.flex.core.IParentIUIBase; IParentIUIBase;
import org.apache.flex.core.IPopUp; IPopUp;
import org.apache.flex.core.IRangeModel; IRangeModel;
+ import org.apache.flex.core.ISWFApplication; ISWFApplication;
import org.apache.flex.core.ITransformModel; ITransformModel;
import org.apache.flex.core.ITransformHost; ITransformHost;
import org.apache.flex.core.IRollOverModel; IRollOverModel;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IFlexJSElement.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IFlexJSElement.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IFlexJSElement.as
index 6586fe9..95fe4be 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IFlexJSElement.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IFlexJSElement.as
@@ -33,8 +33,8 @@ package org.apache.flex.core
* @playerversion AIR 2.6
* @productversion FlexJS 0.7
*/
- function get flexjs_wrapper():ElementWrapper;
- function set flexjs_wrapper(value:ElementWrapper):void;
+ function get flexjs_wrapper():Object;
+ function set flexjs_wrapper(value:Object):void;
}
COMPILE::JS
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageViewBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageViewBase.as
index afc7def..f9c4d1c 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageViewBase.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ImageViewBase.as
@@ -23,6 +23,7 @@ package org.apache.flex.core
import flash.display.Bitmap;
import flash.display.Loader;
import flash.display.LoaderInfo;
+ import flash.display.Sprite;
import flash.events.IOErrorEvent;
import flash.net.URLRequest;
}
@@ -34,8 +35,10 @@ package org.apache.flex.core
import org.apache.flex.core.BeadViewBase;
import org.apache.flex.core.IImageModel;
+ import org.apache.flex.core.ILayoutChild;
+ import org.apache.flex.core.IRenderedObject;
import org.apache.flex.core.IStrand;
- import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.IUIBase;
import org.apache.flex.events.Event;
import org.apache.flex.events.IEventDispatcher;
import org.apache.flex.core.IImageView;
@@ -156,14 +159,16 @@ package org.apache.flex.core
COMPILE::SWF
private function onComplete(event:Object):void
{
- var host:UIBase = UIBase(_strand);
+ var host:ILayoutChild = ILayoutChild(_strand);
+ var hostSprite:Sprite = (host as IRenderedObject).$displayObject as Sprite;
+
if (bitmap) {
- host.$sprite.removeChild(bitmap);
+ hostSprite.removeChild(bitmap);
}
bitmap = Bitmap(LoaderInfo(event.target).content);
- host.$sprite.addChild(bitmap);
+ hostSprite.addChild(bitmap);
if (host.isWidthSizedToContent())
{
@@ -191,19 +196,19 @@ package org.apache.flex.core
COMPILE::SWF
private function handleSizeChange(event:Object):void
{
- var host:UIBase = UIBase(_strand);
+ var host:ILayoutChild = ILayoutChild(_strand);
if (bitmap) {
if (!isNaN(host.explicitWidth) || !isNaN(host.percentWidth))
- bitmap.width = UIBase(_strand).width;
+ bitmap.width = IUIBase(_strand).width;
if (!isNaN(host.explicitHeight) || !isNaN(host.percentHeight))
- bitmap.height = UIBase(_strand).height;
+ bitmap.height = IUIBase(_strand).height;
}
}
COMPILE::JS
private function loadHandler(event:Object):void
{
- var host:UIBase = UIBase(_strand);
+ var host:IUIBase = IUIBase(_strand);
IEventDispatcher(host.parent).dispatchEvent(new Event("layoutNeeded"));
}
@@ -213,7 +218,7 @@ package org.apache.flex.core
COMPILE::JS
protected function sizeChangedHandler(event:Object):void
{
- var host:UIBase = _strand as UIBase;
+ var host:IUIBase = _strand as IUIBase;
var s:Object = host.positioner.style;
var l:Number = NaN;
var ls:String = s.left;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedMovieClip.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedMovieClip.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedMovieClip.as
index 1b91d63..c3f9545 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedMovieClip.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedMovieClip.as
@@ -28,7 +28,7 @@ package org.apache.flex.core
COMPILE::SWF
public class WrappedMovieClip extends MovieClip implements IFlexJSElement, IRenderedObject
{
- private var _flexjs_wrapper:ElementWrapper;
+ private var _flexjs_wrapper:Object;
//--------------------------------------
// Property
@@ -42,11 +42,11 @@ package org.apache.flex.core
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public function get flexjs_wrapper():ElementWrapper
+ public function get flexjs_wrapper():Object
{
return _flexjs_wrapper;
}
- public function set flexjs_wrapper(value:ElementWrapper):void
+ public function set flexjs_wrapper(value:Object):void
{
_flexjs_wrapper = value;
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedShape.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedShape.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedShape.as
index 1978fff..10fafd6 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedShape.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedShape.as
@@ -28,7 +28,7 @@ package org.apache.flex.core
COMPILE::SWF
public class WrappedShape extends Shape implements IFlexJSElement, IRenderedObject
{
- private var _flexjs_wrapper:ElementWrapper;
+ private var _flexjs_wrapper:Object;
//--------------------------------------
// Property
@@ -42,11 +42,11 @@ package org.apache.flex.core
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public function get flexjs_wrapper():ElementWrapper
+ public function get flexjs_wrapper():Object
{
return _flexjs_wrapper;
}
- public function set flexjs_wrapper(value:ElementWrapper):void
+ public function set flexjs_wrapper(value:Object):void
{
_flexjs_wrapper = value;
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSimpleButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSimpleButton.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSimpleButton.as
index 557ddf9..6b2411c 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSimpleButton.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSimpleButton.as
@@ -33,7 +33,7 @@ package org.apache.flex.core
}
- private var _flexjs_wrapper:ElementWrapper;
+ private var _flexjs_wrapper:Object;
//--------------------------------------
// Property
@@ -47,11 +47,11 @@ package org.apache.flex.core
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public function get flexjs_wrapper():ElementWrapper
+ public function get flexjs_wrapper():Object
{
return _flexjs_wrapper;
}
- public function set flexjs_wrapper(value:ElementWrapper):void
+ public function set flexjs_wrapper(value:Object):void
{
_flexjs_wrapper = value;
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSprite.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSprite.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSprite.as
index 0fc230b..4f84300 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSprite.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSprite.as
@@ -29,7 +29,7 @@ package org.apache.flex.core
public class WrappedSprite extends Sprite implements IFlexJSElement, IRenderedObject
{
- private var _flexjs_wrapper:ElementWrapper;
+ private var _flexjs_wrapper:Object;
//--------------------------------------
// Property
@@ -43,11 +43,11 @@ package org.apache.flex.core
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public function get flexjs_wrapper():ElementWrapper
+ public function get flexjs_wrapper():Object
{
return _flexjs_wrapper;
}
- public function set flexjs_wrapper(value:ElementWrapper):void
+ public function set flexjs_wrapper(value:Object):void
{
_flexjs_wrapper = value;
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedTextField.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedTextField.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedTextField.as
index ae7faf4..e025646 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedTextField.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedTextField.as
@@ -29,7 +29,7 @@ package org.apache.flex.core
public class WrappedTextField extends TextField implements IFlexJSElement, IRenderedObject
{
- private var _flexjs_wrapper:ElementWrapper;
+ private var _flexjs_wrapper:Object;
//--------------------------------------
// Property
@@ -43,11 +43,11 @@ package org.apache.flex.core
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public function get flexjs_wrapper():ElementWrapper
+ public function get flexjs_wrapper():Object
{
return _flexjs_wrapper;
}
- public function set flexjs_wrapper(value:ElementWrapper):void
+ public function set flexjs_wrapper(value:Object):void
{
_flexjs_wrapper = value;
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/HTMLClasses.as b/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
index b1714ff..6f7db21 100644
--- a/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
+++ b/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
@@ -55,7 +55,7 @@ internal class HTMLClasses
import org.apache.flex.html.beads.CloseButtonView; CloseButtonView;
import org.apache.flex.html.beads.ImageAndTextButtonView; ImageAndTextButtonView;
}
- import org.apache.flex.html.beads.ImageView; ImageView;
+ import org.apache.flex.html.beads.ImageView; org.apache.flex.html.beads.ImageView;
import org.apache.flex.html.beads.BinaryImageLoader; BinaryImageLoader;
import org.apache.flex.html.beads.models.BinaryImageModel; BinaryImageModel;
import org.apache.flex.html.beads.ImageButtonView; ImageButtonView;
@@ -196,6 +196,9 @@ internal class HTMLClasses
import org.apache.flex.svg.Rect; Rect;
import org.apache.flex.svg.Ellipse; Ellipse;
import org.apache.flex.svg.Circle; Circle;
+ import org.apache.flex.svg.Image; Image;
+ import org.apache.flex.svg.BinaryImage; BinaryImage;
+ import org.apache.flex.svg.beads.ImageView; org.apache.flex.svg.beads.ImageView;
import org.apache.flex.svg.Path; Path;
import org.apache.flex.svg.Text; Text;
import org.apache.flex.svg.CompoundGraphic; CompoundGraphic;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as
index f8cbe01..2277802 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as
@@ -21,9 +21,6 @@ package org.apache.flex.core
import org.apache.flex.events.Event;
import org.apache.flex.events.IEventDispatcher;
import org.apache.flex.events.MouseEvent;
- COMPILE::SWF {
- import org.apache.flex.events.utils.MouseEventConverter;
- }
import org.apache.flex.utils.MXMLDataInterpreter;
import org.apache.flex.utils.Timer;
@@ -34,6 +31,7 @@ package org.apache.flex.core
import flash.events.Event;
import flash.system.ApplicationDomain;
import flash.utils.getQualifiedClassName;
+ import org.apache.flex.events.utils.MouseEventConverter;
}
//--------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fdc2a4c2/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as
index ca01f54..5dbea38 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as
@@ -957,8 +957,7 @@ package org.apache.flex.core
{
element.className = value;
}
-
-
+
/**
* @copy org.apache.flex.core.Application#beads
*
[14/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - try to
copy HTML to Basic without losing history
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CSSTextButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CSSTextButtonView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CSSTextButtonView.as
new file mode 100644
index 0000000..3150e7a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CSSTextButtonView.as
@@ -0,0 +1,350 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.Loader;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+ import flash.display.Sprite;
+ import flash.events.Event;
+ import flash.net.URLRequest;
+ import flash.text.TextField;
+ import flash.text.TextFieldType;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.CSSTextField;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ITextModel;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.TextButton;
+ import org.apache.flex.utils.CSSUtils;
+ import org.apache.flex.utils.SolidBorderUtil;
+ import org.apache.flex.utils.StringTrimmer;
+
+ /**
+ * The CSSTextButtonView class is the default view for
+ * the org.apache.flex.html.TextButton class.
+ * It allows the look of the button to be expressed
+ * in CSS via the background-image style and displays
+ * a text label. This view does not support right-to-left
+ * text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class CSSTextButtonView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function CSSTextButtonView()
+ {
+ upSprite = new Sprite();
+ downSprite = new Sprite();
+ overSprite = new Sprite();
+ upTextField = new CSSTextField();
+ downTextField = new CSSTextField();
+ overTextField = new CSSTextField();
+ upTextField.selectable = false;
+ upTextField.type = TextFieldType.DYNAMIC;
+ downTextField.selectable = false;
+ downTextField.type = TextFieldType.DYNAMIC;
+ overTextField.selectable = false;
+ overTextField.type = TextFieldType.DYNAMIC;
+ upTextField.autoSize = "left";
+ downTextField.autoSize = "left";
+ overTextField.autoSize = "left";
+ upSprite.addChild(upTextField);
+ downSprite.addChild(downTextField);
+ overSprite.addChild(overTextField);
+ }
+
+ private var textModel:ITextModel;
+
+ private var shape:Shape;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ textModel = value.getBeadByType(ITextModel) as ITextModel;
+ textModel.addEventListener("textChange", textChangeHandler);
+ textModel.addEventListener("htmlChange", htmlChangeHandler);
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, 10, 10);
+ shape.graphics.endFill();
+ upTextField.styleParent = _strand;
+ downTextField.styleParent = _strand;
+ overTextField.styleParent = _strand;
+ upTextField.parentDrawsBackground = true;
+ downTextField.parentDrawsBackground = true;
+ overTextField.parentDrawsBackground = true;
+ upTextField.parentHandlesPadding = true;
+ downTextField.parentHandlesPadding = true;
+ overTextField.parentHandlesPadding = true;
+ SimpleButton(value).upState = upSprite;
+ SimpleButton(value).downState = downSprite;
+ SimpleButton(value).overState = overSprite;
+ SimpleButton(value).hitTestState = shape;
+ if (textModel.text !== null)
+ text = textModel.text;
+ if (textModel.html !== null)
+ html = textModel.html;
+
+ setupSkins();
+
+ IEventDispatcher(_strand).addEventListener("widthChanged",sizeChangeHandler);
+ IEventDispatcher(_strand).addEventListener("heightChanged",sizeChangeHandler);
+ IEventDispatcher(_strand).addEventListener("sizeChanged",sizeChangeHandler);
+ }
+
+ protected function setupSkins():void
+ {
+ setupSkin(overSprite, overTextField, "hover");
+ setupSkin(downSprite, downTextField, "active");
+ setupSkin(upSprite, upTextField);
+ updateHitArea();
+ }
+
+ private function setupSkin(sprite:Sprite, textField:TextField, state:String = null):void
+ {
+ var sw:uint = DisplayObject(_strand).width;
+ var sh:uint = DisplayObject(_strand).height;
+
+ textField.defaultTextFormat.leftMargin = 0;
+ textField.defaultTextFormat.rightMargin = 0;
+ // set it again so it gets noticed
+ textField.defaultTextFormat = textField.defaultTextFormat;
+
+ var borderColor:uint;
+ var borderThickness:uint;
+ var borderStyle:String;
+ var borderStyles:Object = ValuesManager.valuesImpl.getValue(_strand, "border", state);
+ if (borderStyles is Array)
+ {
+ borderColor = CSSUtils.toColor(borderStyles[2]);
+ borderStyle = borderStyles[1];
+ borderThickness = borderStyles[0];
+ }
+ else if (borderStyles is String)
+ borderStyle = borderStyles as String;
+ var value:Object = ValuesManager.valuesImpl.getValue(_strand, "border-style", state);
+ if (value != null)
+ borderStyle = value as String;
+ value = ValuesManager.valuesImpl.getValue(_strand, "border-color", state);
+ if (value != null)
+ borderColor = CSSUtils.toColor(value);
+ value = ValuesManager.valuesImpl.getValue(_strand, "border-width", state);
+ if (value != null)
+ borderThickness = value as uint;
+ if (borderStyle == "none")
+ {
+ borderStyle = "solid";
+ borderThickness = 0;
+ }
+
+ var borderRadius:String;
+ var borderEllipseWidth:Number = NaN;
+ var borderEllipseHeight:Number = NaN;
+ value = ValuesManager.valuesImpl.getValue(_strand, "border-radius", state);
+ if (value != null)
+ {
+ if (value is Number)
+ borderEllipseWidth = 2 * (value as Number);
+ else
+ {
+ borderRadius = value as String;
+ var arr:Array = StringTrimmer.splitAndTrim(borderRadius, "/");
+ borderEllipseWidth = 2 * CSSUtils.toNumber(arr[0]);
+ if (arr.length > 1)
+ borderEllipseHeight = 2 * CSSUtils.toNumber(arr[1]);
+ }
+ }
+
+ var padding:Object = ValuesManager.valuesImpl.getValue(_strand, "padding", state);
+ var paddingLeft:Object = ValuesManager.valuesImpl.getValue(_strand, "padding-left", state);
+ var paddingRight:Object = ValuesManager.valuesImpl.getValue(_strand, "padding-right", state);
+ var paddingTop:Object = ValuesManager.valuesImpl.getValue(_strand, "padding-top", state);
+ var paddingBottom:Object = ValuesManager.valuesImpl.getValue(_strand, "padding-bottom", state);
+ var pl:Number = CSSUtils.getLeftValue(paddingLeft, padding, DisplayObject(_strand).width);
+ var pr:Number = CSSUtils.getRightValue(paddingRight, padding, DisplayObject(_strand).width);
+ var pt:Number = CSSUtils.getTopValue(paddingTop, padding, DisplayObject(_strand).height);
+ var pb:Number = CSSUtils.getBottomValue(paddingBottom, padding, DisplayObject(_strand).height);
+
+ var backgroundColor:Object = ValuesManager.valuesImpl.getValue(_strand, "background-color", state);
+ var bgColor:uint;
+ var bgAlpha:Number = 1;
+ if (backgroundColor != null)
+ {
+ bgColor = CSSUtils.toColorWithAlpha(backgroundColor);
+ if (bgColor == uint.MAX_VALUE) {
+ bgAlpha = 0
+ }
+ else if (bgColor & 0xFF000000)
+ {
+ bgAlpha = bgColor >>> 24 / 255;
+ bgColor = bgColor & 0xFFFFFF;
+ }
+ }
+ if (borderStyle == "solid")
+ {
+ var useWidth:Number = Math.max(sw,textField.textWidth);
+ var useHeight:Number = Math.max(sh,textField.textHeight);
+
+ if ((useWidth-pl-pr-2*borderThickness) < textField.textWidth)
+ useWidth = textField.textWidth+pl+pr+2*borderThickness;
+ if ((useHeight-pt-pb-2*borderThickness) < textField.textHeight)
+ useHeight = textField.textHeight+pt+pb+2*borderThickness;
+
+ sprite.graphics.clear();
+ SolidBorderUtil.drawBorder(sprite.graphics,
+ 0, 0, useWidth, useHeight,
+ borderColor, backgroundColor == null ? null : bgColor, borderThickness, bgAlpha,
+ borderEllipseWidth, borderEllipseHeight);
+ textField.y = ((useHeight - textField.textHeight) / 2) - 2;
+ textField.x = ((useWidth - textField.textWidth) / 2) - 2;
+ }
+ var backgroundImage:Object = ValuesManager.valuesImpl.getValue(_strand, "background-image", state);
+ if (backgroundImage)
+ {
+ var loader:Loader = new Loader();
+ sprite.addChildAt(loader, 0);
+ var url:String = backgroundImage as String;
+ loader.load(new URLRequest(url));
+ loader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, function (e:flash.events.Event):void {
+ var useWidth:Number = Math.max(sw,textField.textWidth);
+ var useHeight:Number = Math.max(sh,textField.textHeight);
+
+ if ((useWidth-2*Number(padding)-2*borderThickness) < textField.textWidth)
+ useWidth = textField.textWidth+2*Number(padding)+2*borderThickness;
+ if ((useHeight-2*Number(padding)-2*borderThickness) < textField.textHeight)
+ useHeight = textField.textHeight+2*Number(padding)+2*borderThickness;
+
+ textField.y = (useHeight - textField.height) / 2;
+ textField.x = (useWidth - textField.width) / 2;
+ updateHitArea();
+ });
+ }
+ var textColor:Object = ValuesManager.valuesImpl.getValue(_strand, "color", state);
+ if (textColor) {
+ textField.textColor = Number(textColor);
+ }
+ }
+
+ private function textChangeHandler(event:org.apache.flex.events.Event):void
+ {
+ text = textModel.text;
+ }
+
+ private function htmlChangeHandler(event:org.apache.flex.events.Event):void
+ {
+ html = textModel.html;
+ }
+
+ private function sizeChangeHandler(event:org.apache.flex.events.Event):void
+ {
+ setupSkins();
+ }
+
+ private var upTextField:CSSTextField;
+ private var downTextField:CSSTextField;
+ private var overTextField:CSSTextField;
+ private var upSprite:Sprite;
+ private var downSprite:Sprite;
+ private var overSprite:Sprite;
+
+ /**
+ * The text to be displayed in the button
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ return upTextField.text;
+ }
+
+ /**
+ * @private
+ */
+ public function set text(value:String):void
+ {
+ upTextField.text = value;
+ downTextField.text = value;
+ overTextField.text = value;
+ updateHitArea();
+ }
+
+ private function updateHitArea():void
+ {
+ var useWidth:uint = Math.max(DisplayObject(_strand).width, upTextField.textWidth);
+ var useHeight:uint = Math.max(DisplayObject(_strand).height, upTextField.textHeight);
+
+ shape.graphics.clear();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, useWidth, useHeight);
+ shape.graphics.endFill();
+
+ }
+
+ /**
+ * The html-formatted text to be displayed in the button
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get html():String
+ {
+ return upTextField.htmlText;
+ }
+
+ /**
+ * @private
+ */
+ public function set html(value:String):void
+ {
+ upTextField.htmlText = value;
+ downTextField.htmlText = value;
+ overTextField.htmlText = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CSSTextToggleButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CSSTextToggleButtonView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CSSTextToggleButtonView.as
new file mode 100644
index 0000000..7de01ef
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CSSTextToggleButtonView.as
@@ -0,0 +1,105 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IStyleableObject;
+ import org.apache.flex.core.IToggleButtonModel;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The CSSTextToggleButtonView class is the default view for
+ * the org.apache.flex.html.TextToggleButton class.
+ * It allows the look of the button to be expressed
+ * in CSS via the background-image style and displays
+ * a text label. This view does not support right-to-left
+ * text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class CSSTextToggleButtonView extends CSSTextButtonView
+ {
+ /**
+ * The suffix appended to the className when selected.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public static const SELECTED:String = "_Selected";
+
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function CSSTextToggleButtonView()
+ {
+ }
+
+ private var toggleButtonModel:IToggleButtonModel;
+
+ private var _selected:Boolean;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ toggleButtonModel = value.getBeadByType(IToggleButtonModel) as IToggleButtonModel;
+ toggleButtonModel.addEventListener("selectedChange", selectedChangeHandler);
+ }
+
+ private function selectedChangeHandler(event:org.apache.flex.events.Event):void
+ {
+ var className:String = IStyleableObject(_strand).className;
+ if (toggleButtonModel.selected)
+ {
+ if (className.indexOf(SELECTED) == className.length - SELECTED.length)
+ IStyleableObject(_strand).className = className.substring(0, className.length - SELECTED.length);
+ setupSkins();
+ }
+ else
+ {
+ if (className.indexOf(SELECTED) == -1)
+ IStyleableObject(_strand).className += SELECTED;
+ setupSkins();
+ }
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CheckBoxView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CheckBoxView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CheckBoxView.as
new file mode 100644
index 0000000..a04f2bf
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CheckBoxView.as
@@ -0,0 +1,296 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+ import flash.display.Sprite;
+ import flash.text.TextFieldAutoSize;
+ import flash.text.TextFieldType;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.CSSTextField;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IToggleButtonModel;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The CheckBoxView class is the default view for
+ * the org.apache.flex.html.CheckBox class.
+ * It displays a simple checkbox with an 'x' if checked,
+ * and a label on the right. There are no styles or
+ * properties to configure the look of the 'x' or the
+ * position of the label relative to the checkbox as
+ * there are no equivalents in the standard HTML checkbox.
+ *
+ * A more complex CheckBox could implement more view
+ * configuration.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class CheckBoxView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function CheckBoxView()
+ {
+ sprites = [ upSprite = new Sprite(),
+ downSprite = new Sprite(),
+ overSprite = new Sprite(),
+ upAndSelectedSprite = new Sprite(),
+ downAndSelectedSprite = new Sprite(),
+ overAndSelectedSprite = new Sprite() ];
+
+ for each( var s:Sprite in sprites )
+ {
+ var tf:CSSTextField = new CSSTextField();
+ tf.type = TextFieldType.DYNAMIC;
+ tf.autoSize = TextFieldAutoSize.LEFT;
+ tf.name = "textField";
+ var icon:Shape = new Shape();
+ icon.name = "icon";
+ s.addChild(icon);
+ s.addChild(tf);
+ }
+ }
+
+ private var upSprite:Sprite;
+ private var downSprite:Sprite;
+ private var overSprite:Sprite;
+ private var upAndSelectedSprite:Sprite;
+ private var downAndSelectedSprite:Sprite;
+ private var overAndSelectedSprite:Sprite;
+
+ private var sprites:Array;
+
+ private var _toggleButtonModel:IToggleButtonModel;
+
+ // TODO: Can we remove this?
+ private function get toggleButtonModel() : IToggleButtonModel
+ {
+ return _toggleButtonModel;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ _toggleButtonModel = value.getBeadByType(IToggleButtonModel) as IToggleButtonModel;
+ _toggleButtonModel.addEventListener("textChange", textChangeHandler);
+ _toggleButtonModel.addEventListener("htmlChange", htmlChangeHandler);
+ _toggleButtonModel.addEventListener("selectedChange", selectedChangeHandler);
+ if (_toggleButtonModel.text !== null)
+ text = _toggleButtonModel.text;
+
+ layoutControl();
+
+ var hitArea:Shape = new Shape();
+ hitArea.graphics.beginFill(0x000000);
+ hitArea.graphics.drawRect(0,0,upSprite.width, upSprite.height);
+ hitArea.graphics.endFill();
+
+ SimpleButton(value).upState = upSprite;
+ SimpleButton(value).downState = downSprite;
+ SimpleButton(value).overState = overSprite;
+ SimpleButton(value).hitTestState = hitArea;
+
+ if (toggleButtonModel.text !== null)
+ text = toggleButtonModel.text;
+ if (toggleButtonModel.html !== null)
+ html = toggleButtonModel.html;
+ }
+
+ /**
+ * @copy org.apache.flex.html.Label#text
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ var tf:CSSTextField = upSprite.getChildByName('textField') as CSSTextField;
+ return tf.text;
+ }
+
+ /**
+ * @private
+ */
+ public function set text(value:String):void
+ {
+ for each( var s:Sprite in sprites )
+ {
+ var tf:CSSTextField = s.getChildByName('textField') as CSSTextField;
+ tf.text = value;
+ }
+
+ layoutControl();
+ }
+
+ /**
+ * @copy org.apache.flex.html.Label#html
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get html():String
+ {
+ var tf:CSSTextField = upSprite.getChildByName('textField') as CSSTextField;
+ return tf.htmlText;
+ }
+
+ /**
+ * @private
+ */
+ public function set html(value:String):void
+ {
+ for each(var s:Sprite in sprites)
+ {
+ var tf:CSSTextField = s.getChildByName('textField') as CSSTextField;
+ tf.htmlText = value;
+ }
+
+ layoutControl();
+ }
+
+ private function textChangeHandler(event:Event):void
+ {
+ text = toggleButtonModel.text;
+ }
+
+ private function htmlChangeHandler(event:Event):void
+ {
+ html = toggleButtonModel.html;
+ }
+
+ private var _selected:Boolean;
+
+ /**
+ * @copy org.apache.flex.core.IToggleButtonModel#selected
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selected():Boolean
+ {
+ return _selected;
+ }
+
+ /**
+ * @private
+ */
+ public function set selected(value:Boolean):void
+ {
+ _selected = value;
+
+ layoutControl();
+
+ if( value ) {
+ SimpleButton(_strand).upState = upAndSelectedSprite;
+ SimpleButton(_strand).downState = downAndSelectedSprite;
+ SimpleButton(_strand).overState = overAndSelectedSprite;
+
+ } else {
+ SimpleButton(_strand).upState = upSprite;
+ SimpleButton(_strand).downState = downSprite;
+ SimpleButton(_strand).overState = overSprite;
+ }
+ }
+
+ private function selectedChangeHandler(event:Event):void
+ {
+ selected = toggleButtonModel.selected;
+ }
+
+ /**
+ * Display the icon and text label
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function layoutControl() : void
+ {
+ for each(var s:Sprite in sprites)
+ {
+ var icon:Shape = s.getChildByName("icon") as Shape;
+ var tf:CSSTextField = s.getChildByName("textField") as CSSTextField;
+
+ drawCheckBox(icon);
+
+ var mh:Number = Math.max(icon.height,tf.height);
+
+ icon.x = 0;
+ icon.y = (mh - icon.height)/2;
+
+ tf.x = icon.x + icon.width + 1;
+ tf.y = (mh - tf.height)/2;
+ }
+
+ }
+
+ /**
+ * Draw the checkbox
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function drawCheckBox(icon:Shape) : void
+ {
+ icon.graphics.clear();
+ icon.graphics.beginFill(0xf8f8f8);
+ icon.graphics.lineStyle(1,0x808080);
+ icon.graphics.drawRect(0,0,10,10);
+ icon.graphics.endFill();
+
+ if( _toggleButtonModel.selected ) {
+ icon.graphics.lineStyle(2,0);
+ icon.graphics.moveTo(3,4);
+ icon.graphics.lineTo(5,7);
+ icon.graphics.lineTo(9,0);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CloseButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CloseButtonView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CloseButtonView.as
new file mode 100644
index 0000000..7d3fb19
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/CloseButtonView.as
@@ -0,0 +1,101 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.html.Button;
+ import org.apache.flex.html.TitleBar;
+
+ /**
+ * The CloseButtonView class is the view for
+ * the down arrow button in a ScrollBar and other controls.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class CloseButtonView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function CloseButtonView()
+ {
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+
+ drawView(upView.graphics, 0xCCCCCC);
+ drawView(downView.graphics, 0x666666);
+ drawView(overView.graphics, 0x999999);
+ }
+
+ private function drawView(g:Graphics, bgColor:uint):void
+ {
+ g.beginFill(bgColor);
+ g.drawRect(0, 0, 11, 11);
+ g.endFill();
+ g.lineStyle(2);
+ g.moveTo(3,3);
+ g.lineTo(8,8);
+ g.moveTo(3,8);
+ g.lineTo(8,3);
+ }
+
+ private var shape:Shape;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, 11, 11);
+ shape.graphics.endFill();
+ SimpleButton(value).upState = upView;
+ SimpleButton(value).downState = downView;
+ SimpleButton(value).overState = overView;
+ SimpleButton(value).hitTestState = shape;
+ }
+
+ private var upView:Shape;
+ private var downView:Shape;
+ private var overView:Shape;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ComboBoxView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ComboBoxView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ComboBoxView.as
new file mode 100644
index 0000000..e725517
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ComboBoxView.as
@@ -0,0 +1,247 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.DisplayObjectContainer;
+ import flash.display.Sprite;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IComboBoxModel;
+ import org.apache.flex.core.IPopUpHost;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.Button;
+ import org.apache.flex.html.TextInput;
+
+ /**
+ * The ComboBoxView class creates the visual elements of the org.apache.flex.html.ComboBox
+ * component. The job of the view bead is to put together the parts of the ComboBox such as the TextInput
+ * control and org.apache.flex.html.Button to trigger the pop-up.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ComboBoxView extends BeadViewBase implements IBeadView, IComboBoxView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ComboBoxView()
+ {
+ }
+
+ private var textInput:TextInput;
+ private var button:Button;
+ private var selectionModel:IComboBoxModel;
+
+ /**
+ * The value of the TextInput component of the ComboBox.
+ *
+ * @copy org.apache.flex.html.beads.IComboBoxView#text
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ return textInput.text;
+ }
+ public function set text(value:String):void
+ {
+ textInput.text = value;
+ }
+
+ /**
+ * The HTML value of the TextInput component of the ComboBox.
+ *
+ * @copy org.apache.flex.html.beads.IComboBoxView#html
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get html():String
+ {
+ return textInput.html;
+ }
+ public function set html(value:String):void
+ {
+ textInput.html = value;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get strand():IStrand
+ {
+ return _strand;
+ }
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ selectionModel = value.getBeadByType(IComboBoxModel) as IComboBoxModel;
+ selectionModel.addEventListener("selectedIndexChanged", selectionChangeHandler);
+
+ textInput = new TextInput();
+ IParent(strand).addElement(textInput);
+ textInput.width = 100;
+ textInput.height = 18;
+
+ upSprite = new Sprite();
+ drawButton( upSprite, "up", 18, 18 );
+ overSprite = new Sprite();
+ drawButton( overSprite, "over", 18, 18 );
+ downSprite = new Sprite();
+ drawButton( downSprite, "down", 18, 18 );
+
+ button = new Button();
+ button.upState = upSprite;
+ button.overState = overSprite;
+ button.downState = downSprite;
+ DisplayObjectContainer(strand).addChild(button);
+ button.width = 18;
+ button.height = 18;
+ button.x = textInput.width;
+ button.y = textInput.y;
+
+ // listen for events on the text input and modify the list and selection
+ textInput.addEventListener("change", textChangeHandler,false,0,true);
+ }
+
+ private var upSprite:Sprite;
+ private var overSprite:Sprite;
+ private var downSprite:Sprite;
+
+ /**
+ * @private
+ */
+ private function drawButton( sprite:Sprite, mode:String, width:Number, height:Number ) : void
+ {
+ sprite.graphics.clear();
+ sprite.graphics.lineStyle(1,0xFFFFFF);
+ sprite.graphics.drawRect(0, 0, width-1, height-1);
+ sprite.graphics.lineStyle(-1);
+
+ if( mode == "over" ) sprite.graphics.beginFill(0xCCCCCC);
+ else if( mode == "down" ) sprite.graphics.beginFill(0x888888);
+ sprite.graphics.drawRect(0, 0, width-1, height-1);
+ sprite.graphics.endFill();
+
+ sprite.graphics.beginFill(0x333333);
+ sprite.graphics.moveTo(4,4);
+ sprite.graphics.lineTo(width-4,4);
+ sprite.graphics.lineTo(int(width/2),height-4);
+ sprite.graphics.lineTo(4,4);
+ sprite.graphics.endFill();
+ }
+
+ private var _popUp:IStrand;
+
+ /**
+ * The pop-up component that holds the selection list.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get popUp():IStrand
+ {
+ return _popUp;
+ }
+
+ private var _popUpVisible:Boolean;
+
+ /**
+ * This property is true if the pop-up selection list is currently visible.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get popUpVisible():Boolean
+ {
+ return _popUpVisible;
+ }
+ public function set popUpVisible(value:Boolean):void
+ {
+ if (value != _popUpVisible)
+ {
+ _popUpVisible = value;
+ if (value)
+ {
+ if (!_popUp)
+ {
+ var popUpClass:Class = ValuesManager.valuesImpl.getValue(_strand, "iPopUp") as Class;
+ _popUp = new popUpClass() as IStrand;
+ }
+ var root:Object = DisplayObject(_strand).root;
+ var host:DisplayObjectContainer = DisplayObject(_strand).parent;
+ while (host && !(host is IPopUpHost))
+ host = host.parent;
+ if (host)
+ IPopUpHost(host).addElement(popUp);
+ }
+ else
+ {
+ DisplayObject(_popUp).parent.removeChild(_popUp as DisplayObject);
+ }
+ }
+ }
+
+ /**
+ * @private
+ */
+ private function selectionChangeHandler(event:Event):void
+ {
+ text = selectionModel.selectedItem.toString();
+ }
+
+ /**
+ * @private
+ */
+ private function textChangeHandler(event:Event):void
+ {
+ var newEvent:Event = new Event("change");
+ IEventDispatcher(strand).dispatchEvent(newEvent);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ContainerView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ContainerView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ContainerView.as
new file mode 100644
index 0000000..0c6696a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ContainerView.as
@@ -0,0 +1,553 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.ContainerBase;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IContainer;
+ import org.apache.flex.core.IContainerView;
+ import org.apache.flex.core.IContentViewHost;
+ import org.apache.flex.core.ILayoutChild;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.IViewport;
+ import org.apache.flex.core.IViewportModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.geom.Size;
+ import org.apache.flex.html.beads.models.ViewportModel;
+ import org.apache.flex.html.supportClasses.Border;
+ import org.apache.flex.html.supportClasses.ContainerContentArea;
+ import org.apache.flex.html.supportClasses.Viewport;
+ import org.apache.flex.utils.CSSContainerUtils;
+
+ /**
+ * This class creates and manages the contents of a Container. On the ActionScript
+ * side, a Container has a contentView into which the offical children can be
+ * placed. When adding an element that implements IChrome, that element is not
+ * placed into the contentView, but is made a child of the Container directly.
+ *
+ * Containers also have a layout associated with them which controls the size and
+ * placement of the elements in the contentView. When a Container does not have an
+ * explicit size (including a percent size), the content dictates the size of the
+ * Container.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ContainerView extends BeadViewBase implements IBeadView, IContainerView, ILayoutHost
+ {
+ /**
+ * The ContainerView class is the default view for
+ * the org.apache.flex.core.ContainerBase classes.
+ * It lets you use some CSS styles to manage the border, background
+ * and padding around the content area.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ContainerView()
+ {
+ super();
+
+ layoutRunning = false;
+ }
+
+ /**
+ * The sub-element used as the parent of the container's elements. This does not
+ * include the chrome elements.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get contentView():IParentIUIBase
+ {
+ return viewport.contentView as IParentIUIBase;
+ }
+
+ /**
+ * The view that can be resized.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get resizableView():IUIBase
+ {
+ return host;
+ }
+
+ /**
+ * The viewport used to present the content and may display
+ * scroll bars (depending on the actual type of viewport).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function get viewport():IViewport
+ {
+ return _viewport;
+ }
+
+ /**
+ * The data model used by the viewport to determine how it should
+ * present the content area.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get viewportModel():IViewportModel
+ {
+ return _viewportModel;
+ }
+
+ private var _viewportModel:IViewportModel;
+ private var _viewport:IViewport;
+ private var layoutRunning:Boolean;
+
+ /**
+ * @private
+ */
+ public function addElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ contentView.addElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ {
+ contentView.addElementAt(c, index, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function getElementIndex(c:Object):int
+ {
+ return contentView.getElementIndex(c);
+ }
+
+ /**
+ * @private
+ */
+ public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ contentView.removeElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function get numElements():int
+ {
+ return contentView.numElements;
+ }
+
+ /**
+ * @private
+ */
+ public function getElementAt(index:int):Object
+ {
+ return contentView.getElementAt(index);
+ }
+
+ /**
+ * Strand setter.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ super.strand = value;
+
+ createViewport();
+
+ (host as IContentViewHost).strandChildren.addElement(viewport.contentView, false);
+
+ displayBackgroundAndBorder(host as UIBase);
+
+ // listen for initComplete to signal that the strand is set with its size
+ // and beads.
+ host.addEventListener("initComplete", initCompleteHandler);
+ }
+
+ /**
+ * Handles the initComplete event by completing the setup and kicking off the
+ * presentation of the Container.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function initCompleteHandler(event:Event):void
+ {
+ var ilc:ILayoutChild = host as ILayoutChild;
+ // Complete the setup if the height is sized to content or has been explicitly set
+ // and the width is sized to content or has been explicitly set
+ if ((ilc.isHeightSizedToContent() || !isNaN(ilc.explicitHeight)) &&
+ (ilc.isWidthSizedToContent() || !isNaN(ilc.explicitWidth))) {
+ completeSetup();
+
+ var num:Number = contentView.numElements;
+ if (num > 0) performLayout(event);
+ }
+ else {
+ // otherwise, wait until the unknown sizes have been set and then finish
+ host.addEventListener("sizeChanged", deferredSizeHandler);
+ host.addEventListener("widthChanged", deferredSizeHandler);
+ host.addEventListener("heightChanged", deferredSizeHandler);
+ }
+ }
+
+ /**
+ * Handles the case where the size of the host is not immediately known, usually do
+ * to one of its dimensions being indicated as a percent size.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ private function deferredSizeHandler(event:Event):void
+ {
+ host.removeEventListener("sizeChanged", deferredSizeHandler);
+ host.removeEventListener("widthChanged", deferredSizeHandler);
+ host.removeEventListener("heightChanged", deferredSizeHandler);
+ completeSetup();
+
+ var num:Number = contentView.numElements;
+ if (num > 0)
+ {
+ performLayout(event);
+ }
+ }
+
+ /**
+ * Called when the host is ready to complete its setup (usually after its size has been
+ * determined).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function completeSetup():void
+ {
+ // when the first layout is complete, set up listeners for changes
+ // to the childrens' sizes.
+ host.addEventListener("layoutComplete", childrenChangedHandler);
+
+ host.addEventListener("childrenAdded", performLayout);
+ host.addEventListener("layoutNeeded", performLayout);
+ host.addEventListener("widthChanged", resizeHandler);
+ host.addEventListener("heightChanged", resizeHandler);
+ host.addEventListener("sizeChanged", resizeHandler);
+ host.addEventListener("viewCreated", viewCreatedHandler);
+ }
+
+ /**
+ * Handles the viewCreated event by performing the first layout if
+ * there are children already present (ie, from MXML).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function viewCreatedHandler(event:Event):void
+ {
+ if ((host as UIBase).numElements > 0) {
+ performLayout(null);
+ }
+ }
+
+ /**
+ * Calculate the space taken up by non-content children like a TItleBar in a Panel.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function getChromeMetrics():Rectangle
+ {
+ return new Rectangle(0, 0, 0, 0);
+ }
+
+ /**
+ * Creates the Viewport (or ScrollableViewport) through which the content
+ * area is presented.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function createViewport():void
+ {
+ var c:Class;
+ if (viewportModel == null) {
+ _viewportModel = _strand.getBeadByType(IViewportModel) as IViewportModel;
+ if (viewportModel == null) {
+ c = ValuesManager.valuesImpl.getValue(host, "iViewportModel");
+ if (c)
+ {
+ _viewportModel = new c() as IViewportModel;
+ _strand.addBead(_viewportModel);
+ }
+ }
+ }
+
+ if (viewport == null) {
+ _viewport = _strand.getBeadByType(IViewport) as IViewport;
+ if (viewport == null) {
+ c = ValuesManager.valuesImpl.getValue(host, "iViewport");
+ if (c)
+ {
+ _viewport = new c() as IViewport;
+ _strand.addBead(viewport);
+ }
+ }
+ }
+ }
+
+ /**
+ * Positions the viewport, then sets any known sizes of the Viewport prior
+ * to laying out its content.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function layoutViewBeforeContentLayout():void
+ {
+ var host:ILayoutChild = this.host as ILayoutChild;
+ var vm:IViewportModel = viewportModel;
+ vm.borderMetrics = CSSContainerUtils.getBorderMetrics(host);
+ vm.chromeMetrics = getChromeMetrics();
+ viewport.setPosition(vm.borderMetrics.left + vm.chromeMetrics.left,
+ vm.borderMetrics.top + vm.chromeMetrics.top)
+ viewport.layoutViewportBeforeContentLayout(
+ !host.isWidthSizedToContent() ?
+ host.width - vm.borderMetrics.left - vm.borderMetrics.right -
+ vm.chromeMetrics.left - vm.chromeMetrics.right : NaN,
+ !host.isHeightSizedToContent() ?
+ host.height - vm.borderMetrics.top - vm.borderMetrics.bottom -
+ vm.chromeMetrics.top - vm.chromeMetrics.bottom : NaN);
+
+ }
+
+ /**
+ * Executes the layout associated with this container. Once the layout has been
+ * run, it may affect the size of the host or may cause the host to present scroll
+ * bars view its viewport.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function performLayout(event:Event):void
+ {
+ layoutRunning = true;
+
+ layoutViewBeforeContentLayout();
+
+ var host:UIBase = _strand as UIBase;
+
+ var layout:IBeadLayout = _strand.getBeadByType(IBeadLayout) as IBeadLayout;
+ if (layout == null) {
+ var c:Class = ValuesManager.valuesImpl.getValue(host, "iBeadLayout");
+ if (c) {
+ layout = new c() as IBeadLayout;
+ _strand.addBead(layout);
+ }
+ }
+
+ if (layout) {
+ layout.layout();
+ }
+
+ layoutViewAfterContentLayout();
+
+ layoutRunning = false;
+ }
+
+ /**
+ * @private
+ */
+ private var adjusting:Boolean = false;
+
+ /**
+ * Adjusts the size of the host, or adds scrollbars to the viewport, after
+ * the layout has been run.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function layoutViewAfterContentLayout():void
+ {
+ var host:UIBase = _strand as UIBase;
+ var vm:IViewportModel = viewportModel;
+
+ adjusting = true;
+
+ var viewportSize:Size = viewport.layoutViewportAfterContentLayout();
+
+ if (host.isWidthSizedToContent() && host.isHeightSizedToContent()) {
+ host.setWidthAndHeight(viewportSize.width + vm.borderMetrics.left + vm.borderMetrics.right +
+ vm.chromeMetrics.left + vm.chromeMetrics.right,
+ viewportSize.height + vm.borderMetrics.top + vm.borderMetrics.bottom +
+ vm.chromeMetrics.top + vm.chromeMetrics.bottom,
+ false);
+ }
+ else if (!host.isWidthSizedToContent() && host.isHeightSizedToContent())
+ {
+ host.setHeight(viewportSize.height + vm.borderMetrics.top + vm.borderMetrics.bottom +
+ vm.chromeMetrics.top + vm.chromeMetrics.bottom, false);
+ }
+ else if (host.isWidthSizedToContent() && !host.isHeightSizedToContent())
+ {
+ host.setWidth(viewportSize.width + vm.borderMetrics.left + vm.borderMetrics.right +
+ vm.chromeMetrics.left + vm.chromeMetrics.right, false);
+ }
+ adjusting = false;
+ }
+
+ /**
+ * Handles dynamic changes to the host's size by running the layout once
+ * the viewport has been adjusted.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function resizeHandler(event:Event):void
+ {
+ if (!adjusting) {
+ performLayout(event);
+ }
+ }
+
+ /**
+ * Whenever children are added, listeners are added to detect changes
+ * in their size.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function childrenChangedHandler(event:Event):void
+ {
+ var host:UIBase = _strand as UIBase;
+ host.removeEventListener(event.type, childrenChangedHandler);
+
+ var n:Number = contentView.numElements;
+ for (var i:int=0; i < n; i++) {
+ var child:IUIBase = contentView.getElementAt(i) as IUIBase;
+ child.addEventListener("widthChanged", childResizeHandler);
+ child.addEventListener("heightChanged", childResizeHandler);
+ child.addEventListener("sizeChanged", childResizeHandler);
+ }
+ }
+
+ /**
+ * This event handles changes to the size of children of the container by running
+ * the layout again and adjusting the size of the container or viewport as necessary.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function childResizeHandler(event:Event):void
+ {
+ // during this process we don't want the layout to trigger
+ // an endless event chain should any children get resized
+ // by the layout.
+ if (layoutRunning) return;
+ performLayout(event);
+ }
+
+ protected function displayBackgroundAndBorder(host:UIBase) : void
+ {
+ var backgroundColor:Object = ValuesManager.valuesImpl.getValue(host, "background-color");
+ var backgroundImage:Object = ValuesManager.valuesImpl.getValue(host, "background-image");
+ if (backgroundColor != null || backgroundImage != null)
+ {
+ if (host.getBeadByType(IBackgroundBead) == null)
+ var c:Class = ValuesManager.valuesImpl.getValue(host, "iBackgroundBead");
+ if (c) {
+ host.addBead( new c() as IBead );
+ }
+ }
+
+ var borderStyle:String;
+ var borderStyles:Object = ValuesManager.valuesImpl.getValue(host, "border");
+ if (borderStyles is Array)
+ {
+ borderStyle = borderStyles[1];
+ }
+ if (borderStyle == null)
+ {
+ borderStyle = ValuesManager.valuesImpl.getValue(host, "border-style") as String;
+ }
+ if (borderStyle != null && borderStyle != "none")
+ {
+ if (host.getBeadByType(IBorderBead) == null) {
+ c = ValuesManager.valuesImpl.getValue(host, "iBorderBead");
+ if (c) {
+ host.addBead( new c() as IBead );
+ }
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ControlBarMeasurementBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ControlBarMeasurementBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ControlBarMeasurementBead.as
new file mode 100644
index 0000000..18d19dd
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ControlBarMeasurementBead.as
@@ -0,0 +1,116 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObjectContainer;
+
+ import org.apache.flex.core.IMeasurementBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.html.Container;
+
+ /**
+ * The ControlBarMeasurementBead class measures the size of a org.apache.flex.html.ControlBar
+ * component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ControlBarMeasurementBead implements IMeasurementBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ControlBarMeasurementBead()
+ {
+ }
+
+ /**
+ * Returns the overall width of the ControlBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get measuredWidth():Number
+ {
+ // Note: the measurement should problably be done by the ControlBar's layout manager bead
+ // since it would know the arrangement of the items and how far apart they are and if
+ // there are margins and paddings and gaps involved.
+ var mwidth:Number = 0;
+ var container:Container = Container(_strand);
+ var n:int = container.numElements;
+ for(var i:int=0; i < n; i++) {
+ var child:IUIBase = container.getElementAt(i) as IUIBase;
+ if( child == null ) continue;
+ var childMeasure:IMeasurementBead = child.getBeadByType(IMeasurementBead) as IMeasurementBead;
+ if (childMeasure)
+ mwidth += childMeasure.measuredWidth;
+ }
+ return mwidth;
+ }
+
+ /**
+ * Returns the overall height of the ControlBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get measuredHeight():Number
+ {
+ // Note: the measurement should problably be done by the ControlBar's layout manager bead
+ // since it would know the arrangement of the items and how far apart they are and if
+ // there are margins and paddings and gaps involved.
+ var mheight:Number = 0;
+ var n:int = DisplayObjectContainer(_strand).numChildren;
+ for(var i:int=0; i < n; i++) {
+ var child:IUIBase = DisplayObjectContainer(_strand).getChildAt(i) as IUIBase;
+ if( child == null ) continue;
+ var childMeasure:IMeasurementBead = child.getBeadByType(IMeasurementBead) as IMeasurementBead;
+ mheight += childMeasure.measuredHeight;
+ }
+ return mheight;
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataGridColumnView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataGridColumnView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataGridColumnView.as
new file mode 100644
index 0000000..7efa3ee
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataGridColumnView.as
@@ -0,0 +1,101 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.html.supportClasses.DataGridColumn;
+
+ /**
+ * The DataGridColumnView class extends org.apache.flex.html.beads.ListView and
+ * provides properties to the org.apache.flex.html.List that makes a column in
+ * the org.apache.flex.html.DataGrid.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataGridColumnView extends ListView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGridColumnView()
+ {
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ }
+
+ private var _columnIndex:uint;
+
+ /**
+ * The zero-based index for the column.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get columnIndex():uint
+ {
+ return _columnIndex;
+ }
+ public function set columnIndex(value:uint):void
+ {
+ _columnIndex = value;
+ }
+
+ private var _column:DataGridColumn;
+
+ /**
+ * The org.apache.flex.html.support.DataGridColumn containing information used to
+ * present the org.apache.flex.html.List as a column in the
+ * org.apache.flex.html.DataGrid.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get column():DataGridColumn
+ {
+ return _column;
+ }
+ public function set column(value:DataGridColumn):void
+ {
+ _column = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataGridLinesBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataGridLinesBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataGridLinesBead.as
new file mode 100644
index 0000000..951f5f7
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataGridLinesBead.as
@@ -0,0 +1,199 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.collections.ArrayList;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IDataGridModel;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.svg.CompoundGraphic;
+ import org.apache.flex.graphics.IStroke;
+ import org.apache.flex.graphics.SolidColor;
+ import org.apache.flex.graphics.SolidColorStroke;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.beads.models.DataGridPresentationModel;
+ import org.apache.flex.html.supportClasses.DataGridColumn;
+
+ /**
+ * The DataGridLinesBead is an add on bead for the DataGrid. This bead
+ * adds horizontal and vertical grid lines to a DataGrid. The size and
+ * color of the lines is specified by the stroke property (defaults to
+ * a thin dark line).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataGridLinesBead implements IBead
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGridLinesBead()
+ {
+ // Set default separator line stroke.
+ var lineStroke:SolidColorStroke = new SolidColorStroke();
+ lineStroke.color = 0x333333;
+ lineStroke.alpha = 1.0;
+ lineStroke.weight = 1;
+ stroke = lineStroke;
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.UIBase#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ _overlay = new CompoundGraphic();
+
+ IEventDispatcher(_strand).addEventListener("beadsAdded", handleBeadsAdded);
+ }
+
+ private var _stroke:IStroke;
+
+ /**
+ * Describes the line style used to separate the rows and columns.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get stroke():IStroke
+ {
+ return _stroke;
+ }
+ public function set stroke(value:IStroke):void
+ {
+ _stroke = value;
+ }
+
+ private var _overlay:CompoundGraphic;
+ private var _area:UIBase;
+
+ /**
+ * Invoked when all of the beads have been added to the DataGrid. This
+ * function seeks the Container that parents the lists that are the DataGrid's
+ * columns. An overlay GraphicContainer is added to this Container so that the
+ * grid lines will scroll with the rows.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ private function handleBeadsAdded(event:Event):void
+ {
+ var host:UIBase = _strand as UIBase;
+ var n:int = host.numElements;
+ for (var i:int=0; i < n; i++) {
+ var child:UIBase = host.getElementAt(i) as UIBase;
+ if (child.id == "dataGridListArea") {
+ _area = child;
+ _area.addElement(_overlay);
+ break;
+ }
+ }
+
+ // Now set up listeners to handle changes in the size of the DataGrid.
+ IEventDispatcher(_strand).addEventListener("sizeChanged", drawLines);
+ IEventDispatcher(_strand).addEventListener("widthChanged", drawLines);
+ IEventDispatcher(_strand).addEventListener("heightChanged", drawLines);
+
+ // Also set up a listener on the model to know when the dataProvider has
+ // changed which might affect the number of rows/columns and thus the
+ // grid lines.
+ var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel;
+ IEventDispatcher(model).addEventListener("dataProviderChanged", drawLines);
+ }
+
+ /**
+ * This event handler is invoked whenever something happens to the DataGrid. This
+ * function draws the lines either using a default stroke or the one specified by
+ * the stroke property.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ private function drawLines(event:Event):void
+ {
+ var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
+ var presentationModel:DataGridPresentationModel = _strand.getBeadByType(DataGridPresentationModel) as DataGridPresentationModel;
+ var layoutParent:ILayoutHost = _area.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase;
+
+ var columns:Array = sharedModel.columns;
+ var arrayList:ArrayList = sharedModel.dataProvider as ArrayList;
+ var rowHeight:Number = presentationModel.rowHeight;
+
+ var totalHeight:Number = arrayList.length * rowHeight;
+ var columnWidth:Number = _area.width / columns.length;
+
+ // translate the stroke to a fill since rectangles are used for the grid
+ // lines and not lines.
+ var lineFill:SolidColor = new SolidColor();
+ var weight:Number = 1;
+ lineFill.color = (stroke as SolidColorStroke).color;
+ lineFill.alpha = (stroke as SolidColorStroke).alpha;
+ weight = (stroke as SolidColorStroke).weight;
+ _overlay.fill = lineFill;
+
+ columnWidth = (columns[0] as DataGridColumn).columnWidth;
+ var xpos:Number = isNaN(columnWidth) ? _area.width / columns.length : columnWidth;
+
+ _overlay.clear();
+
+ // draw the verticals
+ for (var i:int=1; i < columns.length; i++) {
+ _overlay.drawRect(xpos, 0, weight, totalHeight);
+ columnWidth = (columns[i] as DataGridColumn).columnWidth;
+ xpos += isNaN(columnWidth) ? _area.width / columns.length : columnWidth;
+ }
+
+ var n:int = arrayList.length;
+
+ // draw the horizontals
+ for (i=1; i < n+1; i++) {
+ _overlay.drawRect(0, i*rowHeight, _area.width, weight);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataGridView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataGridView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataGridView.as
new file mode 100644
index 0000000..8393057
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataGridView.as
@@ -0,0 +1,266 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IDataGridModel;
+ import org.apache.flex.core.ISelectableItemRenderer;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.DataGridButtonBar;
+ import org.apache.flex.html.Container;
+ import org.apache.flex.html.beads.layouts.ButtonBarLayout;
+ import org.apache.flex.html.beads.layouts.VerticalLayout;
+ import org.apache.flex.html.beads.layouts.HorizontalLayout;
+ import org.apache.flex.html.beads.layouts.IDataGridLayout;
+ import org.apache.flex.html.beads.models.ArraySelectionModel;
+ import org.apache.flex.html.beads.models.DataGridPresentationModel;
+ import org.apache.flex.html.supportClasses.DataGridColumn;
+ import org.apache.flex.html.supportClasses.DataGridColumnList;
+ import org.apache.flex.html.supportClasses.ScrollingViewport;
+ import org.apache.flex.html.supportClasses.Viewport;
+
+ /**
+ * The DataGridView class is the visual bead for the org.apache.flex.html.DataGrid.
+ * This class constructs the items that make the DataGrid: Lists for each column and a
+ * org.apache.flex.html.ButtonBar for the column headers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataGridView implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGridView()
+ {
+ }
+
+ private var _strand:IStrand;
+ private var _header:DataGridButtonBar;
+ private var _listArea:Container;
+
+ private var _lists:Array;
+
+ /**
+ * An array of List objects the comprise the columns of the DataGrid.
+ */
+ public function get columnLists():Array
+ {
+ return _lists;
+ }
+
+ /**
+ * The area used to hold the columns
+ *
+ */
+ public function get listArea():Container
+ {
+ return _listArea;
+ }
+
+ /**
+ * @private
+ */
+ public function get host():IUIBase
+ {
+ return _strand as IUIBase;
+ }
+
+ /**
+ * Returns the component used as the header for the DataGrid.
+ */
+ public function get header():IUIBase
+ {
+ return _header;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ var host:UIBase = value as UIBase;
+
+ _header = new DataGridButtonBar();
+ _header.id = "dataGridHeader";
+
+ var scrollPort:ScrollingViewport = new ScrollingViewport();
+
+ _listArea = new Container();
+ _listArea.id = "dataGridListArea";
+ _listArea.className = "DataGridListArea";
+ _listArea.addBead(scrollPort);
+
+ if (_strand.getBeadByType(IBeadLayout) == null) {
+ var c:Class = ValuesManager.valuesImpl.getValue(host, "iBeadLayout");
+ if (c)
+ {
+ var layout:IBeadLayout = new c() as IBeadLayout;
+ _strand.addBead(layout);
+ }
+ }
+
+ finishSetup(null);
+ }
+
+ /**
+ * @private
+ */
+ private function finishSetup(event:Event):void
+ {
+ var host:UIBase = _strand as UIBase;
+
+ // see if there is a presentation model already in place. if not, add one.
+ var presentationModel:DataGridPresentationModel = _strand.getBeadByType(DataGridPresentationModel) as DataGridPresentationModel;
+ if (presentationModel == null) {
+ presentationModel = new DataGridPresentationModel();
+ _strand.addBead(presentationModel);
+ }
+
+ var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
+ IEventDispatcher(sharedModel).addEventListener("dataProviderChanged",handleDataProviderChanged);
+
+ var columnLabels:Array = new Array();
+
+ for(var i:int=0; i < sharedModel.columns.length; i++) {
+ var dgc:DataGridColumn = sharedModel.columns[i] as DataGridColumn;
+ columnLabels.push(dgc.label);
+ }
+
+ var bblayout:ButtonBarLayout = new ButtonBarLayout();
+ var buttonBarModel:ArraySelectionModel = new ArraySelectionModel();
+ buttonBarModel.dataProvider = columnLabels;
+
+ _header.addBead(buttonBarModel);
+ _header.addBead(bblayout);
+ _header.addBead(new Viewport());
+ host.addElement(_header);
+
+ host.addElement(_listArea);
+
+ handleDataProviderChanged(event);
+ }
+
+ /**
+ * @private
+ */
+ private function handleSizeChanges(event:Event):void
+ {
+ var layoutBead:IDataGridLayout = _strand.getBeadByType(IBeadLayout) as IDataGridLayout;
+ layoutBead.header = _header;
+ layoutBead.columns = _lists;
+ layoutBead.listArea = _listArea;
+ layoutBead.layout();
+ }
+
+ /**
+ * @private
+ */
+ private function handleDataProviderChanged(event:Event):void
+ {
+ var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
+
+ if (_lists == null || _lists.length == 0) {
+ createLists();
+ }
+
+ for (var i:int=0; i < _lists.length; i++)
+ {
+ var list:DataGridColumnList = _lists[i] as DataGridColumnList;
+ var listModel:ISelectionModel = list.getBeadByType(IBeadModel) as ISelectionModel;
+ listModel.dataProvider = sharedModel.dataProvider;
+ }
+
+ host.dispatchEvent(new Event("layoutNeeded"));
+ }
+
+ /**
+ * @private
+ */
+ private function handleColumnListChange(event:Event):void
+ {
+ var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
+ var list:DataGridColumnList = event.target as DataGridColumnList;
+ sharedModel.selectedIndex = list.selectedIndex;
+
+ for(var i:int=0; i < _lists.length; i++) {
+ if (list != _lists[i]) {
+ var otherList:DataGridColumnList = _lists[i] as DataGridColumnList;
+ otherList.selectedIndex = list.selectedIndex;
+ }
+ }
+
+ host.dispatchEvent(new Event('change'));
+ }
+
+ /**
+ * @private
+ */
+ private function createLists():void
+ {
+ var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
+ var presentationModel:DataGridPresentationModel = _strand.getBeadByType(DataGridPresentationModel) as DataGridPresentationModel;
+ var listWidth:Number = host.width / sharedModel.columns.length;
+
+ _lists = new Array();
+
+ for (var i:int=0; i < sharedModel.columns.length; i++) {
+ var dataGridColumn:DataGridColumn = sharedModel.columns[i] as DataGridColumn;
+
+ var list:DataGridColumnList = new DataGridColumnList();
+ list.id = "dataGridColumn"+String(i);
+ list.addBead(sharedModel);
+ list.itemRenderer = dataGridColumn.itemRenderer;
+ list.labelField = dataGridColumn.dataField;
+ list.addEventListener('change',handleColumnListChange);
+ list.addBead(presentationModel);
+
+ _listArea.addElement(list);
+ _lists.push(list);
+ }
+
+ host.dispatchEvent(new Event("layoutNeeded"));
+ }
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as
new file mode 100644
index 0000000..fdfd9b3
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as
@@ -0,0 +1,176 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IDataProviderItemRendererMapper;
+ import org.apache.flex.core.IItemRendererClassFactory;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.IListPresentationModel;
+ import org.apache.flex.core.ISelectableItemRenderer;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.SimpleCSSStyles;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.ItemRendererEvent;
+ import org.apache.flex.html.List;
+
+ [Event(name="itemRendererCreated",type="org.apache.flex.events.ItemRendererEvent")]
+
+ /**
+ * The DataItemRendererFactoryForArrayData class reads an
+ * array of data and creates an item renderer for every
+ * item in the array. Other implementations of
+ * IDataProviderItemRendererMapper map different data
+ * structures or manage a virtual set of renderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataItemRendererFactoryForArrayData extends EventDispatcher implements IBead, IDataProviderItemRendererMapper
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataItemRendererFactoryForArrayData(target:Object=null)
+ {
+ super(target);
+ }
+
+ private var selectionModel:ISelectionModel;
+
+ private var labelField:String;
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ IEventDispatcher(value).addEventListener("beadsAdded",finishSetup);
+ IEventDispatcher(value).addEventListener("initComplete",finishSetup);
+ }
+
+ private function finishSetup(event:Event):void
+ {
+ selectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ var listView:IListView = _strand.getBeadByType(IListView) as IListView;
+ dataGroup = listView.dataGroup;
+ selectionModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
+
+ labelField = (listView.host as List).labelField;
+
+ if (!itemRendererFactory)
+ {
+ _itemRendererFactory = new (ValuesManager.valuesImpl.getValue(_strand, "iItemRendererClassFactory")) as IItemRendererClassFactory;
+ _strand.addBead(_itemRendererFactory);
+ }
+
+ dataProviderChangeHandler(null);
+ }
+
+ private var _itemRendererFactory:IItemRendererClassFactory;
+
+ /**
+ * The org.apache.flex.core.IItemRendererClassFactory used
+ * to generate instances of item renderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRendererFactory():IItemRendererClassFactory
+ {
+ return _itemRendererFactory;
+ }
+
+ /**
+ * @private
+ */
+ public function set itemRendererFactory(value:IItemRendererClassFactory):void
+ {
+ _itemRendererFactory = value;
+ }
+
+ /**
+ * The org.apache.flex.core.IItemRendererParent that will
+ * parent the item renderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var dataGroup:IItemRendererParent;
+
+ private function dataProviderChangeHandler(event:Event):void
+ {
+ var dp:Array = selectionModel.dataProvider as Array;
+ if (!dp)
+ return;
+
+ dataGroup.removeAllElements();
+
+ var listView:IListView = _strand.getBeadByType(IListView) as IListView;
+ var presentationModel:IListPresentationModel = _strand.getBeadByType(IListPresentationModel) as IListPresentationModel;
+
+ var n:int = dp.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var ir:ISelectableItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as ISelectableItemRenderer;
+ ir.index = i;
+ ir.labelField = labelField;
+ if (presentationModel) {
+ var style:SimpleCSSStyles = new SimpleCSSStyles();
+ style.marginBottom = presentationModel.separatorThickness;
+ UIBase(ir).style = style;
+ UIBase(ir).height = presentationModel.rowHeight;
+ }
+ dataGroup.addElement(ir);
+ ir.data = dp[i];
+
+ var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED);
+ newEvent.itemRenderer = ir;
+ dispatchEvent(newEvent);
+ }
+
+ IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
+ }
+ }
+}
[29/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - move
UIBase and UIButtonBase
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/975d3f34/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as
new file mode 100644
index 0000000..0e4a988
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIBase.as
@@ -0,0 +1,1401 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ COMPILE::SWF
+ {
+ import flash.display.DisplayObject;
+ import flash.display.Sprite;
+ import flash.display.Stage;
+ }
+
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.ValueChangeEvent;
+ import org.apache.flex.events.utils.MouseEventConverter;
+ COMPILE::SWF {
+ import flash.display.InteractiveObject;
+ }
+
+ /**
+ * Set a different class for click events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="click", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * Set a different class for rollOver events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="rollOver", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * Set a different class for rollOut events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="rollOut", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * Set a different class for mouseDown events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="mouseDown", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * Set a different class for mouseUp events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="mouseUp", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * Set a different class for mouseMove events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="mouseMove", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * Set a different class for mouseOut events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="mouseOut", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * Set a different class for mouseOver events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="mouseOver", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * The UIBase class is the base class for most composite user interface
+ * components. For the Flash Player, Buttons and Text controls may
+ * have a different base class and therefore may not extend UIBase.
+ * However all user interface components should implement IUIBase.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class UIBase extends UIHTMLElementWrapper implements IStrandWithModel, IEventDispatcher, IParentIUIBase, IStyleableObject, ILayoutChild, ITransformHost
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function UIBase()
+ {
+ super();
+
+ createElement();
+
+ COMPILE::SWF
+ {
+ MouseEventConverter.setupInstanceConverters(this);
+ }
+ }
+
+ COMPILE::SWF
+ public function get $sprite():Sprite
+ {
+ return $displayObject as Sprite;
+ }
+
+ private var _explicitWidth:Number;
+
+ /**
+ * The explicitly set width (as opposed to measured width
+ * or percentage width).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get explicitWidth():Number
+ {
+ return _explicitWidth;
+ }
+
+ /**
+ * @private
+ */
+ public function set explicitWidth(value:Number):void
+ {
+ if (_explicitWidth == value)
+ return;
+
+ // width can be pixel or percent not both
+ if (!isNaN(value))
+ _percentWidth = NaN;
+
+ _explicitWidth = value;
+
+ dispatchEvent(new Event("explicitWidthChanged"));
+ }
+
+ private var _explicitHeight:Number;
+
+ /**
+ * The explicitly set width (as opposed to measured width
+ * or percentage width).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get explicitHeight():Number
+ {
+ return _explicitHeight;
+ }
+
+ /**
+ * @private
+ */
+ public function set explicitHeight(value:Number):void
+ {
+ if (_explicitHeight == value)
+ return;
+
+ // height can be pixel or percent not both
+ if (!isNaN(value))
+ _percentHeight = NaN;
+
+ _explicitHeight = value;
+
+ dispatchEvent(new Event("explicitHeightChanged"));
+ }
+
+ private var _percentWidth:Number;
+
+ /**
+ * The requested percentage width this component
+ * should have in the parent container. Note that
+ * the actual percentage may be different if the
+ * total is more than 100% or if there are other
+ * components with explicitly set widths.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get percentWidth():Number
+ {
+ return _percentWidth;
+ }
+
+ /**
+ * @private
+ */
+ public function set percentWidth(value:Number):void
+ {
+ COMPILE::SWF {
+ if (_percentWidth == value)
+ return;
+
+ if (!isNaN(value))
+ _explicitWidth = NaN;
+
+ _percentWidth = value;
+ }
+ COMPILE::JS {
+ this._percentWidth = value;
+ this.positioner.style.width = value + '%';
+ if (!isNaN(value))
+ this._explicitWidth = NaN;
+ }
+
+ dispatchEvent(new Event("percentWidthChanged"));
+ }
+
+ private var _percentHeight:Number;
+
+ /**
+ * The requested percentage height this component
+ * should have in the parent container. Note that
+ * the actual percentage may be different if the
+ * total is more than 100% or if there are other
+ * components with explicitly set heights.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get percentHeight():Number
+ {
+ return _percentHeight;
+ }
+
+ /**
+ * @private
+ */
+ public function set percentHeight(value:Number):void
+ {
+ COMPILE::SWF {
+ if (_percentHeight == value)
+ return;
+
+ if (!isNaN(value))
+ _explicitHeight = NaN;
+
+ _percentHeight = value;
+ }
+
+ COMPILE::JS {
+ this._percentHeight = value;
+ this.positioner.style.height = value + '%';
+ if (!isNaN(value))
+ this._explicitHeight = NaN;
+ }
+
+ dispatchEvent(new Event("percentHeightChanged"));
+ }
+
+ private var _width:Number;
+
+ [Bindable("widthChanged")]
+ [PercentProxy("percentWidth")]
+ /**
+ * The width of the component. If no width has been previously
+ * set the default width may be specified in the IValuesImpl
+ * or determined as the bounding box around all child
+ * components and graphics.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ override public function get width():Number
+ {
+ var w:Number = _width;
+ if (isNaN(w)) {
+ w = $width;
+ }
+ return w;
+ }
+
+ /**
+ * @flexjsignorecoercion String
+ */
+ COMPILE::JS
+ public function get width():Number
+ {
+ var pixels:Number;
+ var strpixels:String = positioner.style.width as String;
+ if (strpixels !== null && strpixels.indexOf('%') != -1)
+ pixels = NaN;
+ else
+ pixels = parseFloat(strpixels);
+ if (isNaN(pixels)) {
+ pixels = positioner.offsetWidth;
+ if (pixels === 0 && positioner.scrollWidth !== 0) {
+ // invisible child elements cause offsetWidth to be 0.
+ pixels = positioner.scrollWidth;
+ }
+ }
+ return pixels;
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ override public function set width(value:Number):void
+ {
+ if (explicitWidth != value)
+ {
+ explicitWidth = value;
+ }
+
+ setWidth(value);
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::JS
+ public function set width(value:Number):void
+ {
+ if (explicitWidth != value)
+ {
+ explicitWidth = value;
+ }
+
+ setWidth(value);
+ }
+
+ /**
+ * Retrieve the low-level bounding box width.
+ * Not implemented in JS.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public function get $width():Number
+ {
+ return super.width;
+ }
+
+ private var _height:Number;
+
+ [Bindable("heightChanged")]
+ [PercentProxy("percentHeight")]
+ /**
+ * The height of the component. If no height has been previously
+ * set the default height may be specified in the IValuesImpl
+ * or determined as the bounding box around all child
+ * components and graphics.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ override public function get height():Number
+ {
+ var h:Number = _height;
+ if (isNaN(h)) {
+ h = $height;
+ }
+ return h;
+ }
+
+ /**
+ * @flexjsignorecoercion String
+ */
+ COMPILE::JS
+ public function get height():Number
+ {
+ var pixels:Number;
+ var strpixels:String = positioner.style.height as String;
+ if (strpixels !== null && strpixels.indexOf('%') != -1)
+ pixels = NaN;
+ else
+ pixels = parseFloat(strpixels);
+ if (isNaN(pixels)) {
+ pixels = positioner.offsetHeight;
+ if (pixels === 0 && positioner.scrollHeight !== 0) {
+ // invisible child elements cause offsetHeight to be 0.
+ pixels = positioner.scrollHeight;
+ }
+ }
+ return pixels;
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ override public function set height(value:Number):void
+ {
+ if (explicitHeight != value)
+ {
+ explicitHeight = value;
+ }
+
+ setHeight(value);
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::JS
+ public function set height(value:Number):void
+ {
+ if (explicitHeight != value)
+ {
+ explicitHeight = value;
+ }
+
+ setHeight(value);
+ }
+
+ /**
+ * Retrieve the low-level bounding box height.
+ * Not implemented in JS.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public function get $height():Number
+ {
+ return super.height;
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#setHeight
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setHeight(value:Number, noEvent:Boolean = false):void
+ {
+ if (_height != value)
+ {
+ _height = value;
+ COMPILE::JS
+ {
+ this.positioner.style.height = value + 'px';
+ }
+ if (!noEvent)
+ dispatchEvent(new Event("heightChanged"));
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#setWidth
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setWidth(value:Number, noEvent:Boolean = false):void
+ {
+ if (_width != value)
+ {
+ _width = value;
+ COMPILE::JS
+ {
+ this.positioner.style.width = value + 'px';
+ }
+ if (!noEvent)
+ dispatchEvent(new Event("widthChanged"));
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#setWidthAndHeight
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setWidthAndHeight(newWidth:Number, newHeight:Number, noEvent:Boolean = false):void
+ {
+ if (_width != newWidth)
+ {
+ _width = newWidth;
+ COMPILE::JS
+ {
+ this.positioner.style.width = newWidth + 'px';
+ }
+ if (!noEvent)
+ dispatchEvent(new Event("widthChanged"));
+ }
+ if (_height != newHeight)
+ {
+ _height = newHeight;
+ COMPILE::JS
+ {
+ this.positioner.style.height = newHeight + 'px';
+ }
+ if (!noEvent)
+ dispatchEvent(new Event("heightChanged"));
+ }
+ dispatchEvent(new Event("sizeChanged"));
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#isWidthSizedToContent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function isWidthSizedToContent():Boolean
+ {
+ if (!isNaN(_explicitWidth))
+ return false;
+ if (!isNaN(_percentWidth))
+ return false;
+ var left:* = ValuesManager.valuesImpl.getValue(this, "left");
+ var right:* = ValuesManager.valuesImpl.getValue(this, "right");
+ return (left === undefined || right === undefined);
+
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#isHeightSizedToContent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function isHeightSizedToContent():Boolean
+ {
+ if (!isNaN(_explicitHeight))
+ return false;
+ if (!isNaN(_percentHeight))
+ return false;
+ var top:* = ValuesManager.valuesImpl.getValue(this, "top");
+ var bottom:* = ValuesManager.valuesImpl.getValue(this, "bottom");
+ return (top === undefined || bottom === undefined);
+ }
+
+ private var _x:Number;
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ override public function set x(value:Number):void
+ {
+ super.x = _x = value;
+ if (!style)
+ style = { left: value };
+ else
+ style.left = value;
+ }
+
+ COMPILE::JS
+ public function set x(value:Number):void
+ {
+ positioner.style.position = 'absolute';
+ positioner.style.left = value + 'px';
+ }
+
+ /**
+ * @flexjsignorecoercion String
+ */
+ COMPILE::JS
+ public function get x():Number
+ {
+ var strpixels:String = positioner.style.left as String;
+ var pixels:Number = parseFloat(strpixels);
+ if (isNaN(pixels))
+ pixels = positioner.offsetLeft;
+ return pixels;
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#setX
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setX(value:Number):void
+ {
+ COMPILE::SWF
+ {
+ super.x = value;
+ }
+ COMPILE::JS
+ {
+ positioner.style.position = 'absolute';
+ positioner.style.left = value + 'px';
+ }
+ }
+
+ private var _y:Number;
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ override public function set y(value:Number):void
+ {
+ super.y = _y = value;
+ if (!style)
+ style = { top: value };
+ else
+ style.top = value;
+ }
+
+ COMPILE::JS
+ public function set y(value:Number):void
+ {
+ positioner.style.position = 'absolute';
+ positioner.style.top = value + 'px';
+ }
+
+ /**
+ * @flexjsignorecoercion String
+ */
+ COMPILE::JS
+ public function get y():Number
+ {
+ var strpixels:String = positioner.style.top as String;
+ var pixels:Number = parseFloat(strpixels);
+ if (isNaN(pixels))
+ pixels = positioner.offsetTop;
+ return pixels;
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#setY
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setY(value:Number):void
+ {
+ COMPILE::SWF
+ {
+ super.y = value;
+ }
+ COMPILE::JS
+ {
+ positioner.style.position = 'absolute';
+ positioner.style.top = value + 'px';
+ }
+ }
+
+ /**
+ * @private
+ */
+ [Bindable("visibleChanged")]
+ COMPILE::SWF
+ override public function set visible(value:Boolean):void
+ {
+ super.visible = value;
+ dispatchEvent(new Event(value?"show":"hide"));
+ dispatchEvent(new Event("visibleChanged"));
+ }
+
+ COMPILE::JS
+ private var displayStyleForLayout:String;
+
+ /**
+ * The display style is used for both visible
+ * and layout so is managed as a special case.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::JS
+ public function setDisplayStyleForLayout(value:String):void
+ {
+ if (positioner.style.display !== 'none')
+ positioner.style.display = value;
+ else
+ displayStyleForLayout = value;
+ }
+
+ COMPILE::JS
+ public function get visible():Boolean
+ {
+ return positioner.style.display !== 'none';
+ }
+
+ COMPILE::JS
+ public function set visible(value:Boolean):void
+ {
+ var oldValue:Boolean = positioner.style.display !== 'none';
+ if (value !== oldValue)
+ {
+ if (!value)
+ {
+ displayStyleForLayout = positioner.style.display;
+ positioner.style.display = 'none';
+ dispatchEvent(new Event('hide'));
+ }
+ else
+ {
+ if (displayStyleForLayout)
+ positioner.style.display = displayStyleForLayout;
+ dispatchEvent(new Event('show'));
+ }
+ dispatchEvent(new Event('visibleChanged'));
+ }
+ }
+
+ /**
+ * @return The array of children.
+ * @flexjsignorecoercion Array
+ */
+ COMPILE::JS
+ public function internalChildren():Array
+ {
+ return element.childNodes as Array;
+ }
+
+ private var _view:IBeadView;
+
+ /**
+ * An IBeadView that serves as the view for the component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion Class
+ */
+ public function get view():IBeadView
+ {
+ if (_view == null)
+ {
+ var c:Class = ValuesManager.valuesImpl.getValue(this, "iBeadView") as Class;
+ if (c)
+ {
+ if (c)
+ {
+ _view = (new c()) as IBeadView;
+ addBead(_view);
+ }
+ }
+ }
+ return _view;
+ }
+
+ /**
+ * @private
+ */
+ public function set view(value:IBeadView):void
+ {
+ if (_view != value)
+ {
+ addBead(value as IBead);
+ dispatchEvent(new Event("viewChanged"));
+ }
+ }
+
+ private var _id:String;
+
+ /**
+ * An id property for MXML documents.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get id():String
+ {
+ return _id;
+ }
+
+ /**
+ * @private
+ */
+ public function set id(value:String):void
+ {
+ if (_id != value)
+ {
+ _id = value;
+ dispatchEvent(new Event("idChanged"));
+ }
+ }
+
+ private var _style:Object;
+
+ /**
+ * The object that contains
+ * "styles" and other associated
+ * name-value pairs. You can
+ * also specify a string in
+ * HTML style attribute format.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get style():Object
+ {
+ return _style;
+ }
+
+ /**
+ * @private
+ * @flexjsignorecoercion String
+ */
+ public function set style(value:Object):void
+ {
+ if (_style != value)
+ {
+ if (value is String)
+ {
+ _style = ValuesManager.valuesImpl.parseStyles(value as String);
+ }
+ else
+ _style = value;
+ if (!isNaN(_y))
+ _style.top = _y;
+ if (!isNaN(_x))
+ _style.left = _x;
+ dispatchEvent(new Event("stylesChanged"));
+ }
+ }
+
+ /**
+ * A list of type names. Often used for CSS
+ * type selector lookups.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var typeNames:String;
+
+ private var _className:String;
+
+ /**
+ * The classname. Often used for CSS
+ * class selector lookups.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get className():String
+ {
+ return _className;
+ }
+
+ /**
+ * @private
+ */
+ public function set className(value:String):void
+ {
+ if (_className != value)
+ {
+ COMPILE::JS
+ {
+ setClassName(typeNames ? value + ' ' + typeNames : value);
+ }
+ _className = value;
+ dispatchEvent(new Event("classNameChanged"));
+ }
+ }
+
+ COMPILE::JS
+ protected function setClassName(value:String):void
+ {
+ element.className = value;
+ }
+
+
+ /**
+ * @copy org.apache.flex.core.Application#beads
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var beads:Array;
+
+ COMPILE::SWF
+ private var _beads:Vector.<IBead>;
+
+ /**
+ * @copy org.apache.flex.core.IStrand#addBead()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function addBead(bead:IBead):void
+ {
+ super.addBead(bead);
+ if (bead is IBeadView)
+ _view = bead as IBeadView;
+
+ if (bead is IBeadView) {
+ IEventDispatcher(this).dispatchEvent(new Event("viewChanged"));
+ }
+ }
+
+
+ // maintain this or just calculate it from the displayobject children on demand?
+ private var _elements:Array;
+
+ /**
+ * @copy org.apache.flex.core.IParent#addElement()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.IUIBase
+ */
+ public function addElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ COMPILE::SWF
+ {
+ if(_elements == null)
+ _elements = [];
+ _elements[_elements.length] = c;
+ $displayObjectContainer.addChild(c.$displayObject);
+ if (c is IUIBase)
+ {
+ IUIBase(c).addedToParent();
+ }
+
+ }
+ COMPILE::JS
+ {
+ element.appendChild(c.positioner);
+ (c as IUIBase).addedToParent();
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#addElementAt()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.IUIBase
+ */
+ public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
+ {
+ COMPILE::SWF
+ {
+ if(_elements == null)
+ _elements = [];
+ _elements.splice(index,0,c);
+
+ $displayObjectContainer.addChildAt(c.$displayObject,index);
+
+ if (c is IUIBase)
+ {
+ (c as IUIBase).addedToParent();
+ }
+ }
+ COMPILE::JS
+ {
+ var children:Array = internalChildren();
+ if (index >= children.length)
+ addElement(c);
+ else
+ {
+ element.insertBefore(c.positioner,
+ children[index]);
+ (c as IUIBase).addedToParent();
+ }
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#getElementAt()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getElementAt(index:int):IChild
+ {
+ COMPILE::SWF
+ {
+ if(_elements == null)
+ return null;
+ return _elements[index];
+ }
+ COMPILE::JS
+ {
+ var children:Array = internalChildren();
+ return children[index].flexjs_wrapper;
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#getElementIndex()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getElementIndex(c:IChild):int
+ {
+ COMPILE::SWF
+ {
+ if(_elements == null)
+ return -1;
+ return _elements.indexOf(c);
+ }
+ COMPILE::JS
+ {
+ var children:Array = internalChildren();
+ var n:int = children.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ if (children[i] == c.element)
+ return i;
+ }
+ return -1;
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#removeElement()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion HTMLElement
+ */
+ public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ COMPILE::SWF
+ {
+ if(_elements)
+ {
+ var idx:int = _elements.indexOf(c);
+ if(idx>=0)
+ _elements.splice(idx,1);
+ }
+ $displayObjectContainer.removeChild(c.$displayObject as DisplayObject);
+ }
+ COMPILE::JS
+ {
+ element.removeChild(c.element as HTMLElement);
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#numElements
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get numElements():int
+ {
+ COMPILE::SWF
+ {
+ return _elements ? _elements.length : 0;
+ }
+ COMPILE::JS
+ {
+ var children:Array = internalChildren();
+ return children.length;
+ }
+ }
+
+ /**
+ * The method called when added to a parent. This is a good
+ * time to set up beads.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion Class
+ * @flexjsignorecoercion Number
+ */
+ public function addedToParent():void
+ {
+ var c:Class;
+
+ COMPILE::JS
+ {
+ if (style)
+ ValuesManager.valuesImpl.applyStyles(this, style);
+ }
+
+ if (isNaN(_explicitWidth) && isNaN(_percentWidth))
+ {
+ var value:* = ValuesManager.valuesImpl.getValue(this,"width");
+ if (value !== undefined)
+ {
+ if (value is String)
+ {
+ var s:String = String(value);
+ if (s.indexOf("%") != -1)
+ _percentWidth = Number(s.substring(0, s.length - 1));
+ else
+ {
+ if (s.indexOf("px") != -1)
+ s = s.substring(0, s.length - 2);
+ _width = _explicitWidth = Number(s);
+ }
+ }
+ else
+ _width = _explicitWidth = value as Number;
+ }
+ }
+
+ if (isNaN(_explicitHeight) && isNaN(_percentHeight))
+ {
+ value = ValuesManager.valuesImpl.getValue(this,"height");
+ if (value !== undefined)
+ {
+ if (value is String)
+ {
+ s = String(value);
+ if (s.indexOf("%") != -1)
+ _percentHeight = Number(s.substring(0, s.length - 1));
+ else
+ {
+ if (s.indexOf("px") != -1)
+ s = s.substring(0, s.length - 2);
+ _height = _explicitHeight = Number(s);
+ }
+ }
+ else
+ _height = _explicitHeight = value as Number;
+ }
+ }
+
+ for each (var bead:IBead in beads)
+ addBead(bead);
+
+ if (getBeadByType(IBeadModel) == null)
+ {
+ c = ValuesManager.valuesImpl.getValue(this, "iBeadModel") as Class;
+ if (c)
+ {
+ var model:IBeadModel = new c as IBeadModel;
+ if (model)
+ addBead(model);
+ }
+ }
+ if (_view == null && getBeadByType(IBeadView) == null)
+ {
+ c = ValuesManager.valuesImpl.getValue(this, "iBeadView") as Class;
+ if (c)
+ {
+ var view:IBeadView = new c as IBeadView;
+ if (view)
+ addBead(view);
+ }
+ }
+ if (getBeadByType(IBeadController) == null)
+ {
+ c = ValuesManager.valuesImpl.getValue(this, "iBeadController") as Class;
+ if (c)
+ {
+ var controller:IBeadController = new c as IBeadController;
+ if (controller)
+ addBead(controller);
+ }
+ }
+ dispatchEvent(new Event("beadsAdded"));
+ }
+
+ /**
+ * A measurement bead, if one exists.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get measurementBead() : IMeasurementBead
+ {
+ var measurementBead:IMeasurementBead = getBeadByType(IMeasurementBead) as IMeasurementBead;
+ if( measurementBead == null ) {
+ addBead(measurementBead = new (ValuesManager.valuesImpl.getValue(this, "iMeasurementBead")) as IMeasurementBead);
+ }
+
+ return measurementBead;
+ }
+
+ COMPILE::SWF
+ private var _stageProxy:StageProxy;
+
+ /**
+ * @copy org.apache.flex.core.IUIBase#topMostEventDispatcher
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion org.apache.flex.events.IEventDispatcher
+ */
+ public function get topMostEventDispatcher():IEventDispatcher
+ {
+ COMPILE::SWF
+ {
+ if (!_stageProxy)
+ {
+ _stageProxy = new StageProxy($displayObject.stage);
+ _stageProxy.addEventListener("removedFromStage", stageProxy_removedFromStageHandler);
+ }
+
+ return _stageProxy;
+ }
+ COMPILE::JS
+ {
+ var e:WrappedHTMLElement = document.body as WrappedHTMLElement;
+ return e.flexjs_wrapper as IEventDispatcher;
+ }
+ }
+
+ COMPILE::SWF
+ private function stageProxy_removedFromStageHandler(event:Event):void
+ {
+ _stageProxy = null;
+ }
+
+ /**
+ * Rebroadcast an event from a sub component from the component.
+ */
+ protected function repeaterListener(event:Event):void
+ {
+ dispatchEvent(event);
+ }
+
+ /**
+ * @return The actual element to be parented.
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ protected function createElement():IFlexJSElement
+ {
+ COMPILE::SWF
+ {
+ element = new WrappedSprite();
+ element.flexjs_wrapper = this;
+ (element as InteractiveObject).doubleClickEnabled = true; // make JS and flash consistent
+ return element;
+ }
+ COMPILE::JS
+ {
+ if (element == null)
+ element = document.createElement('div') as WrappedHTMLElement;
+ if (positioner == null)
+ positioner = element;
+ positioner.style.display = 'block';
+ positioner.style.position = 'relative';
+
+ element.flexjs_wrapper = this;
+
+ return positioner;
+ }
+ }
+
+ /**
+ * The HTMLElement used to position the component.
+ * @flexjsignorecoercion String
+ */
+ COMPILE::JS
+ public function get alpha():Number
+ {
+ var stralpha:String = positioner.style.opacity as String;
+ var alpha:Number = parseFloat(stralpha);
+ return alpha;
+ }
+
+ COMPILE::JS
+ public function set alpha(value:Number):void
+ {
+ positioner.style.opacity = value;
+ }
+
+ /**
+ * @param value The event containing new style properties.
+ */
+ COMPILE::JS
+ protected function styleChangeHandler(value:ValueChangeEvent):void
+ {
+ var newStyle:Object = {};
+ newStyle[value.propertyName] = value.newValue;
+ ValuesManager.valuesImpl.applyStyles(this, newStyle);
+ };
+
+ COMPILE::SWF
+ public function get transformElement():IFlexJSElement
+ {
+ return element;
+ }
+
+ COMPILE::JS
+ public function get transformElement():WrappedHTMLElement
+ {
+ return element;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/975d3f34/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIButtonBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIButtonBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIButtonBase.as
new file mode 100644
index 0000000..85fc0fd
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/UIButtonBase.as
@@ -0,0 +1,792 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ import flash.display.DisplayObject;
+ import flash.display.SimpleButton;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IMeasurementBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.utils.MouseEventConverter;
+
+ //--------------------------------------
+ // Events
+ //--------------------------------------
+
+ /**
+ * Set a different class for click events so that
+ * there aren't dependencies on the flash classes
+ * on the JS side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="click", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * The UIHTMLElementWrapper class is the base class for most Buttons
+ * and other UI objects in a FlexJS application that do not have children.
+ * In Flash, these buttons extend SimpleButton and therefore
+ * do not support all of the Sprite APIs.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public class UIButtonBase extends UIHTMLElementWrapper implements IStrandWithModel, IEventDispatcher, IUIBase, IStyleableObject, ILayoutChild
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function UIButtonBase()
+ {
+ // mouseChildren = true;
+ // mouseEnabled = true;
+ createElement();
+ MouseEventConverter.setupInstanceConverters(this);
+ }
+
+ protected function createElement():IFlexJSElement
+ {
+ element = _button = new WrappedSimpleButton();
+ _button.flexjs_wrapper = this;
+ return element;
+ }
+ private var _button:WrappedSimpleButton;
+
+ public function get $button():SimpleButton
+ {
+ return _button;
+ }
+
+ private var _x:Number;
+
+ /**
+ * @private
+ */
+ override public function set x(value:Number):void
+ {
+ if (_button.x != value) {
+ _button.x = _x = value;
+ if (!style)
+ style = { left: value };
+ else
+ style.left = value;
+ dispatchEvent(new Event("xChanged"));
+ }
+ }
+
+ private var _y:Number;
+
+ /**
+ * @private
+ */
+ override public function set y(value:Number):void
+ {
+ if (_button.y != value) {
+ _button.y = _y = value;
+ if (!style)
+ style = { top: value };
+ else
+ style.top = value;
+ dispatchEvent(new Event("yChanged"));
+ }
+ }
+
+ /**
+ * Retrieve the low-level bounding box y.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function get $y():Number
+ {
+ return _button.y;
+ }
+
+ private var _explicitWidth:Number;
+
+ /**
+ * The explicitly set width (as opposed to measured width
+ * or percentage width).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get explicitWidth():Number
+ {
+ if (isNaN(_explicitWidth))
+ {
+ var value:* = ValuesManager.valuesImpl.getValue(this, "width");
+ if (value !== undefined) {
+ _explicitWidth = Number(value);
+ }
+ }
+
+ return _explicitWidth;
+ }
+
+ /**
+ * @private
+ */
+ public function set explicitWidth(value:Number):void
+ {
+ if (_explicitWidth == value)
+ return;
+
+ // width can be pixel or percent not both
+ if (!isNaN(value))
+ _percentWidth = NaN;
+
+ _explicitWidth = value;
+
+ dispatchEvent(new Event("explicitWidthChanged"));
+ }
+
+ private var _explicitHeight:Number;
+
+ /**
+ * The explicitly set width (as opposed to measured width
+ * or percentage width).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get explicitHeight():Number
+ {
+ if (isNaN(_explicitHeight))
+ {
+ var value:* = ValuesManager.valuesImpl.getValue(this, "height");
+ if (value !== undefined) {
+ _explicitHeight = Number(value);
+ }
+ }
+
+ return _explicitHeight;
+ }
+
+ /**
+ * @private
+ */
+ public function set explicitHeight(value:Number):void
+ {
+ if (_explicitHeight == value)
+ return;
+
+ // height can be pixel or percent not both
+ if (!isNaN(value))
+ _percentHeight = NaN;
+
+ _explicitHeight = value;
+
+ dispatchEvent(new Event("explicitHeightChanged"));
+ }
+
+ private var _percentWidth:Number;
+
+ /**
+ * The requested percentage width this component
+ * should have in the parent container. Note that
+ * the actual percentage may be different if the
+ * total is more than 100% or if there are other
+ * components with explicitly set widths.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get percentWidth():Number
+ {
+ return _percentWidth;
+ }
+
+ /**
+ * @private
+ */
+ public function set percentWidth(value:Number):void
+ {
+ if (_percentWidth == value)
+ return;
+
+ if (!isNaN(value))
+ _explicitWidth = NaN;
+
+ _percentWidth = value;
+
+ dispatchEvent(new Event("percentWidthChanged"));
+ }
+
+ private var _percentHeight:Number;
+
+ /**
+ * The requested percentage height this component
+ * should have in the parent container. Note that
+ * the actual percentage may be different if the
+ * total is more than 100% or if there are other
+ * components with explicitly set heights.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get percentHeight():Number
+ {
+ return _percentHeight;
+ }
+
+ /**
+ * @private
+ */
+ public function set percentHeight(value:Number):void
+ {
+ if (_percentHeight == value)
+ return;
+
+ if (!isNaN(value))
+ _explicitHeight = NaN;
+
+ _percentHeight = value;
+
+ dispatchEvent(new Event("percentHeightChanged"));
+ }
+
+ private var _width:Number;
+
+ [Bindable("widthChanged")]
+ [PercentProxy("percentWidth")]
+ /**
+ * @copy org.apache.flex.core.UIBase#width
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function get width():Number
+ {
+ if (isNaN(explicitWidth))
+ {
+ var w:Number = _width;
+ if (isNaN(w)) w = $width;
+ return w;
+ }
+ else
+ return explicitWidth;
+ }
+
+ /**
+ * @private
+ */
+ override public function set width(value:Number):void
+ {
+ if (explicitWidth != value)
+ {
+ explicitWidth = value;
+ }
+
+ setWidth(value);
+ }
+
+ /**
+ * Retrieve the low-level bounding box width.
+ * Not implemented in JS.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get $width():Number
+ {
+ return _button.width;
+ }
+
+ private var _height:Number;
+
+ [Bindable("heightChanged")]
+ [PercentProxy("percentHeight")]
+ /**
+ * @copy org.apache.flex.core.UIBase#width
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function get height():Number
+ {
+ if (isNaN(explicitHeight))
+ {
+ var h:Number = _height;
+ if (isNaN(h)) h = $height;
+ return h;
+ }
+ else
+ return explicitHeight;
+ }
+
+ /**
+ * @private
+ */
+ override public function set height(value:Number):void
+ {
+ if (explicitHeight != value)
+ {
+ explicitHeight = value;
+ }
+
+ setHeight(value);
+ }
+
+ /**
+ * Retrieve the low-level bounding box height.
+ * Not implemented in JS.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get $height():Number
+ {
+ return _button.height;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IUIBase#setHeight
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setHeight(value:Number, noEvent:Boolean = false):void
+ {
+ if (_height != value)
+ {
+ _height = value;
+ if (!noEvent)
+ dispatchEvent(new Event("heightChanged"));
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IUIBase#setWidth
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setWidth(value:Number, noEvent:Boolean = false):void
+ {
+ if (_width != value)
+ {
+ _width = value;
+ if (!noEvent)
+ dispatchEvent(new Event("widthChanged"));
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IUIBase#setWidthAndHeight
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setWidthAndHeight(newWidth:Number, newHeight:Number, noEvent:Boolean = false):void
+ {
+ if (_width != newWidth)
+ {
+ _width = newWidth;
+ if (_height == newHeight)
+ if (!noEvent)
+ dispatchEvent(new Event("widthChanged"));
+ }
+ if (_height != newHeight)
+ {
+ _height = newHeight;
+ if (!noEvent)
+ dispatchEvent(new Event("heightChanged"));
+ }
+ dispatchEvent(new Event("sizeChanged"));
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#isWidthSizedToContent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function isWidthSizedToContent():Boolean
+ {
+ return (isNaN(_explicitWidth) && isNaN(_percentWidth));
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#setX
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setX(value:Number):void
+ {
+ _button.x = value;
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#setY
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setY(value:Number):void
+ {
+ _button.y = value;
+ }
+
+ /**
+ * @private
+ */
+ [Bindable("visibleChanged")]
+ override public function set visible(value:Boolean):void
+ {
+ _button.visible = value;
+ dispatchEvent(new Event(value?"show":"hide"));
+ dispatchEvent(new Event("visibleChanged"));
+ }
+
+ override public function get visible():Boolean
+ {
+ return _button.visible;
+ }
+
+ /**
+ * @copy org.apache.flex.core.ILayoutChild#isHeightSizedToContent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function isHeightSizedToContent():Boolean
+ {
+ return (isNaN(_explicitHeight) && isNaN(_percentHeight));
+ }
+
+ private var _view:IBeadView;
+
+ /**
+ * An IBeadView that serves as the view for the component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get view():IBeadView
+ {
+ if (_view == null)
+ {
+ var c:Class = ValuesManager.valuesImpl.getValue(this, "iBeadView") as Class;
+ if (c)
+ {
+ _view = (new c()) as IBeadView;
+ addBead(_view);
+ }
+ }
+ return _view;
+ }
+
+ /**
+ * @private
+ */
+ public function set view(value:IBeadView):void
+ {
+ if (_view != value)
+ {
+ addBead(value as IBead);
+ dispatchEvent(new Event("viewChanged"));
+ }
+ }
+
+ private var _id:String;
+
+ /**
+ * @copy org.apache.flex.core.UIBase#id
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get id():String
+ {
+ return _id;
+ }
+
+ /**
+ * @private
+ */
+ public function set id(value:String):void
+ {
+ if (_id != value)
+ {
+ _id = value;
+ dispatchEvent(new Event("idChanged"));
+ }
+ }
+
+ private var _styles:Object;
+
+ /**
+ * The object that contains
+ * "styles" and other associated
+ * name-value pairs. You can
+ * also specify a string in
+ * HTML style attribute format.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get style():Object
+ {
+ return _styles;
+ }
+
+ /**
+ * @private
+ */
+ public function set style(value:Object):void
+ {
+ if (value is String)
+ _styles = ValuesManager.valuesImpl.parseStyles(value as String);
+ else
+ _styles = value;
+ if (!isNaN(_y))
+ _styles.top = _y;
+ if (!isNaN(_x))
+ _styles.left = _x;
+ dispatchEvent(new Event("stylesChanged"));
+ }
+
+ /**
+ * The styles for this object formatted
+ * as an HTML style attribute. While this
+ * may be a convenient and less verbose
+ * way of specifying styles than using
+ * the style object, you run the risk of
+ * having a typo.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set styleString(value:String):void
+ {
+ _styles = JSON.parse("{" + value + "}");
+ }
+
+ /**
+ * A list of type names. Often used for CSS
+ * type selector lookups.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var typeNames:String;
+
+ private var _className:String;
+
+ /**
+ * @copy org.apache.flex.core.UIBase#className
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get className():String
+ {
+ return _className;
+ }
+
+ /**
+ * @private
+ */
+ public function set className(value:String):void
+ {
+ if (_className != value)
+ {
+ _className = value;
+ dispatchEvent(new Event("classNameChanged"));
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.UIBase#beads
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var beads:Array;
+
+ private var strand:Vector.<IBead>;
+
+ /**
+ * @copy org.apache.flex.core.UIBase#addBead()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function addBead(bead:IBead):void
+ {
+ super.addBead(bead);
+ if (bead is IBeadView)
+ _view = bead as IBeadView;
+ bead.strand = this;
+ }
+
+ /**
+ * @copy org.apache.flex.core.UIBase#addToParent()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function addedToParent():void
+ {
+ var c:Class;
+
+ for each (var bead:IBead in beads)
+ addBead(bead);
+
+ if (getBeadByType(IBeadModel) == null)
+ {
+ c = ValuesManager.valuesImpl.getValue(this, "iBeadModel") as Class;
+ if (c)
+ {
+ var model:IBeadModel = new c as IBeadModel;
+ if (model)
+ addBead(model);
+ }
+ }
+ if (getBeadByType(IBeadView) == null)
+ {
+ c = ValuesManager.valuesImpl.getValue(this, "iBeadView") as Class;
+ if (c)
+ {
+ var view:IBeadView = new c as IBeadView;
+ if (view)
+ addBead(view);
+ }
+ }
+ if (getBeadByType(IBeadController) == null)
+ {
+ c = ValuesManager.valuesImpl.getValue(this, "iBeadController") as Class;
+ if (c)
+ {
+ var controller:IBeadController = new c as IBeadController;
+ if (controller)
+ addBead(controller);
+ }
+ }
+
+ dispatchEvent(new Event("beadsAdded"));
+
+ }
+
+ /**
+ * @copy org.apache.flex.core.UIBase#measurementBead
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get measurementBead() : IMeasurementBead
+ {
+ var measurementBead:IMeasurementBead = getBeadByType(IMeasurementBead) as IMeasurementBead;
+ if( measurementBead == null ) {
+ addBead(measurementBead = new (ValuesManager.valuesImpl.getValue(this, "iMeasurementBead")) as IMeasurementBead);
+ }
+
+ return measurementBead;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IUIBase#topMostEventDispatcher
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get topMostEventDispatcher():IEventDispatcher
+ {
+ if (!parent)
+ return null;
+ return IUIBase(parent).topMostEventDispatcher;
+ }
+
+
+ }
+}
[26/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - move
ContainerBase Graphics classes
Posted by ah...@apache.org.
move ContainerBase Graphics classes
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/6fee345f
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/6fee345f
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/6fee345f
Branch: refs/heads/refactor-sprite
Commit: 6fee345f119756d032d3ce36911e13f8f80cb368
Parents: f241391
Author: Alex Harui <ah...@apache.org>
Authored: Thu Oct 27 22:13:22 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:46:53 2016 -0700
----------------------------------------------------------------------
.../main/flex/org/apache/flex/svg/DOMWrapper.as | 56 -----
.../org/apache/flex/svg/GraphicContainer.as | 209 -------------------
.../main/flex/org/apache/flex/svg/DOMWrapper.as | 56 +++++
.../org/apache/flex/svg/GraphicContainer.as | 209 +++++++++++++++++++
4 files changed, 265 insertions(+), 265 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6fee345f/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/DOMWrapper.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/DOMWrapper.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/DOMWrapper.as
deleted file mode 100644
index 7bb20ff..0000000
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/DOMWrapper.as
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flex.svg
-{
- COMPILE::JS
- {
- import org.apache.flex.core.WrappedHTMLElement;
- }
-
- import org.apache.flex.core.ContainerBase;
-
- public class DOMWrapper extends ContainerBase
- {
-
- /**
- * Constructor
- *
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- public function DOMWrapper()
- {
- super();
- }
-
- /**
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- COMPILE::JS
- override protected function createElement():WrappedHTMLElement
- {
- element = document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject') as WrappedHTMLElement;
- element.flexjs_wrapper = this;
- element.style.left = 0;
- element.style.top = 0;
- //element.offsetParent = null;
- positioner = element;
- positioner.style.position = 'relative';
-
- return element;
- }
-
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6fee345f/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicContainer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicContainer.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicContainer.as
deleted file mode 100644
index 709d6ea..0000000
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicContainer.as
+++ /dev/null
@@ -1,209 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.flex.svg
-{
- import org.apache.flex.core.ContainerBase;
- import org.apache.flex.core.IChild;
- import org.apache.flex.core.IFlexJSElement;
- import org.apache.flex.core.ITransformHost;
-
- COMPILE::JS
- {
- import org.apache.flex.core.IContainer;
- import org.apache.flex.core.UIBase;
- }
-
- [DefaultProperty("mxmlContent")]
-
- COMPILE::SWF
- public class GraphicContainer extends ContainerBase implements ITransformHost
- {
- public function GraphicContainer()
- {
- super();
- }
-
- }
-
- COMPILE::JS
- public class GraphicContainer extends UIBase implements ITransformHost, IContainer
- {
- private var graphicGroup:ContainerBase;
-
- public function GraphicContainer()
- {
- super();
- }
-
- /**
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- override protected function createElement():org.apache.flex.core.WrappedHTMLElement
- {
- element = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as org.apache.flex.core.WrappedHTMLElement;
-
- positioner = element;
-
- // absolute positioned children need a non-null
- // position value in the parent. It might
- // get set to 'absolute' if the container is
- // also absolutely positioned
- positioner.style.position = 'relative';
- element.flexjs_wrapper = this;
-
- graphicGroup = new GraphicGroup();
- super.addElement(graphicGroup);
- return element;
- }
-
- COMPILE::JS
- override protected function setClassName(value:String):void
- {
- element.setAttribute('class', value);
- }
-
- override public function get transformElement():org.apache.flex.core.WrappedHTMLElement
- {
- return graphicGroup.element;
- }
-
- /**
- * @copy org.apache.flex.core.IParent#getElementAt()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function getElementAt(index:int):IChild
- {
- return graphicGroup.getElementAt(index);
- }
-
- /**
- * @copy org.apache.flex.core.IParent#addElement()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function addElement(c:IChild, dispatchEvent:Boolean = true):void
- {
- graphicGroup.addElement(c, dispatchEvent);
- if (dispatchEvent)
- this.dispatchEvent(new Event("childrenAdded"));
- }
-
- /**
- * @copy org.apache.flex.core.IParent#addElementAt()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
- {
- graphicGroup.addElementAt(c, index, dispatchEvent);
- if (dispatchEvent)
- this.dispatchEvent(new Event("childrenAdded"));
- }
-
- /**
- * @copy org.apache.flex.core.IParent#removeElement()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
- {
- graphicGroup.removeElement(c, dispatchEvent);
- if (dispatchEvent)
- this.dispatchEvent(new Event("childrenRemoved"));
- }
-
- /**
- * @copy org.apache.flex.core.IContainer#childrenAdded()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function childrenAdded():void
- {
- dispatchEvent(new Event("childrenAdded"));
- }
-
- /**
- * @copy org.apache.flex.core.IParent#getElementIndex()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function getElementIndex(c:IChild):int
- {
- return graphicGroup.getElementIndex(c);
- }
-
-
- /**
- * The number of elements in the parent.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function get numElements():int
- {
- return graphicGroup.numElements;
- }
- }
-}
-
-import org.apache.flex.core.ContainerBase;
-
-class GraphicGroup extends ContainerBase
-{
- /**
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- COMPILE::JS
- override protected function createElement():org.apache.flex.core.WrappedHTMLElement
- {
- element = document.createElementNS('http://www.w3.org/2000/svg', 'g') as org.apache.flex.core.WrappedHTMLElement;
-
- positioner = element;
-
- // absolute positioned children need a non-null
- // position value in the parent. It might
- // get set to 'absolute' if the container is
- // also absolutely positioned
- positioner.style.position = 'relative';
- element.flexjs_wrapper = this;
-
- /*addEventListener('childrenAdded',
- runLayoutHandler);
- addEventListener('elementRemoved',
- runLayoutHandler);*/
-
- return element;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6fee345f/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/DOMWrapper.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/DOMWrapper.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/DOMWrapper.as
new file mode 100644
index 0000000..7bb20ff
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/DOMWrapper.as
@@ -0,0 +1,56 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flex.svg
+{
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ import org.apache.flex.core.ContainerBase;
+
+ public class DOMWrapper extends ContainerBase
+ {
+
+ /**
+ * Constructor
+ *
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function DOMWrapper()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject') as WrappedHTMLElement;
+ element.flexjs_wrapper = this;
+ element.style.left = 0;
+ element.style.top = 0;
+ //element.offsetParent = null;
+ positioner = element;
+ positioner.style.position = 'relative';
+
+ return element;
+ }
+
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6fee345f/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/GraphicContainer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/GraphicContainer.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/GraphicContainer.as
new file mode 100644
index 0000000..709d6ea
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/GraphicContainer.as
@@ -0,0 +1,209 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.flex.svg
+{
+ import org.apache.flex.core.ContainerBase;
+ import org.apache.flex.core.IChild;
+ import org.apache.flex.core.IFlexJSElement;
+ import org.apache.flex.core.ITransformHost;
+
+ COMPILE::JS
+ {
+ import org.apache.flex.core.IContainer;
+ import org.apache.flex.core.UIBase;
+ }
+
+ [DefaultProperty("mxmlContent")]
+
+ COMPILE::SWF
+ public class GraphicContainer extends ContainerBase implements ITransformHost
+ {
+ public function GraphicContainer()
+ {
+ super();
+ }
+
+ }
+
+ COMPILE::JS
+ public class GraphicContainer extends UIBase implements ITransformHost, IContainer
+ {
+ private var graphicGroup:ContainerBase;
+
+ public function GraphicContainer()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ override protected function createElement():org.apache.flex.core.WrappedHTMLElement
+ {
+ element = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as org.apache.flex.core.WrappedHTMLElement;
+
+ positioner = element;
+
+ // absolute positioned children need a non-null
+ // position value in the parent. It might
+ // get set to 'absolute' if the container is
+ // also absolutely positioned
+ positioner.style.position = 'relative';
+ element.flexjs_wrapper = this;
+
+ graphicGroup = new GraphicGroup();
+ super.addElement(graphicGroup);
+ return element;
+ }
+
+ COMPILE::JS
+ override protected function setClassName(value:String):void
+ {
+ element.setAttribute('class', value);
+ }
+
+ override public function get transformElement():org.apache.flex.core.WrappedHTMLElement
+ {
+ return graphicGroup.element;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#getElementAt()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function getElementAt(index:int):IChild
+ {
+ return graphicGroup.getElementAt(index);
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#addElement()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function addElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ graphicGroup.addElement(c, dispatchEvent);
+ if (dispatchEvent)
+ this.dispatchEvent(new Event("childrenAdded"));
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#addElementAt()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
+ {
+ graphicGroup.addElementAt(c, index, dispatchEvent);
+ if (dispatchEvent)
+ this.dispatchEvent(new Event("childrenAdded"));
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#removeElement()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ graphicGroup.removeElement(c, dispatchEvent);
+ if (dispatchEvent)
+ this.dispatchEvent(new Event("childrenRemoved"));
+ }
+
+ /**
+ * @copy org.apache.flex.core.IContainer#childrenAdded()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function childrenAdded():void
+ {
+ dispatchEvent(new Event("childrenAdded"));
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#getElementIndex()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function getElementIndex(c:IChild):int
+ {
+ return graphicGroup.getElementIndex(c);
+ }
+
+
+ /**
+ * The number of elements in the parent.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function get numElements():int
+ {
+ return graphicGroup.numElements;
+ }
+ }
+}
+
+import org.apache.flex.core.ContainerBase;
+
+class GraphicGroup extends ContainerBase
+{
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():org.apache.flex.core.WrappedHTMLElement
+ {
+ element = document.createElementNS('http://www.w3.org/2000/svg', 'g') as org.apache.flex.core.WrappedHTMLElement;
+
+ positioner = element;
+
+ // absolute positioned children need a non-null
+ // position value in the parent. It might
+ // get set to 'absolute' if the container is
+ // also absolutely positioned
+ positioner.style.position = 'relative';
+ element.flexjs_wrapper = this;
+
+ /*addEventListener('childrenAdded',
+ runLayoutHandler);
+ addEventListener('elementRemoved',
+ runLayoutHandler);*/
+
+ return element;
+ }
+}
\ No newline at end of file
[09/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - try to
copy HTML to Basic without losing history
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/DateChooserMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/DateChooserMouseController.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/DateChooserMouseController.as
new file mode 100644
index 0000000..c0bed5b
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/DateChooserMouseController.as
@@ -0,0 +1,127 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.controllers
+{
+ import org.apache.flex.html.beads.DateChooserView;
+ import org.apache.flex.html.beads.models.DateChooserModel;
+ import org.apache.flex.html.supportClasses.DateChooserButton;
+
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The DateChooserMouseController class is responsible for listening to
+ * mouse event related to the DateChooser. Events such as selecting a date
+ * or changing the calendar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateChooserMouseController implements IBeadController
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateChooserMouseController()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ var view:DateChooserView = value.getBeadByType(IBeadView) as DateChooserView;
+ view.prevMonthButton.addEventListener("click", prevMonthClickHandler);
+ view.nextMonthButton.addEventListener("click", nextMonthClickHandler);
+
+ var dayButtons:Array = view.dayButtons;
+ for(var i:int=0; i < dayButtons.length; i++) {
+ IEventDispatcher(dayButtons[i]).addEventListener("click", dayButtonClickHandler);
+ }
+ }
+
+ /**
+ * @private
+ */
+ private function prevMonthClickHandler(event:Event):void
+ {
+ var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel;
+ var month:Number = model.displayedMonth - 1;
+ var year:Number = model.displayedYear;
+ if (month < 0) {
+ month = 11;
+ year--;
+ }
+ model.displayedMonth = month;
+ model.displayedYear = year;
+ }
+
+ /**
+ * @private
+ */
+ private function nextMonthClickHandler(event:Event):void
+ {
+ var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel;
+ var month:Number = model.displayedMonth + 1;
+ var year:Number = model.displayedYear;
+ if (month >= 12) {
+ month = 0;
+ year++;
+ }
+ model.displayedMonth = month;
+ model.displayedYear = year;
+ }
+
+ /**
+ * @private
+ */
+ private function dayButtonClickHandler(event:MouseEvent):void
+ {
+ var dateButton:DateChooserButton = event.target as DateChooserButton;
+ if (dateButton.dayOfMonth > 0) {
+ var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel;
+ var newDate:Date = new Date(model.displayedYear,model.displayedMonth,dateButton.dayOfMonth);
+ model.selectedDate = newDate;
+ IEventDispatcher(_strand).dispatchEvent( new Event("change") );
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/DateFieldMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/DateFieldMouseController.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/DateFieldMouseController.as
new file mode 100644
index 0000000..c4f130a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/DateFieldMouseController.as
@@ -0,0 +1,96 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.controllers
+{
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IDateChooserModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.beads.DateFieldView;
+
+ /**
+ * The DateFieldMouseController class is responsible for monitoring
+ * the mouse events on the elements of the DateField. A click on the
+ * DateField's menu button triggers the pop-up, for example.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateFieldMouseController implements IBeadController
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateFieldMouseController()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ var viewBead:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView;
+ IEventDispatcher(viewBead.menuButton).addEventListener("click", clickHandler);
+ }
+
+ /**
+ * @private
+ */
+ private function clickHandler(event:MouseEvent):void
+ {
+ var viewBead:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView;
+ viewBead.popUpVisible = true;
+ IEventDispatcher(viewBead.popUp).addEventListener("change", changeHandler);
+ }
+
+ /**
+ * @private
+ */
+ private function changeHandler(event:Event):void
+ {
+ var viewBead:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView;
+
+ var model:IDateChooserModel = _strand.getBeadByType(IDateChooserModel) as IDateChooserModel;
+ model.selectedDate = IDateChooserModel(viewBead.popUp.getBeadByType(IDateChooserModel)).selectedDate;
+
+ viewBead.popUpVisible = false;
+ IEventDispatcher(_strand).dispatchEvent(new Event("change"));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/DropDownListController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/DropDownListController.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/DropDownListController.as
new file mode 100644
index 0000000..c279dc5
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/DropDownListController.as
@@ -0,0 +1,117 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.controllers
+{
+ import flash.display.DisplayObject;
+ import flash.geom.Point;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.html.beads.IDropDownListView;
+
+ /**
+ * The DropDownListController class is the controller for
+ * org.apache.flex.html.DropDownList. Controllers
+ * watch for events from the interactive portions of a View and
+ * update the data model or dispatch a semantic event.
+ * This controller watches for the click event and displays the
+ * dropdown/popup, and watches the dropdown/popup for change events
+ * and updates the selection model accordingly.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DropDownListController implements IBead, IBeadController
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DropDownListController()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ IEventDispatcher(value).addEventListener(org.apache.flex.events.MouseEvent.CLICK, clickHandler);
+ }
+
+ private function clickHandler(event:org.apache.flex.events.MouseEvent):void
+ {
+ var viewBead:IDropDownListView = _strand.getBeadByType(IDropDownListView) as IDropDownListView;
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ var popUpModel:ISelectionModel = UIBase(viewBead.popUp).model as ISelectionModel;
+ DisplayObject(viewBead.popUp).width = DisplayObject(_strand).width;
+ popUpModel.dataProvider = selectionModel.dataProvider;
+ popUpModel.labelField = selectionModel.labelField;
+ viewBead.popUpVisible = true; // adds to display list as well
+ popUpModel.selectedIndex = selectionModel.selectedIndex;
+ var pt:Point = new Point(DisplayObject(_strand).x, DisplayObject(_strand).y + DisplayObject(_strand).height);
+ pt = DisplayObject(_strand).parent.localToGlobal(pt);
+ DisplayObject(viewBead.popUp).x = pt.x;
+ DisplayObject(viewBead.popUp).y = pt.y;
+ IEventDispatcher(viewBead.popUp).addEventListener("change", changeHandler);
+ IUIBase(_strand).topMostEventDispatcher.addEventListener(org.apache.flex.events.MouseEvent.CLICK, dismissHandler);
+ }
+
+ private function dismissHandler(event:org.apache.flex.events.MouseEvent):void
+ {
+ if (event.target == _strand) return;
+
+ IUIBase(_strand).topMostEventDispatcher.removeEventListener(org.apache.flex.events.MouseEvent.CLICK, dismissHandler);
+ var viewBead:IDropDownListView = _strand.getBeadByType(IDropDownListView) as IDropDownListView;
+ viewBead.popUpVisible = false;
+ }
+
+ private function changeHandler(event:Event):void
+ {
+ var viewBead:IDropDownListView = _strand.getBeadByType(IDropDownListView) as IDropDownListView;
+ viewBead.popUpVisible = false;
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ var popUpModel:ISelectionModel = UIBase(viewBead.popUp).model as ISelectionModel;
+ selectionModel.selectedIndex = popUpModel.selectedIndex;
+ IEventDispatcher(_strand).dispatchEvent(new Event("change"));
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/EditableTextKeyboardController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/EditableTextKeyboardController.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/EditableTextKeyboardController.as
new file mode 100644
index 0000000..4a8115f
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/EditableTextKeyboardController.as
@@ -0,0 +1,86 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.controllers
+{
+ import org.apache.flex.core.CSSTextField;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ITextModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.html.beads.ITextFieldView;
+
+ /**
+ * The EditableTextKeyboardController class bead intercepts keyboard events on the
+ * component's text field and emits change events.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class EditableTextKeyboardController implements IBead, IBeadController
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function EditableTextKeyboardController()
+ {
+ }
+
+ private var model:ITextModel;
+ private var textField:CSSTextField;
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ model = UIBase(_strand).model as ITextModel;
+
+ var viewBead:ITextFieldView = _strand.getBeadByType(ITextFieldView) as ITextFieldView;
+ textField = viewBead.textField;
+ textField.addEventListener("change", inputChangeHandler);
+ }
+
+ /**
+ * @private
+ */
+ private function inputChangeHandler( event:Object ) : void
+ {
+ // this will otherwise bubble an event of flash.events.Event
+ event.stopImmediatePropagation();
+ model.text = textField.text;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/HScrollBarMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/HScrollBarMouseController.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/HScrollBarMouseController.as
new file mode 100644
index 0000000..4abaffe
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/HScrollBarMouseController.as
@@ -0,0 +1,101 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.controllers
+{
+ import flash.display.DisplayObject;
+
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The HScrollBarMouseController class is the controller for
+ * org.apache.flex.html.supportClasses.HScrollBar
+ * that acts as the Horizontal ScrollBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class HScrollBarMouseController extends ScrollBarMouseControllerBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function HScrollBarMouseController()
+ {
+ }
+
+ /**
+ * @private
+ */
+ override protected function trackClickHandler(event:MouseEvent):void
+ {
+ if (sbView.thumb.visible)
+ {
+ if (event.localX < sbView.thumb.x)
+ {
+ sbModel.value = snap(Math.max(sbModel.minimum, sbModel.value - sbModel.pageStepSize));
+ IEventDispatcher(strand).dispatchEvent(new Event("scroll"));
+ }
+ else
+ {
+ sbModel.value = snap(Math.min(sbModel.maximum - sbModel.pageSize, sbModel.value + sbModel.pageStepSize));
+ IEventDispatcher(strand).dispatchEvent(new Event("scroll"));
+ }
+ }
+ }
+
+ private var thumbDownX:Number;
+ private var lastThumbX:Number;
+
+ /**
+ * @private
+ */
+ override protected function thumbMouseDownHandler(event:MouseEvent):void
+ {
+ sbView.thumb.stage.addEventListener(MouseEvent.MOUSE_MOVE, thumbMouseMoveHandler);
+ sbView.thumb.stage.addEventListener(MouseEvent.MOUSE_UP, thumbMouseUpHandler);
+ thumbDownX = event.screenX;
+ lastThumbX = sbView.thumb.x;
+ }
+
+ private function thumbMouseMoveHandler(event:MouseEvent):void
+ {
+ var thumb:DisplayObject = sbView.thumb;
+ var track:DisplayObject = sbView.track;
+ thumb.x = Math.max(track.x, Math.min(lastThumbX + (event.screenX - thumbDownX), track.x + track.width - thumb.width));
+ var newValue:Number = snap((thumb.x - track.x) / (track.width - thumb.width) * (sbModel.maximum - sbModel.minimum - sbModel.pageSize));
+ sbModel.value = newValue;
+ IEventDispatcher(strand).dispatchEvent(new Event("scroll"));
+ }
+
+ private function thumbMouseUpHandler(event:MouseEvent):void
+ {
+ sbView.thumb.stage.removeEventListener(MouseEvent.MOUSE_MOVE, thumbMouseMoveHandler);
+ sbView.thumb.stage.removeEventListener(MouseEvent.MOUSE_UP, thumbMouseUpHandler);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as
new file mode 100644
index 0000000..33c6aa2
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as
@@ -0,0 +1,209 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.controllers
+{
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.ISelectableItemRenderer;
+ import org.apache.flex.core.IStrand;
+COMPILE::SWF {
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.MouseEvent;
+}
+COMPILE::JS {
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.WrappedHTMLElement;
+ import org.apache.flex.events.BrowserEvent;
+ import goog.events.Event;
+ import goog.events.EventType;
+ import goog.events;
+}
+ import org.apache.flex.events.ItemClickedEvent;
+
+ /**
+ * The ItemRendererMouseController class can mouse events in itemRenderers. This
+ * includes roll-overs, mouse down, and mouse up. These platform-specific events are then
+ * re-dispatched as FlexJS events.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignoreimport goog.events.Event
+ */
+ public class ItemRendererMouseController implements IBeadController
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ItemRendererMouseController()
+ {
+ }
+
+ private var renderer:ISelectableItemRenderer;
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ renderer = value as ISelectableItemRenderer;
+
+ COMPILE::SWF {
+ renderer.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler);
+ renderer.addEventListener(MouseEvent.ROLL_OUT, rollOutHandler);
+ renderer.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
+ renderer.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ }
+
+ COMPILE::JS {
+ var element:WrappedHTMLElement = (_strand as UIBase).element;
+
+ goog.events.listen(element, goog.events.EventType.MOUSEOVER, this.handleMouseOver);
+ goog.events.listen(element, goog.events.EventType.MOUSEOUT, this.handleMouseOut);
+ goog.events.listen(element, goog.events.EventType.MOUSEDOWN, this.handleMouseDown);
+ goog.events.listen(element, goog.events.EventType.MOUSEUP, this.handleMouseUp);
+ }
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ protected function rollOverHandler(event:MouseEvent):void
+ {
+ var target:ISelectableItemRenderer = event.currentTarget as ISelectableItemRenderer;
+ if (target)
+ {
+ target.dispatchEvent(new Event("itemRollOver",true));
+ }
+ }
+
+ COMPILE::JS
+ protected function handleMouseOver(event:BrowserEvent):void
+ {
+ var target:ISelectableItemRenderer = event.currentTarget as ISelectableItemRenderer;
+ if (target) {
+ target.dispatchEvent(new Event("itemRollOver",true));
+ }
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ protected function rollOutHandler(event:MouseEvent):void
+ {
+ var target:ISelectableItemRenderer = event.currentTarget as ISelectableItemRenderer;
+ if (target)
+ {
+ target.dispatchEvent(new Event("itemRollOut",true));
+ }
+ }
+
+ COMPILE::JS
+ protected function handleMouseOut(event:BrowserEvent):void
+ {
+ var target:ISelectableItemRenderer = event.currentTarget as ISelectableItemRenderer;
+ if (target)
+ {
+ target.dispatchEvent(new Event("itemRollOut",true));
+ }
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ protected function mouseDownHandler(event:MouseEvent):void
+ {
+ var target:ISelectableItemRenderer = event.currentTarget as ISelectableItemRenderer;
+ if (target)
+ {
+ target.down = true;
+ target.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ }
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::JS
+ protected function handleMouseDown(event:BrowserEvent):void
+ {
+ var target:ISelectableItemRenderer = event.currentTarget as ISelectableItemRenderer;
+ if (target)
+ {
+ target.down = true;
+ target.hovered = false;
+ }
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ protected function mouseUpHandler(event:MouseEvent):void
+ {
+ var target:ISelectableItemRenderer = event.currentTarget as ISelectableItemRenderer;
+ if (target)
+ {
+ event.stopImmediatePropagation();
+
+ var newEvent:ItemClickedEvent = new ItemClickedEvent("itemClicked");
+ newEvent.data = target.data;
+ newEvent.multipleSelection = event.shiftKey;
+ newEvent.index = target.index;
+
+ target.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ target.dispatchEvent(newEvent);
+ }
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::JS
+ protected function handleMouseUp(event:BrowserEvent):void
+ {
+ var target:ISelectableItemRenderer = event.currentTarget as ISelectableItemRenderer;
+ if (target)
+ {
+ var newEvent:ItemClickedEvent = new ItemClickedEvent("itemClicked");
+ newEvent.data = target.data;
+ newEvent.multipleSelection = event.shiftKey;
+ newEvent.index = target.index;
+
+ target.dispatchEvent(newEvent);
+ }
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as
new file mode 100644
index 0000000..77ab6f5
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as
@@ -0,0 +1,153 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.controllers
+{
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.IRollOverModel;
+ import org.apache.flex.core.ISelectableItemRenderer;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.ItemAddedEvent;
+ import org.apache.flex.events.ItemRemovedEvent;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.html.beads.IListView;
+
+ import org.apache.flex.events.ItemClickedEvent;
+
+ /**
+ * The ListSingleSelectionMouseController class is a controller for
+ * org.apache.flex.html.List. Controllers
+ * watch for events from the interactive portions of a View and
+ * update the data model or dispatch a semantic event.
+ * This controller watches for events from the item renderers
+ * and updates an ISelectionModel (which only supports single
+ * selection). Other controller/model pairs would support
+ * various kinds of multiple selection.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ListSingleSelectionMouseController implements IBeadController
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ListSingleSelectionMouseController()
+ {
+ }
+
+ /**
+ * The model.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var listModel:ISelectionModel;
+
+ /**
+ * The view.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var listView:IListView;
+
+ /**
+ * The parent of the item renderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var dataGroup:IItemRendererParent;
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ listModel = value.getBeadByType(ISelectionModel) as ISelectionModel;
+ listView = value.getBeadByType(IListView) as IListView;
+ IEventDispatcher(_strand).addEventListener("itemAdded", handleItemAdded);
+ IEventDispatcher(_strand).addEventListener("itemRemoved", handleItemRemoved);
+ }
+
+ protected function handleItemAdded(event:ItemAddedEvent):void
+ {
+ IEventDispatcher(event.item).addEventListener("itemClicked", selectedHandler);
+ IEventDispatcher(event.item).addEventListener("itemRollOver", rolloverHandler);
+ IEventDispatcher(event.item).addEventListener("itemRollOut", rolloutHandler);
+ }
+
+ protected function handleItemRemoved(event:ItemAddedEvent):void
+ {
+ IEventDispatcher(event.item).removeEventListener("itemClicked", selectedHandler);
+ IEventDispatcher(event.item).removeEventListener("itemRollOver", rolloverHandler);
+ IEventDispatcher(event.item).removeEventListener("itemRollOut", rolloutHandler);
+ }
+
+ protected function selectedHandler(event:ItemClickedEvent):void
+ {
+ listModel.selectedIndex = event.index;
+ listView.host.dispatchEvent(new Event("change"));
+ }
+
+ protected function rolloverHandler(event:Event):void
+ {
+ var renderer:ISelectableItemRenderer = event.currentTarget as ISelectableItemRenderer;
+ if (renderer) {
+ IRollOverModel(listModel).rollOverIndex = renderer.index;
+ }
+ }
+
+ protected function rolloutHandler(event:Event):void
+ {
+ var renderer:ISelectableItemRenderer = event.currentTarget as ISelectableItemRenderer;
+ if (renderer) {
+ renderer.hovered = false;
+ renderer.down = false;
+ IRollOverModel(listModel).rollOverIndex = -1;
+ }
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/RangeStepperMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/RangeStepperMouseController.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/RangeStepperMouseController.as
new file mode 100644
index 0000000..b566d55
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/RangeStepperMouseController.as
@@ -0,0 +1,94 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.controllers
+{
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.html.ImageButton;
+ import org.apache.flex.html.beads.RangeStepperView;
+ import org.apache.flex.html.beads.models.RangeModel;
+
+ /**
+ * The RangeStepperMouseController bead feeds mouse events to the RangeStepper and its
+ * components.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class RangeStepperMouseController implements IBeadController
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function RangeStepperMouseController()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ private var _incrButton:ImageButton;
+ private var _decrButton:ImageButton;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ var stepperView:RangeStepperView = _strand.getBeadByType(RangeStepperView) as RangeStepperView;
+
+ _incrButton = stepperView.incrementButton;
+ _incrButton.addEventListener(MouseEvent.CLICK, handleIncrClick);
+
+ _decrButton = stepperView.decrementButton;
+ _decrButton.addEventListener(MouseEvent.CLICK, handleDecrClick);
+ }
+
+ private function handleIncrClick(event:MouseEvent):void
+ {
+ var model:RangeModel = (_strand as UIBase).model as RangeModel;
+ var nextValue:Number = model.value + 1;
+ if (nextValue >= model.maximum) nextValue = model.maximum;
+ model.value = nextValue;
+ }
+
+ private function handleDecrClick(event:MouseEvent):void
+ {
+ var model:RangeModel = (_strand as UIBase).model as RangeModel;
+ var nextValue:Number = model.value - 1;
+ if (nextValue < model.minimum) nextValue = model.minimum;
+ model.value = nextValue;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ScrollBarMouseControllerBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ScrollBarMouseControllerBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ScrollBarMouseControllerBase.as
new file mode 100644
index 0000000..8d9d27b
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ScrollBarMouseControllerBase.as
@@ -0,0 +1,184 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.controllers
+{
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IScrollBarModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.html.beads.IScrollBarView;
+
+ /**
+ * The ScrollBarMouseControllerBase class is the base class
+ * for ScrollBarMouseControllers such as VScrollBarMouseController.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ScrollBarMouseControllerBase implements IBeadController
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ScrollBarMouseControllerBase()
+ {
+ }
+
+ /**
+ * The data model
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var sbModel:IScrollBarModel;
+
+ /**
+ * The view
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var sbView:IScrollBarView;
+
+ private var _strand:IStrand;
+
+ /**
+ * @private
+ */
+ public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ sbModel = value.getBeadByType(IScrollBarModel) as IScrollBarModel;
+ sbView = value.getBeadByType(IScrollBarView) as IScrollBarView;
+ sbView.decrement.addEventListener(MouseEvent.CLICK, decrementClickHandler);
+ sbView.increment.addEventListener(MouseEvent.CLICK, incrementClickHandler);
+ sbView.decrement.addEventListener("buttonRepeat", decrementClickHandler);
+ sbView.increment.addEventListener("buttonRepeat", incrementClickHandler);
+ sbView.track.addEventListener(MouseEvent.CLICK, trackClickHandler);
+ sbView.thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbMouseDownHandler);
+ }
+
+ /**
+ * Force the input number to be "snapped" to the snapInterval.
+ *
+ * @param value The input number.
+ * @return The input number "snapped" to the snapInterval.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function snap(value:Number):Number
+ {
+ var si:Number = sbModel.snapInterval;
+ var n:Number = Math.round((value - sbModel.minimum) / si) * si + sbModel.minimum;
+ if (value > 0)
+ {
+ if (value - n < n + si - value)
+ return n;
+ return n + si;
+
+ }
+ if (value - n > n + si - value)
+ return n + si;
+ return n;
+ }
+
+ /**
+ * Updates the model when the decrement button is clicked.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function decrementClickHandler(event:Event):void
+ {
+ sbModel.value = snap(Math.max(sbModel.minimum, sbModel.value - sbModel.stepSize));
+ IEventDispatcher(_strand).dispatchEvent(new Event("scroll"));
+ }
+
+ /**
+ * Updates the model when the increment button is clicked.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function incrementClickHandler(event:Event):void
+ {
+ sbModel.value = snap(Math.min(sbModel.maximum - sbModel.pageSize, sbModel.value + sbModel.stepSize));
+ IEventDispatcher(_strand).dispatchEvent(new Event("scroll"));
+ }
+
+ /**
+ * Handles a click in the track. Must be overridden.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function trackClickHandler(event:MouseEvent):void
+ {
+ }
+
+ /**
+ * Handles a mouse down on the thumb. Must be overridden.
+ * Subclasses process the mouseMove and mouseUp events.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function thumbMouseDownHandler(event:MouseEvent):void
+ {
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/SliderMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/SliderMouseController.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/SliderMouseController.as
new file mode 100644
index 0000000..487b365
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/SliderMouseController.as
@@ -0,0 +1,286 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.controllers
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IRangeModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.geom.Point;
+ import org.apache.flex.html.beads.ISliderView;
+ import org.apache.flex.html.beads.SliderTrackView;
+
+ COMPILE::JS
+ {
+ import goog.events;
+ import goog.events.EventType;
+ import org.apache.flex.events.BrowserEvent;
+ import org.apache.flex.html.Slider;
+ import org.apache.flex.html.beads.SliderThumbView;
+ import org.apache.flex.html.beads.SliderTrackView;
+ }
+
+ /**
+ * The SliderMouseController class bead handles mouse events on the
+ * org.apache.flex.html.Slider's component parts (thumb and track) and
+ * dispatches change events on behalf of the Slider (as well as co-ordinating visual
+ * changes (such as moving the thumb when the track has been tapped or clicked).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SliderMouseController implements IBead, IBeadController
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SliderMouseController()
+ {
+ }
+
+ private var rangeModel:IRangeModel;
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ rangeModel = UIBase(value).model as IRangeModel;
+
+ COMPILE::SWF
+ {
+ var sliderView:ISliderView = value.getBeadByType(ISliderView) as ISliderView;
+ sliderView.thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbDownHandler);
+
+ // add handler to detect click on track
+ sliderView.track.addEventListener(MouseEvent.CLICK, trackClickHandler, false, 99999);
+
+ }
+ COMPILE::JS
+ {
+ track = value.getBeadByType(
+ SliderTrackView) as SliderTrackView;
+ thumb = value.getBeadByType(
+ SliderThumbView) as SliderThumbView;
+
+ goog.events.listen(track.element, goog.events.EventType.CLICK,
+ handleTrackClick, false, this);
+
+ goog.events.listen(thumb.element, goog.events.EventType.MOUSEDOWN,
+ handleThumbDown, false, this);
+
+ }
+ }
+
+ COMPILE::JS
+ private var track:SliderTrackView;
+
+ COMPILE::JS
+ private var thumb:SliderThumbView;
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ private function thumbDownHandler( event:MouseEvent ) : void
+ {
+ UIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_MOVE, thumbMoveHandler);
+ UIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_UP, thumbUpHandler);
+
+ var sliderView:ISliderView = _strand.getBeadByType(ISliderView) as ISliderView;
+
+ origin = new Point(event.screenX, event.screenY);
+ thumb = new Point(sliderView.thumb.x,sliderView.thumb.y);
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ private function thumbUpHandler( event:MouseEvent ) : void
+ {
+ UIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_MOVE, thumbMoveHandler);
+ UIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_UP, thumbUpHandler);
+
+ IEventDispatcher(_strand).dispatchEvent(new Event("valueChange"));
+ }
+
+ COMPILE::SWF
+ private var origin:Point;
+ COMPILE::SWF
+ private var thumb:Point;
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ private function thumbMoveHandler( event:MouseEvent ) : void
+ {
+ var sliderView:ISliderView = _strand.getBeadByType(ISliderView) as ISliderView;
+
+ var deltaX:Number = event.screenX - origin.x;
+ var thumbW:Number = sliderView.thumb.width/2;
+ var newX:Number = thumb.x + deltaX;
+
+ var p:Number = newX/UIBase(_strand).width;
+ var n:Number = p*(rangeModel.maximum - rangeModel.minimum) + rangeModel.minimum;
+
+ rangeModel.value = n;
+
+ IEventDispatcher(_strand).dispatchEvent(new Event("valueChange"));
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ private function trackClickHandler( event:MouseEvent ) : void
+ {
+ event.stopImmediatePropagation();
+
+ var sliderView:ISliderView = _strand.getBeadByType(ISliderView) as ISliderView;
+
+ var xloc:Number = event.localX;
+ var p:Number = xloc/UIBase(_strand).width;
+ var n:Number = p*(rangeModel.maximum - rangeModel.minimum) + rangeModel.minimum;
+
+ rangeModel.value = n;
+
+ IEventDispatcher(_strand).dispatchEvent(new Event("valueChange"));
+ }
+
+ /**
+ */
+ COMPILE::JS
+ private function handleTrackClick(event:BrowserEvent):void
+ {
+ var host:Slider = _strand as Slider;
+ var xloc:Number = event.clientX;
+ var p:Number = Math.min(1, xloc / parseInt(track.element.style.width, 10));
+ var n:Number = p * (host.maximum - host.minimum) +
+ host.minimum;
+
+ host.value = n;
+
+ origin = parseInt(thumb.element.style.left, 10);
+ position = parseInt(thumb.element.style.left, 10);
+
+ calcValFromMousePosition(event, true);
+
+ host.dispatchEvent(new org.apache.flex.events.Event('valueChange'));
+ }
+
+
+ /**
+ */
+ COMPILE::JS
+ private function handleThumbDown(event:BrowserEvent):void
+ {
+ var host:Slider = _strand as Slider;
+ goog.events.listen(host.element, goog.events.EventType.MOUSEUP,
+ handleThumbUp, false, this);
+ goog.events.listen(host.element, goog.events.EventType.MOUSEMOVE,
+ handleThumbMove, false, this);
+
+ origin = event.clientX;
+ position = parseInt(thumb.element.style.left, 10);
+ }
+
+ COMPILE::JS
+ private var origin:Number;
+ COMPILE::JS
+ private var position:int;
+
+ /**
+ */
+ COMPILE::JS
+ private function handleThumbUp(event:BrowserEvent):void
+ {
+ var host:Slider = _strand as Slider;
+ goog.events.unlisten(host.element, goog.events.EventType.MOUSEUP,
+ handleThumbUp, false, this);
+ goog.events.unlisten(host.element, goog.events.EventType.MOUSEMOVE,
+ handleThumbMove, false, this);
+
+ calcValFromMousePosition(event, false);
+
+ host.dispatchEvent(new org.apache.flex.events.Event('valueChange'));
+ }
+
+
+ /**
+ */
+ COMPILE::JS
+ private function handleThumbMove(event:BrowserEvent):void
+ {
+ var host:Slider = _strand as Slider;
+ calcValFromMousePosition(event, false);
+
+ host.dispatchEvent(new org.apache.flex.events.Event('valueChange'));
+ }
+
+
+ /**
+ */
+ COMPILE::JS
+ private function calcValFromMousePosition(event:BrowserEvent, useOffset:Boolean):void
+ {
+ var host:Slider = _strand as Slider;
+ var deltaX:Number = (useOffset ? event.offsetX : event.clientX) - origin;
+ var thumbW:int = parseInt(thumb.element.style.width, 10) / 2;
+ var newX:Number = position + deltaX;
+
+ var p:Number = newX / parseInt(track.element.style.width, 10);
+ var n:Number = p * (host.maximum - host.minimum) +
+ host.minimum;
+ n = host.snap(n);
+ if (n < host.minimum) n = host.minimum;
+ else if (n > host.maximum) n = host.maximum;
+
+ p = (n - host.minimum) / (host.maximum -
+ host.minimum);
+ newX = p * parseInt(track.element.style.width, 10);
+
+ thumb.element.style.left = String(newX -
+ parseInt(thumb.element.style.width, 10) / 2) + 'px';
+
+ host.value = n;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/SpinnerMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/SpinnerMouseController.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/SpinnerMouseController.as
new file mode 100644
index 0000000..2a898d8
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/SpinnerMouseController.as
@@ -0,0 +1,124 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.controllers
+{
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IRangeModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.html.TextButton;
+ import org.apache.flex.html.beads.ISpinnerView;
+ COMPILE::JS
+ {
+ import org.apache.flex.html.Spinner;
+ import org.apache.flex.html.supportClasses.SpinnerButton;
+ import goog.events;
+ import goog.events.EventType;
+ }
+
+ /**
+ * The SpinnerMouseController class bead handles mouse events on the
+ * org.apache.flex.html.Spinner's component buttons, changing the
+ * value of the Spinner.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SpinnerMouseController implements IBeadController
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SpinnerMouseController()
+ {
+ }
+
+ private var rangeModel:IRangeModel;
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @flexjsignorecoercion org.apache.flex.html.Spinner
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ rangeModel = UIBase(value).model as IRangeModel;
+
+ COMPILE::SWF
+ {
+ var spinnerBead:ISpinnerView = value.getBeadByType(ISpinnerView) as ISpinnerView;
+ spinnerBead.decrement.addEventListener(MouseEvent.CLICK, decrementClickHandler);
+ spinnerBead.decrement.addEventListener("buttonRepeat", decrementClickHandler);
+ spinnerBead.increment.addEventListener(MouseEvent.CLICK, incrementClickHandler);
+ spinnerBead.increment.addEventListener("buttonRepeat", incrementClickHandler);
+ }
+
+ COMPILE::JS
+ {
+ var spinnerBead:ISpinnerView = value.getBeadByType(ISpinnerView) as ISpinnerView;
+
+ var incrementButton:SpinnerButton = spinnerBead.increment;
+ var decrementButton:SpinnerButton = spinnerBead.decrement;
+
+ goog.events.listen(incrementButton.element, goog.events.EventType.CLICK,
+ incrementClickHandler);
+
+ goog.events.listen(decrementButton.element, goog.events.EventType.CLICK,
+ decrementClickHandler);
+
+ }
+ }
+
+ /**
+ * @private
+ */
+ private function decrementClickHandler( event:org.apache.flex.events.MouseEvent ) : void
+ {
+ rangeModel.value = Math.max(rangeModel.minimum, rangeModel.value - rangeModel.stepSize);
+ IEventDispatcher(_strand).dispatchEvent(new Event("valueChange"));
+ }
+
+ /**
+ * @private
+ */
+ private function incrementClickHandler( event:org.apache.flex.events.MouseEvent ) : void
+ {
+ rangeModel.value = Math.min(rangeModel.maximum, rangeModel.value + rangeModel.stepSize);
+ IEventDispatcher(_strand).dispatchEvent(new Event("valueChange"));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/TreeSingleSelectionMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/TreeSingleSelectionMouseController.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/TreeSingleSelectionMouseController.as
new file mode 100644
index 0000000..a668fa4
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/TreeSingleSelectionMouseController.as
@@ -0,0 +1,82 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.controllers
+{
+ import org.apache.flex.collections.FlattenedList;
+ import org.apache.flex.html.Tree
+ import org.apache.flex.events.ItemClickedEvent;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The TreeSingleSelectionMouseController class is a controller for
+ * org.apache.flex.html.Tree. This controller watches for selection
+ * events on the tree item renderers and uses those events to open
+ * or close nodes of the tree.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TreeSingleSelectionMouseController extends ListSingleSelectionMouseController
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TreeSingleSelectionMouseController()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @private
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ super.strand = value;
+ }
+
+ /**
+ * @private
+ */
+ override protected function selectedHandler(event:ItemClickedEvent):void
+ {
+ var tree:Tree = _strand as Tree;
+ var flatList:FlattenedList = listModel.dataProvider as FlattenedList;
+ var node:Object = event.data;
+
+ if (flatList.isOpen(node)) {
+ flatList.closeNode(node);
+ } else {
+ flatList.openNode(node);
+ }
+
+ listModel.dispatchEvent(new Event("dataProviderChanged"));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/VScrollBarMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/VScrollBarMouseController.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/VScrollBarMouseController.as
new file mode 100644
index 0000000..611f6dd
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/VScrollBarMouseController.as
@@ -0,0 +1,101 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.controllers
+{
+ import flash.display.DisplayObject;
+
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The VScrollBarMouseController class is the controller for
+ * org.apache.flex.html.supportClasses.ScrollBar
+ * that acts as the Vertical ScrollBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VScrollBarMouseController extends ScrollBarMouseControllerBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function VScrollBarMouseController()
+ {
+ }
+
+ /**
+ * @private
+ */
+ override protected function trackClickHandler(event:MouseEvent):void
+ {
+ if (sbView.thumb.visible)
+ {
+ if (event.localY < sbView.thumb.y)
+ {
+ sbModel.value = snap(Math.max(sbModel.minimum, sbModel.value - sbModel.pageStepSize));
+ IEventDispatcher(strand).dispatchEvent(new Event("scroll"));
+ }
+ else
+ {
+ sbModel.value = snap(Math.min(sbModel.maximum - sbModel.pageSize, sbModel.value + sbModel.pageStepSize));
+ IEventDispatcher(strand).dispatchEvent(new Event("scroll"));
+ }
+ }
+ }
+
+ private var thumbDownY:Number;
+ private var lastThumbY:Number;
+
+ /**
+ * @private
+ */
+ override protected function thumbMouseDownHandler(event:MouseEvent):void
+ {
+ sbView.thumb.stage.addEventListener(MouseEvent.MOUSE_MOVE, thumbMouseMoveHandler);
+ sbView.thumb.stage.addEventListener(MouseEvent.MOUSE_UP, thumbMouseUpHandler);
+ thumbDownY = event.screenY;
+ lastThumbY = sbView.thumb.y;
+ }
+
+ private function thumbMouseMoveHandler(event:MouseEvent):void
+ {
+ var thumb:DisplayObject = sbView.thumb;
+ var track:DisplayObject = sbView.track;
+ thumb.y = Math.max(track.y, Math.min(lastThumbY + (event.screenY - thumbDownY), track.y + track.height - thumb.height));
+ var newValue:Number = snap((thumb.y - track.y) / (track.height - thumb.height) * (sbModel.maximum - sbModel.minimum - sbModel.pageSize));
+ sbModel.value = newValue;
+ IEventDispatcher(strand).dispatchEvent(new Event("scroll"));
+ }
+
+ private function thumbMouseUpHandler(event:MouseEvent):void
+ {
+ sbView.thumb.stage.removeEventListener(MouseEvent.MOUSE_MOVE, thumbMouseMoveHandler);
+ sbView.thumb.stage.removeEventListener(MouseEvent.MOUSE_UP, thumbMouseUpHandler);
+ }
+ }
+}
[04/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - try to
copy HTML to Basic without losing history
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/Viewport.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/Viewport.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/Viewport.as
new file mode 100644
index 0000000..285282a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/Viewport.as
@@ -0,0 +1,151 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IContentView;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.IViewport;
+ import org.apache.flex.core.IViewportModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.geom.Size;
+ import org.apache.flex.html.beads.models.ScrollBarModel;
+ import org.apache.flex.utils.CSSContainerUtils;
+
+ /**
+ * A Viewport is the area of a Container set aside for displaying
+ * content and any scrolling controls.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class Viewport implements IBead, IViewport
+ {
+ /**
+ * Constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Viewport()
+ {
+ }
+
+ protected var contentArea:UIBase;
+
+ /**
+ * Get the actual parent of the container's content.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get contentView():IUIBase
+ {
+ return contentArea;
+ }
+
+ protected var _strand:IStrand;
+
+ /**
+ * @flexjsignorecoercion Class
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ contentArea = _strand.getBeadByType(IContentView) as UIBase;
+ if (!contentArea)
+ {
+ var c:Class = ValuesManager.valuesImpl.getValue(_strand, 'iContentView') as Class;
+ contentArea = new c() as UIBase;
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IViewport#setPosition()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setPosition(x:Number, y:Number):void
+ {
+ contentArea.x = x;
+ contentArea.y = y;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IViewport#layoutViewportBeforeContentLayout()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function layoutViewportBeforeContentLayout(width:Number, height:Number):void
+ {
+ if (!isNaN(width))
+ contentArea.width = width;
+ if (!isNaN(height))
+ contentArea.height = height;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IViewport#layoutViewportAfterContentLayout()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function layoutViewportAfterContentLayout():Size
+ {
+ // pass through all of the children and determine the maxWidth and maxHeight
+ // note: this is not done on the JavaScript side because the browser handles
+ // this automatically.
+ var maxWidth:Number = 0;
+ var maxHeight:Number = 0;
+ var num:Number = contentArea.numElements;
+
+ for (var i:int=0; i < num; i++) {
+ var child:IUIBase = contentArea.getElementAt(i) as IUIBase;
+ if (child == null || !child.visible) continue;
+ var childXMax:Number = child.x + child.width;
+ var childYMax:Number = child.y + child.height;
+ maxWidth = Math.max(maxWidth, childXMax);
+ maxHeight = Math.max(maxHeight, childYMax);
+ }
+
+ var padding:Rectangle = CSSContainerUtils.getPaddingMetrics(this._strand);
+ return new Size(maxWidth + padding.right, maxHeight + padding.bottom);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/TextButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/TextButton.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/TextButton.as
new file mode 100644
index 0000000..83a2821
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/TextButton.as
@@ -0,0 +1,30 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.svg
+{
+ import org.apache.flex.html.TextButton;
+
+ public class TextButton extends org.apache.flex.html.TextButton
+ {
+ public function TextButton()
+ {
+ super();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/resources/basic-as-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/resources/basic-as-manifest.xml b/frameworks/projects/Basic/src/main/resources/basic-as-manifest.xml
new file mode 100644
index 0000000..26b7d42
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/resources/basic-as-manifest.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+
+<componentPackage>
+
+ <!-- component id="ListViewNoSelectionState" class="org.apache.flex.html.beads.ListViewNoSelectionState"/ -->
+ <!--<component id="MultilineTextFieldView" class="org.apache.flex.html.beads.MultilineTextFieldView"/>-->
+
+ <component id="TextFieldItemRenderer" class="org.apache.flex.html.supportClasses.TextFieldItemRenderer"/>
+ <component id="HScrollBar" class="org.apache.flex.html.supportClasses.HScrollBar"/>
+ <component id="VScrollBar" class="org.apache.flex.html.supportClasses.VScrollBar"/>
+ <!--
+ <component id="HRuleView" class="org.apache.flex.html.beads.HRuleView" />
+ <component id="VRuleView" class="org.apache.flex.html.beads.VRuleView" />
+ -->
+ <!--
+ <component id="ImageAndTextButtonView" class="org.apache.flex.html.beads.ImageAndTextButtonView" />
+ -->
+</componentPackage>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
new file mode 100644
index 0000000..6737a40
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+
+<componentPackage>
+
+ <component id="Button" class="org.apache.flex.html.Button"/>
+ <component id="CloseButton" class="org.apache.flex.html.CloseButton"/>
+ <component id="ButtonBar" class="org.apache.flex.html.ButtonBar"/>
+ <component id="DropDownList" class="org.apache.flex.html.DropDownList"/>
+ <component id="DropDownListList" class="org.apache.flex.html.supportClasses.DropDownListList"/>
+ <component id="Image" class="org.apache.flex.html.Image"/>
+ <component id="Label" class="org.apache.flex.html.Label"/>
+ <component id="MultilineLabel" class="org.apache.flex.html.MultilineLabel"/>
+ <component id="ImageAndTextButton" class="org.apache.flex.html.ImageAndTextButton"/>
+ <component id="TextButton" class="org.apache.flex.html.TextButton"/>
+ <component id="ToggleTextButton" class="org.apache.flex.html.ToggleTextButton"/>
+ <component id="TextInput" class="org.apache.flex.html.TextInput"/>
+ <component id="TextArea" class="org.apache.flex.html.TextArea"/>
+ <component id="List" class="org.apache.flex.html.List"/>
+ <component id="SimpleList" class="org.apache.flex.html.SimpleList"/>
+ <component id="CheckBox" class="org.apache.flex.html.CheckBox"/>
+ <component id="RadioButton" class="org.apache.flex.html.RadioButton"/>
+ <component id="ComboBox" class="org.apache.flex.html.ComboBox"/>
+ <component id="Container" class="org.apache.flex.html.Container"/>
+ <component id="Form" class="org.apache.flex.html.Form"/>
+ <component id="HContainer" class="org.apache.flex.html.HContainer"/>
+ <component id="VContainer" class="org.apache.flex.html.VContainer"/>
+ <component id="Panel" class="org.apache.flex.html.Panel"/>
+ <component id="PanelView" class="org.apache.flex.html.beads.PanelView"/>
+ <component id="ImageView" class="org.apache.flex.html.beads.ImageView"/>
+ <component id="PanelWithControlBar" class="org.apache.flex.html.PanelWithControlBar"/>
+ <component id="ControlBar" class="org.apache.flex.html.ControlBar"/>
+ <component id="RangeStepper" class="org.apache.flex.html.RangeStepper" />
+ <component id="TitleBar" class="org.apache.flex.html.TitleBar"/>
+ <component id="ImageModel" class="org.apache.flex.html.beads.models.ImageModel"/>
+ <component id="TitleBarModel" class="org.apache.flex.html.beads.models.TitleBarModel"/>
+ <component id="ToolTip" class="org.apache.flex.html.ToolTip"/>
+ <component id="Tree" class="org.apache.flex.html.Tree"/>
+ <component id="BasicLayout" class="org.apache.flex.html.beads.layouts.BasicLayout"/>
+ <component id="VerticalLayout" class="org.apache.flex.html.beads.layouts.VerticalLayout"/>
+ <component id="HorizontalLayout" class="org.apache.flex.html.beads.layouts.HorizontalLayout"/>
+ <component id="TileLayout" class="org.apache.flex.html.beads.layouts.TileLayout"/>
+ <component id="ListView" class="org.apache.flex.html.beads.ListView"/>
+ <!--<component id="MultilineTextFieldView" class="org.apache.flex.html.beads.MultilineTextFieldView"/>-->
+
+ <component id="SimpleAlert" class="org.apache.flex.html.SimpleAlert"/>
+ <component id="Alert" class="org.apache.flex.html.Alert"/>
+ <component id="Spinner" class="org.apache.flex.html.Spinner"/>
+ <component id="Slider" class="org.apache.flex.html.Slider"/>
+ <component id="NumericStepper" class="org.apache.flex.html.NumericStepper" />
+ <component id="StringItemRenderer" class="org.apache.flex.html.supportClasses.StringItemRenderer"/>
+ <component id="TreeItemRenderer" class="org.apache.flex.html.supportClasses.TreeItemRenderer"/>
+ <component id="DataItemRenderer" class="org.apache.flex.html.supportClasses.DataItemRenderer"/>
+ <component id="ButtonBarButtonItemRenderer" class="org.apache.flex.html.supportClasses.ButtonBarButtonItemRenderer"/>
+ <!--
+ <component id="TextFieldItemRenderer" class="org.apache.flex.html.supportClasses.TextFieldItemRenderer"/>
+ <component id="HScrollBar" class="org.apache.flex.html.supportClasses.HScrollBar"/>
+ <component id="VScrollBar" class="org.apache.flex.html.supportClasses.VScrollBar"/>
+ <component id="HRuleView" class="org.apache.flex.html.beads.HRuleView" />
+ <component id="VRuleView" class="org.apache.flex.html.beads.VRuleView" />
+ -->
+ <component id="NumericOnlyTextInputBead" class="org.apache.flex.html.accessories.NumericOnlyTextInputBead" />
+ <component id="PasswordInputBead" class="org.apache.flex.html.accessories.PasswordInputBead" />
+ <component id="TextPromptBead" class="org.apache.flex.html.accessories.TextPromptBead" />
+ <component id="HRule" class="org.apache.flex.html.HRule" />
+ <component id="VRule" class="org.apache.flex.html.VRule" />
+ <component id="Spacer" class="org.apache.flex.html.Spacer" />
+ <!--
+ <component id="ImageAndTextButtonView" class="org.apache.flex.html.beads.ImageAndTextButtonView" />
+ -->
+ <component id="ScrollingViewport" class="org.apache.flex.html.supportClasses.ScrollingViewport" />
+
+ <component id="ArraySelectionModel" class="org.apache.flex.html.beads.models.ArraySelectionModel" />
+ <component id="ArrayListSelectionModel" class="org.apache.flex.html.beads.models.ArrayListSelectionModel" />
+
+ <component id="DataGrid" class="org.apache.flex.html.DataGrid"/>
+ <component id="DataProviderChangeNotifier" class="org.apache.flex.html.beads.DataProviderChangeNotifier"/>
+ <component id="DataGridButtonBar" class="org.apache.flex.html.DataGridButtonBar"/>
+ <component id="DataGridButtonBarTextButton" class="org.apache.flex.html.DataGridButtonBarTextButton"/>
+ <component id="DataGridColumn" class="org.apache.flex.html.supportClasses.DataGridColumn"/>
+ <component id="DataGridLinesBead" class="org.apache.flex.html.beads.DataGridLinesBead"/>
+ <component id="DataGridColumnList" class="org.apache.flex.html.supportClasses.DataGridColumnList"/>
+ <component id="DataGridLayout" class="org.apache.flex.html.beads.layouts.DataGridLayout" />
+ <component id="DataGridPercentageLayout" class="org.apache.flex.html.beads.layouts.DataGridPercentageLayout" />
+
+ <component id="DataItemRendererFactoryForArrayData" class="org.apache.flex.html.beads.DataItemRendererFactoryForArrayData" />
+ <component id="DataItemRendererFactoryForArrayList" class="org.apache.flex.html.beads.DataItemRendererFactoryForArrayList" />
+ <component id="DataItemRendererFactoryForHierarchicalData" class="org.apache.flex.html.beads.DataItemRendererFactoryForHierarchicalData" />
+ <component id="TextItemRendererFactoryForArrayData" class="org.apache.flex.html.beads.TextItemRendererFactoryForArrayData" />
+ <component id="TextItemRendererFactoryForStringVectorData" class="org.apache.flex.html.beads.TextItemRendererFactoryForStringVectorData" />
+
+ <component id="DateChooser" class="org.apache.flex.html.DateChooser"/>
+ <component id="DateField" class="org.apache.flex.html.DateField"/>
+ <component id="VerticalColumnLayout" class="org.apache.flex.html.beads.layouts.VerticalColumnLayout" />
+
+ <component id="ToolTipBead" class="org.apache.flex.html.accessories.ToolTipBead" />
+
+ <component id="LayoutChangeNotifier" class="org.apache.flex.html.beads.layouts.LayoutChangeNotifier"/>
+ <component id="ImageButton" class="org.apache.flex.html.ImageButton"/>
+ <component id="FlexibleFirstChildHorizontalLayout" class="org.apache.flex.html.beads.layouts.FlexibleFirstChildHorizontalLayout"/>
+ <component id="OneFlexibleChildVerticalLayout" class="org.apache.flex.html.beads.layouts.OneFlexibleChildVerticalLayout"/>
+ <component id="OneFlexibleChildHorizontalLayout" class="org.apache.flex.html.beads.layouts.OneFlexibleChildHorizontalLayout"/>
+ <component id="MXMLBeadView" class="org.apache.flex.html.MXMLBeadView"/>
+
+ <component id="Border" class="org.apache.flex.html.supportClasses.Border"/>
+
+ <component id="WebBrowser" class="org.apache.flex.html.WebBrowser" />
+
+</componentPackage>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/resources/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/resources/defaults.css b/frameworks/projects/Basic/src/main/resources/defaults.css
new file mode 100644
index 0000000..40ed0b5
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/resources/defaults.css
@@ -0,0 +1,672 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+@namespace "library://ns.apache.org/flexjs/basic";
+@namespace svg "library://ns.apache.org/flexjs/svg";
+
+/* Global style declaration */
+*
+{
+ font-family: "Arial";
+ font-size: 12px;
+ border-width: 1px;
+}
+
+.flexjs *, . flexjs *:before, . flexjs *:after {
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+}
+
+Application
+{
+ padding: 0px;
+ margin: 0px;
+}
+
+Button
+{
+ background-color: #f8f8f8;
+ border: 1px solid #808080;
+ border-radius: 2px;
+ padding: 4px;
+ margin: 0px;
+}
+
+Button:hover
+{
+ background-color: #e8e8e8;
+ border: 1px solid #808080;
+ padding: 4px;
+}
+
+Button:active
+{
+ background-color: #d8d8d8;
+ border: 1px solid #808080;
+ padding: 4px;
+}
+
+ButtonBar
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.ButtonBarView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.ButtonBarLayout");
+ IContentView: ClassReference("org.apache.flex.html.supportClasses.DataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.beads.TextItemRendererFactoryForArrayData");
+ IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
+ IItemRenderer: ClassReference("org.apache.flex.html.supportClasses.ButtonBarButtonItemRenderer");
+
+ border-style: none;
+}
+
+ButtonBarButtonItemRenderer
+{
+ width: 80;
+ height: 30;
+}
+
+Container
+{
+ IBeadView: ClassReference("org.apache.flex.html.beads.ContainerView");
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.BasicLayout");
+ IContentView: ClassReference("org.apache.flex.html.supportClasses.ContainerContentArea");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.Viewport");
+ IViewportModel: ClassReference("org.apache.flex.html.beads.models.ViewportModel");
+}
+
+ControlBar
+{
+ IBeadView: ClassReference("org.apache.flex.html.beads.ContainerView");
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.FlexibleFirstChildHorizontalLayout");
+
+ background-color: #CECECE;
+ border-style: none;
+ /*border-style: solid;
+ border-color: #000000;
+ border-width: 1px;*/
+}
+
+/* ASJS */
+DataGrid
+{
+ IDataGridPresentationModel: ClassReference("org.apache.flex.html.beads.models.DataGridPresentationModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.DataGridView");
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.DataGridModel");
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.DataGridLayout");
+
+ background-color: #FFFFFF;
+ border-style: solid;
+ border-color: #222222;
+ border-width: 1px;
+}
+
+DataGridButtonBar
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.ButtonBarView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.ButtonBarLayout");
+ IContentView: ClassReference("org.apache.flex.html.supportClasses.DataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.beads.TextItemRendererFactoryForArrayData");
+ IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
+ IItemRenderer: ClassReference("org.apache.flex.html.supportClasses.DataGridButtonBarButtonItemRenderer");
+
+ border-style: none;
+}
+
+DataGridColumnList {
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.DataGridModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.ListView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.VerticalLayout");
+ IContentView: ClassReference("org.apache.flex.html.supportClasses.DataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.beads.DataItemRendererFactoryForArrayList");
+ IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
+ IItemRenderer: ClassReference("org.apache.flex.html.supportClasses.StringItemRenderer");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.Viewport");
+ IViewportModel: ClassReference("org.apache.flex.html.beads.models.ViewportModel");
+ border-style: none;
+ background-color: #FFFFFF;
+}
+
+.DataGridListArea {
+ background-color: #FFFFFF;
+ border-style: solid;
+ border-color: #333333;
+}
+
+DateChooser {
+ IBeadView: ClassReference("org.apache.flex.html.beads.DateChooserView");
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.DateChooserModel");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.DateChooserMouseController");
+ width: 280px;
+ height: 240px;
+}
+
+DateField {
+ IBeadView: ClassReference("org.apache.flex.html.beads.DateFieldView");
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.DateChooserModel");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.DateFieldMouseController");
+ IFormatBead: ClassReference("org.apache.flex.html.accessories.DateFormatMMDDYYYYBead");
+}
+
+RangeStepper {
+ IBeadView: ClassReference("org.apache.flex.html.beads.RangeStepperView");
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.RangeModelExtended");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.RangeStepperMouseController");
+}
+
+Form {
+
+}
+
+HContainer
+{
+ IBeadView: ClassReference("org.apache.flex.html.beads.ContainerView");
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.HorizontalLayout");
+}
+
+Image
+{
+ vertical-align: top;
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ImageModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.ImageView");
+}
+
+ImageAndTextButton
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ImageAndTextModel");
+}
+
+ImageButton
+{
+ border-style: none;
+}
+
+ImageButton:hover
+{
+ border-style: none;
+}
+
+ImageButton:active
+{
+ border-style: none;
+}
+
+VContainer
+{
+ IBeadView: ClassReference("org.apache.flex.html.beads.ContainerView");
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.VerticalLayout");
+}
+
+List
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.ListView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.VerticalLayout");
+ IContentView: ClassReference("org.apache.flex.html.supportClasses.DataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.beads.DataItemRendererFactoryForArrayData");
+ IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
+ IItemRenderer: ClassReference("org.apache.flex.html.supportClasses.StringItemRenderer");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.ScrollingViewport");
+ IViewportModel: ClassReference("org.apache.flex.html.beads.models.ViewportModel");
+ border-style: solid;
+ border-color: #222222;
+}
+
+Tree
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.ListView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.TreeSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.VerticalLayout");
+ IContentView: ClassReference("org.apache.flex.html.supportClasses.DataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.beads.DataItemRendererFactoryForHierarchicalData");
+ IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
+ IItemRenderer: ClassReference("org.apache.flex.html.supportClasses.TreeItemRenderer");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.ScrollingViewport");
+ IViewportModel: ClassReference("org.apache.flex.html.beads.models.ViewportModel");
+ border-style: solid;
+ border-color: #222222;
+}
+
+NumericStepper
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.RangeModel");
+}
+
+Panel
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.PanelModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.PanelView");
+
+ background-color: #FFFFFF;
+ border-style: solid;
+ border-color: #000000;
+ border-width: 1px;
+ padding: 2px;
+}
+
+PanelWithControlBar
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.PanelModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.PanelWithControlBarView");
+
+ background-color: #FFFFFF;
+ border-style: solid;
+ border-color: #000000;
+ border-width: 1px;
+ padding: 2px;
+}
+
+SimpleList
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.ListView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.VerticalLayout");
+ IContentView: ClassReference("org.apache.flex.html.supportClasses.DataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.beads.TextItemRendererFactoryForArrayData");
+ IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
+ IItemRenderer: ClassReference("org.apache.flex.html.supportClasses.StringItemRenderer");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.ScrollingViewport");
+ IViewportModel: ClassReference("org.apache.flex.html.beads.models.ViewportModel");
+}
+
+Slider
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.RangeModel");
+}
+
+Spinner
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.RangeModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.SpinnerView");
+}
+
+
+StringItemRenderer
+{
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ItemRendererMouseController");
+ height: 16;
+}
+
+TreeItemRenderer
+{
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ItemRendererMouseController");
+ height: 16;
+}
+
+TextInput
+{
+ border: 1px solid #808080;
+ border-radius: 2px;
+ padding: 4px;
+ margin: 0px;
+}
+
+TextArea
+{
+ border: 1px solid #808080;
+ border-radius: 2px;
+ padding: 4px;
+ resize: none;
+}
+
+TitleBar
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.TitleBarModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.TitleBarView");
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.FlexibleFirstChildHorizontalLayout");
+ iMeasurementBead: ClassReference("org.apache.flex.html.beads.TitleBarMeasurementBead");
+ background-color: #E2E2E2;
+ border-style: solid;
+ border-color: #000000;
+ border-width: 1px;
+}
+
+.toggleTextButton
+{
+ background-color: #f8f8f8;
+ border: 1px solid #808080;
+ padding: 4px;
+}
+
+.toggleTextButton:hover
+{
+ background-color: #e8e8e8;
+ border: 1px solid #808080;
+ padding: 4px;
+}
+
+.toggleTextButton_Selected
+{
+ background-color: #d8d8d8;
+ border: 1px solid #808080;
+ padding: 4px;
+}
+
+.toggleTextButton_Selected:hover
+{
+ background-color: #e8e8e8;
+ border: 1px solid #808080;
+ padding: 4px;
+}
+
+ToolTip
+{
+ background-color: #FFFFCC;
+}
+
+View
+{
+ IBeadView: ClassReference("org.apache.flex.html.beads.ContainerView");
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.BasicLayout");
+ IContentView: ClassReference("org.apache.flex.html.supportClasses.ContainerContentArea");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.Viewport");
+ IViewportModel: ClassReference("org.apache.flex.html.beads.models.ViewportModel");
+}
+
+WebBrowser
+{
+ IBeadView: ClassReference("org.apache.flex.html.beads.WebBrowserView");
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.WebBrowserModel");
+}
+
+
+/* Global Style Declaration */
+global
+{
+ IStatesImpl: ClassReference("org.apache.flex.core.SimpleStatesImpl");
+ IEffectTimer: ClassReference("org.apache.flex.utils.EffectTimer");
+ effectTimerInterval: 10;
+}
+
+@media -flex-flash
+{
+
+Alert
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.AlertModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.AlertView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.AlertController");
+ iBackgroundBead: ClassReference("org.apache.flex.html.beads.SolidBackgroundBead");
+ iBorderBead: ClassReference("org.apache.flex.html.beads.SingleLineBorderBead");
+
+ background-color: #FFFFFF;
+ border-style: solid;
+ border-color: #000000;
+ border-width: 1px;
+}
+
+Border
+{
+ border-color: inherit;
+ border-style: inherit;
+ border-radius: inherit;
+ border-width: inherit;
+ border: inherit;
+}
+
+Button
+{
+ IBeadView: ClassReference("org.apache.flex.html.beads.CSSButtonView");
+}
+
+CheckBox
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ToggleButtonModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.CheckBoxView");
+}
+
+CloseButton
+{
+ IBeadView: ClassReference("org.apache.flex.html.beads.CloseButtonView");
+}
+
+ComboBox
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ComboBoxModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.ComboBoxView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ComboBoxController");
+ IPopUp: ClassReference("org.apache.flex.html.supportClasses.DropDownListList");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.beads.TextItemRendererFactoryForArrayData");
+ IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
+ IItemRenderer: ClassReference("org.apache.flex.html.supportClasses.StringItemRenderer");
+}
+
+Container
+{
+ iBackgroundBead: ClassReference("org.apache.flex.html.beads.SolidBackgroundBead");
+ iBorderBead: ClassReference("org.apache.flex.html.beads.SingleLineBorderBead");
+}
+
+ControlBar
+{
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.FlexibleFirstChildHorizontalLayout");
+ iMeasurementBead: ClassReference("org.apache.flex.html.beads.ControlBarMeasurementBead");
+ iBackgroundBead: ClassReference("org.apache.flex.html.beads.SolidBackgroundBead");
+ iBorderBead: ClassReference("org.apache.flex.html.beads.SingleLineBorderBead");
+}
+
+DropDownList
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.DropDownListView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.DropDownListController");
+ IPopUp: ClassReference("org.apache.flex.html.supportClasses.DropDownListList");
+}
+
+DropDownListList
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.beads.TextItemRendererFactoryForArrayData");
+ IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
+ IItemRenderer: ClassReference("org.apache.flex.html.supportClasses.StringItemRenderer");
+ iBackgroundBead: ClassReference('org.apache.flex.html.beads.SolidBackgroundBead');
+ border-style: solid;
+ border-radius: 4px;
+ border-color: #000000;
+ border-width: 1px;
+ background-color: #FFFFFF;
+}
+
+HRule
+{
+ IBeadView: ClassReference("org.apache.flex.html.beads.HRuleView");
+}
+
+ImageButton
+{
+ IBeadView: ClassReference("org.apache.flex.html.beads.ImageButtonView");
+}
+
+ImageAndTextButton
+{
+ IBeadView: ClassReference("org.apache.flex.html.beads.CSSImageAndTextButtonView");
+}
+
+Label
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.TextModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.TextFieldView");
+ iMeasurementBead: ClassReference("org.apache.flex.html.beads.TextFieldLabelMeasurementBead");
+}
+
+List
+{
+ iBorderBead: ClassReference('org.apache.flex.html.beads.SingleLineBorderBead');
+ iBorderModel: ClassReference('org.apache.flex.html.beads.models.SingleLineBorderModel');
+}
+
+MultilineLabel
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.TextModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.MultilineTextFieldView");
+}
+
+NumericStepper
+{
+ IBeadView: ClassReference("org.apache.flex.html.beads.NumericStepperView");
+
+ padding: 0px;
+ border-style: solid;
+ border-color: #000000;
+ border-width: 1px;
+ background-color: #FFFFFF;
+ iBorderBead: ClassReference('org.apache.flex.html.beads.SingleLineBorderBead');
+ iBackgroundBead: ClassReference('org.apache.flex.html.beads.SolidBackgroundBead');
+}
+
+Panel
+{
+ iBorderBead: ClassReference("org.apache.flex.html.beads.SingleLineBorderBead");
+ iBackgroundBead: ClassReference("org.apache.flex.html.beads.SolidBackgroundBead");
+}
+
+PanelWithControlBar
+{
+ iBorderBead: ClassReference("org.apache.flex.html.beads.SingleLineBorderBead");
+ iBackgroundBead: ClassReference("org.apache.flex.html.beads.SolidBackgroundBead");
+}
+
+RadioButton
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ValueToggleButtonModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.RadioButtonView");
+}
+
+VScrollBar
+{
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.VScrollBarLayout");
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ScrollBarModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.VScrollBarView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.VScrollBarMouseController");
+}
+
+HScrollBar
+{
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.HScrollBarLayout");
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ScrollBarModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.HScrollBarView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.HScrollBarMouseController");
+}
+
+SimpleAlert
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.AlertModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.SimpleAlertView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.AlertController");
+ iBorderBead: ClassReference("org.apache.flex.html.beads.SingleLineBorderBead");
+ iBackgroundBead: ClassReference("org.apache.flex.html.beads.SolidBackgroundBead");
+
+ background-color: #FFFFFF;
+ border-style: solid;
+ border-color: #000000;
+ border-width: 1px;
+}
+
+Slider
+{
+ iBeadView: ClassReference("org.apache.flex.html.beads.SliderView");
+ iBeadController: ClassReference("org.apache.flex.html.beads.controllers.SliderMouseController");
+ iThumbView: ClassReference("org.apache.flex.html.beads.SliderThumbView");
+ iTrackView: ClassReference("org.apache.flex.html.beads.SliderTrackView");
+}
+
+Spinner
+{
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.SpinnerMouseController");
+}
+
+TextArea
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.TextModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.TextAreaView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.EditableTextKeyboardController");
+ iBorderBead: ClassReference('org.apache.flex.html.beads.SingleLineBorderBead');
+ iBorderModel: ClassReference('org.apache.flex.html.beads.models.SingleLineBorderModel');
+ border-style: solid;
+ border-color: #000000;
+ border-width: 1px;
+ background-color: #FFFFFF;
+}
+
+TextButton
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.TextModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.CSSTextButtonView");
+ iMeasurementBead: ClassReference("org.apache.flex.html.beads.TextButtonMeasurementBead");
+}
+
+TextFieldItemRenderer
+{
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ItemRendererMouseController");
+ height: 16;
+}
+
+TextInput
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.TextModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.TextInputWithBorderView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.EditableTextKeyboardController");
+ iBorderBead: ClassReference('org.apache.flex.html.beads.SingleLineBorderBead');
+ iBackgroundBead: ClassReference('org.apache.flex.html.beads.SolidBackgroundBead');
+ border-style: solid;
+ border-color: #000000;
+ border-width: 1px;
+ background-color: #FFFFFF;
+}
+
+TitleBar
+{
+ iBorderBead: ClassReference("org.apache.flex.html.beads.SingleLineBorderBead");
+ iBackgroundBead: ClassReference("org.apache.flex.html.beads.SolidBackgroundBead");
+}
+
+ToggleTextButton
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ToggleButtonModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.CSSTextToggleButtonView");
+}
+
+View
+{
+ iBackgroundBead: ClassReference("org.apache.flex.html.beads.SolidBackgroundBead");
+ iBorderBead: ClassReference("org.apache.flex.html.beads.SingleLineBorderBead");
+}
+
+VRule
+{
+ IBeadView: ClassReference("org.apache.flex.html.beads.VRuleView");
+}
+
+/* SVG */
+
+svg|TextButton
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.TextModel");
+ IBeadView: ClassReference("org.apache.flex.html.beads.CSSTextButtonView");
+ iMeasurementBead: ClassReference("org.apache.flex.html.beads.TextButtonMeasurementBead");
+}
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/resources/svg-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/resources/svg-manifest.xml b/frameworks/projects/Basic/src/main/resources/svg-manifest.xml
new file mode 100644
index 0000000..a32483e
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/resources/svg-manifest.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+
+<componentPackage>
+ <component id="TextButton" class="org.apache.flex.svg.TextButton"/>
+</componentPackage>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/test/flex/FlexUnitFlexJSApplication.mxml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/test/flex/FlexUnitFlexJSApplication.mxml b/frameworks/projects/Basic/src/test/flex/FlexUnitFlexJSApplication.mxml
new file mode 100644
index 0000000..06ad1d6
--- /dev/null
+++ b/frameworks/projects/Basic/src/test/flex/FlexUnitFlexJSApplication.mxml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+
+<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:js="library://ns.apache.org/flexjs/basic"
+ applicationComplete="runTests()"
+ >
+ <fx:Script>
+ <![CDATA[
+ import flexUnitTests.DataGridColumnTesterTest;
+ import flexUnitTests.DataGridColumnTester;
+
+ import org.flexunit.listeners.CIListener;
+ import org.flexunit.runner.FlexUnitCore;
+
+ public function runTests() : void
+ {
+ var core : FlexUnitCore = new FlexUnitCore();
+ core.addListener(new CIListener());
+ core.run(DataGridColumnTester);
+ }
+
+ ]]>
+ </fx:Script>
+ <js:valuesImpl>
+ <js:SimpleValuesImpl />
+ </js:valuesImpl>
+
+</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/test/flex/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/test/flex/build.xml b/frameworks/projects/Basic/src/test/flex/build.xml
new file mode 100644
index 0000000..df15dc6
--- /dev/null
+++ b/frameworks/projects/Basic/src/test/flex/build.xml
@@ -0,0 +1,165 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+
+<project name="Basic.test" default="main" basedir=".">
+ <property name="FLEXJS_HOME" location="../../../../../.."/>
+
+ <property file="${FLEXJS_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${FLEXJS_HOME}/build.properties"/>
+ <property name="FLEX_HOME" value="${env.FLEX_HOME}"/>
+ <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
+ <property name="target.name" value="Core-${release.version}.swc" />
+
+ <condition property="browser" value="C:/Program Files/Internet Explorer/iexplore.exe">
+ <os family="windows"/>
+ </condition>
+ <condition property="browser" value="/Applications/Safari.app/Contents/MacOS/Safari">
+ <os family="mac"/>
+ </condition>
+
+ <property name="report.dir" value="${basedir}/out" />
+
+ <available file="${FLEXJS_HOME}/../flex-flexunit"
+ type="dir"
+ property="FLEXUNIT_HOME"
+ value="${FLEXJS_HOME}/../flex-flexunit" />
+
+ <available file="${FLEXJS_HOME}/../flexunit"
+ type="dir"
+ property="FLEXUNIT_HOME"
+ value="${FLEXJS_HOME}/../flexunit" />
+
+ <available file="${env.FLEXUNIT_HOME}"
+ type="dir"
+ property="FLEXUNIT_HOME"
+ value="${env.FLEXUNIT_HOME}"/>
+
+ <available file="${FLEXUNIT_HOME}/FlexUnit4/target"
+ type="dir"
+ property="FLEXUNIT_LIBPATH1"
+ value="-library-path+=${FLEXUNIT_HOME}/FlexUnit4/target/flexunit-4.3.0-20140410-as3_4.12.0.swc" />
+ <property name="FLEXUNIT_LIBPATH1" value="-library-path+=${FLEXUNIT_HOME}/flexunit" />
+
+ <available file="${FLEXUNIT_HOME}/FlexUnit4CIListener/target"
+ type="dir"
+ property="FLEXUNIT_LIBPATH2"
+ value="-library-path+=${FLEXUNIT_HOME}/FlexUnit4CIListener/target" />
+ <property name="FLEXUNIT_LIBPATH2" value="-define=CONFIG::dummy,false" />
+
+ <available file="${FLEXUNIT_HOME}/FlexUnit4AntTasks/target"
+ type="dir"
+ property="FLEXUNIT_CLASSPATH"
+ value="${FLEXUNIT_HOME}/FlexUnit4AntTasks/target" />
+ <property name="FLEXUNIT_CLASSPATH" value="${FLEXUNIT_HOME}/flexunit" />
+
+ <target name="main" depends="clean,compile,test" description="Clean test of ${target.name}">
+ </target>
+
+ <target name="clean">
+ <delete failonerror="false">
+ <fileset dir="${basedir}">
+ <include name="FlexUnitFlexJSApplication.swf"/>
+ </fileset>
+ </delete>
+ <delete failonerror="false" includeemptydirs="true">
+ <fileset dir="${report.dir}">
+ <include name="**/**"/>
+ </fileset>
+ </delete>
+ </target>
+
+ <path id="lib.path">
+ <fileset dir="${FALCON_HOME}/lib" includes="falcon-flexTasks.jar"/>
+ </path>
+
+ <target name="compile" description="Compiles FlexUnitApplication.swf">
+ <echo message="Compiling FlexUnitFlexJSApplication.swf"/>
+ <echo message="FLEX_HOME: ${FLEX_HOME}"/>
+ <echo message="FALCON_HOME: ${FALCON_HOME}"/>
+ <echo message="FLEXUNIT_HOME: ${FLEXUNIT_HOME}"/>
+ <echo message="playerglobal.version: ${playerglobal.version}"/>
+
+ <!-- Load the <compc> task. We can't do this at the <project> level -->
+ <!-- because targets that run before flexTasks.jar gets built would fail. -->
+ <taskdef resource="flexTasks.tasks" classpathref="lib.path"/>
+ <!--
+ Link in the classes (and their dependencies) for the MXML tags
+ listed in this project's manifest.xml.
+ Also link the additional classes (and their dependencies)
+ listed in FlexJSUIClasses.as,
+ because these aren't referenced by the manifest classes.
+ Keep the standard metadata when compiling.
+ Include the appropriate CSS files and assets in the SWC.
+ Don't include any resources in the SWC.
+ Write a bundle list of referenced resource bundles
+ into the file bundles.properties in this directory.
+ -->
+ <mxmlc fork="true"
+ file="${basedir}/FlexUnitFlexJSApplication.mxml"
+ output="${basedir}/FlexUnitFlexJSApplication.swf">
+ <jvmarg line="${mxmlc.jvm.args}"/>
+ <arg value="+flexlib=${FLEXJS_HOME}/frameworks" />
+ <arg value="-debug" />
+ <arg value="-compiler.mxml.children-as-data" />
+ <arg value="-compiler.binding-value-change-event=org.apache.flex.events.ValueChangeEvent" />
+ <arg value="-compiler.binding-value-change-event-kind=org.apache.flex.events.ValueChangeEvent" />
+ <arg value="-compiler.binding-value-change-event-type=valueChange" />
+ <arg value="+playerglobal.version=${playerglobal.version}" />
+ <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
+ <arg value="-source-path+=${FLEXJS_HOME}/frameworks/projects/Basic/src/main/flex" />
+ <arg value="-library-path+=${FLEXJS_HOME}/frameworks/libs" />
+ <arg value="${FLEXUNIT_LIBPATH1}" />
+ <arg value="${FLEXUNIT_LIBPATH2}" />
+ </mxmlc>
+ </target>
+
+ <target name="test">
+ <taskdef resource="flexUnitTasks.tasks">
+ <classpath>
+ <fileset dir="${FLEXUNIT_CLASSPATH}">
+ <include name="flexUnitTasks*.jar" />
+ </fileset>
+ </classpath>
+ </taskdef>
+ <mkdir dir="${report.dir}" />
+ <flexunit
+ swf="${basedir}/FlexUnitFlexJSApplication.swf"
+ workingDir="${basedir}"
+ toDir="${report.dir}"
+ haltonfailure="false"
+ verbose="true"
+ localTrusted="true"
+ timeout="90000">
+ <source dir="${FLEXJS_HOME}/frameworks/projects/Basic/src/main/flex" />
+ <library dir="${FLEXJS_HOME}/frameworks/libs" />
+ </flexunit>
+
+ <!-- Generate readable JUnit-style reports -->
+ <junitreport todir="${report.dir}">
+ <fileset dir="${report.dir}">
+ <include name="TEST-*.xml" />
+ </fileset>
+ <report format="frames" todir="${report.dir}/html" />
+ </junitreport>
+
+ </target>
+</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/test/flex/flexUnitTests/DataGridColumnTester.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/test/flex/flexUnitTests/DataGridColumnTester.as b/frameworks/projects/Basic/src/test/flex/flexUnitTests/DataGridColumnTester.as
new file mode 100644
index 0000000..d10c4c0
--- /dev/null
+++ b/frameworks/projects/Basic/src/test/flex/flexUnitTests/DataGridColumnTester.as
@@ -0,0 +1,27 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flexUnitTests
+{
+ [Suite]
+ [RunWith("org.flexunit.runners.Suite")]
+ public class DataGridColumnTester
+ {
+ public var dataGridColumnTesterTest:DataGridColumnTesterTest;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/test/flex/flexUnitTests/DataGridColumnTesterTest.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/test/flex/flexUnitTests/DataGridColumnTesterTest.as b/frameworks/projects/Basic/src/test/flex/flexUnitTests/DataGridColumnTesterTest.as
new file mode 100644
index 0000000..1a3cc0f
--- /dev/null
+++ b/frameworks/projects/Basic/src/test/flex/flexUnitTests/DataGridColumnTesterTest.as
@@ -0,0 +1,55 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flexUnitTests
+{
+ import flexunit.framework.Assert;
+
+ import org.apache.flex.html.supportClasses.DataGridColumn;
+
+ public class DataGridColumnTesterTest
+ {
+ [Before]
+ public function setUp():void
+ {
+ }
+
+ [After]
+ public function tearDown():void
+ {
+ }
+
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+ [Test]
+ public function testLabelProperty():void
+ {
+ var column:DataGridColumn = new DataGridColumn();
+ column.label = "foo";
+ Assert.assertEquals("Error testing DataGridColumn.label", column.label, "foo");
+ }
+ }
+}
[07/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - try to
copy HTML to Basic without losing history
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
new file mode 100644
index 0000000..77af305
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildVerticalLayout.as
@@ -0,0 +1,459 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.layouts
+{
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IDocument;
+ import org.apache.flex.core.ILayoutChild;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.utils.CSSContainerUtils;
+
+ /**
+ * The OneFlexibleChildVerticalLayout class is a simple layout
+ * bead. It takes the set of children and lays them out
+ * vertically in one column, separating them according to
+ * CSS layout rules for margin and padding styles. But it
+ * will size the one child to take up as much or little
+ * room as possible.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class OneFlexibleChildVerticalLayout implements IBeadLayout, IDocument
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function OneFlexibleChildVerticalLayout()
+ {
+ }
+
+
+ /**
+ * The id of the flexible child
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var flexibleChild:String;
+
+ private var actualChild:ILayoutChild;
+
+ // the strand/host container is also an ILayoutChild because
+ // can have its size dictated by the host's parent which is
+ // important to know for layout optimization
+ private var host:ILayoutChild;
+
+ /**
+ * @private
+ * The document.
+ */
+ private var document:Object;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ host = value as ILayoutChild;
+ }
+
+ private var _maxWidth:Number;
+
+ /**
+ * @copy org.apache.flex.core.IBead#maxWidth
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get maxWidth():Number
+ {
+ return _maxWidth;
+ }
+
+ /**
+ * @private
+ */
+ public function set maxWidth(value:Number):void
+ {
+ _maxWidth = value;
+ }
+
+ private var _maxHeight:Number;
+
+ /**
+ * @copy org.apache.flex.core.IBead#maxHeight
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get maxHeight():Number
+ {
+ return _maxHeight;
+ }
+
+ /**
+ * @private
+ */
+ public function set maxHeight(value:Number):void
+ {
+ _maxHeight = value;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBeadLayout#layout
+ */
+ public function layout():Boolean
+ {
+ var layoutParent:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParentIUIBase = layoutParent ? layoutParent.contentView : IParentIUIBase(host);
+ var padding:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
+ actualChild = document[flexibleChild];
+
+ var ilc:ILayoutChild;
+ var n:int = contentView.numElements;
+ var marginLeft:Object;
+ var marginRight:Object;
+ var marginTop:Object;
+ var marginBottom:Object;
+ var margin:Object;
+ maxWidth = 0;
+
+ var w:Number = contentView.width;
+ var hh:Number = contentView.height - padding.bottom;
+ var yy:int = padding.top;
+ var flexChildIndex:int;
+ var ml:Number;
+ var mr:Number;
+ var mt:Number;
+ var mb:Number;
+ var lastmb:Number;
+ var lastmt:Number;
+ var halign:Object;
+ var left:Number;
+ var right:Number;
+
+ for (var i:int = 0; i < n; i++)
+ {
+ var child:IUIBase = contentView.getElementAt(i) as IUIBase;
+ ilc = child as ILayoutChild;
+ left = ValuesManager.valuesImpl.getValue(child, "left");
+ right = ValuesManager.valuesImpl.getValue(child, "right");
+ if (child == actualChild)
+ {
+ flexChildIndex = i;
+ break;
+ }
+ margin = ValuesManager.valuesImpl.getValue(child, "margin");
+ if (margin is Array)
+ {
+ if (margin.length == 1)
+ marginLeft = marginTop = marginRight = marginBottom = margin[0];
+ else if (margin.length <= 3)
+ {
+ marginLeft = marginRight = margin[1];
+ marginTop = marginBottom = margin[0];
+ }
+ else if (margin.length == 4)
+ {
+ marginLeft = margin[3];
+ marginBottom = margin[2];
+ marginRight = margin[1];
+ marginTop = margin[0];
+ }
+ }
+ else if (margin == null)
+ {
+ marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left");
+ marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top");
+ marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right");
+ marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom");
+ }
+ else
+ {
+ marginLeft = marginTop = marginBottom = marginRight = margin;
+ }
+ mt = Number(marginTop);
+ if (isNaN(mt))
+ mt = 0;
+ mb = Number(marginBottom);
+ if (isNaN(mb))
+ mb = 0;
+ if (ilc)
+ {
+ if (!isNaN(ilc.percentHeight))
+ ilc.setHeight(contentView.height * ilc.percentHeight / 100, !isNaN(ilc.percentWidth));
+ }
+ if (marginLeft == "auto")
+ ml = 0;
+ else
+ {
+ ml = Number(marginLeft);
+ if (isNaN(ml))
+ ml = 0;
+ }
+ if (marginRight == "auto")
+ mr = 0;
+ else
+ {
+ mr = Number(marginRight);
+ if (isNaN(mr))
+ mr = 0;
+ }
+ if (child is ILayoutChild)
+ {
+ ilc = child as ILayoutChild;
+ if (!isNaN(ilc.percentWidth))
+ ilc.setWidth(contentView.width * ilc.percentWidth / 100, !isNaN(ilc.percentHeight));
+ }
+ maxWidth = Math.max(maxWidth, ml + child.width + mr);
+ setPositionAndWidth(child, left, ml, padding.left, right, mr, padding.right, w);
+ child.y = yy + mt;
+ yy += child.height + mt + mb;
+ lastmb = mb;
+ }
+
+ if (n > 0 && n > flexChildIndex)
+ {
+ for (i = n - 1; i > flexChildIndex; i--)
+ {
+ child = contentView.getElementAt(i) as IUIBase;
+ ilc = child as ILayoutChild;
+ left = ValuesManager.valuesImpl.getValue(child, "left");
+ right = ValuesManager.valuesImpl.getValue(child, "right");
+ margin = ValuesManager.valuesImpl.getValue(child, "margin");
+ if (margin is Array)
+ {
+ if (margin.length == 1)
+ marginLeft = marginTop = marginRight = marginBottom = margin[0];
+ else if (margin.length <= 3)
+ {
+ marginLeft = marginRight = margin[1];
+ marginTop = marginBottom = margin[0];
+ }
+ else if (margin.length == 4)
+ {
+ marginLeft = margin[3];
+ marginBottom = margin[2];
+ marginRight = margin[1];
+ marginTop = margin[0];
+ }
+ }
+ else if (margin == null)
+ {
+ marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left");
+ marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top");
+ marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right");
+ marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom");
+ }
+ else
+ {
+ marginLeft = marginTop = marginBottom = marginRight = margin;
+ }
+ mt = Number(marginTop);
+ if (isNaN(mt))
+ mt = 0;
+ mb = Number(marginBottom);
+ if (isNaN(mb))
+ mb = 0;
+ if (ilc)
+ {
+ if (!isNaN(ilc.percentHeight))
+ ilc.setHeight(contentView.height * ilc.percentHeight / 100, !isNaN(ilc.percentWidth));
+ }
+ if (marginLeft == "auto")
+ ml = 0;
+ else
+ {
+ ml = Number(marginLeft);
+ if (isNaN(ml))
+ ml = 0;
+ }
+ if (marginRight == "auto")
+ mr = 0;
+ else
+ {
+ mr = Number(marginRight);
+ if (isNaN(mr))
+ mr = 0;
+ }
+ if (child is ILayoutChild)
+ {
+ ilc = child as ILayoutChild;
+ if (!isNaN(ilc.percentWidth))
+ ilc.setWidth(contentView.width * ilc.percentWidth / 100, !isNaN(ilc.percentHeight));
+ }
+ setPositionAndWidth(child, left, ml, padding.left, right, mr, padding.right, w);
+ maxWidth = Math.max(maxWidth, ml + child.width + mr);
+ child.y = hh - child.height - mb;
+ hh -= child.height + mt + mb;
+ lastmt = mt;
+ }
+ }
+
+ child = contentView.getElementAt(flexChildIndex) as IUIBase;
+ ilc = child as ILayoutChild;
+ left = ValuesManager.valuesImpl.getValue(child, "left");
+ right = ValuesManager.valuesImpl.getValue(child, "right");
+ margin = ValuesManager.valuesImpl.getValue(child, "margin");
+ if (margin is Array)
+ {
+ if (margin.length == 1)
+ marginLeft = marginTop = marginRight = marginBottom = margin[0];
+ else if (margin.length <= 3)
+ {
+ marginLeft = marginRight = margin[1];
+ marginTop = marginBottom = margin[0];
+ }
+ else if (margin.length == 4)
+ {
+ marginLeft = margin[3];
+ marginBottom = margin[2];
+ marginRight = margin[1];
+ marginTop = margin[0];
+ }
+ }
+ else if (margin == null)
+ {
+ marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left");
+ marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top");
+ marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right");
+ marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom");
+ }
+ else
+ {
+ marginLeft = marginTop = marginBottom = marginRight = margin;
+ }
+ mt = Number(marginTop);
+ if (isNaN(mt))
+ mt = 0;
+ mb = Number(marginBottom);
+ if (isNaN(mb))
+ mb = 0;
+ if (ilc)
+ {
+ if (!isNaN(ilc.percentHeight))
+ ilc.setHeight(contentView.height * ilc.percentHeight / 100, !isNaN(ilc.percentWidth));
+ }
+ if (marginLeft == "auto")
+ ml = 0;
+ else
+ {
+ ml = Number(marginLeft);
+ if (isNaN(ml))
+ ml = 0;
+ }
+ if (marginRight == "auto")
+ mr = 0;
+ else
+ {
+ mr = Number(marginRight);
+ if (isNaN(mr))
+ mr = 0;
+ }
+ if (child is ILayoutChild)
+ {
+ ilc = child as ILayoutChild;
+ if (!isNaN(ilc.percentWidth))
+ ilc.setWidth(contentView.width * ilc.percentWidth / 100, !isNaN(ilc.percentHeight));
+ }
+ setPositionAndWidth(child, left, ml, padding.left, right, mr, padding.right, w);
+ maxWidth = Math.max(maxWidth, ml + child.width + mr);
+ child.y = yy + mt;
+ child.height = hh - mb - child.y;
+
+ return true;
+ }
+
+ private function setPositionAndWidth(child:IUIBase, left:Number, ml:Number, pl:Number,
+ right:Number, mr:Number, pr:Number, w:Number):void
+ {
+ var widthSet:Boolean = false;
+
+ var ww:Number = w;
+ var ilc:ILayoutChild = child as ILayoutChild;
+ if (!isNaN(left))
+ {
+ child.x = left + ml;
+ ww -= left + ml;
+ }
+ else
+ {
+ if (isNaN(right))
+ child.x = ml + pl;
+ ww -= ml;
+ }
+ if (!isNaN(right))
+ {
+ if (!isNaN(left))
+ {
+ if (ilc)
+ ilc.setWidth(ww - right - mr, true);
+ else
+ {
+ child.width = ww - right - mr;
+ widthSet = true;
+ }
+ }
+ else
+ child.x = w - right - mr - child.width - 1; // some browsers don't like going all the way to the edge
+ }
+ if (ilc)
+ {
+ if (!isNaN(ilc.percentWidth))
+ ilc.setWidth(w * ilc.percentWidth / 100, true);
+ }
+ if (!widthSet)
+ child.dispatchEvent(new Event("sizeChanged"));
+ }
+
+ public function setDocument(document:Object, id:String = null):void
+ {
+ this.document = document;
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/TileLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/TileLayout.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/TileLayout.as
new file mode 100644
index 0000000..a7917ff
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/TileLayout.as
@@ -0,0 +1,248 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.layouts
+{
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The TileLayout class bead sizes and positions the elements it manages into rows and columns.
+ * The size of each element is determined either by setting TileLayout's columnWidth and rowHeight
+ * properties, or having the tile size determined by factoring the numColumns into the area assigned
+ * for the layout.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TileLayout implements IBeadLayout
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TileLayout()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _numColumns:Number = 4;
+ private var _columnWidth:Number = Number.NaN;
+ private var _rowHeight:Number = Number.NaN;
+
+ /**
+ * The number of tiles to fit horizontally into the layout.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get numColumns():Number
+ {
+ return _numColumns;
+ }
+ public function set numColumns(value:Number):void
+ {
+ _numColumns = value;
+ }
+
+ /**
+ * The width of each column, in pixels. If left unspecified, the
+ * columnWidth is determined by dividing the numColumns into the
+ * strand's bounding box width.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get columnWidth():Number
+ {
+ return _columnWidth;
+ }
+ public function set columnWidth(value:Number):void
+ {
+ _columnWidth = value;
+ }
+
+ /**
+ * The height of each row, in pixels. If left unspecified, the
+ * rowHeight is determine by dividing the possible number of rows
+ * into the strand's bounding box height.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get rowHeight():Number
+ {
+ return _rowHeight;
+ }
+ public function set rowHeight(value:Number):void
+ {
+ _rowHeight = value;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBeadLayout#layout
+ */
+ public function layout():Boolean
+ {
+ COMPILE::SWF
+ {
+ // this is where the layout is calculated
+ var host:UIBase = _strand as UIBase;
+ var p:ILayoutHost = _strand.getBeadByType(ILayoutHost) as ILayoutHost;
+ var area:UIBase = p.contentView as UIBase;
+
+ var xpos:Number = 0;
+ var ypos:Number = 0;
+ var useWidth:Number = columnWidth;
+ var useHeight:Number = rowHeight;
+ var n:Number = area.numElements;
+ if (n == 0) return false;
+
+ var realN:Number = n;
+ for(var j:int=0; j < n; j++)
+ {
+ var testChild:IUIBase = area.getElementAt(i) as IUIBase;
+ if (testChild && !testChild.visible) realN--;
+ }
+
+ if (isNaN(useWidth)) useWidth = Math.floor(host.width / numColumns); // + gap
+ if (isNaN(useHeight)) {
+ // given the width and total number of items, how many rows?
+ var numRows:Number = Math.floor(realN/numColumns);
+ useHeight = Math.floor(host.height / numRows);
+ }
+
+ var maxWidth:Number = useWidth;
+ var maxHeight:Number = useHeight;
+
+ for(var i:int=0; i < n; i++)
+ {
+ var child:IUIBase = area.getElementAt(i) as IUIBase;
+ if (child && !child.visible) continue;
+ child.width = useWidth;
+ child.height = useHeight;
+ child.x = xpos;
+ child.y = ypos;
+
+ xpos += useWidth;
+ maxWidth = Math.max(maxWidth,xpos);
+
+ var test:Number = (i+1)%numColumns;
+
+ if (test == 0) {
+ xpos = 0;
+ ypos += useHeight;
+ maxHeight = Math.max(maxHeight,ypos);
+ }
+ }
+
+ maxWidth = Math.max(maxWidth, numColumns*useWidth);
+ maxHeight = Math.max(maxHeight, numRows*useHeight);
+
+ // Only return true if the contentView needs to be larger; that new
+ // size is stored in the model.
+ var sizeChanged:Boolean = true;
+
+ IEventDispatcher(_strand).dispatchEvent( new Event("layoutComplete") );
+
+ return sizeChanged;
+ }
+ COMPILE::JS
+ {
+ var children:Array;
+ var i:int;
+ var n:int;
+ var child:UIBase;
+ var xpos:Number;
+ var ypos:Number;
+ var useWidth:Number;
+ var useHeight:Number;
+
+ var host:UIBase = _strand as UIBase;
+ var viewBead:ILayoutHost = _strand.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParentIUIBase = viewBead.contentView;
+ children = contentView.internalChildren();
+ n = children.length;
+ if (n === 0) return false;
+
+ viewBead.contentView.width = host.width;
+
+ var realN:int = n;
+ for (i = 0; i < n; i++)
+ {
+ child = children[i].flexjs_wrapper;
+ if (!child.visible) realN--;
+ }
+
+ xpos = 0;
+ ypos = 0;
+ useWidth = columnWidth;
+ useHeight = rowHeight;
+
+ if (isNaN(useWidth)) useWidth = Math.floor(host.width / numColumns); // + gap
+ if (isNaN(useHeight)) {
+ // given the width and total number of items, how many rows?
+ var numRows:Number = Math.floor(realN / numColumns);
+ useHeight = Math.floor(host.height / numRows);
+ }
+
+ for (i = 0; i < n; i++)
+ {
+ child = children[i].flexjs_wrapper;
+ if (!child.visible) continue;
+ child.setDisplayStyleForLayout('inline-block');
+ child.width = useWidth;
+ child.height = useHeight;
+ }
+ return true;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VScrollBarLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VScrollBarLayout.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VScrollBarLayout.as
new file mode 100644
index 0000000..612519a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VScrollBarLayout.as
@@ -0,0 +1,122 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.layouts
+{
+ import flash.display.DisplayObject;
+
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IScrollBarModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.html.beads.IScrollBarView;
+ import org.apache.flex.html.beads.ScrollBarView;
+ import org.apache.flex.utils.CSSContainerUtils;
+
+ /**
+ * The VScrollBarLayout class is a layout
+ * bead that displays lays out the pieces of a
+ * vertical ScrollBar like the thumb, track
+ * and arrow buttons.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VScrollBarLayout implements IBeadLayout
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function VScrollBarLayout()
+ {
+ }
+
+ private var sbModel:IScrollBarModel;
+ private var sbView:IScrollBarView;
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ sbView = _strand.getBeadByType(IScrollBarView) as IScrollBarView;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBeadLayout#layout
+ */
+ public function layout():Boolean
+ {
+ if (!sbModel)
+ sbModel = _strand.getBeadByType(IScrollBarModel) as IScrollBarModel
+
+ var metrics:Rectangle = CSSContainerUtils.getBorderAndPaddingMetrics(_strand);
+
+ var h:Number = DisplayObject(_strand).height + metrics.top + metrics.bottom;
+ var increment:DisplayObject = sbView.increment;
+ var decrement:DisplayObject = sbView.decrement;
+ var track:DisplayObject = sbView.track;
+ var thumb:DisplayObject = sbView.thumb;
+
+ decrement.x = 0;
+ decrement.y = 0;
+
+ increment.x = 0;
+ increment.y = h - increment.height - 1;
+
+ if (track.width < thumb.width)
+ track.x = (thumb.width - track.width) / 2;
+ else if (track.width > thumb.width)
+ thumb.x = (track.width - thumb.width) / 2;
+ else
+ track.x = 0;
+ track.y = decrement.height;
+ track.height = increment.y - decrement.height;
+ thumb.height = sbModel.pageSize / (sbModel.maximum - sbModel.minimum) * track.height;
+ if (track.height > thumb.height)
+ {
+ thumb.visible = true;
+ thumb.y = (sbModel.value / (sbModel.maximum - sbModel.minimum - sbModel.pageSize) * (track.height - thumb.height)) + track.y;
+ }
+ else
+ {
+ thumb.visible = false;
+ }
+
+ return true;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as
new file mode 100644
index 0000000..6eaa30a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalColumnLayout.as
@@ -0,0 +1,199 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.layouts
+{
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IContainer;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IMeasurementBead;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.utils.CSSUtils;
+ import org.apache.flex.utils.CSSContainerUtils;
+
+ /**
+ * ColumnLayout is a class that organizes the positioning of children
+ * of a container into a set of columns where each column's width is set to
+ * the maximum size of all of the children in that column.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VerticalColumnLayout implements IBeadLayout
+ {
+ /**
+ * constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function VerticalColumnLayout()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+
+ private var _numColumns:int;
+
+ /**
+ * The number of columns.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get numColumns():int
+ {
+ return _numColumns;
+ }
+ public function set numColumns(value:int):void
+ {
+ _numColumns = value;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBeadLayout#layout
+ */
+ public function layout():Boolean
+ {
+ var host:UIBase = UIBase(_strand);
+ var layoutParent:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParent = layoutParent.contentView;
+ var padding:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
+ var sw:Number = host.width;
+ var sh:Number = host.height;
+
+ var hasWidth:Boolean = !host.isWidthSizedToContent();
+ var hasHeight:Boolean = !host.isHeightSizedToContent();
+ var e:IUIBase;
+ var i:int;
+ var col:int = 0;
+ var columns:Array = [];
+ var rows:Array = [];
+ var data:Array = [];
+ for (i = 0; i < numColumns; i++)
+ columns[i] = 0;
+
+ var marginLeft:Object;
+ var marginRight:Object;
+ var marginTop:Object;
+ var marginBottom:Object;
+ var margin:Object;
+ var ml:Number;
+ var mr:Number;
+ var mt:Number;
+ var mb:Number;
+ var n:int = contentView.numElements;
+ var rowData:Object = { rowHeight: 0 };
+
+ // determine max widths of columns
+ for (i = 0; i < n; i++) {
+ e = contentView.getElementAt(i) as IUIBase;
+ margin = ValuesManager.valuesImpl.getValue(e, "margin");
+ marginLeft = ValuesManager.valuesImpl.getValue(e, "margin-left");
+ marginTop = ValuesManager.valuesImpl.getValue(e, "margin-top");
+ marginRight = ValuesManager.valuesImpl.getValue(e, "margin-right");
+ marginBottom = ValuesManager.valuesImpl.getValue(e, "margin-bottom");
+ mt = CSSUtils.getTopValue(marginTop, margin, sh);
+ mb = CSSUtils.getBottomValue(marginBottom, margin, sh);
+ mr = CSSUtils.getRightValue(marginRight, margin, sw);
+ ml = CSSUtils.getLeftValue(marginLeft, margin, sw);
+ data.push({ mt: mt, mb: mb, mr: mr, ml: ml});
+ var thisPrefWidth:int = 0;
+ if (e is IStrand)
+ {
+ var measure:IMeasurementBead = e.getBeadByType(IMeasurementBead) as IMeasurementBead;
+ if (measure)
+ thisPrefWidth = measure.measuredWidth + ml + mr;
+ else
+ thisPrefWidth = e.width + ml + mr;
+ }
+ else
+ thisPrefWidth = e.width + ml + mr;
+
+ rowData.rowHeight = Math.max(rowData.rowHeight, e.height + mt + mb);
+ columns[col] = Math.max(columns[col], thisPrefWidth);
+ col = col + 1;
+ if (col == numColumns)
+ {
+ rows.push(rowData);
+ rowData = {rowHeight: 0};
+ col = 0;
+ }
+ }
+
+ var lastmb:Number = 0;
+ var curx:int = padding.left;
+ var cury:int = padding.top;
+ var maxHeight:int = 0;
+ var maxWidth:int = 0;
+ col = 0;
+ for (i = 0; i < n; i++)
+ {
+ e = contentView.getElementAt(i) as IUIBase;
+ e.x = curx + ml;
+ e.y = cury + data[i].mt;
+ curx += columns[col++];
+ maxHeight = Math.max(maxHeight, e.y + e.height + data[i].mb);
+ maxWidth = Math.max(maxWidth, e.x + e.width + data[i].mr);
+ if (col == numColumns)
+ {
+ cury += rows[0].rowHeight;
+ rows.shift();
+ col = 0;
+ curx = padding.left;
+ }
+ }
+ if (!hasWidth && n > 0 && !isNaN(maxWidth))
+ {
+ UIBase(contentView).setWidth(maxWidth, true);
+ }
+ if (!hasHeight && n > 0 && !isNaN(maxHeight))
+ {
+ UIBase(contentView).setHeight(maxHeight, true);
+ }
+ return true;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as
new file mode 100644
index 0000000..dd02989
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/VerticalLayout.as
@@ -0,0 +1,362 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.layouts
+{
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.ILayoutChild;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.ValuesManager;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.utils.CSSContainerUtils;
+ import org.apache.flex.utils.CSSUtils;
+
+ /**
+ * The VerticalLayout class is a simple layout
+ * bead. It takes the set of children and lays them out
+ * vertically in one column, separating them according to
+ * CSS layout rules for margin and horizontal-align styles.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VerticalLayout implements IBeadLayout
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function VerticalLayout()
+ {
+ }
+
+ // the strand/host container is also an ILayoutChild because
+ // can have its size dictated by the host's parent which is
+ // important to know for layout optimization
+ private var host:ILayoutChild;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ host = value as ILayoutChild;
+ }
+
+ /**
+ * Layout children vertically
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.ILayoutHost
+ */
+ public function layout():Boolean
+ {
+ COMPILE::SWF
+ {
+ var layoutParent:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParentIUIBase = layoutParent ? layoutParent.contentView : IParentIUIBase(host);
+ var padding:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
+
+ var n:int = contentView.numElements;
+ var hasHorizontalFlex:Boolean;
+ var hostSizedToContent:Boolean = host.isWidthSizedToContent();
+ var flexibleHorizontalMargins:Array = [];
+ var ilc:ILayoutChild;
+ var marginLeft:Object;
+ var marginRight:Object;
+ var marginTop:Object;
+ var marginBottom:Object;
+ var margin:Object;
+ var maxWidth:Number = 0;
+ var cssValue:*;
+ // asking for contentView.width can result in infinite loop if host isn't sized already
+ var w:Number = hostSizedToContent ? 0 : contentView.width;
+ var h:Number = contentView.height;
+
+ for (var i:int = 0; i < n; i++)
+ {
+ var child:IUIBase = contentView.getElementAt(i) as IUIBase;
+ if (child == null || !child.visible) continue;
+ ilc = child as ILayoutChild;
+ var left:Number = NaN;
+ cssValue = ValuesManager.valuesImpl.getValue(child, "left");
+ if (cssValue !== undefined)
+ left = CSSUtils.toNumber(cssValue);
+ var right:Number = NaN;
+ cssValue = ValuesManager.valuesImpl.getValue(child, "right");
+ if (cssValue !== undefined)
+ right = CSSUtils.toNumber(cssValue);
+ margin = ValuesManager.valuesImpl.getValue(child, "margin");
+ marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left");
+ marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top");
+ marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right");
+ marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom");
+ var ml:Number = CSSUtils.getLeftValue(marginLeft, margin, w);
+ var mr:Number = CSSUtils.getRightValue(marginRight, margin, w);
+ var mt:Number = CSSUtils.getTopValue(marginTop, margin, h);
+ var mb:Number = CSSUtils.getBottomValue(marginBottom, margin, h);
+ var lastmb:Number;
+ var yy:Number;
+ if (i == 0)
+ {
+ if (ilc)
+ ilc.setY(mt + padding.top);
+ else
+ child.y = mt + padding.top;
+ }
+ else
+ {
+ if (ilc)
+ ilc.setY(yy + Math.max(mt, lastmb));
+ else
+ child.y = yy + Math.max(mt, lastmb);
+ }
+ if (ilc)
+ {
+ if (!isNaN(ilc.percentHeight))
+ ilc.setHeight(contentView.height * ilc.percentHeight / 100, !isNaN(ilc.percentWidth));
+ }
+ lastmb = mb;
+ var marginObject:Object = {};
+ flexibleHorizontalMargins[i] = marginObject;
+ if (marginLeft == "auto")
+ {
+ ml = 0;
+ marginObject.marginLeft = marginLeft;
+ hasHorizontalFlex = true;
+ }
+ else
+ {
+ ml = Number(marginLeft);
+ if (isNaN(ml))
+ {
+ ml = 0;
+ marginObject.marginLeft = marginLeft;
+ }
+ else
+ marginObject.marginLeft = ml;
+ }
+ if (marginRight == "auto")
+ {
+ mr = 0;
+ marginObject.marginRight = marginRight;
+ hasHorizontalFlex = true;
+ }
+ else
+ {
+ mr = Number(marginRight);
+ if (isNaN(mr))
+ {
+ mr = 0;
+ marginObject.marginRight = marginRight;
+ }
+ else
+ marginObject.marginRight = mr;
+ }
+ if (!hostSizedToContent)
+ {
+ // if host is sized by parent,
+ // we can position and size children horizontally now
+ setPositionAndWidth(child, left, ml, padding.left,
+ right, mr, padding.right, w);
+ }
+ else
+ {
+ if (!isNaN(left))
+ {
+ ml = left;
+ marginObject.left = ml;
+ }
+ if (!isNaN(right))
+ {
+ mr = right;
+ marginObject.right = mr;
+ }
+ maxWidth = Math.max(maxWidth, ml + child.width + mr);
+ }
+ yy = child.y + child.height;
+ }
+ if (hostSizedToContent)
+ {
+ for (i = 0; i < n; i++)
+ {
+ child = contentView.getElementAt(i) as IUIBase;
+ if (child == null || !child.visible) continue;
+ var obj:Object = flexibleHorizontalMargins[i];
+ setPositionAndWidth(child, obj.left, obj.marginLeft, padding.left,
+ obj.right, obj.marginRight, padding.right, maxWidth);
+ }
+ }
+ if (hasHorizontalFlex)
+ {
+ for (i = 0; i < n; i++)
+ {
+ child = contentView.getElementAt(i) as IUIBase;
+ if (child == null || !child.visible) continue;
+ ilc = child as ILayoutChild;
+ obj = flexibleHorizontalMargins[i];
+ if (hasHorizontalFlex)
+ {
+ if (ilc)
+ {
+ if (obj.marginLeft == "auto" && obj.marginRight == "auto")
+ ilc.setX(maxWidth - child.width / 2);
+ else if (obj.marginLeft == "auto")
+ ilc.setX(maxWidth - child.width - obj.marginRight - padding.right);
+ }
+ else
+ {
+ if (obj.marginLeft == "auto" && obj.marginRight == "auto")
+ child.x = maxWidth - child.width / 2;
+ else if (obj.marginLeft == "auto")
+ child.x = maxWidth - child.width - obj.marginRight - padding.right;
+ }
+ }
+ }
+ }
+
+ // Only return true if the contentView needs to be larger; that new
+ // size is stored in the model.
+ var sizeChanged:Boolean = true;
+
+ host.dispatchEvent( new Event("layoutComplete") );
+
+ return sizeChanged;
+
+ }
+ COMPILE::JS
+ {
+ var children:Array;
+ var i:int;
+ var n:int;
+
+ var viewBead:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParentIUIBase = viewBead.contentView;
+ children = contentView.internalChildren();
+ var scv:Object = getComputedStyle(host.positioner);
+ var hasWidth:Boolean = !host.isWidthSizedToContent();
+ var maxWidth:Number = 0;
+ n = children.length;
+ for (i = 0; i < n; i++)
+ {
+ var child:WrappedHTMLElement = children[i];
+ child.flexjs_wrapper.setDisplayStyleForLayout('block');
+ if (child.style.display === 'none')
+ {
+ child.flexjs_wrapper.setDisplayStyleForLayout('block');
+ }
+ else
+ {
+ // block elements don't measure width correctly so set to inline for a second
+ child.style.display = 'inline-block';
+ maxWidth = Math.max(maxWidth, child.offsetLeft + child.offsetWidth);
+ child.style.display = 'block';
+ }
+ child.flexjs_wrapper.dispatchEvent('sizeChanged');
+ }
+ if (!hasWidth && n > 0 && !isNaN(maxWidth)) {
+ var pl:String = scv['padding-left'];
+ var pr:String = scv['padding-right'];
+ var npl:int = parseInt(pl.substring(0, pl.length - 2), 10);
+ var npr:int = parseInt(pr.substring(0, pr.length - 2), 10);
+ maxWidth += npl + npr;
+ contentView.width = maxWidth;
+ }
+ return true;
+ }
+ }
+
+ COMPILE::SWF
+ private function setPositionAndWidth(child:IUIBase, left:Number, ml:Number, pl:Number,
+ right:Number, mr:Number, pr:Number, w:Number):void
+ {
+ var widthSet:Boolean = false;
+
+ var ww:Number = w;
+ var ilc:ILayoutChild = child as ILayoutChild;
+ if (!isNaN(left))
+ {
+ if (ilc)
+ ilc.setX(left + ml);
+ else
+ child.x = left + ml;
+ ww -= left + ml;
+ }
+ else
+ {
+ if (ilc)
+ ilc.setX(ml + pl);
+ else
+ child.x = ml + pl;
+ ww -= ml + pl;
+ }
+ if (!isNaN(right))
+ {
+ if (!isNaN(left))
+ {
+ if (ilc)
+ ilc.setWidth(ww - right - mr, true);
+ else
+ {
+ child.width = ww - right - mr;
+ widthSet = true;
+ }
+ }
+ else
+ {
+ if (ilc)
+ ilc.setX(w - right - mr - child.width);
+ else
+ child.x = w - right - mr - child.width;
+ }
+ }
+ if (ilc)
+ {
+ if (!isNaN(ilc.percentWidth))
+ ilc.setWidth(w * ilc.percentWidth / 100, true);
+ }
+ if (!widthSet)
+ child.dispatchEvent(new Event("sizeChanged"));
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/AlertModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/AlertModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/AlertModel.as
new file mode 100644
index 0000000..caa6215
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/AlertModel.as
@@ -0,0 +1,288 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.core.IAlertModel;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * The AlertModel class bead implements the org.apache.flex.core.IAlertModel and holds the properties
+ * for an org.apache.flex.html.Alert such the buttons to use and message to display.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class AlertModel extends EventDispatcher implements IAlertModel, IBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function AlertModel()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _title:String;
+
+ /**
+ * The title for the Alert.
+ *
+ * @copy org.apache.flex.core.IAlertModel#title
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get title():String
+ {
+ return _title;
+ }
+ public function set title(value:String):void
+ {
+ if( value != _title ) {
+ _title = value;
+ dispatchEvent( new Event("titleChange") );
+ }
+ }
+
+ private var _htmlTitle:String;
+
+ /**
+ * The HTML title for the Alert.
+ *
+ * @copy org.apache.flex.core.IAlertModel#htmlTitle
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get htmlTitle():String
+ {
+ return _htmlTitle;
+ }
+ public function set htmlTitle(value:String):void
+ {
+ if( value != _htmlTitle ) {
+ _htmlTitle = value;
+ dispatchEvent( new Event("htmlTitleChange") );
+ }
+ }
+
+ private var _message:String;
+
+ /**
+ * The message to display.
+ *
+ * @copy org.apache.flex.core.IAlertModel#message
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get message():String
+ {
+ return _message;
+ }
+ public function set message(value:String):void
+ {
+ if( value != _message ) {
+ _message = value;
+ dispatchEvent( new Event("messageChange") );
+ }
+ }
+
+ private var _htmlMessage:String;
+
+ /**
+ * The HTML message to display.
+ *
+ * @copy org.apache.flex.core.IAlertModel#htmlMessage
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get htmlMessage():String
+ {
+ return _htmlMessage;
+ }
+ public function set htmlMessage(value:String):void
+ {
+ if( value != _htmlMessage )
+ {
+ _htmlMessage = value;
+ dispatchEvent( new Event("htmlMessageChange") );
+ }
+ }
+
+ private var _flags:uint;
+
+ /**
+ * Which buttons to display (see Alert for details).
+ *
+ * @copy org.apache.flex.core.IAlertModel#flags
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get flags():uint
+ {
+ return _flags;
+ }
+ public function set flags(value:uint):void
+ {
+ if( value != _flags )
+ {
+ _flags = value;
+ dispatchEvent( new Event("flagsChange") );
+ }
+ }
+
+ private var _okLabel:String = "OK";
+
+ /**
+ * The label to use for the OK button.
+ *
+ * @copy org.apache.flex.core.IAlertModel#okLabel
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get okLabel():String
+ {
+ return _okLabel;
+ }
+ public function set okLabel(value:String):void
+ {
+ if( value != _okLabel )
+ {
+ _okLabel = value;
+ dispatchEvent( new Event("okLabelChange") );
+ }
+ }
+
+ private var _cancelLabel:String = "Cancel";
+
+ /**
+ * The label to use for the Cancel button.
+ *
+ * @copy org.apache.flex.core.IAlertModel#cancelLabel
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get cancelLabel():String
+ {
+ return _cancelLabel;
+ }
+ public function set cancelLabel(value:String):void
+ {
+ if( value != _cancelLabel )
+ {
+ _cancelLabel = value;
+ dispatchEvent( new Event("cancelLabelChange") );
+ }
+ }
+
+ private var _yesLabel:String = "YES";
+
+ /**
+ * The label to use for the Yes button.
+ *
+ * @copy org.apache.flex.core.IAlertModel#yesLabel
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get yesLabel():String
+ {
+ return _yesLabel;
+ }
+ public function set yesLabel(value:String):void
+ {
+ if( value != _yesLabel )
+ {
+ _yesLabel = value;
+ dispatchEvent( new Event("yesLabelChange") );
+ }
+ }
+
+ private var _noLabel:String = "NO";
+
+ /**
+ * The label to use for the NO button.
+ *
+ * @copy org.apache.flex.core.IAlertModel#noLabel
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get noLabel():String
+ {
+ return _noLabel;
+ }
+ public function set noLabel(value:String):void
+ {
+ if( value != _noLabel )
+ {
+ _noLabel = value;
+ dispatchEvent( new Event("noLabelChange") );
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArrayListSelectionModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArrayListSelectionModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArrayListSelectionModel.as
new file mode 100644
index 0000000..5c8a188
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArrayListSelectionModel.as
@@ -0,0 +1,244 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.collections.IArrayList;
+ import org.apache.flex.core.IRollOverModel;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * The ArrayListSelectionModel class is a selection model for
+ * a dataProvider that is an ArrayList. It assumes that items
+ * can be fetched from the dataProvider using dataProvider.getItemAt(index).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ArrayListSelectionModel extends EventDispatcher implements ISelectionModel, IRollOverModel
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ArrayListSelectionModel()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _dataProvider:IArrayList;
+
+ /**
+ * @copy org.apache.flex.core.ISelectionModel#dataProvider
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dataProvider():Object
+ {
+ return _dataProvider;
+ }
+
+ /**
+ * @private
+ */
+ public function set dataProvider(value:Object):void
+ {
+ if (value === _dataProvider) return;
+
+ _dataProvider = value as IArrayList;
+ if (_selectedIndex != -1)
+ _selectedItem = (_dataProvider == null || _selectedIndex >= _dataProvider.length) ? null :
+ _dataProvider.getItemAt(_selectedIndex);
+ dispatchEvent(new Event("dataProviderChanged"));
+ }
+
+ private var _selectedIndex:int = -1;
+ private var _rollOverIndex:int = -1;
+ private var _labelField:String = null;
+
+ /**
+ * @copy org.apache.flex.core.ISelectionModel#labelField
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get labelField():String
+ {
+ return _labelField;
+ }
+
+ /**
+ * @private
+ */
+ public function set labelField(value:String):void
+ {
+ if (value != _labelField) {
+ _labelField = value;
+ dispatchEvent(new Event("labelFieldChanged"));
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.ISelectionModel#selectedIndex
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedIndex():int
+ {
+ return _selectedIndex;
+ }
+
+ /**
+ * @private
+ */
+ public function set selectedIndex(value:int):void
+ {
+ if (value === _selectedIndex) return;
+
+ _selectedIndex = value;
+ _selectedItem = (value == -1 || _dataProvider == null) ? null : (value < _dataProvider.length) ? _dataProvider.getItemAt(value) : null;
+ dispatchEvent(new Event("selectedIndexChanged"));
+ }
+
+ /**
+ * @copy org.apache.flex.core.IRollOverModel#rollOverIndex
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get rollOverIndex():int
+ {
+ return _rollOverIndex;
+ }
+
+ /**
+ * @private
+ */
+ public function set rollOverIndex(value:int):void
+ {
+ if (value != _rollOverIndex) {
+ _rollOverIndex = value;
+ dispatchEvent(new Event("rollOverIndexChanged"));
+ }
+ }
+
+ private var _selectedItem:Object;
+
+ /**
+ * @copy org.apache.flex.core.ISelectionModel#selectedItem
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedItem():Object
+ {
+ return _selectedItem;
+ }
+
+ /**
+ * @private
+ */
+ public function set selectedItem(value:Object):void
+ {
+ if (value === _selectedItem) return;
+
+ _selectedItem = value;
+ var n:int = _dataProvider.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ if (_dataProvider.getItemAt(i) == value)
+ {
+ _selectedIndex = i;
+ break;
+ }
+ }
+ dispatchEvent(new Event("selectedItemChanged"));
+ dispatchEvent(new Event("selectedIndexChanged"));
+ }
+
+ private var _selectedString:String;
+
+ /**
+ * An alternative to selectedItem for strongly typing the
+ * the selectedItem if the Array is an Array of Strings.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedString():String
+ {
+ return String(_selectedItem);
+ }
+
+ /**
+ * @private
+ */
+ public function set selectedString(value:String):void
+ {
+ _selectedString = value;
+ var n:int = _dataProvider.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ if (String(_dataProvider.getItemAt(i)) == value)
+ {
+ _selectedIndex = i;
+ break;
+ }
+ }
+ dispatchEvent(new Event("selectedItemChanged"));
+ dispatchEvent(new Event("selectedIndexChanged"));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArraySelectionModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArraySelectionModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArraySelectionModel.as
new file mode 100644
index 0000000..a6c0a31
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArraySelectionModel.as
@@ -0,0 +1,243 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.core.IRollOverModel;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * The ArraySelectionModel class is a selection model for
+ * a dataProvider that is an array. It assumes that items
+ * can be fetched from the dataProvider
+ * dataProvider[index]. Other selection models
+ * would support other kinds of data providers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ArraySelectionModel extends EventDispatcher implements ISelectionModel, IRollOverModel
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ArraySelectionModel()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _dataProvider:Object;
+
+ /**
+ * @copy org.apache.flex.core.ISelectionModel#dataProvider
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dataProvider():Object
+ {
+ return _dataProvider;
+ }
+
+ /**
+ * @private
+ */
+ public function set dataProvider(value:Object):void
+ {
+ if (value === _dataProvider) return;
+
+ _dataProvider = value;
+ if (_selectedIndex != -1)
+ _selectedItem = (_dataProvider == null || _selectedIndex >= _dataProvider.length) ? null :
+ _dataProvider[_selectedIndex];
+ dispatchEvent(new Event("dataProviderChanged"));
+ }
+
+ private var _selectedIndex:int = -1;
+ private var _rollOverIndex:int = -1;
+ private var _labelField:String = null;
+
+ /**
+ * @copy org.apache.flex.core.ISelectionModel#labelField
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get labelField():String
+ {
+ return _labelField;
+ }
+
+ /**
+ * @private
+ */
+ public function set labelField(value:String):void
+ {
+ if (value != _labelField) {
+ _labelField = value;
+ dispatchEvent(new Event("labelFieldChanged"));
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.ISelectionModel#selectedIndex
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedIndex():int
+ {
+ return _selectedIndex;
+ }
+
+ /**
+ * @private
+ */
+ public function set selectedIndex(value:int):void
+ {
+ if (value === _selectedIndex) return;
+
+ _selectedIndex = value;
+ _selectedItem = (value == -1 || _dataProvider == null) ? null : (value < _dataProvider.length) ? _dataProvider[value] : null;
+ dispatchEvent(new Event("selectedIndexChanged"));
+ }
+
+ /**
+ * @copy org.apache.flex.core.IRollOverModel#rollOverIndex
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get rollOverIndex():int
+ {
+ return _rollOverIndex;
+ }
+
+ /**
+ * @private
+ */
+ public function set rollOverIndex(value:int):void
+ {
+ _rollOverIndex = value;
+ dispatchEvent(new Event("rollOverIndexChanged"));
+ }
+
+ private var _selectedItem:Object;
+
+ /**
+ * @copy org.apache.flex.core.ISelectionModel#selectedItem
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedItem():Object
+ {
+ return _selectedItem;
+ }
+
+ /**
+ * @private
+ */
+ public function set selectedItem(value:Object):void
+ {
+ if (value === _selectedItem) return;
+
+ _selectedItem = value;
+ var n:int = _dataProvider.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ if (_dataProvider[i] == value)
+ {
+ _selectedIndex = i;
+ break;
+ }
+ }
+ dispatchEvent(new Event("selectedItemChanged"));
+ dispatchEvent(new Event("selectedIndexChanged"));
+ }
+
+ private var _selectedString:String;
+
+ /**
+ * An alternative to selectedItem for strongly typing the
+ * the selectedItem if the Array is an Array of Strings.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedString():String
+ {
+ return String(_selectedItem);
+ }
+
+ /**
+ * @private
+ */
+ public function set selectedString(value:String):void
+ {
+ _selectedString = value;
+ var n:int = _dataProvider.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ if (String(_dataProvider[i]) == value)
+ {
+ _selectedIndex = i;
+ break;
+ }
+ }
+ dispatchEvent(new Event("selectedItemChanged"));
+ dispatchEvent(new Event("selectedIndexChanged"));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ComboBoxModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ComboBoxModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ComboBoxModel.as
new file mode 100644
index 0000000..35a60a8
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ComboBoxModel.as
@@ -0,0 +1,100 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IComboBoxModel;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The ComboBoxModel class bead extends org.apache.flex.html.beads.models.ArraySelectionModel
+ * and adds the text being displayed by the org.apache.flex.html.ComboBox's input field.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ComboBoxModel extends ArraySelectionModel implements IBead, IComboBoxModel
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ComboBoxModel()
+ {
+ }
+
+ private var _text:String;
+
+ /**
+ * The string to display in the org.apache.flex.html.ComboBox input field.
+ *
+ * @copy org.apache.flex.core.IComboBoxModel#text
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ return _text;
+ }
+
+ public function set text(value:String):void
+ {
+ if (value != _text)
+ {
+ _text = value;
+ dispatchEvent(new Event("textChange"));
+ }
+ }
+
+ private var _html:String;
+
+ /**
+ * The HTML string to display in the org.apache.flex.html.ComboBox input field.
+ *
+ * @copy org.apache.flex.core.IComboBoxModel#html
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get html():String
+ {
+ return _html;
+ }
+
+ public function set html(value:String):void
+ {
+ if (value != _html)
+ {
+ _html = value;
+ dispatchEvent(new Event("htmlChange"));
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/DataGridModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/DataGridModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/DataGridModel.as
new file mode 100644
index 0000000..531edac
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/DataGridModel.as
@@ -0,0 +1,71 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.core.IDataGridModel;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The DataGridModel class bead extends org.apache.flex.html.beads.models.ArrayListSelectionModel
+ * to facilitate using an ArrayList as the dataProvider for the DataGrid.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataGridModel extends ArrayListSelectionModel implements IDataGridModel
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGridModel()
+ {
+ super();
+ }
+
+ private var _columns:Array;
+
+ /**
+ * The array of org.apache.flex.html.supportClasses.DataGridColumns used to
+ * define each column of the org.apache.flex.html.DataGrid.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get columns():Array
+ {
+ return _columns;
+ }
+ public function set columns(value:Array):void
+ {
+ if (_columns != value) {
+ _columns = value;
+ dispatchEvent( new Event("columnsChanged"));
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/DataGridPresentationModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/DataGridPresentationModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/DataGridPresentationModel.as
new file mode 100644
index 0000000..0a00edb
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/DataGridPresentationModel.as
@@ -0,0 +1,88 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.core.IDataGridPresentationModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The DataGridPresentationModel class contains the data to label the columns
+ * of the org.apache.flex.html.DataGrid along with the height of the rows.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataGridPresentationModel extends ListPresentationModel implements IDataGridPresentationModel
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGridPresentationModel()
+ {
+ super();
+
+ separatorThickness = 1;
+ }
+
+ private var _columnLabels:Array;
+
+ /**
+ * The labels for each column.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get columnLabels():Array
+ {
+ return _columnLabels;
+ }
+ public function set columnLabels(value:Array):void
+ {
+ if (value != _columnLabels) {
+ _columnLabels = value;
+ dispatchEvent(new Event("columnsChanged"));
+ }
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/DateChooserModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/DateChooserModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/DateChooserModel.as
new file mode 100644
index 0000000..4b6fc18
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/DateChooserModel.as
@@ -0,0 +1,189 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.core.IDateChooserModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * The DateChooserModel is a bead class that manages the data for a DataChooser.
+ * This includes arrays of names for the months and days of the week as well the
+ * currently selected date.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateChooserModel extends EventDispatcher implements IDateChooserModel
+ {
+ public function DateChooserModel()
+ {
+ // default displayed year and month to "today"
+ var today:Date = new Date();
+ displayedYear = today.getFullYear();
+ displayedMonth = today.getMonth();
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _dayNames:Array = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
+ private var _monthNames:Array = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
+ private var _displayedYear:Number;
+ private var _displayedMonth:Number;
+ private var _firstDayOfWeek:Number = 0;
+ private var _selectedDate:Date;
+
+ /**
+ * An array of strings used to name the days of the week with Sunday being the
+ * first element of the array.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dayNames():Array
+ {
+ return _dayNames;
+ }
+ public function set dayNames(value:Array):void
+ {
+ _dayNames = value;
+ dispatchEvent( new Event("dayNamesChanged") );
+ }
+
+ /**
+ * An array of strings used to name the months of the year with January being
+ * the first element of the array.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get monthNames():Array
+ {
+ return _monthNames;
+ }
+ public function set monthNames(value:Array):void
+ {
+ _monthNames = value;
+ dispatchEvent( new Event("monthNames") );
+ }
+
+ /**
+ * The year currently displayed by the DateChooser.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get displayedYear():Number
+ {
+ return _displayedYear;
+ }
+ public function set displayedYear(value:Number):void
+ {
+ if (value != _displayedYear) {
+ _displayedYear = value;
+ dispatchEvent( new Event("displayedYearChanged") );
+ }
+ }
+
+ /**
+ * The month currently displayed by the DateChooser.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get displayedMonth():Number
+ {
+ return _displayedMonth;
+ }
+ public function set displayedMonth(value:Number):void
+ {
+ if (_displayedMonth != value) {
+ _displayedMonth = value;
+ dispatchEvent( new Event("displayedMonthChanged") );
+ }
+ }
+
+ /**
+ * The index of the first day of the week, Sunday = 0.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get firstDayOfWeek():Number
+ {
+ return _firstDayOfWeek;
+ }
+ public function set firstDayOfWeek(value:Number):void
+ {
+ if (value != _firstDayOfWeek) {
+ _firstDayOfWeek = value;
+ dispatchEvent( new Event("firstDayOfWeekChanged") );
+ }
+ }
+
+ /**
+ * The currently selected date or null if no date has been selected.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedDate():Date
+ {
+ return _selectedDate;
+ }
+ public function set selectedDate(value:Date):void
+ {
+ if (value != _selectedDate) {
+ _selectedDate = value;
+ dispatchEvent( new Event("selectedDateChanged") );
+
+ displayedMonth = value.getMonth();
+ displayedYear = value.getFullYear();
+ }
+ }
+ }
+}
[20/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - rename
HTMLClasses to BasicClasses
Posted by ah...@apache.org.
rename HTMLClasses to BasicClasses
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/d3b40de0
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/d3b40de0
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/d3b40de0
Branch: refs/heads/refactor-sprite
Commit: d3b40de051fc69794596ca19dc3d55e3afcc4ab2
Parents: 7a2115d
Author: Alex Harui <ah...@apache.org>
Authored: Wed Oct 26 14:14:14 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:46:51 2016 -0700
----------------------------------------------------------------------
.../Basic/src/main/flex/BasicClasses.as | 194 +++++++++++++++++++
.../projects/Basic/src/main/flex/HTMLClasses.as | 194 -------------------
2 files changed, 194 insertions(+), 194 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d3b40de0/frameworks/projects/Basic/src/main/flex/BasicClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/BasicClasses.as b/frameworks/projects/Basic/src/main/flex/BasicClasses.as
new file mode 100644
index 0000000..1271417
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/BasicClasses.as
@@ -0,0 +1,194 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+
+/**
+ * @private
+ * This class is used to link additional classes into rpc.swc
+ * beyond those that are found by dependecy analysis starting
+ * from the classes specified in manifest.xml.
+ */
+internal class HTMLClasses
+{
+
+ import org.apache.flex.html.ToolTip; ToolTip;
+ import org.apache.flex.html.accessories.NumericOnlyTextInputBead; NumericOnlyTextInputBead;
+ import org.apache.flex.html.accessories.PasswordInputBead; PasswordInputBead;
+ import org.apache.flex.html.accessories.TextPromptBead; TextPromptBead;
+ import org.apache.flex.html.beads.AlertView; AlertView;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.BackgroundImageBead; BackgroundImageBead;
+ }
+ import org.apache.flex.html.beads.ButtonBarView; ButtonBarView;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.CheckBoxView; CheckBoxView;
+ import org.apache.flex.html.beads.ComboBoxView; ComboBoxView;
+ }
+ import org.apache.flex.html.beads.ContainerView; ContainerView;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.ControlBarMeasurementBead; ControlBarMeasurementBead;
+ import org.apache.flex.html.beads.CSSButtonView; CSSButtonView;
+ import org.apache.flex.html.beads.CSSImageAndTextButtonView; CSSImageAndTextButtonView;
+ import org.apache.flex.html.beads.CSSTextButtonView; CSSTextButtonView;
+ import org.apache.flex.html.beads.CSSTextToggleButtonView; CSSTextToggleButtonView;
+ import org.apache.flex.html.beads.DropDownListView; DropDownListView;
+ import org.apache.flex.html.beads.CloseButtonView; CloseButtonView;
+ import org.apache.flex.html.beads.ImageAndTextButtonView; ImageAndTextButtonView;
+ import org.apache.flex.html.beads.ImageView; ImageView;
+ }
+ import org.apache.flex.html.beads.ImageButtonView; ImageButtonView;
+ import org.apache.flex.html.beads.ListView; ListView;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.NumericStepperView; NumericStepperView;
+ }
+ import org.apache.flex.html.beads.PanelView; PanelView;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.PanelWithControlBarView; PanelWithControlBarView;
+ import org.apache.flex.html.beads.RadioButtonView; RadioButtonView;
+ import org.apache.flex.html.beads.VScrollBarView; VScrollBarView;
+ import org.apache.flex.html.beads.HScrollBarView; HScrollBarView;
+ import org.apache.flex.html.beads.ScrollBarView; ScrollBarView;
+ import org.apache.flex.html.beads.SimpleAlertView; SimpleAlertView;
+ import org.apache.flex.html.beads.SingleLineBorderBead; SingleLineBorderBead;
+ import org.apache.flex.html.beads.SliderView; SliderView;
+ }
+ import org.apache.flex.html.beads.SliderThumbView; SliderThumbView;
+ import org.apache.flex.html.beads.SliderTrackView; SliderTrackView;
+ import org.apache.flex.html.beads.SpinnerView; SpinnerView;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.SolidBackgroundBead; SolidBackgroundBead;
+ import org.apache.flex.html.beads.TextButtonMeasurementBead; TextButtonMeasurementBead;
+ import org.apache.flex.html.beads.TextFieldLabelMeasurementBead; TextFieldLabelMeasurementBead;
+ import org.apache.flex.html.beads.TextAreaView; TextAreaView;
+ import org.apache.flex.html.beads.TextButtonView; TextButtonView;
+ import org.apache.flex.html.beads.TextFieldView; TextFieldView;
+ import org.apache.flex.html.beads.TextInputView; TextInputView;
+ import org.apache.flex.html.beads.TextInputWithBorderView; TextInputWithBorderView;
+ import org.apache.flex.html.beads.models.AlertModel; AlertModel;
+ }
+ import org.apache.flex.html.beads.models.ArraySelectionModel; ArraySelectionModel;
+ import org.apache.flex.html.beads.models.ArrayListSelectionModel; ArrayListSelectionModel;
+ import org.apache.flex.html.beads.models.RangeModel; RangeModel;
+ import org.apache.flex.html.beads.models.RangeModelExtended; RangeModelExtended;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.models.ComboBoxModel; ComboBoxModel;
+ }
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.models.ImageModel; ImageModel;
+ import org.apache.flex.html.beads.models.ImageAndTextModel; ImageAndTextModel;
+ }
+ import org.apache.flex.html.beads.models.PanelModel; PanelModel;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.models.SingleLineBorderModel; SingleLineBorderModel;
+ }
+ import org.apache.flex.html.beads.models.TextModel; TextModel;
+ import org.apache.flex.html.beads.models.TitleBarModel; TitleBarModel;
+ import org.apache.flex.html.beads.models.ToggleButtonModel; ToggleButtonModel;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.models.ValueToggleButtonModel; ValueToggleButtonModel;
+ }
+ import org.apache.flex.html.beads.models.ViewportModel; ViewportModel;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.controllers.AlertController; AlertController;
+ import org.apache.flex.html.beads.controllers.ComboBoxController; ComboBoxController;
+ import org.apache.flex.html.beads.controllers.DropDownListController; DropDownListController;
+ import org.apache.flex.html.beads.controllers.EditableTextKeyboardController; EditableTextKeyboardController;
+ }
+ import org.apache.flex.html.beads.controllers.ItemRendererMouseController; ItemRendererMouseController;
+ import org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController; ListSingleSelectionMouseController;
+ import org.apache.flex.html.beads.controllers.TreeSingleSelectionMouseController; TreeSingleSelectionMouseController;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.controllers.SliderMouseController; SliderMouseController;
+ import org.apache.flex.html.beads.controllers.SpinnerMouseController; SpinnerMouseController;
+ import org.apache.flex.html.beads.controllers.VScrollBarMouseController; VScrollBarMouseController;
+ import org.apache.flex.html.beads.controllers.HScrollBarMouseController; HScrollBarMouseController;
+ }
+ import org.apache.flex.html.beads.layouts.ButtonBarLayout; ButtonBarLayout;
+ import org.apache.flex.html.beads.layouts.VerticalLayout; VerticalLayout;
+ import org.apache.flex.html.beads.layouts.HorizontalLayout; HorizontalLayout;
+ import org.apache.flex.html.beads.layouts.BasicLayout; BasicLayout;
+ import org.apache.flex.html.beads.layouts.OneFlexibleChildHorizontalLayout; OneFlexibleChildHorizontalLayout;
+ import org.apache.flex.html.beads.layouts.OneFlexibleChildVerticalLayout; OneFlexibleChildVerticalLayout;
+
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.layouts.HScrollBarLayout; HScrollBarLayout;
+ import org.apache.flex.html.beads.layouts.VScrollBarLayout; VScrollBarLayout;
+ }
+ import org.apache.flex.html.beads.layouts.TileLayout; TileLayout;
+ import org.apache.flex.html.beads.TextItemRendererFactoryForArrayData; TextItemRendererFactoryForArrayData;
+ import org.apache.flex.html.beads.DataItemRendererFactoryForArrayData; DataItemRendererFactoryForArrayData;
+ import org.apache.flex.html.beads.DataItemRendererFactoryForArrayList; DataItemRendererFactoryForArrayList;
+ import org.apache.flex.html.beads.DataItemRendererFactoryForHierarchicalData; DataItemRendererFactoryForHierarchicalData;
+ import org.apache.flex.html.supportClasses.DataGroup; DataGroup;
+ import org.apache.flex.html.supportClasses.Viewport; Viewport;
+ import org.apache.flex.html.supportClasses.ScrollingViewport; ScrollingViewport;
+ import org.apache.flex.html.supportClasses.DataGridButtonBarButtonItemRenderer; DataGridButtonBarButtonItemRenderer;
+
+ import org.apache.flex.html.DataGridButtonBarTextButton; DataGridButtonBarTextButton;
+ import org.apache.flex.html.DataGridButtonBar; DataGridButtonBar;
+ import org.apache.flex.html.beads.DataGridColumnView; DataGridColumnView;
+ import org.apache.flex.html.beads.DataGridView; DataGridView;
+ import org.apache.flex.html.beads.layouts.DataGridLayout; DataGridLayout;
+ import org.apache.flex.html.beads.DateChooserView; DateChooserView;
+ import org.apache.flex.html.beads.DateFieldView; DateFieldView;
+ import org.apache.flex.html.beads.DecrementButtonView; DecrementButtonView;
+ import org.apache.flex.html.beads.IncrementButtonView; IncrementButtonView;
+ import org.apache.flex.html.beads.RangeStepperView; RangeStepperView;
+ import org.apache.flex.html.beads.layouts.FlexibleFirstChildHorizontalLayout; FlexibleFirstChildHorizontalLayout;
+ import org.apache.flex.html.beads.models.DataGridModel; DataGridModel;
+ import org.apache.flex.html.beads.models.DateChooserModel; DateChooserModel;
+ import org.apache.flex.html.beads.models.DataGridPresentationModel; DataGridPresentationModel;
+ import org.apache.flex.html.beads.controllers.DateChooserMouseController; DateChooserMouseController;
+ import org.apache.flex.html.beads.controllers.DateFieldMouseController; DateFieldMouseController;
+ import org.apache.flex.html.beads.controllers.RangeStepperMouseController; RangeStepperMouseController;
+ import org.apache.flex.html.supportClasses.DataGridColumn; DataGridColumn;
+ import org.apache.flex.html.supportClasses.DateChooserButton; DateChooserButton;
+ import org.apache.flex.html.supportClasses.DateHeaderButton; DateHeaderButton;
+ import org.apache.flex.html.supportClasses.GraphicsItemRenderer; GraphicsItemRenderer;
+
+ import org.apache.flex.html.beads.TitleBarView; TitleBarView;
+ import org.apache.flex.html.beads.TitleBarMeasurementBead; TitleBarMeasurementBead;
+
+ import org.apache.flex.html.beads.WebBrowserView; WebBrowserView;
+ import org.apache.flex.html.beads.models.WebBrowserModel; WebBrowserModel;
+
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.HRuleView; HRuleView;
+ import org.apache.flex.html.beads.VRuleView; VRuleView;
+ import org.apache.flex.html.beads.MultilineTextFieldView; MultilineTextFieldView;
+ }
+}
+
+}
+
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d3b40de0/frameworks/projects/Basic/src/main/flex/HTMLClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/HTMLClasses.as b/frameworks/projects/Basic/src/main/flex/HTMLClasses.as
deleted file mode 100644
index 1271417..0000000
--- a/frameworks/projects/Basic/src/main/flex/HTMLClasses.as
+++ /dev/null
@@ -1,194 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package
-{
-
-/**
- * @private
- * This class is used to link additional classes into rpc.swc
- * beyond those that are found by dependecy analysis starting
- * from the classes specified in manifest.xml.
- */
-internal class HTMLClasses
-{
-
- import org.apache.flex.html.ToolTip; ToolTip;
- import org.apache.flex.html.accessories.NumericOnlyTextInputBead; NumericOnlyTextInputBead;
- import org.apache.flex.html.accessories.PasswordInputBead; PasswordInputBead;
- import org.apache.flex.html.accessories.TextPromptBead; TextPromptBead;
- import org.apache.flex.html.beads.AlertView; AlertView;
- COMPILE::SWF
- {
- import org.apache.flex.html.beads.BackgroundImageBead; BackgroundImageBead;
- }
- import org.apache.flex.html.beads.ButtonBarView; ButtonBarView;
- COMPILE::SWF
- {
- import org.apache.flex.html.beads.CheckBoxView; CheckBoxView;
- import org.apache.flex.html.beads.ComboBoxView; ComboBoxView;
- }
- import org.apache.flex.html.beads.ContainerView; ContainerView;
- COMPILE::SWF
- {
- import org.apache.flex.html.beads.ControlBarMeasurementBead; ControlBarMeasurementBead;
- import org.apache.flex.html.beads.CSSButtonView; CSSButtonView;
- import org.apache.flex.html.beads.CSSImageAndTextButtonView; CSSImageAndTextButtonView;
- import org.apache.flex.html.beads.CSSTextButtonView; CSSTextButtonView;
- import org.apache.flex.html.beads.CSSTextToggleButtonView; CSSTextToggleButtonView;
- import org.apache.flex.html.beads.DropDownListView; DropDownListView;
- import org.apache.flex.html.beads.CloseButtonView; CloseButtonView;
- import org.apache.flex.html.beads.ImageAndTextButtonView; ImageAndTextButtonView;
- import org.apache.flex.html.beads.ImageView; ImageView;
- }
- import org.apache.flex.html.beads.ImageButtonView; ImageButtonView;
- import org.apache.flex.html.beads.ListView; ListView;
- COMPILE::SWF
- {
- import org.apache.flex.html.beads.NumericStepperView; NumericStepperView;
- }
- import org.apache.flex.html.beads.PanelView; PanelView;
- COMPILE::SWF
- {
- import org.apache.flex.html.beads.PanelWithControlBarView; PanelWithControlBarView;
- import org.apache.flex.html.beads.RadioButtonView; RadioButtonView;
- import org.apache.flex.html.beads.VScrollBarView; VScrollBarView;
- import org.apache.flex.html.beads.HScrollBarView; HScrollBarView;
- import org.apache.flex.html.beads.ScrollBarView; ScrollBarView;
- import org.apache.flex.html.beads.SimpleAlertView; SimpleAlertView;
- import org.apache.flex.html.beads.SingleLineBorderBead; SingleLineBorderBead;
- import org.apache.flex.html.beads.SliderView; SliderView;
- }
- import org.apache.flex.html.beads.SliderThumbView; SliderThumbView;
- import org.apache.flex.html.beads.SliderTrackView; SliderTrackView;
- import org.apache.flex.html.beads.SpinnerView; SpinnerView;
- COMPILE::SWF
- {
- import org.apache.flex.html.beads.SolidBackgroundBead; SolidBackgroundBead;
- import org.apache.flex.html.beads.TextButtonMeasurementBead; TextButtonMeasurementBead;
- import org.apache.flex.html.beads.TextFieldLabelMeasurementBead; TextFieldLabelMeasurementBead;
- import org.apache.flex.html.beads.TextAreaView; TextAreaView;
- import org.apache.flex.html.beads.TextButtonView; TextButtonView;
- import org.apache.flex.html.beads.TextFieldView; TextFieldView;
- import org.apache.flex.html.beads.TextInputView; TextInputView;
- import org.apache.flex.html.beads.TextInputWithBorderView; TextInputWithBorderView;
- import org.apache.flex.html.beads.models.AlertModel; AlertModel;
- }
- import org.apache.flex.html.beads.models.ArraySelectionModel; ArraySelectionModel;
- import org.apache.flex.html.beads.models.ArrayListSelectionModel; ArrayListSelectionModel;
- import org.apache.flex.html.beads.models.RangeModel; RangeModel;
- import org.apache.flex.html.beads.models.RangeModelExtended; RangeModelExtended;
- COMPILE::SWF
- {
- import org.apache.flex.html.beads.models.ComboBoxModel; ComboBoxModel;
- }
- COMPILE::SWF
- {
- import org.apache.flex.html.beads.models.ImageModel; ImageModel;
- import org.apache.flex.html.beads.models.ImageAndTextModel; ImageAndTextModel;
- }
- import org.apache.flex.html.beads.models.PanelModel; PanelModel;
- COMPILE::SWF
- {
- import org.apache.flex.html.beads.models.SingleLineBorderModel; SingleLineBorderModel;
- }
- import org.apache.flex.html.beads.models.TextModel; TextModel;
- import org.apache.flex.html.beads.models.TitleBarModel; TitleBarModel;
- import org.apache.flex.html.beads.models.ToggleButtonModel; ToggleButtonModel;
- COMPILE::SWF
- {
- import org.apache.flex.html.beads.models.ValueToggleButtonModel; ValueToggleButtonModel;
- }
- import org.apache.flex.html.beads.models.ViewportModel; ViewportModel;
- COMPILE::SWF
- {
- import org.apache.flex.html.beads.controllers.AlertController; AlertController;
- import org.apache.flex.html.beads.controllers.ComboBoxController; ComboBoxController;
- import org.apache.flex.html.beads.controllers.DropDownListController; DropDownListController;
- import org.apache.flex.html.beads.controllers.EditableTextKeyboardController; EditableTextKeyboardController;
- }
- import org.apache.flex.html.beads.controllers.ItemRendererMouseController; ItemRendererMouseController;
- import org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController; ListSingleSelectionMouseController;
- import org.apache.flex.html.beads.controllers.TreeSingleSelectionMouseController; TreeSingleSelectionMouseController;
- COMPILE::SWF
- {
- import org.apache.flex.html.beads.controllers.SliderMouseController; SliderMouseController;
- import org.apache.flex.html.beads.controllers.SpinnerMouseController; SpinnerMouseController;
- import org.apache.flex.html.beads.controllers.VScrollBarMouseController; VScrollBarMouseController;
- import org.apache.flex.html.beads.controllers.HScrollBarMouseController; HScrollBarMouseController;
- }
- import org.apache.flex.html.beads.layouts.ButtonBarLayout; ButtonBarLayout;
- import org.apache.flex.html.beads.layouts.VerticalLayout; VerticalLayout;
- import org.apache.flex.html.beads.layouts.HorizontalLayout; HorizontalLayout;
- import org.apache.flex.html.beads.layouts.BasicLayout; BasicLayout;
- import org.apache.flex.html.beads.layouts.OneFlexibleChildHorizontalLayout; OneFlexibleChildHorizontalLayout;
- import org.apache.flex.html.beads.layouts.OneFlexibleChildVerticalLayout; OneFlexibleChildVerticalLayout;
-
- COMPILE::SWF
- {
- import org.apache.flex.html.beads.layouts.HScrollBarLayout; HScrollBarLayout;
- import org.apache.flex.html.beads.layouts.VScrollBarLayout; VScrollBarLayout;
- }
- import org.apache.flex.html.beads.layouts.TileLayout; TileLayout;
- import org.apache.flex.html.beads.TextItemRendererFactoryForArrayData; TextItemRendererFactoryForArrayData;
- import org.apache.flex.html.beads.DataItemRendererFactoryForArrayData; DataItemRendererFactoryForArrayData;
- import org.apache.flex.html.beads.DataItemRendererFactoryForArrayList; DataItemRendererFactoryForArrayList;
- import org.apache.flex.html.beads.DataItemRendererFactoryForHierarchicalData; DataItemRendererFactoryForHierarchicalData;
- import org.apache.flex.html.supportClasses.DataGroup; DataGroup;
- import org.apache.flex.html.supportClasses.Viewport; Viewport;
- import org.apache.flex.html.supportClasses.ScrollingViewport; ScrollingViewport;
- import org.apache.flex.html.supportClasses.DataGridButtonBarButtonItemRenderer; DataGridButtonBarButtonItemRenderer;
-
- import org.apache.flex.html.DataGridButtonBarTextButton; DataGridButtonBarTextButton;
- import org.apache.flex.html.DataGridButtonBar; DataGridButtonBar;
- import org.apache.flex.html.beads.DataGridColumnView; DataGridColumnView;
- import org.apache.flex.html.beads.DataGridView; DataGridView;
- import org.apache.flex.html.beads.layouts.DataGridLayout; DataGridLayout;
- import org.apache.flex.html.beads.DateChooserView; DateChooserView;
- import org.apache.flex.html.beads.DateFieldView; DateFieldView;
- import org.apache.flex.html.beads.DecrementButtonView; DecrementButtonView;
- import org.apache.flex.html.beads.IncrementButtonView; IncrementButtonView;
- import org.apache.flex.html.beads.RangeStepperView; RangeStepperView;
- import org.apache.flex.html.beads.layouts.FlexibleFirstChildHorizontalLayout; FlexibleFirstChildHorizontalLayout;
- import org.apache.flex.html.beads.models.DataGridModel; DataGridModel;
- import org.apache.flex.html.beads.models.DateChooserModel; DateChooserModel;
- import org.apache.flex.html.beads.models.DataGridPresentationModel; DataGridPresentationModel;
- import org.apache.flex.html.beads.controllers.DateChooserMouseController; DateChooserMouseController;
- import org.apache.flex.html.beads.controllers.DateFieldMouseController; DateFieldMouseController;
- import org.apache.flex.html.beads.controllers.RangeStepperMouseController; RangeStepperMouseController;
- import org.apache.flex.html.supportClasses.DataGridColumn; DataGridColumn;
- import org.apache.flex.html.supportClasses.DateChooserButton; DateChooserButton;
- import org.apache.flex.html.supportClasses.DateHeaderButton; DateHeaderButton;
- import org.apache.flex.html.supportClasses.GraphicsItemRenderer; GraphicsItemRenderer;
-
- import org.apache.flex.html.beads.TitleBarView; TitleBarView;
- import org.apache.flex.html.beads.TitleBarMeasurementBead; TitleBarMeasurementBead;
-
- import org.apache.flex.html.beads.WebBrowserView; WebBrowserView;
- import org.apache.flex.html.beads.models.WebBrowserModel; WebBrowserModel;
-
- COMPILE::SWF
- {
- import org.apache.flex.html.beads.HRuleView; HRuleView;
- import org.apache.flex.html.beads.VRuleView; VRuleView;
- import org.apache.flex.html.beads.MultilineTextFieldView; MultilineTextFieldView;
- }
-}
-
-}
-
[23/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - copy
former core classes into Basic
Posted by ah...@apache.org.
copy former core classes into Basic
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/8f155cf8
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/8f155cf8
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/8f155cf8
Branch: refs/heads/refactor-sprite
Commit: 8f155cf80a983484689aa7e8c6143bfd7c374458
Parents: efd9dca
Author: Alex Harui <ah...@apache.org>
Authored: Thu Oct 27 16:28:10 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:46:52 2016 -0700
----------------------------------------------------------------------
.../flex/org/apache/flex/core/Application.as | 637 +++++++++++++++++++
.../org/apache/flex/core/ApplicationBase.as | 110 ++++
.../flex/org/apache/flex/core/ContainerBase.as | 443 +++++++++++++
.../flex/core/ContainerBaseStrandChildren.as | 99 +++
.../org/apache/flex/core/FilledRectangle.as | 125 ++++
.../main/flex/org/apache/flex/core/ListBase.as | 126 ++++
.../apache/flex/core/ListBaseStrandChildren.as | 100 +++
.../src/main/flex/org/apache/flex/core/View.as | 34 +
.../main/flex/org/apache/flex/core/ViewBase.as | 97 +++
9 files changed, 1771 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f155cf8/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Application.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Application.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Application.as
new file mode 100644
index 0000000..ff6e5a6
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Application.as
@@ -0,0 +1,637 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.utils.MouseEventConverter;
+ import org.apache.flex.utils.MXMLDataInterpreter;
+ import org.apache.flex.utils.Timer;
+
+ COMPILE::SWF {
+ import flash.display.DisplayObject;
+ import flash.display.Sprite;
+ import flash.display.StageAlign;
+ import flash.display.StageQuality;
+ import flash.display.StageScaleMode;
+ import flash.events.Event;
+ import flash.system.ApplicationDomain;
+ import flash.utils.getQualifiedClassName;
+ }
+
+ //--------------------------------------
+ // Events
+ //--------------------------------------
+
+ /**
+ * Dispatched at startup. Attributes and sub-instances of
+ * the MXML document have been created and assigned.
+ * The component lifecycle is different
+ * than the Flex SDK. There is no creationComplete event.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="initialize", type="org.apache.flex.events.Event")]
+
+ /**
+ * Dispatched at startup before the instances get created.
+ * Beads can call preventDefault and defer initialization.
+ * This event will be dispatched on every frame until no
+ * listeners call preventDefault(), then the initialize()
+ * method will be called.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="preinitialize", type="org.apache.flex.events.Event")]
+
+ /**
+ * Dispatched at startup after the initial view has been
+ * put on the display list. This event is sent before
+ * applicationComplete is dispatched.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="viewChanged", type="org.apache.flex.events.Event")]
+
+ /**
+ * Dispatched at startup after the initial view has been
+ * put on the display list.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="applicationComplete", type="org.apache.flex.events.Event")]
+ /**
+ * The Application class is the main class and entry point for a FlexJS
+ * application. This Application class is different than the
+ * Flex SDK's mx:Application or spark:Application in that it does not contain
+ * user interface elements. Those UI elements go in the views (ViewBase). This
+ * Application class expects there to be a main model, a controller, and
+ * an initial view.
+ *
+ * @see ViewBase
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class Application extends ApplicationBase implements IStrand, IParent, IEventDispatcher
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Application()
+ {
+ super();
+
+ COMPILE::SWF {
+ if (stage)
+ {
+ stage.align = StageAlign.TOP_LEFT;
+ stage.scaleMode = StageScaleMode.NO_SCALE;
+ // should be opt-in
+ //stage.quality = StageQuality.HIGH_16X16_LINEAR;
+ }
+
+ loaderInfo.addEventListener(flash.events.Event.INIT, initHandler);
+ }
+ }
+
+ COMPILE::SWF
+ private function initHandler(event:flash.events.Event):void
+ {
+ if (model is IBead) addBead(model as IBead);
+ if (controller is IBead) addBead(controller as IBead);
+
+ MouseEventConverter.setupAllConverters(stage);
+
+ for each (var bead:IBead in beads)
+ addBead(bead);
+
+ dispatchEvent(new org.apache.flex.events.Event("beadsAdded"));
+
+ if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true)))
+ initialize();
+ else
+ addEventListener(flash.events.Event.ENTER_FRAME, enterFrameHandler);
+
+ }
+
+ COMPILE::SWF
+ private function enterFrameHandler(event:flash.events.Event):void
+ {
+ if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true)))
+ {
+ removeEventListener(flash.events.Event.ENTER_FRAME, enterFrameHandler);
+ initialize();
+ }
+ }
+
+ /**
+ * This method gets called when all preinitialize handlers
+ * no longer call preventDefault();
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ protected function initialize():void
+ {
+
+ MXMLDataInterpreter.generateMXMLInstances(this, null, MXMLDescriptor);
+
+ dispatchEvent(new org.apache.flex.events.Event("initialize"));
+
+ if (initialView)
+ {
+ initialView.applicationModel = model;
+ this.addElement(initialView);
+ // if someone has installed a resize listener, fake an event to run it now
+ if (stage.hasEventListener("resize"))
+ stage.dispatchEvent(new flash.events.Event("resize"));
+ else if (initialView is ILayoutChild)
+ {
+ var ilc:ILayoutChild = initialView as ILayoutChild;
+ // otherwise, size once like this
+ if (!isNaN(ilc.percentWidth) && !isNaN(ilc.percentHeight))
+ ilc.setWidthAndHeight(stage.stageWidth, stage.stageHeight, true);
+ else if (!isNaN(ilc.percentWidth))
+ ilc.setWidth(stage.stageWidth);
+ else if (!isNaN(ilc.percentHeight))
+ ilc.setHeight(stage.stageHeight);
+ }
+ var bgColor:Object = ValuesManager.valuesImpl.getValue(this, "background-color");
+ if (bgColor != null)
+ {
+ var backgroundColor:uint = ValuesManager.valuesImpl.convertColor(bgColor);
+ graphics.beginFill(backgroundColor);
+ graphics.drawRect(0, 0, initialView.width, initialView.height);
+ graphics.endFill();
+ }
+ dispatchEvent(new org.apache.flex.events.Event("viewChanged"));
+ }
+ dispatchEvent(new org.apache.flex.events.Event("applicationComplete"));
+ }
+
+ /**
+ * The org.apache.flex.core.IValuesImpl that will
+ * determine the default values and other values
+ * for the application. The most common choice
+ * is org.apache.flex.core.SimpleCSSValuesImpl.
+ *
+ * @see org.apache.flex.core.SimpleCSSValuesImpl
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set valuesImpl(value:IValuesImpl):void
+ {
+ ValuesManager.valuesImpl = value;
+ ValuesManager.valuesImpl.init(this);
+ }
+
+ /**
+ * The initial view.
+ *
+ * @see org.apache.flex.core.ViewBase
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Bindable("__NoChangeEvent__")]
+ public var initialView:IApplicationView;
+
+ /**
+ * The data model (for the initial view).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Bindable("__NoChangeEvent__")]
+ COMPILE::SWF
+ public var model:Object;
+
+ COMPILE::JS
+ private var _model:Object;
+
+ /**
+ * The data model (for the initial view).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Bindable("__NoChangeEvent__")]
+ COMPILE::JS
+ override public function get model():Object
+ {
+ return _model;
+ }
+
+ /**
+ * @private
+ */
+ [Bindable("__NoChangeEvent__")]
+ COMPILE::JS
+ override public function set model(value:Object):void
+ {
+ _model = value;
+ }
+
+ /**
+ * The controller. The controller typically watches
+ * the UI for events and updates the model accordingly.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var controller:Object;
+
+ /**
+ * An array of data that describes the MXML attributes
+ * and tags in an MXML document. This data is usually
+ * decoded by an MXMLDataInterpreter
+ *
+ * @see org.apache.flex.utils.MXMLDataInterpreter
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get MXMLDescriptor():Array
+ {
+ return null;
+ }
+
+ /**
+ * An method called by the compiler's generated
+ * code to kick off the setting of MXML attribute
+ * values and instantiation of child tags.
+ *
+ * The call has to be made in the generated code
+ * in order to ensure that the constructors have
+ * completed first.
+ *
+ * @param data The encoded data representing the
+ * MXML attributes.
+ *
+ * @see org.apache.flex.utils.MXMLDataInterpreter
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function generateMXMLAttributes(data:Array):void
+ {
+ MXMLDataInterpreter.generateMXMLProperties(this, data);
+ }
+
+ /**
+ * The array property that is used to add additional
+ * beads to an MXML tag. From ActionScript, just
+ * call addBead directly.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var beads:Array;
+
+ COMPILE::SWF
+ private var _beads:Vector.<IBead>;
+
+ /**
+ * @copy org.apache.flex.core.IStrand#addBead()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public function addBead(bead:IBead):void
+ {
+ if (!_beads)
+ _beads = new Vector.<IBead>;
+ _beads.push(bead);
+ bead.strand = this;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IStrand#getBeadByType()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public function getBeadByType(classOrInterface:Class):IBead
+ {
+ for each (var bead:IBead in _beads)
+ {
+ if (bead is classOrInterface)
+ return bead;
+ }
+ return null;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IStrand#removeBead()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public function removeBead(value:IBead):IBead
+ {
+ var n:int = _beads.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var bead:IBead = _beads[i];
+ if (bead == value)
+ {
+ _beads.splice(i, 1);
+ return bead;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#addElement()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function addElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ COMPILE::SWF {
+ if (c is IUIBase)
+ {
+ addChild(IUIBase(c).element as DisplayObject);
+ IUIBase(c).addedToParent();
+ }
+ else
+ addChild(c as DisplayObject);
+ }
+ COMPILE::JS {
+ this.element.appendChild(c.element);
+ c.addedToParent();
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#addElementAt()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ {
+ COMPILE::SWF {
+ if (c is IUIBase)
+ {
+ addChildAt(IUIBase(c).element as DisplayObject, index);
+ IUIBase(c).addedToParent();
+ }
+ else
+ addChildAt(c as DisplayObject, index);
+ }
+ COMPILE::JS {
+ var children:NodeList = internalChildren();
+ if (index >= children.length)
+ addElement(c);
+ else
+ {
+ element.insertBefore(c.positioner,
+ children[index]);
+ c.addedToParent();
+ }
+
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#getElementAt()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getElementAt(index:int):Object
+ {
+ COMPILE::SWF {
+ return getChildAt(index);
+ }
+ COMPILE::JS {
+ var children:NodeList = internalChildren();
+ return children[index].flexjs_wrapper;
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#getElementIndex()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getElementIndex(c:Object):int
+ {
+ COMPILE::SWF {
+ if (c is IUIBase)
+ return getChildIndex(IUIBase(c).element as DisplayObject);
+
+ return getChildIndex(c as DisplayObject);
+ }
+ COMPILE::JS {
+ var children:NodeList = internalChildren();
+ var n:int = children.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ if (children[i] == c.element)
+ return i;
+ }
+ return -1;
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#removeElement()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ COMPILE::SWF {
+ if (c is IUIBase)
+ {
+ removeChild(IUIBase(c).element as DisplayObject);
+ }
+ else
+ removeChild(c as DisplayObject);
+ }
+ COMPILE::JS {
+ element.removeChild(c.element);
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#numElements
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get numElements():int
+ {
+ COMPILE::SWF {
+ return numChildren;
+ }
+ COMPILE::JS {
+ var children:NodeList = internalChildren();
+ return children.length;
+ }
+ }
+
+ /**
+ * @return {Object} The array of children.
+ */
+ COMPILE::JS
+ protected function internalChildren():NodeList
+ {
+ return element.childNodes;
+ };
+
+ COMPILE::JS
+ protected var startupTimer:Timer;
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.IBead
+ */
+ COMPILE::JS
+ public function start():void
+ {
+ element = document.getElementsByTagName('body')[0];
+ element.flexjs_wrapper = this;
+ element.className = 'Application';
+
+ if (model is IBead) addBead(model as IBead);
+ if (controller is IBead) addBead(controller as IBead);
+
+ for (var index:int in beads) {
+ addBead(beads[index]);
+ }
+
+ dispatchEvent(new org.apache.flex.events.Event("beadsAdded"));
+
+ if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true)))
+ initialize();
+ else {
+ startupTimer = new Timer(34, 0);
+ startupTimer.addEventListener("timer", handleStartupTimer);
+ startupTimer.start();
+ }
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::JS
+ protected function handleStartupTimer(event:Event):void
+ {
+ if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true)))
+ {
+ startupTimer.stop();
+ initialize();
+ }
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.IBead
+ */
+ COMPILE::JS
+ protected function initialize():void
+ {
+ MXMLDataInterpreter.generateMXMLInstances(this, null, MXMLDescriptor);
+
+ dispatchEvent('initialize');
+
+ initialView.applicationModel = model;
+ addElement(initialView);
+
+ if (initialView)
+ {
+ var baseView:UIBase = initialView as UIBase;
+ if (!isNaN(baseView.percentWidth) || !isNaN(baseView.percentHeight)) {
+ this.element.style.height = window.innerHeight.toString() + 'px';
+ this.element.style.width = window.innerWidth.toString() + 'px';
+ this.initialView.dispatchEvent('sizeChanged'); // kick off layout if % sizes
+ }
+
+ dispatchEvent(new org.apache.flex.events.Event("viewChanged"));
+ }
+ dispatchEvent(new org.apache.flex.events.Event("applicationComplete"));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f155cf8/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ApplicationBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ApplicationBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ApplicationBase.as
new file mode 100644
index 0000000..60111ef
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ApplicationBase.as
@@ -0,0 +1,110 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ COMPILE::SWF {
+ import flash.display.Sprite;
+ import flash.system.ApplicationDomain;
+ import flash.utils.getQualifiedClassName;
+ }
+
+ /**
+ * This is a platform-dependent base class
+ * for Application
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public class ApplicationBase extends Sprite implements IFlexInfo
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ApplicationBase()
+ {
+ super();
+ }
+
+ private var _info:Object;
+
+ /**
+ * An Object containing information generated
+ * by the compiler that is useful at startup time.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function info():Object
+ {
+ if (!_info)
+ {
+ var mainClassName:String = getQualifiedClassName(this);
+ var initClassName:String = "_" + mainClassName + "_FlexInit";
+ var c:Class = ApplicationDomain.currentDomain.getDefinition(initClassName) as Class;
+ _info = c.info();
+ }
+ return _info;
+ }
+ }
+
+ COMPILE::JS
+ public class ApplicationBase extends HTMLElementWrapper implements IFlexInfo
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ApplicationBase()
+ {
+ super();
+ }
+
+ private var _info:Object;
+
+ /**
+ * An Object containing information generated
+ * by the compiler that is useful at startup time.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function info():Object
+ {
+ return _info;
+ }
+
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f155cf8/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBase.as
new file mode 100644
index 0000000..5b6cc26
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBase.as
@@ -0,0 +1,443 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ import org.apache.flex.core.IMXMLDocument;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.ValueChangeEvent;
+ import org.apache.flex.states.State;
+ import org.apache.flex.utils.MXMLDataInterpreter;
+
+ /**
+ * Indicates that the state change has completed. All properties
+ * that need to change have been changed, and all transitinos
+ * that need to run have completed. However, any deferred work
+ * may not be completed, and the screen may not be updated until
+ * code stops executing.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="stateChangeComplete", type="org.apache.flex.events.Event")]
+
+ /**
+ * Indicates that the initialization of the container is complete.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="initComplete", type="org.apache.flex.events.Event")]
+
+ /**
+ * Indicates that the children of the container is have been added.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="childrenAdded", type="org.apache.flex.events.Event")]
+
+ [DefaultProperty("mxmlContent")]
+
+ /**
+ * The ContainerBase class is the base class for most containers
+ * in FlexJS. It is usable as the root tag of MXML
+ * documents and UI controls and containers are added to it.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ContainerBase extends UIBase implements IMXMLDocument, IStatesObject, IContainer, IContentViewHost
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ContainerBase()
+ {
+ super();
+
+ _strandChildren = new ContainerBaseStrandChildren(this);
+ }
+
+ private var _strandChildren:ContainerBaseStrandChildren;
+
+ /**
+ * @private
+ */
+ public function get strandChildren():IParent
+ {
+ return _strandChildren;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#getElementAt()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function getElementAt(index:int):Object
+ {
+ var contentView:IParent = view as IParent;
+ if (contentView != null) {
+ return contentView.getElementAt(index);
+ } else {
+ return super.getElementAt(index);
+ }
+ }
+
+ /**
+ * @private
+ */
+ override public function getElementIndex(c:Object):int
+ {
+ var contentView:IParent = view as IParent;
+ if (contentView != null) {
+ return contentView.getElementIndex(c);
+ } else {
+ return super.getElementIndex(c);
+ }
+ }
+
+ /**
+ * @private
+ */
+ override public function addElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ var contentView:IParent = view as IParent;
+ if (contentView != null) {
+ contentView.addElement(c, dispatchEvent);
+ if (dispatchEvent)
+ this.dispatchEvent(new Event("childrenAdded"));
+ }
+ else {
+ super.addElement(c);
+ }
+ }
+
+ /**
+ * @private
+ */
+ override public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ {
+ var contentView:IParent = view as IParent;
+ if (contentView != null) {
+ contentView.addElementAt(c, index, dispatchEvent);
+ if (dispatchEvent)
+ this.dispatchEvent(new Event("childrenAdded"));
+ }
+ else {
+ super.addElementAt(c, index);
+ }
+ }
+
+ /**
+ * @private
+ */
+ override public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ var contentView:IParent = view as IParent;
+ if (contentView != null) {
+ contentView.removeElement(c, dispatchEvent);
+ if (dispatchEvent)
+ this.dispatchEvent(new Event("childrenRemoved"));
+ }
+ else {
+ super.removeElement(c);
+ }
+ }
+
+ /**
+ * @private
+ */
+ public function childrenAdded():void
+ {
+ dispatchEvent(new Event("childrenAdded"));
+ }
+
+ /**
+ * A ContainerBase doesn't create its children until it is added to
+ * a parent.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function addedToParent():void
+ {
+ if (!_initialized)
+ {
+ // each MXML file can also have styles in fx:Style block
+ ValuesManager.valuesImpl.init(this);
+ }
+
+ super.addedToParent();
+
+ if (!_initialized)
+ {
+ MXMLDataInterpreter.generateMXMLInstances(_mxmlDocument, this, MXMLDescriptor);
+
+ dispatchEvent(new Event("initBindings"));
+ dispatchEvent(new Event("initComplete"));
+ _initialized = true;
+ }
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $numElements():int
+ {
+ return super.numElements();
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $addElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ super.addElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ {
+ super.addElementAt(c, index, dispatchEvent);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $removeElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ super.removeElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $getElementIndex(c:Object):int
+ {
+ return super.getElementIndex(c);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $getElementAt(index:int):Object
+ {
+ return super.getElementAt(index);
+ }
+
+ private var _mxmlDescriptor:Array;
+ private var _mxmlDocument:Object = this;
+ private var _initialized:Boolean;
+
+ /**
+ * @copy org.apache.flex.core.Application#MXMLDescriptor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get MXMLDescriptor():Array
+ {
+ return _mxmlDescriptor;
+ }
+
+ /**
+ * @private
+ */
+ public function setMXMLDescriptor(document:Object, value:Array):void
+ {
+ _mxmlDocument = document;
+ _mxmlDescriptor = value;
+ }
+
+ /**
+ * @copy org.apache.flex.core.Application#generateMXMLAttributes()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function generateMXMLAttributes(data:Array):void
+ {
+ MXMLDataInterpreter.generateMXMLProperties(this, data);
+ }
+
+ /**
+ * @copy org.apache.flex.core.ItemRendererClassFactory#mxmlContent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var mxmlContent:Array;
+
+ private var _states:Array;
+
+ /**
+ * The array of view states. These should
+ * be instances of org.apache.flex.states.State.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get states():Array
+ {
+ return _states;
+ }
+
+ /**
+ * @private
+ * @flexjsignorecoercion Class
+ * @flexjsignorecoercion org.apache.flex.core.IBead
+ */
+ public function set states(value:Array):void
+ {
+ _states = value;
+ _currentState = _states[0].name;
+
+ try{
+ if (getBeadByType(IStatesImpl) == null)
+ {
+ var c:Class = ValuesManager.valuesImpl.getValue(this, "iStatesImpl") as Class;
+ var b:Object = new c();
+ addBead(b as IBead);
+ }
+ }
+ //TODO: Need to handle this case more gracefully
+ catch(e:Error)
+ {
+ COMPILE::SWF
+ {
+ trace(e.message);
+ }
+ }
+
+ }
+
+ /**
+ * <code>true</code> if the array of states
+ * contains a state with this name.
+ *
+ * @param state The state namem.
+ * @return True if state in state array
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function hasState(state:String):Boolean
+ {
+ for each (var s:State in _states)
+ {
+ if (s.name == state)
+ return true;
+ }
+ return false;
+ }
+
+ private var _currentState:String;
+
+ [Bindable("currentStateChange")]
+ /**
+ * The name of the current state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get currentState():String
+ {
+ return _currentState;
+ }
+
+ /**
+ * @private
+ */
+ public function set currentState(value:String):void
+ {
+ var event:ValueChangeEvent = new ValueChangeEvent("currentStateChange", false, false, _currentState, value)
+ _currentState = value;
+ dispatchEvent(event);
+ }
+
+ private var _transitions:Array;
+
+ /**
+ * The array of transitions.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get transitions():Array
+ {
+ return _transitions;
+ }
+
+ /**
+ * @private
+ */
+ public function set transitions(value:Array):void
+ {
+ _transitions = value;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f155cf8/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as
new file mode 100644
index 0000000..93e5c53
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as
@@ -0,0 +1,99 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ /**
+ * The ContainerBaseStrandChildren class the provides a way for advanced
+ * components to place children directly into the strand unlike the
+ * addElement() APIs on the Container which place children into the contentView.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ContainerBaseStrandChildren implements IParent
+ {
+ /**
+ * Constructor.
+ *
+ * @flexjsignorecoercion org.apache.flex.core.ContainerBase
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ContainerBaseStrandChildren(owner:IParent)
+ {
+ super();
+
+ this.owner = owner as ContainerBase;
+ }
+
+ public var owner:ContainerBase;
+
+ /**
+ * @private
+ */
+ public function get numElements():int
+ {
+ return owner.$numElements();
+ }
+
+ /**
+ * @private
+ */
+ public function addElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ owner.$addElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ {
+ owner.$addElementAt(c, index, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ owner.$removeElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function getElementIndex(c:Object):int
+ {
+ return owner.$getElementIndex(c);
+ }
+
+ /**
+ * @private
+ */
+ public function getElementAt(index:int):Object
+ {
+ return owner.$getElementAt(index);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f155cf8/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/FilledRectangle.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/FilledRectangle.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/FilledRectangle.as
new file mode 100644
index 0000000..962a11d
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/FilledRectangle.as
@@ -0,0 +1,125 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ COMPILE::SWF
+ {
+ import flash.display.Shape;
+ }
+
+ import org.apache.flex.core.UIBase;
+
+ /**
+ * The FilledRectangle class draws a simple filled
+ * rectangle without a border and with square corners.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class FilledRectangle extends UIBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function FilledRectangle()
+ {
+ super();
+
+ COMPILE::SWF
+ {
+ _shape = new flash.display.Shape();
+ this.addElement(_shape);
+ }
+ }
+
+ COMPILE::SWF
+ private var _shape:flash.display.Shape;
+
+ private var _fillColor:uint = 0x000000;
+
+ /**
+ * The color of the rectangle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get fillColor():uint
+ {
+ return _fillColor;
+ }
+
+ /**
+ * @private
+ */
+ public function set fillColor(value:uint):void
+ {
+ _fillColor = value;
+ }
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+ drawRect(0, 0, this.width, this.height);
+ }
+
+ /**
+ * Draw the rectangle.
+ * @param x The x position of the top-left corner of the rectangle.
+ * @param y The y position of the top-left corner.
+ * @param width The width of the rectangle.
+ * @param height The height of the rectangle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function drawRect(x:Number, y:Number, width:Number, height:Number):void
+ {
+ COMPILE::SWF
+ {
+ _shape.graphics.clear();
+ _shape.graphics.beginFill(_fillColor);
+ _shape.graphics.drawRect(x, y, width, height);
+ _shape.graphics.endFill();
+ }
+ COMPILE::JS
+ {
+ element.style.position = 'absolute';
+ element.style.backgroundColor = '#' + _fillColor.toString(16);
+ if (!isNaN(x)) this.x = x;
+ if (!isNaN(y)) this.y = y;
+ if (!isNaN(width)) this.width = width;
+ if (!isNaN(height)) this.height = height;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f155cf8/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBase.as
new file mode 100644
index 0000000..dbdcace
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBase.as
@@ -0,0 +1,126 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ import org.apache.flex.core.IMXMLDocument;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.ValueChangeEvent;
+ import org.apache.flex.states.State;
+ import org.apache.flex.utils.MXMLDataInterpreter;
+
+ /**
+ * The ListBase class is the base class for most lists
+ * in FlexJS.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ListBase extends UIBase implements IContentViewHost
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ListBase()
+ {
+ super();
+
+ _strandChildren = new ListBaseStrandChildren(this);
+ }
+
+ private var _strandChildren:ListBaseStrandChildren;
+
+ /**
+ * @private
+ */
+ public function get strandChildren():IParent
+ {
+ return _strandChildren;
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $numElements():int
+ {
+ return super.numElements();
+ }
+
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $addElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ super.addElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ {
+ super.addElementAt(c, index, dispatchEvent);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $removeElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ super.removeElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $getElementIndex(c:Object):int
+ {
+ return super.getElementIndex(c);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $getElementAt(index:int):Object
+ {
+ return super.getElementAt(index);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f155cf8/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as
new file mode 100644
index 0000000..e8f2fa5
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as
@@ -0,0 +1,100 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+
+
+ /**
+ * The ListBaseStrandChildren exists so that Lists are compatible with
+ * the ListView/ContainerView beads.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ListBaseStrandChildren implements IParent
+ {
+ /**
+ * Constructor.
+ *
+ * @flexjsignorecoercion org.apache.flex.core.ListBase
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ListBaseStrandChildren(owner:IParent)
+ {
+ super();
+
+ this.owner = owner as ListBase;
+ }
+
+ public var owner:ListBase;
+
+ /**
+ * @private
+ */
+ public function get numElements():int
+ {
+ return owner.$numElements();
+ }
+
+ /**
+ * @private
+ */
+ public function addElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ owner.$addElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ {
+ owner.$addElementAt(c, index, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ owner.$removeElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function getElementIndex(c:Object):int
+ {
+ return owner.$getElementIndex(c);
+ }
+
+ /**
+ * @private
+ */
+ public function getElementAt(index:int):Object
+ {
+ return owner.$getElementAt(index);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f155cf8/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/View.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/View.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/View.as
new file mode 100644
index 0000000..2d0f2c4
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/View.as
@@ -0,0 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ /**
+ * The View class is the class for most views in a FlexJS
+ * application. It is generally used as the root tag of MXML
+ * documents and UI controls and containers are added to it.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class View extends ViewBase
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f155cf8/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ViewBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ViewBase.as
new file mode 100644
index 0000000..7e4b65e
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ViewBase.as
@@ -0,0 +1,97 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ import org.apache.flex.events.Event;
+
+ //--------------------------------------
+ // Events
+ //--------------------------------------
+
+ /**
+ * Dispatched at startup. Attributes and sub-instances of
+ * the MXML document have been created and assigned.
+ * The component lifecycle is different
+ * than the Flex SDK. There is no creationComplete event.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="initComplete", type="org.apache.flex.events.Event")]
+
+ [DefaultProperty("mxmlContent")]
+
+ /**
+ * The ViewBase class is the base class for most views in a FlexJS
+ * application.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ViewBase extends ContainerBase implements IPopUpHost, IApplicationView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ViewBase()
+ {
+ super();
+
+ className = "flexjs";
+ }
+
+ private var _applicationModel:Object;
+
+ [Bindable("modelChanged")]
+
+ /**
+ * A reference to the Application's model. Usually,
+ * a view is displaying the main model for an
+ * application.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get applicationModel():Object
+ {
+ return _applicationModel;
+ }
+
+ /**
+ * @private
+ */
+ public function set applicationModel(value:Object):void
+ {
+ _applicationModel = value;
+ dispatchEvent(new Event("modelChanged"));
+ }
+
+ }
+}
[38/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - move a
few more Graphics classes to HTML
Posted by ah...@apache.org.
move a few more Graphics classes to HTML
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/e020ba83
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/e020ba83
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/e020ba83
Branch: refs/heads/refactor-sprite
Commit: e020ba837067597d9ff97f828214c359455af13b
Parents: c60efc6
Author: Alex Harui <ah...@apache.org>
Authored: Mon Oct 31 09:23:03 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 08:02:15 2016 -0700
----------------------------------------------------------------------
.../flex/org/apache/flex/svg/BinaryImage.as | 87 ------------
.../src/main/flex/org/apache/flex/svg/Image.as | 133 -------------------
.../flex/org/apache/flex/svg/beads/ImageView.as | 87 ------------
.../flex/org/apache/flex/svg/BinaryImage.as | 87 ++++++++++++
.../src/main/flex/org/apache/flex/svg/Image.as | 133 +++++++++++++++++++
.../flex/org/apache/flex/svg/beads/ImageView.as | 87 ++++++++++++
6 files changed, 307 insertions(+), 307 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e020ba83/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/BinaryImage.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/BinaryImage.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/BinaryImage.as
deleted file mode 100644
index c03793c..0000000
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/BinaryImage.as
+++ /dev/null
@@ -1,87 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.svg
-{
- import org.apache.flex.core.IBinaryImage;
- import org.apache.flex.core.IBinaryImageModel;
- import org.apache.flex.core.ValuesManager;
- import org.apache.flex.core.IBinaryImageLoader;
- import org.apache.flex.utils.BinaryData;
-
- /**
- * The Image class is a component that displays a bitmap. The Image uses
- * the following beads:
- *
- * org.apache.flex.core.IBeadModel: the data model for the Image, including the url/binary property.
- * org.apache.flex.core.IBeadView: constructs the visual elements of the component.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class BinaryImage extends Image implements IBinaryImage
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function BinaryImage()
- {
- super();
- }
-
- override public function addedToParent():void
- {
- var c:Class = ValuesManager.valuesImpl.getValue(this, "iBinaryImageLoader") as Class;
- if (c)
- {
- if (c)
- {
- var loader:IBinaryImageLoader = (new c()) as IBinaryImageLoader;
- addBead(loader);
- }
- }
- super.addedToParent();
- }
-
- /**
- * The binary bitmap data.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.IImageModel
- */
- public function get binary():BinaryData
- {
- return (model as IBinaryImageModel).binary;
- }
- public function set binary(value:BinaryData):void
- {
- (model as IBinaryImageModel).binary = value;
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e020ba83/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Image.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Image.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Image.as
deleted file mode 100644
index cd0729f..0000000
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Image.as
+++ /dev/null
@@ -1,133 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flex.svg
-{
- import org.apache.flex.core.ImageBase;
-
- COMPILE::JS
- {
- import org.apache.flex.core.WrappedHTMLElement;
- }
- public class Image extends ImageBase
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.7
- */
- public function Image()
- {
- super();
- }
-
- /**
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- COMPILE::JS
- override protected function createElement():WrappedHTMLElement
- {
- element = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as WrappedHTMLElement;
- element.flexjs_wrapper = this;
- element.setAttribute('x', 0);
- element.setAttribute('y', 0);
- //element.offsetParent = null;
- positioner = element;
- positioner.style.position = 'relative';
- addImageElement();
- return element;
- }
-
- COMPILE::JS
- protected var _image:WrappedHTMLElement;
-
- /**
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- COMPILE::JS
- protected function addImageElement():void
- {
- if (_image == null) {
- _image = document.createElementNS('http://www.w3.org/2000/svg', 'image') as WrappedHTMLElement;
- _image.setAttribute("width", "100%");
- _image.setAttribute("height", "100%");
- _image.flexjs_wrapper = this;
- element.appendChild(_image);
- }
- }
-
- COMPILE::JS
- override public function get imageElement():Element
- {
- return _image;
- }
-
- COMPILE::JS
- override public function get transformElement():WrappedHTMLElement
- {
- return _image;
- }
-
- COMPILE::JS
- override public function applyImageData(binaryDataAsString:String):void
- {
- (_image as SVGImageElement).setAttributeNS('http://www.w3.org/1999/xlink','href', binaryDataAsString);
- }
- COMPILE::JS
- override public function setWidth(value:Number, noEvent:Boolean=false):void
- {
- super.setWidth(value, noEvent);
- positioner.setAttribute("width", value);
- }
-
- COMPILE::JS
- override public function setHeight(value:Number, noEvent:Boolean=false):void
- {
- super.setHeight(value, noEvent);
- positioner.setAttribute("height", value);
- }
-
- COMPILE::JS
- override public function setX(value:Number):void
- {
- super.setX(value);
- positioner.setAttribute("x", value);
-
- }
- COMPILE::JS
- override public function setY(value:Number):void
- {
- super.setY(value);
- positioner.setAttribute("y", value);
-
- }
-
- COMPILE::JS
- override public function set x(value:Number):void
- {
- super.x = value;
- positioner.setAttribute("x", value);
- }
-
- COMPILE::JS
- override public function set y(value:Number):void
- {
- super.y = value;
- positioner.setAttribute("y", value);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e020ba83/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/beads/ImageView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/beads/ImageView.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/beads/ImageView.as
deleted file mode 100644
index 8cbd789..0000000
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/beads/ImageView.as
+++ /dev/null
@@ -1,87 +0,0 @@
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.svg.beads
-{
- import org.apache.flex.core.ImageViewBase;
- COMPILE::JS
- {
- import org.apache.flex.core.UIBase;
- import org.apache.flex.core.ValuesManager;
- }
-
- /**
- * The ImageView class creates the visual elements of the org.apache.flex.svg.Image component.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class ImageView extends ImageViewBase
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ImageView()
- {
- }
-
- COMPILE::JS
- override protected function sizeChangedHandler(event:Object):void
- {
- super.sizeChangedHandler(event);
- var host:UIBase = _strand as UIBase;
-
- var left:* = ValuesManager.valuesImpl.getValue(host, "left");
- var right:* = ValuesManager.valuesImpl.getValue(host, "right");
- var l:Number = isNaN(left) ? NaN : left;
- var r:Number = isNaN(right) ? NaN : right;
-
- var top:* = ValuesManager.valuesImpl.getValue(host, "top");
- var bottom:* = ValuesManager.valuesImpl.getValue(host, "bottom");
- var t:Number = isNaN(top) ? NaN : top;
- var b:Number = isNaN(bottom) ? NaN : bottom;
-
- var p:Object = host.positioner;
-
- if (!isNaN(l) &&
- !isNaN(r)) {
- // if just using size constraints and image will not shrink or grow
- var computedWidth:Number = (host.positioner.offsetParent as HTMLElement).offsetWidth -
- l - r;
- p.setAttribute("width", computedWidth);
-
- }
- if (!isNaN(t) &&
- !isNaN(b)) {
- // if just using size constraints and image will not shrink or grow
- var computedHeight:Number = (host.positioner.offsetParent as HTMLElement).offsetHeight -
- t - b;
- p.setAttribute("height", computedHeight);
- }
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e020ba83/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/BinaryImage.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/BinaryImage.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/BinaryImage.as
new file mode 100644
index 0000000..c03793c
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/BinaryImage.as
@@ -0,0 +1,87 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.svg
+{
+ import org.apache.flex.core.IBinaryImage;
+ import org.apache.flex.core.IBinaryImageModel;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.core.IBinaryImageLoader;
+ import org.apache.flex.utils.BinaryData;
+
+ /**
+ * The Image class is a component that displays a bitmap. The Image uses
+ * the following beads:
+ *
+ * org.apache.flex.core.IBeadModel: the data model for the Image, including the url/binary property.
+ * org.apache.flex.core.IBeadView: constructs the visual elements of the component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class BinaryImage extends Image implements IBinaryImage
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function BinaryImage()
+ {
+ super();
+ }
+
+ override public function addedToParent():void
+ {
+ var c:Class = ValuesManager.valuesImpl.getValue(this, "iBinaryImageLoader") as Class;
+ if (c)
+ {
+ if (c)
+ {
+ var loader:IBinaryImageLoader = (new c()) as IBinaryImageLoader;
+ addBead(loader);
+ }
+ }
+ super.addedToParent();
+ }
+
+ /**
+ * The binary bitmap data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.IImageModel
+ */
+ public function get binary():BinaryData
+ {
+ return (model as IBinaryImageModel).binary;
+ }
+ public function set binary(value:BinaryData):void
+ {
+ (model as IBinaryImageModel).binary = value;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e020ba83/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Image.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Image.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Image.as
new file mode 100644
index 0000000..cd0729f
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Image.as
@@ -0,0 +1,133 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flex.svg
+{
+ import org.apache.flex.core.ImageBase;
+
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+ public class Image extends ImageBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.7
+ */
+ public function Image()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as WrappedHTMLElement;
+ element.flexjs_wrapper = this;
+ element.setAttribute('x', 0);
+ element.setAttribute('y', 0);
+ //element.offsetParent = null;
+ positioner = element;
+ positioner.style.position = 'relative';
+ addImageElement();
+ return element;
+ }
+
+ COMPILE::JS
+ protected var _image:WrappedHTMLElement;
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ protected function addImageElement():void
+ {
+ if (_image == null) {
+ _image = document.createElementNS('http://www.w3.org/2000/svg', 'image') as WrappedHTMLElement;
+ _image.setAttribute("width", "100%");
+ _image.setAttribute("height", "100%");
+ _image.flexjs_wrapper = this;
+ element.appendChild(_image);
+ }
+ }
+
+ COMPILE::JS
+ override public function get imageElement():Element
+ {
+ return _image;
+ }
+
+ COMPILE::JS
+ override public function get transformElement():WrappedHTMLElement
+ {
+ return _image;
+ }
+
+ COMPILE::JS
+ override public function applyImageData(binaryDataAsString:String):void
+ {
+ (_image as SVGImageElement).setAttributeNS('http://www.w3.org/1999/xlink','href', binaryDataAsString);
+ }
+ COMPILE::JS
+ override public function setWidth(value:Number, noEvent:Boolean=false):void
+ {
+ super.setWidth(value, noEvent);
+ positioner.setAttribute("width", value);
+ }
+
+ COMPILE::JS
+ override public function setHeight(value:Number, noEvent:Boolean=false):void
+ {
+ super.setHeight(value, noEvent);
+ positioner.setAttribute("height", value);
+ }
+
+ COMPILE::JS
+ override public function setX(value:Number):void
+ {
+ super.setX(value);
+ positioner.setAttribute("x", value);
+
+ }
+ COMPILE::JS
+ override public function setY(value:Number):void
+ {
+ super.setY(value);
+ positioner.setAttribute("y", value);
+
+ }
+
+ COMPILE::JS
+ override public function set x(value:Number):void
+ {
+ super.x = value;
+ positioner.setAttribute("x", value);
+ }
+
+ COMPILE::JS
+ override public function set y(value:Number):void
+ {
+ super.y = value;
+ positioner.setAttribute("y", value);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e020ba83/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/beads/ImageView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/beads/ImageView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/beads/ImageView.as
new file mode 100644
index 0000000..8cbd789
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/beads/ImageView.as
@@ -0,0 +1,87 @@
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.svg.beads
+{
+ import org.apache.flex.core.ImageViewBase;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ }
+
+ /**
+ * The ImageView class creates the visual elements of the org.apache.flex.svg.Image component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ImageView extends ImageViewBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ImageView()
+ {
+ }
+
+ COMPILE::JS
+ override protected function sizeChangedHandler(event:Object):void
+ {
+ super.sizeChangedHandler(event);
+ var host:UIBase = _strand as UIBase;
+
+ var left:* = ValuesManager.valuesImpl.getValue(host, "left");
+ var right:* = ValuesManager.valuesImpl.getValue(host, "right");
+ var l:Number = isNaN(left) ? NaN : left;
+ var r:Number = isNaN(right) ? NaN : right;
+
+ var top:* = ValuesManager.valuesImpl.getValue(host, "top");
+ var bottom:* = ValuesManager.valuesImpl.getValue(host, "bottom");
+ var t:Number = isNaN(top) ? NaN : top;
+ var b:Number = isNaN(bottom) ? NaN : bottom;
+
+ var p:Object = host.positioner;
+
+ if (!isNaN(l) &&
+ !isNaN(r)) {
+ // if just using size constraints and image will not shrink or grow
+ var computedWidth:Number = (host.positioner.offsetParent as HTMLElement).offsetWidth -
+ l - r;
+ p.setAttribute("width", computedWidth);
+
+ }
+ if (!isNaN(t) &&
+ !isNaN(b)) {
+ // if just using size constraints and image will not shrink or grow
+ var computedHeight:Number = (host.positioner.offsetParent as HTMLElement).offsetHeight -
+ t - b;
+ p.setAttribute("height", computedHeight);
+ }
+ }
+
+ }
+}
[24/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - move
implementation classes to HTML so variants can exist in other SWCs
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ContainerBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ContainerBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ContainerBase.as
new file mode 100644
index 0000000..047b635
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ContainerBase.as
@@ -0,0 +1,453 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ import org.apache.flex.core.IMXMLDocument;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.ValueChangeEvent;
+ import org.apache.flex.states.State;
+ import org.apache.flex.utils.MXMLDataInterpreter;
+
+ /**
+ * Indicates that the state change has completed. All properties
+ * that need to change have been changed, and all transitinos
+ * that need to run have completed. However, any deferred work
+ * may not be completed, and the screen may not be updated until
+ * code stops executing.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="stateChangeComplete", type="org.apache.flex.events.Event")]
+
+ /**
+ * Indicates that the initialization of the container is complete.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="initComplete", type="org.apache.flex.events.Event")]
+
+ /**
+ * Indicates that the children of the container is have been added.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="childrenAdded", type="org.apache.flex.events.Event")]
+
+ [DefaultProperty("mxmlContent")]
+
+ /**
+ * The ContainerBase class is the base class for most containers
+ * in FlexJS. It is usable as the root tag of MXML
+ * documents and UI controls and containers are added to it.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ContainerBase extends UIBase implements IMXMLDocument, IStatesObject, IContainer, IContentViewHost
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ContainerBase()
+ {
+ super();
+
+ _strandChildren = new ContainerBaseStrandChildren(this);
+ }
+
+ private var _strandChildren:ContainerBaseStrandChildren;
+
+ /**
+ * @private
+ */
+ public function get strandChildren():IParent
+ {
+ return _strandChildren;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IParent#getElementAt()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function getElementAt(index:int):IChild
+ {
+ var contentView:IParent = view as IParent;
+ if (contentView != null) {
+ return contentView.getElementAt(index);
+ } else {
+ return super.getElementAt(index);
+ }
+ }
+
+ /**
+ * @private
+ */
+ override public function getElementIndex(c:IChild):int
+ {
+ var contentView:IParent = view as IParent;
+ if (contentView != null) {
+ return contentView.getElementIndex(c);
+ } else {
+ return super.getElementIndex(c);
+ }
+ }
+
+ /**
+ * @private
+ */
+ override public function addElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ var contentView:IParent = view as IParent;
+ if (contentView != null) {
+ contentView.addElement(c, dispatchEvent);
+ if (dispatchEvent)
+ this.dispatchEvent(new Event("childrenAdded"));
+ }
+ else {
+ super.addElement(c);
+ }
+ }
+
+ /**
+ * @private
+ */
+ override public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
+ {
+ var contentView:IParent = view as IParent;
+ if (contentView != null) {
+ contentView.addElementAt(c, index, dispatchEvent);
+ if (dispatchEvent)
+ this.dispatchEvent(new Event("childrenAdded"));
+ }
+ else {
+ super.addElementAt(c, index);
+ }
+ }
+
+ /**
+ * @private
+ */
+ override public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ var contentView:IParent = view as IParent;
+ if (contentView != null) {
+ contentView.removeElement(c, dispatchEvent);
+ if (dispatchEvent)
+ this.dispatchEvent(new Event("childrenRemoved"));
+ }
+ else {
+ super.removeElement(c);
+ }
+ }
+
+ /**
+ * @private
+ */
+ public function childrenAdded():void
+ {
+ dispatchEvent(new Event("childrenAdded"));
+ }
+
+ /**
+ * A ContainerBase doesn't create its children until it is added to
+ * a parent.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function addedToParent():void
+ {
+ if (!_initialized)
+ {
+ // each MXML file can also have styles in fx:Style block
+ ValuesManager.valuesImpl.init(this);
+ }
+
+ super.addedToParent();
+
+ if (!_initialized)
+ {
+ MXMLDataInterpreter.generateMXMLInstances(_mxmlDocument, this, MXMLDescriptor);
+
+ dispatchEvent(new Event("initBindings"));
+ dispatchEvent(new Event("initComplete"));
+ _initialized = true;
+ }
+ }
+
+ /**
+ * @private
+ */
+ override public function get numElements():int
+ {
+ var contentView:IParent = view as IParent;
+ return contentView != null ? contentView.numElements : super.numElements;
+ }
+
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $numElements():int
+ {
+ return super.numElements();
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $addElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ super.addElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
+ {
+ super.addElementAt(c, index, dispatchEvent);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $removeElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ super.removeElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $getElementIndex(c:IChild):int
+ {
+ return super.getElementIndex(c);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $getElementAt(index:int):IChild
+ {
+ return super.getElementAt(index);
+ }
+
+ private var _mxmlDescriptor:Array;
+ private var _mxmlDocument:Object = this;
+ private var _initialized:Boolean;
+
+ /**
+ * @copy org.apache.flex.core.Application#MXMLDescriptor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get MXMLDescriptor():Array
+ {
+ return _mxmlDescriptor;
+ }
+
+ /**
+ * @private
+ */
+ public function setMXMLDescriptor(document:Object, value:Array):void
+ {
+ _mxmlDocument = document;
+ _mxmlDescriptor = value;
+ }
+
+ /**
+ * @copy org.apache.flex.core.Application#generateMXMLAttributes()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function generateMXMLAttributes(data:Array):void
+ {
+ MXMLDataInterpreter.generateMXMLProperties(this, data);
+ }
+
+ /**
+ * @copy org.apache.flex.core.ItemRendererClassFactory#mxmlContent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var mxmlContent:Array;
+
+ private var _states:Array;
+
+ /**
+ * The array of view states. These should
+ * be instances of org.apache.flex.states.State.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get states():Array
+ {
+ return _states;
+ }
+
+ /**
+ * @private
+ * @flexjsignorecoercion Class
+ * @flexjsignorecoercion org.apache.flex.core.IBead
+ */
+ public function set states(value:Array):void
+ {
+ _states = value;
+ _currentState = _states[0].name;
+
+ try{
+ if (getBeadByType(IStatesImpl) == null)
+ {
+ var c:Class = ValuesManager.valuesImpl.getValue(this, "iStatesImpl") as Class;
+ var b:Object = new c();
+ addBead(b as IBead);
+ }
+ }
+ //TODO: Need to handle this case more gracefully
+ catch(e:Error)
+ {
+ COMPILE::SWF
+ {
+ trace(e.message);
+ }
+ }
+
+ }
+
+ /**
+ * <code>true</code> if the array of states
+ * contains a state with this name.
+ *
+ * @param state The state namem.
+ * @return True if state in state array
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function hasState(state:String):Boolean
+ {
+ for each (var s:State in _states)
+ {
+ if (s.name == state)
+ return true;
+ }
+ return false;
+ }
+
+ private var _currentState:String;
+
+ [Bindable("currentStateChange")]
+ /**
+ * The name of the current state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get currentState():String
+ {
+ return _currentState;
+ }
+
+ /**
+ * @private
+ */
+ public function set currentState(value:String):void
+ {
+ var event:ValueChangeEvent = new ValueChangeEvent("currentStateChange", false, false, _currentState, value)
+ _currentState = value;
+ dispatchEvent(event);
+ }
+
+ private var _transitions:Array;
+
+ /**
+ * The array of transitions.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get transitions():Array
+ {
+ return _transitions;
+ }
+
+ /**
+ * @private
+ */
+ public function set transitions(value:Array):void
+ {
+ _transitions = value;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as
new file mode 100644
index 0000000..e961c1f
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as
@@ -0,0 +1,99 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ /**
+ * The ContainerBaseStrandChildren class the provides a way for advanced
+ * components to place children directly into the strand unlike the
+ * addElement() APIs on the Container which place children into the contentView.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ContainerBaseStrandChildren implements IParent
+ {
+ /**
+ * Constructor.
+ *
+ * @flexjsignorecoercion org.apache.flex.core.ContainerBase
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ContainerBaseStrandChildren(owner:IParent)
+ {
+ super();
+
+ this.owner = owner as ContainerBase;
+ }
+
+ public var owner:ContainerBase;
+
+ /**
+ * @private
+ */
+ public function get numElements():int
+ {
+ return owner.$numElements();
+ }
+
+ /**
+ * @private
+ */
+ public function addElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ owner.$addElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
+ {
+ owner.$addElementAt(c, index, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ owner.$removeElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function getElementIndex(c:IChild):int
+ {
+ return owner.$getElementIndex(c);
+ }
+
+ /**
+ * @private
+ */
+ public function getElementAt(index:int):IChild
+ {
+ return owner.$getElementAt(index);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/FilledRectangle.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/FilledRectangle.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/FilledRectangle.as
new file mode 100644
index 0000000..5888a94
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/FilledRectangle.as
@@ -0,0 +1,125 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ COMPILE::SWF
+ {
+ import flash.display.Shape;
+ }
+
+ import org.apache.flex.core.UIBase;
+
+ /**
+ * The FilledRectangle class draws a simple filled
+ * rectangle without a border and with square corners.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class FilledRectangle extends UIBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function FilledRectangle()
+ {
+ super();
+
+ COMPILE::SWF
+ {
+ _shape = new flash.display.Shape();
+ $displayObjectContainer.addChild(_shape);
+ }
+ }
+
+ COMPILE::SWF
+ private var _shape:flash.display.Shape;
+
+ private var _fillColor:uint = 0x000000;
+
+ /**
+ * The color of the rectangle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get fillColor():uint
+ {
+ return _fillColor;
+ }
+
+ /**
+ * @private
+ */
+ public function set fillColor(value:uint):void
+ {
+ _fillColor = value;
+ }
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+ drawRect(0, 0, this.width, this.height);
+ }
+
+ /**
+ * Draw the rectangle.
+ * @param x The x position of the top-left corner of the rectangle.
+ * @param y The y position of the top-left corner.
+ * @param width The width of the rectangle.
+ * @param height The height of the rectangle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function drawRect(x:Number, y:Number, width:Number, height:Number):void
+ {
+ COMPILE::SWF
+ {
+ _shape.graphics.clear();
+ _shape.graphics.beginFill(_fillColor);
+ _shape.graphics.drawRect(x, y, width, height);
+ _shape.graphics.endFill();
+ }
+ COMPILE::JS
+ {
+ element.style.position = 'absolute';
+ element.style.backgroundColor = '#' + _fillColor.toString(16);
+ if (!isNaN(x)) this.x = x;
+ if (!isNaN(y)) this.y = y;
+ if (!isNaN(width)) this.width = width;
+ if (!isNaN(height)) this.height = height;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ListBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ListBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ListBase.as
new file mode 100644
index 0000000..f9c0aaa
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ListBase.as
@@ -0,0 +1,126 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ import org.apache.flex.core.IMXMLDocument;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.ValueChangeEvent;
+ import org.apache.flex.states.State;
+ import org.apache.flex.utils.MXMLDataInterpreter;
+
+ /**
+ * The ListBase class is the base class for most lists
+ * in FlexJS.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ListBase extends UIBase implements IContentViewHost
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ListBase()
+ {
+ super();
+
+ _strandChildren = new ListBaseStrandChildren(this);
+ }
+
+ private var _strandChildren:ListBaseStrandChildren;
+
+ /**
+ * @private
+ */
+ public function get strandChildren():IParent
+ {
+ return _strandChildren;
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $numElements():int
+ {
+ return super.numElements();
+ }
+
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $addElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ super.addElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
+ {
+ super.addElementAt(c, index, dispatchEvent);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $removeElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ super.removeElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $getElementIndex(c:IChild):int
+ {
+ return super.getElementIndex(c);
+ }
+
+ /**
+ * @private
+ * @suppress {undefinedNames}
+ * Support strandChildren.
+ */
+ public function $getElementAt(index:int):IChild
+ {
+ return super.getElementAt(index);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as
new file mode 100644
index 0000000..b1748f9
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as
@@ -0,0 +1,100 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+
+
+ /**
+ * The ListBaseStrandChildren exists so that Lists are compatible with
+ * the ListView/ContainerView beads.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ListBaseStrandChildren implements IParent
+ {
+ /**
+ * Constructor.
+ *
+ * @flexjsignorecoercion org.apache.flex.core.ListBase
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ListBaseStrandChildren(owner:IParent)
+ {
+ super();
+
+ this.owner = owner as ListBase;
+ }
+
+ public var owner:ListBase;
+
+ /**
+ * @private
+ */
+ public function get numElements():int
+ {
+ return owner.$numElements();
+ }
+
+ /**
+ * @private
+ */
+ public function addElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ owner.$addElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
+ {
+ owner.$addElementAt(c, index, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
+ {
+ owner.$removeElement(c, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ public function getElementIndex(c:IChild):int
+ {
+ return owner.$getElementIndex(c);
+ }
+
+ /**
+ * @private
+ */
+ public function getElementAt(index:int):IChild
+ {
+ return owner.$getElementAt(index);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/View.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/View.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/View.as
new file mode 100644
index 0000000..2d0f2c4
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/View.as
@@ -0,0 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ /**
+ * The View class is the class for most views in a FlexJS
+ * application. It is generally used as the root tag of MXML
+ * documents and UI controls and containers are added to it.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class View extends ViewBase
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ViewBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ViewBase.as
new file mode 100644
index 0000000..7e4b65e
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ViewBase.as
@@ -0,0 +1,97 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ import org.apache.flex.events.Event;
+
+ //--------------------------------------
+ // Events
+ //--------------------------------------
+
+ /**
+ * Dispatched at startup. Attributes and sub-instances of
+ * the MXML document have been created and assigned.
+ * The component lifecycle is different
+ * than the Flex SDK. There is no creationComplete event.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="initComplete", type="org.apache.flex.events.Event")]
+
+ [DefaultProperty("mxmlContent")]
+
+ /**
+ * The ViewBase class is the base class for most views in a FlexJS
+ * application.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ViewBase extends ContainerBase implements IPopUpHost, IApplicationView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ViewBase()
+ {
+ super();
+
+ className = "flexjs";
+ }
+
+ private var _applicationModel:Object;
+
+ [Bindable("modelChanged")]
+
+ /**
+ * A reference to the Application's model. Usually,
+ * a view is displaying the main model for an
+ * application.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get applicationModel():Object
+ {
+ return _applicationModel;
+ }
+
+ /**
+ * @private
+ */
+ public function set applicationModel(value:Object):void
+ {
+ _applicationModel = value;
+ dispatchEvent(new Event("modelChanged"));
+ }
+
+ }
+}
[30/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - move
UIBase and UIButtonBase
Posted by ah...@apache.org.
move UIBase and UIButtonBase
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/975d3f34
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/975d3f34
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/975d3f34
Branch: refs/heads/refactor-sprite
Commit: 975d3f34f058cf3fd79302a6e7037c5e29f7ac84
Parents: 87ee711
Author: Alex Harui <ah...@apache.org>
Authored: Fri Oct 28 08:06:04 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:55:20 2016 -0700
----------------------------------------------------------------------
.../main/flex/org/apache/flex/core/UIBase.as | 1401 ------------------
.../flex/org/apache/flex/core/UIButtonBase.as | 792 ----------
.../main/flex/org/apache/flex/core/UIBase.as | 1401 ++++++++++++++++++
.../flex/org/apache/flex/core/UIButtonBase.as | 792 ++++++++++
4 files changed, 2193 insertions(+), 2193 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/975d3f34/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as
deleted file mode 100644
index 0e4a988..0000000
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as
+++ /dev/null
@@ -1,1401 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.core
-{
- COMPILE::SWF
- {
- import flash.display.DisplayObject;
- import flash.display.Sprite;
- import flash.display.Stage;
- }
-
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.events.MouseEvent;
- import org.apache.flex.events.ValueChangeEvent;
- import org.apache.flex.events.utils.MouseEventConverter;
- COMPILE::SWF {
- import flash.display.InteractiveObject;
- }
-
- /**
- * Set a different class for click events so that
- * there aren't dependencies on the flash classes
- * on the JS side.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Event(name="click", type="org.apache.flex.events.MouseEvent")]
-
- /**
- * Set a different class for rollOver events so that
- * there aren't dependencies on the flash classes
- * on the JS side.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Event(name="rollOver", type="org.apache.flex.events.MouseEvent")]
-
- /**
- * Set a different class for rollOut events so that
- * there aren't dependencies on the flash classes
- * on the JS side.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Event(name="rollOut", type="org.apache.flex.events.MouseEvent")]
-
- /**
- * Set a different class for mouseDown events so that
- * there aren't dependencies on the flash classes
- * on the JS side.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Event(name="mouseDown", type="org.apache.flex.events.MouseEvent")]
-
- /**
- * Set a different class for mouseUp events so that
- * there aren't dependencies on the flash classes
- * on the JS side.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Event(name="mouseUp", type="org.apache.flex.events.MouseEvent")]
-
- /**
- * Set a different class for mouseMove events so that
- * there aren't dependencies on the flash classes
- * on the JS side.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Event(name="mouseMove", type="org.apache.flex.events.MouseEvent")]
-
- /**
- * Set a different class for mouseOut events so that
- * there aren't dependencies on the flash classes
- * on the JS side.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Event(name="mouseOut", type="org.apache.flex.events.MouseEvent")]
-
- /**
- * Set a different class for mouseOver events so that
- * there aren't dependencies on the flash classes
- * on the JS side.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Event(name="mouseOver", type="org.apache.flex.events.MouseEvent")]
-
- /**
- * The UIBase class is the base class for most composite user interface
- * components. For the Flash Player, Buttons and Text controls may
- * have a different base class and therefore may not extend UIBase.
- * However all user interface components should implement IUIBase.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class UIBase extends UIHTMLElementWrapper implements IStrandWithModel, IEventDispatcher, IParentIUIBase, IStyleableObject, ILayoutChild, ITransformHost
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function UIBase()
- {
- super();
-
- createElement();
-
- COMPILE::SWF
- {
- MouseEventConverter.setupInstanceConverters(this);
- }
- }
-
- COMPILE::SWF
- public function get $sprite():Sprite
- {
- return $displayObject as Sprite;
- }
-
- private var _explicitWidth:Number;
-
- /**
- * The explicitly set width (as opposed to measured width
- * or percentage width).
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get explicitWidth():Number
- {
- return _explicitWidth;
- }
-
- /**
- * @private
- */
- public function set explicitWidth(value:Number):void
- {
- if (_explicitWidth == value)
- return;
-
- // width can be pixel or percent not both
- if (!isNaN(value))
- _percentWidth = NaN;
-
- _explicitWidth = value;
-
- dispatchEvent(new Event("explicitWidthChanged"));
- }
-
- private var _explicitHeight:Number;
-
- /**
- * The explicitly set width (as opposed to measured width
- * or percentage width).
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get explicitHeight():Number
- {
- return _explicitHeight;
- }
-
- /**
- * @private
- */
- public function set explicitHeight(value:Number):void
- {
- if (_explicitHeight == value)
- return;
-
- // height can be pixel or percent not both
- if (!isNaN(value))
- _percentHeight = NaN;
-
- _explicitHeight = value;
-
- dispatchEvent(new Event("explicitHeightChanged"));
- }
-
- private var _percentWidth:Number;
-
- /**
- * The requested percentage width this component
- * should have in the parent container. Note that
- * the actual percentage may be different if the
- * total is more than 100% or if there are other
- * components with explicitly set widths.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get percentWidth():Number
- {
- return _percentWidth;
- }
-
- /**
- * @private
- */
- public function set percentWidth(value:Number):void
- {
- COMPILE::SWF {
- if (_percentWidth == value)
- return;
-
- if (!isNaN(value))
- _explicitWidth = NaN;
-
- _percentWidth = value;
- }
- COMPILE::JS {
- this._percentWidth = value;
- this.positioner.style.width = value + '%';
- if (!isNaN(value))
- this._explicitWidth = NaN;
- }
-
- dispatchEvent(new Event("percentWidthChanged"));
- }
-
- private var _percentHeight:Number;
-
- /**
- * The requested percentage height this component
- * should have in the parent container. Note that
- * the actual percentage may be different if the
- * total is more than 100% or if there are other
- * components with explicitly set heights.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get percentHeight():Number
- {
- return _percentHeight;
- }
-
- /**
- * @private
- */
- public function set percentHeight(value:Number):void
- {
- COMPILE::SWF {
- if (_percentHeight == value)
- return;
-
- if (!isNaN(value))
- _explicitHeight = NaN;
-
- _percentHeight = value;
- }
-
- COMPILE::JS {
- this._percentHeight = value;
- this.positioner.style.height = value + '%';
- if (!isNaN(value))
- this._explicitHeight = NaN;
- }
-
- dispatchEvent(new Event("percentHeightChanged"));
- }
-
- private var _width:Number;
-
- [Bindable("widthChanged")]
- [PercentProxy("percentWidth")]
- /**
- * The width of the component. If no width has been previously
- * set the default width may be specified in the IValuesImpl
- * or determined as the bounding box around all child
- * components and graphics.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- COMPILE::SWF
- override public function get width():Number
- {
- var w:Number = _width;
- if (isNaN(w)) {
- w = $width;
- }
- return w;
- }
-
- /**
- * @flexjsignorecoercion String
- */
- COMPILE::JS
- public function get width():Number
- {
- var pixels:Number;
- var strpixels:String = positioner.style.width as String;
- if (strpixels !== null && strpixels.indexOf('%') != -1)
- pixels = NaN;
- else
- pixels = parseFloat(strpixels);
- if (isNaN(pixels)) {
- pixels = positioner.offsetWidth;
- if (pixels === 0 && positioner.scrollWidth !== 0) {
- // invisible child elements cause offsetWidth to be 0.
- pixels = positioner.scrollWidth;
- }
- }
- return pixels;
- }
-
- /**
- * @private
- */
- COMPILE::SWF
- override public function set width(value:Number):void
- {
- if (explicitWidth != value)
- {
- explicitWidth = value;
- }
-
- setWidth(value);
- }
-
- /**
- * @private
- */
- COMPILE::JS
- public function set width(value:Number):void
- {
- if (explicitWidth != value)
- {
- explicitWidth = value;
- }
-
- setWidth(value);
- }
-
- /**
- * Retrieve the low-level bounding box width.
- * Not implemented in JS.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- COMPILE::SWF
- public function get $width():Number
- {
- return super.width;
- }
-
- private var _height:Number;
-
- [Bindable("heightChanged")]
- [PercentProxy("percentHeight")]
- /**
- * The height of the component. If no height has been previously
- * set the default height may be specified in the IValuesImpl
- * or determined as the bounding box around all child
- * components and graphics.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- COMPILE::SWF
- override public function get height():Number
- {
- var h:Number = _height;
- if (isNaN(h)) {
- h = $height;
- }
- return h;
- }
-
- /**
- * @flexjsignorecoercion String
- */
- COMPILE::JS
- public function get height():Number
- {
- var pixels:Number;
- var strpixels:String = positioner.style.height as String;
- if (strpixels !== null && strpixels.indexOf('%') != -1)
- pixels = NaN;
- else
- pixels = parseFloat(strpixels);
- if (isNaN(pixels)) {
- pixels = positioner.offsetHeight;
- if (pixels === 0 && positioner.scrollHeight !== 0) {
- // invisible child elements cause offsetHeight to be 0.
- pixels = positioner.scrollHeight;
- }
- }
- return pixels;
- }
-
- /**
- * @private
- */
- COMPILE::SWF
- override public function set height(value:Number):void
- {
- if (explicitHeight != value)
- {
- explicitHeight = value;
- }
-
- setHeight(value);
- }
-
- /**
- * @private
- */
- COMPILE::JS
- public function set height(value:Number):void
- {
- if (explicitHeight != value)
- {
- explicitHeight = value;
- }
-
- setHeight(value);
- }
-
- /**
- * Retrieve the low-level bounding box height.
- * Not implemented in JS.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- COMPILE::SWF
- public function get $height():Number
- {
- return super.height;
- }
-
- /**
- * @copy org.apache.flex.core.ILayoutChild#setHeight
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function setHeight(value:Number, noEvent:Boolean = false):void
- {
- if (_height != value)
- {
- _height = value;
- COMPILE::JS
- {
- this.positioner.style.height = value + 'px';
- }
- if (!noEvent)
- dispatchEvent(new Event("heightChanged"));
- }
- }
-
- /**
- * @copy org.apache.flex.core.ILayoutChild#setWidth
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function setWidth(value:Number, noEvent:Boolean = false):void
- {
- if (_width != value)
- {
- _width = value;
- COMPILE::JS
- {
- this.positioner.style.width = value + 'px';
- }
- if (!noEvent)
- dispatchEvent(new Event("widthChanged"));
- }
- }
-
- /**
- * @copy org.apache.flex.core.ILayoutChild#setWidthAndHeight
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function setWidthAndHeight(newWidth:Number, newHeight:Number, noEvent:Boolean = false):void
- {
- if (_width != newWidth)
- {
- _width = newWidth;
- COMPILE::JS
- {
- this.positioner.style.width = newWidth + 'px';
- }
- if (!noEvent)
- dispatchEvent(new Event("widthChanged"));
- }
- if (_height != newHeight)
- {
- _height = newHeight;
- COMPILE::JS
- {
- this.positioner.style.height = newHeight + 'px';
- }
- if (!noEvent)
- dispatchEvent(new Event("heightChanged"));
- }
- dispatchEvent(new Event("sizeChanged"));
- }
-
- /**
- * @copy org.apache.flex.core.ILayoutChild#isWidthSizedToContent
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function isWidthSizedToContent():Boolean
- {
- if (!isNaN(_explicitWidth))
- return false;
- if (!isNaN(_percentWidth))
- return false;
- var left:* = ValuesManager.valuesImpl.getValue(this, "left");
- var right:* = ValuesManager.valuesImpl.getValue(this, "right");
- return (left === undefined || right === undefined);
-
- }
-
- /**
- * @copy org.apache.flex.core.ILayoutChild#isHeightSizedToContent
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function isHeightSizedToContent():Boolean
- {
- if (!isNaN(_explicitHeight))
- return false;
- if (!isNaN(_percentHeight))
- return false;
- var top:* = ValuesManager.valuesImpl.getValue(this, "top");
- var bottom:* = ValuesManager.valuesImpl.getValue(this, "bottom");
- return (top === undefined || bottom === undefined);
- }
-
- private var _x:Number;
-
- /**
- * @private
- */
- COMPILE::SWF
- override public function set x(value:Number):void
- {
- super.x = _x = value;
- if (!style)
- style = { left: value };
- else
- style.left = value;
- }
-
- COMPILE::JS
- public function set x(value:Number):void
- {
- positioner.style.position = 'absolute';
- positioner.style.left = value + 'px';
- }
-
- /**
- * @flexjsignorecoercion String
- */
- COMPILE::JS
- public function get x():Number
- {
- var strpixels:String = positioner.style.left as String;
- var pixels:Number = parseFloat(strpixels);
- if (isNaN(pixels))
- pixels = positioner.offsetLeft;
- return pixels;
- }
-
- /**
- * @copy org.apache.flex.core.ILayoutChild#setX
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function setX(value:Number):void
- {
- COMPILE::SWF
- {
- super.x = value;
- }
- COMPILE::JS
- {
- positioner.style.position = 'absolute';
- positioner.style.left = value + 'px';
- }
- }
-
- private var _y:Number;
-
- /**
- * @private
- */
- COMPILE::SWF
- override public function set y(value:Number):void
- {
- super.y = _y = value;
- if (!style)
- style = { top: value };
- else
- style.top = value;
- }
-
- COMPILE::JS
- public function set y(value:Number):void
- {
- positioner.style.position = 'absolute';
- positioner.style.top = value + 'px';
- }
-
- /**
- * @flexjsignorecoercion String
- */
- COMPILE::JS
- public function get y():Number
- {
- var strpixels:String = positioner.style.top as String;
- var pixels:Number = parseFloat(strpixels);
- if (isNaN(pixels))
- pixels = positioner.offsetTop;
- return pixels;
- }
-
- /**
- * @copy org.apache.flex.core.ILayoutChild#setY
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function setY(value:Number):void
- {
- COMPILE::SWF
- {
- super.y = value;
- }
- COMPILE::JS
- {
- positioner.style.position = 'absolute';
- positioner.style.top = value + 'px';
- }
- }
-
- /**
- * @private
- */
- [Bindable("visibleChanged")]
- COMPILE::SWF
- override public function set visible(value:Boolean):void
- {
- super.visible = value;
- dispatchEvent(new Event(value?"show":"hide"));
- dispatchEvent(new Event("visibleChanged"));
- }
-
- COMPILE::JS
- private var displayStyleForLayout:String;
-
- /**
- * The display style is used for both visible
- * and layout so is managed as a special case.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- COMPILE::JS
- public function setDisplayStyleForLayout(value:String):void
- {
- if (positioner.style.display !== 'none')
- positioner.style.display = value;
- else
- displayStyleForLayout = value;
- }
-
- COMPILE::JS
- public function get visible():Boolean
- {
- return positioner.style.display !== 'none';
- }
-
- COMPILE::JS
- public function set visible(value:Boolean):void
- {
- var oldValue:Boolean = positioner.style.display !== 'none';
- if (value !== oldValue)
- {
- if (!value)
- {
- displayStyleForLayout = positioner.style.display;
- positioner.style.display = 'none';
- dispatchEvent(new Event('hide'));
- }
- else
- {
- if (displayStyleForLayout)
- positioner.style.display = displayStyleForLayout;
- dispatchEvent(new Event('show'));
- }
- dispatchEvent(new Event('visibleChanged'));
- }
- }
-
- /**
- * @return The array of children.
- * @flexjsignorecoercion Array
- */
- COMPILE::JS
- public function internalChildren():Array
- {
- return element.childNodes as Array;
- }
-
- private var _view:IBeadView;
-
- /**
- * An IBeadView that serves as the view for the component.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion Class
- */
- public function get view():IBeadView
- {
- if (_view == null)
- {
- var c:Class = ValuesManager.valuesImpl.getValue(this, "iBeadView") as Class;
- if (c)
- {
- if (c)
- {
- _view = (new c()) as IBeadView;
- addBead(_view);
- }
- }
- }
- return _view;
- }
-
- /**
- * @private
- */
- public function set view(value:IBeadView):void
- {
- if (_view != value)
- {
- addBead(value as IBead);
- dispatchEvent(new Event("viewChanged"));
- }
- }
-
- private var _id:String;
-
- /**
- * An id property for MXML documents.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get id():String
- {
- return _id;
- }
-
- /**
- * @private
- */
- public function set id(value:String):void
- {
- if (_id != value)
- {
- _id = value;
- dispatchEvent(new Event("idChanged"));
- }
- }
-
- private var _style:Object;
-
- /**
- * The object that contains
- * "styles" and other associated
- * name-value pairs. You can
- * also specify a string in
- * HTML style attribute format.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get style():Object
- {
- return _style;
- }
-
- /**
- * @private
- * @flexjsignorecoercion String
- */
- public function set style(value:Object):void
- {
- if (_style != value)
- {
- if (value is String)
- {
- _style = ValuesManager.valuesImpl.parseStyles(value as String);
- }
- else
- _style = value;
- if (!isNaN(_y))
- _style.top = _y;
- if (!isNaN(_x))
- _style.left = _x;
- dispatchEvent(new Event("stylesChanged"));
- }
- }
-
- /**
- * A list of type names. Often used for CSS
- * type selector lookups.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public var typeNames:String;
-
- private var _className:String;
-
- /**
- * The classname. Often used for CSS
- * class selector lookups.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get className():String
- {
- return _className;
- }
-
- /**
- * @private
- */
- public function set className(value:String):void
- {
- if (_className != value)
- {
- COMPILE::JS
- {
- setClassName(typeNames ? value + ' ' + typeNames : value);
- }
- _className = value;
- dispatchEvent(new Event("classNameChanged"));
- }
- }
-
- COMPILE::JS
- protected function setClassName(value:String):void
- {
- element.className = value;
- }
-
-
- /**
- * @copy org.apache.flex.core.Application#beads
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public var beads:Array;
-
- COMPILE::SWF
- private var _beads:Vector.<IBead>;
-
- /**
- * @copy org.apache.flex.core.IStrand#addBead()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function addBead(bead:IBead):void
- {
- super.addBead(bead);
- if (bead is IBeadView)
- _view = bead as IBeadView;
-
- if (bead is IBeadView) {
- IEventDispatcher(this).dispatchEvent(new Event("viewChanged"));
- }
- }
-
-
- // maintain this or just calculate it from the displayobject children on demand?
- private var _elements:Array;
-
- /**
- * @copy org.apache.flex.core.IParent#addElement()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.IUIBase
- */
- public function addElement(c:IChild, dispatchEvent:Boolean = true):void
- {
- COMPILE::SWF
- {
- if(_elements == null)
- _elements = [];
- _elements[_elements.length] = c;
- $displayObjectContainer.addChild(c.$displayObject);
- if (c is IUIBase)
- {
- IUIBase(c).addedToParent();
- }
-
- }
- COMPILE::JS
- {
- element.appendChild(c.positioner);
- (c as IUIBase).addedToParent();
- }
- }
-
- /**
- * @copy org.apache.flex.core.IParent#addElementAt()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.IUIBase
- */
- public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
- {
- COMPILE::SWF
- {
- if(_elements == null)
- _elements = [];
- _elements.splice(index,0,c);
-
- $displayObjectContainer.addChildAt(c.$displayObject,index);
-
- if (c is IUIBase)
- {
- (c as IUIBase).addedToParent();
- }
- }
- COMPILE::JS
- {
- var children:Array = internalChildren();
- if (index >= children.length)
- addElement(c);
- else
- {
- element.insertBefore(c.positioner,
- children[index]);
- (c as IUIBase).addedToParent();
- }
- }
- }
-
- /**
- * @copy org.apache.flex.core.IParent#getElementAt()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function getElementAt(index:int):IChild
- {
- COMPILE::SWF
- {
- if(_elements == null)
- return null;
- return _elements[index];
- }
- COMPILE::JS
- {
- var children:Array = internalChildren();
- return children[index].flexjs_wrapper;
- }
- }
-
- /**
- * @copy org.apache.flex.core.IParent#getElementIndex()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function getElementIndex(c:IChild):int
- {
- COMPILE::SWF
- {
- if(_elements == null)
- return -1;
- return _elements.indexOf(c);
- }
- COMPILE::JS
- {
- var children:Array = internalChildren();
- var n:int = children.length;
- for (var i:int = 0; i < n; i++)
- {
- if (children[i] == c.element)
- return i;
- }
- return -1;
- }
- }
-
- /**
- * @copy org.apache.flex.core.IParent#removeElement()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion HTMLElement
- */
- public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
- {
- COMPILE::SWF
- {
- if(_elements)
- {
- var idx:int = _elements.indexOf(c);
- if(idx>=0)
- _elements.splice(idx,1);
- }
- $displayObjectContainer.removeChild(c.$displayObject as DisplayObject);
- }
- COMPILE::JS
- {
- element.removeChild(c.element as HTMLElement);
- }
- }
-
- /**
- * @copy org.apache.flex.core.IParent#numElements
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get numElements():int
- {
- COMPILE::SWF
- {
- return _elements ? _elements.length : 0;
- }
- COMPILE::JS
- {
- var children:Array = internalChildren();
- return children.length;
- }
- }
-
- /**
- * The method called when added to a parent. This is a good
- * time to set up beads.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion Class
- * @flexjsignorecoercion Number
- */
- public function addedToParent():void
- {
- var c:Class;
-
- COMPILE::JS
- {
- if (style)
- ValuesManager.valuesImpl.applyStyles(this, style);
- }
-
- if (isNaN(_explicitWidth) && isNaN(_percentWidth))
- {
- var value:* = ValuesManager.valuesImpl.getValue(this,"width");
- if (value !== undefined)
- {
- if (value is String)
- {
- var s:String = String(value);
- if (s.indexOf("%") != -1)
- _percentWidth = Number(s.substring(0, s.length - 1));
- else
- {
- if (s.indexOf("px") != -1)
- s = s.substring(0, s.length - 2);
- _width = _explicitWidth = Number(s);
- }
- }
- else
- _width = _explicitWidth = value as Number;
- }
- }
-
- if (isNaN(_explicitHeight) && isNaN(_percentHeight))
- {
- value = ValuesManager.valuesImpl.getValue(this,"height");
- if (value !== undefined)
- {
- if (value is String)
- {
- s = String(value);
- if (s.indexOf("%") != -1)
- _percentHeight = Number(s.substring(0, s.length - 1));
- else
- {
- if (s.indexOf("px") != -1)
- s = s.substring(0, s.length - 2);
- _height = _explicitHeight = Number(s);
- }
- }
- else
- _height = _explicitHeight = value as Number;
- }
- }
-
- for each (var bead:IBead in beads)
- addBead(bead);
-
- if (getBeadByType(IBeadModel) == null)
- {
- c = ValuesManager.valuesImpl.getValue(this, "iBeadModel") as Class;
- if (c)
- {
- var model:IBeadModel = new c as IBeadModel;
- if (model)
- addBead(model);
- }
- }
- if (_view == null && getBeadByType(IBeadView) == null)
- {
- c = ValuesManager.valuesImpl.getValue(this, "iBeadView") as Class;
- if (c)
- {
- var view:IBeadView = new c as IBeadView;
- if (view)
- addBead(view);
- }
- }
- if (getBeadByType(IBeadController) == null)
- {
- c = ValuesManager.valuesImpl.getValue(this, "iBeadController") as Class;
- if (c)
- {
- var controller:IBeadController = new c as IBeadController;
- if (controller)
- addBead(controller);
- }
- }
- dispatchEvent(new Event("beadsAdded"));
- }
-
- /**
- * A measurement bead, if one exists.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get measurementBead() : IMeasurementBead
- {
- var measurementBead:IMeasurementBead = getBeadByType(IMeasurementBead) as IMeasurementBead;
- if( measurementBead == null ) {
- addBead(measurementBead = new (ValuesManager.valuesImpl.getValue(this, "iMeasurementBead")) as IMeasurementBead);
- }
-
- return measurementBead;
- }
-
- COMPILE::SWF
- private var _stageProxy:StageProxy;
-
- /**
- * @copy org.apache.flex.core.IUIBase#topMostEventDispatcher
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- * @flexjsignorecoercion org.apache.flex.events.IEventDispatcher
- */
- public function get topMostEventDispatcher():IEventDispatcher
- {
- COMPILE::SWF
- {
- if (!_stageProxy)
- {
- _stageProxy = new StageProxy($displayObject.stage);
- _stageProxy.addEventListener("removedFromStage", stageProxy_removedFromStageHandler);
- }
-
- return _stageProxy;
- }
- COMPILE::JS
- {
- var e:WrappedHTMLElement = document.body as WrappedHTMLElement;
- return e.flexjs_wrapper as IEventDispatcher;
- }
- }
-
- COMPILE::SWF
- private function stageProxy_removedFromStageHandler(event:Event):void
- {
- _stageProxy = null;
- }
-
- /**
- * Rebroadcast an event from a sub component from the component.
- */
- protected function repeaterListener(event:Event):void
- {
- dispatchEvent(event);
- }
-
- /**
- * @return The actual element to be parented.
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- protected function createElement():IFlexJSElement
- {
- COMPILE::SWF
- {
- element = new WrappedSprite();
- element.flexjs_wrapper = this;
- (element as InteractiveObject).doubleClickEnabled = true; // make JS and flash consistent
- return element;
- }
- COMPILE::JS
- {
- if (element == null)
- element = document.createElement('div') as WrappedHTMLElement;
- if (positioner == null)
- positioner = element;
- positioner.style.display = 'block';
- positioner.style.position = 'relative';
-
- element.flexjs_wrapper = this;
-
- return positioner;
- }
- }
-
- /**
- * The HTMLElement used to position the component.
- * @flexjsignorecoercion String
- */
- COMPILE::JS
- public function get alpha():Number
- {
- var stralpha:String = positioner.style.opacity as String;
- var alpha:Number = parseFloat(stralpha);
- return alpha;
- }
-
- COMPILE::JS
- public function set alpha(value:Number):void
- {
- positioner.style.opacity = value;
- }
-
- /**
- * @param value The event containing new style properties.
- */
- COMPILE::JS
- protected function styleChangeHandler(value:ValueChangeEvent):void
- {
- var newStyle:Object = {};
- newStyle[value.propertyName] = value.newValue;
- ValuesManager.valuesImpl.applyStyles(this, newStyle);
- };
-
- COMPILE::SWF
- public function get transformElement():IFlexJSElement
- {
- return element;
- }
-
- COMPILE::JS
- public function get transformElement():WrappedHTMLElement
- {
- return element;
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/975d3f34/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIButtonBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIButtonBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIButtonBase.as
deleted file mode 100644
index 85fc0fd..0000000
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIButtonBase.as
+++ /dev/null
@@ -1,792 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.core
-{
- import flash.display.DisplayObject;
- import flash.display.SimpleButton;
-
- import org.apache.flex.core.IBead;
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IMeasurementBead;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.IUIBase;
- import org.apache.flex.core.ValuesManager;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.EventDispatcher;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.events.utils.MouseEventConverter;
-
- //--------------------------------------
- // Events
- //--------------------------------------
-
- /**
- * Set a different class for click events so that
- * there aren't dependencies on the flash classes
- * on the JS side.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- [Event(name="click", type="org.apache.flex.events.MouseEvent")]
-
- /**
- * The UIHTMLElementWrapper class is the base class for most Buttons
- * and other UI objects in a FlexJS application that do not have children.
- * In Flash, these buttons extend SimpleButton and therefore
- * do not support all of the Sprite APIs.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- COMPILE::SWF
- public class UIButtonBase extends UIHTMLElementWrapper implements IStrandWithModel, IEventDispatcher, IUIBase, IStyleableObject, ILayoutChild
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function UIButtonBase()
- {
- // mouseChildren = true;
- // mouseEnabled = true;
- createElement();
- MouseEventConverter.setupInstanceConverters(this);
- }
-
- protected function createElement():IFlexJSElement
- {
- element = _button = new WrappedSimpleButton();
- _button.flexjs_wrapper = this;
- return element;
- }
- private var _button:WrappedSimpleButton;
-
- public function get $button():SimpleButton
- {
- return _button;
- }
-
- private var _x:Number;
-
- /**
- * @private
- */
- override public function set x(value:Number):void
- {
- if (_button.x != value) {
- _button.x = _x = value;
- if (!style)
- style = { left: value };
- else
- style.left = value;
- dispatchEvent(new Event("xChanged"));
- }
- }
-
- private var _y:Number;
-
- /**
- * @private
- */
- override public function set y(value:Number):void
- {
- if (_button.y != value) {
- _button.y = _y = value;
- if (!style)
- style = { top: value };
- else
- style.top = value;
- dispatchEvent(new Event("yChanged"));
- }
- }
-
- /**
- * Retrieve the low-level bounding box y.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- protected function get $y():Number
- {
- return _button.y;
- }
-
- private var _explicitWidth:Number;
-
- /**
- * The explicitly set width (as opposed to measured width
- * or percentage width).
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get explicitWidth():Number
- {
- if (isNaN(_explicitWidth))
- {
- var value:* = ValuesManager.valuesImpl.getValue(this, "width");
- if (value !== undefined) {
- _explicitWidth = Number(value);
- }
- }
-
- return _explicitWidth;
- }
-
- /**
- * @private
- */
- public function set explicitWidth(value:Number):void
- {
- if (_explicitWidth == value)
- return;
-
- // width can be pixel or percent not both
- if (!isNaN(value))
- _percentWidth = NaN;
-
- _explicitWidth = value;
-
- dispatchEvent(new Event("explicitWidthChanged"));
- }
-
- private var _explicitHeight:Number;
-
- /**
- * The explicitly set width (as opposed to measured width
- * or percentage width).
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get explicitHeight():Number
- {
- if (isNaN(_explicitHeight))
- {
- var value:* = ValuesManager.valuesImpl.getValue(this, "height");
- if (value !== undefined) {
- _explicitHeight = Number(value);
- }
- }
-
- return _explicitHeight;
- }
-
- /**
- * @private
- */
- public function set explicitHeight(value:Number):void
- {
- if (_explicitHeight == value)
- return;
-
- // height can be pixel or percent not both
- if (!isNaN(value))
- _percentHeight = NaN;
-
- _explicitHeight = value;
-
- dispatchEvent(new Event("explicitHeightChanged"));
- }
-
- private var _percentWidth:Number;
-
- /**
- * The requested percentage width this component
- * should have in the parent container. Note that
- * the actual percentage may be different if the
- * total is more than 100% or if there are other
- * components with explicitly set widths.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get percentWidth():Number
- {
- return _percentWidth;
- }
-
- /**
- * @private
- */
- public function set percentWidth(value:Number):void
- {
- if (_percentWidth == value)
- return;
-
- if (!isNaN(value))
- _explicitWidth = NaN;
-
- _percentWidth = value;
-
- dispatchEvent(new Event("percentWidthChanged"));
- }
-
- private var _percentHeight:Number;
-
- /**
- * The requested percentage height this component
- * should have in the parent container. Note that
- * the actual percentage may be different if the
- * total is more than 100% or if there are other
- * components with explicitly set heights.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get percentHeight():Number
- {
- return _percentHeight;
- }
-
- /**
- * @private
- */
- public function set percentHeight(value:Number):void
- {
- if (_percentHeight == value)
- return;
-
- if (!isNaN(value))
- _explicitHeight = NaN;
-
- _percentHeight = value;
-
- dispatchEvent(new Event("percentHeightChanged"));
- }
-
- private var _width:Number;
-
- [Bindable("widthChanged")]
- [PercentProxy("percentWidth")]
- /**
- * @copy org.apache.flex.core.UIBase#width
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function get width():Number
- {
- if (isNaN(explicitWidth))
- {
- var w:Number = _width;
- if (isNaN(w)) w = $width;
- return w;
- }
- else
- return explicitWidth;
- }
-
- /**
- * @private
- */
- override public function set width(value:Number):void
- {
- if (explicitWidth != value)
- {
- explicitWidth = value;
- }
-
- setWidth(value);
- }
-
- /**
- * Retrieve the low-level bounding box width.
- * Not implemented in JS.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get $width():Number
- {
- return _button.width;
- }
-
- private var _height:Number;
-
- [Bindable("heightChanged")]
- [PercentProxy("percentHeight")]
- /**
- * @copy org.apache.flex.core.UIBase#width
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function get height():Number
- {
- if (isNaN(explicitHeight))
- {
- var h:Number = _height;
- if (isNaN(h)) h = $height;
- return h;
- }
- else
- return explicitHeight;
- }
-
- /**
- * @private
- */
- override public function set height(value:Number):void
- {
- if (explicitHeight != value)
- {
- explicitHeight = value;
- }
-
- setHeight(value);
- }
-
- /**
- * Retrieve the low-level bounding box height.
- * Not implemented in JS.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get $height():Number
- {
- return _button.height;
- }
-
- /**
- * @copy org.apache.flex.core.IUIBase#setHeight
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function setHeight(value:Number, noEvent:Boolean = false):void
- {
- if (_height != value)
- {
- _height = value;
- if (!noEvent)
- dispatchEvent(new Event("heightChanged"));
- }
- }
-
- /**
- * @copy org.apache.flex.core.IUIBase#setWidth
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function setWidth(value:Number, noEvent:Boolean = false):void
- {
- if (_width != value)
- {
- _width = value;
- if (!noEvent)
- dispatchEvent(new Event("widthChanged"));
- }
- }
-
- /**
- * @copy org.apache.flex.core.IUIBase#setWidthAndHeight
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function setWidthAndHeight(newWidth:Number, newHeight:Number, noEvent:Boolean = false):void
- {
- if (_width != newWidth)
- {
- _width = newWidth;
- if (_height == newHeight)
- if (!noEvent)
- dispatchEvent(new Event("widthChanged"));
- }
- if (_height != newHeight)
- {
- _height = newHeight;
- if (!noEvent)
- dispatchEvent(new Event("heightChanged"));
- }
- dispatchEvent(new Event("sizeChanged"));
- }
-
- /**
- * @copy org.apache.flex.core.ILayoutChild#isWidthSizedToContent
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function isWidthSizedToContent():Boolean
- {
- return (isNaN(_explicitWidth) && isNaN(_percentWidth));
- }
-
- /**
- * @copy org.apache.flex.core.ILayoutChild#setX
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function setX(value:Number):void
- {
- _button.x = value;
- }
-
- /**
- * @copy org.apache.flex.core.ILayoutChild#setY
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function setY(value:Number):void
- {
- _button.y = value;
- }
-
- /**
- * @private
- */
- [Bindable("visibleChanged")]
- override public function set visible(value:Boolean):void
- {
- _button.visible = value;
- dispatchEvent(new Event(value?"show":"hide"));
- dispatchEvent(new Event("visibleChanged"));
- }
-
- override public function get visible():Boolean
- {
- return _button.visible;
- }
-
- /**
- * @copy org.apache.flex.core.ILayoutChild#isHeightSizedToContent
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function isHeightSizedToContent():Boolean
- {
- return (isNaN(_explicitHeight) && isNaN(_percentHeight));
- }
-
- private var _view:IBeadView;
-
- /**
- * An IBeadView that serves as the view for the component.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get view():IBeadView
- {
- if (_view == null)
- {
- var c:Class = ValuesManager.valuesImpl.getValue(this, "iBeadView") as Class;
- if (c)
- {
- _view = (new c()) as IBeadView;
- addBead(_view);
- }
- }
- return _view;
- }
-
- /**
- * @private
- */
- public function set view(value:IBeadView):void
- {
- if (_view != value)
- {
- addBead(value as IBead);
- dispatchEvent(new Event("viewChanged"));
- }
- }
-
- private var _id:String;
-
- /**
- * @copy org.apache.flex.core.UIBase#id
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get id():String
- {
- return _id;
- }
-
- /**
- * @private
- */
- public function set id(value:String):void
- {
- if (_id != value)
- {
- _id = value;
- dispatchEvent(new Event("idChanged"));
- }
- }
-
- private var _styles:Object;
-
- /**
- * The object that contains
- * "styles" and other associated
- * name-value pairs. You can
- * also specify a string in
- * HTML style attribute format.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get style():Object
- {
- return _styles;
- }
-
- /**
- * @private
- */
- public function set style(value:Object):void
- {
- if (value is String)
- _styles = ValuesManager.valuesImpl.parseStyles(value as String);
- else
- _styles = value;
- if (!isNaN(_y))
- _styles.top = _y;
- if (!isNaN(_x))
- _styles.left = _x;
- dispatchEvent(new Event("stylesChanged"));
- }
-
- /**
- * The styles for this object formatted
- * as an HTML style attribute. While this
- * may be a convenient and less verbose
- * way of specifying styles than using
- * the style object, you run the risk of
- * having a typo.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set styleString(value:String):void
- {
- _styles = JSON.parse("{" + value + "}");
- }
-
- /**
- * A list of type names. Often used for CSS
- * type selector lookups.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public var typeNames:String;
-
- private var _className:String;
-
- /**
- * @copy org.apache.flex.core.UIBase#className
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get className():String
- {
- return _className;
- }
-
- /**
- * @private
- */
- public function set className(value:String):void
- {
- if (_className != value)
- {
- _className = value;
- dispatchEvent(new Event("classNameChanged"));
- }
- }
-
- /**
- * @copy org.apache.flex.core.UIBase#beads
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public var beads:Array;
-
- private var strand:Vector.<IBead>;
-
- /**
- * @copy org.apache.flex.core.UIBase#addBead()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function addBead(bead:IBead):void
- {
- super.addBead(bead);
- if (bead is IBeadView)
- _view = bead as IBeadView;
- bead.strand = this;
- }
-
- /**
- * @copy org.apache.flex.core.UIBase#addToParent()
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function addedToParent():void
- {
- var c:Class;
-
- for each (var bead:IBead in beads)
- addBead(bead);
-
- if (getBeadByType(IBeadModel) == null)
- {
- c = ValuesManager.valuesImpl.getValue(this, "iBeadModel") as Class;
- if (c)
- {
- var model:IBeadModel = new c as IBeadModel;
- if (model)
- addBead(model);
- }
- }
- if (getBeadByType(IBeadView) == null)
- {
- c = ValuesManager.valuesImpl.getValue(this, "iBeadView") as Class;
- if (c)
- {
- var view:IBeadView = new c as IBeadView;
- if (view)
- addBead(view);
- }
- }
- if (getBeadByType(IBeadController) == null)
- {
- c = ValuesManager.valuesImpl.getValue(this, "iBeadController") as Class;
- if (c)
- {
- var controller:IBeadController = new c as IBeadController;
- if (controller)
- addBead(controller);
- }
- }
-
- dispatchEvent(new Event("beadsAdded"));
-
- }
-
- /**
- * @copy org.apache.flex.core.UIBase#measurementBead
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get measurementBead() : IMeasurementBead
- {
- var measurementBead:IMeasurementBead = getBeadByType(IMeasurementBead) as IMeasurementBead;
- if( measurementBead == null ) {
- addBead(measurementBead = new (ValuesManager.valuesImpl.getValue(this, "iMeasurementBead")) as IMeasurementBead);
- }
-
- return measurementBead;
- }
-
- /**
- * @copy org.apache.flex.core.IUIBase#topMostEventDispatcher
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get topMostEventDispatcher():IEventDispatcher
- {
- if (!parent)
- return null;
- return IUIBase(parent).topMostEventDispatcher;
- }
-
-
- }
-}
[19/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - fix
BasicClasses
Posted by ah...@apache.org.
fix BasicClasses
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/6683f9b9
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/6683f9b9
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/6683f9b9
Branch: refs/heads/refactor-sprite
Commit: 6683f9b960ebf9603678fe83c76296be15468ea4
Parents: d3b40de
Author: Alex Harui <ah...@apache.org>
Authored: Wed Oct 26 14:19:53 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:46:51 2016 -0700
----------------------------------------------------------------------
frameworks/projects/Basic/src/main/flex/BasicClasses.as | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6683f9b9/frameworks/projects/Basic/src/main/flex/BasicClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/BasicClasses.as b/frameworks/projects/Basic/src/main/flex/BasicClasses.as
index 1271417..527d182 100644
--- a/frameworks/projects/Basic/src/main/flex/BasicClasses.as
+++ b/frameworks/projects/Basic/src/main/flex/BasicClasses.as
@@ -25,7 +25,7 @@ package
* beyond those that are found by dependecy analysis starting
* from the classes specified in manifest.xml.
*/
-internal class HTMLClasses
+internal class BasicClasses
{
import org.apache.flex.html.ToolTip; ToolTip;
[08/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - try to
copy HTML to Basic without losing history
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/BasicLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/BasicLayout.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/BasicLayout.as
new file mode 100644
index 0000000..b566354
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/BasicLayout.as
@@ -0,0 +1,445 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.layouts
+{
+
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.ILayoutChild;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.utils.CSSUtils;
+ //import org.apache.flex.utils.dbg.DOMPathUtil;
+
+ /**
+ * The BasicLayout class is a simple layout
+ * bead. It takes the set of children and lays them out
+ * as specified by CSS properties like left, right, top
+ * and bottom.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class BasicLayout implements IBeadLayout
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function BasicLayout()
+ {
+ }
+
+ // the strand/host container is also an ILayoutChild because
+ // can have its size dictated by the host's parent which is
+ // important to know for layout optimization
+ private var host:ILayoutChild;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ host = value as ILayoutChild;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBeadLayout#layout
+ * @flexjsignorecoercion org.apache.flex.core.ILayoutHost
+ * @flexjsignorecoercion org.apache.flex.core.UIBase
+ */
+ public function layout():Boolean
+ {
+ COMPILE::SWF
+ {
+ //trace(DOMPathUtil.getPath(host), event ? event.type : "fixed size");
+ var layoutParent:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParentIUIBase = layoutParent ? layoutParent.contentView : IParentIUIBase(host);
+
+ var gotMargin:Boolean;
+ var marginLeft:Object;
+ var marginRight:Object;
+ var marginTop:Object;
+ var marginBottom:Object;
+ var margin:Object;
+ var ml:Number;
+ var mr:Number;
+ var mt:Number;
+ var mb:Number;
+ var hostWidthSizedToContent:Boolean = host.isWidthSizedToContent();
+ var hostHeightSizedToContent:Boolean = host.isHeightSizedToContent();
+ var w:Number = hostWidthSizedToContent ? 0 : contentView.width;
+ var h:Number = hostHeightSizedToContent ? 0 : contentView.height;
+ var n:int = contentView.numElements;
+ var maxWidth:Number = 0;
+ var maxHeight:Number = 0;
+ var childData:Array = [];
+ for (var i:int = 0; i < n; i++)
+ {
+ var child:IUIBase = contentView.getElementAt(i) as IUIBase;
+ var left:Number = ValuesManager.valuesImpl.getValue(child, "left");
+ var right:Number = ValuesManager.valuesImpl.getValue(child, "right");
+ var top:Number = ValuesManager.valuesImpl.getValue(child, "top");
+ var bottom:Number = ValuesManager.valuesImpl.getValue(child, "bottom");
+ var ww:Number = w;
+ var hh:Number = h;
+
+ var ilc:ILayoutChild = child as ILayoutChild;
+ if (!isNaN(left))
+ {
+ if (ilc)
+ ilc.setX(left);
+ else
+ child.x = left;
+ ww -= left;
+ }
+ if (!isNaN(top))
+ {
+ if (ilc)
+ ilc.setY(top);
+ else
+ child.y = top;
+ hh -= top;
+ }
+ if (ilc)
+ {
+ if (!hostWidthSizedToContent)
+ {
+ if (!isNaN(ilc.percentWidth))
+ ilc.setWidth((ww - (isNaN(right) ? 0 : right)) * ilc.percentWidth / 100, true);
+ }
+ else
+ childData[i] = { bottom: bottom, right: right, ww: ww, ilc: ilc, child: child };
+ }
+ if (!isNaN(right))
+ {
+ if (!hostWidthSizedToContent)
+ {
+ if (!isNaN(left))
+ {
+ if (ilc)
+ ilc.setWidth(ww - right, true);
+ else
+ child.width = ww - right;
+ }
+ else
+ {
+ if (ilc)
+ ilc.setX( w - right - child.width);
+ else
+ child.x = w - right - child.width;
+ }
+ }
+ else
+ childData[i] = { ww: ww, left: left, right: right, ilc: ilc, child: child };
+ }
+
+ if (isNaN(right) && isNaN(left))
+ {
+ margin = ValuesManager.valuesImpl.getValue(child, "margin");
+ gotMargin = true;
+ marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left");
+ marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right");
+ var horizontalCenter:Boolean =
+ (marginLeft == "auto" && marginRight == "auto") ||
+ (margin is String && margin == "auto") ||
+ (margin is Array &&
+ ((margin.length < 4 && margin[1] == "auto") ||
+ (margin.length == 4 && margin[1] == "auto" && margin[3] == "auto")));
+ if (!hostWidthSizedToContent)
+ {
+ if (!horizontalCenter)
+ {
+ mr = CSSUtils.getRightValue(marginRight, margin, ww);
+ ml = CSSUtils.getLeftValue(marginLeft, margin, ww);
+ if (ilc)
+ ilc.setX(ml);
+ else
+ child.x = ml;
+ if (ilc && isNaN(ilc.percentWidth) && isNaN(ilc.explicitWidth))
+ child.width = ww - child.x - mr;
+ }
+ else
+ {
+ if (ilc)
+ ilc.setX((ww - child.width) / 2);
+ else
+ child.x = (ww - child.width) / 2;
+ }
+ }
+ else
+ {
+ if (!horizontalCenter)
+ {
+ mr = CSSUtils.getRightValue(marginRight, margin, ww);
+ ml = CSSUtils.getLeftValue(marginLeft, margin, ww);
+ if (ilc)
+ ilc.setX(ml);
+ else
+ child.x = ml;
+ if (ilc && isNaN(ilc.percentWidth) && isNaN(ilc.explicitWidth))
+ childData[i] = { ww: ww, left: ml, right: mr, ilc: ilc, child: child };
+ }
+ else
+ {
+ childData[i] = { ww: ww, center: true, ilc: ilc, child: child };
+ }
+ }
+
+ }
+ if (isNaN(top) && isNaN(bottom))
+ {
+ if (!gotMargin)
+ margin = ValuesManager.valuesImpl.getValue(child, "margin");
+ marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top");
+ marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom");
+ mt = CSSUtils.getTopValue(marginTop, margin, hh);
+ mb = CSSUtils.getBottomValue(marginBottom, margin, hh);
+ if (ilc)
+ ilc.setY(mt);
+ else
+ child.y = mt;
+ /* browsers don't use margin-bottom to stretch things vertically
+ if (!hostHeightSizedToContent)
+ {
+ if (ilc && isNaN(ilc.percentHeight) && isNaN(ilc.explicitHeight))
+ child.height = hh - child.y - mb;
+ }
+ else
+ {
+ if (!childData[i])
+ childData[i] = { hh: hh, bottom: mb, ilc: ilc, child: child };
+ else
+ {
+ childData[i].hh = hh;
+ childData[i].bottom = mb;
+ }
+ }
+ */
+ }
+
+ if (ilc)
+ {
+ if (!hostHeightSizedToContent)
+ {
+ if (!isNaN(ilc.percentHeight))
+ ilc.setHeight((hh - (isNaN(bottom) ? 0 : bottom)) * ilc.percentHeight / 100, true);
+ }
+ else
+ {
+ if (!childData[i])
+ childData[i] = { hh: hh, bottom: bottom, ilc: ilc, child: child };
+ else
+ {
+ childData[i].hh = hh;
+ childData[i].bottom = bottom;
+ }
+ }
+ }
+ if (!isNaN(bottom))
+ {
+ if (!hostHeightSizedToContent)
+ {
+ if (!isNaN(top))
+ {
+ if (ilc)
+ ilc.setHeight(hh - bottom, true);
+ else
+ child.height = hh - bottom;
+ }
+ else
+ {
+ if (ilc)
+ ilc.setY(h - bottom - child.height);
+ else
+ child.y = h - bottom - child.height;
+ }
+ }
+ else
+ {
+ if (!childData[i])
+ childData[i] = { top: top, bottom: bottom, hh:hh, ilc: ilc, child: child };
+ else
+ {
+ childData[i].top = top;
+ childData[i].bottom = bottom;
+ childData[i].hh = hh;
+ }
+ }
+ }
+ if (!childData[i])
+ child.dispatchEvent(new Event("sizeChanged"));
+ maxWidth = Math.max(maxWidth, child.x + child.width);
+ maxHeight = Math.max(maxHeight, child.y + child.height);
+ }
+ if (hostHeightSizedToContent || hostWidthSizedToContent)
+ {
+ for (i = 0; i < n; i++)
+ {
+ var data:Object = childData[i];
+ if (data)
+ {
+ if (hostWidthSizedToContent)
+ {
+ if (data.ilc && !isNaN(data.ilc.percentWidth))
+ data.ilc.setWidth((data.ww - (isNaN(data.right) ? 0 : data.right)) * data.ilc.percentWidth / 100, true);
+ if (data.center)
+ {
+ if (data.ilc)
+ data.ilc.setX((data.ww - data.child.width) / 2);
+ else
+ data.child.x = (data.ww - data.child.width) / 2;
+ }
+ else if (!isNaN(data.right))
+ {
+ if (!isNaN(data.left))
+ {
+ if (data.ilc)
+ data.ilc.setWidth(data.ww - data.right, true);
+ else
+ data.child.width = data.ww - data.right;
+ }
+ else
+ {
+ if (data.ilc)
+ data.ilc.setX(maxWidth - data.right - data.child.width);
+ else
+ data.child.x = maxWidth - data.right - data.child.width;
+ }
+ }
+ }
+ if (hostHeightSizedToContent)
+ {
+ if (data.ilc && !isNaN(data.ilc.percentHeight))
+ data.ilc.setHeight((data.hh - (isNaN(data.bottom) ? 0 : data.bottom)) * data.ilc.percentHeight / 100, true);
+ if (!isNaN(data.bottom))
+ {
+ if (!isNaN(data.top))
+ {
+ if (data.ilc)
+ data.ilc.setHeight(data.hh - data.bottom, true);
+ else
+ data.child.height = data.hh - data.bottom;
+ }
+ else
+ {
+ if (data.ilc)
+ data.ilc.setY(maxHeight - data.bottom - data.child.height);
+ else
+ data.child.y = maxHeight - data.bottom - data.child.height;
+ }
+ }
+ }
+ child.dispatchEvent(new Event("sizeChanged"));
+ }
+ }
+ }
+
+ host.dispatchEvent( new Event("layoutComplete") );
+
+ return true;
+
+ }
+ COMPILE::JS
+ {
+ var i:int
+ var n:int;
+ var h:Number;
+ var w:Number;
+
+ var viewBead:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParentIUIBase = viewBead.contentView;
+ w = contentView.width;
+ var hasWidth:Boolean = !host.isWidthSizedToContent();
+ h = contentView.height;
+ var hasHeight:Boolean = !host.isHeightSizedToContent();
+ var maxHeight:Number = 0;
+ var maxWidth:Number = 0;
+ n = contentView.numElements;
+ for (i = 0; i < n; i++) {
+ var child:UIBase = contentView.getElementAt(i) as UIBase;
+ child.setDisplayStyleForLayout('block');
+ var left:Number = org.apache.flex.core.ValuesManager.valuesImpl.getValue(child, 'left');
+ var right:Number = org.apache.flex.core.ValuesManager.valuesImpl.getValue(child, 'right');
+ var top:Number = org.apache.flex.core.ValuesManager.valuesImpl.getValue(child, 'top');
+ var bottom:Number = org.apache.flex.core.ValuesManager.valuesImpl.getValue(child, 'bottom');
+ var margin:String = org.apache.flex.core.ValuesManager.valuesImpl.getValue(child, 'margin');
+ var marginLeft:String = org.apache.flex.core.ValuesManager.valuesImpl.getValue(child, 'margin-left');
+ var marginRight:String = org.apache.flex.core.ValuesManager.valuesImpl.getValue(child, 'margin-right');
+ var horizontalCenter:Boolean =
+ (marginLeft == 'auto' && marginRight == 'auto') ||
+ (typeof(margin) === 'string' && margin == 'auto') ||
+ (margin && margin.hasOwnProperty('length') &&
+ ((margin.length < 4 && margin[1] == 'auto') ||
+ (margin.length == 4 && margin[1] == 'auto' && margin[3] == 'auto')));
+
+ if (!isNaN(left)) {
+ child.positioner.style.position = 'absolute';
+ child.positioner.style.left = left.toString() + 'px';
+ }
+ if (!isNaN(top)) {
+ child.positioner.style.position = 'absolute';
+ child.positioner.style.top = top.toString() + 'px';
+ }
+ if (!isNaN(right)) {
+ child.positioner.style.position = 'absolute';
+ child.positioner.style.right = right.toString() + 'px';
+ }
+ if (!isNaN(bottom)) {
+ child.positioner.style.position = 'absolute';
+ child.positioner.style.bottom = bottom.toString() + 'px';
+ }
+ if (horizontalCenter)
+ {
+ child.positioner.style.position = 'absolute';
+ child.positioner.style.left = ((w - child.width) / 2).toString() + 'px';
+ }
+ child.dispatchEvent('sizeChanged');
+ maxWidth = Math.max(maxWidth, child.positioner.offsetLeft + child.positioner.offsetWidth);
+ maxHeight = Math.max(maxHeight, child.positioner.offsetTop + child.positioner.offsetHeight);
+ }
+ // if there are children and maxHeight is ok, use it.
+ // maxHeight can be NaN if the child hasn't been rendered yet.
+ if (!hasWidth && n > 0 && !isNaN(maxWidth)) {
+ contentView.width = maxWidth;
+ }
+ if (!hasHeight && n > 0 && !isNaN(maxHeight)) {
+ contentView.height = maxHeight;
+ }
+ return true;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/ButtonBarLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/ButtonBarLayout.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/ButtonBarLayout.as
new file mode 100644
index 0000000..5bd1159
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/ButtonBarLayout.as
@@ -0,0 +1,143 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.layouts
+{
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IItemRendererClassFactory;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.ISelectableItemRenderer;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.IViewportModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.List;
+ import org.apache.flex.html.beads.ButtonBarView;
+
+ /**
+ * The ButtonBarLayout class bead sizes and positions the org.apache.flex.html.Button
+ * elements that make up a org.apache.flex.html.ButtonBar. This bead arranges the Buttons
+ * horizontally and makes them all the same width unless the buttonWidths property has been set in which case
+ * the values stored in that array are used.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ButtonBarLayout implements IBeadLayout
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ButtonBarLayout()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _buttonWidths:Array = null;
+
+ /**
+ * An array of widths (Number), one per button. These values supersede the
+ * default of equally-sized buttons.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get buttonWidths():Array
+ {
+ return _buttonWidths;
+ }
+ public function set buttonWidths(value:Array):void
+ {
+ _buttonWidths = value;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBeadLayout#layout
+ */
+ public function layout():Boolean
+ {
+ var layoutParent:ILayoutHost = _strand.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase;
+ var itemRendererParent:IItemRendererParent = contentView as IItemRendererParent;
+ var viewportModel:IViewportModel = (layoutParent as ButtonBarView).viewportModel;
+
+ var n:int = contentView.numElements;
+ var realN:int = n;
+
+ for (var j:int=0; j < n; j++)
+ {
+ var child:IUIBase = itemRendererParent.getElementAt(j) as IUIBase;
+ if (child == null || !child.visible) realN--;
+ }
+
+ var xpos:Number = 0;
+ var useWidth:Number = contentView.width / realN;
+ var useHeight:Number = contentView.height;
+
+ for (var i:int=0; i < n; i++)
+ {
+ var ir:ISelectableItemRenderer = itemRendererParent.getElementAt(i) as ISelectableItemRenderer;
+ if (ir == null || !UIBase(ir).visible) continue;
+ UIBase(ir).y = 0;
+ UIBase(ir).x = xpos;
+ if (!isNaN(useHeight) && useHeight > 0) {
+ UIBase(ir).height = useHeight;
+ }
+
+ if (buttonWidths) UIBase(ir).width = Number(buttonWidths[i]);
+ else if (!isNaN(useWidth) && useWidth > 0) {
+ UIBase(ir).width = useWidth;
+ }
+ xpos += UIBase(ir).width;
+ }
+
+ IEventDispatcher(_strand).dispatchEvent( new Event("layoutComplete") );
+
+ return true;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridLayout.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridLayout.as
new file mode 100644
index 0000000..1d22956
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridLayout.as
@@ -0,0 +1,208 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.layouts
+{
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IDataGridModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.ButtonBar;
+ import org.apache.flex.html.beads.DataGridView;
+ import org.apache.flex.html.beads.layouts.BasicLayout;
+ import org.apache.flex.html.supportClasses.DataGridColumnList;
+ import org.apache.flex.html.supportClasses.DataGridColumn;
+
+ /**
+ * DataGridLayout is a class that handles the size and positioning of the
+ * elements of a DataGrid. This includes the ButtonBar used for the column
+ * headers and the Lists that are the columns.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataGridLayout implements IDataGridLayout
+ {
+ /**
+ * constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGridLayout()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ var host:UIBase = _strand as UIBase;
+ host.addEventListener("widthChanged", handleSizeChanges);
+ host.addEventListener("heightChanged", handleSizeChanges);
+ host.addEventListener("sizeChanged", handleSizeChanges);
+ host.addEventListener("layoutNeeded", handleSizeChanges);
+
+ var view:DataGridView = host.view as DataGridView;
+ header = view.header;
+ listArea = view.listArea;
+ listArea.addBead(new BasicLayout());
+ }
+
+ private var _header:UIBase;
+
+ /**
+ * The element that is the header for the DataGrid
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get header():IUIBase
+ {
+ return _header;
+ }
+ public function set header(value:IUIBase):void
+ {
+ _header = UIBase(value);
+ }
+
+ private var _columns:Array;
+
+ /**
+ * The array of column elements.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get columns():Array
+ {
+ return _columns;
+ }
+ public function set columns(value:Array):void
+ {
+ _columns = value;
+ }
+
+ private var _listArea:IUIBase;
+
+ public function get listArea():IUIBase
+ {
+ return _listArea;
+ }
+ public function set listArea(value:IUIBase):void
+ {
+ _listArea = value;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBeadLayout#layout
+ */
+ public function layout():Boolean
+ {
+ if (columns == null || columns.length == 0) {
+ return false;
+ }
+ var host:UIBase = _strand as UIBase;
+
+ var useWidth:Number = host.width;
+ var useHeight:Number = host.height;
+
+ if (host.height > 0) {
+ useHeight = host.height - _header.height;
+ }
+
+ var thisisnothing:Number = -1234;
+
+ _listArea.x = 0;
+ _listArea.y = 26;
+ _listArea.width = useWidth;
+ _listArea.height = useHeight;
+
+ var sharedModel:IDataGridModel = host.model as IDataGridModel;
+ var buttonWidths:Array = [];
+
+ if (_columns != null && _columns.length > 0) {
+ var xpos:Number = 0;
+ var listWidth:Number = host.width / _columns.length;
+ for (var i:int=0; i < _columns.length; i++) {
+ var list:DataGridColumnList = _columns[i] as DataGridColumnList;
+ list.x = xpos;
+ list.y = 0;
+
+ var dataGridColumn:DataGridColumn = sharedModel.columns[i] as DataGridColumn;
+ var colWidth:Number = dataGridColumn.columnWidth;
+ if (!isNaN(colWidth)) list.width = colWidth;
+ else list.width = listWidth;
+
+ xpos += list.width;
+
+ buttonWidths.push(list.width);
+ }
+ }
+
+ var bar:ButtonBar = header as ButtonBar;
+ var barLayout:ButtonBarLayout = bar.getBeadByType(ButtonBarLayout) as ButtonBarLayout;
+ barLayout.buttonWidths = buttonWidths;
+ bar.dispatchEvent(new Event("layoutNeeded"));
+
+ _header.x = 0;
+ _header.y = 0;
+ _header.width = useWidth;
+ _header.height = 25;
+ _header.dispatchEvent(new Event("layoutNeeded"));
+
+ return true;
+ }
+
+ /**
+ * @private
+ */
+ private function handleSizeChanges(event:Event):void
+ {
+ var view:DataGridView = UIBase(_strand).view as DataGridView;
+ if (view == null) return;
+
+ columns = view.columnLists;
+
+ layout();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridPercentageLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridPercentageLayout.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridPercentageLayout.as
new file mode 100644
index 0000000..7459a24
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridPercentageLayout.as
@@ -0,0 +1,224 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.layouts
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IDataGridModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.ButtonBar;
+ import org.apache.flex.html.beads.DataGridView;
+ import org.apache.flex.html.beads.layouts.HorizontalLayout;
+ import org.apache.flex.html.supportClasses.DataGridColumn;
+
+ /**
+ * DataGridPercentageLayout is a class that handles the size and positioning of the
+ * elements of a DataGrid. This includes the ButtonBar used for the column
+ * headers and the Lists that are the columns. The columns are sized on their
+ * percentage of the width of the DataGrid space.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataGridPercentageLayout implements IDataGridLayout
+ {
+ /**
+ * constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGridPercentageLayout()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ var host:UIBase = value as UIBase;
+
+ var view:DataGridView = host.view as DataGridView;
+
+ header = view.header;
+ listArea = view.listArea;
+
+ var anylayout:IBead = listArea.getBeadByType(IBeadLayout);
+ if (anylayout != null) {
+ listArea.removeBead(anylayout);
+ }
+ listArea.addBead(new HorizontalLayout());
+
+ host.addEventListener("widthChanged", handleSizeChanges);
+ host.addEventListener("heightChanged", handleSizeChanges);
+ host.addEventListener("sizeChanged", handleSizeChanges);
+ host.addEventListener("layoutNeeded", handleSizeChanges);
+ }
+
+ private var _header:UIBase;
+
+ /**
+ * The element that is the header for the DataGrid
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get header():IUIBase
+ {
+ return _header;
+ }
+ public function set header(value:IUIBase):void
+ {
+ _header = UIBase(value);
+ }
+
+ private var _columns:Array;
+
+ /**
+ * The array of column elements.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get columns():Array
+ {
+ return _columns;
+ }
+ public function set columns(value:Array):void
+ {
+ _columns = value;
+ }
+
+ private var _listArea:IUIBase;
+
+ public function get listArea():IUIBase
+ {
+ return _listArea;
+ }
+ public function set listArea(value:IUIBase):void
+ {
+ _listArea = value;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBeadLayout#layout
+ */
+ public function layout():Boolean
+ {
+ if (columns == null || columns.length == 0) {
+ return false;
+ }
+
+ var host:UIBase = _strand as UIBase;
+
+ var sw:Number = host.width;
+ var sh:Number = host.height;
+
+ var columnHeight:Number = Math.floor(sh - header.height);
+ var columnWidth:Number = Math.floor(sw / columns.length);
+
+ var xpos:Number = 0;
+ var ypos:Number = 26;
+
+ _header.x = 0;
+ _header.y = 0;
+ _header.width = sw;
+ _header.height = 25;
+
+ if (sh > 0) {
+ sh = sh - _header.height;
+ }
+
+ // TODO: change the layout so that the model's DataGridColumn.columnWidth
+ // isn't used blindly, but is considered in the overall width. In other words,
+ // right now the width could exceed the strand's width.
+ var model:IDataGridModel = host.model as IDataGridModel;
+
+ var buttonWidths:Array = new Array();
+
+ for(var i:int=0; i < columns.length; i++) {
+ var column:UIBase = columns[i] as UIBase;
+ column.percentHeight = 100;
+
+ var dgc:DataGridColumn = model.columns[i];
+ if (!isNaN(dgc.columnWidth)) {
+ column.percentWidth = dgc.columnWidth;
+ columnWidth = sw * (dgc.columnWidth/100.0);
+ }
+ else column.explicitWidth = columnWidth;
+
+ buttonWidths.push(columnWidth);
+ }
+
+ _listArea.x = 0;
+ _listArea.y = 26;
+ _listArea.width = sw;
+ _listArea.height = sh;
+ _listArea.dispatchEvent(new Event("layoutNeeded"));
+
+ var bar:ButtonBar = header as ButtonBar;
+ var barLayout:ButtonBarLayout = bar.getBeadByType(ButtonBarLayout) as ButtonBarLayout;
+ barLayout.buttonWidths = buttonWidths;
+
+ _header.x = 0;
+ _header.y = 0;
+ _header.width = sw;
+ _header.height = 25;
+ _header.dispatchEvent(new Event("layoutNeeded"));
+
+ return true;
+ }
+
+ /**
+ * @private
+ */
+ private function handleSizeChanges(event:Event):void
+ {
+ var view:DataGridView = UIBase(_strand).view as DataGridView;
+ if (view == null) return;
+
+ columns = view.columnLists;
+
+ layout();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as
new file mode 100644
index 0000000..4198fea
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/FlexibleFirstChildHorizontalLayout.as
@@ -0,0 +1,244 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.layouts
+{
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.ILayoutChild;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.IViewport;
+ import org.apache.flex.core.IViewportModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.html.supportClasses.Viewport;
+ import org.apache.flex.utils.CSSContainerUtils;
+
+ /**
+ * The FlexibleFirstChildHorizontalLayout class is a simple layout
+ * bead. It takes the set of children and lays them out
+ * horizontally in one row, separating them according to
+ * CSS layout rules for margin and padding styles. But it
+ * will size the first child to take up as much or little
+ * room as possible.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class FlexibleFirstChildHorizontalLayout implements IBeadLayout
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function FlexibleFirstChildHorizontalLayout()
+ {
+ }
+
+ // the strand/host container is also an ILayoutChild because
+ // can have its size dictated by the host's parent which is
+ // important to know for layout optimization
+ private var host:ILayoutChild;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ host = value as ILayoutChild;
+ }
+
+ private var _maxWidth:Number;
+
+ /**
+ * @copy org.apache.flex.core.IBead#maxWidth
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get maxWidth():Number
+ {
+ return _maxWidth;
+ }
+
+ /**
+ * @private
+ */
+ public function set maxWidth(value:Number):void
+ {
+ _maxWidth = value;
+ }
+
+ private var _maxHeight:Number;
+
+ /**
+ * @copy org.apache.flex.core.IBead#maxHeight
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get maxHeight():Number
+ {
+ return _maxHeight;
+ }
+
+ /**
+ * @private
+ */
+ public function set maxHeight(value:Number):void
+ {
+ _maxHeight = value;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBeadLayout#layout
+ */
+ public function layout():Boolean
+ {
+ var layoutParent:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase;
+ var padding:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
+ var hostSizedToContent:Boolean = host.isHeightSizedToContent();
+
+ var n:int = contentView.numElements;
+ var marginLeft:Object;
+ var marginRight:Object;
+ var marginTop:Object;
+ var marginBottom:Object;
+ var margin:Object;
+ maxHeight = 0;
+ var verticalMargins:Array = [];
+
+ var xx:Number = contentView.width;
+ if (isNaN(xx) || xx <= 0)
+ return true;
+ xx -= padding.right + 1; // some browsers won't layout to the edge
+
+ for (var i:int = n - 1; i >= 0; i--)
+ {
+ var child:IUIBase = contentView.getElementAt(i) as IUIBase;
+ margin = ValuesManager.valuesImpl.getValue(child, "margin");
+ if (margin is Array)
+ {
+ if (margin.length == 1)
+ marginLeft = marginTop = marginRight = marginBottom = margin[0];
+ else if (margin.length <= 3)
+ {
+ marginLeft = marginRight = margin[1];
+ marginTop = marginBottom = margin[0];
+ }
+ else if (margin.length == 4)
+ {
+ marginLeft = margin[3];
+ marginBottom = margin[2];
+ marginRight = margin[1];
+ marginTop = margin[0];
+ }
+ }
+ else if (margin == null)
+ {
+ marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left");
+ marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top");
+ marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right");
+ marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom");
+ }
+ else
+ {
+ marginLeft = marginTop = marginBottom = marginRight = margin;
+ }
+ var ml:Number;
+ var mr:Number;
+ var mt:Number;
+ var mb:Number;
+ var lastmr:Number;
+ mt = Number(marginTop);
+ if (isNaN(mt))
+ mt = 0;
+ mb = Number(marginBottom);
+ if (isNaN(mb))
+ mb = 0;
+ if (marginLeft == "auto")
+ ml = 0;
+ else
+ {
+ ml = Number(marginLeft);
+ if (isNaN(ml))
+ ml = 0;
+ }
+ if (marginRight == "auto")
+ mr = 0;
+ else
+ {
+ mr = Number(marginRight);
+ if (isNaN(mr))
+ mr = 0;
+ }
+ child.y = mt + padding.top;
+ if (i == 0)
+ {
+ child.x = ml + padding.left;
+ child.width = xx - mr - child.x;
+ }
+ else
+ child.x = xx - child.width - mr;
+ maxHeight = Math.max(maxHeight, mt + child.height + mb);
+ xx -= child.width + mr + ml;
+ lastmr = mr;
+ var valign:Object = ValuesManager.valuesImpl.getValue(child, "vertical-align");
+ verticalMargins.push({ marginTop: mt, marginBottom: mb, valign: valign });
+ }
+ for (i = 0; i < n; i++)
+ {
+ var obj:Object = verticalMargins[0]
+ child = contentView.getElementAt(i) as IUIBase;
+ if (obj.valign == "middle")
+ child.y = (maxHeight - child.height) / 2;
+ else if (valign == "bottom")
+ child.y = maxHeight - child.height - obj.marginBottom;
+ else
+ child.y = obj.marginTop;
+ }
+ if (hostSizedToContent)
+ ILayoutChild(contentView).setHeight(maxHeight + padding.top + padding.bottom, true);
+
+ return true;
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HScrollBarLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HScrollBarLayout.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HScrollBarLayout.as
new file mode 100644
index 0000000..38b97ec
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HScrollBarLayout.as
@@ -0,0 +1,121 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.layouts
+{
+ import flash.display.DisplayObject;
+
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IScrollBarModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.html.beads.IScrollBarView;
+ import org.apache.flex.utils.CSSContainerUtils;
+
+ /**
+ * The HScrollBarLayout class is a layout
+ * bead that displays lays out the pieces of a
+ * horizontal ScrollBar like the thumb, track
+ * and arrow buttons.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class HScrollBarLayout implements IBeadLayout
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function HScrollBarLayout()
+ {
+ }
+
+ private var sbModel:IScrollBarModel;
+ private var sbView:IScrollBarView;
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ sbView = _strand.getBeadByType(IScrollBarView) as IScrollBarView;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBeadLayout#layout
+ */
+ public function layout():Boolean
+ {
+ if (!sbModel)
+ sbModel = _strand.getBeadByType(IScrollBarModel) as IScrollBarModel
+
+ var metrics:Rectangle = CSSContainerUtils.getBorderAndPaddingMetrics(_strand);
+
+ var w:Number = DisplayObject(_strand).width + metrics.left + metrics.right;
+ var increment:DisplayObject = sbView.increment;
+ var decrement:DisplayObject = sbView.decrement;
+ var track:DisplayObject = sbView.track;
+ var thumb:DisplayObject = sbView.thumb;
+
+ decrement.x = 0;
+ decrement.y = 0;
+ decrement.height = DisplayObject(_strand).height;
+ decrement.width = DisplayObject(_strand).height;
+
+ increment.height = DisplayObject(_strand).height;
+ increment.width = DisplayObject(_strand).height;
+ increment.x = w - increment.width - 1;
+ increment.y = 0;
+
+ track.x = decrement.width;
+ track.y = 0;
+ track.height = DisplayObject(_strand).height;
+ track.width = increment.x - decrement.width;
+ thumb.width = sbModel.pageSize / (sbModel.maximum - sbModel.minimum) * track.width;
+ if (track.width > thumb.width)
+ {
+ thumb.visible = true;
+ thumb.x = (sbModel.value / (sbModel.maximum - sbModel.minimum - sbModel.pageSize) * (track.width - thumb.width)) + track.x;
+ }
+ else
+ {
+ thumb.visible = false;
+ }
+
+ return true;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as
new file mode 100644
index 0000000..225e0ac
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalLayout.as
@@ -0,0 +1,325 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.layouts
+{
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.ILayoutChild;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.utils.CSSContainerUtils;
+ import org.apache.flex.utils.CSSUtils;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The HorizontalLayout class is a simple layout
+ * bead. It takes the set of children and lays them out
+ * horizontally in one row, separating them according to
+ * CSS layout rules for margin and vertical-align styles.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class HorizontalLayout implements IBeadLayout
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function HorizontalLayout()
+ {
+ }
+
+ // the strand/host container is also an ILayoutChild because
+ // can have its size dictated by the host's parent which is
+ // important to know for layout optimization
+ private var host:ILayoutChild;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ host = value as ILayoutChild;
+ COMPILE::JS
+ {
+ (value as IUIBase).element.style.display = 'block';
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBeadLayout#layout
+ * @flexjsignorecoercion org.apache.flex.core.ILayoutHost
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function layout():Boolean
+ {
+ COMPILE::SWF
+ {
+ //trace(DOMPathUtil.getPath(host), event ? event.type : "fixed size");
+ var layoutParent:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParentIUIBase = layoutParent.contentView;
+ var padding:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
+
+ var n:int = contentView.numElements;
+ var hostSizedToContent:Boolean = host.isHeightSizedToContent();
+ var ilc:ILayoutChild;
+ var marginLeft:Object;
+ var marginRight:Object;
+ var marginTop:Object;
+ var marginBottom:Object;
+ var margin:Object;
+ var maxHeight:Number = 0;
+ // asking for contentView.height can result in infinite loop if host isn't sized already
+ var h:Number = hostSizedToContent ? 0 : contentView.height;
+ var w:Number = contentView.width;
+ var verticalMargins:Array = [];
+
+ for (var i:int = 0; i < n; i++)
+ {
+ var child:IUIBase = contentView.getElementAt(i) as IUIBase;
+ if (child == null || !child.visible) continue;
+ var top:Number = ValuesManager.valuesImpl.getValue(child, "top");
+ var bottom:Number = ValuesManager.valuesImpl.getValue(child, "bottom");
+ margin = ValuesManager.valuesImpl.getValue(child, "margin");
+ marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left");
+ marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top");
+ marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right");
+ marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom");
+ var ml:Number = CSSUtils.getLeftValue(marginLeft, margin, w);
+ var mr:Number = CSSUtils.getRightValue(marginRight, margin, w);
+ var mt:Number = CSSUtils.getTopValue(marginTop, margin, h);
+ var mb:Number = CSSUtils.getBottomValue(marginBottom, margin, h);
+
+ ilc = child as ILayoutChild;
+ var lastmr:Number;
+ if (marginLeft == "auto")
+ ml = 0;
+ if (marginRight == "auto")
+ mr = 0;
+ var xx:Number;
+ if (i == 0)
+ {
+ if (ilc)
+ ilc.setX(ml + padding.left);
+ else
+ child.x = ml + padding.left;
+ }
+ else
+ {
+ if (ilc)
+ ilc.setX(xx + ml + lastmr);
+ else
+ child.x = xx + ml + lastmr;
+ }
+ if (ilc)
+ {
+ if (!isNaN(ilc.percentWidth))
+ ilc.setWidth(contentView.width * ilc.percentWidth / 100, !isNaN(ilc.percentHeight));
+ }
+ lastmr = mr;
+ var marginObject:Object = {};
+ verticalMargins[i] = marginObject;
+ var valign:* = ValuesManager.valuesImpl.getValue(child, "vertical-align");
+ marginObject.valign = valign;
+ if (!hostSizedToContent)
+ {
+ // if host is sized by parent,
+ // we can position and size children horizontally now
+ setPositionAndHeight(child, top, mt, padding.top, bottom, mb, padding.bottom, h, valign);
+ maxHeight = Math.max(maxHeight, mt + child.height + mb);
+ }
+ else
+ {
+ if (!isNaN(top))
+ {
+ mt = top;
+ marginObject.top = mt;
+ }
+ if (!isNaN(bottom))
+ {
+ mb = bottom;
+ marginObject.bottom = mb;
+ }
+ maxHeight = Math.max(maxHeight, mt + child.height + mb);
+ }
+ xx = child.x + child.width;
+ }
+ if (hostSizedToContent)
+ {
+ ILayoutChild(contentView).setHeight(maxHeight, true);
+ if (host.isWidthSizedToContent())
+ ILayoutChild(contentView).setWidth(xx, true);
+ for (i = 0; i < n; i++)
+ {
+ child = contentView.getElementAt(i) as IUIBase;
+ if (child == null || !child.visible) continue;
+ var obj:Object = verticalMargins[i];
+ setPositionAndHeight(child, obj.top, obj.marginTop, padding.top,
+ obj.bottom, obj.marginBottom, padding.bottom, maxHeight, obj.valign);
+ }
+ }
+
+ // Only return true if the contentView needs to be larger; that new
+ // size is stored in the model.
+ var sizeChanged:Boolean = true;
+
+ host.dispatchEvent( new Event("layoutComplete") );
+
+ return sizeChanged;
+
+ }
+ COMPILE::JS
+ {
+ var children:Array;
+ var i:int;
+ var n:int;
+
+ var viewBead:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParentIUIBase = viewBead.contentView;
+ children = contentView.internalChildren();
+ var hasHeight:Boolean = !host.isHeightSizedToContent();
+ var hasWidth:Boolean = !host.isWidthSizedToContent();
+ var maxHeight:Number = 0;
+ var computedWidth:Number = 0;
+ n = children.length;
+ for (i = 0; i < n; i++)
+ {
+ var child:WrappedHTMLElement = children[i] as WrappedHTMLElement;
+ child.flexjs_wrapper.internalDisplay = 'inline-block';
+ if (child.style.display == 'none')
+ child.flexjs_wrapper.setDisplayStyleForLayout('inline-block');
+ else
+ child.style.display = 'inline-block';
+ maxHeight = Math.max(maxHeight, child.offsetHeight);
+ if (!hasWidth) {
+ var cv:Object = getComputedStyle(child);
+ var mls:String = cv['margin-left'];
+ var ml:Number = Number(mls.substring(0, mls.length - 2));
+ var mrs:String = cv['margin-right'];
+ var mr:Number = Number(mrs.substring(0, mrs.length - 2));
+ computedWidth += ml + child.offsetWidth + mr;
+ }
+ child.flexjs_wrapper.dispatchEvent('sizeChanged');
+ }
+ // if there are children and maxHeight is ok, use it.
+ // maxHeight can be NaN if the child hasn't been rendered yet.
+ if (!hasHeight && n > 0 && !isNaN(maxHeight)) {
+ contentView.height = maxHeight;
+ }
+ if (!hasWidth && n > 0 && !isNaN(computedWidth)) {
+ contentView.width = computedWidth + 1; // some browser need one more pixel
+ }
+ return true;
+ }
+ }
+
+ COMPILE::SWF
+ private function setPositionAndHeight(child:IUIBase, top:Number, mt:Number, pt:Number,
+ bottom:Number, mb:Number, pb:Number, h:Number,
+ valign:*):void
+ {
+ var heightSet:Boolean = false;
+
+ var hh:Number = h;
+ var ilc:ILayoutChild = child as ILayoutChild;
+ if (ilc)
+ {
+ if (!isNaN(ilc.percentHeight))
+ ilc.setHeight(h * ilc.percentHeight / 100, true);
+ }
+ if (valign == "top")
+ {
+ if (!isNaN(top))
+ {
+ if (ilc)
+ ilc.setY(top + mt);
+ else
+ child.y = top + mt;
+ hh -= top + mt;
+ }
+ else
+ {
+ if (ilc)
+ ilc.setY(mt + pt);
+ else
+ child.y = mt + pt;
+ hh -= mt + pt;
+ }
+ if (ilc.isHeightSizedToContent())
+ {
+ if (!isNaN(bottom))
+ {
+ if (!isNaN(top))
+ {
+ if (ilc)
+ ilc.setHeight(hh - bottom - mb, true);
+ else
+ {
+ child.height = hh - bottom - mb;
+ heightSet = true;
+ }
+ }
+ }
+ }
+ }
+ else if (valign == "bottom")
+ {
+ if (!isNaN(bottom))
+ {
+ if (ilc)
+ ilc.setY(h - bottom - mb - child.height);
+ else
+ child.y = h - bottom - mb - child.height;
+ }
+ else
+ {
+ if (ilc)
+ ilc.setY(h - mb - child.height);
+ else
+ child.y = h - mb - child.height;
+ }
+ }
+ else
+ child.y = (h - child.height) / 2;
+ if (!heightSet)
+ child.dispatchEvent(new Event("sizeChanged"));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/IDataGridLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/IDataGridLayout.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/IDataGridLayout.as
new file mode 100644
index 0000000..2f22ec4
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/IDataGridLayout.as
@@ -0,0 +1,52 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.layouts
+{
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IDataGridModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.ButtonBar;
+ import org.apache.flex.html.supportClasses.DataGridColumn;
+
+ /**
+ * DataGridLayout is a class that handles the size and positioning of the
+ * elements of a DataGrid. This includes the ButtonBar used for the column
+ * headers and the Lists that are the columns.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IDataGridLayout extends IBeadLayout
+ {
+ function get header():IUIBase;
+ function set header(value:IUIBase):void;
+
+ function get columns():Array;
+ function set columns(value:Array):void;
+
+ function get listArea():IUIBase;
+ function set listArea(value:IUIBase):void;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/LayoutChangeNotifier.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/LayoutChangeNotifier.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/LayoutChangeNotifier.as
new file mode 100644
index 0000000..00d328b
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/LayoutChangeNotifier.as
@@ -0,0 +1,103 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.layouts
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The LayoutChangeNotifier notifies layouts when a property
+ * it is watching changes.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class LayoutChangeNotifier implements IBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function LayoutChangeNotifier()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _value:* = undefined;
+
+ /**
+ * The value of the property being watched. This is usually
+ * a data binding expression.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set initialValue(value:Object):void
+ {
+ _value = value;
+ }
+
+ /**
+ * The value of the property being watched. This is usually
+ * a data binding expression.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set watchedProperty(value:Object):void
+ {
+ if (_value !== value)
+ {
+ _value = value;
+ if (_strand is IBeadView)
+ IBeadView(_strand).host.dispatchEvent(new Event("layoutNeeded"));
+ else
+ IEventDispatcher(_strand).dispatchEvent(new Event("layoutNeeded"));
+ }
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as
new file mode 100644
index 0000000..c052442
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/OneFlexibleChildHorizontalLayout.as
@@ -0,0 +1,332 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.layouts
+{
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IDocument;
+ import org.apache.flex.core.ILayoutChild;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.utils.CSSUtils;
+ import org.apache.flex.utils.CSSContainerUtils;
+
+ /**
+ * The OneFlexibleChildHorizontalLayout class is a simple layout
+ * bead. It takes the set of children and lays them out
+ * horizontally in one row, separating them according to
+ * CSS layout rules for margin and padding styles. But it
+ * will size the one child to take up as much or little
+ * room as possible.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class OneFlexibleChildHorizontalLayout implements IBeadLayout, IDocument
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function OneFlexibleChildHorizontalLayout()
+ {
+ }
+
+
+ /**
+ * The id of the flexible child
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var flexibleChild:String;
+
+ private var actualChild:ILayoutChild;
+
+ // the strand/host container is also an ILayoutChild because
+ // can have its size dictated by the host's parent which is
+ // important to know for layout optimization
+ private var host:ILayoutChild;
+
+ /**
+ * @private
+ * The document.
+ */
+ private var document:Object;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ host = value as ILayoutChild;
+ }
+
+ private var _maxWidth:Number;
+
+ /**
+ * @copy org.apache.flex.core.IBead#maxWidth
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get maxWidth():Number
+ {
+ return _maxWidth;
+ }
+
+ /**
+ * @private
+ */
+ public function set maxWidth(value:Number):void
+ {
+ _maxWidth = value;
+ }
+
+ private var _maxHeight:Number;
+
+ /**
+ * @copy org.apache.flex.core.IBead#maxHeight
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get maxHeight():Number
+ {
+ return _maxHeight;
+ }
+
+ /**
+ * @private
+ */
+ public function set maxHeight(value:Number):void
+ {
+ _maxHeight = value;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBeadLayout#layout
+ */
+ public function layout():Boolean
+ {
+ var layoutParent:ILayoutHost = host.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParentIUIBase = layoutParent ? layoutParent.contentView : IParentIUIBase(host);
+ var padding:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
+ actualChild = document[flexibleChild];
+
+ var ilc:ILayoutChild;
+ var n:int = contentView.numElements;
+ var marginLeft:Object;
+ var marginRight:Object;
+ var marginTop:Object;
+ var marginBottom:Object;
+ var margin:Object;
+ maxHeight = 0;
+ var verticalMargins:Array = new Array(n);
+
+ var ww:Number = contentView.width - padding.right;
+ var hh:Number = contentView.height;
+ var xx:int = padding.left;
+ var flexChildIndex:int;
+ var ml:Number;
+ var mr:Number;
+ var mt:Number;
+ var mb:Number;
+ var lastmr:Number;
+ var lastml:Number;
+ var valign:Object;
+ var hostSizedToContent:Boolean = host.isHeightSizedToContent();
+
+ for (var i:int = 0; i < n; i++)
+ {
+ var child:IUIBase = contentView.getElementAt(i) as IUIBase;
+ if (child == actualChild)
+ {
+ flexChildIndex = i;
+ break;
+ }
+ margin = ValuesManager.valuesImpl.getValue(child, "margin");
+ marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left");
+ marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top");
+ marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right");
+ marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom");
+ mt = CSSUtils.getTopValue(marginTop, margin, hh);
+ mb = CSSUtils.getBottomValue(marginBottom, margin, hh);
+ mr = CSSUtils.getRightValue(marginRight, margin, ww);
+ ml = CSSUtils.getLeftValue(marginLeft, margin, ww);
+ child.y = mt + padding.top;
+ if (child is ILayoutChild)
+ {
+ ilc = child as ILayoutChild;
+ if (!isNaN(ilc.percentHeight))
+ ilc.setHeight(contentView.height * ilc.percentHeight / 100, true);
+ }
+ maxHeight = Math.max(maxHeight, mt + child.height + mb);
+ child.x = xx + ml;
+ xx += child.width + ml + mr;
+ lastmr = mr;
+ valign = ValuesManager.valuesImpl.getValue(child, "vertical-align");
+ verticalMargins[i] = { marginTop: mt, marginBottom: mb, valign: valign };
+ }
+
+ if (n > 0 && n > flexChildIndex)
+ {
+ for (i = n - 1; i > flexChildIndex; i--)
+ {
+ child = contentView.getElementAt(i) as IUIBase;
+ margin = ValuesManager.valuesImpl.getValue(child, "margin");
+ marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left");
+ marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top");
+ marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right");
+ marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom");
+ mt = CSSUtils.getTopValue(marginTop, margin, hh);
+ mb = CSSUtils.getTopValue(marginBottom, margin, hh);
+ mr = CSSUtils.getRightValue(marginRight, margin, ww);
+ ml = CSSUtils.getLeftValue(marginLeft, margin, ww);
+ child.y = mt + padding.top;
+ if (child is ILayoutChild)
+ {
+ ilc = child as ILayoutChild;
+ if (!isNaN(ilc.percentHeight))
+ ilc.setHeight(contentView.height * ilc.percentHeight / 100, true);
+ }
+ maxHeight = Math.max(maxHeight, mt + child.height + mb);
+ child.x = ww - child.width - mr;
+ ww -= child.width + ml + mr;
+ lastml = ml;
+ valign = ValuesManager.valuesImpl.getValue(child, "vertical-align");
+ verticalMargins[i] = { marginTop: mt, marginBottom: mb, valign: valign };
+ }
+
+ child = contentView.getElementAt(flexChildIndex) as IUIBase;
+ margin = ValuesManager.valuesImpl.getValue(child, "margin");
+ marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left");
+ marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top");
+ marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right");
+ marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom");
+ mt = CSSUtils.getTopValue(marginTop, margin, hh);
+ mb = CSSUtils.getTopValue(marginBottom, margin, hh);
+ mr = CSSUtils.getRightValue(marginRight, margin, ww);
+ ml = CSSUtils.getLeftValue(marginLeft, margin, ww);
+ if (child is ILayoutChild)
+ {
+ ilc = child as ILayoutChild;
+ if (!isNaN(ilc.percentHeight))
+ ilc.setHeight(contentView.height * ilc.percentHeight / 100, true);
+ }
+ child.x = xx + ml;
+ child.width = ww - child.x;
+ maxHeight = Math.max(maxHeight, mt + child.height + mb);
+ valign = ValuesManager.valuesImpl.getValue(child, "vertical-align");
+ verticalMargins[flexChildIndex] = { marginTop: mt, marginBottom: mb, valign: valign };
+ }
+ if (hostSizedToContent)
+ ILayoutChild(contentView).setHeight(maxHeight + padding.top + padding.bottom, true);
+
+ for (i = 0; i < n; i++)
+ {
+ var obj:Object = verticalMargins[i]
+ child = contentView.getElementAt(i) as IUIBase;
+ setPositionAndHeight(child, obj.top, obj.marginTop, padding.top,
+ obj.bottom, obj.marginBottom, padding.bottom, maxHeight, obj.valign);
+ }
+ return true;
+ }
+
+ private function setPositionAndHeight(child:IUIBase, top:Number, mt:Number, pt:Number,
+ bottom:Number, mb:Number, pb:Number, h:Number, valign:String):void
+ {
+ var heightSet:Boolean = false; // if we've set the height in a way that gens a change event
+ var ySet:Boolean = false; // if we've set the y yet.
+
+ var hh:Number = h;
+ var ilc:ILayoutChild = child as ILayoutChild;
+ if (!isNaN(top))
+ {
+ child.y = top + mt;
+ ySet = true;
+ hh -= top + mt;
+ }
+ else
+ {
+ hh -= mt;
+ }
+ if (!isNaN(bottom))
+ {
+ if (!isNaN(top))
+ {
+ if (ilc)
+ ilc.setHeight(hh - bottom - mb, true);
+ else
+ {
+ child.height = hh - bottom - mb;
+ heightSet = true;
+ }
+ }
+ else
+ {
+ child.y = h - bottom - mb - child.height - 1; // some browsers don't like going to the edge
+ ySet = true;
+ }
+ }
+ if (ilc)
+ {
+ if (!isNaN(ilc.percentHeight))
+ ilc.setHeight(h * ilc.percentHeight / 100, true);
+ }
+ if (valign == "middle")
+ child.y = (h - child.height) / 2;
+ else if (valign == "bottom")
+ child.y = h - child.height - mb;
+ else
+ child.y = mt + pt;
+ if (!heightSet)
+ child.dispatchEvent(new Event("sizeChanged"));
+ }
+
+ public function setDocument(document:Object, id:String = null):void
+ {
+ this.document = document;
+ }
+ }
+
+}
[10/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - try to
copy HTML to Basic without losing history
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextFieldView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextFieldView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextFieldView.as
new file mode 100644
index 0000000..61b6edb
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextFieldView.as
@@ -0,0 +1,54 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.text.TextFieldType;
+
+ /**
+ * The TextFieldView class is the default view for
+ * the org.apache.flex.html.Label class.
+ * It displays text using a TextField, so there is no
+ * right-to-left text support in this view.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextFieldView extends TextFieldViewBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TextFieldView()
+ {
+ super();
+
+ textField.selectable = false;
+ textField.type = TextFieldType.DYNAMIC;
+ textField.mouseEnabled = false;
+ textField.autoSize = "left";
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextFieldViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextFieldViewBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextFieldViewBase.as
new file mode 100644
index 0000000..3ab2874
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextFieldViewBase.as
@@ -0,0 +1,404 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.DisplayObjectContainer;
+ import flash.text.StyleSheet;
+
+ import org.apache.flex.core.CSSTextField;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.ILayoutChild;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ITextModel;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The TextFieldViewBase class is the base class for
+ * the components that display text.
+ * It displays text using a TextField, so there is no
+ * right-to-left text support in this view.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextFieldViewBase implements IBeadView, ITextFieldView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TextFieldViewBase()
+ {
+ _textField = new CSSTextField();
+ }
+
+ private var _textField:CSSTextField;
+
+ /**
+ * @copy org.apache.flex.core.ITextModel#textField
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get textField() : CSSTextField
+ {
+ return _textField;
+ }
+
+ private var _textModel:ITextModel;
+
+ protected var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ _textModel = value.getBeadByType(ITextModel) as ITextModel;
+ _textModel.addEventListener("textChange", textChangeHandler);
+ _textModel.addEventListener("htmlChange", htmlChangeHandler);
+ IEventDispatcher(_strand).addEventListener("widthChanged", widthChangeHandler);
+ IEventDispatcher(_strand).addEventListener("heightChanged", heightChangeHandler);
+ IEventDispatcher(_strand).addEventListener("sizeChanged", sizeChangeHandler);
+ DisplayObjectContainer(value).addChild(_textField);
+ if (_textModel.text !== null)
+ text = _textModel.text;
+ if (_textModel.html !== null)
+ html = _textModel.html;
+
+ var ilc:ILayoutChild = host as ILayoutChild;
+ autoHeight = ilc.isHeightSizedToContent();
+ autoWidth = ilc.isWidthSizedToContent();
+ if (!autoWidth && !isNaN(ilc.explicitWidth))
+ {
+ widthChangeHandler(null);
+ }
+ if (!autoHeight && !isNaN(ilc.explicitHeight))
+ {
+ heightChangeHandler(null);
+ }
+
+ // textfield's collapse to height==4 if no text
+ if (autoHeight && _textModel.text === null)
+ {
+ var fontHeight:Number = ValuesManager.valuesImpl.getValue(_strand, "fontSize") + 4;
+ if (textField.height != fontHeight)
+ {
+ textField.autoSize = "none";
+ textField.height = fontHeight;
+ }
+ }
+ }
+
+ /**
+ * @private
+ */
+ public function get host() : IUIBase
+ {
+ return _strand as IUIBase;
+ }
+
+ /**
+ * @copy org.apache.flex.core.ITextModel#text
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ return _textField.text;
+ }
+
+ /**
+ * @private
+ */
+ public function set text(value:String):void
+ {
+ if (value == null)
+ value = "";
+ _textField.text = value;
+ autoSizeIfNeeded();
+ }
+
+ /**
+ * Handle autosizing. The built-in player algorithm
+ * doesn't work the way we would like, especially
+ * when it collapses Textfields with empty strings.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function autoSizeIfNeeded():void
+ {
+ var host:UIBase = UIBase(_strand);
+ if (autoHeight)
+ {
+ if (textField.text != "")
+ {
+ if (textField.height != textField.textHeight + 4)
+ {
+ textField.height = textField.textHeight + 4;
+ inHeightChange = true;
+ host.dispatchEvent(new Event("heightChanged"));
+ inHeightChange = false;
+ }
+ }
+ else
+ {
+ var fontHeight:Number = ValuesManager.valuesImpl.getValue(_strand, "fontSize") + 4;
+ if (textField.height != fontHeight)
+ {
+ textField.height = fontHeight;
+ inHeightChange = true;
+ host.dispatchEvent(new Event("heightChanged"));
+ inHeightChange = false;
+ }
+ }
+ }
+ if (autoWidth)
+ {
+ if (textField.width != textField.textWidth + 4)
+ {
+ textField.width = textField.textWidth + 4;
+ inWidthChange = true;
+ host.dispatchEvent(new Event("widthChanged"));
+ inWidthChange = false;
+ }
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.ITextModel#html
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get html():String
+ {
+ return _textField.htmlText;
+ }
+
+ /**
+ * @private
+ */
+ public function set html(value:String):void
+ {
+ convertToTextFieldHTML(value);
+ autoSizeIfNeeded();
+ }
+
+ private function convertToTextFieldHTML(input:String):void
+ {
+ var classCount:int = 0;
+ var ss:StyleSheet;
+ var c:int = input.indexOf("<span");
+ while (c != -1)
+ {
+ var c1:int = input.indexOf(">", c);
+ if (c1 == -1)
+ {
+ trace("did not parse span correctly");
+ return;
+ }
+ var tag:String = input.substring(c, c1 + 1);
+ var c2:int = tag.indexOf("style=");
+ if (c2 != -1)
+ {
+ var quote:String = tag.charAt(c2 + 6);
+ var c3:int = tag.indexOf(quote, c2 + 7);
+ if (c3 != -1)
+ {
+ var styles:String = tag.substring(c2 + 7, c3);
+ if (!ss)
+ ss = new StyleSheet();
+ var styleObject:Object = {};
+ var list:Array = styles.split(";");
+ for each (var pair:String in list)
+ {
+ var parts:Array = pair.split(":");
+ var name:String = parts[0];
+ var c4:int = name.indexOf("-");
+ if (c4 != -1)
+ {
+ var firstChar:String = name.charAt(c4 + 1);
+ firstChar = firstChar.toUpperCase();
+ var tail:String = name.substring(c4 + 2);
+ name = name.substring(0, c4) + firstChar + tail;
+ }
+ styleObject[name] = parts[1];
+ }
+ var className:String = "css" + classCount++;
+ ss.setStyle("." + className, styleObject);
+ var newTag:String = "<span class='" + className + "'>";
+ input = input.replace(tag, newTag);
+ c1 += newTag.length - tag.length;
+ }
+ }
+ c = input.indexOf("<span", c1);
+ }
+ _textField.styleSheet = ss;
+ _textField.htmlText = input;
+ }
+
+ private function textChangeHandler(event:Event):void
+ {
+ text = _textModel.text;
+ }
+
+ private function htmlChangeHandler(event:Event):void
+ {
+ html = _textModel.html;
+ }
+
+ /**
+ * Whether we are autosizing the height.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var autoHeight:Boolean;
+
+ /**
+ * Whether we are autosizing the width.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var autoWidth:Boolean;
+
+ /**
+ * A flag to prevent looping.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var inHeightChange:Boolean = false;
+
+ /**
+ * A flag to prevent looping.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var inWidthChange:Boolean = false;
+
+ /**
+ * Determine the width of the TextField.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function widthChangeHandler(event:Event):void
+ {
+ if (!inWidthChange)
+ {
+ textField.autoSize = "none";
+ autoWidth = false;
+ textField.width = host.width;
+ if (autoHeight)
+ autoSizeIfNeeded()
+ else
+ textField.height = host.height;
+ }
+ }
+
+ /**
+ * Determine the height of the TextField.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function heightChangeHandler(event:Event):void
+ {
+ if (!inHeightChange)
+ {
+ textField.autoSize = "none";
+ autoHeight = false;
+ textField.height = host.height;
+ if (autoWidth)
+ autoSizeIfNeeded();
+ else
+ textField.width = host.width;
+ }
+ }
+
+ /**
+ * Determine the size of the TextField.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function sizeChangeHandler(event:Event):void
+ {
+ var ilc:ILayoutChild = host as ILayoutChild;
+ autoHeight = ilc.isHeightSizedToContent();
+ if (!autoHeight)
+ {
+ textField.autoSize = "none";
+ textField.height = host.height;
+ }
+
+ autoWidth = ilc.isWidthSizedToContent();
+ if (!autoWidth)
+ {
+ textField.autoSize = "none";
+ textField.width = host.width;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextInputView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextInputView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextInputView.as
new file mode 100644
index 0000000..a6f1438
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextInputView.as
@@ -0,0 +1,135 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+ import flash.text.TextFieldType;
+
+ import org.apache.flex.core.ILayoutChild;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.utils.CSSContainerUtils;
+
+ /**
+ * The TextInputView class is the view for
+ * the org.apache.flex.html.TextInput in
+ * a ComboBox and other controls
+ * because it does not display a border.
+ * It displays text using a TextField, so there is no
+ * right-to-left text support in this view.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextInputView extends TextFieldViewBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TextInputView()
+ {
+ super();
+
+ textField.selectable = true;
+ textField.type = TextFieldType.INPUT;
+ textField.mouseEnabled = true;
+ textField.multiline = false;
+ textField.wordWrap = false;
+ }
+
+ /**
+ * @private
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ autoWidth = autoHeight = false;
+
+ var w:Number;
+ var h:Number;
+ var uiMetrics:Rectangle;
+ var ilc:ILayoutChild = host as ILayoutChild;
+ if (ilc.isWidthSizedToContent())
+ {
+ uiMetrics = CSSContainerUtils.getBorderAndPaddingMetrics(host);
+ // use default width of 20
+ var s:String = textField.text;
+ textField.text = "0";
+ w = textField.textWidth * 20;
+ h = textField.textHeight;
+ textField.text = s;
+ ilc.setWidth(w + uiMetrics.left + uiMetrics.right, true);
+ }
+ if (ilc.isHeightSizedToContent())
+ {
+ if (!uiMetrics)
+ uiMetrics = CSSContainerUtils.getBorderAndPaddingMetrics(host);
+ if (isNaN(h))
+ {
+ s = textField.text;
+ textField.text = "0";
+ h = textField.textHeight;
+ textField.text = s;
+ }
+ ilc.setHeight(h + uiMetrics.top + uiMetrics.bottom, true);
+ }
+
+ heightChangeHandler(null);
+ }
+
+ /**
+ * @private
+ */
+ override protected function heightChangeHandler(event:Event):void
+ {
+ var hh:Number = host.height;
+ if( !isNaN(hh) && hh > 0 )
+ {
+ textField.height = textField.textHeight + 5;
+ }
+
+ textField.y = ((hh - textField.height) / 2);
+ }
+
+ /**
+ * @private
+ */
+ override protected function sizeChangeHandler(event:Event):void
+ {
+ var ww:Number = host.width;
+ if( !isNaN(ww) && ww > 0 ) textField.width = ww;
+
+ var hh:Number = host.height;
+ if( !isNaN(hh) && hh > 0 )
+ {
+ textField.height = textField.textHeight + 5;
+ textField.y = ((hh - textField.height) / 2);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextInputWithBorderView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextInputWithBorderView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextInputWithBorderView.as
new file mode 100644
index 0000000..fbab13e
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextInputWithBorderView.as
@@ -0,0 +1,100 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.ILayoutChild;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.html.supportClasses.Border;
+ import org.apache.flex.utils.CSSContainerUtils;
+
+ /**
+ * The TextInputWithBorderView class is the default view for
+ * the org.apache.flex.html.TextInput.
+ * It displays text using a TextField, so there is no
+ * right-to-left text support in this view.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextInputWithBorderView extends TextInputView
+ {
+ public function TextInputWithBorderView()
+ {
+ super();
+ textField.parentDrawsBackground = true;
+ textField.parentHandlesPadding = true;
+ }
+
+ /**
+ * @private
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ value.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBackgroundBead")) as IBead);
+ value.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBorderBead")) as IBead);
+ }
+
+ /**
+ * Determine the width of the TextField.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override protected function widthChangeHandler(event:Event):void
+ {
+ if (!inWidthChange)
+ {
+ textField.autoSize = "none";
+ autoWidth = false;
+ var uiMetrics:Rectangle = CSSContainerUtils.getBorderAndPaddingMetrics(host);
+ textField.width = host.width - uiMetrics.left - uiMetrics.right;
+ textField.x = uiMetrics.left;
+ }
+ }
+
+ /**
+ * Determine the size of the TextField.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override protected function sizeChangeHandler(event:Event):void
+ {
+ super.sizeChangeHandler(event);
+ widthChangeHandler(event);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextItemRendererFactoryForArrayData.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextItemRendererFactoryForArrayData.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextItemRendererFactoryForArrayData.as
new file mode 100644
index 0000000..9ffd9fe
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextItemRendererFactoryForArrayData.as
@@ -0,0 +1,159 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IDataProviderItemRendererMapper;
+ import org.apache.flex.core.IItemRendererClassFactory;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.events.ItemRendererEvent;
+ import org.apache.flex.events.IEventDispatcher;
+
+ [Event(name="itemRendererCreated",type="org.apache.flex.events.ItemRendererEvent")]
+
+ /**
+ * The TextItemRendererFactoryForArrayData class is the
+ * IDataProviderItemRendererMapper for creating
+ * ITextItemRenderers and assigning them data from an array.
+ * Other IDataProviderItemRendererMapper implementations
+ * assign specific array or vector types to item
+ * renderers expecting those types.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextItemRendererFactoryForArrayData extends EventDispatcher implements IBead, IDataProviderItemRendererMapper
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TextItemRendererFactoryForArrayData(target:Object=null)
+ {
+ super(target);
+ }
+
+ private var selectionModel:ISelectionModel;
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ IEventDispatcher(value).addEventListener("beadsAdded",finishSetup);
+ IEventDispatcher(value).addEventListener("initComplete",finishSetup);
+ }
+
+ private function finishSetup(event:Event):void
+ {
+ selectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ var listView:IListView = _strand.getBeadByType(IListView) as IListView;
+ dataGroup = listView.dataGroup;
+ selectionModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
+
+ if (!itemRendererFactory)
+ {
+ _itemRendererFactory = new (ValuesManager.valuesImpl.getValue(_strand, "iItemRendererClassFactory")) as IItemRendererClassFactory;
+ _strand.addBead(_itemRendererFactory);
+ }
+
+ dataProviderChangeHandler(null);
+ }
+
+ private var _itemRendererFactory:IItemRendererClassFactory;
+
+ /**
+ * An IItemRendererClassFactory that should generate ITextItemRenderers
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRendererFactory():IItemRendererClassFactory
+ {
+ return _itemRendererFactory
+ }
+
+ /**
+ * @private
+ */
+ public function set itemRendererFactory(value:IItemRendererClassFactory):void
+ {
+ _itemRendererFactory = value;
+ }
+
+ /**
+ * The IItemRendererParent that should parent the ITextItemRenderers
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var dataGroup:IItemRendererParent;
+
+ private function dataProviderChangeHandler(event:Event):void
+ {
+ var dp:Array = selectionModel.dataProvider as Array;
+ if (!dp)
+ return;
+
+ dataGroup.removeAllElements();
+
+ var n:int = dp.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var tf:ITextItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as ITextItemRenderer;
+ tf.index = i;
+ dataGroup.addElement(tf);
+ if (selectionModel.labelField)
+ tf.text = dp[i][selectionModel.labelField];
+ else
+ tf.text = dp[i];
+
+ var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED);
+ newEvent.itemRenderer = tf;
+ dispatchEvent(newEvent);
+ }
+
+ IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextItemRendererFactoryForStringVectorData.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextItemRendererFactoryForStringVectorData.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextItemRendererFactoryForStringVectorData.as
new file mode 100644
index 0000000..b0c11b5
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TextItemRendererFactoryForStringVectorData.as
@@ -0,0 +1,143 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IItemRendererClassFactory;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.ItemRendererEvent;
+
+ [Event(name="itemRendererCreated",type="org.apache.flex.events.ItemRendererEvent")]
+
+ /**
+ * The TextItemRendererFactoryForStringVectorData class is the
+ * IDataProviderItemRendererMapper for creating
+ * ITextItemRenderers and assigning them data from an vector
+ * of Strings. Other IDataProviderItemRendererMapper implementations
+ * assign specific array or vector types to item
+ * renderers expecting those types.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextItemRendererFactoryForStringVectorData extends EventDispatcher implements IBead
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TextItemRendererFactoryForStringVectorData(target:Object=null)
+ {
+ super(target);
+ }
+
+ private var selectionModel:ISelectionModel;
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ IEventDispatcher(value).addEventListener("beadsAdded",finishSetup);
+ }
+
+ private function finishSetup(event:Event):void
+ {
+ selectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ var listView:IListView = _strand.getBeadByType(IListView) as IListView;
+ dataGroup = listView.dataGroup;
+ selectionModel.addEventListener("dataProviderChange", dataProviderChangeHandler);
+ dataProviderChangeHandler(null);
+ }
+
+ private var _itemRendererFactory:IItemRendererClassFactory;
+
+ /**
+ * An IItemRendererClassFactory that should generate ITextItemRenderers
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRendererFactory():IItemRendererClassFactory
+ {
+ return _itemRendererFactory
+ }
+
+ /**
+ * @private
+ */
+ public function set itemRendererFactory(value:IItemRendererClassFactory):void
+ {
+ _itemRendererFactory = value;
+ }
+
+ /**
+ * The IItemRendererParent that should parent the ITextItemRenderers
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var dataGroup:IItemRendererParent;
+
+ private function dataProviderChangeHandler(event:Event):void
+ {
+ var dp:Vector.<String> = selectionModel.dataProvider as Vector.<String>;
+
+ dataGroup.removeAllElements();
+
+ var n:int = dp.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var tf:ITextItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as ITextItemRenderer;
+ tf.index = i;
+ dataGroup.addElement(tf);
+ tf.text = dp[i];
+
+ var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED);
+ newEvent.itemRenderer = tf;
+ dispatchEvent(newEvent);
+ }
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TitleBarMeasurementBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TitleBarMeasurementBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TitleBarMeasurementBead.as
new file mode 100644
index 0000000..8195f70
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TitleBarMeasurementBead.as
@@ -0,0 +1,108 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import org.apache.flex.core.IMeasurementBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.html.TitleBar;
+
+ /**
+ * The TitleBarMeasurementBead class measures the overall size of a
+ * org.apache.flex.html.TitleBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TitleBarMeasurementBead implements IMeasurementBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TitleBarMeasurementBead()
+ {
+ }
+
+ /**
+ * The overall width of the org.apache.flex.html.TitleBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get measuredWidth():Number
+ {
+ var mwidth:Number = 0;
+ var titleBar:TitleBar = _strand as TitleBar;
+ var titleView:TitleBarView = _strand.getBeadByType(TitleBarView) as TitleBarView;
+ var labelMeasure:IMeasurementBead = titleView.titleLabel.measurementBead;
+ mwidth = labelMeasure.measuredWidth;
+ if( titleBar.showCloseButton ) {
+ var buttonMeasure:IMeasurementBead = titleView.closeButton.measurementBead;
+ mwidth += buttonMeasure.measuredWidth;
+ }
+ return mwidth;
+ }
+
+ /**
+ * The overall height of the org.apache.flex.html.TitleBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get measuredHeight():Number
+ {
+ var mheight:Number = 0;
+ var titleBar:TitleBar = _strand as TitleBar;
+ var titleView:TitleBarView = _strand.getBeadByType(TitleBarView) as TitleBarView;
+ var labelMeasure:IMeasurementBead = titleView.titleLabel.measurementBead;
+ mheight = labelMeasure.measuredHeight;
+ if( titleBar.showCloseButton ) {
+ var buttonMeasure:IMeasurementBead = titleView.closeButton.measurementBead;
+ mheight = Math.max(mheight,buttonMeasure.measuredHeight);
+ }
+ return mheight;
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TitleBarView.mxml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TitleBarView.mxml b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TitleBarView.mxml
new file mode 100644
index 0000000..206f43e
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TitleBarView.mxml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<!---
+ The TitleBarView is the view for a Panel's TitleBar written in MXML
+
+ @langversion 3.0
+ @playerversion Flash 10.2
+ @playerversion AIR 2.6
+ @productversion FlexJS 0.0
+-->
+<js:MXMLBeadView xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:js="library://ns.apache.org/flexjs/basic">
+
+ <fx:Script>
+ <![CDATA[
+ import org.apache.flex.html.TitleBar;
+ import org.apache.flex.core.ITitleBarModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+
+ private function clickHandler():void
+ {
+ var newEvent:org.apache.flex.events.Event = new org.apache.flex.events.Event('close',true);
+ UIBase(_strand).dispatchEvent(newEvent)
+ }
+ ]]>
+ </fx:Script>
+ <js:beads>
+ <js:MXMLBeadViewDataBinding />
+ <js:LayoutChangeNotifier watchedProperty="{titleLabel.text}" />
+ </js:beads>
+
+ <js:Label id="titleLabel" text="{ITitleBarModel(model).title}" >
+ <js:style>
+ <js:SimpleCSSStyles fontWeight="inherit" margin="5" />
+ </js:style>
+ </js:Label>
+ <js:CloseButton id="closeButton" click="clickHandler()"
+ visible="{ITitleBarModel(model).showCloseButton}"/>
+
+</js:MXMLBeadView>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/UpArrowButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/UpArrowButtonView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/UpArrowButtonView.as
new file mode 100644
index 0000000..8e6ff4a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/UpArrowButtonView.as
@@ -0,0 +1,112 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The UpArrowButtonView class is the view for
+ * the up arrow button in a ScrollBar and other controls.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class UpArrowButtonView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function UpArrowButtonView()
+ {
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+
+ drawView(upView.graphics, 0xf8f8f8);
+ drawView(downView.graphics, 0xd8d8d8);
+ drawView(overView.graphics, 0xe8e8e8);
+ }
+
+ private function drawView(g:Graphics, bgColor:uint):void
+ {
+ g.lineStyle(1);
+ g.beginFill(bgColor);
+ g.drawRoundRect(0, 0, ScrollBarView.FullSize, ScrollBarView.FullSize, ScrollBarView.ThirdSize);
+ g.endFill();
+ g.lineStyle(0);
+ g.beginFill(0);
+ g.moveTo(ScrollBarView.QuarterSize, ScrollBarView.ThreeQuarterSize);
+ g.lineTo(ScrollBarView.ThreeQuarterSize, ScrollBarView.ThreeQuarterSize);
+ g.lineTo(ScrollBarView.HalfSize, ScrollBarView.QuarterSize);
+ g.lineTo(ScrollBarView.QuarterSize, ScrollBarView.ThreeQuarterSize);
+ g.endFill();
+ }
+
+ private var shape:Shape;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, ScrollBarView.FullSize, ScrollBarView.FullSize);
+ shape.graphics.endFill();
+ SimpleButton(value).upState = upView;
+ SimpleButton(value).downState = downView;
+ SimpleButton(value).overState = overView;
+ SimpleButton(value).hitTestState = shape;
+
+ SimpleButton(_strand).addEventListener("widthChanged",sizeChangeHandler);
+ SimpleButton(_strand).addEventListener("heightChanged",sizeChangeHandler);
+ }
+
+ private var upView:Shape;
+ private var downView:Shape;
+ private var overView:Shape;
+
+ private function sizeChangeHandler(event:Event):void
+ {
+ SimpleButton(_strand).scaleX = SimpleButton(_strand).width / ScrollBarView.FullSize;
+ SimpleButton(_strand).scaleY = SimpleButton(_strand).height / ScrollBarView.FullSize;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/VRuleView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/VRuleView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/VRuleView.as
new file mode 100644
index 0000000..5eb6c4c
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/VRuleView.as
@@ -0,0 +1,87 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.Bitmap;
+ import flash.display.Loader;
+ import flash.display.LoaderInfo;
+ import flash.net.URLRequest;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IImageModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The ImageView class creates the visual elements of the org.apache.flex.html.Image component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VRuleView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function VRuleView()
+ {
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ IEventDispatcher(_strand).addEventListener("widthChanged",handleSizeChange);
+ IEventDispatcher(_strand).addEventListener("heightChanged",handleSizeChange);
+ IEventDispatcher(_strand).addEventListener("sizeChanged",handleSizeChange);
+
+ handleSizeChange(null);
+ }
+
+ /**
+ * @private
+ */
+ private function handleSizeChange(event:Object):void
+ {
+ var ui:UIBase = _strand as UIBase;
+ ui.graphics.clear();
+ ui.graphics.beginFill(0);
+ ui.graphics.drawRect(0, 0, 1, ui.height);
+ ui.graphics.endFill();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/VScrollBarThumbView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/VScrollBarThumbView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/VScrollBarThumbView.as
new file mode 100644
index 0000000..0f70b37
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/VScrollBarThumbView.as
@@ -0,0 +1,119 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+ import flash.display.DisplayObject;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The VScrollBarThumbView class is the view for
+ * the thumb button in a Vertical ScrollBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VScrollBarThumbView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function VScrollBarThumbView()
+ {
+ }
+
+ private function drawView(g:Graphics, bgColor:uint):void
+ {
+ var hh:Number = DisplayObject(_strand).height;
+ g.clear();
+ g.lineStyle(1);
+ g.beginFill(bgColor);
+ g.drawRoundRect(0, 0, ScrollBarView.FullSize, hh, ScrollBarView.HalfSize);
+ g.endFill();
+ }
+
+ private var shape:Shape;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+
+ drawView(upView.graphics, 0xc8c8c8);
+ drawView(downView.graphics, 0xc8c8c8);
+ drawView(overView.graphics, 0xb8b8b8);
+
+ shape = new Shape();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, ScrollBarView.FullSize, ScrollBarView.FullSize);
+ shape.graphics.endFill();
+ SimpleButton(value).upState = upView;
+ SimpleButton(value).downState = downView;
+ SimpleButton(value).overState = overView;
+ SimpleButton(value).hitTestState = shape;
+ IEventDispatcher(_strand).addEventListener("heightChanged", heightChangedHandler);
+ }
+
+ private function heightChangedHandler(event:Event):void
+ {
+ DisplayObject(_strand).scaleY = 1.0;
+ DisplayObject(_strand).scaleX = 1.0;
+
+ var hh:Number = DisplayObject(_strand).height;
+ drawView(upView.graphics, 0xc8c8c8);
+ drawView(downView.graphics, 0xc8c8c8);
+ drawView(overView.graphics, 0xb8b8b8);
+
+ shape.graphics.clear();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, ScrollBarView.FullSize, hh);
+ shape.graphics.endFill();
+ }
+
+ private var upView:Shape;
+ private var downView:Shape;
+ private var overView:Shape;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/VScrollBarTrackView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/VScrollBarTrackView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/VScrollBarTrackView.as
new file mode 100644
index 0000000..3510251
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/VScrollBarTrackView.as
@@ -0,0 +1,118 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+ import flash.display.Graphics;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+
+ import org.apache.flex.core.BeadViewBase;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The VScrollBarTrackView class is the view for
+ * the track in a Vertical ScrollBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VScrollBarTrackView extends BeadViewBase implements IBeadView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function VScrollBarTrackView()
+ {
+ }
+
+ private function drawView(g:Graphics, bgColor:uint):void
+ {
+ var h:Number = SimpleButton(_strand).height;
+
+ g.clear();
+ g.lineStyle(1, 0x808080);
+ g.beginFill(bgColor);
+ g.drawRect(0, 0, ScrollBarView.FullSize, h);
+ g.endFill();
+ g.lineStyle(0);
+ }
+
+ private function heightChangeHandler(event:Event):void
+ {
+ DisplayObject(_strand).scaleY = 1.0;
+ DisplayObject(_strand).scaleX = 1.0;
+
+ var h:Number = SimpleButton(_strand).height;
+
+ drawView(upView.graphics, 0xf8f8f8);
+ drawView(downView.graphics, 0xd8d8d8);
+ drawView(overView.graphics, 0xe8e8e8);
+ shape.graphics.clear();
+ shape.graphics.beginFill(0xCCCCCC);
+ shape.graphics.drawRect(0, 0, ScrollBarView.FullSize, h);
+ shape.graphics.endFill();
+
+ }
+
+ private var shape:Shape;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ upView = new Shape();
+ downView = new Shape();
+ overView = new Shape();
+
+ drawView(upView.graphics, 0xf8f8f8);
+ drawView(downView.graphics, 0xd8d8d8);
+ drawView(overView.graphics, 0xe8e8e8);
+
+ SimpleButton(value).addEventListener("heightChanged", heightChangeHandler);
+ shape = new Shape();
+ SimpleButton(value).upState = upView;
+ SimpleButton(value).downState = downView;
+ SimpleButton(value).overState = overView;
+ SimpleButton(value).hitTestState = shape;
+ }
+
+ private var upView:Shape;
+ private var downView:Shape;
+ private var overView:Shape;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/VScrollBarView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/VScrollBarView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/VScrollBarView.as
new file mode 100644
index 0000000..840f7bf
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/VScrollBarView.as
@@ -0,0 +1,99 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ import flash.display.DisplayObject;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IScrollBarModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.Strand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.html.Button;
+ import org.apache.flex.html.beads.controllers.ButtonAutoRepeatController;
+
+ /**
+ * The ScrollBarView class is the default view for
+ * the org.apache.flex.html.supportClasses.VScrollBar class.
+ * It implements the classic desktop-like VScrollBar.
+ * A different view would implement more modern scrollbars that hide themselves
+ * until hovered over with the mouse.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VScrollBarView extends ScrollBarView implements IBeadView, IStrand, IScrollBarView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function VScrollBarView()
+ {
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+
+ UIBase(value).setWidth(ScrollBarView.FullSize, true);
+
+ // TODO: (aharui) put in values impl
+ _increment = new Button();
+ Button(_increment).addBead(new DownArrowButtonView());
+ Button(_increment).addBead(new ButtonAutoRepeatController());
+ _decrement = new Button();
+ Button(_decrement).addBead(new UpArrowButtonView());
+ Button(_decrement).addBead(new ButtonAutoRepeatController());
+ _track = new Button();
+ Button(_track).addBead(new VScrollBarTrackView());
+ _thumb = new Button();
+ Button(_thumb).addBead(new VScrollBarThumbView());
+
+ UIBase(value).addChild(_decrement);
+ UIBase(value).addChild(_increment);
+ UIBase(value).addChild(_track);
+ UIBase(value).addChild(_thumb);
+
+ IEventDispatcher(_strand).addEventListener("heightChanged", changeHandler);
+
+ layout.layout();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/WebBrowserView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/WebBrowserView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/WebBrowserView.as
new file mode 100644
index 0000000..63d04e2
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/WebBrowserView.as
@@ -0,0 +1,198 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+ COMPILE::SWF {
+ import flash.events.Event;
+ import flash.html.HTMLLoader;
+ import flash.net.URLRequest;
+ }
+
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.beads.models.WebBrowserModel;
+
+ /**
+ * The WebBrowserView creates an instance of HTMLLoader to load
+ * web pages into AIR application.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public class WebBrowserView implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function WebBrowserView()
+ {
+ loader = new HTMLLoader();
+ loader.placeLoadStringContentInApplicationSandbox = false;
+
+ loader.addEventListener(flash.events.LocationChangeEvent.LOCATION_CHANGE, handleLocationChange);
+ }
+
+ private var _strand:IStrand;
+
+ private var loader:HTMLLoader;
+
+ /**
+ * @private
+ */
+ public function get host():IUIBase
+ {
+ return _strand as IUIBase;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ (host as UIBase).addEventListener("widthChanged", handleSizeChange);
+ (host as UIBase).addEventListener("heightChanged", handleSizeChange);
+
+ var model:IEventDispatcher = (host as UIBase).model as IEventDispatcher;
+ model.addEventListener("urlChanged", loadPage);
+
+ loader.x = 0;
+ loader.y = 0;
+ loader.width = host.width;
+ loader.height = host.height;
+ (host as UIBase).addElement(loader);
+ }
+
+ /**
+ * @private
+ */
+ private function loadPage(event:org.apache.flex.events.Event):void
+ {
+ var model:WebBrowserModel = (host as UIBase).model as WebBrowserModel;
+ loader.load(new URLRequest(model.url));
+ }
+
+ /**
+ * @private
+ */
+ private function handleSizeChange(event:org.apache.flex.events.Event):void
+ {
+ loader.width = host.width;
+ loader.height = host.height;
+ }
+
+ /**
+ * @private
+ */
+ private function handleLocationChange(event:flash.events.LocationChangeEvent):void
+ {
+ var model:WebBrowserModel = (host as UIBase).model as WebBrowserModel;
+ model.setURL(loader.location);
+ host.dispatchEvent(new org.apache.flex.events.Event("locationChanged"));
+ }
+ }
+
+ COMPILE::JS
+ public class WebBrowserView implements IBeadView
+ {
+ /**
+ * Constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function WebBrowserView()
+ {
+
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @private
+ */
+ public function get host():IUIBase
+ {
+ return _strand as IUIBase;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ var model:IEventDispatcher = (host as UIBase).model as IEventDispatcher;
+ model.addEventListener("urlChanged", loadPage);
+
+ var iframe:HTMLIFrameElement = (host as UIBase).element as HTMLIFrameElement;
+ iframe.addEventListener("load", handlePageShow, false);
+ }
+
+ /**
+ * @private
+ */
+ private function loadPage(event:Event):void
+ {
+ var model:WebBrowserModel = (host as UIBase).model as WebBrowserModel;
+
+ var iframe:HTMLIFrameElement = (host as UIBase).element as HTMLIFrameElement;
+ iframe.src = model.url;
+ }
+
+ /**
+ * @private
+ */
+ private function handlePageShow(event:Event):void
+ {
+ var model:WebBrowserModel = (host as UIBase).model as WebBrowserModel;
+ var iframe:HTMLIFrameElement = (host as UIBase).element as HTMLIFrameElement;
+
+ model.setURL(iframe.src);
+ host.dispatchEvent(new org.apache.flex.events.Event("locationChanged"));
+ }
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/AlertController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/AlertController.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/AlertController.as
new file mode 100644
index 0000000..3982d0f
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/AlertController.as
@@ -0,0 +1,88 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.controllers
+{
+ import flash.display.DisplayObject;
+
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The AlertControler class bead handles the close event on the org.apache.flex.html.Alert
+ * by removing the org.apache.flex.html.Alert from the display.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class AlertController implements IBeadController
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function AlertController()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ IEventDispatcher(value).addEventListener("close",handleAlertClose);
+ }
+
+ /**
+ * @private
+ */
+ private function handleAlertClose(event:Event):void
+ {
+ DisplayObject(_strand).parent.removeChild(DisplayObject(_strand));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ButtonAutoRepeatController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ButtonAutoRepeatController.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ButtonAutoRepeatController.as
new file mode 100644
index 0000000..4100a28
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ButtonAutoRepeatController.as
@@ -0,0 +1,147 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.controllers
+{
+ import flash.utils.clearInterval;
+ import flash.utils.clearTimeout;
+ import flash.utils.setInterval;
+ import flash.utils.setTimeout;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The ButtonAutoRepeatController class adds autorepeat
+ * functionality to a button. This version is simply waits
+ * a specified amount of time (default is 250ms), then repeats the button
+ * event at a specified interval, which defaults to
+ * 125 milliseconds. Alternate implementations could
+ * have non-linear repeat timing, look for keyboard modifiers to choose
+ * different rates, etc.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ButtonAutoRepeatController implements IBead, IBeadController
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ButtonAutoRepeatController()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ IEventDispatcher(value).addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
+ }
+
+ /**
+ * The number of milliseconds to wait before repeating the event
+ * for the first time.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var delay:int = 250;
+
+ /**
+ * The number of milliseconds to wait before repeating the event
+ * after the first time. This value is not checked for
+ * changes after the events start repeating.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var interval:int = 100;
+
+ private var timeout:uint;
+ private var repeater:uint;
+
+ private function mouseDownHandler(event:MouseEvent):void
+ {
+ event.target.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
+ event.target.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ timeout = setTimeout(sendFirstRepeat, delay);
+ }
+
+ private function mouseOutHandler(event:MouseEvent):void
+ {
+ event.target.removeEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
+ event.target.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ if (repeater > 0)
+ clearInterval(repeater);
+ repeater = 0;
+ if (timeout > 0)
+ clearTimeout(timeout);
+ timeout = 0;
+ }
+
+ private function mouseUpHandler(event:MouseEvent):void
+ {
+ event.target.removeEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
+ event.target.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
+ if (repeater > 0)
+ clearInterval(repeater);
+ repeater = 0;
+ if (timeout > 0)
+ clearTimeout(timeout);
+ timeout = 0;
+ }
+
+ private function sendFirstRepeat():void
+ {
+ clearTimeout(timeout);
+ timeout = 0;
+ repeater = setInterval(sendRepeats, interval);
+ IEventDispatcher(_strand).dispatchEvent(new Event("buttonRepeat"));
+ }
+
+ private function sendRepeats():void
+ {
+ IEventDispatcher(_strand).dispatchEvent(new Event("buttonRepeat"));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ComboBoxController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ComboBoxController.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ComboBoxController.as
new file mode 100644
index 0000000..12fb59c
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ComboBoxController.as
@@ -0,0 +1,104 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.controllers
+{
+ import flash.display.DisplayObject;
+
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.html.beads.IComboBoxView;
+
+ /**
+ * The ComboBoxController class bead handles mouse events on the elements of
+ * the org.apache.flex.html.ComboBox. This includes selecting the
+ * button to display the selection list pop-up as well as selecting an item from the
+ * pop-up list.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ComboBoxController implements IBeadController
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ComboBoxController()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ IEventDispatcher(value).addEventListener(MouseEvent.CLICK, clickHandler);
+ }
+
+ /**
+ * @private
+ */
+ private function clickHandler(event:MouseEvent):void
+ {
+ var viewBead:IComboBoxView = _strand.getBeadByType(IComboBoxView) as IComboBoxView;
+ viewBead.popUpVisible = true;
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ var popUpModel:ISelectionModel = viewBead.popUp.getBeadByType(ISelectionModel) as ISelectionModel;
+ popUpModel.dataProvider = selectionModel.dataProvider;
+ popUpModel.selectedIndex = selectionModel.selectedIndex;
+ DisplayObject(viewBead.popUp).width = DisplayObject(_strand).width;
+ DisplayObject(viewBead.popUp).height = 200;
+ DisplayObject(viewBead.popUp).x = DisplayObject(_strand).x;
+ DisplayObject(viewBead.popUp).y = DisplayObject(_strand).y;
+ IEventDispatcher(viewBead.popUp).addEventListener("change", changeHandler);
+ }
+
+ /**
+ * @private
+ */
+ private function changeHandler(event:Event):void
+ {
+ var viewBead:IComboBoxView = _strand.getBeadByType(IComboBoxView) as IComboBoxView;
+ viewBead.popUpVisible = false;
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ var popUpModel:ISelectionModel = viewBead.popUp.getBeadByType(ISelectionModel) as ISelectionModel;
+ selectionModel.selectedIndex = popUpModel.selectedIndex;
+ IEventDispatcher(_strand).dispatchEvent(new Event("change"));
+ }
+
+ }
+}
[21/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - Copy
HTMLJS to BasicJS. Use --follow for history
Posted by ah...@apache.org.
Copy HTMLJS to BasicJS. Use --follow for history
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/7a2115d7
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/7a2115d7
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/7a2115d7
Branch: refs/heads/refactor-sprite
Commit: 7a2115d7bcf6a015ac7bfc280327458f52d4fa5e
Parents: d822145
Author: Alex Harui <ah...@apache.org>
Authored: Wed Oct 26 14:11:51 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:46:51 2016 -0700
----------------------------------------------------------------------
frameworks/js/FlexJS/projects/BasicJS/build.xml | 142 +++++++++++++++++++
.../src/main/config/compile-js-config.xml | 96 +++++++++++++
2 files changed, 238 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7a2115d7/frameworks/js/FlexJS/projects/BasicJS/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/projects/BasicJS/build.xml b/frameworks/js/FlexJS/projects/BasicJS/build.xml
new file mode 100644
index 0000000..5a39024
--- /dev/null
+++ b/frameworks/js/FlexJS/projects/BasicJS/build.xml
@@ -0,0 +1,142 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+
+<project name="BasicJS" default="main" basedir=".">
+ <property name="FLEXJS_HOME" location="../../../../.."/>
+
+ <property file="${FLEXJS_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${FLEXJS_HOME}/build.properties"/>
+ <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+
+ <property name="target.name" value="${ant.project.name}.swc" />
+ <echo file="${basedir}/${target.name}.properties">target.name.nojs=${ant.project.name}</echo>
+ <replaceregexp file="${basedir}/${target.name}.properties" match="(.*)JS$" replace="\1" flags="m" />
+ <property file="${basedir}/${target.name}.properties"/>
+ <delete file="${basedir}/${target.name}.properties"/>
+
+ <target name="main" depends="clean,check-compiler,compile-js-swc,compile-asjs" description="Full build of ${ant.project.name}.swc">
+ </target>
+
+ <target name="clean">
+ <delete failonerror="false">
+ <fileset dir="${FLEXJS_HOME}/frameworks/js/FlexJS/libs">
+ <include name="${target.name}"/>
+ </fileset>
+ </delete>
+ <delete failonerror="false" includeemptydirs="true">
+ <fileset dir="${basedir}/target">
+ <include name="**/**"/>
+ </fileset>
+ </delete>
+ </target>
+
+ <target name="compile-asjs" depends="check-compiler">
+ <echo message="Cross-compiling ${target.name}"/>
+ <echo message="FALCONJX_HOME: ${FALCONJX_HOME}"/>
+ <mkdir dir="${basedir}/target/generated-sources/flexjs"/>
+ <java jar="${FALCONJX_HOME}/lib/compc.jar" fork="true" >
+ <jvmarg value="-Xmx384m" />
+ <jvmarg value="-Dsun.io.useCanonCaches=false" />
+ <jvmarg value="-Dflexcompiler=${FALCONJX_HOME}/../compiler" />
+ <jvmarg value="-Dflexlib=${FLEXJS_HOME}/frameworks" />
+ <arg value="+flexlib=${FLEX_HOME}/frameworks" />
+ <arg value="-js-output-type=FLEXJS" />
+ <arg value="-compiler.strict-xml=true" />
+ <arg value="-keep-asdoc" /><!-- allows compiler to see @flexjsignorecoercion annotations -->
+ <arg value="-output=${FLEX_HOME}/frameworks/projects/${target.name.nojs}/target/${target.name.nojs}.swc" />
+ <arg value="-load-config=${FLEX_HOME}/frameworks/js-config.xml" />
+ <arg value="-load-config+=${basedir}/src/main/config/compile-js-config.xml" />
+ </java>
+ </target>
+
+ <target name="compile-js-swc" description="Compiles .as files into .swc used for cross-compiling other projects">
+ <echo message="Compiling target/${target.name}"/>
+ <echo message="FLEX_HOME: ${FLEX_HOME}"/>
+ <echo message="FALCON_HOME: ${FALCON_HOME}"/>
+ <mkdir dir="${FLEXJS_HOME}/frameworks/js/FlexJS/libs"/>
+ <mkdir dir="${basedir}/target"/>
+
+ <compc fork="true"
+ output="${basedir}/target/${target.name}">
+ <jvmarg line="${compc.jvm.args}"/>
+ <load-config filename="${FLEX_HOME}/frameworks/js-config.xml" />
+ <load-config filename="src/main/config/compile-js-config.xml" />
+ <arg value="-compiler.strict-xml=true" />
+ </compc>
+ <copy file="${basedir}/target/${target.name}" tofile="${FLEXJS_HOME}/frameworks/js/FlexJS/libs/${target.name}" />
+ </target>
+
+ <target name="copy-js" >
+ <mkdir dir="${FLEXJS_HOME}/frameworks/js/FlexJS/generated-sources"/>
+ <copy todir="${FLEXJS_HOME}/frameworks/js/FlexJS/generated-sources">
+ <fileset dir="${basedir}/target/generated-sources/flexjs">
+ <include name="**/**" />
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="check-compiler" depends="check-falcon-home, check-falconjx-home">
+ <path id="lib.path">
+ <fileset dir="${FALCON_HOME}/lib" includes="falcon-flexTasks.jar"/>
+ </path>
+ <taskdef resource="flexTasks.tasks" classpathref="lib.path"/>
+ </target>
+
+ <target name="check-falcon-home" unless="FALCON_HOME"
+ description="Check FALCON_HOME is a directory.">
+
+ <echo message="FALCON_HOME is ${env.FALCON_HOME}"/>
+
+ <available file="${env.FALCON_HOME}/lib/falcon-mxmlc.jar"
+ type="file"
+ property="FALCON_HOME"
+ value="${env.FALCON_HOME}"/>
+
+ <available file="${FLEXJS_HOME}/../flex-falcon/compiler/lib/falcon-mxmlc.jar"
+ type="file"
+ property="FALCON_HOME"
+ value="${FLEXJS_HOME}/../flex-falcon/compiler"/>
+
+ <fail message="FALCON_HOME must be set to a folder with a lib sub-folder containing falcon-mxmlc.jar such as the compiler folder in flex-falcon repo or a FlexJS SDK folder"
+ unless="FALCON_HOME"/>
+ </target>
+
+ <target name="check-falconjx-home" unless="FALCONJX_HOME"
+ description="Check FALCON_HOME is a directory.">
+
+ <echo message="FALCONJX_HOME is ${env.FALCONJX_HOME}"/>
+
+ <available file="${env.FALCONJX_HOME}/lib/jsc.jar"
+ type="file"
+ property="FALCONJX_HOME"
+ value="${env.FALCONJX_HOME}"/>
+
+ <available file="${FLEXJS_HOME}/../flex-falcon/compiler-jx/lib/jsc.jar"
+ type="file"
+ property="FALCONJX_HOME"
+ value="${FLEXJS_HOME}/../flex-falcon/compiler-jx"/>
+
+ <fail message="FALCONJX_HOME must be set to a folder with a lib sub-folder containing jsc.jar such as the compiler-jx folder in flex-falcon repo or the js folder of a FlexJS SDK"
+ unless="FALCONJX_HOME"/>
+ </target>
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7a2115d7/frameworks/js/FlexJS/projects/BasicJS/src/main/config/compile-js-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/projects/BasicJS/src/main/config/compile-js-config.xml b/frameworks/js/FlexJS/projects/BasicJS/src/main/config/compile-js-config.xml
new file mode 100644
index 0000000..ec61db4
--- /dev/null
+++ b/frameworks/js/FlexJS/projects/BasicJS/src/main/config/compile-js-config.xml
@@ -0,0 +1,96 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<flex-config>
+
+ <compiler>
+ <accessible>false</accessible>
+
+ <mxml>
+ <children-as-data>true</children-as-data>
+ </mxml>
+ <binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event>
+ <binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind>
+ <binding-value-change-event-type>valueChange</binding-value-change-event-type>
+
+ <define>
+ <name>COMPILE::SWF</name>
+ <value>false</value>
+ </define>
+ <define>
+ <name>COMPILE::JS</name>
+ <value>true</value>
+ </define>
+
+ <keep-as3-metadata>
+ <name>Bindable</name>
+ <name>Managed</name>
+ <name>ChangeEvent</name>
+ <name>NonCommittingChangeEvent</name>
+ <name>Transient</name>
+ </keep-as3-metadata>
+
+ <locale/>
+
+ <!-- overwrite the default library-path setting -->
+ <library-path>
+ <path-element>../../../../../../../../js/libs/GCL.swc</path-element>
+ <!-- asjscompc won't 'link' these classes in, but will list their requires
+ if these swcs are on the external-library-path then their requires
+ will not be listed -->
+ <path-element>../../../../../libs/BindingJS.swc</path-element>
+ <path-element>../../../../../libs/CoreJS.swc</path-element>
+ <path-element>../../../../../libs/GraphicsJS.swc</path-element>
+ <path-element>../../../../../libs/CollectionsJS.swc</path-element>
+ </library-path>
+
+ <namespaces>
+ <namespace>
+ <uri>library://ns.apache.org/flexjs/basic</uri>
+ <manifest>../../../../../../../projects/Basic/src/main/resources/basic-manifest.xml</manifest>
+ </namespace>
+ <namespace>
+ <uri>library://ns.apache.org/flexjs/svg</uri>
+ <manifest>../../../../../../../projects/Basic/src/main/resources/svg-manifest.xml</manifest>
+ </namespace>
+ </namespaces>
+
+ <source-path>
+ <path-element>../../../../../../../projects/Basic/src/main/flex</path-element>
+ </source-path>
+
+ <warn-no-constructor>false</warn-no-constructor>
+ </compiler>
+
+ <include-file>
+ </include-file>
+
+ <include-sources>
+ </include-sources>
+
+ <include-classes>
+ <class>BasicClasses</class>
+ </include-classes>
+
+ <include-namespaces>
+ <uri>library://ns.apache.org/flexjs/basic</uri>
+ <uri>library://ns.apache.org/flexjs/svg</uri>
+ </include-namespaces>
+
+
+</flex-config>
[33/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - fix up
after moving UIButtonBase
Posted by ah...@apache.org.
fix up after moving UIButtonBase
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/1890b715
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/1890b715
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/1890b715
Branch: refs/heads/refactor-sprite
Commit: 1890b715660130240ef613890e92c26cbe19177d
Parents: 0d06e65
Author: Alex Harui <ah...@apache.org>
Authored: Fri Oct 28 23:21:25 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:59:02 2016 -0700
----------------------------------------------------------------------
frameworks/projects/Core/src/main/flex/CoreClasses.as | 4 ----
1 file changed, 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1890b715/frameworks/projects/Core/src/main/flex/CoreClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/CoreClasses.as b/frameworks/projects/Core/src/main/flex/CoreClasses.as
index 325b36a..6be1c0b 100644
--- a/frameworks/projects/Core/src/main/flex/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/flex/CoreClasses.as
@@ -98,10 +98,6 @@ internal class CoreClasses
}
import org.apache.flex.core.SimpleStatesImpl; SimpleStatesImpl;
import org.apache.flex.core.DataBindingBase; DataBindingBase;
- COMPILE::SWF
- {
- import org.apache.flex.core.UIButtonBase; UIButtonBase;
- }
import org.apache.flex.events.CustomEvent; CustomEvent;
import org.apache.flex.events.Event; Event;
import org.apache.flex.events.ProgressEvent; ProgressEvent;
[05/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - try to
copy HTML to Basic without losing history
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGroup.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGroup.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGroup.as
new file mode 100644
index 0000000..15b6587
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGroup.as
@@ -0,0 +1,121 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import org.apache.flex.core.IContentView;
+ import org.apache.flex.core.IItemRenderer;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.IRollOverModel;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.ItemAddedEvent;
+ import org.apache.flex.events.ItemClickedEvent;
+ import org.apache.flex.events.ItemRemovedEvent;
+
+ /**
+ * The DataGroup class is the IItemRendererParent used internally
+ * by org.apache.flex.html.List class.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataGroup extends ContainerContentArea implements IItemRendererParent, IContentView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGroup()
+ {
+ super();
+ }
+
+ /**
+ * @private
+ */
+ override public function addElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ super.addElement(c, dispatchEvent);
+
+ var newEvent:ItemAddedEvent = new ItemAddedEvent("itemAdded");
+ newEvent.item = c;
+
+ var strand:IEventDispatcher = parent as IEventDispatcher;
+ strand.dispatchEvent(newEvent);
+ }
+
+ /**
+ * @private
+ */
+ override public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+ {
+ super.removeElement(c, dispatchEvent);
+
+ var newEvent:ItemRemovedEvent = new ItemRemovedEvent("itemRemoved");
+ newEvent.item = c;
+
+ var strand:IEventDispatcher = parent as IEventDispatcher;
+ strand.dispatchEvent(newEvent);
+ }
+
+ /**
+ * @copy org.apache.flex.core.IItemRendererParent#getItemRendererForIndex()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getItemRendererForIndex(index:int):IItemRenderer
+ {
+ if (index < 0 || index >= numElements) return null;
+ return getElementAt(index) as IItemRenderer;
+ }
+
+ /**
+ * Refreshes the itemRenderers. Useful after a size change by the data group.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function updateAllItemRenderers():void
+ {
+ var n:Number = numElements;
+ for (var i:Number = 0; i < n; i++)
+ {
+ var renderer:DataItemRenderer = getItemRendererForIndex(i) as DataItemRenderer;
+ if (renderer) {
+ renderer.setWidth(this.width,true);
+ renderer.adjustSize();
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataItemRenderer.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataItemRenderer.as
new file mode 100644
index 0000000..8b4ad5b
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataItemRenderer.as
@@ -0,0 +1,179 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ COMPILE::SWF
+ {
+ import flash.display.Sprite;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ import org.apache.flex.html.beads.controllers.ItemRendererMouseController;
+ }
+ import org.apache.flex.core.ValuesManager;
+
+ /**
+ * The DataItemRenderer class is the base class for most itemRenderers. This class
+ * extends org.apache.flex.html.supportClasses.UIItemRendererBase and
+ * includes row and column index values.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataItemRenderer extends UIItemRendererBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataItemRenderer()
+ {
+ super();
+ }
+
+ private var _columnIndex:int;
+
+ /**
+ * The index of the column the itemRenderer represents.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get columnIndex():int
+ {
+ return _columnIndex;
+ }
+ public function set columnIndex(value:int):void
+ {
+ _columnIndex = value;
+ }
+
+ private var _rowIndex:int;
+
+ /**
+ * The index of the row the itemRenderer represents.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get rowIndex():int
+ {
+ return _rowIndex;
+ }
+ public function set rowIndex(value:int):void
+ {
+ _rowIndex = value;
+ }
+
+ private var _dataField:String;
+
+ /**
+ * The name of the field within the data the itemRenderer should use.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dataField():String
+ {
+ return _dataField;
+ }
+ public function set dataField(value:String):void
+ {
+ _dataField = value;
+ }
+
+ COMPILE::SWF
+ private var background:Sprite;
+
+ COMPILE::JS
+ private var controller:ItemRendererMouseController;
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+
+ background = new Sprite();
+ addChild(background);
+ }
+
+ /**
+ * @private
+ */
+ override public function updateRenderer():void
+ {
+ COMPILE::SWF
+ {
+ super.updateRenderer();
+
+ background.graphics.clear();
+ background.graphics.beginFill(useColor, (down||selected||hovered)?1:0);
+ background.graphics.drawRect(0, 0, width, height);
+ background.graphics.endFill();
+ }
+ COMPILE::JS
+ {
+ if (selected)
+ element.style.backgroundColor = '#9C9C9C';
+ else if (hovered)
+ element.style.backgroundColor = '#ECECEC';
+ else
+ element.style.backgroundColor = null;
+ }
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ *
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('div') as WrappedHTMLElement;
+ positioner = element;
+ positioner.style.position = 'relative';
+
+ element.flexjs_wrapper = this;
+ className = 'DataItemRenderer';
+
+ controller = new ItemRendererMouseController();
+ controller.strand = this;
+
+ return element;
+ }
+
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DateChooserButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DateChooserButton.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DateChooserButton.as
new file mode 100644
index 0000000..f493a45
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DateChooserButton.as
@@ -0,0 +1,67 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import org.apache.flex.html.TextButton;
+
+ /**
+ * The DateChooserButton class is used for each button in the DateChooser. The
+ * button holds the day of the month the button is representing.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateChooserButton extends TextButton
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateChooserButton()
+ {
+ super();
+ className = "DateChooserButton";
+ }
+
+ private var _dayOfMonth:int;
+
+ /**
+ * The day of the month the button represents.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dayOfMonth():int
+ {
+ return _dayOfMonth;
+ }
+ public function set dayOfMonth(value:int):void
+ {
+ _dayOfMonth = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DateHeaderButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DateHeaderButton.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DateHeaderButton.as
new file mode 100644
index 0000000..4fbe70a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DateHeaderButton.as
@@ -0,0 +1,48 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import org.apache.flex.html.TextButton;
+
+ /**
+ * The DateHeaderButton class is used for the buttons in the DateChooser's
+ * heading areas.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateHeaderButton extends TextButton
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateHeaderButton()
+ {
+ super();
+ className = "DateHeaderButton";
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DropDownListList.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DropDownListList.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DropDownListList.as
new file mode 100644
index 0000000..6bc1d43
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DropDownListList.as
@@ -0,0 +1,63 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import org.apache.flex.core.IPopUp;
+ import org.apache.flex.html.SimpleList;
+ import org.apache.flex.html.beads.SolidBackgroundBead;
+
+ //--------------------------------------
+ // Events
+ //--------------------------------------
+
+ /**
+ * @copy org.apache.flex.core.ISelectionModel#change
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="change", type="org.apache.flex.events.Event")]
+
+ /**
+ * The DropDownListList class is the List class used internally
+ * by DropDownList as the dropdown/popup.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DropDownListList extends SimpleList implements IPopUp
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DropDownListList()
+ {
+ super();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/GraphicsItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/GraphicsItemRenderer.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/GraphicsItemRenderer.as
new file mode 100644
index 0000000..73bd8bd
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/GraphicsItemRenderer.as
@@ -0,0 +1,316 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import org.apache.flex.core.ISelectableItemRenderer;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.svg.CompoundGraphic;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.utils.MXMLDataInterpreter;
+
+ /**
+ * The GraphicsItemRenderer provides a base class for itemRenderers that use graphics rather than
+ * components.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class GraphicsItemRenderer extends CompoundGraphic implements ISelectableItemRenderer
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function GraphicsItemRenderer()
+ {
+ super();
+ }
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+
+ // very common for item renderers to be resized by their containers,
+ addEventListener("widthChanged", sizeChangeHandler);
+ addEventListener("heightChanged", sizeChangeHandler);
+
+ // each MXML file can also have styles in fx:Style block
+ ValuesManager.valuesImpl.init(this);
+
+ MXMLDataInterpreter.generateMXMLProperties(this, mxmlProperties);
+ MXMLDataInterpreter.generateMXMLInstances(this, this, MXMLDescriptor);
+
+ dispatchEvent(new Event("initBindings"));
+ dispatchEvent(new Event("initComplete"));
+
+ }
+
+ private var _labelField:String = "label";
+
+ /**
+ * The name of the field within the data to use as a label. Some itemRenderers use this field to
+ * identify the value they should show while other itemRenderers ignore this if they are showing
+ * complex information.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get labelField():String
+ {
+ return _labelField;
+ }
+ public function set labelField(value:String):void
+ {
+ _labelField = value;
+ }
+
+ private var _index:int;
+
+ /**
+ * The position with the dataProvider being shown by the itemRenderer instance.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get index():int
+ {
+ return _index;
+ }
+ public function set index(value:int):void
+ {
+ _index = value;
+ }
+
+ private var _selected:Boolean;
+
+ /**
+ * Whether or not the itemRenderer is in a selected state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selected():Boolean
+ {
+ return _selected;
+ }
+ public function set selected(value:Boolean):void
+ {
+ _selected = value;
+ updateRenderer();
+ }
+
+ private var _hovered:Boolean;
+
+ /**
+ * Whether or not the itemRenderer is in a hovered state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get hovered():Boolean
+ {
+ return _hovered;
+ }
+ public function set hovered(value:Boolean):void
+ {
+ _hovered = value;
+ updateRenderer();
+ }
+
+ private var _down:Boolean;
+
+ /**
+ * Whether or not the itemRenderer is in a down (or pre-selected) state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get down():Boolean
+ {
+ return _down;
+ }
+ public function set down(value:Boolean):void
+ {
+ _down = value;
+ updateRenderer();
+ }
+
+ private var _data:Object;
+
+ [Bindable("__NoChangeEvent__")]
+ /**
+ * The data being represented by this itemRenderer. This can be something simple like a String or
+ * a Number or something very complex.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get data():Object
+ {
+ return _data;
+ }
+ public function set data(value:Object):void
+ {
+ _data = value;
+ }
+
+ private var _listData:Object;
+
+ [Bindable("__NoChangeEvent__")]
+ /**
+ * Additional data about the list structure the itemRenderer may
+ * find useful.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get listData():Object
+ {
+ return _listData;
+ }
+ public function set listData(value:Object):void
+ {
+ _listData = value;
+ }
+
+ private var _dataField:String;
+
+ /**
+ * The name of the field within the data the itemRenderer should use.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dataField():String
+ {
+ return _dataField;
+ }
+ public function set dataField(value:String):void
+ {
+ _dataField = value;
+ }
+
+ private var _itemRendererParent:Object;
+
+ /**
+ * The parent container for the itemRenderer instance.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRendererParent():Object
+ {
+ return _itemRendererParent;
+ }
+ public function set itemRendererParent(value:Object):void
+ {
+ _itemRendererParent = value;
+ }
+
+ /**
+ * @private
+ */
+ public function updateRenderer():void
+ {
+// if (down)
+// backgroundColor = downColor;
+// else if (hovered)
+// backgroundColor = highlightColor;
+// else if (selected)
+// backgroundColor = selectedColor;
+ }
+
+ /**
+ * @copy org.apache.flex.core.ItemRendererClassFactory#mxmlContent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var mxmlContent:Array;
+
+ /**
+ * @private
+ */
+ public function get MXMLDescriptor():Array
+ {
+ return null;
+ }
+
+ private var mxmlProperties:Array ;
+
+ /**
+ * @private
+ */
+ public function generateMXMLAttributes(data:Array):void
+ {
+ mxmlProperties = data;
+ }
+
+ /**
+ * @private
+ */
+ private function sizeChangeHandler(event:Event):void
+ {
+ adjustSize();
+ }
+
+ /**
+ * This function is called whenever the itemRenderer changes size. Sub-classes should override
+ * this method an handle the size change.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function adjustSize():void
+ {
+ // handle in subclass
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/HScrollBar.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/HScrollBar.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/HScrollBar.as
new file mode 100644
index 0000000..0b56925
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/HScrollBar.as
@@ -0,0 +1,49 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import org.apache.flex.core.IChrome;
+ import org.apache.flex.core.IViewportScroller;
+
+ /**
+ * The ScrollBar class represents either a vertical or horizontal control
+ * that allows the user to quickly scan through a component that does not
+ * wholly fit within its container.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class HScrollBar extends ScrollBar implements IChrome, IViewportScroller
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function HScrollBar()
+ {
+ super();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/RadioButtonIcon.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/RadioButtonIcon.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/RadioButtonIcon.as
new file mode 100644
index 0000000..119400f
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/RadioButtonIcon.as
@@ -0,0 +1,111 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ COMPILE::JS {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The RadioButton class is a component that displays a selectable Button. RadioButtons
+ * are typically used in groups, identified by the groupName property. RadioButton use
+ * the following beads:
+ *
+ * org.apache.flex.core.IBeadModel: the data model, which includes the groupName.
+ * org.apache.flex.core.IBeadView: the bead that constructs the visual parts of the RadioButton..
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class RadioButtonIcon
+ {
+ public function RadioButtonIcon()
+ {
+ COMPILE::JS {
+ createElement();
+ }
+
+ className = 'RadioButtonIcon';
+ }
+
+ COMPILE::JS {
+ public var element:WrappedHTMLElement;
+ public var positioner:WrappedHTMLElement;
+ }
+
+ private var _className:String;
+
+ /**
+ * @private
+ */
+ public function get className():String
+ {
+ return _className;
+ }
+ public function set className(value:String):void
+ {
+ _className = value;
+
+ COMPILE::JS {
+ element.className = value;
+ }
+ }
+
+ private var _id:String;
+
+ /**
+ * @private
+ */
+ public function get id():String
+ {
+ return _id;
+ }
+ public function set id(value:String):void
+ {
+ _id = value;
+
+ COMPILE::JS {
+ element.id = value;
+ }
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion HTMLInputElement
+ * @flexjsignorecoercion Text
+ */
+ COMPILE::JS
+ protected function createElement():WrappedHTMLElement
+ {
+ var input:HTMLInputElement = document.createElement('input') as HTMLInputElement;
+ input.type = 'radio';
+
+ element = input as WrappedHTMLElement;
+
+ positioner = element;
+ positioner.style.position = 'relative';
+
+ (element as WrappedHTMLElement).flexjs_wrapper = this;
+
+ return element;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollBar.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollBar.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollBar.as
new file mode 100644
index 0000000..0bef2e6
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollBar.as
@@ -0,0 +1,50 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.IChrome;
+ import org.apache.flex.core.IViewportScroller;
+
+ /**
+ * The ScrollBar class represents either a vertical or horizontal control
+ * that allows the user to quickly scan through a component that does not
+ * wholly fit within its container.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ScrollBar extends UIBase implements IChrome, IViewportScroller
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ScrollBar()
+ {
+ super();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
new file mode 100644
index 0000000..d7c8d71
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
@@ -0,0 +1,351 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ COMPILE::SWF
+ {
+ import flash.geom.Rectangle;
+ }
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IContentViewHost;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.IViewport;
+ import org.apache.flex.core.IViewportModel;
+ COMPILE::SWF
+ {
+ import org.apache.flex.core.IViewportScroller;
+ }
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.geom.Size;
+ import org.apache.flex.html.beads.ScrollBarView;
+ import org.apache.flex.html.beads.models.ScrollBarModel;
+
+ /**
+ * The ScrollingViewport extends the Viewport class by adding horizontal and
+ * vertical scroll bars, if needed, to the content area of a Container. In
+ * addition, the content of the Container is clipped so that items extending
+ * outside the Container are hidden and reachable only by scrolling.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ScrollingViewport extends Viewport implements IBead, IViewport
+ {
+ /**
+ * Constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ScrollingViewport()
+ {
+ }
+
+ COMPILE::SWF
+ private var _verticalScroller:ScrollBar;
+
+ COMPILE::SWF
+ public function get verticalScroller():IViewportScroller
+ {
+ return _verticalScroller;
+ }
+
+ COMPILE::SWF
+ private var _horizontalScroller:ScrollBar
+
+ COMPILE::SWF
+ public function get horizontalScroller():IViewportScroller
+ {
+ return _horizontalScroller;
+ }
+
+ COMPILE::SWF
+ private var _verticalScrollPosition:Number = 0;
+
+ public function get verticalScrollPosition():Number
+ {
+ COMPILE::SWF
+ {
+ return _verticalScrollPosition;
+ }
+ COMPILE::JS
+ {
+ return this.contentView.positioner.scrollTop;
+ }
+ }
+ public function set verticalScrollPosition(value:Number):void
+ {
+ COMPILE::SWF
+ {
+ _verticalScrollPosition = value;
+ handleVerticalScrollChange();
+ }
+ COMPILE::JS
+ {
+ this.contentView.positioner.scrollTop = value;
+ }
+ }
+
+ COMPILE::SWF
+ private var _horizontalScrollPosition:Number = 0;
+
+ public function get horizontalScrollPosition():Number
+ {
+ COMPILE::SWF
+ {
+ return _horizontalScrollPosition;
+ }
+ COMPILE::JS
+ {
+ return this.contentView.positioner.scrollLeft;
+ }
+ }
+ public function set horizontalScrollPosition(value:Number):void
+ {
+ COMPILE::SWF
+ {
+ _horizontalScrollPosition = value;
+ handleHorizontalScrollChange();
+ }
+ COMPILE::JS
+ {
+ this.contentView.positioner.scrollLeft = value;
+ }
+ }
+
+ COMPILE::JS
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ contentView.element.style.overflow = 'auto';
+ }
+
+ private var viewportWidth:Number;
+ private var viewportHeight:Number;
+
+ /**
+ * @copy org.apache.flex.core.IViewport
+ */
+ override public function layoutViewportBeforeContentLayout(width:Number, height:Number):void
+ {
+ super.layoutViewportBeforeContentLayout(width, height);
+ viewportWidth = width;
+ viewportHeight = height;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IViewport
+ */
+ override public function layoutViewportAfterContentLayout():Size
+ {
+ COMPILE::SWF
+ {
+ var hadV:Boolean = _verticalScroller != null && _verticalScroller.visible;
+ var hadH:Boolean = _horizontalScroller != null && _horizontalScroller.visible;
+ var contentSize:Size;
+ do
+ {
+ contentSize = super.layoutViewportAfterContentLayout();
+ if (isNaN(viewportHeight))
+ viewportHeight = contentSize.height;
+ if (isNaN(viewportWidth))
+ viewportWidth = contentSize.width;
+
+ var host:UIBase = UIBase(_strand);
+ var visibleWidth:Number;
+ var visibleHeight:Number;
+ var needV:Boolean = contentSize.height > viewportHeight;
+ var needH:Boolean = contentSize.width > viewportWidth;
+
+ if (needV)
+ {
+ if (_verticalScroller == null) {
+ _verticalScroller = createVerticalScrollBar();
+ (host as IContentViewHost).strandChildren.addElement(_verticalScroller);
+ }
+ }
+ if (needH)
+ {
+ if (_horizontalScroller == null) {
+ _horizontalScroller = createHorizontalScrollBar();
+ (host as IContentViewHost).strandChildren.addElement(_horizontalScroller);
+ }
+ }
+
+ if (needV)
+ {
+ _verticalScroller.visible = true;
+ _verticalScroller.x = contentArea.x + viewportWidth - _verticalScroller.width;
+ _verticalScroller.y = contentArea.y;
+ _verticalScroller.setHeight(viewportHeight - (needH ? _horizontalScroller.height : 0), true);
+ visibleWidth = _verticalScroller.x;
+ }
+ else if (_verticalScroller)
+ _verticalScroller.visible = false;
+
+ if (needH)
+ {
+ _horizontalScroller.visible = true;
+ _horizontalScroller.x = contentArea.x;
+ _horizontalScroller.y = contentArea.y + viewportHeight - _horizontalScroller.height;
+ _horizontalScroller.setWidth(viewportWidth - (needV ? _verticalScroller.width : 0), true);
+ visibleHeight = _horizontalScroller.y;
+ }
+
+ var needsLayout:Boolean = false;
+ // resize content area if needed to get out from under scrollbars
+ if (!isNaN(visibleWidth) || !isNaN(visibleHeight))
+ {
+ if (!isNaN(visibleWidth))
+ needsLayout = visibleWidth != contentView.width;
+ if (!isNaN(visibleHeight))
+ needsLayout = visibleHeight != contentView.height;
+ if (!isNaN(visibleWidth) && !isNaN(visibleHeight))
+ contentArea.setWidthAndHeight(visibleWidth, visibleHeight, false);
+ else if (!isNaN(visibleWidth))
+ contentArea.setWidth(visibleWidth, false);
+ else if (!isNaN(visibleHeight))
+ contentArea.setHeight(visibleHeight, false);
+ }
+ if (needsLayout)
+ {
+ var layout:IBeadLayout = host.getBeadByType(IBeadLayout) as IBeadLayout;
+ layout.layout();
+ }
+ } while (needsLayout && (needV != hadV || needH == hadH));
+ if (_verticalScroller)
+ {
+ ScrollBarModel(_verticalScroller.model).maximum = contentSize.height;
+ ScrollBarModel(_verticalScroller.model).pageSize = contentArea.height;
+ ScrollBarModel(_verticalScroller.model).pageStepSize = contentArea.height;
+ if (contentSize.height > contentArea.height &&
+ (contentSize.height - contentArea.height) < _verticalScrollPosition)
+ _verticalScrollPosition = contentSize.height - contentArea.height;
+ }
+ if (_horizontalScroller)
+ {
+ ScrollBarModel(_horizontalScroller.model).maximum = contentSize.width;
+ ScrollBarModel(_horizontalScroller.model).pageSize = contentArea.width;
+ ScrollBarModel(_horizontalScroller.model).pageStepSize = contentArea.width;
+ if (contentSize.width > contentArea.width &&
+ (contentSize.width - contentArea.width) < _horizontalScrollPosition)
+ _horizontalScrollPosition = contentSize.width - contentArea.width;
+ }
+
+ var rect:Rectangle = new Rectangle(_horizontalScrollPosition, _verticalScrollPosition,
+ (_verticalScroller != null && _verticalScroller.visible) ?
+ _verticalScroller.x : viewportWidth,
+ (_horizontalScroller != null && _horizontalScroller.visible) ?
+ _horizontalScroller.y : viewportHeight);
+ contentArea.scrollRect = rect;
+ return contentSize;
+
+ }
+ COMPILE::JS
+ {
+ return new Size(contentView.width, contentView.height);
+ }
+
+ }
+
+ COMPILE::SWF
+ private function createVerticalScrollBar():ScrollBar
+ {
+ var vsbm:ScrollBarModel = new ScrollBarModel();
+ vsbm.minimum = 0;
+ vsbm.snapInterval = 1;
+ vsbm.stepSize = 1;
+ vsbm.value = 0;
+
+ var vsb:VScrollBar;
+ vsb = new VScrollBar();
+ vsb.model = vsbm;
+ vsb.visible = false;
+
+ vsb.addEventListener("scroll",handleVerticalScroll);
+ return vsb;
+ }
+
+ COMPILE::SWF
+ private function createHorizontalScrollBar():ScrollBar
+ {
+ var hsbm:ScrollBarModel = new ScrollBarModel();
+ hsbm.minimum = 0;
+ hsbm.snapInterval = 1;
+ hsbm.stepSize = 1;
+ hsbm.value = 0;
+
+ var hsb:HScrollBar;
+ hsb = new HScrollBar();
+ hsb.model = hsbm;
+ hsb.visible = false;
+
+ hsb.addEventListener("scroll",handleHorizontalScroll);
+ return hsb;
+ }
+
+ COMPILE::SWF
+ private function handleVerticalScroll(event:Event):void
+ {
+ var host:UIBase = UIBase(_strand);
+ var vpos:Number = ScrollBarModel(_verticalScroller.model).value;
+ var rect:Rectangle = contentArea.scrollRect;
+ rect.y = vpos;
+ contentArea.scrollRect = rect;
+
+ _verticalScrollPosition = vpos;
+ }
+
+ COMPILE::SWF
+ private function handleHorizontalScroll(event:Event):void
+ {
+ var host:UIBase = UIBase(_strand);
+ var hpos:Number = ScrollBarModel(_horizontalScroller.model).value;
+ var rect:Rectangle = contentArea.scrollRect;
+ rect.x = hpos;
+ contentArea.scrollRect = rect;
+
+ _horizontalScrollPosition = hpos;
+ }
+
+ COMPILE::SWF
+ private function handleVerticalScrollChange():void
+ {
+ if (_verticalScroller) {
+ ScrollBarModel(_verticalScroller.model).value = verticalScrollPosition;
+ }
+ }
+
+ COMPILE::SWF
+ private function handleHorizontalScrollChange():void
+ {
+ if (_horizontalScroller) {
+ ScrollBarModel(_horizontalScroller.model).value = horizontalScrollPosition;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/SpinnerButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/SpinnerButton.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/SpinnerButton.as
new file mode 100644
index 0000000..f03b527
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/SpinnerButton.as
@@ -0,0 +1,31 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import org.apache.flex.html.TextButton;
+
+ public class SpinnerButton extends TextButton
+ {
+ public function SpinnerButton()
+ {
+ super();
+ className = 'SpinnerButton';
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/StringItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/StringItemRenderer.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/StringItemRenderer.as
new file mode 100644
index 0000000..b897012
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/StringItemRenderer.as
@@ -0,0 +1,180 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ COMPILE::SWF
+ {
+ import flash.text.TextFieldAutoSize;
+ import flash.text.TextFieldType;
+
+ import org.apache.flex.core.CSSTextField;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ import org.apache.flex.html.beads.controllers.ItemRendererMouseController;
+ }
+ import org.apache.flex.events.Event;
+ import org.apache.flex.html.beads.ITextItemRenderer;
+
+ /**
+ * The StringItemRenderer class displays data in string form using the data's toString()
+ * function.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class StringItemRenderer extends DataItemRenderer implements ITextItemRenderer
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function StringItemRenderer()
+ {
+ super();
+
+ COMPILE::SWF
+ {
+ textField = new CSSTextField();
+ textField.type = TextFieldType.DYNAMIC;
+ textField.autoSize = TextFieldAutoSize.LEFT;
+ textField.selectable = false;
+ textField.parentDrawsBackground = true;
+ }
+ }
+
+ COMPILE::SWF
+ public var textField:CSSTextField;
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+
+ addChild(textField);
+
+ adjustSize();
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ override public function adjustSize():void
+ {
+ var cy:Number = height/2;
+
+ textField.x = 0;
+ textField.y = cy - textField.height/2;
+ textField.width = width;
+
+ updateRenderer();
+ }
+
+ /**
+ * The text currently displayed by the itemRenderer instance.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ COMPILE::SWF
+ {
+ return textField.text;
+ }
+ COMPILE::JS
+ {
+ return this.element.innerHTML;
+ }
+ }
+
+ public function set text(value:String):void
+ {
+ COMPILE::SWF
+ {
+ textField.text = value;
+ }
+ COMPILE::JS
+ {
+ this.element.innerHTML = value;
+ }
+ }
+
+ /**
+ * Sets the data value and uses the String version of the data for display.
+ *
+ * @param Object data The object being displayed by the itemRenderer instance.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set data(value:Object):void
+ {
+ super.data = value;
+ var text:String;
+ if (labelField) text = String(value[labelField]);
+ else if (dataField) text = String(value[dataField]);
+ else text = String(value);
+
+ this.text = text;
+ }
+
+ COMPILE::JS
+ private var controller:ItemRendererMouseController;
+
+ COMPILE::JS
+ private var backgroundView:WrappedHTMLElement;
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('div') as WrappedHTMLElement;
+ positioner = element;
+ positioner.style.position = 'relative';
+
+ element.flexjs_wrapper = this;
+ className = 'StringItemRenderer';
+
+ // itemRenderers should provide something for the background to handle
+ // the selection and highlight
+ backgroundView = element;
+
+ return element;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as
new file mode 100644
index 0000000..5908d73
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as
@@ -0,0 +1,560 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import flash.text.TextFieldType;
+
+ import org.apache.flex.core.CSSTextField;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IFlexJSElement;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.utils.MouseEventConverter;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.html.beads.ITextItemRenderer;
+ import org.apache.flex.utils.CSSContainerUtils;
+
+ /**
+ * The TextFieldItemRenderer class provides a org.apache.flex.html.TextField as an itemRenderer.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextFieldItemRenderer extends CSSTextField implements ITextItemRenderer, IStrand, IUIBase, IFlexJSElement
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TextFieldItemRenderer()
+ {
+ super();
+ type = TextFieldType.DYNAMIC;
+ selectable = false;
+
+ MouseEventConverter.setupInstanceConverters(this);
+ }
+
+ public var highlightColor:uint = 0xCEDBEF;
+ public var selectedColor:uint = 0xA8C6EE;
+ public var downColor:uint = 0x808080;
+
+ private var _explicitWidth:Number;
+
+ /**
+ * The explicitly set width (as opposed to measured width
+ * or percentage width).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get explicitWidth():Number
+ {
+ if (isNaN(_explicitWidth))
+ {
+ var value:* = ValuesManager.valuesImpl.getValue(this, "width");
+ if (value !== undefined) {
+ _explicitWidth = Number(value);
+ }
+ }
+
+ return _explicitWidth;
+ }
+
+ /**
+ * @private
+ */
+ public function set explicitWidth(value:Number):void
+ {
+ if (_explicitWidth == value)
+ return;
+
+ // width can be pixel or percent not both
+ if (!isNaN(value))
+ _percentWidth = NaN;
+
+ _explicitWidth = value;
+
+ dispatchEvent(new Event("explicitWidthChanged"));
+ }
+
+ private var _explicitHeight:Number;
+
+ /**
+ * The explicitly set width (as opposed to measured width
+ * or percentage width).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get explicitHeight():Number
+ {
+ if (isNaN(_explicitHeight))
+ {
+ var value:* = ValuesManager.valuesImpl.getValue(this, "height");
+ if (value !== undefined) {
+ _explicitHeight = Number(value);
+ }
+ }
+
+ return _explicitHeight;
+ }
+
+ /**
+ * @private
+ */
+ public function set explicitHeight(value:Number):void
+ {
+ if (_explicitHeight == value)
+ return;
+
+ // height can be pixel or percent not both
+ if (!isNaN(value))
+ _percentHeight = NaN;
+
+ _explicitHeight = value;
+
+ dispatchEvent(new Event("explicitHeightChanged"));
+ }
+
+ private var _percentWidth:Number;
+
+ /**
+ * The requested percentage width this component
+ * should have in the parent container. Note that
+ * the actual percentage may be different if the
+ * total is more than 100% or if there are other
+ * components with explicitly set widths.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get percentWidth():Number
+ {
+ return _percentWidth;
+ }
+
+ /**
+ * @private
+ */
+ public function set percentWidth(value:Number):void
+ {
+ if (_percentWidth == value)
+ return;
+
+ if (!isNaN(value))
+ _explicitWidth = NaN;
+
+ _percentWidth = value;
+
+ dispatchEvent(new Event("percentWidthChanged"));
+ }
+
+ private var _percentHeight:Number;
+
+ /**
+ * The requested percentage height this component
+ * should have in the parent container. Note that
+ * the actual percentage may be different if the
+ * total is more than 100% or if there are other
+ * components with explicitly set heights.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get percentHeight():Number
+ {
+ return _percentHeight;
+ }
+
+ /**
+ * @private
+ */
+ public function set percentHeight(value:Number):void
+ {
+ if (_percentHeight == value)
+ return;
+
+ if (!isNaN(value))
+ _explicitHeight = NaN;
+
+ _percentHeight = value;
+
+ dispatchEvent(new Event("percentHeightChanged"));
+ }
+
+ private var _width:Number;
+
+ /**
+ * @private
+ */
+ override public function get width():Number
+ {
+ if (isNaN(explicitWidth))
+ {
+ var w:Number = _width;
+ if (isNaN(w)) w = $width;
+ var metrics:Rectangle = CSSContainerUtils.getBorderAndPaddingMetrics(this);
+ return w + metrics.left + metrics.right;
+ }
+ else
+ return explicitWidth;
+ }
+ override public function set width(value:Number):void
+ {
+ if (explicitWidth != value)
+ {
+ explicitWidth = value;
+ }
+
+ if (value != _width) {
+ _width = value;
+ dispatchEvent( new Event("widthChanged") );
+ }
+ }
+
+ /**
+ * @private
+ */
+ protected function get $width():Number
+ {
+ return super.width;
+ }
+
+ private var _height:Number;
+
+ /**
+ * @private
+ */
+ override public function get height():Number
+ {
+ if (isNaN(explicitHeight))
+ {
+ var h:Number = _height;
+ if (isNaN(h)) h = $height;
+ var metrics:Rectangle = CSSContainerUtils.getBorderAndPaddingMetrics(this);
+ return h + metrics.top + metrics.bottom;
+ }
+ else
+ return explicitHeight;
+ }
+
+ override public function set height(value:Number):void
+ {
+ if (explicitHeight != value)
+ {
+ explicitHeight = value;
+ }
+
+ if (_height != value) {
+ _height = value;
+ dispatchEvent(new Event("heightChanged"));
+ }
+ }
+
+ /**
+ * @private
+ */
+ protected function get $height():Number
+ {
+ return super.height;
+ }
+
+ /**
+ * The String(data) for the itemRenderer instance.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get data():Object
+ {
+ return text;
+ }
+ public function set data(value:Object):void
+ {
+ text = String(value);
+ }
+
+ private var _listData:Object;
+
+ /**
+ * Additional data about the list the itemRenderer may find useful.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get listData():Object
+ {
+ return _listData;
+ }
+ public function set listData(value:Object):void
+ {
+ _listData = value;
+ }
+
+ /**
+ * @private
+ */
+ public function get labelField():String
+ {
+ return null;
+ }
+ public function set labelField(value:String):void
+ {
+ // nothing to do for this
+ }
+
+ private var _index:int;
+
+ /**
+ * An index value for the itemRenderer corresponding the data's position with its dataProvider.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get index():int
+ {
+ return _index;
+ }
+ public function set index(value:int):void
+ {
+ _index = value;
+ }
+
+ private var _hovered:Boolean;
+
+ /**
+ * Returns whether or not the itemRenderer is a "hovered" state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get hovered():Boolean
+ {
+ return _hovered;
+ }
+ public function set hovered(value:Boolean):void
+ {
+ _hovered = value;
+ updateRenderer();
+ }
+
+ private var _selected:Boolean;
+
+ /**
+ * Whether or not the itemRenderer should be represented in a selected state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selected():Boolean
+ {
+ return _selected;
+ }
+ public function set selected(value:Boolean):void
+ {
+ _selected = value;
+ updateRenderer();
+ }
+
+ private var _down:Boolean;
+
+ /**
+ * Whether or not the itemRenderer should be represented in a down (or pre-selected) state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get down():Boolean
+ {
+ return _down;
+ }
+ public function set down(value:Boolean):void
+ {
+ _down = value;
+ updateRenderer();
+ }
+
+ private var _itemRendererParent:Object;
+
+ /**
+ * The parent component of the itemRenderer instance. This is the container that houses
+ * all of the itemRenderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRendererParent():Object
+ {
+ return _itemRendererParent;
+ }
+ public function set itemRendererParent(value:Object):void
+ {
+ _itemRendererParent = value;
+ }
+
+ /**
+ * @private
+ */
+ public function updateRenderer():void
+ {
+ background = (down || selected || hovered);
+ if (down)
+ backgroundColor = downColor;
+ else if (hovered)
+ backgroundColor = highlightColor;
+ else if (selected)
+ backgroundColor = selectedColor;
+ }
+
+ /**
+ * @private
+ */
+ public function get element():IFlexJSElement
+ {
+ return this;
+ }
+
+ // beads declared in MXML are added to the strand.
+ // from AS, just call addBead()
+ public var beads:Array;
+
+ private var _beads:Vector.<IBead>;
+
+ /**
+ * @private
+ */
+ public function addBead(bead:IBead):void
+ {
+ if (!_beads)
+ _beads = new Vector.<IBead>;
+ _beads.push(bead);
+ bead.strand = this;
+ }
+
+ /**
+ * @private
+ */
+ public function getBeadByType(classOrInterface:Class):IBead
+ {
+ for each (var bead:IBead in _beads)
+ {
+ if (bead is classOrInterface)
+ return bead;
+ }
+ return null;
+ }
+
+ /**
+ * @private
+ */
+ public function removeBead(value:IBead):IBead
+ {
+ var n:int = _beads.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var bead:IBead = _beads[i];
+ if (bead == value)
+ {
+ _beads.splice(i, 1);
+ return bead;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @private
+ */
+ public function addedToParent():void
+ {
+ var c:Class;
+
+ for each (var bead:IBead in beads)
+ addBead(bead);
+
+ dispatchEvent(new Event("beadsAdded"));
+
+ // renderer has a default model (the 'data' property)
+ // and it is essentially a view of that model, so it
+ // only needs an assignable controller
+
+ if (getBeadByType(IBeadController) == null)
+ {
+ c = ValuesManager.valuesImpl.getValue(this, "iBeadController") as Class;
+ if (c)
+ {
+ var controller:IBeadController = new c as IBeadController;
+ if (controller)
+ addBead(controller);
+ }
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.core.IUIBase#topMostEventDispatcher
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get topMostEventDispatcher():IEventDispatcher
+ {
+ if (!parent)
+ return null;
+ return IUIBase(parent).topMostEventDispatcher;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/TreeItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/TreeItemRenderer.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/TreeItemRenderer.as
new file mode 100644
index 0000000..7250e82
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/TreeItemRenderer.as
@@ -0,0 +1,64 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ public class TreeItemRenderer extends StringItemRenderer
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TreeItemRenderer()
+ {
+ super();
+ }
+
+ /**
+ * Sets the data for the itemRenderer instance along with the listData
+ * (TreeListData).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set data(value:Object):void
+ {
+ super.data = value;
+
+ var treeData:TreeListData = listData as TreeListData;
+ var indentSpace:String = " ";
+
+ COMPILE::JS {
+ indentSpace = " "
+ }
+
+ var indent:String = treeData.hasChildren ? (treeData.isOpen ? "\u25bc" : "\u25b6") : " ";
+ for (var i:int=0; i < treeData.depth; i++) {
+ indent += indentSpace;
+ }
+
+ this.text = indent + this.text;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/TreeListData.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/TreeListData.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/TreeListData.as
new file mode 100644
index 0000000..c6da4d5
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/TreeListData.as
@@ -0,0 +1,76 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ /**
+ * The TreeListData class contains information that Tree item renderers may
+ * find useful when displaying the data for a node in the tree.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignoreimport goog.events.Event
+ */
+ public class TreeListData
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TreeListData()
+ {
+ }
+
+ /**
+ * The depth of the data within the tree with the root being zero.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var depth:Number;
+
+ /**
+ * Whether or not the node for this data is open (and its children
+ * visible).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var isOpen:Boolean;
+
+ /**
+ * Whether or not the node for this data has any children.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var hasChildren:Boolean;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/UIItemRendererBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/UIItemRendererBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/UIItemRendererBase.as
new file mode 100644
index 0000000..f253bd2
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/UIItemRendererBase.as
@@ -0,0 +1,303 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import org.apache.flex.core.ISelectableItemRenderer;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.utils.MXMLDataInterpreter;
+
+ [DefaultProperty("mxmlContent")]
+
+ /**
+ * The UIItemRendererBase class is the base class for all itemRenderers. An itemRenderer is used to
+ * display a single datum within a collection of data. Components such as a List use itemRenderers to
+ * show their dataProviders.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class UIItemRendererBase extends UIBase implements ISelectableItemRenderer
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function UIItemRendererBase()
+ {
+ }
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+
+ // very common for item renderers to be resized by their containers,
+ addEventListener("widthChanged", sizeChangeHandler);
+ addEventListener("heightChanged", sizeChangeHandler);
+ addEventListener("sizeChanged", sizeChangeHandler);
+
+ // each MXML file can also have styles in fx:Style block
+ ValuesManager.valuesImpl.init(this);
+
+ MXMLDataInterpreter.generateMXMLProperties(this, mxmlProperties);
+ MXMLDataInterpreter.generateMXMLInstances(this, this, MXMLDescriptor);
+
+ dispatchEvent(new Event("initBindings"));
+ dispatchEvent(new Event("initComplete"));
+
+ }
+
+ private var _itemRendererParent:Object;
+
+ /**
+ * The parent container for the itemRenderer instance.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRendererParent():Object
+ {
+ return _itemRendererParent;
+ }
+ public function set itemRendererParent(value:Object):void
+ {
+ _itemRendererParent = value;
+ }
+
+ /**
+ * @copy org.apache.flex.core.ItemRendererClassFactory#mxmlContent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var mxmlContent:Array;
+
+ /**
+ * @private
+ */
+ public function get MXMLDescriptor():Array
+ {
+ return null;
+ }
+
+ private var mxmlProperties:Array ;
+
+ /**
+ * @private
+ */
+ public function generateMXMLAttributes(data:Array):void
+ {
+ mxmlProperties = data;
+ }
+
+ public var backgroundColor:uint = 0xFFFFFF;
+ public var highlightColor:uint = 0xCEDBEF;
+ public var selectedColor:uint = 0xA8C6EE;
+ public var downColor:uint = 0x808080;
+ protected var useColor:uint = backgroundColor;
+
+ private var _data:Object;
+
+ [Bindable("__NoChangeEvent__")]
+ /**
+ * The data being represented by this itemRenderer. This can be something simple like a String or
+ * a Number or something very complex.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get data():Object
+ {
+ return _data;
+ }
+ public function set data(value:Object):void
+ {
+ _data = value;
+ }
+
+ private var _listData:Object;
+
+ [Bindable("__NoChangeEvent__")]
+ /**
+ * Additional data about the list structure the itemRenderer may
+ * find useful.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get listData():Object
+ {
+ return _listData;
+ }
+ public function set listData(value:Object):void
+ {
+ _listData = value;
+ }
+
+ private var _labelField:String = "label";
+
+ /**
+ * The name of the field within the data to use as a label. Some itemRenderers use this field to
+ * identify the value they should show while other itemRenderers ignore this if they are showing
+ * complex information.
+ */
+ public function get labelField():String
+ {
+ return _labelField;
+ }
+ public function set labelField(value:String):void
+ {
+ _labelField = value;
+ }
+
+ private var _index:int;
+
+ /**
+ * The position with the dataProvider being shown by the itemRenderer instance.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get index():int
+ {
+ return _index;
+ }
+ public function set index(value:int):void
+ {
+ _index = value;
+ }
+
+ private var _hovered:Boolean;
+
+ /**
+ * Whether or not the itemRenderer is in a hovered state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get hovered():Boolean
+ {
+ return _hovered;
+ }
+ public function set hovered(value:Boolean):void
+ {
+ _hovered = value;
+ updateRenderer();
+ }
+
+ private var _selected:Boolean;
+
+ /**
+ * Whether or not the itemRenderer is in a selected state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selected():Boolean
+ {
+ return _selected;
+ }
+ public function set selected(value:Boolean):void
+ {
+ _selected = value;
+ updateRenderer();
+ }
+
+ private var _down:Boolean;
+
+ /**
+ * Whether or not the itemRenderer is in a down (or pre-selected) state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get down():Boolean
+ {
+ return _down;
+ }
+ public function set down(value:Boolean):void
+ {
+ _down = value;
+ updateRenderer();
+ }
+
+ /**
+ * @private
+ */
+ public function updateRenderer():void
+ {
+ if (down)
+ useColor = downColor;
+ else if (hovered)
+ useColor = highlightColor;
+ else if (selected)
+ useColor = selectedColor;
+ else
+ useColor = backgroundColor;
+ }
+
+ /**
+ * @private
+ */
+ private function sizeChangeHandler(event:Event):void
+ {
+ adjustSize();
+ }
+
+ /**
+ * This function is called whenever the itemRenderer changes size. Sub-classes should override
+ * this method an handle the size change.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function adjustSize():void
+ {
+ // handle in subclass
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/VScrollBar.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/VScrollBar.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/VScrollBar.as
new file mode 100644
index 0000000..a72c64c
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/VScrollBar.as
@@ -0,0 +1,49 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import org.apache.flex.core.IChrome;
+ import org.apache.flex.core.IViewportScroller;
+
+ /**
+ * The ScrollBar class represents either a vertical or horizontal control
+ * that allows the user to quickly scan through a component that does not
+ * wholly fit within its container.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VScrollBar extends ScrollBar implements IChrome, IViewportScroller
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function VScrollBar()
+ {
+ super();
+ }
+ }
+}
[32/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - move
more UIBase to HTML
Posted by ah...@apache.org.
move more UIBase to HTML
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/7af78c10
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/7af78c10
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/7af78c10
Branch: refs/heads/refactor-sprite
Commit: 7af78c10981886b14f7f067b5083b756beccad86
Parents: 6622b25
Author: Alex Harui <ah...@apache.org>
Authored: Fri Oct 28 23:17:40 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:55:20 2016 -0700
----------------------------------------------------------------------
.../src/main/flex/org/apache/flex/svg/Circle.as | 119 ----
.../flex/org/apache/flex/svg/CompoundGraphic.as | 584 -------------------
.../main/flex/org/apache/flex/svg/Ellipse.as | 171 ------
.../flex/org/apache/flex/svg/GraphicShape.as | 233 --------
.../src/main/flex/org/apache/flex/svg/Path.as | 133 -----
.../src/main/flex/org/apache/flex/svg/Rect.as | 156 -----
.../src/main/flex/org/apache/flex/svg/Text.as | 150 -----
.../src/main/flex/org/apache/flex/svg/Circle.as | 119 ++++
.../flex/org/apache/flex/svg/CompoundGraphic.as | 584 +++++++++++++++++++
.../main/flex/org/apache/flex/svg/Ellipse.as | 171 ++++++
.../flex/org/apache/flex/svg/GraphicShape.as | 233 ++++++++
.../src/main/flex/org/apache/flex/svg/Path.as | 133 +++++
.../src/main/flex/org/apache/flex/svg/Rect.as | 156 +++++
.../src/main/flex/org/apache/flex/svg/Text.as | 150 +++++
14 files changed, 1546 insertions(+), 1546 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7af78c10/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Circle.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Circle.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Circle.as
deleted file mode 100644
index 07cc3d5..0000000
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Circle.as
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flex.svg
-{
- import org.apache.flex.graphics.ICircle;
-
- COMPILE::SWF
- {
- import flash.display.Graphics;
- import flash.geom.Point;
- import flash.geom.Rectangle;
- }
- COMPILE::JS
- {
- import org.apache.flex.core.WrappedHTMLElement;
- }
-
- public class Circle extends GraphicShape implements ICircle
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.7
- */
- public function Circle(cx:Number=0, cy:Number=0, r:Number=0)
- {
- x = cx;
- y = cy;
- radius = r;
- }
-
- private var _radius:Number;
-
- public function get radius():Number
- {
- return _radius;
- }
-
- public function set radius(value:Number):void
- {
- _radius = value;
- }
-
- COMPILE::JS
- private var _circle:WrappedHTMLElement;
-
- /**
- * Draw the circle.
- * @param cx The x location of the center of the circle
- * @param cy The y location of the center of the circle.
- * @param radius The radius of the circle.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- * @flexjsignorecoercion SVGCircleElement
- */
- public function drawCircle(cx:Number, cy:Number, radius):void
- {
- COMPILE::SWF
- {
- $sprite.graphics.clear();
- applyStroke();
- beginFill(new Rectangle(cx,cy,radius*2, radius*2),new Point(cx-radius,cy-radius));
- $sprite.graphics.drawCircle(cx+radius,cy+radius,radius);
- endFill();
- }
- COMPILE::JS
- {
- var style:String = getStyleStr();
-
- if (_circle == null) {
- _circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle') as WrappedHTMLElement;
- _circle.flexjs_wrapper = this;
- element.appendChild(_circle);
- }
- _circle.setAttribute('style', style);
- if (stroke)
- {
- _circle.setAttribute('cx', radius + stroke.weight);
- _circle.setAttribute('cy', radius + stroke.weight);
- }
- else
- {
- _circle.setAttribute('cx', radius);
- _circle.setAttribute('cy', radius);
- }
-
- _circle.setAttribute('r', radius);
-
- resize(x-radius, y-radius, (_circle as SVGCircleElement).getBBox());
-
- }
- }
-
- override protected function draw():void
- {
- drawCircle(0, 0, radius);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7af78c10/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/CompoundGraphic.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/CompoundGraphic.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/CompoundGraphic.as
deleted file mode 100644
index 351f871..0000000
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/CompoundGraphic.as
+++ /dev/null
@@ -1,584 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flex.svg
-{
- import org.apache.flex.graphics.ICompoundGraphic;
- import org.apache.flex.graphics.IFill;
- import org.apache.flex.graphics.IStroke;
- import org.apache.flex.graphics.PathBuilder;
- import org.apache.flex.graphics.SolidColor;
-
- COMPILE::SWF
- {
- import flash.display.GraphicsPath;
- import flash.display.Shape;
- import flash.display.Sprite;
- import flash.geom.Point;
- import flash.geom.Rectangle;
- import flash.text.TextFieldType;
-
- import org.apache.flex.core.CSSTextField;
- import org.apache.flex.graphics.utils.PathHelper;
- }
- COMPILE::JS
- {
- import org.apache.flex.core.WrappedHTMLElement;
- }
-
- /**
- * CompoundGraphic is a surface on which you can
- * draw various graphic elements such as Rect, Circle,
- * Ellipse, Path etc.
- * Use this class if you want to draw multiple graphic
- * shapes on a single container.
- *
- */
- public class CompoundGraphic extends GraphicShape implements ICompoundGraphic
- {
- private var _textFill:IFill;
-
- public function get textFill():IFill
- {
- return _textFill;
- }
- /**
- * The color of the text.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion FlexJS 0.0
- */
- public function set textFill(value:IFill):void
- {
- _textFill = value;
- }
-
- private var _textStroke:IStroke;
-
- public function get textStroke():IStroke
- {
- return _textStroke;
- }
- /**
- * The stroke color of the text.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion FlexJS 0.0
- */
- public function set textStroke(value:IStroke):void
- {
- _textStroke = value;
- }
-
- /**
- * Removes all of the drawn elements of the container.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0.3
- */
- public function removeAllElements():void
- {
- clear();
- }
-
- /**
- * Clears all of the drawn path data.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.7.0
- */
- public function clear():void
- {
- COMPILE::SWF
- {
- $sprite.graphics.clear();
- $sprite.removeChildren();
- }
- COMPILE::JS
- {
- var svg:HTMLElement = element;
- while (svg.lastChild) {
- svg.removeChild(svg.lastChild);
- }
- }
- }
-
- /**
- * Draw the rectangle.
- * @param x The x position of the top-left corner of the rectangle.
- * @param y The y position of the top-left corner.
- * @param width The width of the rectangle.
- * @param height The height of the rectangle.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0.3
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- public function drawRect(x:Number, y:Number, width:Number, height:Number):void
- {
- COMPILE::SWF
- {
- applyStroke();
- beginFill(new Rectangle(x, y, width, height), new Point(x,y) );
- $sprite.graphics.drawRect(x, y, width, height);
- endFill();
- }
- COMPILE::JS
- {
- drawRoundRect(x, y, width, height, NaN);
- }
- }
-
- /**
- * Draws a rounded rectangle.
- * Note: The radius values are different than the Flash API of the same name. Flash uses diameter instead of radius.
- * @param x The x position of the top-left corner of the rectangle.
- * @param y The y position of the top-left corner.
- * @param width The width of the rectangle.
- * @param height The height of the rectangle.
- * @param radiusX The horizontal radius of the rounded corners (in pixels).
- * @param radiusY The vertical radius of the rounded corners (in pixels). Optional; if no value is specified, the default value matches that provided for the <code>radiusX</code> parameter.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0.3
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- public function drawRoundRect(x:Number, y:Number, width:Number, height:Number, radiusX:Number, radiusY:Number = NaN):void
- {
- COMPILE::SWF
- {
- applyStroke();
- beginFill(new Rectangle(x,y,width,height), new Point(x,y));
- radiusX *=2;
- radiusY = isNaN(radiusY) ? radiusY : radiusY*2;
- $sprite.graphics.drawRoundRect(x,y,width,height,radiusX,radiusY);
- endFill();
- }
- COMPILE::JS
- {
- if(isNaN(radiusY))
- radiusY = radiusX;
-
- var style:String = getStyleStr();
- var rect:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'rect') as WrappedHTMLElement;
- rect.flexjs_wrapper = this;
- rect.style.left = x;
- rect.style.top = y;
- rect.setAttribute('style', style);
- rect.setAttribute('x', x);
- rect.setAttribute('y', y);
- rect.setAttribute('width', width);
- rect.setAttribute('height', height);
- if(!isNaN(radiusX))
- {
- rect.setAttribute('rx', radiusX);
- rect.setAttribute('ry', radiusY);
- }
- element.appendChild(rect);
- }
-
- }
-
- /**
- * Draw the ellipse.
- * @param x The x position of the top-left corner of the bounding box of the ellipse.
- * @param y The y position of the top-left corner of the bounding box of the ellipse.
- * @param width The width of the ellipse.
- * @param height The height of the ellipse.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0.3
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- public function drawEllipse(x:Number, y:Number, width:Number, height:Number):void
- {
- COMPILE::SWF
- {
- applyStroke();
- beginFill(new Rectangle(x,y,width,height), new Point(x,y));
- $sprite.graphics.drawEllipse(x,y,width,height);
- endFill();
- }
- COMPILE::JS
- {
- var style:String = getStyleStr();
- var ellipse:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse') as WrappedHTMLElement;
- ellipse.flexjs_wrapper = this;
- ellipse.style.left = x;
- ellipse.style.top = y;
- ellipse.setAttribute('style', style);
- ellipse.setAttribute('cx', x + width / 2);
- ellipse.setAttribute('cy', y + height / 2);
- ellipse.setAttribute('rx', width / 2);
- ellipse.setAttribute('ry', height / 2);
- element.appendChild(ellipse);
- }
- }
-
- /**
- * Draw the circle.
- * @param x The x location of the center of the circle
- * @param y The y location of the center of the circle.
- * @param radius The radius of the circle.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- public function drawCircle(x:Number, y:Number, radius:Number):void
- {
- COMPILE::SWF
- {
- applyStroke();
- beginFill(new Rectangle(x,y,radius*2, radius*2),new Point(x-radius,y-radius));
- $sprite.graphics.drawCircle(x,y,radius);
- endFill();
- }
- COMPILE::JS
- {
- var style:String = getStyleStr();
- var circle:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse') as WrappedHTMLElement;
- circle.flexjs_wrapper = this;
- circle.style.left = x;
- circle.style.top = y;
- circle.setAttribute('style', style);
- circle.setAttribute('cx', x);
- circle.setAttribute('cy', y);
- circle.setAttribute('rx', radius);
- circle.setAttribute('ry', radius);
- element.appendChild(circle);
-
- }
- }
-
- /**
- * Draw the path.
- * @param data A PathBuilder object containing a vector of drawing commands.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- public function drawPathCommands(data:PathBuilder):void
- {
- drawStringPath(data.getPathString());
- }
-
- /**
- * Draw the path.
- * @param data A string containing a compact represention of the path segments.
- * The value is a space-delimited string describing each path segment. Each
- * segment entry has a single character which denotes the segment type and
- * two or more segment parameters.
- *
- * If the segment command is upper-case, the parameters are absolute values.
- * If the segment command is lower-case, the parameters are relative values.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- public function drawStringPath(data:String):void
- {
- COMPILE::SWF
- {
- applyStroke();
- var bounds:Rectangle = PathHelper.getBounds(data);
- beginFill(bounds,bounds.topLeft);
- var graphicsPath:GraphicsPath = PathHelper.getSegments(data);
- $sprite.graphics.drawPath(graphicsPath.commands, graphicsPath.data);
- endFill();
- }
- COMPILE::JS
- {
- var style:String = getStyleStr();
- var path:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'path') as WrappedHTMLElement;
- path.flexjs_wrapper = this;
- path.style.left = 0;
- path.style.top = 0;
- path.setAttribute('style', style);
- path.setAttribute('d', data);
- element.appendChild(path);
- }
- }
-
- public function drawLine():void
- {
-
- }
-
- public function drawPolygon():void
- {
-
- }
-
-
- /**
- * Draws a rounded rectangle using the size of a radius to draw the rounded corners.
- * You must set the line style, fill, or both
- * on the Graphics object before
- * you call the <code>drawRoundRectComplex()</code> method
- * by calling the <code>linestyle()</code>,
- * <code>lineGradientStyle()</code>, <code>beginFill()</code>,
- * <code>beginGradientFill()</code>, or
- * <code>beginBitmapFill()</code> method.
- *
- * @param x The horizontal position relative to the
- * registration point of the parent display object, in pixels.
- *
- * @param y The vertical position relative to the
- * registration point of the parent display object, in pixels.
- *
- * @param width The width of the round rectangle, in pixels.
- *
- * @param height The height of the round rectangle, in pixels.
- *
- * @param topLeftRadius The radius of the upper-left corner, in pixels.
- *
- * @param topRightRadius The radius of the upper-right corner, in pixels.
- *
- * @param bottomLeftRadius The radius of the bottom-left corner, in pixels.
- *
- * @param bottomRightRadius The radius of the bottom-right corner, in pixels.
- *
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function drawRoundRectComplex(x:Number, y:Number,
- width:Number, height:Number,
- topLeftRadius:Number, topRightRadius:Number,
- bottomLeftRadius:Number, bottomRightRadius:Number):void
- {
- COMPILE::SWF
- {
- applyStroke();
- beginFill(new Rectangle(x,y,width,height), new Point(x,y));
- $sprite.graphics.drawRoundRectComplex(x,y,width,height,topLeftRadius,topRightRadius,bottomLeftRadius,bottomRightRadius);
- endFill();
- }
- COMPILE::JS
- {
- var builder:PathBuilder = new PathBuilder();
- builder.drawRoundRectComplex(x, y, width, height, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
- drawStringPath(builder.getPathString());
- }
-
-
- }
-
- /**
- * Draws a rounded rectangle using the size of individual x and y radii to
- * draw the rounded corners.
- * You must set the line style, fill, or both
- * on the Graphics object before
- * you call the <code>drawRoundRectComplex2()</code> method
- * by calling the <code>linestyle()</code>,
- * <code>lineGradientStyle()</code>, <code>beginFill()</code>,
- * <code>beginGradientFill()</code>, or
- * <code>beginBitmapFill()</code> method.
- *
- * @param graphics The Graphics object that draws the rounded rectangle.
- *
- * @param x The horizontal position relative to the
- * registration point of the parent display object, in pixels.
- *
- * @param y The vertical position relative to the
- * registration point of the parent display object, in pixels.
- *
- * @param width The width of the round rectangle, in pixels.
- *
- * @param height The height of the round rectangle, in pixels.
- *
- * @param radiusX The default radiusX to use, if corner-specific values are not specified.
- * This value must be specified.
- *
- * @param radiusY The default radiusY to use, if corner-specific values are not specified.
- * If 0, the value of radiusX is used.
- *
- * @param topLeftRadiusX The x radius of the upper-left corner, in pixels. If NaN,
- * the value of radiusX is used.
- *
- * @param topLeftRadiusY The y radius of the upper-left corner, in pixels. If NaN,
- * the value of topLeftRadiusX is used.
- *
- * @param topRightRadiusX The x radius of the upper-right corner, in pixels. If NaN,
- * the value of radiusX is used.
- *
- * @param topRightRadiusY The y radius of the upper-right corner, in pixels. If NaN,
- * the value of topRightRadiusX is used.
- *
- * @param bottomLeftRadiusX The x radius of the bottom-left corner, in pixels. If NaN,
- * the value of radiusX is used.
- *
- * @param bottomLeftRadiusY The y radius of the bottom-left corner, in pixels. If NaN,
- * the value of bottomLeftRadiusX is used.
- *
- * @param bottomRightRadiusX The x radius of the bottom-right corner, in pixels. If NaN,
- * the value of radiusX is used.
- *
- * @param bottomRightRadiusY The y radius of the bottom-right corner, in pixels. If NaN,
- * the value of bottomRightRadiusX is used.
- *
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 1.5
- * @productversion Flex 4
- */
- public function drawRoundRectComplex2(x:Number, y:Number,
- width:Number, height:Number,
- radiusX:Number, radiusY:Number,
- topLeftRadiusX:Number, topLeftRadiusY:Number,
- topRightRadiusX:Number, topRightRadiusY:Number,
- bottomLeftRadiusX:Number, bottomLeftRadiusY:Number,
- bottomRightRadiusX:Number, bottomRightRadiusY:Number):void
- {
- var builder:PathBuilder = new PathBuilder();
- builder.drawRoundRectComplex2(x, y, width, height, radiusX, radiusY,topLeftRadiusX, topLeftRadiusY,topRightRadiusX, topRightRadiusY,bottomLeftRadiusX, bottomLeftRadiusY,bottomRightRadiusX, bottomRightRadiusY);
-
- COMPILE::SWF
- {
- applyStroke();
- beginFill(new Rectangle(x,y,width,height), new Point(x,y));
- builder.draw($sprite.graphics);
- endFill();
- }
- COMPILE::JS
- {
- drawStringPath(builder.getPathString());
- }
- }
-
- /*
- What about these?
- beginBitmapFill
- beginFill
- beginGradientFill
- beginShaderFill
- drawGraphicsData
- drawRoundRect
- drawTriangles
- */
-
- /**
- * Draw a string of characters.
- * @param value The string to draw.
- * @param x The x location of the center of the circle
- * @param y The y location of the center of the circle.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- * @flexjsignorecoercion Text
- * @flexjsignorecoercion Node
- */
- public function drawText(value:String, x:Number, y:Number):Object
- {
- COMPILE::SWF
- {
- var textField:CSSTextField = new CSSTextField();
- $sprite.addChild(textField);
-
- textField.selectable = false;
- textField.type = TextFieldType.DYNAMIC;
- textField.mouseEnabled = false;
- textField.autoSize = "left";
- textField.text = value;
-
- var color:SolidColor = textFill as SolidColor;
- if (color) {
- textField.textColor = color.color;
- textField.alpha = color.alpha;
- }
-
- textField.x = x;
- textField.y = y + textField.textHeight/4;
-
- return textField;
-
- }
- COMPILE::JS
- {
- var style:String = getTxtStyleStr();
- var text:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'text') as WrappedHTMLElement;
- text.flexjs_wrapper = this;
- text.style.left = x;
- text.style.top = y;
- text.setAttribute('style', style);
- text.setAttribute('x', x);
- text.setAttribute('y', y + 15);
- var textNode:Text = document.createTextNode(value) as Text;
- text.appendChild(textNode as Node);
- element.appendChild(text);
- return text;
- }
- }
-
- /**
- * @return {string} The style attribute.
- */
- COMPILE::JS
- public function getTxtStyleStr():String
- {
- var fillStr:String;
- if (textFill)
- {
- fillStr = textFill.addFillAttrib(this);
- }
- else
- {
- fillStr = 'fill:none';
- }
-
- var strokeStr:String;
- if (textStroke)
- {
- strokeStr = textStroke.addStrokeAttrib(this);
- }
- else
- {
- strokeStr = 'stroke:none';
- }
- return fillStr + ';' + strokeStr;
-
-
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7af78c10/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Ellipse.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Ellipse.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Ellipse.as
deleted file mode 100644
index 2cfd95e..0000000
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Ellipse.as
+++ /dev/null
@@ -1,171 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.svg
-{
- import org.apache.flex.graphics.IEllipse;
-
- COMPILE::SWF
- {
- import flash.geom.Point;
- import flash.geom.Rectangle;
- }
- COMPILE::JS
- {
- import org.apache.flex.core.WrappedHTMLElement;
- }
-
- public class Ellipse extends GraphicShape implements IEllipse
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.7
- */
- public function Ellipse(cx:Number=0, cy:Number=0, rx:Number=0, ry:Number=0)
- {
- x = cx;
- y = cy;
- this.rx = rx;
- this.ry = ry;
- }
-
- private var _rx:Number;
-
- /**
- * The horizontal radius of the ellipse.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion FlexJS 0.7
- */
- public function get rx():Number
- {
- return _rx;
- }
-
- public function set rx(value:Number):void
- {
- _rx = value;
- }
-
- private var _ry:Number;
-
- /**
- * The vertical radius of the ellipse.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion FlexJS 0.7
- */
- public function get ry():Number
- {
- return _ry;
- }
-
- public function set ry(value:Number):void
- {
- _ry = value;
- }
-
- override public function get width():Number
- {
- return _rx*2;
- }
-
- override public function set width(value:Number):void
- {
- _rx = value/2;
- }
-
- override public function get height():Number
- {
- return _ry*2;
- }
-
- override public function set height(value:Number):void
- {
- _ry = value/2;
- }
-
- COMPILE::JS
- private var _ellipse:WrappedHTMLElement;
-
- /**
- * Draw the ellipse.
- * @param xp The x position of the top-left corner of the bounding box of the ellipse.
- * @param yp The y position of the top-left corner of the bounding box of the ellipse.
- * @param width The width of the ellipse.
- * @param height The height of the ellipse.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- * @flexjsignorecoercion SVGEllipseElement
- */
- public function drawEllipse(xp:Number, yp:Number):void
- {
- COMPILE::SWF
- {
- $sprite.graphics.clear();
- applyStroke();
- beginFill(new Rectangle(xp, yp, width, height), new Point(xp,yp));
- $sprite.graphics.drawEllipse(xp,yp,width,height);
- endFill();
- }
- COMPILE::JS
- {
- var style:String = getStyleStr();
- if (_ellipse == null) {
- _ellipse = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse') as WrappedHTMLElement;
- _ellipse.flexjs_wrapper = this;
- element.appendChild(_ellipse);
- }
- _ellipse.setAttribute('style', style);
- if (stroke)
- {
- _ellipse.setAttribute('cx', rx + stroke.weight);
- _ellipse.setAttribute('cy', ry + stroke.weight);
- }
- else
- {
- _ellipse.setAttribute('cx', rx);
- _ellipse.setAttribute('cy', ry);
- }
- _ellipse.setAttribute('rx', rx);
- _ellipse.setAttribute('ry', ry);
-
- resize(x, y, (_ellipse as SVGEllipseElement).getBBox());
-
- }
- }
-
- override protected function draw():void
- {
- drawEllipse(0, 0);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7af78c10/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicShape.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicShape.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicShape.as
deleted file mode 100644
index 8f9e326..0000000
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/GraphicShape.as
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flex.svg
-{
- COMPILE::SWF
- {
- import flash.display.Graphics;
- import flash.display.Sprite;
- import flash.geom.Point;
- import flash.geom.Rectangle;
- import org.apache.flex.core.WrappedSprite;
- }
- COMPILE::JS
- {
- import org.apache.flex.core.WrappedHTMLElement;
- }
-
- import org.apache.flex.core.IFlexJSElement;
- import org.apache.flex.core.UIBase;
- import org.apache.flex.graphics.IFill;
- import org.apache.flex.graphics.IStroke;
- import org.apache.flex.graphics.IGraphicShape;
-
- public class GraphicShape extends UIBase implements IGraphicShape
- {
-
- private var _fill:IFill;
- private var _stroke:IStroke;
-
- public function get stroke():IStroke
- {
- return _stroke;
- }
-
- /**
- * A solid color fill.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion FlexJS 0.0
- */
- public function set stroke(value:IStroke):void
- {
- _stroke = value;
- }
-
- public function get fill():IFill
- {
- return _fill;
- }
- /**
- * A solid color fill.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion FlexJS 0.0
- */
- public function set fill(value:IFill):void
- {
- _fill = value;
- }
-
- /**
- * Constructor
- *
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- public function GraphicShape()
- {
- super();
- }
-
- /**
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- COMPILE::JS
- override protected function createElement():IFlexJSElement
- {
- element = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as WrappedHTMLElement;
- element.flexjs_wrapper = this;
- element.style.left = 0;
- element.style.top = 0;
- //element.offsetParent = null;
- positioner = element;
- positioner.style.position = 'relative';
-
- return element;
- }
-
-
- COMPILE::SWF
- protected function applyStroke():void
- {
- if(stroke)
- {
- stroke.apply($sprite.graphics);
- }
- }
-
- COMPILE::SWF
- protected function beginFill(targetBounds:Rectangle,targetOrigin:Point):void
- {
- if(fill)
- {
- fill.begin($sprite.graphics, targetBounds,targetOrigin);
- }
- }
-
- COMPILE::SWF
- protected function endFill():void
- {
- if(fill)
- {
- fill.end($sprite.graphics);
- }
- }
-
- /**
- * This is where the drawing methods get called from
- */
- protected function draw():void
- {
- //Overwrite in subclass
- }
-
- override public function addedToParent():void
- {
- super.addedToParent();
- draw();
- COMPILE::JS
- {
- element.style.overflow = 'visible';
- }
- }
-
- /**
- * @return {string} The style attribute.
- */
- COMPILE::JS
- public function getStyleStr():String
- {
- var fillStr:String;
- if (fill)
- {
- fillStr = fill.addFillAttrib(this);
- }
- else
- {
- fillStr = 'fill:none';
- }
-
- var strokeStr:String;
- if (stroke)
- {
- strokeStr = stroke.addStrokeAttrib(this);
- }
- else
- {
- strokeStr = 'stroke:none';
- }
-
-
- return fillStr + ';' + strokeStr;
- }
-
- COMPILE::JS
- override protected function setClassName(value:String):void
- {
- element.setAttribute('class', value);
- }
-
-
- /**
- * @param x X position.
- * @param y Y position.
- * @param bbox The bounding box of the svg element.
- */
- COMPILE::JS
- public function resize(x:Number, y:Number, bbox:SVGRect):void
- {
- var useWidth:Number = Math.max(this.width, bbox.width);
- var useHeight:Number = Math.max(this.height, bbox.height);
-
- element.style.position = 'absolute';
- if (!isNaN(x)) element.style.top = x;
- if (!isNaN(y)) element.style.left = y;
- element.style.width = useWidth;
- element.style.height = useHeight;
- element.style.left = x;
- element.style.top = y;
- }
-
- COMPILE::JS
- private var _x:Number;
- COMPILE::JS
- private var _y:Number;
- COMPILE::JS
- private var _xOffset:Number;
- COMPILE::JS
- private var _yOffset:Number;
-
- /**
- * @param x X position.
- * @param y Y position.
- * @param xOffset offset from x position.
- * @param yOffset offset from y position.
- */
- COMPILE::JS
- public function setPosition(x:Number, y:Number, xOffset:Number, yOffset:Number):void
- {
- _x = x;
- _y = y;
- _xOffset = xOffset;
- _yOffset = yOffset;
- element.style.left = xOffset;
- element.style.top = yOffset;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7af78c10/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Path.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Path.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Path.as
deleted file mode 100644
index 3369e47..0000000
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Path.as
+++ /dev/null
@@ -1,133 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flex.svg
-{
- import org.apache.flex.graphics.IPath;
- import org.apache.flex.graphics.PathBuilder;
-
- COMPILE::SWF
- {
- import flash.display.GraphicsPath;
- import flash.geom.Point;
- import flash.geom.Rectangle;
- import org.apache.flex.graphics.utils.PathHelper;
- }
- COMPILE::JS
- {
- import org.apache.flex.core.WrappedHTMLElement;
- }
-
-
- public class Path extends GraphicShape implements IPath
- {
-
- private var _data:String;
-
- public function get data():String
- {
- return _data;
- }
-
- public function set data(value:String):void
- {
- _data = value;
- _pathCommands = null;
- }
-
- private var _pathCommands:PathBuilder;
-
- public function get pathCommands():PathBuilder
- {
- return _pathCommands;
- }
-
- public function set pathCommands(value:PathBuilder):void
- {
- _pathCommands = value;
- _data = _pathCommands.getPathString();
- }
-
-
- COMPILE::JS
- private var _path:WrappedHTMLElement;
-
- /**
- * Draw the path.
- * @param data A PathBuilder object containing a vector of drawing commands.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- public function drawPathCommands(xp:Number,yp:Number,data:PathBuilder):void
- {
- drawStringPath(xp,yp,data.getPathString());
- }
-
- /**
- * Draw the path.
- * @param data A string containing a compact represention of the path segments.
- * The value is a space-delimited string describing each path segment. Each
- * segment entry has a single character which denotes the segment type and
- * two or more segment parameters.
- *
- * If the segment command is upper-case, the parameters are absolute values.
- * If the segment command is lower-case, the parameters are relative values.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- public function drawStringPath(xp:Number,yp:Number,data:String):void
- {
- COMPILE::SWF
- {
- $sprite.graphics.clear();
- applyStroke();
- var bounds:Rectangle = PathHelper.getBounds(data);
- this.width = bounds.width;
- this.height = bounds.height;
- beginFill(bounds,new Point(bounds.left + xp, bounds.top + yp) );
- var graphicsPath:GraphicsPath = PathHelper.getSegments(data,xp,yp);
- $sprite.graphics.drawPath(graphicsPath.commands, graphicsPath.data);
- endFill();
- }
- COMPILE::JS
- {
- if (data == null || data.length === 0) return;
- var style:String = getStyleStr();
- if (_path == null) {
- _path = document.createElementNS('http://www.w3.org/2000/svg', 'path') as WrappedHTMLElement;
- _path.flexjs_wrapper = this;
- element.appendChild(_path);
- }
- _path.setAttribute('style', style);
- _path.setAttribute('d', data);
-
- resize(x, y, _path['getBBox']());
-
- }
- }
-
- override protected function draw():void
- {
- drawStringPath(0, 0, data);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7af78c10/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Rect.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Rect.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Rect.as
deleted file mode 100644
index 14f153e..0000000
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Rect.as
+++ /dev/null
@@ -1,156 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flex.svg
-{
- import org.apache.flex.graphics.IRect;
-
- COMPILE::SWF
- {
- import flash.geom.Point;
- import flash.geom.Rectangle;
- }
- COMPILE::JS
- {
- import org.apache.flex.core.WrappedHTMLElement;
- }
-
- public class Rect extends GraphicShape implements IRect
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.7
- */
- public function Rect(x:Number=0, y:Number=0, width:Number=0, height:Number=0,rx:Number=NaN,ry:Number=NaN)
- {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
- this.rx = rx;
- this.ry = ry;
- }
-
- COMPILE::JS
- private var _rect:WrappedHTMLElement;
-
- private var _rx:Number;
-
- /**
- * The x axis radius for rounded corners
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.7
- */
- public function get rx():Number
- {
- return _rx;
- }
-
- public function set rx(value:Number):void
- {
- _rx = value;
- }
-
- private var _ry:Number;
-
- /**
- * The y axis radius for rounded corners
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.7
- *
- */
- public function get ry():Number
- {
- return _ry;
- }
-
- public function set ry(value:Number):void
- {
- _ry = value;
- }
-
- /**
- * Draw the rectangle.
- * @param xp The x position of the top-left corner of the rectangle.
- * @param yp The y position of the top-left corner.
- * @param width The width of the rectangle.
- * @param height The height of the rectangle.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- public function drawRect(xp:Number, yp:Number, width:Number, height:Number):void
- {
- COMPILE::SWF
- {
- $sprite.graphics.clear();
- applyStroke();
- beginFill(new Rectangle(xp, yp, width, height), new Point(xp,yp));
- if(isNaN(rx))
- $sprite.graphics.drawRect(0, 0, width, height);
- else
- {
- var dx:Number = rx*2;
- var dy:Number = isNaN(ry) ? ry : ry*2;
- $sprite.graphics.drawRoundRect(0, 0, width, height,dx ,dy);
- }
- endFill();
- }
- COMPILE::JS
- {
- var style:String = this.getStyleStr();
-
- if (_rect == null) {
- _rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect') as WrappedHTMLElement;
- _rect.flexjs_wrapper = this;
- element.appendChild(_rect);
- }
- _rect.setAttribute('style', style);
- if (stroke)
- {
- _rect.setAttribute('x', stroke.weight / 2);
- _rect.setAttribute('y', stroke.weight / 2);
- }
- else
- {
- _rect.setAttribute('x', 0);
- _rect.setAttribute('y', 0);
- }
- _rect.setAttribute('width', width);
- _rect.setAttribute('height', height);
-
- resize(x, y, _rect['getBBox']());
- }
- }
-
- override protected function draw():void
- {
- drawRect(0,0,width,height);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7af78c10/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Text.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Text.as b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Text.as
deleted file mode 100644
index 51b8135..0000000
--- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/svg/Text.as
+++ /dev/null
@@ -1,150 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.svg
-{
- import org.apache.flex.graphics.IText;
- import org.apache.flex.graphics.SolidColor;
-
- COMPILE::SWF
- {
- import flash.text.TextFieldType;
- import org.apache.flex.core.CSSTextField;
- }
- COMPILE::JS
- {
- import org.apache.flex.core.WrappedHTMLElement;
- }
-
- /**
- * Draws a string of characters at a specific location using the stroke
- * value of color and alpha.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * // TODO (aharui) ignore imports of external linkage interfaces?
- * @flexjsignoreimport SVGLocatable
- */
- public class Text extends GraphicShape implements IText
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function Text()
- {
- super();
-
- COMPILE::SWF
- {
- _textField = new CSSTextField();
- $sprite.addChild(_textField);
- }
- }
-
-
- COMPILE::SWF
- private var _textField:CSSTextField;
-
- COMPILE::JS
- private var _text:WrappedHTMLElement;
-
- /**
- * @copy org.apache.flex.core.ITextModel#textField
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- COMPILE::SWF
- public function get textField() : CSSTextField
- {
- return _textField;
- }
-
- /**
- * Draws text at the given point.
- * @param value The string to draw.
- * @param xt The x position of the top-left corner of the rectangle.
- * @param yt The y position of the top-left corner.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- * @flexjsignorecoercion Text
- * @flexjsignorecoercion Node
- * @flexjsignorecoercion SVGLocatable
- */
- public function drawText(value:String, xt:Number, yt:Number):void
- {
- COMPILE::SWF
- {
- textField.selectable = false;
- textField.type = TextFieldType.DYNAMIC;
- textField.mouseEnabled = false;
- textField.autoSize = "left";
- textField.text = value;
-
- var color:SolidColor = fill as SolidColor;
- if (color) {
- textField.textColor = color.color;
- textField.alpha = color.alpha;
- }
-
- textField.x = xt;
- textField.y = yt;
- }
- COMPILE::JS
- {
- var style:String = this.getStyleStr();
- if (_text == null) {
- _text = document.createElementNS('http://www.w3.org/2000/svg', 'text') as WrappedHTMLElement;
- _text.flexjs_wrapper = this;
- element.appendChild(_text);
- }
- else {
- _text.removeChild(_text.childNodes[0]);
- }
- _text.setAttribute('style', style);
- _text.setAttribute('x', xt);
- _text.setAttribute('y', yt);
- var textNode:Text = document.createTextNode(value) as Text;
- _text.appendChild(textNode as Node);
-
- resize(x, y, (_text as SVGLocatable).getBBox());
-
- }
- }
-
- COMPILE::JS
- override protected function draw():void
- {
-
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7af78c10/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Circle.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Circle.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Circle.as
new file mode 100644
index 0000000..07cc3d5
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Circle.as
@@ -0,0 +1,119 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flex.svg
+{
+ import org.apache.flex.graphics.ICircle;
+
+ COMPILE::SWF
+ {
+ import flash.display.Graphics;
+ import flash.geom.Point;
+ import flash.geom.Rectangle;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ public class Circle extends GraphicShape implements ICircle
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.7
+ */
+ public function Circle(cx:Number=0, cy:Number=0, r:Number=0)
+ {
+ x = cx;
+ y = cy;
+ radius = r;
+ }
+
+ private var _radius:Number;
+
+ public function get radius():Number
+ {
+ return _radius;
+ }
+
+ public function set radius(value:Number):void
+ {
+ _radius = value;
+ }
+
+ COMPILE::JS
+ private var _circle:WrappedHTMLElement;
+
+ /**
+ * Draw the circle.
+ * @param cx The x location of the center of the circle
+ * @param cy The y location of the center of the circle.
+ * @param radius The radius of the circle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion SVGCircleElement
+ */
+ public function drawCircle(cx:Number, cy:Number, radius):void
+ {
+ COMPILE::SWF
+ {
+ $sprite.graphics.clear();
+ applyStroke();
+ beginFill(new Rectangle(cx,cy,radius*2, radius*2),new Point(cx-radius,cy-radius));
+ $sprite.graphics.drawCircle(cx+radius,cy+radius,radius);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ var style:String = getStyleStr();
+
+ if (_circle == null) {
+ _circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle') as WrappedHTMLElement;
+ _circle.flexjs_wrapper = this;
+ element.appendChild(_circle);
+ }
+ _circle.setAttribute('style', style);
+ if (stroke)
+ {
+ _circle.setAttribute('cx', radius + stroke.weight);
+ _circle.setAttribute('cy', radius + stroke.weight);
+ }
+ else
+ {
+ _circle.setAttribute('cx', radius);
+ _circle.setAttribute('cy', radius);
+ }
+
+ _circle.setAttribute('r', radius);
+
+ resize(x-radius, y-radius, (_circle as SVGCircleElement).getBBox());
+
+ }
+ }
+
+ override protected function draw():void
+ {
+ drawCircle(0, 0, radius);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7af78c10/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/CompoundGraphic.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/CompoundGraphic.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/CompoundGraphic.as
new file mode 100644
index 0000000..351f871
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/CompoundGraphic.as
@@ -0,0 +1,584 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flex.svg
+{
+ import org.apache.flex.graphics.ICompoundGraphic;
+ import org.apache.flex.graphics.IFill;
+ import org.apache.flex.graphics.IStroke;
+ import org.apache.flex.graphics.PathBuilder;
+ import org.apache.flex.graphics.SolidColor;
+
+ COMPILE::SWF
+ {
+ import flash.display.GraphicsPath;
+ import flash.display.Shape;
+ import flash.display.Sprite;
+ import flash.geom.Point;
+ import flash.geom.Rectangle;
+ import flash.text.TextFieldType;
+
+ import org.apache.flex.core.CSSTextField;
+ import org.apache.flex.graphics.utils.PathHelper;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * CompoundGraphic is a surface on which you can
+ * draw various graphic elements such as Rect, Circle,
+ * Ellipse, Path etc.
+ * Use this class if you want to draw multiple graphic
+ * shapes on a single container.
+ *
+ */
+ public class CompoundGraphic extends GraphicShape implements ICompoundGraphic
+ {
+ private var _textFill:IFill;
+
+ public function get textFill():IFill
+ {
+ return _textFill;
+ }
+ /**
+ * The color of the text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion FlexJS 0.0
+ */
+ public function set textFill(value:IFill):void
+ {
+ _textFill = value;
+ }
+
+ private var _textStroke:IStroke;
+
+ public function get textStroke():IStroke
+ {
+ return _textStroke;
+ }
+ /**
+ * The stroke color of the text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion FlexJS 0.0
+ */
+ public function set textStroke(value:IStroke):void
+ {
+ _textStroke = value;
+ }
+
+ /**
+ * Removes all of the drawn elements of the container.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0.3
+ */
+ public function removeAllElements():void
+ {
+ clear();
+ }
+
+ /**
+ * Clears all of the drawn path data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.7.0
+ */
+ public function clear():void
+ {
+ COMPILE::SWF
+ {
+ $sprite.graphics.clear();
+ $sprite.removeChildren();
+ }
+ COMPILE::JS
+ {
+ var svg:HTMLElement = element;
+ while (svg.lastChild) {
+ svg.removeChild(svg.lastChild);
+ }
+ }
+ }
+
+ /**
+ * Draw the rectangle.
+ * @param x The x position of the top-left corner of the rectangle.
+ * @param y The y position of the top-left corner.
+ * @param width The width of the rectangle.
+ * @param height The height of the rectangle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0.3
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawRect(x:Number, y:Number, width:Number, height:Number):void
+ {
+ COMPILE::SWF
+ {
+ applyStroke();
+ beginFill(new Rectangle(x, y, width, height), new Point(x,y) );
+ $sprite.graphics.drawRect(x, y, width, height);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ drawRoundRect(x, y, width, height, NaN);
+ }
+ }
+
+ /**
+ * Draws a rounded rectangle.
+ * Note: The radius values are different than the Flash API of the same name. Flash uses diameter instead of radius.
+ * @param x The x position of the top-left corner of the rectangle.
+ * @param y The y position of the top-left corner.
+ * @param width The width of the rectangle.
+ * @param height The height of the rectangle.
+ * @param radiusX The horizontal radius of the rounded corners (in pixels).
+ * @param radiusY The vertical radius of the rounded corners (in pixels). Optional; if no value is specified, the default value matches that provided for the <code>radiusX</code> parameter.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0.3
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawRoundRect(x:Number, y:Number, width:Number, height:Number, radiusX:Number, radiusY:Number = NaN):void
+ {
+ COMPILE::SWF
+ {
+ applyStroke();
+ beginFill(new Rectangle(x,y,width,height), new Point(x,y));
+ radiusX *=2;
+ radiusY = isNaN(radiusY) ? radiusY : radiusY*2;
+ $sprite.graphics.drawRoundRect(x,y,width,height,radiusX,radiusY);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ if(isNaN(radiusY))
+ radiusY = radiusX;
+
+ var style:String = getStyleStr();
+ var rect:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'rect') as WrappedHTMLElement;
+ rect.flexjs_wrapper = this;
+ rect.style.left = x;
+ rect.style.top = y;
+ rect.setAttribute('style', style);
+ rect.setAttribute('x', x);
+ rect.setAttribute('y', y);
+ rect.setAttribute('width', width);
+ rect.setAttribute('height', height);
+ if(!isNaN(radiusX))
+ {
+ rect.setAttribute('rx', radiusX);
+ rect.setAttribute('ry', radiusY);
+ }
+ element.appendChild(rect);
+ }
+
+ }
+
+ /**
+ * Draw the ellipse.
+ * @param x The x position of the top-left corner of the bounding box of the ellipse.
+ * @param y The y position of the top-left corner of the bounding box of the ellipse.
+ * @param width The width of the ellipse.
+ * @param height The height of the ellipse.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0.3
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawEllipse(x:Number, y:Number, width:Number, height:Number):void
+ {
+ COMPILE::SWF
+ {
+ applyStroke();
+ beginFill(new Rectangle(x,y,width,height), new Point(x,y));
+ $sprite.graphics.drawEllipse(x,y,width,height);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ var style:String = getStyleStr();
+ var ellipse:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse') as WrappedHTMLElement;
+ ellipse.flexjs_wrapper = this;
+ ellipse.style.left = x;
+ ellipse.style.top = y;
+ ellipse.setAttribute('style', style);
+ ellipse.setAttribute('cx', x + width / 2);
+ ellipse.setAttribute('cy', y + height / 2);
+ ellipse.setAttribute('rx', width / 2);
+ ellipse.setAttribute('ry', height / 2);
+ element.appendChild(ellipse);
+ }
+ }
+
+ /**
+ * Draw the circle.
+ * @param x The x location of the center of the circle
+ * @param y The y location of the center of the circle.
+ * @param radius The radius of the circle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawCircle(x:Number, y:Number, radius:Number):void
+ {
+ COMPILE::SWF
+ {
+ applyStroke();
+ beginFill(new Rectangle(x,y,radius*2, radius*2),new Point(x-radius,y-radius));
+ $sprite.graphics.drawCircle(x,y,radius);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ var style:String = getStyleStr();
+ var circle:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse') as WrappedHTMLElement;
+ circle.flexjs_wrapper = this;
+ circle.style.left = x;
+ circle.style.top = y;
+ circle.setAttribute('style', style);
+ circle.setAttribute('cx', x);
+ circle.setAttribute('cy', y);
+ circle.setAttribute('rx', radius);
+ circle.setAttribute('ry', radius);
+ element.appendChild(circle);
+
+ }
+ }
+
+ /**
+ * Draw the path.
+ * @param data A PathBuilder object containing a vector of drawing commands.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawPathCommands(data:PathBuilder):void
+ {
+ drawStringPath(data.getPathString());
+ }
+
+ /**
+ * Draw the path.
+ * @param data A string containing a compact represention of the path segments.
+ * The value is a space-delimited string describing each path segment. Each
+ * segment entry has a single character which denotes the segment type and
+ * two or more segment parameters.
+ *
+ * If the segment command is upper-case, the parameters are absolute values.
+ * If the segment command is lower-case, the parameters are relative values.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ public function drawStringPath(data:String):void
+ {
+ COMPILE::SWF
+ {
+ applyStroke();
+ var bounds:Rectangle = PathHelper.getBounds(data);
+ beginFill(bounds,bounds.topLeft);
+ var graphicsPath:GraphicsPath = PathHelper.getSegments(data);
+ $sprite.graphics.drawPath(graphicsPath.commands, graphicsPath.data);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ var style:String = getStyleStr();
+ var path:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'path') as WrappedHTMLElement;
+ path.flexjs_wrapper = this;
+ path.style.left = 0;
+ path.style.top = 0;
+ path.setAttribute('style', style);
+ path.setAttribute('d', data);
+ element.appendChild(path);
+ }
+ }
+
+ public function drawLine():void
+ {
+
+ }
+
+ public function drawPolygon():void
+ {
+
+ }
+
+
+ /**
+ * Draws a rounded rectangle using the size of a radius to draw the rounded corners.
+ * You must set the line style, fill, or both
+ * on the Graphics object before
+ * you call the <code>drawRoundRectComplex()</code> method
+ * by calling the <code>linestyle()</code>,
+ * <code>lineGradientStyle()</code>, <code>beginFill()</code>,
+ * <code>beginGradientFill()</code>, or
+ * <code>beginBitmapFill()</code> method.
+ *
+ * @param x The horizontal position relative to the
+ * registration point of the parent display object, in pixels.
+ *
+ * @param y The vertical position relative to the
+ * registration point of the parent display object, in pixels.
+ *
+ * @param width The width of the round rectangle, in pixels.
+ *
+ * @param height The height of the round rectangle, in pixels.
+ *
+ * @param topLeftRadius The radius of the upper-left corner, in pixels.
+ *
+ * @param topRightRadius The radius of the upper-right corner, in pixels.
+ *
+ * @param bottomLeftRadius The radius of the bottom-left corner, in pixels.
+ *
+ * @param bottomRightRadius The radius of the bottom-right corner, in pixels.
+ *
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function drawRoundRectComplex(x:Number, y:Number,
+ width:Number, height:Number,
+ topLeftRadius:Number, topRightRadius:Number,
+ bottomLeftRadius:Number, bottomRightRadius:Number):void
+ {
+ COMPILE::SWF
+ {
+ applyStroke();
+ beginFill(new Rectangle(x,y,width,height), new Point(x,y));
+ $sprite.graphics.drawRoundRectComplex(x,y,width,height,topLeftRadius,topRightRadius,bottomLeftRadius,bottomRightRadius);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ var builder:PathBuilder = new PathBuilder();
+ builder.drawRoundRectComplex(x, y, width, height, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
+ drawStringPath(builder.getPathString());
+ }
+
+
+ }
+
+ /**
+ * Draws a rounded rectangle using the size of individual x and y radii to
+ * draw the rounded corners.
+ * You must set the line style, fill, or both
+ * on the Graphics object before
+ * you call the <code>drawRoundRectComplex2()</code> method
+ * by calling the <code>linestyle()</code>,
+ * <code>lineGradientStyle()</code>, <code>beginFill()</code>,
+ * <code>beginGradientFill()</code>, or
+ * <code>beginBitmapFill()</code> method.
+ *
+ * @param graphics The Graphics object that draws the rounded rectangle.
+ *
+ * @param x The horizontal position relative to the
+ * registration point of the parent display object, in pixels.
+ *
+ * @param y The vertical position relative to the
+ * registration point of the parent display object, in pixels.
+ *
+ * @param width The width of the round rectangle, in pixels.
+ *
+ * @param height The height of the round rectangle, in pixels.
+ *
+ * @param radiusX The default radiusX to use, if corner-specific values are not specified.
+ * This value must be specified.
+ *
+ * @param radiusY The default radiusY to use, if corner-specific values are not specified.
+ * If 0, the value of radiusX is used.
+ *
+ * @param topLeftRadiusX The x radius of the upper-left corner, in pixels. If NaN,
+ * the value of radiusX is used.
+ *
+ * @param topLeftRadiusY The y radius of the upper-left corner, in pixels. If NaN,
+ * the value of topLeftRadiusX is used.
+ *
+ * @param topRightRadiusX The x radius of the upper-right corner, in pixels. If NaN,
+ * the value of radiusX is used.
+ *
+ * @param topRightRadiusY The y radius of the upper-right corner, in pixels. If NaN,
+ * the value of topRightRadiusX is used.
+ *
+ * @param bottomLeftRadiusX The x radius of the bottom-left corner, in pixels. If NaN,
+ * the value of radiusX is used.
+ *
+ * @param bottomLeftRadiusY The y radius of the bottom-left corner, in pixels. If NaN,
+ * the value of bottomLeftRadiusX is used.
+ *
+ * @param bottomRightRadiusX The x radius of the bottom-right corner, in pixels. If NaN,
+ * the value of radiusX is used.
+ *
+ * @param bottomRightRadiusY The y radius of the bottom-right corner, in pixels. If NaN,
+ * the value of bottomRightRadiusX is used.
+ *
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public function drawRoundRectComplex2(x:Number, y:Number,
+ width:Number, height:Number,
+ radiusX:Number, radiusY:Number,
+ topLeftRadiusX:Number, topLeftRadiusY:Number,
+ topRightRadiusX:Number, topRightRadiusY:Number,
+ bottomLeftRadiusX:Number, bottomLeftRadiusY:Number,
+ bottomRightRadiusX:Number, bottomRightRadiusY:Number):void
+ {
+ var builder:PathBuilder = new PathBuilder();
+ builder.drawRoundRectComplex2(x, y, width, height, radiusX, radiusY,topLeftRadiusX, topLeftRadiusY,topRightRadiusX, topRightRadiusY,bottomLeftRadiusX, bottomLeftRadiusY,bottomRightRadiusX, bottomRightRadiusY);
+
+ COMPILE::SWF
+ {
+ applyStroke();
+ beginFill(new Rectangle(x,y,width,height), new Point(x,y));
+ builder.draw($sprite.graphics);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ drawStringPath(builder.getPathString());
+ }
+ }
+
+ /*
+ What about these?
+ beginBitmapFill
+ beginFill
+ beginGradientFill
+ beginShaderFill
+ drawGraphicsData
+ drawRoundRect
+ drawTriangles
+ */
+
+ /**
+ * Draw a string of characters.
+ * @param value The string to draw.
+ * @param x The x location of the center of the circle
+ * @param y The y location of the center of the circle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion Text
+ * @flexjsignorecoercion Node
+ */
+ public function drawText(value:String, x:Number, y:Number):Object
+ {
+ COMPILE::SWF
+ {
+ var textField:CSSTextField = new CSSTextField();
+ $sprite.addChild(textField);
+
+ textField.selectable = false;
+ textField.type = TextFieldType.DYNAMIC;
+ textField.mouseEnabled = false;
+ textField.autoSize = "left";
+ textField.text = value;
+
+ var color:SolidColor = textFill as SolidColor;
+ if (color) {
+ textField.textColor = color.color;
+ textField.alpha = color.alpha;
+ }
+
+ textField.x = x;
+ textField.y = y + textField.textHeight/4;
+
+ return textField;
+
+ }
+ COMPILE::JS
+ {
+ var style:String = getTxtStyleStr();
+ var text:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'text') as WrappedHTMLElement;
+ text.flexjs_wrapper = this;
+ text.style.left = x;
+ text.style.top = y;
+ text.setAttribute('style', style);
+ text.setAttribute('x', x);
+ text.setAttribute('y', y + 15);
+ var textNode:Text = document.createTextNode(value) as Text;
+ text.appendChild(textNode as Node);
+ element.appendChild(text);
+ return text;
+ }
+ }
+
+ /**
+ * @return {string} The style attribute.
+ */
+ COMPILE::JS
+ public function getTxtStyleStr():String
+ {
+ var fillStr:String;
+ if (textFill)
+ {
+ fillStr = textFill.addFillAttrib(this);
+ }
+ else
+ {
+ fillStr = 'fill:none';
+ }
+
+ var strokeStr:String;
+ if (textStroke)
+ {
+ strokeStr = textStroke.addStrokeAttrib(this);
+ }
+ else
+ {
+ strokeStr = 'stroke:none';
+ }
+ return fillStr + ';' + strokeStr;
+
+
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7af78c10/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Ellipse.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Ellipse.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Ellipse.as
new file mode 100644
index 0000000..2cfd95e
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Ellipse.as
@@ -0,0 +1,171 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.svg
+{
+ import org.apache.flex.graphics.IEllipse;
+
+ COMPILE::SWF
+ {
+ import flash.geom.Point;
+ import flash.geom.Rectangle;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ public class Ellipse extends GraphicShape implements IEllipse
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.7
+ */
+ public function Ellipse(cx:Number=0, cy:Number=0, rx:Number=0, ry:Number=0)
+ {
+ x = cx;
+ y = cy;
+ this.rx = rx;
+ this.ry = ry;
+ }
+
+ private var _rx:Number;
+
+ /**
+ * The horizontal radius of the ellipse.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion FlexJS 0.7
+ */
+ public function get rx():Number
+ {
+ return _rx;
+ }
+
+ public function set rx(value:Number):void
+ {
+ _rx = value;
+ }
+
+ private var _ry:Number;
+
+ /**
+ * The vertical radius of the ellipse.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion FlexJS 0.7
+ */
+ public function get ry():Number
+ {
+ return _ry;
+ }
+
+ public function set ry(value:Number):void
+ {
+ _ry = value;
+ }
+
+ override public function get width():Number
+ {
+ return _rx*2;
+ }
+
+ override public function set width(value:Number):void
+ {
+ _rx = value/2;
+ }
+
+ override public function get height():Number
+ {
+ return _ry*2;
+ }
+
+ override public function set height(value:Number):void
+ {
+ _ry = value/2;
+ }
+
+ COMPILE::JS
+ private var _ellipse:WrappedHTMLElement;
+
+ /**
+ * Draw the ellipse.
+ * @param xp The x position of the top-left corner of the bounding box of the ellipse.
+ * @param yp The y position of the top-left corner of the bounding box of the ellipse.
+ * @param width The width of the ellipse.
+ * @param height The height of the ellipse.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion SVGEllipseElement
+ */
+ public function drawEllipse(xp:Number, yp:Number):void
+ {
+ COMPILE::SWF
+ {
+ $sprite.graphics.clear();
+ applyStroke();
+ beginFill(new Rectangle(xp, yp, width, height), new Point(xp,yp));
+ $sprite.graphics.drawEllipse(xp,yp,width,height);
+ endFill();
+ }
+ COMPILE::JS
+ {
+ var style:String = getStyleStr();
+ if (_ellipse == null) {
+ _ellipse = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse') as WrappedHTMLElement;
+ _ellipse.flexjs_wrapper = this;
+ element.appendChild(_ellipse);
+ }
+ _ellipse.setAttribute('style', style);
+ if (stroke)
+ {
+ _ellipse.setAttribute('cx', rx + stroke.weight);
+ _ellipse.setAttribute('cy', ry + stroke.weight);
+ }
+ else
+ {
+ _ellipse.setAttribute('cx', rx);
+ _ellipse.setAttribute('cy', ry);
+ }
+ _ellipse.setAttribute('rx', rx);
+ _ellipse.setAttribute('ry', ry);
+
+ resize(x, y, (_ellipse as SVGEllipseElement).getBBox());
+
+ }
+ }
+
+ override protected function draw():void
+ {
+ drawEllipse(0, 0);
+ }
+
+ }
+}
[16/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - try to
copy HTML to Basic without losing history
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/MXMLBeadView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/MXMLBeadView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/MXMLBeadView.as
new file mode 100644
index 0000000..1807381
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/MXMLBeadView.as
@@ -0,0 +1,317 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.states.State;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IStatesImpl;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.html.beads.ContainerView;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.ValueChangeEvent;
+ import org.apache.flex.utils.MXMLDataInterpreter;
+
+ [DefaultProperty("mxmlContent")]
+
+ /**
+ * The MXMLBeadView class extends ContainerView
+ * and adds support for databinding and specification
+ * of children in MXML.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class MXMLBeadView extends ContainerView implements IStrand, ILayoutHost
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function MXMLBeadView()
+ {
+ super();
+ }
+
+ [Bindable("strandChanged")]
+ /**
+ * An MXMLBeadView doesn't create its children until it is added to
+ * the strand.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ // each MXML file can also have styles in fx:Style block
+ ValuesManager.valuesImpl.init(this);
+
+ dispatchEvent(new Event("strandChanged"));
+
+ for each (var bead:IBead in beads)
+ addBead(bead);
+
+ dispatchEvent(new org.apache.flex.events.Event("beadsAdded"));
+
+ MXMLDataInterpreter.generateMXMLInstances(this, IParent(value), MXMLDescriptor);
+
+ dispatchEvent(new Event("initBindings"))
+ dispatchEvent(new Event("initComplete"))
+ dispatchEvent(new Event("childrenAdded"));
+ }
+
+ [Bindable("__NoChangeEvent__")]
+ /**
+ * The model object.
+ */
+ public function get model():Object
+ {
+ return _strand["model"];
+ }
+
+ /**
+ * @copy org.apache.flex.core.Application#MXMLDescriptor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get MXMLDescriptor():Array
+ {
+ return null;
+ }
+
+ /**
+ * @copy org.apache.flex.core.Application#generateMXMLAttributes()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function generateMXMLAttributes(data:Array):void
+ {
+ MXMLDataInterpreter.generateMXMLProperties(this, data);
+ }
+
+ /**
+ * @copy org.apache.flex.core.ItemRendererClassFactory#mxmlContent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var mxmlContent:Array;
+
+ private var _states:Array;
+
+ /**
+ * The array of view states. These should
+ * be instances of org.apache.flex.states.State.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get states():Array
+ {
+ return _states;
+ }
+
+ /**
+ * @private
+ */
+ public function set states(value:Array):void
+ {
+ _states = value;
+ _currentState = _states[0].name;
+
+ try{
+ if (getBeadByType(IStatesImpl) == null)
+ addBead(new (ValuesManager.valuesImpl.getValue(this, "iStatesImpl")) as IBead);
+ }
+ //TODO: Need to handle this case more gracefully
+ catch(e:Error)
+ {
+ COMPILE::SWF
+ {
+ trace(e.message);
+ }
+ }
+
+ }
+
+ /**
+ * <code>true</code> if the array of states
+ * contains a state with this name.
+ *
+ * @param state The state namem.
+ * @return True if state in state array
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function hasState(state:String):Boolean
+ {
+ for each (var s:State in _states)
+ {
+ if (s.name == state)
+ return true;
+ }
+ return false;
+ }
+
+ private var _currentState:String;
+
+ [Bindable("currentStateChange")]
+ /**
+ * The name of the current state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get currentState():String
+ {
+ return _currentState;
+ }
+
+ /**
+ * @private
+ */
+ public function set currentState(value:String):void
+ {
+ var event:ValueChangeEvent = new ValueChangeEvent("currentStateChange", false, false, _currentState, value)
+ _currentState = value;
+ dispatchEvent(event);
+ }
+
+ private var _transitions:Array;
+
+ /**
+ * The array of transitions.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get transitions():Array
+ {
+ return _transitions;
+ }
+
+ /**
+ * @private
+ */
+ public function set transitions(value:Array):void
+ {
+ _transitions = value;
+ }
+
+ /**
+ * @copy org.apache.flex.core.Application#beads
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var beads:Array;
+
+ private var _beads:Array;
+
+ /**
+ * @copy org.apache.flex.core.IStrand#addBead()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function addBead(bead:IBead):void
+ {
+ if (!_beads)
+ _beads = [];
+ _beads.push(bead);
+ bead.strand = this;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IStrand#getBeadByType()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getBeadByType(classOrInterface:Class):IBead
+ {
+ for each (var bead:IBead in _beads)
+ {
+ if (bead is classOrInterface)
+ return bead;
+ }
+ return null;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IStrand#removeBead()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function removeBead(value:IBead):IBead
+ {
+ var n:int = _beads.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var bead:IBead = _beads[i];
+ if (bead == value)
+ {
+ _beads.splice(i, 1);
+ return bead;
+ }
+ }
+ return null;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/MultilineLabel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/MultilineLabel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/MultilineLabel.as
new file mode 100644
index 0000000..5149237
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/MultilineLabel.as
@@ -0,0 +1,76 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.ITextModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /*
+ * Label probably should extend TextField directly,
+ * but the player's APIs for TextLine do not allow
+ * direct instantiation, and we might want to allow
+ * Labels to be declared and have their actual
+ * view be swapped out.
+ */
+
+ /**
+ * The Label class implements the basic control for labeling
+ * other controls.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class MultilineLabel extends Label
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function MultilineLabel()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('div') as WrappedHTMLElement;
+ positioner = element;
+ element.flexjs_wrapper = this;
+ return element;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/NumericStepper.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/NumericStepper.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/NumericStepper.as
new file mode 100644
index 0000000..e919295
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/NumericStepper.as
@@ -0,0 +1,202 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.IRangeModel;
+ import org.apache.flex.core.UIBase;
+ COMPILE::JS
+ {
+ import goog.events;
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ [Event(name="valueChange", type="org.apache.flex.events.Event")]
+
+ /**
+ * The NumericStepper class is a component that displays a numeric
+ * value and up/down controls (using a org.apache.flex.html.Spinner) to
+ * increase and decrease the value by specific amounts. The NumericStepper uses the following beads:
+ *
+ * org.apache.flex.core.IBeadModel: the data model for the component of type org.apache.flex.core.IRangeModel.
+ * org.apache.flex.core.IBeadView: constructs the parts of the component.
+ * org.apache.flex.core.IBeadController: handles the input events.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class NumericStepper extends UIBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function NumericStepper()
+ {
+ super();
+ }
+
+ [Bindable("valueChange")]
+ /**
+ * The current value of the control.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get value():Number
+ {
+ return IRangeModel(model).value;
+ }
+ public function set value(newValue:Number):void
+ {
+ IRangeModel(model).value = newValue;
+ }
+
+ /**
+ * The minimum value the control will display.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get minimum():Number
+ {
+ return IRangeModel(model).minimum;
+ }
+ public function set minimum(value:Number):void
+ {
+ IRangeModel(model).minimum = value;
+ }
+
+ /**
+ * The maximum value the control will display.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get maximum():Number
+ {
+ return IRangeModel(model).maximum;
+ }
+ public function set maximum(value:Number):void
+ {
+ IRangeModel(model).maximum = value;
+ }
+
+ /**
+ * The amount to increase or descrease the value. The value
+ * will not exceed the minimum or maximum value. The final
+ * value is affected by the snapInterval.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get stepSize():Number
+ {
+ return IRangeModel(model).stepSize;
+ }
+ public function set stepSize(value:Number):void
+ {
+ IRangeModel(model).stepSize = value;
+ }
+
+ /**
+ * The modulus for the value. If this property is set,
+ * the value displayed with a muliple of the snapInterval.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get snapInterval():Number
+ {
+ return IRangeModel(model).snapInterval;
+ }
+ public function set snapInterval(value:Number):void
+ {
+ IRangeModel(model).snapInterval = value;
+ }
+
+ COMPILE::JS
+ private var input:TextInput;
+
+ COMPILE::JS
+ private var spinner:Spinner;
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('div') as WrappedHTMLElement;
+ positioner = element;
+ positioner.style.position = 'relative';
+
+ input = new TextInput();
+ input.className = "NumericStepperInput";
+ input.typeNames = "NumericStepperInput";
+ addElement(input);
+ input.positioner.style.display = 'inline-block';
+ input.positioner.style.width = '100px';
+
+ spinner = new Spinner();
+ addElement(spinner);
+
+ /* TODO: ajh move to view and css */
+ spinner.positioner.style.display = 'inline-block';
+ goog.events.listen(spinner, 'valueChange',
+ spinnerChange);
+
+ element.flexjs_wrapper = this;
+ className = 'NumericStepper';
+
+ input.text = String(spinner.value);
+
+ return element;
+ }
+
+ /**
+ * @param event The input event.
+ */
+ COMPILE::JS
+ private function spinnerChange(event:Event):void
+ {
+ var newValue:Number = spinner.value;
+ value = newValue;
+ input.text = String(spinner.value);
+ dispatchEvent(new Event('valueChange'));
+ };
+
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Panel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Panel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Panel.as
new file mode 100644
index 0000000..e9c5986
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Panel.as
@@ -0,0 +1,121 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.IPanelModel;
+
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ [Event(name="close", type="org.apache.flex.events.Event")]
+
+ /**
+ * The Panel class is a Container component capable of parenting other
+ * components. The Panel has a TitleBar. If you want to a Panel with
+ * a ControlBar, use PanelWithControlBar which
+ * will instantiate, by default, an ControlBar.
+ * The Panel uses the following bead types:
+ *
+ * org.apache.flex.core.IBeadModel: the data model for the Panel that includes the title and whether
+ * or not to display the close button.
+ * org.apache.flex.core.IBeadView: creates the parts of the Panel.
+ * org.apache.flex.core.IBorderBead: if present, draws a border around the Panel.
+ * org.apache.flex.core.IBackgroundBead: if present, provides a colored background for the Panel.
+ *
+ * @see PanelWithControlBar
+ * @see ControlBar
+ * @see TitleBar
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class Panel extends Container
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Panel()
+ {
+ super();
+ }
+
+ /**
+ * The string to display in the org.apache.flex.html.TitleBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get title():String
+ {
+ return IPanelModel(model).title;
+ }
+ public function set title(value:String):void
+ {
+ IPanelModel(model).title = value;
+ }
+
+ /**
+ * The HTML string to display in the org.apache.flex.html.TitleBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get htmlTitle():String
+ {
+ return IPanelModel(model).htmlTitle;
+ }
+ public function set htmlTitle(value:String):void
+ {
+ IPanelModel(model).htmlTitle = value;
+ }
+
+ /**
+ * Whether or not to show a Close button in the org.apache.flex.html.TitleBar.
+ */
+ public function get showCloseButton():Boolean
+ {
+ return IPanelModel(model).showCloseButton;
+ }
+ public function set showCloseButton(value:Boolean):void
+ {
+ IPanelModel(model).showCloseButton = value;
+ }
+
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ super.createElement();
+ element.className = "Panel";
+ typeNames = "Panel";
+ return element;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/PanelWithControlBar.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/PanelWithControlBar.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/PanelWithControlBar.as
new file mode 100644
index 0000000..7659d9d
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/PanelWithControlBar.as
@@ -0,0 +1,121 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.IPanelModel;
+
+ [Event(name="close", type="org.apache.flex.events.Event")]
+
+ /**
+ * The Panel class is a Container component capable of parenting other
+ * components. The Panel has a TitleBar and an optional org.apache.flex.html.ControlBar.
+ * The Panel uses the following bead types:
+ *
+ * org.apache.flex.core.IBeadModel: the data model for the Panel that includes the title and whether
+ * or not to display the close button.
+ * org.apache.flex.core.IBeadView: creates the parts of the Panel.
+ * org.apache.flex.core.IBorderBead: if present, draws a border around the Panel.
+ * org.apache.flex.core.IBackgroundBead: if present, provides a colored background for the Panel.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class PanelWithControlBar extends Container
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function PanelWithControlBar()
+ {
+ super();
+ }
+
+ /**
+ * The string to display in the org.apache.flex.html.TitleBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get title():String
+ {
+ return IPanelModel(model).title;
+ }
+ public function set title(value:String):void
+ {
+ IPanelModel(model).title = value;
+ }
+
+ /**
+ * The HTML string to display in the org.apache.flex.html.TitleBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get htmlTitle():String
+ {
+ return IPanelModel(model).htmlTitle;
+ }
+ public function set htmlTitle(value:String):void
+ {
+ IPanelModel(model).htmlTitle = value;
+ }
+
+ /**
+ * Whether or not to show a Close button in the org.apache.flex.html.TitleBar.
+ */
+ public function get showCloseButton():Boolean
+ {
+ return IPanelModel(model).showCloseButton;
+ }
+ public function set showCloseButton(value:Boolean):void
+ {
+ IPanelModel(model).showCloseButton = value;
+ }
+
+ /**
+ * The items in the org.apache.flex.html.ControlBar. Setting this property automatically
+ * causes the ControlBar to display.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get controlBar():Array
+ {
+ return IPanelModel(model).controlBar;
+ }
+ public function set controlBar(value:Array):void
+ {
+ IPanelModel(model).controlBar = value;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/RadioButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/RadioButton.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/RadioButton.as
new file mode 100644
index 0000000..9aa2254
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/RadioButton.as
@@ -0,0 +1,350 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ COMPILE::SWF
+ {
+ import flash.display.DisplayObject;
+ import flash.events.MouseEvent;
+ import flash.utils.Dictionary;
+ }
+
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IValueToggleButtonModel;
+ COMPILE::SWF
+ {
+ import org.apache.flex.core.UIButtonBase;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.WrappedHTMLElement;
+ import org.apache.flex.html.supportClasses.RadioButtonIcon;
+ }
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.core.IUIBase;
+
+ [Event(name="change", type="org.apache.flex.events.Event")]
+
+ /**
+ * The RadioButton class is a component that displays a selectable Button. RadioButtons
+ * are typically used in groups, identified by the groupName property. RadioButton use
+ * the following beads:
+ *
+ * org.apache.flex.core.IBeadModel: the data model, which includes the groupName.
+ * org.apache.flex.core.IBeadView: the bead that constructs the visual parts of the RadioButton..
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public class RadioButton extends UIButtonBase implements IStrand
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function RadioButton(upState:DisplayObject=null, overState:DisplayObject=null, downState:DisplayObject=null, hitTestState:DisplayObject=null)
+ {
+ super(upState, overState, downState, hitTestState);
+
+ addEventListener(org.apache.flex.events.MouseEvent.CLICK, internalMouseHandler);
+ }
+
+ protected static var dict:Dictionary = new Dictionary(true);
+
+ private var _groupName:String;
+
+ /**
+ * The name of the group. Only one RadioButton in a group is selected.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get groupName() : String
+ {
+ return IValueToggleButtonModel(model).groupName;
+ }
+ public function set groupName(value:String) : void
+ {
+ IValueToggleButtonModel(model).groupName = value;
+ }
+
+ /**
+ * The string used as a label for the RadioButton.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ return IValueToggleButtonModel(model).text;
+ }
+ public function set text(value:String):void
+ {
+ IValueToggleButtonModel(model).text = value;
+ }
+
+ /**
+ * Whether or not the RadioButton instance is selected. Setting this property
+ * causes the currently selected RadioButton in the same group to lose the
+ * selection.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selected():Boolean
+ {
+ return IValueToggleButtonModel(model).selected;
+ }
+ public function set selected(selValue:Boolean):void
+ {
+ IValueToggleButtonModel(model).selected = selValue;
+
+ // if this button is being selected, its value should become
+ // its group's selectedValue
+ if( selValue ) {
+ for each(var rb:RadioButton in dict)
+ {
+ if( rb.groupName == groupName )
+ {
+ rb.selectedValue = value;
+ }
+ }
+ }
+ }
+
+ /**
+ * The value associated with the RadioButton. For example, RadioButtons with labels,
+ * "Red", "Green", and "Blue" might have the values 0, 1, and 2 respectively.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get value():Object
+ {
+ return IValueToggleButtonModel(model).value;
+ }
+ public function set value(newValue:Object):void
+ {
+ IValueToggleButtonModel(model).value = newValue;
+ }
+
+ /**
+ * The group's currently selected value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedValue():Object
+ {
+ return IValueToggleButtonModel(model).selectedValue;
+ }
+ public function set selectedValue(newValue:Object):void
+ {
+ // a radio button is really selected when its value matches that of the group's value
+ IValueToggleButtonModel(model).selected = (newValue == value);
+ IValueToggleButtonModel(model).selectedValue = newValue;
+ }
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+
+ // if this instance is selected, set the local selectedValue to
+ // this instance's value
+ if( selected ) selectedValue = value;
+
+ else {
+
+ // make sure this button's selectedValue is set from its group's selectedValue
+ // to keep it in sync with the rest of the buttons in its group.
+ for each(var rb:RadioButton in dict)
+ {
+ if( rb.groupName == groupName )
+ {
+ selectedValue = rb.selectedValue;
+ break;
+ }
+ }
+ }
+
+ dict[this] = this;
+ }
+
+ /**
+ * @private
+ */
+ private function internalMouseHandler(event:org.apache.flex.events.MouseEvent) : void
+ {
+ // prevent radiobutton from being turned off by a click
+ if( !selected ) {
+ selected = !selected;
+ dispatchEvent(new Event("change"));
+ }
+ }
+ }
+
+ COMPILE::JS
+ public class RadioButton extends UIBase
+ {
+ public static var radioCounter:int = 0;
+
+ private var labelFor:HTMLLabelElement;
+ private var textNode:Text;
+ private var icon:RadioButtonIcon;
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion HTMLInputElement
+ * @flexjsignorecoercion HTMLLabelElement
+ * @flexjsignorecoercion Text
+ */
+ override protected function createElement():WrappedHTMLElement
+ {
+ icon = new RadioButtonIcon()
+ icon.id = '_radio_' + RadioButton.radioCounter++;
+
+ textNode = document.createTextNode('radio button') as Text;
+
+ labelFor = document.createElement('label') as HTMLLabelElement;
+ labelFor.appendChild(icon.element);
+ labelFor.appendChild(textNode);
+
+ element = labelFor as WrappedHTMLElement;
+
+ positioner = element;
+ positioner.style.position = 'relative';
+
+ (element as WrappedHTMLElement).flexjs_wrapper = this;
+ (textNode as WrappedHTMLElement).flexjs_wrapper = this;
+ (icon.element as WrappedHTMLElement).flexjs_wrapper = this;
+
+ className = 'RadioButton';
+ typeNames = 'RadioButton, RadioButtonIcon';
+
+ return element;
+ }
+
+ override public function set id(value:String):void
+ {
+ super.id = value;
+ labelFor.id = value;
+ icon.element.id = value;
+ }
+
+ public function get groupName():String
+ {
+ return (icon.element as HTMLInputElement).name as String;
+ }
+ public function set groupName(value:String):void
+ {
+ (icon.element as HTMLInputElement).name = value;
+ }
+
+ public function get text():String
+ {
+ return textNode.nodeValue as String;
+ }
+ public function set text(value:String):void
+ {
+ textNode.nodeValue = value;
+ }
+
+ /** @export */
+ public function get selected():Boolean
+ {
+ return (icon.element as HTMLInputElement).checked;
+ }
+ public function set selected(value:Boolean):void
+ {
+ (icon.element as HTMLInputElement).checked = value;
+ }
+
+ public function get value():Object
+ {
+ return (icon.element as HTMLInputElement).value;
+ }
+ public function set value(v:Object):void
+ {
+ (icon.element as HTMLInputElement).value = v as String;
+ }
+
+ public function get selectedValue():Object
+ {
+ var buttons:NodeList;
+ var groupName:String;
+ var i:int;
+ var n:int;
+
+ groupName = (icon.element as HTMLInputElement).name as String;
+ buttons = document.getElementsByName(groupName);
+ n = buttons.length;
+
+ for (i = 0; i < n; i++) {
+ if (buttons[i].checked) {
+ return buttons[i].value;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @flexjsignorecoercion Array
+ */
+ public function set selectedValue(value:Object):void
+ {
+ var buttons:NodeList;
+ var groupName:String;
+ var i:int;
+ var n:int;
+
+ groupName = (icon.element as HTMLInputElement).name as String;
+ buttons = document.getElementsByName(groupName);
+ n = buttons.length;
+ for (i = 0; i < n; i++) {
+ if (buttons[i].value === value) {
+ buttons[i].checked = true;
+ break;
+ }
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/RangeStepper.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/RangeStepper.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/RangeStepper.as
new file mode 100644
index 0000000..bcba27b
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/RangeStepper.as
@@ -0,0 +1,69 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.IRangeModel;
+ import org.apache.flex.core.UIBase;
+
+ /**
+ * The RangeStepper control allows for the selection of a single value
+ * from multiple choices.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class RangeStepper extends UIBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function RangeStepper()
+ {
+ super();
+
+ className = "RangeStepper";
+
+ setWidthAndHeight(40, 60, true);
+ }
+
+ /**
+ * The value selected or set.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set value(newValue:Number):void
+ {
+ IRangeModel(model).value = newValue;
+ }
+ public function get value():Number
+ {
+ return IRangeModel(model).value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/SimpleAlert.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/SimpleAlert.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/SimpleAlert.as
new file mode 100644
index 0000000..0719036
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/SimpleAlert.as
@@ -0,0 +1,140 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.IAlertModel;
+ import org.apache.flex.core.IPopUp;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+
+ [Event(name="close", type="org.apache.flex.events.Event")]
+
+ /**
+ * The SimpleAlert class is a component that displays a message and an OK button. The
+ * SimpleAlert converts directly to window.alert() for HTML. SimpleAlert uses
+ * the following beads:
+ *
+ * org.apache.flex.core.IBeadModel: the data model, which includes the message.
+ * org.apache.flex.core.IBeadView: the bead that constructs the visual parts of the Alert.
+ * org.apache.flex.core.IBeadController: the bead responsible for handling input events.
+ * org.apache.flex.core.IBorderBead: a bead, if present, that draws a border around the control.
+ * org.apache.flex.core.IBackgroundBead: a bead, if present, that creates a solid-color background.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SimpleAlert extends UIBase implements IPopUp
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SimpleAlert()
+ {
+ super();
+
+ className = "SimpleAlert";
+ }
+
+ /**
+ * The message to display.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ private function get message():String
+ {
+ return IAlertModel(model).message;
+ }
+ private function set message(value:String):void
+ {
+ IAlertModel(model).message = value;
+ }
+
+ /**
+ * The HTML message to display.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ private function get htmlMessage():String
+ {
+ return IAlertModel(model).htmlMessage;
+ }
+ private function set htmlMessage(value:String):void
+ {
+ IAlertModel(model).htmlMessage = value;
+ }
+
+ /**
+ * This function causes the SimpleAlert to appear. The parent is used for ActionScript and
+ * identifies the IPopUpParent that manages the alert.
+ *
+ * @param Object parent The object that hosts the pop-up.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function showAlert(parent:Object) : void
+ {
+ parent.addElement(this);
+ }
+
+ /**
+ * A convenience function to compose and display the alert.
+ *
+ * @param String message The content to display in the SimpleAlert.
+ * @param Object parent The object that hosts the pop-up.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ static public function show(message:String, parent:Object):SimpleAlert
+ {
+ COMPILE::SWF
+ {
+ var alert:SimpleAlert = new SimpleAlert();
+ alert.message = message;
+ alert.showAlert(parent);
+
+ return alert;
+ }
+ COMPILE::JS
+ {
+ alert(message);
+ return null;
+ }
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/SimpleList.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/SimpleList.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/SimpleList.as
new file mode 100644
index 0000000..9dcb348
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/SimpleList.as
@@ -0,0 +1,79 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ COMPILE::JS
+ {
+ import goog.events;
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The SimpleList class is a component that displays data in a vertical column. This
+ * component differs from org.apache.flex.html.List in that it displays
+ * only string values and maps to the <select> HTML element.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SimpleList extends List
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SimpleList()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion HTMLSelectElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('select') as WrappedHTMLElement;
+ (element as HTMLSelectElement).size = 5;
+ goog.events.listen(element, 'change',
+ changeHandler);
+ positioner = element;
+ positioner.style.position = 'relative';
+ className = 'SimpleList';
+
+ return element;
+ }
+
+ /**
+ * @flexjsignorecoercion HTMLSelectElement
+ */
+ COMPILE::JS
+ protected function changeHandler(event:Event):void
+ {
+ model.selectedIndex = (element as HTMLSelectElement).selectedIndex;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Slider.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Slider.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Slider.as
new file mode 100644
index 0000000..d10891c
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Slider.as
@@ -0,0 +1,233 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.IRangeModel;
+ import org.apache.flex.core.UIBase;
+
+ COMPILE::JS
+ {
+ import org.apache.flex.html.beads.SliderTrackView;
+ import org.apache.flex.html.beads.SliderThumbView;
+ import org.apache.flex.html.beads.controllers.SliderMouseController;
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ [Event(name="valueChange", type="org.apache.flex.events.Event")]
+
+ /**
+ * The Slider class is a component that displays a range of values using a
+ * track and a thumb control. The Slider uses the following bead types:
+ *
+ * org.apache.flex.core.IBeadModel: the data model, typically an IRangeModel, that holds the Slider values.
+ * org.apache.flex.core.IBeadView: the bead that constructs the visual parts of the Slider.
+ * org.apache.flex.core.IBeadController: the bead that handles input.
+ * org.apache.flex.core.IThumbValue: the bead responsible for the display of the thumb control.
+ * org.apache.flex.core.ITrackView: the bead responsible for the display of the track.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class Slider extends UIBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Slider()
+ {
+ super();
+
+ className = "Slider";
+
+ IRangeModel(model).value = 0;
+ IRangeModel(model).minimum = 0;
+ IRangeModel(model).maximum = 100;
+ IRangeModel(model).stepSize = 1;
+ IRangeModel(model).snapInterval = 1;
+ }
+
+ /**
+ * The current value of the Slider.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get value():Number
+ {
+ return IRangeModel(model).value;
+ }
+ public function set value(newValue:Number):void
+ {
+ IRangeModel(model).value = newValue;
+ }
+
+ /**
+ * The minimum value of the Slider.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get minimum():Number
+ {
+ return IRangeModel(model).minimum;
+ }
+ public function set minimum(value:Number):void
+ {
+ IRangeModel(model).minimum = value;
+ }
+
+ /**
+ * The maximum value of the Slider.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get maximum():Number
+ {
+ return IRangeModel(model).maximum;
+ }
+ public function set maximum(value:Number):void
+ {
+ IRangeModel(model).maximum = value;
+ }
+
+ /**
+ * The modulus of the Slider value. The thumb will be positioned
+ * at the nearest multiple of this value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get snapInterval():Number
+ {
+ return IRangeModel(model).snapInterval;
+ }
+ public function set snapInterval(value:Number):void
+ {
+ IRangeModel(model).snapInterval = value;
+ }
+
+ /**
+ * The amount to move the thumb when the track is selected. This value is
+ * adjusted to fit the nearest snapInterval.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get stepSize():Number
+ {
+ return IRangeModel(model).stepSize;
+ }
+ public function set stepSize(value:Number):void
+ {
+ IRangeModel(model).stepSize = value;
+ }
+
+ COMPILE::JS
+ private var track:SliderTrackView;
+
+ COMPILE::JS
+ private var thumb:SliderThumbView;
+
+ COMPILE::JS
+ private var controller:SliderMouseController;
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('div') as WrappedHTMLElement;
+ element.style.width = '200px';
+ element.style.height = '30px';
+
+ track = new SliderTrackView();
+ addBead(track);
+
+ thumb = new SliderThumbView();
+ addBead(thumb);
+
+ controller = new SliderMouseController();
+ addBead(controller);
+
+ positioner = element;
+ positioner.style.position = 'relative';
+ element.flexjs_wrapper = this;
+
+ className = 'Slider';
+
+ return element;
+ }
+
+ /**
+ */
+ COMPILE::JS
+ public function snap(value:Number):Number
+ {
+ var si:Number = snapInterval;
+ var n:Number = Math.round((value - minimum) / si) *
+ si + minimum;
+ if (value > 0)
+ {
+ if (value - n < n + si - value)
+ return n;
+ return n + si;
+ }
+ if (value - n > n + si - value)
+ return n + si;
+ return n;
+ }
+
+
+ /**
+ * @param {number} value The value used to calculate new position of the thumb.
+ * @return {void} Moves the thumb to the corresponding position.
+ */
+ COMPILE::JS
+ public function setThumbFromValue(value:Number):void
+ {
+ var min:Number = model.minimum;
+ var max:Number = model.maximum;
+ var p:Number = (value - min) / (max - min);
+ var xloc:Number = p * (parseInt(track.element.style.width, 10) -
+ parseInt(thumb.element.style.width, 10));
+
+ thumb.element.style.left = "" + xloc + 'px';
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Spacer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Spacer.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Spacer.as
new file mode 100644
index 0000000..d7ab050
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Spacer.as
@@ -0,0 +1,64 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.UIBase;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The Spacer class takes up space in the UI layout.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class Spacer extends UIBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Spacer()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ this.element = document.createElement('div') as WrappedHTMLElement;
+ this.positioner = this.element;
+ this.element.flexjs_wrapper = this;
+
+ return element;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Spinner.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Spinner.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Spinner.as
new file mode 100644
index 0000000..65b5290
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Spinner.as
@@ -0,0 +1,166 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.IRangeModel;
+ import org.apache.flex.core.UIBase;
+
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ [Event(name="valueChange", type="org.apache.flex.events.Event")]
+
+ /**
+ * The Spinner class is a component that displays a control for incrementing a value
+ * and a control for decrementing a value. The org.apache.flex.html.NumericStepper
+ * uses a Spinner as part of the component. Spinner uses the following beads:
+ *
+ * org.apache.flex.core.IBeadModel: an IRangeModel to hold the properties.
+ * org.apache.flex.core.IBeadView: the bead that constructs the visual parts of the Spinner.
+ * org.apache.flex.core.IBeadController: a bead that handles the input events.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class Spinner extends UIBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Spinner()
+ {
+ super();
+
+ className = "Spinner";
+ }
+
+ /**
+ * The current value of the Spinner.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get value():Number
+ {
+ return IRangeModel(model).value;
+ }
+ public function set value(newValue:Number):void
+ {
+ IRangeModel(model).value = newValue;
+ }
+
+ /**
+ * The minimum value of the Spinner.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get minimum():Number
+ {
+ return IRangeModel(model).minimum;
+ }
+ public function set minimum(value:Number):void
+ {
+ IRangeModel(model).minimum = value;
+ }
+
+ /**
+ * The maximum value of the Spinner.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get maximum():Number
+ {
+ return IRangeModel(model).maximum;
+ }
+ public function set maximum(value:Number):void
+ {
+ IRangeModel(model).maximum = value;
+ }
+
+ /**
+ * The modulus for the value. If this property is set,
+ * the value displayed with a muliple of the snapInterval.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get snapInterval():Number
+ {
+ return IRangeModel(model).snapInterval;
+ }
+ public function set snapInterval(value:Number):void
+ {
+ IRangeModel(model).snapInterval = value;
+ }
+
+ /**
+ * The amount to increase or descrease the value. The value
+ * will not exceed the minimum or maximum value. The final
+ * value is affected by the snapInterval.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get stepSize():Number
+ {
+ return IRangeModel(model).stepSize;
+ }
+ public function set stepSize(value:Number):void
+ {
+ IRangeModel(model).stepSize = value;
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('div') as WrappedHTMLElement;
+ positioner = element;
+ positioner.style.position = 'relative';
+
+ element.style.verticalAlign = 'middle';
+ element.flexjs_wrapper = this;
+
+ return element;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/TextArea.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/TextArea.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/TextArea.as
new file mode 100644
index 0000000..10b7555
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/TextArea.as
@@ -0,0 +1,126 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.ITextModel;
+ import org.apache.flex.core.UIBase;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The TextArea class implements the basic control for
+ * multi-line text input.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextArea extends UIBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TextArea()
+ {
+ super();
+ }
+
+ /**
+ * @copy org.apache.flex.html.Label#text
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion HTMLInputElement
+ */
+ public function get text():String
+ {
+ COMPILE::SWF
+ {
+ return ITextModel(model).text;
+ }
+ COMPILE::JS
+ {
+ return (element as HTMLInputElement).value;
+ }
+ }
+
+ /**
+ * @private
+ * @flexjsignorecoercion HTMLInputElement
+ */
+ public function set text(value:String):void
+ {
+ COMPILE::SWF
+ {
+ ITextModel(model).text = value;
+ }
+ COMPILE::JS
+ {
+ (element as HTMLInputElement).value = value;
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.html.Label#html
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get html():String
+ {
+ return ITextModel(model).html;
+ }
+
+ /**
+ * @private
+ */
+ public function set html(value:String):void
+ {
+ ITextModel(model).html = value;
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('textarea') as WrappedHTMLElement;
+ positioner = element;
+ positioner.style.position = 'relative';
+ element.flexjs_wrapper = this;
+ element.className = 'TextArea';
+ typeNames = 'TextArea';
+
+ return element;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/TextButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/TextButton.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/TextButton.as
new file mode 100644
index 0000000..a08c9b3
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/TextButton.as
@@ -0,0 +1,139 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.ITextModel;
+
+ COMPILE::JS {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ [DefaultProperty("text")]
+
+ /**
+ * The TextButton class implements a basic button that
+ * displays text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextButton extends ButtonBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TextButton()
+ {
+ super();
+ }
+
+ /**
+ * @copy org.apache.flex.html.Label#text
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ COMPILE::SWF
+ {
+ return ITextModel(model).text;
+ }
+ COMPILE::JS
+ {
+ return element.innerHTML;
+ }
+ }
+
+ /**
+ * @private
+ */
+ public function set text(value:String):void
+ {
+ COMPILE::SWF
+ {
+ ITextModel(model).text = value;
+ }
+ COMPILE::JS
+ {
+ this.element.innerHTML = value;
+ this.dispatchEvent('textChange');
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.html.Label#html
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get html():String
+ {
+ COMPILE::SWF
+ {
+ return ITextModel(model).html;
+ }
+ COMPILE::JS
+ {
+ return element.innerHTML;
+ }
+ }
+
+ /**
+ * @private
+ */
+ public function set html(value:String):void
+ {
+ COMPILE::SWF
+ {
+ ITextModel(model).html = value;
+ }
+ COMPILE::JS
+ {
+ this.element.innerHTML = value;
+ this.dispatchEvent('textChange');
+ }
+ }
+
+ /**
+ * @private
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ var element:WrappedHTMLElement = super.createElement();
+ className = "TextButton";
+ typeNames = "TextButton";
+ return element;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/TextInput.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/TextInput.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/TextInput.as
new file mode 100644
index 0000000..c8df45d
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/TextInput.as
@@ -0,0 +1,187 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.ITextModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ COMPILE::JS
+ {
+ import goog.events;
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * Dispatched when the user changes the text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="change", type="org.apache.flex.events.Event")]
+
+ /**
+ * The TextInput class implements the basic control for
+ * single-line text input.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextInput extends UIBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TextInput()
+ {
+ super();
+
+ COMPILE::SWF
+ {
+ model.addEventListener("textChange", textChangeHandler);
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.html.Label#text
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion HTMLInputElement
+ */
+ [Bindable(event="change")]
+ public function get text():String
+ {
+ COMPILE::SWF
+ {
+ return ITextModel(model).text;
+ }
+ COMPILE::JS
+ {
+ return (element as HTMLInputElement).value;
+ }
+ }
+
+ /**
+ * @private
+ * @flexjsignorecoercion HTMLInputElement
+ */
+ public function set text(value:String):void
+ {
+ COMPILE::SWF
+ {
+ inSetter = true;
+ ITextModel(model).text = value;
+ inSetter = false;
+ }
+ COMPILE::JS
+ {
+ (element as HTMLInputElement).value = value;
+ dispatchEvent(new Event('textChange'));
+ }
+ }
+
+ /**
+ * @copy org.apache.flex.html.Label#html
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion HTMLInputElement
+ */
+ [Bindable(event="change")]
+ public function get html():String
+ {
+ COMPILE::SWF
+ {
+ return ITextModel(model).html;
+ }
+ COMPILE::JS
+ {
+ return (element as HTMLInputElement).value;
+ }
+ }
+
+ /**
+ * @private
+ * @flexjsignorecoercion HTMLInputElement
+ */
+ public function set html(value:String):void
+ {
+ COMPILE::SWF
+ {
+ ITextModel(model).html = value;
+ }
+ COMPILE::JS
+ {
+ (element as HTMLInputElement).value = value;
+ dispatchEvent(new Event('textChange'));
+ }
+ }
+
+ private var inSetter:Boolean;
+
+ /**
+ * dispatch change event in response to a textChange event
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function textChangeHandler(event:Event):void
+ {
+ if (!inSetter)
+ dispatchEvent(new Event(Event.CHANGE));
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('input') as WrappedHTMLElement;
+ element.setAttribute('type', 'input');
+ element.className = 'TextInput';
+ typeNames = 'TextInput';
+
+ //attach input handler to dispatch flexjs change event when user write in textinput
+ //goog.events.listen(element, 'change', killChangeHandler);
+ goog.events.listen(element, 'input', textChangeHandler);
+
+ positioner = element;
+ positioner.style.position = 'relative';
+ element.flexjs_wrapper = this;
+
+ return element;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/TitleBar.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/TitleBar.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/TitleBar.as
new file mode 100644
index 0000000..3902330
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/TitleBar.as
@@ -0,0 +1,146 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IChrome;
+ import org.apache.flex.core.ITitleBarModel;
+ import org.apache.flex.core.ValuesManager;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+ import org.apache.flex.events.Event;
+ import org.apache.flex.html.Label;
+
+ /**
+ * The TitleBar class is a Container component that displays a title and an
+ * optional close button. The TitleBar uses the following bead types:
+ *
+ * org.apache.flex.core.IBeadModel: the data model, which includes the title and showCloseButton values.
+ * org.apache.flex.core.IBeadView: the bead that constructs the visual parts of the component.
+ * org.apache.flex.core.IBeadLayout: the bead that handles size and position of the component parts
+ * (org.apache.flex.html.Label and org.apache.flex.html.Button).
+ * org.apache.flex.core.IMeasurementBead: a bead that helps determine the size of the
+ * org.apache.flex.html.TitleBar for layout.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TitleBar extends Container implements IChrome
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TitleBar()
+ {
+ super();
+
+ className = "TitleBar";
+ }
+
+ /**
+ * The title string to display.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get title():String
+ {
+ return ITitleBarModel(model).title;
+ }
+ public function set title(value:String):void
+ {
+ ITitleBarModel(model).title = value;
+ }
+
+ /**
+ * The HTML title to display.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get htmlTitle():String
+ {
+ return ITitleBarModel(model).htmlTitle;
+ }
+ public function set htmlTitle(value:String):void
+ {
+ ITitleBarModel(model).htmlTitle = value;
+ }
+
+ /**
+ * Whether or not to show a org.apache.flex.html.Button that indicates the component
+ * may be closed.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get showCloseButton():Boolean
+ {
+ return ITitleBarModel(model).showCloseButton;
+ }
+ public function set showCloseButton(value:Boolean):void
+ {
+ ITitleBarModel(model).showCloseButton = value;
+ }
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+
+ if( getBeadByType(IBeadLayout) == null )
+ addBead(new (ValuesManager.valuesImpl.getValue(this, "iBeadLayout")) as IBead);
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('div') as WrappedHTMLElement;
+
+ positioner = element;
+ positioner.style.position = 'relative';
+ element.flexjs_wrapper = this;
+
+ className = 'TitleBar';
+
+ return element;
+ }
+ }
+}
[34/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] -
replace UIBase dependency
Posted by ah...@apache.org.
replace UIBase dependency
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/0d06e658
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/0d06e658
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/0d06e658
Branch: refs/heads/refactor-sprite
Commit: 0d06e658dc87a1b6fd84e47565057c8e42f6a694
Parents: 7af78c1
Author: Alex Harui <ah...@apache.org>
Authored: Fri Oct 28 23:20:14 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:59:02 2016 -0700
----------------------------------------------------------------------
.../main/flex/org/apache/flex/core/BrowserResizeListener.as | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0d06e658/frameworks/projects/Core/src/main/flex/org/apache/flex/core/BrowserResizeListener.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/BrowserResizeListener.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/BrowserResizeListener.as
index a8fb5c0..441bfee 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/BrowserResizeListener.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/BrowserResizeListener.as
@@ -109,11 +109,14 @@ COMPILE::SWF
}
}
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.ILayoutChild
+ */
private function resizeHandler(event:Event):void
{
COMPILE::SWF
{
- var initialView:UIBase = app.initialView as UIBase;
+ var initialView:ILayoutChild = app.initialView as ILayoutChild;
var constrainedWidth:Number = Math.max(isNaN(minWidth) ? 0 : minWidth, app.$displayObject.stage.stageWidth);
var constrainedHeight:Number = Math.max(isNaN(minHeight) ? 0 : minHeight, app.$displayObject.stage.stageHeight);
if (!isNaN(initialView.percentWidth) && !isNaN(initialView.percentHeight))
@@ -125,7 +128,7 @@ COMPILE::SWF
}
COMPILE::JS
{
- var initialView:UIBase = app.initialView as UIBase;
+ var initialView:ILayoutChild = app.initialView as ILayoutChild;
var element:HTMLElement = app.element;
if (!isNaN(initialView.percentWidth) || !isNaN(initialView.percentHeight)) {
element.style.height = window.innerHeight + 'px';
[42/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - change
TextButton to inherit from Button instead of ButtonBase so it picks up
default styles on Button
Posted by ah...@apache.org.
change TextButton to inherit from Button instead of ButtonBase so it picks up default styles on Button
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a5cf2777
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a5cf2777
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a5cf2777
Branch: refs/heads/refactor-sprite
Commit: a5cf27772f5bf71b92c8042f9c6ac1c4a03787bb
Parents: fdc2a4c
Author: Alex Harui <ah...@apache.org>
Authored: Mon Oct 31 23:36:11 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 08:12:11 2016 -0700
----------------------------------------------------------------------
.../projects/HTML/src/main/flex/org/apache/flex/html/TextButton.as | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a5cf2777/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TextButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TextButton.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TextButton.as
index a08c9b3..b2997c2 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TextButton.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TextButton.as
@@ -35,7 +35,7 @@ package org.apache.flex.html
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public class TextButton extends ButtonBase
+ public class TextButton extends Button
{
/**
* Constructor.
[22/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - also
move SimpleApplication
Posted by ah...@apache.org.
also move SimpleApplication
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/f241391d
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/f241391d
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/f241391d
Branch: refs/heads/refactor-sprite
Commit: f241391dfac6a12a4c72aad20dacc258e0b1438e
Parents: 8f155cf
Author: Alex Harui <ah...@apache.org>
Authored: Thu Oct 27 17:25:53 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:46:52 2016 -0700
----------------------------------------------------------------------
.../org/apache/flex/core/SimpleApplication.as | 102 -------------------
.../org/apache/flex/core/SimpleApplication.as | 102 +++++++++++++++++++
2 files changed, 102 insertions(+), 102 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f241391d/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleApplication.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleApplication.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleApplication.as
deleted file mode 100644
index 770d0b2..0000000
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleApplication.as
+++ /dev/null
@@ -1,102 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.core
-{
- COMPILE::SWF
- {
- import flash.display.DisplayObject;
- import flash.display.Sprite;
- import flash.display.StageAlign;
- import flash.display.StageQuality;
- import flash.display.StageScaleMode;
- import flash.events.Event;
- import flash.system.ApplicationDomain;
- import flash.utils.getQualifiedClassName;
- }
-
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.events.MouseEvent;
- import org.apache.flex.events.utils.MouseEventConverter;
- import org.apache.flex.utils.MXMLDataInterpreter;
-
- /**
- * A SWF application must be bootstrapped by a Flash Sprite.
- * The factory class is the default bootstrap.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- [Frame(factoryClass="org.apache.flex.core.ApplicationFactory")]
-
- /**
- * The SimpleApplication class can be used as the main class and entry point
- * for low-level ActionScript-only FlexJS
- * applications. It is not indended for use in MXML applications or most
- * of the FlexJS components as they expect a certain application lifecycle
- * in the org.apache.flex.core.Application class.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class SimpleApplication extends ApplicationBase
- {
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function SimpleApplication()
- {
- super();
- }
-
- COMPILE::SWF
- public function setRoot(r:WrappedMovieClip):void
- {
- element = r;
- start();
- }
-
- /**
- * The entry point. Override this and put all of your code in here.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function start():void
- {
- COMPILE::JS
- {
- this.element = document.getElementsByTagName('body')[0];
- this.element.flexjs_wrapper = this;
- this.element.className = 'SimpleApplication';
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f241391d/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/SimpleApplication.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/SimpleApplication.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/SimpleApplication.as
new file mode 100644
index 0000000..770d0b2
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/SimpleApplication.as
@@ -0,0 +1,102 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ COMPILE::SWF
+ {
+ import flash.display.DisplayObject;
+ import flash.display.Sprite;
+ import flash.display.StageAlign;
+ import flash.display.StageQuality;
+ import flash.display.StageScaleMode;
+ import flash.events.Event;
+ import flash.system.ApplicationDomain;
+ import flash.utils.getQualifiedClassName;
+ }
+
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.utils.MouseEventConverter;
+ import org.apache.flex.utils.MXMLDataInterpreter;
+
+ /**
+ * A SWF application must be bootstrapped by a Flash Sprite.
+ * The factory class is the default bootstrap.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ [Frame(factoryClass="org.apache.flex.core.ApplicationFactory")]
+
+ /**
+ * The SimpleApplication class can be used as the main class and entry point
+ * for low-level ActionScript-only FlexJS
+ * applications. It is not indended for use in MXML applications or most
+ * of the FlexJS components as they expect a certain application lifecycle
+ * in the org.apache.flex.core.Application class.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SimpleApplication extends ApplicationBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SimpleApplication()
+ {
+ super();
+ }
+
+ COMPILE::SWF
+ public function setRoot(r:WrappedMovieClip):void
+ {
+ element = r;
+ start();
+ }
+
+ /**
+ * The entry point. Override this and put all of your code in here.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function start():void
+ {
+ COMPILE::JS
+ {
+ this.element = document.getElementsByTagName('body')[0];
+ this.element.flexjs_wrapper = this;
+ this.element.className = 'SimpleApplication';
+ }
+ }
+ }
+}
[06/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - try to
copy HTML to Basic without losing history
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ImageAndTextModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ImageAndTextModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ImageAndTextModel.as
new file mode 100644
index 0000000..01dd3e9
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ImageAndTextModel.as
@@ -0,0 +1,77 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ITextModel;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The ImageAndTextModel class is associates and image
+ * with some text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ImageAndTextModel extends TextModel
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ImageAndTextModel()
+ {
+ }
+
+
+ private var _image:String;
+
+ /**
+ * The URL of an icon to use in the button
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get image():String
+ {
+ return _image;
+ }
+
+ /**
+ * @private
+ */
+ public function set image(value:String):void
+ {
+ _image = value;
+ dispatchEvent(new Event("imageChange"));
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ImageModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ImageModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ImageModel.as
new file mode 100644
index 0000000..7742c2b
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ImageModel.as
@@ -0,0 +1,89 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.core.IImageModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * The ImageModel class bead defines the data associated with an org.apache.flex.html.Image
+ * component, namely the source of the image.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ImageModel extends EventDispatcher implements IImageModel
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ImageModel()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _source:String;
+
+ /**
+ * The source of the image.
+ *
+ * @copy org.apache.flex.core.IImageModel#source
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get source():String
+ {
+ return _source;
+ }
+ public function set source(value:String):void
+ {
+ if (value != _source) {
+ _source = value;
+ dispatchEvent( new Event("urlChanged") );
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ListPresentationModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ListPresentationModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ListPresentationModel.as
new file mode 100644
index 0000000..8a372ac
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ListPresentationModel.as
@@ -0,0 +1,107 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.core.IListPresentationModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * The ListPresentationModel holds values used by list controls for presenting
+ * their user interfaces.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ListPresentationModel extends EventDispatcher implements IListPresentationModel
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ListPresentationModel()
+ {
+ super();
+ }
+
+ private var _rowHeight:Number = 30;
+
+ /**
+ * The height of each row.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get rowHeight():Number
+ {
+ return _rowHeight;
+ }
+
+ public function set rowHeight(value:Number):void
+ {
+ _rowHeight = value;
+ dispatchEvent(new Event("rowHeightChanged"));
+ }
+
+ private var _separatorThickness:Number = 0;
+
+ /**
+ * The distance between rows.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get separatorThickness():Number
+ {
+ return _separatorThickness;
+ }
+
+ public function set separatorThickness(value:Number):void
+ {
+ _separatorThickness = value;
+ dispatchEvent(new Event("separatorThicknessChanged"));
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/PanelModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/PanelModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/PanelModel.as
new file mode 100644
index 0000000..5741fdd
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/PanelModel.as
@@ -0,0 +1,158 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IPanelModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * The PanelModel bead class holds the values for a org.apache.flex.html.Panel, such as its
+ * title.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class PanelModel extends EventDispatcher implements IBead, IPanelModel
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function PanelModel()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _controlBar:Array;
+
+ /**
+ * The items in the org.apache.flex.html.ControlBar. Setting this property automatically
+ * causes the ControlBar to display if you are using a View bead that supports it.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get controlBar():Array
+ {
+ return _controlBar;
+ }
+ public function set controlBar(value:Array):void
+ {
+ _controlBar = value;
+ }
+
+ private var _title:String;
+
+ /**
+ * The title string for the org.apache.flex.html.Panel.
+ *
+ * @copy org.apache.flex.core.ITitleBarModel#title
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get title():String
+ {
+ return _title;
+ }
+ public function set title(value:String):void
+ {
+ if( value != _title ) {
+ _title = value;
+ dispatchEvent( new Event('titleChange') );
+ }
+ }
+
+ private var _htmlTitle:String;
+
+ /**
+ * The HTML string for the title.
+ *
+ * @copy org.apache.flex.core.ITitleBarModel#htmlTitle
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get htmlTitle():String
+ {
+ return _htmlTitle;
+ }
+ public function set htmlTitle(value:String):void
+ {
+ if( value != _htmlTitle ) {
+ _htmlTitle = value;
+ dispatchEvent( new Event('htmlTitleChange') );
+ }
+ }
+
+ private var _showCloseButton:Boolean = false;
+
+ /**
+ * Indicates whether or not there is a Close button for the org.apache.flex.html.Panel.
+ *
+ * @copy org.apache.flex.core.ITitleBarModel#showCloseButton
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get showCloseButton():Boolean
+ {
+ return _showCloseButton;
+ }
+ public function set showCloseButton(value:Boolean):void
+ {
+ if( value != _showCloseButton ) {
+ _showCloseButton = value;
+ dispatchEvent( new Event('showCloseButtonChange') );
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/RangeModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/RangeModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/RangeModel.as
new file mode 100644
index 0000000..5e46e41
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/RangeModel.as
@@ -0,0 +1,222 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IRangeModel;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * The RangeModel class bead defines a set of for a numeric range of values
+ * which includes a minimum, maximum, and current value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class RangeModel extends EventDispatcher implements IBead, IRangeModel
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function RangeModel()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _maximum:Number = 100;
+
+ /**
+ * The maximum value for the range (defaults to 100).
+ *
+ * @copy org.apache.flex.core.IRangeModel#maximum
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get maximum():Number
+ {
+ return _maximum;
+ }
+
+ public function set maximum(value:Number):void
+ {
+ if (value != _maximum)
+ {
+ _maximum = value;
+ dispatchEvent(new Event("maximumChange"));
+ }
+ }
+
+ private var _minimum:Number = 0;
+
+ /**
+ * The minimum value for the range (defaults to 0).
+ *
+ * @copy org.apache.flex.core.IRangeModel#minimum
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get minimum():Number
+ {
+ return _minimum;
+ }
+
+ public function set minimum(value:Number):void
+ {
+ if (value != _minimum)
+ {
+ _minimum = value;
+ dispatchEvent(new Event("minimumChange"));
+ }
+ }
+
+ private var _snapInterval:Number = 1;
+
+ /**
+ * The modulus value for the range.
+ *
+ * @copy org.apache.flex.core.IRangeModel#snapInterval
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get snapInterval():Number
+ {
+ return _snapInterval;
+ }
+
+ public function set snapInterval(value:Number):void
+ {
+ if (value != _snapInterval)
+ {
+ _snapInterval = value;
+ dispatchEvent(new Event("snapIntervalChange"));
+ }
+ }
+
+ private var _stepSize:Number = 1;
+
+ /**
+ * The amount to adjust the value either up or down toward the edge of the range.
+ *
+ * @copy org.apache.flex.core.IRangeModel#stepSize
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get stepSize():Number
+ {
+ return _stepSize;
+ }
+
+ public function set stepSize(value:Number):void
+ {
+ if (value != _stepSize)
+ {
+ _stepSize = value;
+ dispatchEvent(new Event("stepSizeChange"));
+ }
+ }
+
+ private var _value:Number = 0;
+
+ /**
+ * The current value of the range, between the minimum and maximum values. Attempting
+ * to set the value outside of the minimum-maximum range changes the value to still be
+ * within the range. Note that the value is adjusted by the stepSize.
+ *
+ * @copy org.apache.flex.core.IRangeModel#value
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get value():Number
+ {
+ return _value;
+ }
+
+ public function set value(newValue:Number):void
+ {
+ if (newValue != _value)
+ {
+ // value must lie within the boundaries of minimum & maximum
+ // and be on a step interval, so the value is adjusted to
+ // what is coming in.
+ newValue = Math.max(minimum, newValue - stepSize);
+ newValue = Math.min(maximum, newValue + stepSize);
+ _value = snap(newValue);
+ dispatchEvent(new Event("valueChange"));
+ }
+ }
+
+ /**
+ * @private
+ */
+ protected function snap(value:Number):Number
+ {
+ var si:Number = snapInterval;
+ var n:Number = Math.round((value - minimum) / si) * si + minimum;
+ if (value > 0)
+ {
+ if (value - n < n + si - value)
+ return n;
+ return n + si;
+
+ }
+ if (value - n > n + si - value)
+ return n + si;
+ return n;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/RangeModelExtended.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/RangeModelExtended.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/RangeModelExtended.as
new file mode 100644
index 0000000..ebbc4f3
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/RangeModelExtended.as
@@ -0,0 +1,101 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.events.Event;
+ import org.apache.flex.html.beads.models.RangeModel;
+
+ /**
+ * The RangeModelExtended bead expands on the RangeModel and adds a function to
+ * display a value from the model.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class RangeModelExtended extends RangeModel
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function RangeModelExtended()
+ {
+ super();
+ }
+
+ private var _value:Number = 0;
+
+ /**
+ * @private
+ */
+ override public function get value():Number
+ {
+ return _value;
+ }
+ override public function set value(newValue:Number):void
+ {
+ _value = newValue;
+ dispatchEvent(new Event("valueChange"));
+ }
+
+ private var _labelFunction:Function;
+
+ /**
+ * A function used to format a value in the model.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get labelFunction():Function
+ {
+ return _labelFunction;
+ }
+ public function set labelFunction(value:Function):void
+ {
+ _labelFunction = value;
+ }
+
+ /**
+ * Returns the label, using the labelFunction (if provided) for the value
+ * at the given index.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getLabelForIndex(index:Number):String
+ {
+ if (_labelFunction != null) {
+ return _labelFunction(this, index);
+ }
+ else {
+ return "";
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ScrollBarModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ScrollBarModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ScrollBarModel.as
new file mode 100644
index 0000000..582df91
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ScrollBarModel.as
@@ -0,0 +1,98 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+
+ import org.apache.flex.core.IScrollBarModel;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The ScrollBarModel class bead extends the org.apache.flex.html.beads.models.RangeModel
+ * and adds page size and page step sizes.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ScrollBarModel extends RangeModel implements IScrollBarModel
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ScrollBarModel()
+ {
+ }
+
+ private var _pageSize:Number;
+
+ /**
+ * The amount represented by the thumb control of the org.apache.flex.html.ScrollBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get pageSize():Number
+ {
+ return _pageSize;
+ }
+
+ public function set pageSize(value:Number):void
+ {
+ if (value != _pageSize)
+ {
+ _pageSize = value;
+ dispatchEvent(new Event("pageSizeChange"));
+ }
+ }
+
+ private var _pageStepSize:Number;
+
+ /**
+ * The amount to adjust the org.apache.flex.html.ScrollBar if the scroll bar's
+ * track area is selected.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get pageStepSize():Number
+ {
+ return _pageStepSize;
+ }
+
+ public function set pageStepSize(value:Number):void
+ {
+ if (value != _pageStepSize)
+ {
+ _pageStepSize = value;
+ dispatchEvent(new Event("pageStepSizeChange"));
+ }
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/SingleLineBorderModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/SingleLineBorderModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/SingleLineBorderModel.as
new file mode 100644
index 0000000..99c3a0d
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/SingleLineBorderModel.as
@@ -0,0 +1,85 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import flash.geom.Rectangle;
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IBorderModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * The SingleLineBorderModel class is a data model for
+ * a single line border. This model is very simple,
+ * it only stores the offsets from the edges of the
+ * component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SingleLineBorderModel extends EventDispatcher implements IBead, IBorderModel
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SingleLineBorderModel()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ static private var rect:Rectangle = new Rectangle(1, 1, 1, 1);
+
+ /**
+ * The offsets of the border from the edges of the
+ * component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get offsets():Rectangle
+ {
+ return rect;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/StringSelectionModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/StringSelectionModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/StringSelectionModel.as
new file mode 100644
index 0000000..be3d7c8
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/StringSelectionModel.as
@@ -0,0 +1,221 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * The StringSelectionModel class is a selection model for
+ * selecting a single string from a vector of strings.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class StringSelectionModel extends EventDispatcher implements ISelectionModel
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function StringSelectionModel()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _strings:Vector.<String>;
+
+ /**
+ * The vector of strings. This is the same
+ * as the dataProvider property but is
+ * strongly typed.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get strings():Vector.<String>
+ {
+ return _strings;
+ }
+
+ /**
+ * @private
+ */
+ public function set strings(value:Vector.<String>):void
+ {
+ _strings = value;
+ dispatchEvent(new Event("dataProviderChanged"));
+ }
+
+ /**
+ * The dataProvider, which is a
+ * Vector.<String>.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dataProvider():Object
+ {
+ return _strings;
+ }
+
+ /**
+ * @private
+ */
+ public function set dataProvider(value:Object):void
+ {
+ _strings = value as Vector.<String>;
+ dispatchEvent(new Event("dataProviderChanged"));
+ }
+
+ private var _selectedIndex:int = -1;
+
+ /**
+ * @copy org.apache.flex.core.ISelectionModel#selectedIndex
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedIndex():int
+ {
+ return _selectedIndex;
+ }
+
+ /**
+ * @private
+ */
+ public function set selectedIndex(value:int):void
+ {
+ _selectedIndex = value;
+ _selectedString = (value == -1) ? null : (value < _strings.length) ? _strings[value] : null;
+ dispatchEvent(new Event("selectedIndexChanged"));
+ }
+ private var _selectedString:String;
+
+ /**
+ * @copy org.apache.flex.core.ISelectionModel#selectedItem
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedItem():Object
+ {
+ return _selectedString;
+ }
+
+ /**
+ * @private
+ */
+ public function set selectedItem(value:Object):void
+ {
+ selectedString = String(value);
+ }
+
+ /**
+ * The selected string. This is the same as the
+ * selectedItem, but is strongly-typed.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedString():String
+ {
+ return _selectedString;
+ }
+
+ /**
+ * @private
+ */
+ public function set selectedString(value:String):void
+ {
+ _selectedString = value;
+ var n:int = _strings.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ if (_strings[i] == value)
+ {
+ _selectedIndex = i;
+ break;
+ }
+ }
+ dispatchEvent(new Event("selectedItemChanged"));
+ }
+
+
+ private var _labelField:String;
+
+ /**
+ * The labelField, which is not used in this
+ * implementation.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get labelField():String
+ {
+ return _labelField;
+ }
+
+ /**
+ * @private
+ */
+ public function set labelField(value:String):void
+ {
+ if (value != _labelField) {
+ _labelField = value;
+ dispatchEvent(new Event("labelFieldChanged"));
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/TextModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/TextModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/TextModel.as
new file mode 100644
index 0000000..eaf2cf4
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/TextModel.as
@@ -0,0 +1,125 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ITextModel;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The TextModel class is most basic data model for a
+ * component that displays text. All FlexJS components
+ * that display text should also support HTML, although
+ * the Flash Player implementations may only support
+ * a subset of HTML.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TextModel extends EventDispatcher implements IBead, ITextModel
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TextModel()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _text:String;
+
+ /**
+ * @copy org.apache.flex.core.ITextModel#text
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ return _text;
+ }
+
+ /**
+ * @private
+ */
+ public function set text(value:String):void
+ {
+ if (value == null)
+ value = "";
+ if (value != _text)
+ {
+ _text = value;
+ dispatchEvent(new Event("textChange"));
+ }
+ }
+
+ private var _html:String;
+
+ /**
+ * @copy org.apache.flex.core.ITextModel#html
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get html():String
+ {
+ return _html;
+ }
+
+ /**
+ * @private
+ */
+ public function set html(value:String):void
+ {
+ if (value != _html)
+ {
+ _html = value;
+ dispatchEvent(new Event("htmlChange"));
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/TitleBarModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/TitleBarModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/TitleBarModel.as
new file mode 100644
index 0000000..d9f6ff2
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/TitleBarModel.as
@@ -0,0 +1,136 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ITitleBarModel;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * The TitleBarModel class bead holds the values for the org.apache.flex.html.TitleBar's
+ * properties.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TitleBarModel extends EventDispatcher implements IBead, ITitleBarModel
+ {
+ public function TitleBarModel()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _title:String;
+
+ [Bindable("titleChange")]
+ /**
+ * The string title for the org.apache.flex.html.TitleBar.
+ *
+ * @copy org.apache.flex.core.ITitleBarModel#title
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get title():String
+ {
+ return _title;
+ }
+
+ public function set title(value:String):void
+ {
+ if( value != _title ) {
+ _title = value;
+ dispatchEvent( new Event('titleChange') );
+ }
+ }
+
+ private var _htmlTitle:String;
+
+ [Bindable("htmlTitleChange")]
+ /**
+ * The HTML string for the title.
+ *
+ * @copy org.apache.flex.core.ITitleBarModel#htmlTitle
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get htmlTitle():String
+ {
+ return _htmlTitle;
+ }
+
+ public function set htmlTitle(value:String):void
+ {
+ if( value != _htmlTitle ) {
+ _htmlTitle = value;
+ dispatchEvent( new Event('htmlTitleChange') );
+ }
+ }
+
+ private var _showCloseButton:Boolean = false;
+
+ [Bindable("showCloseButtonChange")]
+ /**
+ * Whether or not to show a close button.
+ *
+ * @copy org.apache.flex.core.ITitleBarModel#showCloseButton
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get showCloseButton():Boolean
+ {
+ return _showCloseButton;
+ }
+
+ public function set showCloseButton(value:Boolean):void
+ {
+ if( value != _showCloseButton ) {
+ _showCloseButton = value;
+ dispatchEvent( new Event('showCloseButtonChange') );
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ToggleButtonModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ToggleButtonModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ToggleButtonModel.as
new file mode 100644
index 0000000..a4c1a91
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ToggleButtonModel.as
@@ -0,0 +1,145 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.ITextModel;
+ import org.apache.flex.core.IToggleButtonModel;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * The ToggleButtonModel class bead holds values for org.apache.flex.html.Buttons
+ * that have a state.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ToggleButtonModel extends EventDispatcher implements IBead, IToggleButtonModel, ITextModel
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ToggleButtonModel()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _text:String;
+
+ /**
+ * The text string for the org.apache.flex.html.Button's label.
+ *
+ * @copy org.apache.flex.core.IToggleButtonModel#text
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ return _text;
+ }
+
+ public function set text(value:String):void
+ {
+ if (value != _text)
+ {
+ _text = value;
+ dispatchEvent(new Event("textChange"));
+ }
+ }
+
+ private var _html:String;
+
+ /**
+ * The HTML string for the Button's label.
+ *
+ * @copy org.apache.flex.core.IToggleButtonModel#html
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get html():String
+ {
+ return _html;
+ }
+
+ public function set html(value:String):void
+ {
+ if( value != html )
+ {
+ _html = value;
+ dispatchEvent(new Event("htmlChange"));
+ }
+ }
+
+ private var _selected:Boolean;
+
+ /**
+ * Whether or not the org.apache.flex.html.Button is selected.
+ *
+ * @copy org.apache.flex.core.IToggleButtonModel#selected
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selected():Boolean
+ {
+ return _selected;
+ }
+
+ public function set selected(value:Boolean):void
+ {
+ if( value != _selected )
+ {
+ _selected = value;
+ dispatchEvent(new Event("selectedChange"));
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ValueToggleButtonModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ValueToggleButtonModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ValueToggleButtonModel.as
new file mode 100644
index 0000000..27b0a95
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ValueToggleButtonModel.as
@@ -0,0 +1,123 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+
+ import org.apache.flex.core.IValueToggleButtonModel;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The ValueToggleButtonModel class bead extends the
+ * org.apache.flex.html.beads.models.ToggleButtonModel and adds
+ * value intended to represent a collection of similar org.apache.flex.html.Buttons
+ * such as org.apache.flex.html.RadioButtons.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ValueToggleButtonModel extends ToggleButtonModel implements IValueToggleButtonModel
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ValueToggleButtonModel()
+ {
+ super();
+ }
+
+ private var _value:Object;
+
+ /**
+ * The current value of the button collection.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get value():Object
+ {
+ return _value;
+ }
+
+ public function set value(newValue:Object):void
+ {
+ if( newValue != _value )
+ {
+ _value = newValue;
+ dispatchEvent(new Event("valueChange"));
+ }
+ }
+
+ private var _groupName:String;
+
+ /**
+ * The name of the collection has shared by all of the buttons in the collection.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get groupName():String
+ {
+ return _groupName;
+ }
+
+ public function set groupName(value:String):void
+ {
+ if( value != _groupName )
+ {
+ _groupName = value;
+ dispatchEvent(new Event("groupNameChange"));
+ }
+ }
+
+ private var _selectedValue:Object;
+
+ /**
+ * The value that is currently selected.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedValue():Object
+ {
+ return _selectedValue;
+ }
+
+ public function set selectedValue(newValue:Object):void
+ {
+ if( _selectedValue != newValue )
+ {
+ _selectedValue = newValue;
+ dispatchEvent(new Event("selectedValueChange"));
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ViewportModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ViewportModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ViewportModel.as
new file mode 100644
index 0000000..26752ac
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ViewportModel.as
@@ -0,0 +1,72 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.core.IViewportModel;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.geom.Rectangle;
+
+ /**
+ * @copy org.apache.flex.core.IViewportModel
+ */
+ public class ViewportModel extends EventDispatcher implements IViewportModel
+ {
+ public function ViewportModel()
+ {
+ super();
+ }
+
+ private var _borderMetrics:Rectangle;
+ private var _chromeMetrics:Rectangle;
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IViewportModel
+ */
+ public function get borderMetrics():Rectangle
+ {
+ return _borderMetrics;
+ }
+ public function set borderMetrics(value:Rectangle):void
+ {
+ _borderMetrics = value;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IViewportModel
+ */
+ public function get chromeMetrics():Rectangle
+ {
+ return _chromeMetrics;
+ }
+ public function set chromeMetrics(value:Rectangle):void
+ {
+ _chromeMetrics = value;
+ }
+
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/WebBrowserModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/WebBrowserModel.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/WebBrowserModel.as
new file mode 100644
index 0000000..fbd823a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/WebBrowserModel.as
@@ -0,0 +1,100 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads.models
+{
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * The WebBrowserModel class bead defines the data associated with an org.apache.flex.html.WebBrowser
+ * component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class WebBrowserModel extends EventDispatcher implements IBeadModel
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function WebBrowserModel()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _url:String;
+
+ /**
+ * The URL to load into the WebBrowser.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get url():String
+ {
+ return _url;
+ }
+ public function set url(value:String):void
+ {
+ if (value != _url) {
+ _url = value;
+ dispatchEvent( new Event("urlChanged") );
+ }
+ }
+
+ /**
+ * Sets the URL value without dispatching an event.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function setURL(value:String):void
+ {
+ _url = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/Border.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/Border.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/Border.as
new file mode 100644
index 0000000..f7277d0
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/Border.as
@@ -0,0 +1,49 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import org.apache.flex.core.UIBase;
+
+ /**
+ * The Border class is a class used internally by many
+ * controls to draw a border. The border actually drawn
+ * is dictated by the IBeadView in the CSS.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class Border extends UIBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Border()
+ {
+ super();
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as
new file mode 100644
index 0000000..1d320e3
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as
@@ -0,0 +1,145 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import org.apache.flex.core.IItemRenderer;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.html.TextButton;
+ import org.apache.flex.html.beads.ITextItemRenderer;
+ import org.apache.flex.events.ItemClickedEvent;
+
+ /**
+ * The ButtonBarButtonItemRenderer class handles the display of each item for the
+ * org.apache.flex.html.ButtonBar component. This class uses a
+ * org.apache.flex.html.Button to represent the data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ButtonBarButtonItemRenderer extends UIItemRendererBase implements ITextItemRenderer
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ButtonBarButtonItemRenderer()
+ {
+ super();
+ }
+
+ protected var textButton:TextButton;
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+ }
+
+ /**
+ * @private
+ */
+ protected function handleClickEvent(event:MouseEvent):void
+ {
+ var newEvent:ItemClickedEvent = new ItemClickedEvent("itemClicked");
+ newEvent.multipleSelection = event.shiftKey;
+ newEvent.index = index;
+ newEvent.data = data;
+ dispatchEvent(newEvent);
+ }
+
+ /**
+ * The string version of the data associated with the instance of the itemRenderer.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ return data as String;
+ }
+ public function set text(value:String):void
+ {
+ data = value;
+ }
+
+ /**
+ * The data to be displayed by the itemRenderer instance. For ButtonBarItemRenderer, the
+ * data's string version is used as the label for the Button.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set data(value:Object):void
+ {
+ super.data = value;
+
+ var added:Boolean = false;
+ if (textButton == null) {
+ textButton = new TextButton();
+
+ // listen for clicks on the button and translate them into
+ // an itemClicked event.
+ textButton.addEventListener('click',handleClickEvent);
+ added = true;
+ }
+
+ var valueAsString:String;
+
+ if (value is String) {
+ valueAsString = value as String;
+ }
+ else if (value.hasOwnProperty("label")) {
+ valueAsString = String(value["label"]);
+ }
+ else if (value.hasOwnProperty("title")) {
+ valueAsString = String(value["title"]);
+ }
+
+ if (valueAsString) textButton.text = valueAsString;
+
+ if (added) addElement(textButton);
+ }
+
+ /**
+ * @private
+ */
+ override public function adjustSize():void
+ {
+ textButton.width = this.width;
+ textButton.height = this.height;
+
+ updateRenderer();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/CheckBoxIcon.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/CheckBoxIcon.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/CheckBoxIcon.as
new file mode 100644
index 0000000..92c3f53
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/CheckBoxIcon.as
@@ -0,0 +1,92 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ COMPILE::JS {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ public class CheckBoxIcon
+ {
+ public function CheckBoxIcon()
+ {
+ COMPILE::JS {
+ createElement();
+ }
+
+ className = 'CheckBoxIcon';
+ }
+
+ COMPILE::JS {
+ public var element:WrappedHTMLElement;
+ public var positioner:WrappedHTMLElement;
+ }
+
+ private var _className:String;
+
+ public function get className():String
+ {
+ return _className;
+ }
+ public function set className(value:String):void
+ {
+ _className = value;
+
+ COMPILE::JS {
+ element.className = value;
+ }
+ }
+
+ private var _id:String;
+
+ public function get id():String
+ {
+ return _id;
+ }
+ public function set id(value:String):void
+ {
+ _id = value;
+
+ COMPILE::JS {
+ element.id = value;
+ }
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion HTMLInputElement
+ * @flexjsignorecoercion Text
+ */
+ COMPILE::JS
+ protected function createElement():WrappedHTMLElement
+ {
+ var input:HTMLInputElement = document.createElement('input') as HTMLInputElement;
+ input.type = 'checkbox';
+
+ element = input as WrappedHTMLElement;
+
+ positioner = element;
+ positioner.style.position = 'relative';
+
+ (element as WrappedHTMLElement).flexjs_wrapper = this;
+
+ return element;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ContainerContentArea.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ContainerContentArea.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ContainerContentArea.as
new file mode 100644
index 0000000..46426cd
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ContainerContentArea.as
@@ -0,0 +1,80 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import org.apache.flex.core.IContentView;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+
+ /**
+ * The ContainerContentArea class implements the contentView for
+ * a Container. Container's don't always parent their children directly as
+ * that makes it harder to handle scrolling.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ContainerContentArea extends UIBase implements IContentView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ContainerContentArea()
+ {
+ super();
+ addEventListener("layoutNeeded", forwardEventHandler);
+ }
+
+ private function forwardEventHandler(event:Event):void
+ {
+ if (parent)
+ parent.dispatchEvent(event);
+ }
+
+ /**
+ * @copy org.apache.flex.core.IItemRendererParent#removeAllElements()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function removeAllElements():void
+ {
+ COMPILE::SWF
+ {
+ removeChildren(0);
+ }
+ COMPILE::JS
+ {
+ while (element.hasChildNodes())
+ {
+ element.removeChild(element.lastChild);
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridButtonBarButtonItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridButtonBarButtonItemRenderer.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridButtonBarButtonItemRenderer.as
new file mode 100644
index 0000000..f6663a5
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridButtonBarButtonItemRenderer.as
@@ -0,0 +1,81 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import org.apache.flex.core.IItemRenderer;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.html.DataGridButtonBarTextButton;
+ import org.apache.flex.html.beads.ITextItemRenderer;
+ import org.apache.flex.events.ItemClickedEvent;
+
+ /**
+ * The ButtonBarButtonItemRenderer class handles the display of each item for the
+ * org.apache.flex.html.ButtonBar component. This class uses a
+ * org.apache.flex.html.Button to represent the data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataGridButtonBarButtonItemRenderer extends ButtonBarButtonItemRenderer
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGridButtonBarButtonItemRenderer()
+ {
+ super();
+ }
+
+ /**
+ * The data to be displayed by the itemRenderer instance. For ButtonBarItemRenderer, the
+ * data's string version is used as the label for the Button.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set data(value:Object):void
+ {
+ var added:Boolean = false;
+ if (textButton == null) {
+ textButton = new DataGridButtonBarTextButton();
+
+ // listen for clicks on the button and translate them into
+ // an itemClicked event.
+ textButton.addEventListener('click',handleClickEvent);
+ added = true;
+ }
+
+ super.data = value;
+
+ if (added) addElement(textButton);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridColumn.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridColumn.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridColumn.as
new file mode 100644
index 0000000..24e16fd
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridColumn.as
@@ -0,0 +1,127 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import org.apache.flex.core.IFactory;
+
+ /**
+ * The DataGridColumn class is the collection of properties that describe
+ * a column of the org.apache.flex.html.DataGrid: which renderer
+ * to use for each cell in the column, the width of the column, the label for the
+ * column, and the name of the field in the data containing the value to display
+ * in the column.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataGridColumn
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGridColumn()
+ {
+ }
+
+ private var _itemRenderer:IFactory;
+
+ /**
+ * The itemRenderer class or factory to use to make instances of itemRenderers for
+ * display of data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRenderer():IFactory
+ {
+ return _itemRenderer;
+ }
+ public function set itemRenderer(value:IFactory):void
+ {
+ _itemRenderer = value;
+ }
+
+ private var _columnWidth:Number = Number.NaN;
+
+ /**
+ * The width of the column (default is 100 pixels).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get columnWidth():Number
+ {
+ return _columnWidth;
+ }
+ public function set columnWidth(value:Number):void
+ {
+ _columnWidth = value;
+ }
+
+ private var _label:String;
+
+ /**
+ * The label for the column (appears in the header area).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get label():String
+ {
+ return _label;
+ }
+ public function set label(value:String):void
+ {
+ _label = value;
+ }
+
+ private var _dataField:String;
+
+ /**
+ * The name of the field containing the data value presented by the column. This value is used
+ * by the itemRenderer is select the property from the data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dataField():String
+ {
+ return _dataField;
+ }
+ public function set dataField(value:String):void
+ {
+ _dataField = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridColumnList.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridColumnList.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridColumnList.as
new file mode 100644
index 0000000..bb0fa65
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/DataGridColumnList.as
@@ -0,0 +1,61 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.supportClasses
+{
+ import org.apache.flex.html.List;
+
+ //--------------------------------------
+ // Events
+ //--------------------------------------
+
+ /**
+ * @copy org.apache.flex.core.ISelectionModel#change
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="change", type="org.apache.flex.events.Event")]
+
+ /**
+ * The DataGridColumnList class is the List class used internally
+ * by DataGrid for each column.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataGridColumnList extends List
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGridColumnList()
+ {
+ super();
+ }
+ }
+}
[43/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - clean
up build after merge. I wonder if fork is causing things to mess up on
merges. I thought I'd made these changes before
Posted by ah...@apache.org.
clean up build after merge. I wonder if fork is causing things to mess up on merges. I thought I'd made these changes before
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/1b6c3af2
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/1b6c3af2
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/1b6c3af2
Branch: refs/heads/refactor-sprite
Commit: 1b6c3af235708d1b73e9816bf8f4aa2e79326694
Parents: a5cf277
Author: Alex Harui <ah...@apache.org>
Authored: Tue Nov 1 08:33:05 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 08:33:05 2016 -0700
----------------------------------------------------------------------
.../flex/org/apache/flex/core/ContainerBase.as | 20 ++++++++++----------
.../flex/core/ContainerBaseStrandChildren.as | 10 +++++-----
.../main/flex/org/apache/flex/core/ListBase.as | 10 +++++-----
.../apache/flex/core/ListBaseStrandChildren.as | 12 +++++-------
.../main/flex/org/apache/flex/core/UIBase.as | 19 +++++++++++--------
.../org/apache/flex/svg/GraphicContainer.as | 18 +++++++-----------
6 files changed, 43 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1b6c3af2/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBase.as
index 5b6cc26..0dd0b53 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBase.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBase.as
@@ -106,7 +106,7 @@ package org.apache.flex.core
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- override public function getElementAt(index:int):Object
+ override public function getElementAt(index:int):IChild
{
var contentView:IParent = view as IParent;
if (contentView != null) {
@@ -119,7 +119,7 @@ package org.apache.flex.core
/**
* @private
*/
- override public function getElementIndex(c:Object):int
+ override public function getElementIndex(c:IChild):int
{
var contentView:IParent = view as IParent;
if (contentView != null) {
@@ -132,7 +132,7 @@ package org.apache.flex.core
/**
* @private
*/
- override public function addElement(c:Object, dispatchEvent:Boolean = true):void
+ override public function addElement(c:IChild, dispatchEvent:Boolean = true):void
{
var contentView:IParent = view as IParent;
if (contentView != null) {
@@ -148,7 +148,7 @@ package org.apache.flex.core
/**
* @private
*/
- override public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ override public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
{
var contentView:IParent = view as IParent;
if (contentView != null) {
@@ -164,7 +164,7 @@ package org.apache.flex.core
/**
* @private
*/
- override public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+ override public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
{
var contentView:IParent = view as IParent;
if (contentView != null) {
@@ -229,7 +229,7 @@ package org.apache.flex.core
* @suppress {undefinedNames}
* Support strandChildren.
*/
- public function $addElement(c:Object, dispatchEvent:Boolean = true):void
+ public function $addElement(c:IChild, dispatchEvent:Boolean = true):void
{
super.addElement(c, dispatchEvent);
}
@@ -239,7 +239,7 @@ package org.apache.flex.core
* @suppress {undefinedNames}
* Support strandChildren.
*/
- public function $addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ public function $addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
{
super.addElementAt(c, index, dispatchEvent);
}
@@ -249,7 +249,7 @@ package org.apache.flex.core
* @suppress {undefinedNames}
* Support strandChildren.
*/
- public function $removeElement(c:Object, dispatchEvent:Boolean = true):void
+ public function $removeElement(c:IChild, dispatchEvent:Boolean = true):void
{
super.removeElement(c, dispatchEvent);
}
@@ -259,7 +259,7 @@ package org.apache.flex.core
* @suppress {undefinedNames}
* Support strandChildren.
*/
- public function $getElementIndex(c:Object):int
+ public function $getElementIndex(c:IChild):int
{
return super.getElementIndex(c);
}
@@ -269,7 +269,7 @@ package org.apache.flex.core
* @suppress {undefinedNames}
* Support strandChildren.
*/
- public function $getElementAt(index:int):Object
+ public function $getElementAt(index:int):IChild
{
return super.getElementAt(index);
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1b6c3af2/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as
index 93e5c53..e961c1f 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as
@@ -59,7 +59,7 @@ package org.apache.flex.core
/**
* @private
*/
- public function addElement(c:Object, dispatchEvent:Boolean = true):void
+ public function addElement(c:IChild, dispatchEvent:Boolean = true):void
{
owner.$addElement(c, dispatchEvent);
}
@@ -67,7 +67,7 @@ package org.apache.flex.core
/**
* @private
*/
- public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
{
owner.$addElementAt(c, index, dispatchEvent);
}
@@ -75,7 +75,7 @@ package org.apache.flex.core
/**
* @private
*/
- public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+ public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
{
owner.$removeElement(c, dispatchEvent);
}
@@ -83,7 +83,7 @@ package org.apache.flex.core
/**
* @private
*/
- public function getElementIndex(c:Object):int
+ public function getElementIndex(c:IChild):int
{
return owner.$getElementIndex(c);
}
@@ -91,7 +91,7 @@ package org.apache.flex.core
/**
* @private
*/
- public function getElementAt(index:int):Object
+ public function getElementAt(index:int):IChild
{
return owner.$getElementAt(index);
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1b6c3af2/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBase.as
index dbdcace..f9c0aaa 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBase.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBase.as
@@ -77,7 +77,7 @@ package org.apache.flex.core
* @suppress {undefinedNames}
* Support strandChildren.
*/
- public function $addElement(c:Object, dispatchEvent:Boolean = true):void
+ public function $addElement(c:IChild, dispatchEvent:Boolean = true):void
{
super.addElement(c, dispatchEvent);
}
@@ -87,7 +87,7 @@ package org.apache.flex.core
* @suppress {undefinedNames}
* Support strandChildren.
*/
- public function $addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ public function $addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
{
super.addElementAt(c, index, dispatchEvent);
}
@@ -97,7 +97,7 @@ package org.apache.flex.core
* @suppress {undefinedNames}
* Support strandChildren.
*/
- public function $removeElement(c:Object, dispatchEvent:Boolean = true):void
+ public function $removeElement(c:IChild, dispatchEvent:Boolean = true):void
{
super.removeElement(c, dispatchEvent);
}
@@ -107,7 +107,7 @@ package org.apache.flex.core
* @suppress {undefinedNames}
* Support strandChildren.
*/
- public function $getElementIndex(c:Object):int
+ public function $getElementIndex(c:IChild):int
{
return super.getElementIndex(c);
}
@@ -117,7 +117,7 @@ package org.apache.flex.core
* @suppress {undefinedNames}
* Support strandChildren.
*/
- public function $getElementAt(index:int):Object
+ public function $getElementAt(index:int):IChild
{
return super.getElementAt(index);
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1b6c3af2/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as
index e8f2fa5..d2c413b 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as
@@ -18,8 +18,6 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.flex.core
{
-
-
/**
* The ListBaseStrandChildren exists so that Lists are compatible with
* the ListView/ContainerView beads.
@@ -60,7 +58,7 @@ package org.apache.flex.core
/**
* @private
*/
- public function addElement(c:Object, dispatchEvent:Boolean = true):void
+ public function addElement(c:IChild, dispatchEvent:Boolean = true):void
{
owner.$addElement(c, dispatchEvent);
}
@@ -68,7 +66,7 @@ package org.apache.flex.core
/**
* @private
*/
- public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
{
owner.$addElementAt(c, index, dispatchEvent);
}
@@ -76,7 +74,7 @@ package org.apache.flex.core
/**
* @private
*/
- public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+ public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
{
owner.$removeElement(c, dispatchEvent);
}
@@ -84,7 +82,7 @@ package org.apache.flex.core
/**
* @private
*/
- public function getElementIndex(c:Object):int
+ public function getElementIndex(c:IChild):int
{
return owner.$getElementIndex(c);
}
@@ -92,7 +90,7 @@ package org.apache.flex.core
/**
* @private
*/
- public function getElementAt(index:int):Object
+ public function getElementAt(index:int):IChild
{
return owner.$getElementAt(index);
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1b6c3af2/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as
index dc2b774..5cab77d 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIBase.as
@@ -1098,8 +1098,9 @@ package org.apache.flex.core
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.IUIBase
*/
- public function addElement(c:Object, dispatchEvent:Boolean = true):void
+ public function addElement(c:IChild, dispatchEvent:Boolean = true):void
{
COMPILE::SWF
{
@@ -1117,7 +1118,7 @@ package org.apache.flex.core
COMPILE::JS
{
element.appendChild(c.positioner);
- c.addedToParent();
+ (c as IUIBase).addedToParent();
}
}
@@ -1128,8 +1129,9 @@ package org.apache.flex.core
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.IUIBase
*/
- public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
{
COMPILE::SWF
{
@@ -1153,7 +1155,7 @@ package org.apache.flex.core
{
element.insertBefore(c.positioner,
children[index]);
- c.addedToParent();
+ (c as IUIBase).addedToParent();
}
}
}
@@ -1166,7 +1168,7 @@ package org.apache.flex.core
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public function getElementAt(index:int):Object
+ public function getElementAt(index:int):IChild
{
COMPILE::SWF
{
@@ -1187,7 +1189,7 @@ package org.apache.flex.core
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public function getElementIndex(c:Object):int
+ public function getElementIndex(c:IChild):int
{
COMPILE::SWF
{
@@ -1216,8 +1218,9 @@ package org.apache.flex.core
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
+ * @flexjsignorecoercion HTMLElement
*/
- public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+ public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
{
COMPILE::SWF
{
@@ -1228,7 +1231,7 @@ package org.apache.flex.core
}
COMPILE::JS
{
- element.removeChild(c.element);
+ element.removeChild(c.element as HTMLElement);
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1b6c3af2/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicContainer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicContainer.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicContainer.as
index b25ebf2..8e8498f 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicContainer.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/svg/GraphicContainer.as
@@ -21,6 +21,7 @@ package org.apache.flex.svg
{
import org.apache.flex.core.IContainer;
import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.IChild;
}
[DefaultProperty("mxmlContent")]
@@ -33,11 +34,6 @@ package org.apache.flex.svg
super();
}
- public function get transformElement():IFlexJSElement
- {
- return element;
- }
-
}
COMPILE::JS
@@ -72,7 +68,7 @@ package org.apache.flex.svg
}
- public function get transformElement():org.apache.flex.core.WrappedHTMLElement
+ override public function get transformElement():org.apache.flex.core.WrappedHTMLElement
{
return graphicGroup.element;
}
@@ -85,7 +81,7 @@ package org.apache.flex.svg
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- override public function getElementAt(index:int):Object
+ override public function getElementAt(index:int):IChild
{
return graphicGroup.getElementAt(index);
}
@@ -98,7 +94,7 @@ package org.apache.flex.svg
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- override public function addElement(c:Object, dispatchEvent:Boolean = true):void
+ override public function addElement(c:IChild, dispatchEvent:Boolean = true):void
{
graphicGroup.addElement(c, dispatchEvent);
if (dispatchEvent)
@@ -113,7 +109,7 @@ package org.apache.flex.svg
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- override public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void
+ override public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void
{
graphicGroup.addElementAt(c, index, dispatchEvent);
if (dispatchEvent)
@@ -128,7 +124,7 @@ package org.apache.flex.svg
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- override public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+ override public function removeElement(c:IChild, dispatchEvent:Boolean = true):void
{
graphicGroup.removeElement(c, dispatchEvent);
if (dispatchEvent)
@@ -156,7 +152,7 @@ package org.apache.flex.svg
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- override public function getElementIndex(c:Object):int
+ override public function getElementIndex(c:IChild):int
{
return graphicGroup.getElementIndex(c);
}
[18/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - try to
copy HTML to Basic without losing history
Posted by ah...@apache.org.
try to copy HTML to Basic without losing history
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/d8221452
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/d8221452
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/d8221452
Branch: refs/heads/refactor-sprite
Commit: d822145269fcd59dca71b8310527edbf008072dc
Parents: 6c2e37f
Author: Alex Harui <ah...@apache.org>
Authored: Wed Oct 26 13:16:24 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 1 07:46:51 2016 -0700
----------------------------------------------------------------------
frameworks/projects/Basic/build.xml | 116 ++++
frameworks/projects/Basic/pom.xml | 128 ++++
.../Basic/src/main/config/compile-as-config.xml | 90 +++
.../projects/Basic/src/main/flex/HTMLClasses.as | 194 ++++++
.../apache/flex/core/IScrollingLayoutParent.as | 68 ++
.../org/apache/flex/events/ItemAddedEvent.as | 88 +++
.../org/apache/flex/events/ItemClickedEvent.as | 115 ++++
.../org/apache/flex/events/ItemRemovedEvent.as | 88 +++
.../org/apache/flex/events/ItemRendererEvent.as | 90 +++
.../src/main/flex/org/apache/flex/html/Alert.as | 287 ++++++++
.../main/flex/org/apache/flex/html/Button.as | 85 +++
.../main/flex/org/apache/flex/html/ButtonBar.as | 76 +++
.../flex/org/apache/flex/html/ButtonBase.as | 101 +++
.../main/flex/org/apache/flex/html/CheckBox.as | 187 ++++++
.../flex/org/apache/flex/html/CloseButton.as | 66 ++
.../main/flex/org/apache/flex/html/ComboBox.as | 277 ++++++++
.../main/flex/org/apache/flex/html/Container.as | 108 +++
.../flex/org/apache/flex/html/ControlBar.as | 99 +++
.../main/flex/org/apache/flex/html/DataGrid.as | 166 +++++
.../org/apache/flex/html/DataGridButtonBar.as | 51 ++
.../flex/html/DataGridButtonBarTextButton.as | 55 ++
.../flex/org/apache/flex/html/DateChooser.as | 74 ++
.../main/flex/org/apache/flex/html/DateField.as | 95 +++
.../flex/org/apache/flex/html/DropDownList.as | 235 +++++++
.../src/main/flex/org/apache/flex/html/Form.as | 99 +++
.../flex/org/apache/flex/html/HContainer.as | 61 ++
.../src/main/flex/org/apache/flex/html/HRule.as | 63 ++
.../src/main/flex/org/apache/flex/html/Image.as | 93 +++
.../org/apache/flex/html/ImageAndTextButton.as | 128 ++++
.../flex/org/apache/flex/html/ImageButton.as | 89 +++
.../src/main/flex/org/apache/flex/html/Label.as | 194 ++++++
.../src/main/flex/org/apache/flex/html/List.as | 311 +++++++++
.../flex/org/apache/flex/html/MXMLBeadView.as | 317 +++++++++
.../flex/org/apache/flex/html/MultilineLabel.as | 76 +++
.../flex/org/apache/flex/html/NumericStepper.as | 202 ++++++
.../src/main/flex/org/apache/flex/html/Panel.as | 121 ++++
.../org/apache/flex/html/PanelWithControlBar.as | 121 ++++
.../flex/org/apache/flex/html/RadioButton.as | 350 ++++++++++
.../flex/org/apache/flex/html/RangeStepper.as | 69 ++
.../flex/org/apache/flex/html/SimpleAlert.as | 140 ++++
.../flex/org/apache/flex/html/SimpleList.as | 79 +++
.../main/flex/org/apache/flex/html/Slider.as | 233 +++++++
.../main/flex/org/apache/flex/html/Spacer.as | 64 ++
.../main/flex/org/apache/flex/html/Spinner.as | 166 +++++
.../main/flex/org/apache/flex/html/TextArea.as | 126 ++++
.../flex/org/apache/flex/html/TextButton.as | 139 ++++
.../main/flex/org/apache/flex/html/TextInput.as | 187 ++++++
.../main/flex/org/apache/flex/html/TitleBar.as | 146 ++++
.../org/apache/flex/html/ToggleTextButton.as | 170 +++++
.../main/flex/org/apache/flex/html/ToolTip.as | 60 ++
.../src/main/flex/org/apache/flex/html/Tree.as | 73 ++
.../flex/org/apache/flex/html/VContainer.as | 62 ++
.../src/main/flex/org/apache/flex/html/VRule.as | 68 ++
.../flex/org/apache/flex/html/WebBrowser.as | 145 ++++
.../accessories/NumericOnlyTextInputBead.as | 199 ++++++
.../flex/html/accessories/PasswordInputBead.as | 102 +++
.../flex/html/accessories/TextPromptBead.as | 148 ++++
.../apache/flex/html/accessories/ToolTipBead.as | 141 ++++
.../flex/html/beads/AlertMeasurementBead.as | 88 +++
.../org/apache/flex/html/beads/AlertView.as | 226 +++++++
.../flex/html/beads/BackgroundImageBead.as | 112 ++++
.../org/apache/flex/html/beads/ButtonBarView.as | 69 ++
.../org/apache/flex/html/beads/CSSButtonView.as | 167 +++++
.../html/beads/CSSImageAndTextButtonView.as | 367 ++++++++++
.../apache/flex/html/beads/CSSTextButtonView.as | 350 ++++++++++
.../flex/html/beads/CSSTextToggleButtonView.as | 105 +++
.../org/apache/flex/html/beads/CheckBoxView.as | 296 ++++++++
.../apache/flex/html/beads/CloseButtonView.as | 101 +++
.../org/apache/flex/html/beads/ComboBoxView.as | 247 +++++++
.../org/apache/flex/html/beads/ContainerView.as | 553 +++++++++++++++
.../html/beads/ControlBarMeasurementBead.as | 116 ++++
.../flex/html/beads/DataGridColumnView.as | 101 +++
.../apache/flex/html/beads/DataGridLinesBead.as | 199 ++++++
.../org/apache/flex/html/beads/DataGridView.as | 266 ++++++++
.../DataItemRendererFactoryForArrayData.as | 176 +++++
.../DataItemRendererFactoryForArrayList.as | 194 ++++++
.../DataItemRendererFactoryForColumnData.as | 142 ++++
...ataItemRendererFactoryForHierarchicalData.as | 113 ++++
.../html/beads/DataProviderChangeNotifier.as | 194 ++++++
.../apache/flex/html/beads/DateChooserView.as | 328 +++++++++
.../org/apache/flex/html/beads/DateFieldView.as | 192 ++++++
.../flex/html/beads/DecrementButtonView.as | 94 +++
.../flex/html/beads/DownArrowButtonView.as | 111 +++
.../apache/flex/html/beads/DropDownListView.as | 300 +++++++++
.../org/apache/flex/html/beads/HRuleView.as | 87 +++
.../flex/html/beads/HScrollBarThumbView.as | 120 ++++
.../flex/html/beads/HScrollBarTrackView.as | 118 ++++
.../apache/flex/html/beads/HScrollBarView.as | 99 +++
.../apache/flex/html/beads/IBackgroundBead.as | 35 +
.../org/apache/flex/html/beads/IBorderBead.as | 35 +
.../org/apache/flex/html/beads/IComboBoxView.as | 78 +++
.../org/apache/flex/html/beads/IDataGridView.as | 36 +
.../apache/flex/html/beads/IDropDownListView.as | 57 ++
.../apache/flex/html/beads/IGraphicsDrawing.as | 36 +
.../org/apache/flex/html/beads/IListView.as | 48 ++
.../apache/flex/html/beads/IScrollBarView.as | 80 +++
.../org/apache/flex/html/beads/ISliderView.as | 60 ++
.../org/apache/flex/html/beads/ISpinnerView.as | 69 ++
.../apache/flex/html/beads/ITextFieldView.as | 44 ++
.../apache/flex/html/beads/ITextItemRenderer.as | 45 ++
.../flex/html/beads/ImageAndTextButtonView.as | 276 ++++++++
.../apache/flex/html/beads/ImageButtonView.as | 158 +++++
.../org/apache/flex/html/beads/ImageView.as | 223 ++++++
.../flex/html/beads/IncrementButtonView.as | 94 +++
.../flex/html/beads/LeftArrowButtonView.as | 112 ++++
.../flex/org/apache/flex/html/beads/ListView.as | 211 ++++++
.../flex/html/beads/MultilineTextFieldView.as | 56 ++
.../flex/html/beads/NumericStepperView.as | 186 +++++
.../org/apache/flex/html/beads/PanelView.as | 168 +++++
.../flex/html/beads/PanelWithControlBarView.as | 207 ++++++
.../apache/flex/html/beads/RadioButtonView.as | 281 ++++++++
.../apache/flex/html/beads/RangeStepperView.as | 157 +++++
.../flex/html/beads/RightArrowButtonView.as | 112 ++++
.../org/apache/flex/html/beads/ScrollBarView.as | 216 ++++++
.../apache/flex/html/beads/SimpleAlertView.as | 150 +++++
.../flex/html/beads/SingleLineBorderBead.as | 91 +++
.../apache/flex/html/beads/SliderThumbView.as | 156 +++++
.../apache/flex/html/beads/SliderTrackView.as | 153 +++++
.../org/apache/flex/html/beads/SliderView.as | 179 +++++
.../flex/html/beads/SolidBackgroundBead.as | 195 ++++++
.../org/apache/flex/html/beads/SpinnerView.as | 180 +++++
.../org/apache/flex/html/beads/TextAreaView.as | 263 ++++++++
.../html/beads/TextButtonMeasurementBead.as | 86 +++
.../apache/flex/html/beads/TextButtonView.as | 217 ++++++
.../html/beads/TextFieldLabelMeasurementBead.as | 92 +++
.../org/apache/flex/html/beads/TextFieldView.as | 54 ++
.../apache/flex/html/beads/TextFieldViewBase.as | 404 +++++++++++
.../org/apache/flex/html/beads/TextInputView.as | 135 ++++
.../flex/html/beads/TextInputWithBorderView.as | 100 +++
.../TextItemRendererFactoryForArrayData.as | 159 +++++
...extItemRendererFactoryForStringVectorData.as | 143 ++++
.../flex/html/beads/TitleBarMeasurementBead.as | 108 +++
.../apache/flex/html/beads/TitleBarView.mxml | 58 ++
.../apache/flex/html/beads/UpArrowButtonView.as | 112 ++++
.../org/apache/flex/html/beads/VRuleView.as | 87 +++
.../flex/html/beads/VScrollBarThumbView.as | 119 ++++
.../flex/html/beads/VScrollBarTrackView.as | 118 ++++
.../apache/flex/html/beads/VScrollBarView.as | 99 +++
.../apache/flex/html/beads/WebBrowserView.as | 198 ++++++
.../html/beads/controllers/AlertController.as | 88 +++
.../controllers/ButtonAutoRepeatController.as | 147 ++++
.../beads/controllers/ComboBoxController.as | 104 +++
.../controllers/DateChooserMouseController.as | 127 ++++
.../controllers/DateFieldMouseController.as | 96 +++
.../beads/controllers/DropDownListController.as | 117 ++++
.../EditableTextKeyboardController.as | 86 +++
.../controllers/HScrollBarMouseController.as | 101 +++
.../controllers/ItemRendererMouseController.as | 209 ++++++
.../ListSingleSelectionMouseController.as | 153 +++++
.../controllers/RangeStepperMouseController.as | 94 +++
.../controllers/ScrollBarMouseControllerBase.as | 184 +++++
.../beads/controllers/SliderMouseController.as | 286 ++++++++
.../beads/controllers/SpinnerMouseController.as | 124 ++++
.../TreeSingleSelectionMouseController.as | 82 +++
.../controllers/VScrollBarMouseController.as | 101 +++
.../flex/html/beads/layouts/BasicLayout.as | 445 ++++++++++++
.../flex/html/beads/layouts/ButtonBarLayout.as | 143 ++++
.../flex/html/beads/layouts/DataGridLayout.as | 208 ++++++
.../beads/layouts/DataGridPercentageLayout.as | 224 +++++++
.../FlexibleFirstChildHorizontalLayout.as | 244 +++++++
.../flex/html/beads/layouts/HScrollBarLayout.as | 121 ++++
.../flex/html/beads/layouts/HorizontalLayout.as | 325 +++++++++
.../flex/html/beads/layouts/IDataGridLayout.as | 52 ++
.../html/beads/layouts/LayoutChangeNotifier.as | 103 +++
.../layouts/OneFlexibleChildHorizontalLayout.as | 332 +++++++++
.../layouts/OneFlexibleChildVerticalLayout.as | 459 +++++++++++++
.../flex/html/beads/layouts/TileLayout.as | 248 +++++++
.../flex/html/beads/layouts/VScrollBarLayout.as | 122 ++++
.../html/beads/layouts/VerticalColumnLayout.as | 199 ++++++
.../flex/html/beads/layouts/VerticalLayout.as | 362 ++++++++++
.../apache/flex/html/beads/models/AlertModel.as | 288 ++++++++
.../beads/models/ArrayListSelectionModel.as | 244 +++++++
.../html/beads/models/ArraySelectionModel.as | 243 +++++++
.../flex/html/beads/models/ComboBoxModel.as | 100 +++
.../flex/html/beads/models/DataGridModel.as | 71 ++
.../beads/models/DataGridPresentationModel.as | 88 +++
.../flex/html/beads/models/DateChooserModel.as | 189 ++++++
.../flex/html/beads/models/ImageAndTextModel.as | 77 +++
.../apache/flex/html/beads/models/ImageModel.as | 89 +++
.../html/beads/models/ListPresentationModel.as | 107 +++
.../apache/flex/html/beads/models/PanelModel.as | 158 +++++
.../apache/flex/html/beads/models/RangeModel.as | 222 ++++++
.../html/beads/models/RangeModelExtended.as | 101 +++
.../flex/html/beads/models/ScrollBarModel.as | 98 +++
.../html/beads/models/SingleLineBorderModel.as | 85 +++
.../html/beads/models/StringSelectionModel.as | 221 ++++++
.../apache/flex/html/beads/models/TextModel.as | 125 ++++
.../flex/html/beads/models/TitleBarModel.as | 136 ++++
.../flex/html/beads/models/ToggleButtonModel.as | 145 ++++
.../html/beads/models/ValueToggleButtonModel.as | 123 ++++
.../flex/html/beads/models/ViewportModel.as | 72 ++
.../flex/html/beads/models/WebBrowserModel.as | 100 +++
.../apache/flex/html/supportClasses/Border.as | 49 ++
.../ButtonBarButtonItemRenderer.as | 145 ++++
.../flex/html/supportClasses/CheckBoxIcon.as | 92 +++
.../html/supportClasses/ContainerContentArea.as | 80 +++
.../DataGridButtonBarButtonItemRenderer.as | 81 +++
.../flex/html/supportClasses/DataGridColumn.as | 127 ++++
.../html/supportClasses/DataGridColumnList.as | 61 ++
.../flex/html/supportClasses/DataGroup.as | 121 ++++
.../html/supportClasses/DataItemRenderer.as | 179 +++++
.../html/supportClasses/DateChooserButton.as | 67 ++
.../html/supportClasses/DateHeaderButton.as | 48 ++
.../html/supportClasses/DropDownListList.as | 63 ++
.../html/supportClasses/GraphicsItemRenderer.as | 316 +++++++++
.../flex/html/supportClasses/HScrollBar.as | 49 ++
.../flex/html/supportClasses/RadioButtonIcon.as | 111 +++
.../flex/html/supportClasses/ScrollBar.as | 50 ++
.../html/supportClasses/ScrollingViewport.as | 351 ++++++++++
.../flex/html/supportClasses/SpinnerButton.as | 31 +
.../html/supportClasses/StringItemRenderer.as | 180 +++++
.../supportClasses/TextFieldItemRenderer.as | 560 ++++++++++++++++
.../html/supportClasses/TreeItemRenderer.as | 64 ++
.../flex/html/supportClasses/TreeListData.as | 76 +++
.../html/supportClasses/UIItemRendererBase.as | 303 +++++++++
.../flex/html/supportClasses/VScrollBar.as | 49 ++
.../apache/flex/html/supportClasses/Viewport.as | 151 +++++
.../main/flex/org/apache/flex/svg/TextButton.as | 30 +
.../src/main/resources/basic-as-manifest.xml | 37 +
.../Basic/src/main/resources/basic-manifest.xml | 127 ++++
.../Basic/src/main/resources/defaults.css | 672 +++++++++++++++++++
.../Basic/src/main/resources/svg-manifest.xml | 24 +
.../test/flex/FlexUnitFlexJSApplication.mxml | 46 ++
.../projects/Basic/src/test/flex/build.xml | 165 +++++
.../flex/flexUnitTests/DataGridColumnTester.as | 27 +
.../flexUnitTests/DataGridColumnTesterTest.as | 55 ++
226 files changed, 33403 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/build.xml b/frameworks/projects/Basic/build.xml
new file mode 100644
index 0000000..f7e42a5
--- /dev/null
+++ b/frameworks/projects/Basic/build.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+
+<project name="Basic" default="main" basedir=".">
+ <property name="FLEXJS_HOME" location="../../.."/>
+
+ <property file="${FLEXJS_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${FLEXJS_HOME}/build.properties"/>
+ <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+
+ <property name="target.name" value="${ant.project.name}.swc" />
+
+ <target name="main" depends="clean,check-compiler,compile,compile-js,copy-swc,test" description="Full build of ${ant.project.name}.swc">
+ </target>
+
+ <target name="compile-js">
+ <ant dir="${FLEXJS_HOME}/frameworks/js/FlexJS/projects/${ant.project.name}JS/" inheritAll="false" />
+ </target>
+
+ <target name="copy-swc">
+ <copy file="${basedir}/target/${target.name}" tofile="${FLEXJS_HOME}/frameworks/libs/${target.name}" />
+ </target>
+
+ <target name="check-for-tests" >
+ <condition property="skip-tests" >
+ <not>
+ <available file="${basedir}/src/test/flex/build.xml" />
+ </not>
+ </condition>
+ </target>
+
+ <target name="test" depends="check-for-tests" unless="skip-tests">
+ <ant dir="src/test/flex" />
+ </target>
+
+ <target name="clean">
+ <delete failonerror="false">
+ <fileset dir="${FLEXJS_HOME}/frameworks/libs">
+ <include name="${target.name}"/>
+ </fileset>
+ </delete>
+ <delete failonerror="false" includeemptydirs="true">
+ <fileset dir="${basedir}/target">
+ <include name="**/**"/>
+ </fileset>
+ </delete>
+ <antcall target="clean-tests" />
+ </target>
+
+ <target name="clean-tests" depends="check-for-tests" unless="skip-tests">
+ <ant dir="src/test/flex" target="clean"/>
+ </target>
+
+ <target name="compile" description="Compiles .as files into .swc">
+ <echo message="Compiling libs/${ant.project.name}.swc"/>
+ <echo message="FLEX_HOME: ${FLEX_HOME}"/>
+ <echo message="FALCON_HOME: ${FALCON_HOME}"/>
+
+ <compc fork="true"
+ output="${basedir}/target/${target.name}">
+ <jvmarg line="${compc.jvm.args}"/>
+ <load-config filename="${basedir}/src/main/config/compile-as-config.xml" />
+ <arg value="+playerglobal.version=${playerglobal.version}" />
+ <arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+ <arg value="-define=COMPILE::SWF,true" />
+ <arg value="-define=COMPILE::JS,false" />
+ </compc>
+ <copy file="${basedir}/target/${target.name}" tofile="${FLEXJS_HOME}/frameworks/libs/${target.name}" />
+ </target>
+
+ <target name="check-compiler" depends="check-falcon-home">
+ <path id="lib.path">
+ <fileset dir="${FALCON_HOME}/lib" includes="falcon-flexTasks.jar"/>
+ </path>
+ <taskdef resource="flexTasks.tasks" classpathref="lib.path"/>
+ </target>
+
+ <target name="check-falcon-home" unless="FALCON_HOME"
+ description="Check FALCON_HOME is a directory.">
+
+ <echo message="FALCON_HOME is ${env.FALCON_HOME}"/>
+
+ <available file="${env.FALCON_HOME}/lib/falcon-mxmlc.jar"
+ type="file"
+ property="FALCON_HOME"
+ value="${env.FALCON_HOME}"/>
+
+ <available file="${FLEXJS_HOME}/../flex-falcon/compiler/lib/falcon-mxmlc.jar"
+ type="file"
+ property="FALCON_HOME"
+ value="${FLEXJS_HOME}/../flex-falcon/compiler"/>
+
+ <fail message="FALCON_HOME must be set to a folder with a lib sub-folder containing falcon-mxmlc.jar such as the compiler folder in flex-falcon repo or a FlexJS SDK folder"
+ unless="FALCON_HOME"/>
+ </target>
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/pom.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/pom.xml b/frameworks/projects/Basic/pom.xml
new file mode 100644
index 0000000..0263e38
--- /dev/null
+++ b/frameworks/projects/Basic/pom.xml
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.flex.flexjs.framework</groupId>
+ <artifactId>projects</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>Basic</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <packaging>swc</packaging>
+
+ <name>Apache Flex - FlexJS: Framework: Libs: Basic</name>
+
+ <build>
+ <sourceDirectory>src/main/flex</sourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.flex.flexjs.compiler</groupId>
+ <artifactId>flexjs-maven-plugin</artifactId>
+ <version>${flexjs.compiler.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <namespaces>
+ <namespace>
+ <uri>library://ns.apache.org/flexjs/basic</uri>
+ <manifest>${project.basedir}/src/main/resources/basic-manifest.xml</manifest>
+ </namespace>
+ <namespace>
+ <type>as</type>
+ <uri>library://ns.apache.org/flexjs/basic</uri>
+ <manifest>${project.basedir}/src/main/resources/basic-as-manifest.xml</manifest>
+ </namespace>
+ <namespace>
+ <uri>library://ns.apache.org/flexjs/svg</uri>
+ <manifest>${project.basedir}/src/main/resources/svg-manifest.xml</manifest>
+ </namespace>
+ </namespaces>
+ <includeClasses>
+ <includeClass>BasicClasses</includeClass>
+ </includeClasses>
+ <includeFiles>
+ <include-file>
+ <name>defaults.css</name>
+ <path>../src/main/resources/defaults.css</path>
+ </include-file>
+ </includeFiles>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.flex.flexjs.framework</groupId>
+ <artifactId>Core</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <type>swc</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flex.flexjs.framework</groupId>
+ <artifactId>Core</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <type>swc</type>
+ <classifier>typedefs</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flex.flexjs.framework</groupId>
+ <artifactId>Binding</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <type>swc</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flex.flexjs.framework</groupId>
+ <artifactId>Binding</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <type>swc</type>
+ <classifier>typedefs</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flex.flexjs.framework</groupId>
+ <artifactId>Graphics</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <type>swc</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flex.flexjs.framework</groupId>
+ <artifactId>Graphics</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <type>swc</type>
+ <classifier>typedefs</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flex.flexjs.framework</groupId>
+ <artifactId>Collections</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <type>swc</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flex.flexjs.framework</groupId>
+ <artifactId>Collections</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <type>swc</type>
+ <classifier>typedefs</classifier>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/config/compile-as-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/config/compile-as-config.xml b/frameworks/projects/Basic/src/main/config/compile-as-config.xml
new file mode 100644
index 0000000..6e12398
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/config/compile-as-config.xml
@@ -0,0 +1,90 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<flex-config>
+
+ <compiler>
+ <accessible>false</accessible>
+
+ <external-library-path>
+ <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element>
+ <path-element>../../../../../libs/Binding.swc</path-element>
+ <path-element>../../../../../libs/Core.swc</path-element>
+ <path-element>../../../../../libs/Graphics.swc</path-element>
+ <path-element>../../../../../libs/Collections.swc</path-element>
+ </external-library-path>
+
+ <mxml>
+ <children-as-data>true</children-as-data>
+ </mxml>
+ <binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event>
+ <binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind>
+ <binding-value-change-event-type>valueChange</binding-value-change-event-type>
+
+ <keep-as3-metadata>
+ <name>Bindable</name>
+ <name>Managed</name>
+ <name>ChangeEvent</name>
+ <name>NonCommittingChangeEvent</name>
+ <name>Transient</name>
+ </keep-as3-metadata>
+
+ <locale/>
+
+ <library-path/>
+
+ <namespaces>
+ <namespace>
+ <uri>library://ns.apache.org/flexjs/basic</uri>
+ <manifest>../resources/basic-manifest.xml</manifest>
+ </namespace>
+ <namespace>
+ <uri>library://ns.apache.org/flexjs/basic</uri>
+ <manifest>../resources/basic-as-manifest.xml</manifest>
+ </namespace>
+ <namespace>
+ <uri>library://ns.apache.org/flexjs/svg</uri>
+ <manifest>../resources/svg-manifest.xml</manifest>
+ </namespace>
+ </namespaces>
+
+ <source-path>
+ <path-element>../flex</path-element>
+ </source-path>
+
+ <warn-no-constructor>false</warn-no-constructor>
+ </compiler>
+
+ <include-file>
+ <name>defaults.css</name>
+ <path>../resources/defaults.css</path>
+ </include-file>
+
+ <include-classes>
+ <class>BasicClasses</class>
+ </include-classes>
+
+ <include-namespaces>
+ <uri>library://ns.apache.org/flexjs/basic</uri>
+ <uri>library://ns.apache.org/flexjs/svg</uri>
+ </include-namespaces>
+
+ <target-player>${playerglobal.version}</target-player>
+
+
+</flex-config>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/HTMLClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/HTMLClasses.as b/frameworks/projects/Basic/src/main/flex/HTMLClasses.as
new file mode 100644
index 0000000..1271417
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/HTMLClasses.as
@@ -0,0 +1,194 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+
+/**
+ * @private
+ * This class is used to link additional classes into rpc.swc
+ * beyond those that are found by dependecy analysis starting
+ * from the classes specified in manifest.xml.
+ */
+internal class HTMLClasses
+{
+
+ import org.apache.flex.html.ToolTip; ToolTip;
+ import org.apache.flex.html.accessories.NumericOnlyTextInputBead; NumericOnlyTextInputBead;
+ import org.apache.flex.html.accessories.PasswordInputBead; PasswordInputBead;
+ import org.apache.flex.html.accessories.TextPromptBead; TextPromptBead;
+ import org.apache.flex.html.beads.AlertView; AlertView;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.BackgroundImageBead; BackgroundImageBead;
+ }
+ import org.apache.flex.html.beads.ButtonBarView; ButtonBarView;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.CheckBoxView; CheckBoxView;
+ import org.apache.flex.html.beads.ComboBoxView; ComboBoxView;
+ }
+ import org.apache.flex.html.beads.ContainerView; ContainerView;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.ControlBarMeasurementBead; ControlBarMeasurementBead;
+ import org.apache.flex.html.beads.CSSButtonView; CSSButtonView;
+ import org.apache.flex.html.beads.CSSImageAndTextButtonView; CSSImageAndTextButtonView;
+ import org.apache.flex.html.beads.CSSTextButtonView; CSSTextButtonView;
+ import org.apache.flex.html.beads.CSSTextToggleButtonView; CSSTextToggleButtonView;
+ import org.apache.flex.html.beads.DropDownListView; DropDownListView;
+ import org.apache.flex.html.beads.CloseButtonView; CloseButtonView;
+ import org.apache.flex.html.beads.ImageAndTextButtonView; ImageAndTextButtonView;
+ import org.apache.flex.html.beads.ImageView; ImageView;
+ }
+ import org.apache.flex.html.beads.ImageButtonView; ImageButtonView;
+ import org.apache.flex.html.beads.ListView; ListView;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.NumericStepperView; NumericStepperView;
+ }
+ import org.apache.flex.html.beads.PanelView; PanelView;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.PanelWithControlBarView; PanelWithControlBarView;
+ import org.apache.flex.html.beads.RadioButtonView; RadioButtonView;
+ import org.apache.flex.html.beads.VScrollBarView; VScrollBarView;
+ import org.apache.flex.html.beads.HScrollBarView; HScrollBarView;
+ import org.apache.flex.html.beads.ScrollBarView; ScrollBarView;
+ import org.apache.flex.html.beads.SimpleAlertView; SimpleAlertView;
+ import org.apache.flex.html.beads.SingleLineBorderBead; SingleLineBorderBead;
+ import org.apache.flex.html.beads.SliderView; SliderView;
+ }
+ import org.apache.flex.html.beads.SliderThumbView; SliderThumbView;
+ import org.apache.flex.html.beads.SliderTrackView; SliderTrackView;
+ import org.apache.flex.html.beads.SpinnerView; SpinnerView;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.SolidBackgroundBead; SolidBackgroundBead;
+ import org.apache.flex.html.beads.TextButtonMeasurementBead; TextButtonMeasurementBead;
+ import org.apache.flex.html.beads.TextFieldLabelMeasurementBead; TextFieldLabelMeasurementBead;
+ import org.apache.flex.html.beads.TextAreaView; TextAreaView;
+ import org.apache.flex.html.beads.TextButtonView; TextButtonView;
+ import org.apache.flex.html.beads.TextFieldView; TextFieldView;
+ import org.apache.flex.html.beads.TextInputView; TextInputView;
+ import org.apache.flex.html.beads.TextInputWithBorderView; TextInputWithBorderView;
+ import org.apache.flex.html.beads.models.AlertModel; AlertModel;
+ }
+ import org.apache.flex.html.beads.models.ArraySelectionModel; ArraySelectionModel;
+ import org.apache.flex.html.beads.models.ArrayListSelectionModel; ArrayListSelectionModel;
+ import org.apache.flex.html.beads.models.RangeModel; RangeModel;
+ import org.apache.flex.html.beads.models.RangeModelExtended; RangeModelExtended;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.models.ComboBoxModel; ComboBoxModel;
+ }
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.models.ImageModel; ImageModel;
+ import org.apache.flex.html.beads.models.ImageAndTextModel; ImageAndTextModel;
+ }
+ import org.apache.flex.html.beads.models.PanelModel; PanelModel;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.models.SingleLineBorderModel; SingleLineBorderModel;
+ }
+ import org.apache.flex.html.beads.models.TextModel; TextModel;
+ import org.apache.flex.html.beads.models.TitleBarModel; TitleBarModel;
+ import org.apache.flex.html.beads.models.ToggleButtonModel; ToggleButtonModel;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.models.ValueToggleButtonModel; ValueToggleButtonModel;
+ }
+ import org.apache.flex.html.beads.models.ViewportModel; ViewportModel;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.controllers.AlertController; AlertController;
+ import org.apache.flex.html.beads.controllers.ComboBoxController; ComboBoxController;
+ import org.apache.flex.html.beads.controllers.DropDownListController; DropDownListController;
+ import org.apache.flex.html.beads.controllers.EditableTextKeyboardController; EditableTextKeyboardController;
+ }
+ import org.apache.flex.html.beads.controllers.ItemRendererMouseController; ItemRendererMouseController;
+ import org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController; ListSingleSelectionMouseController;
+ import org.apache.flex.html.beads.controllers.TreeSingleSelectionMouseController; TreeSingleSelectionMouseController;
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.controllers.SliderMouseController; SliderMouseController;
+ import org.apache.flex.html.beads.controllers.SpinnerMouseController; SpinnerMouseController;
+ import org.apache.flex.html.beads.controllers.VScrollBarMouseController; VScrollBarMouseController;
+ import org.apache.flex.html.beads.controllers.HScrollBarMouseController; HScrollBarMouseController;
+ }
+ import org.apache.flex.html.beads.layouts.ButtonBarLayout; ButtonBarLayout;
+ import org.apache.flex.html.beads.layouts.VerticalLayout; VerticalLayout;
+ import org.apache.flex.html.beads.layouts.HorizontalLayout; HorizontalLayout;
+ import org.apache.flex.html.beads.layouts.BasicLayout; BasicLayout;
+ import org.apache.flex.html.beads.layouts.OneFlexibleChildHorizontalLayout; OneFlexibleChildHorizontalLayout;
+ import org.apache.flex.html.beads.layouts.OneFlexibleChildVerticalLayout; OneFlexibleChildVerticalLayout;
+
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.layouts.HScrollBarLayout; HScrollBarLayout;
+ import org.apache.flex.html.beads.layouts.VScrollBarLayout; VScrollBarLayout;
+ }
+ import org.apache.flex.html.beads.layouts.TileLayout; TileLayout;
+ import org.apache.flex.html.beads.TextItemRendererFactoryForArrayData; TextItemRendererFactoryForArrayData;
+ import org.apache.flex.html.beads.DataItemRendererFactoryForArrayData; DataItemRendererFactoryForArrayData;
+ import org.apache.flex.html.beads.DataItemRendererFactoryForArrayList; DataItemRendererFactoryForArrayList;
+ import org.apache.flex.html.beads.DataItemRendererFactoryForHierarchicalData; DataItemRendererFactoryForHierarchicalData;
+ import org.apache.flex.html.supportClasses.DataGroup; DataGroup;
+ import org.apache.flex.html.supportClasses.Viewport; Viewport;
+ import org.apache.flex.html.supportClasses.ScrollingViewport; ScrollingViewport;
+ import org.apache.flex.html.supportClasses.DataGridButtonBarButtonItemRenderer; DataGridButtonBarButtonItemRenderer;
+
+ import org.apache.flex.html.DataGridButtonBarTextButton; DataGridButtonBarTextButton;
+ import org.apache.flex.html.DataGridButtonBar; DataGridButtonBar;
+ import org.apache.flex.html.beads.DataGridColumnView; DataGridColumnView;
+ import org.apache.flex.html.beads.DataGridView; DataGridView;
+ import org.apache.flex.html.beads.layouts.DataGridLayout; DataGridLayout;
+ import org.apache.flex.html.beads.DateChooserView; DateChooserView;
+ import org.apache.flex.html.beads.DateFieldView; DateFieldView;
+ import org.apache.flex.html.beads.DecrementButtonView; DecrementButtonView;
+ import org.apache.flex.html.beads.IncrementButtonView; IncrementButtonView;
+ import org.apache.flex.html.beads.RangeStepperView; RangeStepperView;
+ import org.apache.flex.html.beads.layouts.FlexibleFirstChildHorizontalLayout; FlexibleFirstChildHorizontalLayout;
+ import org.apache.flex.html.beads.models.DataGridModel; DataGridModel;
+ import org.apache.flex.html.beads.models.DateChooserModel; DateChooserModel;
+ import org.apache.flex.html.beads.models.DataGridPresentationModel; DataGridPresentationModel;
+ import org.apache.flex.html.beads.controllers.DateChooserMouseController; DateChooserMouseController;
+ import org.apache.flex.html.beads.controllers.DateFieldMouseController; DateFieldMouseController;
+ import org.apache.flex.html.beads.controllers.RangeStepperMouseController; RangeStepperMouseController;
+ import org.apache.flex.html.supportClasses.DataGridColumn; DataGridColumn;
+ import org.apache.flex.html.supportClasses.DateChooserButton; DateChooserButton;
+ import org.apache.flex.html.supportClasses.DateHeaderButton; DateHeaderButton;
+ import org.apache.flex.html.supportClasses.GraphicsItemRenderer; GraphicsItemRenderer;
+
+ import org.apache.flex.html.beads.TitleBarView; TitleBarView;
+ import org.apache.flex.html.beads.TitleBarMeasurementBead; TitleBarMeasurementBead;
+
+ import org.apache.flex.html.beads.WebBrowserView; WebBrowserView;
+ import org.apache.flex.html.beads.models.WebBrowserModel; WebBrowserModel;
+
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.beads.HRuleView; HRuleView;
+ import org.apache.flex.html.beads.VRuleView; VRuleView;
+ import org.apache.flex.html.beads.MultilineTextFieldView; MultilineTextFieldView;
+ }
+}
+
+}
+
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/IScrollingLayoutParent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/IScrollingLayoutParent.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/IScrollingLayoutParent.as
new file mode 100644
index 0000000..5e9768e
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/IScrollingLayoutParent.as
@@ -0,0 +1,68 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.core
+{
+ import org.apache.flex.html.supportClasses.Border;
+ import org.apache.flex.html.supportClasses.ScrollBar;
+
+ /**
+ * The IScrollingLayoutParent interface is an ILayoutParent
+ * that has traditional scrollbars. The layout implementation
+ * often needs to know certain things about other objects in
+ * the component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IScrollingLayoutParent
+ {
+ /**
+ * The border.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get border():Border;
+
+ /**
+ * The vertical ScrollBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get vScrollBar():ScrollBar;
+
+ /**
+ * The horizontal ScrollBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get hScrollBar():ScrollBar;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/events/ItemAddedEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/events/ItemAddedEvent.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/events/ItemAddedEvent.as
new file mode 100644
index 0000000..a6ae756
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/events/ItemAddedEvent.as
@@ -0,0 +1,88 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.events
+{
+
+ import org.apache.flex.events.CustomEvent;
+
+ /**
+ * The ItemAddedEvent is dispatched by IItemRendererParent objects whenenver an
+ * itemRenderer is added.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ItemAddedEvent extends CustomEvent
+ {
+
+ //--------------------------------------
+ // Constructor
+ //--------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @param type The name of the event.
+ * @param bubbles Whether the event bubbles.
+ * @param cancelable Whether the event can be canceled.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ItemAddedEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
+ {
+ COMPILE::SWF
+ {
+ super(type, bubbles, cancelable);
+ }
+ COMPILE::JS
+ {
+ super(type);
+ }
+
+ item = null;
+ }
+
+ /**
+ * The item being added.
+ *
+ * @export
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var item:Object;
+
+ /**
+ * @private
+ */
+ override public function cloneEvent():org.apache.flex.events.Event
+ {
+ var newEvent:ItemAddedEvent = new ItemAddedEvent(type);
+ newEvent.item = item;
+ return newEvent;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/events/ItemClickedEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/events/ItemClickedEvent.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/events/ItemClickedEvent.as
new file mode 100644
index 0000000..febc798
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/events/ItemClickedEvent.as
@@ -0,0 +1,115 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.events
+{
+
+ import org.apache.flex.events.CustomEvent;
+
+ /**
+ * The ItemClickedEvent is a custom event issued by an itemRenderer to
+ * convey information about itself when it has determined that the
+ * event(s) happening to it constitute a 'click' on itself.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ItemClickedEvent extends CustomEvent
+ {
+
+ //--------------------------------------
+ // Constructor
+ //--------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @param type The name of the event.
+ * @param bubbles Whether the event bubbles.
+ * @param cancelable Whether the event can be canceled.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ItemClickedEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
+ {
+ COMPILE::SWF
+ {
+ super(type, bubbles, cancelable);
+ }
+ COMPILE::JS
+ {
+ super(type);
+ }
+
+ index = -1;
+ data = null;
+ multipleSelection = false;
+ }
+
+ /**
+ * The index of the item beginning with zero.
+ *
+ * @export
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var index:Number;
+
+ /**
+ * The data of the item.
+ *
+ * @export
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var data:Object;
+
+ /**
+ * Whether or not this click is part of a multi-selection sequence.
+ *
+ * @export
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var multipleSelection:Boolean;
+
+ /**
+ * @private
+ */
+ override public function cloneEvent():org.apache.flex.events.Event
+ {
+ var newEvent:ItemClickedEvent = new ItemClickedEvent(type);
+ newEvent.index = index;
+ newEvent.data = data;
+ newEvent.multipleSelection = multipleSelection;
+ return newEvent;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/events/ItemRemovedEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/events/ItemRemovedEvent.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/events/ItemRemovedEvent.as
new file mode 100644
index 0000000..313f3f9
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/events/ItemRemovedEvent.as
@@ -0,0 +1,88 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.events
+{
+
+ import org.apache.flex.events.CustomEvent;
+
+ /**
+ * The ItemRemovedEvent is dispatched by IItemRendererParent objects whenenver an
+ * itemRenderer is removed.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ItemRemovedEvent extends CustomEvent
+ {
+
+ //--------------------------------------
+ // Constructor
+ //--------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @param type The name of the event.
+ * @param bubbles Whether the event bubbles.
+ * @param cancelable Whether the event can be canceled.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ItemRemovedEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
+ {
+ COMPILE::SWF
+ {
+ super(type, bubbles, cancelable);
+ }
+ COMPILE::JS
+ {
+ super(type);
+ }
+
+ item = null;
+ }
+
+ /**
+ * The item being removed.
+ *
+ * @export
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var item:Object;
+
+ /**
+ * @private
+ */
+ override public function cloneEvent():org.apache.flex.events.Event
+ {
+ var newEvent:ItemRemovedEvent = new ItemRemovedEvent(type);
+ newEvent.item = item;
+ return newEvent;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/events/ItemRendererEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/events/ItemRendererEvent.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/events/ItemRendererEvent.as
new file mode 100644
index 0000000..f4044a4
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/events/ItemRendererEvent.as
@@ -0,0 +1,90 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.events
+{
+ import org.apache.flex.core.IItemRenderer;
+ import org.apache.flex.events.CustomEvent;
+
+ /**
+ * The ItemRendererEvent is dispatched by DataItemRendererFactory classes under
+ * various conditions.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ItemRendererEvent extends CustomEvent
+ {
+ // dispatched when a new itemRenderer has been created and added to the IItemRendererParent.
+ static public const CREATED:String = "itemRendererCreated";
+
+ //--------------------------------------
+ // Constructor
+ //--------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @param type The name of the event.
+ * @param bubbles Whether the event bubbles.
+ * @param cancelable Whether the event can be canceled.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ItemRendererEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
+ {
+ COMPILE::SWF
+ {
+ super(type, bubbles, cancelable);
+ }
+ COMPILE::JS
+ {
+ super(type);
+ }
+
+ itemRenderer = null;
+ }
+
+ /**
+ * The itemRenderer that has been created.
+ *
+ * @export
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public var itemRenderer:IItemRenderer;
+
+ /**
+ * @private
+ */
+ override public function cloneEvent():org.apache.flex.events.Event
+ {
+ var newEvent:ItemRendererEvent = new ItemRendererEvent(type);
+ newEvent.itemRenderer = itemRenderer;
+ return newEvent;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Alert.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Alert.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Alert.as
new file mode 100644
index 0000000..b7f50dc
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Alert.as
@@ -0,0 +1,287 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.IAlertModel;
+ import org.apache.flex.core.IPopUp;
+ import org.apache.flex.core.UIBase;
+
+ COMPILE::JS
+ {
+ import goog.events;
+ import org.apache.flex.core.WrappedHTMLElement;
+ import org.apache.flex.events.Event;
+ }
+
+ /**
+ * The Alert class is a component that displays a message and one or more buttons
+ * in a view that pops up over all other controls and views. The Alert component
+ * uses the AlertView bead to display a modal dialog with a title and a variety
+ * of buttons configured through the flag property of its show() static function.
+ * The Alert component uses the following beads:
+ *
+ * org.apache.flex.core.IBeadModel: the data model for the Alert.
+ * org.apache.flex.core.IBeadView: the bead used to create the parts of the Alert.
+ * org.apache.flex.core.IBeadController: the bead used to handle input events.
+ * org.apache.flex.core.IBorderBead: if present, draws a border around the Alert.
+ * org.apache.flex.core.IBackgroundBead: if present, places a solid color background below the Alert.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class Alert extends UIBase implements IPopUp
+ {
+ /**
+ * The bitmask button flag to show the YES button.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public static const YES:uint = 0x000001;
+
+ /**
+ * The bitmask button flag to show the NO button.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public static const NO:uint = 0x000002;
+
+ /**
+ * The bitmask button flag to show the OK button.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public static const OK:uint = 0x000004;
+
+ /**
+ * The bitmask button flag to show the Cancel button.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public static const CANCEL:uint = 0x000008;
+
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Alert()
+ {
+ super();
+
+ className = "Alert";
+ }
+
+ COMPILE::JS
+ private var titleBar:TitleBar;
+
+ COMPILE::JS
+ private var label:Label;
+
+ COMPILE::JS
+ private var buttonArea:Container;
+
+ /**
+ * @override
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ super.createElement();
+
+ element.className = 'Alert';
+
+ // add in a title bar
+ titleBar = new TitleBar();
+ addElement(titleBar);
+ titleBar.element.id = 'titleBar';
+
+ label = new Label();
+ addElement(label);
+ label.element.id = 'message';
+
+ // add a place for the buttons
+ buttonArea = new Container();
+ addElement(buttonArea);
+ buttonArea.element.id = 'buttonArea';
+
+ return element;
+ };
+
+ // note: only passing parent to this function as I don't see a way to identify
+ // the 'application' or top level view without supplying a place to start to
+ // look for it.
+ /**
+ * This static method is a convenience function to quickly create and display an Alert. The
+ * text and parent paramters are required, the others will default.
+ *
+ * @param String text The message content of the Alert.
+ * @param Object parent The object that hosts the pop-up.
+ * @param String title An optional title for the Alert.
+ * @param uint flags Identifies which buttons to display in the alert.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ static public function show( text:String, parent:Object, title:String="", flags:uint=Alert.OK ) : void
+ {
+ var alert:Alert = new Alert();
+ alert.message = text;
+ alert.title = title;
+ alert.flags = flags;
+
+ alert.show(parent);
+
+ COMPILE::JS
+ {
+ alert.positioner.style.position = 'relative';
+ alert.positioner.style.width = '200px';
+ alert.positioner.style.margin = 'auto';
+ alert.positioner.style.top = '100px';
+ }
+ }
+
+ /**
+ * Shows the Alert anchored to the given parent object which is usally a root component such
+ * as a UIView..
+ *
+ * @param Object parent The object that hosts the pop-up.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function show(parent:Object) : void
+ {
+ parent.addElement(this);
+ }
+
+ /**
+ * The tile of the Alert.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get title():String
+ {
+ return IAlertModel(model).title;
+ }
+ public function set title(value:String):void
+ {
+ IAlertModel(model).title = value;
+ }
+
+ /**
+ * The message to display in the Alert body.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get message():String
+ {
+ return IAlertModel(model).message;
+ }
+ public function set message(value:String):void
+ {
+ IAlertModel(model).message = value;
+ }
+
+ /**
+ * The buttons to display on the Alert as bit-mask values.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get flags():uint
+ {
+ return IAlertModel(model).flags;
+ }
+ public function set flags(value:uint):void
+ {
+ IAlertModel(model).flags = value;
+
+ COMPILE::JS
+ {
+ // add buttons based on flags
+ if (flags & Alert.OK) {
+ var ok:TextButton = new TextButton();
+ buttonArea.addElement(ok);
+ ok.text = 'OK';
+ goog.events.listen(ok.element, 'click', dismissAlert);
+ }
+ if (flags & Alert.CANCEL) {
+ var cancel:TextButton = new TextButton();
+ buttonArea.addElement(cancel);
+ cancel.text = 'Cancel';
+ goog.events.listen(cancel.element, 'click', dismissAlert);
+ }
+ if (flags & Alert.YES) {
+ var yes:TextButton = new TextButton();
+ buttonArea.addElement(yes);
+ yes.text = 'YES';
+ goog.events.listen(yes.element, 'click', dismissAlert);
+ }
+ if (flags & Alert.NO) {
+ var nob:TextButton = new TextButton();
+ buttonArea.addElement(nob);
+ nob.text = 'NO';
+ goog.events.listen(nob.element, 'click', dismissAlert);
+ }
+
+ }
+ }
+
+ /**
+ * @param event The event object.
+ * @flexjsignorecoercion HTMLElement
+ */
+ COMPILE::JS
+ private function dismissAlert(event:Event):void
+ {
+ var htmlElement:HTMLElement = element as HTMLElement;
+ htmlElement.parentElement.removeChild(element);
+ };
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Button.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Button.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Button.as
new file mode 100644
index 0000000..6057919
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Button.as
@@ -0,0 +1,85 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ COMPILE::SWF
+ {
+ import org.apache.flex.core.UIButtonBase;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.IEventDispatcher;
+
+
+ //--------------------------------------
+ // Events
+ //--------------------------------------
+
+ /**
+ * Dispatched when the user clicks on a button.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="click", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * The Button class is a simple button. Use TextButton for
+ * buttons that should show text. This is the lightest weight
+ * button used for non-text buttons like the arrow buttons
+ * in a Scrollbar or NumericStepper.
+ *
+ * The most common view for this button is CSSButtonView that
+ * allows you to specify a backgroundImage in CSS that defines
+ * the look of the button.
+ *
+ * However, when used in ScrollBar and when composed in many
+ * other components, it is more common to assign a custom view
+ * to the button.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class Button extends ButtonBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Button()
+ {
+ super();
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ButtonBar.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ButtonBar.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ButtonBar.as
new file mode 100644
index 0000000..e4c58e7
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ButtonBar.as
@@ -0,0 +1,76 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The ButtonBar class is a component that displays a set of Buttons. The ButtonBar
+ * is actually a List with a default horizontal layout and an itemRenderer that
+ * produces Buttons. The ButtonBar uses the following beads:
+ *
+ * org.apache.flex.core.IBeadModel: the data model for the ButtonBar, including the dataProvider.
+ * org.apache.flex.core.IBeadView: constructs the parts of the component.
+ * org.apache.flex.core.IBeadController: handles input events.
+ * org.apache.flex.core.IBeadLayout: sizes and positions the component parts.
+ * org.apache.flex.core.IDataProviderItemRendererMapper: produces itemRenderers.
+ * org.apache.flex.core.IItemRenderer: the class or class factory to use.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ButtonBar extends List
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ButtonBar()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('div') as WrappedHTMLElement;
+ element.style.overflow = 'auto';
+ positioner = element;
+ positioner.style.position = 'relative';
+
+ className = 'ButtonBar';
+
+ element.flexjs_wrapper = this;
+
+ return element;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ButtonBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ButtonBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ButtonBase.as
new file mode 100644
index 0000000..a30f0cf
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ButtonBase.as
@@ -0,0 +1,101 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IUIBase;
+ COMPILE::SWF
+ {
+ import org.apache.flex.core.UIButtonBase;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.IEventDispatcher;
+
+
+ //--------------------------------------
+ // Events
+ //--------------------------------------
+
+ /**
+ * Dispatched when the user clicks on a button.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="click", type="org.apache.flex.events.MouseEvent")]
+
+ /**
+ * The ButtonBase class is the base class for Button.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public class ButtonBase extends UIButtonBase implements IStrand, IEventDispatcher, IUIBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ButtonBase()
+ {
+ super();
+ }
+ }
+
+ COMPILE::JS
+ public class ButtonBase extends UIBase implements IStrand, IEventDispatcher, IUIBase
+ {
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('button') as WrappedHTMLElement;
+ element.setAttribute('type', 'button');
+
+ positioner = element;
+ positioner.style.position = 'relative';
+ element.flexjs_wrapper = this;
+
+ /* AJH comment out until we figure out why it is needed
+ if (org.apache.flex.core.ValuesManager.valuesImpl.getValue) {
+ var impl:Object = org.apache.flex.core.ValuesManager.valuesImpl.
+ getValue(this, 'iStatesImpl');
+ }*/
+
+ return element;
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/CheckBox.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/CheckBox.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/CheckBox.as
new file mode 100644
index 0000000..632b539
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/CheckBox.as
@@ -0,0 +1,187 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ COMPILE::SWF
+ {
+ import flash.events.MouseEvent;
+ }
+
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IToggleButtonModel;
+ import org.apache.flex.core.IUIBase;
+ COMPILE::SWF
+ {
+ import org.apache.flex.core.UIButtonBase;
+ }
+ COMPILE::JS
+ {
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.WrappedHTMLElement;
+ import org.apache.flex.html.supportClasses.CheckBoxIcon;
+ }
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.MouseEvent;
+
+ //--------------------------------------
+ // Events
+ //--------------------------------------
+
+ /**
+ * Dispatched when the user checks or un-checks the CheckBox.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="change", type="org.apache.flex.events.Event")]
+
+ /**
+ * The CheckBox class implements the common user interface
+ * control. The CheckBox includes its text label.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public class CheckBox extends UIButtonBase implements IStrand
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function CheckBox()
+ {
+ super();
+
+ addEventListener(org.apache.flex.events.MouseEvent.CLICK, internalMouseHandler);
+ }
+
+ /**
+ * The text label for the CheckBox.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ return IToggleButtonModel(model).text;
+ }
+
+ /**
+ * @private
+ */
+ public function set text(value:String):void
+ {
+ IToggleButtonModel(model).text = value;
+ }
+
+ [Bindable("change")]
+ /**
+ * <code>true</code> if the check mark is displayed.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selected():Boolean
+ {
+ return IToggleButtonModel(model).selected;
+ }
+
+ /**
+ * @private
+ */
+ public function set selected(value:Boolean):void
+ {
+ IToggleButtonModel(model).selected = value;
+ }
+
+ private function internalMouseHandler(event:org.apache.flex.events.MouseEvent) : void
+ {
+ selected = !selected;
+ dispatchEvent(new Event("change"));
+ }
+ }
+
+ COMPILE::JS
+ public class CheckBox extends UIBase
+ {
+ private var _label:WrappedHTMLElement;
+ private var _icon:CheckBoxIcon;
+
+ private static var _checkNumber:Number = 0;
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ override protected function createElement():WrappedHTMLElement
+ {
+ var cb:HTMLInputElement;
+
+ element = document.createElement('label') as WrappedHTMLElement;
+ _label = element;
+ _icon = new CheckBoxIcon();
+ element.appendChild(_icon.element);
+
+ element.appendChild(document.createTextNode(''));
+
+ positioner = element;
+ positioner.style.position = 'relative';
+ element.flexjs_wrapper = this;
+ _icon.element.flexjs_wrapper = this;
+
+ className = 'CheckBox';
+ typeNames = 'CheckBox, CheckBoxIcon';
+
+ return element;
+ }
+
+ public function get text():String
+ {
+ return _label.childNodes.item(1).nodeValue;
+ }
+
+ public function set text(value:String):void
+ {
+ _label.childNodes.item(1).nodeValue = value;
+ }
+
+ public function get selected():Boolean
+ {
+ return (_icon.element as HTMLInputElement).checked;
+ }
+
+ public function set selected(value:Boolean):void
+ {
+ (_icon.element as HTMLInputElement).checked = value;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/CloseButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/CloseButton.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/CloseButton.as
new file mode 100644
index 0000000..8306915
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/CloseButton.as
@@ -0,0 +1,66 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The CloseButton class is Button that displays an X
+ * and is commonly used in a Panel's TitleBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class CloseButton extends Button
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function CloseButton()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ super.createElement();
+ element.innerHTML = 'x';
+
+ element.style.padding = 0;
+ height = 11;
+ width = 11;
+ return element;
+ }
+
+ }
+}
[17/43] git commit: [flex-asjs] [refs/heads/refactor-sprite] - try to
copy HTML to Basic without losing history
Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ComboBox.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ComboBox.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ComboBox.as
new file mode 100644
index 0000000..fa91fec
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ComboBox.as
@@ -0,0 +1,277 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.IComboBoxModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+
+ COMPILE::JS
+ {
+ import goog.events;
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ [Event(name="change", type="org.apache.flex.events.Event")]
+
+ /**
+ * The ComboBox class is a component that displays an input field and
+ * pop-up List with selections. Selecting an item from the pop-up List
+ * places that item into the input field of the ComboBox. The ComboBox
+ * uses the following bead types:
+ *
+ * org.apache.flex.core.IBeadModel: the data model, which includes the dataProvider, selectedItem, and
+ * so forth.
+ * org.apache.flex.core.IBeadView: the bead that constructs the visual parts of the component.
+ * org.apache.flex.core.IBeadController: the bead that handles input and output.
+ * org.apache.flex.core.IPopUp: the bead responsible for displaying the selection list.
+ * org.apache.flex.core.IDataProviderItemRendererMapper: the bead responsible for creating the itemRenders.
+ * org.apache.flex.core.IItemRenderer: the class or factory used to display an item in the component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ComboBox extends UIBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ComboBox()
+ {
+ super();
+ }
+
+ /**
+ * The data for display by the ComboBox.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dataProvider():Object
+ {
+ return IComboBoxModel(model).dataProvider;
+ }
+ public function set dataProvider(value:Object):void
+ {
+ IComboBoxModel(model).dataProvider = value;
+ }
+
+ /**
+ * The index of the currently selected item. Changing this item changes
+ * the selectedItem value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedIndex():int
+ {
+ return IComboBoxModel(model).selectedIndex;
+ }
+ public function set selectedIndex(value:int):void
+ {
+ IComboBoxModel(model).selectedIndex = value;
+ }
+
+ /**
+ * The item that is currently selected. Changing this item changes
+ * the selectedIndex.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedItem():Object
+ {
+ return IComboBoxModel(model).selectedItem;
+ }
+ public function set selectedItem(value:Object):void
+ {
+ IComboBoxModel(model).selectedItem = value;
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ var button:WrappedHTMLElement;
+ var input:WrappedHTMLElement;
+
+ element = document.createElement('div') as WrappedHTMLElement;
+
+ input = document.createElement('input') as WrappedHTMLElement;
+ input.style.position = 'absolute';
+ input.style.width = '80px';
+ element.appendChild(input);
+
+ button = document.createElement('div') as WrappedHTMLElement;
+ button.style.position = 'absolute';
+ button.style.top = '0px';
+ button.style.right = '0px';
+ button.style.background = '#bbb';
+ button.style.width = '16px';
+ button.style.height = '20px';
+ button.style.margin = '0';
+ button.style.border = 'solid #609 1px';
+ goog.events.listen(button, 'click', buttonClicked);
+ element.appendChild(button);
+
+ positioner = element;
+ positioner.style.position = 'relative';
+
+ // add a click handler so that a click outside of the combo box can
+ // dismiss the pop-up should it be visible.
+ goog.events.listen(document, 'click',
+ dismissPopup);
+
+ input.flexjs_wrapper = this;
+
+ return element;
+ }
+
+ COMPILE::JS
+ private var popup:HTMLElement;
+
+ /**
+ * @param event The event.
+ * @flexjsignorecoercion HTMLSelectElement
+ */
+ COMPILE::JS
+ private function selectChanged(event:Event):void
+ {
+ var select:HTMLSelectElement;
+
+ select = event.currentTarget as HTMLSelectElement;
+
+ selectedItem = select.options[select.selectedIndex].value;
+
+ popup.parentNode.removeChild(popup);
+ popup = null;
+
+ dispatchEvent(event);
+ }
+
+
+ /**
+ * @param event The event.
+ */
+ COMPILE::JS
+ private function dismissPopup(event:Event):void
+ {
+ // remove the popup if it already exists
+ if (popup) {
+ popup.parentNode.removeChild(popup);
+ popup = null;
+ }
+ }
+
+
+ /**
+ * @export
+ * @param {Object} event The event.
+ * @flexjsignorecoercion HTMLInputElement
+ * @flexjsignorecoercion HTMLElement
+ * @flexjsignorecoercion HTMLSelectElement
+ * @flexjsignorecoercion HTMLOptionElement
+ * @flexjsignorecoercion Array
+ */
+ COMPILE::JS
+ private function buttonClicked(event:Event):void
+ {
+ var dp:Array;
+ var i:int;
+ var input:HTMLInputElement;
+ var left:Number;
+ var n:int;
+ var opt:HTMLOptionElement;
+ var pn:HTMLElement;
+ var popup:HTMLElement;
+ var select:HTMLSelectElement;
+ var si:int;
+ var top:Number;
+ var width:Number;
+
+ event.stopPropagation();
+
+ if (popup) {
+ dismissPopup(null);
+
+ return;
+ }
+
+ input = element.childNodes.item(0) as HTMLInputElement;
+
+ pn = element;
+ top = pn.offsetTop + input.offsetHeight;
+ left = pn.offsetLeft;
+ width = pn.offsetWidth;
+
+ popup = document.createElement('div') as HTMLElement;
+ popup.className = 'popup';
+ popup.id = 'test';
+ popup.style.position = 'absolute';
+ popup.style.top = top.toString() + 'px';
+ popup.style.left = left.toString() + 'px';
+ popup.style.width = width.toString() + 'px';
+ popup.style.margin = '0px auto';
+ popup.style.padding = '0px';
+ popup.style.zIndex = '10000';
+
+ select = document.createElement('select') as HTMLSelectElement;
+ select.style.width = width.toString() + 'px';
+ goog.events.listen(select, 'change', selectChanged);
+
+ dp = dataProvider as Array;
+ n = dp.length;
+ for (i = 0; i < n; i++) {
+ opt = document.createElement('option') as HTMLOptionElement;
+ opt.text = dp[i];
+ select.add(opt, null);
+ }
+
+ select.size = n;
+
+ si = selectedIndex;
+ if (si < 0) {
+ select.value = null;
+ } else {
+ select.value = dp[si];
+ }
+
+ this.popup = popup;
+
+ popup.appendChild(select);
+ document.body.appendChild(popup);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Container.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Container.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Container.as
new file mode 100644
index 0000000..ee30b7f
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Container.as
@@ -0,0 +1,108 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.ContainerBase;
+ import org.apache.flex.core.IChrome;
+ import org.apache.flex.core.IContainer;
+ import org.apache.flex.core.IUIBase;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+ import org.apache.flex.events.Event;
+
+ [DefaultProperty("mxmlContent")]
+
+ /**
+ * The Container class implements a basic container for
+ * other controls and containers. The position and size
+ * of the children are determined by a layout while the size of
+ * a Container can either be determined by its children or by
+ * specifying an exact size in pixels or as a percentage of the
+ * parent element.
+ *
+ * This Container does not have a built-in scroll bar or clipping of
+ * its content should the content exceed the Container's boundaries. To
+ * have scroll bars and clipping, add the ScrollingView bead.
+ *
+ * While the container is relatively lightweight, it should
+ * generally not be used as the base class for other controls,
+ * even if those controls are composed of children. That's
+ * because the fundamental API of Container is to support
+ * an arbitrary set of children, and most controls only
+ * support a specific set of children.
+ *
+ * And that's one of the advantages of beads: that functionality
+ * used in a Container can also be used in a Control as long
+ * as that bead doesn't assume that its strand is a Container.
+ *
+ * For example, even though you can use a Panel to create the
+ * equivalent of an Alert control, the Alert is a
+ * control and not a Container because the Alert does not
+ * support an arbitrary set of children.
+ *
+ * @see org.apache.flex.html.beads.layout
+ * @see org.apache.flex.html.supportClasses.ScrollingViewport
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class Container extends ContainerBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Container()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('div') as WrappedHTMLElement;
+
+ positioner = element;
+
+ // absolute positioned children need a non-null
+ // position value in the parent. It might
+ // get set to 'absolute' if the container is
+ // also absolutely positioned
+ positioner.style.position = 'relative';
+ element.flexjs_wrapper = this;
+
+ /*addEventListener('childrenAdded',
+ runLayoutHandler);
+ addEventListener('elementRemoved',
+ runLayoutHandler);*/
+
+ return element;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ControlBar.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ControlBar.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ControlBar.as
new file mode 100644
index 0000000..da65539
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ControlBar.as
@@ -0,0 +1,99 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IChrome;
+ import org.apache.flex.core.IContainer;
+ import org.apache.flex.core.ValuesManager;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The ControlBar class is used within a Panel as a place to position
+ * additional controls. The ControlBar appears at the bottom of the
+ * org.apache.flex.html.Panel
+ * and is not part of the Panel's scrollable content area. The ControlBar
+ * is a Container and implements the org.apache.flex.core.IChrome interface, indicating that is
+ * outside of the Container's content area. The ControlBar uses the following
+ * beads:
+ *
+ * org.apache.flex.core.IBeadModel: the data model for the component.
+ * org.apache.flex.core.IMeasurementBead: helps determine the overlay size of the ControlBar for layout.
+ * org.apache.flex.core.IBorderBead: if present, displays a border around the component.
+ * org.apache.flex.core.IBackgroundBead: if present, displays a solid background below the ControlBar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ControlBar extends Container implements IContainer, IChrome
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ControlBar()
+ {
+ super();
+
+ className = "ControlBar";
+ }
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+
+ if( getBeadByType(IBeadLayout) == null ) {
+ var layout:IBeadLayout = new (ValuesManager.valuesImpl.getValue(this, "iBeadLayout")) as IBeadLayout;
+ addBead(layout);
+ }
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('div') as WrappedHTMLElement;
+ element.className = 'ControlBar';
+ element.style.display = 'inline';
+ typeNames = 'ControlBar';
+
+ positioner = element;
+ positioner.style.position = 'relative';
+ element.flexjs_wrapper = this;
+
+ return element;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DataGrid.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DataGrid.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DataGrid.as
new file mode 100644
index 0000000..c271134
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DataGrid.as
@@ -0,0 +1,166 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IDataGridModel;
+ import org.apache.flex.core.IDataGridPresentationModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.html.beads.models.DataGridPresentationModel;
+
+ [Event(name="change", type="org.apache.flex.events.Event")]
+
+ /**
+ * The DataGrid class displays a collection of data using columns and rows. Each
+ * column represents a specific field in the data set; each row represents a specific
+ * datum. The DataGrid is a composite component built with a org.apache.flex.html.ButtonBar
+ * for the column headers and a org.apache.flex.html.List for each column. The DataGrid's
+ * view bead (usually org.apache.flex.html.beads.DataGridView) constructs these parts while
+ * itemRenderer factories contruct the elements to display the data in each cell.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataGrid extends UIBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGrid()
+ {
+ super();
+
+ className = "DataGrid";
+ }
+
+ /**
+ * The array of org.apache.flex.html.supportClasses.DataGridColumns used to
+ * describe each column.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get columns():Array
+ {
+ return IDataGridModel(model).columns;
+ }
+ public function set columns(value:Array):void
+ {
+ IDataGridModel(model).columns = value;
+ }
+
+ /**
+ * The object used to provide data to the org.apache.flex.html.DataGrid.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dataProvider():Object
+ {
+ return IDataGridModel(model).dataProvider;
+ }
+ public function set dataProvider(value:Object):void
+ {
+ IDataGridModel(model).dataProvider = value;
+ }
+
+ /**
+ * The currently selected row.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedIndex():int
+ {
+ return IDataGridModel(model).selectedIndex;
+ }
+
+ /**
+ * The DataGrid's presentation model
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get presentationModel():IDataGridPresentationModel
+ {
+ var beadMod:IBead = getBeadByType(IDataGridPresentationModel);
+ var presModel:IDataGridPresentationModel;
+
+ if (beadMod == null) {
+ presModel = new DataGridPresentationModel();
+ addBead(presModel);
+ } else {
+ presModel = beadMod as IDataGridPresentationModel;
+ }
+ return presModel;
+ }
+
+ /**
+ * The default height of each cell in every column
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get rowHeight():Number
+ {
+ return presentationModel.rowHeight;
+ }
+ public function set rowHeight(value:Number):void
+ {
+ presentationModel.rowHeight = value;
+ }
+
+ /**
+ * @private
+ * The DataGrid needs to know whenever its size is being changed so the columns can be
+ * be aligned properly, so the noEvent value must always be false.
+ */
+ override public function setWidth(value:Number, noEvent:Boolean=false):void
+ {
+ super.setWidth(value,false);
+ }
+
+ /**
+ * @private
+ * The DataGrid needs to know whenever its size is being changed so the columns can be
+ * be aligned properly, so the noEvent value must always be false.
+ */
+ override public function setHeight(value:Number, noEvent:Boolean=false):void
+ {
+ super.setHeight(value,false);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DataGridButtonBar.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DataGridButtonBar.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DataGridButtonBar.as
new file mode 100644
index 0000000..c7208dc
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DataGridButtonBar.as
@@ -0,0 +1,51 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The DataGridButtonBar class extends ButtonBar and provides a class for styling
+ * the header region of the DataGrid.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataGridButtonBar extends ButtonBar
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGridButtonBar()
+ {
+ super();
+ className = "DataGridButtonBar";
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DataGridButtonBarTextButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DataGridButtonBarTextButton.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DataGridButtonBarTextButton.as
new file mode 100644
index 0000000..67be174
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DataGridButtonBarTextButton.as
@@ -0,0 +1,55 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.ITextModel;
+
+ COMPILE::JS {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The DataGridButtonBarTextButton class extends TextButton so that
+ * the buttons used in the DataGrid header can be styled separately
+ * from normal TextButtons.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataGridButtonBarTextButton extends TextButton
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataGridButtonBarTextButton()
+ {
+ super();
+ typeNames = "";
+ className = "DataGridButtonBarTextButton";
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DateChooser.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DateChooser.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DateChooser.as
new file mode 100644
index 0000000..62b5a3e
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DateChooser.as
@@ -0,0 +1,74 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.IDateChooserModel;
+ import org.apache.flex.core.UIBase;
+
+ /**
+ * The change event is dispatched when the selectedDate is changed.
+ */
+ [Event(name="change", type="org.apache.flex.events.Event")]
+
+ /**
+ * The DateChooser class is a component that displays a calendar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateChooser extends UIBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateChooser()
+ {
+ super();
+ className = "DateChooser";
+
+ // fix the DateChooser's size
+ width = 280;
+ height = 240;
+ }
+
+ /**
+ * The currently selected date (or null if no date has been selected).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedDate():Date
+ {
+ return IDateChooserModel(model).selectedDate;
+ }
+ public function set selectedDate(value:Date):void
+ {
+ IDateChooserModel(model).selectedDate = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DateField.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DateField.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DateField.as
new file mode 100644
index 0000000..f46e453
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DateField.as
@@ -0,0 +1,95 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IDateChooserModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+
+ /**
+ * The change event is dispatched when the selectedDate is changed.
+ */
+ [Event(name="change", type="org.apache.flex.events.Event")]
+
+ /**
+ * The DateField class provides an input field where a date can be entered
+ * and a pop-up calendar control for picking a date as an alternative to
+ * the text field.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateField extends UIBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateField()
+ {
+ super();
+
+ className = "DateField";
+ }
+
+ /**
+ * The method called when added to a parent. The DateField class uses
+ * this opportunity to install additional beads.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function addedToParent():void
+ {
+ var klass:* = ValuesManager.valuesImpl.getValue(this,"iFormatBead");
+ var bead:IBead = new klass() as IBead;
+ if (bead) {
+ addBead(bead);
+ }
+
+ super.addedToParent();
+ }
+
+ /**
+ * The currently selected date (or null if no date has been selected).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedDate():Date
+ {
+ return IDateChooserModel(model).selectedDate;
+ }
+ public function set selectedDate(value:Date):void
+ {
+ IDateChooserModel(model).selectedDate = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DropDownList.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DropDownList.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DropDownList.as
new file mode 100644
index 0000000..dd069b2
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/DropDownList.as
@@ -0,0 +1,235 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.ISelectionModel;
+
+ COMPILE::JS
+ {
+ import goog.events;
+ import org.apache.flex.core.WrappedHTMLElement;
+ import org.apache.flex.html.beads.models.ArraySelectionModel;
+ }
+
+ //--------------------------------------
+ // Events
+ //--------------------------------------
+
+ /**
+ * Dispatched when the user selects an item.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="change", type="org.apache.flex.events.Event")]
+
+ /**
+ * The DropDownList class implements the basic equivalent of
+ * the <code><select></code> tag in HTML.
+ * The default implementation only lets the user see and
+ * choose from an array of strings. More complex controls
+ * would display icons as well as strings, or colors instead
+ * of strings or just about anything.
+ *
+ * The default behavior only lets the user choose one and
+ * only one item. More complex controls would allow
+ * mutiple selection by not dismissing the dropdown as soon
+ * as a selection is made.
+ *
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DropDownList extends Button
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DropDownList()
+ {
+ COMPILE::JS
+ {
+ model = new ArraySelectionModel();
+ }
+ }
+
+ /**
+ * The data set to be displayed. Usually a simple
+ * array of strings. A more complex component
+ * would allow more complex data and data sets.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dataProvider():Object
+ {
+ return ISelectionModel(model).dataProvider;
+ }
+
+ /**
+ * @private
+ * @flexjsignorecoercion HTMLOptionElement
+ * @flexjsignorecoercion HTMLSelectElement
+ */
+ public function set dataProvider(value:Object):void
+ {
+ ISelectionModel(model).dataProvider = value;
+ COMPILE::JS
+ {
+ var dp:HTMLOptionsCollection;
+ var i:int;
+ var n:int;
+ var opt:HTMLOptionElement;
+ var dd:HTMLSelectElement = element as HTMLSelectElement;
+
+ model.dataProvider = value;
+ dp = dd.options;
+ n = dp.length;
+ for (i = 0; i < n; i++) {
+ dd.remove(0);
+ }
+
+ var lf:String = labelField;
+ n = value.length;
+ for (i = 0; i < n; i++) {
+ opt = document.createElement('option') as HTMLOptionElement;
+ if (lf)
+ opt.text = value[i][lf];
+ else
+ opt.text = value[i];
+ dd.add(opt, null);
+ }
+
+ }
+ }
+
+ [Bindable("change")]
+ /**
+ * @copy org.apache.flex.core.ISelectionModel#selectedIndex
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedIndex():int
+ {
+ return ISelectionModel(model).selectedIndex;
+ }
+
+ /**
+ * @private
+ * @flexjsignorecoercion HTMLSelectElement
+ */
+ public function set selectedIndex(value:int):void
+ {
+ ISelectionModel(model).selectedIndex = value;
+ COMPILE::JS
+ {
+ (element as HTMLSelectElement).selectedIndex = ISelectionModel(model).selectedIndex;
+ }
+ }
+
+
+ [Bindable("change")]
+ /**
+ * @copy org.apache.flex.core.ISelectionModel#selectedItem
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedItem():Object
+ {
+ return ISelectionModel(model).selectedItem;
+ }
+
+ /**
+ * @private
+ * @flexjsignorecoercion HTMLSelectElement
+ */
+ public function set selectedItem(value:Object):void
+ {
+ ISelectionModel(model).selectedItem = value;
+ COMPILE::JS
+ {
+ (element as HTMLSelectElement).selectedIndex = ISelectionModel(model).selectedIndex;
+ }
+ }
+
+ /**
+ * The name of field within the data used for display. Each item of the
+ * data should have a property with this name.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get labelField():String
+ {
+ return ISelectionModel(model).labelField;
+ }
+ public function set labelField(value:String):void
+ {
+ ISelectionModel(model).labelField = value;
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion HTMLSelectElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('select') as WrappedHTMLElement;
+ (element as HTMLSelectElement).size = 1;
+ goog.events.listen(element, 'change',
+ changeHandler);
+
+ positioner = element;
+ positioner.style.position = 'relative';
+
+ element.flexjs_wrapper = this;
+
+ return element;
+ }
+
+ /**
+ * @flexjsignorecoercion HTMLSelectElement
+ */
+ COMPILE::JS
+ protected function changeHandler(event:Event):void
+ {
+ model.selectedIndex = (element as HTMLSelectElement).selectedIndex;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Form.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Form.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Form.as
new file mode 100644
index 0000000..d7b0459
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Form.as
@@ -0,0 +1,99 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.ContainerBase;
+
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ [DefaultProperty("mxmlContent")]
+
+ /**
+ * The Form class is a simple form.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class Form extends ContainerBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Form()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {HTMLFormElement
+ element = document.createElement('form') as WrappedHTMLElement;
+
+ positioner = element;
+
+ positioner.style.position = 'relative';
+ element.flexjs_wrapper = this;
+ return element;
+ }
+
+
+ private var _action:String = "#";
+
+ [Bindable("actionChange")]
+ /**
+ * The action to be performed when the form is submitted
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get action():String
+ {
+ return _action;
+ }
+
+ /**
+ * @private
+ */
+ public function set action(value:String):void
+ {
+ _action = value;
+
+ COMPILE::JS
+ {
+ this.element.setAttribute('action', action);
+ this.dispatchEvent('actionChange');
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/HContainer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/HContainer.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/HContainer.as
new file mode 100644
index 0000000..9f38883
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/HContainer.as
@@ -0,0 +1,61 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.ContainerBase;
+ import org.apache.flex.core.IChrome;
+ import org.apache.flex.core.IContainer;
+ import org.apache.flex.core.IUIBase;
+ import org.apache.flex.events.Event;
+
+ [DefaultProperty("mxmlContent")]
+
+ /**
+ * A Container that has a HorizontalLayout.
+ *
+ * This is effectively the same as the pattern
+ * <code>
+ * <basic:Container xmlns:basic="library://ns.apache.org/flexjs/basic">
+ * <basic:layout>
+ * <basic:HorizontalLayout />
+ * </basic:layout>
+ * </basic:Container>
+ * </code>
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class HContainer extends Container implements IContainer
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function HContainer()
+ {
+ super();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/HRule.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/HRule.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/HRule.as
new file mode 100644
index 0000000..7c2fb2f
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/HRule.as
@@ -0,0 +1,63 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.UIBase;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The HRule class displays a horizontal line
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class HRule extends UIBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function HRule()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('hr') as WrappedHTMLElement;
+ positioner = element;
+ positioner.style.position = 'relative';
+ element.flexjs_wrapper = this;
+ return element;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Image.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Image.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Image.as
new file mode 100644
index 0000000..0a42d2a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Image.as
@@ -0,0 +1,93 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.IImageModel;
+ import org.apache.flex.core.UIBase;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ import org.apache.flex.html.beads.models.ImageModel;
+ import org.apache.flex.html.beads.ImageView;
+ }
+
+ /**
+ * The Image class is a component that displays a bitmap. The Image uses
+ * the following beads:
+ *
+ * org.apache.flex.core.IBeadModel: the data model for the Image, including the source property.
+ * org.apache.flex.core.IBeadView: constructs the visual elements of the component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class Image extends UIBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Image()
+ {
+ super();
+ }
+
+ /**
+ * The location of the bitmap, usually a URL.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.core.IImageModel
+ */
+ public function get source():String
+ {
+ return (model as IImageModel).source;
+ }
+ public function set source(value:String):void
+ {
+ (model as IImageModel).source = value;
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('img') as WrappedHTMLElement;
+ element.className = 'Image';
+ typeNames = 'Image';
+
+ positioner = element;
+ positioner.style.position = 'relative';
+ element.flexjs_wrapper = this;
+
+ return element;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ImageAndTextButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ImageAndTextButton.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ImageAndTextButton.as
new file mode 100644
index 0000000..8bdcc6a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ImageAndTextButton.as
@@ -0,0 +1,128 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.events.Event;
+ import org.apache.flex.html.beads.models.ImageAndTextModel;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The ImageTextButton class implements a basic button that
+ * displays and image and text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ImageAndTextButton extends TextButton
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ImageAndTextButton()
+ {
+ super();
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::JS
+ override public function get text():String
+ {
+ return ImageAndTextModel(model).text;
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::JS
+ override public function set text(value:String):void
+ {
+ ImageAndTextModel(model).text = value;
+ COMPILE::JS
+ {
+ setInnerHTML();
+ }
+ }
+
+ /**
+ * The URL of an icon to use in the button
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get image():String
+ {
+ return ImageAndTextModel(model).image;
+ }
+
+ /**
+ * @private
+ */
+ public function set image(value:String):void
+ {
+ ImageAndTextModel(model).image = value;
+ COMPILE::JS
+ {
+ setInnerHTML();
+ }
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('button') as WrappedHTMLElement;
+ element.setAttribute('type', 'button');
+
+ positioner = element;
+ positioner.style.position = 'relative';
+ element.flexjs_wrapper = this;
+
+ return element;
+ }
+
+ /**
+ */
+ COMPILE::JS
+ protected function setInnerHTML():void
+ {
+ var inner:String = '';
+ if (image != null)
+ inner += "<img src='" + image + "'/>";
+ inner += ' ';
+ inner += text;
+ element.innerHTML = inner;
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ImageButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ImageButton.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ImageButton.as
new file mode 100644
index 0000000..de563a1
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/ImageButton.as
@@ -0,0 +1,89 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.SimpleCSSStyles;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The ImageButton class presents an image as a button.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ImageButton extends Button
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ImageButton()
+ {
+ super();
+ typeNames = "ImageButton";
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement("input") as WrappedHTMLElement;
+ positioner = element;
+ element.flexjs_wrapper = this;
+
+ var inputElement:HTMLInputElement = element as HTMLInputElement;
+ inputElement.type = "image";
+
+ return element;
+ }
+
+ /**
+ * Sets the image for the button. This is a URL.
+ * TODO: figure out how to set the source in the style, rather than using
+ * backgroundImage behind the scenes.
+ */
+ public function get source():String
+ {
+ return style.backgroundImage;
+ }
+
+ public function set source(url:String):void
+ {
+ if (!style)
+ style = new SimpleCSSStyles();
+ style.backgroundImage = url;
+
+ COMPILE::JS {
+ var inputElement:HTMLInputElement = element as HTMLInputElement;
+ inputElement.src = url;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Label.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Label.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Label.as
new file mode 100644
index 0000000..21282f8
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/Label.as
@@ -0,0 +1,194 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.ITextModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /*
+ * Label probably should extend TextField directly,
+ * but the player's APIs for TextLine do not allow
+ * direct instantiation, and we might want to allow
+ * Labels to be declared and have their actual
+ * view be swapped out.
+ */
+
+ /**
+ * The Label class implements the basic control for labeling
+ * other controls.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class Label extends UIBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Label()
+ {
+ super();
+ }
+
+ [Bindable("textChange")]
+ /**
+ * The text to display in the label.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ COMPILE::SWF
+ {
+ return ITextModel(model).text;
+ }
+ COMPILE::JS
+ {
+ return element.innerHTML;
+ }
+ }
+
+ /**
+ * @private
+ */
+ public function set text(value:String):void
+ {
+ COMPILE::SWF
+ {
+ ITextModel(model).text = value;
+ }
+ COMPILE::JS
+ {
+ this.element.innerHTML = value;
+ this.dispatchEvent('textChange');
+ }
+
+ }
+
+ [Bindable("htmlChange")]
+ /**
+ * The html-formatted text to display in the label.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get html():String
+ {
+ COMPILE::SWF
+ {
+ return ITextModel(model).html;
+ }
+ COMPILE::JS
+ {
+ return element.innerHTML;
+ }
+ }
+
+ /**
+ * @private
+ */
+ public function set html(value:String):void
+ {
+ COMPILE::SWF
+ {
+ ITextModel(model).html = value;
+ }
+ COMPILE::JS
+ {
+ this.element.innerHTML = value;
+ this.dispatchEvent('textChange');
+ }
+ }
+ private var _selectable:Boolean;
+
+ public function get selectable():Boolean
+ {
+ return _selectable;
+ }
+ public function set selectable(value:Boolean):void
+ {
+ if(value != _selectable)
+ {
+ _selectable = value;
+ COMPILE::JS
+ {
+ if(element)
+ {
+ element.style.cursor = _selectable ? "auto" : "default";
+ element.style.pointerEvents = _selectable ? "auto" : "none";
+ }
+ }
+ }
+
+ }
+
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+ model.addEventListener("textChange", repeaterListener);
+ model.addEventListener("htmlChange", repeaterListener);
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ element = document.createElement('span') as WrappedHTMLElement;
+ positioner = element;
+ element.flexjs_wrapper = this;
+ element.style.whiteSpace = "nowrap";
+ if(!selectable)
+ {
+ element.style.cursor = "default";
+ element.style.pointerEvents = "none";
+ }
+
+ className = "Label";
+ typeNames = "Label";
+ return element;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d8221452/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/List.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/List.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/List.as
new file mode 100644
index 0000000..17c8b3f
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/List.as
@@ -0,0 +1,311 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+ import org.apache.flex.core.ContainerBaseStrandChildren;
+ import org.apache.flex.core.IContentViewHost;
+ import org.apache.flex.core.IDataProviderItemRendererMapper;
+ import org.apache.flex.core.IFactory;
+ import org.apache.flex.core.IItemRendererClassFactory;
+ import org.apache.flex.core.IItemRendererProvider;
+ import org.apache.flex.core.IListPresentationModel;
+ import org.apache.flex.core.IRollOverModel;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.ListBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ import org.apache.flex.html.beads.ListView;
+ import org.apache.flex.html.supportClasses.DataGroup;
+ }
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.beads.models.ListPresentationModel;
+
+ /**
+ * Indicates that the initialization of the list is complete.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="initComplete", type="org.apache.flex.events.Event")]
+
+ /**
+ * The change event is dispatched whenever the list's selection changes.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="change", type="org.apache.flex.events.Event")]
+
+ /**
+ * The List class is a component that displays multiple data items. The List uses
+ * the following bead types:
+ *
+ * org.apache.flex.core.IBeadModel: the data model, which includes the dataProvider, selectedItem, and
+ * so forth.
+ * org.apache.flex.core.IBeadView: the bead that constructs the visual parts of the list.
+ * org.apache.flex.core.IBeadController: the bead that handles input and output.
+ * org.apache.flex.core.IBeadLayout: the bead responsible for the size and position of the itemRenderers.
+ * org.apache.flex.core.IDataProviderItemRendererMapper: the bead responsible for creating the itemRenders.
+ * org.apache.flex.core.IItemRenderer: the class or factory used to display an item in the list.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class List extends ListBase implements IItemRendererProvider
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function List()
+ {
+ super();
+ }
+
+ /**
+ * The name of field within the data used for display. Each item of the
+ * data should have a property with this name.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get labelField():String
+ {
+ return ISelectionModel(model).labelField;
+ }
+ public function set labelField(value:String):void
+ {
+ ISelectionModel(model).labelField = value;
+ }
+
+ /**
+ * The data being display by the List.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dataProvider():Object
+ {
+ return ISelectionModel(model).dataProvider;
+ }
+ public function set dataProvider(value:Object):void
+ {
+ ISelectionModel(model).dataProvider = value;
+ }
+
+ /**
+ * The index of the currently selected item. Changing this value
+ * also changes the selectedItem property.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedIndex():int
+ {
+ return ISelectionModel(model).selectedIndex;
+ }
+ public function set selectedIndex(value:int):void
+ {
+ ISelectionModel(model).selectedIndex = value;
+ }
+
+ /**
+ * The index of the item currently below the pointer.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get rollOverIndex():int
+ {
+ return IRollOverModel(model).rollOverIndex;
+ }
+ public function set rollOverIndex(value:int):void
+ {
+ IRollOverModel(model).rollOverIndex = value;
+ }
+
+ /**
+ * The presentation model for the list.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get presentationModel():IListPresentationModel
+ {
+ var presModel:IListPresentationModel = getBeadByType(IListPresentationModel) as IListPresentationModel;
+ if (presModel == null) {
+ presModel = new ListPresentationModel();
+ addBead(presModel);
+ }
+ return presModel;
+ }
+
+ /**
+ * The default height of each cell in every column
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get rowHeight():Number
+ {
+ return presentationModel.rowHeight;
+ }
+ public function set rowHeight(value:Number):void
+ {
+ presentationModel.rowHeight = value;
+ }
+
+ /**
+ * The item currently selected. Changing this value also
+ * changes the selectedIndex property.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedItem():Object
+ {
+ return ISelectionModel(model).selectedItem;
+ }
+ public function set selectedItem(value:Object):void
+ {
+ ISelectionModel(model).selectedItem = value;
+ }
+
+ private var _itemRenderer:IFactory;
+
+ /**
+ * The class or factory used to display each item.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRenderer():IFactory
+ {
+ return _itemRenderer;
+ }
+ public function set itemRenderer(value:IFactory):void
+ {
+ _itemRenderer = value;
+ }
+
+ /**
+ * Returns whether or not the itemRenderer property has been set.
+ *
+ * @see org.apache.flex.core.IItemRendererProvider
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get hasItemRenderer():Boolean
+ {
+ var result:Boolean = false;
+
+ COMPILE::SWF {
+ result = _itemRenderer != null;
+ }
+
+ COMPILE::JS {
+ var test:* = _itemRenderer;
+ result = _itemRenderer !== null && test !== undefined;
+ }
+
+ return result;
+ }
+
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+
+ if (getBeadByType(IDataProviderItemRendererMapper) == null)
+ {
+ var mapper:IDataProviderItemRendererMapper = new (ValuesManager.valuesImpl.getValue(this, "iDataProviderItemRendererMapper")) as IDataProviderItemRendererMapper;
+ addBead(mapper);
+ }
+ var itemRendererFactory:IItemRendererClassFactory = getBeadByType(IItemRendererClassFactory) as IItemRendererClassFactory;
+ if (!itemRendererFactory)
+ {
+ itemRendererFactory = new (ValuesManager.valuesImpl.getValue(this, "iItemRendererClassFactory")) as IItemRendererClassFactory;
+ addBead(itemRendererFactory);
+ }
+
+ dispatchEvent(new Event("initComplete"));
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ super.createElement();
+ className = 'List';
+
+ return element;
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.html.beads.ListView
+ * @flexjsignorecoercion org.apache.flex.html.supportClasses.DataGroup
+ */
+ COMPILE::JS
+ override public function internalChildren():Array
+ {
+ var listView:ListView = getBeadByType(ListView) as ListView;
+ var dg:DataGroup = listView.dataGroup as DataGroup;
+ var renderers:Array = dg.internalChildren();
+ return renderers;
+ };
+ }
+}