Interface TableCell
-
- All Known Subinterfaces:
TableCellCore
,TableCellSWT
- All Known Implementing Classes:
FakeTableCell
,TableCellPainted
,TableCellSWTBase
public interface TableCell
This interface provides access to an Azureus table cell.- Since:
- 2.0.8.5
- See Also:
TableManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addDisposeListener(TableCellDisposeListener listener)
Adds a listener that triggers when the TableCell has been disposedvoid
addListeners(java.lang.Object listenerObject)
A listener is added for every type of cell listener the supplied object implementsvoid
addMouseListener(TableCellMouseListener listener)
Adds a listener that triggers when a TableCell that belongs to this column has a mouse event.void
addRefreshListener(TableCellRefreshListener listener)
Adds a listener that triggers when the TableCell needs refreshingvoid
addToolTipListener(TableCellToolTipListener listener)
Adds a listener related to tooltip actionsint[]
getBackground()
Get the background color of the cellGraphic
getBackgroundGraphic()
Returns a Graphic of what's behind the celljava.lang.String
getClipboardText()
Returns text that's meant for the clipboardjava.lang.Object
getDataSource()
Retrieve the data object associated with the current table row and cell.int[]
getForeground()
Get the foreground color of the cellGraphic
getGraphic()
Retrieve the SWT graphic related to this table item for TableColumn objects of TYPE_GRAPHIC only.int
getHeight()
Retrieve the height of the cell's drawing area (excluding any margin) for TableColumn objects of TYPE_GRAPHIC only.int
getMarginHeight()
int
getMarginWidth()
int
getMaxLines()
Retrieves the number of lines available for setting textint[]
getMouseOffset()
Return the position of the mouse relative to the cell.java.lang.Comparable
getSortValue()
Retrieves the sorting valueTableColumn
getTableColumn()
Retreive the TableColumn that this cell belongs tojava.lang.String
getTableID()
Returns which table the cell is being displayed in.TableRow
getTableRow()
Retrieve the TableRow that this cell belongs tojava.lang.String
getText()
Retrieve the Cell's textjava.lang.Object
getToolTip()
Retrieve the tooltip object assigned to this cellint
getWidth()
Retrieve the width of the cell's drawing area (excluding any margin) for TableColumn objects of TYPE_GRAPHIC only.void
invalidate()
Sets the cell to invalid.boolean
isDisposed()
Retrieve whether the cell has been disposed.default boolean
isSecondarySortEnabled()
When false the cell's sort value should be set to the simple sort value without any implicit secondary sort being applied.boolean
isShown()
Determines if the user has chosen to display the cellboolean
isValid()
Validility of the cell's text.void
removeDisposeListener(TableCellDisposeListener listener)
Remove a previously added TableCellDisposeListenervoid
removeMouseListener(TableCellMouseListener listener)
Remove a previously added TableCellMouseListenervoid
removeRefreshListener(TableCellRefreshListener listener)
Remove a previously added TableCellRefreshListenervoid
removeToolTipListener(TableCellToolTipListener listener)
Remove a previously added TableCellToolTipListenervoid
setFillCell(boolean bFillCell)
Sets whether the graphic fills the whole cell for TableColumn objects of TYPE_GRAPHIC only.boolean
setForeground(int[] rgb)
Change the cell's foreground colorboolean
setForeground(int red, int green, int blue)
Change the cell's foreground color.boolean
setForegroundToErrorColor()
Change the cell's foreground color to the user's defined "error" color.boolean
setGraphic(Graphic img)
Sets the image to be drawn.void
setMarginHeight(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.void
setMarginWidth(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.boolean
setSortValue(float valueToSort)
Sets a float value that the column sorting will act upon.boolean
setSortValue(long valueToSort)
Sets a long value that the column sorting will act on.boolean
setSortValue(java.lang.Comparable valueToSort)
Sets a Comparable object that column sorting will act on.boolean
setText(java.lang.String text)
This method is called to set the cell's text.void
setToolTip(java.lang.Object tooltip)
Set the cell's tooltip display.boolean
useSimpleSortValue()
When true, the user is sorting by multiple columns, and you should set the cell's sort value based solely on your column's data.
-
-
-
Method Detail
-
getDataSource
java.lang.Object getDataSource()
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)- Returns:
- The return type is dependent upon which table the cell is for:
TABLE_MYTORRENTS_*:Download
object for the current row
TABLE_TORRENT_PEERS:Peer
object for the current row
TABLE_TORRENT_FILES:DiskManagerFileInfo
object for the current row
TABLE_MYTRACKER:TrackerTorrent
object for the current row
TABLE_MYSHARES:ShareResource
object for the current row
remaining TABLE_* constants: undefined or null
-
getTableColumn
TableColumn getTableColumn()
Retreive the TableColumn that this cell belongs to- Returns:
- this cell's TableColumn
-
getTableRow
TableRow getTableRow()
Retrieve the TableRow that this cell belongs to- Returns:
- this cell's TableRow
-
getTableID
java.lang.String getTableID()
Returns which table the cell is being displayed in.- Returns:
TableManager
.TABLE_* constant
-
setText
boolean setText(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
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
invalidate()
, and set the text in theTableCellRefreshListener
- Parameters:
text
- the text to be set- Returns:
- True - the text was updated.
False - the text was the same and not modified.
-
getText
java.lang.String getText()
Retrieve the Cell's text- Returns:
- Cell's text
-
setForeground
boolean setForeground(int red, int green, int blue)
Change the cell's foreground color.pass -1 to return color back to default
- Parameters:
red
- red value (0 - 255)green
- green value (0 - 255)blue
- blue value (0 - 255)- Returns:
- True - Color changed.
False - Color was already set.
-
setForeground
boolean setForeground(int[] rgb)
Change the cell's foreground color- Parameters:
rgb
- int array containing red, green, and blue values, respectively. null to return color back to default- Returns:
- Since:
- 3.0.4.3
-
setForegroundToErrorColor
boolean setForegroundToErrorColor()
Change the cell's foreground color to the user's defined "error" color.- Returns:
- True - Color changed.
False - Color was already set. - Since:
- 3.0.3.5
-
getForeground
int[] getForeground()
Get the foreground color of the cell- Returns:
- array containing red, green, and blue color
- Since:
- 2.5.0.1
-
getBackground
int[] getBackground()
Get the background color of the cell- Returns:
- array containing red, green, and blue color. Might be null
- Since:
- 3.0.3.5
-
setSortValue
boolean setSortValue(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.- Parameters:
valueToSort
- the object that will be used when the column cell's are compared to each other- Returns:
- True - Sort Value changed.
False - Sort Value was already set to object supplied.
-
setSortValue
boolean setSortValue(long valueToSort)
Sets a long value that the column sorting will act on.- Parameters:
valueToSort
- sorting value.- Returns:
- True - Sort Value changed.
False - Sort Value was already set to value supplied.
-
setSortValue
boolean setSortValue(float valueToSort)
Sets a float value that the column sorting will act upon.- Parameters:
valueToSort
- float sort value- Returns:
- true if sort value changed, or false if sort value already set to value supplied
-
getSortValue
java.lang.Comparable getSortValue()
Retrieves the sorting value- Returns:
- Object that will be sorted on
-
isSecondarySortEnabled
default boolean isSecondarySortEnabled()
When false the cell's sort value should be set to the simple sort value without any implicit secondary sort being applied. Default implementation is based on whether the table is in multi-sort mode where the user is explicitly selecting secondary, tertiary... sorting- Returns:
- Since:
- 2.2.0.3
-
isShown
boolean isShown()
Determines if the user has chosen to display the cell- Returns:
- True - User has chosen to display cell
-
isValid
boolean isValid()
Validility of the cell's text.- Returns:
- 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.
-
invalidate
void invalidate()
Sets the cell to invalid. This will result in a refresh on the next scheduled interval.- Since:
- 2.3.0.7
-
setToolTip
void setToolTip(java.lang.Object tooltip)
Set the cell's tooltip display.- Parameters:
tooltip
- Object to display. Currently, only String is supported- Since:
- 2.1.0.2
- See Also:
addToolTipListener(TableCellToolTipListener)
-
getToolTip
java.lang.Object getToolTip()
Retrieve the tooltip object assigned to this cell- Returns:
- tooltip object
- Since:
- 2.1.0.2
- See Also:
addToolTipListener(TableCellToolTipListener)
-
isDisposed
boolean isDisposed()
Retrieve whether the cell has been disposed. This will return true after theTableCellDisposeListener
is triggered.- Returns:
- disposal state
- Since:
- 2.3.0.7
-
getMaxLines
int getMaxLines()
Retrieves the number of lines available for setting text- Returns:
- # of lines available, -1 if unknown
- Since:
- 3.0.1.1
-
getWidth
int getWidth()
Retrieve the width of the cell's drawing area (excluding any margin) for TableColumn objects of TYPE_GRAPHIC only.- Returns:
- if you are filling the cell, this is the width your image should be
-
getHeight
int getHeight()
Retrieve the height of the cell's drawing area (excluding any margin) for TableColumn objects of TYPE_GRAPHIC only.- Returns:
- if you are filling the cell, this is the height your image should be
-
setGraphic
boolean setGraphic(Graphic img)
Sets the image to be drawn.From 3.0.1.1, setting the graphic to the same Graphic object will not redraw the image. You need to
invalidate()
the cell if you know the image bits have changed (or you could pass a new Graphic object in each time a new image is generated)Previously, setting the graphic to the same object resulted in a repaint. Plugins were naughty and would do this on every refresh, causing horrible repaint slowdowns.
- Parameters:
img
- image to be stored & drawn- Returns:
- true - image was changed.
false = image was the same
-
getGraphic
Graphic getGraphic()
Retrieve the SWT graphic related to this table item for TableColumn objects of TYPE_GRAPHIC only.- Returns:
- the Image that is draw in the cell, or null if there is none.
-
setFillCell
void setFillCell(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.- Parameters:
bFillCell
- true - the whole cell is filled by the graphic
-
getMarginHeight
int getMarginHeight()
- Returns:
- Since:
- 3.0.5.3
-
setMarginHeight
void setMarginHeight(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.
- Parameters:
height
- new margin height
-
getMarginWidth
int getMarginWidth()
- Returns:
- Since:
- 3.0.5.3
-
setMarginWidth
void setMarginWidth(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.
- Parameters:
width
- new margin width
-
addRefreshListener
void addRefreshListener(TableCellRefreshListener listener)
Adds a listener that triggers when the TableCell needs refreshing- Parameters:
listener
- Listener Object to be called when refresh is needed.
-
removeRefreshListener
void removeRefreshListener(TableCellRefreshListener listener)
Remove a previously added TableCellRefreshListener- Parameters:
listener
- Previously added listener
-
addDisposeListener
void addDisposeListener(TableCellDisposeListener listener)
Adds a listener that triggers when the TableCell has been disposed- Parameters:
listener
- listener object to be called
-
removeDisposeListener
void removeDisposeListener(TableCellDisposeListener listener)
Remove a previously added TableCellDisposeListener- Parameters:
listener
- Previously added listener
-
addToolTipListener
void addToolTipListener(TableCellToolTipListener listener)
Adds a listener related to tooltip actions- Parameters:
listener
- listener object to be called
-
removeToolTipListener
void removeToolTipListener(TableCellToolTipListener listener)
Remove a previously added TableCellToolTipListener- Parameters:
listener
- Previously added listener
-
addMouseListener
void addMouseListener(TableCellMouseListener listener)
Adds a listener that triggers when a TableCell that belongs to this column has a mouse event.- Parameters:
listener
-- Since:
- 2.3.0.7
-
removeMouseListener
void removeMouseListener(TableCellMouseListener listener)
Remove a previously added TableCellMouseListener- Parameters:
listener
- Previously added listener- Since:
- 2.3.0.7
-
addListeners
void addListeners(java.lang.Object listenerObject)
A listener is added for every type of cell listener the supplied object implements- Parameters:
listenerObject
- Object implementing some cell listeneters
-
getBackgroundGraphic
Graphic getBackgroundGraphic()
Returns a Graphic of what's behind the cell- Returns:
- Since:
- 3.0.3.5
-
getMouseOffset
int[] getMouseOffset()
Return the position of the mouse relative to the cell.- Returns:
- array of 2 containing x and y position position relative to cell. null if cell doesn't have mouse.
- Since:
- 3.0.4.3
-
getClipboardText
java.lang.String getClipboardText()
Returns text that's meant for the clipboard- Since:
- 4.3.1.5
-
useSimpleSortValue
boolean useSimpleSortValue()
When true, the user is sorting by multiple columns, and you should set the cell's sort value based solely on your column's data.
-
-