Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 153 Rev 156
1
package org.tela_botanica.client.modeles;
1
package org.tela_botanica.client.modeles;
2
 
2
 
3
import java.util.ArrayList;
3
import java.util.ArrayList;
4
 
4
 
5
import com.google.gwt.json.client.JSONArray;
5
import com.google.gwt.json.client.JSONArray;
6
 
6
 
7
public class Information {
7
public class Information {
8
	
8
	
9
	private String type = null;
9
	private String type = null;
10
	private ArrayList<String> messages = null;
10
	private ArrayList<String> messages = null;
-
 
11
	private ArrayList<Object> donnees = null;
11
 
12
	
12
	public Information() {
13
	public Information() {
13
		messages = new ArrayList<String>();
14
		messages = new ArrayList<String>();
14
	}
15
	}
-
 
16
 
-
 
17
	public Information(String t) {
-
 
18
		type = t;
-
 
19
	}
15
	
20
	
16
	public Information(String t, String m) {
21
	public Information(String t, String m) {
17
		messages = new ArrayList<String>();
22
		messages = new ArrayList<String>();
18
		messages.add(m);
23
		messages.add(m);
19
		type = t;
24
		type = t;
20
	}
25
	}
21
	
26
	
22
	public Information(String t, JSONArray jsonArray) {
27
	public Information(String t, JSONArray jsonArray) {
23
		messages = new ArrayList<String>();
28
		messages = new ArrayList<String>();
24
		for(int i = 0 ; i < jsonArray.size() ; i++) {
29
		for(int i = 0 ; i < jsonArray.size() ; i++) {
25
			if (jsonArray.get(i).isString() != null) {
30
			if (jsonArray.get(i).isString() != null) {
26
				messages.add(jsonArray.get(i).isString().stringValue());
31
				messages.add(jsonArray.get(i).isString().stringValue());
27
			}
32
			}
28
		}
33
		}
29
		type = t;
34
		type = t;
30
	}
35
	}
-
 
36
 
-
 
37
	public Information(String t, Object o) {
-
 
38
		donnees = new ArrayList<Object>();
-
 
39
		donnees.add(o);
-
 
40
		type = t;
-
 
41
	}
-
 
42
	
31
 
43
 
32
	public void setType(String t) {
44
	public void setType(String t) {
33
		type = t;
45
		type = t;
34
	}
46
	}
35
	public String getType() {
47
	public String getType() {
36
		return type;
48
		return type;
37
	}
49
	}
38
	
50
	
39
	public void setMessage(String message) {
51
	public void setMessage(String message) {
40
		messages.add(message);
52
		messages.add(message);
41
	}
53
	}
42
	public String getMessage(int index) {
54
	public String getMessage(int index) {
43
		return messages.get(index);
55
		return messages.get(index);
44
	}
56
	}
45
	
57
	
46
	public ArrayList<String> getMessages() {
58
	public ArrayList<String> getMessages() {
47
		return messages;
59
		return messages;
48
	}
60
	}
-
 
61
	
-
 
62
	public void setDonnee(Object objet) {
-
 
63
		donnees.add(objet);
-
 
64
	}
-
 
65
	public Object getDonnee(int index) {
-
 
66
		return donnees.get(index);
-
 
67
	}
-
 
68
	
-
 
69
	public ArrayList<Object> getDonnees() {
-
 
70
		return donnees;
-
 
71
	}
49
 
72
 
50
	public String toString() {
73
	public String toString() {
51
		String chaine = new String();
74
		String chaine = new String();
-
 
75
		if (messages != null) {
52
		for(int i = 0 ; i < messages.size() ; i++) {
76
			for(int i = 0 ; i < messages.size() ; i++) {
53
			// GXT ne prend pas en compte /n ou /r/n...
77
				// GXT ne prend pas en compte /n ou /r/n...
54
			chaine += getMessage(i)+"\n";
78
				chaine += getMessage(i)+"\n";
-
 
79
			}
55
		}
80
		}
56
		return chaine;
81
		return chaine;
57
	}
82
	}
58
}
83
}