This is an automated email from the ASF dual-hosted git repository.
harbs 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 e6580a88f3 view and layouts
e6580a88f3 is described below
commit e6580a88f3036e892d24aa983e3c399b0ae2106d
Author: Harbs <[email protected]>
AuthorDate: Sun Mar 8 15:55:17 2026 +0200
view and layouts
---
.../royale/org/apache/royale/core/LayoutBase.as | 2 +-
.../Style/src/main/resources/basic-manifest.xml | 3 +
.../projects/Style/src/main/resources/defaults.css | 6 +
.../layout/Display.as => Application.as} | 36 ++--
.../royale/org/apache/royale/style/StyleUIBase.as | 82 ++++++++-
.../main/royale/org/apache/royale/style/View.as | 125 +++++++++++++
.../royale/org/apache/royale/style/ViewBase.as | 120 +++++++++++++
.../layout/Display.as => beads/FlexLayout.as} | 41 +++--
.../org/apache/royale/style/beads/LayoutBase.as | 197 +++++++++++++++++++++
.../royale/style/stylebeads/layout/Display.as | 2 +-
10 files changed, 576 insertions(+), 38 deletions(-)
diff --git
a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/LayoutBase.as
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/LayoutBase.as
index 2f9733e985..aeb6b0a4f0 100644
---
a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/LayoutBase.as
+++
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/LayoutBase.as
@@ -318,7 +318,7 @@ package org.apache.royale.core
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.8
- * @royaleignorecoercion
org.apache.royale.events.IEventDispatcher
+ * @royaleignorecoercion org.apache.royale.core.ILayoutParent
*/
public function performLayout():void
{
diff --git a/frameworks/projects/Style/src/main/resources/basic-manifest.xml
b/frameworks/projects/Style/src/main/resources/basic-manifest.xml
index 631cc52afa..3f812da739 100644
--- a/frameworks/projects/Style/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Style/src/main/resources/basic-manifest.xml
@@ -20,8 +20,11 @@
<componentPackage>
+ <component id="Application" class="org.apache.royale.style.Application"/>
+ <component id="View" class="org.apache.royale.style.View"/>
<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"/>
<component id="Group" class="org.apache.royale.style.Group"/>
<component id="DataContainer" class="org.apache.royale.style.DataContainer"/>
diff --git a/frameworks/projects/Style/src/main/resources/defaults.css
b/frameworks/projects/Style/src/main/resources/defaults.css
index 1d7b74bb2a..d1e476492a 100644
--- a/frameworks/projects/Style/src/main/resources/defaults.css
+++ b/frameworks/projects/Style/src/main/resources/defaults.css
@@ -20,6 +20,12 @@
@namespace "library://ns.apache.org/royale/style";
+View
+{
+ IBeadView: ClassReference("org.apache.royale.html.beads.GroupView");
+ IBeadLayout: ClassReference("org.apache.royale.style.beads.FlexLayout");
+}
+
DataContainer
{
IBeadModel:
ClassReference("org.apache.royale.html.beads.models.DataProviderModel");
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/layout/Display.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Application.as
similarity index 54%
copy from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/layout/Display.as
copy to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/Application.as
index 7a6c40e57a..e5903e2075 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/layout/Display.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Application.as
@@ -16,26 +16,36 @@
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
-package org.apache.royale.style.stylebeads.layout
+package org.apache.royale.style
{
- import org.apache.royale.style.stylebeads.LeafStyleBase;
- import org.apache.royale.debugging.assert;
+ import org.apache.royale.core.Application;
+ import org.apache.royale.binding.ApplicationDataBinding;
+ import org.apache.royale.core.CSSClassList;
- public class Display extends LeafStyleBase
+ public class Application extends org.apache.royale.core.Application
{
- public function Display()
+ public function Application()
{
- super("", "display");
+ super();
+ addBead(new ApplicationDataBinding());
}
- override public function set value(value:*):void
+ private var _theme:String = "";
+
+ public function get theme():String
+ {
+ return _theme;
+ }
+
+ public function set theme(value:String):void
{
- // TODO: Support `sr-only` and `not-sr-only`
-
assert(["inline","block","inline-block","flow-root","flex","inline-flex","grid","inline-grid","contents","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","list-item","none"].indexOf(value)
>= 0, "Invalid value for display: " + value);
- _value = value;
- calculatedRuleValue = calculatedSelector = value;
- if(value == "none")
- calculatedSelector = "hidden";
+ _theme = value;
}
+ COMPILE::JS
+ override public function start():void
+ {
+ super.start();
+ }
+
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/StyleUIBase.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/StyleUIBase.as
index e39c3fcf52..1b549944db 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/StyleUIBase.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/StyleUIBase.as
@@ -24,6 +24,10 @@ package org.apache.royale.style
import org.apache.royale.style.IStyleSkin;
import org.apache.royale.style.stylebeads.ILeafStyleBead;
import org.apache.royale.style.stylebeads.IStyleBead;
+ import org.apache.royale.style.stylebeads.layout.Display;
+ import org.apache.royale.style.stylebeads.flexgrid.FlexGrow;
+ import org.apache.royale.style.stylebeads.flexgrid.FlexShrink;
+ import org.apache.royale.style.stylebeads.layout.Position;
import org.apache.royale.style.util.StyleManager;
import org.apache.royale.style.util.ThemeManager;
import org.apache.royale.utils.loadBeadFromValuesManager;
@@ -87,7 +91,7 @@ package org.apache.royale.style
{
assert(bead != null, "bead cannot be null");
if(!styleTypes)
- styleTypes = new Set();
+ styleTypes = new Map();
var leaves:Array = bead.getLeaves();
for each(var leaf:ILeafStyleBead in leaves)
@@ -100,7 +104,7 @@ package org.apache.royale.style
*/
if(styleTypes.has(leaf.styleType))
continue;
- styleTypes.add(leaf.styleType);
+ styleTypes.set(leaf.styleType, leaf);
leaf.strand = this;
_styleBeads.push(leaf);
}
@@ -108,7 +112,7 @@ package org.apache.royale.style
}
}
COMPILE::JS
- private var styleTypes:Set;
+ private var styleTypes:Map;
private var _stylesLoaded:Boolean;
override protected function loadBeads():void
{
@@ -123,15 +127,75 @@ package org.apache.royale.style
_stylesLoaded = true;
refreshStyles();
}
- public function getStyleBeadsByType(type:Class):Array
+ /**
+ * @royaleignorecoercion
org.apache.royale.style.stylebeads.ILeafStyleBead
+ */
+ public function getStyleBeadByType(type:Class):ILeafStyleBead
{
- var retVal:Array = [];
- for each(var bead:IStyleBead in _styleBeads)
+ var style:ILeafStyleBead = new type() as ILeafStyleBead;
+ assert(style is ILeafStyleBead, "Only leaf style beads
can be retrieved by type");
+ COMPILE::JS
{
- if(bead is type)
- retVal.push(bead);
+ var styleType:String = style.styleType;
+ if(styleTypes.has(styleType))
+ {
+ return styleTypes.get(styleType);
+ }
+ addStyleBead(style);
}
- return retVal;
+ return style;
+ }
+ /**
+ * Setters and Getters for common HTML attributes that can be
set on any component.
+ * Style beads are used and automatically createded if they
don't yet exist.
+ */
+ private var _displayStyle:String;
+ [Inspectable(category="General",
enumeration="inline,block,inline-block,flow-root,flex,inline-flex,grid,inline-grid,contents,table,inline-table,table-caption,table-cell,table-column,table-column-group,table-footer-group,table-header-group,table-row-group,table-row,list-item,none",
defaultValue="inline")]
+ public function get displayStyle():String
+ {
+ return _displayStyle;
+ }
+
+ public function set displayStyle(value:String):void
+ {
+ _displayStyle = value;
+ getStyleBeadByType(Display).value = value;
+ }
+ private var _positionStyle:String;
+ [Inspectable(category="General",
enumeration="static,fixed,absolute,relative,sticky", defaultValue="absolute")]
+ public function get positionStyle():String
+ {
+ return _positionStyle;
+ }
+
+ public function set positionStyle(value:String):void
+ {
+ _positionStyle = value;
+ getStyleBeadByType(Position).value = value;
+ }
+ private var _flexGrow:Number;
+
+ public function get flexGrow():Number
+ {
+ return _flexGrow;
+ }
+
+ public function set flexGrow(value:Number):void
+ {
+ _flexGrow = value;
+ getStyleBeadByType(FlexGrow).value = value;
+ }
+ private var _flexShrink:Number;
+
+ public function get flexShrink():Number
+ {
+ return _flexShrink;
+ }
+
+ public function set flexShrink(value:Number):void
+ {
+ _flexShrink = value;
+ getStyleBeadByType(FlexShrink).value = value;
}
private var _skin:IStyleSkin;
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
new file mode 100644
index 0000000000..8b9dabfe62
--- /dev/null
+++ b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/View.as
@@ -0,0 +1,125 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.core.IMXMLDocument;
+ import org.apache.royale.core.ValuesManager;
+ import org.apache.royale.utils.MXMLDataInterpreter;
+ import org.apache.royale.utils.sendEvent;
+
+ /**
+ * The default property uses when additional MXML content appears
within an element's
+ * definition in an MXML file.
+ */
+ [DefaultProperty("mxmlContent")]
+
+ /**
+ * The View class is the class for most views in a Royale
+ * application. It is generally used as the root tag of MXML
+ * documents and UI controls and containers are added to it.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.0
+ */
+ public class View extends ViewBase implements IMXMLDocument
+ {
+ public function View()
+ {
+ super();
+ }
+
+ 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);
+
+ sendEvent(this,"initBindings");
+ sendEvent(this,"initComplete");
+ _initialized = true;
+
+ // - why was this added here? childrenAdded();
//?? Is this necessary 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;
+ }
+}
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/ViewBase.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/ViewBase.as
new file mode 100644
index 0000000000..6dc1fa9ab6
--- /dev/null
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/ViewBase.as
@@ -0,0 +1,120 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.utils.sendEvent;
+ import org.apache.royale.core.IPopUpHost;
+ import org.apache.royale.core.IPopUpHostParent;
+ import org.apache.royale.core.IApplicationView;
+
+ // --------------------------------------
+ // Events
+ // --------------------------------------
+
+ /**
+ * Dispatched at startup. Attributes and sub-instances of
+ * the MXML document have been created and assigned.
+ * The component lifecycle is different
+ * than the Flex SDK. There is no creationComplete event.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.0
+ */
+ [Event(name="initComplete", type="org.apache.royale.events.Event")]
+
+ [DefaultProperty("mxmlContent")]
+
+ /**
+ * The ViewBase class is the base class for most views in a Royale
+ * application.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.0
+ */
+ public class ViewBase extends GroupBase implements IPopUpHost,
IPopUpHostParent, IApplicationView
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.0
+ */
+ public function ViewBase()
+ {
+ super();
+
+ typeNames = "royale";
+ }
+
+ private var _applicationModel:Object;
+
+ [Bindable("modelChanged")]
+
+ /**
+ * A reference to the Application's model. Usually,
+ * a view is displaying the main model for an
+ * application.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.0
+ */
+ public function get applicationModel():Object
+ {
+ return _applicationModel;
+ }
+
+ /**
+ * @private
+ */
+ public function set applicationModel(value:Object):void
+ {
+ _applicationModel = value;
+ sendEvent(this, "modelChanged");
+ }
+
+ /**
+ * ViewBase can host popups but they will be in the layout, if
any
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.0
+ */
+ public function get popUpParent():IPopUpHostParent
+ {
+ return this;
+ }
+
+ /**
+ */
+ public function get popUpHost():IPopUpHost
+ {
+ return this;
+ }
+
+ }
+}
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/layout/Display.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/beads/FlexLayout.as
similarity index 52%
copy from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/layout/Display.as
copy to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/beads/FlexLayout.as
index 7a6c40e57a..09c97e8c17 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/layout/Display.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/beads/FlexLayout.as
@@ -16,26 +16,39 @@
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
-package org.apache.royale.style.stylebeads.layout
+package org.apache.royale.style.beads
{
- import org.apache.royale.style.stylebeads.LeafStyleBase;
- import org.apache.royale.debugging.assert;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.core.ILayoutChild;
+ import org.apache.royale.style.IStyleUIBase;
+ import org.apache.royale.style.stylebeads.FlexContainerStyle;
+ import org.apache.royale.style.StyleUIBase;
+ import org.apache.royale.style.stylebeads.layout.Display;
- public class Display extends LeafStyleBase
+ public class FlexLayout extends LayoutBase
{
- public function Display()
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @productversion Royale 0.9.13
+ */
+ public function FlexLayout()
{
- super("", "display");
+ super();
}
-
- override public function set value(value:*):void
+ /**
+ * @royaleignorecoercion org.apache.royale.style.StyleUIBase
+ */
+ override public function set strand(value:IStrand):void
{
- // TODO: Support `sr-only` and `not-sr-only`
-
assert(["inline","block","inline-block","flow-root","flex","inline-flex","grid","inline-grid","contents","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","list-item","none"].indexOf(value)
>= 0, "Invalid value for display: " + value);
- _value = value;
- calculatedRuleValue = calculatedSelector = value;
- if(value == "none")
- calculatedSelector = "hidden";
+ super.strand = value;
+ var styleHost:StyleUIBase = value as StyleUIBase;
+ if(!styleHost.styleBeads)
+ styleHost.styleBeads = [];
+ var displayStyle:Display = new Display();
+ displayStyle.value = "flex";
+ styleHost.styleBeads.push(displayStyle);
}
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/beads/LayoutBase.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/beads/LayoutBase.as
new file mode 100644
index 0000000000..dc97ec3fae
--- /dev/null
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/beads/LayoutBase.as
@@ -0,0 +1,197 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.beads
+{
+ import org.apache.royale.core.IBeadLayout;
+ import org.apache.royale.core.ILayoutChild;
+ import org.apache.royale.core.ILayoutHost;
+ import org.apache.royale.core.ILayoutParent;
+ import org.apache.royale.core.ILayoutView;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.events.Event;
+ import org.apache.royale.utils.sendStrandEvent;
+ import org.apache.royale.core.Bead;
+
+ /**
+ * This class is the base class for most, if not all, layouts.
+ *
+ * @langversion 3.0
+ * @productversion Royale 0.9.13
+ */
+ public class LayoutBase extends Bead implements IBeadLayout
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @productversion Royale 0.9.13
+ */
+ public function LayoutBase()
+ {
+ }
+
+ private var sawInitComplete:Boolean;
+
+ /**
+ * The strand/host container is also an ILayoutChild because
+ * it can have its size dictated by the host's parent which is
+ * important to know for layout optimization.
+ *
+ * @langversion 3.0
+ * @productversion Royale 0.9.13
+ */
+ protected var host:ILayoutChild;
+
+ /**
+ * @copy org.apache.royale.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @productversion Royale 0.9.13
+ *
+ * @royaleignorecoercion org.apache.royale.core.ILayoutChild
+ */
+ override public function set strand(value:IStrand):void
+ {
+ if (value != _strand)
+ {
+ if (_strand)
+ setListeners(true);
+ }
+ _strand = value;
+ host = value as ILayoutChild;
+ if (value)
+ {
+ setListeners();
+ }
+ }
+
+ protected function setListeners(off:Boolean = false):void
+ {
+ listenOnStrand("childrenAdded", handleChildrenAdded,
false, off);
+ listenOnStrand("initComplete", handleInitComplete,
false, off);
+ listenOnStrand("layoutNeeded", handleLayoutNeeded,
false, off);
+ }
+
+ private var lastWidth:Number = -1;
+ private var lastHeight:Number = -1;
+
+ /**
+ * Handles the addition of children to the host's layoutView by
listening for
+ * size changes in the children.
+ *
+ * @langversion 3.0
+ * @productversion Royale 0.9.13
+ */
+ protected function handleChildrenAdded(event:Event):void
+ {
+ COMPILE::JS
+ {
+ if (sawInitComplete)
+ {
+ performLayout();
+ }
+ }
+ }
+
+ /**
+ * Called whenever "layoutNeeded" event is dispatched against
the host strand.
+ *
+ * @langversion 3.0
+ * @productversion Royale 0.9.13
+ */
+ protected function handleLayoutNeeded(event:Event):void
+ {
+ performLayout();
+ }
+
+ /**
+ * Handles the final start-up condition by running the layout
an initial time.
+ *
+ * @langversion 3.0
+ * @productversion Royale 0.9.13
+ */
+ protected function handleInitComplete(event:Event):void
+ {
+ sawInitComplete = true;
+ COMPILE::JS
+ {
+ // always run layout since there are no size
change events
+ performLayout();
+ }
+ }
+
+ /**
+ * Returns the ILayoutView for the host.
+ *
+ * @langversion 3.0
+ * @productversion Royale 0.9.13
+ *
+ * @royaleignorecoercion org.apache.royale.core.ILayoutParent
+ */
+ protected function get layoutView():ILayoutView
+ {
+ var viewBead:ILayoutHost = (host as
ILayoutParent).getLayoutHost();
+ return viewBead.contentView;
+ }
+
+ protected var isLayoutRunning:Boolean = false;
+
+ /**
+ * Performs the layout in three parts: before, layout, after.
+ *
+ * @langversion 3.0
+ * @productversion Royale 0.9.13
+ * @royaleignorecoercion org.apache.royale.core.ILayoutParent
+ */
+ public function performLayout():void
+ {
+ // avoid running this layout instance recursively.
+ if (isLayoutRunning)
+ return;
+
+ isLayoutRunning = true;
+
+ var viewBead:ILayoutHost = (host as
ILayoutParent).getLayoutHost();
+ if (viewBead.beforeLayout())
+ {
+ if (layout())
+ {
+ viewBead.afterLayout();
+ }
+ }
+
+ isLayoutRunning = false;
+
+ sendStrandEvent(_strand, "layoutComplete");
+
+ }
+
+ /**
+ * @copy org.apache.royale.core.IBeadLayout#layout
+ *
+ * @langversion 3.0
+ * @productversion Royale 0.9.13
+ */
+ public function layout():Boolean
+ {
+ // override in subclass
+ return false;
+ }
+ }
+}
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/layout/Display.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/layout/Display.as
index 7a6c40e57a..c4a0fd47fe 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/layout/Display.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/stylebeads/layout/Display.as
@@ -27,7 +27,7 @@ package org.apache.royale.style.stylebeads.layout
{
super("", "display");
}
-
+ [Inspectable(category="General",
enumeration="inline,block,inline-block,flow-root,flex,inline-flex,grid,inline-grid,contents,table,inline-table,table-caption,table-cell,table-column,table-column-group,table-footer-group,table-header-group,table-row-group,table-row,list-item,none",
defaultValue="inline")]
override public function set value(value:*):void
{
// TODO: Support `sr-only` and `not-sr-only`