Subversion Repositories eFlore/Applications.coel

Rev

Rev 858 | Rev 875 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
687 jp_milcent 1
package org.tela_botanica.client.vues;
2
 
3
import org.tela_botanica.client.Mediateur;
4
import org.tela_botanica.client.RegistreId;
5
import org.tela_botanica.client.i18n.Constantes;
6
import org.tela_botanica.client.interfaces.Rafraichissable;
7
import org.tela_botanica.client.modeles.Configuration;
8
 
9
import com.extjs.gxt.ui.client.Registry;
10
import com.extjs.gxt.ui.client.Style.Scroll;
11
import com.extjs.gxt.ui.client.event.ComponentEvent;
12
import com.extjs.gxt.ui.client.event.Events;
13
import com.extjs.gxt.ui.client.event.Listener;
14
import com.extjs.gxt.ui.client.widget.TabItem;
858 jpm 15
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
687 jp_milcent 16
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
17
 
18
public abstract class FormulaireOnglet extends TabItem implements Rafraichissable {
19
 
20
	protected Formulaire formulaire = null;
21
	protected Mediateur mediateur = null;
22
	protected Constantes i18nC = null;
23
	protected Configuration config = null;
24
 
25
	protected String mode = null;
26
	protected int tabIndex = 100;
858 jpm 27
	protected static LabelAlign alignementLabelDefaut = LabelAlign.LEFT;
28
	protected static int largeurLabelDefaut = 250;
687 jp_milcent 29
 
30
	public FormulaireOnglet() {
31
		parametrer(this);
32
		addListener(Events.Select, new Listener<ComponentEvent>() {
33
			public void handleEvent(ComponentEvent be) {
34
				actualiser();
35
			}
36
		});
37
	}
38
 
39
	public static void parametrer(TabItem onglet) {
858 jpm 40
		FormLayout layout = new FormLayout();
41
		layout.setLabelWidth(largeurLabelDefaut);
42
		layout.setLabelAlign(alignementLabelDefaut);
43
		onglet.setLayout(layout);
44
 
687 jp_milcent 45
		onglet.setStyleAttribute("padding", "10px");
46
		onglet.setScrollMode(Scroll.AUTO);
47
		onglet.setData("acces", false);
48
	}
49
 
50
	protected void initialiserOnglet(Formulaire formulaireCourrant) {
51
		formulaire = formulaireCourrant;
52
		mediateur = formulaire.mediateur;
53
		i18nC = Mediateur.i18nC;
54
		config = (Configuration) Registry.get(RegistreId.CONFIG);
55
 
56
		mode = formulaire.mode;
57
		tabIndex = formulaire.tabIndex;
58
	}
59
 
60
	public void actualiser() {
61
		layout();
62
	}
867 jpm 63
 
64
	public void setAcces(boolean acces) {
65
		this.setData("acces", acces);
66
	}
67
 
68
	public boolean etreAccede() {
69
		return this.getData("acces");
70
	}
687 jp_milcent 71
}