cache problem fixed.

git-svn-id: https://svn.coded.pt/svn/SIPRP@1123 bb69d46d-e84e-40c8-a05a-06db0d633741
lxbfYeaa
Diogo Neves 16 years ago
parent e2eda64344
commit 10c5f165b0

@ -21,6 +21,7 @@ public class AnchorSair extends Anchor implements ClickHandler
public void onClick( ClickEvent event )
{
PageNavigation.getProvider().setUserLogged( null );
PageNavigation.getProvider().clearCache();
PageNavigation.goPage( NavigationConstants.LOGIN_PANEL );
}

@ -25,13 +25,9 @@ public class PageNavigation
private Utilizador userLogged = null;
private PageNavigation( String id )
private PageNavigation()
{
this.containerID = id;
if ( id == null )
{
this.containerID = AppConstants.MAIN_DIV;
}
this.containerID = AppConstants.MAIN_DIV;
mainPanel = RootPanel.get( this.containerID );
panelsCache = new HashMap< Integer, Object >();
@ -39,29 +35,39 @@ public class PageNavigation
public static PageNavigation getProvider()
{
return getProvider( null );
}
public static PageNavigation getProvider( String id )
{
if ( instance == null )
{
instance = new PageNavigation( id );
instance = new PageNavigation();
}
return instance;
}
public static void goPage( Composite newWindow )
public static void goPage( Integer pageID )
{
PageNavigation.getProvider().gotoPage( newWindow );
PageNavigation.getProvider().gotoPage( pageID );
}
public static void goPage( Integer pageID )
/**
* usado quando se faz logout ...
* manter login panel e recover se existir ...
*/
public void clearCache()
{
PageNavigation.getProvider().gotoPage( pageID );
Map< Integer, Object > newCache = new HashMap< Integer, Object >();
if ( panelsCache.containsKey( NavigationConstants.LOGIN_PANEL ) )
{
newCache.put( NavigationConstants.LOGIN_PANEL, panelsCache.get( NavigationConstants.LOGIN_PANEL ) );
}
if ( panelsCache.containsKey( NavigationConstants.RECOVER_PWD_PANEL ) )
{
newCache.put( NavigationConstants.RECOVER_PWD_PANEL, panelsCache.get( NavigationConstants.RECOVER_PWD_PANEL ) );
}
panelsCache = newCache;
}
@ -139,6 +145,7 @@ public class PageNavigation
}
//TODO: find a better place for this stuff ...
public boolean isLoggedIn()
{
return getUserLogged() != null;

Loading…
Cancel
Save