Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21399
Added Files:
PasteActionListener.java
Log Message:
first commit
--- NEW FILE: PasteActionListener.java ---
//---------------------------------------------------------------------------------
// $Id: PasteActionListener.java,v 1.1 2005/10/28 12:12:42 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 net.sourceforge.bprocessor.model.Project;
import org.apache.log4j.Logger;
/**
* The copy action listener. Lets us copy an assignment of domains to a surface.
*/
public class PasteActionListener implements ActionListener {
/**
* The logger
*/
private static Logger log = Logger.getLogger(SelectTool.class);
/**
* The surface this listener pastes domains to
*/
private Surface surface;
/**
* The view
*/
private View view;
/**
* Constructs a listener
* @param surface the surface
* @param view the view
*/
public PasteActionListener (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) {
Domain facing = CopyActionListener.getFacing();
Domain nonFacing = CopyActionListener.getNonFacing();
if (view.facingFront(surface)) {
surface.setFrontDomain(facing);
surface.setBackDomain(nonFacing);
} else {
surface.setBackDomain(facing);
surface.setFrontDomain(nonFacing);
}
Project.getInstance().update(surface);
if (facing != null) {
facing.addSurface(surface);
Project.getInstance().update(facing);
}
if (nonFacing != null) {
nonFacing.addSurface(surface);
Project.getInstance().update(nonFacing);
}
}
}
|