Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20604
Added Files:
DomainPopupListener.java
Log Message:
Added listener class for the domain popup
--- NEW FILE: DomainPopupListener.java ---
//---------------------------------------------------------------------------------
// $Id: DomainPopupListener.java,v 1.1 2005/09/30 17:52:43 nordholt Exp $
//
// Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net)
// Released under the Lesser GNU Public License v2.1
//---------------------------------------------------------------------------------
package net.sourceforge.bprocessor.gl;
import net.sourceforge.bprocessor.model.Surface;
import net.sourceforge.bprocessor.model.Domain;
import net.sourceforge.bprocessor.model.DomainFacade;
import net.sourceforge.bprocessor.model.SurfaceFacade;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import org.apache.log4j.Logger;
/**
* The listener for the domain popup menu.
*/
public class DomainPopupListener extends MouseAdapter {
/** The Log */
private static Logger log = Logger.getLogger(GLView.class);
/** The domain */
private Domain domain;
/** The Surface */
private Surface surface;
/** Boolean telling if this is for the front or back of the surface*/
private boolean front;
/**
* Constructs a listener for an item in the domain popup
* @param domain the domain
* @param surface the surface
* @param front werther or not this popup for the back or front of the back of the surface
*/
public DomainPopupListener(Domain domain, Surface surface, boolean front) {
this.domain = domain;
this.surface = surface;
this.front = front;
}
/**
* Invoked when mouse is pressed
* @param e a mouseevent
*/
public void mousePressed(MouseEvent e) {
if (front) {
surface.setFrontDomain(domain);
domain.addSurface(surface);
} else {
surface.setBackDomain(domain);
domain.addSurface(surface);
}
DomainFacade.getInstance().update(domain);
SurfaceFacade.getInstance().update(surface);
}
}
|