Refactored modorder as modsTableState

This commit is contained in:
Vhati 2013-11-22 00:15:24 -05:00
parent 1a5bf935df
commit e25799a78e
3 changed files with 110 additions and 47 deletions

View file

@ -0,0 +1,39 @@
package net.vhati.modmanager.ui.table;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* An implementation-agnostic model to pass between the GUI thread and the
* (de)serializer.
*/
public class ListState<T> {
protected List<T> items = new ArrayList<T>();
public ListState() {
}
public void addItem( T item ) {
items.add( item );
}
/**
* Returns a new list containing items in this state.
*/
public List<T> getItems() {
return new ArrayList<T>( items );
}
public void removeItem( T item ) {
items.remove( item );
}
public boolean containsItem( T item ) {
return items.contains( item );
}
}