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

RFE: Use of Action still needs work

XMLWordPrintable

    • generic, x86
    • generic, linux, linux_redhat_7.2, windows_2000

      Name: yyT116575 Date: 08/14/2001


      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)


      Swing components use of Action still needs some work.

      The changes to 1.4.0beta (4304129 4396593) are incomplete.

      Action
      ======
          This needs an Action.ENABLED_KEY.

      JComboBox
      =========
          Action.ACTION_COMMAND_KEY is not used at all.

      AbstractButton
      ==============
          This provides a mechanism for extending classes
          to specify which action properties are used when
          the action is set but does not provide the same
          mechanism when the action changes.

          The configurePropertiesFromAction method is also
          inefficient as it creates a new array every time
          that the types array is not specified. This array
          should be static and the method should state that
          it does not change the array so that extending
          classes can also pass in a static array.

          Action.ACTION_COMMAND_KEY is not used at all.

      JMenuItem
      =========
          Action.ACCELERATOR_KEY is used when the
          action is set, but not when the actions is changed.

          Action.ACTION_COMMAND_KEY is not used at all.

      JButton
      =======
          Action.ACTION_COMMAND_KEY is not used at all.

      JRadioButton
      ============
          Action.ACTION_COMMAND_KEY is not used at all.

      JCheckBox
      =========
          Action.ACTION_COMMAND_KEY is not used at all.

      hideActionText property
      =======================
          This still does not work properly and is the wrong
          way to do this anyway. It does not work because it
          is only supposed to be set when the action has an
          icon configured. However, JToolBar only sets it when
          the button is created, not when the action changes.

          The proper way to do this is for JToolBar to create
          its own button.

      Update all actions properties
      =============================
          It would be nice if the action property change
          listeners would reconfigure all the properties
          from the action if the property name was null.
          This would for example allow ProxyActions to
          more efficiently force an update when the action
          which they are wrapping changes.

          This is a very easy change to make as the Action
          is the source of the event and can simply be
          passed to the configurePropertiesFromAction.

      Make ...ActionPropertyChangeListeners extensible
      ================================================
          The various classes which are used to listen to
          changes in Action properties are either anonymous,
          private or package private, this hinders anyone
          wishing to extend the classes. The anonymous
          ones should be named and should be made protected,
          the private classes should be made protected
          and the package private classes should be made
          public.

      Better solution to allow configuration
      ======================================
          Rather than requiring classes which extend
          AbstractButton from passing in an array of
          properties to check, AbstractButton should
          call a method to retrieve the array of
          properties. This method could then be used
          by both the configurePropertiesFromAction
          method and the action property change
          listener.
      (Review ID: 129998)
      ======================================================================

      A DESCRIPTION OF THE PROBLEM :
      Add another property for a second icon to Action. The
      problem is that at the moment I can only define one icon.
      This icon will be used for JMenuItems and JToolBar buttons.

      The JMenuItem looks better with an icon of 16x16 pixels.
      The JToolBar button looks better with an icon of 24x24 pixels.

      I've to set ont of the icons manually. It would be better to
      have both icons in the Action and both (the button and the
      menu item) can get the appropriate icon.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Add another property to Action to have two different buttons.

      This bug can be reproduced always.

      CUSTOMER WORKAROUND :
      Set one icon manually.
      (Review ID: 143303)
      ======================================================================

      Should add convenience methods to AbstractAction which can retrieve all the Action
      properties from the internal table. All the Action keys should have matching methods.

      i.e, action.getName(), intead of (String)action.getValue(Action.NAME),

            svioletsunw Scott Violet (Inactive)
            yyoungsunw Yung-ching Young (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: