Subversion Repositories eFlore/Archives.cel-v1

Rev

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

Rev 25 Rev 26
Line 20... Line 20...
20
import com.google.gwt.json.client.JSONParser;
20
import com.google.gwt.json.client.JSONParser;
21
import com.google.gwt.json.client.JSONString;
21
import com.google.gwt.json.client.JSONString;
22
import com.google.gwt.json.client.JSONValue;
22
import com.google.gwt.json.client.JSONValue;
23
import com.google.gwt.user.client.HTTPRequest;
23
import com.google.gwt.user.client.HTTPRequest;
24
import com.google.gwt.user.client.ResponseTextHandler;
24
import com.google.gwt.user.client.ResponseTextHandler;
-
 
25
import com.google.gwt.user.client.Window;
-
 
26
import com.google.gwt.user.client.ui.HorizontalPanel;
25
import com.google.gwt.user.client.ui.Image;
27
import com.google.gwt.user.client.ui.Image;
26
import com.google.gwt.user.client.ui.PopupPanel;
28
import com.google.gwt.user.client.ui.PopupPanel;
-
 
29
import com.google.gwt.user.client.ui.VerticalPanel;
Line 27... Line 30...
27
 
30
 
28
/**
31
/**
29
 * Composite permet de wrapper des Widget pour creer un nouveau Widget cf methode initWidget()
32
 * Composite permet de wrapper des Widget pour creer un nouveau Widget cf methode initWidget()
Line 30... Line 33...
30
 */
33
 */
Line 31... Line 34...
31
 
34
 
32
public class InfoPopup extends PopupPanel   {
35
public class InfoPopup extends PopupPanel   {
-
 
36
	
Line 33... Line 37...
33
	
37
  private Mediator mediator=null;
Line 34... Line 38...
34
  private Mediator mediator=null;
38
  private Image imageTop = new Image();
Line 35... Line 39...
35
  private Image image = new Image();
39
  private Image imageBottom = new Image();
Line -... Line 40...
-
 
40
  
-
 
41
  public InfoPopup(final Mediator med) {
Line -... Line 42...
-
 
42
 
36
  
43
   super(true);
Line 37... Line -...
37
  public InfoPopup(final Mediator med) {
-
 
38
 
44
   
-
 
45
   mediator=med;
Line -... Line 46...
-
 
46
   
Line 39... Line 47...
39
   super(true);
47
   imageBottom.setPixelSize(150,150);
Line 40... Line -...
40
   
-
 
41
   mediator=med;
-
 
42
   
-
 
43
   
-
 
44
   mediator.registerInfoPopup(this);
-
 
45
   
-
 
46
   
-
 
47
   add(image);
-
 
48
 
-
 
49
    
-
 
50
  }
-
 
51
 
-
 
Line 52... Line 48...
52
  public void setImage(String url) {
48
   imageTop.setPixelSize(150,150);
Line 53... Line 49...
53
		if (url.compareTo("null")!=0) {
49
   
54
		  setPopupPosition(mediator.getLeftPanel().getAbsoluteLeft()+10, mediator.getLeftPanel().getAbsoluteTop()  + (mediator.getLeftPanel().getOffsetHeight()/2));
50
 //  HorizontalPanel panel = new    HorizontalPanel();
Line 72... Line 68...
72
						JSONValue jsonValue = JSONParser.parse(strcomplete);
68
						JSONValue jsonValue = JSONParser.parse(strcomplete);
73
						JSONArray jsonArray;
69
						JSONArray jsonArray;
Line 74... Line 70...
74
 
70
 
75
						if ((jsonArray = jsonValue.isArray()) != null) {
71
						if ((jsonArray = jsonValue.isArray()) != null) {
76
							// Url Image
72
							// Url Image
77
							setImage(((JSONString) jsonArray.get(0)).stringValue());
73
							setImageTop(((JSONString) jsonArray.get(0)).stringValue());
78
						}
74
						}
Line 79... Line 75...
79
					}
75
					}
-
 
76
 
-
 
77
				});
-
 
78
		
-
 
79
		
-
 
80
		HTTPRequest.asyncGet(mediator.getServiceBaseUrl() + "/NameMap/" + value,
-
 
81
				new ResponseTextHandler() {
-
 
82
 
-
 
83
					public void onCompletion(String strcomplete) {
-
 
84
 
-
 
85
						JSONValue jsonValue = JSONParser.parse(strcomplete);
-
 
86
						JSONArray jsonArray;
-
 
87
 
-
 
88
						if ((jsonArray = jsonValue.isArray()) != null) {
-
 
89
							// Url Image
-
 
90
							setImageBottom(((JSONString) jsonArray.get(0)).stringValue());
-
 
91
						}
-
 
92
					}
-
 
93
 
-
 
94
				});
-
 
95
  }	
-
 
96
 
-
 
97
  
-
 
98
  public void setImageTop(String url) {
-
 
99
		if (url.compareTo("null")!=0) {
-
 
100
//			setPopupPosition(3*(Window.getClientWidth()/4), mediator.getInventoryItemList().getAbsoluteTop()+50);	
-
 
101
			
-
 
102
		  setPopupPosition(mediator.getLeftPanel().getAbsoluteLeft()+10, mediator.getLeftPanel().getAbsoluteTop()  + (mediator.getLeftPanel().getOffsetHeight()/2));
-
 
103
		  show();
-
 
104
		  imageTop.setUrl(url);
-
 
105
		}
80
 
106
		else  {
Line -... Line 107...
-
 
107
		  hide();
-
 
108
		}
-
 
109
 
-
 
110
	}
-
 
111
 
-
 
112
  
-
 
113
  public void setImageBottom(String url) {
-
 
114
		if (url.compareTo("null")!=0) {
-
 
115
//			setPopupPosition(3*(Window.getClientWidth()/4), mediator.getInventoryItemList().getAbsoluteTop()+50);	
-
 
116
	  setPopupPosition(mediator.getLeftPanel().getAbsoluteLeft()+10, mediator.getLeftPanel().getAbsoluteTop()  + (mediator.getLeftPanel().getOffsetHeight()/2));
-
 
117
		  show();
-
 
118
		  imageBottom.setUrl(url);
-
 
119
		}
-
 
120
		else  {
-
 
121
		  hide();
-
 
122
		}
-
 
123
 
81
				});
124
	}