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

Refactoring: Move layout code from BasicMenuItemUI.getPreferredMenuItemSize() into DefaultMenuLayout

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 7
    • Fix Version/s: 7
    • Component/s: client-libs
    • Labels:

      Description

      The layout code in BasicMenuItemUI (the getPreferredMenuItemSize, layoutMenuItem and paintMenuItem methods) is intricate and cumbersome.

      Suggestions:

      1. Do not take in account sizes of neighbour MenuItems in the BasicMenuItemUI.getPreferredSize() and BasicMenuItemUI.paint() methods.

      2. Move all the layout code from BasicMenuItemUI.getPreferredSize() into DefaultMenuLayout. BasicMenuItemUI.getPreferredSize() could then just return sum of widths of all elements (icon, text, etc.) with appropriate gaps.

      3. Synth would just use the same algorithm from Basic (now it is using own similar algorithm).

      4. Calculate and store MAX_ICON_WIDTH, MAX_TEXT_WIDTH and MAX_ACC_WIDTH in DefaultMenuLayout or BasicMenuUI (it is the matter for the further investigations).

      5. Remove using of MAX_ICON_OFFSET and MAX_TEXT_OFFSET from BasicMenuItemUI.layoutMenuItem(). Use calculated MAX_ICON_WIDTH, MAX_TEXT_WIDTH and MAX_ACC_WIDTH. Also rewrite getPreferredMenuItemSize and paintMenuItem to use the maximal widths if they are available.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mlapshin Mikhail Lapshin (Inactive)
                Reporter:
                mlapshin Mikhail Lapshin (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: