6,12 → 6,18 |
import org.tela_botanica.client.interfaces.Rafraichissable; |
|
|
import com.gwtext.client.data.ArrayReader; |
import com.gwtext.client.data.FieldDef; |
import com.gwtext.client.data.MemoryProxy; |
import com.gwtext.client.data.Record; |
import com.gwtext.client.data.RecordDef; |
import com.gwtext.client.data.Store; |
import com.gwtext.client.data.StoreMgr; |
import com.gwtext.client.data.StringFieldDef; |
import com.gwtext.client.widgets.Component; |
import com.gwtext.client.widgets.event.ContainerListenerAdapter; |
import com.gwtext.client.widgets.event.PanelListener; |
import com.gwtext.client.widgets.event.PanelListenerAdapter; |
import com.gwtext.client.widgets.grid.CellMetadata; |
import com.gwtext.client.widgets.grid.ColumnConfig; |
import com.gwtext.client.widgets.grid.ColumnModel; |
42,17 → 48,10 |
public ListeImageVue(ImageMediateur im) { |
|
this.iMediateur = im ; |
configurerColonnes(); |
configurerStore(); |
|
|
setAutoWidth(true); |
setAutoHeight(true); |
} |
|
|
// role : configurer les colonnes affichées dans la grille |
private void configurerColonnes() { |
setAutoHeight(true); |
|
numImage = new ColumnConfig("numéro d'image","num_image",150,true); |
urlImage = new ColumnConfig("Image","url_image",150,true,new Renderer() { |
60,7 → 59,7 |
public String render(Object value, CellMetadata cellMetadata, |
Record record, int rowIndex, int colNum, Store store) { |
|
String ImgUrl = record.getAsString("Miniature"); |
String ImgUrl = record.getAsString("url_image"); |
return "<img src=\""+ImgUrl+"\" title='example'>"; |
} |
|
78,22 → 77,90 |
st = new Store(rd) ; |
this.setStore(st); |
|
|
ajouterListeners() ; |
} |
|
|
// role : préparer le store et faire l'appel aux données nécessaires |
private void configurerStore() { |
// role : configurer les colonnes affichées dans la grille |
private void initialiser() { |
|
getIMediateur().ObtenirPhotoGalerie(this); |
|
|
} |
|
public void ajouterListeners() |
{ |
this.addListener(new ContainerListenerAdapter() { |
|
|
public void onHide(Component component) { |
// TODO Auto-generated method stub |
|
} |
|
|
public void onRender(Component component) { |
// TODO Auto-generated method stub |
|
} |
|
|
public void onShow(Component component) { |
|
|
initialiser(); |
} |
|
}); |
} |
|
|
public void rafraichir(Object nouvelleDonnees) { |
// TODO Auto-generated method stub |
|
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); |
photoStore.load(); |
|
st = photoStore; |
this.reconfigure(st, modeleColonnes); |
} |
|
|
public ImageMediateur getIMediateur() { |
return iMediateur; |
} |
|
|
public ColumnConfig getNumImage() { |
return numImage; |
} |
|
|
public ColumnConfig getUrlImage() { |
return urlImage; |
} |
|
|
public ColumnModel getModeleColonnes() { |
return modeleColonnes; |
} |
|
|
public Store getSt() { |
return st; |
} |
|
|
public ColumnConfig getCl() { |
return cl; |
} |
|
|
|