public String action_edit(ActionEvent evt) {
    selectedAnexosRespuesta =
        (AnexosRespuestaDTO) (evt.getComponent().getAttributes().get("selectedAnexosRespuesta"));
    txtAdjuntoDocumento.setValue(selectedAnexosRespuesta.getAdjuntoDocumento());
    txtAdjuntoDocumento.setDisabled(false);
    txtDocumentoReal.setValue(selectedAnexosRespuesta.getDocumentoReal());
    txtDocumentoReal.setDisabled(false);
    txtEstadoRegistro.setValue(selectedAnexosRespuesta.getEstadoRegistro());
    txtEstadoRegistro.setDisabled(false);
    txtFechaCreacion.setValue(selectedAnexosRespuesta.getFechaCreacion());
    txtFechaCreacion.setDisabled(false);
    txtNombreAnexo.setValue(selectedAnexosRespuesta.getNombreAnexo());
    txtNombreAnexo.setDisabled(false);
    txtNombreBusqueda.setValue(selectedAnexosRespuesta.getNombreBusqueda());
    txtNombreBusqueda.setDisabled(false);
    txtUsuarioCreador.setValue(selectedAnexosRespuesta.getUsuarioCreador());
    txtUsuarioCreador.setDisabled(false);
    txtIdAnexoPqr_AnexosPqr.setValue(selectedAnexosRespuesta.getIdAnexoPqr_AnexosPqr());
    txtIdAnexoPqr_AnexosPqr.setDisabled(false);
    txtIdRespSol_RespuestaSol.setValue(selectedAnexosRespuesta.getIdRespSol_RespuestaSol());
    txtIdRespSol_RespuestaSol.setDisabled(false);
    txtIdAnxResp.setValue(selectedAnexosRespuesta.getIdAnxResp());
    txtIdAnxResp.setDisabled(true);
    btnSave.setDisabled(false);
    setShowDialog(true);

    return "";
  }
  public void listener_txtId() {
    try {
      Long idAnxResp = FacesUtils.checkLong(txtIdAnxResp);
      entity = (idAnxResp != null) ? businessDelegatorView.getAnexosRespuesta(idAnxResp) : null;
    } catch (Exception e) {
      entity = null;
    }

    if (entity == null) {
      txtAdjuntoDocumento.setDisabled(false);
      txtDocumentoReal.setDisabled(false);
      txtEstadoRegistro.setDisabled(false);
      txtNombreAnexo.setDisabled(false);
      txtNombreBusqueda.setDisabled(false);
      txtUsuarioCreador.setDisabled(false);
      txtIdAnexoPqr_AnexosPqr.setDisabled(false);
      txtIdRespSol_RespuestaSol.setDisabled(false);
      txtFechaCreacion.setDisabled(false);
      txtIdAnxResp.setDisabled(false);
      btnSave.setDisabled(false);
    } else {
      txtAdjuntoDocumento.setValue(entity.getAdjuntoDocumento());
      txtAdjuntoDocumento.setDisabled(false);
      txtDocumentoReal.setValue(entity.getDocumentoReal());
      txtDocumentoReal.setDisabled(false);
      txtEstadoRegistro.setValue(entity.getEstadoRegistro());
      txtEstadoRegistro.setDisabled(false);
      txtFechaCreacion.setValue(entity.getFechaCreacion());
      txtFechaCreacion.setDisabled(false);
      txtNombreAnexo.setValue(entity.getNombreAnexo());
      txtNombreAnexo.setDisabled(false);
      txtNombreBusqueda.setValue(entity.getNombreBusqueda());
      txtNombreBusqueda.setDisabled(false);
      txtUsuarioCreador.setValue(entity.getUsuarioCreador());
      txtUsuarioCreador.setDisabled(false);
      txtIdAnexoPqr_AnexosPqr.setValue(entity.getAnexosPqr().getIdAnexoPqr());
      txtIdAnexoPqr_AnexosPqr.setDisabled(false);
      txtIdRespSol_RespuestaSol.setValue(entity.getRespuestaSol().getIdRespSol());
      txtIdRespSol_RespuestaSol.setDisabled(false);
      txtIdAnxResp.setValue(entity.getIdAnxResp());
      txtIdAnxResp.setDisabled(true);
      btnSave.setDisabled(false);

      if (btnDelete != null) {
        btnDelete.setDisabled(false);
      }
    }
  }
Example #3
1
  public void limpiar() {
    listaPersonal = null;
    txtCedulaPersonal.setValue("");
    txtNombrePersonal.setValue("");
    txtApellidoPersonal.setValue("");
    txtDireccionPersonal.setValue("");
    txtCorreoPersonal.setValue("");
    txtTelefonoPersonal.setValue("");
    txtClavePersonal.setValue("");
    txtFechaNacimientoPersonal.setValue(null);
    txtLugarNacimientoPersonal.setValue("");

    btnRegistrar.setDisabled(false);
    btnModificar.setDisabled(true);
    btnEliminar.setDisabled(true);
    txtCedulaPersonal.setDisabled(false);

    llenarComboRol();

    columnaRol.setRendered(true);
    columnaLabelRol.setRendered(true);

    columnaComboRegistrarComo.setRendered(false);
    columnaLabelRegistrarComo.setRendered(false);
  }
Example #4
1
  public void OnRowSelect(SelectEvent evt) {
    Personal p = personalSeleccionado;
    txtCedulaPersonal.setValue(p.getDocumentopersonal());
    txtNombrePersonal.setValue(p.getNombrepersonal());
    txtApellidoPersonal.setValue(p.getApellidopersonal());
    txtDireccionPersonal.setValue(p.getDireccionpersonal());
    txtCorreoPersonal.setValue(p.getCorreopersonal());
    txtTelefonoPersonal.setValue(p.getTelefonopersonal());
    txtClavePersonal.setValue(p.getClavepersonal());
    txtFechaNacimientoPersonal.setValue(p.getFechanacimientopersonal());
    txtLugarNacimientoPersonal.setValue(p.getLugarnacimientopersonal());

    btnRegistrar.setDisabled(true);
    btnModificar.setDisabled(false);
    btnEliminar.setDisabled(false);
    txtCedulaPersonal.setDisabled(true);

    columnaRol.setRendered(false);
    columnaLabelRol.setRendered(false);

    columnaComboRegistrarComo.setRendered(true);
    columnaLabelRegistrarComo.setRendered(true);
    llenarComboRegistrarComo();
  }
  public void rowEventListener(RowEditEvent e) {
    try {
      AnexosRespuestaDTO anexosRespuestaDTO = (AnexosRespuestaDTO) e.getObject();

      if (txtAdjuntoDocumento == null) {
        txtAdjuntoDocumento = new InputText();
      }

      txtAdjuntoDocumento.setValue(anexosRespuestaDTO.getAdjuntoDocumento());

      if (txtDocumentoReal == null) {
        txtDocumentoReal = new InputText();
      }

      txtDocumentoReal.setValue(anexosRespuestaDTO.getDocumentoReal());

      if (txtEstadoRegistro == null) {
        txtEstadoRegistro = new InputText();
      }

      txtEstadoRegistro.setValue(anexosRespuestaDTO.getEstadoRegistro());

      if (txtNombreAnexo == null) {
        txtNombreAnexo = new InputText();
      }

      txtNombreAnexo.setValue(anexosRespuestaDTO.getNombreAnexo());

      if (txtNombreBusqueda == null) {
        txtNombreBusqueda = new InputText();
      }

      txtNombreBusqueda.setValue(anexosRespuestaDTO.getNombreBusqueda());

      if (txtUsuarioCreador == null) {
        txtUsuarioCreador = new InputText();
      }

      txtUsuarioCreador.setValue(anexosRespuestaDTO.getUsuarioCreador());

      if (txtIdAnexoPqr_AnexosPqr == null) {
        txtIdAnexoPqr_AnexosPqr = new InputText();
      }

      txtIdAnexoPqr_AnexosPqr.setValue(anexosRespuestaDTO.getIdAnexoPqr_AnexosPqr());

      if (txtIdRespSol_RespuestaSol == null) {
        txtIdRespSol_RespuestaSol = new InputText();
      }

      txtIdRespSol_RespuestaSol.setValue(anexosRespuestaDTO.getIdRespSol_RespuestaSol());

      if (txtIdAnxResp == null) {
        txtIdAnxResp = new InputText();
      }

      txtIdAnxResp.setValue(anexosRespuestaDTO.getIdAnxResp());

      if (txtFechaCreacion == null) {
        txtFechaCreacion = new Calendar();
      }

      txtFechaCreacion.setValue(anexosRespuestaDTO.getFechaCreacion());

      Long idAnxResp = FacesUtils.checkLong(txtIdAnxResp);
      entity = businessDelegatorView.getAnexosRespuesta(idAnxResp);

      action_modify();
    } catch (Exception ex) {
    }
  }
 public void listener_txtFechaCreacion() {
   Date inputDate = (Date) txtFechaCreacion.getValue();
   DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
   FacesContext.getCurrentInstance()
       .addMessage("", new FacesMessage("Selected Date " + dateFormat.format(inputDate)));
 }
  public String action_clear() {
    entity = null;
    selectedAnexosRespuesta = null;

    if (txtAdjuntoDocumento != null) {
      txtAdjuntoDocumento.setValue(null);
      txtAdjuntoDocumento.setDisabled(true);
    }

    if (txtDocumentoReal != null) {
      txtDocumentoReal.setValue(null);
      txtDocumentoReal.setDisabled(true);
    }

    if (txtEstadoRegistro != null) {
      txtEstadoRegistro.setValue(null);
      txtEstadoRegistro.setDisabled(true);
    }

    if (txtNombreAnexo != null) {
      txtNombreAnexo.setValue(null);
      txtNombreAnexo.setDisabled(true);
    }

    if (txtNombreBusqueda != null) {
      txtNombreBusqueda.setValue(null);
      txtNombreBusqueda.setDisabled(true);
    }

    if (txtUsuarioCreador != null) {
      txtUsuarioCreador.setValue(null);
      txtUsuarioCreador.setDisabled(true);
    }

    if (txtIdAnexoPqr_AnexosPqr != null) {
      txtIdAnexoPqr_AnexosPqr.setValue(null);
      txtIdAnexoPqr_AnexosPqr.setDisabled(true);
    }

    if (txtIdRespSol_RespuestaSol != null) {
      txtIdRespSol_RespuestaSol.setValue(null);
      txtIdRespSol_RespuestaSol.setDisabled(true);
    }

    if (txtFechaCreacion != null) {
      txtFechaCreacion.setValue(null);
      txtFechaCreacion.setDisabled(true);
    }

    if (txtIdAnxResp != null) {
      txtIdAnxResp.setValue(null);
      txtIdAnxResp.setDisabled(false);
    }

    if (btnSave != null) {
      btnSave.setDisabled(true);
    }

    if (btnDelete != null) {
      btnDelete.setDisabled(true);
    }

    return "";
  }
  public void testPrimeFacesWidgetBuilder() throws Exception {

    PrimeFacesWidgetBuilder widgetBuilder = new PrimeFacesWidgetBuilder();

    // Read-only pass throughs

    Map<String, String> attributes = CollectionUtils.newHashMap();
    assertEquals(null, widgetBuilder.buildWidget(PROPERTY, attributes, null));
    attributes.put(READ_ONLY, TRUE);
    assertEquals(null, widgetBuilder.buildWidget(PROPERTY, attributes, null));
    attributes.put(LOOKUP, TRUE);
    assertEquals(null, widgetBuilder.buildWidget(PROPERTY, attributes, null));
    attributes.remove(LOOKUP);
    attributes.put(FACES_LOOKUP, "#{true}");
    assertEquals(null, widgetBuilder.buildWidget(PROPERTY, attributes, null));
    attributes.remove(FACES_LOOKUP);
    attributes.put(HIDDEN, TRUE);
    assertEquals(null, widgetBuilder.buildWidget(PROPERTY, attributes, null));
    attributes.remove(HIDDEN);
    attributes.put(TYPE, "foo");
    assertEquals(null, widgetBuilder.buildWidget(PROPERTY, attributes, null));

    // Active pass throughs

    attributes.remove(READ_ONLY);
    attributes.put(HIDDEN, TRUE);
    assertEquals(null, widgetBuilder.buildWidget(PROPERTY, attributes, null));
    attributes.remove(HIDDEN);
    attributes.put(TYPE, "foo");
    assertEquals(null, widgetBuilder.buildWidget(PROPERTY, attributes, null));
    attributes.remove(HIDDEN);

    // Action

    attributes.put(NAME, "Press Me");
    HtmlMetawidget metawidget = new HtmlMetawidget();
    CommandButton button =
        (CommandButton) widgetBuilder.buildWidget(ACTION, attributes, metawidget);
    assertEquals("Press Me", button.getValue());
    assertTrue(!button.isAjax());
    attributes.remove(ACTION);

    // Faces lookup

    attributes.put(FACES_LOOKUP, "#{foo.bar}");
    assertTrue(widgetBuilder.buildWidget(PROPERTY, attributes, null) instanceof SelectOneMenu);
    attributes.remove(FACES_LOOKUP);

    // Lookup

    attributes.put(TYPE, String.class.getName());
    attributes.put(LOOKUP, "Foo, Bar, Baz");
    metawidget.setInspector(new PropertyTypeInspector());
    assertTrue(
        widgetBuilder.buildWidget(PROPERTY, attributes, metawidget) instanceof SelectOneMenu);
    attributes.remove(LOOKUP);

    // Sliders

    attributes.put(TYPE, int.class.getName());
    attributes.put(MINIMUM_VALUE, "1");
    attributes.put(MAXIMUM_VALUE, "1024");
    UIStub stub = (UIStub) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertTrue(stub.getChildren().get(0) instanceof HtmlInputText);
    Slider slider = (Slider) stub.getChildren().get(1);
    assertEquals(1, slider.getMinValue());
    assertEquals(1024, slider.getMaxValue());

    attributes.put(TYPE, Long.class.getName());
    attributes.put(MINIMUM_VALUE, "2");
    attributes.put(MAXIMUM_VALUE, "1023");
    stub = (UIStub) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertTrue(stub.getChildren().get(0) instanceof HtmlInputText);
    slider = (Slider) stub.getChildren().get(1);
    assertEquals(2, slider.getMinValue());
    assertEquals(1023, slider.getMaxValue());

    // Spinners

    attributes.put(TYPE, int.class.getName());
    attributes.put(MAXIMUM_VALUE, "");
    Spinner spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals(2d, spinner.getMin());
    attributes.put(MAXIMUM_VALUE, "1024");

    attributes.put(MINIMUM_VALUE, "");
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals(1024d, spinner.getMax());

    // (lower bound)

    attributes.put(TYPE, byte.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Byte.MIN_VALUE, spinner.getMin());

    attributes.put(TYPE, short.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Short.MIN_VALUE, spinner.getMin());

    attributes.put(TYPE, int.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Integer.MIN_VALUE, spinner.getMin());

    attributes.put(TYPE, long.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Long.MIN_VALUE, spinner.getMin());

    attributes.put(TYPE, float.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) -Float.MAX_VALUE, spinner.getMin());

    attributes.put(TYPE, double.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals(-Double.MAX_VALUE, spinner.getMin());

    // (upper bound)

    attributes.put(MAXIMUM_VALUE, "");

    attributes.put(TYPE, byte.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Byte.MAX_VALUE, spinner.getMax());

    attributes.put(TYPE, short.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Short.MAX_VALUE, spinner.getMax());

    attributes.put(TYPE, int.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Integer.MAX_VALUE, spinner.getMax());

    attributes.put(TYPE, long.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Long.MAX_VALUE, spinner.getMax());

    attributes.put(TYPE, float.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Float.MAX_VALUE, spinner.getMax());

    attributes.put(TYPE, double.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals(Double.MAX_VALUE, spinner.getMax());

    // Calendars

    attributes.put(TYPE, Date.class.getName());
    attributes.put(DATETIME_PATTERN, "dd-MM-yyyy");
    attributes.put(LOCALE, "en-AU");
    attributes.put(TIME_ZONE, "Australia/Sydney");
    Calendar calendar = (Calendar) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals("dd-MM-yyyy", calendar.getPattern());
    assertEquals(new Locale("en-AU"), calendar.getLocale());
    assertEquals(TimeZone.getTimeZone("Australia/Sydney"), calendar.getTimeZone());

    // Suggest

    attributes.put(TYPE, String.class.getName());
    attributes.put(FACES_SUGGEST, "#{foo.bar}");

    AutoComplete autocomplete =
        (AutoComplete) widgetBuilder.buildWidget(PROPERTY, attributes, metawidget);
    assertEquals("#{foo.bar}", autocomplete.getCompleteMethod().getExpressionString());
    assertEquals(
        Object.class, autocomplete.getCompleteMethod().getMethodInfo(null).getReturnType());
    assertEquals(
        String.class, autocomplete.getCompleteMethod().getMethodInfo(null).getParamTypes()[0]);
    assertEquals(1, autocomplete.getCompleteMethod().getMethodInfo(null).getParamTypes().length);

    attributes.remove(FACES_SUGGEST);

    // ColorPickers. Note org.primefaces.component.ColorPickerRenderer does *not* support
    // java.awt.Color (http://forum.primefaces.org/viewtopic.php?t=21593) so it isn't much good
    // to us here

    attributes.put(TYPE, Color.class.getName());
    assertEquals(null, widgetBuilder.buildWidget(PROPERTY, attributes, null));
  }
Example #9
0
  public void modificarPersonal() {

    long cedula = 0;
    String nombre = "";
    String apellidos = "";
    String direccion = "";
    String correo = "";
    String telefono = "";
    String clave = "";
    Date fechaNacimiento;
    String lugarNacimiento = "";

    int excepciones = 0;

    if (txtCedulaPersonal.getValue().toString().equals("")
        || txtNombrePersonal.getValue().toString().equals("")
        || txtApellidoPersonal.getValue().toString().equals("")
        || txtDireccionPersonal.getValue().toString().equals("")
        || txtCorreoPersonal.getValue().toString().equals("")
        || txtTelefonoPersonal.getValue().toString().equals("")
        || txtClavePersonal.getValue().toString().equals("")
        || txtLugarNacimientoPersonal.getValue().toString().equals("")) {
      FacesContext.getCurrentInstance()
          .addMessage(
              null,
              new FacesMessage(FacesMessage.SEVERITY_WARN, "Error", "Todos son obligatorios."));
    } else {

      try {
        cedula = Long.parseLong(txtCedulaPersonal.getValue().toString());
      } catch (Exception error1) {
        FacesContext.getCurrentInstance()
            .addMessage(
                null,
                new FacesMessage(
                    FacesMessage.SEVERITY_WARN, "Error", "El campo cedula solo permite numeros."));
        excepciones++;
      }

      nombre = txtNombrePersonal.getValue().toString();
      apellidos = txtApellidoPersonal.getValue().toString();
      direccion = txtDireccionPersonal.getValue().toString();
      correo = txtCorreoPersonal.getValue().toString();
      telefono = txtTelefonoPersonal.getValue().toString();
      clave = txtClavePersonal.getValue().toString();
      fechaNacimiento = (Date) txtFechaNacimientoPersonal.getValue();
      lugarNacimiento = txtLugarNacimientoPersonal.getValue().toString();

      if (excepciones == 0) {
        try {
          Personal p = new Personal();
          p.setDocumentopersonal(cedula);
          p.setNombrepersonal(nombre);
          p.setApellidopersonal(apellidos);
          p.setDireccionpersonal(direccion);
          p.setCorreopersonal(correo);
          p.setClavepersonal(clave);
          p.setTelefonopersonal(telefono);
          p.setFechanacimientopersonal(fechaNacimiento);
          p.setLugarnacimientopersonal(lugarNacimiento);

          personalDAO.modificar(p);

          // si todo sale bien aplique esto
          addMessage("Exito", "El personal se ha modificado con éxito.");
          limpiar();

        } catch (Exception e5) {
          FacesContext.getCurrentInstance()
              .addMessage(
                  null,
                  new FacesMessage(
                      FacesMessage.SEVERITY_WARN,
                      "Error",
                      "Error llenando los datos del nuevo personal."));
        }
      } else {
        FacesContext.getCurrentInstance()
            .addMessage(
                null,
                new FacesMessage(FacesMessage.SEVERITY_WARN, "Error", "Verifique los datos."));
      }
    }
  }
Example #10
0
  public void registrarPersonal() {

    long cedula = 0;
    String nombre = "";
    String apellidos = "";
    String direccion = "";
    String correo = "";
    String telefono = "";
    String clave = "";
    Date fechaNacimiento;
    String lugarNacimiento = "";
    int excepciones = 0;
    if (txtCedulaPersonal.getValue().toString().equals("")
        || txtNombrePersonal.getValue().toString().equals("")
        || txtApellidoPersonal.getValue().toString().equals("")
        || txtDireccionPersonal.getValue().toString().equals("")
        || txtCorreoPersonal.getValue().toString().equals("")
        || txtTelefonoPersonal.getValue().toString().equals("")
        || txtClavePersonal.getValue().toString().equals("")
        || txtLugarNacimientoPersonal.getValue().toString().equals("")) {
      FacesContext.getCurrentInstance()
          .addMessage(
              null,
              new FacesMessage(
                  FacesMessage.SEVERITY_WARN, "Error", "Todos los campos son obligatorios."));
    } else {

      try {
        cedula = Long.parseLong(txtCedulaPersonal.getValue().toString());
      } catch (Exception error1) {
        FacesContext.getCurrentInstance()
            .addMessage(
                null,
                new FacesMessage(
                    FacesMessage.SEVERITY_WARN, "Error", "El campo cedula solo permite numeros."));
        excepciones++;
      }

      nombre = txtNombrePersonal.getValue().toString();
      apellidos = txtApellidoPersonal.getValue().toString();
      direccion = txtDireccionPersonal.getValue().toString();
      correo = txtCorreoPersonal.getValue().toString();
      telefono = txtTelefonoPersonal.getValue().toString();
      clave = txtClavePersonal.getValue().toString();
      fechaNacimiento = (Date) txtFechaNacimientoPersonal.getValue();
      lugarNacimiento = txtLugarNacimientoPersonal.getValue().toString();

      if (excepciones == 0) {
        try {
          Personal p = new Personal();
          p.setDocumentopersonal(cedula);
          p.setNombrepersonal(nombre);
          p.setApellidopersonal(apellidos);
          p.setDireccionpersonal(direccion);
          p.setCorreopersonal(correo);
          p.setClavepersonal(clave);
          p.setTelefonopersonal(telefono);
          p.setFechanacimientopersonal(fechaNacimiento);
          p.setLugarnacimientopersonal(lugarNacimiento);
          cedulaRetornar = p.getDocumentopersonal() + "";

          personalDAO.crear(p);

          switch (comboRol) {
            case "Coordinador":
              FacesContext.getCurrentInstance()
                  .getExternalContext()
                  .redirect("gestionCoordinador.xhtml");
              llegada = "nuevo";
              break;

            case "Funcionario":
              FacesContext.getCurrentInstance()
                  .getExternalContext()
                  .redirect("gestionFuncionario.xhtml");
              llegada = "nuevo";
              break;

            case "Instructor":
              FacesContext.getCurrentInstance()
                  .getExternalContext()
                  .redirect("gestionInstructor.xhtml");
              llegada = "nuevo";
              break;

            case "Guarda":
              FacesContext.getCurrentInstance()
                  .getExternalContext()
                  .redirect("gestionGuarda.xhtml");
              llegada = "nuevo";
              break;

            case "Ninguno":
              FacesContext.getCurrentInstance()
                  .addMessage(
                      null,
                      new FacesMessage(
                          FacesMessage.SEVERITY_INFO,
                          "Éxito",
                          "El personal se ha registrado con éxito."));
              break;

            default:
              break;
          }

          limpiar();

        } catch (Exception e5) {
          FacesContext.getCurrentInstance()
              .addMessage(
                  null,
                  new FacesMessage(
                      FacesMessage.SEVERITY_WARN,
                      "Error",
                      "Error llenando los datos del nuevo personal." + e5.getMessage()));
        }
      } else {
        FacesContext.getCurrentInstance()
            .addMessage(
                null,
                new FacesMessage(FacesMessage.SEVERITY_WARN, "Error", "Verifique los datos."));
      }
    }
  }
  public void testPrimeFacesWidgetBuilder() throws Exception {

    PrimeFacesWidgetBuilder widgetBuilder = new PrimeFacesWidgetBuilder();

    // Read-only pass throughs

    Map<String, String> attributes = CollectionUtils.newHashMap();
    assertTrue(null == widgetBuilder.buildWidget(PROPERTY, attributes, null));
    attributes.put(READ_ONLY, TRUE);
    assertTrue(null == widgetBuilder.buildWidget(PROPERTY, attributes, null));
    attributes.put(LOOKUP, TRUE);
    assertTrue(null == widgetBuilder.buildWidget(PROPERTY, attributes, null));
    attributes.remove(LOOKUP);
    attributes.put(FACES_LOOKUP, TRUE);
    assertTrue(null == widgetBuilder.buildWidget(PROPERTY, attributes, null));
    attributes.remove(FACES_LOOKUP);
    attributes.put(HIDDEN, TRUE);
    assertTrue(null == widgetBuilder.buildWidget(PROPERTY, attributes, null));
    attributes.remove(HIDDEN);
    attributes.put(TYPE, "foo");
    assertTrue(null == widgetBuilder.buildWidget(PROPERTY, attributes, null));

    // Active pass throughs

    attributes.remove(READ_ONLY);
    attributes.put(LOOKUP, TRUE);
    assertTrue(null == widgetBuilder.buildWidget(PROPERTY, attributes, null));
    attributes.remove(LOOKUP);
    attributes.put(FACES_LOOKUP, TRUE);
    assertTrue(null == widgetBuilder.buildWidget(PROPERTY, attributes, null));
    attributes.remove(FACES_LOOKUP);
    attributes.put(HIDDEN, TRUE);
    assertTrue(null == widgetBuilder.buildWidget(PROPERTY, attributes, null));
    attributes.remove(HIDDEN);
    attributes.put(TYPE, "foo");
    assertTrue(null == widgetBuilder.buildWidget(PROPERTY, attributes, null));

    // Sliders

    attributes.put(TYPE, int.class.getName());
    attributes.put(MINIMUM_VALUE, "1");
    attributes.put(MAXIMUM_VALUE, "1024");
    UIStub stub = (UIStub) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertTrue(stub.getChildren().get(0) instanceof HtmlInputText);
    Slider slider = (Slider) stub.getChildren().get(1);
    assertEquals(1, slider.getMinValue());
    assertEquals(1024, slider.getMaxValue());

    attributes.put(TYPE, Long.class.getName());
    attributes.put(MINIMUM_VALUE, "2");
    attributes.put(MAXIMUM_VALUE, "1023");
    stub = (UIStub) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertTrue(stub.getChildren().get(0) instanceof HtmlInputText);
    slider = (Slider) stub.getChildren().get(1);
    assertEquals(2, slider.getMinValue());
    assertEquals(1023, slider.getMaxValue());

    // Spinners

    attributes.put(TYPE, int.class.getName());
    attributes.put(MAXIMUM_VALUE, "");
    Spinner spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals(2d, spinner.getMin());
    attributes.put(MAXIMUM_VALUE, "1024");

    attributes.put(MINIMUM_VALUE, "");
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals(1024d, spinner.getMax());

    // (lower bound)

    attributes.put(TYPE, byte.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Byte.MIN_VALUE, spinner.getMin());

    attributes.put(TYPE, short.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Short.MIN_VALUE, spinner.getMin());

    attributes.put(TYPE, int.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Integer.MIN_VALUE, spinner.getMin());

    attributes.put(TYPE, long.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Long.MIN_VALUE, spinner.getMin());

    attributes.put(TYPE, float.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) -Float.MAX_VALUE, spinner.getMin());

    attributes.put(TYPE, double.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals(-Double.MAX_VALUE, spinner.getMin());

    // (upper bound)

    attributes.put(MAXIMUM_VALUE, "");

    attributes.put(TYPE, byte.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Byte.MAX_VALUE, spinner.getMax());

    attributes.put(TYPE, short.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Short.MAX_VALUE, spinner.getMax());

    attributes.put(TYPE, int.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Integer.MAX_VALUE, spinner.getMax());

    attributes.put(TYPE, long.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Long.MAX_VALUE, spinner.getMax());

    attributes.put(TYPE, float.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals((double) Float.MAX_VALUE, spinner.getMax());

    attributes.put(TYPE, double.class.getName());
    spinner = (Spinner) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals(Double.MAX_VALUE, spinner.getMax());

    // Calendars

    attributes.put(TYPE, Date.class.getName());
    attributes.put(DATETIME_PATTERN, "dd-MM-yyyy");
    attributes.put(LOCALE, "en-AU");
    attributes.put(TIME_ZONE, "Australia/Sydney");
    Calendar calendar = (Calendar) widgetBuilder.buildWidget(PROPERTY, attributes, null);
    assertEquals("dd-MM-yyyy", calendar.getPattern());
    assertEquals(new Locale("en-AU"), calendar.getLocale());
    assertEquals(TimeZone.getTimeZone("Australia/Sydney"), calendar.getTimeZone());

    // ColorPickers

    attributes.put(TYPE, Color.class.getName());
    assertTrue(widgetBuilder.buildWidget(PROPERTY, attributes, null) instanceof ColorPicker);

    attributes.put(READ_ONLY, TRUE);
    HtmlMetawidget metawidget = new HtmlMetawidget();
    assertTrue(
        widgetBuilder.buildWidget(PROPERTY, attributes, metawidget) instanceof HtmlOutputText);
  }