Fórumok

Alloy Loading Mask with Portlet Init method

Umadas Ravindran, módosítva 11 év-val korábban

Alloy Loading Mask with Portlet Init method

New Member Bejegyzések: 2 Csatlakozás dátuma: 2012.07.09. Legújabb bejegyzések
Hi everyone,
I have just started to try out liferay project.I have created a simple JSP portlet .I have created a custom portlet class(by extending MVCPortlet) for the business logic. What i am trying to do is to initialize parameters(say db connection) for this portlet application which is a one time activity.So,I have used the init method of the MVCPortlet for this purpose.Till here its fine.Now i want "loading mask" to be displayed to the client side when this activity(db connection) is going on.I am able to independently run the "Alloy UI-loading mask" feature mentioned in the site.
Basically what i want is to display the "Loading Mask" when the init method is called and when this method is finished the loading mask should stop.I am not able to understand how to communicate from the init method to the Loading Mask API of the Alloy UI. I have chosen the init method of the portlet class for my one time loading activities,if some other better approach is there ,please guide me.

Regards
Umadas
thumbnail
Thomas Berg, módosítva 11 év-val korábban

RE: Alloy Loading Mask with Portlet Init method

Regular Member Bejegyzések: 131 Csatlakozás dátuma: 2009.09.07. Legújabb bejegyzések
Hello Umadas,

I don't think it's possible to achieve what you want. The portlet container calls the init method exactly once after instantiating the portlet and cannot process any request until initialization is complete. In Liferay (and presumably other portlet containers), the init() -method is called when the portlet is deployed, i.e., before users can interact with the portlet.

If you have some initialization that needs to be done for every user, look into using <portlet:resourceURL> and calling your initialization method through ajax (aui-io-request).
Override the serveResource() -method in your MVCPortlet to handle the ajax request.

HTH

Regards
/ Thomas
Umadas Ravindran, módosítva 11 év-val korábban

RE: Alloy Loading Mask with Portlet Init method

New Member Bejegyzések: 2 Csatlakozás dátuma: 2012.07.09. Legújabb bejegyzések
HI Thomas,
Thanks for the reply.
I have called the serveResource Method by clicking on a button ("LoadApplicationParameters") and once this is done,the Loading mask of alloy ui works on the screen hiding everything .Once the loading is complete then the form is presented to the user for further tasks.But here ,the problem is user has to click the button ,it doesn't happen automatically ,i tried to use it in AUI.ready() function,but the problem there is everytime the page loads all those bulky parameter loading stuff happens.I wonder if there is any portlet init equivalent method in the client side(any other alloy scripts?) of liferay .

Regards
Umadas
thumbnail
Thomas Berg, módosítva 11 év-val korábban

RE: Alloy Loading Mask with Portlet Init method

Regular Member Bejegyzések: 131 Csatlakozás dátuma: 2009.09.07. Legújabb bejegyzések
Hi Umadas,

I've put together a simple "demo" (attached) that might help.

Regards
/ Thomas