本文整理汇总了Java中javax.faces.model.SelectItemGroup.setSelectItems方法的典型用法代码示例。如果您正苦于以下问题:Java SelectItemGroup.setSelectItems方法的具体用法?Java SelectItemGroup.setSelectItems怎么用?Java SelectItemGroup.setSelectItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.faces.model.SelectItemGroup
的用法示例。
在下文中一共展示了SelectItemGroup.setSelectItems方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1:
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();
/* */ }
示例2: 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();
}
示例3: 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;
}
示例4: 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;
}
示例5: 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);
}
示例6:
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);
/* */ }
示例7: 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);
}
示例8:
import javax.faces.model.SelectItemGroup; //导入方法依赖的package包/类
@PostConstruct
/* */ public void init()
/* */ {
/* 33 */ this.categories = new ArrayList();
/* 34 */ SelectItemGroup group1 = new SelectItemGroup("Group 1");
/* 35 */ SelectItemGroup group2 = new SelectItemGroup("Group 2");
/* 36 */ SelectItemGroup group3 = new SelectItemGroup("Group 3");
/* 37 */ SelectItemGroup group4 = new SelectItemGroup("Group 4");
/* */
/* 39 */ SelectItemGroup group11 = new SelectItemGroup("Group 1.1");
/* 40 */ SelectItemGroup group12 = new SelectItemGroup("Group 1.2");
/* */
/* 42 */ SelectItemGroup group21 = new SelectItemGroup("Group 2.1");
/* */
/* 44 */ SelectItem option31 = new SelectItem("Option 3.1", "Option 3.1");
/* 45 */ SelectItem option32 = new SelectItem("Option 3.2", "Option 3.2");
/* 46 */ SelectItem option33 = new SelectItem("Option 3.3", "Option 3.3");
/* 47 */ SelectItem option34 = new SelectItem("Option 3.4", "Option 3.4");
/* */
/* 49 */ SelectItem option41 = new SelectItem("Option 4.1", "Option 4.1");
/* */
/* 51 */ SelectItem option111 = new SelectItem("Option 1.1.1");
/* 52 */ SelectItem option112 = new SelectItem("Option 1.1.2");
/* 53 */ group11.setSelectItems(new SelectItem[] { option111, option112 });
/* */
/* 55 */ SelectItem option121 = new SelectItem("Option 1.2.1", "Option 1.2.1");
/* 56 */ SelectItem option122 = new SelectItem("Option 1.2.2", "Option 1.2.2");
/* 57 */ SelectItem option123 = new SelectItem("Option 1.2.3", "Option 1.2.3");
/* 58 */ group12.setSelectItems(new SelectItem[] { option121, option122, option123 });
/* */
/* 60 */ SelectItem option211 = new SelectItem("Option 2.1.1", "Option 2.1.1");
/* 61 */ group21.setSelectItems(new SelectItem[] { option211 });
/* */
/* 63 */ group1.setSelectItems(new SelectItem[] { group11, group12 });
/* 64 */ group2.setSelectItems(new SelectItem[] { group21 });
/* 65 */ group3.setSelectItems(new SelectItem[] { option31, option32, option33, option34 });
/* 66 */ group4.setSelectItems(new SelectItem[] { option41 });
/* */
/* 68 */ this.categories.add(group1);
/* 69 */ this.categories.add(group2);
/* 70 */ this.categories.add(group3);
/* 71 */ this.categories.add(group4);
/* */ }
示例9: initialisePrecusorModes
import javax.faces.model.SelectItemGroup; //导入方法依赖的package包/类
protected void initialisePrecusorModes() {
int numberPositive = 0;
int numberNegative = 0;
for(int i = 0; i < Constants.ADDUCT_NAMES.size(); i++) {
if(Constants.ADDUCT_NAMES.get(i).equals("-D") || Constants.ADDUCT_NAMES.get(i).equals("+D")) continue;
if(Constants.ADDUCT_NOMINAL_MASSES.get(i) == 0) continue;
if(Constants.ADDUCT_CHARGES.get(i)) numberPositive++;
else numberNegative++;
}
SelectItem[] positiveAdducts = new SelectItem[numberPositive + 1];
SelectItem[] negativeAdducts = new SelectItem[numberNegative + 1];
int indexPositive = 1;
int indexNegative = 1;
for(int i = 0; i < Constants.ADDUCT_NAMES.size(); i++) {
if(Constants.ADDUCT_NAMES.get(i).equals("-D") || Constants.ADDUCT_NAMES.get(i).equals("+D")) continue;
if(Constants.ADDUCT_NOMINAL_MASSES.get(i) == 0) continue;
String label = "[M" + Constants.ADDUCT_NAMES.get(i) + "]";
boolean positive = true;
if(Constants.ADDUCT_CHARGES.get(i)) label += "+";
else {
label += "-";
positive = false;
}
if(positive) {
positiveAdducts[indexPositive] = new SelectItem(Constants.ADDUCT_NOMINAL_MASSES.get(i), label);
indexPositive++;
}
else {
negativeAdducts[indexNegative] = new SelectItem(Constants.ADDUCT_NOMINAL_MASSES.get(i), label);
indexNegative++;
}
}
positiveAdducts[0] = new SelectItem(1000, "[M]+");
negativeAdducts[0] = new SelectItem(-1000, "[M]-");
SelectItemGroup g1 = new SelectItemGroup("Positive");
g1.setSelectItems(positiveAdducts);
SelectItemGroup g2 = new SelectItemGroup("Negative");
g2.setSelectItems(negativeAdducts);
this.precursorModes = new java.util.ArrayList<SelectItem>();
this.precursorModes.add(g1);
this.precursorModes.add(g2);
}
示例10: init
import javax.faces.model.SelectItemGroup; //导入方法依赖的package包/类
@SuppressWarnings("restriction")
@PostConstruct
public void init() {
countries.put("UK", "UK");
countries.put("US", "US");
countries.put("India", "India");
countries.put("Germany", "Germany");
Map<String, String> citiesUK = new HashMap<String, String>();
citiesUK.put("London", "London");
citiesUK.put("Bristol", "Bristol");
citiesUK.put("Derby", "Derby");
Map<String, String> citiesUS = new HashMap<String, String>();
citiesUS.put("Newyork", "Newyork");
citiesUS.put("California", "California");
citiesUS.put("Washington", "Washington");
Map<String, String> citiesIndia = new HashMap<String, String>();
citiesIndia.put("Delhi", "Delhi");
citiesIndia.put("Chennai", "Chennai");
citiesIndia.put("Banglore", "Banglore");
Map<String, String> citiesGermany = new HashMap<String, String>();
citiesGermany.put("Berlin", "Berlin");
citiesGermany.put("Hamburg", "Hamburg");
citiesGermany.put("Bavaria", "Bavaria");
citiesData.put("UK", citiesUK);
citiesData.put("US", citiesUS);
citiesData.put("India", citiesIndia);
citiesData.put("Germany", citiesGermany);
allFrameworks.add("JSF");
allFrameworks.add("Spring");
allFrameworks.add("Struts");
allFrameworks.add("Grails");
allDBs.add("Oracle");
allDBs.add("MySQL");
allDBs.add("SQLServer");
allDBs.add("DB2");
allIDEs.add("Eclipse");
allIDEs.add("NetBeans");
allIDEs.add("Intellij");
allIDEs.add("JDeveloper");
allServers = new ArrayList<SelectItem>();
SelectItemGroup group1 = new SelectItemGroup("Application Servers");
SelectItemGroup group2 = new SelectItemGroup("Web servers");
SelectItemGroup group11 = new SelectItemGroup("Open source");
SelectItemGroup group12 = new SelectItemGroup("Proprietary");
SelectItemGroup group21 = new SelectItemGroup("Open source");
SelectItem option111 = new SelectItem("Glassfish");
SelectItem option112 = new SelectItem("Jboss");
SelectItem option113 = new SelectItem("TomEE");
group11.setSelectItems(new SelectItem[] { option111, option112,
option113 });
SelectItem option121 = new SelectItem("Wellogic");
SelectItem option122 = new SelectItem("Websphere");
group12.setSelectItems(new SelectItem[] { option121, option122 });
SelectItem option211 = new SelectItem("Tomcat");
SelectItem option222 = new SelectItem("Jetty");
SelectItem option223 = new SelectItem("Resin");
group21.setSelectItems(new SelectItem[] { option211, option222,
option223 });
group1.setSelectItems(new SelectItem[] { group11, group12 });
group2.setSelectItems(new SelectItem[] { group21 });
allServers.add(group1);
allServers.add(group2);
}