com.common
Class jTable

java.lang.Object
  extended bycom.common.jTable

public class jTable
extends java.lang.Object

Object made with a vector of vector to store data, and another vector to store column names.


Field Summary
protected static java.lang.String _
           
protected  java.util.Vector columnNames
           
protected  java.util.Vector data
           
 
Constructor Summary
jTable()
          Creates a new empty instance of preludeTable
jTable(java.sql.Connection con, java.lang.String sql)
          Creates an instance with table obtained from SQL query and connection specified in params.
jTable(java.util.Vector data, java.util.Vector columnNames)
          Creates an initialized instance of preludeTable
 
Method Summary
 void clear()
           
 java.util.Vector getColumn(int column)
          Get a column from this jTable
 java.util.Vector getColumnNames()
          Get this.columnNames Vector.
 int getColumnSize()
          Get N dimension of MxN this.data Vector of Vectors
 java.util.Vector getData()
          Get this.data Vector of Vectors.
 int[] getIgnoredColumnsPdf()
          Get column numbers of a jTable to be ignored for generating pdf report.
 int getNamedColumnNumber(java.lang.String columnName)
          Get named column number from this table.
static int getNamedColumnNumber(java.lang.String columnName, java.util.Vector vec)
          Get named column number from this table.
 java.util.Vector getRow(int row)
          Get a row from this jTable.
 int getRowSize()
          Get M dimension of MxN this.data Vector of Vectors
static jTable getTableVector(java.sql.Connection con, java.lang.String sql)
          Method to get tuples and columns according to sql query.
 java.lang.Object getValue(int row, int column)
          Get value from data Vector of Vectors in Object generic format.
 java.lang.Object getValue(int row, int column, java.lang.Object defaultIfNull)
          Get value from this data Vector of Vectors in Object generic format if value is not null.
 java.lang.Object getValue(int row, int column, java.lang.Object ob, java.lang.Object defaultIfobFound)
          Get value in position (row,column) of a table.
 void printTable()
          Print a Prelude generic table Vector in standard output
 void setColumnNames(java.util.Vector columnNames)
          Set initial values to columnNames vector.
 void setDataVector(java.util.Vector data)
          Sets initial values to vectors.
 void setDataVector(java.util.Vector data, java.util.Vector columnNames)
          Sets initial values to data and columnNames vectors.
 void setTableVector(java.sql.Connection con, java.lang.String sql)
          Set a table vector in this object.
 void setValue(int row, int column, java.lang.Object ob)
          Set ob Object into this.data Vector of Vectors at (row, column) position
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

protected java.util.Vector data

columnNames

protected java.util.Vector columnNames

_

protected static final java.lang.String _
See Also:
Constant Field Values
Constructor Detail

jTable

public jTable()
Creates a new empty instance of preludeTable


jTable

public jTable(java.sql.Connection con,
              java.lang.String sql)
       throws java.sql.SQLException
Creates an instance with table obtained from SQL query and connection specified in params.

Parameters:
con - Connection variable to access PostgreSQL database.
sql - String with SQL query to fill jTable object.
Throws:
java.sql.SQLException - SQL syntax error executing query to define an object.

jTable

public jTable(java.util.Vector data,
              java.util.Vector columnNames)
Creates an initialized instance of preludeTable

Parameters:
data - Vector of Vectors to store data.
columnNames - Vector with column names.
Method Detail

clear

public void clear()

setDataVector

public void setDataVector(java.util.Vector data,
                          java.util.Vector columnNames)
Sets initial values to data and columnNames vectors.

Parameters:
data - Vector of vector to store database table query.
columnNames - Vector with column names

setColumnNames

public void setColumnNames(java.util.Vector columnNames)
Set initial values to columnNames vector.

Parameters:
columnNames - Vector with column names.

getValue

public java.lang.Object getValue(int row,
                                 int column)
                          throws java.lang.ArrayIndexOutOfBoundsException
Get value from data Vector of Vectors in Object generic format.

Parameters:
row - integer with row index of data vector.
column - integer with column indes of data vector.
Returns:
generic Object with bidimensional vector value.
Throws:
java.lang.ArrayIndexOutOfBoundsException - index exceeded of this jTable

getValue

public java.lang.Object getValue(int row,
                                 int column,
                                 java.lang.Object defaultIfNull)
Get value from this data Vector of Vectors in Object generic format if value is not null. Otherwise is returned defaultIfNull object.

Parameters:
row - row index.
column - column index.
defaultIfNull - Object returned if value in (row, column) position is null.
Returns:
Object with value in (row, column) pos. or default object if it's null.
Throws:
java.lang.ArrayIndexOutOfBoundsException - index exceeded of this jTable

getValue

public java.lang.Object getValue(int row,
                                 int column,
                                 java.lang.Object ob,
                                 java.lang.Object defaultIfobFound)
Get value in position (row,column) of a table. If value returned equals to Object ob, defaultIfobFound is returned

Parameters:
row - int row index.
column - int column index.
ob - Object which is found, is returned defaultIfobFound.
defaultIfobFound - Object returned if value in (row, column) position is ob.
Returns:
Object with value in (row, column) pos. or default object if it's null.

getRow

public java.util.Vector getRow(int row)
                        throws java.lang.ArrayIndexOutOfBoundsException
Get a row from this jTable.

Parameters:
row - row index wanted.
Returns:
row Vector according to index specified.
Throws:
java.lang.ArrayIndexOutOfBoundsException - index exceeded of this jTable

getColumn

public java.util.Vector getColumn(int column)
                           throws java.lang.ArrayIndexOutOfBoundsException
Get a column from this jTable

Parameters:
column - column index wanted.
Returns:
Vector according to index specified.
Throws:
java.lang.ArrayIndexOutOfBoundsException - index exceeded of this jTable

getRowSize

public int getRowSize()
Get M dimension of MxN this.data Vector of Vectors

Returns:
integer with row size.

getColumnSize

public int getColumnSize()
Get N dimension of MxN this.data Vector of Vectors

Returns:
integer with column size.

setValue

public void setValue(int row,
                     int column,
                     java.lang.Object ob)
Set ob Object into this.data Vector of Vectors at (row, column) position

Parameters:
row - row index.
column - column index.
ob - Object to be set.

setDataVector

public void setDataVector(java.util.Vector data)
Sets initial values to vectors.

Parameters:
data - Vector of vector to store database table query.

getData

public java.util.Vector getData()
Get this.data Vector of Vectors.

Returns:
Vector of Vectors data of this jTable.

getColumnNames

public java.util.Vector getColumnNames()
Get this.columnNames Vector.

Returns:
Vector columnNames of this jTable.

getNamedColumnNumber

public int getNamedColumnNumber(java.lang.String columnName)
Get named column number from this table.

Parameters:
columnName - Name to find in this table.
Returns:
number of column which name is columnName

getNamedColumnNumber

public static int getNamedColumnNumber(java.lang.String columnName,
                                       java.util.Vector vec)
Get named column number from this table.

Parameters:
columnName - Name to find in this table.
vec - Vector of columnNames of this object.
Returns:
number of column which name is columnName

getIgnoredColumnsPdf

public int[] getIgnoredColumnsPdf()
Get column numbers of a jTable to be ignored for generating pdf report.

Returns:
int array with column numbers that won't appear in pdf report.

printTable

public void printTable()
Print a Prelude generic table Vector in standard output


setTableVector

public void setTableVector(java.sql.Connection con,
                           java.lang.String sql)
                    throws java.sql.SQLException
Set a table vector in this object.

Parameters:
con - Connection to the database.
sql - Sql command whose result is stored in this object.
Throws:
java.sql.SQLException - SQL error setting table vector.

getTableVector

public static jTable getTableVector(java.sql.Connection con,
                                    java.lang.String sql)
                             throws java.sql.SQLException
Method to get tuples and columns according to sql query.

Parameters:
con - Connection ip_address:port to connect to database.
sql - SQL command to execute over connection con.
Returns:
PreludeTable given by sql param query
Throws:
java.sql.SQLException - SQL syntax error in statement.executeQuery(String sql);


e-REdING. Biblioteca de la Escuela Superior de Ingenieros de Sevilla.


DISEÑO DE UNA PLATAFORMA DE GESTIÓN Y MONITORIZACIÓN DE EVENTOS DE SEGURIDAD

: Galera Ruiz, Alejandro David
: Ingeniería Telecomunicación
Contenido del proyecto:
Directorio raíz  >  Javadoc  >  com  >  common  >  jTable.html