Subversion Repositories eFlore/Applications.coel

Rev

Rev 1417 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
359 jp_milcent 1
package org.tela_botanica.client.vues;
2
 
3
import org.tela_botanica.client.ComposantId;
1239 cyprien 4
import org.tela_botanica.client.Mediateur;
5
import org.tela_botanica.client.RegistreId;
6
import org.tela_botanica.client.util.Debug;
359 jp_milcent 7
 
1239 cyprien 8
import com.extjs.gxt.ui.client.Registry;
359 jp_milcent 9
import com.extjs.gxt.ui.client.Style.Orientation;
1239 cyprien 10
import com.extjs.gxt.ui.client.event.ButtonEvent;
11
import com.extjs.gxt.ui.client.event.ComponentEvent;
12
import com.extjs.gxt.ui.client.event.EventType;
13
import com.extjs.gxt.ui.client.event.Events;
14
import com.extjs.gxt.ui.client.event.Listener;
15
import com.extjs.gxt.ui.client.event.SelectionListener;
16
import com.extjs.gxt.ui.client.event.WidgetListener;
17
import com.extjs.gxt.ui.client.widget.InfoConfig;
359 jp_milcent 18
import com.extjs.gxt.ui.client.widget.LayoutContainer;
500 jp_milcent 19
import com.extjs.gxt.ui.client.widget.Status;
1239 cyprien 20
import com.extjs.gxt.ui.client.widget.button.Button;
21
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
359 jp_milcent 22
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
500 jp_milcent 23
import com.extjs.gxt.ui.client.widget.toolbar.FillToolItem;
24
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
359 jp_milcent 25
 
443 jp_milcent 26
public class StatutVue extends LayoutContainer {
359 jp_milcent 27
 
500 jp_milcent 28
	private Status barreStatut = null;
1239 cyprien 29
	private Button messageErreur = null;
30
	private Status messages = null;
31
	private int nbErreursNonLues = 0;
500 jp_milcent 32
 
443 jp_milcent 33
	public StatutVue() {
1239 cyprien 34
		setLayout(new FitLayout());
359 jp_milcent 35
		setId(ComposantId.PANNEAU_STATUT);
500 jp_milcent 36
 
37
		ToolBar toolBar = new ToolBar();
359 jp_milcent 38
 
500 jp_milcent 39
		barreStatut = new Status();
40
		toolBar.add(barreStatut);
1239 cyprien 41
		toolBar.add(new FillToolItem());
500 jp_milcent 42
 
1239 cyprien 43
		messages = new Status();
44
		toolBar.add(messages);
45
 
46
		messageErreur = new Button();
47
		messageErreur.addSelectionListener(new SelectionListener<ButtonEvent>() {
48
 
49
			@Override
50
			public void componentSelected(ButtonEvent ce) {
51
				reinitialiserNonLue();
52
				((Mediateur) Registry.get(RegistreId.MEDIATEUR)).ouvrirFenetreJournal();
53
			}
54
		});
55
		toolBar.add(messageErreur);
56
 
1417 jpm 57
		Status version = new Status();
58
		String infoVersionAppli = Registry.get(RegistreId.APPLI_CODE)+" v"+Registry.get(RegistreId.APPLI_VERSION)+" - "+Registry.get(RegistreId.APPLI_VERSION_NOM);
59
		version.setText(infoVersionAppli);
60
		toolBar.add(version);
1239 cyprien 61
 
62
		add(toolBar);
359 jp_milcent 63
	}
64
 
65
	public void showBusy(String message) {
500 jp_milcent 66
		barreStatut.setBusy(message);
359 jp_milcent 67
	}
68
 
69
	public void clear() {
500 jp_milcent 70
		barreStatut.clearStatus("");
359 jp_milcent 71
	}
1239 cyprien 72
 
73
	public void afficherMessage(InfoConfig info)	{
74
		messages.setText(info.title +" - " + info.text);
75
	}
76
 
77
	public void afficherErreur()	{
78
		nbErreursNonLues++;
79
		String labelErreur = " erreur";
80
		if (nbErreursNonLues > 1)	{
81
			labelErreur+="s";
82
		}
83
		messageErreur.setText("<b style=\"color:red\">" + nbErreursNonLues + labelErreur + "</b>");
84
	}
85
 
86
	public void reinitialiserNonLue()	{
87
		nbErreursNonLues = 0;
88
		messageErreur.setText("");
89
		messageErreur.setVisible(false);
90
	}
359 jp_milcent 91
}