<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FGWT%2FAuto_Completion</id>
		<title>Java/GWT/Auto Completion - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FGWT%2FAuto_Completion"/>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/GWT/Auto_Completion&amp;action=history"/>
		<updated>2026-04-07T00:35:59Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://jexp.ru/index.php?title=Java/GWT/Auto_Completion&amp;diff=7091&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/GWT/Auto_Completion&amp;diff=7091&amp;oldid=prev"/>
				<updated>2010-06-01T06:35:46Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 06:35, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://jexp.ru/index.php?title=Java/GWT/Auto_Completion&amp;diff=7090&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/GWT/Auto_Completion&amp;diff=7090&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:44Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Auto-Completion Textbox for GWT ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
package com.jexp.gwt.client;&lt;br /&gt;
import java.util.ArrayList;&lt;br /&gt;
import com.google.gwt.user.client.ui.*;&lt;br /&gt;
import com.google.gwt.core.client.EntryPoint;&lt;br /&gt;
public class GWTClient implements EntryPoint{&lt;br /&gt;
  public void onModuleLoad() {&lt;br /&gt;
    final AutoCompleteTextBox box = new AutoCompleteTextBox();&lt;br /&gt;
    box.setCompletionItems(new SimpleAutoCompletionItems(&lt;br /&gt;
            new String[]{ &amp;quot;apple&amp;quot;, &amp;quot;ape&amp;quot;, &amp;quot;anything&amp;quot;, &amp;quot;else&amp;quot;}));&lt;br /&gt;
    Label zipLabel = new Label(&amp;quot;zip&amp;quot;);&lt;br /&gt;
       &lt;br /&gt;
    Grid grid = new Grid(4, 2);&lt;br /&gt;
    grid.setWidget(0, 0, zipLabel);&lt;br /&gt;
    grid.setWidget(0, 1, box);&lt;br /&gt;
    &lt;br /&gt;
    RootPanel.get().add(grid);&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
/*&lt;br /&gt;
Auto-Completion Textbox for GWT&lt;br /&gt;
Copyright (C) 2006 Oliver Albers http://gwt.ruponents.googlepages.ru/&lt;br /&gt;
This library is free software; you can redistribute it and/or&lt;br /&gt;
modify it under the terms of the GNU Lesser General Public&lt;br /&gt;
License as published by the Free Software Foundation; either&lt;br /&gt;
version 2.1 of the License, or (at your option) any later version.&lt;br /&gt;
This library is distributed in the hope that it will be useful,&lt;br /&gt;
but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&lt;br /&gt;
Lesser General Public License for more details.&lt;br /&gt;
You should have received a copy of the GNU Lesser General Public&lt;br /&gt;
License along with this library; if not, write to the Free Software&lt;br /&gt;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA&lt;br /&gt;
*/&lt;br /&gt;
interface CompletionItems {&lt;br /&gt;
        /**&lt;br /&gt;
         * Returns an array of all completion items matching&lt;br /&gt;
         * @param match The user-entered text all compleition items have to match&lt;br /&gt;
         * @return      Array of strings&lt;br /&gt;
         */&lt;br /&gt;
        public String[] getCompletionItems(String match);&lt;br /&gt;
}&lt;br /&gt;
/*&lt;br /&gt;
Auto-Completion Textbox for GWT&lt;br /&gt;
Copyright (C) 2006 Oliver Albers http://gwt.ruponents.googlepages.ru/&lt;br /&gt;
This library is free software; you can redistribute it and/or&lt;br /&gt;
modify it under the terms of the GNU Lesser General Public&lt;br /&gt;
License as published by the Free Software Foundation; either&lt;br /&gt;
version 2.1 of the License, or (at your option) any later version.&lt;br /&gt;
This library is distributed in the hope that it will be useful,&lt;br /&gt;
but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&lt;br /&gt;
Lesser General Public License for more details.&lt;br /&gt;
You should have received a copy of the GNU Lesser General Public&lt;br /&gt;
License along with this library; if not, write to the Free Software&lt;br /&gt;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA&lt;br /&gt;
*/&lt;br /&gt;
class AutoCompleteTextBox extends TextBox&lt;br /&gt;
    implements KeyboardListener, ChangeListener {&lt;br /&gt;
   &lt;br /&gt;
  protected PopupPanel choicesPopup = new PopupPanel(true);&lt;br /&gt;
  protected ListBox choices = new ListBox();&lt;br /&gt;
  protected CompletionItems items = new SimpleAutoCompletionItems(new String[]{});&lt;br /&gt;
  protected boolean popupAdded = false;&lt;br /&gt;
  protected boolean visible = false;&lt;br /&gt;
   &lt;br /&gt;
  /**&lt;br /&gt;
   * Default Constructor&lt;br /&gt;
   *&lt;br /&gt;
   */&lt;br /&gt;
  public AutoCompleteTextBox()&lt;br /&gt;
  {&lt;br /&gt;
    super();&lt;br /&gt;
    this.addKeyboardListener(this);&lt;br /&gt;
    choices.addChangeListener(this);&lt;br /&gt;
    this.setStyleName(&amp;quot;AutoCompleteTextBox&amp;quot;);&lt;br /&gt;
       &lt;br /&gt;
    choicesPopup.add(choices);&lt;br /&gt;
    choicesPopup.addStyleName(&amp;quot;AutoCompleteChoices&amp;quot;);&lt;br /&gt;
       &lt;br /&gt;
    choices.setStyleName(&amp;quot;list&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Sets an &amp;quot;algorithm&amp;quot; returning completion items&lt;br /&gt;
   * You can define your own way how the textbox retrieves autocompletion items&lt;br /&gt;
   * by implementing the CompletionItems interface and setting the according object&lt;br /&gt;
   * @see SimpleAutoCompletionItem&lt;br /&gt;
   * @param items CompletionItem implementation&lt;br /&gt;
   */&lt;br /&gt;
  public void setCompletionItems(CompletionItems items)&lt;br /&gt;
  {&lt;br /&gt;
    this.items = items;&lt;br /&gt;
  }&lt;br /&gt;
   &lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the used CompletionItems object&lt;br /&gt;
   * @return CompletionItems implementation&lt;br /&gt;
   */&lt;br /&gt;
  public CompletionItems getCompletionItems()&lt;br /&gt;
  {&lt;br /&gt;
    return this.items;&lt;br /&gt;
  }&lt;br /&gt;
   &lt;br /&gt;
  /**&lt;br /&gt;
   * Not used at all&lt;br /&gt;
   */&lt;br /&gt;
  public void onKeyDown(Widget arg0, char arg1, int arg2) {&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Not used at all&lt;br /&gt;
   */&lt;br /&gt;
  public void onKeyPress(Widget arg0, char arg1, int arg2) {&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * A key was released, start autocompletion&lt;br /&gt;
   */&lt;br /&gt;
  public void onKeyUp(Widget arg0, char arg1, int arg2) {&lt;br /&gt;
    if(arg1 == KEY_DOWN)&lt;br /&gt;
    {&lt;br /&gt;
      int selectedIndex = choices.getSelectedIndex();&lt;br /&gt;
      selectedIndex++;&lt;br /&gt;
      if(selectedIndex &amp;gt; choices.getItemCount())&lt;br /&gt;
      {&lt;br /&gt;
        selectedIndex = 0;&lt;br /&gt;
      }&lt;br /&gt;
      choices.setSelectedIndex(selectedIndex);&lt;br /&gt;
           &lt;br /&gt;
      return;&lt;br /&gt;
    }&lt;br /&gt;
       &lt;br /&gt;
    if(arg1 == KEY_UP)&lt;br /&gt;
    {&lt;br /&gt;
      int selectedIndex = choices.getSelectedIndex();&lt;br /&gt;
      selectedIndex--;&lt;br /&gt;
      if(selectedIndex &amp;lt; 0)&lt;br /&gt;
      {&lt;br /&gt;
        selectedIndex = choices.getItemCount();&lt;br /&gt;
      }&lt;br /&gt;
      choices.setSelectedIndex(selectedIndex);&lt;br /&gt;
           &lt;br /&gt;
      return;        &lt;br /&gt;
    }&lt;br /&gt;
       &lt;br /&gt;
    if(arg1 == KEY_ENTER)&lt;br /&gt;
    {&lt;br /&gt;
      if(visible)&lt;br /&gt;
      {&lt;br /&gt;
        complete();&lt;br /&gt;
      }&lt;br /&gt;
           &lt;br /&gt;
      return;&lt;br /&gt;
    }&lt;br /&gt;
       &lt;br /&gt;
    if(arg1 == KEY_ESCAPE)&lt;br /&gt;
    {&lt;br /&gt;
      choices.clear();&lt;br /&gt;
      choicesPopup.hide();&lt;br /&gt;
      visible = false;&lt;br /&gt;
           &lt;br /&gt;
      return;&lt;br /&gt;
    }&lt;br /&gt;
       &lt;br /&gt;
    String text = this.getText();&lt;br /&gt;
    String[] matches = new String[]{};&lt;br /&gt;
    if(text.length() &amp;gt; 0)&lt;br /&gt;
    {&lt;br /&gt;
      matches = items.getCompletionItems(text);&lt;br /&gt;
    }&lt;br /&gt;
       &lt;br /&gt;
    if(matches.length &amp;gt; 0)&lt;br /&gt;
    {&lt;br /&gt;
      choices.clear();&lt;br /&gt;
           &lt;br /&gt;
      for(int i = 0; i &amp;lt; matches.length; i++)&lt;br /&gt;
      {&lt;br /&gt;
        choices.addItem((String) matches[i]);&lt;br /&gt;
      }&lt;br /&gt;
           &lt;br /&gt;
      // if there is only one match and it is what is in the&lt;br /&gt;
      // text field anyways there is no need to show autocompletion&lt;br /&gt;
      if(matches.length == 1 &amp;amp;&amp;amp; matches[0].rupareTo(text) == 0)&lt;br /&gt;
      {&lt;br /&gt;
        choicesPopup.hide();&lt;br /&gt;
      } else {&lt;br /&gt;
        choices.setSelectedIndex(0);&lt;br /&gt;
        choices.setVisibleItemCount(matches.length + 1);&lt;br /&gt;
               &lt;br /&gt;
        if(!popupAdded)&lt;br /&gt;
        {&lt;br /&gt;
          RootPanel.get().add(choicesPopup);&lt;br /&gt;
          popupAdded = true;&lt;br /&gt;
        }&lt;br /&gt;
        choicesPopup.show();&lt;br /&gt;
        visible = true;&lt;br /&gt;
        choicesPopup.setPopupPosition(this.getAbsoluteLeft(),&lt;br /&gt;
        this.getAbsoluteTop() + this.getOffsetHeight());&lt;br /&gt;
        //choicesPopup.setWidth(this.getOffsetWidth() + &amp;quot;px&amp;quot;);&lt;br /&gt;
        choices.setWidth(this.getOffsetWidth() + &amp;quot;px&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
    } else {&lt;br /&gt;
      visible = false;&lt;br /&gt;
      choicesPopup.hide();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * A mouseclick in the list of items&lt;br /&gt;
   */&lt;br /&gt;
  public void onChange(Widget arg0) {&lt;br /&gt;
    complete();&lt;br /&gt;
  }&lt;br /&gt;
 &lt;br /&gt;
  public void onClick(Widget arg0) {&lt;br /&gt;
    complete();&lt;br /&gt;
  }&lt;br /&gt;
   &lt;br /&gt;
  // add selected item to textbox&lt;br /&gt;
  protected void complete()&lt;br /&gt;
  {&lt;br /&gt;
    if(choices.getItemCount() &amp;gt; 0)&lt;br /&gt;
    {&lt;br /&gt;
      this.setText(choices.getItemText(choices.getSelectedIndex()));&lt;br /&gt;
    }&lt;br /&gt;
       &lt;br /&gt;
    choices.clear();&lt;br /&gt;
    choicesPopup.hide();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
Auto-Completion Textbox for GWT&lt;br /&gt;
Copyright (C) 2006 Oliver Albers http://gwt.ruponents.googlepages.ru/&lt;br /&gt;
This library is free software; you can redistribute it and/or&lt;br /&gt;
modify it under the terms of the GNU Lesser General Public&lt;br /&gt;
License as published by the Free Software Foundation; either&lt;br /&gt;
version 2.1 of the License, or (at your option) any later version.&lt;br /&gt;
This library is distributed in the hope that it will be useful,&lt;br /&gt;
but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&lt;br /&gt;
Lesser General Public License for more details.&lt;br /&gt;
You should have received a copy of the GNU Lesser General Public&lt;br /&gt;
License along with this library; if not, write to the Free Software&lt;br /&gt;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA&lt;br /&gt;
*/&lt;br /&gt;
class AutoCompleteTextArea extends TextArea&lt;br /&gt;
    implements KeyboardListener, ChangeListener {&lt;br /&gt;
   &lt;br /&gt;
  protected PopupPanel choicesPopup = new PopupPanel(true);&lt;br /&gt;
  protected ListBox choices = new ListBox();&lt;br /&gt;
  protected CompletionItems items = new SimpleAutoCompletionItems(new String[]{});&lt;br /&gt;
  protected boolean popupAdded = false;&lt;br /&gt;
  protected String typedText = &amp;quot;&amp;quot;;&lt;br /&gt;
  protected boolean visible = false;&lt;br /&gt;
   &lt;br /&gt;
  protected int posy = -1;&lt;br /&gt;
   &lt;br /&gt;
  /**&lt;br /&gt;
   * Default Constructor&lt;br /&gt;
   *&lt;br /&gt;
   */&lt;br /&gt;
  public AutoCompleteTextArea()&lt;br /&gt;
  {&lt;br /&gt;
    super();&lt;br /&gt;
    this.addKeyboardListener(this);&lt;br /&gt;
    choices.addChangeListener(this);&lt;br /&gt;
    this.setStyleName(&amp;quot;AutoCompleteTextArea&amp;quot;);&lt;br /&gt;
       &lt;br /&gt;
    choicesPopup.add(choices);&lt;br /&gt;
    choicesPopup.addStyleName(&amp;quot;AutoCompleteChoices&amp;quot;);&lt;br /&gt;
       &lt;br /&gt;
    choices.setStyleName(&amp;quot;list&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Sets an &amp;quot;algorithm&amp;quot; returning completion items&lt;br /&gt;
   * You can define your own way how the textbox retrieves autocompletion items&lt;br /&gt;
   * by implementing the CompletionItems interface and setting the according object&lt;br /&gt;
   * @see SimpleAutoCompletionItem&lt;br /&gt;
   * @param items CompletionItem implementation&lt;br /&gt;
   */&lt;br /&gt;
  public void setCompletionItems(CompletionItems items)&lt;br /&gt;
  {&lt;br /&gt;
    this.items = items;&lt;br /&gt;
  }&lt;br /&gt;
   &lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the used CompletionItems object&lt;br /&gt;
   * @return CompletionItems implementation&lt;br /&gt;
   */&lt;br /&gt;
  public CompletionItems getCompletionItems()&lt;br /&gt;
  {&lt;br /&gt;
    return this.items;&lt;br /&gt;
  }&lt;br /&gt;
   &lt;br /&gt;
  public void onKeyDown(Widget sender, char keyCode, int modifiers) {&lt;br /&gt;
  }&lt;br /&gt;
  public void onKeyPress(Widget sender, char keyCode, int modifiers) {&lt;br /&gt;
  }&lt;br /&gt;
  public void onKeyUp(Widget sender, char keyCode, int modifiers) {&lt;br /&gt;
    if(keyCode == KEY_DOWN)&lt;br /&gt;
    {&lt;br /&gt;
      int selectedIndex = choices.getSelectedIndex();&lt;br /&gt;
      selectedIndex++;&lt;br /&gt;
      if(selectedIndex &amp;gt; choices.getItemCount())&lt;br /&gt;
      {&lt;br /&gt;
        selectedIndex = 0;&lt;br /&gt;
      }&lt;br /&gt;
      choices.setSelectedIndex(selectedIndex);&lt;br /&gt;
           &lt;br /&gt;
      return;&lt;br /&gt;
    }&lt;br /&gt;
       &lt;br /&gt;
    if(keyCode == KEY_UP)&lt;br /&gt;
    {&lt;br /&gt;
      int selectedIndex = choices.getSelectedIndex();&lt;br /&gt;
      selectedIndex--;&lt;br /&gt;
      if(selectedIndex &amp;lt; 0)&lt;br /&gt;
      {&lt;br /&gt;
        selectedIndex = choices.getItemCount();&lt;br /&gt;
      }&lt;br /&gt;
      choices.setSelectedIndex(selectedIndex);&lt;br /&gt;
           &lt;br /&gt;
      return;        &lt;br /&gt;
    }&lt;br /&gt;
       &lt;br /&gt;
    if(keyCode == KEY_ENTER)&lt;br /&gt;
    {&lt;br /&gt;
      if(visible)&lt;br /&gt;
      {&lt;br /&gt;
        complete();&lt;br /&gt;
      }&lt;br /&gt;
           &lt;br /&gt;
      return;&lt;br /&gt;
    }&lt;br /&gt;
       &lt;br /&gt;
    if(keyCode == KEY_ESCAPE)&lt;br /&gt;
    {&lt;br /&gt;
      choices.clear();&lt;br /&gt;
      choicesPopup.hide();&lt;br /&gt;
      visible = false;&lt;br /&gt;
           &lt;br /&gt;
      return;&lt;br /&gt;
    }&lt;br /&gt;
       &lt;br /&gt;
    String text = this.getText();&lt;br /&gt;
    String[] matches = new String[]{};&lt;br /&gt;
       &lt;br /&gt;
    String[] words = text.split(&amp;quot; |\n|\r&amp;quot;);&lt;br /&gt;
    text = words[words.length - 1];&lt;br /&gt;
    typedText = text;&lt;br /&gt;
       &lt;br /&gt;
    if(text.length() &amp;gt; 0)&lt;br /&gt;
    {&lt;br /&gt;
      matches = items.getCompletionItems(text);&lt;br /&gt;
    }&lt;br /&gt;
       &lt;br /&gt;
    if(matches.length &amp;gt; 0)&lt;br /&gt;
    {&lt;br /&gt;
      choices.clear();&lt;br /&gt;
           &lt;br /&gt;
      for(int i = 0; i &amp;lt; matches.length; i++)&lt;br /&gt;
      {&lt;br /&gt;
        choices.addItem((String) matches[i]);&lt;br /&gt;
      }&lt;br /&gt;
           &lt;br /&gt;
      // if there is only one match and it is what is in the&lt;br /&gt;
      // text field anyways there is no need to show autocompletion&lt;br /&gt;
      if(matches.length == 1 &amp;amp;&amp;amp; matches[0].rupareTo(text) == 0)&lt;br /&gt;
      {&lt;br /&gt;
        choicesPopup.hide();&lt;br /&gt;
      } else {&lt;br /&gt;
        choices.setSelectedIndex(0);&lt;br /&gt;
        choices.setVisibleItemCount(matches.length + 1);&lt;br /&gt;
               &lt;br /&gt;
        if(!popupAdded)&lt;br /&gt;
        {&lt;br /&gt;
          RootPanel.get().add(choicesPopup);&lt;br /&gt;
          popupAdded = true;&lt;br /&gt;
        }&lt;br /&gt;
        choicesPopup.show();&lt;br /&gt;
        visible = true;&lt;br /&gt;
        int nposy = this.getAbsoluteTop() + this.getOffsetHeight();&lt;br /&gt;
        if(posy &amp;lt; 0 || nposy &amp;gt; posy)&lt;br /&gt;
        {&lt;br /&gt;
          posy = nposy;&lt;br /&gt;
        }&lt;br /&gt;
        choicesPopup.setPopupPosition(this.getAbsoluteLeft(), posy);&lt;br /&gt;
        //choicesPopup.setWidth(this.getOffsetWidth() + &amp;quot;px&amp;quot;);&lt;br /&gt;
        choices.setWidth(this.getOffsetWidth() + &amp;quot;px&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
    } else {&lt;br /&gt;
      choicesPopup.hide();&lt;br /&gt;
      visible = false;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  public void onChange(Widget sender) {&lt;br /&gt;
    complete();&lt;br /&gt;
  }&lt;br /&gt;
  // add selected item to textarea&lt;br /&gt;
  protected void complete()&lt;br /&gt;
  {&lt;br /&gt;
    if(choices.getItemCount() &amp;gt; 0)&lt;br /&gt;
    {&lt;br /&gt;
      String text = this.getText();&lt;br /&gt;
      text = text.substring(0, text.length() - typedText.length() - 1);&lt;br /&gt;
      text += choices.getItemText(choices.getSelectedIndex());&lt;br /&gt;
      this.setText(text);&lt;br /&gt;
      this.setFocus(true);&lt;br /&gt;
    }&lt;br /&gt;
       &lt;br /&gt;
    choices.clear();&lt;br /&gt;
    choicesPopup.hide();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
Auto-Completion Textbox for GWT&lt;br /&gt;
Copyright (C) 2006 Oliver Albers http://gwt.ruponents.googlepages.ru/&lt;br /&gt;
This library is free software; you can redistribute it and/or&lt;br /&gt;
modify it under the terms of the GNU Lesser General Public&lt;br /&gt;
License as published by the Free Software Foundation; either&lt;br /&gt;
version 2.1 of the License, or (at your option) any later version.&lt;br /&gt;
This library is distributed in the hope that it will be useful,&lt;br /&gt;
but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&lt;br /&gt;
Lesser General Public License for more details.&lt;br /&gt;
You should have received a copy of the GNU Lesser General Public&lt;br /&gt;
License along with this library; if not, write to the Free Software&lt;br /&gt;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA&lt;br /&gt;
*/&lt;br /&gt;
class SimpleAutoCompletionItems implements CompletionItems {&lt;br /&gt;
  private String[] completions;&lt;br /&gt;
  public SimpleAutoCompletionItems(String[] items)&lt;br /&gt;
  {&lt;br /&gt;
    completions = items;&lt;br /&gt;
  }&lt;br /&gt;
  public String[] getCompletionItems(String match) {&lt;br /&gt;
    ArrayList matches = new ArrayList();&lt;br /&gt;
    for (int i = 0; i &amp;lt; completions.length; i++) {&lt;br /&gt;
      if (completions[i].toLowerCase().startsWith(match.toLowerCase())) {&lt;br /&gt;
        matches.add(completions[i]);&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    String[] returnMatches = new String[matches.size()];&lt;br /&gt;
    for(int i = 0; i &amp;lt; matches.size(); i++)&lt;br /&gt;
    {&lt;br /&gt;
      returnMatches[i] = (String)matches.get(i);&lt;br /&gt;
    }&lt;br /&gt;
    return returnMatches;&lt;br /&gt;
  }&lt;br /&gt;
} &lt;br /&gt;
///////////&lt;br /&gt;
.sPanel {&lt;br /&gt;
  width: 150px;&lt;br /&gt;
  height: 100px;&lt;br /&gt;
  position: absolute; &lt;br /&gt;
  left: 15px; &lt;br /&gt;
  top: 240px;  &lt;br /&gt;
}&lt;br /&gt;
.panel {&lt;br /&gt;
  background-color: #C3D9FF;&lt;br /&gt;
  border: 1px solid #000000;&lt;br /&gt;
  padding: 3px;&lt;br /&gt;
  margin: 3px;&lt;br /&gt;
  font-weight: normal;  &lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>