Page 1 of 1

Adding a dialog box in Download Servlet

PostPosted:Tue Apr 02, 2019 3:09 pm
by sickboy8388
Hi, I'm working with OpenKM-6.3.7-DEV for the last 2 months. My goal was to integrate OpenKM with a Key Management Platform. I achieved my goal very quickly.
Now I'm facing a very simple problem (I hope :) ), when I decrypt a file, it depends on file dimension, I want to show an alert/popup with a simple text message until the operations is not over.

I spent last 5 days to find a solution, but I think that I'm very poor with GWT framework.

To add this new alert I performed the following operations:

1-I create a class DownloadPopup.java as any other popup in the soruce code(e.g. AboutPopup.java)

2-Later I declared the new popup in /openkm/src/main/java/com/openkm/frontend/client/Main.java and I initialize my new popup as the others general panels that are initialiize in onModuleLoad2 in the same class.

What is still obscure for me is the way to mapping the action of showing the popup when a specific class is called?

thx in advance :)

Re: Adding a dialog box in Download Servlet

PostPosted:Fri Apr 05, 2019 7:53 am
by jllort
I suggest follow how "About openkm" popup is shown. Open the MainMenu.java and follow how is opened:
https://github.com/openkm/document-mana ... nMenu.java

Follow the usage of the MenuItem named about:
https://github.com/openkm/document-mana ... .java#L169

Re: Adding a dialog box in Download Servlet

PostPosted:Mon Apr 08, 2019 9:31 am
by sickboy8388
Jllort thanks for your suggests. I'm able to create and show the now popup after I select the dowload button.

I saw that the function fireEvent notify the actual action, I'm tryin' to remove the popup when the download is over, but unfortunately I still try to understand when the operations is over, to invoke the method that hide the popup

Re: Adding a dialog box in Download Servlet

PostPosted:Wed Apr 10, 2019 6:57 am
by jllort
Take a look at FancyFileUpload class

Take a look when is set the UPLOADED_STATE in the class https://github.com/openkm/document-mana ... d.java#L69

Re: Adding a dialog box in Download Servlet

PostPosted:Wed Apr 17, 2019 10:49 am
by sickboy8388
Hi Jllort, I'm still facing the problem of hiding the popup after download is complete.

I'm trying to follow your hint, but I think I'm getting a little bit lost.

I look at the point when the UPLOADED_STATE is set, from this starting point I'm trying to use this solution, but It's still not so clear:

For me is still obscure the interaction between the 3 classes: FileUploadPopup, FancyFileUpload, FileUploadForm.

I try to develop my solution for the download popup:

- I create a FancyFileDownload.java that use a nested class (DownloadDisplay) to update the widget state.

- GWTFileDownloadStatus.java and GWTFileDownloadResponse.java but I'm not sure about how the popup interacts with these 2 classes.

-DownloadAlertPopup that use the FancyFileDownload class to show/hide the popup through the widget state.


-I modified OKMGeneralService.java and OKMGeneralServiceAsync.java and add the method getFileDownloadStatus()

-I'm stuck in the GeneralServlet, trying to add the method getFileDownloadStatus, I should develop the DownlodFileListener ?

It's been now a week that I worked for this simple popup, I was wondering if there is a way more simple, to do that. For example is possible to pass as argument of the show method in the popup the dimension of the downloading file? I could use the dimension to give an input to a TIMER object that hide the popup ? GWT is really tricky, specially in this case when I need to modify an UI that is not develop with my two own hands.

Re: Adding a dialog box in Download Servlet

PostPosted:Fri Apr 19, 2019 7:00 am
by jllort
The GWTFileDownloadStatus.java and GWTFileDownloadResponse.java are controlled in the FileUploadServer.

Anyway, I think I have focus the problem in uploading and really you talked me for downloading?

The class what takes control of downloading is com.openkm.frontend.client.util.Util. Take a look for a method named downloadXXXX.

Timer might be an option but will be better if you add some new servlet or method in GWT servlet connected with the popup to take control the current document status ( 1 second timer to update information until be finished and then close the popup ).