594 |
aurelien |
1 |
package org.tela_botanica.client.vues;
|
|
|
2 |
|
|
|
3 |
import org.tela_botanica.client.CarnetEnLigneMediateur;
|
2621 |
aurelien |
4 |
import org.tela_botanica.client.i18n.Msg;
|
594 |
aurelien |
5 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
|
|
6 |
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
|
|
7 |
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
|
|
8 |
import com.google.gwt.user.client.ui.CheckBox;
|
|
|
9 |
import com.google.gwt.user.client.ui.HTML;
|
|
|
10 |
import com.google.gwt.user.client.ui.Label;
|
|
|
11 |
import com.gwtext.client.core.EventObject;
|
|
|
12 |
import com.gwtext.client.widgets.Button;
|
|
|
13 |
import com.gwtext.client.widgets.Panel;
|
|
|
14 |
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
|
|
|
15 |
import com.gwtext.client.widgets.form.FormPanel;
|
|
|
16 |
|
|
|
17 |
public class FenetreLicenceVue extends com.gwtext.client.widgets.Window implements Rafraichissable {
|
|
|
18 |
|
|
|
19 |
CarnetEnLigneMediateur cm = null;
|
|
|
20 |
|
|
|
21 |
private CheckBox accepterLicence = new CheckBox();
|
2621 |
aurelien |
22 |
private Button validerAcceptationLicence = new Button(Msg.get("valider"));
|
|
|
23 |
private Button annulerAcceptationLicence = new Button(Msg.get("Refuser"));
|
594 |
aurelien |
24 |
|
965 |
aurelien |
25 |
// C'est moche mais ça évite de la transmettre du serveur ou de créer un fichier de config pour la licence
|
|
|
26 |
// Todo afficher un texte provenant d'une url
|
2638 |
mathias |
27 |
private String licence = Msg.get("licence");
|
594 |
aurelien |
28 |
|
|
|
29 |
|
|
|
30 |
public FenetreLicenceVue(CarnetEnLigneMediateur cm) {
|
|
|
31 |
|
|
|
32 |
super();
|
|
|
33 |
|
|
|
34 |
this.cm = cm;
|
2621 |
aurelien |
35 |
setTitle(Msg.get("acceptation-licence"));
|
594 |
aurelien |
36 |
Panel conteneurHtml = new Panel();
|
|
|
37 |
conteneurHtml.setHtml(licence);
|
653 |
aurelien |
38 |
conteneurHtml.setHeight(230);
|
594 |
aurelien |
39 |
conteneurHtml.setAutoScroll(true);
|
|
|
40 |
HTML conteneurLicence = new HTML();
|
|
|
41 |
conteneurHtml.add(conteneurLicence);
|
|
|
42 |
//licence = Configuration.getLicence();
|
653 |
aurelien |
43 |
setConstrain(true);
|
594 |
aurelien |
44 |
|
|
|
45 |
conteneurLicence.setHTML(licence);
|
|
|
46 |
|
|
|
47 |
this.add(conteneurHtml);
|
|
|
48 |
|
|
|
49 |
Panel conteneurCheckbox = new Panel();
|
|
|
50 |
conteneurCheckbox.setBorder(false);
|
|
|
51 |
conteneurCheckbox.setHeader(false);
|
|
|
52 |
|
|
|
53 |
Label labelCheckboxAccepterLicence = new Label();
|
|
|
54 |
labelCheckboxAccepterLicence.setStyleName("display:inline");
|
|
|
55 |
|
2621 |
aurelien |
56 |
accepterLicence.setText(" "+Msg.get("lu-accepte-licence"));
|
594 |
aurelien |
57 |
accepterLicence.setStyleName("accepter_licence");
|
|
|
58 |
|
|
|
59 |
FormPanel conteneurCheckboxEtValidation = new FormPanel();
|
|
|
60 |
conteneurCheckboxEtValidation.setHeader(false);
|
|
|
61 |
|
|
|
62 |
conteneurCheckboxEtValidation.setHeight(70);
|
|
|
63 |
|
|
|
64 |
conteneurCheckboxEtValidation.add(accepterLicence);
|
|
|
65 |
conteneurCheckboxEtValidation.add(labelCheckboxAccepterLicence);
|
|
|
66 |
|
|
|
67 |
conteneurCheckboxEtValidation.addButton(validerAcceptationLicence);
|
|
|
68 |
|
|
|
69 |
validerAcceptationLicence.setDisabled(true);
|
|
|
70 |
|
|
|
71 |
conteneurCheckboxEtValidation.addButton(annulerAcceptationLicence);
|
|
|
72 |
|
|
|
73 |
this.add(conteneurCheckboxEtValidation);
|
|
|
74 |
|
|
|
75 |
this.setClosable(false);
|
|
|
76 |
|
653 |
aurelien |
77 |
this.setHeight(320);
|
|
|
78 |
|
594 |
aurelien |
79 |
ajouterListenerBoutons();
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
public void ajouterListenerBoutons() {
|
|
|
83 |
|
|
|
84 |
accepterLicence.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
|
|
85 |
|
1291 |
aurelien |
86 |
@Override
|
594 |
aurelien |
87 |
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
|
|
88 |
validerAcceptationLicence.setDisabled(!event.getValue());
|
|
|
89 |
}
|
|
|
90 |
});
|
|
|
91 |
|
|
|
92 |
validerAcceptationLicence.addListener(new ButtonListenerAdapter() {
|
|
|
93 |
|
1291 |
aurelien |
94 |
@Override
|
594 |
aurelien |
95 |
public void onClick(Button button, EventObject e) {
|
|
|
96 |
|
|
|
97 |
cm.rafraichir("licence_acceptee", false);
|
|
|
98 |
}
|
|
|
99 |
});
|
|
|
100 |
|
|
|
101 |
annulerAcceptationLicence.addListener(new ButtonListenerAdapter() {
|
|
|
102 |
|
1291 |
aurelien |
103 |
@Override
|
594 |
aurelien |
104 |
public void onClick(Button button, EventObject e) {
|
|
|
105 |
|
|
|
106 |
cm.rafraichir("licence_refusee", false);
|
|
|
107 |
}
|
|
|
108 |
});
|
|
|
109 |
}
|
|
|
110 |
|
1291 |
aurelien |
111 |
@Override
|
594 |
aurelien |
112 |
public void rafraichir(Object nouvelleDonnees,
|
|
|
113 |
boolean repandreRaffraichissement) {
|
|
|
114 |
// TODO Auto-generated method stub
|
|
|
115 |
|
|
|
116 |
}
|
|
|
117 |
}
|