Subversion Repositories eFlore/Applications.coel

Rev

Go to most recent revision | Details | 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) {
875 jpm 34
				setAcces(true);
687 jp_milcent 35
				actualiser();
36
			}
37
		});
38
	}
39
 
40
	public static void parametrer(TabItem onglet) {
858 jpm 41
		FormLayout layout = new FormLayout();
42
		layout.setLabelWidth(largeurLabelDefaut);
43
		layout.setLabelAlign(alignementLabelDefaut);
44
		onglet.setLayout(layout);
45
 
687 jp_milcent 46
		onglet.setStyleAttribute("padding", "10px");
47
		onglet.setScrollMode(Scroll.AUTO);
48
		onglet.setData("acces", false);
49
	}
50
 
51
	protected void initialiserOnglet(Formulaire formulaireCourrant) {
52
		formulaire = formulaireCourrant;
53
		mediateur = formulaire.mediateur;
54
		i18nC = Mediateur.i18nC;
55
		config = (Configuration) Registry.get(RegistreId.CONFIG);
56
 
57
		mode = formulaire.mode;
58
		tabIndex = formulaire.tabIndex;
59
	}
60
 
61
	public void actualiser() {
62
		layout();
63
	}
867 jpm 64
 
65
	public void setAcces(boolean acces) {
66
		this.setData("acces", acces);
67
	}
68
 
69
	public boolean etreAccede() {
70
		return this.getData("acces");
71
	}
687 jp_milcent 72
}