Hi, I’m new to Cuba so I wonder whether I got anything wrong…
I tried to declare a custom action and reference it in the screen descriptor file, following the steps given by https://doc.cuba-platform.com/manual-7.2/custom_action_types.html (I know this is not shown within the latest documentation pages, but it already shows up in Google)
It worked until I tried to access the custom action type in the calling screen code, like in the following snippet:
@Subscribe("customersTable.showProjects") private void onShowProjectsActionPerformed(Action.ActionPerformedEvent event) { NamedItemTrackingAction action = (NamedItemTrackingAction) event.getSource(); // More code using specific NamedItemTrackingAction methods }
This results into a runtime error: java.lang.ClassCastException: ro.kms.repository.web.actions.NamedItemTrackingAction cannot be cast to ro.kms.repository.web.actions.NamedItemTrackingAction
Injecting the action into a similarly typed field results in the same error.
It looks like a class loader issue, but I am not sure whether this is the intended behaviour or not?
If it is, then is there another way for the caller screen to pass any parameters to the action (the screen descriptor file does not allow custom setup, I think)?
If it is not, is there any reasonably simple workaround?
Thanks