Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: How to remove Mediators and views  (Read 6857 times)
amazed
Newbie
*
Posts: 1


View Profile Email
« on: October 23, 2008, 05:40:22 »

I was checking the J2ME login demo and I was thinking where would be the best place and how to unload the views that are not needed.

Lets say my project is really heavy for mobile phones and I want to unload last view and its data when a new view is loaded.

To be clearer, Lets see the PrepViewCommand which creates the instances of MainScreenView before login in successful.

:
public class PrepViewCommand extends SimpleCommand implements ICommand
{
    public void execute(INotification notification)
    {
        this.facade.registerMediator(new SplashScreenMediator());
        this.facade.registerMediator(new LoginScreenMediator());
        this.facade.registerMediator(new MainScreenMediator());
    }
}

Lets say I dont want to create MainScreenMediator before login is successful and after login is done I dont want to keep LoginScreenMediator in memory which keeps LoginScreen as its member.

What should be the best practice to do so?

I hope I managed to make my question clear :)

Mazed
Logged
dzeikei
Newbie
*
Posts: 3


View Profile Email
« Reply #1 on: October 27, 2008, 02:04:22 »

Hi im no expert in PureMVC, but I would make the startup command only load the SplashScreenMediator and LoginScreenMediator then make another command that unloads those two mediators and loads the MainScreenMediator on successful login notification.

jK
Logged
Pages: [1]
Print