示例#1
0
 private void chamarRemocao() throws BusinessException {
   UsuarioNumeroTelefonicoVO selecionado;
   BusinessFactory factory;
   if (jTable1.getSelectedRow() >= 0) {
     selecionado = ligacoes.get((this.jTable1.getSelectedRow()));
     factory = BusinessFactory.getInstance();
     try {
       factory.getNumeroTelefonico().delete(selecionado.getNumero().getNumero());
     } catch (BusinessException e) {
       throw e;
     }
   }
 }
示例#2
0
  private void populaTabela() {

    int counter = 0;
    if (this.isConsultaPorResponsavel) {
      try {
        ligacoes =
            BusinessFactory.getInstance()
                .getNumeroTelefonico()
                .getLigacoesPorUsuario(usuarioSelecionado.getEmail());

      } catch (BusinessException ex) {
        Logger.getLogger(JPConsultarLigacao.class.getName()).log(Level.SEVERE, null, ex);
      }
    } else {
      try {
        ligacoes =
            BusinessFactory.getInstance()
                .getNumeroTelefonico()
                .getLigacoes(new NumeroTelefonicoVO(jTextField5.getText()));

      } catch (BusinessException ex) {
        Logger.getLogger(JPConsultarLigacao.class.getName()).log(Level.SEVERE, null, ex);
      }
    }
    DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
    model.setRowCount(0);
    for (UsuarioNumeroTelefonicoVO ligacao : ligacoes) {
      DateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
      String recorrencia = "";

      ResourceBundle bundle = ResourceBundle.getBundle("I18n/Bundle");

      if (ligacao.getRecorrencia() == 1) {
        recorrencia = bundle.getString("JPConsultarNumeroTelefonico.CellText.Recorrente");
      } else if (ligacao.getRecorrencia() == 0) {
        recorrencia = bundle.getString("JPConsultarNumeroTelefonico.CellText.NaoRecorrente");
      }

      model.insertRow(
          counter,
          new Object[] {
            ligacao.getNumero().getNumero(),
            ligacao.getUsuario().getNome(),
            df.format(ligacao.getDataHora().getTime()),
            recorrencia
          });

      counter++;
    }
    jTable1.changeSelection(0, 0, false, false);
  }