當前位置: 首頁>>代碼示例>>Java>>正文


Java SelectItem.getLabel方法代碼示例

本文整理匯總了Java中javax.faces.model.SelectItem.getLabel方法的典型用法代碼示例。如果您正苦於以下問題:Java SelectItem.getLabel方法的具體用法?Java SelectItem.getLabel怎麽用?Java SelectItem.getLabel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.faces.model.SelectItem的用法示例。


在下文中一共展示了SelectItem.getLabel方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: _convertSelectItemListToIndices

import javax.faces.model.SelectItem; //導入方法依賴的package包/類
/**
 * Rips through the list of SelectItems, and sets all item's
 * values to their index
 */
static private void _convertSelectItemListToIndices(
  List<SelectItem>     itemsToConvert)
{
  int length = itemsToConvert.size();
  // loop through each item to convert.
  for (int j=0; j < length; j++)
  {
    SelectItem oldSelectItem = itemsToConvert.get(j);
    // We have to create a new item - the old ones are not
    // necessarily ours, so we can't just mutate 'em
    SelectItem newSelectItem = new SelectItem(j,
                                             oldSelectItem.getLabel(),
                                             oldSelectItem.getDescription(),
                                             oldSelectItem.isDisabled());
    itemsToConvert.set(j, newSelectItem);
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:22,代碼來源:SelectManyShuttleRenderer.java

示例2: getOrgName

import javax.faces.model.SelectItem; //導入方法依賴的package包/類
String getOrgName() {

        DeleteCustomerPriceModelModel m = getModel();
        String orgId = m.getSelectedOrgId();
        String result = orgId;
        List<SelectItem> customers = m.getCustomers();
        for (SelectItem si : customers) {
            if (si.getValue().equals(orgId)) {
                result = si.getLabel();
                break;
            }
        }

        return result;
    }
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:16,代碼來源:DeleteCustomerPriceModelCtrl.java

示例3: getSelectedTenantId

import javax.faces.model.SelectItem; //導入方法依賴的package包/類
private String getSelectedTenantId() {
    for (SelectItem selectedTenantItem : getSelectableTenants()) {
        if (selectedTenantItem.getValue().toString().equals(selectedTenant)) {
            return selectedTenantItem.getLabel();
        }
    }
    return "";
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:9,代碼來源:OperatorOrgBean.java

示例4: ContainerInfo

import javax.faces.model.SelectItem; //導入方法依賴的package包/類
public ContainerInfo(List<SelectItem> itemsList)
{
  this.itemsList = itemsList;
  this.listCount = itemsList.size();
  for (SelectItem item : itemsList)
  {
    String text  = item.getLabel();
    if (text != null)
    {
      maxWidth = Math.max( text.length(),
                           maxWidth);
    }
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:15,代碼來源:SelectManyShuttleRenderer.java

示例5: renderNonElementContent

import javax.faces.model.SelectItem; //導入方法依賴的package包/類
@Override
protected void renderNonElementContent(
  FacesContext     context,
  RenderingContext rc,
  UIComponent      component,
  FacesBean        bean
  ) throws IOException
{
  // http://issues.apache.org/jira/browse/ADFFACES-151
  // Getting default converter for null value leads to exception but
  // if value of component is null than there is no need to perform
  // this method
  if (getValue(component, bean) == null)
    return;

  Converter converter = getConverter(component, bean);
  if ( converter == null)
    converter = getDefaultConverter(context, component, bean);
  boolean valuePassThru = getValuePassThru(component, bean);

  // =-=AEW If needed, this could be made more efficient
  // by iterating through the list instead of getting
  // all the items
  List<SelectItem> selectItems = getSelectItems(component, converter, false);

  int selectedIndex = _getSelectedIndex(context,
                                        component,
                                        bean,
                                        selectItems,
                                        converter,
                                        valuePassThru);

  // If an item is selected, get its label.
  String text;
  if (selectedIndex >= 0)
  {
    SelectItem item = selectItems.get(selectedIndex);
    text = item.getLabel();
  }
  else
  {
    text = getUnselectedLabel(component, bean);
  }

  context.getResponseWriter().writeText(text, null);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:47,代碼來源:SimpleSelectOneRenderer.java


注:本文中的javax.faces.model.SelectItem.getLabel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。