Chapter 11: Using Menu-Based Controls Defining menu structure and data

 

所有的基于菜单控件的data providers 都有如下特点来指定菜单的结构和内容:

 •data providers经常是有层次的,但是你也可以只有一层菜单。

 • 每一个菜单项中都包括了来决定这个菜单项的外观和行为的field,基于菜单的控件支持这些field:定义label text,icon,菜单项的type,和菜单项的status。

About menu data providers

 基于菜单控件的dataProvider属性具体指定了一个对象,这个对象定义了菜单的结构和内容。如果一个菜单的内容是动态的,你可以通过修改它的data Provider 来改变这个菜单显示内容,菜单控件通常是从具有一定层次的data provider中获得它需要的数据,比如从嵌套的对象数组中,或者一个XML对象。如果这个菜单展示了一个动态变化的数据,你使用实现了ICollectionView接口的对象,比如ArrayCollection 和 XMLListCollection.

菜单控件使用data descriptor来解析和使用data provider中的内容,默认情况下,菜单控件使用DefaultDataDescriptor类作为它的data descriptor,但是你可以创建一个你自己的类然后把它指定给Menu控件的dataDescriptor属性。

DefaultDataDescriptor类支持如下的数据类型:

XML A string that contains valid XML text, or any of the following objects containing valid E4X format XML data:
an <mx:XML> or <mx:XMLList> compile-time tag, or an XML or XMLList object.
Other objects An array of items, or an object that contains an array of items, where a node’s children are contained
in an item named children. You can also use the <mx:Model> compile-time tag to create nested objects that
support data binding, but you must follow the structure defined in “Using the <mx:Model> tag with Tree and
menu-based controls” on page 171.
Collections An object that implements the ICollectionView interface (such as the ArrayCollection or XMLList-
Collection classes) and whose data source conforms to the structure specified in either of the previous bullets. The
DefaultDataDescriptor class includes code to handle collections efficiently. Always use a collection as the data
provider if the data in the menu changes dynamically; otherwise, the Menu displays obsolete data.
For more information on hierarchical objects and data descriptors, including a detailed description of the formats
supported by the DefaultDataDescriptor, see “Data descriptors and hierarchical data structure” on page 168.
As with all data-driven controls, if the data provider contents can change dynamically, and you want the Menu to
update with the changes, ensure that the data source is a collection, such as an ArrayCollection or XMLListCol-
lection object. To modify the menu, change the underlying collection, and the menu will update its appearance
accordingly.
Node (menu item) tags in the XML data can have any name. Many examples in this topic use tags such as <node>
for all menu items, or <menuItem> for top-level items and <subMenuItem> for submenu items, but it might be
more realistic to use tag names that identify the data, such as <person>, <address>, and so on. The menu-
handling code reads through the XML and builds the display hierarchy based on the nested relationship of the
nodes. For more information, see “Specifying and using menu entry information” on page 349.
Most menus have multiple items at the top level, not a single root item. XML objects, such as the XML object
created by the <mx:XML> tag, must have a single root node. To display a menu that uses a data provider that has a
root that you do not want to display, set the Menu, PopUpMenuButton, or MenuBar showRoot property to false.

 

 指定和使用menu entry信息

       菜单控件的data provider中的信息决定了每一个menu entry 是怎样被显示和被使用的,为了能够访问或者改变菜单的内容,你修改data provider中的内容,基于菜单控件的类使用IMenuDataDescriptor中的接口来访问和控制那个定义了菜单行为和内容的data provider中的信息,Flex提供了DefaultDataDescriptor类实现了该接口,基于菜单的控件将会使用DefaultDataDescriptor类如果你没有设置dataDescriptor属性。

 

Menu entry types

每一个data provider的条目都能指定关于这个menu item的item 类型和特定的类型信息。基于菜单控件的类支持如下的item类型(指定type域的值如type:normal):
normal (the default) Selecting an item with the normal type triggers a change event, or, if the item has children,
opens a submenu.
check Selecting an item with the check type toggles the menu item’s toggled property between true and false
values. When the menu item is in the true state, it displays a check mark in the menu next to the item’s label.
radio Items with the radio type operate in groups, much like RadioButton controls; you can select only one
radio menu item in each group at a time. The example in this section defines three submenu items as radio buttons
within the group “one”.
When a radio button is selected, the radio item’s toggled property is set to true, and the toggled properties of
all other radio items in the group are set to false. The Menu control displays a solid circle next to the radio button
that is currently selected. The selection property of the radio group is set to the label of the selected menu item.
separator(分割线)  Items with the separator type provide a simple horizontal line that divides the items in a menu into different visual groups.

 

菜单的属性

菜单项可以指定一些能够决定how the item is displayed and behaves的属性,下面的表格列出了你可以指定的属性,比如它们的data types,它们的purpose,还有,如果菜单使用DefaultDataDescriptor类来解析data provider,data provider该怎样表示它们。

 

 

Attribute

Type

Description

enabled

Boolean

Specifies whether the user can select the menu item (true), or not (false). If not specified, Flex treats the item as if the value were true.

If you use the default data descriptor, data providers must use an enabled XML attribute or object field to specify this characteristic.

groupName

String

(Required, and meaningful, for radio type only) The identifier that associates radio button items in a radio group. If you use the default data descriptor, data providers must use a groupName XML attribute or object field to specify this characteristic.

icon

Class

Specifies the class identifier of an image asset. This item is not used for the check, radio, or separator types. You can use the checkIcon and radioIcon styles to specify the icons used for radio and check box items that are selected.

The menu’s iconField or iconFunction property determines the name of the field in the data that specifies the icon, or a function for determining the icons.

label

String

Specifies the text that appears in the control. This item is used for all menu item types except separator.

The menu’s labelField or labelFunction property determines the name of the field in the data that specifies the label, or a function for determining the labels. (If the data provider is in E4X XML format, you must specify one of these properties to display a label.) If the data provider is an array of strings, Flex uses the string value as the label.

toggled

Boolean

Specifies whether a check or radio item is selected. If not specified, Flex treats the item as if the value were false and the item is not selected.

If you use the default data descriptor, data providers must use a toggled XML attribute or object field to specify this characteristic.

type

String

Specifies the type of menu item. Meaningful values are separator, check, or radio. Flex treats all othevalues, or nodes with no type entry, as normal menu entries.

If you use the default data descriptor, data providers must use a type XML attribute or object field to specify this characteristic.

Menu-based controls ignore all other object fields or XML attributes, so you can use them for application-specific
data.

 

举例:使用数组作为menu的 data provider 

 

 效果如下:

 

举例:用XML作为菜单数据data provider并带有icons

下面的例子用XML作为menu控件的数据提供器,并且为菜单中项指定了自定义icon:

  

 

 

 

### 关于NRFreqBandList、NRFreqBandInformation、bandInformationEUTRA和bandInformationNR的详细信息 #### 定义与结构说明 `NRFreqBandList` 是一个列表,用于描述支持的频率范围集合。该列表中的每一项是一个 `NRFreqBandInformation` 结构体,表示特定频段的相关参数配置。 - **NRFreqBandInformation**: 这一数据结构定义了一个具体的频段及其关联的信息。其中包括频段标识符(如 EUTRA 或 NR 的频段编号)、工作频率范围以及其他必要的物理层参数[^1]。 - **bandInformationEUTRA**: 此字段属于 `NRFreqBandInformation` 中的一部分,专门用来描述与 EUTRA(演进通用陆地无线接入)相关的频段特性。它通常包括频段号以及可能的载波带宽等细节[^2]。 - **bandInformationNR**: 类似于 `bandInformationEUTRA`,但它专注于第五代移动通信系统 (5G New Radio, NR) 所需的具体参数设置。这可以涉及更高的频率范围和支持更大的信道宽度以满足更高吞吐量的要求。 #### 对应频段配置概述 根据 3GPP Release 15 标准文档的规定: - **EUTRA 频段** (`bandEUTRA`) 主要集中在较低至中等频率范围内操作,典型值从 Band 1 到 Band 46 不等,覆盖约 70 MHz 至接近 6 GHz 的区域[^2]。 - **NR 频段** (`bandInformationNR`) 能够扩展到毫米波领域,不仅涵盖了 Sub-6GHz 层面的传统频谱分配方案,还新增了许多超高频频段选项来实现极高速率传输目标。具体而言,在 FR1 (Frequency Range 1 即 sub-6GHz)中有 n1 至 n84 多种可能性;而在 FR2 下则有更广泛的划分比如 n257-n261 等代表不同中心频率位置及相应带宽大小的选择[^1]. 以下是部分常见频段的例子展示如何利用这些概念构建实际应用环境下的网络规划模型: ```python class FreqBandInfo: def __init__(self, band_id, freq_range_mhz): self.band_id = band_id self.freq_range_mhz = freq_range_mhz # Example of defining bands based on the information provided. bands_eutra = [ FreqBandInfo('n1', [1920, 2170]), # Corresponding to E-UTRA Band 1 FreqBandInfo('n3', [1710, 1880]) # Corresponding to E-UTRA Band 3 ] bands_nr_fr1 = [ FreqBandInfo('n77', [3300, 4200]), FreqBandInfo('n78', [3300, 3800]) ] bands_nr_fr2 = [ FreqBandInfo('n257', [24250, 25000]), FreqBandInfo('n261', [27500, 28350]) ] ``` 以上代码片段展示了如何创建简单的 Python 类对象来模拟存储各种类型的频段信息的方式方法之一. #### 总结 综上所述,理解并正确运用像 `NRFreqBandList`, `NRFreqBandInformation`, `bandInformationEUTRA` 和 `bandInformationNR`这样的术语对于设计兼容性强且高效的现代蜂窝通讯基础设施至关重要。它们共同构成了复杂但灵活可调制解调器平台的基础框架,使得设备制造商和服务提供商能够更好地适应不断变化的技术需求和发展趋势。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值