Revision 2632 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/task/DefaultJTaskStatusController.java
DefaultJTaskStatusController.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* gvSIG. Desktop Geographic Information System. |
3 | 3 |
* |
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
|
4 |
* Copyright (C) 2007-2021 gvSIG Association.
|
|
5 | 5 |
* |
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
... | ... | |
43 | 43 |
* Default implementation of the {@link TaskStatusController}. |
44 | 44 |
* |
45 | 45 |
* @author gvSIG Team |
46 |
* @version $Id$ |
|
47 | 46 |
*/ |
48 | 47 |
public class DefaultJTaskStatusController implements TaskStatusController, Observer { |
49 | 48 |
|
... | ... | |
59 | 58 |
private TaskStatus bindedTaskStatus; |
60 | 59 |
private TaskStatusManager bindedTaskStatusManager; |
61 | 60 |
|
61 |
@SuppressWarnings("OverridableMethodCallInConstructor") |
|
62 | 62 |
public DefaultJTaskStatusController( |
63 | 63 |
TaskStatus taskStatus, |
64 | 64 |
JLabel titlelabel, |
... | ... | |
130 | 130 |
this.removeTaskButton.setDisabledIcon(getIcon("disabledRemoveTaskButton.png")); |
131 | 131 |
this.removeTaskButton.setEnabled(true); |
132 | 132 |
this.removeTaskButton.addActionListener((ActionEvent arg0) -> { |
133 |
if( bindedTaskStatus==null ) { |
|
134 |
return; |
|
135 |
} |
|
133 | 136 |
if (bindedTaskStatus.isRunning()) { |
134 | 137 |
if ((arg0.getModifiers() & ActionEvent.CTRL_MASK) == ActionEvent.CTRL_MASK) { |
135 | 138 |
bindedTaskStatus.getManager().remove(bindedTaskStatus); |
... | ... | |
184 | 187 |
|
185 | 188 |
@Override |
186 | 189 |
public void bind(TaskStatus taskStatus) { |
190 |
if (cancelRequestButton!=null ) { |
|
191 |
this.cancelRequestButton.setEnabled(this.showCancelButton); |
|
192 |
this.cancelRequestButton.setVisible(this.showCancelButton); |
|
193 |
} |
|
187 | 194 |
if (this.bindedTaskStatus != null) { |
188 | 195 |
this.bindedTaskStatus.deleteObserver(this); |
189 | 196 |
} |
... | ... | |
197 | 204 |
} |
198 | 205 |
} |
199 | 206 |
|
207 |
@Override |
|
200 | 208 |
public void bind(TaskStatusManager taskStatusManager) { |
201 | 209 |
if (this.bindedTaskStatus != null) { |
202 | 210 |
this.bindedTaskStatus.deleteObserver(this); |
... | ... | |
282 | 290 |
public void setTitle(String title) { |
283 | 291 |
if (this.bindedTaskStatus instanceof SimpleTaskStatus) { |
284 | 292 |
((SimpleTaskStatus) this.bindedTaskStatus).setTitle(title); |
293 |
} else { |
|
294 |
this.titlelabel.setText(title); |
|
285 | 295 |
} |
286 | 296 |
} |
287 | 297 |
|
... | ... | |
289 | 299 |
public void message(String message) { |
290 | 300 |
if (this.bindedTaskStatus instanceof SimpleTaskStatus) { |
291 | 301 |
((SimpleTaskStatus) this.bindedTaskStatus).message(message); |
302 |
} else { |
|
303 |
this.messagelabel.setText(message); |
|
292 | 304 |
} |
293 | 305 |
} |
294 | 306 |
|
Also available in: Unified diff