public void llenarComboRegistrarComo() { combosRegistrarComo = null; SelectItem si; // este sera un nuevo item List<SelectItem> datos = new ArrayList<SelectItem>(); // esta es la lista que alojara los items nuevos si = new SelectItem(); // creamos nuevo item si.setLabel("Coordinador"); // descripcion del nuevo item si.setValue("Coordinador"); // valor del nuevo item datos.add(si); // añadimos el nuevo item a la lista de items si = new SelectItem(); // creamos nuevo item si.setLabel("Funcionario"); // descripcion del nuevo item si.setValue("Funcionario"); // valor del nuevo item datos.add(si); si = new SelectItem(); // creamos nuevo item si.setLabel("Instructor"); // descripcion del nuevo item si.setValue("Instructor"); // valor del nuevo item datos.add(si); si = new SelectItem(); // creamos nuevo item si.setLabel("Guarda"); // descripcion del nuevo item si.setValue("Guarda"); // valor del nuevo item datos.add(si); combosRegistrarComo = datos; }
public MantCuentasBean() { this.selectedUsuariofac = new Usuariofac(); this.usuafac = new ArrayList<Usuariofac>(); faceContext = FacesContext.getCurrentInstance(); httpServletRequest = (HttpServletRequest) faceContext.getExternalContext().getRequest(); if (httpServletRequest.getSession().getAttribute("sesionUsuario") != null) { System.out.println( "este hay " + httpServletRequest.getSession().getAttribute("sesionUsuario").toString()); } else { if (httpServletRequest.getSession().isNew()) { try { faceContext.getExternalContext().redirect("/TesisProduccion2/index.jsf"); } catch (Exception e) { } } else { try { faceContext.getExternalContext().redirect("/TesisProduccion2/index.jsf"); } catch (Exception e) { } } } listaCursos = new ArrayList<SelectItem>(); ArrayList<String> facu = this.listarVeterinarias(); for (int i = 0; i < facu.size(); i++) { SelectItem item = new SelectItem(); item.setValue(facu.get(i)); item.setLabel(facu.get(i)); listaCursos.add(item); } }
/** @return the catalogoTipoServicio */ public List<SelectItem> getCatalogoTipoServicio() { try { List<MaestroServicio> lista = consultaNegocioServicio.listarMaestroServicio(); SelectItem si = null; catalogoTipoServicio = new ArrayList<SelectItem>(); for (MaestroServicio maestroServicio : lista) { si = new SelectItem(); si.setLabel(maestroServicio.getNombre()); si.setValue(maestroServicio.getCodigoEntero()); catalogoTipoServicio.add(si); } } catch (Exception e) { logger.error(e.getMessage(), e); } /* * int idmaestro = UtilWeb.obtenerEnteroPropertieMaestro( * "maestroTipoServicios", "aplicacionDatos"); * * try { List<BaseVO> lista = soporteServicio * .listarCatalogoMaestro(idmaestro); catalogoTipoServicio = * UtilWeb.convertirSelectItem(lista); } catch (Exception e) { * logger.error(e.getMessage(), e); } */ return catalogoTipoServicio; }
public ArrayList getSelectRelativeWidthList() { ArrayList<SelectItem> list = new ArrayList(); ResourceLoader rb = new ResourceLoader("org.sakaiproject.tool.assessment.bundle.AuthorMessages"); final String[] widthLists = { rb.getString("matrix_width_list_default"), rb.getString("matrix_width_list_1"), rb.getString("matrix_width_list_2"), rb.getString("matrix_width_list_3"), rb.getString("matrix_width_list_4"), rb.getString("matrix_width_list_5"), rb.getString("matrix_width_list_6"), rb.getString("matrix_width_list_7"), rb.getString("matrix_width_list_8"), rb.getString("matrix_width_list_9") }; for (int i = 0; i < widthLists.length; i++) { SelectItem selectItem = new SelectItem(); selectItem.setLabel(widthLists[i]); selectItem.setValue(Integer.toString(i)); list.add(selectItem); } return list; }
public ArrayList getSectionSelectList() { ArrayList list = new ArrayList(); ResourceLoader rb = new ResourceLoader("org.sakaiproject.tool.assessment.bundle.AuthorMessages"); AssessmentBean assessbean = (AssessmentBean) ContextUtil.lookupBean("assessmentBean"); List<SectionContentsBean> sectionSet = assessbean.getSections(); Iterator<SectionContentsBean> iter = sectionSet.iterator(); int i = 0; while (iter.hasNext()) { i = i + 1; SectionContentsBean part = iter.next(); SelectItem selection = new SelectItem(); // need to filter out all the random draw parts if (part.getSectionAuthorType().equals(SectionDataIfc.RANDOM_DRAW_FROM_QUESTIONPOOL)) { // skip random draw parts, cannot add items to this part manually } else { if ("".equals(part.getTitle())) { selection.setLabel(rb.getString("p") + " " + i); } else { selection.setLabel( rb.getString("p") + " " + i + " - " + FormattedText.convertFormattedTextToPlaintext(part.getTitle())); } selection.setValue(part.getSectionId()); list.add(selection); } } Collections.reverse(list); // create a new part if there are no non-randomDraw parts available if (list.size() < 1) { i = i + 1; SelectItem temppart = new SelectItem(); temppart.setLabel(rb.getString("p") + " " + i); temppart.setValue( "-1"); // use -1 to indicate this is a temporary part. if the user decides to cancel the // operation, this part will not be created list.add(temppart); } return list; }
public FilteringBean() { for (int i = 5; i < 11; i++) { SelectItem select = new SelectItem(); select.setLabel("-" + i); select.setValue(i); filterZones.add(select); // create -5 to -10 time zone pick list } }
/** * Construct a <code>SelectItem</code> instance with the specified property values. * * @param value Value to be delivered to the model if this item is selected by the user * @param label Label to be rendered for this item in the response * @param description Description of this item, for use in tools * @param disabled Flag indicating that this option is disabled * @exception NullPointerException if <code>value</code> or <code>label</code> is <code>null * </code> */ public SelectItem(Object value, String label, String description, boolean disabled) { super(); setValue(value); setLabel(label); setDescription(description); setDisabled(disabled); }
public SelectItem next() { Map.Entry entry = (Map.Entry) iterator.next(); Object key = entry.getKey(); Object value = entry.getValue(); item.setLabel(((key != null) ? key.toString() : value.toString())); item.setValue(((value != null) ? value : "")); return item; }
public List getPostnumeraListiSelects() { ArrayList selects = new ArrayList(); SelectItem item0 = new SelectItem(); item0.setLabel("Veldu póstnúmer:"); item0.setValue(""); selects.add(item0); List postnumer = getPostnumeraListi(); for (Iterator iter = postnumer.iterator(); iter.hasNext(); ) { Postnumer numer = (Postnumer) iter.next(); SelectItem item = new SelectItem(); item.setLabel(numer.getFulltNafn()); item.setValue(numer.getNumer()); selects.add(item); } return selects; }
private void createStorageLocationSelectItemList() { SelectItem selectItem; storageLocationSelectItemList.clear(); storageLocationSelectItemList.add(new SelectItem("-1", "àÅ×͡ʶҹ·Õè¨Ñ´à¡çº")); for (StorageLocation stLocation : StorageLocation.warehouse(warehouseCode)) { selectItem = new SelectItem(); selectItem.setValue(stLocation.getID()); selectItem.setLabel(stLocation.getValue()); storageLocationSelectItemList.add(selectItem); } }
private void createGRTypeSelectItemList() { SelectItem selectItem; grTypeSelectItemList.clear(); grTypeSelectItemList.add(new SelectItem("-1", "àÅ×Í¡»ÃÐàÀ·¡ÒÃÃѺÇÑÊ´Ø")); for (GRType grType : GRType.values()) { selectItem = new SelectItem(); selectItem.setValue(grType.getID()); selectItem.setLabel(grType.getValue()); grTypeSelectItemList.add(selectItem); } }
private List getSelectItemList(List myList) { ArrayList selects = new ArrayList(); for (Iterator iter = myList.iterator(); iter.hasNext(); ) { String label = (String) iter.next(); String value = (String) iter.next(); SelectItem item = new SelectItem(); item.setLabel(label); item.setValue(value); selects.add(item); } return selects; }
public ArrayList<SelectItem> getCategories() { categories.clear(); List<Category> allCategory = categoryBean.findAllCategory(); Iterator it = allCategory.iterator(); while (it.hasNext()) { Category cat = (Category) it.next(); SelectItem select = new SelectItem(); select.setLabel(cat.getName()); select.setValue(cat.getCategoryID()); categories.add(select); } return categories; }
public List /* SelectItemGroup */ getViewChoiceDropdown() { List selectItems = new ArrayList(); SelectItem item = new SelectItem(); item.setLabel("Users"); // User item.setValue("user"); selectItems.add(item); item = new SelectItem(); item.setLabel("Users by Role"); // Tree item.setValue("tree"); selectItems.add(item); item = new SelectItem(); item.setLabel("Side-by-Side"); // Side By Side item.setValue("sidebyside"); selectItems.add(item); item = new SelectItem(); item.setLabel("Scrolling List"); // Foothill item.setValue("foothill"); selectItems.add(item); return selectItems; }
/** * Derived property. * * @return ArrayList of model SelectItems */ public ArrayList getSectionSelectList() { ArrayList list = new ArrayList(); if (sections == null) return list; for (int i = 0; i < sections.size(); i++) { SelectItem selection = new SelectItem(); SectionBean sBean = (SectionBean) sections.get(i); selection.setLabel(sBean.getSectionTitle()); selection.setValue(sBean.getSectionIdent()); list.add(selection); } return list; }
public List getGotuListiSelects() { ArrayList selects = new ArrayList(); if (postnumer == null || postnumer.equals("")) { SelectItem item = new SelectItem(); item.setLabel("Veldu póstnúmer fyrst"); item.setValue(""); selects.add(item); } else { SelectItem item0 = new SelectItem(); item0.setLabel("- Engin gata til staðar"); item0.setValue("none"); selects.add(item0); List gotuListi = InitialData.getInitialData().getGotuListiByPostnumer(postnumer); for (Iterator iter = gotuListi.iterator(); iter.hasNext(); ) { Gata gata = (Gata) iter.next(); SelectItem item = new SelectItem(); item.setLabel(gata.getNafn()); item.setValue(gata.getNafn()); selects.add(item); } } return selects; }
/** @return the catalogoProveedores */ public List<SelectItem> getCatalogoProveedores() { try { List<Proveedor> lista = this.consultaNegocioServicio.listarProveedor(new Proveedor()); SelectItem si = null; catalogoProveedores = new ArrayList<SelectItem>(); for (Proveedor proveedor : lista) { si = new SelectItem(); si.setLabel(proveedor.getNombreCompleto()); si.setValue(proveedor.getCodigoEntero()); catalogoProveedores.add(si); } } catch (Exception e) { logger.error(e.getMessage(), e); } return catalogoProveedores; }
/** @return the catalogoParametros */ public List<SelectItem> getCatalogoParametros() { try { List<Parametro> lista = parametroServicio.listarParametros(); SelectItem si = null; catalogoParametros = new ArrayList<SelectItem>(); for (Parametro parametro : lista) { si = new SelectItem(); si.setLabel(parametro.getNombre()); si.setValue(parametro.getCodigoEntero()); catalogoParametros.add(si); } } catch (Exception e) { logger.error(e.getMessage(), e); } return catalogoParametros; }
/** @return the catalogoTipoServicioIgv */ public List<SelectItem> getCatalogoTipoServicioIgv() { try { List<MaestroServicio> lista = consultaNegocioServicio.listarMaestroServicioIgv(); SelectItem si = null; catalogoTipoServicioIgv = new ArrayList<SelectItem>(); for (MaestroServicio maestroServicio : lista) { si = new SelectItem(); si.setLabel(maestroServicio.getNombre()); si.setValue(maestroServicio.getCodigoEntero()); catalogoTipoServicioIgv.add(si); } } catch (Exception e) { logger.error(e.getMessage(), e); } return catalogoTipoServicioIgv; }
private void createBudgetItemSelectItemList() { try { budgetItemSelectItemList.clear(); ArrayList<BudgetAuthorization> budgetAuthorizations = budController.getBudgetAuthorizationsForCurrentUser(getUserFromSession().getId()); Calendar currentCal = CalendarUtils.getDateInstance(CalendarUtils.LOCALE_TH); int budgetYear = CalendarUtils.toFinancialYear( CalendarUtils.LOCALE_TH, CalendarUtils.LOCALE_TH, currentCal.getTime()); ArrayList<BudgetItem> authorizedBudgetList = new ArrayList<BudgetItem>(); BudgetItem item; for (BudgetAuthorization auth : budgetAuthorizations) { item = new BudgetItem(); item = budController.getAuthorizedBudgetItemForCurrentUser(budgetYear, auth.getBudgetAuth()); authorizedBudgetList.add(item); } /*ArrayList<BudgetItem> budgetItemList = new ArrayList<BudgetItem>(); for(BudgetItem items : authorizedBudgetList) { getSubBudgetItemsForAuthorizedUser(items,budgetItemList); }*/ // ArrayList<BudgetItem> budgetItemList = budController.getAllBugetItems(budgetYear); budgetItemSelectItemList.add(new SelectItem(Long.valueOf(-1), "àÅ×Í¡§º»ÃÐÁÒ³")); /*SelectItem selectItem; for (BudgetItem budgetItem : budgetItemList) { //if (budgetItem.isPurchasingBudget() && budgetItem.getSubBudgetItems().size() == 0 && budgetItem.isAvailable()){ if (budgetItem.isPurchasingBudget() && budgetItem.isAvailable()){ selectItem = new SelectItem(); selectItem.setValue(budgetItem.getId()); selectItem.setLabel(budgetItem.toString()); budgetItemSelectItemList.add(selectItem); } }*/ SelectItem selectItem; for (BudgetItem budgetItem : authorizedBudgetList) { if (budgetItem.isPurchasingBudget() && budgetItem.isAvailable()) { selectItem = new SelectItem(); selectItem.setValue(budgetItem.getId()); selectItem.setLabel(budgetItem.toString()); budgetItemSelectItemList.add(selectItem); } } } catch (ControllerException e) { FacesUtils.reportError(FacesContext.getCurrentInstance(), e.getMessage(), e.getMessage(), e); e.printStackTrace(); } }
private List<SelectItem> getAllRolesSelectItems() { rolesSelectItems = new ArrayList<SelectItem>(); if (roles != null) { log.info("rolesSelectItems is NOT null."); for (Roles role : roles) { SelectItem item = new SelectItem(); item.setValue(role.getRoleName()); item.setLabel(role.getRoleDescription()); rolesSelectItems.add(item); } } else { log.info("rolesSelectItems is empty."); } return rolesSelectItems; }
private void createPOSelectItemList() { try { poSelectItemList.clear(); ArrayList<PurchaseOrder> openPrList = poController.getOpenPurchaseOrders(warehouseCode); poSelectItemList.add(new SelectItem(Long.valueOf(-1), "àÅ×Í¡ãºÊÑ觫×éÍ")); SelectItem selectItem; for (PurchaseOrder po : openPrList) { selectItem = new SelectItem(); selectItem.setValue(po.getId()); selectItem.setLabel(po.getFormattedPoNumber()); poSelectItemList.add(selectItem); } } catch (ControllerException e) { FacesUtils.reportError(FacesContext.getCurrentInstance(), e.getMessage(), e.getMessage(), e); e.printStackTrace(); } }
/** @return the catalogoOperador */ public List<SelectItem> getCatalogoOperador() { try { BaseVO tipoProveedor = new BaseVO(); tipoProveedor.setCodigoEntero(3); List<Proveedor> lista = this.soporteServicio.listarComboProveedorTipo(tipoProveedor); SelectItem si = null; catalogoOperador = new ArrayList<SelectItem>(); for (Proveedor proveedor : lista) { si = new SelectItem(); si.setLabel(proveedor.getNombreCompleto()); si.setValue(proveedor.getCodigoEntero()); catalogoOperador.add(si); } } catch (Exception e) { logger.error(e.getMessage(), e); } return catalogoOperador; }
@SuppressWarnings("unused") @PostConstruct private void init() { selectRights = new ArrayList<SelectItem>(); try { for (Right right : superUserService.getAllRights()) { if (right.getName().equals("ROLE_SUPER")) { continue; } SelectItem selectItem = new SelectItem(); selectItem.setLabel(right.getName()); selectItem.setValue(right.getId().toString()); selectRights.add(selectItem); } } catch (DataAccessException exception) { message = "Database error, try again later"; } catch (TransactionException exception) { message = "Database error, try again later"; } catch (Exception e) { message = "Sorry, service is currently unavailable"; } }
/** @return the catalogoVendedores */ public List<SelectItem> getCatalogoVendedores() { try { catalogoVendedores = new ArrayList<SelectItem>(); List<Usuario> listaVendedores = this.seguridadServicio.listarVendedores(); SelectItem si = null; for (Usuario usuario : listaVendedores) { si = new SelectItem(); si.setValue(usuario.getCodigoEntero()); String descripcionCompleto = usuario.getNombreCompleto(); si.setLabel(descripcionCompleto); catalogoVendedores.add(si); } } catch (SQLException e) { catalogoVendedores = new ArrayList<SelectItem>(); logger.error(e.getMessage(), e); } catch (Exception e) { catalogoVendedores = new ArrayList<SelectItem>(); logger.error(e.getMessage(), e); } return catalogoVendedores; }
/** @return the catalogoDestino */ public List<SelectItem> getCatalogoDestino() { try { catalogoDestino = new ArrayList<SelectItem>(); List<Destino> listaDestino = this.soporteServicio.listarDestinos(); SelectItem si = null; for (Destino destino : listaDestino) { si = new SelectItem(); si.setValue(destino.getCodigoEntero()); String descripcionCompleto = destino.getDescripcion() + "(" + destino.getCodigoIATA() + ")"; si.setLabel(descripcionCompleto); catalogoDestino.add(si); } } catch (SQLException e) { catalogoDestino = new ArrayList<SelectItem>(); logger.error(e.getMessage(), e); } catch (Exception e) { catalogoDestino = new ArrayList<SelectItem>(); logger.error(e.getMessage(), e); } return catalogoDestino; }
public List<SelectItem> getExecutionPeriodsLabels() { if (this.executionPeriodsLabels == null) { this.executionPeriodsLabels = new ArrayList(); final List<InfoExecutionPeriod> infoExecutionPeriods = getExecutionPeriods(); final ComparatorChain comparatorChain = new ComparatorChain(); comparatorChain.addComparator( new ReverseComparator(new BeanComparator("infoExecutionYear.year"))); comparatorChain.addComparator(new ReverseComparator(new BeanComparator("semester"))); Collections.sort(infoExecutionPeriods, comparatorChain); for (final InfoExecutionPeriod infoExecutionPeriod : infoExecutionPeriods) { final SelectItem selectItem = new SelectItem(); selectItem.setValue(infoExecutionPeriod.getExternalId()); selectItem.setLabel( infoExecutionPeriod.getName() + " - " + infoExecutionPeriod.getInfoExecutionYear().getYear()); this.executionPeriodsLabels.add(selectItem); } } return this.executionPeriodsLabels; }
/** * Derived property. * * @return ArrayList of model SelectItems */ public ArrayList getTrueFalseAnswerSelectList() { ArrayList list = new ArrayList(); String trueprop = ContextUtil.getLocalizedString( "org.sakaiproject.tool.assessment.bundle.AuthorMessages", "true_msg"); String falseprop = ContextUtil.getLocalizedString( "org.sakaiproject.tool.assessment.bundle.AuthorMessages", "false_msg"); String[] answerValues = {"true", "false"}; // not to be displayed in the UI String[] answerLabelText = {trueprop, falseprop}; currentItem.setAnswers(answerValues); currentItem.setAnswerLabels(answerLabelText); for (int i = 0; i < answerValues.length; i++) { SelectItem selection = new SelectItem(); selection.setLabel(answerLabelText[i]); selection.setValue(answerValues[i]); list.add(selection); } return list; }
public Collection<SelectItem> getLanguagesAsSelectItems() { try { if (languagesAsSelectItems.isEmpty()) { // No select item found for locale. // Create select item list from language taxonomy List<Topic> languageTopics = retrieveAllLanguageTopics(); if (CollectionUtils.isEmpty(languageTopics)) { // No topics found for taxonomy. Load locale selector return localeSelector.getSupportedLocales(); } else { logger.error("Creating select items"); if (topicComparator == null) { topicComparator = new TopicComparator("en", OrderByProperty.LABEL); } Collections.sort(languageTopics, topicComparator); for (Topic language : languageTopics) { SelectItem selectItem = new SelectItem(); selectItem.setLabel(language.getLocalizedLabelForLocale("en")); selectItem.setValue(language.getName()); languagesAsSelectItems.put(language.getName(), selectItem); } } } return languagesAsSelectItems.values(); } catch (Exception e) { logger.error("", e); return localeSelector.getSupportedLocales(); } }
public Object getValue() { Object value = super.getValue(); if (value instanceof SelectItem[] || value instanceof SelectItem) { return value; } List list = new ArrayList(); boolean nullLabelSet = false; if (nullLabelRequired) { SelectItem si = new SelectItem(); si.setValue(""); final FacesContext context = getFacesContext(); FacesMessage mes = FacesMessageUtil.getMessage(context, NULL_LABEL_MESSAGE_CODE, null); si.setLabel(mes.getSummary()); list.add(si); nullLabelSet = true; } if (value != null && value.getClass().isArray()) { value = Arrays.asList((Object[]) value); } if (value instanceof Collection) { final Collection valueCollection = (Collection) value; if (!nullLabelSet && valueCollection.size() == 0) { list.add(BLANK_SELECT_ITEM); } else { for (Iterator it = valueCollection.iterator(); it.hasNext(); ) { Object item = it.next(); if (item instanceof SelectItem) { list.add(item); } else if (item instanceof Map) { Map map = (Map) item; SelectItem si = new SelectItem(); Object itemValueValue = map.get(itemValue); if (itemValueValue != null) { si.setValue(itemValueValue); } Object itemLabelValue = map.get(itemLabel); if (itemLabelValue == null) { itemLabelValue = itemValueValue; } if (itemLabelValue != null) { si.setLabel(itemLabelValue.toString()); } list.add(si); } else { SelectItem si = new SelectItem(); BeanDesc bd = BeanDescFactory.getBeanDesc(item.getClass()); PropertyDesc pd = bd.getPropertyDesc(itemValue); Object itemValueValue = (pd.isReadable()) ? pd.getValue(item) : null; if (itemValueValue != null) { si.setValue(itemValueValue); } Object itemLabelValue = null; if (bd.hasPropertyDesc(itemLabel)) { pd = bd.getPropertyDesc(itemLabel); itemLabelValue = (pd.isReadable()) ? pd.getValue(item) : null; } if (itemLabelValue == null) { itemLabelValue = itemValueValue; } if (itemLabelValue != null) { si.setLabel(itemLabelValue.toString()); } list.add(si); } } } } else if (value instanceof Map) { final Map map = (Map) value; if (!nullLabelSet && map.size() == 0) { list.add(BLANK_SELECT_ITEM); } else { for (Iterator it = map.keySet().iterator(); it.hasNext(); ) { Object key = it.next(); Object val = map.get(key); SelectItem si = new SelectItem(); if (key != null) { si.setLabel(key.toString()); } if (val != null) { si.setValue(val); } list.add(si); } } } else { if (!nullLabelSet && value == null) { list.add(BLANK_SELECT_ITEM); } } return list; }