@UiHandler("save")
  void onSave(ClickEvent event) {

    if (!formularioValido()) return;

    //		CajaDeclarada cd = new CajaDeclarada();
    //		Caja c = new Caja();
    //		c.setSiglas("CAJADEC");
    //		cd.setCaja(c);

    // TODO falta validar TOODOOO!!!

    tiempoServicioReconocido.setEmpleador(empleador);
    //		tiempoServicioReconocido.setCajaDeclarada(cd);
    tiempoServicioReconocido.setInicio(inicio.getValue());
    tiempoServicioReconocido.setFin(fin.getValue());
    tiempoServicioReconocido.setEmpleador(empleador);

    if (listener != null) {
      listener.onChanged(tiempoServicioReconocido);
    }
    //		AppUtils.EVENT_BUS.fireEvent(new
    // PeriodoAporteDeclaradoChangedEvent(tiempoServicioDeclarado));
    close();
  }
 @EventHandler("updateButton")
 public void updateTaskButton(ClickEvent e) {
   presenter.updateTask(
       Long.parseLong(taskIdText.getText()),
       taskNameText.getText(),
       taskDescriptionTextArea.getText(),
       userText.getText(),
       subTaskStrategyListBox.getItemText(subTaskStrategyListBox.getSelectedIndex()),
       dueDate.getValue(),
       taskPriorityListBox.getSelectedIndex());
 }
  @UiHandler("valider_affectation")
  void onValider_affectationClick(ClickEvent event) {

    Affectation af = new Affectation();

    af.setDateFin(date_fin.getValue());
    af.setDateDebut(date_debut.getValue());
    Terminal t = new Terminal();
    AdresseIp a = new AdresseIp();
    // af.adresseIp.setIdAdresse(Integer.parseInt(valider_affectation.getTitle()));
    a.setIdplage(id_plage);
    a.setChamp1(Integer.parseInt(adresse_selectione.getText()));
    a.setChamp2(Integer.parseInt(adresse_selectione2.getText()));
    a.setChamp3(Integer.parseInt(adresse_selectione3.getText()));
    a.setChamp4(Integer.parseInt(adresse_selectione5.getText()));
    a.setIdAdresse(Integer.parseInt(valider_affectation.getTitle()));
    t.setIdTerminal(Integer.parseInt(mes_terminaux.getValue(mes_terminaux.getSelectedIndex())));
    af.setTerminal(t);
    af.setAdresseIp(a);

    greetingService.ajouter_affectation(
        af,
        new AsyncCallback() {

          @Override
          public void onFailure(Throwable caught) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onSuccess(Object result) {
            Window.alert("l affectation s est deroule avec succes");
          }
        });

    RootPanel.get().clear();
    adresses_dispo p_a = new adresses_dispo();
    RootPanel.get().add(p_a);
  }
  @UiHandler("save")
  void saveCustomer(ClickEvent event) {
    if (customer == null) {
      customer = new CustomerModel();
    }

    // Update the fields
    customer.setFirstname(firstname.getText());
    customer.setLastname(lastname.getText());
    customer.setBirthdate(birthdate.getValue());

    // Call the presenter
    presenter.saveCustomer(customer);
  }
  public boolean formularioValido() {

    Date hoy = LoginService.Util.currentUser.getFechaLogin();

    UIValidarFormulario vf =
        new UIValidarFormulario(
            "Favor complete las siguientes informaciones solicitadas para agregar tiempo de servicio");

    if (empleador == null) {
      vf.addError("Seleccione un empleador");
    }

    if (!AppUtils.esFecha(inicio)) {
      vf.addError("Fecha de inicio no valida");
    } else {
      if (inicio.getValue().after(hoy)) {
        vf.addError("Fecha de inicio no puede ser posterior a la fecha de hoy");
      }
    }

    if (!AppUtils.esFecha(fin)) {
      vf.addError("Fecha fin no valida");
    } else {
      if (fin.getValue().after(hoy)) {
        vf.addError("Fecha fin no puede ser posterior a la fecha de hoy");
      }
    }

    if (AppUtils.esFecha(inicio) && AppUtils.esFecha(fin)) {
      if (fin.getValue().before(inicio.getValue())) {
        vf.addError("Rango de fecha del inicio al fin no valido");
      }
    }

    return vf.esValido();
  }
Beispiel #6
0
 /**
  * To be used with the constructor ImogDateBox(boolean withExceptions) with withExceptions=true
  * Can be used when the box is not used as an editor but just as a widget
  *
  * @return
  * @throws ParseException
  */
 public Date getValueWithParseException() {
   formatErrorIdentified = true;
   return dateBox.getValue();
 }
Beispiel #7
0
 @Override
 public Date getValue() {
   return dateBox.getValue();
 }
  @Override
  public List<FilterCriteria> getFilterCriteria() {

    String locale = NLS.constants().locale();

    List<FilterCriteria> criteria = new ArrayList<FilterCriteria>();

    FilterCriteria castb_patient_identifiantCrit = new FilterCriteria();
    castb_patient_identifiantCrit.setField("casTb.patient.identifiant");
    castb_patient_identifiantCrit.setFieldDisplayName(NLS.constants().patient_field_identifiant());
    castb_patient_identifiantCrit.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS);
    castb_patient_identifiantCrit.setValue(castb_patient_identifiantBox.getValue());
    castb_patient_identifiantCrit.setValueDisplayName(castb_patient_identifiantBox.getValue());
    criteria.add(castb_patient_identifiantCrit);
    FilterCriteria castb_patient_nomCrit = new FilterCriteria();
    castb_patient_nomCrit.setField("casTb.patient.nom");
    castb_patient_nomCrit.setFieldDisplayName(NLS.constants().patient_field_nom());
    castb_patient_nomCrit.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS);
    castb_patient_nomCrit.setValue(castb_patient_nomBox.getValue());
    castb_patient_nomCrit.setValueDisplayName(castb_patient_nomBox.getValue());
    criteria.add(castb_patient_nomCrit);

    if (dateExamenBeforeBox.getValue() != null) {
      FilterCriteria dateExamenBeforeCrit = new FilterCriteria();
      dateExamenBeforeCrit.setField("dateExamen");
      dateExamenBeforeCrit.setFieldDisplayName(
          NLS.constants().examenATB_field_dateExamen()
              + BaseNLS.constants().search_operator_inferior());
      dateExamenBeforeCrit.setOperation(CriteriaConstants.DATE_OPERATOR_BEFORE);
      dateExamenBeforeCrit.setValue(DateUtil.getDate(dateExamenBeforeBox.getValue()));
      dateExamenBeforeCrit.setValueDisplayName(DateUtil.getDate(dateExamenBeforeBox.getValue()));
      criteria.add(dateExamenBeforeCrit);
    }

    if (dateExamenAfterBox.getValue() != null) {
      FilterCriteria dateExamenAfterCrit = new FilterCriteria();
      dateExamenAfterCrit.setField("dateExamen");
      dateExamenAfterCrit.setFieldDisplayName(
          NLS.constants().examenATB_field_dateExamen()
              + BaseNLS.constants().search_operator_superior());
      dateExamenAfterCrit.setOperation(CriteriaConstants.DATE_OPERATOR_AFTER);
      dateExamenAfterCrit.setValue(DateUtil.getDate(dateExamenAfterBox.getValue()));
      dateExamenAfterCrit.setValueDisplayName(DateUtil.getDate(dateExamenAfterBox.getValue()));
      criteria.add(dateExamenAfterCrit);
    }

    FilterCriteria raisonDepistageCrit = new FilterCriteria();
    raisonDepistageCrit.setField("raisonDepistage");
    raisonDepistageCrit.setFieldDisplayName(NLS.constants().examenATB_field_raisonDepistage());
    raisonDepistageCrit.setOperation(CriteriaConstants.STRING_OPERATOR_EQUAL);
    raisonDepistageCrit.setValue(
        raisonDepistageBox.getValue(raisonDepistageBox.getSelectedIndex()));
    raisonDepistageCrit.setValueDisplayName(
        EpicamRenderer.get()
            .getEnumDisplayValue(
                ExamenATBProxy.class,
                "raisonDepistage",
                raisonDepistageBox.getValue(raisonDepistageBox.getSelectedIndex())));
    criteria.add(raisonDepistageCrit);

    FilterCriteria resultatCrit = new FilterCriteria();
    resultatCrit.setField("resultat");
    resultatCrit.setFieldDisplayName(NLS.constants().examenATB_field_resultat());
    resultatCrit.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS);
    resultatCrit.setValue(resultatBox.getValue());
    resultatCrit.setValueDisplayName(resultatBox.getValue());
    criteria.add(resultatCrit);

    FilterCriteria deletedEntityCrit = new FilterCriteria();
    deletedEntityCrit.setField("deleted");
    deletedEntityCrit.setFieldDisplayName(BaseNLS.constants().entity_field_deleted());
    if (deletedEntityBox.getValue()) {
      deletedEntityCrit.setOperation(CriteriaConstants.OPERATOR_ISNOTNULL);
      deletedEntityCrit.setValue("true");
      deletedEntityCrit.setValueDisplayName(BaseNLS.constants().boolean_true());
    } else {
      deletedEntityCrit.setOperation(CriteriaConstants.OPERATOR_ISNULL);
      deletedEntityCrit.setValue("false");
      deletedEntityCrit.setValueDisplayName(BaseNLS.constants().boolean_false());
    }
    criteria.add(deletedEntityCrit);

    return criteria;
  }
Beispiel #9
0
  private void makeKarma() {

    int type = Integer.parseInt(listTypes.getValue(listTypes.getSelectedIndex()));
    if (type == -1) {
      MsgMan.getInstance().showError(CONSTANTS.error_type(), listTypes);
      return;
    }

    System.out.println("Seleccionado Carma tipo: " + type);

    String plate = tbPlate.getText().toUpperCase();
    if (ClientUtils.isEmpty(plate)) {
      MsgMan.getInstance().showError(CONSTANTS.error_plate1(), tbPlate);
      return;
    } else if (!ClientUtils.isValidAlphanumeric(plate)) {
      MsgMan.getInstance().showError(CONSTANTS.error_plate2(), tbPlate);
      return;
    } else if (plate.equals(user.getPlate())) {
      if (!cbxForeign.getValue()
          || (cbxForeign.getValue()
              && listCountry
                  .getValue(listCountry.getSelectedIndex())
                  .equals(user.getCountryCode()))) {
        MsgMan.getInstance().showError(CONSTANTS.error_plate3(), tbPlate);
        return;
      }
    }

    System.out.println("Matrícula pasa el test: " + plate);

    String txt = taNotes.getText();
    if (txt.length() > Message.MAX_LENGTH_MESSAGE) {
      MsgMan.getInstance()
          .showError(CONSTANTS.error_message() + Message.MAX_LENGTH_MESSAGE, taNotes);
      return;
    }

    Date d = date.getValue();
    if (d == null) {
      MsgMan.getInstance().showError(CONSTANTS.error_date2(), date);
      return;
    }
    String cCode =
        cbxForeign.getValue()
            ? listCountry.getValue(listCountry.getSelectedIndex())
            : user.getCountryCode();
    System.out.println("La fecha pasa el test: " + d);

    Message msg = new Message(type, user.getId(), plate, cCode, txt, d);
    System.out.println("Mensaje a guardar: " + msg);

    AsyncCallback<Integer> callback =
        new AsyncCallback<Integer>() {
          public void onFailure(Throwable caught) {
            System.out.println("Fallo al llamar al servicio: " + caught);
            MsgMan.getInstance().showError(CONSTANTS.error_generic());
          }

          public void onSuccess(Integer resultCode) {
            if (resultCode == Message.REGISTERED) {
              System.out.println(CONSTANTS.ok_carma());
              homeParent.updateScreen();
              DialogCarma.this.hide();
              ClientUtils.recordAnalyticsHit("account-set-carma");
              MsgMan.getInstance().showMessage(ClientUtils.getCarmaReturnMessage(resultCode));
            } else {
              // Mostrar mensajito de error bajo la caja
              System.out.println("No ha podido registrarse el karma: " + resultCode);
              MsgMan.getInstance().showError(ClientUtils.getCarmaReturnMessage(resultCode));
            }
          }
        };

    SVC.getSvc().registerMessage(msg, callback);
  }