Subversion Repositories eFlore/Applications.coel

Rev

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