コード例 #1
0
  /**
   * Handling mouse over event to display hand cursor in case cell contains an URL
   *
   * @param e mouse event
   */
  void handleMouseOver(MouseEvent e) {
    Point pt = new Point(e.x, e.y);
    ViewerCell cell = getViewer().getCell(pt);
    boolean cursorSet = false;

    if (cell != null) {
      int colIndex = cell.getColumnIndex();
      Object element = cell.getElement();
      if (getCellControlType(element, colIndex) == CellControlType.URL) {
        Rectangle cellBounds = cell.getBounds();
        Image img = getImage(element, colIndex);
        if (img != null) {
          cellBounds.x += img.getBounds().width;
        }
        if (cellBounds.contains(pt)) {
          if (getString(element, colIndex) != null) {
            this.control.setCursor(CURSOR_HAND);
            cursorSet = true;
          }
        }
      }
    }

    if (!cursorSet) {
      handleMouseExit(e);
    }
  }
コード例 #2
0
  @Override
  protected void focusCellChanged(ViewerCell newCell, ViewerCell oldCell) {
    super.focusCellChanged(newCell, oldCell);

    // Redraw new area
    if (newCell != null) {
      final Rectangle rect = newCell.getBounds();
      final int x = newCell.getColumnIndex() == 0 ? 0 : rect.x;
      final int width = newCell.getColumnIndex() == 0 ? rect.x + rect.width : rect.width;
      // 1 is a fix for Linux-GTK
      newCell.getControl().redraw(x, rect.y - 1, width, rect.height + 1, true);
    }

    if (oldCell != null) {
      final Rectangle rect = oldCell.getBounds();
      final int x = oldCell.getColumnIndex() == 0 ? 0 : rect.x;
      final int width = oldCell.getColumnIndex() == 0 ? rect.x + rect.width : rect.width;
      // 1 is a fix for Linux-GTK
      oldCell.getControl().redraw(x, rect.y - 1, width, rect.height + 1, true);
    }
  }
コード例 #3
0
 private void setInput(Control c) {
   if (klickedCell == null) {
     return;
   }
   XViewerColumn xCol =
       xv.getXViewerFactory()
           .getDefaultXViewerColumn(((XViewerColumn) klickedColumn.getData()).getId());
   if (xCol instanceof ExtendedViewerColumn) {
     ExtendedViewerColumn extendedCol = (ExtendedViewerColumn) xCol;
     CellEditDescriptor ced =
         extendedCol.getCellEditDescriptorMap().get(klickedCell.getElement().getClass());
     if (ced == null || ced.getControl() == null) {
       return;
     }
     converter.setInput(c, ced, klickedCell.getElement());
   }
   c.setBounds(klickedCell.getBounds());
 }