Package com.sencha.gxt.widget.core.client.grid.Grid

Examples of com.sencha.gxt.widget.core.client.grid.Grid.GridCell


    }

    if (selection == null) {
      e.preventDefault();
      e.stopPropagation();
      GridCell cell = grid.walkCells(0, 0, 1, callback);
      if (cell != null) {
        selectCell(cell.getRow(), cell.getCol());
      }
      return;
    }

    int r = selection.getRow();
    int c = selection.getCell();

    GridCell newCell = null;

    switch (e.getKeyCode()) {
      case KeyCodes.KEY_HOME:
        if (enableNavKeys) {
          newCell = grid.walkCells(selection.getRow(), 0, 1, callback);
        }
        break;
      case KeyCodes.KEY_END:
        if (enableNavKeys) {
          newCell = grid.walkCells(selection.getRow(), grid.getColumnModel().getColumnCount() - 1, -1, callback);
        }
        break;
      case KeyCodes.KEY_PAGEUP:
        if (enableNavKeys) {
          newCell = grid.walkCells(0, 0, 1, callback);
        }
        break;
      case KeyCodes.KEY_PAGEDOWN:
        if (enableNavKeys) {
          int idx = listStore.indexOf(listStore.get(listStore.size() - 1));
          newCell = grid.walkCells(idx, 0, 1, callback);
        }
        break;
      case KeyCodes.KEY_TAB:
        if (e.getShiftKey()) {
          newCell = grid.walkCells(r, c - 1, -1, callback);
        } else {
          newCell = grid.walkCells(r, c + 1, 1, callback);
        }
        break;
      case KeyCodes.KEY_DOWN: {
        newCell = grid.walkCells(r + 1, c, 1, callback);
        break;
      }
      case KeyCodes.KEY_UP: {
        newCell = grid.walkCells(r - 1, c, -1, callback);
        break;
      }
      case KeyCodes.KEY_LEFT:
        newCell = grid.walkCells(r, c - 1, -1, callback);
        break;
      case KeyCodes.KEY_RIGHT:
        newCell = grid.walkCells(r, c + 1, 1, callback);
        break;
    }

    if (newCell != null) {
      selectCell(newCell.getRow(), newCell.getCol());
      e.preventDefault();
      e.stopPropagation();
    }
  }
View Full Code Here


    }
  }

  protected void onEnter(NativeEvent evt) {
    evt.preventDefault();
    GridCell gc = activeCell;
    completeEditing();
    if (gc != null) {
      focusCell(gc.getRow(), gc.getCol());
    }
  }
View Full Code Here

      focusCell(gc.getRow(), gc.getCol());
    }
  }

  protected void onEsc(NativeEvent evt) {
    GridCell gc = activeCell;
    cancelEditing();
    if (gc != null) {
      focusCell(gc.getRow(), gc.getCol());
      focusGrid();
    }
  }
View Full Code Here

    if (editableGrid != null) {
      if (editableGrid.getView().isSelectableTarget(target) && editableGrid.getView().getBody().isOrHasChild(target)) {
        int row = editableGrid.getView().findRowIndex(target);
        int col = editableGrid.getView().findCellIndex(target, null);
        if (row != -1 && col != -1) {
          startEditing(new GridCell(row, col));
        }
      }
    }
  }
View Full Code Here

    }

    if (selection == null) {
      e.preventDefault();
      e.stopPropagation();
      GridCell cell = grid.walkCells(0, 0, 1, callback);
      if (cell != null) {
        selectCell(cell.getRow(), cell.getCol());
      }
      return;
    }

    int r = selection.getRow();
    int c = selection.getCell();

    GridCell newCell = null;

    switch (e.getKeyCode()) {
      case KeyCodes.KEY_HOME:
        if (enableNavKeys) {
          newCell = grid.walkCells(selection.getRow(), 0, 1, callback);
        }
        break;
      case KeyCodes.KEY_END:
        if (enableNavKeys) {
          newCell = grid.walkCells(selection.getRow(), grid.getColumnModel().getColumnCount() - 1, -1, callback);
        }
        break;
      case KeyCodes.KEY_PAGEUP:
        if (enableNavKeys) {
          newCell = grid.walkCells(0, 0, 1, callback);
        }
        break;
      case KeyCodes.KEY_PAGEDOWN:
        if (enableNavKeys) {
          int idx = listStore.indexOf(listStore.get(listStore.size() - 1));
          newCell = grid.walkCells(idx, 0, 1, callback);
        }
        break;
      case KeyCodes.KEY_TAB:
        if (e.getShiftKey()) {
          newCell = grid.walkCells(r, c - 1, -1, callback);
        } else {
          newCell = grid.walkCells(r, c + 1, 1, callback);
        }
        break;
      case KeyCodes.KEY_DOWN: {
        newCell = grid.walkCells(r + 1, c, 1, callback);
        break;
      }
      case KeyCodes.KEY_UP: {
        newCell = grid.walkCells(r - 1, c, -1, callback);
        break;
      }
      case KeyCodes.KEY_LEFT:
        newCell = grid.walkCells(r, c - 1, -1, callback);
        break;
      case KeyCodes.KEY_RIGHT:
        newCell = grid.walkCells(r, c + 1, 1, callback);
        break;
    }

    if (newCell != null) {
      selectCell(newCell.getRow(), newCell.getCol());
      e.preventDefault();
      e.stopPropagation();
    }
  }
View Full Code Here

  }

  @Override
  public void cancelEditing() {
    if (activeCell != null) {
      final GridCell editCell = activeCell;
      removeEditor();
      fireEvent(new CancelEditEvent<M>(editCell));
    }
  }
View Full Code Here

      }
      for (int i = 0, len = columnModel.getColumnCount(); i < len; i++) {
        ColumnConfig<M, ?> c = columnModel.getColumn(i);
        doCompleteEditing(c);
      }
      final GridCell editCell = activeCell;
      removeEditor();
      fireEvent(new CompleteEditEvent<M>(editCell));
    }
  }
View Full Code Here

      ColumnConfig<M, ?> c = columnModel.getColumn(activeCell.getCol());
      Field<?> field = getEditor(c);
      removeEditor(activeCell, field);

      final GridCell gc = activeCell;
      activeCell = null;
      fireEvent(new CancelEditEvent<M>(gc));

      if (focusOnComplete) {
        focusOnComplete = false;
View Full Code Here

    GridSelectionModel<M> sm = getEditableGrid().getSelectionModel();
    if (sm instanceof CellSelectionModel) {
      CellSelection<M> cell = ((CellSelectionModel<M>) sm).getSelectCell();
      if (cell != null) {
        evt.preventDefault();
        startEditing(new GridCell(cell.getRow(), cell.getCell()));
      }
    }

  }
View Full Code Here

    }

    // keep active cell since we manually fire blur (finishEditing) which will
    // call cancel edit
    // clearing active cell
    final GridCell active = activeCell;

    if (activeCell != null) {
      ColumnConfig<M, ?> c = columnModel.getColumn(activeCell.getCol());

      Field<?> field = getEditor(c);

      // we handle navigation programatically
      evt.preventDefault();

      // since we are preventingDefault on tab key, the field will not blur on
      // its
      // own, which means the value change event will not fire so we manually
      // blur
      // the field, so we call finishEditing
      field.finishEditing();

    }

    if (active != null) {

      GridCell newCell = null;

      if (evt.getShiftKey()) {
        newCell = getEditableGrid().walkCells(active.getRow(), active.getCol() - 1, -1, callback);
      } else {
        newCell = getEditableGrid().walkCells(active.getRow(), active.getCol() + 1, 1, callback);
      }
      if (newCell != null) {
        final GridCell c = newCell;

        Scheduler.get().scheduleFinally(new ScheduledCommand() {

          @Override
          public void execute() {
View Full Code Here

TOP

Related Classes of com.sencha.gxt.widget.core.client.grid.Grid.GridCell

Copyright © 2018 www.massapicom. 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.