Subversion Repositories eFlore/Applications.coel

Rev

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