1,17 → 1,16 |
/** |
David Delon david.delon@clapas.net 2007 |
|
*/ |
|
/* |
* Copyright 2006 Google Inc. |
* TopPanel.java : affichage information portant sur le statut de la connexion utilisateur |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not |
* use this file except in compliance with the License. You may obtain a copy of |
* the License at |
* |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
* License for the specific language governing permissions and limitations under |
* the License. |
* 1: Le programme affiche le statut connecte si l'utilisateur s'est connecte precedemment, sinon s'affiche le statut deconnecte |
* 2: Le programme arme les actions liees a la connection ou a la deconnection |
* - Connection : affichage de la boite de connexion |
* - Deconnexion : appel du service de deconnexion, et appel de la re-initialisation de l'affichage pour le nouvel identifiant utilisateur obtenu (identifiant de session) |
*/ |
package org.tela_botanica.client; |
|
30,11 → 29,7 |
import com.google.gwt.user.client.ui.Label; |
import com.google.gwt.user.client.ui.Widget; |
|
/** |
* Composite permet de wrapper des Widget pour creer un nouveau Widget cf methode initWidget() |
*/ |
|
|
public class TopPanel extends Composite { |
|
|
76,10 → 71,14 |
inner.setSpacing(3); |
outer.add(inner); |
|
|
|
signLabel.addClickListener( |
new ClickListener() { |
public void onClick(Widget sender) { |
|
// Non connecte ? Lien vers boite de connection |
|
if (!mediator.getConnected()) { |
LoginDialog loginDialog = new LoginDialog(med); |
|
91,7 → 90,8 |
} |
|
else { |
|
|
// Deja Connecte : lancement deconnexion sur selection de l'action |
HTTPRequest.asyncGet(serviceBaseUrl + "/User/" + user , |
new ResponseTextHandler() { |
|
100,11 → 100,11 |
JSONValue jsonValue = JSONParser.parse(str); |
JSONArray jsonArray; |
if ((jsonArray = jsonValue.isArray()) != null) { |
user = ((JSONString) jsonArray.get(0)).stringValue(); |
user = ((JSONString) jsonArray.get(0)).stringValue(); // Identifiant utilisateur : identifant de session |
mediator.setConnected(((JSONBoolean) jsonArray.get(1)).booleanValue()); |
} |
|
if (!mediator.getConnected()) { |
if (!mediator.getConnected()) { // La deconnexion a ete accepte : |
mediator.onLogoff(user); |
} |
} |
129,3 → 129,9 |
|
|
} |
|
|
/* +--Fin du code ---------------------------------------------------------------------------------------+ |
* $Log$ |
* |
*/ |