本文整理汇总了Java中javax.faces.model.SelectItem类的典型用法代码示例。如果您正苦于以下问题:Java SelectItem类的具体用法?Java SelectItem怎么用?Java SelectItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SelectItem类属于javax.faces.model包,在下文中一共展示了SelectItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initServiceInstanceRows
import javax.faces.model.SelectItem; //导入依赖的package包/类
private List<ServiceInstanceRow> initServiceInstanceRows()
throws ServiceInstanceException {
List<ServiceInstance> serviceInstances = getServiceInstanceService()
.getInstancesForController(getControllerId());
List<ServiceInstanceRow> result = new ArrayList<>();
if (serviceInstances == null) {
return result;
}
for (ServiceInstance serviceInstance : serviceInstances) {
List<SelectItem> selectableOperations = initSelectableOperaions(
serviceInstance);
ServiceInstanceRow row = new ServiceInstanceRow(serviceInstance,
selectableOperations);
result.add(row);
}
return result;
}
示例2: _isNothingSelected
import javax.faces.model.SelectItem; //导入依赖的package包/类
private boolean _isNothingSelected(
UIComponent component,
List<SelectItem> selectItems)
{
// Assume the component is a value holder
Object value = ((ValueHolder) component).getValue();
if (value == null)
return true;
// now check if none of the items' values match the value.
int size = selectItems.size();
for (int i=0; i < size; i++)
{
SelectItem item = selectItems.get(i);
if (value.equals(item.getValue()))
return false;
}
return true;
}
示例3: initSets
import javax.faces.model.SelectItem; //导入依赖的package包/类
private void initSets() {
collidingProbandStatusEntryModelCache.clear();
visitScheduleItemModel.setTrialId(in.getTrialId());
visitScheduleItemModel.updateRowCount();
visits = WebUtil.getVisits(in.getTrialId());
probandGroups = WebUtil.getProbandGroups(in.getTrialId());
filterProbandGroups = new ArrayList<SelectItem>(probandGroups);
filterProbandGroups.add(0, new SelectItem(CommonUtil.NO_SELECTION_VALUE, ""));
filterVisits = new ArrayList<SelectItem>(visits);
filterVisits.add(0, new SelectItem(CommonUtil.NO_SELECTION_VALUE, ""));
matrix.initPages();
// loadMatrix();
trial = WebUtil.getTrial(this.in.getTrialId());
if (WebUtil.isTrialLocked(trial)) {
Messages.addLocalizedMessage(FacesMessage.SEVERITY_WARN, MessageCodes.TRIAL_LOCKED);
}
}
示例4: getItemValue
import javax.faces.model.SelectItem; //导入依赖的package包/类
/**
* Return the value to output for an item.
*/
static public Object getItemValue(
FacesContext context,
UIComponent component,
SelectItem item,
Converter converter,
boolean valuePassThru,
int index)
{
if (!valuePassThru)
{
return IntegerUtils.getString(index);
}
else
{
Object itemValue = item.getValue();
if ((itemValue != null) && (converter != null))
{
itemValue = converter.getAsString(context,
component,
itemValue);
}
return itemValue;
}
}
示例5: getAsObject
import javax.faces.model.SelectItem; //导入依赖的package包/类
@Override
public Object getAsObject(FacesContext facesContext, UIComponent component, String submittedValue) {
// if (submittedValue.trim().equals(CommonUtil.NO_SELECTION_VALUE)) {
// return null;
// } else {
// http://stackoverflow.com/questions/9147119/avoid-extra-db-reads-in-the-getasobject-method-of-converter-class-by-caching-dat
Iterator<SelectItem> it = new SelectItemsIterator(facesContext, component);
while (it.hasNext()) {
Object value = it.next().getValue();
if (value instanceof ECRFSectionProgressVO) {
if (submittedValue.equals(((ECRFSectionProgressVO) value).getSection())) {
return value;
}
} else if (value instanceof String) {
if (submittedValue.equals(value)) {
ECRFSectionProgressVO progress = new EcrfSectionProgressItemValue();
progress.setSection((String) value);
return progress;
}
}
}
// System.out.println("section progress for " + submittedValue + " not found");
return null;
// }
}
示例6: calcItems
import javax.faces.model.SelectItem; //导入依赖的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;
}
示例7: loadMarketplaces_NoMarketplaceOwner
import javax.faces.model.SelectItem; //导入依赖的package包/类
/**
* The user has only the SERVICE_MANAGER role, therefore only marketplaces
* with publishing rights must be loaded.
*/
@Test
public void loadMarketplaces_NoMarketplaceOwner() {
// given two marketplaces
doReturn(Boolean.FALSE).when(marketplaceGotoBean)
.isLoggedInAndMarketplaceOwner();
given(mpServiceMock.getMarketplacesForOrganization()).willReturn(
marketplace(1L, "publishedMp"));
given(mpServiceMock.getMarketplacesOwned()).willReturn(
marketplace(2L, "ownedMp"));
// when
List<SelectItem> marketplaces = marketplaceGotoBean.getMarketplaces();
// then only one is loaded
assertEquals(1, marketplaces.size());
assertEquals("publishedMp", marketplaces.get(0).getValue());
}
示例8:
import javax.faces.model.SelectItem; //导入依赖的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();
/* */ }
示例9: _createNavigationItem
import javax.faces.model.SelectItem; //导入依赖的package包/类
private SelectItem _createNavigationItem(
FacesContext context,
RenderingContext rc,
UIComponent component,
long blockStart,
int blockSize,
long maxValue,
String text,
UIComponent rangeLabel
)
{
// if text isn't null, it is More or Previous.
if (text == null)
text = _getRangeString(context,
rc,
component,
blockStart,
blockSize,
maxValue,
rangeLabel);
return new SelectItem(IntegerUtils.getString(blockStart),
text);
}
示例10: selectTypeUser
import javax.faces.model.SelectItem; //导入依赖的package包/类
public void selectTypeUser(){
selectTypeDoc = new SelectItem[alltd.size()];
for(int i = 0; i < alltd.size();i++){
TypeDoc td1 = alltd.get(i);
selectTypeDoc[i] = new SelectItem(td1.getTypedocId(),td1.getName());
}
}
示例11: getFilterEventImportances
import javax.faces.model.SelectItem; //导入依赖的package包/类
public synchronized ArrayList<SelectItem> getFilterEventImportances() {
if (filterEventImportances == null) {
filterEventImportances = WebUtil.getEventImportances();
filterEventImportances.add(0, new SelectItem(CommonUtil.NO_SELECTION_VALUE, ""));
}
return filterEventImportances;
}
示例12: initSelectableOperaions
import javax.faces.model.SelectItem; //导入依赖的package包/类
private List<SelectItem> initSelectableOperaions(
ServiceInstance serviceInstance) {
List<SelectItem> selectableOperations = new ArrayList<>();
for (InstanceOperation operation : getServiceInstanceService()
.listOperationsForInstance(serviceInstance)) {
if (filterOperation(operation, serviceInstance)) {
selectableOperations.add(new SelectItem(operation));
}
}
return selectableOperations;
}
示例13: getFilterVariablePeriods
import javax.faces.model.SelectItem; //导入依赖的package包/类
public synchronized ArrayList<SelectItem> getFilterVariablePeriods() {
if (filterVariablePeriods == null) {
filterVariablePeriods = WebUtil.getVariablePeriods();
filterVariablePeriods.add(0, new SelectItem(CommonUtil.NO_SELECTION_VALUE, ""));
}
return filterVariablePeriods;
}
示例14: initSets
import javax.faces.model.SelectItem; //导入依赖的package包/类
private void initSets() {
costTypesTruncated = null;
isCostTypeColumnsTruncated = false;
truncatedCostTypes = null;
if (costTypes == null) {
costTypes = new ArrayList<String>();
costTypesTruncated = costTypes;
truncatedCostTypes = new ArrayList<SelectItem>();
truncatedCostTypeIndex = null;
} else {
Long limit = Settings.getLongNullable(SettingCodes.MAX_COST_TYPES_COLUMNS, Bundle.SETTINGS, DefaultSettings.MAX_COST_TYPES_COLUMNS);
truncatedCostTypes = new ArrayList<SelectItem>();
if (limit != null && costTypes.size() > limit) {
costTypesTruncated = new ArrayList<String>();
Iterator<String> it = costTypes.iterator();
Long index = 0l;
while (it.hasNext()) {
if ((costTypesTruncated.size() + 1) < limit) {
costTypesTruncated.add(it.next());
} else {
if (truncatedCostTypeIndex == null) {
truncatedCostTypeIndex = index;
}
truncatedCostTypes.add(new SelectItem(index.toString(), it.next()));
}
index++;
}
isCostTypeColumnsTruncated = true;
} else {
costTypesTruncated = costTypes;
truncatedCostTypeIndex = null;
}
}
}
示例15: setPublicLandingpageSelected
import javax.faces.model.SelectItem; //导入依赖的package包/类
private void setPublicLandingpageSelected() {
model.setLandingpageType(LandingpageType.PUBLIC.name());
model.setSelectedMarketplace(PUBLIC_MARKETPLACE_ID);
model.setLandingpageConfig(new POPublicLandingpageConfig());
model.setAvailableServices(new ArrayList<POService>());
model.setFillinItems(new ArrayList<SelectItem>());
}