ExcelAction duplicate?

Hi

I’m trying to extend ExcelAction behavior globally and I met two ExcelAction classes in the framework (cuba 7.2).

com.haulmont.cuba.gui.components.actions.ExcelAction

This one is referenced in com.haulmont.cuba.gui.components.actions.ListActionType, so when defining a standard table action in screen xml like this.

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

It seems logical that this is the one to be used ; plus there is clear documentation in the class code on how to extend it globally.

/**
 * Standard table action to export the list of entities to XLS.
 * <p>
 * Action's behaviour can be customized by providing arguments to constructor or setting properties.
 * <p>
 * In order to provide your own implementation globally, create a subclass and register it in {@code web-spring.xml},
 * for example:
 * <pre>
 * &lt;bean id="cuba_ExcelAction" class="com.company.sample.gui.MyExcelAction" scope="prototype"/&gt;
 * </pre>
 * Also, use {@code create()} static methods instead of constructors when creating the action programmatically.
 */
@org.springframework.stereotype.Component("cuba_ExcelAction")
@Scope("prototype")

Documentation I have followed to create my own ExceExcelAction class.

But in reality, the one that is used is the following

com.haulmont.cuba.gui.actions.list.ExcelAction

Code is essentially the same, but for this one there is no documented way of extending it. Why this duplication, and how can I replace it globally ?

Regards
Michael

Hi Michael,

com.haulmont.cuba.gui.components.actions.ExcelAction is a legacy action (see Actions over Collection (Legacy)).

com.haulmont.cuba.gui.actions.list.ExcelAction is the correct class, see ExcelAction.

See Custom Action Types section for how to provide your own implementation for using in <action id="excel" type="excel"/>. Pay attention to this note:

If you want to override an existing type, just register your new action type with the same name.

Thanks @krivopustov, I finally reached the same conclusion and created my own @ActionType("excel")

Michael