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);
    }
  }
Exemple #2
0
  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;
  }
 /** @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 static Converter getSelectItemConverter(
     Application facesApplication, Iterator<SelectItem> selectItems) {
   Converter converter = null;
   while (selectItems.hasNext() && converter == null) {
     SelectItem selectItem = selectItems.next();
     if (selectItem instanceof SelectItemGroup) {
       SelectItemGroup selectItemGroup = (SelectItemGroup) selectItem;
       Iterator<SelectItem> groupSelectItems =
           Iterators.forArray(selectItemGroup.getSelectItems());
       // Recursively get the converter from the SelectItems of the SelectItemGroup
       converter = getSelectItemConverter(facesApplication, groupSelectItems);
     } else {
       Class<?> selectItemClass = selectItem.getValue().getClass();
       if (String.class.equals(selectItemClass)) {
         return null; // No converter required for strings
       }
       try {
         converter =
             facesApplication.createConverter(
                 selectItemClass); // Lookup the converter registered for the class
       } catch (FacesException exception) {
         // Converter cannot be created
       }
     }
   }
   return converter;
 }
Exemple #5
0
 public void setLowPriorityEvents(List<SelectItem> events) {
   this.lowPriorityEvents = new ArrayList<String>();
   Iterator<SelectItem> i = events.iterator();
   while (i.hasNext()) {
     SelectItem e = i.next();
     lowPriorityEvents.add(e.getValue());
   }
 }
 /**
  * Return the label of the language
  *
  * @param lang
  * @return
  */
 public String getLanguageLabel(String lang) {
   for (SelectItem iso : isolanguages) {
     if (((String) iso.getValue()).equals(lang)) {
       return iso.getLabel();
     }
   }
   return lang;
 }
Exemple #7
0
 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
   }
 }
Exemple #8
0
 public static String getLabelByValueOnSelectItems(Object value, List<SelectItem> list) {
   for (SelectItem item : list) {
     if (item.getValue().equals(value)) {
       return item.getLabel();
     }
   }
   return null;
 }
  @SuppressWarnings("rawtypes")
  @Test
  public void metodo1() throws IllegalArgumentException, Exception {
    this.scanningProvider = new ClassPathScanningCandidateComponentProvider(false);
    this.scanningProvider.addIncludeFilter(
        new AnnotationTypeFilter(javax.persistence.Entity.class));

    List<Class<? extends Object>> classes = new ArrayList<Class<? extends Object>>();
    for (BeanDefinition beanDef : this.scanningProvider.findCandidateComponents("br.com")) {
      classes.add(Class.forName(beanDef.getBeanClassName()));
    }

    CLAZZ:
    for (Class clazz : classes) {

      Field listaCampo[] = clazz.getDeclaredFields();
      for (Field campo : listaCampo) {
        if (campo.getName().trim().equalsIgnoreCase("id")) {

          for (Annotation anotacao : campo.getAnnotations()) {
            if (anotacao.toString().contains("sequenceName")) {
              String array[] = anotacao.toString().split(",");
              String sequence = "";
              for (String item : array) {
                if (item.contains("sequenceName")) {
                  sequence = item.replace("sequenceName=", "");
                  break;
                }
              }
              if (sequence != null && !sequence.equals("")) {
                // Descobre o maior id do banco
                Integer ultimoId = dao.max(clazz);
                if (ultimoId == null) {
                  ultimoId = 1;
                }
                Session session = dao.getCurrentSession();

                String sql = "SELECT setval('SISFIE." + sequence.trim() + "', " + ultimoId + ");";

                if (duplicadas.contains(sequence.trim())) {
                  throw new IllegalArgumentException();
                }
                duplicadas.add(sequence.trim());
                session.createSQLQuery(sql).uniqueResult();
                sequences.add(new SelectItem(ultimoId, sequence.trim()));
                continue CLAZZ;
              }
            }
          }
        }
      }
    }
    System.out.println("Total :" + sequences.size());
    for (SelectItem item : sequences) {
      System.out.println(item.getLabel() + ": " + item.getValue());
    }
  }
    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;
    }
  /* (non-Javadoc)
   * @see javax.faces.convert.Converter#getAsObject(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.String)
   */
  @Override
  public Object getAsObject(FacesContext ctx, UIComponent component, String value) {

    SelectItem selectedItem = this.getSelectedItemByIndex(component, Integer.parseInt(value));
    if (selectedItem != null) {
      return selectedItem.getValue();
    }

    return null;
  }
 /**
  * Return: <br>
  * - the supported languages (i.e languages with a translation for labels and messages) if the
  * parameter is set to true <br>
  * - the non supported languages if the parameter is set to false
  *
  * @param supported
  * @return
  */
 private List<SelectItem> getsupportedLanguages(boolean supported) {
   List<SelectItem> l = new ArrayList<SelectItem>();
   for (SelectItem iso : isolanguages) {
     if (supported && isSupported(iso.getValue().toString())
         || (!supported && !isSupported(iso.getValue().toString()))) {
       l.add(iso);
     }
   }
   return l;
 }
Exemple #13
0
  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;
  }
 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 void fillAvailableViews(String[] views) {
   this.viewsSelectItems.clear();
   boolean bFirst = true;
   for (String view : views) {
     SelectItem viewSelectItem = new SelectItem(view);
     this.viewsSelectItems.add(viewSelectItem);
     if (bFirst) {
       this.setSelectedViewItem((String) viewSelectItem.getValue());
       bFirst = false;
     }
   }
 }
 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;
 }
 /**
  * Menu with first, the supported languages out of the properties, second all the iso languages
  *
  * @param SUPPORTED_LANGUAGES
  */
 public void initLanguagesMenu() {
   // Add first languages out of properties
   languages = new ArrayList<SelectItem>();
   languages.addAll(getsupportedLanguages(true));
   // add a separator
   // languages.add(new SelectItem(null, "--"));
   // Add the other languages (non supported)
   // languages.addAll(getsupportedLanguages(false));
   // init the string of all languages
   languagesAsString = "";
   for (SelectItem s : languages) {
     languagesAsString += s.getValue() + "," + s.getLabel() + "|";
   }
 }
Exemple #20
0
 /**
  * Make a new SelectItem[] with items whose ids belong to selected first, preserving inner
  * ordering of selected and its complement in all.
  *
  * <p>Again this assumes that selected is an ordered sub-list of all
  *
  * @param selected ids of selected items
  * @param all
  * @return
  */
 static SelectItem[] shiftFirst(String[] selected, SelectItem[] all) {
   SelectItem[] res = new SelectItem[all.length];
   int sl = selected.length;
   int i = 0;
   int j = sl;
   for (SelectItem item : all) {
     if (i < sl && item.getValue().toString().equals(selected[i])) {
       res[i++] = item;
     } else {
       res[j++] = item;
     }
   }
   return res;
 }
Exemple #21
0
  /**
   * 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;
  }
 /** @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;
 }
 /** @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;
 }
 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 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();
   }
 }
Exemple #27
0
  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;
  }
  public String undo_action() throws Exception {
    networkDataService.undoLastEvent();
    NetworkDataAnalysisEvent lastEvent = getLastEvent();
    if (lastEvent.getAddedAttribute() != null) {
      for (SelectItem selectItem : vertexAttributeSelectItems) {
        if (lastEvent.getAddedAttribute().equals(selectItem.getValue())) {
          vertexAttributeSelectItems.remove(selectItem);
          break;
        }
      }
    }

    events.remove(getLastEvent());
    canUndo = false;

    return null;
  }
  private String getTablePassword(String tableName) {
    String tablePass = "";

    for (Iterator iter = getViewIconTablesManagedBean().getIconTableNameList().iterator();
        iter.hasNext(); ) {
      SelectItem element = (SelectItem) iter.next();
      // if we have a match
      if (((String) element.getValue()).equalsIgnoreCase(tableName)) {
        tablePass = element.getDescription();
        getViewIconTablesManagedBean().setSelectedTableName(element.getLabel());
        logger.info("Table Name: " + element.getLabel());
        break;
      }
    }

    logger.info("In getTablePassword() -- Table Pass: " + tablePass);
    return tablePass;
  }
 /** @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;
 }