This is an automated email from the ASF dual-hosted git repository.

harbs 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 d003330  Added Progress closes #346
d003330 is described below

commit d0033300a3dcf58596542b18cf160e2401967594
Author: Harbs <[email protected]>
AuthorDate: Thu Nov 15 17:38:42 2018 +0200

    Added Progress closes #346
---
 .../HTML/src/main/resources/html-manifest.xml      |   1 +
 .../org/apache/royale/html/elements/Progress.as    | 191 +++++++++++++++++++++
 2 files changed, 192 insertions(+)

diff --git a/frameworks/projects/HTML/src/main/resources/html-manifest.xml 
b/frameworks/projects/HTML/src/main/resources/html-manifest.xml
index bf94912..60cb24a 100644
--- a/frameworks/projects/HTML/src/main/resources/html-manifest.xml
+++ b/frameworks/projects/HTML/src/main/resources/html-manifest.xml
@@ -47,6 +47,7 @@
     <component id="Option" class="org.apache.royale.html.elements.Option"/>
     <component id="P" class="org.apache.royale.html.elements.P" />
     <component id="Pre" class="org.apache.royale.html.elements.Pre" />
+    <component id="Progress" class="org.apache.royale.html.elements.Progress" 
/>
     <component id="S" class="org.apache.royale.html.elements.S" />
     <component id="Select" class="org.apache.royale.html.elements.Select"/>
     <component id="Small" class="org.apache.royale.html.elements.Small"/>
diff --git 
a/frameworks/projects/HTML/src/main/royale/org/apache/royale/html/elements/Progress.as
 
b/frameworks/projects/HTML/src/main/royale/org/apache/royale/html/elements/Progress.as
new file mode 100644
index 0000000..d122d85
--- /dev/null
+++ 
b/frameworks/projects/HTML/src/main/royale/org/apache/royale/html/elements/Progress.as
@@ -0,0 +1,191 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//     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.elements
+{
+       import org.apache.royale.core.UIBase;
+
+               COMPILE::JS
+               {
+                               import 
org.apache.royale.core.WrappedHTMLElement;
+               import org.apache.royale.html.util.addElementToWrapper;
+               }
+               import org.apache.royale.html.NodeElementBase;
+
+       /**
+        *      The Progress class represents an HTML <progress> element
+                *      
+        *      
+                *      @toplevel
+        *      @langversion 3.0
+        *      @playerversion Flash 10.2
+        *      @playerversion AIR 2.6
+        *      @productversion Royale 0.9.5
+        */
+       public class Progress extends NodeElementBase
+       {
+               /**
+                *      constructor.
+                *
+                *      @langversion 3.0
+                *      @playerversion Flash 10.2
+                *      @playerversion AIR 2.6
+                *      @productversion Royale 0.9.5
+                */
+               public function Progress()
+               {
+                       super();
+               }
+
+               /**
+                * @royaleignorecoercion HTMLProgressElement
+                */
+               COMPILE::JS
+               private function get progress():HTMLProgressElement
+               {
+                       return element as HTMLProgressElement;
+               }
+
+               COMPILE::SWF
+               private var _value:Number;
+
+               /**
+                *      A Number value that reflects the current value;
+                *      if the progress bar is an indeterminate progress bar, 
it returns 0.
+                *      
+                *      @langversion 3.0
+                *      @playerversion Flash 10.2
+                *      @playerversion AIR 2.6
+                *      @productversion Royale 0.9.5
+                */
+               public function get value():Number
+               {
+                       COMPILE::SWF
+                       {
+                               return _value;
+                       }
+                       COMPILE::JS
+                       {
+                               return progress.value;
+                       }
+               }
+
+
+               public function set value(value:Number):void
+               {
+                       COMPILE::SWF
+                       {
+                               _value = value;
+                       }
+                       COMPILE::JS
+                       {
+                               progress.value = value;
+                       }
+               }
+
+               COMPILE::SWF
+               private var _max:Number;
+
+               /**
+                *      A Number value reflecting the content attribute of the 
same name,
+                *  limited to numbers greater than zero. Its default value is 
1.0.
+                *      
+                *      @langversion 3.0
+                *      @playerversion Flash 10.2
+                *      @playerversion AIR 2.6
+                *      @productversion Royale 0.9.5
+                */
+               public function get max():Number
+               {
+                       COMPILE::SWF
+                       {
+                               if(isNaN(_max))
+                                       return 1;
+                               return _max;
+                       }
+                       COMPILE::JS
+                       {
+                               return progress.max;
+                       }
+               }
+
+               public function set max(value:Number):void
+               {
+                       COMPILE::SWF
+                       {
+                               _max = value;
+                       }
+                       COMPILE::JS
+                       {
+                               progress.max = value;
+                       }
+               }
+
+               /**
+                *      Returns a Number value returning the result of dividing 
the
+                *  current value (value) by the maximum value (max).
+                *  If the progress bar is an indeterminate progress bar, it 
returns -1.
+                *      
+                *      @langversion 3.0
+                *      @playerversion Flash 10.2
+                *      @playerversion AIR 2.6
+                *      @productversion Royale 0.9.5
+                */
+               public function get position():Number
+               {
+                       COMPILE::SWF
+                       {
+                               if(determinate)
+                                       return value / max;
+                               
+                               return -1;
+                       }
+                       COMPILE::JS
+                       {
+                               return progress.position;
+                       }
+               }
+
+               /**
+                *      Whether the progress bar is determinate (true) or 
indeterminate (false)
+                *      
+                *      @langversion 3.0
+                *      @playerversion Flash 10.2
+                *      @playerversion AIR 2.6
+                *      @productversion Royale 0.9.5
+                */
+               public function get determinate():Boolean
+               {
+                       COMPILE::SWF
+                       {
+                               return !isNaN(_value);
+                       }
+
+                       COMPILE::JS
+                       {
+                               return progress.hasAttribute("value");
+                       }
+               }
+
+               COMPILE::JS
+               override protected function createElement():WrappedHTMLElement
+               {
+                       return addElementToWrapper(this,'progress');
+               }
+       }
+}

Reply via email to