Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 188 Rev 306
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<String> deboguages = null;
11
	private ArrayList<Object> donnees = null;
12
	private ArrayList<Object> donnees = null;
12
	
13
	
13
	public Information() {
14
	public Information() {
14
		messages = new ArrayList<String>();
-
 
15
		donnees = new ArrayList<Object>();
15
		donnees = new ArrayList<Object>();
-
 
16
		messages = new ArrayList<String>();
-
 
17
		deboguages = new ArrayList<String>();
16
	}
18
	}
17
 
19
 
18
	public Information(String t) {
20
	public Information(String t) {
19
		donnees = new ArrayList<Object>();
21
		donnees = new ArrayList<Object>();
20
		messages = new ArrayList<String>();
22
		messages = new ArrayList<String>();
-
 
23
		deboguages = new ArrayList<String>();
21
		type = t;
24
		type = t;
22
	}
25
	}
23
	
26
	
24
	public Information(String t, String m) {
27
	public Information(String t, String m) {
25
		donnees = new ArrayList<Object>();
28
		donnees = new ArrayList<Object>();
26
		messages = new ArrayList<String>();
29
		messages = new ArrayList<String>();
27
		messages.add(m);
30
		messages.add(m);
-
 
31
		deboguages = new ArrayList<String>();
28
		type = t;
32
		type = t;
29
	}
33
	}
30
	
34
	
31
	public Information(String t, JSONArray jsonArray) {
35
	public Information(String t, JSONArray jsonArray) {
32
		donnees = new ArrayList<Object>();
36
		donnees = new ArrayList<Object>();
33
		messages = new ArrayList<String>();
37
		messages = new ArrayList<String>();
34
		for(int i = 0 ; i < jsonArray.size() ; i++) {
38
		for(int i = 0 ; i < jsonArray.size() ; i++) {
35
			if (jsonArray.get(i).isString() != null) {
39
			if (jsonArray.get(i).isString() != null) {
36
				messages.add(jsonArray.get(i).isString().stringValue());
40
				messages.add(jsonArray.get(i).isString().stringValue());
37
			}
41
			}
38
		}
42
		}
-
 
43
		deboguages = new ArrayList<String>();
39
		type = t;
44
		type = t;
40
	}
45
	}
41
 
46
 
42
	public Information(String t, Object o) {
47
	public Information(String t, Object o) {
43
		messages = new ArrayList<String>();
-
 
44
		donnees = new ArrayList<Object>();
48
		donnees = new ArrayList<Object>();
45
		donnees.add(o);
49
		donnees.add(o);
-
 
50
		messages = new ArrayList<String>();
-
 
51
		deboguages = new ArrayList<String>();
46
		type = t;
52
		type = t;
47
	}
53
	}
48
	
54
	
49
 
55
 
50
	public void setType(String t) {
56
	public void setType(String t) {
51
		type = t;
57
		type = t;
52
	}
58
	}
53
	public String getType() {
59
	public String getType() {
54
		return type;
60
		return type;
55
	}
61
	}
56
	
62
	
57
	public void setMessage(String message) {
63
	public void setMessage(String message) {
58
		messages.add(message);
64
		messages.add(message);
59
	}
65
	}
60
	public String getMessage(int index) {
66
	public String getMessage(int index) {
61
		return messages.get(index);
67
		return messages.get(index);
62
	}
68
	}
63
	
-
 
64
	public ArrayList<String> getMessages() {
69
	public ArrayList<String> getMessages() {
65
		return messages;
70
		return messages;
66
	}
71
	}
-
 
72
	
-
 
73
	public void setDeboguage(String messageDeboguage) {
-
 
74
		deboguages.add(messageDeboguage);
-
 
75
	}
-
 
76
	public void setDeboguages(JSONArray jsonArray) {
-
 
77
		for(int i = 0 ; i < jsonArray.size() ; i++) {
-
 
78
			if (jsonArray.get(i).isString() != null) {
-
 
79
				deboguages.add(jsonArray.get(i).isString().stringValue());
-
 
80
			}
-
 
81
		}
-
 
82
	}
-
 
83
	public String getDeboguage(int index) {
-
 
84
		return deboguages.get(index);
-
 
85
	}
-
 
86
	public ArrayList<String> getDeboguages() {
-
 
87
		return deboguages;
-
 
88
	}
67
	
89
	
68
	public void setDonnee(Object objet) {
90
	public void setDonnee(Object objet) {
69
		donnees.add(objet);
91
		donnees.add(objet);
70
	}
92
	}
71
	public void setDonnee(int index, Object objet) {
93
	public void setDonnee(int index, Object objet) {
72
		if (objet != null) {
94
		if (objet != null) {
73
			donnees.add(index, objet);
95
			donnees.add(index, objet);
74
		}
96
		}
75
	}
97
	}
76
	public Object getDonnee(int index) {
98
	public Object getDonnee(int index) {
77
		try {
99
		try {
78
			return donnees.get(index);
100
			return donnees.get(index);
79
		} catch (Exception e) {
101
		} catch (Exception e) {
80
			return null;
102
			return null;
81
		}
103
		}
82
	}
104
	}
83
	
-
 
84
	public ArrayList<Object> getDonnees() {
105
	public ArrayList<Object> getDonnees() {
85
		return donnees;
106
		return donnees;
86
	}
107
	}
87
 
108
 
88
	public String toString() {
109
	public String toString() {
89
		String chaine = new String();
110
		String chaine = new String();
90
		if (messages != null) {
111
		if (messages != null) {
91
			for(int i = 0 ; i < messages.size() ; i++) {
112
			for(int i = 0 ; i < messages.size() ; i++) {
92
				// GXT ne prend pas en compte /n ou /r/n...
113
				// GXT ne prend pas en compte /n ou /r/n...
93
				chaine += getMessage(i)+"\n";
114
				chaine += getMessage(i)+"\n";
94
			}
115
			}
95
		}
116
		}
96
		return chaine;
117
		return chaine;
97
	}
118
	}
98
}
119
}