Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 13 | Rev 23 | 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
   mediator.registerSearchPanel(this);
45
 
46
   search = new TextBox();
47
 
48
 
49
	// Recherche
50
 
14 ddelon 51
	HTML searchButton=new HTML("Rechercher dans les relevés");
52
	searchButton.setStyleName("html_button_long");
13 ddelon 53
	searchButton.addClickListener(
54
	    	new ClickListener() {
55
	    		public void onClick(Widget sender) {
56
	    			  mediator.onSearch(search.getText());
57
	    		}
58
	     	}
59
	);
60
 
61
 
62
	  search.addKeyboardListener( new KeyboardListener() {
63
 
64
		  public void onKeyDown(Widget arg0, char arg1, int arg2) {
65
 
66
 
67
			  if(arg1 == KEY_ENTER)
68
			    {
69
	  			 mediator.onSearch(search.getText());
70
			    }
71
 
72
		  }
73
 
74
		  public void onKeyUp(Widget arg0, char arg1, int arg2) {
75
		  }
76
 
77
		  public void onKeyPress(Widget arg0, char arg1, int arg2) {
78
		  }
79
 
80
		  }
81
  );
82
 
83
 
84
 
85
   outer.setSpacing(5);
86
   outer.add(search);
87
 
88
   outer.add(searchButton);
89
 
90
 
91
 
92
    initWidget(outer);
93
 
94
 
95
  }
96
 
97
 
98
}