You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/09/25 18:03:51 UTC
[09/50] git commit: [flex-asjs] [refs/heads/develop] - expose host
property in views
expose host property in views
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a63ef456
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a63ef456
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a63ef456
Branch: refs/heads/develop
Commit: a63ef456ad192b77849d54032e7484757251f33e
Parents: f55e862
Author: Alex Harui <ah...@apache.org>
Authored: Mon Sep 15 13:39:09 2014 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Sep 23 14:49:43 2014 -0700
----------------------------------------------------------------------
.../src/org/apache/flex/core/BeadViewBase.as | 15 +++++++
.../src/org/apache/flex/core/IBeadView.as | 10 +++++
.../org/apache/flex/html/beads/ContainerView.as | 41 +-------------------
.../DataItemRendererFactoryForArrayData.as | 2 +-
.../src/org/apache/flex/html/beads/IListView.as | 12 +-----
.../src/org/apache/flex/html/beads/ListView.as | 13 +++++--
.../org/apache/flex/html/beads/ScrollBarView.as | 14 +++++++
.../org/apache/flex/html/beads/TextAreaView.as | 14 +++----
.../apache/flex/html/beads/TextFieldViewBase.as | 5 ++-
.../org/apache/flex/html/beads/TextInputView.as | 16 ++++----
.../flex/html/beads/TextInputWithBorderView.as | 10 ++---
.../ListSingleSelectionMouseController.as | 4 +-
12 files changed, 77 insertions(+), 79 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a63ef456/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/BeadViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/BeadViewBase.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/BeadViewBase.as
index f2b941e..87de127 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/BeadViewBase.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/BeadViewBase.as
@@ -56,6 +56,8 @@ package org.apache.flex.core
protected var _strand:IStrand;
/**
+ * Get the strand for this bead
+ *
* Override this for whatever else you need to do when
* being hooked to the Strand
*
@@ -70,6 +72,19 @@ package org.apache.flex.core
{
_strand = value;
}
+
+ /**
+ * 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.IBeadView#viewHeight
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a63ef456/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IBeadView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IBeadView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IBeadView.as
index 9f49c9c..1934134 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IBeadView.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IBeadView.as
@@ -34,6 +34,16 @@ package org.apache.flex.core
public interface IBeadView extends IBead
{
/**
+ * The host component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get host():IUIBase
+
+ /**
* The width of the view.
*
* @langversion 3.0
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a63ef456/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ContainerView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ContainerView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ContainerView.as
index 78dd64d..755dd63 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ContainerView.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ContainerView.as
@@ -197,19 +197,6 @@ package org.apache.flex.html.beads
}
/**
- * The border.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get border():Border
- {
- return null;
- }
-
- /**
* The host component, which can resize to different slots.
*
* @langversion 3.0
@@ -221,32 +208,6 @@ package org.apache.flex.html.beads
{
return _strand as DisplayObject;
}
-
- /**
- * The vertical ScrollBar, if it exists.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get vScrollBar():ScrollBar
- {
- return null;
- }
-
- /**
- * The horizontal ScrollBar, if it exists.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get hScrollBar():ScrollBar
- {
- return null;
- }
-
+
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a63ef456/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as
index 0472e4a..b91328b 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/DataItemRendererFactoryForArrayData.as
@@ -78,7 +78,7 @@ package org.apache.flex.html.beads
dataGroup = listView.dataGroup;
selectionModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
- labelField = (listView.strand as List).labelField;
+ labelField = (listView.host as List).labelField;
if (!itemRendererFactory)
{
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a63ef456/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IListView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IListView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IListView.as
index 5046399..f9159ce 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IListView.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/IListView.as
@@ -18,6 +18,7 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.flex.html.beads
{
+ import org.apache.flex.core.IBeadView;
import org.apache.flex.core.IItemRendererParent;
import org.apache.flex.core.IStrand;
@@ -30,7 +31,7 @@ package org.apache.flex.html.beads
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public interface IListView
+ public interface IListView extends IBeadView
{
/**
* The component which parents all of the itemRenderers for each
@@ -43,14 +44,5 @@ package org.apache.flex.html.beads
*/
function get dataGroup():IItemRendererParent;
- /**
- * The host component.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- function get strand():IStrand;
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a63ef456/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ListView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ListView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ListView.as
index 0b21db8..0b98577 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ListView.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ListView.as
@@ -33,6 +33,7 @@ package org.apache.flex.html.beads
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;
@@ -148,6 +149,14 @@ package org.apache.flex.html.beads
return _strand as DisplayObject;
}
+ /**
+ * @private
+ */
+ public function get host():IUIBase
+ {
+ return _strand as IUIBase;
+ }
+
private var _strand:IStrand;
/**
@@ -158,10 +167,6 @@ package org.apache.flex.html.beads
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public function get strand():IStrand
- {
- return _strand;
- }
public function set strand(value:IStrand):void
{
_strand = value;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a63ef456/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ScrollBarView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ScrollBarView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ScrollBarView.as
index 00ad495..67979bd 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ScrollBarView.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ScrollBarView.as
@@ -24,6 +24,7 @@ package org.apache.flex.html.beads
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;
@@ -61,6 +62,19 @@ package org.apache.flex.html.beads
private var _strand:IStrand;
/**
+ * 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
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a63ef456/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextAreaView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextAreaView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextAreaView.as
index 3bb10fd..d73aaf7 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextAreaView.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextAreaView.as
@@ -108,22 +108,22 @@ package org.apache.flex.html.beads
_border = new Border();
_border.model = new (ValuesManager.valuesImpl.getValue(value, "iBorderModel")) as IBeadModel;
_border.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBorderBead")) as IBead);
- IParent(strand).addElement(border);
+ IParent(host).addElement(border);
var vb:ScrollBar = vScrollBar;
// Default size
- var ww:Number = DisplayObject(strand).width;
- if( isNaN(ww) || ww == 0 ) DisplayObject(strand).width = 100;
- var hh:Number = DisplayObject(strand).height;
- if( isNaN(hh) || hh == 0 ) DisplayObject(strand).height = 42;
+ 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(strand).addEventListener("widthChanged", sizeChangedHandler);
- IEventDispatcher(strand).addEventListener("heightChanged", sizeChangedHandler);
+ IEventDispatcher(host).addEventListener("widthChanged", sizeChangedHandler);
+ IEventDispatcher(host).addEventListener("heightChanged", sizeChangedHandler);
sizeChangedHandler(null);
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a63ef456/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextFieldViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextFieldViewBase.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextFieldViewBase.as
index 7653095..ac4fcd3 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextFieldViewBase.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextFieldViewBase.as
@@ -25,6 +25,7 @@ package org.apache.flex.html.beads
import org.apache.flex.core.IBeadView;
import org.apache.flex.core.IStrand;
import org.apache.flex.core.ITextModel;
+ import org.apache.flex.core.IUIBase;
import org.apache.flex.core.ValuesManager;
import org.apache.flex.events.Event;
import org.apache.flex.events.IEventDispatcher;
@@ -101,9 +102,9 @@ package org.apache.flex.html.beads
/**
* @private
*/
- public function get strand() : IStrand
+ public function get host() : IUIBase
{
- return _strand;
+ return _strand as IUIBase;
}
/**
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a63ef456/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextInputView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextInputView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextInputView.as
index c5b39c6..dcbce38 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextInputView.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextInputView.as
@@ -66,22 +66,22 @@ package org.apache.flex.html.beads
super.strand = value;
// Default size
- var ww:Number = DisplayObject(strand).width;
- if( isNaN(ww) || ww == 0 ) DisplayObject(strand).width = 100;
- var hh:Number = DisplayObject(strand).height;
- if( isNaN(hh) || hh == 0 ) DisplayObject(strand).height = 18;
+ 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 = 18;
- IEventDispatcher(strand).addEventListener("widthChanged", sizeChangedHandler);
- IEventDispatcher(strand).addEventListener("heightChanged", sizeChangedHandler);
+ IEventDispatcher(host).addEventListener("widthChanged", sizeChangedHandler);
+ IEventDispatcher(host).addEventListener("heightChanged", sizeChangedHandler);
sizeChangedHandler(null);
}
private function sizeChangedHandler(event:Event):void
{
- var ww:Number = DisplayObject(strand).width;
+ var ww:Number = DisplayObject(host).width;
if( !isNaN(ww) && ww > 0 ) textField.width = ww;
- var hh:Number = DisplayObject(strand).height;
+ var hh:Number = DisplayObject(host).height;
if( !isNaN(hh) && hh > 0 ) textField.height = hh;
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a63ef456/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextInputWithBorderView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextInputWithBorderView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextInputWithBorderView.as
index d205086..9ca0aed 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextInputWithBorderView.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/TextInputWithBorderView.as
@@ -60,19 +60,19 @@ package org.apache.flex.html.beads
_border = new Border();
_border.model = new (ValuesManager.valuesImpl.getValue(value, "iBorderModel")) as IBeadModel;
_border.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBorderBead")) as IBead);
- IParent(strand).addElement(_border);
+ IParent(host).addElement(_border);
- IEventDispatcher(strand).addEventListener("widthChanged", sizeChangedHandler);
- IEventDispatcher(strand).addEventListener("heightChanged", sizeChangedHandler);
+ IEventDispatcher(host).addEventListener("widthChanged", sizeChangedHandler);
+ IEventDispatcher(host).addEventListener("heightChanged", sizeChangedHandler);
sizeChangedHandler(null);
}
private function sizeChangedHandler(event:Event):void
{
- var ww:Number = DisplayObject(strand).width;
+ var ww:Number = DisplayObject(host).width;
_border.width = ww;
- var hh:Number = DisplayObject(strand).height;
+ var hh:Number = DisplayObject(host).height;
_border.height = hh;
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a63ef456/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as
index 07f769a..79e6352 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/controllers/ListSingleSelectionMouseController.as
@@ -111,13 +111,13 @@ package org.apache.flex.html.beads.controllers
private function selectedHandler(event:Event):void
{
listModel.selectedIndex = ISelectableItemRenderer(event.target).index;
- IEventDispatcher(listView.strand).dispatchEvent(new Event("change"));
+ listView.host.dispatchEvent(new Event("change"));
}
private function rolloverHandler(event:Event):void
{
IRollOverModel(listModel).rollOverIndex = ISelectableItemRenderer(event.target).index;
- IEventDispatcher(listView.strand).dispatchEvent(new Event("rollover"));
+ listView.host.dispatchEvent(new Event("rollover"));
}
}