javax.swing.undo

Class AbstractUndoableEdit

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      protected static String RedoName
      String returned by getRedoPresentationName; as of Java 2 platform v1.3.1 this field is no longer used.
      protected static String UndoName
      String returned by getUndoPresentationName; as of Java 2 platform v1.3.1 this field is no longer used.

        

    • Constructor Summary

      Constructors 
      Constructor and Description
      AbstractUndoableEdit()
      Creates an AbstractUndoableEdit which defaults hasBeenDone and alive to true.

        

    • Method Summary

      Methods 
      Modifier and Type Method and Description
      boolean addEdit(UndoableEdit anEdit)
      This default implementation returns false.
      boolean canRedo()
      Returns true if this edit is alive and hasBeenDone is false.
      boolean canUndo()
      Returns true if this edit is alive and hasBeenDone is true.
      void die()
      Sets alive to false.
      String getPresentationName()
      This default implementation returns "".
      String getRedoPresentationName()
      Retreives the value from the defaults table with key AbstractUndoableEdit.redoText and returns that value followed by a space, followed by getPresentationName.
      String getUndoPresentationName()
      Retreives the value from the defaults table with key AbstractUndoableEdit.undoText and returns that value followed by a space, followed by getPresentationName.
      boolean isSignificant()
      This default implementation returns true.
      void redo()
      Throws CannotRedoException if canRedo returns false.
      boolean replaceEdit(UndoableEdit anEdit)
      This default implementation returns false.
      String toString()
      Returns a string that displays and identifies this object's properties.
      void undo()
      Throws CannotUndoException if canUndo returns false.

        

    • Field Detail

      • UndoName

        protected static final String UndoName
        String returned by getUndoPresentationName; as of Java 2 platform v1.3.1 this field is no longer used. This value is now localized and comes from the defaults table with key AbstractUndoableEdit.undoText.
        See Also:
        UIDefaults, Constant Field Values
      • RedoName

        protected static final String RedoName
        String returned by getRedoPresentationName; as of Java 2 platform v1.3.1 this field is no longer used. This value is now localized and comes from the defaults table with key AbstractUndoableEdit.redoText.
        See Also:
        UIDefaults, Constant Field Values
    • Constructor Detail

      • AbstractUndoableEdit

        public AbstractUndoableEdit()
        Creates an AbstractUndoableEdit which defaults hasBeenDone and alive to true.
    • Method Detail

      • die

        public void die()
        Sets alive to false. Note that this is a one way operation; dead edits cannot be resurrected. Sending undo or redo to a dead edit results in an exception being thrown.

        Typically an edit is killed when it is consolidated by another edit's addEdit or replaceEdit method, or when it is dequeued from an UndoManager.

        Specified by:
        die in interface UndoableEdit
        See Also:
        CompoundEdit.die()
      • undo

        public void undo()
                  throws CannotUndoException
        Throws CannotUndoException if canUndo returns false. Sets hasBeenDone to false. Subclasses should override to undo the operation represented by this edit. Override should begin with a call to super.
        Specified by:
        undo in interface UndoableEdit
        Throws:
        CannotUndoException - if canUndo returns false
        See Also:
        canUndo()
      • canUndo

        public boolean canUndo()
        Returns true if this edit is alive and hasBeenDone is true.
        Specified by:
        canUndo in interface UndoableEdit
        Returns:
        true if this edit is alive and hasBeenDone is true
        See Also:
        die(), undo(), redo()
      • redo

        public void redo()
                  throws CannotRedoException
        Throws CannotRedoException if canRedo returns false. Sets hasBeenDone to true. Subclasses should override to redo the operation represented by this edit. Override should begin with a call to super.
        Specified by:
        redo in interface UndoableEdit
        Throws:
        CannotRedoException - if canRedo returns false
        See Also:
        canRedo()
      • canRedo

        public boolean canRedo()
        Returns true if this edit is alive and hasBeenDone is false.
        Specified by:
        canRedo in interface UndoableEdit
        Returns:
        true if this edit is alive and hasBeenDone is false
        See Also:
        die(), undo(), redo()
      • getPresentationName

        public String getPresentationName()
        This default implementation returns "". Used by getUndoPresentationName and getRedoPresentationName to construct the strings they return. Subclasses should override to return an appropriate description of the operation this edit represents.
        Specified by:
        getPresentationName in interface UndoableEdit
        Returns:
        the empty string ""
        See Also:
        getUndoPresentationName(), getRedoPresentationName()
      • getUndoPresentationName

        public String getUndoPresentationName()
        Retreives the value from the defaults table with key AbstractUndoableEdit.undoText and returns that value followed by a space, followed by getPresentationName. If getPresentationName returns "", then the defaults value is returned alone.
        Specified by:
        getUndoPresentationName in interface UndoableEdit
        Returns:
        the value from the defaults table with key AbstractUndoableEdit.undoText, followed by a space, followed by getPresentationName unless getPresentationName is "" in which case, the defaults value is returned alone.
        See Also:
        getPresentationName()
      • getRedoPresentationName

        public String getRedoPresentationName()
        Retreives the value from the defaults table with key AbstractUndoableEdit.redoText and returns that value followed by a space, followed by getPresentationName. If getPresentationName returns "", then the defaults value is returned alone.
        Specified by:
        getRedoPresentationName in interface UndoableEdit
        Returns:
        the value from the defaults table with key AbstractUndoableEdit.redoText, followed by a space, followed by getPresentationName unless getPresentationName is "" in which case, the defaults value is returned alone.
        See Also:
        getPresentationName()
      • toString

        public String toString()
        Returns a string that displays and identifies this object's properties.
        Overrides:
        toString in class Object
        Returns:
        a String representation of this object

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Version en cache

22/12/2024 10:32:49 Cette version de la page est en cache (à la date du 22/12/2024 10:32:49) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.

Document créé le 30/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-javax/swing/undo/AbstractUndoableEdit.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com, AbstractUndoableEdit

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.

Table des matières Haut