Diamond Control Suite 3.0

diamondedge.swing.grid
Class TableModelFormat

java.lang.Object
  extended by diamondedge.swing.grid.TableModelFormat
All Implemented Interfaces:
TableFormat, EventListener, TableModelListener

public class TableModelFormat
extends Object
implements TableFormat, TableModelListener

This class allows a mapping to be specified between the actual data value in the cell and a set of values. The actual value in the grid will correspond to the value in the TableModel for the selected row and the BoundColumn. The value displayed in the grid will correspond to the value in the TableModel for the selected row and the TextColumn. When editing in a DsGrid, a multi-column drop-down ComboBox will be used as the editor.


Constructor Summary
TableModelFormat()
           
 
Method Summary
 int getBoundColumn()
          Determines the column used as the data value.
 int getColumnCount()
          Returns the number of columns in the table.
 Object getDataValue(int row)
          Returns the value for the bound column at specified row.
 int getIndexOf(Object dataValue)
          Returns the row index for the given data value.
 TableModel getModel()
          Returns the TableModel used to supply all data values.
 int getRowCount()
          Returns the number of rows in the table.
 int getTextColumn()
          Determines the column used as the value for the Text.
 Object getTextValue(int row)
          Returns the value for the display column at specified row.
 Object getValueAt(int rowIndex, int columnIndex)
          Returns the value for the cell at columnIndex and rowIndex.
 boolean isBoundColumnVisible()
          Determines whether the column used as the data value is visible.
 void loadTextData(Reader reader, int begRow, int begCol, int endRow, int endCol, boolean firstRowIsColHeader, char delim, boolean stripStringDelim, boolean convertData)
          Load data from a text stream.
 void setBoundColumn(int val)
          Determines the column used as the data value.
 void setBoundColumnVisible(boolean showBoundColumn)
          Determines whether the column used as the data value is visible.
 void setModel(TableModel dataModel)
          Sets the TableModel used to supply all data values.
 void setTextColumn(int val)
          Determines the column used as the value for the Text property which is diplayed in the text area of the ComboBox.
 void setValueAt(Object aValue, int rowIndex, int columnIndex)
          Sets the value in the cell at columnIndex and rowIndex to aValue.
 void tableChanged(TableModelEvent e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableModelFormat

public TableModelFormat()
Method Detail

getModel

public TableModel getModel()
Returns the TableModel used to supply all data values.


setModel

public void setModel(TableModel dataModel)
Sets the TableModel used to supply all data values.


loadTextData

public void loadTextData(Reader reader,
                         int begRow,
                         int begCol,
                         int endRow,
                         int endCol,
                         boolean firstRowIsColHeader,
                         char delim,
                         boolean stripStringDelim,
                         boolean convertData)
                  throws IOException,
                         ArrayIndexOutOfBoundsException
Load data from a text stream. The TableModel must have enough rows and columns to load the data or an exception will be thrown.

Parameters:
reader - stream that provides the data
begRow - row position in model to begin placing data
begCol - column position in model to begin placing data
endRow - ending row position in model to stop setting data. -1 means to load all data.
endCol - ending column position in model to stop setting data. -1 means to load all columns up to model.getColumnCount.
firstRowIsColHeader - the first row is used to set the column headers
delim - delimeter used to separate values. Pass in '\t' for tab delimeted and ',' for csv.
stripStringDelim - removes the " at the beginning and end of strings
convertData - attempt to parse the values into a Number, Boolean, Date in that order
Throws:
IOException
ArrayIndexOutOfBoundsException

tableChanged

public void tableChanged(TableModelEvent e)
Specified by:
tableChanged in interface TableModelListener

isBoundColumnVisible

public boolean isBoundColumnVisible()
Determines whether the column used as the data value is visible.


setBoundColumnVisible

public void setBoundColumnVisible(boolean showBoundColumn)
Determines whether the column used as the data value is visible.


getBoundColumn

public int getBoundColumn()
Determines the column used as the data value.


setBoundColumn

public void setBoundColumn(int val)
Determines the column used as the data value.


getTextColumn

public int getTextColumn()
Determines the column used as the value for the Text.


setTextColumn

public void setTextColumn(int val)
Determines the column used as the value for the Text property which is diplayed in the text area of the ComboBox.


getDataValue

public Object getDataValue(int row)
Returns the value for the bound column at specified row.

Specified by:
getDataValue in interface TableFormat

getTextValue

public Object getTextValue(int row)
Returns the value for the display column at specified row.

Specified by:
getTextValue in interface TableFormat

getIndexOf

public int getIndexOf(Object dataValue)
Returns the row index for the given data value.

Specified by:
getIndexOf in interface TableFormat

getRowCount

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

Specified by:
getRowCount in interface TableFormat

getColumnCount

public int getColumnCount()
Returns the number of columns in the table.

Specified by:
getColumnCount in interface TableFormat

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)
Returns the value for the cell at columnIndex and rowIndex.

Specified by:
getValueAt in interface TableFormat

setValueAt

public void setValueAt(Object aValue,
                       int rowIndex,
                       int columnIndex)
Sets the value in the cell at columnIndex and rowIndex to aValue.

Specified by:
setValueAt in interface TableFormat

Diamond Control Suite 3.0

Diamond Edge and Diamond Control Suite are trademarks or registered trademarks of Diamond Edge, Inc. Copyright 1999-2005 Diamond Edge, Inc. All Rights Reserved.