com.l2fprod.common.swing.table
Class AbstractMutableListTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.l2fprod.common.swing.table.AbstractMutableListTableModel
All Implemented Interfaces:
MutableListModel, java.io.Serializable, javax.swing.ListModel, javax.swing.table.TableModel

public abstract class AbstractMutableListTableModel
extends javax.swing.table.AbstractTableModel
implements MutableListModel

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.l2fprod.common.swing.list.MutableListModel
MutableListModel.ActionList, MutableListModel.Actions
 
Field Summary
protected  java.util.List _data
           
protected  javax.swing.event.EventListenerList listenerList
           
 
Constructor Summary
AbstractMutableListTableModel()
           
 
Method Summary
 void add(int index, java.lang.Object element)
          Inserts the specified element at the specified position in this list (optional operation).
 void add(java.lang.Object object)
          Appends the specified element to the end of this list (optional operation).
 void add(java.lang.Object[] objects)
           
 void addListDataListener(javax.swing.event.ListDataListener l)
          Add a listener to the list that's notified each time a change to the data model occurs.
protected  void fireContentsChanged(java.lang.Object source, int index0, int index1)
          AbstractListModel subclasses must call this method after one or more elements of the list change.
protected  void fireIntervalAdded(java.lang.Object source, int index0, int index1)
          AbstractListModel subclasses must call this method after one or more elements are added to the model.
protected  void fireIntervalRemoved(java.lang.Object source, int index0, int index1)
          AbstractListModel subclasses must call this method after one or more elements are removed from the model.
 void fireTableDataChanged()
           
 void fireTableRowsDeleted(int firstRow, int lastRow)
           
 void fireTableRowsInserted(int firstRow, int lastRow)
           
 void fireTableRowsUpdated(int firstRow, int lastRow)
           
 java.lang.Object getElementAt(int index)
           
 int getIndex(java.lang.Object o)
          Returns the index within this model of the first occurence of the specified Object.
 int getIndex(java.lang.Object o, int fromIndex)
          Return the index within this model of the first occurence of the specified Object, starting at the specified index (included).
 java.lang.Object getObject(int index)
           
 int getRowCount()
           
 int getSize()
           
 void moveDown(int index)
          Move the object at index one line down
 void moveTo(int oldIndex0, int oldIndex1, int newIndex0)
          Move the objects between oldIndex0 and oldIndex1 to the new position newIndex0.
 void moveToBottom(int index)
          Move the object at index to the bottom of the list.
 void moveToTop(int index)
          Move the object at index to the top of the list.
 void moveUp(int index)
          Move the object at index one line up
 java.lang.Object remove(int index)
          Remove the element at index
 void remove(java.lang.Object o)
           
 void removeAll()
          Remove All Elements from this list model.
 void removeListDataListener(javax.swing.event.ListDataListener l)
          Remove a listener from the list that's notified each time a change to the data model occurs.
 void replace(int index, java.lang.Object object)
           
 void update()
          Shortcut for fireTableDataChanged()
 void update(int row)
          Notify listeners that the given row has been updated.
 int update(java.lang.Object o)
          Notify listeners that the given object has been updated.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
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
getColumnCount, getValueAt
 

Field Detail

_data

protected java.util.List _data

listenerList

protected javax.swing.event.EventListenerList listenerList
Constructor Detail

AbstractMutableListTableModel

public AbstractMutableListTableModel()
Method Detail

add

public void add(java.lang.Object object)
Description copied from interface: MutableListModel
Appends the specified element to the end of this list (optional operation).

Specified by:
add in interface MutableListModel
Parameters:
object - an Object value

add

public void add(java.lang.Object[] objects)

add

public void add(int index,
                java.lang.Object element)
Description copied from interface: MutableListModel
Inserts the specified element at the specified position in this list (optional operation).

Specified by:
add in interface MutableListModel
Parameters:
index - an int value
element - an Object value

update

public void update()
Shortcut for fireTableDataChanged()


update

public void update(int row)
Notify listeners that the given row has been updated.

Parameters:
row - an int value
See Also:
getIndex(Object)

update

public int update(java.lang.Object o)
Notify listeners that the given object has been updated. This method will traverse the model to find all occurences of the given object.

Parameters:
o - an Object value
Returns:
the number of rows updated
See Also:
getIndex(Object)

replace

public void replace(int index,
                    java.lang.Object object)

remove

public void remove(java.lang.Object o)

remove

public java.lang.Object remove(int index)
Description copied from interface: MutableListModel
Remove the element at index

Specified by:
remove in interface MutableListModel
Parameters:
index - an int value
Returns:
the element previously at the specified position.

removeAll

public void removeAll()
Description copied from interface: MutableListModel
Remove All Elements from this list model.

Specified by:
removeAll in interface MutableListModel

moveToTop

public void moveToTop(int index)
Move the object at index to the top of the list.

Specified by:
moveToTop in interface MutableListModel
Parameters:
index - an int value

moveUp

public void moveUp(int index)
Move the object at index one line up

Specified by:
moveUp in interface MutableListModel
Parameters:
index - an int value

moveDown

public void moveDown(int index)
Move the object at index one line down

Specified by:
moveDown in interface MutableListModel
Parameters:
index - an int value

moveToBottom

public void moveToBottom(int index)
Move the object at index to the bottom of the list.

Specified by:
moveToBottom in interface MutableListModel
Parameters:
index - an int value

moveTo

public void moveTo(int oldIndex0,
                   int oldIndex1,
                   int newIndex0)
Move the objects between oldIndex0 and oldIndex1 to the new position newIndex0.

Specified by:
moveTo in interface MutableListModel
Parameters:
oldIndex0 - , oldIndex1 the limits of the interval to move
newIndex0 - the new position of the element that was at oldIndex0
oldIndex1 - oldIndex1 the limits of the interval to move

getIndex

public int getIndex(java.lang.Object o)
Returns the index within this model of the first occurence of the specified Object.

Parameters:
o - an Object value
Returns:
the first occurence or -1 if o is not found in the model.

getIndex

public int getIndex(java.lang.Object o,
                    int fromIndex)
Return the index within this model of the first occurence of the specified Object, starting at the specified index (included).

Parameters:
o - an Object value
fromIndex - an int value
Returns:
an int value

getObject

public java.lang.Object getObject(int index)

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface javax.swing.table.TableModel

fireTableRowsInserted

public void fireTableRowsInserted(int firstRow,
                                  int lastRow)
Overrides:
fireTableRowsInserted in class javax.swing.table.AbstractTableModel

fireTableDataChanged

public void fireTableDataChanged()
Overrides:
fireTableDataChanged in class javax.swing.table.AbstractTableModel

fireTableRowsUpdated

public void fireTableRowsUpdated(int firstRow,
                                 int lastRow)
Overrides:
fireTableRowsUpdated in class javax.swing.table.AbstractTableModel

fireTableRowsDeleted

public void fireTableRowsDeleted(int firstRow,
                                 int lastRow)
Overrides:
fireTableRowsDeleted in class javax.swing.table.AbstractTableModel

addListDataListener

public void addListDataListener(javax.swing.event.ListDataListener l)
Add a listener to the list that's notified each time a change to the data model occurs.

Specified by:
addListDataListener in interface javax.swing.ListModel
Parameters:
l - the ListDataListener

removeListDataListener

public void removeListDataListener(javax.swing.event.ListDataListener l)
Remove a listener from the list that's notified each time a change to the data model occurs.

Specified by:
removeListDataListener in interface javax.swing.ListModel
Parameters:
l - the ListDataListener

fireContentsChanged

protected void fireContentsChanged(java.lang.Object source,
                                   int index0,
                                   int index1)
AbstractListModel subclasses must call this method after one or more elements of the list change. The changed elements are specified by a closed interval index0, index1, i.e. the range that includes both index0 and index1. Note that index0 need not be less than or equal to index1.

Parameters:
source - The ListModel that changed, typically "this".
index0 - One end of the new interval.
index1 - The other end of the new interval.
See Also:
EventListenerList, DefaultListModel

fireIntervalAdded

protected void fireIntervalAdded(java.lang.Object source,
                                 int index0,
                                 int index1)
AbstractListModel subclasses must call this method after one or more elements are added to the model. The new elements are specified by a closed interval index0, index1, i.e. the range that includes both index0 and index1. Note that index0 need not be less than or equal to index1.

Parameters:
source - The ListModel that changed, typically "this".
index0 - One end of the new interval.
index1 - The other end of the new interval.
See Also:
EventListenerList, DefaultListModel

fireIntervalRemoved

protected void fireIntervalRemoved(java.lang.Object source,
                                   int index0,
                                   int index1)
AbstractListModel subclasses must call this method after one or more elements are removed from the model. The new elements are specified by a closed interval index0, index1, i.e. the range that includes both index0 and index1. Note that index0 need not be less than or equal to index1.

Parameters:
source - The ListModel that changed, typically "this".
index0 - One end of the new interval.
index1 - The other end of the new interval.
See Also:
EventListenerList, DefaultListModel

getElementAt

public java.lang.Object getElementAt(int index)
Specified by:
getElementAt in interface javax.swing.ListModel

getSize

public int getSize()
Specified by:
getSize in interface javax.swing.ListModel