/* $Id: SearchResultPanelContextMode.java 148 2011-05-01 13:25:14Z shayashi $ */
package smart_gs.image_search.normal.swingui;

import java.awt.Image;
import java.awt.image.BufferedImage;
import java.util.List;

import javax.swing.ImageIcon;
import javax.swing.JLabel;

import smart_gs.image_search.ContextImageCropper;
import smart_gs.image_search.logical.SearchResult;

@SuppressWarnings("serial")

class SearchResultPanelContextMode extends SearchResultPanel{
		
	// 20110423 Image arg is not likely used in this mode. The null arg will work.
	SearchResultPanelContextMode(SearchResultViewer parent,List<SearchResult> results,Image queryImage){
		super(parent,results,queryImage);
		
	}	
	protected JLabel createImageLabel(SearchResult result){	
		ContextImageCropper cropper = new ContextImageCropper(result);
		BufferedImage bufImage = (BufferedImage)cropper.crop();	
		ImageIcon icon = new ImageIcon(bufImage);	
		JLabel label = new JLabel();
		label.setIcon(icon);
		label.addMouseListener(new LabelMouseListener(label,result.getSpread(),result.getRectangle()));
		return label;
	}
}