Class UndoableEdit

java.lang.Object
com.codename1.util.UndoableEdit
Direct Known Subclasses:
ComponentEdit

public abstract class UndoableEdit extends Object

One step an UndoHistory can take back and apply again.

An edit is recorded after the change it describes was made, so undo is called first. Both methods must leave the edited object exactly as it was before, or after, the original change: a history replays them in order and each relies on the state the previous one left.

This is a class rather than an interface so that later capabilities can be added here with a default that keeps every existing edit working.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    A short name for the change, such as "Move" or "Delete", for an "Undo Move" menu item.
    boolean
    False once what this edit changes can no longer take it, for instance after the component it was made in was given another document.
    abstract void
    Makes the change again, after undo.
    abstract void
    Takes the change back.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • UndoableEdit

      public UndoableEdit()
  • Method Details

    • undo

      public abstract void undo()
      Takes the change back.
    • redo

      public abstract void redo()
      Makes the change again, after undo.
    • getName

      public String getName()
      A short name for the change, such as "Move" or "Delete", for an "Undo Move" menu item. Null by default.
    • isAlive

      public boolean isAlive()
      False once what this edit changes can no longer take it, for instance after the component it was made in was given another document. A history passes over such an edit and forgets it. True by default.