コード例 #1
0
  public String editar(MensagemConvencao me) {
    mensagemConvencao = me;
    vencimento = mensagemConvencao.getVencimento();
    // listaMensagens.remove(listaMensagens.get(idIndex));
    msgConfirma = "";

    if (mensagemConvencao.getConvencao().getId() != -1) {
      for (int i = 0; i < getListaConvencoes().size(); i++) {
        if (Integer.parseInt(getListaConvencoes().get(i).getDescription())
            == mensagemConvencao.getConvencao().getId()) {
          idConvencao = (Integer) getListaConvencoes().get(i).getValue();
          break;
        }
      }
    }

    if (mensagemConvencao.getGrupoCidade().getId() != -1) {
      List<SelectItem> grupo = getListaGrupoCidade();
      for (SelectItem grupo1 : grupo) {
        if (Integer.parseInt(grupo1.getDescription())
            == mensagemConvencao.getGrupoCidade().getId()) {
          idGrupo = (Integer) grupo1.getValue();
          break;
        }
      }
    }

    if (mensagemConvencao.getTipoServico().getId() != -1) {
      List<SelectItem> tipoServico = getListaTipoServico();
      for (SelectItem tipoServico1 : tipoServico) {
        if (Integer.parseInt(tipoServico1.getDescription())
            == mensagemConvencao.getTipoServico().getId()) {
          idTipoServico = (Integer) tipoServico1.getValue();
          break;
        }
      }
    }

    if (mensagemConvencao.getServicos().getId() != -1) {
      List<SelectItem> servicos = getListaServico();
      for (SelectItem servico : servicos) {
        if (Integer.parseInt(servico.getDescription()) == mensagemConvencao.getServicos().getId()) {
          idServico = (Integer) servico.getValue();
          break;
        }
      }
    }
    return "mensagem";
  }
コード例 #2
0
  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;
  }
コード例 #3
0
  protected void encodeItem(
      FacesContext context,
      SelectOneListbox listbox,
      SelectItem option,
      Object values,
      Object submittedValues,
      Converter converter,
      boolean customContent)
      throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    String itemValueAsString = getOptionAsString(context, listbox, converter, option.getValue());
    boolean disabled = option.isDisabled() || listbox.isDisabled();
    String itemClass =
        disabled ? SelectOneListbox.ITEM_CLASS + " ui-state-disabled" : SelectOneListbox.ITEM_CLASS;

    Object valuesArray;
    Object itemValue;
    if (submittedValues != null) {
      valuesArray = submittedValues;
      itemValue = itemValueAsString;
    } else {
      valuesArray = values;
      itemValue = option.getValue();
    }

    boolean selected = isSelected(context, listbox, itemValue, valuesArray, converter);
    if (option.isNoSelectionOption() && values != null && !selected) {
      return;
    }

    if (selected) {
      itemClass = itemClass + " ui-state-highlight";
    }

    if (customContent) {
      String var = listbox.getVar();
      context.getExternalContext().getRequestMap().put(var, option.getValue());

      writer.startElement("tr", null);
      writer.writeAttribute("class", itemClass, null);
      if (option.getDescription() != null) {
        writer.writeAttribute("title", option.getDescription(), null);
      }

      for (UIComponent child : listbox.getChildren()) {
        if (child instanceof Column && child.isRendered()) {
          writer.startElement("td", null);
          renderChildren(context, child);
          writer.endElement("td");
        }
      }

      writer.endElement("tr");
    } else {
      writer.startElement("li", null);
      writer.writeAttribute("class", itemClass, null);
      if (option.isEscape()) {
        writer.writeText(option.getLabel(), null);
      } else {
        writer.write(option.getLabel());
      }

      writer.endElement("li");
    }
  }