view
Class SWTTable

java.lang.Object
  extended by view.SWTTable

public class SWTTable
extends java.lang.Object

Title: Bioinformatics Project

Description: Genomes Comparacent

Copyright: Copyright (c) 2005-2006

SWTTable a class that builds and handles an editable table.

Version:
1.0
Author:
Shadi Ibrahem.

Field Summary
private  org.eclipse.swt.widgets.Table table
          A regular table.
private  org.eclipse.swt.events.SelectionAdapter TableListener
          Table listener in case its editable.
 
Constructor Summary
SWTTable(org.eclipse.swt.widgets.Composite comp, boolean editable)
          C'tor, builds an empty table, adds a listener in case it is editable.
 
Method Summary
 void addSelectionListener(org.eclipse.swt.events.SelectionListener selListener)
          Adds a listener to the table.
 void DeleteSelected(boolean ALL)
          Deletes the selected rows in the table, in case ALL is true, it deletes all the rows in the table.
 void deselectAll()
          Unmarks the selected rows.
 void dispose()
          Disposes the table.
 java.lang.String getColumnName(int i)
          Returns a column name.
 java.lang.String getIndexAt(int i, int j)
          Returns a cell text.
 int getItemCount()
          Returns number of the rows in the table.
 int[] getSelectedIndices()
          Rturns an array contaning the selected indcies.
 int getSelectedItemIndex()
          Returns the number of the selected row.
 boolean isDisposed()
          Returns true if the table is disposed.
 void reDraw()
          Redraws the table.
 void removeAll()
          Removes all the rows in the table.
 void removeListener()
          Removes the table listener.
 void setBounds(int i, int j, int k, int l)
          Sets the table bounds.
 void setBounds(org.eclipse.swt.graphics.Rectangle bounds)
          Sets the table bounds.
 void setColumn(java.lang.String[] columnNames)
          Initiates the table with the given strings as columns.
 void setColumnSize()
          Sets each column size.
 void setIndexAt(int i, int j, java.lang.String string)
          Stores text in a cell.
 void setNewRow(java.lang.String[] Row)
          Adds a single row to the table.
 void setSize(int x, int y)
          Sets table size.
 void setSize(org.eclipse.swt.graphics.Point size)
          Sets the table size.
 void setToolTip(java.lang.String string)
          Sets the table tooltip text with the given text.
 void setVisible(boolean b)
          Sets the table to be visible/unvisible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

private org.eclipse.swt.widgets.Table table
A regular table.


TableListener

private org.eclipse.swt.events.SelectionAdapter TableListener
Table listener in case its editable.

Constructor Detail

SWTTable

public SWTTable(org.eclipse.swt.widgets.Composite comp,
                boolean editable)
C'tor, builds an empty table, adds a listener in case it is editable.

Parameters:
comp - Composite: table parent composite.
editable - boolean: given boolean.
Method Detail

setColumn

public void setColumn(java.lang.String[] columnNames)
Initiates the table with the given strings as columns.

Parameters:
columnNames - String[]: an array of strings.

setNewRow

public void setNewRow(java.lang.String[] Row)
Adds a single row to the table.

Parameters:
Row - String[]: an array of strings.

setSize

public void setSize(int x,
                    int y)
Sets table size.

Parameters:
x - int: given int.
y - int: given int.

removeAll

public void removeAll()
Removes all the rows in the table.


setVisible

public void setVisible(boolean b)
Sets the table to be visible/unvisible.

Parameters:
b - boolean: given boolean.

setSize

public void setSize(org.eclipse.swt.graphics.Point size)
Sets the table size.

Parameters:
size - Point: given point.

dispose

public void dispose()
Disposes the table.


setColumnSize

public void setColumnSize()
Sets each column size.


getColumnName

public java.lang.String getColumnName(int i)
Returns a column name.

Parameters:
i - int: column index.
Returns:
String: column name.

getIndexAt

public java.lang.String getIndexAt(int i,
                                   int j)
Returns a cell text.

Parameters:
i - int: column index.
j - int: row index.
Returns:
String: cell content.

setIndexAt

public void setIndexAt(int i,
                       int j,
                       java.lang.String string)
Stores text in a cell.

Parameters:
i - int: column index.
j - int: row index.
string - String: given text.

addSelectionListener

public void addSelectionListener(org.eclipse.swt.events.SelectionListener selListener)
Adds a listener to the table.

Parameters:
selListener - SelectionListener: a given listener.

getSelectedItemIndex

public int getSelectedItemIndex()
Returns the number of the selected row.

Returns:
int: the number of the selected rows.

reDraw

public void reDraw()
Redraws the table.


DeleteSelected

public void DeleteSelected(boolean ALL)
Deletes the selected rows in the table, in case ALL is true, it deletes all the rows in the table.

Parameters:
ALL - boolean: given boolean.

getSelectedIndices

public int[] getSelectedIndices()
Rturns an array contaning the selected indcies.

Returns:
int[]: an array of integers.

getItemCount

public int getItemCount()
Returns number of the rows in the table.

Returns:
int: integer.

deselectAll

public void deselectAll()
Unmarks the selected rows.


setBounds

public void setBounds(int i,
                      int j,
                      int k,
                      int l)
Sets the table bounds.

Parameters:
i - int: given int.
j - int: given int.
k - int: given int.
l - int: given int.

setBounds

public void setBounds(org.eclipse.swt.graphics.Rectangle bounds)
Sets the table bounds.

Parameters:
bounds - Rectangle: given bounds.

isDisposed

public boolean isDisposed()
Returns true if the table is disposed.

Returns:
true if the table is disposed.

setToolTip

public void setToolTip(java.lang.String string)
Sets the table tooltip text with the given text.

Parameters:
string - String: given string.

removeListener

public void removeListener()
Removes the table listener.