Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-3098

Bulk operation MoveNodeAction: "Move After" is reverting the chosen Node order

    XMLWordPrintable

    Details

    • Patch included:
      Yes
    • Magnolia Release:
      5.2.7, 5.3.3

      Description

      Summary:
      When moving a selection of Nodes with the "Move After" operation, their order is reversed.
      The reason is that for each Node the moveAfter() is called, which reverses its original order:
      The last Node is placed as last element directly after the target node -> its then the first Node and not the last anymore.

      Cause:
      Super class of MoveNodeAction abstract class is

      info.magnolia.ui.framework.action.AbstractMultiItemAction
      

      It calls in the execute() for every item operating on the abstract method .executeOnItem(JcrItemAdapter).
      The MoveNodeAction implementing the method executeOnItem is calling

      info.magnolia.ui.workbench.tree.MoveHandler.moveItem(Item, Item, MoveLocation)
      

      which in the end calls

      info.magnolia.jcr.util.NodeUtil.moveNodeAfter(Node, Node)

      Solution general:
      Override the method

      info.magnolia.ui.contentapp.movedialog.action.MoveNodeAction.getSortedItems(Comparator<JcrItemAdapter>)

      of the super class and revert the list on the MoveLoction.after operation.

      Solution patches:
      As the code changed form 5.2 to 5.3 of this class, I needed to create two different patches basically containing the same code. Just the line numbers won't match.

        Attachments

          Activity

            People

            Assignee:
            dlipp Daniel Lipp
            Reporter:
            cringele Christian Ringele
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Date of First Response: