// (c) MIT 2003.  All rights reserved.

// $Id: SurfaceTransition.java,v 1.7 2003/03/06 00:40:39 moltmans Exp $
// Time-stamp: <2000-03-11 18:59:36 moltmans>
package rec.sys;



import rec.util.*;

/**
 * Slightly different semantics:
 * Transition with actions to be commited in the future, but that
 * have not been created when the transition is created.
 *
 * Not to be used with the main transitions, since its purpose is much
 * simpler... it will not support all of the functionality of the 
 * main Transition class
 */
public class SurfaceTransition extends DoTransition
{
  /**
   * use this to create the DoTransition
   */
  public SurfaceTransition( Surface s, VisibleWidget w )
  {
    super( s );
    m_Widget = w;
  }


  /* perform the transition */
  public void doDo() 
  {
    m_Surface.addWidgetToSurface( m_Widget );
  }

  /* undoes the transition */
  public void doUndo() 
  {
    m_Surface.removeWidgetFromSurface( m_Widget );
  }

  /* get the effects of the action without performing the do */
  // for now this is just a string, soon it will be an action object
  // that can be more easily reasoned about.
  public String getAction()
  {
    return( "Add widget to Surface" );
  }

  ////////////////////////////////////////////////////////////////////////////

  private VisibleWidget m_Widget;
}

//////////////////////////////////////////////////////////////////////////////
