Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 5 → Rev 61

/trunk/src/org/tela_botanica/client/vues/MiniListeObservationVue.java
1,8 → 1,13
package org.tela_botanica.client.vues;
 
import java.util.Iterator;
 
import org.tela_botanica.client.image.ImageMediateur;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.ListeObservation;
import org.tela_botanica.client.modeles.Observation;
 
import com.google.gwt.user.client.Window;
import com.gwtext.client.data.SimpleStore;
import com.gwtext.client.data.Store;
import com.gwtext.client.dd.DragSource;
9,6 → 14,8
import com.gwtext.client.dd.DropTarget;
import com.gwtext.client.dd.DropTargetConfig;
import com.gwtext.client.widgets.Component;
import com.gwtext.client.widgets.event.ComponentListenerAdapter;
import com.gwtext.client.widgets.event.ContainerListener;
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
import com.gwtext.client.widgets.grid.ColumnConfig;
import com.gwtext.client.widgets.grid.ColumnModel;
40,6 → 47,8
*/
private ColumnModel colModel = null ;
private SimpleStore store = null ;
/**
* Constructeur avec arguments
* @param im le médiateur à associer à la vue
51,10 → 60,11
this.setId("x-view-mini-obs") ;
// on crée un store simple contenant un petit set de données et deux colonnes
final Store store = new SimpleStore(new String[]{"id_obs","plante"}, getObs());
store = new SimpleStore(new String[]{"id_obs","plante","date"}, getObs());
ColumnConfig[] columns = {
new ColumnConfig("Numero", "id_obs", 65, true),
new ColumnConfig("Taxon", "plante", 150, true) } ;
new ColumnConfig("Numero", "id_obs", 55, true),
new ColumnConfig("Taxon", "plante", 150, true),
new ColumnConfig("Date", "date", 68, true) } ;
ColumnModel columnModel = new ColumnModel(columns);
63,7 → 73,7
setTitle("Observations");
// on associe le modèle de colonnes
setColumnModel(columnModel);
setHeight(390);
setAutoHeight(true);
setWidth(200);
// on autorise le drag 'n drop pour un certain groupe
this.setEnableDragDrop(true);
73,6 → 83,16
// on configure le drag 'n drop
configDragAndDrop() ;
this.addListener(new ComponentListenerAdapter() {
public void onRender(Component c) {
obtenirMiniListeObservations() ;
}
}) ;
}
130,10 → 150,38
*/
public void rafraichir(Object nouvelleDonnees,
boolean repandreRaffraichissement) {
// TODO Auto-generated method stub
if(nouvelleDonnees instanceof ListeObservation)
{
ListeObservation data = (ListeObservation)nouvelleDonnees ;
String[][] listeObs = new String[data.size()][3] ;
int i = 0 ;
for (Iterator it = data.keySet().iterator(); it.hasNext();)
{
Observation obs=(Observation) data.get(it.next());
listeObs[i][0] = obs.getNumeroOrdre();
listeObs[i][1] = obs.getNomSaisi();
listeObs[i][2] = obs.getDate() ;
i++ ;
}
 
store = new SimpleStore(new String[]{"id_obs","plante","date"}, listeObs);
store.load();
this.reconfigure(store, colModel) ;
}
}
private void obtenirMiniListeObservations()
{
iMediateur.obtenirMiniListeObservations(this) ;
}
/**
* Renvoie le faux set de données pour le store
* @return un tableau à deux colonnes int - String
140,21 → 188,10
*/
private Object[][] getObs() {
return new Object[][]{
new Object[]{"1","Plantum bizarrum"},
new Object[]{"2","Feuillum etrangum"},
new Object[]{"3","Spirus cotapilis"},
new Object[]{"4","Birita raborum"},
new Object[]{"5","Spacea sinea"},
new Object[]{"6","Spacea subtea"},
new Object[]{"7","Buissnum petitum"},
new Object[]{"8","Acer monspessulanum"},
new Object[]{"9","Geranium prouticorum"},
new Object[]{"10","Rosae epania"},
new Object[]{"11","Rosea rougea"},
new Object[]{"12","Liciea rosa"},
new Object[]{"13","Liciea bella"}
} ;
}
 
}