~vcs-imports/jhylafax/head

« back to all changes in this revision

Viewing changes to src/java/net/sf/jhylafax/TransferMonitor.java

  • Committer: squig
  • Date: 2005-04-19 22:44:50 UTC
  • Revision ID: Arch-1:unnamed@bazaar.ubuntu.com%series--4272--patch-13
added cover handling

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * JHylaFax - A java client for HylaFAX.
 
3
 *
 
4
 * Copyright (C) 2005 by Steffen Pingel <steffenp@gmx.de>
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; either version 2 of the License, or
 
9
 * (at your option) any later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program; if not, write to the Free Software
 
18
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
19
 */
 
20
package net.sf.jhylafax;
 
21
 
 
22
import gnu.inet.ftp.TransferListener;
 
23
import org.xnap.commons.io.ProgressMonitor;
 
24
import org.xnap.commons.io.SubTaskProgressMonitor;
 
25
 
 
26
/**
 
27
 * A mediator that links a {@link gnu.inet.ftp.TransferListener} and
 
28
 * a {@link org.xnap.commons.io.ProgressMonitor} object.
 
29
 * 
 
30
 * @author Steffen Pingel
 
31
 */
 
32
public class TransferMonitor implements TransferListener {
 
33
 
 
34
        private SubTaskProgressMonitor monitor;
 
35
 
 
36
        public TransferMonitor(ProgressMonitor monitor, int amount, long totalSize) {
 
37
                this.monitor = new SubTaskProgressMonitor(monitor, amount, totalSize);
 
38
        }
 
39
 
 
40
        public void transferStarted()
 
41
        {
 
42
        }
 
43
 
 
44
        public void transferCompleted()
 
45
        {
 
46
                monitor.done();
 
47
        }
 
48
 
 
49
        public void transfered(long value)
 
50
        {
 
51
                monitor.setValue(value);
 
52
        }
 
53
 
 
54
        public void transferFailed()
 
55
        {
 
56
                monitor.done();
 
57
        }
 
58
 
 
59
}