Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 25 | Rev 27 | Go to most recent revision | Show entire file | Regard 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 -... Line 44...
-
 
44
   
-
 
45
   mediator=med;
Line 37... Line 46...
37
  public InfoPopup(final Mediator med) {
46
   
38
 
-
 
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
 
-
 
Line -... Line 48...
-
 
48
   imageTop.setPixelSize(150,150);
-
 
49
   
-
 
50
 //  HorizontalPanel panel = new    HorizontalPanel();
-
 
51
   VerticalPanel panel = new    VerticalPanel();
-
 
52
   
-
 
53
   panel.add(imageTop);
-
 
54
   panel.add(imageBottom);
-
 
55
 
-
 
56
   add(panel);
-
 
57
    
-
 
58
  }
-
 
59
 
-
 
60
  
-
 
61
  public void setImageUrl(String value) {
49
    
62
		
Line -... Line 63...
-
 
63
		HTTPRequest.asyncGet(mediator.getServiceBaseUrl() + "/NameImage/" + value,
Line 50... Line -...
50
  }
-
 
Line 51... Line 64...
51
 
64
				new ResponseTextHandler() {
52
  public void setImage(String url) {
65
 
Line 53... Line 66...
53
		if (url.compareTo("null")!=0) {
66
					public void onCompletion(String strcomplete) {
Line 54... Line 67...
54
		  setPopupPosition(mediator.getLeftPanel().getAbsoluteLeft()+10, mediator.getLeftPanel().getAbsoluteTop()  + (mediator.getLeftPanel().getOffsetHeight()/2));
67
 
55
		  show();
68
						JSONValue jsonValue = JSONParser.parse(strcomplete);
Line 56... Line 69...
56
		  image.setUrl(url);
69
						JSONArray jsonArray;
57
		}
70
 
58
		else  {
71
						if ((jsonArray = jsonValue.isArray()) != null) {
59
		  hide();
72
							// Url Image
60
		}
73
							setImageTop(((JSONString) jsonArray.get(0)).stringValue());
Line 61... Line 74...
61
 
74
						}
62
	}
75
					}
Line -... Line 76...
-
 
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
		}
63
 
106
		else  {