| Line 1... |
Line 1... |
| 1 |
package org.tela_botanica.client.vues;
|
1 |
package org.tela_botanica.client.vues;
|
| Line 2... |
Line -... |
| 2 |
|
- |
|
| 3 |
import org.tela_botanica.client.ComposantClass;
|
2 |
|
| 4 |
import org.tela_botanica.client.ComposantId;
|
3 |
import org.tela_botanica.client.ComposantId;
|
| 5 |
import org.tela_botanica.client.Mediateur;
|
4 |
import org.tela_botanica.client.Mediateur;
|
| - |
|
5 |
import org.tela_botanica.client.RegistreId;
|
| 6 |
import org.tela_botanica.client.RegistreId;
|
6 |
import org.tela_botanica.client.i18n.Constantes;
|
| 7 |
import org.tela_botanica.client.images.Images;
|
7 |
import org.tela_botanica.client.images.Images;
|
| 8 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
8 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
| 9 |
import org.tela_botanica.client.modeles.Information;
|
9 |
import org.tela_botanica.client.modeles.Information;
|
| Line 10... |
Line 10... |
| 10 |
import org.tela_botanica.client.modeles.Utilisateur;
|
10 |
import org.tela_botanica.client.modeles.Utilisateur;
|
| 11 |
|
11 |
|
| 12 |
import com.extjs.gxt.ui.client.Registry;
|
12 |
import com.extjs.gxt.ui.client.Registry;
|
| 13 |
import com.extjs.gxt.ui.client.Style;
|
13 |
import com.extjs.gxt.ui.client.Style;
|
| 14 |
import com.extjs.gxt.ui.client.Style.Orientation;
|
- |
|
| 15 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
14 |
import com.extjs.gxt.ui.client.Style.Orientation;
|
| 16 |
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
15 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
| 17 |
import com.extjs.gxt.ui.client.event.MenuEvent;
|
16 |
import com.extjs.gxt.ui.client.event.MenuEvent;
|
| 18 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
17 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
| 19 |
import com.extjs.gxt.ui.client.util.Format;
|
18 |
import com.extjs.gxt.ui.client.util.Format;
|
| Line 31... |
Line 30... |
| 31 |
import com.google.gwt.core.client.GWT;
|
30 |
import com.google.gwt.core.client.GWT;
|
| Line 32... |
Line 31... |
| 32 |
|
31 |
|
| Line 33... |
Line 32... |
| 33 |
public class EnteteVue extends LayoutContainer implements Rafraichissable {
|
32 |
public class EnteteVue extends LayoutContainer implements Rafraichissable {
|
| - |
|
33 |
|
| 34 |
|
34 |
private Mediateur mediateur = null;
|
| 35 |
private Mediateur mediateur = null;
|
35 |
private Constantes i18nC = null;
|
| 36 |
private ButtonBar barreBoutons = null;
|
36 |
private ButtonBar barreBoutons = null;
|
| 37 |
private Button identificationBouton = null;
|
37 |
private Button identificationBouton = null;
|
| Line 38... |
Line 38... |
| 38 |
private String identificationInfoTpl = null;
|
38 |
private String identificationInfoTpl = null;
|
| 39 |
private HtmlContainer identificationInfoHtml = null;
|
39 |
private HtmlContainer identificationConteneurHtml = null;
|
| - |
|
40 |
|
| 40 |
|
41 |
public EnteteVue(Mediateur mediateurCourant) {
|
| 41 |
public EnteteVue(Mediateur mediateurCourant) {
|
42 |
mediateur = mediateurCourant;
|
| Line 42... |
Line -... |
| 42 |
mediateur = mediateurCourant;
|
- |
|
| 43 |
setLayout(new RowLayout(Orientation.HORIZONTAL));
|
43 |
i18nC = mediateur.i18nC;
|
| 44 |
setId(ComposantId.PANNEAU_ENTETE);
|
- |
|
| 45 |
|
44 |
setLayout(new RowLayout(Orientation.HORIZONTAL));
|
| 46 |
// TODO : ajouter la gestion de l'identification
|
45 |
setId(ComposantId.PANNEAU_ENTETE);
|
| 47 |
HtmlContainer html = new HtmlContainer();
|
- |
|
| Line 48... |
Line 46... |
| 48 |
StringBuffer sb = new StringBuffer();
|
46 |
|
| 49 |
sb.append(" <div id='"+ComposantId.DIV_TITRE+"'>Collections en Ligne Demo</div>");
|
47 |
HtmlContainer titreConteneurHtml = new HtmlContainer();
|
| 50 |
html.setHtml(sb.toString());
|
48 |
String titreHtml = "<div id='"+ComposantId.DIV_TITRE+"'>{0}</div>";
|
| 51 |
html.setEnabled(false);
|
- |
|
| Line 52... |
Line 49... |
| 52 |
|
49 |
titreConteneurHtml.setHtml(Format.substitute(titreHtml, i18nC.appliNom()));
|
| 53 |
identificationInfoHtml = new HtmlContainer();
|
50 |
|
| 54 |
identificationInfoTpl = "<div id='"+ComposantId.DIV_IDENTIFICATION+"'>{0}</div>";
|
51 |
identificationConteneurHtml = new HtmlContainer();
|
| 55 |
identificationInfoHtml.setHtml(Format.substitute(identificationInfoTpl, (new Params()).add("Mode anonyme")));
|
52 |
identificationInfoTpl = "<div id='"+ComposantId.DIV_IDENTIFICATION+"'>{0}</div>";
|
| Line 134... |
Line 131... |
| 134 |
|
131 |
|
| 135 |
applisBouton.setMenu(menu);
|
132 |
applisBouton.setMenu(menu);
|
| 136 |
applisBouton.setIcon(Images.ICONES.flecheBascule());
|
133 |
applisBouton.setIcon(Images.ICONES.flecheBascule());
|
| Line 137... |
Line 134... |
| 137 |
barreBoutons.add(applisBouton);
|
134 |
barreBoutons.add(applisBouton);
|
| 138 |
|
135 |
|
| 139 |
add(html, new RowData(.3, 1));
|
136 |
add(titreConteneurHtml, new RowData(.3, 1));
|
| 140 |
add(identificationInfoHtml, new RowData(.3, 1));
|
137 |
add(identificationConteneurHtml, new RowData(.3, 1));
|
| Line 141... |
Line 138... |
| 141 |
add(barreBoutons, new RowData(.4, 1));
|
138 |
add(barreBoutons, new RowData(.4, 1));
|
| 142 |
}
|
139 |
}
|
| 143 |
|
140 |
|
| 144 |
public void rafraichir(Object nouvelleDonnees) {
|
141 |
public void rafraichir(Object nouvelleDonnees) {
|
| 145 |
if (nouvelleDonnees instanceof Information) {
|
142 |
if (nouvelleDonnees instanceof Information) {
|
| 146 |
Information info = (Information) nouvelleDonnees;
|
143 |
Information info = (Information) nouvelleDonnees;
|
| 147 |
if (info.getType().equals("maj_utilisateur")) {
|
144 |
if (info.getType().equals("maj_utilisateur")) {
|
| 148 |
Utilisateur utilisateur = ((Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT));
|
145 |
Utilisateur utilisateur = ((Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT));
|
| 149 |
if (utilisateur.isIdentifie() == true) {
|
146 |
if (utilisateur.isIdentifie() == true) {
|
| 150 |
identificationInfoHtml.setHtml(Format.substitute(identificationInfoTpl, (new Params()).add("Bienvenue : "+utilisateur.getNomComplet())));
|
147 |
identificationConteneurHtml.setHtml(Format.substitute(identificationInfoTpl, (new Params()).add("Bienvenue : "+utilisateur.getNomComplet())));
|
| 151 |
identificationBouton.setText("Deconnexion");
|
148 |
identificationBouton.setText("Deconnexion");
|
| 152 |
identificationBouton.setIcon(Images.ICONES.deconnexion());
|
149 |
identificationBouton.setIcon(Images.ICONES.deconnexion());
|
| 153 |
identificationBouton.setId(ComposantId.BTN_DECONNEXION);
|
150 |
identificationBouton.setId(ComposantId.BTN_DECONNEXION);
|
| 154 |
} else {
|
151 |
} else {
|
| 155 |
identificationInfoHtml.setHtml(Format.substitute(identificationInfoTpl, (new Params()).add("Mode anonyme")));
|
152 |
identificationConteneurHtml.setHtml(Format.substitute(identificationInfoTpl, (new Params()).add("Mode anonyme")));
|
| 156 |
identificationBouton.setText("Identifiez vous...");
|
153 |
identificationBouton.setText("Identifiez vous...");
|
| 157 |
identificationBouton.setIcon(Images.ICONES.connexion());
|
154 |
identificationBouton.setIcon(Images.ICONES.connexion());
|