Revision 2130 org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/process/DataProcess.java
DataProcess.java | ||
---|---|---|
53 | 53 |
protected IProcessActions externalActions = null; |
54 | 54 |
protected Hashtable<String, Object> |
55 | 55 |
taskParams = new Hashtable<String, Object>(); |
56 |
HashMap<String, Object> output = new HashMap<String, Object>(); |
|
56 |
|
|
57 | 57 |
|
58 | 58 |
private String log = ""; |
59 | 59 |
private String lastLine = ""; |
... | ... | |
69 | 69 |
//*************************************************** |
70 | 70 |
|
71 | 71 |
/** |
72 |
* Crea la ventana de IncrementableTask |
|
72 |
* Builds the window <code>IncrementableTask</code> to show |
|
73 |
* the increment of the task. |
|
73 | 74 |
*/ |
74 | 75 |
public IncrementableTask getIncrementableTask() { |
75 | 76 |
if (incrementableTask == null) { |
... | ... | |
80 | 81 |
} |
81 | 82 |
|
82 | 83 |
/** |
83 |
* Define si se puede cancelar el proceso. Por defecto es true. |
|
84 |
* @param enabled |
|
84 |
* Sets the button to cancel the task |
|
85 | 85 |
*/ |
86 | 86 |
public void setCancelable(boolean enabled) { |
87 | 87 |
getIncrementableTask().getButtonsPanel().setEnabled(IButtonsPanel.BUTTON_CANCEL, enabled); |
88 | 88 |
} |
89 | 89 |
|
90 | 90 |
/** |
91 |
* Muestra la ventana de IncrementableTask
|
|
91 |
* Show the increment of this task <code>IncrementableTask</code>
|
|
92 | 92 |
*/ |
93 | 93 |
public void showIncrementableWindow() { |
94 | 94 |
if (progressActive) { |
... | ... | |
98 | 98 |
} |
99 | 99 |
|
100 | 100 |
/** |
101 |
* Arranca el proceso de recorte de un layer
|
|
101 |
* Starts the process. It will call the run method
|
|
102 | 102 |
*/ |
103 | 103 |
public void start() { |
104 | 104 |
showIncrementableWindow(); |
... | ... | |
108 | 108 |
} |
109 | 109 |
|
110 | 110 |
/** |
111 |
* Proceso de carga de par�metros. Puede no hacerse una carga de par�metros |
|
112 |
* explicita y obtenerlos directamente de la tabla Hash cuando vayan a usarse. |
|
113 |
* Esto queda a elecci�n del programador. En caso de hacerse una carga de par�metros |
|
114 |
* explicita esta llamada deber�a hacerse justo despues del constructor de la clase |
|
115 |
* que contendr� el proceso. |
|
111 |
* A specific task will load parameters using this initialization. |
|
116 | 112 |
*/ |
117 | 113 |
public abstract void init(); |
118 | 114 |
|
119 | 115 |
/** |
120 |
* Proceso |
|
116 |
* This call will be implemented by a specific process. It will do the actions to carry out |
|
117 |
* the task |
|
121 | 118 |
* @throws InterruptedException |
122 | 119 |
*/ |
123 | 120 |
public abstract void process() throws ProcessInterruptedException, ProcessException; |
... | ... | |
132 | 129 |
* @return Result of the task |
133 | 130 |
*/ |
134 | 131 |
public HashMap<String, Object> getResult() { |
135 |
output.put("PROCESS", this); |
|
136 |
output.put(TIME, getTime()); |
|
137 |
output.put(PROCESS_NAME, getName()); |
|
138 |
return output; |
|
132 |
outputParameters.put("PROCESS", this);
|
|
133 |
outputParameters.put(TIME, getTime());
|
|
134 |
outputParameters.put(PROCESS_NAME, getName());
|
|
135 |
return outputParameters;
|
|
139 | 136 |
} |
140 | 137 |
|
141 | 138 |
/** |
... | ... | |
144 | 141 |
* @param value |
145 | 142 |
*/ |
146 | 143 |
protected void addOutputValue(String key, Object value) { |
147 |
output.put(key, value); |
|
144 |
outputParameters.put(key, value);
|
|
148 | 145 |
} |
149 | 146 |
|
150 | 147 |
/** |
151 |
* Proceso
|
|
148 |
* Sequential execution of this task
|
|
152 | 149 |
* @throws ProcessException |
153 | 150 |
*/ |
154 | 151 |
public void execute() throws ProcessInterruptedException, ProcessException { |
155 | 152 |
taskEventManager = RasterLocator.getManager().createRasterTask(this); |
153 |
loadGlobalParameters(); |
|
156 | 154 |
init(); |
157 | 155 |
process(); |
158 | 156 |
|
... | ... | |
167 | 165 |
} |
168 | 166 |
|
169 | 167 |
/** |
170 |
* M�todo donde se ejecutar� el Thread. Este har� las acciones globales para
|
|
171 |
* cualquier tarea y llamar� al m�todo execute especifico de una tarea.
|
|
168 |
* This method will be executed by the Thread. It will have the global actions for
|
|
169 |
* any task and it will call to the <code>execute</code> function.
|
|
172 | 170 |
*/ |
173 | 171 |
public void run() { |
174 | 172 |
long t1 = new java.util.Date().getTime(); |
... | ... | |
220 | 218 |
} |
221 | 219 |
|
222 | 220 |
/** |
223 |
* Activa o desactiva el interfaz de progreso en el lanzamiento de la tarea como un thread.
|
|
224 |
* @param active true para activarlo o false para desactivarlo
|
|
221 |
* When the process is launched in a thread, this method enables or disables
|
|
222 |
* the GUI to show the progress.
|
|
225 | 223 |
*/ |
226 | 224 |
public void setProgressActive(boolean active) { |
227 | 225 |
this.progressActive = active; |
228 | 226 |
} |
229 | 227 |
|
230 | 228 |
/** |
231 |
* Obtiene el tiempo que tard� en ejecutarse la tarea |
|
232 |
* la �ltima vez que se proces� |
|
229 |
* Gets the time that a task lasts |
|
233 | 230 |
*/ |
234 | 231 |
public long getTime() { |
235 | 232 |
return time; |
236 | 233 |
} |
237 | 234 |
|
238 | 235 |
/** |
239 |
* Obtiene el objeto para ejecutar acciones externar.
|
|
240 |
* @param IProcessActions
|
|
236 |
* Gets the object to execute external actions.
|
|
237 |
* A user should be register this object to receive the events
|
|
241 | 238 |
*/ |
242 | 239 |
public IProcessActions getActions() { |
243 | 240 |
return externalActions; |
244 | 241 |
} |
245 | 242 |
|
246 | 243 |
/** |
247 |
* Asigna el objeto para ejecutar acciones externar.
|
|
248 |
* @param IProcessActions
|
|
244 |
* Sets the object to execute external actions.
|
|
245 |
* A user should be register this object to receive the events
|
|
249 | 246 |
*/ |
250 | 247 |
public void setActions(IProcessActions actions) { |
251 | 248 |
this.externalActions = actions; |
252 | 249 |
} |
253 | 250 |
|
254 | 251 |
/** |
255 |
* Obtiene el objeto para ejecutar acciones de la cola de procesos de ejecuci�n exclusiva. |
|
256 |
* @param IProcessActions |
|
252 |
* Gets the object to execute actions in the queue of processes |
|
257 | 253 |
*/ |
258 | 254 |
public IProcessActions getUniqueProcessActions() { |
259 | 255 |
return queueActions; |
... | ... | |
268 | 264 |
} |
269 | 265 |
|
270 | 266 |
/** |
271 |
* Inserta una nueva l�nea en el log del cuadro de incremento de tarea |
|
272 |
* @param line |
|
267 |
* Inserts a new line in the increment window |
|
273 | 268 |
*/ |
274 | 269 |
protected void insertLineLog(String line) { |
275 | 270 |
lastLine = line; |
... | ... | |
277 | 272 |
} |
278 | 273 |
|
279 | 274 |
/** |
280 |
* Obtiene la �ltima l�nea introducida en el log del cuadro de incremento.
|
|
275 |
* Gets the last line in the increment window
|
|
281 | 276 |
*/ |
282 | 277 |
public String getLabel() { |
283 | 278 |
return lastLine; |
284 | 279 |
} |
285 | 280 |
|
286 | 281 |
/** |
287 |
* Obtiene el texto de log del cuadro de incremento completo.
|
|
282 |
* Gets the log of the increment window
|
|
288 | 283 |
*/ |
289 | 284 |
public String getLog() { |
290 | 285 |
return log; |
Also available in: Unified diff