Subversion Repositories eFlore/Archives.cel-v2

Rev

Rev 18 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package org.tela_botanica.client.vues;

import java.util.Date;

import org.tela_botanica.client.image.ImageMediateur;
import org.tela_botanica.client.interfaces.Rafraichissable;

import com.gwtext.client.core.NameValuePair;
import com.gwtext.client.data.Store;
import com.gwtext.client.data.StringFieldDef;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.TabPanel;
import com.gwtext.client.widgets.grid.GridView;
import com.gwtext.client.widgets.grid.PropertyGridPanel;

public class PanneauMetadonneesVue extends TabPanel implements Rafraichissable {

        private ImageMediateur imediateur = null ;
        
        private PropertyGridPanel ExifGrid = null ;
        private PropertyGridPanel IptcGrid = null ;
        
        private GridView gViewExif = null ;
        private GridView gViewIptc = null ;
        
        private Panel panneauExifGrid = null; 
        private Panel panneauIptcGrid = null ;
        private Panel panneauInfoGrid = null ;
        
        boolean estInstancie = false ;
        
        public PanneauMetadonneesVue(ImageMediateur im)
        {
                super() ;
                
                imediateur = im ;
                
                panneauExifGrid = new Panel("Exif") ;
                panneauIptcGrid = new Panel("Iptc") ;
                panneauInfoGrid = new Panel("info") ;
                
                
                this.add(panneauInfoGrid) ;
                this.add(panneauExifGrid) ;
                this.add(panneauIptcGrid) ;
                
                gViewExif = new GridView();
                gViewExif.setForceFit(true);
                
                ExifGrid = new PropertyGridPanel() ;
                ExifGrid.setId("meta_exif");
                ExifGrid.setView(gViewExif);
                ExifGrid.setNameText("Métadonnées Exif");
                ExifGrid.setAutoWidth(true);
                ExifGrid.setAutoHeight(true);
                ExifGrid.setSorted(false);
                
                gViewIptc = new GridView();
                gViewIptc.setForceFit(true);
                
                IptcGrid = new PropertyGridPanel() ;
                IptcGrid.setId("meta_iptc");
                IptcGrid.setView(gViewIptc);
                
                IptcGrid.setNameText("Métadonnées IPTC");
                IptcGrid.setAutoWidth(true);
                IptcGrid.setAutoHeight(true);
                IptcGrid.setSorted(false);
                
                panneauExifGrid.add(ExifGrid);
                panneauIptcGrid.add(IptcGrid); 
                
        }
        
        public ImageMediateur getIMediateur()
        {
                return imediateur ;
        }
        
        
        public void rafraichir(Object nouvelleDonnees, boolean repandreRafraichissement) {
                
                if(nouvelleDonnees instanceof Object[])
                {
                        Object meta[] = (Object[])nouvelleDonnees ;
                        String[][] exif = (String[][])meta[0] ;
                        String[][] iptc = (String[][])meta[1] ;
                        
                        NameValuePair[] exifSource = new NameValuePair[exif.length] ;
                        NameValuePair[] iptcSource = new NameValuePair[iptc.length] ;
                        
                        
                        int maxLength ;
                        if(exif.length <= iptc.length)
                        {
                                maxLength = iptc.length ;
                        }
                        else
                        {
                                maxLength = exif.length ;
                        }
                        
                        for(int i = 0; i < maxLength ; i++)
                        {
                                if(i < exif.length)
                                {
                                        exifSource[i] = new NameValuePair(exif[i][0],exif[i][1]) ;
                                }
                                
                                if(i < iptc.length)
                                {
                                        iptcSource[i] = new NameValuePair(iptc[i][0],iptc[i][1]) ;
                                }
                        }
                        
                        
                        ExifGrid.setSource(exifSource);
                        IptcGrid.setSource(iptcSource);
                        
                        gViewExif.refresh(true) ;
                        gViewIptc.refresh(true) ;
                        
                }       
        }
}