This is an automated email from the ASF dual-hosted git repository.
gregdove 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 b03f969432 Some of these changes may not persist... getting things
working for playground app.
b03f969432 is described below
commit b03f969432ecd496a77cd48361c6252c7600c705
Author: greg-dove <[email protected]>
AuthorDate: Fri Mar 20 19:35:39 2026 +1300
Some of these changes may not persist... getting things working for
playground app.
---
.../projects/Style/src/main/resources/defaults.css | 5 +
.../Style/src/main/resources/style-manifest.xml | 3 +
.../royale/org/apache/royale/style/Application.as | 2 +-
.../apache/royale/style/{Group.as => Divider.as} | 31 +++-
.../org/apache/royale/style/FlexContainer.as | 160 +++++++++++++++++++++
.../main/royale/org/apache/royale/style/Group.as | 86 ++++++++++-
.../main/royale/org/apache/royale/style/List.as | 10 +-
.../main/royale/org/apache/royale/style/View.as | 8 +-
.../org/apache/royale/style/skins/DividerSkin.as | 108 ++++++++++++++
9 files changed, 404 insertions(+), 9 deletions(-)
diff --git a/frameworks/projects/Style/src/main/resources/defaults.css
b/frameworks/projects/Style/src/main/resources/defaults.css
index eafeb98dd3..69f04620a9 100644
--- a/frameworks/projects/Style/src/main/resources/defaults.css
+++ b/frameworks/projects/Style/src/main/resources/defaults.css
@@ -52,6 +52,11 @@ DataContainer
IViewport:
ClassReference("org.apache.royale.html.supportClasses.Viewport");
IViewportModel:
ClassReference("org.apache.royale.html.beads.models.ViewportModel");
}
+Divider
+{
+ IStyleSkin: ClassReference("org.apache.royale.style.skins.DividerSkin");
+}
+
MultiSelectionList
{
IBeadModel:
ClassReference("org.apache.royale.html.beads.models.ArrayMultiSelectionModel");
diff --git a/frameworks/projects/Style/src/main/resources/style-manifest.xml
b/frameworks/projects/Style/src/main/resources/style-manifest.xml
index 00b3a4976d..5813912de1 100644
--- a/frameworks/projects/Style/src/main/resources/style-manifest.xml
+++ b/frameworks/projects/Style/src/main/resources/style-manifest.xml
@@ -23,6 +23,8 @@
<component id="Application" class="org.apache.royale.style.Application"/>
<component id="View" class="org.apache.royale.style.View"/>
<component id="CheckBox" class="org.apache.royale.style.CheckBox"/>
+ <component id="Divider" class="org.apache.royale.style.Divider"/>
+ <component id="FlexContainer" class="org.apache.royale.style.FlexContainer"/>
<component id="StyleSkin" class="org.apache.royale.style.StyleSkin"/>
<component id="Icon" class="org.apache.royale.style.Icon"/>
<component id="FlexLayout" class="org.apache.royale.style.beads.FlexLayout"/>
@@ -301,5 +303,6 @@
<component id="Video" class="org.apache.royale.style.elements.Video"/>
<component id="CheckBoxSkin"
class="org.apache.royale.style.skins.CheckBoxSkin"/>
+ <component id="DividerSkin"
class="org.apache.royale.style.skins.DividerSkin"/>
</componentPackage>
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Application.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Application.as
index d6acb5fc17..7fbb61f955 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Application.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Application.as
@@ -31,7 +31,7 @@ package org.apache.royale.style
{
super();
valuesImpl = new AllCSSValuesImpl();
- addBead(new ApplicationDataBinding());
+ addBead(new ApplicationDataBinding());
ThemeManager.instance.registerTheme(new StyleTheme());
}
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Group.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Divider.as
similarity index 66%
copy from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/Group.as
copy to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/Divider.as
index 7df4ae8b7c..df448215eb 100644
--- a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Group.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Divider.as
@@ -18,9 +18,15 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.style
{
- public class Group extends GroupBase
+ import org.apache.royale.core.IMXMLDocument;
+ import org.apache.royale.core.ValuesManager;
+ import org.apache.royale.events.Event;
+ import org.apache.royale.utils.MXMLDataInterpreter;
+
+
+ public class Divider extends StyleUIBase
{
- public function Group()
+ public function Divider()
{
super();
}
@@ -30,8 +36,27 @@ package org.apache.royale.style
override protected function requiresController():Boolean{
return false;
}
- override protected function requiresLayout():Boolean{
+ /*override protected function requiresLayout():Boolean{
return false;
+ }*/
+
+
+ private var _vertical:Boolean;
+
+ /**
+ * Whether horizontal or vertical divider
+ */
+ public function get vertical():Boolean
+ {
+ return _vertical;
+ }
+
+ public function set vertical(value:Boolean):void
+ {
+ if(value != !!_vertical){
+
+ }
+ _vertical = value;
}
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/FlexContainer.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/FlexContainer.as
new file mode 100644
index 0000000000..de98cac423
--- /dev/null
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/FlexContainer.as
@@ -0,0 +1,160 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.style
+{
+ import org.apache.royale.binding.ContainerDataBinding;
+ import org.apache.royale.binding.DataBindingBase;
+ import org.apache.royale.core.IMXMLDocument;
+ import org.apache.royale.core.ValuesManager;
+ import org.apache.royale.events.Event;
+ import org.apache.royale.utils.MXMLDataInterpreter;
+
+
+ public class FlexContainer extends Group
+ {
+ public function FlexContainer()
+ {
+ super();
+ setStyle("display","flex");
+ }
+
+ override public function addedToParent():void{
+ if (!_bindingsInited) initBindings()
+ super.addedToParent();
+ }
+
+ private var _bindingsInited:Boolean
+ protected function initBindings():void{
+ _bindingsInited = true;
+ if ('_bindings' in this &&
!getBeadByType(DataBindingBase)) {
+ addBead(new ContainerDataBinding());
+ }
+ }
+
+ public function get alignContent():String{
+ COMPILE::SWF{return "";}
+ COMPILE::JS{return element.style.alignContent;}
+ }
+ /**
+ * Takes any of the values accepted by flexbox align-content
+ */
+ public function set alignContent(value:String):void{
+ setStyle("alignContent",value);
+ }
+ public function get alignItems():String{
+ COMPILE::SWF{return "";}
+ COMPILE::JS{return element.style.alignItems;}
+ }
+ /**
+ * Takes any of the values accepted by flexbox align-items
+ */
+ public function set alignItems(value:String):void{
+ setStyle("alignItems",value);
+ }
+
+ public function get justifyContent():String{
+ COMPILE::SWF{return "";}
+ COMPILE::JS{return element.style.justifyContent;}
+ }
+ /**
+ * Takes any of the values accepted by flexbox justify-content
+ */
+ public function set justifyContent(value:String):void{
+ setStyle("justifyContent",value);
+ }
+
+ private var _vertical:Boolean = false;
+
+ public function get vertical():Boolean
+ {
+ return _vertical;
+ }
+
+ public function set vertical(value:Boolean):void
+ {
+ _vertical = value;
+ computeDirection();
+ }
+
+ private var _reverse:Boolean;
+
+ public function get reverse():Boolean
+ {
+ return _reverse;
+ }
+
+ public function set reverse(value:Boolean):void
+ {
+ _reverse = value;
+ computeDirection();
+ }
+ private function computeDirection():void{
+ var direction:String = vertical ? "column" : "row";
+ if(reverse){
+ direction += "-reverse";
+ }
+ setStyle("flexDirection",direction);
+ }
+
+ private var _wrap:Boolean;
+
+ public function get wrap():Boolean
+ {
+ return _wrap;
+ }
+
+ public function set wrap(value:Boolean):void
+ {
+ _wrap = value;
+ if(value){
+ _reverseWrap = false;
+ }
+ setWrap();
+ }
+
+ private var _reverseWrap:Boolean;
+
+ public function get reverseWrap():Boolean
+ {
+ return _reverseWrap;
+ }
+
+ public function set reverseWrap(value:Boolean):void
+ {
+ _reverseWrap = value;
+ if(value){
+ _wrap = false;
+ }
+ setWrap();
+ }
+
+ private function setWrap():void{
+ var wrapVal:String;
+ if(_wrap){
+ wrapVal = "wrap";
+ } else if(_reverseWrap){
+ wrapVal = "wrap-reverse";
+ } else {
+ wrapVal = "nowrap";
+ }
+ setStyle("flexWrap",wrapVal);
+ }
+
+ }
+}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Group.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Group.as
index 7df4ae8b7c..8d551984db 100644
--- a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Group.as
+++ b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Group.as
@@ -18,7 +18,13 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.style
{
- public class Group extends GroupBase
+ import org.apache.royale.core.IMXMLDocument;
+ import org.apache.royale.core.ValuesManager;
+ import org.apache.royale.events.Event;
+ import org.apache.royale.utils.MXMLDataInterpreter;
+
+ [DefaultProperty("mxmlContent")]
+ public class Group extends GroupBase implements IMXMLDocument
{
public function Group()
{
@@ -33,5 +39,83 @@ package org.apache.royale.style
override protected function requiresLayout():Boolean{
return false;
}
+
+
+
+ private var _mxmlDescriptor:Array;
+ private var _mxmlDocument:Object = this;
+ private var _initialized:Boolean;
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ if (!_initialized)
+ {
+ // each MXML file can also have styles in
fx:Style block
+ ValuesManager.valuesImpl.init(this);
+ }
+
+ super.addedToParent();
+
+ if (!_initialized)
+ {
+
MXMLDataInterpreter.generateMXMLInstances(_mxmlDocument, this, MXMLDescriptor);
+
+ dispatchEvent(new Event("initBindings"));
+ dispatchEvent(new Event("initComplete"));
+ _initialized = true;
+
+ //?? why was this added here? childrenAdded();
//?? Is this needed since MXMLDataInterpreter will already have called it
+ }
+ }
+
+ /**
+ * @copy org.apache.royale.core.Application#MXMLDescriptor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.8
+ */
+ public function get MXMLDescriptor():Array
+ {
+ return _mxmlDescriptor;
+ }
+
+ /**
+ * @private
+ */
+ public function setMXMLDescriptor(document:Object,
value:Array):void
+ {
+ _mxmlDocument = document;
+ _mxmlDescriptor = value;
+ }
+
+ /**
+ * @copy
org.apache.royale.core.Application#generateMXMLAttributes()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.8
+ */
+ public function generateMXMLAttributes(data:Array):void
+ {
+ MXMLDataInterpreter.generateMXMLProperties(this, data);
+ }
+
+ /**
+ * @copy
org.apache.royale.core.ItemRendererClassFactory#mxmlContent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.8
+ *
+ * @royalesuppresspublicvarwarning
+ */
+ public var mxmlContent:Array;
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/List.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/List.as
index 46ab7647ac..5e4351cfe9 100644
--- a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/List.as
+++ b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/List.as
@@ -37,7 +37,9 @@ package org.apache.royale.style
* @langversion 3.0
* @productversion Royale 1.0.0
*/
- [Event(name="selectionChange", type="org.apache.royale.events.Event")]
+ //[Event(name="selectionChange", type="org.apache.royale.events.Event")]
+ [Event(name="change", type="org.apache.royale.events.Event")]
+
/**
* The List class is a component that displays multiple data items.
The List uses
@@ -76,7 +78,8 @@ package org.apache.royale.style
* @productversion Royale 1.0.0
* @royaleignorecoercion org.apache.royale.core.ISelectionModel
*/
- [Bindable("selectionChange")]
+ //[Bindable("selectionChange")]
+ [Bindable("change")]
public function get selectedIndex():int
{
return (model as ISelectionModel).selectedIndex;
@@ -138,7 +141,8 @@ package org.apache.royale.style
* @productversion Royale 1.0.0
* @royaleignorecoercion org.apache.royale.core.ISelectionModel
*/
- [Bindable("selectionChange")]
+ // [Bindable("selectionChange")]
+ [Bindable("change")]
public function get selectedItem():Object
{
return (model as ISelectionModel).selectedItem;
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/View.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/View.as
index 8b9dabfe62..5414e4c84b 100644
--- a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/View.as
+++ b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/View.as
@@ -17,7 +17,9 @@
//
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.style
-{
+{
+ import org.apache.royale.binding.DataBindingBase;
+ import org.apache.royale.binding.ViewDataBinding;
import org.apache.royale.core.IMXMLDocument;
import org.apache.royale.core.ValuesManager;
import org.apache.royale.utils.MXMLDataInterpreter;
@@ -65,6 +67,10 @@ package org.apache.royale.style
if (!_initialized)
{
+ if ('_bindings' in this &&
!getBeadByType(DataBindingBase)) {
+ addBead(new ViewDataBinding());
+ }
+
MXMLDataInterpreter.generateMXMLInstances(_mxmlDocument, this, MXMLDescriptor);
sendEvent(this,"initBindings");
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/skins/DividerSkin.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/skins/DividerSkin.as
new file mode 100644
index 0000000000..38b072db63
--- /dev/null
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/skins/DividerSkin.as
@@ -0,0 +1,108 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.style.skins
+{
+ import org.apache.royale.style.StyleSkin;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.style.stylebeads.sizing.HeightStyle;
+ import org.apache.royale.style.stylebeads.sizing.WidthStyle;
+ import org.apache.royale.style.stylebeads.border.BorderRadius;
+ import org.apache.royale.style.util.ThemeManager;
+ import org.apache.royale.style.stylebeads.background.BackgroundColor;
+
+ import org.apache.royale.style.Divider;
+
+ public class DividerSkin extends StyleSkin /*implements ICheckBoxSkin*/
+ {
+ public function DividerSkin()
+ {
+ super();
+ }
+ /**
+ * @royaleignorecoercion org.apache.royale.style.CheckBox
+ */
+ private function getHost():Divider
+ {
+ return _strand as Divider;
+ }
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ // Manually set. Don't create the default ones.
+ if(_styles)
+ return;
+ processStyles();
+ }
+
+ private function processStyles():void{
+ var host:Divider = getHost();
+ var hostSize:String = getHost().size;
+ var size:Number = getAppliedSize(hostSize);
+ var colorAdjust:Number = getShading(hostSize);
+ var appliedSize:String = computeSize(size , host.unit);
+ var styles:Array = [
+ new
BackgroundColor("slate-"+colorAdjust),
+ new
BorderRadius(ThemeManager.instance.activeTheme.radiusSM)
+ ]
+ if (getHost().vertical) {
+ styles.push(new HeightStyle('100%'));
+ styles.push(new WidthStyle())
+ } else {
+ styles.push(new WidthStyle('100%'));
+ styles.push(new HeightStyle(appliedSize));
+ }
+ _styles = styles;
+
+ host.setStyles(_styles);
+ }
+
+ private function getShading(size:String):Number{
+ switch(size)
+ {
+ case "sm":
+ return 250;
+ case "lg":
+ return 500;
+ case "xl":
+ return 700;
+ case "md":
+ default:
+ return 900;
+ }
+ }
+
+ private function getAppliedSize(size:String):Number
+ {
+ switch(size)
+ {
+ case "sm":
+ return 1;
+ case "lg":
+ return 4;
+ case "xl":
+ return 8;
+ case "md":
+ default:
+ return 2;
+ }
+ }
+
+
+ }
+}
\ No newline at end of file