Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 13 | Rev 23 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 13 Rev 14
1
/*
1
/*
2
 * Copyright 2006 Google Inc.
2
 * Copyright 2006 Google Inc.
3
 * 
3
 * 
4
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
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
5
 * use this file except in compliance with the License. You may obtain a copy of
6
 * the License at
6
 * the License at
7
 * 
7
 * 
8
 * http://www.apache.org/licenses/LICENSE-2.0
8
 * http://www.apache.org/licenses/LICENSE-2.0
9
 * 
9
 * 
10
 * Unless required by applicable law or agreed to in writing, software
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
 * License for the specific language governing permissions and limitations under
13
 * License for the specific language governing permissions and limitations under
14
 * the License.
14
 * the License.
15
 */
15
 */
16
package org.tela_botanica.client;
16
package org.tela_botanica.client;
17
 
17
 
18
 
18
 
19
import com.google.gwt.user.client.ui.ClickListener;
19
import com.google.gwt.user.client.ui.ClickListener;
20
import com.google.gwt.user.client.ui.Composite;
20
import com.google.gwt.user.client.ui.Composite;
21
import com.google.gwt.user.client.ui.HTML;
21
import com.google.gwt.user.client.ui.HTML;
22
import com.google.gwt.user.client.ui.HorizontalPanel;
22
import com.google.gwt.user.client.ui.HorizontalPanel;
23
import com.google.gwt.user.client.ui.KeyboardListener;
23
import com.google.gwt.user.client.ui.KeyboardListener;
24
import com.google.gwt.user.client.ui.TextBox;
24
import com.google.gwt.user.client.ui.TextBox;
25
import com.google.gwt.user.client.ui.Widget;
25
import com.google.gwt.user.client.ui.Widget;
26
 
26
 
27
/**
27
/**
28
 * Composite permet de wrapper des Widget pour creer un nouveau Widget cf methode initWidget()
28
 * Composite permet de wrapper des Widget pour creer un nouveau Widget cf methode initWidget()
29
 */
29
 */
30
 
30
 
31
public class SearchPanel extends Composite   {
31
public class SearchPanel extends Composite   {
32
	
32
	
33
  Mediator mediator=null;
-
 
34
  private String serviceBaseUrl = null;
-
 
35
  
33
  private Mediator mediator=null;
36
  private String user= null;
34
  
37
  private TextBox search = null;
35
  private TextBox search = null;
38
 
36
 
39
 
37
 
40
  public SearchPanel(final Mediator med) {
38
  public SearchPanel(final Mediator med) {
41
 
39
 
42
   HorizontalPanel outer=new HorizontalPanel();
40
   HorizontalPanel outer=new HorizontalPanel();
43
	  
41
	  
44
   mediator=med;
42
   mediator=med;
45
 
43
 
46
   mediator.registerSearchPanel(this);
44
   mediator.registerSearchPanel(this);
47
  
45
  
48
   search = new TextBox();
46
   search = new TextBox();
49
   
47
   
50
   
48
   
51
	// Recherche
49
	// Recherche
52
	
50
	
53
	HTML searchButton=new HTML("Rechercher");
51
	HTML searchButton=new HTML("Rechercher dans les relevés");
54
	searchButton.setStyleName("html_button");
52
	searchButton.setStyleName("html_button_long");
55
	searchButton.addClickListener(
53
	searchButton.addClickListener(
56
	    	new ClickListener() {
54
	    	new ClickListener() {
57
	    		public void onClick(Widget sender) {
55
	    		public void onClick(Widget sender) {
58
	    			  mediator.onSearch(search.getText());
56
	    			  mediator.onSearch(search.getText());
59
	    		}
57
	    		}
60
	     	}
58
	     	}
61
	);		
59
	);		
62
	
60
	
63
	
61
	
64
	  search.addKeyboardListener( new KeyboardListener() {
62
	  search.addKeyboardListener( new KeyboardListener() {
65
 
63
 
66
		  public void onKeyDown(Widget arg0, char arg1, int arg2) {
64
		  public void onKeyDown(Widget arg0, char arg1, int arg2) {
67
			  
65
			  
68
			  
66
			  
69
			  if(arg1 == KEY_ENTER)
67
			  if(arg1 == KEY_ENTER)
70
			    {
68
			    {
71
	  			 mediator.onSearch(search.getText());
69
	  			 mediator.onSearch(search.getText());
72
			    }
70
			    }
73
 
71
 
74
		  }
72
		  }
75
		  
73
		  
76
		  public void onKeyUp(Widget arg0, char arg1, int arg2) {
74
		  public void onKeyUp(Widget arg0, char arg1, int arg2) {
77
		  }
75
		  }
78
 
76
 
79
		  public void onKeyPress(Widget arg0, char arg1, int arg2) {
77
		  public void onKeyPress(Widget arg0, char arg1, int arg2) {
80
		  }
78
		  }
81
		  
79
		  
82
		  }
80
		  }
83
  );
81
  );
84
	
82
	
85
	
83
	
86
 
84
 
87
   outer.setSpacing(5);
85
   outer.setSpacing(5);
88
   outer.add(search);
86
   outer.add(search);
89
   
87
   
90
   outer.add(searchButton);
88
   outer.add(searchButton);
91
   
-
 
92
   user=mediator.getUser();
-
 
93
   serviceBaseUrl = mediator.getServiceBaseUrl();
-
 
94
 
89
   
95
   
90
   
96
 
91
 
97
    initWidget(outer);
92
    initWidget(outer);
98
   
93
   
99
    
94
    
100
  }
95
  }
101
 
96
 
102
 
97
 
103
}
98
}