Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6229954

AbstractUndoableEdit.UndoName, RedoName localization

XMLWordPrintable

    • Cause Known
    • generic
    • generic

      The description of AbstractUndoableEdit UndoName field contains the following assertion:
       "This value is now localized and comes from the defaults table with key AbstractUndoableEdit.undoText."
      But actually this field is not localized: it contains the string "Undo". The same concern is valid for RedoName field.

      To reproduce this use the following:

      import javax.swing.undo.AbstractUndoableEdit;
      import javax.swing.UIManager;
      import java.util.Locale;

      public class StubAbstractUndoableEdit extends AbstractUndoableEdit {

          public static boolean checkRedoName(Locale locale) {
              String redoText = UIManager.getString("AbstractUndoableEdit.redoText", locale);
              boolean res = RedoName.equals(redoText);

              if (! res) {
                  System.out.println("RedoName is not localized for " + locale);
                  System.out.println("RedoName: " + RedoName);
                  System.out.println("Value of AbstractUndoableEdit.redoText for " + locale + ": " + redoText);
              }

              return res;
          }

          public static boolean checkUndoName(Locale locale) {
              String undoText = UIManager.getString("AbstractUndoableEdit.undoText", locale);
              boolean res = UndoName.equals(undoText);

              if (! res) {
                  System.out.println("UndoName is not localized for " + locale);
                  System.out.println("UndoName: " + UndoName);
                  System.out.println("Value of AbstractUndoableEdit.undoText for " + locale + ": " + undoText);
              }

              return res;
          }

          public static void main(String[] args) {
              checkRedoName(Locale.GERMANY);
              checkRedoName(Locale.FRANCE);

              checkUndoName(Locale.GERMANY);
              checkUndoName(Locale.FRANCE);
          }
      }

      ###@###.### 2005-2-16 16:39:51 GMT

      The whole description of these fields (RedoName, UndoName) needs some update.
      First assertion of RedoName spec is following:
        "String returned by getRedoPresentationName; as of Java 2 platform v1.3.1
      this field is no longer used."
      But the method getRedoPresentationName() depends from getPresentationName().
      Of course current default implementation of getPresentationName() returns "",
      and we obtain RedoName equals to getRedoPresentationName (up to localization
      considered above). But if we override getPresentationName() to return non empty string, method getRedoPresentationName() will change its behavior. And this
      assertion turns out to be invalid.
      The same concern is valid for UndoName spec also.


      ###@###.### 2005-2-18 07:56:16 GMT

            peterz Peter Zhelezniakov
            aglasman Alexander Glasman (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: