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/03/19 14:49:51 UTC
[royale-asjs] branch develop updated: jewel-container: add
VContainer and HContainer
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 d3a3636 jewel-container: add VContainer and HContainer
d3a3636 is described below
commit d3a36365e46e305b283ebf79dc0315142d9372f5
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Thu Mar 19 15:49:46 2020 +0100
jewel-container: add VContainer and HContainer
---
.../projects/Jewel/src/main/resources/defaults.css | 8 ++
.../Jewel/src/main/resources/jewel-manifest.xml | 2 +
.../royale/org/apache/royale/jewel/Container.as | 2 +-
.../royale/org/apache/royale/jewel/HContainer.as | 93 ++++++++++++++++
.../royale/org/apache/royale/jewel/VContainer.as | 119 +++++++++++++++++++++
.../projects/Jewel/src/main/sass/_global.sass | 6 ++
6 files changed, 229 insertions(+), 1 deletion(-)
diff --git a/frameworks/projects/Jewel/src/main/resources/defaults.css b/frameworks/projects/Jewel/src/main/resources/defaults.css
index 14dfa1b..1ba9718 100644
--- a/frameworks/projects/Jewel/src/main/resources/defaults.css
+++ b/frameworks/projects/Jewel/src/main/resources/defaults.css
@@ -106,6 +106,14 @@ j|Container {
IViewportModel: ClassReference("org.apache.royale.html.beads.models.ViewportModel");
}
+j|HContainer {
+ IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.HorizontalLayout");
+}
+
+j|VContainer {
+ IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.VerticalLayout");
+}
+
j|Image {
IBeadModel: ClassReference("org.apache.royale.jewel.beads.models.ImageModel");
IBeadView: ClassReference("org.apache.royale.jewel.beads.views.ImageView");
diff --git a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
index 7368f4f..86c91d3 100644
--- a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
+++ b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
@@ -29,6 +29,8 @@
<component id="HGroup" class="org.apache.royale.jewel.HGroup"/>
<component id="VGroup" class="org.apache.royale.jewel.VGroup"/>
<component id="Container" class="org.apache.royale.jewel.Container"/>
+ <component id="HContainer" class="org.apache.royale.jewel.HContainer"/>
+ <component id="VContainer" class="org.apache.royale.jewel.VContainer"/>
<component id="Grid" class="org.apache.royale.jewel.Grid"/>
<component id="ScrollableGrid" class="org.apache.royale.jewel.ScrollableGrid"/>
<component id="GridCell" class="org.apache.royale.jewel.GridCell"/>
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Container.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Container.as
index a1a305d..ac06938 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Container.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Container.as
@@ -82,7 +82,7 @@ package org.apache.royale.jewel
public function Container()
{
super();
- typeNames = "";
+ typeNames = "jewel container";
}
protected var _layout:StyledLayoutBase;
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/HContainer.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/HContainer.as
new file mode 100644
index 0000000..0abdad2
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/HContainer.as
@@ -0,0 +1,93 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+{
+ import org.apache.royale.jewel.beads.layouts.HorizontalLayout;
+ import org.apache.royale.utils.StringUtil;
+
+ /**
+ * This Container subclass uses HorizontalLayout as its default layout.
+ *
+ * @toplevel
+ * @see org.apache.royale.jewel.beads.layouts
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public class HContainer extends Group
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public function HContainer()
+ {
+ super();
+
+ typeNames += " " + HorizontalLayout.LAYOUT_TYPE_NAMES;
+
+ layout = new HorizontalLayout();
+ addBead(layout);
+ }
+
+ public function get layout():HorizontalLayout
+ {
+ return _layout as HorizontalLayout;
+ }
+ public function set layout(value:HorizontalLayout):void
+ {
+ _layout = value;
+ }
+
+ /**
+ * Assigns variable gap in steps of GAP_STEP. You have available GAPS*GAP_STEP gap styles
+ * Activate "gap-{X}x{GAP_STEP}px" effect selector to set a numeric gap between elements.
+ * i.e: gap-2x3px will result in a gap of 6px
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public function get gap():Number
+ {
+ return layout.gap;
+ }
+
+ public function set gap(value:Number):void
+ {
+ typeNames = StringUtil.removeWord(typeNames, " gap-" + layout.gap + "x" + HorizontalLayout.GAP_STEP + "px");
+ if(value != 0)
+ typeNames += " gap-" + value + "x" + HorizontalLayout.GAP_STEP + "px";
+
+ COMPILE::JS
+ {
+ if (parent)
+ setClassName(computeFinalClassNames());
+ }
+
+ layout.gap = value;
+ }
+ }
+}
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/VContainer.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/VContainer.as
new file mode 100644
index 0000000..fd5d31e
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/VContainer.as
@@ -0,0 +1,119 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+{
+ import org.apache.royale.jewel.beads.layouts.VerticalLayout;
+ import org.apache.royale.utils.StringUtil;
+
+ /**
+ * This Container subclass uses VerticalLayout as its default layout.
+ *
+ * @toplevel
+ * @see org.apache.royale.jewel.beads.layouts
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public class VContainer extends Container
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public function VContainer()
+ {
+ super();
+
+ typeNames += " " + VerticalLayout.LAYOUT_TYPE_NAMES;
+
+ layout = new VerticalLayout();
+ addBead(layout);
+ }
+
+ public function get layout():VerticalLayout
+ {
+ return _layout as VerticalLayout;
+ }
+ public function set layout(value:VerticalLayout):void
+ {
+ _layout = value;
+ }
+
+ /**
+ * Assigns variable gap in steps of GAP_STEP. You have available GAPS*GAP_STEP gap styles
+ * Activate "gap-{X}x{GAP_STEP}px" effect selector to set a numeric gap between elements.
+ * i.e: gap-2x3px will result in a gap of 6px
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public function get gap():Number
+ {
+ return layout.gap;
+ }
+ public function set gap(value:Number):void
+ {
+ typeNames = StringUtil.removeWord(typeNames, " gap-" + layout.gap + "x" + VerticalLayout.GAP_STEP + "px");
+ if(value != 0)
+ typeNames += " gap-" + value + "x" + VerticalLayout.GAP_STEP + "px";
+
+ COMPILE::JS
+ {
+ if (parent)
+ setClassName(computeFinalClassNames());
+ }
+
+ layout.gap = value;
+ }
+
+ /**
+ *
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public function get variableRowHeight():Boolean
+ {
+ return layout.variableRowHeight;
+ }
+ public function set variableRowHeight(value:Boolean):void
+ {
+ typeNames = StringUtil.removeWord(typeNames, " variableRowHeight");
+ if(value)
+ typeNames += " variableRowHeight";
+
+ COMPILE::JS
+ {
+ if (parent)
+ setClassName(computeFinalClassNames());
+ }
+
+ layout.variableRowHeight = value;
+ }
+ }
+}
diff --git a/frameworks/projects/Jewel/src/main/sass/_global.sass b/frameworks/projects/Jewel/src/main/sass/_global.sass
index 70cd979..4732e19 100644
--- a/frameworks/projects/Jewel/src/main/sass/_global.sass
+++ b/frameworks/projects/Jewel/src/main/sass/_global.sass
@@ -104,6 +104,12 @@ j|Container
IViewportModel: ClassReference("org.apache.royale.html.beads.models.ViewportModel")
//align-items: flex-start
+j|HContainer
+ IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.HorizontalLayout")
+
+j|VContainer
+ IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.VerticalLayout")
+
j|Image
IBeadModel: ClassReference("org.apache.royale.jewel.beads.models.ImageModel")
IBeadView: ClassReference("org.apache.royale.jewel.beads.views.ImageView")