You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2020/07/12 11:03:34 UTC
[royale-asjs] branch develop updated: remove ErrorImageButton
(ErrorImage is valid for all image controls)
This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 50238c5 remove ErrorImageButton (ErrorImage is valid for all image controls)
50238c5 is described below
commit 50238c596bcb8299da23c5ca3bc52983af3c2355
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sun Jul 12 13:03:23 2020 +0200
remove ErrorImageButton (ErrorImage is valid for all image controls)
---
.../src/main/royale/ImagePlayGround.mxml | 4 +-
.../Basic/src/main/resources/basic-manifest.xml | 1 -
.../apache/royale/html/beads/ErrorImageButton.as | 180 ---------------------
3 files changed, 2 insertions(+), 183 deletions(-)
diff --git a/examples/jewel/TourDeJewel/src/main/royale/ImagePlayGround.mxml b/examples/jewel/TourDeJewel/src/main/royale/ImagePlayGround.mxml
index b59f927..2b327f1 100644
--- a/examples/jewel/TourDeJewel/src/main/royale/ImagePlayGround.mxml
+++ b/examples/jewel/TourDeJewel/src/main/royale/ImagePlayGround.mxml
@@ -74,7 +74,7 @@ limitations under the License.
<j:ImageButton localId="imageButtonWithErrorBead" src="assets/royale.png">
<j:beads>
- <js:ErrorImageButton emptyIsError="true"/>
+ <js:ErrorImage emptyIsError="true"/>
</j:beads>
</j:ImageButton>
</j:Card>
@@ -85,7 +85,7 @@ limitations under the License.
<js:ImageButton localId="imageButtonBasicErrorBead" src="assets/royale.png">
<js:beads>
- <js:ErrorImageButton emptyIsError="true"/>
+ <js:ErrorImage emptyIsError="true"/>
</js:beads>
</js:ImageButton>
</j:Card>
diff --git a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
index 717069d..497e843 100644
--- a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
@@ -296,7 +296,6 @@
<component id="UIGraphicsBase" class="org.apache.royale.display.UIGraphicsBase"/>
<component id="CollectionSelectedItemByField" class="org.apache.royale.html.beads.CollectionSelectedItemByField"/>
- <component id="ErrorImageButton" class="org.apache.royale.html.beads.ErrorImageButton"/>
<component id="ErrorImage" class="org.apache.royale.html.beads.ErrorImage"/>
</componentPackage>
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/ErrorImageButton.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/ErrorImageButton.as
deleted file mode 100644
index 18e596f..0000000
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/ErrorImageButton.as
+++ /dev/null
@@ -1,180 +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.royale.html.beads
-{
- import org.apache.royale.core.IBead;
- import org.apache.royale.core.IImageModel;
- import org.apache.royale.core.IRenderedObject;
- import org.apache.royale.core.IStrand;
- import org.apache.royale.events.Event;
- import org.apache.royale.events.EventDispatcher;
-
- /**
- * The ErrorImage class is a bead that can be used to
- * display an alternate image, in the event that the specified image
- * cannot be loaded.
- *
- * It will be supported by controls that load the ImageModel bead and
- * expose an imageElement property that references its img element.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion Royale 0.9.8
- */
- public class ErrorImageButton implements IBead
- {
- /**
- * constructor.
- *
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion Royale 0.9.8
- */
- public function ErrorImageButton() {
- }
-
- private var _src:String = "assets/no-image.svg";
- /**
- * The source of the image
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion Royale 0.9.8
- */
- public function get src():String {
- return _src;
- }
-
- public function set src(value:String):void {
- _src = value;
- }
-
- COMPILE::JS
- private var _hostElement:Element;
-
- COMPILE::JS
- protected function get hostElement():Element
- {
- return _hostElement;
- }
-
- protected function get hostModel():IImageModel
- {
- return _strand.getBeadByType(IImageModel) as IImageModel;
- }
-
- protected var _strand:IStrand;
- /**
- * @copy org.apache.royale.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion Royale 0.9.8
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
-
- COMPILE::JS {
-
- if(_strand is IRenderedObject)
- {
- try
- {
- _hostElement = Element((_strand as Object).imageElement) as Element;
- }
- catch (error:Error)
- {
- trace(error);
- }
- if(_hostElement){
-
- _hostElement.addEventListener('error', errorHandler);
-
- if(_emptyIsError)
- {
- (_strand as EventDispatcher).addEventListener("beadsAdded", beadsAddedHandler);
- }
- }
- }
- }
- }
-
- COMPILE::JS
- private function beadsAddedHandler(event:Event):void
- {
- (_strand as EventDispatcher).removeEventListener("beadsAdded", beadsAddedHandler);
-
- if(hostModel)
- hostModel.addEventListener("urlChanged",srcChangedHandler);
- srcChangedHandler(null);
- }
-
- private var _emptyIsError:Boolean = false;
- /**
- * Indicates whether the "empty or null" values will be treated as errors and replaced by the indicated src
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion Royale 0.9.8
- */
- public function get emptyIsError():Boolean {
- return _emptyIsError;
- }
- public function set emptyIsError(value:Boolean):void {
- _emptyIsError = value;
- }
-
- private function errorHandler(event:Event):void {
- COMPILE::JS
- {
- var imgEle:Object = hostElement as Object;
- if (imgEle.src != _src)
- {
- imgEle.src = _src;
- }
- }
- }
-
- private function srcChangedHandler(event:Event):void
- {
- if(hostModel && !hostModel.url){
-
- if(hostModel.hasEventListener("urlChanged")){
- hostModel.removeEventListener("urlChanged",srcChangedHandler);
- hostModel.url = src;
- hostModel.addEventListener("urlChanged",srcChangedHandler);
- }
- COMPILE::JS
- {
- (hostElement as Object).src = src;
- }
- }
-
- }
-
- }
-}
-