ca.odell.glazedlists.swt
Class DefaultEventKTableModel

java.lang.Object
  extended by ca.odell.glazedlists.swt.DefaultEventKTableModel
All Implemented Interfaces:
ListEventListener, de.kupzog.ktable.KTableModel, EventListener
Direct Known Subclasses:
EventKTableModel

public class DefaultEventKTableModel
extends Object
implements de.kupzog.ktable.KTableModel, ListEventListener

A KTableModel that displays an EventList. Each element of the EventList corresponds to a row in the KTableModel. The columns of the table must be specified using a TableFormat.

Extension: KTable
This Glazed Lists extension requires the third party library KTable.
Tested Version:2.1.2
Home page:http://ktable.sourceforge.net/
License:Eclipse Public License

The DefaultEventKTableModel class is not thread-safe. Unless otherwise noted, all methods are only safe to be called from the SWT event dispatch thread. To do this programmatically, use Display.asyncExec(Runnable).

Author:
Jesse Wilson, Holger Brands

Field Summary
protected  EventList source
          the proxy moves events to the SWT thread
 
Constructor Summary
  DefaultEventKTableModel(de.kupzog.ktable.KTable table, EventList source, TableFormat tableFormat)
          Create a new DefaultEventKTableModel that uses elements from the specified EventList as rows, and the specified TableFormat to divide row objects across columns.
protected DefaultEventKTableModel(de.kupzog.ktable.KTable table, EventList source, TableFormat tableFormat, boolean disposeSource)
          Create a new DefaultEventKTableModel that uses elements from the specified EventList as rows, and the specified TableFormat to divide row objects across columns.
 
Method Summary
 org.eclipse.swt.graphics.Point belongsToCell(int column, int row)
          
 void dispose()
          Releases the resources consumed by this DefaultEventKTableModel so that it may eventually be garbage collected.
 de.kupzog.ktable.KTableCellEditor getCellEditor(int column, int row)
          
 de.kupzog.ktable.KTableCellRenderer getCellRenderer(int column, int row)
          
 int getColumnCount()
          
 int getColumnWidth(int col)
          
 Object getContentAt(int column, int row)
          
 int getFixedHeaderColumnCount()
          
 int getFixedHeaderRowCount()
          
 int getFixedSelectableColumnCount()
          
 int getFixedSelectableRowCount()
          
 int getRowCount()
          
 int getRowHeight(int row)
          
 int getRowHeightMinimum()
          
 String getTooltipAt(int column, int row)
          
 boolean isColumnResizable(int col)
          
 boolean isRowResizable(int row)
          
 void listChanged(ListEvent listChanges)
          When the underlying list changes, this notification allows the object to repaint itself or update itself as necessary.
 void setColumnWidth(int col, int width)
          
 void setContentAt(int column, int row, Object value)
          
 void setRowHeight(int row, int value)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

protected EventList source
the proxy moves events to the SWT thread

Constructor Detail

DefaultEventKTableModel

public DefaultEventKTableModel(de.kupzog.ktable.KTable table,
                               EventList source,
                               TableFormat tableFormat)
Create a new DefaultEventKTableModel that uses elements from the specified EventList as rows, and the specified TableFormat to divide row objects across columns.

Parameters:
table - the KTable the model is created for
source - the EventList
tableFormat - provides logic to divide row objects across columns. If the value implements the KTableFormat interface, those methods will be used to provide further details such as cell renderers, cell editors and row heights.

DefaultEventKTableModel

protected DefaultEventKTableModel(de.kupzog.ktable.KTable table,
                                  EventList source,
                                  TableFormat tableFormat,
                                  boolean disposeSource)
Create a new DefaultEventKTableModel that uses elements from the specified EventList as rows, and the specified TableFormat to divide row objects across columns.

Parameters:
table - the KTable the model is created for
source - the EventList
tableFormat - provides logic to divide row objects across columns. If the value implements the KTableFormat interface, those methods will be used to provide further details such as cell renderers, cell editors and row heights.
diposeSource - true if the source list should be disposed when disposing this model, false otherwise
Method Detail

listChanged

public void listChanged(ListEvent listChanges)
When the underlying list changes, this notification allows the object to repaint itself or update itself as necessary.

It is mandatory that the calling thread has obtained the write lock on the source list. This is because the calling thread will have written to the source list to cause this event. This condition guarantees that no writes can occur while the listener is handling this event. It is an error to write to the source list while processing an event.

Specified by:
listChanged in interface ListEventListener
Parameters:
listChanges - a ListEvent describing the changes to the list

getContentAt

public Object getContentAt(int column,
                           int row)

Specified by:
getContentAt in interface de.kupzog.ktable.KTableModel

getTooltipAt

public String getTooltipAt(int column,
                           int row)

Specified by:
getTooltipAt in interface de.kupzog.ktable.KTableModel

getCellEditor

public de.kupzog.ktable.KTableCellEditor getCellEditor(int column,
                                                       int row)

Specified by:
getCellEditor in interface de.kupzog.ktable.KTableModel

setContentAt

public void setContentAt(int column,
                         int row,
                         Object value)

Specified by:
setContentAt in interface de.kupzog.ktable.KTableModel

getCellRenderer

public de.kupzog.ktable.KTableCellRenderer getCellRenderer(int column,
                                                           int row)

Specified by:
getCellRenderer in interface de.kupzog.ktable.KTableModel

belongsToCell

public org.eclipse.swt.graphics.Point belongsToCell(int column,
                                                    int row)

Specified by:
belongsToCell in interface de.kupzog.ktable.KTableModel

getRowCount

public int getRowCount()

Specified by:
getRowCount in interface de.kupzog.ktable.KTableModel

getFixedHeaderRowCount

public int getFixedHeaderRowCount()

Specified by:
getFixedHeaderRowCount in interface de.kupzog.ktable.KTableModel

getFixedSelectableRowCount

public int getFixedSelectableRowCount()

Specified by:
getFixedSelectableRowCount in interface de.kupzog.ktable.KTableModel

getColumnCount

public int getColumnCount()

Specified by:
getColumnCount in interface de.kupzog.ktable.KTableModel

getFixedHeaderColumnCount

public int getFixedHeaderColumnCount()

Specified by:
getFixedHeaderColumnCount in interface de.kupzog.ktable.KTableModel

getFixedSelectableColumnCount

public int getFixedSelectableColumnCount()

Specified by:
getFixedSelectableColumnCount in interface de.kupzog.ktable.KTableModel

getColumnWidth

public int getColumnWidth(int col)

Specified by:
getColumnWidth in interface de.kupzog.ktable.KTableModel

isColumnResizable

public boolean isColumnResizable(int col)

Specified by:
isColumnResizable in interface de.kupzog.ktable.KTableModel

setColumnWidth

public void setColumnWidth(int col,
                           int width)

Specified by:
setColumnWidth in interface de.kupzog.ktable.KTableModel

getRowHeight

public int getRowHeight(int row)

Specified by:
getRowHeight in interface de.kupzog.ktable.KTableModel

isRowResizable

public boolean isRowResizable(int row)

Specified by:
isRowResizable in interface de.kupzog.ktable.KTableModel

getRowHeightMinimum

public int getRowHeightMinimum()

Specified by:
getRowHeightMinimum in interface de.kupzog.ktable.KTableModel

setRowHeight

public void setRowHeight(int row,
                         int value)

Specified by:
setRowHeight in interface de.kupzog.ktable.KTableModel

dispose

public void dispose()
Releases the resources consumed by this DefaultEventKTableModel so that it may eventually be garbage collected.

A DefaultEventKTableModel will be garbage collected without a call to dispose(), but not before its source EventList is garbage collected. By calling dispose(), you allow the DefaultEventKTableModel to be garbage collected before its source EventList. This is necessary for situations where a DefaultEventKTableModel is short-lived but its source EventList is long-lived.

Warning: It is an error to call any method on a DefaultEventKTableModel after it has been disposed.



Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by hbrands at 2013-02-12 20:58