/*
 * @(#)FileTransferChangeDirEvent.java
 *
 * Copyright (c) 1999-2007 JSCAPE LLC
 *
 * This software is the confidential and proprietary information of
 * JSCAPE. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with JSCAPE.
 */
package com.jscape.filetransfer;

/**
 * Fired when remote directory path is changed on server.
 */
public class FileTransferChangeDirEvent
        extends FileTransferEvent {

    private final String directory;

    /**
     * Creates <code>FileTransferChangeDirEvent</code>.
     *
     * @param source    the source of the event
     * @param directory the new directory name
     */
    public FileTransferChangeDirEvent(FileTransfer source, String directory) {
        super(source);

        this.directory = directory;
    }

    /**
     * Gets the new directory name.
     *
     * @return the directory name
     */
    public String getDirectory() {
        return this.directory;
    }

    /**
     * {@inheritDoc}
     */
    public void accept(FileTransferListener listener) {
        listener.changeDir(this);
    }

    @Override
    public String toString() {
        return "FileTransferChangeDirEvent {"
                + "directory='" + this.directory + '\''
                + '}';
    }
}
