Package org.nuiton.math.matrix.gui
Class MatrixTableModelND
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- org.nuiton.math.matrix.gui.MatrixTableModelND
-
- All Implemented Interfaces:
Serializable
,TableModel
,MatrixTableModel
public class MatrixTableModelND extends AbstractTableModel implements MatrixTableModel
Extension de AbstractTableModel pour definir un TableModel avec une MatrixND comme support d'information. Created: 21 mars 2006 19:01:27- Version:
- $Revision$ Last update: $Date$ by : $Author$
- Author:
- poussin
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MatrixTableModelND.MatrixCellRenderer
-
Field Summary
Fields Modifier and Type Field Description protected int
addCol
nombre de colone ajoutéprotected int
addRow
nombre de ligne ajoutéprotected MatrixND
m
protected int[]
multRowCol
protected TableCellRenderer
renderer
-
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description MatrixTableModelND(MatrixND m)
TableModel basee sur une MatrixND a une ou deux dimensions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 column)
int
getColumnCount()
String
getColumnName(int column)
MatrixND
getMatrix()
TableCellRenderer
getMatrixCellRenderer()
int
getRowCount()
protected String
getSemantic(int dim, int elem)
Retourne une representation String de la semantique de l'element elem de la dimension dimprotected Object
getValue(int row, int col)
Get value.Object
getValueAt(int row, int column)
boolean
isCellEditable(int row, int column)
void
setMatrix(MatrixND m)
void
setValueAt(Object obj, int row, int column)
protected int[]
tableToMatrix(int row, int col)
converti les coordonnées de la table en coordonnées pour la matriceprotected int
tableToMatrixCell(int dim, int tableValue)
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, removeTableModelListener
-
-
-
-
Field Detail
-
m
protected MatrixND m
-
addRow
protected int addRow
nombre de ligne ajouté
-
addCol
protected int addCol
nombre de colone ajouté
-
multRowCol
protected int[] multRowCol
-
renderer
protected TableCellRenderer renderer
-
-
Constructor Detail
-
MatrixTableModelND
public MatrixTableModelND(MatrixND m) throws MatrixException
TableModel basee sur une MatrixND a une ou deux dimensions. Pour le moment les matrices de plus de 3 dimensions ne sont pas geree.Pour les matrices 1D :
La premiere dimension represente les colonnes.
Pour les matrices 2D :
La premiere dimension represente les lignes.
La deuxieme dimension represente les colonnes.
Pour les matrices 3D :
La premiere dimension represente les lignes.
La deuxieme dimension represente les colonnes.
La troisieme dimension represente les lignes (dim1 x dim3).
- Parameters:
m
- Matrice a afficher dans la table- Throws:
MatrixException
-
-
Method Detail
-
getMatrix
public MatrixND getMatrix()
- Specified by:
getMatrix
in interfaceMatrixTableModel
-
setMatrix
public void setMatrix(MatrixND m)
- Specified by:
setMatrix
in interfaceMatrixTableModel
-
tableToMatrix
protected int[] tableToMatrix(int row, int col)
converti les coordonnées de la table en coordonnées pour la matrice- Parameters:
row
- la ligne dans la tablecol
- la colonne dans la table- Returns:
- les coordonnées equivalentes dans la matrice
-
tableToMatrixCell
protected int tableToMatrixCell(int dim, int tableValue)
-
getValue
protected Object getValue(int row, int col)
Get value. Return column name (i18n if possible) for bounded values.- Parameters:
row
- rowcol
- column- Returns:
- value
-
getSemantic
protected String getSemantic(int dim, int elem)
Retourne une representation String de la semantique de l'element elem de la dimension dim- Parameters:
dim
- la dimension dans lequel on recherche l'elementelem
- l'element de la dimension a prendre- Returns:
- une chaine representant l'element. Si l'element est null, la chaine vide est retourné
-
getColumnName
public String getColumnName(int column)
- Specified by:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classAbstractTableModel
-
getRowCount
public int getRowCount()
- Specified by:
getRowCount
in interfaceTableModel
- Returns:
- Le nombre de lignes de la table.
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCount
in interfaceTableModel
- Returns:
- Le nombre de colonnes de la table.
-
getValueAt
public Object getValueAt(int row, int column)
- Specified by:
getValueAt
in interfaceTableModel
- Parameters:
row
- La lignecolumn
- La colonnes- Returns:
- L'Object correspondant dans la matrice.
-
setValueAt
public void setValueAt(Object obj, int row, int column)
- Specified by:
setValueAt
in interfaceTableModel
- Overrides:
setValueAt
in classAbstractTableModel
- Parameters:
obj
- L'objet a inserer dans la matrice.row
- La lignecolumn
- La colonnes
-
isCellEditable
public boolean isCellEditable(int row, int column)
- Specified by:
isCellEditable
in interfaceTableModel
- Overrides:
isCellEditable
in classAbstractTableModel
-
getColumnClass
public Class<?> getColumnClass(int column)
- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
-
getMatrixCellRenderer
public TableCellRenderer getMatrixCellRenderer()
- Specified by:
getMatrixCellRenderer
in interfaceMatrixTableModel
-
getAdditionalRows
public int getAdditionalRows()
Description copied from interface:MatrixTableModel
Get how many additional rows table model need to renderer matrix.- Specified by:
getAdditionalRows
in interfaceMatrixTableModel
- 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 interfaceMatrixTableModel
- Returns:
- additional columns
-
-