Subversion Repositories eFlore/Archives.cel-v2

Rev

Rev 36 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 36 Rev 47
Line 1... Line 1...
1
package org.tela_botanica.client.vues;
1
package org.tela_botanica.client.vues;
Line 2... Line 2...
2
 
2
 
3
import org.tela_botanica.client.image.ImageMediateur;
-
 
4
import com.gwtext.client.core.Ext;
3
import org.tela_botanica.client.image.ImageMediateur;
5
import org.tela_botanica.client.interfaces.Rafraichissable;
4
import org.tela_botanica.client.interfaces.Rafraichissable;
-
 
5
import org.tela_botanica.client.interfaces.VueListable;
6
import org.tela_botanica.client.interfaces.VueListable;
6
 
7
import com.google.gwt.user.client.Element;
-
 
8
import com.google.gwt.user.client.ui.Label;
7
import com.google.gwt.user.client.Element;
9
import com.gwtext.client.core.EventObject;
-
 
10
import com.gwtext.client.core.ExtElement;
8
import com.gwtext.client.core.EventObject;
11
import com.gwtext.client.core.XTemplate;
9
import com.gwtext.client.core.XTemplate;
12
import com.gwtext.client.data.FieldDef;
10
import com.gwtext.client.data.FieldDef;
13
import com.gwtext.client.data.IntegerFieldDef;
11
import com.gwtext.client.data.IntegerFieldDef;
14
import com.gwtext.client.data.Record;
12
import com.gwtext.client.data.Record;
15
import com.gwtext.client.data.RecordDef;
13
import com.gwtext.client.data.RecordDef;
16
import com.gwtext.client.data.Store;
14
import com.gwtext.client.data.Store;
17
import com.gwtext.client.data.StringFieldDef;
15
import com.gwtext.client.data.StringFieldDef;
18
import com.gwtext.client.util.Format;
16
import com.gwtext.client.util.Format;
19
import com.gwtext.client.widgets.Component;
17
import com.gwtext.client.widgets.Component;
20
import com.gwtext.client.widgets.DataView;
-
 
21
import com.gwtext.client.widgets.PagingToolbar;
18
import com.gwtext.client.widgets.DataView;
22
import com.gwtext.client.widgets.Panel;
-
 
23
import com.gwtext.client.widgets.ToolTip;
-
 
24
import com.gwtext.client.widgets.Toolbar;
-
 
25
import com.gwtext.client.widgets.ToolbarButton;
-
 
26
import com.gwtext.client.widgets.ToolbarTextItem;
19
import com.gwtext.client.widgets.Panel;
27
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
20
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
28
import com.gwtext.client.widgets.event.DataViewListenerAdapter;
-
 
29
import com.gwtext.client.widgets.form.Field;
-
 
30
import com.gwtext.client.widgets.form.NumberField;
-
 
Line 31... Line 21...
31
import com.gwtext.client.widgets.form.event.FieldListenerAdapter;
21
import com.gwtext.client.widgets.event.DataViewListenerAdapter;
32
 
22
 
33
/**
23
/**
34
 * Galerie d'images miniatures
24
 * Galerie d'images miniatures
35
 * Avec barre de pagination 
25
 * Avec barre de pagination 
36
 * @author aurelien
26
 * @author aurelien
37
 */
-
 
Line 38... Line 27...
38
public class GalerieImageVue extends Panel implements Rafraichissable,
27
 */
39
		VueListable {
28
public class GalerieImageVue extends Panel implements Rafraichissable, VueListable {
40
 
29
 
41
	/**
30
	/**
Line 77... Line 66...
77
		
66
		
78
		// on ajoute des listeners au composant tout entier
67
		// on ajoute des listeners au composant tout entier
Line 79... Line 68...
79
		this.addListener(new ContainerListenerAdapter() {
68
		this.addListener(new ContainerListenerAdapter() {
-
 
69
 
80
 
70
			// pour gagner du temps on n'instancie la vue en elle même que lors du premier affichage (lazy rendering)
Line 81... Line 71...
81
			// pour gagner du temps on n'instancie la vue en elle même que lors du premier affichage (lazy rendering)
71
			
82
			public void onShow(Component component) {
72
			public void onShow(Component component) {
83
 
73
 
Line 102... Line 92...
102
		// ajout de listeners pour la gestion de la selection
92
		// ajout de listeners pour la gestion de la selection
103
		// dans la galerie
93
		// dans la galerie
104
		dView.addListener(new DataViewListenerAdapter() {
94
		dView.addListener(new DataViewListenerAdapter() {
Line 105... Line 95...
105
			
95
			
-
 
96
			// gestion du clic sur une image
106
			// gestion du clic sur une image
97
			
107
			public void onClick(DataView source, int index, Element node,
98
			public void onClick(DataView source, int index, Element node,
Line 108... Line 99...
108
					EventObject e) {
99
					EventObject e) {
109
				
100
				
Line 110... Line 101...
110
				// on en notifie le médiateur
101
				// on en notifie le médiateur
Line 111... Line 102...
111
				getIMediateur().clicGalerieImage(index, node, e);
102
				getIMediateur().clicGalerieImage(index, node, e);
-
 
103
 
112
 
104
			}
113
			}
105
 
Line 114... Line 106...
114
 
106
			// gestion du clic droit
115
			// gestion du clic droit
107
			
Line 122... Line 114...
122
				getIMediateur().montrerContextMenu(e);
114
				getIMediateur().montrerContextMenu(e);
Line 123... Line 115...
123
 
115
 
Line 124... Line 116...
124
			}
116
			}
-
 
117
 
125
 
118
			// gestion du double clic
126
			// gestion du double clic
119
			
Line 127... Line 120...
127
			public void onDblClick(DataView source, int index, Element node,
120
			public void onDblClick(DataView source, int index, Element node,
128
					EventObject e) {
121
					EventObject e) {
Line 129... Line 122...
129
 
122
 
Line 130... Line 123...
130
				// on notife le mediateur
123
				// on notife le mediateur
-
 
124
				getIMediateur().clicGalerieImage(index, node, e);
131
				getIMediateur().clicGalerieImage(index, node, e);
125
				
Line 132... Line 126...
132
				
126
			}
133
			}
127
 
134
 
128
			// gestion des actions en fonction de la selection
Line 220... Line 214...
220
 
214
 
221
		// la dataview affichera les images en accord avec le template
215
		// la dataview affichera les images en accord avec le template
222
		// cree precedemment
216
		// cree precedemment
Line -... Line 217...
-
 
217
		dView = new DataView("div.thumb-wrap") {
223
		dView = new DataView("div.thumb-wrap") {
218
 
224
 
219
			
225
			public void prepareData(Data data) {
220
			public void prepareData(Data data) {
226
				data.setProperty("shortName", Format.ellipsis(data
221
				data.setProperty("shortName", Format.ellipsis(data
227
						.getProperty("num_image"), 15));
222
						.getProperty("num_image"), 15));