public void closing() { chatRoom.removeFileDropListener(this); chatRoom.getChatInputEditor().removeKeyListener(this); chatRoom.removeClosingListener(this); sendFileButton.removeActionListener(this); sendScreenShotButton.removeActionListener(this); } }
/** * Removes the ChatRoom resources. * * @param room the room to remove. */ private void cleanupChatRoom(ChatRoom room) { if (room.isActive()) { room.leaveChatRoom(); room.closeChatRoom(); } final StanzaListener listener = presenceMap.get(room.getRoomname()); if (listener != null) { SparkManager.getConnection().removeAsyncStanzaListener(listener); } fireChatRoomClosed(room); room.removeMessageListener(this); // Remove mappings presenceMap.remove(room.getRoomname()); chatRoomList.remove(room); room.getChatInputEditor().removeKeyListener(this); // Clear all Text :) room.getTranscriptWindow().cleanup(); }
/** * Close the ChatRoom. */ public void closeChatRoom() { fireClosingListeners(); setChatState(ChatState.gone); if (typingTimerTask != null) { TaskEngine.getInstance().cancelScheduledTask(typingTimerTask); typingTimerTask = null; } getTranscriptWindow().removeContextMenuListener(this); getTranscriptWindow().removeMouseListener(transcriptWindowMouseListener); getChatInputEditor().removeKeyListener(chatEditorKeyListener); this.removeAll(); textScroller.getViewport().remove(transcriptWindow); // Remove Connection Listener SparkManager.getConnection().removeConnectionListener(this); getTranscriptWindow().setTransferHandler(null); getChatInputEditor().setTransferHandler(null); transferHandler = null; packetIDList.clear(); messageListeners.clear(); fileDropListeners.clear(); getChatInputEditor().close(); getChatInputEditor().getActionMap().remove("closeTheRoom"); chatAreaButton.getButton().removeActionListener(this); bottomPanel.remove(chatAreaButton); _chatFrame.removeWindowToFrontListener(this); }