Refactored modorder as modsTableState
This commit is contained in:
parent
1a5bf935df
commit
e25799a78e
3 changed files with 110 additions and 47 deletions
39
src/main/java/net/vhati/modmanager/ui/table/ListState.java
Normal file
39
src/main/java/net/vhati/modmanager/ui/table/ListState.java
Normal 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 );
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue