1   package net.sf.jhylafax;
2   
3   import static net.sf.jhylafax.JHylaFAX.i18n;
4   import javax.swing.table.DefaultTableCellRenderer;
5   import net.sf.jhylafax.fax.FaxJob;
6   import org.xnap.commons.gui.util.IconHelper;
7   
8   class StateCellRenderer extends DefaultTableCellRenderer
9   {
10  
11  	public StateCellRenderer() {
12      }
13  
14  	protected void setValue(Object value) 
15  	{
16  		if (value == null) {
17  			setIcon(null);
18  			setToolTipText(null);
19  		}
20  		else {
21  			FaxJob.State state = (FaxJob.State)value;
22  			switch (state) {
23  			case BLOCKED:
24  				setIcon(IconHelper.getTableIcon("gear.png"));
25  				setToolTipText(i18n.tr("Blocked (by concurrent activity to the same destination)"));
26  				break;
27  			case WAITING:
28  				setIcon(IconHelper.getTableIcon("gear.png"));
29  				setToolTipText(i18n.tr("Waiting (for resources such as a free modem)"));
30  				break;
31  			case DONE:
32  				setIcon(IconHelper.getTableIcon("ok.png"));
33  				setToolTipText(i18n.tr("Done (successfully)"));
34  				break;
35  			case FAILED:
36  				setIcon(IconHelper.getTableIcon("flag.png"));
37  				setToolTipText(i18n.tr("Failed"));
38  				break;
39  			case PENDING:
40  				setIcon(IconHelper.getTableIcon("history.png"));
41  				setToolTipText(i18n.tr("Pending (waiting for its time to send to arrive)"));
42  				break;
43  			case RUNNING:
44  				setIcon(IconHelper.getTableIcon("launch.png"));
45  				setToolTipText(i18n.tr("Running"));
46  				break;
47  			case SLEEPING:
48  				setIcon(IconHelper.getTableIcon("history.png"));
49  				setToolTipText(i18n.tr("Sleeping (waiting for a scheduled timeout such as a delay between attempts to send)"));
50  				break;
51  			case SUSPENDED:
52  				setIcon(IconHelper.getTableIcon("player_pause.png"));
53  				setToolTipText(i18n.tr("Suspended (not being  scheduled)"));
54  				break;
55  			default: // UNDEFINED
56  				setIcon(null);
57  				setToolTipText(null);					
58  			}
59  		}
60  	}
61  	
62  }