Legacy Screen - Table column linkinvoke error (IllegalStateException: No suitable methods named for invoke)

Hi

We have upgraded our application from 6 to 7 and have discovered a problem with some legacy screen functionality. We are not sure if there is something we need to change or if there is a bug with the legacy screens. The problem is with the linkInvoke functionality of a table component as it returns an error ‘IllegalStateException: No suitable methods named for invoke’. The problem was found as we use the attachable add on and we can’t preview a file using the link in the table.

Initially we thought it might be a problem with the add on but I have been able to reproduce the problem with a simple table and linkInvoke. I have attached a simple project:

invokelink.zip (418.1 KB)

and to reproduce:

1 - add new customer
2 - create address against customer
3 - click on an address line in the table within the ‘address’ column which has the linkInvoke

Thanks
David

Hello David!

Thank you for the test project. Method for linkInvoke attribute requires two parameters (see documentation):

  • Entity entity
  • String columnId

I tried the following in your project and it works fine:

public void addressSelect(Entity entity, String columnId) {
    showNotification("You have selected an address");
}
1 Like

Thanks Roman, that solved the problem in our own implementation of the linkInvoke.

Unfortunately the same issue remains with the attachable addon using within an entity combined screen. I have attached a new project with the attachable addon which shows the same error when you click on the preview link within the line.

invokeline2.zip (411.4 KB)

Looking at the code within the AttachmentBrowse.groovy it appears the same as you suggested:

Blockquote
@SuppressWarnings(‘UnusedMethodParameter’)
void previewFile(Entity item, String columnId)
{
Attachment attachment = item as Attachment
frame.openEditor(‘ddca$Attachment.preview’, attachment, WindowManager.OpenType.DIALOG)
}

not quite sure what else to try?

Thanks
David

I think this is because of the default access modifier in previewFile() method. Attachable add-on is provided by @mario, you can try to ask him about this issue.

Hi Roman

I have done a little more investigation on this and I think I have narrowed the problem down a little further. It appears the problem is relating to the linkInvoke being called in a screen that is embeded within another screen using a frame.

I have attached a project that has 2 screens:
invokeline2.zip (431.6 KB)

Customer Embeded Screen - this screen contains a table with a clickable link. When opened on it’s own the linkInvoke function runs.

Customer Screen - This screen has the customer embeded screen contained within a frame. When you click on the table link (the customer embeded screen within the frame) then the error ‘IllegalStateException: No suitable methods named preview for invoke’

We have tried both creating the frame programmatically like so:

Frame frame;
frame = openFrame(customerBox, “CustomerembedBrowse”, params2);

and also through XML:

frame id=“diffFrame”
screen=“CustomerembedBrowse”
width=“100%”
height=“400px”
src="/com/company/invokeline2/web/screens/customer/customerembed-browse.xml"/>

However both result in the same error.

Any help would be appreciated as we have a number of screens using this mechanism.

Thanks
David

Hi,

i have taken a look if this is something to look into from attachable perspective, but I was not able to fix the situation in the example app. As @Pinyazhin suggested I changed the access modifier, but it did not change anything (in fact that would be really interesting, since it is a groovy class and not defining the modifier == public).

Not so sure if I can help here.

And as you @david.jones already described in the last post, it seems to be unrelated to attachable, as you have found the situation in other scenarios as well, correct?

Just a side note. Since 0.8.0 I added this scenario of embedding attachments into detail screens via this provided fragment: cuba-component-attachable/EntityAttachmentsFragment.java at master · mariodavid/cuba-component-attachable · GitHub - but in order to use fragments I guess it is required to use CUBA 7 UI APIs.

Cheers
Mario

Thank you all for investigating this problem and the test project. After debugging, it turns out when we try to open a legacy screen in another we get a wrapper class instead of original. It is a bug for legacy screens.
I’ve created an issue: cuba-platform/cuba#2786.

1 Like

Thanks @mario and @Pinyazhin for your help with this.