Groovy Documentation

com.wordpress.tipsforjava.swing.table
[Java] Class TableCellListener

java.lang.Object
  com.wordpress.tipsforjava.swing.table.TableCellListener
All Implemented Interfaces:
PropertyChangeListener, Runnable

public class TableCellListener
extends Object

This class listens for changes made to the data in the table via the TableCellEditor. When editing is started, the value of the cell is saved When editing is stopped the new value is saved. When the oold and new values are different, then the provided Action is invoked. The source of the Action is a TableCellListener instance.

Authors:
Rob Camick
Darryl Burke


Field Summary
private Action action

private int column

private Object newValue

private Object oldValue

private int row

private JTable table

 
Constructor Summary
TableCellListener(JTable table, Action action)

Create a TableCellListener.

private TableCellListener(JTable table, int row, int column, Object oldValue, Object newValue)

Create a TableCellListener with a copy of all the data relevant to the change of data for a given cell.

 
Method Summary
int getColumn()

Get the column that was last edited

Object getNewValue()

Get the new value in the cell

Object getOldValue()

Get the old value of the cell

int getRow()

Get the row that was last edited

JTable getTable()

Get the table of the cell that was changed

private void processEditingStarted()

private void processEditingStopped()

void propertyChange(PropertyChangeEvent e)

void run()

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Field Detail

action

private Action action


column

private int column


newValue

private Object newValue


oldValue

private Object oldValue


row

private int row


table

private JTable table


 
Constructor Detail

TableCellListener

public TableCellListener(JTable table, Action action)
Create a TableCellListener.
Parameters:
table - the table to be monitored for data changes
action - the Action to invoke when cell data is changed


TableCellListener

private TableCellListener(JTable table, int row, int column, Object oldValue, Object newValue)
Create a TableCellListener with a copy of all the data relevant to the change of data for a given cell.
Parameters:
row - the row of the changed cell
column - the column of the changed cell
oldValue - the old data of the changed cell
newValue - the new data of the changed cell


 
Method Detail

getColumn

public int getColumn()
Get the column that was last edited
Returns:
the column that was edited


getNewValue

public Object getNewValue()
Get the new value in the cell
Returns:
the new value in the cell


getOldValue

public Object getOldValue()
Get the old value of the cell
Returns:
the old value of the cell


getRow

public int getRow()
Get the row that was last edited
Returns:
the row that was edited


getTable

public JTable getTable()
Get the table of the cell that was changed
Returns:
the table of the cell that was changed


processEditingStarted

private void processEditingStarted()


processEditingStopped

private void processEditingStopped()


propertyChange

de
	public
public void propertyChange(PropertyChangeEvent e)


run

de
	public
public void run()


 

Groovy Documentation