FileDocCategorySizeDatePackage
TableCell.javaAPI DocAzureus 3.0.3.411013Fri May 04 14:33:54 BST 2007org.gudy.azureus2.plugins.ui.tables

TableCell

public interface TableCell
This interface provides access to an Azureus table cell.
see
TableManager
author
Oliver (Original PeerTableItem Code)
author
TuxPaper (Generic-izing)
since
2.0.8.5

Fields Summary
Constructors Summary
Methods Summary
public voidaddDisposeListener(TableCellDisposeListener listener)
Adds a listener that triggers when the TableCell has been disposed

param
listener listener object to be called

public voidaddListeners(java.lang.Object listenerObject)
A listener is added for every type of cell listener the supplied object implements

param
listenerObject Object implementing some cell listeneters

public voidaddMouseListener(TableCellMouseListener listener)
Adds a listener that triggers when a TableCell that belongs to this column has a mouse event.

param
listener
since
2.3.0.7

public voidaddRefreshListener(TableCellRefreshListener listener)
Adds a listener that triggers when the TableCell needs refreshing

param
listener Listener Object to be called when refresh is needed.

public voidaddToolTipListener(TableCellToolTipListener listener)
Adds a listener related to tooltip actions

param
listener listener object to be called

public java.lang.ObjectgetDataSource()
Retrieve the data object associated with the current table row and cell. The results of this method MUST NOT BE CACHED. The link between a table cell and a DataSource is not persistent and can change from call to call (for example when the table is re-ordered, the link may be modified)

return
The return type is dependent upon which table the cell is for:
TABLE_MYTORRENTS_*: {@link org.gudy.azureus2.plugins.download.Download} object for the current row
TABLE_TORRENT_PEERS: {@link org.gudy.azureus2.plugins.peers.Peer} object for the current row
TABLE_TORRENT_FILES: {@link org.gudy.azureus2.plugins.disk.DiskManagerFileInfo} object for the current row
TABLE_MYTRACKER: {@link org.gudy.azureus2.plugins.tracker.TrackerTorrent} object for the current row
TABLE_MYSHARES: {@link org.gudy.azureus2.plugins.sharing.ShareResource} object for the current row
remaining TABLE_* constants: undefined or null

public int[]getForeground()
Get the foreground color of the cell

return
array containing red, green, and blue color
since
2.5.0.1

public org.gudy.azureus2.plugins.ui.GraphicgetGraphic()
Retrieve the SWT graphic related to this table item for TableColumn objects of TYPE_GRAPHIC only.

return
the Image that is draw in the cell, or null if there is none.

public intgetHeight()
Retrieve the height of the cell's drawing area (excluding any margin) for TableColumn objects of TYPE_GRAPHIC only.

return
if you are filling the cell, this is the height your image should be

public intgetMaxLines()
Retrieves the number of lines available for setting text

return
# of lines available
since
3.0.1.1

public java.lang.ComparablegetSortValue()
Retrieves the sorting value

return
Object that will be sorted on

public TableColumngetTableColumn()
Retreive the TableColumn that this cell belongs to

return
this cell's TableColumn

public java.lang.StringgetTableID()
Returns which table the cell is being displayed in.

return
{@link TableManager}.TABLE_* constant

public TableRowgetTableRow()
Retrieve the TableRow that this cell belongs to

return
this cell's TableRow

public java.lang.StringgetText()
Retrieve the Cell's text

return
Cell's text

public java.lang.ObjectgetToolTip()
Retrieve the tooltip object assigned to this cell

return
tooltip object
see
#addToolTipListener(TableCellToolTipListener)
since
2.1.0.2

public intgetWidth()
Retrieve the width of the cell's drawing area (excluding any margin) for TableColumn objects of TYPE_GRAPHIC only.

return
if you are filling the cell, this is the width your image should be

public voidinvalidate()
Sets the cell to invalid. This will result in a refresh on the next scheduled interval.

since
2.3.0.7

public booleanisDisposed()
Retrieve whether the cell has been disposed. This will return true after the {@link TableCellDisposeListener} is triggered.

return
disposal state
since
2.3.0.7

public booleanisShown()
Determines if the user has chosen to display the cell

return
True - User has chosen to display cell

public booleanisValid()
Validility of the cell's text.

return
True - Text is the same as last call. You do not need to update unless you have new text to display.
False - Cell-to-Datasource link has changed, and the text is definitely not valid.

public voidremoveDisposeListener(TableCellDisposeListener listener)
Remove a previously added TableCellDisposeListener

param
listener Previously added listener

public voidremoveMouseListener(TableCellMouseListener listener)
Remove a previously added TableCellMouseListener

param
listener Previously added listener
since
2.3.0.7

public voidremoveRefreshListener(TableCellRefreshListener listener)
Remove a previously added TableCellRefreshListener

param
listener Previously added listener

public voidremoveToolTipListener(TableCellToolTipListener listener)
Remove a previously added TableCellToolTipListener

param
listener Previously added listener

public voidsetFillCell(boolean bFillCell)
Sets whether the graphic fills the whole cell for TableColumn objects of TYPE_GRAPHIC only. This may effect how often a refresh of the cell is needed, and effects alignment.

param
bFillCell true - the whole cell is filled by the graphic

public booleansetForeground(int red, int green, int blue)
Change the cell's foreground color.

param
red red value (0 - 255)
param
green green value (0 - 255)
param
blue blue value (0 - 255)
return
True - Color changed.
False - Color was already set.

public booleansetGraphic(org.gudy.azureus2.plugins.ui.Graphic img)
Sets the image to be drawn.

param
img image to be stored & drawn
return
true - image was changed.
false = image was the same

public voidsetMarginHeight(int height)
Specifies the number of pixels of vertical margin that will be placed along the top and bottom edges of the layout for TableColumn objects of TYPE_GRAPHIC only.

The default is 1.

param
height new margin height

public voidsetMarginWidth(int width)
Specifies the number of pixels of horizontal margin that will be placed along the left and right edges of the layout for TableColumn object of TYPE_GRAPHIC only.

The default is 1.

param
width new margin width

public booleansetSortValue(long valueToSort)
Sets a long value that the column sorting will act on.

param
valueToSort sorting value.
return
True - Sort Value changed.
False - Sort Value was already set to value supplied.

public booleansetSortValue(float valueToSort)
Sets a float value that the column sorting will act upon.

param
valueToSort float sort value
return
true if sort value changed, or false if sort value already set to value supplied

public booleansetSortValue(java.lang.Comparable valueToSort)
Sets a Comparable object that column sorting will act on. If you never call setSortValue, your column will be sorted by the cell's text.

param
valueToSort the object that will be used when the column cell's are compared to each other
return
True - Sort Value changed.
False - Sort Value was already set to object supplied.

public booleansetText(java.lang.String text)
This method is called to set the cell's text. Caching is done, so that if same text is used several times, there won't be any 'flickering' effect. Ie the text is only updated if it's different from current value.

This function must be called from the same thread that the GUI is running under. Listeners like {@link TableCellAddedListener} do not always get called on the GUI thread.

If you wish to set the text and not worry about changing to the GUI thread, use {@link #invalidate()}, and set the text in the {@link TableCellRefreshListener}

param
text the text to be set
return
True - the text was updated.
False - the text was the same and not modified.

public voidsetToolTip(java.lang.Object tooltip)
Set the cell's tooltip display.

param
tooltip Object to display. Currently, only String is supported
see
#addToolTipListener(TableCellToolTipListener)
since
2.1.0.2