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/09/12 10:35:19 UTC
[royale-asjs] branch develop updated: core-basic-Positioning: new
bead for position elements
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 1317a81 core-basic-Positioning: new bead for position elements
1317a81 is described below
commit 1317a81589c143da1cc2d7d4f398588c4c3a30e2
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sat Sep 12 12:35:10 2020 +0200
core-basic-Positioning: new bead for position elements
---
.../Basic/src/main/resources/basic-manifest.xml | 1 +
.../royale/html/beads/layouts/Positioning.as | 158 +++++++++++++++++++++
.../projects/Core/src/main/royale/CoreClasses.as | 2 +
.../org/apache/royale/html/beads/IPositioning.as | 77 ++++++++++
4 files changed, 238 insertions(+)
diff --git a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
index a4774fa..13ae0be 100644
--- a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
@@ -249,6 +249,7 @@
<component id="ScrollingFlexibleChild" class="org.apache.royale.html.beads.layouts.ScrollingFlexibleChild"/>
<component id="Paddings" class="org.apache.royale.html.beads.layouts.Paddings"/>
+ <component id="Positioning" class="org.apache.royale.html.beads.layouts.Positioning"/>
<component id="SubAppLoader" class="org.apache.royale.html.SubAppLoader" />
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/layouts/Positioning.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/layouts/Positioning.as
new file mode 100644
index 0000000..b632c2b
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/layouts/Positioning.as
@@ -0,0 +1,158 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.layouts
+{
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.core.IUIBase;
+ import org.apache.royale.html.beads.IPositioning;
+
+ /**
+ * The Positioning class is an IPositioning bead that adds
+ * positioning constraints to its host.
+ *
+ * How it behaves will depend on 'position' values for that element
+ * @see https://www.w3schools.com/css/css_positioning.asp to know more about it
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.8
+ */
+ public class Positioning implements IPositioning
+ {
+ 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.8
+ */
+ public function set strand(value:IStrand):void
+ {
+ host = value as IUIBase;
+
+ COMPILE::JS
+ {
+ host.positioner.style.top = _top + "px";
+ host.positioner.style.right = _right + "px";
+ host.positioner.style.bottom = _bottom + "px";
+ host.positioner.style.left = _left + "px";
+ }
+ }
+
+ /**
+ * @private
+ */
+ private var _top:Number;
+ /**
+ * The top position constraint value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.8
+ */
+ public function get top():Number
+ {
+ return _top;
+ }
+ /**
+ * @private
+ */
+ public function set top(value:Number):void
+ {
+ _top = value;
+ }
+
+ /**
+ * @private
+ */
+ private var _right:Number;
+ /**
+ * The right position constraint value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.8
+ */
+ public function get right():Number
+ {
+ return _right;
+ }
+ /**
+ * @private
+ */
+ public function set right(value:Number):void
+ {
+ _right = value;
+ }
+
+ /**
+ * @private
+ */
+ private var _bottom:Number;
+ /**
+ * The bottom position constraint value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.8
+ */
+ public function get bottom():Number
+ {
+ return _bottom;
+ }
+ /**
+ * @private
+ */
+ public function set bottom(value:Number):void
+ {
+ _bottom = value;
+ }
+
+ /**
+ * @private
+ */
+ private var _left:Number;
+
+ /**
+ * The left position constraint value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.8
+ */
+ public function get left():Number
+ {
+ return _left;
+ }
+ /**
+ * @private
+ */
+ public function set left(value:Number):void
+ {
+ _left = value;
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as b/frameworks/projects/Core/src/main/royale/CoreClasses.as
index 6f4358a..1af3007 100644
--- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
@@ -54,7 +54,9 @@ internal class CoreClasses
import org.apache.royale.html.beads.IBackgroundBead; IBackgroundBead;
import org.apache.royale.html.beads.IBorderBead; IBorderBead;
import org.apache.royale.html.beads.SelectableItemRendererBeadBase; SelectableItemRendererBeadBase;
+
import org.apache.royale.html.beads.IPaddings; IPaddings;
+ import org.apache.royale.html.beads.IPositioning; IPositioning;
import org.apache.royale.html.IListPresentationModel; org.apache.royale.html.IListPresentationModel;
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/html/beads/IPositioning.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/html/beads/IPositioning.as
new file mode 100644
index 0000000..04b3787
--- /dev/null
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/html/beads/IPositioning.as
@@ -0,0 +1,77 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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;
+
+ /**
+ * The IPositioning is a interface bead that adds padding to its host
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.8
+ */
+ public interface IPositioning extends IBead
+ {
+ /**
+ * The top position constraint value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.8
+ */
+ function get top():Number;
+ function set top(value:Number):void;
+
+ /**
+ * The right position constraint value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.8
+ */
+ function get right():Number;
+ function set right(value:Number):void;
+
+ /**
+ * The bottom position constraint value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.8
+ */
+ function get bottom():Number;
+ function set bottom(value:Number):void;
+
+ /**
+ * The left position constraint value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.8
+ */
+ function get left():Number;
+ function set left(value:Number):void;
+ }
+}