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 12... Line 12...
12
import com.google.gwt.json.client.JSONValue;
12
import com.google.gwt.json.client.JSONValue;
13
import com.google.gwt.user.client.ResponseTextHandler;
13
import com.google.gwt.user.client.ResponseTextHandler;
14
import com.google.gwt.user.client.ui.Composite;
14
import com.google.gwt.user.client.ui.Composite;
15
import com.google.gwt.user.client.ui.HorizontalPanel;
15
import com.google.gwt.user.client.ui.HorizontalPanel;
Line 16... Line -...
16
 
-
 
17
import java.util.Vector;
-
 
Line 18... Line 16...
18
 
16
 
Line 19... Line 17...
19
 
17
 
20
import org.tela_botanica.client.AutoCompleteAsyncTextBox;
18
import org.tela_botanica.client.AutoCompleteAsyncTextBox;
Line 25... Line 23...
25
 
23
 
Line 26... Line 24...
26
public class NameAssistant extends Composite implements EventListener, ResponseTextHandler  {
24
public class NameAssistant extends Composite implements EventListener, ResponseTextHandler  {
27
 
25
 
28
  private AutoCompleteAsyncTextBox autoCompletebox = new AutoCompleteAsyncTextBox(this);
-
 
Line 29... Line 26...
29
  private HorizontalPanel panel = new HorizontalPanel();
26
  private AutoCompleteAsyncTextBox autoCompletebox = new AutoCompleteAsyncTextBox(this);
Line 30... Line -...
30
  private Vector complements=null;
-
 
31
  
27
  private HorizontalPanel panel = new HorizontalPanel();
Line 32... Line 28...
32
  public NameAssistant(AutoCompleteAsyncTextBoxListener listener,Vector comps) {
28
  
Line 33... Line 29...
33
	
29
  public NameAssistant(AutoCompleteAsyncTextBoxListener listener) {
Line 47... Line 43...
47
  			JSONValue jsonValue= JSONParser.parse(str);
43
  			JSONValue jsonValue= JSONParser.parse(str);
48
  			JSONArray jsonArray;
44
  			JSONArray jsonArray;
49
  			JSONArray jsonArrayNested;
45
  			JSONArray jsonArrayNested;
50
  			JSONString jsonString;
46
  			JSONString jsonString;
Line 51... Line -...
51
 
-
 
Line 52... Line 47...
52
  			complements.clear();
47
 
53
  			
48
  			
54
  			if ((jsonArray = jsonValue.isArray()) != null) {
49
  			if ((jsonArray = jsonValue.isArray()) != null) {
55
  				for (int i = 0; i < jsonArray.size(); ++i) {
50
  				for (int i = 0; i < jsonArray.size(); ++i) {
56
  				  if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) {
51
  				  if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) {
57
  					if ((jsonString = (jsonArrayNested.get(0)).isString()) != null) {
-
 
58
  						autoCompletebox.addItem(jsonString.stringValue());
-
 
59
  					}
-
 
60
  					if ((jsonString = (jsonArrayNested.get(1)).isString()) != null) {
52
  					if ((jsonString = (jsonArrayNested.get(0)).isString()) != null) {
61
  						complements.add(i,jsonString.stringValue());
53
  						autoCompletebox.addItem(((JSONString) jsonArrayNested.get(0)).stringValue(),((JSONString) jsonArrayNested.get(1)).stringValue());
62
  					}
54
  					}
63
  				  }
55
  				  }