src/net/java/sip/communicator/impl/gui/main/chat/filetransfer/ReceiveFileConversationComponent.java
/**
     * Handles status changes in file transfer.
     */
Handles status changes in file transfer.
Handles status changes in file transfer .
public void statusChanged(FileTransferStatusChangeEvent event)
    {
        FileTransfer fileTransfer = event.getFileTransfer();
        int status = event.getNewStatus();
        String fromContactName
            = fileTransferRequest.getSender().getDisplayName();
        if (status == FileTransferStatusChangeEvent.COMPLETED
            || status == FileTransferStatusChangeEvent.CANCELED
            || status == FileTransferStatusChangeEvent.FAILED
            || status == FileTransferStatusChangeEvent.REFUSED)
        {
            fileTransfer.removeStatusListener(this);
        }
        if (status == FileTransferStatusChangeEvent.PREPARING)
        {
            hideProgressRelatedComponents();
            titleLabel.setText(
                dateString
                + resources.getI18NString(
                "service.gui.FILE_TRANSFER_PREPARING",
                new String[]{fromContactName}));
        }
        else if (status == FileTransferStatusChangeEvent.FAILED)
        {
            hideProgressRelatedComponents();
            cancelButton.setVisible(false);
            titleLabel.setText(
                dateString
                + resources.getI18NString(
                "service.gui.FILE_RECEIVE_FAILED",
                new String[]{fromContactName}));
            setWarningStyle(true);
        }
        else if (status == FileTransferStatusChangeEvent.IN_PROGRESS)
        {
            titleLabel.setText(
                dateString
                + resources.getI18NString(
                "service.gui.FILE_RECEIVING_FROM",
                new String[]{fromContactName}));
            setWarningStyle(false);
            if (!progressBar.isVisible())
            {
                progressBar.setVisible(true);
            }
        }
        else if (status == FileTransferStatusChangeEvent.COMPLETED)
        {
            this.setCompletedDownloadFile(downloadFile);
            hideProgressRelatedComponents();
            cancelButton.setVisible(false);
            openFileButton.setVisible(true);
            openFolderButton.setVisible(true);
            titleLabel.setText(
                dateString
                + resources.getI18NString(
                "service.gui.FILE_RECEIVE_COMPLETED",
                new String[]{fromContactName}));
        }
        else if (status == FileTransferStatusChangeEvent.CANCELED)
        {
            hideProgressRelatedComponents();
            cancelButton.setVisible(false);
            titleLabel.setText(
                dateString
                + resources.getI18NString(
                "service.gui.FILE_TRANSFER_CANCELED"));
            setWarningStyle(true);
        }
        else if (status == FileTransferStatusChangeEvent.REFUSED)
        {
            hideProgressRelatedComponents();
            titleLabel.setText(
                dateString
                + resources.getI18NString(
                "service.gui.FILE_TRANSFER_REFUSED",
                new String[]{fromContactName}));
            cancelButton.setVisible(false);
            openFileButton.setVisible(false);
            openFolderButton.setVisible(false);
            setWarningStyle(true);
        }
    }
public void statusChanged ( FileTransferStatusChangeEvent event ) { FileTransfer fileTransfer = event . getFileTransfer ( ) ; int status = event . getNewStatus ( ) ; String fromContactName = fileTransferRequest . getSender ( ) . getDisplayName ( ) ; if ( status == FileTransferStatusChangeEvent . COMPLETED || status == FileTransferStatusChangeEvent . CANCELED || status == FileTransferStatusChangeEvent . FAILED || status == FileTransferStatusChangeEvent . REFUSED ) { fileTransfer . removeStatusListener ( this ) ; } if ( status == FileTransferStatusChangeEvent . PREPARING ) { hideProgressRelatedComponents ( ) ; titleLabel . setText ( dateString + resources . getI18NString ( "service.gui.FILE_TRANSFER_PREPARING" , new String [ ] { fromContactName } ) ) ; } else if ( status == FileTransferStatusChangeEvent . FAILED ) { hideProgressRelatedComponents ( ) ; cancelButton . setVisible ( false ) ; titleLabel . setText ( dateString + resources . getI18NString ( "service.gui.FILE_RECEIVE_FAILED" , new String [ ] { fromContactName } ) ) ; setWarningStyle ( true ) ; } else if ( status == FileTransferStatusChangeEvent . IN_PROGRESS ) { titleLabel . setText ( dateString + resources . getI18NString ( "service.gui.FILE_RECEIVING_FROM" , new String [ ] { fromContactName } ) ) ; setWarningStyle ( false ) ; if ( ! progressBar . isVisible ( ) ) { progressBar . setVisible ( true ) ; } } else if ( status == FileTransferStatusChangeEvent . COMPLETED ) { this . setCompletedDownloadFile ( downloadFile ) ; hideProgressRelatedComponents ( ) ; cancelButton . setVisible ( false ) ; openFileButton . setVisible ( true ) ; openFolderButton . setVisible ( true ) ; titleLabel . setText ( dateString + resources . getI18NString ( "service.gui.FILE_RECEIVE_COMPLETED" , new String [ ] { fromContactName } ) ) ; } else if ( status == FileTransferStatusChangeEvent . CANCELED ) { hideProgressRelatedComponents ( ) ; cancelButton . setVisible ( false ) ; titleLabel . setText ( dateString + resources . getI18NString ( "service.gui.FILE_TRANSFER_CANCELED" ) ) ; setWarningStyle ( true ) ; } else if ( status == FileTransferStatusChangeEvent . REFUSED ) { hideProgressRelatedComponents ( ) ; titleLabel . setText ( dateString + resources . getI18NString ( "service.gui.FILE_TRANSFER_REFUSED" , new String [ ] { fromContactName } ) ) ; cancelButton . setVisible ( false ) ; openFileButton . setVisible ( false ) ; openFolderButton . setVisible ( false ) ; setWarningStyle ( true ) ; } }
Handles status changes in file transfer.
Handles status changes in file transfer .