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 cf422d1 basic-constraintsize-bead: brings min, max width and height
properties to UIBase as a bead
cf422d1 is described below
commit cf422d11082cd91b7cb755e22e708b6b2fe23255
Author: Carlos Rovira <[email protected]>
AuthorDate: Fri Apr 10 19:04:38 2020 +0200
basic-constraintsize-bead: brings min, max width and height properties to
UIBase as a bead
---
.../Basic/src/main/resources/basic-manifest.xml | 1 +
.../org/apache/royale/core/ConstraintSize.as | 172 +++++++++++++++++++++
2 files changed, 173 insertions(+)
diff --git a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
index 40e9b43..4e0b5b5 100644
--- a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
@@ -128,6 +128,7 @@
<component id="ApplicationParameters"
class="org.apache.royale.html.beads.ApplicationParametersBead"/>
<component id="ApplicationParametersCaseInsensitive"
class="org.apache.royale.html.beads.ApplicationParametersCaseInsensitiveBead"/>
<component id="IEEventAdapter"
class="org.apache.royale.html.beads.IEEventAdapterBead"/>
+ <component id="ConstraintSize"
class="org.apache.royale.core.ConstraintSize"/>
<component id="SimpleAlert" class="org.apache.royale.html.SimpleAlert"/>
<component id="Alert" class="org.apache.royale.html.Alert"/>
diff --git
a/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/ConstraintSize.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/ConstraintSize.as
new file mode 100644
index 0000000..b9e702a
--- /dev/null
+++
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/ConstraintSize.as
@@ -0,0 +1,172 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.core
+{
+ import org.apache.royale.core.IBead;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.core.UIBase;
+
+ /**
+ * The ConstraintSize class is used to set minimun and maximun sizes
on the component
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public class ConstraintSize implements IBead
+ {
+ public function ConstraintSize()
+ {
+ }
+
+ protected var host:UIBase;
+
+ public function set strand(value:IStrand):void
+ {
+ host = value as UIBase;
+ updateMinWidth();
+ updateMinHeight();
+ }
+
+ protected var _minWidth:Number;
+ /**
+ * the minimun width for this component
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public function get minWidth():Number
+ {
+ return _minWidth;
+ }
+ public function set minWidth(value:Number):void
+ {
+ if (_minWidth !== value)
+ {
+ _minWidth = value;
+ if(host)
+ updateMinWidth();
+ }
+ }
+ private function updateMinWidth():void
+ {
+ COMPILE::JS
+ {
+ if(_minWidth)
+ host.positioner.style.minWidth = _minWidth.toString() + 'px';
+ }
+ }
+
+ protected var _minHeight:Number;
+ /**
+ * the minimun height for this component
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public function get minHeight():Number
+ {
+ return _minHeight;
+ }
+ public function set minHeight(value:Number):void
+ {
+ if (_minHeight !== value)
+ {
+ _minHeight = value;
+ if(host)
+ updateMinHeight();
+ }
+ }
+ private function updateMinHeight():void
+ {
+ COMPILE::JS
+ {
+ if(_minHeight)
+ host.positioner.style.minHeight = _minHeight.toString() +
'px';
+ }
+ }
+
+ protected var _maxWidth:Number;
+ /**
+ * the maximun width for this component
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public function get maxWidth():Number
+ {
+ return _maxWidth;
+ }
+ public function set maxWidth(value:Number):void
+ {
+ if (_maxWidth !== value)
+ {
+ _maxWidth = value;
+ if(host)
+ updateMaxWidth();
+ }
+ }
+ private function updateMaxWidth():void
+ {
+ COMPILE::JS
+ {
+ if(_maxWidth)
+ host.positioner.style.maxWidth = _maxWidth.toString() + 'px';
+ }
+ }
+
+ protected var _maxHeight:Number;
+ /**
+ * the maximun height for this component
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public function get maxHeight():Number
+ {
+ return _maxHeight;
+ }
+ public function set maxHeight(value:Number):void
+ {
+ if (_maxHeight !== value)
+ {
+ _maxHeight = value;
+ if(host)
+ updateMaxHeight();
+ }
+ }
+ private function updateMaxHeight():void
+ {
+ COMPILE::JS
+ {
+ if(_maxHeight)
+ host.positioner.style.maxHeight = _maxHeight.toString() +
'px';
+ }
+ }
+ }
+}