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 afd7c42 jewel cell and fixes to grid afd7c42 is described below commit afd7c42b49976329e2bb3e2ba6ae55cfcb3e1a72 Author: Carlos Rovira <carlosrov...@apache.org> AuthorDate: Sun Jun 10 11:39:41 2018 +0200 jewel cell and fixes to grid --- .../Jewel/src/main/resources/jewel-manifest.xml | 1 + .../org/apache/royale/jewel/{Grid.as => Cell.as} | 47 +++------------------- .../main/royale/org/apache/royale/jewel/Grid.as | 15 +------ .../royale/jewel/beads/layouts/GridLayout.as | 23 ++++++----- 4 files changed, 20 insertions(+), 66 deletions(-) diff --git a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml index ffc7333..ec87ec1 100644 --- a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml +++ b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml @@ -28,6 +28,7 @@ <component id="VGroup" class="org.apache.royale.jewel.VGroup"/> <component id="Container" class="org.apache.royale.jewel.Container"/> <component id="Grid" class="org.apache.royale.jewel.Grid"/> + <component id="Cell" class="org.apache.royale.jewel.Cell"/> <component id="Button" class="org.apache.royale.jewel.Button"/> <component id="Label" class="org.apache.royale.jewel.Label"/> diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Grid.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Cell.as similarity index 57% copy from frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Grid.as copy to frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Cell.as index a43a936..f7010aa 100644 --- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Grid.as +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Cell.as @@ -23,16 +23,15 @@ package org.apache.royale.jewel import org.apache.royale.jewel.beads.layouts.GridLayout; /** - * The Grid class is a container that uses Grid Layout. - * Grid Layout need other inmediate children to work as cells - * to host cell content. + * The Cell class is the inmediate container in a Grid Layout + * to host grid cell content. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.9.3 */ - public class Grid extends Group + public class Cell extends Group { /** * constructor. @@ -42,47 +41,11 @@ package org.apache.royale.jewel * @playerversion AIR 2.6 * @productversion Royale 0.9.3 */ - public function Grid() + public function Cell() { super(); - typeNames = "jewel"; - - layout = new GridLayout(); - addBead(layout); + typeNames = "jewel cell"; } - - protected var layout:GridLayout; - - protected var _gap:Number = 0; - /** - * Assigns variable gap to grid from 1 to 20 - * Activate "gap-Xdp" effect selector to set a numeric gap - * between grid cells - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9.3 - */ - public function get gap():Number - { - return _gap; - } - - public function set gap(value:Number):void - { - if (_gap != value) - { - COMPILE::JS - { - if (value > 0 && value < 20) - { - layout.gap = value; - } else - throw new Error("Grid gap needs to be between 0 and 20"); - } - } - } } } \ No newline at end of file diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Grid.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Grid.as index a43a936..308fd4b 100644 --- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Grid.as +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Grid.as @@ -54,7 +54,6 @@ package org.apache.royale.jewel protected var layout:GridLayout; - protected var _gap:Number = 0; /** * Assigns variable gap to grid from 1 to 20 * Activate "gap-Xdp" effect selector to set a numeric gap @@ -67,22 +66,12 @@ package org.apache.royale.jewel */ public function get gap():Number { - return _gap; + return layout.gap; } public function set gap(value:Number):void { - if (_gap != value) - { - COMPILE::JS - { - if (value > 0 && value < 20) - { - layout.gap = value; - } else - throw new Error("Grid gap needs to be between 0 and 20"); - } - } + layout.gap = value; } } } \ No newline at end of file diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/GridLayout.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/GridLayout.as index c913d52..848f15f 100644 --- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/GridLayout.as +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/GridLayout.as @@ -109,22 +109,23 @@ package org.apache.royale.jewel.beads.layouts { if(hostComponent) setGap(value); - else - _gap = value; + + _gap = value; } } } COMPILE::JS - public function setGap(value:Number):void - {//if(hostComponent.className.indexOf("gap") == -1 && - // if(gap) - // hostComponent.className += " gap-1dp"; - // else - // hostComponent.className = StringUtil.removeWord(hostComponent.className, " gap-1dp"); - hostComponent.positioner.classList.remove("gap-" + _gap + "dp"); - hostComponent.positioner.classList.add("gap-" + value + "dp"); - _gap = value; + private function setGap(value:Number):void + { + if (value >= 0 && value <= 20) + { + hostComponent.className = StringUtil.removeWord(hostComponent.className, " gap-" + _gap + "dp"); + hostComponent.className += " gap-" + value + "dp"; + // hostComponent.positioner.classList.remove("gap-" + _gap + "dp"); + // hostComponent.positioner.classList.add("gap-" + value + "dp"); + } else + throw new Error("Grid gap needs to be between 0 and 20"); } /** -- To stop receiving notification emails like this one, please contact carlosrov...@apache.org.