IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

GWT et Vaadin Java Discussion :

Pb TabItem avec GWT + GXT + Gin


Sujet :

GWT et Vaadin Java

  1. #1
    Membre du Club
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juillet 2007
    Messages
    39
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Juillet 2007
    Messages : 39
    Points : 44
    Points
    44
    Par défaut Pb TabItem avec GWT + GXT + Gin
    Je développe en ce moment une application GWT (+ GXT).

    J'ai un problème d'affichage de données dans un TabPanel :
    - je lis une info en base MySQL,
    - je construis mon panel en remplissant les données avec les infos,
    - j'affiche mon panel.

    => lors de l'affichage le contenu du 1er tabItem ne s'affiche pas (ni libellé ni valeurs : seul le titre apparait), il faut cliquer sur un des autres items puis revenir au 1er pour le voir s'afficher normalement.

    Extrait du code :

    EntryPoint
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
     
    package fr.pmo.gwt.serietv.client;
     
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.core.client.GWT;
     
    import fr.pmo.gwt.serietv.client.injection.SerietvGinInjector;
    import fr.pmo.gwt.serietv.client.service.SerieServiceAsync;
    import fr.pmo.gwt.serietv.client.service.callback.FicheCallback;
     
    public class Serietv implements EntryPoint {
     
    	private final SerietvGinInjector injector = GWT.create(SerietvGinInjector.class);
     
    	final SerieServiceAsync serieService = injector.getSerieService();
     
    	public void onModuleLoad() {
     
    		new SerietvControleur(injector);
     
    		String noFiche = " 124";
    		serieService.getSerie(noFiche, new FicheCallback());
    	}
    }
    Contrôleur
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
     
    import com.google.gwt.event.logical.shared.ValueChangeEvent;
    import com.google.gwt.event.logical.shared.ValueChangeHandler;
    import com.google.gwt.user.client.History;
    import com.google.gwt.user.client.ui.RootLayoutPanel;
     
    import fr.pmo.gwt.serietv.client.fiche.FichePanel;
    import fr.pmo.gwt.serietv.client.injection.SerietvGinInjector;
    import fr.pmo.gwt.serietv.shared.Constante;
     
    public class SerietvControleur implements ValueChangeHandler<String> {
     
    	SerietvGinInjector injector;
     
    	public SerietvControleur(SerietvGinInjector injector) {
     
    		this.injector = injector;
    		History.addValueChangeHandler(this);
     
    		if ((History.getToken() != null) && (History.getToken().equals(""))) {
    			History.newItem(Constante.MenuAccueil);
    		} else {
    			History.fireCurrentHistoryState();
    		}
    	}
     
    	public void onValueChange(ValueChangeEvent<String> event) {
     
    		String token = event.getValue();
    		if (token != null) {
    			// Si le token correspond à l'affichage d'une fiche
    			if (Constante.MenuFiche.equals(token)) {
    				RootLayoutPanel rlp = RootLayoutPanel.get();
    				rlp.add(new FichePanel());
    			}
    		}
    	}
    }
    Panel
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
     
     
    import com.google.gwt.user.client.ui.FlowPanel;
     
    import fr.pmo.gwt.serietv.client.Contexte;
    import fr.pmo.gwt.serietv.shared.bean.metier.Serie;
     
    public class FichePanel extends FlowPanel {
     
    	public FichePanel() {
    		super();
     
    		setWidth("100%");
    		setHeight("100%");
     
    		Serie serie = Contexte.getSerie();
     
    		if (null != serie) {
    			add(new TitreFichePanel(serie));
    			add(new DetailFichePanel(serie));
    		}
    	}
    }
     
    import com.extjs.gxt.ui.client.widget.TabPanel;
     
    import fr.pmo.gwt.serietv.client.fiche.casting.CastingTabItem;
    import fr.pmo.gwt.serietv.client.fiche.production.ProductionTabItem;
    import fr.pmo.gwt.serietv.client.fiche.serie.SerieTabItem;
    import fr.pmo.gwt.serietv.shared.bean.metier.Serie;
     
    public class DetailFichePanel extends TabPanel {
     
    	public DetailFichePanel(Serie serie) {
    		super();
    		setPlain(true);
    		setAutoHeight(true);
     
    		add(new SerieTabItem(serie));
    		add(new ProductionTabItem(serie));
    		add(new CastingTabItem(serie));
    	}
    }
     
    import fr.pmo.gwt.serietv.client.fiche.SerietvTabItem;
    import fr.pmo.gwt.serietv.shared.bean.metier.Serie;
     
    public class SerieTabItem extends SerietvTabItem {
     
    	static String titre = "Série";
     
    	public SerieTabItem(Serie serie) {
    		super(titre);
     
    		add(new SeriePanel(serie));
    	}
    }
     
     
    import com.extjs.gxt.ui.client.widget.form.FormPanel;
    import com.extjs.gxt.ui.client.widget.form.LabelField;
    import com.extjs.gxt.ui.client.widget.form.MultiField;
    import com.google.gwt.user.client.Element;
     
    import fr.pmo.gwt.serietv.client.fiche.ConsultSerieTextField;
    import fr.pmo.gwt.serietv.client.fiche.SerietvFieldSet;
    import fr.pmo.gwt.serietv.shared.bean.metier.Serie;
    import fr.pmo.gwt.serietv.shared.bean.metier.activite.CommentaireDetail;
     
    public class SeriePanel extends FormPanel {
     
    	Serie serie;
     
    	public SeriePanel(Serie serie) {
    		super();
     
    		this.serie = serie;
     
    		setLabelWidth(150);
    		setReadOnly(true);
    		setLabelSeparator("");
    	}
     
    	protected void onRender(Element parent, int index) {
    		super.onRender(parent, index);
     
    		ConsultSerieTextField<String> titreVFTF = new ConsultSerieTextField<String>();
    		titreVFTF.setValue(serie.getTitreVF());
    		titreVFTF.setFieldLabel("Titre français");
    		add(titreVFTF);
     
    ...
    Injection
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
     
     
    import com.google.gwt.inject.client.GinModules;
    import com.google.gwt.inject.client.Ginjector;
     
    import fr.pmo.gwt.serietv.client.service.SerieServiceAsync;
     
    @GinModules({ WidgetModule.class })
    public interface SerietvGinInjector extends Ginjector {
     
    	public SerieServiceAsync getSerieService();
    }
     
    import com.google.gwt.core.client.GWT;
    import com.google.gwt.inject.client.AbstractGinModule;
    import com.google.gwt.user.client.rpc.ServiceDefTarget;
    import com.google.inject.Provides;
    import com.google.inject.Singleton;
     
    import fr.pmo.gwt.serietv.client.service.SerieService;
    import fr.pmo.gwt.serietv.client.service.SerieServiceAsync;
     
    public class WidgetModule extends AbstractGinModule {
     
    	final private static String MODULE_URL = "/serietv/";
     
    	@Provides
    	@Singleton
    	public SerieServiceAsync getSerieService() {
    		SerieServiceAsync serieService = (SerieServiceAsync) GWT.create(SerieService.class);
    		((ServiceDefTarget) serieService).setServiceEntryPoint(MODULE_URL + "serie");
    		return serieService;
    	}
    }
    Callback
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
     
    import com.google.gwt.user.client.History;
     
    import fr.pmo.gwt.serietv.client.Contexte;
    import fr.pmo.gwt.serietv.shared.Constante;
    import fr.pmo.gwt.serietv.shared.bean.metier.Serie;
     
    public class FicheCallback extends SerietvCallback<Serie> {
    	/***
             * Traitement de la reponse
             */
    	public void traiterReponse(Serie reponse) {
     
    	    Contexte.setSerie(reponse);
     
    	    History.newItem(Constante.MenuFiche);
    	    History.fireCurrentHistoryState();
    	}
    }
     
    import com.google.gwt.user.client.Window;
    import com.google.gwt.user.client.rpc.AsyncCallback;
     
    public abstract class SerietvCallback<T> implements AsyncCallback<T> {
     
    	public abstract void traiterReponse(T reponse);
     
    	public void onSuccess(T arg0) {
    		if (arg0 != null) {
    			traiterReponse(arg0);
    		} else {
    			// TODO que fait-on si la reponse est nulle ?
    		}
    	};
     
    	public void onFailure(Throwable caught) {
    		Window.alert(caught.getMessage());
    	}
    }
    Merci d'avance pour votre aide.

  2. #2
    in
    in est déconnecté
    Membre expérimenté Avatar de in
    Profil pro
    Inscrit en
    Avril 2003
    Messages
    1 612
    Détails du profil
    Informations personnelles :
    Localisation : France, Finistère (Bretagne)

    Informations forums :
    Inscription : Avril 2003
    Messages : 1 612
    Points : 1 718
    Points
    1 718
    Par défaut
    Je crois qu'il faut sélectionner le premier tab lors de la création de ton TabPanel (qqchose du genre setSelectedIndex(0)).
    "If email had been around before the telephone was invented, people would have said, 'Hey, forget email! With this new telephone invention I can actually talk to people!"

    Besoin d'une nouvelle méthode pour développer ? -> http://www.la-rache.com/

  3. #3
    Membre du Club
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juillet 2007
    Messages
    39
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Juillet 2007
    Messages : 39
    Points : 44
    Points
    44
    Par défaut
    Merci pour cette réponse mais çà marche toujours pas.

    J'ai essayé setSelection et setTabIndex mais c'est pas mieux : en fait ce n'est pas la sélection qui pose problème mais le contenu qui ne s'affiche pas.

  4. #4
    Membre du Club
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juillet 2007
    Messages
    39
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Juillet 2007
    Messages : 39
    Points : 44
    Points
    44
    Par défaut
    J'ai corrigé mais je sais pas trop pourquoi çà marchait pas :
    j'ai inclus mon SeriePanel dans mon SerieTabItem en rajoutant dans ce dernier un FormLayout.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Prise en main de JSON avec GWT
    Par GroXx dans le forum GWT et Vaadin
    Réponses: 5
    Dernier message: 05/02/2009, 12h47
  2. Upload avec gwt
    Par hebmaster dans le forum GWT et Vaadin
    Réponses: 2
    Dernier message: 04/03/2008, 16h33
  3. Commencer avec GWT sur netbeans
    Par anas.eh dans le forum GWT et Vaadin
    Réponses: 3
    Dernier message: 10/10/2007, 13h36
  4. Hibernate avec GWT
    Par Hecto dans le forum GWT et Vaadin
    Réponses: 28
    Dernier message: 06/09/2007, 18h55
  5. Utilisation de la classe Collection avec GWT
    Par rnan dans le forum GWT et Vaadin
    Réponses: 1
    Dernier message: 03/07/2007, 22h58

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo