11,6 → 11,7 |
import org.tela_botanica.client.modeles.ListeImageCarnet; |
|
|
import com.google.gwt.core.client.JavaScriptObject; |
import com.google.gwt.user.client.Window; |
import com.gwtext.client.core.EventObject; |
import com.gwtext.client.data.ArrayReader; |
22,7 → 23,11 |
import com.gwtext.client.data.Store; |
import com.gwtext.client.data.StoreMgr; |
import com.gwtext.client.data.StringFieldDef; |
import com.gwtext.client.widgets.BoxComponent; |
import com.gwtext.client.widgets.Component; |
import com.gwtext.client.widgets.Container; |
import com.gwtext.client.widgets.Panel; |
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.event.PanelListener; |
33,9 → 38,12 |
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.grid.RowSelectionModel; |
import com.gwtext.client.widgets.grid.event.GridCellListener; |
import com.gwtext.client.widgets.grid.event.GridListener; |
import com.gwtext.client.widgets.grid.event.GridRowListener; |
import com.gwtext.client.widgets.grid.event.RowSelectionListener; |
import com.gwtext.client.widgets.grid.event.RowSelectionListenerAdapter; |
import com.gwtext.client.widgets.layout.AnchorLayout; |
import com.gwtext.client.widgets.layout.FitLayout; |
import com.gwtextux.client.data.BufferedStore; |
101,45 → 109,32 |
this.setAutoWidth(true); |
|
|
FieldDef defNumImage = new StringFieldDef("num_image"); |
// creation du store |
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 defUrlImageS = new StringFieldDef("url_image_S"); |
FieldDef defUrlImage = new StringFieldDef("url_imag"); |
FieldDef[] defTab = {defNumImage,defDatImage,defLieImage,defAppImage,defUrlImageS,defUrlImage}; |
FieldDef defUrlImageM = new StringFieldDef("url_image_M"); |
FieldDef defUrlImage = new StringFieldDef("url_image"); |
FieldDef[] defTab = {defNumImage,defDatImage,defLieImage,defAppImage,defUrlImageS,defUrlImageM,defUrlImage}; |
RecordDef rd = new RecordDef(defTab) ; |
st = new Store(rd) ; |
this.setStore(st); |
this.getView().setAutoFill(true) ; |
|
this.setLoadMask(true) ; |
//this.setLoadMask(true) ; |
this.setLoadMask("chargement") ; |
|
ajouterListeners() ; |
|
} |
|
|
// role : configurer les colonnes affichées dans la grille |
private void initialiser() { |
|
getIMediateur().obtenirPhotoGalerie(this); |
estInstancie = true ; |
|
|
} |
|
public void ajouterListeners() |
{ |
{ |
this.addListener(new ContainerListenerAdapter() { |
|
|
public boolean doBeforeRender(Component component) |
{ |
initialiser(); |
return true ; |
} |
|
public void onHide(Component component) { |
// TODO Auto-generated method stub |
146,16 → 141,22 |
|
} |
|
|
public void onRender(Component component) { |
|
public void onRender(Component component) { |
// TODO Auto-generated method stub |
|
if(!isEstInstancie()) |
{ |
setEstInstancie(true) ; |
getIMediateur().synchroniserSelection("galerie") ; |
} |
} |
|
|
|
public void onShow(Component component) { |
|
|
} |
|
|
}); |
|
163,25 → 164,44 |
|
|
public void onRowClick(GridPanel grid, int rowIndex, EventObject e) { |
|
getIMediateur().clicListeImage(rowIndex, e) ; |
; |
getIMediateur().clicListeImage(rowIndex) ; |
} |
|
public void onRowContextMenu(GridPanel grid, int rowIndex, |
EventObject e) { |
// TODO Auto-generated method stub |
|
getIMediateur().montrerContextMenu(e) ; |
|
} |
|
public void onRowDblClick(GridPanel grid, int rowIndex, |
EventObject e) { |
|
getIMediateur().doubleClicListeImage(rowIndex, e) ; |
|
getIMediateur().doubleClicListeImage(rowIndex) ; |
|
|
} |
|
}); |
|
this.getSelectionModel().addListener(new RowSelectionListenerAdapter() { |
|
public void onSelectionChange(RowSelectionModel sm) { |
|
if(sm.getCount() <= 0) |
{ |
getIMediateur().aucuneSelection() ; |
} |
else |
{ |
getIMediateur().selection() ; |
getIMediateur().synchroniserSelection("liste"); |
} |
|
} |
|
|
}); |
} |
|
202,45 → 222,17 |
|
public void rafraichir(Object nouvelleDonnees, boolean repandreRafraichissement) { |
|
if(nouvelleDonnees instanceof ListeImageCarnet && estInstancie) |
if(nouvelleDonnees instanceof Store) |
{ |
ListeImageCarnet data = (ListeImageCarnet) nouvelleDonnees ; |
Object[][] photoData = new Object[data.size()][6]; |
int i = 0 ; |
for (Iterator it = data.keySet().iterator(); it.hasNext();) |
{ |
ImageCarnet im = (ImageCarnet) data.get(it.next()); |
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.getSUrl() ; |
photoData[i][5] = im.getUrl() ; |
|
i++ ; |
} |
|
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_S"); |
FieldDef defUrlImageL = new StringFieldDef("url_image"); |
FieldDef[] defTab = {defNumImage,defDatImage,defLieImage,defAppImage,defUrlImage,defUrlImageL}; |
|
final MemoryProxy dataProxy = new MemoryProxy(photoData); |
final ArrayReader reader = new ArrayReader(new RecordDef(defTab)); |
|
final Store photoStore = new Store(dataProxy, reader); |
|
st = photoStore; |
st = (Store)nouvelleDonnees; |
st.load(); |
this.reconfigure(st, this.getColumnModel()); |
photoStore.load(); |
} |
|
if(repandreRafraichissement) |
{ |
getIMediateur().synchroniserZoomListeGalerie(nouvelleDonnees, this) ; |
getIMediateur().synchroniserDonneesZoomListeGalerie(nouvelleDonnees, this) ; |
} |
} |
|
273,6 → 265,39 |
public ColumnConfig getCl() { |
return cl; |
} |
|
|
/** |
* @return the estInstancie |
*/ |
public boolean isEstInstancie() { |
return estInstancie; |
} |
|
|
/** |
* @param estInstancie the estInstancie to set |
*/ |
public void setEstInstancie(boolean estInstancie) { |
this.estInstancie = estInstancie; |
} |
|
|
/** |
* @param mediateur the iMediateur to set |
*/ |
public void setIMediateur(ImageMediateur mediateur) { |
iMediateur = mediateur; |
} |
|
public void selectionnerEnregistrements(Record[] sel) { |
|
if(isEstInstancie()) |
{ |
getSelectionModel().clearSelections() ; |
getSelectionModel().selectRecords(sel) ; |
} |
} |
|
|
|