org.mockcentral.editor.viewers
Class MockCentralTableModel<T>

java.lang.Object
  extended by org.mockcentral.editor.viewers.MockCentralTableModel<T>
Type Parameters:
T -

public class MockCentralTableModel<T>
extends java.lang.Object

A Class used to model MockCentralNode data that is to be displayed in a table.

Author:
David Hutchinson

Constructor Summary
MockCentralTableModel()
           
 
Method Summary
 void add(int i, T element)
          Adds the supplied element to the model.
 void add(T element)
          Adds the supplied element to the model.
 void addAll(java.util.List<T> list)
          Adds all of the elements in the supplied list to the model.
 void clear()
          Clears the list of all elements.
 java.lang.Object clone()
           
 boolean contains(T element)
          Returns whether the current list contains the supplied element.
 java.util.List<T> elements()
          Returns the current list of elements.
 T get(int index)
          Returns the element at the given index.
 T getSelectedObject()
          Returns the currently selected Object in the table.
 int indexOf(T element)
          Returns the index of the supplied element.
 boolean isEmpty()
          Returns whether the list of elements is empty.
 T remove(int index)
          Removes the element at the given index, returning it.
 void set(int i, T element)
          Sets the element at the supplied index to the given element.
 void setSelectedObject(T selectedObject)
          Sets the the currently selected Object in the table.
 int size()
          Returns the size of the list of elements.
 void sortElements(java.util.Comparator<T> comparator)
          Sorts all of the elements using the supplied Comparator.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockCentralTableModel

public MockCentralTableModel()
Method Detail

add

public void add(T element)
Adds the supplied element to the model.

Parameters:
element - the element to add.

add

public void add(int i,
                T element)
Adds the supplied element to the model.

Parameters:
i - the index at which to add the element.
element - the element to add.

addAll

public void addAll(java.util.List<T> list)
Adds all of the elements in the supplied list to the model.

Parameters:
list - the list containing the elements to add.

set

public void set(int i,
                T element)
Sets the element at the supplied index to the given element.

Parameters:
i - the index.
element - the element to set.

size

public int size()
Returns the size of the list of elements.

Returns:
the size of the list of elements.

elements

public java.util.List<T> elements()
Returns the current list of elements.

Returns:
the current list of elements.

indexOf

public int indexOf(T element)
Returns the index of the supplied element.

Parameters:
element - the element.
Returns:
the index of the supplied element.

get

public T get(int index)
Returns the element at the given index.

Parameters:
index - the index.
Returns:
the element at the given index.

remove

public T remove(int index)
Removes the element at the given index, returning it.

Parameters:
index - the index.
Returns:
the element at the given index.

clear

public void clear()
Clears the list of all elements.


isEmpty

public boolean isEmpty()
Returns whether the list of elements is empty.

Returns:
whether the list of elements is empty.

contains

public boolean contains(T element)
Returns whether the current list contains the supplied element.

Parameters:
element - the element.
Returns:
whether the current list contains the supplied element.

sortElements

public void sortElements(java.util.Comparator<T> comparator)
Sorts all of the elements using the supplied Comparator.

Parameters:
comparator - the Comparator.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

getSelectedObject

public T getSelectedObject()
Returns the currently selected Object in the table.

Returns:
the currently selected Object in the table.

setSelectedObject

public void setSelectedObject(T selectedObject)
Sets the the currently selected Object in the table.

Parameters:
selectedObject - the Object to select.