Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 14 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14 Rev 26
Line -... Line 1...
-
 
1
/**
-
 
2
 David Delon david.delon@clapas.net 2007
-
 
3
 
-
 
4
 */
-
 
5
 
1
/*
6
/*
2
 * Copyright 2006 Google Inc.
-
 
3
 * 
-
 
4
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
-
 
5
 * use this file except in compliance with the License. You may obtain a copy of
7
 * TopPanel.java  : affichage information portant sur le statut de la connexion utilisateur
6
 * the License at
-
 
7
 * 
8
 * 
8
 * http://www.apache.org/licenses/LICENSE-2.0
-
 
9
 * 
9
 * 
10
 * Unless required by applicable law or agreed to in writing, software
10
 * 1: Le programme affiche le statut connecte si l'utilisateur s'est connecte precedemment, sinon s'affiche le statut deconnecte
11
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
 * 2: Le programme arme les actions liees a la connection ou a la deconnection
12
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
 *    - Connection : affichage de la boite de connexion
13
 * License for the specific language governing permissions and limitations under
13
 *    - Deconnexion : appel du service de deconnexion, et appel de la re-initialisation de l'affichage pour le nouvel identifiant utilisateur obtenu (identifiant  de session)
14
 * the License.
-
 
15
 */
14
 */
16
package org.tela_botanica.client;
15
package org.tela_botanica.client;
Line 17... Line 16...
17
 
16
 
18
import com.google.gwt.json.client.JSONArray;
17
import com.google.gwt.json.client.JSONArray;
Line 28... Line 27...
28
import com.google.gwt.user.client.ui.HTML;
27
import com.google.gwt.user.client.ui.HTML;
29
import com.google.gwt.user.client.ui.HorizontalPanel;
28
import com.google.gwt.user.client.ui.HorizontalPanel;
30
import com.google.gwt.user.client.ui.Label;
29
import com.google.gwt.user.client.ui.Label;
31
import com.google.gwt.user.client.ui.Widget;
30
import com.google.gwt.user.client.ui.Widget;
Line 32... Line -...
32
 
-
 
33
/**
-
 
34
 * Composite permet de wrapper des Widget pour creer un nouveau Widget cf methode initWidget()
-
 
35
 */
-
 
Line 36... Line 31...
36
 
31
 
Line 37... Line 32...
37
 
32
 
Line 74... Line 69...
74
	 inner.add(new HTML("<b>Carnet en ligne</b>"));
69
	 inner.add(new HTML("<b>Carnet en ligne</b>"));
Line 75... Line 70...
75
	 
70
	 
76
	 inner.setSpacing(3);
71
	 inner.setSpacing(3);
Line -... Line 72...
-
 
72
	 outer.add(inner);
-
 
73
 
77
	 outer.add(inner);
74
	 
78
 
75
	 
79
	 signLabel.addClickListener(
76
	 signLabel.addClickListener(
Line -... Line 77...
-
 
77
		    	new ClickListener() {
-
 
78
		    		public void onClick(Widget sender) {
80
		    	new ClickListener() {
79
		    
81
		    		public void onClick(Widget sender) {
80
		    			// Non connecte ? Lien vers boite de connection
Line 82... Line 81...
82
		    
81
		    			
83
		    			if (!mediator.getConnected()) {
82
		    			if (!mediator.getConnected()) {
Line 89... Line 88...
89
		    				loginDialog.setPopupPosition(left, top);
88
		    				loginDialog.setPopupPosition(left, top);
90
		    				loginDialog.show();
89
		    				loginDialog.show();
91
		    			}
90
		    			}
Line 92... Line 91...
92
		    			
91
		    			
93
		    			else {
92
		    			else {
-
 
93
		    			
94
		    				
94
		    				// Deja Connecte : lancement deconnexion sur selection de l'action
95
			    			HTTPRequest.asyncGet(serviceBaseUrl + "/User/" + user    ,
95
			    			HTTPRequest.asyncGet(serviceBaseUrl + "/User/" + user    ,
Line 96... Line 96...
96
			    					new ResponseTextHandler() {
96
			    					new ResponseTextHandler() {
Line 97... Line 97...
97
 
97
 
98
			    						public void onCompletion(String str) {
98
			    						public void onCompletion(String str) {
99
			    							
99
			    							
100
			    								JSONValue jsonValue = JSONParser.parse(str);
100
			    								JSONValue jsonValue = JSONParser.parse(str);
101
			    								JSONArray jsonArray;
101
			    								JSONArray jsonArray;
102
			    								if ((jsonArray = jsonValue.isArray()) != null) {
102
			    								if ((jsonArray = jsonValue.isArray()) != null) {
Line 103... Line 103...
103
			    									user = ((JSONString) jsonArray.get(0)).stringValue();
103
			    									user = ((JSONString) jsonArray.get(0)).stringValue(); // Identifiant utilisateur : identifant de session
104
			    									mediator.setConnected(((JSONBoolean) jsonArray.get(1)).booleanValue());
104
			    									mediator.setConnected(((JSONBoolean) jsonArray.get(1)).booleanValue());
105
			    								}
105
			    								}
106
 
106
 
107
			    								if (!mediator.getConnected()) {
107
			    								if (!mediator.getConnected()) { // La deconnexion a ete accepte :
Line 127... Line 127...
127
 
127
 
-
 
128
  
-
 
129
 
-
 
130
  
-
 
131
}
-
 
132
 
-
 
133