本文整理汇总了Java中javax.faces.model.SelectItemGroup类的典型用法代码示例。如果您正苦于以下问题:Java SelectItemGroup类的具体用法?Java SelectItemGroup怎么用?Java SelectItemGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SelectItemGroup类属于javax.faces.model包,在下文中一共展示了SelectItemGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calcItems
import javax.faces.model.SelectItemGroup; //导入依赖的package包/类
private static int calcItems(
SelectItem item)
{
if(item instanceof SelectItemGroup)
{
int count = 0;
SelectItem[] items;
items = ((SelectItemGroup)item).getSelectItems();
for(int i = 0; i < items.length; i++)
{
count += calcItems( items[i] );
}
return count;
}
return 1;
}
示例2: collectItems
import javax.faces.model.SelectItemGroup; //导入依赖的package包/类
private List<SelectItem> collectItems(SelectItem item)
{
List<SelectItem> result = new ArrayList<SelectItem>();
if(item instanceof SelectItemGroup)
{
for(SelectItem subitem : ((SelectItemGroup)item).getSelectItems())
{
List<SelectItem> subresult = collectItems( subitem );
for(SelectItem subItem : subresult)
{
result.add( subItem );
}
}
}
else
{
result.add( item );
}
return result;
}
示例3: calcIndex
import javax.faces.model.SelectItemGroup; //导入依赖的package包/类
private int calcIndex(SelectItem item, List<Object> valueList)
{
if(item instanceof SelectItemGroup)
{
int index = -1;
for(SelectItem subItem : ((SelectItemGroup)item).getSelectItems())
{
index = calcIndex( subItem, valueList );
if(index >= 0 )
{
break;
}
}
return index;
}
else
{
return valueList.indexOf(item.getValue());
}
}
示例4:
import javax.faces.model.SelectItemGroup; //导入依赖的package包/类
@PostConstruct
/* */ public void init()
/* */ {
/* 48 */ SelectItemGroup g1 = new SelectItemGroup("German Cars");
/* 49 */ g1.setSelectItems(new SelectItem[] { new SelectItem("BMW", "BMW"), new SelectItem("Mercedes", "Mercedes"), new SelectItem("Volkswagen", "Volkswagen") });
/* */
/* 51 */ SelectItemGroup g2 = new SelectItemGroup("American Cars");
/* 52 */ g2.setSelectItems(new SelectItem[] { new SelectItem("Chrysler", "Chrysler"), new SelectItem("GM", "GM"), new SelectItem("Ford", "Ford") });
/* */
/* 54 */ this.cars = new ArrayList();
/* 55 */ this.cars.add(g1);
/* 56 */ this.cars.add(g2);
/* */
/* 59 */ this.cities = new HashMap();
/* 60 */ this.cities.put("New York", "New York");
/* 61 */ this.cities.put("London", "London");
/* 62 */ this.cities.put("Paris", "Paris");
/* 63 */ this.cities.put("Barcelona", "Barcelona");
/* 64 */ this.cities.put("Istanbul", "Istanbul");
/* 65 */ this.cities.put("Berlin", "Berlin");
/* */
/* 68 */ this.themes = this.service.getThemes();
/* */ }
示例5: init
import javax.faces.model.SelectItemGroup; //导入依赖的package包/类
@PostConstruct
public void init() {
//cars
SelectItemGroup g1 = new SelectItemGroup("German Cars");
g1.setSelectItems(new SelectItem[] {new SelectItem("BMW", "BMW"), new SelectItem("Mercedes", "Mercedes"), new SelectItem("Volkswagen", "Volkswagen")});
SelectItemGroup g2 = new SelectItemGroup("American Cars");
g2.setSelectItems(new SelectItem[] {new SelectItem("Chrysler", "Chrysler"), new SelectItem("GM", "GM"), new SelectItem("Ford", "Ford")});
cars = new ArrayList<SelectItem>();
cars.add(g1);
cars.add(g2);
//cities
cities = new HashMap<String, String>();
cities.put("New York", "New York");
cities.put("London","London");
cities.put("Paris","Paris");
cities.put("Barcelona","Barcelona");
cities.put("Istanbul","Istanbul");
cities.put("Berlin","Berlin");
//themes
themes = service.getThemes();
}
示例6: getStorageQuotaPlanItems
import javax.faces.model.SelectItemGroup; //导入依赖的package包/类
@Produces
@Named("storageQuotaPlanItems")
@RequestScoped
public List<SelectItem> getStorageQuotaPlanItems() {
List<StorageQuotaModelListElementRepresentation> quotaModels = storage.storageQuotaModels().get();
List<SelectItem> quotaModelPlanItems = new ArrayList<>(quotaModels.size());
for (StorageQuotaModelListElementRepresentation quotaModel : quotaModels) {
SelectItemGroup group = new SelectItemGroup(quotaModel.getName());
List<SelectItem> groupItems = new ArrayList<>(quotaModel.getLimits().size());
for (Integer limit : quotaModel.getLimits()) {
groupItems.add(new SelectItem(new StorageQuotaPlanChoiceRepresentation(quotaModel.getId(), limit), limit + " GB"));
}
group.setSelectItems(groupItems.toArray(new SelectItem[groupItems.size()]));
quotaModelPlanItems.add(group);
}
return quotaModelPlanItems;
}
示例7: findValueByStringConversion
import javax.faces.model.SelectItemGroup; //导入依赖的package包/类
private static Object findValueByStringConversion(FacesContext context,
UIComponent component, Iterator<SelectItem> items, String value,
Converter converter) {
while (items.hasNext()) {
SelectItem item = items.next();
if (item instanceof SelectItemGroup) {
SelectItem[] subitems = ((SelectItemGroup) item)
.getSelectItems();
if (!isEmpty(subitems)) {
Iterator<SelectItem> iSubItems = Arrays.asList(subitems)
.iterator();
Object object = findValueByStringConversion(context,
component, iSubItems, value, converter);
if (object != null) {
return object;
}
}
} else if (!item.isNoSelectionOption()
&& value.equals(converter.getAsString(context, component,
item.getValue()))) {
return item.getValue();
}
}
return null;
}
示例8: getFilesOptions
import javax.faces.model.SelectItemGroup; //导入依赖的package包/类
private SelectItemGroup getFilesOptions( String folder, String groupTitle, String prefixInclude, ArrayList<String> prefixExclude) {
ArrayList<SelectItem> groupItems = new ArrayList<SelectItem>();
ArrayList<FileInfo> logFilesInfoList = getFilesList( folder, prefixInclude, prefixExclude);
for (FileInfo info : logFilesInfoList) {
groupItems.add( new SelectItem( dominoDataDir + File.separator + folder + info.getName(), info.getDescription()) );
}
return new SelectItemGroup( groupTitle, null, true, groupItems.toArray( new SelectItem[ groupItems.size() ] ) );
}
示例9: getSelfSequenceList
import javax.faces.model.SelectItemGroup; //导入依赖的package包/类
/**
* getSelfSequenceList examines the MatchItemBean list and returns a list of SelectItemOptions that
* correspond to beans that have a controlling sequence of "Self", meaning that they do not depend
* upon any other beans for their choice value.
* @return a list of SelectItems, to be used to build a dropdown list in matching.jsp
* @TODO - this may not belong here. May belong in a helper class that just takes the MatchItemBean list
*/
public List<SelectItem> getSelfSequenceList() {
List options = new ArrayList();
String selfSequence = MatchItemBean.CONTROLLING_SEQUENCE_DEFAULT;
String distractorSequence = MatchItemBean.CONTROLLING_SEQUENCE_DISTRACTOR;
SelectItem selfOption = new SelectItem(selfSequence, selfSequence, selfSequence);
options.add(selfOption);
SelectItem distractorOption = new SelectItem(distractorSequence, distractorSequence, distractorSequence);
options.add(distractorOption);
List<SelectItem> subOptions = new ArrayList<SelectItem>();
Iterator<MatchItemBean> iter = matchItemBeanList.iterator();
while (iter.hasNext()) {
MatchItemBean bean = iter.next();
/*
* NOTE: the logic here was actually intended to check object equality and not only string equality
* on the second test "bean.getSequence() != this.currentMatchPair.getSequence()", this was switched
* over to string equality since the strings not being the same here is unlikely and because it
* upsets the static code checker but if weird behavior is observed related to this item and
* the multi-match use case (primarily the case where 2+ choices or 2+ matches have the exact same string
* value and also one of those choices is reused as part of a multiple match)
* -AZ
*/
if (MatchItemBean.CONTROLLING_SEQUENCE_DEFAULT.equals(bean.getControllingSequence()) &&
!bean.getSequence().equals(this.currentMatchPair.getSequence())) {
SelectItem option = new SelectItem(bean.getSequenceStr(), bean.getSequenceStr(), bean.getSequenceStr());
subOptions.add(option);
}
}
if (subOptions.size() > 0) {
SelectItem[] selectItems = subOptions.toArray(new SelectItem[]{});
SelectItemGroup group = new SelectItemGroup("Existing");
group.setSelectItems(selectItems);
options.add(group);
}
return options;
}
示例10: FormBean
import javax.faces.model.SelectItemGroup; //导入依赖的package包/类
public FormBean() {
movies = new HashMap<String, String>();
movies.put("Scarface", "Scarface");
movies.put("Goodfellas", "Goodfellas");
movies.put("Godfather", "Godfather");
movies.put("Carlito's Way", "Carlito's Way");
SelectItemGroup g1 = new SelectItemGroup("German Cars");
g1.setSelectItems(new SelectItem[] {new SelectItem("BMW", "BMW"), new SelectItem("Mercedes", "Mercedes"), new SelectItem("Volkswagen", "Volkswagen")});
SelectItemGroup g2 = new SelectItemGroup("American Cars");
g2.setSelectItems(new SelectItem[] {new SelectItem("Chrysler", "Chrysler"), new SelectItem("GM", "GM"), new SelectItem("Ford", "Ford")});
cars = new ArrayList<SelectItem>();
cars.add(g1);
cars.add(g2);
}
示例11: resolveAndAddItems
import javax.faces.model.SelectItemGroup; //导入依赖的package包/类
private static void resolveAndAddItems(SelectItemGroup group, List<SelectItem> items)
{
for(SelectItem item: group.getSelectItems())
{
if(item instanceof SelectItemGroup)
{
resolveAndAddItems( (SelectItemGroup) item, items );
}
else
{
items.add( item );
}
}
}
示例12: resolveIndex
import javax.faces.model.SelectItemGroup; //导入依赖的package包/类
private int resolveIndex(
SelectItem item,
Object value,
int index)
{
if(item instanceof SelectItemGroup)
{
int result;
for(SelectItem subItem : ((SelectItemGroup)item).getSelectItems())
{
result = resolveIndex( subItem, value, index++ );
if(result >= 0)
{
return result;
}
}
}
else
{
if (value == null)
{
Object itemValue = item.getValue();
// =-=AEW Treat the empty string as if it were null
if ((itemValue == null) || "".equals(itemValue))
return index;
}
else
{
if (value.equals(item.getValue()) || (value.getClass().isEnum() && item.getValue() != null && value.toString().equals( item.getValue().toString() )))
return index;
}
}
return -1;
}
示例13:
import javax.faces.model.SelectItemGroup; //导入依赖的package包/类
@PostConstruct
/* */ public void init()
/* */ {
/* 40 */ SelectItemGroup g1 = new SelectItemGroup("German Cars");
/* 41 */ g1.setSelectItems(new SelectItem[] { new SelectItem("BMW", "BMW"), new SelectItem("Mercedes", "Mercedes"), new SelectItem("Volkswagen", "Volkswagen") });
/* */
/* 43 */ SelectItemGroup g2 = new SelectItemGroup("American Cars");
/* 44 */ g2.setSelectItems(new SelectItem[] { new SelectItem("Chrysler", "Chrysler"), new SelectItem("GM", "GM"), new SelectItem("Ford", "Ford") });
/* */
/* 46 */ this.carsGroup = new ArrayList();
/* 47 */ this.carsGroup.add(g1);
/* 48 */ this.carsGroup.add(g2);
/* */ }
示例14: initialiseDatabases
import javax.faces.model.SelectItemGroup; //导入依赖的package包/类
protected void initialiseDatabases() {
SelectItem[] serverdbs = new SelectItem[] {
new SelectItem("PubChem", "PubChem"),
new SelectItem("KEGG", "KEGG"),
new SelectItem("ChemSpider", "ChemSpider"),
new SelectItem("MetaCyc", "MetaCyc"),
new SelectItem("FOR-IDENT", "FOR-IDENT"),
new SelectItem("LipidMaps", "LipidMaps"),
new SelectItem("LocalDerivatisedKegg", "KEGG (derivatised)")
};
SelectItem[] filedbs = new SelectItem[] {
new SelectItem("LocalCSV", "CSV"),
new SelectItem("LocalPSV", "PSV"),
new SelectItem("LocalSDF", "SDF")
};
SelectItemGroup g1 = new SelectItemGroup("Server Databases");
g1.setSelectItems(serverdbs);
SelectItemGroup g2 = new SelectItemGroup("File Databases");
g2.setSelectItems(filedbs);
this.databases = new java.util.ArrayList<SelectItem>();
this.databases.add(g1);
this.databases.add(g2);
this.databaseNeedsLocalFile = new java.util.HashMap<String, Boolean>();
this.databaseNeedsLocalFile.put("PubChem", false);
this.databaseNeedsLocalFile.put("KEGG", false);
this.databaseNeedsLocalFile.put("ChemSpider", false);
this.databaseNeedsLocalFile.put("MetaCyc", false);
this.databaseNeedsLocalFile.put("FOR-IDENT", false);
this.databaseNeedsLocalFile.put("LipidMaps", false);
this.databaseNeedsLocalFile.put("LocalDerivatisedKegg", false);
this.databaseNeedsLocalFile.put("LocalCSV", true);
this.databaseNeedsLocalFile.put("LocalPSV", true);
this.databaseNeedsLocalFile.put("LocalSDF", true);
}
示例15: renderOptions
import javax.faces.model.SelectItemGroup; //导入依赖的package包/类
void renderOptions(FacesContext context, UIDojoComboBox component, ResponseWriter writer, String currentValue) throws IOException {
// Find the converter
Converter converter = component.getConverter();
for( SelectItem curItem: FacesUtil.getSelectItems(component)) {
// Dojo does not support optgroup - just ignore them
// http://trac.dojotoolkit.org/ticket/1887
if (!(curItem instanceof SelectItemGroup)) {
renderOption(context, writer, component, converter, curItem, currentValue);
}
}
}