Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 14 | Rev 27 | Go to most recent revision | Details | Compare with Previous | 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
 
14 ddelon 33
  private Mediator mediator=null;
13 ddelon 34
 
35
  private TextBox search = null;
36
 
37
 
38
  public SearchPanel(final Mediator med) {
39
 
40
   HorizontalPanel outer=new HorizontalPanel();
41
 
42
   mediator=med;
43
 
44
 
45
   search = new TextBox();
46
 
47
 
48
	// Recherche
49
 
14 ddelon 50
	HTML searchButton=new HTML("Rechercher dans les relevés");
51
	searchButton.setStyleName("html_button_long");
13 ddelon 52
	searchButton.addClickListener(
53
	    	new ClickListener() {
54
	    		public void onClick(Widget sender) {
55
	    			  mediator.onSearch(search.getText());
56
	    		}
57
	     	}
58
	);
59
 
60
 
61
	  search.addKeyboardListener( new KeyboardListener() {
62
 
63
		  public void onKeyDown(Widget arg0, char arg1, int arg2) {
64
 
65
 
66
			  if(arg1 == KEY_ENTER)
67
			    {
68
	  			 mediator.onSearch(search.getText());
69
			    }
70
 
71
		  }
72
 
73
		  public void onKeyUp(Widget arg0, char arg1, int arg2) {
74
		  }
75
 
76
		  public void onKeyPress(Widget arg0, char arg1, int arg2) {
77
		  }
78
 
79
		  }
80
  );
81
 
82
 
83
 
84
   outer.setSpacing(5);
85
   outer.add(search);
86
 
87
   outer.add(searchButton);
88
 
89
 
90
 
91
    initWidget(outer);
92
 
93
 
94
  }
95
 
96
 
97
}