public boolean submitPerformed(SubmitEvent e) throws Exception {
    /** redirect to lookupPageURL?returnto=parentPage&comp=nameofComponent */
    /** open new page */
    _rowNo = e.getRow();
    String rowURL = "";
    if (_rowNo != -1) rowURL = "&rowNo=" + _rowNo;

    HttpServletResponse resp = e.getPage().getCurrentResponse();
    String URL = _lookUpPageURL;
    if (_lookUpPageURL != null && _lookUpPageURL.indexOf("?") == -1)
      URL += "?returnTo=" + e.getPage().getPageName() + "&comp=" + getFullName() + rowURL;
    else URL += "&returnTo=" + e.getPage().getPageName() + "&comp=" + getFullName() + rowURL;

    String sCurrentValue = null;

    // Try to get the text that is already entered to the text edit box. We
    // will use this value in the list form to filter the results.
    if (_rowNo != -1) sCurrentValue = getEditField().getValue(_rowNo);
    else sCurrentValue = getEditField().getValue();

    if (sCurrentValue != null && sCurrentValue.length() > 0)
      URL += "&" + PARAM_LISTFORM_SEARCH_FILTER_STRING + "=" + sCurrentValue;

    if (_extraParms != null) URL += "&" + _extraParms;
    resp.sendRedirect(URL);
    return false;
  }
  @Override
  public boolean submitPerformed(SubmitEvent e) throws Exception {
    // Find
    if (e.getComponent() == _buscarBUT) {
      try {
        _dsArticulos.reset();
        _dsArticulos.retrieve(armarCriterio());
        if (_dsArticulos.getRowCount() <= 0) {
          displayErrorMessage("La búsqueda no ha retornado resultados");
          return false;
        }
      } catch (RuntimeException ex) {
        displayErrorMessage(ex.getMessage());
        return false;
      }
    }

    // clear button
    if (e.getComponent() == _limpiarBUT) {
      _lkpAttrINP1.setValue(null);
      _lkpAttrINP2.setValue(null);
      _lkpAttrINP3.setValue(null);
      _valorAttr1.setValue(null);
      _valorAttr2.setValue(null);
      _valorAttr3.setValue(null);
    }

    // Call ReplicateSta11QuartzJob manually
    if (e.getComponent() == _replicaFromTangoBUT) {
      ReplicateSta11QuartzJob replicateSta11 = new ReplicateSta11QuartzJob();
      replicateSta11.replicate();
      _dsArticulos.reset();
      _dsArticulos.retrieve(armarCriterio());
      if (_dsArticulos.getRowCount() <= 0) {
        displayErrorMessage("No se encontraron articulos");
        return false;
      }
    }

    // Call ReplicateCpa01QuartzJob manually
    if (e.getComponent() == _replicaProveedores) {
      ReplicateCpa01QuartzJob replicateCpa01 = new ReplicateCpa01QuartzJob();
      replicateCpa01.importaProveedores();
    }

    return super.submitPerformed(e);
  }
Example #3
0
  public boolean executeEvent(int type) throws Exception {
    if (type != EVENT_SUBMIT) {
      return true;
    }

    if (_listeners == null) {
      return true;
    }

    SubmitEvent e = new SubmitEvent(getPage(), this, getName(), getFullName(), _rowNo);

    for (int i = 0; i < _listeners.size(); i++) {
      SubmitListener l = (SubmitListener) _listeners.elementAt(i);
      e.setNextListener((_listeners.size() > (i + 1)) ? _listeners.elementAt(i + 1) : null);

      if (!l.submitPerformed(e)) {
        return false;
      }
    }

    return true;
  }
  @Override
  public boolean submitPerformed(SubmitEvent e) throws Exception {

    if (e.getComponent() == _grabarParteBUT3) {
      try {
        _dsPartes.update();
      } catch (DataStoreException ex) {
        displayErrorMessage(ex.getMessage());
        return false;
      }
    }

    if (e.getComponent() == _nuevoParteCopiarBUT1 || e.getComponent() == _nuevoBUT91) {

      int rowActual = _dsPartes.getRow();
      // si existe row anterior, le copia los valores
      if (rowActual != -1) {
        // valido el parte que estoy copiando
        try {
          _dsPartes.completaUnParte(rowActual);
        } catch (DataStoreException ex) {
          // muestro mensaje pero sigo sin problemas
          displayErrorMessage(ex.getMessage());
          _fechaTE3.setFocus(rowActual, true);
          return false;
        }
        int row = _dsPartes.insertRow(0);

        _dsPartes.setPartesMoFecha(row, _dsPartes.getPartesMoFecha(rowActual + 1));
        _dsPartes.setPartesMoHoraDesde(row, _dsPartes.getPartesMoHoraDesde(rowActual + 1));
        _dsPartes.setPartesMoHoraHasta(row, _dsPartes.getPartesMoHoraHasta(rowActual + 1));
        _dsPartes.setPartesMoNroLegajo(row, _dsPartes.getPartesMoNroLegajo(rowActual + 1));
        _dsPartes.setPartesMoProyecto(row, _dsPartes.getPartesMoProyecto(rowActual + 1));
        _dsPartes.setPartesMoProyectoNombre(
            row, _dsPartes.getPartesMoProyectoNombre(rowActual + 1));
        _dsPartes.setPartesMoSectorId(row, _dsPartes.getPartesMoSectorId(rowActual + 1));
        _dsPartes.setPartesMoSupervisor(row, _dsPartes.getPartesMoSupervisor(rowActual + 1));

        // hace foco en el registro
        int nroPagerow = _datatable1.getPage(row);
        int nroPageActual = _datatable1.getPage(_dsPartes.getRow());
        if (nroPagerow != nroPageActual) _datatable1.setPage(_datatable1.getPage(row));
        _fechaTE3.setFocus(row, true);
      } else {
        displayErrorMessage("Debe seleccionar un parte primero antes de copiarlo");
        return false;
      }
    }

    if (e.getComponent() == _nuevoParteNuevoBUT2 || e.getComponent() == _nuevoBUT92) {

      int rowActual = _dsPartes.getRow();
      int row = _dsPartes.insertRow(0);
      // si existe row anterior, s�lo copia valores b�sicos
      if (row > 1) {
        // valido el parte que estoy copiando
        _dsPartes.setPartesMoFecha(row, _dsPartes.getPartesMoFecha(rowActual + 1));
        _dsPartes.setPartesMoProyectoId(row, _dsPartes.getPartesMoProyectoId(rowActual + 1));
      }

      // hace foco en el registro
      int nroPagerow = _datatable1.getPage(row);
      int nroPageActual = _datatable1.getPage(_dsPartes.getRow());
      if (nroPagerow != nroPageActual) _datatable1.setPage(_datatable1.getPage(row));
      _fechaTE3.setFocus(row, true);
    }

    if (e.getComponent() == _eliminaParteBUT4) {
      // elimina todos los partes seleccionados
      for (int i = 0; i < _dsPartes.getRowCount(); i++) {
        if (_dsPartes.getInt(i, SELECCION_PARTE_FLAG) == 1) {
          // Rol marcado para selecci�n
          _dsPartes.deleteRow(i);
        }
      }

      _dsPartes.update();
      refrescaPartes();
    }

    if (e.getComponent() == _refrescarBUT5) {
      refrescaPartes();
    }

    return super.submitPerformed(e);
  }