Subversion Repositories eFlore/Applications.coel

Rev

Rev 1633 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1633 Rev 1644
Line 1... Line 1...
1
package org.tela_botanica.client.vues.projet;
1
package org.tela_botanica.client.vues.projet;
Line -... Line 2...
-
 
2
 
2
 
3
import java.text.ParseException;
3
import java.util.ArrayList;
4
import java.util.ArrayList;
-
 
5
import java.util.Arrays;
4
import java.util.Arrays;
6
import java.util.Comparator;
5
import java.util.Iterator;
7
import java.util.Iterator;
Line 6... Line 8...
6
import java.util.List;
8
import java.util.List;
7
 
9
 
Line 30... Line 32...
30
import com.extjs.gxt.ui.client.event.Listener;
32
import com.extjs.gxt.ui.client.event.Listener;
31
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
33
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
32
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
34
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
33
import com.extjs.gxt.ui.client.event.SelectionListener;
35
import com.extjs.gxt.ui.client.event.SelectionListener;
34
import com.extjs.gxt.ui.client.store.ListStore;
36
import com.extjs.gxt.ui.client.store.ListStore;
-
 
37
import com.extjs.gxt.ui.client.store.StoreSorter;
35
import com.extjs.gxt.ui.client.widget.ContentPanel;
38
import com.extjs.gxt.ui.client.widget.ContentPanel;
36
import com.extjs.gxt.ui.client.widget.Info;
39
import com.extjs.gxt.ui.client.widget.Info;
37
import com.extjs.gxt.ui.client.widget.button.Button;
40
import com.extjs.gxt.ui.client.widget.button.Button;
38
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
41
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
39
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
42
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
Line 123... Line 126...
123
				clicListe(projetSelectionne);
126
				clicListe(projetSelectionne);
124
			}
127
			}
125
		});
128
		});
Line 126... Line 129...
126
		
129
		
-
 
130
		store = new ListStore<Projet>();
-
 
131
		Comparator<Object> compStp = new Comparator<Object>() {
-
 
132
			@Override
-
 
133
			public int compare(Object o1, Object o2) {
-
 
134
				return comparerNaturellementChampProjet(o1,o2);
-
 
135
			}
-
 
136
		};
-
 
137
		StoreSorter<Projet> stp = new StoreSorter<Projet>(compStp);
127
		store = new ListStore<Projet>();
138
		store.setStoreSorter(stp);
Line 128... Line 139...
128
		store.sort("id_projet", SortDir.ASC);
139
		store.sort("id_projet", SortDir.ASC);
129
		
140
		
130
		grille = new Grid<Projet>(store, modeleDesColonnes);
141
		grille = new Grid<Projet>(store, modeleDesColonnes);
Line 151... Line 162...
151
		// Définition de la barre de pagination
162
		// Définition de la barre de pagination
152
		pagination = new BarrePaginationVue(projetListe, mediateur);
163
		pagination = new BarrePaginationVue(projetListe, mediateur);
153
		setBottomComponent(pagination);
164
		setBottomComponent(pagination);
154
	}
165
	}
Line -... Line 166...
-
 
166
	
-
 
167
	private int comparerNaturellementChampProjet(Object o1, Object o2) {
-
 
168
		int compare = 0;
-
 
169
		String s1 = (String)o1;
-
 
170
		String s2 = (String)o2;
-
 
171
		try {
-
 
172
			Integer i1 = Integer.parseInt(s1); 
-
 
173
			Integer i2 = Integer.parseInt(s2);
-
 
174
			compare = i1.compareTo(i2);
-
 
175
		} catch (NumberFormatException e) {
-
 
176
			compare = s1.compareTo(s2);
-
 
177
		}		
-
 
178
		return compare;
-
 
179
	}
155
	
180
	
156
	public ListStore<Projet> getStore() {
181
	public ListStore<Projet> getStore() {
157
		return store;
182
		return store;
Line 158... Line 183...
158
	}
183
	}