use of com.haulmont.cuba.client.sys.cache.ClientCacheManager in project cuba by cuba-platform.
the class App method connectionStateChanged.
@Override
public void connectionStateChanged(Connection connection) throws LoginException {
MessagesClientImpl messagesClient = AppBeans.get(Messages.NAME);
SessionMessagesNotifier messagesNotifier = AppBeans.get(SessionMessagesNotifier.NAME);
ClientCacheManager clientCacheManager = AppBeans.get(ClientCacheManager.NAME);
clientCacheManager.initialize();
if (connection.isConnected()) {
applicationSession = new ApplicationSession(new ConcurrentHashMap<>());
messagesClient.setRemoteSearch(true);
initExceptionHandlers(true);
DesktopWindowManager windowManager = mainFrame.getWindowManager();
mainFrame.setContentPane(createContentPane());
mainFrame.repaint();
windowManager.setTabsPane(tabsPane);
initClientTime();
messagesNotifier.activate();
SwingUtilities.invokeLater(this::afterLoggedIn);
} else {
messagesNotifier.deactivate();
messagesClient.setRemoteSearch(false);
Iterator<TopLevelFrame> it = topLevelFrames.iterator();
while (it.hasNext()) {
TopLevelFrame frame = it.next();
if (frame != mainFrame) {
DesktopWindowManager windowManager = frame.getWindowManager();
if (windowManager != null)
windowManager.dispose();
frame.dispose();
it.remove();
}
}
DesktopWindowManager windowManager = mainFrame.getWindowManager();
if (windowManager != null)
windowManager.dispose();
applicationSession = null;
mainFrame.setContentPane(createStartContentPane());
mainFrame.repaint();
initExceptionHandlers(false);
showLoginDialog();
}
}
Aggregations