Subversion Repositories eFlore/Applications.coel

Rev

Rev 1369 | 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
 
57
 
58
		add(toolBar);
359 jp_milcent 59
	}
60
 
61
	public void showBusy(String message) {
500 jp_milcent 62
		barreStatut.setBusy(message);
359 jp_milcent 63
	}
64
 
65
	public void clear() {
500 jp_milcent 66
		barreStatut.clearStatus("");
359 jp_milcent 67
	}
1239 cyprien 68
 
69
	public void afficherMessage(InfoConfig info)	{
70
		messages.setText(info.title +" - " + info.text);
71
	}
72
 
73
	public void afficherErreur()	{
74
		nbErreursNonLues++;
75
		String labelErreur = " erreur";
76
		if (nbErreursNonLues > 1)	{
77
			labelErreur+="s";
78
		}
79
		messageErreur.setText("<b style=\"color:red\">" + nbErreursNonLues + labelErreur + "</b>");
80
	}
81
 
82
	public void reinitialiserNonLue()	{
83
		nbErreursNonLues = 0;
84
		messageErreur.setText("");
85
		messageErreur.setVisible(false);
86
	}
359 jp_milcent 87
}