Any issues while migrating from 6.7.9 to 6.8.1 of CUBA platform

I reckon, the provision of adding a listener on image click is available in version 6.8+ of the CUBA platform.

I am on CUBA platform 6.7.9 and do not see addClickListener() as part of Image API.
Image API from 6.7.9: Image - CUBA Platform. Developer’s Manual
Image API from 6.8.1: Image - CUBA Platform. Developer’s Manual

I need to show an image (from server location) in a pop up window on the click on an icon in search results table. Since the path to the image is in the database, I need to write the code to display the image in the controller. Any suggestions on implementing this piece in CUBA 6.7.9 are welcome.

However, If I am required to migrate to CUBA platform 6.8.1 will the license for 6.7.9 work for 6.8.1 of the CUBA platform?
Please state.

1 Like

Hi,

The license is for cuba studio, not for cuba platform. Additionally the studio license is not tied to a particular version.

Cuba platform 6.8.x (and studio 6.8.x) can just easily be used. Feel free to update :slight_smile:

1 Like

Thanks Mario,

Please suggest ways to open up the JPG/PNG/PDF on the click of an icon in a table column using CUBA framework.

I am trying to open up the file using “openWindow” method.

Hi @jasvir.singh,

This all well explained in the documentation. Did you invest time reading it? Have a look at this chapter it will answer you question of how to open a form. As for displaying image in the form, have a look at this component.

P.S. Reading manuals always help :slight_smile:

Regards,
Aleksey

1 Like

Thanks Aleksey,
Let me re-state the problem. I have a table with one of the columns containing images. On click of one of the images, I need to open up the respective data file (that can been a JPG, PNG, PDF). These data files are located at a server location.

Though I could manage to open up the JPG file in a popup window only when the image is placed in Theme extension directory “\TestProject\modules\web\themes\halo\icons”, I am looking for ways to open up the file from a server location.

Following works (Target controller’s init() method):
profileImage.setSource(ThemeResource.class).setPath(“icons/singx-logo.png”);

But following didn’t work:
profileImage.setSource(RelativePathResource.class).setPath(“DougRoberts.jpg”);

with UI code being:

@jasvir.singh,

Place it under webapps/app/VAADIN/{image path} folder and specify relative path as VAADIN/{image path}. This should work.

Regards,
Aleksey

1 Like

Thank Aleksey, it worked, but only for image files (tested JPG/PNG).

Can you please point me to some documentation that lists some notes on these configuration settings.

Even though the solution worked when the image files are placed in suggested server directory. There are scenarios when the application is undeployed completely before a newer version is deployed. In such cases the directory structure needs to be recreated and resources(images files/PDFs) copied again after application deployment and this may not be desirable.

I’m sure there must be some settings/configurations, something of the sort of

cuba.webContextName = onboarding [Auto entry during project creation, "onboarding" being the web module]
#cuba.confDir = ${catalina.base}/conf/${cuba.webContextName} [I added these after taking clues from the documentation]
#cuba.web.resourcesRoot = ${cuba.confDir}/profiles [I added these after taking clues from the documentation]

I tried using custom settings including creation of folder “profiles” within “onboarding” but it didn’t work.

Additionally, I’m looking for opening up PDF files, too, on the click on an image.
I tried the following piece but PDF didn’t show up.

browserFrame.setSource(StreamResource.class)
                       .setStreamSupplier(() -> 
                              resources.getResourceAsStream("VAADIN/resources/profiles/ETLBasic.pdf"))
            		.setMimeType("application/pdf");

@jasvir.singh,

If you want to show images as well as PDFs, use the Embedded component.

See these topics:

Regards,
Aleksey

1 Like

I managed to get it to work both for PDF and image files.

However, I am still looking for answers on configuration settings to place static resources at some server location in such a way that application un-deployment doesn’t delete/remove them.

Suggestions from CUBA team will be appreciated.

Hi @jasvir.singh,

This is not CUBA related, but a very general question, relevant for most such kind of applications. This is a quite good article answering your question.

Regards,
Aleksey

This certainly has to do with VAADIN if not directly a CUBA question.

Thanks once again.