Examples of PageActionEvent


Examples of org.apache.myfaces.tobago.event.PageActionEvent

        action = PageAction.parse(component.getId());
      } catch (Exception e) {
        LOG.error("Illegal value for PageAction :" + component.getId());
        return;
      }
      PageActionEvent event = new PageActionEvent(component.getParent(), action);

      switch (action) {
        case TO_PAGE:
        case TO_ROW:
          Map map = facesContext.getExternalContext().getRequestParameterMap();
          Object value = map.get(clientId + ComponentUtils.SUB_SEPARATOR + "value");
          try {
            event.setValue(Integer.parseInt((String) value));
          } catch (NumberFormatException e) {
            LOG.error("Can't parse integer value for action " + action.name() + ": " + value);
          }
          break;
        default:
View Full Code Here

Examples of org.apache.myfaces.tobago.event.PageActionEvent

  }

  public Object invoke(FacesContext facesContext, Object[] aobj)
      throws EvaluationException {
    if (aobj[0] instanceof PageActionEvent) {
      PageActionEvent pageEvent = (PageActionEvent) aobj[0];

      UIData sheet = pageEvent.getSheet();
      int first = -1;

      if (LOG.isDebugEnabled()) {
        LOG.debug("action = '" + pageEvent.getAction().name() + "'");
      }

      int start;
      switch(pageEvent.getAction()) {
        case FIRST:
          first = 0;
          break;
        case PREV:
          start = sheet.getFirst() - sheet.getRows();
          first = start < 0 ? 0 : start;
          break;
        case NEXT:
          if (sheet.hasRowCount()) {
            start = sheet.getFirst() + sheet.getRows();
            first = start > sheet.getRowCount() ? sheet.getLastPageIndex() : start;
          } else {
            if (sheet.isAtEnd()) {
              first = sheet.getFirst();
            } else {
              first = sheet.getFirst() + sheet.getRows();
            }
          }
          break;
        case LAST:
          first = sheet.getLastPageIndex();
          break;
        case TO_ROW:
          start = pageEvent.getValue() -1;
          if (start > sheet.getLastPageIndex()) {
            start = sheet.getLastPageIndex();
          } else if (start < 0) {
            start = 0;
          }
          first = start;
          break;
        case TO_PAGE:
          start = pageEvent.getValue() -1;
          if (LOG.isDebugEnabled()) {
            LOG.debug("start = " + start + "  sheet.getRows() = "
                + sheet.getRows() + " => start = " + (start * sheet.getRows()));
          }
          start = start * sheet.getRows();
 
View Full Code Here

Examples of org.apache.myfaces.tobago.event.PageActionEvent

        action = PageAction.parse(component.getId());
      } catch (Exception e) {
        LOG.error("Illegal value for PageAction :" + component.getId());
        return;
      }
      PageActionEvent event = new PageActionEvent(component.getParent(), action);

      switch (action) {
        case TO_PAGE:
        case TO_ROW:
          Map map = facesContext.getExternalContext().getRequestParameterMap();
          Object value = map.get(clientId + ComponentUtils.SUB_SEPARATOR + "value");
          try {
            event.setValue(Integer.parseInt((String) value));
          } catch (NumberFormatException e) {
            LOG.error("Can't parse integer value for action " + action.name() + ": " + value);
          }
          break;
        default:
View Full Code Here

Examples of org.apache.myfaces.tobago.event.PageActionEvent

  }

  public Object invoke(FacesContext facesContext, Object[] aobj)
      throws EvaluationException {
    if (aobj[0] instanceof PageActionEvent) {
      PageActionEvent pageEvent = (PageActionEvent) aobj[0];

      UIData sheet = pageEvent.getSheet();
      int first = -1;

      if (LOG.isDebugEnabled()) {
        LOG.debug("action = '" + pageEvent.getAction().name() + "'");
      }

      int start;
      switch (pageEvent.getAction()) {
        case FIRST:
          first = 0;
          break;
        case PREV:
          start = sheet.getFirst() - sheet.getRows();
          first = start < 0 ? 0 : start;
          break;
        case NEXT:
          if (sheet.hasRowCount()) {
            start = sheet.getFirst() + sheet.getRows();
            first = start > sheet.getRowCount() ? sheet.getLastPageIndex() : start;
          } else {
            if (sheet.isAtEnd()) {
              first = sheet.getFirst();
            } else {
              first = sheet.getFirst() + sheet.getRows();
            }
          }
          break;
        case LAST:
          first = sheet.getLastPageIndex();
          break;
        case TO_ROW:
          start = pageEvent.getValue() - 1;
          if (start > sheet.getLastPageIndex()) {
            start = sheet.getLastPageIndex();
          } else if (start < 0) {
            start = 0;
          }
          first = start;
          break;
        case TO_PAGE:
          start = pageEvent.getValue() - 1;
          if (LOG.isDebugEnabled()) {
            LOG.debug("start = " + start + "  sheet.getRows() = "
                + sheet.getRows() + " => start = " + (start * sheet.getRows()));
          }
          start = start * sheet.getRows();
 
View Full Code Here

Examples of org.apache.myfaces.tobago.event.PageActionEvent

        }
      } catch (Exception e) {
        LOG.error("Illegal value for PageAction :" + component.getId());
        return;
      }
      PageActionEvent event = new PageActionEvent((UIData) component.getParent(), action);

      switch (action) {
        case TO_PAGE:
        case TO_ROW:
          Map map = facesContext.getExternalContext().getRequestParameterMap();
          Object value = map.get(clientId + SUBCOMPONENT_SEP + "value");
          try {
            event.setValue(Integer.parseInt((String) value));
          } catch (Exception e) {
            LOG.error("Can't parse value for action " + action.name() + ": " + value);
          }
          break;
        default:
View Full Code Here

Examples of org.apache.myfaces.tobago.event.PageActionEvent

        }
      } catch (Exception e) {
        LOG.error("Illegal value for PageAction :" + component.getId());
        return;
      }
      PageActionEvent event = new PageActionEvent((UIData) component.getParent(), action);

      switch(action) {
        case TO_PAGE:
        case TO_ROW:
          Map map = facesContext.getExternalContext().getRequestParameterMap();
          Object value = map.get(clientId + SUBCOMPONENT_SEP + "value");
          try {
            event.setValue(Integer.parseInt((String) value));
          } catch (Exception e) {
            LOG.error("Can't parse value for action " + action.name() + ": " + value);
          }
          break;
        default:
View Full Code Here

Examples of org.apache.myfaces.tobago.event.PageActionEvent

        }
      } catch (Exception e) {
        LOG.error("Illegal value for PageAction :" + component.getId());
        return;
      }
      PageActionEvent event = new PageActionEvent((UIData) component.getParent(), action);

      switch(action) {
        case TO_PAGE:
        case TO_ROW:
          Map map = facesContext.getExternalContext().getRequestParameterMap();
          Object value = map.get(clientId + SUBCOMPONENT_SEP + "value");
          try {
            event.setValue(Integer.parseInt((String) value));
          } catch (Exception e) {
            LOG.error("Can't parse value for action " + action.name() + ": " + value);
          }
          break;
        default:
View Full Code Here

Examples of org.apache.myfaces.tobago.event.PageActionEvent

        action = PageAction.parse(component.getId());
      } catch (final Exception e) {
        LOG.error("Illegal value for PageAction :" + component.getId());
        return;
      }
      final PageActionEvent event = new PageActionEvent(component.getParent(), action);

      switch (action) {
        case TO_PAGE:
        case TO_ROW:
          final Map map = facesContext.getExternalContext().getRequestParameterMap();
          final Object value = map.get(clientId + ComponentUtils.SUB_SEPARATOR + "value");
          try {
            event.setValue(Integer.parseInt((String) value));
          } catch (final NumberFormatException e) {
            LOG.error("Can't parse integer value for action " + action.name() + ": " + value);
          }
          break;
        default:
View Full Code Here

Examples of org.apache.myfaces.tobago.event.PageActionEvent

        action = PageAction.parse(component.getId());
      } catch (final Exception e) {
        LOG.error("Illegal value for PageAction :" + component.getId());
        return;
      }
      final PageActionEvent event = new PageActionEvent(component.getParent(), action);

      switch (action) {
        case TO_PAGE:
        case TO_ROW:
          final Map map = facesContext.getExternalContext().getRequestParameterMap();
          final Object value = map.get(clientId + ComponentUtils.SUB_SEPARATOR + "value");
          try {
            event.setValue(Integer.parseInt((String) value));
          } catch (final NumberFormatException e) {
            LOG.error("Can't parse integer value for action " + action.name() + ": " + value);
          }
          break;
        default:
View Full Code Here

Examples of org.apache.myfaces.tobago.event.PageActionEvent

        action = PageAction.parse(component.getId());
      } catch (Exception e) {
        LOG.error("Illegal value for PageAction :" + component.getId());
        return;
      }
      PageActionEvent event = new PageActionEvent(component.getParent(), action);

      switch (action) {
        case TO_PAGE:
        case TO_ROW:
          Map map = facesContext.getExternalContext().getRequestParameterMap();
          Object value = map.get(clientId + ComponentUtils.SUB_SEPARATOR + "value");
          try {
            event.setValue(Integer.parseInt((String) value));
          } catch (NumberFormatException e) {
            LOG.error("Can't parse integer value for action " + action.name() + ": " + value);
          }
          break;
        default:
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.