PDA

View Full Version : How to clear Desktop (com.extjs.gxt.desktop.client.Desktop)?



Лэйн
4 Sep 2009, 9:56 PM
Hi!

I try to understand the functionality of the Desktop and try to implement now a function of relogin: the user changes the account (log out and then log in).
I need to clean user data after a user exits the application (i.e. clean the desktop).

I tried the code



for (Shortcut s : desktop.getShortcuts())
desktop.removeShortcut(s);
for (Window w : desktop.getWindows())
desktop.removeWindow(w);


but it does not work. When I relogin, the number of shortcuts is doubled.

How to clean the Desktop?
Can someone help me?

Thank you in advance.
Sorry for my bad English.

MickeyMiner
16 Mar 2010, 6:29 AM
Hi,

I am looking for a solution as well.
What is the correct way of cleaning up the Desktop environment upon logout?
The removeWindow() and removeShortcut() methods somehow do not work...

Thank you for your help.

mm

bhuism
16 Mar 2010, 3:38 PM
Give this a try, mayby u've got an ConcurrentModificationException, which u didn't see :D


List<Shortcut> clone = new ArrayList<Shortcut>(desktop.getShortcuts());
for (Shortcut shortCut : clone) {
desktop.removeShortcut(shortCut);
}

MickeyMiner
17 Mar 2010, 7:24 AM
Thanx a lot,

That did work.

For the Windows I was able to do similar, but I had to hide them first. I hope though they are gone for good... (since there is no window.close() anymore ;) )

Cheers,

mm.

joeljefcoat
8 Mar 2011, 10:16 PM
goo job for coding it!