fr.ifremer.coser.ui.control
Class ControlDuplicatedLineTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by fr.ifremer.coser.ui.control.ControlTableModel
          extended by fr.ifremer.coser.ui.control.ControlDuplicatedLineTableModel
All Implemented Interfaces:
Serializable, TableModel

public class ControlDuplicatedLineTableModel
extends ControlTableModel

Table model that change line order to display duplicated line side by side. L'implementation reside sur la construction d'un tableau associatif qui associe les numeros demandé par la vue à d'autre numero différents qui correspondent au données du modèle réel. La précédente implémentation utilisait des ArrayList, mais n'était pas performante vis à vis de la construction de la liste.

Version:
$Revision: 940 $ Last update : $Date: 2012-01-04 11:14:42 +0100 (Wed, 04 Jan 2012) $ By : $Author: echatellier $
Author:
chatellier
See Also:
Serialized Form

Field Summary
protected  List<ControlError> controlErrors
          List des erreurs de validation (non null seulement apres validation).
protected  ControlTableModel dataTableModel
           
protected  int[] linesIndex
           
protected  int[] reverseLinesIndex
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ControlDuplicatedLineTableModel(ControlTableModel dataTableModel)
           
 
Method Summary
 void addTableModelListener(TableModelListener l)
           
protected  void computeLineIndices()
          Compute line indices.
protected  void deleteLine(int lineIndex)
          Update linesIndex array to remove an index of a line.
 int findColumn(String columnName)
           
 void fireTableCellUpdated(int row, int column)
           
 void fireTableChanged(TableModelEvent e)
           
 void fireTableDataChanged()
           
 void fireTableRowsDeleted(int firstRow, int lastRow)
           
 void fireTableRowsInserted(int firstRow, int lastRow)
           
 void fireTableRowsUpdated(int firstRow, int lastRow)
           
 void fireTableStructureChanged()
           
 CoserConstants.Category getCategory()
          Return category managed by model.
 Class<?> getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 String getColumnName(int column)
           
protected  List<ControlError> getCurrentModelErrors()
          Parse input control errors list, an build a new list with only errors that will be used by this model.
 String[] getDataAt(int rowIndex)
          Retourne la donnée (toutes le String[]) à la ligne demandée.
<T extends EventListener>
T[]
getListeners(Class<T> listenerType)
           
protected  int getModifiedRowIndex(int rowIndex)
          Look for modified order row index.
 int getRealIndexOfLine(String lineNumber)
          Retourne l'index réel de la ligne dans la vue.
 int getRowCount()
           
 TableModelListener[] getTableModelListeners()
           
 Object getValueAt(int rowIndex, int columnIndex)
           
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 void removeTableModelListener(TableModelListener l)
           
 void setControlErrors(List<ControlError> controlErrors)
           
 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

dataTableModel

protected ControlTableModel dataTableModel

controlErrors

protected List<ControlError> controlErrors
List des erreurs de validation (non null seulement apres validation).


linesIndex

protected int[] linesIndex

reverseLinesIndex

protected int[] reverseLinesIndex
Constructor Detail

ControlDuplicatedLineTableModel

public ControlDuplicatedLineTableModel(ControlTableModel dataTableModel)
Method Detail

getCategory

public CoserConstants.Category getCategory()
Description copied from class: ControlTableModel
Return category managed by model.

Specified by:
getCategory in class ControlTableModel
Returns:
model category

setControlErrors

public void setControlErrors(List<ControlError> controlErrors)

computeLineIndices

protected void computeLineIndices()
Compute line indices. This algorithm has been optimized three times. Be carefull of performances when modify it, can take looooong times without optimisation.


getCurrentModelErrors

protected List<ControlError> getCurrentModelErrors()
Parse input control errors list, an build a new list with only errors that will be used by this model.

Returns:
new error list for model only

getRowCount

public int getRowCount()

getColumnCount

public int getColumnCount()

getColumnName

public String getColumnName(int column)
Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel

getModifiedRowIndex

protected int getModifiedRowIndex(int rowIndex)
Look for modified order row index.

Parameters:
rowIndex - initial row index
Returns:
modified row index

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)

getDataAt

public String[] getDataAt(int rowIndex)
Description copied from class: ControlTableModel
Retourne la donnée (toutes le String[]) à la ligne demandée.

Specified by:
getDataAt in class ControlTableModel
Returns:
String[]

getRealIndexOfLine

public int getRealIndexOfLine(String lineNumber)
Retourne l'index réel de la ligne dans la vue. Ne doit être utilisé que pour manipuler le modele de selection et non appeler derriere getValueAt ou getDataAt (pas de sens).

Specified by:
getRealIndexOfLine in class ControlTableModel
Parameters:
lineNumber - le numero de données
Returns:
l'index

deleteLine

protected void deleteLine(int lineIndex)
Update linesIndex array to remove an index of a line. This method WONT work for addition, just deletion.

Parameters:
lineIndex - index of line to delete

findColumn

public int findColumn(String columnName)
Overrides:
findColumn in class AbstractTableModel

getColumnClass

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

isCellEditable

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

setValueAt

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

fireTableDataChanged

public void fireTableDataChanged()
Overrides:
fireTableDataChanged in class AbstractTableModel

fireTableStructureChanged

public void fireTableStructureChanged()
Overrides:
fireTableStructureChanged in class AbstractTableModel

fireTableRowsInserted

public void fireTableRowsInserted(int firstRow,
                                  int lastRow)
Overrides:
fireTableRowsInserted in class AbstractTableModel

fireTableRowsUpdated

public void fireTableRowsUpdated(int firstRow,
                                 int lastRow)
Overrides:
fireTableRowsUpdated in class AbstractTableModel

fireTableRowsDeleted

public void fireTableRowsDeleted(int firstRow,
                                 int lastRow)
Overrides:
fireTableRowsDeleted in class AbstractTableModel

fireTableCellUpdated

public void fireTableCellUpdated(int row,
                                 int column)
Overrides:
fireTableCellUpdated in class AbstractTableModel

fireTableChanged

public void fireTableChanged(TableModelEvent e)
Overrides:
fireTableChanged in class AbstractTableModel

addTableModelListener

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

removeTableModelListener

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

getTableModelListeners

public TableModelListener[] getTableModelListeners()
Overrides:
getTableModelListeners in class AbstractTableModel

getListeners

public <T extends EventListener> T[] getListeners(Class<T> listenerType)
Overrides:
getListeners in class AbstractTableModel


Copyright © 2010-2012 Ifremer. All Rights Reserved.