@Override
 public Object getFieldValue(JRField jrField) throws JRException {
   Object valor = null;
   if (tabla != null) {
     for (int i = 0; i < tabla.getTotalColumnas(); i++) {
       if (tabla.getColumnas()[i].getNombre().equalsIgnoreCase(jrField.getName())) {
         valor = tabla.getValor(indice, tabla.getColumnas()[i].getNombre());
         break;
       }
     }
   } else if (tablaGenerica != null) {
     for (int i = 0; i < tablaGenerica.getTotalColumnas(); i++) {
       if (tablaGenerica.getColumnas()[i].getNombre().equalsIgnoreCase(jrField.getName())) {
         valor = tablaGenerica.getValor(indice, tablaGenerica.getColumnas()[i].getNombre());
         break;
       }
     }
   } else if (lista != null) {
     for (int i = 0; i < lista.get(indice).getNombreColumna().length; i++) {
       if (lista.get(indice).getNombreColumna()[i].equalsIgnoreCase(jrField.getName())) {
         valor = lista.get(indice).getValor()[i];
         break;
       }
     }
   }
   return valor;
 }
    @Override
    public Object getFieldValue(JRField jrf) throws JRException {
      Object value = "";

      System.out.println(jrf.getName());
      if ("codigo".equals(jrf.getName())) {
        codU = lista.get(iActual).getIdCabezera();
        if (lista.get(iActual).getEstado() == 3) {
          value = " A -";
        }
        value = value + "" + lista.get(iActual).getCod();
      }
      if ("hora".equals(jrf.getName())) {

        value = lista.get(iActual).getFecha();
      }
      if ("importe".equals(jrf.getName())) {

        if (lista.get(iActual).getEstado() == 1) {
          value = lista.get(iActual).getTotal();
        }
        if (lista.get(iActual).getEstado() == 3) {
          value = -1 * lista.get(iActual).getTotal();
        }
        if (value == null || value.equals("")) {
          value = 0;
        }
        System.out.println(value);
      }
      if (value == null) {
        System.out.println("ERROR");
      }
      return value;
    }
 private Object computeValueForField(JRField field) {
   if (field.getName().toLowerCase().equals("path")) {
     String pathField = m_paths.get(m_currentRow);
     System.err.println("path field:[" + pathField + "]");
     return m_paths.get(m_currentRow);
   } else {
     if (m_filterFields.containsField(field.getName())) {
       return calculateFieldValue(field, m_paths.get(m_currentRow));
     } else {
       return null;
     }
   }
 }
 /**
  * Checks if the field name is suitable for the current expression context.
  *
  * @param field the field to validate
  */
 @Check
 public void checkFieldName(JRFieldObj field) {
   ExpressionContext currExpContext =
       ExpressionEditorSupportUtil.safeGetCurrentExpressionContext();
   List<JRField> allFields = ExpressionContextUtils.getAllDatasetsFields(currExpContext);
   for (JRField f : allFields) {
     if (("{" + f.getName() + "}").equals(field.getBracedIdentifier()))
       return; //$NON-NLS-1$ //$NON-NLS-2$
   }
   error(
       Messages.JavaJRExpressionJavaValidator_FieldNotFoundInContextError,
       field,
       JavaJRExpressionPackage.Literals.JR_FIELD_OBJ__BRACED_IDENTIFIER,
       JavaJRExpressionPackage.JR_FIELD_OBJ__BRACED_IDENTIFIER);
 }
  public Object getFieldValue(JRField field) throws JRException {
    Object value = null;

    String fieldName = field.getName();
    if ("description".equalsIgnoreCase(fieldName)) {
      value = data.get(index).getDescription();
    } else if ("commencedDate".equalsIgnoreCase(fieldName)) {
      value = data.get(index).getCommencedDate();
    } else if ("invoice".equalsIgnoreCase(fieldName)) {
      String invoice = data.get(index).getInvoice();
      if ("Y".equalsIgnoreCase(invoice)) {
        value = "INV";
      } else {
        value = "";
      }
    } else if ("quantity".equalsIgnoreCase(fieldName)) {
      value = data.get(index).getQuantity();
    } else if ("totalAmount".equalsIgnoreCase(fieldName)) {
      value = data.get(index).getTotalAmount();
    } else if ("totalGST".equalsIgnoreCase(fieldName)) {
      value = data.get(index).getTotalGST();
    } else if ("itemType".equalsIgnoreCase(fieldName)) {
      value = data.get(index).getItemType();
    } else if ("typeId".equalsIgnoreCase(fieldName)) {
      value = data.get(index).getTypeId();
    } else if ("quantityType".equalsIgnoreCase(fieldName)) {
      value = data.get(index).getQuantityType();
    } else if ("gstAllowed".equalsIgnoreCase(fieldName)) {
      value = data.get(index).getGstAllowed();
    } else if ("requestName".equalsIgnoreCase(fieldName)) {
      value = data.get(index).getRequestName();
    }
    return value;
  }
 @Override
 public Object getFieldValue(JRField jrf) throws JRException {
   Object valor = null;
   // General
   if (null != jrf.getName()) {
     switch (jrf.getName()) {
       case "nroCamiseta":
         valor = plantelImprimir.get(indice).getNumeroCamiseta();
         break;
       case "apellidoynombre":
         valor =
             plantelImprimir.get(indice).getApellido()
                 + ", "
                 + plantelImprimir.get(indice).getNombre();
         break;
       case "dni":
         valor = plantelImprimir.get(indice).getDni();
         break;
     }
   }
   return valor;
 }
  @Override
  public Object getFieldValue(JRField arg0) throws JRException {
    String name = arg0.getName();
    if (!name.equals("image")) return null;
    try {
      flag = false;
      if (stateBean != null) {
        StateBean tmpBean = stateBean.cloneThis();
        return create3DPieChart(tmpBean.getMonitorName(), createDataset(tmpBean), 600, 300);

      } else if (this.colorlist != null) {
        return this.getSpectrumImage(colorlist, 800, 50);
      }
    } catch (Exception e) {
      e.printStackTrace();
      throw new JRException(e);
    }
    return null;
  }
 public Object getFieldValue(JRField field) throws JRException {
   Object value = null;
   String fieldName = field.getName();
   if ("studyName".equalsIgnoreCase(fieldName)) {
     value = data.get(index).getStudyName();
   } else if ("subjectUId".equalsIgnoreCase(fieldName)) {
     value = data.get(index).getSubjectUId();
   } else if ("biospecimenId".equalsIgnoreCase(fieldName)) {
     value = data.get(index).getBiospecimenId();
   } else if ("parentId".equalsIgnoreCase(fieldName)) {
     value = data.get(index).getParentId();
   } else if ("sampleType".equalsIgnoreCase(fieldName)) {
     value = data.get(index).getSampleType();
   } else if ("quantity".equalsIgnoreCase(fieldName)) {
     value = data.get(index).getQuantity();
   } else if ("initialStatus".equalsIgnoreCase(fieldName)) {
     value = data.get(index).getInitialStatus();
   } else if ("biospecimenUid".equalsIgnoreCase(fieldName)) {
     value = data.get(index).getBiospecimenUid();
   }
   return value;
 }
 @Override
 public Object getFieldValue(JRField jrField) throws JRException {
   return FieldDataFactory.getFieldValue(fCurrentElement, jrField.getName());
 }
 @Override
 public Object getFieldValue(JRField jrf) throws JRException {
   Object valor = null;
   if (null != jrf.getName()) // General
   {
     switch (jrf.getName()) {
       case "fecha":
         valor = dateFormat.format(tarjetasImprimir.get(indiceTarjeta).getFecha());
         break;
       case "tipoTarjeta":
         valor = tarjetasImprimir.get(indiceTarjeta).getTipo();
         break;
       case "torneo":
         if (unaControladoraGlobal.getTorneoTarjeta(tarjetasImprimir.get(indiceTarjeta)) != null) {
           valor = unaControladoraGlobal.getTorneoTarjeta(tarjetasImprimir.get(indiceTarjeta));
         } else {
           valor = "-";
         }
         break;
       case "fechaTorneo":
         if (unaControladoraGlobal.getFechaTorneoDePartido(
                 unaControladoraGlobal.getPartidoTarjeta(tarjetasImprimir.get(indiceTarjeta)))
             != null) {
           valor =
               unaControladoraGlobal
                   .getFechaTorneoDePartido(
                       unaControladoraGlobal.getPartidoTarjeta(
                           tarjetasImprimir.get(indiceTarjeta)))
                   .getNumeroFecha();
         } else {
           valor = "-";
         }
         break;
       case "minuto":
         if (tarjetasImprimir.get(indiceTarjeta).getMinuto() != null) {
           valor =
               tarjetasImprimir.get(indiceTarjeta).getMinuto()
                   + "' "
                   + tarjetasImprimir.get(indiceTarjeta).getTiempo()
                   + "T";
         } else {
           valor = "-";
         }
         break;
       case "contabilizo":
         if (tarjetasImprimir.get(indiceTarjeta).isComputado()) {
           valor = "Si";
         } else {
           valor = "No";
         }
         break;
       case "partido":
         if (unaControladoraGlobal.getPartidoTarjeta(tarjetasImprimir.get(indiceTarjeta))
             != null) {
           Partido unPartido =
               unaControladoraGlobal.getPartidoTarjeta(tarjetasImprimir.get(indiceTarjeta));
           valor = unPartido.getUnEquipoLocal() + " vs " + unPartido.getUnEquipoVisitante();
         } else {
           valor = "Por Acumulación";
         }
         break;
     }
   }
   return valor;
 }
 @Override
 public Object getFieldValue(JRField jrf) throws JRException {
   if ("trainingDate".equals(jrf.getName())) {
     return new SimpleDateFormat("dd.MM.yyyy")
         .format(reportingTrainings.get(currentlyTrainingIndex).getDate());
   } else if ("trainingType".equals(jrf.getName())) {
     return ShootingTrainingType.toString(
         reportingTrainings.get(currentlyTrainingIndex).getType());
   } else if ("totalShoots".equals(jrf.getName())) {
     return ReportsDataSourceFieldValuesFormer.determineIntFieldValue(
         statisticsCalculator.getTotalShoots());
   } else if ("totalInRest".equals(jrf.getName())) {
     return ReportsDataSourceFieldValuesFormer.determineIntFieldValue(
         statisticsCalculator.getTotalInRest());
   } else if ("totalLoading".equals(jrf.getName())) {
     return ReportsDataSourceFieldValuesFormer.determineIntFieldValue(
         statisticsCalculator.getTotalLoading());
   } else if ("totalCompetition".equals(jrf.getName())) {
     return ReportsDataSourceFieldValuesFormer.determineIntFieldValue(
         statisticsCalculator.getTotalCompetition());
   } else if ("totalTrial".equals(jrf.getName())) {
     return ReportsDataSourceFieldValuesFormer.determineIntFieldValue(
         statisticsCalculator.getTotalTrail());
   } else if ("totalScatt".equals(jrf.getName())) {
     return ReportsDataSourceFieldValuesFormer.determineIntFieldValue(
         statisticsCalculator.getTotalScatt());
   } else if ("averageFirstLying".equals(jrf.getName())) {
     return ReportsDataSourceFieldValuesFormer.determineDoubleFieldValue(
         statisticsCalculator.getAverageFirstLying());
   } else if ("averageFirstStanding".equals(jrf.getName())) {
     return ReportsDataSourceFieldValuesFormer.determineDoubleFieldValue(
         statisticsCalculator.getAverageFirstStanding());
   } else if ("averageDelayLying".equals(jrf.getName())) {
     return ReportsDataSourceFieldValuesFormer.determineDoubleFieldValue(
         statisticsCalculator.getAverageDelayLying());
   } else if ("averageDelayStanding".equals(jrf.getName())) {
     return ReportsDataSourceFieldValuesFormer.determineDoubleFieldValue(
         statisticsCalculator.getAverageDelayStanding());
   } else if ("effectivenessLying".equals(jrf.getName())) {
     return ReportsDataSourceFieldValuesFormer.determineLyingEffectivenessFieldValue(
         statisticsCalculator);
   } else if ("effectivenessStanding".equals(jrf.getName())) {
     return ReportsDataSourceFieldValuesFormer.determineStandingEffectivenessFieldValue(
         statisticsCalculator);
   } else if ("effectivenessAverage".equals(jrf.getName())) {
     return ReportsDataSourceFieldValuesFormer.determineAverageEffectivenessFieldValue(
         statisticsCalculator);
   } else {
     return 0;
   }
 }
  @Override
  public JRDesignElement createReportElement(JasperDesign jd) {
    JRDesignTextField element = (JRDesignTextField) super.createReportElement(jd);

    FieldPercentageDialog dialog = new FieldPercentageDialog(Misc.getMainFrame());
    dialog.setJasperDesign(jd);

    dialog.setVisible(true);
    if (dialog.getDialogResult() == JOptionPane.OK_OPTION) {
      JRField f = dialog.getSelectedField();
      ResetTypeEnum resetType = dialog.getSelectedResetTypeValue();
      JRGroup group = null;
      if (resetType == ResetTypeEnum.GROUP) {
        group = dialog.getSelectedGroup();
      }

      // Let's create the variable...

      JRDesignVariable variable = new JRDesignVariable();
      for (int i = 0; ; ++i) {
        String vname = f.getName() + "_SUM";
        if (i > 0) vname += "_" + i;

        if (jd.getVariablesMap().containsKey(vname)) {
          continue;
        }

        variable.setName(vname);
        break;
      }

      variable.setExpression(
          Misc.createExpression(f.getValueClassName(), "$F{" + f.getName() + "}"));
      variable.setValueClassName(f.getValueClassName());
      variable.setCalculation(CalculationEnum.SUM);
      variable.setResetType(resetType);
      if (resetType == ResetTypeEnum.GROUP) {
        variable.setResetGroup(group);
      }
      try {
        jd.addVariable(variable);
      } catch (JRException ex) {
        ex.printStackTrace();
      }

      ((JRDesignExpression) element.getExpression())
          .setText(
              "new Double( $F{"
                  + f.getName()
                  + "}.doubleValue() / $V{"
                  + variable.getName()
                  + "}.doubleValue() )");
      ((JRDesignExpression) element.getExpression()).setValueClassName("java.lang.Double");

      element.setPattern("#,##0.00%");
      setMatchingClassExpression(
          ((JRDesignExpression) element.getExpression()),
          ((JRDesignExpression) element.getExpression()).getValueClassName(),
          true);

      element.setEvaluationTime(EvaluationTimeEnum.AUTO);

      return element;
    }

    return null;
  }
 public Object getFieldValue(JRField field) throws JRException {
   DocumentBean documento = (DocumentBean) documentos[index];
   if (field.getName().equals("documento")) return documento;
   return null;
 }
 private String getColumnName(JRField field) {
   return field.getDescription() == null || field.getDescription().trim().equals("")
       ? field.getName()
       : field.getDescription();
 }
 private String calculateFieldValue(JRField field, String absolutePath) {
   // TODO: check if there are dsName filters
   return m_filterFields.getValueForField(field.getName(), absolutePath);
 }
  private String generateExpression(JRExpression expression, byte evaluationType) {
    JRParameter jrParameter = null;
    JRField jrField = null;
    JRVariable jrVariable = null;

    StringBuffer sbuffer = new StringBuffer();

    JRExpressionChunk[] chunks = expression.getChunks();
    JRExpressionChunk chunk = null;
    String chunkText = null;
    if (chunks != null && chunks.length > 0) {
      for (int i = 0; i < chunks.length; i++) {
        chunk = chunks[i];

        chunkText = chunk.getText();
        if (chunkText == null) {
          chunkText = "";
        }

        switch (chunk.getType()) {
          case JRExpressionChunk.TYPE_TEXT:
            {
              sbuffer.append(chunkText);
              break;
            }
          case JRExpressionChunk.TYPE_PARAMETER:
            {
              jrParameter = (JRParameter) parametersMap.get(chunkText);

              sbuffer.append("((");
              sbuffer.append(jrParameter.getValueClassName());
              sbuffer.append(")super.parameter_");
              sbuffer.append(JRStringUtil.getJavaIdentifier(chunkText));
              sbuffer.append(".getValue())");

              break;
            }
          case JRExpressionChunk.TYPE_FIELD:
            {
              jrField = (JRField) fieldsMap.get(chunkText);

              sbuffer.append("((");
              sbuffer.append(jrField.getValueClassName());
              sbuffer.append(")super.field_");
              sbuffer.append(JRStringUtil.getJavaIdentifier(chunkText));
              sbuffer.append(".get");
              sbuffer.append((String) fieldPrefixMap.get(new Byte(evaluationType)));
              sbuffer.append("Value())");

              break;
            }
          case JRExpressionChunk.TYPE_VARIABLE:
            {
              jrVariable = (JRVariable) variablesMap.get(chunkText);

              sbuffer.append("((");
              sbuffer.append(jrVariable.getValueClassName());
              sbuffer.append(")super.variable_");
              sbuffer.append(JRStringUtil.getJavaIdentifier(chunkText));
              sbuffer.append(".get");
              sbuffer.append((String) variablePrefixMap.get(new Byte(evaluationType)));
              sbuffer.append("Value())");

              break;
            }
          case JRExpressionChunk.TYPE_RESOURCE:
            {
              jrParameter = (JRParameter) parametersMap.get(chunkText);

              sbuffer.append("super.evaluator.str(\"");
              sbuffer.append(chunkText);
              sbuffer.append("\")");

              break;
            }
        }
      }
    }

    if (sbuffer.length() == 0) {
      sbuffer.append("null");
    }

    return sbuffer.toString();
  }
 @Override
 public Object getFieldValue(JRField field) throws JRException {
   EJReportRecord record = data[index];
   return record.getValue(field.getName());
 }
  public Object getFieldValue(JRField jrf) throws JRException {
    Object valor = null;

    if ("legajo".equals(jrf.getName())) {
      valor = listaEmpleado.get(indiceEmpleadoActual).getLegajo();
    } else if ("nombre".equals(jrf.getName())) {
      valor = listaEmpleado.get(indiceEmpleadoActual).getNombre();
    } else if ("tipoDocumento".equals(jrf.getName())) {
      valor = listaEmpleado.get(indiceEmpleadoActual).getTipoDocumento();
    } else if ("nroDocumento".equals(jrf.getName())) {
      valor = listaEmpleado.get(indiceEmpleadoActual).getNroDocumento();
    } else if ("fechaNacimiento".equals(jrf.getName())) {
      valor = listaEmpleado.get(indiceEmpleadoActual).getFechaNacimiento();
    } else if ("domicilio".equals(jrf.getName())) {
      valor = listaEmpleado.get(indiceEmpleadoActual).getDomicilio();
    } else if ("provincia".equals(jrf.getName())) {
      valor = listaEmpleado.get(indiceEmpleadoActual).getProvincia();
    } else if ("ciudad".equals(jrf.getName())) {
      valor = listaEmpleado.get(indiceEmpleadoActual).getCiudad();
    } else if ("codigoPostal".equals(jrf.getName())) {
      valor = listaEmpleado.get(indiceEmpleadoActual).getCodigoPostal();
    } else if ("fechaAlta".equals(jrf.getName())) {
      valor = listaEmpleado.get(indiceEmpleadoActual).getFechaAlta();
    } else if ("sexo".equals(jrf.getName())) {
      valor = listaEmpleado.get(indiceEmpleadoActual).getSexo();
    } else if ("telefono".equals(jrf.getName())) {
      valor = listaEmpleado.get(indiceEmpleadoActual).getTelefono();
    } else if ("email".equals(jrf.getName())) {
      valor = listaEmpleado.get(indiceEmpleadoActual).getLegajo();
    } else if ("area".equals(jrf.getName())) {
      valor = listaEmpleado.get(indiceEmpleadoActual).getArea();
    } else if ("activo".equals(jrf.getName())) {
      valor = listaEmpleado.get(indiceEmpleadoActual).getActivo();
    } else if ("vehiculo".equals(jrf.getName())) {
      valor = listaEmpleado.get(indiceEmpleadoActual).getVehiculo();
    }
    return valor;
  }
  @Override
  public Object getFieldValue(JRField campo) throws JRException {

    Object valor = null;
    formulario = (Formulario) valorAtual;

    Collection<Contrato> contratos = formulario.getContratos();

    for (Iterator<Contrato> it = contratos.iterator(); it.hasNext(); ) {

      Contrato c = (Contrato) it.next();

      if ("formularioData".equals(campo.getName())) {
        valor = new Timestamp(formulario.getCreated().getTime().getTime());
      } else if ("consultorNome".equals(campo.getName())) {
        valor = c.getUsuario().getApelido();
      } else if ("consultorCpf".equals(campo.getName())) {
        valor = c.getUsuario().getChave();
      } else if ("consultorSupervisor".equals(campo.getName())) {
        valor = c.getUsuario().getSupervisorUsuario().getApelido();
      } else if ("clienteNome".equals(campo.getName())) {
        valor = formulario.getParceiroNegocio().getNome();
      } else if ("clienteBeneficio".equals(campo.getName())) {
        valor = c.getNumeroBeneficio();
      } else if ("contratoProduto".equals(campo.getName())) {
        valor = c.getProduto().getNome();
      } else if ("contratoBanco".equals(campo.getName())) {
        valor = c.getBanco().getNome();
      } else if ("clienteCpf".equals(campo.getName())) {
        valor = formulario.getParceiroNegocio().getCpf();
      } else if ("clienteNascimento".equals(campo.getName())) {
        valor =
            new Timestamp(formulario.getParceiroNegocio().getDataNascimento().getTime().getTime());
      } else if ("clienteCep".equals(campo.getName())) {
        valor = formulario.getParceiroLocalidade().getLocalidade().getCep();
      } else if ("clienteTelRes".equals(campo.getName())) {
        valor = formulario.getParceiroContatos().get(0).getNome();
        ;
      } else if ("clienteTelCel".equals(campo.getName())) {
        valor =
            formulario.getParceiroContatos().size() > 1
                ? formulario.getParceiroContatos().get(1).getNome()
                : "";
      } else if ("clienteBanco".equals(campo.getName())) {
        valor = "";
      } else if ("clienteAgencia".equals(campo.getName())) {
        valor = "";
      } else if ("clienteConta".equals(campo.getName())) {
        valor = "";
      } else if ("clienteTipoConta".equals(campo.getName())) {
        valor = "";
      } else if ("clienteTipoPagamento".equals(campo.getName())) {
        valor = "";
      } else if ("clienteSenha".equals(campo.getName())) {
        valor = "";
      } else if ("contratoBancoComprado".equals(campo.getName())) {
        valor = c.getRecompraBanco().getNome();
      } else if ("contratoParcelaAberto".equals(campo.getName())) {
        valor = c.getQtdParcelasAberto();
      } else if ("contratoValor".equals(campo.getName())) {
        valor = c.getValorContrato();
      } else if ("contratoParcela".equals(campo.getName())) {
        valor = c.getValorParcela();
      } else if ("contratoPrazo".equals(campo.getName())) {
        valor = c.getPrazo();
      } else if ("contratoDivida".equals(campo.getName())) {
        valor = c.getValorDivida();
      } else if ("contratoDesconto".equals(campo.getName())) {
        valor = c.getDesconto();
      } else if ("contratoLiquido".equals(campo.getName())) {
        valor = c.getValorLiquido();
      } else if ("contratoCoeficiente".equals(campo.getName())) {
        valor = c.getCoeficiente().getValor();
      } else if ("contratoObs".equals(campo.getName())) {
        valor = c.getObservacao();
      }
    }

    return valor;
  }