[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool DomainPopupListener.java,NONE,1.1
Status: Pre-Alpha
Brought to you by:
henryml
From: Nordholt <nor...@us...> - 2005-10-27 14:59:30
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14955 Added Files: DomainPopupListener.java Log Message: Moved this to no longer be inner class of selecttool --- NEW FILE: DomainPopupListener.java --- //--------------------------------------------------------------------------------- // $Id: DomainPopupListener.java,v 1.1 2005/10/27 14:59:16 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.model.Domain; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Surface; import org.apache.log4j.Logger; /** * The listener for the domain popup menu. */ public class DomainPopupListener implements ActionListener { /** The logger */ private static Logger log = Logger.getLogger(SelectTool.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 that assigns the given domain to * the given side of a surface. * @param domain the domain * @param surface the surface * @param front werther or not this popup for the 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 an action is performed * @param arg0 an action event */ public void actionPerformed(ActionEvent arg0) { if (front) { Domain oldFront = surface.getFrontDomain(); surface.setFrontDomain(domain); if (domain != null) { domain.addSurface(surface); } if (oldFront != null) { Project.getInstance().update(oldFront); } } else { Domain oldBack = surface.getBackDomain(); surface.setBackDomain(domain); if (domain != null) { domain.addSurface(surface); } if (oldBack != null) { Project.getInstance().update(oldBack); } } if (domain != null) { Project.getInstance().update(domain); } Project.getInstance().update(surface); } } |