Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24281
Added Files:
CopyActionListener.java
Log Message:
first commit
--- NEW FILE: CopyActionListener.java ---
//---------------------------------------------------------------------------------
// $Id: CopyActionListener.java,v 1.1 2005/10/28 12:14:05 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.tool;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import net.sourceforge.bprocessor.gl.view.View;
import net.sourceforge.bprocessor.model.Surface;
import net.sourceforge.bprocessor.model.Domain;
import org.apache.log4j.Logger;
/**
* The copy action listener. Lets us copy an assignment of domains to a surface.
*/
public class CopyActionListener implements ActionListener {
/**
* The logger
*/
private static Logger log = Logger.getLogger(SelectTool.class);
/**
* The copied domain facing the camera
*/
private static Domain facing = null;
/**
* The copied domain not facing the camera
*/
private static Domain nonFacing = null;
/**
* The surface this listener shifts spaces on
*/
private Surface surface;
/**
* The view
*/
private View view;
/**
* Constructs a listener
* @param surface the surface
* @param view the view
*/
public CopyActionListener (Surface surface, View view) {
this.surface = surface;
this.view = view;
}
/**
* Invoked when an action is performed
* @param e The action event
*/
public void actionPerformed(ActionEvent e) {
if (view.facingFront(surface)) {
facing = surface.getFrontDomain();
nonFacing = surface.getBackDomain();
} else {
facing = surface.getBackDomain();
nonFacing = surface.getFrontDomain();
}
}
/**
* Gets the copied domain facing the camera
* @return the domain
*/
public static Domain getFacing() {
return facing;
}
/**
* Gets the copied domain not facing the camera
* @return the domain
*/
public static Domain getNonFacing() {
return nonFacing;
}
}
|