package devopsdistilled.operp.client.items;

import java.util.Vector;

import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

import devopsdistilled.operp.client.abstracts.SubTaskPane;
import devopsdistilled.operp.server.data.entity.items.Item;

public class ListItemPane extends SubTaskPane implements ListItemModelObserver {

	private final ListItemPaneController controller;
	private final ListItemModel model;

	private JPanel pane;
	private JTable table;
	private DefaultTableModel tableModel;

	public ListItemPane(ListItemPaneController controller, ListItemModel model) {
		this.controller = controller;

		this.model = model;
		model.registerObserver(this);
	}

	/**
	 * @wbp.parser.entryPoint
	 */
	public void init() {
		pane = new JPanel();
		tableModel = new DefaultTableModel();
		table = new JTable(tableModel);
		pane.add(new JScrollPane(table));

		controller.loadData();
	}

	@Override
	public void updateAll() {
		// TODO Auto-generated method stub

	}

	@Override
	public JComponent getPane() {
		return pane;
	}

	@Override
	public void updateItemList() {
		Vector<Item> items = new Vector<>(model.getItems());
		tableModel.setDataVector(items, model.getTableColumnNames());
	}

	@Override
	public void updateColumnNames() {
		tableModel.setColumnIdentifiers(model.getTableColumnNames());
	}
}

@@ -42,34 +42,8 @@
 s;%0A%0A
-import java.util.Vector;%0A%0A
 impo
@@ -158,52 +158,8 @@
 ble;
-%0Aimport javax.swing.table.DefaultTableModel;
 %0A%0Aim
@@ -218,68 +218,8 @@
 ane;
-%0Aimport devopsdistilled.operp.server.data.entity.items.Item;
 %0A%0Apu
@@ -439,23 +439,20 @@
 private 
-Default
+Item
 TableMod
@@ -742,15 +742,12 @@
 new 
-Default
+Item
 Tabl
@@ -1044,63 +1044,8 @@
 ) %7B%0A
-%09%09Vector%3CItem%3E items = new Vector%3C%3E(model.getItems());%0A
 %09%09ta
@@ -1060,26 +1060,14 @@
 .set
-DataVector(i
+I
 tems
-, 
+(
 mode
@@ -1075,144 +1075,22 @@
 .get
-TableColumnNames());%0A%09%7D%0A%0A%09@Override%0A%09public void updateColumnNames() %7B%0A%09%09tableModel.setColumnIdentifiers(model.getTableColumnNames());%0A%09%7D
+Items());%0A%09%7D%0A%0A%09
 %0A%7D%0A

Substitute DefaultTableModel with ItemTableModel