@SuppressWarnings("unchecked")
  @Override
  public void decode(FacesContext context, UIComponent component) {
    Map<String, String> requestMap = context.getExternalContext().getRequestParameterMap();

    Object event = requestMap.get(XhtmlConstants.EVENT_PARAM);

    if ((event != null) && event.equals(XhtmlConstants.GOTO_EVENT)) {
      Object source = requestMap.get(XhtmlConstants.SOURCE_PARAM);

      if (source != null && source.equals(component.getClientId(context))) {

        Object valueObject = requestMap.get(XhtmlConstants.VALUE_PARAM);

        // we piggyback on the size parameter.
        // 0 means we are moving to a previous step, 1 means we are
        // moving to the next step.
        Object sizeObject = requestMap.get(XhtmlConstants.SIZE_PARAM);

        if (valueObject != null) {
          int value = -1;

          try {
            value = Integer.parseInt(valueObject.toString());
          } catch (NumberFormatException nfe) {
            _LOG.severe(nfe);
          }

          int size = 0;

          try {
            size = Integer.parseInt(sizeObject.toString());
          } catch (NumberFormatException nfe) {
            _LOG.warning(nfe);
          }

          if (size < 0) size = 0;

          if (value >= 0) {
            UIXProcess process = (UIXProcess) component;
            Object oldPath = process.getRowKey();
            Object focusPath = process.getFocusRowKey();
            process.setRowKey(focusPath);
            UIComponent stamp = process.getNodeStamp();
            int index = process.getRowIndex();

            if (size == 0) {
              index = ProcessUtils.getBackIndex(process, stamp, index);
            } else {
              index = ProcessUtils.getNextIndex(process, stamp, index);
            }

            process.setRowIndex(index);
            new ActionEvent(stamp).queue();
            process.setRowKey(oldPath);
          }
        }
      }
    }
  }
  private void _renderHiddenFields(FacesContext context, RenderingContext arc, Train train)
      throws IOException {
    if ((train.getFormName() != null) && supportsScripting(arc)) {
      // render hidden fields to hold the form data
      FormData formData = arc.getFormData();
      if (formData != null) {
        formData.addNeededValue(XhtmlConstants.EVENT_PARAM);
        formData.addNeededValue(XhtmlConstants.SOURCE_PARAM);
        formData.addNeededValue(XhtmlConstants.VALUE_PARAM);
        formData.addNeededValue(XhtmlConstants.SIZE_PARAM);
      }

      // Render script submission code.
      ProcessUtils.renderNavSubmitScript(context, arc);
    }
  }