912 |
jpm |
1 |
package org.tela_botanica.client.vues.accueil;
|
|
|
2 |
|
|
|
3 |
import org.tela_botanica.client.RegistreId;
|
|
|
4 |
import org.tela_botanica.client.configuration.Configuration;
|
|
|
5 |
import org.tela_botanica.client.modeles.InterneValeur;
|
|
|
6 |
import org.tela_botanica.client.vues.Formulaire;
|
|
|
7 |
|
|
|
8 |
import com.extjs.gxt.ui.client.Registry;
|
|
|
9 |
import com.extjs.gxt.ui.client.event.IconButtonEvent;
|
|
|
10 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
|
|
11 |
import com.extjs.gxt.ui.client.event.WindowEvent;
|
|
|
12 |
import com.extjs.gxt.ui.client.event.WindowListener;
|
|
|
13 |
import com.extjs.gxt.ui.client.store.ListStore;
|
|
|
14 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
|
|
15 |
import com.extjs.gxt.ui.client.widget.Dialog;
|
|
|
16 |
import com.extjs.gxt.ui.client.widget.HtmlContainer;
|
|
|
17 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
|
|
18 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
|
|
19 |
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
|
|
|
20 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
|
|
21 |
|
913 |
jpm |
22 |
public class AppletteStatistique extends Applette {
|
912 |
jpm |
23 |
|
|
|
24 |
private String baseUrl = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl();
|
913 |
jpm |
25 |
|
912 |
jpm |
26 |
|
|
|
27 |
public AppletteStatistique() {
|
|
|
28 |
initialiserAppletteStatistique(null);
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
public AppletteStatistique(String contenu) {
|
|
|
32 |
initialiserAppletteStatistique(contenu);
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
private void initialiserAppletteStatistique(String contenu) {
|
913 |
jpm |
36 |
String titre = "Statistiques des collections";
|
|
|
37 |
initialiserApplette(titre);
|
912 |
jpm |
38 |
|
913 |
jpm |
39 |
SelectionListener<IconButtonEvent> configurationListener = new SelectionListener<IconButtonEvent>() {
|
912 |
jpm |
40 |
@Override
|
|
|
41 |
public void componentSelected(IconButtonEvent ce) {
|
|
|
42 |
ContentPanel panneau = new ContentPanel();
|
|
|
43 |
panneau.setHeaderVisible(false);
|
|
|
44 |
panneau.setLayout(Formulaire.creerFormLayout(350, LabelAlign.TOP));
|
|
|
45 |
|
|
|
46 |
ListStore<InterneValeur> appletteStore = new ListStore<InterneValeur>();
|
|
|
47 |
appletteStore.add(new InterneValeur("NombreDonnees", "Nombre de données"));
|
|
|
48 |
appletteStore.add(new InterneValeur("TypeDepot", "Types de dépôt des collections"));
|
|
|
49 |
appletteStore.add(new InterneValeur("NombreCollectionParStructure", "Nombre de collections par institution"));
|
|
|
50 |
|
|
|
51 |
final ComboBox<InterneValeur> applettesCombo = new ComboBox<InterneValeur>();
|
|
|
52 |
applettesCombo.setFieldLabel("Veuillez sélectionner le type d'applette");
|
|
|
53 |
applettesCombo.setForceSelection(true);
|
|
|
54 |
applettesCombo.setTriggerAction(TriggerAction.ALL);
|
|
|
55 |
applettesCombo.setDisplayField("nom");
|
|
|
56 |
applettesCombo.setStore(appletteStore);
|
|
|
57 |
applettesCombo.setEditable(false);
|
|
|
58 |
applettesCombo.setWidth(300);
|
|
|
59 |
|
|
|
60 |
panneau.add(applettesCombo);
|
|
|
61 |
|
|
|
62 |
final Dialog configurationFenetre = new Dialog();
|
|
|
63 |
configurationFenetre.setHeading("Configuration de l'applette");
|
|
|
64 |
configurationFenetre.setButtons(Dialog.OK);
|
|
|
65 |
configurationFenetre.setSize(350, 150);
|
|
|
66 |
configurationFenetre.setPlain(true);
|
|
|
67 |
configurationFenetre.setModal(true);
|
|
|
68 |
configurationFenetre.setBlinkModal(true);
|
|
|
69 |
configurationFenetre.setLayout(new FitLayout());
|
|
|
70 |
configurationFenetre.setHideOnButtonClick(true);
|
|
|
71 |
configurationFenetre.addWindowListener(new WindowListener(){
|
|
|
72 |
public void windowHide(WindowEvent we) {
|
|
|
73 |
String abreviation = applettesCombo.getValue().getAbr();
|
|
|
74 |
attribuerContenu(abreviation);
|
|
|
75 |
}
|
|
|
76 |
});
|
|
|
77 |
configurationFenetre.add(panneau);
|
|
|
78 |
configurationFenetre.show();
|
|
|
79 |
}
|
913 |
jpm |
80 |
};
|
|
|
81 |
ajouterConfigurationListener(configurationListener);
|
912 |
jpm |
82 |
|
913 |
jpm |
83 |
attribuerContenu(contenu);
|
912 |
jpm |
84 |
}
|
913 |
jpm |
85 |
|
912 |
jpm |
86 |
private void attribuerContenu(String abreviation) {
|
|
|
87 |
if (abreviation == null) {
|
|
|
88 |
abreviation = "NombreDonnees";
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
setData("contenu", abreviation);
|
|
|
92 |
String url = baseUrl+"CoelStatistique/"+abreviation;
|
|
|
93 |
|
|
|
94 |
HtmlContainer conteneurHtml = new HtmlContainer();
|
|
|
95 |
conteneurHtml.setUrl(url);
|
|
|
96 |
conteneurHtml.recalculate();
|
|
|
97 |
|
|
|
98 |
removeAll();
|
|
|
99 |
add(conteneurHtml);
|
|
|
100 |
layout();
|
|
|
101 |
}
|
|
|
102 |
}
|