protected void addToolbar() { add(toolbar, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); }
public void addChatRoomButton(ChatRoomButton button) { addChatRoomButton(button, false); }
public ChatRoomDecorator(ChatRoom room) { this.chatRoom = room; chatRoom.addClosingListener(this); }
getChatInputEditor().setSelectedTextColor((Color)UIManager.get("ChatInput.SelectedTextColor")); getChatInputEditor().setSelectionColor((Color)UIManager.get("ChatInput.SelectionColor")); setLayout(new GridBagLayout()); add(verticalSplit, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); GridBagConstraints.BOTH, getChatPanelInsets(), 0, 0)); bottomPanel.setLayout(new GridBagLayout()); bottomPanel.add(chatAreaButton, new GridBagConstraints(0, 1, 5, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, getChatAreaInsets(), 0, 35)); bottomPanel.add(editorWrapperBar, new GridBagConstraints(0, 0, 5, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, getEditorWrapperInsets(), 0, 0)); getChatInputEditor().getDocument().addDocumentListener(this); getChatInputEditor().addKeyListener(chatEditorKeyListener); getChatInputEditor().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ctrl F4"), "closeTheRoom"); getChatInputEditor().getActionMap().put("closeTheRoom", new AbstractAction("closeTheRoom") { private static final long serialVersionUID = 1L; getChatInputEditor().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ctrl SPACE"), "handleCompletion"); getChatInputEditor().getActionMap().put("handleCompletion", new AbstractAction("handleCompletion") { private static final long serialVersionUID = 1L; getSplitPane().setRightComponent(null);
createFrameIfNeeded(); room.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.LIGHT_GRAY)); AndFilter presenceFilter = new AndFilter(new StanzaTypeFilter(Presence.class), FromMatchesFilter.createBare( room.getRoomJid())); room.registeredToFrame(chatFrame); presenceMap.put(room.getRoomJid(), myListener); tooltip = room.getRoomJid().toString(); SparkTab tab = addTab(room.getTabTitle(), room.getTabIcon(), room, tooltip); tab.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { room.addMessageListener(this); chatFrame.setTitle(room.getRoomTitle()); room.getChatInputEditor().addKeyListener(this);
public ChatRoomTransferDecorator(final ChatRoom chatRoom) { this.chatRoom = chatRoom; chatRoom.addFileDropListener(this); chatRoom.getChatInputEditor().addKeyListener(this); chatRoom.addClosingListener(this); sendFileButton = UIComponentRegistry.getButtonFactory().createSendFileButton(); sendFileButton.setToolTipText(Res.getString("message.send.file.to.user")); chatRoom.addChatRoomButton(sendFileButton); sendFileButton.addActionListener(this); sendScreenShotButton = UIComponentRegistry.getButtonFactory().createScreenshotButton(); sendScreenShotButton.setToolTipText(Res.getString("message.send.picture")); chatRoom.addChatRoomButton(sendScreenShotButton); sendScreenShotButton.addActionListener(this); }
private void handleTransferRequest(FileTransferRequest request, ContactList contactList) { // Check if a listener handled this request if (fireTransferListeners(request)) { return; } Jid requestor = request.getRequestor(); EntityBareJid bareJID = requestor.asEntityBareJidOrThrow(); String fileName = request.getFileName(); ContactItem contactItem = contactList.getContactItemByJID(bareJID); ChatRoom chatRoom; if (contactItem != null) { chatRoom = SparkManager.getChatManager().createChatRoom(bareJID, contactItem.getDisplayName(), contactItem.getDisplayName()); } else { chatRoom = SparkManager.getChatManager().createChatRoom(bareJID, bareJID, bareJID); } TranscriptWindow transcriptWindow = chatRoom.getTranscriptWindow(); transcriptWindow.insertCustomText(Res.getString("message.file.transfer.chat.window"), true, false, Color.BLACK); final ReceiveFileTransfer receivingMessageUI = new ReceiveFileTransfer(); receivingMessageUI.acceptFileTransfer(request); chatRoom.addClosingListener( () -> receivingMessageUI.cancelTransfer() ); transcriptWindow.addComponent(receivingMessageUI); chatRoom.increaseUnreadMessageCount(); chatRoom.scrollToBottom(); String fileTransMsg = contactItem.getDisplayName() + " " + Res.getString("message.file.transfer.short.message") + " " + fileName; SparkManager.getChatManager().getChatContainer().fireNotifyOnMessage(chatRoom, true, fileTransMsg, Res.getString("message.file.transfer.notification")); }
room.addEditorComponent(emoticonPicker); room.addClosingListener( () -> room.removeEditorComponent(emoticonPicker) );
chatRoom.getTranscriptWindow().insertNotificationMessage("The user is offline. Will auto-send \"" + file.getName() + "\" when user comes back online.", ChatManager.ERROR_COLOR); return null; TranscriptWindow transcriptWindow = chatRoom.getTranscriptWindow(); chatRoom.addClosingListener( () -> { SparkManager.getConnection().removeAsyncStanzaListener(packetListener); chatRoom.scrollToBottom(); return chatRoom;
/** * The main entry point when receiving any messages. This will * either handle a message from a customer or delegate itself * as an agent handler. * * @param message - the message receieved. */ public void insertMessage(Message message) { // Fire Message Filters SparkManager.getChatManager().filterIncomingMessage(this, message); SparkManager.getChatManager().fireGlobalMessageReceievedListeners(this, message); addToTranscript(message, true); fireMessageReceived(message); SparkManager.getWorkspace().getTranscriptPlugin().persistChatRoom(this); }
public ChatRoomDecorator(ChatRoom chatRoom) { this.chatRoom = chatRoom; chatRoom.addClosingListener(this); // Add History Button localPreferences = SettingsManager.getLocalPreferences(); if (!localPreferences.isChatHistoryEnabled()) { return; } chatHistoryButton = UIComponentRegistry.getButtonFactory().createChatTranscriptButton(); if (!Default.getBoolean("HISTORY_DISABLED") && Enterprise.containsFeature(Enterprise.HISTORY_TRANSCRIPTS_FEATURE)) chatRoom.addChatRoomButton(chatHistoryButton); chatHistoryButton.setToolTipText(Res.getString("tooltip.view.history")); chatHistoryButton.addActionListener(this); }
room.getTranscriptWindow().insertMessage(nickname, message, ChatManager.FROM_COLOR); room.addToTranscript(message, true);
public void addBuzzButton(BuzzRoomDecorator buzzer) { final JLabel dividerLabel = new JLabel(SparkRes.getImageIcon("DIVIDER_IMAGE")); chatRoom.addEditorComponent(dividerLabel); chatRoom.addEditorComponent(buzzer.buzzButton); }
public void chatRoomOpened(ChatRoom room) { room.addMessageListener(this); }
public void actionPerformed(ActionEvent e) { if (e.getSource() == infoButton) { VCardManager vcard = SparkManager.getVCardManager(); vcard.viewProfile(participantJID.asBareJid(), SparkManager.getChatManager().getChatContainer()); } else if (e.getSource() == addToRosterButton) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(participantJID.asBareJid().toString()); rosterDialog.setDefaultNickname(getParticipantNickname().toString()); rosterDialog.showRosterDialog(SparkManager.getChatManager().getChatContainer().getChatFrame()); } else { super.actionPerformed(e); } }
public BuzzRoomDecorator(ChatRoom chatRoom) { this.chatRoom = chatRoom; buzzButton = UIComponentRegistry.getButtonFactory().createBuzzButton(); buzzButton.setToolTipText(Res .getString("message.buzz.alert.notification")); buzzButton.addActionListener(this); final JLabel dividerLabel = UIComponentRegistry.getButtonFactory().createDivider(); if (dividerLabel != null) { chatRoom.addEditorComponent(dividerLabel); } chatRoom.addEditorComponent(buzzButton); }
public void decorate() { // Add Conference Invite Button. inviteButton = UIComponentRegistry.getButtonFactory().createInviteConferenceButton(); inviteButton.setToolTipText(Res.getString("title.invite.to.conference")); chatRoom.addChatRoomButton(inviteButton); inviteButton.addActionListener(this); }