Package simtools.shapes.undo

Source Code of simtools.shapes.undo.UnGroupEdit

/* ========================
* JSynoptic : a free Synoptic editor
* ========================
*
* Project Info:  http://jsynoptic.sourceforge.net/index.html
*
* This program is free software; you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* (C) Copyright 2001-2005, by :
*     Corporate:
*         EADS Astrium SAS
*         EADS CRC
*     Individual:
*         Claude Cazenave
*
* $Id: UnGroupEdit.java,v 1.1 2009/01/08 16:36:14 ogor Exp $
*
* Changes
* -------
* 19 sept. 2006  : Initial public release (CC);
*
*/
package simtools.shapes.undo;

import java.util.Vector;

import javax.swing.undo.AbstractUndoableEdit;
import simtools.shapes.CompoundShape;
import simtools.shapes.ShapesContainer.ShapesDiagramComponent;

public class UnGroupEdit extends AbstractUndoableEdit {

  Vector _compoundShapes;
  ShapesDiagramComponent _shapesComponent;

 
  /* (non-Javadoc)
   * @see javax.swing.undo.AbstractUndoableEdit#undo()
   */
  public void undo() {
    for (int i=0; i< _compoundShapes.size();i++){
      CompoundShape compoundShape = (CompoundShape)_compoundShapes.get(i);
      _shapesComponent.undoUngroup(compoundShape);
    }
    super.undo();
  }

 
  /* (non-Javadoc)
   * @see javax.swing.undo.AbstractUndoableEdit#redo()
   */
  public void redo() {
    for (int i=0; i< _compoundShapes.size();i++){
      CompoundShape compoundShape = (CompoundShape)_compoundShapes.get(i);
      _shapesComponent.redoUngroup(compoundShape);
    }
    super.redo();
  }


  public UnGroupEdit(ShapesDiagramComponent shapesComponent, Vector compoundShapes) {
    super();
    _shapesComponent = shapesComponent;
    _compoundShapes = compoundShapes;
  }

  public String getPresentationName() {
    return "ungroup";
  }
}
TOP

Related Classes of simtools.shapes.undo.UnGroupEdit

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.