org.nuiton.math.matrix.gui
Class MatrixTableModelOption

java.lang.Object
  extended by org.nuiton.math.matrix.gui.MatrixTableModelOption
All Implemented Interfaces:
TableModel, MatrixTableModel

public class MatrixTableModelOption
extends Object
implements MatrixTableModel

Model that take a delegate model to add additional lines during rendering (such as row sum, column sum, row mean, column mean...) Created: 21 mars 2006 19:01:27

Version:
$Revision: 366 $ Last update: $Date: 2011-05-25 10:51:21 +0200 (mer., 25 mai 2011) $ by : $Author: echatellier $
Author:
poussin

Field Summary
protected  MatrixTableModel delegate
           
protected  boolean meanOption
           
protected  boolean sumOption
           
protected  boolean transposeOption
           
 
Constructor Summary
MatrixTableModelOption(MatrixTableModel delegate)
           
MatrixTableModelOption(MatrixTableModel delegate, boolean sumOption, boolean meanOption, boolean transposeOption)
           
 
Method Summary
 void addTableModelListener(TableModelListener l)
           
 int getAdditionalColumns()
          Get how many additional columns table model need to renderer matrix.
 int getAdditionalRows()
          Get how many additional rows table model need to renderer matrix.
 Class<?> getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 String getColumnName(int columnIndex)
           
protected  Double getComputedValueForColumn(int delegateColumnIndex, boolean mean)
          Compute sum for delegate model column index.
protected  Double getComputedValueForRow(int delegateRowIndex, boolean mean)
          Compute sum for delegate model row index.
 MatrixND getMatrix()
           
 TableCellRenderer getMatrixCellRenderer()
           
 int getRowCount()
           
 Object getValueAt(int rowIndex, int columnIndex)
           
protected  Object getValueAtTranposable(int rowIndex, int columnIndex, int rowCount, int columnCount)
          Get value qui fonctionne aussi en transposée.
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 boolean isMeanOption()
           
 boolean isSumOption()
           
 boolean isTransposeOption()
           
 void removeTableModelListener(TableModelListener l)
           
 void setMatrix(MatrixND m)
           
 void setMeanOption(boolean meanOption)
           
 void setSumOption(boolean sumOption)
           
 void setTransposeOption(boolean transposeOption)
           
 void setValueAt(Object aValue, int rowIndex, int columnIndex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delegate

protected MatrixTableModel delegate

sumOption

protected boolean sumOption

meanOption

protected boolean meanOption

transposeOption

protected boolean transposeOption
Constructor Detail

MatrixTableModelOption

public MatrixTableModelOption(MatrixTableModel delegate)

MatrixTableModelOption

public MatrixTableModelOption(MatrixTableModel delegate,
                              boolean sumOption,
                              boolean meanOption,
                              boolean transposeOption)
Method Detail

isSumOption

public boolean isSumOption()

setSumOption

public void setSumOption(boolean sumOption)

isMeanOption

public boolean isMeanOption()

setMeanOption

public void setMeanOption(boolean meanOption)

isTransposeOption

public boolean isTransposeOption()

setTransposeOption

public void setTransposeOption(boolean transposeOption)

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface TableModel

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface TableModel

getColumnName

public String getColumnName(int columnIndex)
Specified by:
getColumnName in interface TableModel

getColumnClass

public Class<?> getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface TableModel

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Specified by:
isCellEditable in interface TableModel

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)
Specified by:
getValueAt in interface TableModel

getValueAtTranposable

protected Object getValueAtTranposable(int rowIndex,
                                       int columnIndex,
                                       int rowCount,
                                       int columnCount)
Get value qui fonctionne aussi en transposée. Le principe est que des que les bornes sur modele delegé sont dépassées on réalise des opération (mean/sum). Actuellement le code n'est vraiment pas evident.

Parameters:
rowIndex - rowIndex
columnIndex - columnIndex
rowCount - rowCount
columnCount - columnCount
Returns:
object at rowIndex/columnCount

getComputedValueForRow

protected Double getComputedValueForRow(int delegateRowIndex,
                                        boolean mean)
Compute sum for delegate model row index.

Parameters:
delegateRowIndex - delegate model row index
Returns:
sum for row

getComputedValueForColumn

protected Double getComputedValueForColumn(int delegateColumnIndex,
                                           boolean mean)
Compute sum for delegate model column index.

Parameters:
delegateColumnIndex - delegate model column index
Returns:
sum for column

setValueAt

public void setValueAt(Object aValue,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface TableModel

addTableModelListener

public void addTableModelListener(TableModelListener l)
Specified by:
addTableModelListener in interface TableModel

removeTableModelListener

public void removeTableModelListener(TableModelListener l)
Specified by:
removeTableModelListener in interface TableModel

setMatrix

public void setMatrix(MatrixND m)
Specified by:
setMatrix in interface MatrixTableModel

getMatrix

public MatrixND getMatrix()
Specified by:
getMatrix in interface MatrixTableModel

getMatrixCellRenderer

public TableCellRenderer getMatrixCellRenderer()
Specified by:
getMatrixCellRenderer in interface MatrixTableModel

getAdditionalRows

public int getAdditionalRows()
Description copied from interface: MatrixTableModel
Get how many additional rows table model need to renderer matrix.

Specified by:
getAdditionalRows in interface MatrixTableModel
Returns:
additional rows

getAdditionalColumns

public int getAdditionalColumns()
Description copied from interface: MatrixTableModel
Get how many additional columns table model need to renderer matrix.

Specified by:
getAdditionalColumns in interface MatrixTableModel
Returns:
additional columns


Copyright © 2004-2011 CodeLutin. All Rights Reserved.