@Override public void run() { if (ixCall != iCall.get() || !isActive()) { return; } FThreads.invokeInEdtLater(showMessageFromEdt); }
public void openLayout() { SOverlayUtils.genericOverlay(); final SaveOpenDialog dlgOpen = new SaveOpenDialog(); final FileLocation layoutFile = Singletons.getControl().getCurrentScreen().getLayoutFile(); final File defFile = layoutFile != null ? new File(layoutFile.userPrefLoc) : null; final File loadFile = dlgOpen.OpenDialog(defFile, Filetypes.LAYOUT); if (loadFile != null) { FView.SINGLETON_INSTANCE.getPnlContent().removeAll(); // let it redraw everything first FThreads.invokeInEdtLater( new Runnable() { @Override public void run() { if (loadFile != null) { SLayoutIO.loadLayout(loadFile); SLayoutIO.saveLayout(null); } SOverlayUtils.hideOverlay(); } }); } }
@Override public void onActivate() { if (getLobby() instanceof OfflineLobby) { // prompt to connect to server when offline lobby activated FThreads.invokeInBackgroundThread( new Runnable() { @Override public void run() { final String url = NetConnectUtil.getServerUrl(); FThreads.invokeInEdtLater( new Runnable() { @Override public void run() { if (url == null) { Forge.back(); // go back to previous screen if user cancels connection return; } final boolean joinServer = url.length() > 0; final String caption = joinServer ? "Connecting to server..." : "Starting server..."; LoadingOverlay.show( caption, new Runnable() { @Override public void run() { final ChatMessage result; final IOnlineChatInterface chatInterface = (IOnlineChatInterface) OnlineScreen.Chat.getScreen(); if (joinServer) { result = NetConnectUtil.join(url, OnlineLobbyScreen.this, chatInterface); } else { result = NetConnectUtil.host(OnlineLobbyScreen.this, chatInterface); } chatInterface.addMessage(result); if (!joinServer) { FThreads.invokeInBackgroundThread( new Runnable() { @Override public void run() { NetConnectUtil.copyHostedServerUrl(); } }); } } }); } }); } }); } }
public void revertLayout() { SOverlayUtils.genericOverlay(); FView.SINGLETON_INSTANCE.getPnlContent().removeAll(); FThreads.invokeInEdtLater( new Runnable() { @Override public void run() { SLayoutIO.loadLayout(null); SOverlayUtils.hideOverlay(); } }); }
void connectToServer() { final String url = NetConnectUtil.getServerUrl(); if (url == null) { return; } FThreads.invokeInBackgroundThread( new Runnable() { @Override public void run() { if (url.length() > 0) { join(url); } else { host(); } } }); }