Methods Summary |
---|
public void | dispose()
// TODO Auto-generated method stub
|
public void | doPaint(GC gc)
// TODO: Orientation
if (!isShowable()) {
return;
}
if (sText == null) {
return;
}
gc.setForeground(getForeground());
gc.setBackground(getBackground());
if (DEBUG_COLORCELL) {
gc.setBackground(Display.getDefault().getSystemColor(
(int) (Math.random() * 13) + 3));
}
Rectangle bounds = getBounds();
if (bounds == null) {
return;
}
gc.fillRectangle(bounds);
if (((TableCellImpl) cell).bDebug) {
((TableCellImpl) cell).debug("drawText " + bounds);
}
Point size = gc.textExtent(sText);
boolean hasIcon = (imgIcon != null && !imgIcon.isDisposed());
if (hasIcon) {
int w = imgIcon.getBounds().width + 2;
size.x += w;
gc.drawImage(imgIcon, bounds.x, bounds.y);
bounds.x += w;
}
size.x += ListView.COLUMN_PADDING_WIDTH;
if (column.isMaxWidthAuto() && column.getMaxWidth() < size.x) {
column.setMaxWidth(size.x);
}
if (column.isMinWidthAuto() && column.getMinWidth() < size.x) {
column.setMinWidth(size.x);
}
if (column.isPreferredWidthAuto() && column.getPreferredWidth() < size.x) {
column.setPreferredWidth(size.x);
}
//gc.drawText(sText, bounds.x, bounds.y);
GCStringPrinter.printString(gc, sText, bounds, true, true, alignment
| SWT.WRAP);
|
public Color | getBackground()
if (colorBG == null) {
return row.getBackground();
}
return colorBG;
|
public Image | getBackgroundImage()
return null;
|
public Rectangle | getBounds()
TableColumnMetrics columnMetrics = view.getColumnMetrics(column);
if (columnMetrics == null) {
return null;
}
bounds.x = columnMetrics.x;
bounds.width = columnMetrics.width;
try {
bounds.y = row.getVisibleYOffset() + ListView.ROW_MARGIN_HEIGHT;
bounds.height = ListRow.ROW_HEIGHT - (ListView.ROW_MARGIN_HEIGHT * 2);
} catch (Exception e) {
//System.err.println(cell.getTableColumn().getName() + " " + bounds + ";" + row + ";");
}
return bounds;
|
public Color | getForeground()
if (colorFG == null) {
return row.getForeground();
}
return colorFG;
|
public Image | getIcon()
return imgIcon;
|
public int | getMaxLines()
if (maxLines <= 0) {
if (fontHeight <= 0) {
maxLines = 1;
} else {
maxLines = (int) Math.ceil((double)getBounds().height / fontHeight);
}
}
return maxLines;
|
public int | getPosition()
return position;
|
public ListRow | getRow()
return row;
|
public java.lang.String | getText()
return sText;
|
public void | invalidate()
|
private boolean | isSameColor(Color c1, Color c2)
if (c1 == null && c2 == null) {
return true;
}
if (c1 == null || c2 == null) {
return false;
}
return c1.getRGB().equals(c2.getRGB());
|
private boolean | isShowable()Whether the column is set to be showable
return position >= 0 && bounds != null && bounds.height > 0;
|
public boolean | isShown()
boolean bIsShown = isShowable() && row.isVisible();
if (bIsShown != bLastIsShown) {
bLastIsShown = bIsShown;
if (cell != null) {
int mode = bIsShown ? TableCellVisibilityListener.VISIBILITY_SHOWN
: TableCellVisibilityListener.VISIBILITY_HIDDEN;
((TableColumnCore) cell.getTableColumn()).invokeCellVisibilityListeners(
cell, mode);
cell.invokeVisibilityListeners(mode);
}
}
return bIsShown;
|
public void | locationChanged()
// TODO Auto-generated method stub
|
public boolean | needsPainting()
return isShown();
|
public void | redraw()
// XXX Complete. We don't have a redraw for cells, so redraw the row
if (!isShown()) {
return;
}
row.redraw();
// invalidating the area
// Utils.execSWTThread(new AERunnable() {
// public void runSupport() {
// if (!isShown()) {
// return;
// }
// Rectangle r = getBounds();
// if (r == null) {
// return;
// }
// ((TableViewSWT) row.getView()).getTableComposite().redraw(r.x, r.y,
// r.width, r.height, true);
// }
//});
|
public void | refresh()
redraw();
|
public void | setBounds(Rectangle bounds)
if (((TableCellImpl) cell).bDebug) {
((TableCellImpl) cell).debug("setBounds " + bounds);
}
//System.out.println(cell.getTableID() + "]" + cell.getTableColumn().getName() + ": " + bounds);
this.bounds = bounds;
|
public boolean | setForeground(Color color)
if (isSameColor(colorFG, color)) {
return false;
}
colorFG = color;
return true;
|
public boolean | setForeground(int red, int green, int blue)
// TODO Auto-generated method stub
return false;
|
public void | setIcon(Image img)
imgIcon = img;
|
public void | setRowForeground(Color color)
// TODO Auto-generated method stub
|
public void | setTableCell(com.aelitis.azureus.ui.common.table.TableCellCore cell)
this.cell = cell;
this.column = cell.getTableColumn();
|
public boolean | setText(java.lang.String text)
if (sText == null && text == null) {
return false;
}
if (sText != null && text != null && (sText == text || sText.equals(text))) {
return false;
}
sText = text;
view.cellRefresh(this, true, true);
return true;
|