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 ec6a16aece list and menu data
ec6a16aece is described below
commit ec6a16aece469025a349097b47e0cd3a8cb79fbb
Author: Harbs <[email protected]>
AuthorDate: Thu May 14 14:29:40 2026 +0300
list and menu data
---
.../projects/Style/src/main/royale/StyleClasses.as | 3 +
.../style/data/{IListItem.as => DataItem.as} | 40 +++++---
.../style/data/{IListItem.as => IListData.as} | 2 +-
.../org/apache/royale/style/data/IMenuData.as | 65 +++++++++++++
.../style/data/{IListItem.as => ListData.as} | 58 ++++++++++--
.../org/apache/royale/style/data/MenuData.as | 105 +++++++++++++++++++++
.../royale/style/renderers/ListItemRenderer.as | 10 +-
7 files changed, 253 insertions(+), 30 deletions(-)
diff --git a/frameworks/projects/Style/src/main/royale/StyleClasses.as
b/frameworks/projects/Style/src/main/royale/StyleClasses.as
index 61d0672910..66fb86e307 100644
--- a/frameworks/projects/Style/src/main/royale/StyleClasses.as
+++ b/frameworks/projects/Style/src/main/royale/StyleClasses.as
@@ -33,6 +33,9 @@ package
import org.apache.royale.style.util.ContentAlign; ContentAlign;
import org.apache.royale.style.support.UIItemRendererBase;
UIItemRendererBase;
import org.apache.royale.style.const.Theme; Theme;
+ import org.apache.royale.style.data.DataItem; DataItem;
+ import org.apache.royale.style.data.ListData; ListData;
+ import org.apache.royale.style.data.MenuData; MenuData;
}
}
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/IListItem.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/DataItem.as
similarity index 60%
copy from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/IListItem.as
copy to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/DataItem.as
index e9d0bfaa8f..97004ff291 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/IListItem.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/DataItem.as
@@ -18,19 +18,31 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.style.data
{
- public interface IListItem extends IDataItem
- {
- function get text():String;
- function set text(value:String):void;
- function get label():String;
- function get icon():String;
- function set icon(value:String):void;
+ /**
+ * A simple implementation of IDataItem that can be used as a base
class for more complex data items or as a simple data item on its own.
+ *
+ * @languageversion 3.0
+ * @productversion Royale 1.0.0
+ */
+ public class DataItem implements IDataItem
+ {
+ public function DataItem()
+ {
- /**
- * src of an icon to be rendered an an img
- */
- function get imageIcon():String;
- function set imageIcon(value:String):void;
-
- }
+ }
+ private var _disabled:Boolean;
+ public function get disabled():Boolean{
+ return _disabled;
+ }
+ public function set disabled(value:Boolean):void{
+ _disabled = value;
+ }
+ private var _selected:Boolean;
+ public function get selected():Boolean{
+ return _selected;
+ }
+ public function set selected(value:Boolean):void{
+ _selected = value;
+ }
+ }
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/IListItem.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/IListData.as
similarity index 96%
copy from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/IListItem.as
copy to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/IListData.as
index e9d0bfaa8f..87d886c401 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/IListItem.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/IListData.as
@@ -18,7 +18,7 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.style.data
{
- public interface IListItem extends IDataItem
+ public interface IListData extends IDataItem
{
function get text():String;
function set text(value:String):void;
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/IMenuData.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/IMenuData.as
new file mode 100644
index 0000000000..5a2841aa27
--- /dev/null
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/IMenuData.as
@@ -0,0 +1,65 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.data
+{
+ /**
+ * Describes the data contract for menu items used by Style menu
controls.
+ *
+ * @langversion 3.0
+ * @productversion Royale 1.0.0
+ */
+ public interface IMenuData extends IListData
+ {
+ /**
+ * True when this item should render as a visual divider
instead of a selectable item.
+ *
+ * @langversion 3.0
+ * @productversion Royale 1.0.0
+ */
+ function get isDivider():Boolean;
+ function set isDivider(value:Boolean):void
+
+ /**
+ * True when this menu item is currently expanded.
+ *
+ * @langversion 3.0
+ * @productversion Royale 1.0.0
+ */
+ function get isOpen():Boolean;
+ function set isOpen(value:Boolean):void
+
+ /**
+ * True when this item is a non-selectable heading label.
+ *
+ * @langversion 3.0
+ * @productversion Royale 1.0.0
+ */
+ function get isHeading():Boolean;
+ function set isHeading(value:Boolean):void
+
+ /**
+ * Child menu items for nested submenus.
+ *
+ * @langversion 3.0
+ * @productversion Royale 1.0.0
+ */
+ function get subMenu():Array
+ function set subMenu(value:Array):void
+ }
+}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/IListItem.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/ListData.as
similarity index 50%
rename from
frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/IListItem.as
rename to
frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/ListData.as
index e9d0bfaa8f..848c2bcf36 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/IListItem.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/ListData.as
@@ -18,19 +18,57 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.style.data
{
- public interface IListItem extends IDataItem
- {
- function get text():String;
- function set text(value:String):void;
- function get label():String;
- function get icon():String;
- function set icon(value:String):void;
+ /**
+ * The ListData class is a simple implementation of the IListData
interface. It is used to hold data for a list item.
+ * It is used by the List component to hold data for each item in the
list.
+ *
+ * @languageversion 3.0
+ * @productversion Royale 1.0.0
+ */
+ public class ListData extends DataItem implements IListData
+ {
+ public function ListData(text:String="")
+ {
+ this.text = text;
+ }
+ private var _text:String;
+ public function get text():String
+ {
+ return _text;
+ }
+
+ public function set text(value:String):void
+ {
+ _text = value;
+ }
+ public function get label():String{
+ return _text;
+ }
+ private var _icon:String;
+
+ public function get icon():String
+ {
+ return _icon;
+ }
+
+ public function set icon(value:String):void
+ {
+ _icon = value;
+ }
+
+ private var _imageIcon:String;
/**
* src of an icon to be rendered an an img
*/
- function get imageIcon():String;
- function set imageIcon(value:String):void;
+ public function get imageIcon():String
+ {
+ return _imageIcon;
+ }
- }
+ public function set imageIcon(value:String):void
+ {
+ _imageIcon = value;
+ }
+ }
}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/MenuData.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/MenuData.as
new file mode 100644
index 0000000000..123b6235f1
--- /dev/null
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/data/MenuData.as
@@ -0,0 +1,105 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.data
+{
+ /**
+ * Data model for menu/list items used by style-based menu components.
+ *
+ * @langversion 3.0
+ * @productversion Royale 1.0.0
+ */
+ public class MenuData extends ListData implements IMenuData
+ {
+ /**
+ * Creates a menu data item with optional display text.
+ */
+ public function MenuData(text:String = null)
+ {
+ super(text);
+ }
+
+ private var _isDivider:Boolean;
+
+ /**
+ * True when this item should render as a divider rather than a
selectable item.
+ *
+ * @langversion 3.0
+ * @productversion Royale 1.0.0
+ */
+ public function get isDivider():Boolean
+ {
+ return _isDivider;
+ }
+ public function set isDivider(value:Boolean):void
+ {
+ _isDivider = value;
+ }
+
+ private var _isOpen:Boolean = false;
+
+ /**
+ * True when this menu item is currently expanded.
+ *
+ * @langversion 3.0
+ * @productversion Royale 1.0.0
+ */
+ public function get isOpen():Boolean
+ {
+ return _isOpen;
+ }
+ public function set isOpen(value:Boolean):void
+ {
+ _isOpen = value;
+ }
+
+ private var _isHeading:Boolean;
+
+ /**
+ * True when this item is a non-selectable heading label.
+ *
+ * @langversion 3.0
+ * @productversion Royale 1.0.0
+ */
+ public function get isHeading():Boolean
+ {
+ return _isHeading;
+ }
+ public function set isHeading(value:Boolean):void
+ {
+ _isHeading = value;
+ }
+
+ private var _subMenu:Array;
+
+ /**
+ * Child menu items for nested submenus.
+ *
+ * @langversion 3.0
+ * @productversion Royale 1.0.0
+ */
+ public function get subMenu():Array
+ {
+ return _subMenu;
+ }
+ public function set subMenu(value:Array):void
+ {
+ _subMenu = value;
+ }
+ }
+}
\ No newline at end of file
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/renderers/ListItemRenderer.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/renderers/ListItemRenderer.as
index a5e88d35cb..fb5391123d 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/renderers/ListItemRenderer.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/renderers/ListItemRenderer.as
@@ -22,7 +22,7 @@ package org.apache.royale.style.renderers
import org.apache.royale.html.util.getLabelFromData;
import org.apache.royale.core.IParent;
import org.apache.royale.style.Icon;
- import org.apache.royale.style.data.IListItem;
+ import org.apache.royale.style.data.IListData;
import org.apache.royale.style.elements.Img;
public class ListItemRenderer extends DataItemRenderer implements
IListItemRenderer
@@ -120,17 +120,17 @@ package org.apache.royale.style.renderers
*/
private function getIconSelector():String
{
- if (data is IListItem)
+ if (data is IListData)
{
- return (data as IListItem).icon;
+ return (data as IListData).icon;
}
return data["icon"];
}
private function getImageIcon():String
{
- if (data is IListItem)
+ if (data is IListData)
{
- return (data as IListItem).imageIcon;
+ return (data as IListData).imageIcon;
}
return data["imageIcon"];
}