Custom Action Types

You can create your own action types or override existing standard types in your project.

For example, imagine that you need an action that would show the instance name of the currently selected entity in a dataGrid. You would like to reuse this action in multiple views by specifying its type only. Below are the steps to create the action.

  1. Create an action class and add the @ActionType annotation with the desired type name:

    import com.vaadin.flow.component.Component;
    import io.jmix.core.MetadataTools;
    import io.jmix.flowui.Notifications;
    import io.jmix.flowui.action.ActionType;
    import io.jmix.flowui.action.list.ItemTrackingAction;
    import org.springframework.beans.factory.annotation.Autowired;
    public class ShowSelectedAction<E> extends ItemTrackingAction<E> {
        private MetadataTools metadataTools;
        private Notifications notifications;
        public ShowSelectedAction(String id) {
            setText("Show Selected");
        public void actionPerform(Component component) {
            if (getTarget() != null) {
                E selected = getTarget().getSingleSelectedItem();
                if (selected != null) {
  2. Now you can use the action in screen descriptors by specifying its type:

    <action id="showSelected" type="showSelected"/>

If you want to override an existing type, register your new action class with the same type name in @ActionType annotation.