1 package org.columba.core.gui.statusbar; 17 18 import java.awt.event.ActionEvent ; 19 import java.awt.event.ActionListener ; 20 21 import javax.swing.Timer ; 22 23 import org.columba.core.base.SwingWorker; 24 25 26 class WorkerItem { 27 private final static int TWO_SECONDS = 2000; 28 private SwingWorker worker; 29 private int number; 30 private String text; 31 private int maximum; 32 private int value; 33 private boolean allowed; 34 private int priority; 35 36 public WorkerItem(SwingWorker w, int i, int priority) { 37 worker = w; 38 number = i; 39 this.priority = priority; 40 41 allowed = false; 42 43 new Timer (TWO_SECONDS, 44 new ActionListener () { 45 public void actionPerformed(ActionEvent e) { 46 allowed = true; 47 } 48 }); 49 } 50 51 public int getPriority() { 52 return priority; 53 } 54 55 public boolean isAllowed() { 56 return allowed; 57 } 58 59 public void setAllowed(boolean b) { 60 allowed = b; 61 } 62 63 public void setWorker(SwingWorker w) { 64 worker = w; 65 } 66 67 public void setCancel(boolean b) { 68 worker.setCancel(b); 69 } 70 71 public boolean getCancel() { 72 return worker.getCancel(); 73 } 74 75 public void setNumber(int i) { 76 number = i; 77 } 78 79 public int getNumber() { 80 return number; 81 } 82 83 public Thread getThread() { 84 return worker.getThread(); 85 } 86 87 public void setText(String s) { 88 this.text = s; 89 } 90 91 public String getText() { 92 return text; 93 } 94 95 public void setProgressBarMaximum(int m) { 96 maximum = m; 97 } 98 99 public int getProgressBarMaximum() { 100 return maximum; 101 } 102 103 public void setProgressBarValue(int v) { 104 if (v <= getProgressBarMaximum()) { 105 value = v; 106 } 107 } 108 109 public int getProgressBarValue() { 110 return value; 111 } 112 } 113 | Popular Tags |