Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Umadas Ravindran
Alloy Loading Mask with Portlet Init method
9 de Julho de 2012 03:24
Resposta

Umadas Ravindran

Ranking: New Member

Mensagens: 2

Data de entrada: 9 de Julho de 2012

Mensagens recentes

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
Thomas Berg
RE: Alloy Loading Mask with Portlet Init method
9 de Julho de 2012 04:49
Resposta

Thomas Berg

Ranking: Regular Member

Mensagens: 121

Data de entrada: 7 de Setembro de 2009

Mensagens recentes

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
RE: Alloy Loading Mask with Portlet Init method
16 de Julho de 2012 03:47
Resposta

Umadas Ravindran

Ranking: New Member

Mensagens: 2

Data de entrada: 9 de Julho de 2012

Mensagens recentes

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
Thomas Berg
RE: Alloy Loading Mask with Portlet Init method
18 de Julho de 2012 14:42
Resposta

Thomas Berg

Ranking: Regular Member

Mensagens: 121

Data de entrada: 7 de Setembro de 2009

Mensagens recentes

Hi Umadas,

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

Regards
/ Thomas
Anexos: init-test-portlet-6.1.0.1.war (7,7k)