Revision 10962 trunk/libraries/libUIComponent/src-test/org/gvsig/gui/beans/incrementableTask/TestIncrementableTask.java

View differences:

TestIncrementableTask.java
2 2

  
3 3
import org.gvsig.gui.beans.incrementabletask.IIncrementable;
4 4
import org.gvsig.gui.beans.incrementabletask.IncrementableTask;
5
import org.gvsig.gui.beans.progresspanel.LogControl;
5 6

  
6 7
public class TestIncrementableTask {
7
	class ClassProcess implements IIncrementable {
8
	class ClassProcess extends Thread implements IIncrementable {
8 9
		int i = 0;
10
		long j = 0;
11
		LogControl log = new LogControl();
9 12

  
13
		public ClassProcess() {
14
			this.start();
15
		}
16

  
17
		public synchronized void run(){
18
			for (j=0; j<=65535; j++) {
19
				for (long i=0; i<=65535; i++);
20
				log.replaceLastLine(j + "");
21
				if ((j%1000)==0) {
22
					log.addLine(j + "");
23
				}
24
			}
25
		}
26

  
10 27
		public String getLabel() {
11
			return "Etiqueta " + i;
28
			return "Etiqueta " + j;
12 29
		}
13 30

  
14 31
		public String getLog() {
15
			return "Mi log " + i;
32
			return log.getText();
16 33
		}
17 34

  
18 35
		public int getPercent() {
19
			i++;
20
			return i/10;
36
			return (int) ((j*100)/65535);
21 37
		}
22 38

  
23 39
		public String getTitle() {
24 40
			return "TestIncrementTask";
25 41
		}
42

  
43
		public void canceled() {
44
			this.suspend();
45
		}
46

  
47
		public void closed() {
48
			this.suspend();
49
		}
50

  
51
		public void resumed() {
52
			this.resume();
53
		}
54

  
55
		public void suspended() {
56
			this.suspend();
57
		}
26 58
	}
27 59

  
28 60
  ClassProcess ncp = new ClassProcess();

Also available in: Unified diff