SelectItemGroup (Java EE 5)

Java EE API


javax.faces.model Class SelectItemGroup

java.lang.Object
  extended by javax.faces.model.SelectItem
      extended by javax.faces.model.SelectItemGroup
All Implemented Interfaces:
Serializable

public class SelectItemGroup
extends SelectItem

Extends: SelectItem

SelectItemGroupSelectItem 的子类,它标识将用作从属“子菜单”或“选项列表”的一组选项,具体取决于实际使用的 UISelectManyUISelectOne Renderer 的要求。通常,此实例的 value 属性将被忽略,而其 label 属性将用作子菜单的标签。

尽管可以将 SelectItemGroup 实例合并到此实例的 selectItems 属性(据以创建一个适合级联子菜单的数据结构),但是一些 Renderer 可能限制支持的嵌套层次。例如,创建 <select> 元素的基于 HTML 的 Renderer 通常将此实例呈现为 <optgroup> 元素,但是 HTML 4.01 规范不允许选项组嵌套。

英文文档:

SelectItemGroup is a subclass of SelectItem that identifies a set of options that will be made available as a subordinate "submenu" or "options list", depending upon the requirements of the UISelectMany or UISelectOne renderer that is actually used. In general, the value property of this instance will be ignored, and the label property of this instance will be used to label the submenu.

Although it is feasible to incorporate SelectItemGroup instances in he selectItems property of this instance (thereby creating a data structure suitable for cascading submenus), some renderers may place restrictions on the level of nesting they support. For example, HTML based renderers that create an <select> element will typically render this instance as an <optgroup> element, but the HTML 4.01 Specification disallows nested option groups.

See Also:
Serialized Form

Constructor Summary
 
Method Summary
 SelectItem[]
 void
 
Methods inherited from class javax.faces.model.SelectItem
 
Methods inherited from class java.lang.Object
 

Constructor Detail

public SelectItemGroup()

构造一个 SelectItemGroup,没有初始化任何属性值。

英文文档:

SelectItemGroup

public SelectItemGroup()

Construct a SelectItemGroup with no initialized property values.


public SelectItemGroup(String label)

构造带指定标签并且没有关联 selectItemSelectItemGroupvalue 属性将设置为长度为 0 的 String,description 属性将被设置为 nulldisabled 属性将被设置为 false。

label 响应时要为该组呈现的标签
ThrowsNullPointerException: 如果 labelfalse
英文文档:

SelectItemGroup

public SelectItemGroup(String label)

Construct a SelectItemGroup with the specified label and no associated selectItems. The value property will be set to a zero-length String, the description property will be set to null, and the disabled property will be set to false.

Parameters:
label - Label to be rendered for this group in the response
Throws:
NullPointerException - if label is false


public SelectItemGroup(String label, String description, boolean disabled, SelectItem[] selectItems)

构造带指定属性的 SelectItemGroupvalue 属性将被设置为长度为 0 的 String。

label 响应时要为该组呈现的标签
description 此组的描述,在工具中使用
disabled 指示此组已禁用的标志
selectItems 描述此组中可用条目的 SelectItem 数组
ThrowsNullPointerException: 如果 labelselectItemsfalse
英文文档:

SelectItemGroup

public SelectItemGroup(String label,
                       String description,
                       boolean disabled,
                       SelectItem[] selectItems)

Construct a SelectItemGroup with the specified properties. The value property will be set to a zero-length String.

Parameters:
label - Label to be rendered for this group in the response
description - Description of this group, for use in tools
disabled - Flag indicating that this group is disabled
selectItems - Array of SelectItem describing the items available in this group
Throws:
NullPointerException - if label or selectItems is false

Method Detail

public SelectItem[] getSelectItems()

返回此组的从属 SelectItem 集。

英文文档:

getSelectItems

public SelectItem[] getSelectItems()

Return the set of subordinate SelectItems for this group.


public void setSelectItems(SelectItem[] selectItems)

设置此组的从属 SelectItem 集。

selectItems 新的从属条目集
ThrowsNullPointerException: 如果 selectItemsnull
英文文档:

setSelectItems

public void setSelectItems(SelectItem[] selectItems)

Set the set of subordinate SelectItems for this group.

Parameters:
selectItems - The new set of subordinate items
Throws:
NullPointerException - if selectItems is null


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!