Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 14 | Go to most recent revision | Details | Last modification | View Log | RSS feed

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