I am trying to create a cellgrid. That would be something like a
cellList with the difference that it should be able to use all arrows
to navigate throw the grid. I have tried it with a normal cellList but
it seems only possible to use up and down arrow. The function below
from package "com.google.gwt.user.cellview.client" shows that
situation. It is a final function so I can't override it. I have also
tried with a table but it works (logicaly) with rows and columns and
Ishould work just with cells. I would like to use all the advantages
that we can find in cellList (selection and so on), thus use a normal
grid seems not to resolve the problem. The best solution were to add
to more cases to the next function. Someone knows how could I achive
it?

desired solution:
Add this code to the case of the next function:
 case KeyCodes.KEY_LEFT:
          presenter.keyboardPrev();
          event.preventDefault();
          return;
case KeyCodes.KEY_RIGHT:
          presenter.keyboardNext();
          event.preventDefault();
          return;
Chnage this code of the case statement:
 case KeyCodes.KEY_DOWN:
          presenter.keyboardDownt();
          event.preventDefault();
          return;
        case KeyCodes.KEY_UP:
          presenter.keyboardUp();
          event.preventDefault();
          return;

Original function in package
com.google.gwt.user.cellview.client.AbstractHasData

 @Override
  public final void onBrowserEvent(Event event) {
    CellBasedWidgetImpl.get().onBrowserEvent(this, event);

    // Ignore spurious events (such as onblur) while we refresh the
table.
    if (isRefreshing) {
      return;
    }

    // Verify that the target is still a child of this widget. IE
fires focus
    // events even after the element has been removed from the DOM.
    EventTarget eventTarget = event.getEventTarget();
    if (!Element.is(eventTarget)
        || !getElement().isOrHasChild(Element.as(eventTarget))) {
      return;
    }
    super.onBrowserEvent(event);

    String eventType = event.getType();
    if ("focus".equals(eventType)) {
      // Remember the focus state.
      isFocused = true;
      onFocus();
    } else if ("blur".equals(eventType)) {
      // Remember the blur state.
      isFocused = false;
      onBlur();
    } else if ("keydown".equals(eventType) && !
isKeyboardNavigationSuppressed()) {
      // A key event indicates that we have focus.
      isFocused = true;

      // Handle keyboard navigation. Prevent default on navigation
events to
      // prevent default scrollbar behavior.
      int keyCode = event.getKeyCode();
      switch (keyCode) {
        case KeyCodes.KEY_DOWN:
          presenter.keyboardNext();
          event.preventDefault();
          return;
        case KeyCodes.KEY_UP:
          presenter.keyboardPrev();
          event.preventDefault();
          return;
        case KeyCodes.KEY_PAGEDOWN:
          presenter.keyboardNextPage();
          event.preventDefault();
          return;
        case KeyCodes.KEY_PAGEUP:
          presenter.keyboardPrevPage();
          event.preventDefault();
          return;
        case KeyCodes.KEY_HOME:
          presenter.keyboardHome();
          event.preventDefault();
          return;
        case KeyCodes.KEY_END:
          presenter.keyboardEnd();
          event.preventDefault();
          return;
        case 32:
          // Prevent the list box from scrolling.
          event.preventDefault();
          return;
      }
    }

    // Let subclasses handle the event now.
    onBrowserEvent2(event);
  }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to