From commits-return-1889-archive-asf-public=cust-asf.ponee.io@royale.apache.org Fri Feb 2 23:09:09 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id E48811807A3 for ; Fri, 2 Feb 2018 23:09:08 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id D4B8E160C57; Fri, 2 Feb 2018 22:09:08 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A301D160C60 for ; Fri, 2 Feb 2018 23:09:07 +0100 (CET) Received: (qmail 68580 invoked by uid 500); 2 Feb 2018 22:09:06 -0000 Mailing-List: contact commits-help@royale.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@royale.apache.org Delivered-To: mailing list commits@royale.apache.org Received: (qmail 68489 invoked by uid 99); 2 Feb 2018 22:09:06 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Feb 2018 22:09:06 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 32FBC85A02; Fri, 2 Feb 2018 22:09:03 +0000 (UTC) Date: Fri, 02 Feb 2018 22:09:13 +0000 To: "commits@royale.apache.org" Subject: [royale-asjs] 10/14: AlternatingBackgroundColor renderer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: aharui@apache.org In-Reply-To: <151760934305.21911.13143084515053479058@gitbox.apache.org> References: <151760934305.21911.13143084515053479058@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: royale-asjs X-Git-Refname: refs/heads/feature/royalesite X-Git-Reftype: branch X-Git-Rev: 41eb80478d3ca7755915386a0331c3d446d17cc5 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20180202220904.32FBC85A02@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. aharui pushed a commit to branch feature/royalesite in repository https://gitbox.apache.org/repos/asf/royale-asjs.git commit 41eb80478d3ca7755915386a0331c3d446d17cc5 Author: Alex Harui AuthorDate: Fri Feb 2 11:24:25 2018 -0800 AlternatingBackgroundColor renderer --- .../ASDoc/src/main/royale/ASDocMainView.mxml | 8 +- .../Basic/src/main/resources/basic-manifest.xml | 1 + ...AlternatingBackgroundColorStringItemRenderer.as | 96 ++++++++++++++++++++++ 3 files changed, 104 insertions(+), 1 deletion(-) diff --git a/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml b/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml index efbc016..19f92dc 100644 --- a/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml +++ b/examples/royale/ASDoc/src/main/royale/ASDocMainView.mxml @@ -90,6 +90,11 @@ limitations under the License. } + + + + + @@ -130,7 +135,8 @@ limitations under the License. - + diff --git a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml index ad0ac29..4da5734 100644 --- a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml +++ b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml @@ -93,6 +93,7 @@ + diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/AlternatingBackgroundColorStringItemRenderer.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/AlternatingBackgroundColorStringItemRenderer.as new file mode 100644 index 0000000..a9e3a80 --- /dev/null +++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/AlternatingBackgroundColorStringItemRenderer.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.royale.html.supportClasses +{ + + /** + * The AlternatingBackgroundColorStringItemRenderer class displays data in string form using the data's toString() + * function and alternates between two background colors. This is the most simple implementation for immutable lists + * and will not handle adding/removing renderers. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.0 + */ + public class AlternatingBackgroundColorStringItemRenderer extends StringItemRenderer + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.0 + */ + public function AlternatingBackgroundColorStringItemRenderer() + { + } + + private var _color0:String; + + public function get backgroundColor0():String + { + return _color0; + } + public function set backgroundColor0(value:String):void + { + _color0 = value; + } + + private var _color1:String; + + public function get backgroundColor1():String + { + return _color1; + } + public function set backgroundColor1(value:String):void + { + _color1 = value; + } + + private var oddIndex:Boolean; + + override public function addedToParent():void + { + super.addedToParent(); + + var index:int = parent.getElementIndex(this); + oddIndex = ((index % 2) == 1) + COMPILE::JS + { + element.style.backgroundColor = oddIndex ? _color1 : _color0; + } + } + + /** + * @private + */ + override public function updateRenderer():void + { + super.updateRenderer(); + COMPILE::JS + { + if (element.style.backgroundColor == null || element.style.backgroundColor == "") + element.style.backgroundColor = oddIndex ? _color1 : _color0; + } + } + + } +} -- To stop receiving notification emails like this one, please contact aharui@apache.org.