Override default actions


(Ivan Doroshenko) #1

Hello team,

I would like to override some existing standard action, for example, “create”: <action id="create"/>.
Seems that I need to extend some functionality by creating a subclass of com.haulmont.cuba.gui.components.actions.CreateAction class.

But what are the next steps?
Can you provide some examples, please? (I couldn’t find it)

Thanks!


(Weston Jones) #2

I have found the stanard API for Create and Edit Actions to be sufficient but you may be an edge case and would need to extend the class. What kind of functionality are you hoping to add? Perhaps the functionality is there but maybe isn’t clear.


(Ivan Doroshenko) #3

For example, I would like to override isApplicable() method.


(Olga Shiryaeva) #5

Hi Ivan,

Here’s an example of overriding isApplicable() method in the platform code: UserBrowser.java#L137

Also, some useful links:

Documentation: BaseAction and List Actions;
Forum:
https://www.cuba-platform.com/discuss/t/change-standard-buttons-visiblity-as-i-click-an-item-in-a-browse-table/3465/2

https://www.cuba-platform.com/discuss/t/before-action-listener-for-table-standard-actions/612

https://www.cuba-platform.com/discuss/t/enable-and-disable-edit-action-on-entity-selected/403/2

https://www.cuba-platform.com/discuss/t/ok-override-button-behavior/380/7

https://www.cuba-platform.com/discuss/t/how-to-override-create-button-in-entitycombinedscreen/4329


(Ivan Doroshenko) #6

Thanks, Olga! Got it!