Repository: flex-asjs Updated Branches: refs/heads/feature/spriteflexjs-refactor 5a725328d -> 9f7908f98
Added StyleNotifier to Container component as part of its default set in Express package. Updated SingleLineBorderWithChangeListenerBead to handle border style expression (e.g., "solid 3px yellow"). Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/64c06150 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/64c06150 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/64c06150 Branch: refs/heads/feature/spriteflexjs-refactor Commit: 64c06150b385478e46dcac9170be8858e293a2df Parents: 36151f7 Author: Peter Ent <[email protected]> Authored: Tue Feb 21 14:05:55 2017 -0500 Committer: Peter Ent <[email protected]> Committed: Tue Feb 21 14:05:55 2017 -0500 ---------------------------------------------------------------------- .../flex/org/apache/flex/express/Container.as | 18 ++++++++++++++++++ .../Express/src/main/resources/defaults.css | 2 ++ .../SingleLineBorderWithChangeListenerBead.as | 20 ++++++++++++++++++-- 3 files changed, 38 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/64c06150/frameworks/projects/Express/src/main/flex/org/apache/flex/express/Container.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Express/src/main/flex/org/apache/flex/express/Container.as b/frameworks/projects/Express/src/main/flex/org/apache/flex/express/Container.as index 0ebd54a..27e2b08 100644 --- a/frameworks/projects/Express/src/main/flex/org/apache/flex/express/Container.as +++ b/frameworks/projects/Express/src/main/flex/org/apache/flex/express/Container.as @@ -22,6 +22,14 @@ package org.apache.flex.express import org.apache.flex.html.Container; import org.apache.flex.html.supportClasses.ScrollingViewport; + import org.apache.flex.core.BindableCSSStyles; + import org.apache.flex.core.StyleChangeNotifier; + + COMPILE::SWF { + import org.apache.flex.html.beads.SolidBackgroundWithChangeListenerBead; + import org.apache.flex.html.beads.SingleLineBorderWithChangeListenerBead; + } + /** * This class extends the standard Container and adds the * ContainerDataBinding bead and ScrollingViewport beads for @@ -33,8 +41,18 @@ package org.apache.flex.express { super(); + var wasStyle:Object = style; + + style = new BindableCSSStyles(); + addBead(new ContainerDataBinding()); addBead(new ScrollingViewport()); + addBead(new StyleChangeNotifier()); + + COMPILE::SWF { + addBead(new SolidBackgroundWithChangeListenerBead()); + addBead(new SingleLineBorderWithChangeListenerBead()); + } } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/64c06150/frameworks/projects/Express/src/main/resources/defaults.css ---------------------------------------------------------------------- diff --git a/frameworks/projects/Express/src/main/resources/defaults.css b/frameworks/projects/Express/src/main/resources/defaults.css index 7ad5c48..7046a0d 100644 --- a/frameworks/projects/Express/src/main/resources/defaults.css +++ b/frameworks/projects/Express/src/main/resources/defaults.css @@ -45,6 +45,8 @@ Container IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.BasicLayout"); IContentView: ClassReference("org.apache.flex.html.supportClasses.ContainerContentArea"); IViewportModel: ClassReference("org.apache.flex.html.beads.models.ViewportModel"); + + background-color: #FFFFFF; } TextInput http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/64c06150/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/SingleLineBorderWithChangeListenerBead.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/SingleLineBorderWithChangeListenerBead.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/SingleLineBorderWithChangeListenerBead.as index 12dad18..ae7440f 100644 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/SingleLineBorderWithChangeListenerBead.as +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/SingleLineBorderWithChangeListenerBead.as @@ -19,6 +19,8 @@ package org.apache.flex.html.beads { import org.apache.flex.core.IStrand; + import org.apache.flex.core.IStyleableObject; + import org.apache.flex.core.ValuesManager; import org.apache.flex.events.IEventDispatcher; import org.apache.flex.events.StyleChangeEvent; @@ -59,6 +61,7 @@ package org.apache.flex.html.beads override public function set strand(value:IStrand):void { super.strand = value; + _strand = value; IEventDispatcher(value).addEventListener(StyleChangeEvent.STYLE_CHANGE, handleStyleChange); } @@ -66,8 +69,21 @@ package org.apache.flex.html.beads * @private */ private function handleStyleChange(event:StyleChangeEvent):void - { - changeHandler(null); + { + // see if border style needs to be converted into an array + var borderStyles:Object = ValuesManager.valuesImpl.getValue(_strand, "border"); + if (borderStyles is String) { + // it may be just "solid" + var list:Array = String(borderStyles).split(" "); + if (list.length == 3) { + // set it on the strand's style (IValuesImpl does not have setStyle exposed). + var host:IStyleableObject = _strand as IStyleableObject; + // setting this will trigger this event listener again + host.style.border = list; + } + } else { + changeHandler(null); + } } } }
