Subversion Repositories eFlore/Archives.cel-v2

Compare Revisions

Ignore whitespace Rev 11 → Rev 12

/trunk/src/org/tela_botanica/client/vues/ListeImageVue.java
2,13 → 2,18
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.ImageCarnet;
import org.tela_botanica.client.modeles.ListeImage;
 
 
import com.google.gwt.user.client.Window;
import com.gwtext.client.data.ArrayReader;
import com.gwtext.client.data.FieldDef;
import com.gwtext.client.data.IntegerFieldDef;
import com.gwtext.client.data.MemoryProxy;
import com.gwtext.client.data.Record;
import com.gwtext.client.data.RecordDef;
26,8 → 31,15
import com.gwtext.client.widgets.grid.GridPanel;
import com.gwtext.client.widgets.grid.GridView;
import com.gwtext.client.widgets.grid.Renderer;
import com.gwtext.client.widgets.layout.AnchorLayout;
import com.gwtext.client.widgets.layout.FitLayout;
import com.gwtextux.client.data.BufferedStore;
 
/**
* Liste d'image composée de miniatures et d'information sur l'image
* @author aurelien
*
*/
public class ListeImageVue extends GridPanel implements Rafraichissable {
38,6 → 50,9
private ColumnConfig numImage ;
private ColumnConfig urlImage ;
private ColumnConfig lieImage ;
private ColumnConfig datImage ;
private ColumnConfig appImage ;
private ColumnModel modeleColonnes ;
50,40 → 65,43
public ListeImageVue(ImageMediateur im) {
super() ;
this.iMediateur = im ;
/*setAutoWidth(true);
setAutoHeight(true);*/
numImage = new ColumnConfig("numéro d'image","num_image",150,true);
numImage.setId("expCol");
urlImage = new ColumnConfig("Image","url_image",150,true,new Renderer() {
numImage = new ColumnConfig("numéro","num_image",100,true);
datImage = new ColumnConfig("date","dat_image",120,true);
lieImage = new ColumnConfig("lieu","lie_image",120,true);
appImage = new ColumnConfig("appareil","app_image",200,true);
urlImage = new ColumnConfig("Image","url_image",200,true,new Renderer() {
 
public String render(Object value, CellMetadata cellMetadata,
Record record, int rowIndex, int colNum, Store store) {
 
String ImgUrl = record.getAsString("url_image");
return "<div class=\"img-list\"> <img src=\""+ImgUrl+"\" title='example'> </div>";
String ImgNum = record.getAsString("num_image");
return "<div class=\"img-list\"> <img src=\""+ImgUrl+"\" title='"+ImgNum+"'> </div>";
}
 
});
ColumnConfig[] cm = {numImage,urlImage};
ColumnConfig[] cm = {numImage,datImage,lieImage,appImage,urlImage};
modeleColonnes = new ColumnModel(cm);
this.setColumnModel(modeleColonnes);
this.setAutoExpandColumn("expCol");
this.setAutoScroll(true);
this.setAutoWidth(true);
this.setAutoHeight(true);
FieldDef defNumImage = new StringFieldDef("num_image");
FieldDef defDatImage = new StringFieldDef("dat_image");
FieldDef defLieImage = new StringFieldDef("lie_image");
FieldDef defAppImage = new StringFieldDef("app_image");
FieldDef defUrlImage = new StringFieldDef("url_image");
FieldDef[] defTab = {defNumImage,defUrlImage};
FieldDef[] defTab = {defNumImage,defDatImage,defLieImage,defAppImage,defUrlImage};
RecordDef rd = new RecordDef(defTab) ;
st = new Store(rd) ;
this.setStore(st);
this.getView().setAutoFill(true) ;
ajouterListeners() ;
131,18 → 149,36
 
public void rafraichir(Object nouvelleDonnees) {
Object[][] photoData = (Object[][])nouvelleDonnees ;
 
final MemoryProxy dataProxy = new MemoryProxy(photoData);
final ArrayReader reader = new ArrayReader(new RecordDef(
new FieldDef[]{new StringFieldDef("num_image"),
new StringFieldDef("url_image")}));
 
final Store photoStore = new Store(dataProxy, reader);
 
st = photoStore;
this.reconfigure(st, this.getColumnModel());
photoStore.load();
if(nouvelleDonnees instanceof ListeImage)
{
ListeImage data = (ListeImage) nouvelleDonnees ;
Object[][] photoData = new Object[data.size()][5];
for(int i = 0 ; i<data.size();i++)
{
ImageCarnet im = (ImageCarnet) data.elementAt(i);
photoData[i][0] = im.getOrdre() ;
photoData[i][1] = im.getDate() ;
photoData[i][2] = im.getIptcCity() ;
photoData[i][3] = im.getMake()+" "+im.getModel() ;
photoData[i][4] = im.getUrl() ;
}
FieldDef defNumImage = new IntegerFieldDef("num_image");
FieldDef defDatImage = new StringFieldDef("dat_image");
FieldDef defLieImage = new StringFieldDef("lie_image");
FieldDef defAppImage = new StringFieldDef("app_image");
FieldDef defUrlImage = new StringFieldDef("url_image");
FieldDef[] defTab = {defNumImage,defDatImage,defLieImage,defAppImage,defUrlImage};
final MemoryProxy dataProxy = new MemoryProxy(photoData);
final ArrayReader reader = new ArrayReader(new RecordDef(defTab));
final Store photoStore = new Store(dataProxy, reader);
st = photoStore;
this.reconfigure(st, this.getColumnModel());
photoStore.load();
}
}