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 fd8481d jewel-padding: add padding bead to use with any jewel
component
fd8481d is described below
commit fd8481d4b7bb0e93d1baefda706da0083cfb1d98
Author: Carlos Rovira <[email protected]>
AuthorDate: Fri Feb 21 20:15:26 2020 +0100
jewel-padding: add padding bead to use with any jewel component
---
.../Jewel/src/main/resources/jewel-manifest.xml | 1 +
.../apache/royale/jewel/beads/layouts/Paddings.as | 190 +++++++++++++++++++++
2 files changed, 191 insertions(+)
diff --git a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
index 783b956..dba8835 100644
--- a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
+++ b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
@@ -202,6 +202,7 @@
<component id="GridCellLayout"
class="org.apache.royale.jewel.beads.layouts.GridCellLayout"/>
<component id="TableLayout"
class="org.apache.royale.jewel.beads.layouts.TableLayout"/>
<component id="ButtonBarLayout"
class="org.apache.royale.jewel.beads.layouts.ButtonBarLayout"/>
+ <component id="Paddings"
class="org.apache.royale.jewel.beads.layouts.Paddings"/>
<component id="StringItemRenderer"
class="org.apache.royale.jewel.itemRenderers.StringItemRenderer"/>
<component id="ListItemRenderer"
class="org.apache.royale.jewel.itemRenderers.ListItemRenderer"/>
diff --git
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/Paddings.as
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/Paddings.as
new file mode 100644
index 0000000..e8dfbd9
--- /dev/null
+++
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/Paddings.as
@@ -0,0 +1,190 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.jewel.beads.layouts
+{
+ import org.apache.royale.core.IBead;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.core.IUIBase;
+
+ /**
+ * The Paddings class is a bead that adds padding to its host
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public class Paddings implements IBead
+ {
+ protected var host:IUIBase;
+ /**
+ * @copy org.apache.royale.core.IStrand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public function set strand(value:IStrand):void
+ {
+ host = value as IUIBase;
+ if(_padding)
+ {
+ _paddingTop = _padding;
+ _paddingRight = _padding;
+ _paddingBottom = _padding;
+ _paddingLeft = _padding;
+
+ COMPILE::JS
+ {
+ host.positioner.style.padding = _padding + "px";
+ }
+ } else {
+ COMPILE::JS
+ {
+ host.positioner.style.paddingTop = _paddingTop
+ "px";
+ host.positioner.style.paddingRight =
_paddingRight + "px";
+ host.positioner.style.paddingBottom =
_paddingBottom + "px";
+ host.positioner.style.paddingLeft =
_paddingLeft + "px";
+ }
+ }
+ }
+
+ /**
+ * @private
+ */
+ private var _padding:Number;
+ /**
+ * The padding value. Setting this value override the rest of
values
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public function get padding():Number
+ {
+ return _padding;
+ }
+ /**
+ * @private
+ */
+ public function set padding(value:Number):void
+ {
+ _padding = value;
+ }
+
+ /**
+ * @private
+ */
+ private var _paddingTop:Number;
+ /**
+ * The top padding value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public function get paddingTop():Number
+ {
+ return _paddingTop;
+ }
+ /**
+ * @private
+ */
+ public function set paddingTop(value:Number):void
+ {
+ _paddingTop = value;
+ }
+
+ /**
+ * @private
+ */
+ private var _paddingRight:Number;
+ /**
+ * The right padding value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public function get paddingRight():Number
+ {
+ return _paddingRight;
+ }
+ /**
+ * @private
+ */
+ public function set paddingRight(value:Number):void
+ {
+ _paddingRight = value;
+ }
+
+ /**
+ * @private
+ */
+ private var _paddingBottom:Number;
+ /**
+ * The top padding value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public function get paddingBottom():Number
+ {
+ return _paddingBottom;
+ }
+ /**
+ * @private
+ */
+ public function set paddingBottom(value:Number):void
+ {
+ _paddingBottom = value;
+ }
+
+ /**
+ * @private
+ */
+ private var _paddingLeft:Number;
+
+ /**
+ * The left padding value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public function get paddingLeft():Number
+ {
+ return _paddingLeft;
+ }
+ /**
+ * @private
+ */
+ public function set paddingLeft(value:Number):void
+ {
+ _paddingLeft = value;
+ }
+ }
+}
\ No newline at end of file