Subversion Repositories eFlore/Applications.coel

Rev

Rev 188 | Rev 202 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 188 Rev 193
Line 1... Line 1...
1
package org.tela_botanica.client.modeles;
1
package org.tela_botanica.client.modeles;
Line 2... Line 2...
2
 
2
 
-
 
3
import java.io.Serializable;
3
import java.io.Serializable;
4
import java.util.Iterator;
-
 
5
import java.util.List;
Line 4... Line 6...
4
import java.util.List;
6
import java.util.Set;
5
 
7
 
Line -... Line 8...
-
 
8
import com.extjs.gxt.ui.client.data.BaseModelData;
-
 
9
import com.extjs.gxt.ui.client.widget.form.CheckBox;
-
 
10
 
-
 
11
/**
6
import com.extjs.gxt.ui.client.data.BaseModelData;
12
 * @author jpm
Line 7... Line 13...
7
import com.extjs.gxt.ui.client.widget.form.CheckBox;
13
 *
8
 
14
 */
9
public abstract class aDonnee extends BaseModelData implements Serializable {
15
public abstract class aDonnee extends BaseModelData implements Serializable {
Line 19... Line 25...
19
	 * l'affichage, il ne faut pas utiliser get directement
25
	 * l'affichage, il ne faut pas utiliser get directement
20
	 * 
26
	 * 
21
	 * @param cle
27
	 * @param cle
22
	 * @return la valeur associée à la clé
28
	 * @return la valeur associée à la clé
23
	 */
29
	 */
24
	public String renvoyerValeurCorrecte(String cle) {
30
	protected String renvoyerValeurCorrecte(String cle) {
25
		String sortie = "";
31
		String sortie = "";
26
		if (this.get(cle) != null) {
32
		if (this.get(cle) != null) {
27
			String valeur = this.get(cle);
33
			String valeur = this.get(cle);
28
			if (! valeur.equals("null")) {
34
			if (! valeur.equals("null")) {
29
				char nullChar = '\u0000';
35
				char nullChar = '\u0000';
Line 32... Line 38...
32
				sortie =  valeur;
38
				sortie =  valeur;
33
			}
39
			}
34
		}
40
		}
35
		return sortie;
41
		return sortie;
36
	}
42
	}
-
 
43
	/**
-
 
44
	 * Permet de constuire correctement une chaine dénormalisée (champ de type "truk").
-
 
45
	 * 
-
 
46
	 * @param champ le nom du champ dénormalisé
-
 
47
	 * @param type le type de la valeur à ajouter
-
 
48
	 * @param valeur la valeur à ajouter
-
 
49
	 */
-
 
50
	protected void setChaineDenormalise(String champ, String type, Object valeur) {
-
 
51
		if (valeur instanceof String) {
-
 
52
			String chaineExistante = renvoyerValeurCorrecte(champ);
-
 
53
			if (chaineExistante.equals("")) {
-
 
54
				this.set(champ, type+"##"+valeur);
-
 
55
			} else {
-
 
56
				this.set(champ, chaineExistante+";;"+type+"##"+valeur);
-
 
57
			}
-
 
58
		}
-
 
59
	}
Line 37... Line 60...
37
	
60
	
38
	public String getDateModification() {
61
	public String getDateModification() {
39
		return (String) renvoyerValeurCorrecte("cmhl_date_modification");
62
		return (String) renvoyerValeurCorrecte("cmhl_date_modification");
Line 52... Line 75...
52
	}
75
	}
Line 53... Line 76...
53
	
76
	
54
	public String getIp() {
77
	public String getIp() {
55
		return (String) renvoyerValeurCorrecte("cmhl_ip");
78
		return (String) renvoyerValeurCorrecte("cmhl_ip");
-
 
79
	}
-
 
80
	
-
 
81
	/** (non-Javadoc)
-
 
82
	 * @see java.lang.Object#toString()
-
 
83
	 */
-
 
84
	public String toString() {
-
 
85
		String sortie = "";
-
 
86
		
-
 
87
		// Champs du BaseModelData
-
 
88
		Set<String> proprietes = this.getProperties().keySet();
-
 
89
		for (Iterator<String> it = proprietes.iterator(); it.hasNext();) {
-
 
90
			String cle = it.next();
-
 
91
			sortie += cle+" : "+this.get(cle)+"\n";
-
 
92
		}
-
 
93
		
-
 
94
		return sortie;
56
	}
95
	}