Example #1
0
 /**
  * Returns a rectangle describing the receiver's size and location relative to its parent at a
  * column in the table.
  *
  * @param index the index that specifies the column
  * @return the receiver's bounding column rectangle
  * @exception SWTException
  *     <ul>
  *       <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  *       <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  *     </ul>
  */
 public Rectangle getBounds(final int index) {
   checkWidget();
   if (!parent.checkData(this, parent.indexOf(this))) {
     error(SWT.ERROR_WIDGET_DISPOSED);
   }
   Rectangle result;
   int columnCount = parent.getColumnCount();
   if (columnCount > 0 && (index < 0 || index >= columnCount)) {
     result = new Rectangle(0, 0, 0, 0);
   } else {
     Rectangle textBounds = getTextBounds(index);
     int left = getLeft(index);
     int itemIndex = parent.indexOf(this);
     int top = getTop(itemIndex);
     int width = 0;
     if (index == 0 && columnCount == 0) {
       Rectangle imageBounds = getImageBounds(index);
       int spacing = getSpacing(index);
       int paddingWidth = parent.getCellPadding().width;
       width = imageBounds.width + spacing + textBounds.width + paddingWidth;
     } else if (index >= 0 && index < columnCount) {
       width = parent.getColumn(index).getWidth() - getCheckWidth(index);
     }
     int height = getHeight(index);
     result = new Rectangle(left, top, width, height);
   }
   return result;
 }
Example #2
0
 private int getLeft(final int index) {
   int result = 0;
   int columnCount = parent.getColumnCount();
   if (index == 0 && columnCount == 0) {
     result = getCheckWidth(index) - parent.leftOffset;
   } else if (index >= 0 && index < columnCount) {
     // TODO [rh] consider applying the leftOffset already in Column#getLeft()
     int columnLeft = parent.getColumn(index).getLeft();
     result = getCheckWidth(index) + columnLeft - parent.leftOffset;
   }
   return result;
 }
Example #3
0
 private int getColumnWidth(final int index) {
   TableColumn column = parent.getColumn(index);
   return column.getWidth() - getCheckWidth(index);
 }