View Javadoc

    1   /*
    2    * @(#) EditMenuActions.java 25-jul-2004 Copyright (c) 2002-2005 Delft
    3    * University of Technology Jaffalaan 5, 2628 BX Delft, the Netherlands. All
    4    * rights reserved. This software is proprietary information of Delft University
    5    * of Technology The code is published under the Lesser General Public License
    6    */
    7   package nl.tudelft.simulation.dsol.gui.editor2D.actions;
    8
    9   import java.awt.event.ActionEvent;
    10  import java.awt.event.ActionListener;
    11
    12  import nl.tudelft.simulation.dsol.gui.editor2D.EditMenu;
    13  import nl.tudelft.simulation.dsol.gui.editor2D.Editor2DPanel;
    14
    15  /***
    16   * EditMenuActions.java <br>
    17   * (c) copyright 2002-2005 <a href="http://www.simulation.tudelft.nl">Delft
    18   * University of Technology </a>, the Netherlands. <br>
    19   * See for project information <a
    20   * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
    21   * License of use: <a href="http://www.gnu.org/copyleft/lesser.html">Lesser
    22   * General Public License (LGPL) </a>, no warranty.
    23   *
    24   * @version $Revision$ $Date$
    25   * @author <a href="http://www.tbm.tudelft.nl/webstaf/royc/index.htm">Roy Chin
    26   *         </a>
    27   */
    28  public class EditMenuActions implements ActionListener
    29  {
    30
    31  	/*** tHe source object */
    32  	private EditMenu source = null;
    33
    34  	/*** The editalbe animation panel */
    35  	private Editor2DPanel panel = null;
    36
    37  	/***
    38  	 * Constructor
    39  	 *
    40  	 * @param source The source object
    41  	 * @param panel The Editor2DPanel
    42  	 */
    43  	public EditMenuActions(final EditMenu source, final Editor2DPanel panel)
    44  	{
    45  		super();
    46  		this.source = source;
    47  		this.panel = panel;
    48  	}
    49
    50  	/***
    51  	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
    52  	 */
    53  	public void actionPerformed(final ActionEvent event)
    54  	{
    55  		Object src = event.getSource();
    56  		if (src.equals(this.source.getMoveItem()))
    57  		{
    58  			this.panel.setSelectedEditMode(Editor2DPanel.EDIT_MODE_MOVE);
    59  		} else if (src.equals(this.source.getRotateItem()))
    60  		{
    61  			this.panel.setSelectedEditMode(Editor2DPanel.EDIT_MODE_ROTATE);
    62  		} else if (src.equals(this.source.getAddPointItem()))
    63  		{
    64  			EditorUtilities.addPointToEditable(this.panel
    65  					.getSelectedEditableRenderable(), this.panel);
    66  		}
    67  	}
    68
    69  }