/** * When the file transfer request is acceptable, this method should be * invoked. It will create an IncomingFileTransfer which allows the * transmission of the file to proceed. * * @param request * The remote request that is being accepted. * @return The IncomingFileTransfer which manages the download of the file * from the transfer initiator. */ protected IncomingFileTransfer createIncomingFileTransfer( FileTransferRequest request) { if (request == null) { throw new NullPointerException("ReceiveRequest cannot be null"); } IncomingFileTransfer transfer = new IncomingFileTransfer(request, fileTransferNegotiator); transfer.setFileInfo(request.getFileName(), request.getFileSize()); return transfer; }
public void mousePressed(MouseEvent e) { launchFile(Downloads.getDownloadDirectory()+File.separator+request.getFileName()); } });
/** * When the file transfer request is acceptable, this method should be * invoked. It will create an IncomingFileTransfer which allows the * transmission of the file to procede. * * @param request * The remote request that is being accepted. * @return The IncomingFileTransfer which manages the download of the file * from the transfer initiator. */ protected IncomingFileTransfer createIncomingFileTransfer( FileTransferRequest request) { if (request == null) { throw new NullPointerException("RecieveRequest cannot be null"); } IncomingFileTransfer transfer = new IncomingFileTransfer(request, fileTransferNegotiator); transfer.setFileInfo(request.getFileName(), request.getFileSize()); return transfer; }
/** * When the file transfer request is acceptable, this method should be * invoked. It will create an IncomingFileTransfer which allows the * transmission of the file to procede. * * @param request * The remote request that is being accepted. * @return The IncomingFileTransfer which manages the download of the file * from the transfer initiator. */ protected IncomingFileTransfer createIncomingFileTransfer( FileTransferRequest request) { if (request == null) { throw new NullPointerException("RecieveRequest cannot be null"); } IncomingFileTransfer transfer = new IncomingFileTransfer(request, fileTransferNegotiator); transfer.setFileInfo(request.getFileName(), request.getFileSize()); return transfer; }
/** * When the file transfer request is acceptable, this method should be * invoked. It will create an IncomingFileTransfer which allows the * transmission of the file to procede. * * @param request * The remote request that is being accepted. * @return The IncomingFileTransfer which manages the download of the file * from the transfer initiator. */ protected IncomingFileTransfer createIncomingFileTransfer( FileTransferRequest request) { if (request == null) { throw new NullPointerException("RecieveRequest cannot be null"); } IncomingFileTransfer transfer = new IncomingFileTransfer(request, fileTransferNegotiator); transfer.setFileInfo(request.getFileName(), request.getFileSize()); return transfer; }
/** * When the file transfer request is acceptable, this method should be * invoked. It will create an IncomingFileTransfer which allows the * transmission of the file to procede. * * @param request * The remote request that is being accepted. * @return The IncomingFileTransfer which manages the download of the file * from the transfer initiator. */ protected IncomingFileTransfer createIncomingFileTransfer( FileTransferRequest request) { if (request == null) { throw new NullPointerException("RecieveRequest cannot be null"); } IncomingFileTransfer transfer = new IncomingFileTransfer(request, fileTransferNegotiator); transfer.setFileInfo(request.getFileName(), request.getFileSize()); return transfer; }
cancelButton.setVisible(true); transfer = request.accept(); final File downloadedFile = new File(Downloads.getDownloadDirectory(), request.getFileName());
fileLabel.setText(request.getFileName()); final File downloadedFile = new File(Downloads.getDownloadDirectory(), request.getFileName()); openFileButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) {
public void acceptFileTransfer(final FileTransferRequest request) { String fileName = request.getFileName(); long fileSize = request.getFileSize(); Jid requestor = request.getRequestor();
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")); }