| Line 1... |
Line 1... |
| 1 |
package org.tela_botanica.client.composants;
|
1 |
package org.tela_botanica.client.composants;
|
| Line 2... |
Line -... |
| 2 |
|
- |
|
| 3 |
|
2 |
|
| 4 |
import java.util.Iterator;
|
3 |
import java.util.Iterator;
|
| Line 5... |
Line 4... |
| 5 |
import java.util.List;
|
4 |
import java.util.List;
|
| 6 |
|
5 |
|
| 7 |
import org.tela_botanica.client.ComposantClass;
|
6 |
import org.tela_botanica.client.ComposantClass;
|
| 8 |
import org.tela_botanica.client.ComposantId;
|
- |
|
| 9 |
import org.tela_botanica.client.RegistreId;
|
7 |
import org.tela_botanica.client.ComposantId;
|
| - |
|
8 |
import org.tela_botanica.client.RegistreId;
|
| 10 |
import org.tela_botanica.client.modeles.Aide;
|
9 |
import org.tela_botanica.client.modeles.Configuration;
|
| - |
|
10 |
import org.tela_botanica.client.modeles.Information;
|
| - |
|
11 |
import org.tela_botanica.client.modeles.Menu;
|
| - |
|
12 |
import org.tela_botanica.client.modeles.Structure;
|
| - |
|
13 |
import org.tela_botanica.client.modeles.StructureConservation;
|
| 11 |
import org.tela_botanica.client.modeles.Configuration;
|
14 |
import org.tela_botanica.client.modeles.StructureListe;
|
| Line 12... |
Line 15... |
| 12 |
import org.tela_botanica.client.modeles.Menu;
|
15 |
import org.tela_botanica.client.modeles.StructureValorisation;
|
| 13 |
import org.tela_botanica.client.util.Print;
|
16 |
import org.tela_botanica.client.util.Print;
|
| 14 |
|
17 |
|
| 15 |
import com.extjs.gxt.ui.client.Events;
|
18 |
import com.extjs.gxt.ui.client.Events;
|
| 16 |
import com.extjs.gxt.ui.client.Registry;
|
19 |
import com.extjs.gxt.ui.client.Registry;
|
| 17 |
import com.extjs.gxt.ui.client.Style.LayoutRegion;
|
20 |
import com.extjs.gxt.ui.client.Style.LayoutRegion;
|
| 18 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
- |
|
| 19 |
import com.extjs.gxt.ui.client.binder.TreeBinder;
|
21 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
| 20 |
import com.extjs.gxt.ui.client.data.BaseTreeModel;
|
- |
|
| 21 |
import com.extjs.gxt.ui.client.event.BaseEvent;
|
22 |
import com.extjs.gxt.ui.client.binder.TreeBinder;
|
| 22 |
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
23 |
import com.extjs.gxt.ui.client.data.BaseTreeModel;
|
| 23 |
import com.extjs.gxt.ui.client.event.HtmlContainerEvent;
|
24 |
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
| - |
|
25 |
import com.extjs.gxt.ui.client.event.Listener;
|
| 24 |
import com.extjs.gxt.ui.client.event.Listener;
|
26 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
| 25 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
27 |
import com.extjs.gxt.ui.client.event.TreeEvent;
|
| 26 |
import com.extjs.gxt.ui.client.event.TreeEvent;
|
28 |
import com.extjs.gxt.ui.client.js.JsArray;
|
| 27 |
import com.extjs.gxt.ui.client.store.Store;
|
29 |
import com.extjs.gxt.ui.client.store.Store;
|
| 28 |
import com.extjs.gxt.ui.client.store.TreeStore;
|
30 |
import com.extjs.gxt.ui.client.store.TreeStore;
|
| 29 |
import com.extjs.gxt.ui.client.util.Margins;
|
31 |
import com.extjs.gxt.ui.client.util.Margins;
|
| 30 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
32 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
| - |
|
33 |
import com.extjs.gxt.ui.client.widget.Dialog;
|
| 31 |
import com.extjs.gxt.ui.client.widget.Dialog;
|
34 |
import com.extjs.gxt.ui.client.widget.Html;
|
| 32 |
import com.extjs.gxt.ui.client.widget.Html;
|
35 |
import com.extjs.gxt.ui.client.widget.HtmlContainer;
|
| 33 |
import com.extjs.gxt.ui.client.widget.HtmlContainer;
|
36 |
import com.extjs.gxt.ui.client.widget.Info;
|
| 34 |
import com.extjs.gxt.ui.client.widget.StoreFilterField;
|
37 |
import com.extjs.gxt.ui.client.widget.StoreFilterField;
|
| 35 |
import com.extjs.gxt.ui.client.widget.VerticalPanel;
|
38 |
import com.extjs.gxt.ui.client.widget.VerticalPanel;
|
| 36 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
39 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
| 37 |
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
|
40 |
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
|
| 38 |
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
|
41 |
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
|
| - |
|
42 |
import com.extjs.gxt.ui.client.widget.tree.Tree;
|
| - |
|
43 |
import com.extjs.gxt.ui.client.widget.tree.TreeItem;
|
| - |
|
44 |
import com.google.gwt.core.client.GWT;
|
| - |
|
45 |
import com.google.gwt.http.client.Request;
|
| - |
|
46 |
import com.google.gwt.http.client.RequestBuilder;
|
| - |
|
47 |
import com.google.gwt.http.client.RequestCallback;
|
| - |
|
48 |
import com.google.gwt.http.client.RequestException;
|
| - |
|
49 |
import com.google.gwt.http.client.Response;
|
| - |
|
50 |
import com.google.gwt.json.client.JSONArray;
|
| 39 |
import com.extjs.gxt.ui.client.widget.tree.Tree;
|
51 |
import com.google.gwt.json.client.JSONObject;
|
| Line 40... |
Line 52... |
| 40 |
import com.extjs.gxt.ui.client.widget.tree.TreeItem;
|
52 |
import com.google.gwt.json.client.JSONParser;
|
| Line 41... |
Line 53... |
| 41 |
import com.google.gwt.core.client.GWT;
|
53 |
import com.google.gwt.json.client.JSONValue;
|
| - |
|
54 |
import com.google.gwt.user.client.Event;
|
| 42 |
import com.google.gwt.user.client.Event;
|
55 |
|
| 43 |
|
56 |
public class AideFenetre extends Dialog {
|
| 44 |
public class AideFenetre extends Dialog {
|
57 |
|
| 45 |
|
58 |
private static final String SERVICE_NOM = "CoelAide";
|
| 46 |
private static final String SERVICE_NOM = "CoelAide";
|
59 |
private static final String PAGE_SOMMAIRE_CODE = "AideCoelSommaire";
|
| 47 |
private static final String PAGE_A_OUVRIR_CODE = "AideCoelPresentationGenerale";
|
60 |
private static final String PAGE_A_OUVRIR_CODE = "AideCoelPresentationGenerale";
|
| 48 |
private static Menu pagePrincipale = null;
|
61 |
private static Menu pagePrincipale = null;
|
| - |
|
62 |
private static TreeItem treeItemAOuvrirParDefaut = null;
|
| 49 |
private static TreeItem treeItemAOuvrirParDefaut = null;
|
63 |
private Tree arbre = null;
|
| 50 |
private Tree arbre = null;
|
64 |
private TreeStore<Menu> magazin = null;
|
| 51 |
private TreeStore<Menu> magazin = null;
|
65 |
private TreeBinder<Menu> binder = null;
|
| 52 |
private TreeBinder<Menu> binder = null;
|
66 |
private StoreFilterField<Menu> filtre = null;
|
| 53 |
private StoreFilterField<Menu> filtre = null;
|
67 |
private Menu sommaire = null;
|
| 54 |
private VerticalPanel sommairePanneau = null;
|
68 |
private VerticalPanel sommairePanneau = null;
|
| 55 |
private ContentPanel contenuPanneau = null;
|
69 |
private ContentPanel contenuPanneau = null;
|
| 56 |
private Html contenuHtml = null;
|
70 |
private HtmlContainer conteneurDuHtml;
|
| 57 |
|
71 |
|
| 58 |
public AideFenetre() {
|
72 |
public AideFenetre() {
|
| 59 |
setBodyBorder(false);
|
73 |
setBodyBorder(false);
|
| 60 |
setButtons(Dialog.OK);
|
74 |
setButtons(Dialog.OK);
|
| 61 |
setIconStyle(ComposantClass.ICONE_PANNEAU_LISTE);
|
75 |
setIconStyle(ComposantClass.ICONE_PANNEAU_LISTE);
|
| Line 62... |
Line 76... |
| 62 |
setHeading("COEL - Aide");
|
76 |
setHeading("COEL - Aide");
|
| 63 |
setWidth(675);
|
77 |
setWidth(675);
|
| 64 |
setHeight(400);
|
78 |
setHeight(400);
|
| - |
|
79 |
setHideOnButtonClick(true);
|
| 65 |
setHideOnButtonClick(true);
|
80 |
setLayout(new BorderLayout());
|
| 66 |
setLayout(new BorderLayout());
|
81 |
|
| 67 |
|
82 |
// Panneau Ouest : sommaire
|
| 68 |
// Panneau Ouest : sommaire
|
83 |
sommairePanneau = new VerticalPanel();
|
| 69 |
sommairePanneau = new VerticalPanel();
|
84 |
sommairePanneau.setSpacing(5);
|
| 70 |
sommairePanneau.setSpacing(5);
|
85 |
sommairePanneau.setScrollMode(Scroll.AUTO);
|
| 71 |
// FIXME : plutôt que d'utiliser ce style propre à GXT faudrait utiliser une méthode...
|
86 |
// FIXME : plutôt que d'utiliser ce style propre à GXT faudrait utiliser une méthode...
|
| 72 |
sommairePanneau.setStyleName("x-panel-body");
|
87 |
sommairePanneau.setStyleName("x-panel-body");
|
| Line 73... |
Line 88... |
| 73 |
BorderLayoutData sommaireDisposition = new BorderLayoutData(LayoutRegion.WEST, 200, 175, 250);
|
88 |
BorderLayoutData sommaireDisposition = new BorderLayoutData(LayoutRegion.WEST, 200, 175, 350);
|
| 74 |
sommaireDisposition.setMargins(new Margins(0, 5, 0, 0));
|
89 |
sommaireDisposition.setMargins(new Margins(0, 5, 0, 0));
|
| 75 |
sommaireDisposition.setSplit(true);
|
- |
|
| 76 |
sommaireDisposition.setCollapsible(true);
|
- |
|
| 77 |
sommaireDisposition.setFloatable(true);
|
- |
|
| Line 78... |
Line 90... |
| 78 |
add(sommairePanneau, sommaireDisposition);
|
90 |
sommaireDisposition.setSplit(true);
|
| 79 |
|
91 |
sommaireDisposition.setCollapsible(true);
|
| 80 |
// Chargement de l'arbre du sommaire et de son filtre
|
92 |
sommaireDisposition.setFloatable(true);
|
| 81 |
chargerSommaireArbre();
|
93 |
add(sommairePanneau, sommaireDisposition);
|
| 82 |
attribuerIdAuxTreeItem();
|
94 |
|
| 83 |
sommairePanneau.add(filtre);
|
95 |
// Chargement de l'arbre du sommaire et de son filtre
|
| 84 |
sommairePanneau.add(arbre);
|
- |
|
| 85 |
|
96 |
getSommaireArbreModele();
|
| 86 |
// Panneau Central : contenu
|
97 |
|
| 87 |
contenuPanneau = new ContentPanel();
|
98 |
// Panneau Central : contenu
|
| 88 |
contenuPanneau.setScrollMode(Scroll.AUTO);
|
99 |
contenuPanneau = new ContentPanel();
|
| 89 |
// Barre d'outils
|
100 |
contenuPanneau.setScrollMode(Scroll.AUTO);
|
| 90 |
Button imprimerBtn = new Button(null, new SelectionListener<ComponentEvent>() {
|
101 |
// Barre d'outils
|
| 91 |
public void componentSelected(ComponentEvent ce) {
|
102 |
Button imprimerBtn = new Button(null, new SelectionListener<ComponentEvent>() {
|
| 92 |
//Print.it(contenuHtml.);
|
- |
|
| 93 |
GWT.log(contenuHtml.getHtml(), null);
|
- |
|
| 94 |
}
|
- |
|
| 95 |
});
|
- |
|
| 96 |
imprimerBtn.setIconStyle(ComposantClass.ICONE_IMPRIMER);
|
- |
|
| 97 |
contenuPanneau.getHeader().insertTool(imprimerBtn, 0);
|
- |
|
| 98 |
BorderLayoutData contenuDisposition = new BorderLayoutData(LayoutRegion.CENTER);
|
103 |
public void componentSelected(ComponentEvent ce) {
|
| Line 99... |
Line 104... |
| 99 |
add(contenuPanneau, contenuDisposition);
|
104 |
Print.it(conteneurDuHtml.el().getInnerHtml());
|
| 100 |
|
105 |
}
|
| 101 |
// Chargement de la page racine
|
106 |
});
|
| Line 116... |
Line 121... |
| 116 |
}
|
121 |
}
|
| Line 117... |
Line 122... |
| 117 |
|
122 |
|
| 118 |
private void chargerSommaireArbre() {
|
123 |
private void chargerSommaireArbre() {
|
| 119 |
arbre = new Tree();
|
124 |
arbre = new Tree();
|
| 120 |
arbre.getStyle().setLeafIconStyle(ComposantClass.ICONE_AIDE);
|
- |
|
| 121 |
|
- |
|
| 122 |
magazin = new TreeStore<Menu>();
|
- |
|
| Line 123... |
Line 125... |
| 123 |
magazin.add(getSommaireArbreModele(), true);
|
125 |
arbre.getStyle().setLeafIconStyle(ComposantClass.ICONE_AIDE);
|
| 124 |
|
126 |
|
| 125 |
binder = new TreeBinder<Menu>(arbre, magazin);
|
127 |
binder = new TreeBinder<Menu>(arbre, magazin);
|
| 126 |
binder.setAutoLoad(true);
|
128 |
binder.setAutoLoad(true);
|
| 127 |
binder.setDisplayProperty("nom");
|
129 |
binder.setDisplayProperty("nom");
|
| 128 |
binder.init();
|
- |
|
| 129 |
|
130 |
binder.init();
|
| 130 |
inititialiserSommaireArbreFiltre();
|
131 |
|
| 131 |
filtre.bind(magazin);
|
132 |
filtre.bind(magazin);
|
| 132 |
filtre.setWidth(170);
|
133 |
filtre.setWidth(200);
|
| Line 133... |
Line 134... |
| 133 |
filtre.setToolTip("Filtrer le sommaire");
|
134 |
filtre.setToolTip("Filtrer le sommaire");
|
| 134 |
arbre.addListener(Events.OnClick, new Listener<TreeEvent>(){
|
135 |
arbre.addListener(Events.OnClick, new Listener<TreeEvent>(){
|
| Line 139... |
Line 140... |
| 139 |
selectionSommaire((String) f.getModel().get("code"));
|
140 |
selectionSommaire((String) f.getModel().get("code"));
|
| 140 |
}
|
141 |
}
|
| 141 |
}
|
142 |
}
|
| Line 142... |
Line 143... |
| 142 |
|
143 |
|
| - |
|
144 |
});
|
| - |
|
145 |
|
| 143 |
});
|
146 |
attribuerIdAuxTreeItem();
|
| Line 144... |
Line 147... |
| 144 |
}
|
147 |
}
|
| 145 |
|
148 |
|
| 146 |
private void attribuerIdAuxTreeItem() {
|
149 |
private void attribuerIdAuxTreeItem() {
|
| 147 |
List<TreeItem> liste = arbre.getAllItems();
|
150 |
List<TreeItem> liste = arbre.getAllItems();
|
| 148 |
Iterator<TreeItem> it = liste.iterator();
|
151 |
Iterator<TreeItem> it = liste.iterator();
|
| 149 |
while(it.hasNext()) {
|
152 |
while (it.hasNext()) {
|
| 150 |
TreeItem ti = (TreeItem) it.next();
|
153 |
TreeItem ti = (TreeItem) it.next();
|
| 151 |
if (ti.isLeaf()) {
|
154 |
if (ti.isLeaf()) {
|
| 152 |
String code = (String) ti.getModel().get("code");
|
155 |
String code = (String) ti.getModel().get("code");
|
| Line 193... |
Line 196... |
| 193 |
chargerPageAide(aidePageUrl);
|
196 |
chargerPageAide(aidePageUrl);
|
| 194 |
}
|
197 |
}
|
| Line 195... |
Line 198... |
| 195 |
|
198 |
|
| 196 |
private void chargerPageAide(String url) {
|
199 |
private void chargerPageAide(String url) {
|
| 197 |
GWT.log("Charger : "+url, null);
|
200 |
GWT.log("Charger : "+url, null);
|
| 198 |
HtmlContainer conteneurDuHtml = new HtmlContainer() {
|
201 |
conteneurDuHtml = new HtmlContainer() {
|
| 199 |
public void onBrowserEvent(Event e) {
|
202 |
public void onBrowserEvent(Event e) {
|
| 200 |
// Nous vérifions que l'évenement est un clic et qu'il a lieu sur un lien
|
203 |
// Nous vérifions que l'évenement est un clic et qu'il a lieu sur un lien
|
| 201 |
if (e.getTypeInt() == Event.ONCLICK && e.getTarget().getTagName().equals("A")) {
|
204 |
if (e.getTypeInt() == Event.ONCLICK && e.getTarget().getTagName().equals("A")) {
|
| 202 |
e.preventDefault();
|
205 |
e.preventDefault();
|
| Line 215... |
Line 218... |
| 215 |
conteneurDuHtml.setWidth(400);
|
218 |
conteneurDuHtml.setWidth(400);
|
| 216 |
conteneurDuHtml.sinkEvents(Event.ONCLICK);
|
219 |
conteneurDuHtml.sinkEvents(Event.ONCLICK);
|
| 217 |
conteneurDuHtml.setUrl(url);
|
220 |
conteneurDuHtml.setUrl(url);
|
| 218 |
conteneurDuHtml.recalculate();
|
221 |
conteneurDuHtml.recalculate();
|
| Line 219... |
Line -... |
| 219 |
|
- |
|
| 220 |
|
- |
|
| 221 |
|
222 |
|
| 222 |
contenuPanneau.removeAll();
|
223 |
contenuPanneau.removeAll();
|
| 223 |
contenuPanneau.add(conteneurDuHtml);
|
224 |
contenuPanneau.add(conteneurDuHtml);
|
| 224 |
contenuPanneau.layout();
|
225 |
contenuPanneau.layout();
|
| Line 239... |
Line 240... |
| 239 |
return retour;
|
240 |
return retour;
|
| 240 |
}
|
241 |
}
|
| 241 |
};
|
242 |
};
|
| 242 |
}
|
243 |
}
|
| Line 243... |
Line -... |
| 243 |
|
- |
|
| 244 |
|
244 |
|
| - |
|
245 |
public void getSommaireArbreModele() {
|
| 245 |
public static Menu getSommaireArbreModele() {
|
246 |
String serviceUrl = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl();
|
| 246 |
// TODO : charger automatiquement l'arbre depuis le contenu de la page wikini de sommaire...
|
247 |
String sommairePageUrl = serviceUrl+SERVICE_NOM+"/"+PAGE_SOMMAIRE_CODE+"/sommaire";
|
| - |
|
248 |
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, sommairePageUrl);
|
| 247 |
pagePrincipale = new Menu("Accueil", "AideCoelAccueil");
|
249 |
try {
|
| - |
|
250 |
rb.sendRequest(null, new RequestCallback() {
|
| 248 |
Menu[] menus = new Menu[] {
|
251 |
|
| 249 |
new Menu("Débuter avec COEL", new BaseTreeModel[] {
|
252 |
public void onError(Request request, Throwable exception) {
|
| 250 |
new Menu("Présentation rapide", "AideCoelPresentationGenerale"),
|
253 |
// Gestion des exceptions déclenchées par l'exécution de la requête
|
| 251 |
new Menu("Comment s'identifier", "AideCoelCommentIdentifier"),
|
254 |
GWT.log("Erreur à l'exécution du service "+SERVICE_NOM+" (selection)", exception);
|
| 252 |
new Menu("Pourquoi s'identifier", "AideCoelPourquoiIdentifier")
|
255 |
Info.display("Erreur de Requête", "Une erreur s'est produite lors de l'exécution de la requête.");
|
| - |
|
256 |
}
|
| 253 |
}),
|
257 |
|
| 254 |
new Menu("Les menus", new BaseTreeModel[] {
|
258 |
public void onErrorHTTP(Request request, Response reponse) {
|
| 255 |
new Menu("Institutions", "AideCoelInstitution"),
|
259 |
// Gestion des erreurs HTTP renvoyé par Apache ou JRest
|
| 256 |
new Menu("Collections", "AideCoelCollection"),
|
260 |
Information info = new Information("erreur_jrest", JSONParser.parse(reponse.getText()).isArray());
|
| 257 |
new Menu("Personnes", "AideCoelPersonne"),
|
261 |
GWT.log("Erreur JREST - Code "+reponse.getStatusCode()+"\n"+info.getMessages().toString(), null);
|
| 258 |
new Menu("Publications", "AideCoelPublication")
|
262 |
Info.display("Erreur JREST - Code "+reponse.getStatusCode(), info.toString());
|
| - |
|
263 |
}
|
| 259 |
}),
|
264 |
|
| - |
|
265 |
public void onResponseReceived(Request request, Response response) {
|
| 260 |
new Menu("Aller plus loin...", new BaseTreeModel[] {
|
266 |
// Si le code de réponse HTTP ne vaut pas 200 OK, on lance le mécanise d'erreur HTTP
|
| 261 |
new Menu("Régler les paramêtres", "AideCoelParametre"),
|
267 |
if (response.getStatusCode() != 200) {
|
| 262 |
new Menu("Modifier ses préférences", "AideCoelPreference")
|
268 |
onErrorHTTP(request, response);
|
| - |
|
269 |
} else {
|
| - |
|
270 |
if (response.getText().length() != 0 && response.getText() != null) {
|
| - |
|
271 |
final JSONValue responseValue = JSONParser.parse(response.getText());
|
| 263 |
})
|
272 |
JSONArray jsonArray = responseValue.isArray();
|
| - |
|
273 |
|
| - |
|
274 |
if (jsonArray != null) {
|
| - |
|
275 |
sommaire = new Menu("Sommaire");
|
| 264 |
};
|
276 |
ajouterMenuRecursivement(sommaire, jsonArray);
|
| - |
|
277 |
|
| 265 |
|
278 |
magazin = new TreeStore<Menu>();
|
| - |
|
279 |
magazin.add(sommaire, true);
|
| 266 |
Menu racine = pagePrincipale;
|
280 |
|
| 267 |
for (int i = 0; i < menus.length; i++) {
|
281 |
inititialiserSommaireArbreFiltre();
|
| - |
|
282 |
chargerSommaireArbre();
|
| - |
|
283 |
|
| - |
|
284 |
sommairePanneau.add(filtre);
|
| - |
|
285 |
sommairePanneau.add(arbre);
|
| - |
|
286 |
sommairePanneau.layout();
|
| - |
|
287 |
// Chargement de la page racine
|
| - |
|
288 |
selectionSommaire(pagePrincipale.getCode());
|
| - |
|
289 |
etendreArbre(treeItemAOuvrirParDefaut);
|
| - |
|
290 |
} else {
|
| - |
|
291 |
GWT.log("\n\tLa réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString(), null);
|
| - |
|
292 |
}
|
| - |
|
293 |
}
|
| - |
|
294 |
}
|
| - |
|
295 |
}
|
| - |
|
296 |
});
|
| - |
|
297 |
} catch (RequestException e) {
|
| 268 |
racine.add((Menu) menus[i]);
|
298 |
e.printStackTrace();
|
| 269 |
}
|
- |
|
| 270 |
|
- |
|
| 271 |
return racine;
|
299 |
}
|
| Line -... |
Line 300... |
| - |
|
300 |
}
|
| - |
|
301 |
|
| 272 |
}
|
302 |
private void ajouterMenuRecursivement(Menu brancheSommaire, JSONArray tableau) {
|
| - |
|
303 |
final int tailleMax = tableau.size();
|
| - |
|
304 |
|
| - |
|
305 |
for (int i = 0; i < tailleMax; i++) {
|
| - |
|
306 |
JSONObject pageCourante = tableau.get(i).isObject() ;
|
| 273 |
|
307 |
if (pageCourante != null) {
|
| 274 |
|
308 |
Menu menuCourrant = new Menu();
|
| - |
|
309 |
|
| 275 |
/**
|
310 |
if (pageCourante.get("code") != null) {
|
| - |
|
311 |
menuCourrant.setCode(pageCourante.get("code").isString().stringValue());
|
| - |
|
312 |
}
|
| 276 |
* Sur une fermeture on fait un fadeOut.
|
313 |
if (pageCourante.get("txt") != null) {
|
| 277 |
*
|
314 |
menuCourrant.setNom(pageCourante.get("txt").isString().stringValue());
|
| 278 |
*/
|
315 |
}
|
| - |
|
316 |
|
| - |
|
317 |
if (menuCourrant.getNom() == null && menuCourrant.getCode() == null) {
|
| 279 |
/*
|
318 |
menuCourrant = (Menu) brancheSommaire.getChild((brancheSommaire.getChildCount() - 1));
|
| 280 |
protected void onButtonPressed(Button btn) {
|
319 |
} else {
|
| - |
|
320 |
if (brancheSommaire != null) {
|
| 281 |
if (this.isHideOnButtonClick()) {
|
321 |
brancheSommaire.add(menuCourrant);
|
| 282 |
// FIXME : apparament le fade In/Fade Out pose problème sur les navigateurs...
|
322 |
if (pagePrincipale == null) {
|
| - |
|
323 |
pagePrincipale = menuCourrant;
|
| - |
|
324 |
}
|
| - |
|
325 |
}
|
| 283 |
//this.el().fadeOut(FxConfig.NONE);
|
326 |
}
|
| - |
|
327 |
|
| - |
|
328 |
if (pageCourante.get("liste") != null) {
|
| - |
|
329 |
ajouterMenuRecursivement(menuCourrant, pageCourante.get("liste").isArray());
|
| 284 |
} else {
|
330 |
}
|
| 285 |
super.onButtonPressed(btn);
|
331 |
}
|
| 286 |
}
|
332 |
}
|
| 287 |
}*/
|
333 |
}
|