Revision 449 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/DefaultJTaskStatus.java
DefaultJTaskStatus.java | ||
---|---|---|
4 | 4 |
import java.awt.Dimension; |
5 | 5 |
import java.awt.GridBagConstraints; |
6 | 6 |
import java.awt.GridBagLayout; |
7 |
import java.awt.event.ActionEvent; |
|
8 |
import java.awt.event.ActionListener; |
|
7 | 9 |
import java.net.URL; |
8 | 10 |
|
9 | 11 |
import javax.swing.ImageIcon; |
... | ... | |
76 | 78 |
|
77 | 79 |
this.progressBar = new JProgressBar(1,100); |
78 | 80 |
this.progressBar.setPreferredSize(new Dimension( 200, 10)); |
79 |
this.progressBar.setIndeterminate(true);
|
|
81 |
this.progressBar.setIndeterminate(false);
|
|
80 | 82 |
this.progressBar.setBorderPainted(true); |
81 | 83 |
|
82 | 84 |
this.cancelRequestButton = new JButton(); |
... | ... | |
86 | 88 |
if( !this.showCancelButton ) { |
87 | 89 |
this.cancelRequestButton.setVisible(this.showCancelButton); |
88 | 90 |
} |
89 |
|
|
91 |
this.cancelRequestButton.addActionListener(new ActionListener() { |
|
92 |
public void actionPerformed(ActionEvent arg0) { |
|
93 |
cancelRequestButton.setEnabled(false); |
|
94 |
taskStatus.cancelRequest(); |
|
95 |
} |
|
96 |
}); |
|
97 |
this.cancelRequestButton.setDisabledIcon( getIcon("disabledCancelRequestButton.png") ); |
|
98 |
|
|
90 | 99 |
this.messagelabel = new JLabel(); |
91 | 100 |
this.messagelabel.setPreferredSize( new Dimension( 200, 16)); |
92 | 101 |
|
... | ... | |
130 | 139 |
}); |
131 | 140 |
return; |
132 | 141 |
} |
133 |
if( observable == null ) { |
|
134 |
this.tittlelabel.setText(""); |
|
142 |
TaskStatus taskStatus = (TaskStatus) observable; |
|
143 |
if( taskStatus == null || !taskStatus.isRunning() ) { |
|
144 |
//this.tittlelabel.setText(""); |
|
135 | 145 |
this.messagelabel.setText(""); |
136 | 146 |
this.progressBar.setValue(100); |
137 | 147 |
this.cancelRequestButton.setEnabled(false); |
138 | 148 |
return; |
139 | 149 |
} |
140 |
TaskStatus taskStatus = (TaskStatus) observable; |
|
141 | 150 |
this.tittlelabel.setText(taskStatus.getTitle()); |
142 | 151 |
this.messagelabel.setText(taskStatus.getLabel()); |
143 | 152 |
this.progressBar.setIndeterminate( taskStatus.isIndeterminate() ); |
Also available in: Unified diff