Repository navigation
Expand file tree
/
Copy pathFileJob.java
More file actions
143 lines (124 loc) · 4.85 KB
/
Copy pathFileJob.java
File metadata and controls
143 lines (124 loc) · 4.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*
* This file is part of muCommander, http://www.mucommander.com
*
* muCommander is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* muCommander is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.mucommander.job;
import com.mucommander.commons.file.AbstractFile;
import com.mucommander.ui.dialog.file.ProgressDialog;
/**
* An interface that exposes the public API of {@link com.mucommander.job.impl.FileJob}
*
* @author Arik Hadas
*/
public interface FileJob extends Runnable {
/**
* Indicates whether this job is executed in a non-blocking mode.
*
* @return true if the job is executed in the background, false otherwise.
*/
boolean isRunInBackground();
/**
* Registers a FileJobListener to receive notifications whenever state of this FileJob changes.
*
* <p>Listeners are stored as weak references so {@link #removeFileJobListener(FileJobListener)}
* doesn't need to be called for listeners to be garbage collected when they're not used anymore.</p>
*
* @param listener the FileJobListener to register
*/
void addFileJobListener(FileJobListener listener);
/**
* Removes the given FileJobListener from the list of listeners that receive notifications when the state of
* this FileJob has changed.
*
* @param listener the FileJobListener to remove
*/
void removeFileJobListener(FileJobListener listener);
/**
* Returns the current state of this FileJob. See constant fields for possible return values.
*
* @return the current state of this FileJob. See constant fields for possible return values.
*/
FileJobState getState();
/**
* Returns <code>true</code> if the given folder has or may have been modified by this job.
* This method is called after this job has finished processing files, to determine if the current MainFrame's
* file tables need to be refreshed to reveal the modified contents.
*
* @param folder the folder to test
* @return true if the given folder has or may have been modified by this job
*/
boolean hasFolderChanged(AbstractFile folder);
/**
* Returns information about the job progress.
* @return the job progress
*/
JobProgress getJobProgress();
/**
* Returns the timestamp in milliseconds when this job was last paused, <code>0</code> if this job has not been
* paused yet.
*
* @return the timestamp in milliseconds when this job was last paused
*/
long getPauseStartDate();
/**
* Returns a String describing what the job is currently doing. This default implementation returns
* <i>Processing CURRENT_FILE</i> where CURRENT_FILE is the name of the file currently being processed.
* This method should be overridden to provide a more accurate description.
*
* @return a String describing what the job is currently doing
*/
String getStatusString();
/**
* Returns the timestamp in milliseconds when this job ended, <code>0</code> if this job hasn't finished yet.
*
* @return the timestamp in milliseconds when this job ended
*/
long getEndDate();
/**
* Returns this job's percentage of completion, as a float comprised between 0 and 1.
*
* @return this job's percentage of completion, as a float comprised between 0 and 1
*/
float getTotalPercentDone();
/**
* Returns the number of milliseconds this job effectively spent processing files, excluding any pause time.
*
* @return the number of milliseconds this job effectively spent processing files, excluding any pause time
*/
long getEffectiveJobTime();
/**
* Starts file job in a separate thread.
*/
void start();
/**
* Interrupts this job, changes the job state to {@link #INTERRUPTED} and notifies listeners.
*/
void interrupt();
/**
* Sets or unsets this job in paused mode.
*/
void setPaused(boolean paused);
/**
* Specifies whether or not this job needs to be executed in a non-blocking mode.
*
* @param runInBackground true if the job needs to be executed in the background, false otherwise.
*/
void setRunInBackground(boolean runInBackground);
/**
* Returns the dialog showing progress of this job.
* @return the progressDialog
*/
ProgressDialog getProgressDialog();
}