Subversion Repositories eFlore/Archives.cel-v1

Rev

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

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