Repository: flex-asjs Updated Branches: refs/heads/refactor-sprite c5a470bf8 -> 5e1506f81
BinaryImage 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/5e1506f8 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/5e1506f8 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/5e1506f8 Branch: refs/heads/refactor-sprite Commit: 5e1506f81de05d10727032b3fabbcf4ce3a2c309 Parents: c5a470b Author: Harbs <ha...@in-tools.com> Authored: Tue Aug 9 00:20:15 2016 +0300 Committer: Harbs <ha...@in-tools.com> Committed: Tue Aug 9 00:20:15 2016 +0300 ---------------------------------------------------------------------- .../projects/Core/src/main/flex/CoreClasses.as | 8 +- .../org/apache/flex/core/IBinaryImageModel.as | 48 ++++++++ .../flex/org/apache/flex/core/IImageModel.as | 12 -- .../projects/HTML/src/main/flex/HTMLClasses.as | 2 + .../flex/org/apache/flex/html/BinaryImage.as | 92 +++++++++++++++ .../src/main/flex/org/apache/flex/html/Image.as | 41 +++---- .../apache/flex/html/beads/BinaryImageView.as | 114 +++++++++++++++++++ .../org/apache/flex/html/beads/ImageView.as | 71 ++++++------ .../apache/flex/html/beads/SliderThumbView.as | 1 - .../apache/flex/html/beads/SliderTrackView.as | 1 - .../flex/html/beads/models/BinaryImageModel.as | 86 ++++++++++++++ .../apache/flex/html/beads/models/ImageModel.as | 31 +---- .../HTML/src/main/resources/defaults.css | 6 + 13 files changed, 402 insertions(+), 111 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5e1506f8/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 1e8622b..de7a945 100644 --- a/frameworks/projects/Core/src/main/flex/CoreClasses.as +++ b/frameworks/projects/Core/src/main/flex/CoreClasses.as @@ -57,6 +57,7 @@ internal class CoreClasses import org.apache.flex.core.IContentView; IContentView; import org.apache.flex.core.IContentViewHost; IContentViewHost; import org.apache.flex.core.IDataProviderItemRendererMapper; IDataProviderItemRendererMapper; + import org.apache.flex.core.IBinaryImageModel; IBinaryImageModel; import org.apache.flex.core.IDocument; IDocument; import org.apache.flex.core.IFormatBead; IFormatBead; import org.apache.flex.core.IImageModel; IImageModel; @@ -132,7 +133,7 @@ internal class CoreClasses import org.apache.flex.utils.PNGEncoder; PNGEncoder; import org.apache.flex.utils.SolidBorderUtil; SolidBorderUtil; import org.apache.flex.utils.HTMLLoader; HTMLLoader; -} + } import org.apache.flex.utils.BrowserUtils; BrowserUtils; import org.apache.flex.utils.Endian; Endian; import org.apache.flex.utils.StringPadder; StringPadder; @@ -141,7 +142,10 @@ internal class CoreClasses import org.apache.flex.utils.Timer; Timer; import org.apache.flex.utils.UIDUtil; UIDUtil; import org.apache.flex.utils.UIUtils; UIUtils; - import org.apache.flex.utils.URLUtils; URLUtils; + COMPILE::JS + { + import org.apache.flex.utils.URLUtils; URLUtils; + } import org.apache.flex.core.ClassFactory; ClassFactory; import org.apache.flex.states.AddItems; AddItems; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5e1506f8/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IBinaryImageModel.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IBinaryImageModel.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IBinaryImageModel.as new file mode 100644 index 0000000..52901a8 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IBinaryImageModel.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.core +{ + import org.apache.flex.events.IEventDispatcher; + import org.apache.flex.utils.BinaryData; + + /** + * The IImageModel interface describes the minimum set of properties + * available to an Image control. More sophisticated Image controls + * could have models that extend IImageModel. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public interface IBinaryImageModel extends IImageModel + { + /** + * The BinaryData of the image. + * This is used to set the image using binary content retrieved using HTTP requests or File APIs. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.7 + */ + function get binary():BinaryData; + function set binary(value:BinaryData):void; + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5e1506f8/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IImageModel.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IImageModel.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IImageModel.as index a810d71..730bf1a 100644 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IImageModel.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IImageModel.as @@ -45,17 +45,5 @@ package org.apache.flex.core */ function get url():String; function set url(value:String):void; - - /** - * The BinaryData of the image. - * This is used to set the image using binary content retrieved using HTTP requests or File APIs. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.7 - */ - function get binary():BinaryData; - function set binary(value:BinaryData):void; } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5e1506f8/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 51b5e48..fddb2ee 100644 --- a/frameworks/projects/HTML/src/main/flex/HTMLClasses.as +++ b/frameworks/projects/HTML/src/main/flex/HTMLClasses.as @@ -55,6 +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.BinaryImageView; BinaryImageView; } import org.apache.flex.html.beads.ImageButtonView; ImageButtonView; import org.apache.flex.html.beads.ListView; ListView; @@ -101,6 +102,7 @@ internal class HTMLClasses 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.BinaryImageModel; BinaryImageModel; import org.apache.flex.html.beads.models.PanelModel; PanelModel; COMPILE::SWF { http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5e1506f8/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/BinaryImage.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/BinaryImage.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/BinaryImage.as new file mode 100644 index 0000000..f98367e --- /dev/null +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/BinaryImage.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 +{ + import org.apache.flex.core.IImageModel; + import org.apache.flex.core.UIBase; + import org.apache.flex.utils.BinaryData; + COMPILE::JS + { + import org.apache.flex.core.WrappedHTMLElement; + import org.apache.flex.html.beads.models.BinaryImageView; + import org.apache.flex.html.beads.BinaryImageView; + } + + /** + * 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 + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function BinaryImage() + { + super(); + } + + /** + * 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 IImageModel).binary; + } + public function set binary(value:BinaryData):void + { + (model as IImageModel).binary = value; + } + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + */ + COMPILE::JS + override protected function createElement():WrappedHTMLElement + { + createElementInternal(); + + model = new BinaryImageModel(); + + addBead(new BinaryImageView()); + + return element; + } + + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5e1506f8/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Image.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Image.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Image.as index 07a9a27..724cbae 100644 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Image.as +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Image.as @@ -73,38 +73,13 @@ package org.apache.flex.html (model as IImageModel).url = value; } - /** - * 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 IImageModel).binary; - } - public function set binary(value:BinaryData):void - { - (model as IImageModel).binary = 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; - + createElementInternal(); model = new ImageModel(); @@ -112,7 +87,19 @@ package org.apache.flex.html ImageView()); return element; - } + } + + COMPILE::JS + protected function createElementInternal():void + { + element = document.createElement('img') as WrappedHTMLElement; + element.className = 'Image'; + typeNames = 'Image'; + + positioner = element; + positioner.style.position = 'relative'; + element.flexjs_wrapper = this; + } } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5e1506f8/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BinaryImageView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BinaryImageView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BinaryImageView.as new file mode 100644 index 0000000..9290b3f --- /dev/null +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/BinaryImageView.as @@ -0,0 +1,114 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF 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.utils.URLUtils; + } + + import org.apache.flex.core.BeadViewBase; + import org.apache.flex.core.IBeadView; + import org.apache.flex.core.IBinaryImageModel; + 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.utils.BinaryData; + + /** + * 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 BinaryImageView extends ImageView + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function BinaryImageView() + { + } + + private var _objectURL:String; + + /** + * @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; + _model.addEventListener("binaryChanged",handleBinaryChange); + + } + + /** + * @private + * @flexjsignorecoercion HTMLImageELement + * @flexjsignorecoercion BinaryImageModel + */ + private function handleBinaryChange(event:Event):void + { + var m:IBinaryImageModel = _model as IBinaryImageModel; + COMPILE::SWF + { + if (m.binary) { + setupLoader(); + loader.loadBytes(m.binary.array); + } + } + COMPILE::JS + { + if (m.binary) { + setupLoader(); + if(_objectURL) + URLUtils.revokeObjectURL(_objectURL); + var blob:Blob = new Blob([m.binary.array]); +// I don't think we need to specify the type. +// var blob = new Blob([response], {type: "image/png"}); + _objectURL = URLUtils.createObjectURL(blob); + (host.element as HTMLImageElement).src = _objectURL; + } + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5e1506f8/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/ImageView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/ImageView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/ImageView.as index 8533d02..7f093cb 100644 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/ImageView.as +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/ImageView.as @@ -65,12 +65,11 @@ package org.apache.flex.html.beads } COMPILE::SWF - private var bitmap:Bitmap; + protected var bitmap:Bitmap; COMPILE::SWF - private var loader:Loader; + protected var loader:Loader; - private var _model:IImageModel; - private var _objectURL:String; + protected var _model:IImageModel; /** * @copy org.apache.flex.core.IBead#strand @@ -90,9 +89,8 @@ package org.apache.flex.html.beads IEventDispatcher(_strand).addEventListener("heightChanged",handleSizeChange); } - _model = value.getBeadByType(IImageModel) as IImageModel; - _model.addEventListener("urlChanged",handleUrlChange); - + _model = value.getBeadByType(IImageModel) as IImageModel; + _model.addEventListener("urlChanged",handleUrlChange); handleUrlChange(null); } @@ -100,47 +98,44 @@ package org.apache.flex.html.beads * @private * @flexjsignorecoercion HTMLImageELement */ - private function handleUrlChange(event:Event):void + protected function handleUrlChange(event:Event):void { COMPILE::SWF { - if (_model.url || model.binary) { - loader = new Loader(); - loader.contentLoaderInfo.addEventListener("complete",onComplete); - loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (e:IOErrorEvent):void { - trace(e); - e.preventDefault(); - }); - if(model.url) - loader.load(new URLRequest(_model.url)); - else - loader.loadBytes(_model.binary.array); + if (_model.url) { + setupLoader(); + loader.load(new URLRequest(_model.url)); } } COMPILE::JS { - if (_model.url || model.binary) { - var host:IUIBase = _strand as IUIBase; - (host.element as HTMLImageElement).addEventListener('load', - loadHandler, false); - host.addEventListener('sizeChanged', - sizeChangedHandler); - var urlStr:String = _model.url; - - if(_model.binary) - { - if(_objectURL) - URLUtils.revokeObjectURL(_objectURL); - var blob:Blob = new Blob([_model.binary.array]); -// I don't think we need to specify the type. -// var blob = new Blob([response], {type: "image/png"}); - _objectURL = URLUtils.createObjectURL(blob); - urlStr = _objectURL - } - (host.element as HTMLImageElement).src = urlStr; + if (_model.url) { + setupLoader(); + (host.element as HTMLImageElement).src = _model.url; } } } + + COMPILE::SWF + protected function setupLoader():void + { + loader = new Loader(); + loader.contentLoaderInfo.addEventListener("complete",onComplete); + loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (e:IOErrorEvent):void { + trace(e); + e.preventDefault(); + }); + } + + COMPILE::JS + protected function setupLoader():void + { + var host:IUIBase = _strand as IUIBase; + (host.element as HTMLImageElement).addEventListener('load', + loadHandler, false); + host.addEventListener('sizeChanged', + sizeChangedHandler); + } /** * @private http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5e1506f8/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/SliderThumbView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/SliderThumbView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/SliderThumbView.as index fa5d235..caa7a3e 100644 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/SliderThumbView.as +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/SliderThumbView.as @@ -34,7 +34,6 @@ package org.apache.flex.html.beads import org.apache.flex.events.Event; import org.apache.flex.events.IEventDispatcher; import org.apache.flex.core.IChild; - import flash.display.SimpleButton; /** * The SliderThumbView class creates the draggable input element for the http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5e1506f8/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/SliderTrackView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/SliderTrackView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/SliderTrackView.as index e423896..294aa43 100644 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/SliderTrackView.as +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/SliderTrackView.as @@ -36,7 +36,6 @@ package org.apache.flex.html.beads import org.apache.flex.events.Event; import org.apache.flex.events.IEventDispatcher; import org.apache.flex.core.IChild; - import flash.display.SimpleButton; /** * The SliderTrackView class creates the track area for the org.apache.flex.html.Slider http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5e1506f8/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/models/BinaryImageModel.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/models/BinaryImageModel.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/models/BinaryImageModel.as new file mode 100644 index 0000000..1ec5372 --- /dev/null +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/models/BinaryImageModel.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.models +{ + import org.apache.flex.core.IBinaryImageModel; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.EventDispatcher; + import org.apache.flex.utils.BinaryData; + + /** + * 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 BinaryImageModel extends ImageModel implements IBinaryImageModel + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.7 + */ + public function BinaryImageModel() + { + super(); + } + + private var _binary:BinaryData; + + override public function set url(value:String):void + { + if (value && value != _url) + _binary = null; + + super.url = value; + } + + /** + * The BinaryData of the image. + * This is used to set the image using binary content retrieved using HTTP requests or File APIs. + * + * @copy org.apache.flex.core.IImageModel#binary + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get binary():BinaryData + { + return _binary; + } + public function set binary(value:BinaryData):void + { + if (value != _binary) { + _binary = value; + if(value) + _url = ""; + dispatchEvent( new Event("binaryChanged") ); + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5e1506f8/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/models/ImageModel.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/models/ImageModel.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/models/ImageModel.as index 91155d9..ac6b50c 100644 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/models/ImageModel.as +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/models/ImageModel.as @@ -63,7 +63,7 @@ package org.apache.flex.html.beads.models _strand = value; } - private var _url:String; + protected var _url:String; /** * The url of the image. @@ -83,35 +83,6 @@ package org.apache.flex.html.beads.models { if (value != _url) { _url = value; - if(value) - _binary = null; - dispatchEvent( new Event("urlChanged") ); - } - } - - private var _binary:BinaryData; - - /** - * The BinaryData of the image. - * This is used to set the image using binary content retrieved using HTTP requests or File APIs. - * - * @copy org.apache.flex.core.IImageModel#binary - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get binary():BinaryData - { - return _binary; - } - public function set binary(value:BinaryData):void - { - if (value != _binary) { - _binary = value; - if(value) - _url = ""; dispatchEvent( new Event("urlChanged") ); } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5e1506f8/frameworks/projects/HTML/src/main/resources/defaults.css ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/resources/defaults.css b/frameworks/projects/HTML/src/main/resources/defaults.css index d853623..bff10d8 100644 --- a/frameworks/projects/HTML/src/main/resources/defaults.css +++ b/frameworks/projects/HTML/src/main/resources/defaults.css @@ -494,6 +494,12 @@ Image IBeadView: ClassReference("org.apache.flex.html.beads.ImageView"); } +BinaryImage +{ + IBeadModel: ClassReference("org.apache.flex.html.beads.models.BinaryImageModel"); + IBeadView: ClassReference("org.apache.flex.html.beads.BinaryImageView"); +} + ImageButton { IBeadView: ClassReference("org.apache.flex.html.beads.ImageButtonView");