package devopsdistilled.operp.client.items.views;

import javax.inject.Inject;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import net.miginfocom.swing.MigLayout;
import devopsdistilled.operp.client.abstracts.SubTaskPane;
import devopsdistilled.operp.client.items.controllers.ListItemPaneController;
import devopsdistilled.operp.client.items.models.impl.ItemTableModel;
import devopsdistilled.operp.client.items.models.observers.ListItemPaneModelObserver;

public class ListItemPane extends SubTaskPane implements
		ListItemPaneModelObserver {

	@Inject
	private ListItemPaneController controller;

	private final JPanel pane;
	private final JTable table;
	private final ItemTableModel tableModel;

	public ListItemPane() {
		pane = new JPanel(new MigLayout("debug, fill"));

		tableModel = new ItemTableModel();
		table = new JTable(tableModel);

		final JScrollPane scrollPane = new JScrollPane(table,
				JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
				JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

		pane.add(scrollPane, "grow");
	}

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

}

@@ -44,16 +44,40 @@
 views;%0A%0A
+import java.util.List;%0A%0A
 import j
@@ -96,16 +96,16 @@
 Inject;%0A
-
 import j
@@ -456,24 +456,102 @@
 TableModel;%0A
+import devopsdistilled.operp.client.items.models.observers.ItemModelObserver;%0A
 import devop
@@ -623,16 +623,76 @@
 bserver;
+%0Aimport devopsdistilled.operp.server.data.entity.items.Item;
 %0A%0Apublic
@@ -769,16 +769,35 @@
 Observer
+, ItemModelObserver
  %7B%0A%0A%09@In
@@ -1325,16 +1325,16 @@
 ane() %7B%0A
-
 %09%09return
@@ -1344,10 +1344,100 @@
 ne;%0A%09%7D%0A%0A
+%09@Override%0A%09public void updateItems(List%3CItem%3E items) %7B%0A%09%09tableModel.setItems(items);%0A%09%7D%0A%0A
 %7D%0A

Implement ItemModelObserver