pt.moredata.dataentry.component.swing
Class TableComponent

java.lang.Object
  extended bypt.moredata.dataentry.component.AbstractDataEntryComponent
      extended bypt.moredata.dataentry.component.GridDataEntryComponent
          extended bypt.moredata.dataentry.component.swing.TableComponent
All Implemented Interfaces:
DataEntryComponent, java.io.Serializable

public class TableComponent
extends GridDataEntryComponent

This the implementation of the DataEntryComponent for the widget Table. Company MoreData

Version:
$Revision: 1.9 $ FIXME : Rever os construtores, o parametro columnName nao devia ser usado, porque a tabela ja tem as colunas definidas. Rever tambem os factory methods na classe DataEntryComponentFactory, estao a passar o serialkey no lugar do columnName.
Author:
psfbc
See Also:
Serialized Form

Field Summary
 
Fields inherited from class pt.moredata.dataentry.component.AbstractDataEntryComponent
_columnName, _tableAlias, _tableName
 
Constructor Summary
TableComponent(java.lang.String name, java.lang.String tableName, java.lang.String tableAlias, java.lang.String columnName, Table table)
          Constructor for the TableComponent object
TableComponent(java.lang.String tableName, java.lang.String columnName, Table table)
          Creates a new instance of TableVisualField
 
Method Summary
 void cleanUp()
          Clean up the component, removing all listeners added to other objects.
 int getCurrentRow()
          Devolve o numero da linha selecionada na tabela.
 java.lang.Object getFieldValue()
          Devolve o valor guardado no componente.
 java.lang.Object getFieldValue(int rowNumber)
          Devolve o valor guardado numa determinada celula do componente.
 int getRows()
          Devolve o numero de linhas da tabela.
 void insertNewRow()
          Inserre uma nova linha na fim da tabela.
 void removeRow(int rowNumber)
          Remove uma linha da tabela.
 void setEditable(boolean editable)
          Torna o componente editavel ou nao.
 void setFieldValue(int rowNumber, java.lang.Object obj)
          Altera o valor guardado numa determinada celula do componente.
 void setFieldValue(java.lang.Object value)
          Altera o valor guardado no componente.
 
Methods inherited from class pt.moredata.dataentry.component.AbstractDataEntryComponent
addComponentModifiedListener, fireComponentEvent, getColumnName, getName, getTableAlias, getTableName, getTableNameOrAlias, isDataBaseComponent, isEditableForInsert, isEditableForQuery, isEditableForUpdate, removeComponentModifiedListener, setAllowedCharacters, setDataBaseComponent, setEditableForInsert, setEditableForQuery, setEditableForUpdate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableComponent

public TableComponent(java.lang.String tableName,
                      java.lang.String columnName,
                      Table table)
               throws NullTableNameException,
                      NullColumnNameException,
                      java.lang.NullPointerException
Creates a new instance of TableVisualField

Parameters:
tableName - Nome da tabela associada ao campo visual.
columnName - The column name of the component.
table - Tabela onde sao introduzidos os dados.
Throws:
NullTableNameException - If the table name is null.
NullColumnNameException - Se o nome da coluna for nulo.
java.lang.NullPointerException - Se a table for nula.

TableComponent

public TableComponent(java.lang.String name,
                      java.lang.String tableName,
                      java.lang.String tableAlias,
                      java.lang.String columnName,
                      Table table)
               throws NullTableNameException,
                      NullColumnNameException,
                      java.lang.NullPointerException
Constructor for the TableComponent object

Parameters:
name - The component name. This name will be used to identify the component, if the name is null, the columnName is used.
tableName - The table name.
tableAlias - The table alias.
columnName - The column name of the component.
table - Tabela onde sao introduzidos os dados.
Throws:
NullTableNameException - If the table name is null.
NullColumnNameException - If the column name is null.
java.lang.NullPointerException - Se o obj for nulo.
Method Detail

getFieldValue

public java.lang.Object getFieldValue()
Devolve o valor guardado no componente.

Returns:
O valor guardado no componente (pode ser null).

getFieldValue

public java.lang.Object getFieldValue(int rowNumber)
Devolve o valor guardado numa determinada celula do componente.

Specified by:
getFieldValue in class GridDataEntryComponent
Parameters:
rowNumber - Numero da linha a que a celula pertence.
Returns:
O valor guardado numa determinada celula do componente.

setFieldValue

public void setFieldValue(java.lang.Object value)
Altera o valor guardado no componente.

Parameters:
value - O valor a guardar no componente.

setFieldValue

public void setFieldValue(int rowNumber,
                          java.lang.Object obj)
Altera o valor guardado numa determinada celula do componente.

Specified by:
setFieldValue in class GridDataEntryComponent
Parameters:
rowNumber - Numero da linha a que a celula pertence.
obj - O valor a guardar numa determinada celula do componente.

getRows

public int getRows()
Devolve o numero de linhas da tabela.

Returns:
O numero de linhas da tabela.

getCurrentRow

public int getCurrentRow()
Devolve o numero da linha selecionada na tabela.

Returns:
O numero da linha selecionada na tabela.

insertNewRow

public void insertNewRow()
Inserre uma nova linha na fim da tabela.

Specified by:
insertNewRow in class GridDataEntryComponent

removeRow

public void removeRow(int rowNumber)
Remove uma linha da tabela.

Specified by:
removeRow in class GridDataEntryComponent
Parameters:
rowNumber - O numero da linha a remover.

setEditable

public void setEditable(boolean editable)
Torna o componente editavel ou nao.

Parameters:
editable - Se for true o componente fica editavel, caso contrario o componente deixa de poder ser editado.

cleanUp

public void cleanUp()
Clean up the component, removing all listeners added to other objects. This operation is necessary for making this object free of references so the GC can collect it.