Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 4 | Rev 7 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4 Rev 6
Line 53... Line 53...
53
  protected PopupPanel choicesPopup = new PopupPanel(true);
53
  protected PopupPanel choicesPopup = new PopupPanel(true);
54
  protected ListBox choices = new ListBox();
54
  protected ListBox choices = new ListBox();
55
  protected Vector items = new Vector(); 
55
  protected Vector items = new Vector(); 
56
  protected boolean popupAdded = false;
56
  protected boolean popupAdded = false;
57
  protected boolean visible = false;
57
  protected boolean visible = false;
58
  protected int current = -1;
58
  protected String currentValue = null;
Line 59... Line 59...
59
   
59
   
60
   
60
   
61
  /**
61
  /**
Line 174... Line 174...
174
        complete();
174
        complete();
175
      }
175
      }
176
      else {
176
      else {
177
    	 // Validation de l'entree : 
177
    	 // Validation de l'entree : 
178
          if (autoCompleteAsyncTextBoxListeners!= null) {
178
          if (autoCompleteAsyncTextBoxListeners!= null) {
179
              autoCompleteAsyncTextBoxListeners.fireTextBoxEnter(this,current, this.getText());
179
              autoCompleteAsyncTextBoxListeners.fireTextBoxEnter(this,this.getText(),currentValue);
180
          }
180
          }
181
    	  current=-1;
181
    	  currentValue=null;
182
    	  this.setText("");
182
    	  this.setText("");
183
      }
183
      }
Line 184... Line 184...
184
           
184
           
185
      return;
185
      return;
Line 226... Line 226...
226
	      
226
	      
Line 227... Line 227...
227
	      choices.clear();
227
	      choices.clear();
228
	           
228
	           
229
	      for(int i = 0; i < items.size(); i++)
229
	      for(int i = 0; i < items.size(); i++)
230
	      {
230
	      {
Line 231... Line 231...
231
	        choices.addItem((String) items.get(i));
231
	        choices.addItem(((String [])items.get(i))[0],((String [])items.get(i))[1]);
232
	      }
232
	      }
233
	      
233
	      
234
	           
234
	           
235
	      // if there is only one match and it is what is in the
235
	      // if there is only one match and it is what is in the
236
	      // text field anyways there is no need to show autocompletion
236
	      // text field anyways there is no need to show autocompletion
237
	      if(items.size() == 1 && ((String) items.get(0)).compareTo(this.getText()) == 0)
237
	      if(items.size() == 1 && (((String []) items.get(0))[0]).compareTo(this.getText()) == 0)
238
	      {
238
	      {
Line 275... Line 275...
275
  protected void complete()
275
  protected void complete()
276
  {
276
  {
277
    if(choices.getItemCount() > 0)
277
    if(choices.getItemCount() > 0)
278
    {
278
    {
279
      this.setText(choices.getItemText(choices.getSelectedIndex()));
279
      this.setText(choices.getItemText(choices.getSelectedIndex()));
280
      current=choices.getSelectedIndex();
280
      currentValue=choices.getValue(choices.getSelectedIndex());
281
    }
281
    }
Line 282... Line 282...
282
 
282
 
283
    visible=false;
283
    visible=false;
284
    items.clear();
284
    items.clear();
285
    choices.clear();
285
    choices.clear();
286
    choicesPopup.hide();
286
    choicesPopup.hide();
Line 287... Line 287...
287
  }
287
  }
288
  
288
  
289
  
289
  
Line 290... Line 290...
290
  public void addItem(String item) {
290
  public void addItem(String item, String value) {
291
	  items.add(item);
291
	  items.add(new String [] {item, value});
292
  }
292
  }