package view;

import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.ImageIcon;
import java.util.Observer;
import java.util.Observable;
import model.Image;
import model.Thumbnail;

public class ViewerView extends BaseView implements Observer {
	private Image image;
	private JLabel label;
	private JButton rename;
	private JButton hide;

	public ViewerView() {
		super("Viewer", 360, 240);
	}

	public void update (Observable o, Object arg) {
		Thumbnail thumb = (Thumbnail)o;
		image.setName(thumb.getName());
		image.setPath(thumb.getPath());
		image.setBufferedImage(thumb.getOriginalImage());
		label = new JLabel(new ImageIcon(image.getBufferedImage()));
		add(label);
	}
}

@@ -370,20 +370,31 @@
 werView(
+Image image
 ) %7B%0A
-
 %09%09super(
@@ -414,16 +414,38 @@
 , 240);%0A
+%09%09this.image = image;%0A
 %09%7D%0A%0A%09pub
@@ -495,157 +495,52 @@
 %7B%0A%09%09
-Thumbnail thumb = (Thumbnail)o;%0A%09%09image.setName(thumb.getName());%0A%09%09image.setPath(thumb.getPath());%0A%09%09image.setBufferedImage(thumb.getOriginalImage()
+if(getComponentCount() == 3)%0A%09%09%09remove(label
 );%0A%09

change viewer to let controller make all the changes