/* $Id: ShowQueryAction.java 389 2011-10-09 23:57:04Z minao $ */
package smart_gs.image_search.normal.swingui;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import smart_gs.image_search.logical.GSQuery;
import smart_gs.logical.region.RectangleRegion;
import smart_gs.menu.action.SpreadJumpAction;
import smart_gs.menu.action.SpreadOpenAction;
import smart_gs.swingui.WorkspaceWindow;

public class ShowQueryAction implements MouseListener {

	private GSQuery query;
	
	public ShowQueryAction(GSQuery query) {
		this.query = query;
	}

	public void mouseClicked(MouseEvent e) {
		//this.query.show();
		
		// 2011/10/08 kukita
		RectangleRegion rectreg = new RectangleRegion(this.query.getSpread(),this.query.getRectangle());
		if (e.getButton()==MouseEvent.BUTTON1) {
			if (WorkspaceWindow.getInstance().isAlt()) {
				/* alternative for right button click */
				SpreadJumpAction.jumpToTempRectangleRegion(rectreg);
			} else {
				SpreadOpenAction.openTempRectangleRegion(rectreg);
			}
		} if (e.getButton()==MouseEvent.BUTTON3)	{
			SpreadJumpAction.jumpToTempRectangleRegion(rectreg);
		}

	}

	public void mouseEntered(MouseEvent e) {
		
	}

	public void mouseExited(MouseEvent e) {

	}

	public void mousePressed(MouseEvent e) {

	}

	public void mouseReleased(MouseEvent e) {

	}

}
