Package io.jmix.reportsui.action.list
Class ItemOrderableAction<E extends OrderableEntity>
java.lang.Object
io.jmix.ui.action.AbstractAction
io.jmix.ui.action.BaseAction
io.jmix.ui.action.ListAction
io.jmix.ui.action.list.SecuredListAction
io.jmix.reportsui.action.list.ItemOrderableAction<E>
- 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
Note that order num of item will be changed for moving. Move algorithm is differ from selected items count:
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)
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.ui.action.BaseAction
BaseAction.EnabledRule
Nested classes/interfaces inherited from interface io.jmix.ui.action.Action
Action.ActionPerformedEvent, Action.AdjustWhenScreenReadOnly, Action.ExecutableAction, Action.HasPrimaryState, Action.HasSecurityConstraint, Action.HasTarget, Action.MainTabSheetAction, Action.OperationResultAction, Action.ScreenAction<S extends Screen>, Action.ScreenOpeningAction, Action.SecuredAction, Action.Status
-
Field Summary
Fields inherited from class io.jmix.ui.action.list.SecuredListAction
accessManager, applicationContext, constraintEntityOp, metadata
Fields inherited from class io.jmix.ui.action.ListAction
target
Fields inherited from class io.jmix.ui.action.AbstractAction
caption, description, enabled, eventHub, icon, id, owners, primary, shortcut, visible
Fields inherited from interface io.jmix.ui.action.Action
PROP_CAPTION, PROP_DESCRIPTION, PROP_ENABLED, PROP_ICON, PROP_SHORTCUT, PROP_VISIBLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
actionPerform
(Component component) Invoked by owning component to execute the action.protected void
execute()
protected OrderableEntity
getItemNeighbour
(ListIterator<OrderableEntity> iterator) protected void
Move few items up or down by recalculating their indexes.protected void
Iterate over items and set orderNum value from 1 to size()+1;void
setDirection
(ItemOrderableAction.Direction direction) protected void
protected void
Swap items is simpleMethods inherited from class io.jmix.ui.action.list.SecuredListAction
getConstraintEntityOp, isApplicable, isPermitted, setAccessManager, setApplicationContext, setConstraintEntityOp, setMetadata
Methods inherited from class io.jmix.ui.action.ListAction
getTarget, setTarget, withCaption, withDescription, withHandler, withIcon, withPrimary, withShortcut
Methods inherited from class io.jmix.ui.action.BaseAction
addActionPerformedListener, addEnabledRule, isEnabledByRule, isEnabledByUiPermissions, isVisibleByUiPermissions, refreshState, removeEnabledRule, setEnabled, setEnabledByUiPermissions, setEnabledInternal, setVisible, setVisibleByUiPermissions, setVisibleInternal
Methods inherited from class io.jmix.ui.action.AbstractAction
addOwner, addPropertyChangeListener, firePropertyChange, getDescription, getEventHub, getIcon, getId, getOwner, getOwners, getShortcutCombination, hasSubscriptions, isEnabled, isPrimary, isVisible, removeOwner, removePropertyChangeListener, setCaption, setDescription, setIcon, setPrimary, setShortcut, setShortcutCombination
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.jmix.ui.action.Action
addOwner, addPropertyChangeListener, getDescription, getIcon, getId, getOwner, getOwners, getShortcutCombination, isEnabled, isVisible, refreshState, removeOwner, removePropertyChangeListener, setCaption, setDescription, setEnabled, setIcon, setShortcut, setShortcutCombination, setVisible
-
Field Details
-
ID
- See Also:
-
direction
-
-
Constructor Details
-
ItemOrderableAction
public ItemOrderableAction() -
ItemOrderableAction
-
-
Method Details
-
setDirection
-
actionPerform
Description copied from interface:Action
Invoked by owning component to execute the action.- Specified by:
actionPerform
in interfaceAction
- Overrides:
actionPerform
in classBaseAction
- Parameters:
component
- invoking component
-
execute
protected void execute() -
swapSingleItemWithNeighbour
protected void swapSingleItemWithNeighbour()Swap items is simple -
getItemNeighbour
-
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
- Specified by:
getCaption
in interfaceAction
- Overrides:
getCaption
in classAbstractAction
- Returns:
- action's caption
-
normalizeEntityOrderNum
protected void normalizeEntityOrderNum()Iterate over items and set orderNum value from 1 to size()+1;
-