Rev 133 | Rev 156 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package org.tela_botanica.client.modeles;
import java.util.ArrayList;
import com.google.gwt.json.client.JSONArray;
public class Information {
private String type = null;
private ArrayList<String> messages = null;
public Information() {
messages = new ArrayList<String>();
}
public Information(String t, String m) {
messages = new ArrayList<String>();
messages.add(m);
type = t;
}
public Information(String t, JSONArray jsonArray) {
messages = new ArrayList<String>();
for(int i = 0 ; i < jsonArray.size() ; i++) {
if (jsonArray.get(i).isString() != null) {
messages.add(jsonArray.get(i).isString().stringValue());
}
}
type = t;
}
public void setType(String t) {
type = t;
}
public String getType() {
return type;
}
public void setMessage(String message) {
messages.add(message);
}
public String getMessage(int index) {
return messages.get(index);
}
public ArrayList<String> getMessages() {
return messages;
}
public String toString() {
String chaine = new String();
for(int i = 0 ; i < messages.size() ; i++) {
// GXT ne prend pas en compte /n ou /r/n...
chaine += getMessage(i)+"\n";
}
return chaine;
}
}