org.gudy.azureus2.ui.swt.views.table.impl
Class TableRowSWTBase

java.lang.Object
  extended by org.gudy.azureus2.ui.swt.views.table.impl.TableRowSWTBase
All Implemented Interfaces:
TableRowCore, TableRow, TableRowSWT
Direct Known Subclasses:
TableRowPainted

public abstract class TableRowSWTBase
extends java.lang.Object
implements TableRowSWT


Field Summary
static boolean DEBUG_ROW_PAINT
           
protected  java.lang.Object lock
           
protected  java.util.Map<java.lang.String,TableCellCore> mTableCells
           
protected  boolean wasShown
           
 
Constructor Summary
TableRowSWTBase(java.lang.Object lock, TableRowCore parentRow, TableViewSWT tv, java.lang.Object dataSource)
           
 
Method Summary
 void addMouseListener(TableRowMouseListener listener)
          Adds a listener that triggers when this TableRow has a mouse event.
 boolean canExpand()
           
 void clearCellFlag(int flag, boolean subRows)
           
 void delete()
          Delete the row
 boolean doesAnyCellHaveFlag(int flag)
           
 int getAlpha()
           
abstract  org.eclipse.swt.graphics.Color getBackground()
           
abstract  org.eclipse.swt.graphics.Rectangle getBounds()
           
 java.lang.Object getData(java.lang.String id)
          Get a previously stored value
 java.lang.Object getDataSource()
          Retrieve the data object associated with the current table row.
 java.lang.Object getDataSource(boolean bCoreObject)
          Retrieve the Data Source related to this row
 int getFontStyle()
           
abstract  org.eclipse.swt.graphics.Color getForeground()
          Retreive the color of the row
 int getIndex()
           
 TableRowCore getParentRowCore()
           
 TableCell getTableCell(java.lang.String field)
          Retrieve a cell based on its column name
 TableCellCore getTableCellCore(java.lang.String name)
          Retrieve a cell based on the supplied value
 TableCellSWT getTableCellSWT(java.lang.String name)
           
 java.lang.String getTableID()
          Returns which table the row is being displayed in.
 TableView getView()
           
 void invalidate()
          Invalidates Row
 void invalidate(boolean mustRefersh)
           
 void invokeMouseListeners(TableRowMouseEvent event)
           
 boolean isExpanded()
           
 boolean isFocused()
           
 boolean isInPaintItem()
           
 boolean isMouseOver()
           
 boolean isRowDisposed()
           
 boolean isSelected()
          Retrieve whether the row is selected by the user
 boolean isShown()
           
 boolean isValid()
          Validility of the row's cells.
 boolean isVisible()
          Retreive whether the row is visible to the user.
 void locationChanged(int iStartColumn)
          Location of a column has changed
 void redraw()
          like refresh, except a different name to confuse us.
 java.util.List refresh(boolean bDoGraphics)
          Refresh all the cells in the row
 java.util.List<TableCellCore> refresh(boolean bDoGraphics, boolean bVisible)
           
 void removeMouseListener(TableRowMouseListener listener)
          Remove a previously added TableRowMouseListener
 boolean setAlpha(int alpha)
           
abstract  void setBackgroundImage(org.eclipse.swt.graphics.Image image)
           
 void setCellFlag(int flag)
           
 void setData(java.lang.String id, java.lang.Object data)
          Store a value against the table row
 void setExpanded(boolean b)
           
 boolean setFontStyle(int style)
           
abstract  boolean setForeground(org.eclipse.swt.graphics.Color c)
          Set the color of the row
 void setForeground(int[] rgb)
          Change the row's foreground color
 void setForeground(int red, int green, int blue)
          Change the row's foreground color.
 boolean setForeground2(int[] rgb)
           
 boolean setForeground2(int red, int green, int blue)
           
 void setForegroundToErrorColor()
          Change the row's foreground color to the user's defined "error" color.
abstract  boolean setIconSize(org.eclipse.swt.graphics.Point pt)
           
 void setSelected(boolean selected)
           
 boolean setShown(boolean b, boolean force)
           
 boolean setTableItem(int newIndex)
          Link the row to a SWT TableItem
 boolean setTableItem(int newIndex, boolean isVisible)
           
 void setUpToDate(boolean upToDate)
           
abstract  void setWidgetSelected(boolean selected)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.gudy.azureus2.ui.swt.views.table.TableRowSWT
getFullHeight
 
Methods inherited from interface com.aelitis.azureus.ui.common.table.TableRowCore
getHeight, getSortColumnCell, getSubItemCount, getSubRow, getSubRowsWithNull, linkSubItem, redraw, removeSubRow, setHeight, setSortColumn, setSubItemCount, setSubItems
 

Field Detail

DEBUG_ROW_PAINT

public static boolean DEBUG_ROW_PAINT

lock

protected java.lang.Object lock

mTableCells

protected java.util.Map<java.lang.String,TableCellCore> mTableCells

wasShown

protected boolean wasShown
Constructor Detail

TableRowSWTBase

public TableRowSWTBase(java.lang.Object lock,
                       TableRowCore parentRow,
                       TableViewSWT tv,
                       java.lang.Object dataSource)
Method Detail

invalidate

public void invalidate()
Description copied from interface: TableRowCore
Invalidates Row

Specified by:
invalidate in interface TableRowCore

invalidate

public void invalidate(boolean mustRefersh)
Specified by:
invalidate in interface TableRowCore

doesAnyCellHaveFlag

public boolean doesAnyCellHaveFlag(int flag)

setCellFlag

public void setCellFlag(int flag)

clearCellFlag

public void clearCellFlag(int flag,
                          boolean subRows)

delete

public void delete()
Description copied from interface: TableRowCore
Delete the row

Specified by:
delete in interface TableRowCore

refresh

public java.util.List refresh(boolean bDoGraphics)
Description copied from interface: TableRowCore
Refresh all the cells in the row

Specified by:
refresh in interface TableRowCore
Parameters:
bDoGraphics - Refresh graphic cells to

locationChanged

public void locationChanged(int iStartColumn)
Description copied from interface: TableRowCore
Location of a column has changed

Specified by:
locationChanged in interface TableRowCore
Parameters:
iStartColumn - Cells starting at this value may need repainting XXX Rename to cellLocationChanged?

getDataSource

public java.lang.Object getDataSource(boolean bCoreObject)
Description copied from interface: TableRowCore
Retrieve the Data Source related to this row

Specified by:
getDataSource in interface TableRowCore
Parameters:
bCoreObject - true - return a core object
false - return a plugin object
Returns:
the Data Source Object related to the row

getIndex

public int getIndex()
Specified by:
getIndex in interface TableRowCore
Specified by:
getIndex in interface TableRow

getTableCellCore

public TableCellCore getTableCellCore(java.lang.String name)
Description copied from interface: TableRowCore
Retrieve a cell based on the supplied value

Specified by:
getTableCellCore in interface TableRowCore
Parameters:
name - Column name of the cell to be returned
Returns:
TableCellCore object related to this row and the specified column

isVisible

public boolean isVisible()
Description copied from interface: TableRowCore
Retreive whether the row is visible to the user.

Specified by:
isVisible in interface TableRowCore
Returns:
visibility state

setTableItem

public boolean setTableItem(int newIndex)
Description copied from interface: TableRowCore
Link the row to a SWT TableItem

Specified by:
setTableItem in interface TableRowCore
Parameters:
newIndex - new position row should be
Returns:
false - already linked to that item at that index

setTableItem

public boolean setTableItem(int newIndex,
                            boolean isVisible)
Specified by:
setTableItem in interface TableRowCore

setSelected

public void setSelected(boolean selected)
Specified by:
setSelected in interface TableRowCore

isRowDisposed

public boolean isRowDisposed()
Specified by:
isRowDisposed in interface TableRowCore

setUpToDate

public void setUpToDate(boolean upToDate)
Specified by:
setUpToDate in interface TableRowCore

refresh

public java.util.List<TableCellCore> refresh(boolean bDoGraphics,
                                             boolean bVisible)
Specified by:
refresh in interface TableRowCore

getView

public TableView getView()
Specified by:
getView in interface TableRowCore
Specified by:
getView in interface TableRow

addMouseListener

public void addMouseListener(TableRowMouseListener listener)
Description copied from interface: TableRow
Adds a listener that triggers when this TableRow has a mouse event.

Specified by:
addMouseListener in interface TableRow

removeMouseListener

public void removeMouseListener(TableRowMouseListener listener)
Description copied from interface: TableRow
Remove a previously added TableRowMouseListener

Specified by:
removeMouseListener in interface TableRow
Parameters:
listener - Previously added listener

invokeMouseListeners

public void invokeMouseListeners(TableRowMouseEvent event)
Specified by:
invokeMouseListeners in interface TableRowCore

isMouseOver

public boolean isMouseOver()
Specified by:
isMouseOver in interface TableRowCore
Returns:

canExpand

public boolean canExpand()

isExpanded

public boolean isExpanded()
Specified by:
isExpanded in interface TableRowCore

setExpanded

public void setExpanded(boolean b)
Specified by:
setExpanded in interface TableRowCore

getParentRowCore

public TableRowCore getParentRowCore()
Specified by:
getParentRowCore in interface TableRowCore

isInPaintItem

public boolean isInPaintItem()
Specified by:
isInPaintItem in interface TableRowCore
Returns:

getDataSource

public java.lang.Object getDataSource()
Description copied from interface: TableRow
Retrieve the data object associated with the current table row.

Specified by:
getDataSource in interface TableRow
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

getTableID

public java.lang.String getTableID()
Description copied from interface: TableRow
Returns which table the row is being displayed in.

Specified by:
getTableID in interface TableRow
Returns:
TableManager.TABLE_* constant

setForeground

public abstract boolean setForeground(org.eclipse.swt.graphics.Color c)
Description copied from interface: TableRowSWT
Set the color of the row

Specified by:
setForeground in interface TableRowSWT
Parameters:
c - new color

setForeground

public void setForeground(int red,
                          int green,
                          int blue)
Description copied from interface: TableRow
Change the row's foreground color.

Specified by:
setForeground in interface TableRow
Parameters:
red - red value (0 - 255)
green - green value (0 - 255)
blue - blue value (0 - 255)

setForeground2

public boolean setForeground2(int red,
                              int green,
                              int blue)

setForeground

public void setForeground(int[] rgb)
Description copied from interface: TableRow
Change the row's foreground color

Specified by:
setForeground in interface TableRow
Parameters:
rgb - int array of red, green, and blue values. Null to reset to default color

setForeground2

public boolean setForeground2(int[] rgb)

setForegroundToErrorColor

public void setForegroundToErrorColor()
Description copied from interface: TableRow
Change the row's foreground color to the user's defined "error" color.

Specified by:
setForegroundToErrorColor in interface TableRow

isValid

public boolean isValid()
Description copied from interface: TableRow
Validility of the row's cells.

Specified by:
isValid in interface TableRow
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.

getTableCell

public TableCell getTableCell(java.lang.String field)
Description copied from interface: TableRow
Retrieve a cell based on its column name

Specified by:
getTableCell in interface TableRow
Parameters:
field - Name/ID of column
Returns:
TableCell object related to this row and the column specified

isSelected

public boolean isSelected()
Description copied from interface: TableRow
Retrieve whether the row is selected by the user

Specified by:
isSelected in interface TableRow
Returns:
selection status

isFocused

public boolean isFocused()

getData

public java.lang.Object getData(java.lang.String id)
Description copied from interface: TableRow
Get a previously stored value

Specified by:
getData in interface TableRow
Returns:

setData

public void setData(java.lang.String id,
                    java.lang.Object data)
Description copied from interface: TableRow
Store a value against the table row

Specified by:
setData in interface TableRow

setIconSize

public abstract boolean setIconSize(org.eclipse.swt.graphics.Point pt)
Specified by:
setIconSize in interface TableRowSWT

getForeground

public abstract org.eclipse.swt.graphics.Color getForeground()
Description copied from interface: TableRowSWT
Retreive the color of the row

Specified by:
getForeground in interface TableRowSWT
Returns:
color of the row

getBackground

public abstract org.eclipse.swt.graphics.Color getBackground()
Specified by:
getBackground in interface TableRowSWT

getTableCellSWT

public TableCellSWT getTableCellSWT(java.lang.String name)
Specified by:
getTableCellSWT in interface TableRowSWT
Returns:

getBounds

public abstract org.eclipse.swt.graphics.Rectangle getBounds()
Specified by:
getBounds in interface TableRowSWT

setBackgroundImage

public abstract void setBackgroundImage(org.eclipse.swt.graphics.Image image)
Specified by:
setBackgroundImage in interface TableRowSWT

getFontStyle

public int getFontStyle()
Specified by:
getFontStyle in interface TableRowSWT
Returns:

setFontStyle

public boolean setFontStyle(int style)
Specified by:
setFontStyle in interface TableRowSWT

getAlpha

public int getAlpha()
Specified by:
getAlpha in interface TableRowSWT
Returns:

setAlpha

public boolean setAlpha(int alpha)
Specified by:
setAlpha in interface TableRowSWT

setWidgetSelected

public abstract void setWidgetSelected(boolean selected)
Specified by:
setWidgetSelected in interface TableRowSWT

isShown

public boolean isShown()
Specified by:
isShown in interface TableRowSWT

setShown

public boolean setShown(boolean b,
                        boolean force)
Specified by:
setShown in interface TableRowSWT
Returns:
true: changed

redraw

public void redraw()
Description copied from interface: TableRowCore
like refresh, except a different name to confuse us.

Specified by:
redraw in interface TableRowCore