Class ItemOrderableAction<E extends OrderableEntity>

All Implemented Interfaces:
Action, Action.HasPrimaryState, Action.HasSecurityConstraint, Action.HasTarget, Action.SecuredAction

@ActionType("itemOrderable") public class ItemOrderableAction<E extends OrderableEntity> extends SecuredListAction
Move items in ListComponent up or down. Items in datasource must to be of type OrderableEntity.
Note that order num of item will be changed for moving. Move algorithm is differ from selected items count:
  • swap items algorithm if one item is selected
  • index recalculating algorithm if more than one item selected)
  • Field Details

  • Constructor Details

    • ItemOrderableAction

      public ItemOrderableAction()
    • ItemOrderableAction

      public ItemOrderableAction(String actionId)
  • Method Details

    • setDirection

      public void setDirection(ItemOrderableAction.Direction direction)
    • actionPerform

      public void actionPerform(Component component)
      Description copied from interface: Action
      Invoked by owning component to execute the action.
      Specified by:
      actionPerform in interface Action
      Overrides:
      actionPerform in class BaseAction
      Parameters:
      component - invoking component
    • execute

      protected void execute()
    • swapSingleItemWithNeighbour

      protected void swapSingleItemWithNeighbour()
      Swap items is simple
    • getItemNeighbour

      @Nullable protected OrderableEntity getItemNeighbour(ListIterator<OrderableEntity> iterator)
    • sortTableDsByItemsOrderNum

      protected void sortTableDsByItemsOrderNum()
    • moveFewItems

      protected void moveFewItems()
      Move few items up or down by recalculating their indexes. Then we sorting table and normalize indexes
    • getCaption

      public String getCaption()
      Specified by:
      getCaption in interface Action
      Overrides:
      getCaption in class AbstractAction
      Returns:
      action's caption
    • normalizeEntityOrderNum

      protected void normalizeEntityOrderNum()
      Iterate over items and set orderNum value from 1 to size()+1;